Explorar el Código

Merge remote-tracking branch 'origin/feature-201824-wangcz' into feature-201824-wangcz

wangcz hace 7 años
padre
commit
825e077c1b

+ 8 - 16
src/main/java/com/uas/platform/b2c/fa/payment/service/impl/BankInfoServiceImpl.java

@@ -64,25 +64,16 @@ public class BankInfoServiceImpl implements BankInfoService {
 	public BankInfo save(BankInfo bankInfo, Integer type, FileUpload... fileItem) {
 		bankInfo.setOpraterUserType(type);
 		bankInfo.setCreateTime(new Date());
-		if(type == Type.BUYER.value()) {
+		type = Type.SUP.value();
+		if(SystemSession.getUser().getEnterprise() == null) {
 			if(bankInfo.getId() == null) {
-				if (SystemSession.getUser().getEnterprise() != null){
-					int num = bankInfoDao.getCountByUseruuAndStatus(SystemSession.getUser().getUserUU(), SystemSession.getUser().getEnterprise().getUu(), bankInfo.getOpraterUserType(), Status.ALLOW.value()) + 1;
-					bankInfo.setNum(num);
-				}else {
-					int num = bankInfoDao.getCountByUseruuAndStatusAndDissociative(SystemSession.getUser().getUserUU(), Type.PERSONAL.value(), bankInfo.getOpraterUserType(), Status.ALLOW.value()) + 1;
-					bankInfo.setNum(num);
-				}
+				int num = bankInfoDao.getCountByUseruuAndStatusAndDissociative(SystemSession.getUser().getUserUU(), Type.PERSONAL.value(), bankInfo.getOpraterUserType(), Status.ALLOW.value()) + 1;
+				bankInfo.setNum(num);
 			}
 			bankInfo.setUseruu(SystemSession.getUser().getUserUU());
-			bankInfo.setEnuu(SystemSession.getUser().getEnterprise() != null ? SystemSession.getUser().getEnterprise().getUu() : null);
-			if (bankInfo.getEnuu() == null) {
-				bankInfo.setDissociative(Type.PERSONAL.value());
-			} else {
-				bankInfo.setDissociative(Type.ENTERPRISING.value());
-			}
+			bankInfo.setDissociative(Type.PERSONAL.value());
 			bankInfo.setStatus(Status.ALLOW.value());
-		}else if(type == Type.SUP.value()) {
+		}else {
 			bankInfo.setEnuu(SystemSession.getUser().getEnterprise().getUu());
 			bankInfo.setDissociative(Type.ENTERPRISING.value());
 			if(bankInfo.getId() == null) {
@@ -198,7 +189,8 @@ public class BankInfoServiceImpl implements BankInfoService {
 		}else {
 			enuu = params[0];
 		}
-		if(operatorUserType == Type.BUYER.value()) {
+		//如果是个人用户登录
+		if(SystemSession.getUser().getEnterprise() == null) {
 			if (enuu != null) {
 				return bankInfoDao.findByUseruuAndEnuuAndOpraterUserTypeAndStatusOrderByNumAsc(SystemSession.getUser().getUserUU(), enuu, operatorUserType, status);
 			} else {

+ 4 - 4
src/main/java/com/uas/platform/b2c/fa/settlement/controller/BillController.java

@@ -103,14 +103,14 @@ public class BillController {
 	}
 
 	/**
-	 * 根据当前登录信息,获取个人当前登录企业的发票列表
+	 * 根据当前登录信息,当前登录企业的发票列表
 	 *
-	 * @return 个人当前登录企业的发票列表
+	 * @return 当前登录企业的发票列表(或个人发票)
 	 */
-	@RequestMapping(value = "/list/personal", method = RequestMethod.GET)
+	@RequestMapping(value = "/list", method = RequestMethod.GET)
 	@ApiOperation(value = "根据当前登录信息,获取个人当前登录企业的发票列表", httpMethod = "GET")
 	public List<Bill> getBills() {
-		logger.log("发票管理", "根据个人uu和企业的uu,获取发票资料信息");
+		logger.log("发票管理", "当前登录企业的发票列表");
 		return billService.getBills();
 	}
 

+ 18 - 0
src/main/java/com/uas/platform/b2c/fa/settlement/dao/BillDao.java

@@ -27,6 +27,15 @@ public interface BillDao extends JpaSpecificationExecutor<Bill>, JpaRepository<B
      */
     public List<Bill> getBillByUseruuAndEnuu(Long useruu, Long enuu);
 
+
+	/**
+	 * 根据用户UU号和企业UU号获取发票列表
+	 *
+	 * @param enuu   the enuu 企业enuu
+	 * @return the bill by useruu and enuu
+	 */
+	List<Bill> getBillByEnuu(Long enuu);
+
     /**
      * 根据个人UU号和是否个人用户获取发票列表
      *
@@ -55,6 +64,15 @@ public interface BillDao extends JpaSpecificationExecutor<Bill>, JpaRepository<B
      */
     public List<Bill> getBillByUseruuAndEnuuAndKind(Long useruu, Long enuu, Integer kind);
 
+	/**
+	 * 根据企业UU号和发票类型(增值税专用 和 增值税普通)获取发票列表
+	 *
+	 * @param enuu   the enuu 企业enuu
+	 * @param kind   the kind 发票类型
+	 * @return the bill by useruu and enuu and kind
+	 */
+	List<Bill> getBillByEnuuAndKind(Long enuu, Integer kind);
+
     /**
      * 根据个人UU号和企业UU号和发票类型(增值税专用 和 增值税普通) 和是否个人用户获取发票列表
      *

+ 2 - 2
src/main/java/com/uas/platform/b2c/fa/settlement/service/impl/BillServiceImpl.java

@@ -63,7 +63,7 @@ public class BillServiceImpl implements BillService {
 		if (bill.getId() == null) {
 			List<Bill> billList = new ArrayList<Bill>();
 			if (Type.ENTERPRISING.value() == bill.getDissociative())
-				billList = billDao.getBillByUseruuAndEnuuAndKind(useruu, enuu, bill.getKind());
+				billList = billDao.getBillByEnuuAndKind(enuu, bill.getKind());
 			if (Type.PERSONAL.value() == bill.getDissociative())
 				billList = billDao.getBillByUseruuAndEnuuAndKindAndDissociative(useruu, Type.PERSONAL.value(),bill.getKind());
 			if (billList.size() > 0) {
@@ -85,7 +85,7 @@ public class BillServiceImpl implements BillService {
 	public List<Bill> getBills() {
 		Long useruu = SystemSession.getUser().getUserUU();
 		if (SystemSession.getUser().getEnterprise() != null) {
-			return billDao.getBillByUseruuAndEnuu(useruu, SystemSession.getUser().getEnterprise().getUu());
+			return billDao.getBillByEnuu(SystemSession.getUser().getEnterprise().getUu());
 		} else {
 			return billDao.getBillByUseruuAndDissociative(useruu, Type.PERSONAL.value());
 		}

+ 2 - 11
src/main/java/com/uas/platform/b2c/logistics/controller/AddressController.java

@@ -9,7 +9,6 @@ import com.uas.platform.b2c.logistics.service.AddressService;
 import com.uas.platform.core.logging.BufferedLoggerManager;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.PageParams;
-import com.uas.platform.core.model.Type;
 import com.wordnik.swagger.annotations.ApiOperation;
 import com.wordnik.swagger.annotations.ApiParam;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -189,11 +188,7 @@ public class AddressController {
 	@ApiOperation(value = "获取企业发货地址的信息", httpMethod = "GET")
 	public Page<Address> getEnterpriseSendAddress(@ApiParam(required = true, value = "分页参数") PageParams page) {
 		logger.log("地址管理", "获取一页的企业发货地址信息");
-		PageInfo info = new PageInfo(page);
-		info.filter("enuu", SystemSession.getUser().getEnterprise().getUu());
-		info.filter("type", Type.Address_Sending_Code.value());
-		info.filter("usetype", (short)2);
-		return addressService.getEnterprise(info);
+		return addressService.getEnterpriseSendAddress(page);
 	}
 
 	/**
@@ -206,11 +201,7 @@ public class AddressController {
 	@ApiOperation(value = "获取企业收货地址信息", httpMethod = "GET")
 	public Page<Address> getEnterpriseReceiveAddress(@ApiParam(required = true, value = "分页参数") PageParams page) {
 		logger.log("地址管理", "获取一页的企业收货地址信息");
-		PageInfo info = new PageInfo(page);
-		info.filter("enuu", SystemSession.getUser().getEnterprise().getUu());
-		info.filter("type", Type.Address_Shipping_Code.value());
-		info.filter("usetype", (short)2);
-		return addressService.getEnterprise(info);
+		return addressService.getEnterpriseReceiveAddress(page);
 	}
 
 	/**

+ 21 - 4
src/main/java/com/uas/platform/b2c/logistics/service/AddressService.java

@@ -1,11 +1,11 @@
 package com.uas.platform.b2c.logistics.service;
 
-import java.util.List;
-
-import org.springframework.data.domain.Page;
-
 import com.uas.platform.b2c.logistics.model.Address;
 import com.uas.platform.core.model.PageInfo;
+import com.uas.platform.core.model.PageParams;
+import org.springframework.data.domain.Page;
+
+import java.util.List;
 
 /**
  * The interface AddressService.
@@ -97,6 +97,23 @@ public interface AddressService {
 	 */
 	public Page<Address> getEnterprise(final PageInfo info);
 
+	/**
+	 * 获取企业收货地址信息
+	 *
+	 * @param page the page 一页的参数
+	 * @return Page 返回Address的page对象
+	 */
+	Page<Address> getEnterpriseReceiveAddress(PageParams page);
+
+
+	/**
+	 * 获取企业发货地址的信息
+	 *
+	 * @param page 一页的参数
+	 * @return Page 返回Address的page对象
+	 */
+	Page<Address> getEnterpriseSendAddress(PageParams page);
+
 	/**
 	 * 2016年5月20日 下午6:38:48
 	 * 获取企业的默认账户

+ 51 - 3
src/main/java/com/uas/platform/b2c/logistics/service/impl/AddressServiceImpl.java

@@ -8,6 +8,7 @@ import com.uas.platform.b2c.logistics.model.Address;
 import com.uas.platform.b2c.logistics.service.AddressService;
 import com.uas.platform.core.model.Constant;
 import com.uas.platform.core.model.PageInfo;
+import com.uas.platform.core.model.PageParams;
 import com.uas.platform.core.model.Type;
 import com.uas.platform.core.persistence.criteria.CriterionExpression;
 import com.uas.platform.core.persistence.criteria.SimpleExpression;
@@ -149,9 +150,16 @@ public class AddressServiceImpl implements AddressService {
 				}
 			}else {
 				address.setUseruu(user.getUserUU());
-				address.setEnuu(user.getEnterprise().getUu());
-				address.setUsetype((short)2);
-				num = addressDao.getCountByEnuuAndTypeAndUsetype(user.getEnterprise().getUu(), address.getType(), address.getUsetype());
+				if (user.getEnterprise() != null) {
+					address.setEnuu(user.getEnterprise().getUu());
+					address.setUsetype((short)2);
+					num = addressDao.getCountByEnuuAndTypeAndUsetype(user.getEnterprise().getUu(), address.getType(), address.getUsetype());
+				} else {
+					address.setDissociative(Type.PERSONAL.value());
+					address.setUsetype((short)1);
+					num =addressDao.getCountByUseruuTypeUsetypeAndDissociative(user.getUserUU(),address.getType(), address.getUsetype(), Type.PERSONAL.value());
+				}
+
 			}
 			address.setNum(num == 0 ? 1 : ++num);
 		}
@@ -237,6 +245,46 @@ public class AddressServiceImpl implements AddressService {
 		}, info);
 	}
 
+	/**
+	 * 获取企业收货地址信息
+	 *
+	 * @param page the page 一页的参数
+	 * @return Page 返回Address的page对象
+	 */
+	@Override
+	public Page<Address> getEnterpriseReceiveAddress(PageParams page) {
+		PageInfo info = new PageInfo(page);
+		info.filter("type", Type.Address_Shipping_Code.value());
+		if (SystemSession.getUser().getEnterprise() != null) {
+			info.filter("enuu", SystemSession.getUser().getEnterprise().getUu());
+			info.filter("usetype", (short)2);
+		} else {
+			info.filter("useruu", SystemSession.getUser().getUserUU());
+			info.filter("usetype", (short)1);
+		}
+		return getEnterprise(info);
+	}
+
+	/**
+	 * 获取企业发货地址的信息
+	 *
+	 * @param page 一页的参数
+	 * @return Page 返回Address的page对象
+	 */
+	@Override
+	public Page<Address> getEnterpriseSendAddress(PageParams page) {
+		PageInfo info = new PageInfo(page);
+		info.filter("type", Type.Address_Sending_Code.value());
+		if (SystemSession.getUser().getEnterprise() != null) {
+			info.filter("enuu", SystemSession.getUser().getEnterprise().getUu());
+			info.filter("usetype", (short)2);
+		} else {
+			info.filter("useruu", SystemSession.getUser().getUserUU());
+			info.filter("usetype", (short)1);
+		}
+		return getEnterprise(info);
+	}
+
 	@Override
 	public List<Address> findDefaultEnterpriseAddress(boolean bool) {
 		// boo判断查询的是收货地址还是发货地址(默认收货地址)

+ 10 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/controller/ProductController.java

@@ -420,4 +420,14 @@ public class ProductController {
 	public ResultMap updateProduct(@RequestBody String json, String attachUrl){
 		return productService.updateProduct(json, attachUrl);
 	}
+
+	/**
+	 * 根据关键字匹配器件型号,获取物料信息
+	 * @param keyword
+	 * @return
+	 */
+	@RequestMapping(value = "/keyword", method = RequestMethod.GET)
+	public List<Product> getProductsByKeyword(String keyword) {
+		return new ArrayList<>();
+	}
 }

+ 2 - 0
src/main/java/com/uas/platform/b2c/prod/product/common/api/CommonCountController.java

@@ -98,11 +98,13 @@ public class CommonCountController {
         storeCounts.setItem("店铺");
         storeCounts.setCount(Double.valueOf(storeCount));
         storeCounts.setUsedFor("b2c_index");
+        storeCounts.setDetno((short) 4);
         commonCounts.add(storeCounts);
 
         Integer enCount = vendorIntroductionService.getVendorCount();
         CommonCount vendorCounts = new CommonCount();
         vendorCounts.setItem("供应商");
+        vendorCounts.setDetno((short) 2);
         vendorCounts.setUsedFor("mall_home_banner");
         vendorCounts.setCount(Double.valueOf(enCount));
         commonCounts.add(vendorCounts);

+ 7 - 7
src/main/java/com/uas/platform/b2c/prod/store/facade/StoreApplyFacade.java

@@ -30,13 +30,13 @@ public interface StoreApplyFacade {
 	ResultMap confirmOpenStore(String uuid, StoreApply storeApply);
 
 
-	/**
-	 * 自动确认开铺
-	 *
-	 * @param uuid			店铺申请信息编号
-	 * @param storeApply	更新的店铺信息
-	 */
-	ResultMap autoConfirmOpenStore(String uuid, StoreApply storeApply);
+//	/**
+//	 * 自动确认开铺
+//	 *
+//	 * @param uuid			店铺申请信息编号
+//	 * @param storeApply	更新的店铺信息
+//	 */
+//	ResultMap autoConfirmOpenStore(String uuid, StoreApply storeApply);
 
 	/**
 	 * 保存店铺申请信息

+ 20 - 79
src/main/java/com/uas/platform/b2c/prod/store/facade/impl/StoreApplyFacadeImpl.java

@@ -43,6 +43,13 @@ public class StoreApplyFacadeImpl implements StoreApplyFacade {
 
 	@Override
 	public ResultMap handlerApply(String uuid, StoreApply.ApplyStatus status, StoreApply apply) {
+		// 通过uuid找到店铺申请信息
+		Date date = new Date();
+		StoreApply storeApply = storeApplyService.findByUuid(uuid);
+		User user = SystemSession.getUser();
+		if (user == null || user.getEnterprise() == null) {
+			return new ResultMap(CodeType.NOT_PERMIT, "请进行用户登录操作");
+		}
 		// 验证参数合法性
 		if (StringUtils.isEmpty(uuid) || status == null) {
 			return new ResultMap(CodeType.NO_INFO, "店铺申请UUID或状态信息不存在");
@@ -53,18 +60,6 @@ public class StoreApplyFacadeImpl implements StoreApplyFacade {
 		if (apply == null) {
 			return new ResultMap(CodeType.NO_INFO, "店铺申请信息不能为空");
 		}
-
-		Date date = new Date();
-		StoreApply storeApply = storeApplyService.findByUuid(uuid);
-
-		User user = SystemSession.getUser();
-		if (user == null || user.getEnterprise() == null) {
-			return new ResultMap(CodeType.NOT_PERMIT, "请进行用户登录操作");
-		}
-		storeApply.setAuthPerson(user.getUserName());
-		storeApply.setAuthTime(date);
-		storeApply.setStatus(status);
-
 		// 检测资质信息
 		if (StoreApply.ApplyStatus.PASS == status) {
 			// TODO 检测企业信息以及品牌信息
@@ -101,23 +96,29 @@ public class StoreApplyFacadeImpl implements StoreApplyFacade {
 			}
 			storeApply.setReason(null);
 		}
-
 		if (StoreApply.ApplyStatus.UNPASS == status) {
 			if (StringUtils.isEmpty(apply.getReason())) {
 				return new ResultMap(CodeType.NO_INFO, "审核不通过后,不通过原因不能为空");
 			}
 			storeApply.setReason(apply.getReason());
 		}
-
+		// 保存审核时的审核人信息和是否通过状态
+		storeApply.setAuthPerson(user.getUserName());
+		storeApply.setAuthTime(date);
+		storeApply.setStatus(status);
 		// 保存审核时的企业信息
 		storeApply.setEnType(apply.getEnType());
 		storeApply.setEnQualification(apply.getEnQualification());
 		storeApply.setBrands(apply.getBrands());
-
-		storeApplyService.handlerApply(storeApply);
-		//自动确认开通店铺;
-		if (StoreApply.ApplyStatus.PASS == status) {
-			this.autoConfirmOpenStore(uuid, storeApply);
+		// 不通过保存申请信息,通过则进行自动确认开通店铺操作
+		if (StoreApply.ApplyStatus.UNPASS == status) {
+			storeApplyService.handlerApply(storeApply);
+		} else {
+			storeApply.setBannerUrl("http://dfs.ubtob.com/group1/M00/19/BF/CgpkyFlSBRmAcascAANK5vkByag940.jpg");
+			storeApply.setLogoUrl("https://dfs.ubtob.com/group1/M00/88/4D/CgpkyFrMEHeAbmFgAAAVUSwA8go871.png");
+			StoreApply savedApply = storeApplyService.handlerApply(storeApply);
+			StoreIn storeIn = storeService.createByStoreApplyAndSave(savedApply);
+			return ResultMap.success(storeIn.getUuid());
 		}
 		return ResultMap.success(null);
 	}
@@ -177,66 +178,6 @@ public class StoreApplyFacadeImpl implements StoreApplyFacade {
 		return ResultMap.success(storeIn.getUuid());
 	}
 
-
-
-	public ResultMap autoConfirmOpenStore(String uuid, StoreApply storeApply) {
-		Date date = new Date();
-		// 验证
-		if (StringUtils.isEmpty(uuid) || storeApply == null) {
-			return new ResultMap(CodeType.NO_INFO, "开铺申请和编号信息不能为空");
-		}
-		storeApply.setBannerUrl("http://dfs.ubtob.com/group1/M00/19/BF/CgpkyFlSBRmAcascAANK5vkByag940.jpg");
-		storeApply.setLogoUrl("https://dfs.ubtob.com/group1/M00/88/4D/CgpkyFrMEHeAbmFgAAAVUSwA8go871.png");
-		if ( StringUtils.isEmpty(storeApply.getLogoUrl())
-				|| StringUtils.isEmpty(storeApply.getBannerUrl())) {
-			return new ResultMap(CodeType.NOT_COMPLETE_INFO, "LOGO或横幅广告不能为空");
-		}
-		// 更新店铺申请信息
-		StoreApply apply = storeApplyService.findByUuid(uuid);
-		if (apply == null) {
-			return new ResultMap(CodeType.NOT_EXiST, "该店铺申请信息不存在");
-		}
-		if (StringUtils.hasText(storeApply.getStoreUuid())) {
-			apply.setStoreUuid(storeApply.getStoreUuid().toLowerCase());
-		}
-		apply.setLogoUrl(storeApply.getLogoUrl());
-		apply.setBannerUrl(storeApply.getBannerUrl());
-/*		if (storeApply.getEnterprise() != null) {
-			EnterpriseSimple enterprise = apply.getEnterprise();
-			enterprise.setEnUrl(storeApply.getEnterprise().getEnUrl());
-			enterprise.setAddress(storeApply.getEnterprise().getAddress());
-			enterprise.setEnTel(storeApply.getEnterprise().getEnTel());
-			enterprise.setEnFax(storeApply.getEnterprise().getEnFax());
-			// 更新企业信息JSON字符串
-			apply.setEnterprise(enterprise);
-		}
-
-		User user  = SystemSession.getUser();
-		if (user == null || user.getEnterprise() == null) {
-			return new ResultMap(CodeType.ERROR_STATE, "用户没有登录或账户信息异常");
-		}
-
-		// 添加资质信息
-		List<Qualification> qualifications = storeApply.getQualifications();
-		List<Qualification> existQualifications = apply.getQualifications();
-		for (Qualification qualification : qualifications) {
-			qualification.setEnUU(user.getEnterprise().getUu());
-			qualification.setUploaderUU(user.getUserUU());
-			qualification.setCreateTime(date);
-			qualification.setUpdateTime(date);
-			existQualifications.add(qualification);
-		}
-		// 更新资质信息JSON字符串
-		apply.setQualifications(existQualifications);*/
-		User user  = SystemSession.getUser();
-		if (user == null || user.getEnterprise() == null) {
-			return new ResultMap(CodeType.ERROR_STATE, "用户没有登录或账户信息异常");
-		}
-		storeApply = storeApplyService.handlerApply(apply);
-		StoreIn storeIn = storeService.createByStoreApplyAndSave(storeApply);
-		return ResultMap.success(storeIn.getUuid());
-	}
-
 	@Override
 	public ResultMap saveUpdateOfApply(String uuid, StoreApply apply) {
 		// 验证参数合法性

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/store/service/impl/StoreApplyServiceImpl.java

@@ -196,7 +196,7 @@ public class StoreApplyServiceImpl implements StoreApplyService {
 	}
 
 	@Override
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
 	public StoreApply handlerApply(StoreApply shopApply) {
 		if (shopApply == null || StringUtils.isEmpty(shopApply.getUuid()) || shopApply.getId() == null) {
 			return null;

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/store/service/impl/StoreInServiceImpl.java

@@ -121,7 +121,7 @@ public class StoreInServiceImpl implements StoreInService {
 	}
 
 	@Override
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
 	public StoreIn createByStoreApplyAndSave(StoreApply storeApply) {
 		if (storeApply == null || storeApply.getEnUU() == null) {
 			return null;