zoujiajian 2 år sedan
förälder
incheckning
d41792672f

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/mange/CmsYhShopCommonService.java

@@ -17,7 +17,7 @@ public interface CmsYhShopCommonService {
 
 	void verifyYhShopApply(YhShopVerifyReq verifyReq);
 
-	void setYhShopGoodsRate(List<YhShopUserPlatDistributeRate> yhShopUserPlatDistributeRates);
+	void setYhShopGoodsRate(List<YhShopUserPlatDistributeRate> yhShopUserPlatDistributeRates, Long userId);
 
 	void setYhShopBusiness(YhShop yhShop);
 

+ 6 - 11
netflix-service/src/main/java/com/cyksj/service/mange/goods/CmsYhShopCommonServiceImpl.java

@@ -30,7 +30,6 @@ import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
-import java.util.concurrent.atomic.AtomicBoolean;
 
 /*
  *项目名: yhlxj
@@ -127,17 +126,9 @@ public class CmsYhShopCommonServiceImpl implements CmsYhShopCommonService {
 
 	@Override
 	@Transactional(rollbackFor = Throwable.class)
-	public void setYhShopGoodsRate(List<YhShopUserPlatDistributeRate> yhShopUserPlatDistributeRates) {
-		AtomicBoolean checkShopOwner = new AtomicBoolean(false);
+	public void setYhShopGoodsRate(List<YhShopUserPlatDistributeRate> yhShopUserPlatDistributeRates, Long userId) {
 		yhShopUserPlatDistributeRates.forEach(data -> {
-			Long userId = data.getUserId();
-			if (!checkShopOwner.get()) {
-				YhShop yhShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
-						.eq(YhShop::getVerifyStatus, YhShop.Status.success)
-						.eq(YhShop::getUserId, userId).last("limit 1"));
-				Assert.notNull(yhShop, "请检查该店铺是不是存在或审核成功");
-				checkShopOwner.set(true);
-			}
+			data.setUserId(userId);
 			Long goodsId = data.getGoodsId();
 			GoodsDon goodsDon = goodsDonMapper.selectById(goodsId);
 			Assert.notNull(goodsDon, "请检查你设置的平台是否存在");
@@ -159,6 +150,10 @@ public class CmsYhShopCommonServiceImpl implements CmsYhShopCommonService {
 		Long id = yhShop.getId();
 		YhShop dbShop = yhShopMapper.selectById(id);
 		Assert.notNull(dbShop, "请检查店铺是否存在");
+		if (dbShop.getVerifyStatus() != YhShop.Status.success) {
+			throw BusinessRuntimeException.getInstance("请检查该店铺是否审核成功");
+		}
+		yhShop.setUserId(dbShop.getUserId());
 		if (businessId == null && dbShop.getBusinessId() == 0) {
 			return;
 		}

+ 1 - 1
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/shop/CmsYhShopGoodsController.java

@@ -245,7 +245,7 @@ public class CmsYhShopGoodsController {
         if (CollUtil.isEmpty(yhShopUserPlatDistributeRates)) {
             throw BusinessRuntimeException.getInstance("请选择店铺用户对应平台比例");
         }
-        cmsYhShopCommonService.setYhShopGoodsRate(yhShopUserPlatDistributeRates);
+        cmsYhShopCommonService.setYhShopGoodsRate(yhShopUserPlatDistributeRates, yhShop.getUserId());
         return GatewayResponse.SUCCESS.newBuilder().toResult();
     }