Bladeren bron

format code

Mr.qian 2 weken geleden
bovenliggende
commit
eb2c36ed84
1 gewijzigde bestanden met toevoegingen van 207 en 212 verwijderingen
  1. 207 212
      mall-service/src/main/java/com/txz/mall/service/impl/StorePinkServiceImpl.java

+ 207 - 212
mall-service/src/main/java/com/txz/mall/service/impl/StorePinkServiceImpl.java

@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
-import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.github.pagehelper.PageHelper;
@@ -20,9 +19,9 @@ import com.txz.mall.dao.StoreCombinationMapper;
 import com.txz.mall.dao.StorePinkMapper;
 import com.txz.mall.dao.StoreProductMapper;
 import com.txz.mall.dubbo.client.CifAccountDubboServiceClient;
+import com.txz.mall.dubbo.client.CifUserDubboServiceClient;
 import com.txz.mall.enums.NoticeEnum;
 import com.txz.mall.enums.OrderEventsEnum;
-import com.txz.mall.dubbo.client.CifUserDubboServiceClient;
 import com.txz.mall.enums.PinkOrderStatusEnum;
 import com.txz.mall.enums.StorePinkStatusEnum;
 import com.txz.mall.model.*;
@@ -53,24 +52,25 @@ import java.util.stream.Collectors;
 @Transactional
 @Slf4j
 public class StorePinkServiceImpl extends AbstractService<StorePink> implements StorePinkService {
-
-
+    
+    
     @Resource
     private StorePinkMapper storePinkMapper;
-
+    
     @Resource
     private CifAccountDubboServiceClient cifAccountDubboServiceClient;
-
+    
     @Resource
     private CifUserDubboServiceClient userDubboServiceClient;
     @Resource
     private NoticeService noticeService;
-
+    
     @Resource
     private StoreProductMapper storeProductMapper;
-
+    
     @Resource
     private StoreCombinationMapper storeCombinationMapper;
+    
     @Override
     public List<StorePink> getListByCidAndKid(Long cid, Long kid) {
         Condition condition = new Condition(StorePink.class);
@@ -81,118 +81,118 @@ public class StorePinkServiceImpl extends AbstractService<StorePink> implements
         condition.setOrderByClause("id DESC");
         return findByCondition(condition);
     }
-
-
+    
+    
     @Resource
     private StorePinkSummaryService storePinkSummaryService;
     @Resource
     private DailySalesSummaryOfProductsService dailySalesSummaryOfProductsService;
-
+    
     @Override
     @Transactional
     public void pinkSuccess(String orderNo, StoreOrder storeOrder) {
-
-
+        
+        
         // 现在这个方法每次支付的时候都会执行一次
         Date date = new Date();
         if (ObjectUtil.isNull(orderNo)) {
             return;
         }
-        StorePink teamPink = findBy("orderId",orderNo);
-        //下面这行好像没什么用
-      //  List<StorePink> memberList = getListByCidAndKid(teamPink.getCid(), id);
+        StorePink teamPink = findBy("orderId", orderNo);
+        // 下面这行好像没什么用
+        //  List<StorePink> memberList = getListByCidAndKid(teamPink.getCid(), id);
         StorePink storePink2 = new StorePink();
         storePink2.setId(teamPink.getId());
-       // storePink2.setStatus(2);
-       // storePink2.setStopTime(date);
+        // storePink2.setStatus(2);
+        // storePink2.setStopTime(date);
         storePink2.setOrderStatus(PinkOrderStatusEnum.GROUP_ORDER_PAID.getKey());
-        log.info("storePink2:"+storePink2);
-
+        log.info("storePink2:" + storePink2);
+        
         Condition updateStorePinkCondition = new Condition(StorePink.class);
-        updateStorePinkCondition.createCriteria().andEqualTo("orderId",orderNo);
-        storePinkMapper.updateByConditionSelective(storePink2,updateStorePinkCondition);
-        dailySalesSummaryOfProductsService.updateDailySalesSummaryOfProducts(orderNo,storePink2);
-
-       //**分库整改
-       // update(storePink2);
-
-        storeOrderStatusService.createLog(storeOrder.getId(), storeOrder.getOrderId(),Constants.ORDER_LOG_PAY_SUCCESS, "支付成功");
-        noticeService.addOrderNotice(NoticeEnum.ORDER_GROUP_BUY_PAYMENT_SUCCESS,storeOrder.getOrderId(),storeOrder.getUid());
-
-        //累计虚拟销量,虚拟销量和下单数挂钩,和是否退款或者成团或者是否中奖都无关  只累加不扣减
+        updateStorePinkCondition.createCriteria().andEqualTo("orderId", orderNo);
+        storePinkMapper.updateByConditionSelective(storePink2, updateStorePinkCondition);
+        dailySalesSummaryOfProductsService.updateDailySalesSummaryOfProducts(orderNo, storePink2);
+        
+        //**分库整改
+        // update(storePink2);
+        
+        storeOrderStatusService.createLog(storeOrder.getId(), storeOrder.getOrderId(), Constants.ORDER_LOG_PAY_SUCCESS, "支付成功");
+        noticeService.addOrderNotice(NoticeEnum.ORDER_GROUP_BUY_PAYMENT_SUCCESS, storeOrder.getOrderId(), storeOrder.getUid());
+        
+        // 累计虚拟销量,虚拟销量和下单数挂钩,和是否退款或者成团或者是否中奖都无关  只累加不扣减
         Long pid = teamPink.getPid();
-
+        
         StoreProduct storeProduct = storeProductService.findById(pid);
         StoreProduct storeProductForUpdate = new StoreProduct();
-        storeProductForUpdate.setFicti(storeProduct.getFicti()+teamPink.getTotalNum());
-        storeProductForUpdate.setVersion(storeProduct.getVersion()+1);
+        storeProductForUpdate.setFicti(storeProduct.getFicti() + teamPink.getTotalNum());
+        storeProductForUpdate.setVersion(storeProduct.getVersion() + 1);
         Example exampleStoreProduct = new Example(StoreProduct.class);
         exampleStoreProduct.createCriteria().andEqualTo("id", pid).andEqualTo(storeProduct.getVersion());
         int i = storeProductMapper.updateByConditionSelective(storeProductForUpdate, exampleStoreProduct);
-        if(i==0){
-            throw new ServiceException(I18nUtil.get("failed.to.increase.virtual.sales.during.payment")+pid);
+        if (i == 0) {
+            throw new ServiceException(I18nUtil.get("failed.to.increase.virtual.sales.during.payment") + pid);
         }
-
-        //将虚拟销量维护到拼团商品表上防止连表查询
+        
+        // 将虚拟销量维护到拼团商品表上防止连表查询
         StoreCombination storeCombinationUpdate = new StoreCombination();
-        storeCombinationUpdate.setFicti(storeProduct.getFicti()+teamPink.getTotalNum());
+        storeCombinationUpdate.setFicti(storeProduct.getFicti() + teamPink.getTotalNum());
         Example exampleStoreCombination = new Example(StoreCombination.class);
-        exampleStoreCombination.createCriteria().andEqualTo("productId", pid).andEqualTo("isDelete",0);
-        storeCombinationMapper.updateByConditionSelective(storeCombinationUpdate,exampleStoreCombination);
-
-      //  memberList.add(teamPink);
-//        memberList.forEach(i -> {
-//            i.setStatus(2);
-//            i.setStopTime(date);
-//            update(i);
-//        });
-
-        //理论上在支付环节调用的时候不会出现拼团人数校验异常,所以这块调用这个方法的目的在于维护成团状态。 如果支付环节抛出了
-        //拼团校验异常则证明在 add时就有问题,没有挡住异常的拼团数据
-        log.info("storePinkSummaryService.maintainQuantityStatusOfTheStorePinkSummary SpsId"+teamPink.getSpsCode());
+        exampleStoreCombination.createCriteria().andEqualTo("productId", pid).andEqualTo("isDelete", 0);
+        storeCombinationMapper.updateByConditionSelective(storeCombinationUpdate, exampleStoreCombination);
+        
+        //  memberList.add(teamPink);
+        //        memberList.forEach(i -> {
+        //            i.setStatus(2);
+        //            i.setStopTime(date);
+        //            update(i);
+        //        });
+        
+        // 理论上在支付环节调用的时候不会出现拼团人数校验异常,所以这块调用这个方法的目的在于维护成团状态。 如果支付环节抛出了
+        // 拼团校验异常则证明在 add时就有问题,没有挡住异常的拼团数据
+        log.info("storePinkSummaryService.maintainQuantityStatusOfTheStorePinkSummary SpsId" + teamPink.getSpsCode());
         Boolean b = storePinkSummaryService.maintainQuantityStatusOfTheStorePinkSummary(teamPink.getSpsCode());
-        log.info("storePinkSummaryService.maintainQuantityStatusOfTheStorePinkSummary b"+b);
-        if(b){
-
-        // 算出天选  同时推进订单状态到 代发货状态/订单关闭状态/未中奖成员退款
-        theSelection(teamPink.getSpsCode(),date);
-
+        log.info("storePinkSummaryService.maintainQuantityStatusOfTheStorePinkSummary b" + b);
+        if (b) {
+            
+            // 算出天选  同时推进订单状态到 代发货状态/订单关闭状态/未中奖成员退款
+            theSelection(teamPink.getSpsCode(), date);
+            
         }
     }
-
-//    @Override
-//    public void theSelection(String orderId) {
-//        // 假设只有1个用户是天选
-//        long luckNum = 1;
-//
-//        Condition condition = new Condition(StorePink.class);
-//        Example.Criteria criteria = condition.createCriteria();
-//        criteria.andEqualTo("isDelete", 0);
-//        criteria.andEqualTo("orderId", orderId);
-//        // 排除团长
-////        criteria.andEqualTo("kId", 1);
-//        // 支付成功的
-//
-//        criteria.andEqualTo("status", 1);
-//        List<StorePink> list = findByCondition(condition);
-//        if (CollUtil.isEmpty(list)) {
-//            throw new ServiceException(I18nUtil.get("no.group.buying.orders"));
-//        }
-//        long count = list.stream().filter(i -> i.getLId().equals(1)).count();
-//        if (count >= luckNum) {
-//            throw new ServiceException(I18nUtil.get("already.have.a.chosen.one"));
-//        }
-//
-//        List<Long> idCollect = list.stream().map(StorePink::getId).collect(Collectors.toList());
-//        List<Long> randomIds = RandomUtil.uniqueRandom(idCollect, (int) luckNum);
-//
-//        randomIds.forEach(i -> {
-//            StorePink luckPink = new StorePink();
-//            luckPink.setId(i);
-//            luckPink.setLId(1);
-//            update(luckPink);
-//        });
-//    }
+    
+    //    @Override
+    //    public void theSelection(String orderId) {
+    //        // 假设只有1个用户是天选
+    //        long luckNum = 1;
+    //
+    //        Condition condition = new Condition(StorePink.class);
+    //        Example.Criteria criteria = condition.createCriteria();
+    //        criteria.andEqualTo("isDelete", 0);
+    //        criteria.andEqualTo("orderId", orderId);
+    //        // 排除团长
+    /// /        criteria.andEqualTo("kId", 1);
+    //        // 支付成功的
+    //
+    //        criteria.andEqualTo("status", 1);
+    //        List<StorePink> list = findByCondition(condition);
+    //        if (CollUtil.isEmpty(list)) {
+    //            throw new ServiceException(I18nUtil.get("no.group.buying.orders"));
+    //        }
+    //        long count = list.stream().filter(i -> i.getLId().equals(1)).count();
+    //        if (count >= luckNum) {
+    //            throw new ServiceException(I18nUtil.get("already.have.a.chosen.one"));
+    //        }
+    //
+    //        List<Long> idCollect = list.stream().map(StorePink::getId).collect(Collectors.toList());
+    //        List<Long> randomIds = RandomUtil.uniqueRandom(idCollect, (int) luckNum);
+    //
+    //        randomIds.forEach(i -> {
+    //            StorePink luckPink = new StorePink();
+    //            luckPink.setId(i);
+    //            luckPink.setLId(1);
+    //            update(luckPink);
+    //        });
+    //    }
     @Lazy
     @Resource
     private StoreOrderService storeOrderService;
@@ -202,128 +202,124 @@ public class StorePinkServiceImpl extends AbstractService<StorePink> implements
     @Lazy
     @Resource
     private StoreProductService storeProductService;
-
+    
     @Lazy
     @Resource
     private StoreOrderStatusService storeOrderStatusService;
-
+    
     @Override
-    public void theSelection(String spsCode,Date date) {
-        log.info("theSelection:"+spsCode);
+    public void theSelection(String spsCode, Date date) {
+        log.info("theSelection:" + spsCode);
         // 假设只有1个用户是天选
         long luckNum = 1;
-
+        
         StorePinkSummary storePinkSummary = storePinkSummaryService.findBy("code", spsCode);
         //**分库整改
         // StorePinkSummary storePinkSummary = storePinkSummaryService.findById(spsId);
-        if(ObjectUtils.isEmpty(storePinkSummary)){
-            throw new ServiceException(I18nUtil.get("no.group.buying.summary.records")+spsCode);
+        if (ObjectUtils.isEmpty(storePinkSummary)) {
+            throw new ServiceException(I18nUtil.get("no.group.buying.summary.records") + spsCode);
         }
-
+        
         List<String> orderNoSetList = new ArrayList<>();
         String orderNoSet = storePinkSummary.getOrderNoSet();
-        if(!ObjectUtils.isEmpty(orderNoSet)){
-             orderNoSetList = JSONObject.parseArray(orderNoSet, String.class);
+        if (!ObjectUtils.isEmpty(orderNoSet)) {
+            orderNoSetList = JSONObject.parseArray(orderNoSet, String.class);
         }
-        if(ObjectUtils.isEmpty(orderNoSetList)){
-            throw new ServiceException(I18nUtil.get("store.pink.summary.order.no.set.not.exist")+spsCode);
+        if (ObjectUtils.isEmpty(orderNoSetList)) {
+            throw new ServiceException(I18nUtil.get("store.pink.summary.order.no.set.not.exist") + spsCode);
         }
-
+        
         Condition condition = new Condition(StorePink.class);
         Example.Criteria criteria = condition.createCriteria();
         criteria.andEqualTo("isDelete", 0);
-        criteria.andIn("orderId",orderNoSetList);
+        criteria.andIn("orderId", orderNoSetList);
         //**分库整改
-       // criteria.andEqualTo("spsId", spsId);
+        // criteria.andEqualTo("spsId", spsId);
         // 排除团长
-//        criteria.andEqualTo("kId", 1);
+        //        criteria.andEqualTo("kId", 1);
         // 支付成功的
         criteria.andEqualTo("orderStatus", PinkOrderStatusEnum.GROUP_ORDER_PAID.getKey());
         List<StorePink> list = findByCondition(condition);
         if (CollUtil.isEmpty(list)) {
             String s = I18nUtil.get("no.group.buying.orders");
-            throw new ServiceException(s+spsCode);
+            throw new ServiceException(s + spsCode);
         }
         long count = list.stream().filter(i -> i.getLId().equals(1)).count();
         if (count >= luckNum) {
-            throw new ServiceException(I18nUtil.get("already.have.a.chosen.one")+spsCode);
+            throw new ServiceException(I18nUtil.get("already.have.a.chosen.one") + spsCode);
         }
-
-
-
-
-
+        
+        
         Map<Long, StorePink> idStorePinkMap = list.stream().collect(Collectors.toMap(StorePink::getId, a -> a, (b, c) -> c));
-
+        
         List<Long> idCollect = list.stream().map(StorePink::getId).collect(Collectors.toList());
         List<Long> randomIds = RandomUtil.uniqueRandom(idCollect, (int) luckNum);
-
+        
         AccomplishParam param = new AccomplishParam();
-
+        
         param.setBizNo(storePinkSummary.getCode());
-        param.setBizId(storePinkSummary.getId()+"");
+        param.setBizId(storePinkSummary.getId() + "");
         List<OrderParam> orderParamList = new ArrayList<>();
-
-        //选出中奖单号 推进状态
+        
+        // 选出中奖单号 推进状态
         randomIds.forEach(i -> {
             StorePink luckPink = new StorePink();
             StorePink storePink = idStorePinkMap.get(i);
             StoreOrder storeOrder = storeOrderService.findBy("orderId", storePink.getOrderId());
             //**分库整改
-           // StoreOrder storeOrder = storeOrderService.findById(storePink.getOrderIdKey());
+            // StoreOrder storeOrder = storeOrderService.findById(storePink.getOrderIdKey());
             luckPink.setId(i);
             luckPink.setLId(1);
-
+            
             luckPink.setStatus(StorePinkStatusEnum.RESULTS_ANNOUNCED.getKey());
             luckPink.setStopTime(date);
-
+            
             PinkOrderStatusEnum pinkOrderStatusEnum = OrderStateMachine.handleEvent(storeOrder, OrderEventsEnum.GROUP_PURCHASE_WIN, null);
-            if(ObjectUtils.isEmpty(pinkOrderStatusEnum)){
-                throw new ServiceException(I18nUtil.get("current.order.status.does.not.allow.progression.to.pending.shipment.orderid")+storePink.getOrderId());
+            if (ObjectUtils.isEmpty(pinkOrderStatusEnum)) {
+                throw new ServiceException(I18nUtil.get("current.order.status.does.not.allow.progression.to.pending.shipment.orderid") + storePink.getOrderId());
             }
-            if(!ObjectUtils.isEmpty(storeOrder.getAddressId())) {
+            if (!ObjectUtils.isEmpty(storeOrder.getAddressId())) {
                 luckPink.setOrderStatus(PinkOrderStatusEnum.GROUP_ORDER_TO_SHIP.getKey());
                 storeOrderService.updateOrderStatus(storePink.getOrderId(), pinkOrderStatusEnum.getKey());
-            }else{
-                noticeService.addOrderNotice(NoticeEnum.ORDER_PROVIDE_SHIPPING_ADDRESS,storeOrder.getOrderId(),storeOrder.getUid());
+            } else {
+                noticeService.addOrderNotice(NoticeEnum.ORDER_PROVIDE_SHIPPING_ADDRESS, storeOrder.getOrderId(), storeOrder.getUid());
             }
-            //分库整改
+            // 分库整改
             Condition storePinkUpdateCondition = new Condition(StorePink.class);
-            storePinkUpdateCondition.createCriteria().andEqualTo("orderId",storePink.getOrderId());
+            storePinkUpdateCondition.createCriteria().andEqualTo("orderId", storePink.getOrderId());
             int i1 = storePinkMapper.updateByConditionSelective(luckPink, storePinkUpdateCondition);
-            //维护每日统计表
-            dailySalesSummaryOfProductsService.updateDailySalesSummaryOfProducts(storePink.getOrderId(),luckPink);
-
+            // 维护每日统计表
+            dailySalesSummaryOfProductsService.updateDailySalesSummaryOfProducts(storePink.getOrderId(), luckPink);
+            
             // update(luckPink);
-            //推进订单状态到待发货状态
-
-            storeOrderStatusService.createLog(storeOrder.getId(), storeOrder.getOrderId(),Constants.ORDER_STATUS_PINK_SUCCESS_ORDER, "拼团成功");
-            noticeService.addOrderNotice(NoticeEnum.ORDER_GROUP_BUY_SUCCESS_WIN,storeOrder.getOrderId(),storeOrder.getUid());
-            //中奖者
+            // 推进订单状态到待发货状态
+            
+            storeOrderStatusService.createLog(storeOrder.getId(), storeOrder.getOrderId(), Constants.ORDER_STATUS_PINK_SUCCESS_ORDER, "拼团成功");
+            noticeService.addOrderNotice(NoticeEnum.ORDER_GROUP_BUY_SUCCESS_WIN, storeOrder.getOrderId(), storeOrder.getUid());
+            // 中奖者
             param.setWinnerOrderNo(storeOrder.getOrderId());
             param.setWinnerUserId(storeOrder.getUid());
             Integer kId = storePink.getKId();
             Integer zero = 0;
-            if(zero.equals(kId)){
+            if (zero.equals(kId)) {
                 param.setOpenGroupUserId(storeOrder.getUid());
                 param.setOpenOrderNo(storeOrder.getOrderId());
             }
-            //获奖者的状态联动已经完成了所以把他从列表中移除
+            // 获奖者的状态联动已经完成了所以把他从列表中移除
             list.remove(storePink);
         });
-
-
-
+        
+        
         param.setTransTime(date);
-        //将所有参团成员的status设置为 已开奖
-        list.forEach(a->{
-            log.info("forEach a:"+JSONObject.toJSONString(a));
-            StoreOrder storeOrder = storeOrderService.findBy("orderId",a.getOrderId());
+        // 将所有参团成员的status设置为 已开奖
+        list.forEach(a -> {
+            log.info("forEach a:" + JSONObject.toJSONString(a));
+            StoreOrder storeOrder = storeOrderService.findBy("orderId", a.getOrderId());
             //**分库整改
-           // StoreOrder storeOrder = storeOrderService.findById(a.getOrderIdKey());
+            // StoreOrder storeOrder = storeOrderService.findById(a.getOrderIdKey());
             PinkOrderStatusEnum pinkOrderStatusEnum = OrderStateMachine.handleEvent(storeOrder, OrderEventsEnum.GROUP_PURCHASE_NOT_WIN, null);
-            if(ObjectUtils.isEmpty(pinkOrderStatusEnum)){
-                throw new ServiceException(I18nUtil.get("the.current.order.status.does.not.allow.advancement.to.the.closed.status.of.unwinning.orders.orderid")+a.getOrderId());
+            if (ObjectUtils.isEmpty(pinkOrderStatusEnum)) {
+                throw new ServiceException(I18nUtil.get("the.current.order.status.does.not.allow.advancement.to.the.closed.status.of.unwinning.orders.orderid") + a.getOrderId());
             }
             // storePink2.setStopTime(date);
             StorePink unLuckPink = new StorePink();
@@ -332,68 +328,67 @@ public class StorePinkServiceImpl extends AbstractService<StorePink> implements
             unLuckPink.setOrderStatus(pinkOrderStatusEnum.getKey());
             unLuckPink.setStopTime(date);
             Condition storePinkConditionForUpdate = new Condition(StorePink.class);
-            storePinkConditionForUpdate.createCriteria().andEqualTo("orderId",a.getOrderId());
+            storePinkConditionForUpdate.createCriteria().andEqualTo("orderId", a.getOrderId());
             int i = storePinkMapper.updateByConditionSelective(unLuckPink, storePinkConditionForUpdate);
-            //维护每日统计表
-            dailySalesSummaryOfProductsService.updateDailySalesSummaryOfProducts(a.getOrderId(),unLuckPink);
-
-
+            // 维护每日统计表
+            dailySalesSummaryOfProductsService.updateDailySalesSummaryOfProducts(a.getOrderId(), unLuckPink);
+            
+            
             //**分库整改
-            //update(unLuckPink);
-
-            //推进订单状态到未中奖关闭状态
-            log.info("storeOrderService.updateOrderStatus"+JSONObject.toJSONString(a));
-
-            storeOrderService.updateOrderStatus(a.getOrderId(),pinkOrderStatusEnum.getKey());
-            storeOrderStatusService.createLog(storeOrder.getId(),storeOrder.getOrderId(),Constants.ORDER_STATUS_PINK_SUCCESS_ORDER, "拼团成功");
-            noticeService.addOrderNotice(NoticeEnum.ORDER_GROUP_BUY_SUCCESS_LOSE,storeOrder.getOrderId(),storeOrder.getUid());
-
-            //库存回退
+            // update(unLuckPink);
+            
+            // 推进订单状态到未中奖关闭状态
+            log.info("storeOrderService.updateOrderStatus" + JSONObject.toJSONString(a));
+            
+            storeOrderService.updateOrderStatus(a.getOrderId(), pinkOrderStatusEnum.getKey());
+            storeOrderStatusService.createLog(storeOrder.getId(), storeOrder.getOrderId(), Constants.ORDER_STATUS_PINK_SUCCESS_ORDER, "拼团成功");
+            noticeService.addOrderNotice(NoticeEnum.ORDER_GROUP_BUY_SUCCESS_LOSE, storeOrder.getOrderId(), storeOrder.getUid());
+            
+            // 库存回退
             // 拼团商品扣库存
-            log.info("storeCombinationService.operationStock"+JSONObject.toJSONString(a));
+            log.info("storeCombinationService.operationStock" + JSONObject.toJSONString(a));
             storeCombinationService.operationStock(a.getCid(), a.getTotalNum(), "add");
             // 拼团商品规格扣库存
             //   productAttrValueService.operationStock(skuRecord.getInt("activityAttrValueId"), skuRecord.getInt("num"), "sub", Constants.PRODUCT_TYPE_PINGTUAN);
             // 普通商品口库存
-            log.info("storeProductService.operationStock"+JSONObject.toJSONString(a));
+            log.info("storeProductService.operationStock" + JSONObject.toJSONString(a));
             storeProductService.operationStock(a.getPid(), a.getTotalNum(), "add");
-
-
-            //非天选之子给他退款
+            
+            
+            // 非天选之子给他退款
             OrderParam orderParam = new OrderParam();
-            orderParam.setOrderId(storeOrder.getId()+"");
+            orderParam.setOrderId(storeOrder.getId() + "");
             orderParam.setUserId(storeOrder.getUid());
             orderParam.setOrderNo(storeOrder.getOrderId());
-
+            
             Integer kId = a.getKId();
             Integer zero = 0;
-            if(zero.equals(kId)){
+            if (zero.equals(kId)) {
                 param.setOpenGroupUserId(storeOrder.getUid());
                 param.setOpenOrderNo(storeOrder.getOrderId());
             }
-            //当前只能拼1个商品 所以理论上这个价格都是一样的,这边就循环覆盖即可
+            // 当前只能拼1个商品 所以理论上这个价格都是一样的,这边就循环覆盖即可
             param.setAmount(storeOrder.getPayPrice());
             orderParamList.add(orderParam);
-
+            
         });
-        log.info("orderParamList"+orderParamList);
+        log.info("orderParamList" + orderParamList);
         param.setUserIds(orderParamList);
-        log.info("cifAccountDubboServiceClient.accomplishGroup"+JSONObject.toJSONString(param));
-
+        log.info("cifAccountDubboServiceClient.accomplishGroup" + JSONObject.toJSONString(param));
+        
         Result result = cifAccountDubboServiceClient.accomplishGroup(param);
-        log.info("cifAccountDubboServiceClient.accomplishGroup result"+result);
-        if(!result.getCode().equals("200")){
-            throw new ServiceException(I18nUtil.get("refund.failed.for.users.who.did.not.win.the.group.buying.message")+result.getMessage());
+        log.info("cifAccountDubboServiceClient.accomplishGroup result" + result);
+        if (!result.getCode().equals("200")) {
+            throw new ServiceException(I18nUtil.get("refund.failed.for.users.who.did.not.win.the.group.buying.message") + result.getMessage());
         }
-
+        
     }
-
-
-
+    
+    
     @Override
     public List<StorePinkOngoingVO> ongoingList(StorePink storePink) {
-
-         PageHelper.startPage(1, 3);
+        
+        PageHelper.startPage(1, 3);
         List<StorePinkOngoingVO> list = new ArrayList<>();
         Condition storePinkSummarycondition = new Condition(StorePinkSummary.class);
         Example.Criteria storePinkSummarycriteria = storePinkSummarycondition.createCriteria();
@@ -402,42 +397,42 @@ public class StorePinkServiceImpl extends AbstractService<StorePink> implements
         storePinkSummarycriteria.andEqualTo("isVirtual", 0);
         storePinkSummarycondition.setOrderByClause("people_count DESC");
         List<StorePinkSummary> byCondition = storePinkSummaryService.findByCondition(storePinkSummarycondition);
-
-
+        
+        
         if (!CollectionUtils.isEmpty(byCondition)) {
-
+            
             Map<Long, StorePinkSummary> storePinkSummaryMap = byCondition.stream().collect(Collectors.toMap(StorePinkSummary::getId, a -> a, (b, c) -> c));
-
+            
             List<Long> spsIdList = byCondition.stream().map(StorePinkSummary::getId).collect(Collectors.toList());
-
-            List<String> orderNoSetList = byCondition.stream().map(StorePinkSummary::getOrderNoSet).filter(a->!ObjectUtils.isEmpty(a)).collect(Collectors.toList());
+            
+            List<String> orderNoSetList = byCondition.stream().map(StorePinkSummary::getOrderNoSet).filter(a -> !ObjectUtils.isEmpty(a)).collect(Collectors.toList());
             Set<String> orderNoSetForSearch = new HashSet<>();
-            log.info("ongoingList.orderNoSetList:"+orderNoSetList);
-            if(!org.springframework.util.CollectionUtils.isEmpty(orderNoSetList)){
+            log.info("ongoingList.orderNoSetList:" + orderNoSetList);
+            if (!org.springframework.util.CollectionUtils.isEmpty(orderNoSetList)) {
                 for (String s : orderNoSetList) {
                     List<String> strings = JSONObject.parseArray(s, String.class);
                     orderNoSetForSearch.addAll(strings);
                 }
             }
-            log.info("ongoingList.orderNoSetForSearch:"+orderNoSetForSearch);
+            log.info("ongoingList.orderNoSetForSearch:" + orderNoSetForSearch);
             Condition condition = new Condition(StorePink.class);
             Example.Criteria criteria = condition.createCriteria();
             criteria.andEqualTo("isDelete", 0);
-           // criteria.andEqualTo("cid", storePink.getCid());
-            criteria.andEqualTo("orderStatus",PinkOrderStatusEnum.GROUP_ORDER_PAID.getKey());
+            // criteria.andEqualTo("cid", storePink.getCid());
+            criteria.andEqualTo("orderStatus", PinkOrderStatusEnum.GROUP_ORDER_PAID.getKey());
             //  criteria.andEqualTo("kid", 0);
-
-            if(!org.springframework.util.CollectionUtils.isEmpty(orderNoSetForSearch)){
-                criteria.andIn("orderId",orderNoSetForSearch);
-            }else{
+            
+            if (!org.springframework.util.CollectionUtils.isEmpty(orderNoSetForSearch)) {
+                criteria.andIn("orderId", orderNoSetForSearch);
+            } else {
                 criteria.andIn("spsId", spsIdList);
             }
             List<StorePink> pinkList = findByCondition(condition);
-
+            
             Map<Long, List<StorePink>> collect = pinkList.stream().collect(Collectors.groupingBy(StorePink::getSpsId));
             list = pinkList.stream().filter(a -> a.getKId().equals(0)).map(a -> {
                 List<StorePink> storePinks = collect.get(a.getSpsId());
-
+                
                 StorePinkOngoingVO pinkOngoingVO = new StorePinkOngoingVO();
                 pinkOngoingVO.setId(a.getId());
                 pinkOngoingVO.setOrderId(a.getOrderId());
@@ -448,17 +443,17 @@ public class StorePinkServiceImpl extends AbstractService<StorePink> implements
                 pinkOngoingVO.setSuccessAvatar(storePinks.stream().map(StorePink::getAvatar).collect(Collectors.toList()));
                 return pinkOngoingVO;
             }).collect(Collectors.toList());
-
+            
             list = list.stream().sorted(Comparator.comparing(StorePinkOngoingVO::getRemainNum).reversed()).collect(Collectors.toList());
-
+            
         }
-
+        
         return list;
     }
-
+    
     @Resource
     private DailySalesSummaryOfProductsMapper dailySalesSummaryOfProductsMapper;
-
+    
     @Override
     public List<ProductCarouselVO> carousel(Long productId) {
         List<ProductCarouselDTO> pinks = dailySalesSummaryOfProductsMapper.pinkByProductId(productId);
@@ -476,7 +471,7 @@ public class StorePinkServiceImpl extends AbstractService<StorePink> implements
             return new ArrayList<>();
         }
         Map<Long, UserDTO> userMap = users.stream().collect(Collectors.toMap(UserDTO::getId, user -> user));
-
+        
         List<ProductCarouselVO> carousel = new ArrayList<>();
         pinks.forEach(item -> {
             UserDTO user = userMap.get(item.getUid());
@@ -503,5 +498,5 @@ public class StorePinkServiceImpl extends AbstractService<StorePink> implements
         });
         return carousel;
     }
-
+    
 }