瀏覽代碼

Merge branch 'zx_saas_goods' of http://git.dayaedu.com/yonge/mec into zx_saas_goods

刘俊驰 1 年之前
父節點
當前提交
0c64d52b7b

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SellOrderServiceImpl.java

@@ -875,6 +875,9 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
     @Transactional(rollbackFor = Exception.class)
     public List<SellOrder> initSellOrder(StudentPaymentOrder order, String musicGroupId, List<Integer> goodsIds,
                                          KitGroupPurchaseTypeEnum kitGroupPurchaseType,Boolean saveFlag) {
+        if (CollectionUtils.isEmpty(goodsIds)) {
+            return null;
+        }
         BigDecimal totalBalance = order.getBalancePaymentAmount();
         if (totalBalance == null) {
             totalBalance = BigDecimal.ZERO;

+ 15 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java

@@ -2251,17 +2251,26 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
             for (OrderSkuSync.SkuSync skuSync : orderSkuSync.getSkuSyncList()) {
                 List<SellOrder> sellOrderList = goodsSkuMap.get(skuSync.getSku());
                 for (int i = 0; i < skuSync.getCount(); i++) {
-                    SellOrder sellOrder = sellOrderList.get(i);
-                    if (sellOrder != null) {
-                        sellOrder.setDeliveryTime(format);
-                        sellOrder.setSellCost(skuSync.getPrice());
-                        sellOrder.setStockType(StringUtils.equalsIgnoreCase(skuSync.getType(),"INTERNAL")?StockType.INTERNAL:StockType.EXTERNAL);
-                    }
+                    SellOrder sellOrder = this.getSellorder(sellOrderList,i);
+                    sellOrder.setDeliveryTime(format);
+                    sellOrder.setSellCost(skuSync.getPrice());
+                    sellOrder.setStockType(StringUtils.equalsIgnoreCase(skuSync.getType(),"INTERNAL")?StockType.INTERNAL:StockType.EXTERNAL);
                 }
             }
         }
         sellOrderDao.batchUpdate(sellOrders);
+    }
 
+    private SellOrder getSellorder(List<SellOrder> sellOrderList,Integer index){
+        if(index >= sellOrderList.size()){
+            return new SellOrder();
+        }
+        SellOrder sellOrder = sellOrderList.get(index);
+        if(StringUtils.isNotEmpty(sellOrder.getDeliveryTime())){
+            return getSellorder(sellOrderList,index+1);
+        }else {
+            return sellOrder;
+        }
     }
 
     public BigDecimal getActualAmount(BigDecimal price, StudentPaymentOrderExportDto row) {

+ 10 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentRouteOrderServiceImpl.java

@@ -156,6 +156,11 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
             if (musicGroupPaymentCalender == null) {
                 throw new BizException("学校缴费单号(审核通过)不存在,请核查");
             }
+            if(musicGroupPaymentCalender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.GOODS_PURCHASE){
+                studentPaymentRouteOrder.setSaleAmount(studentPaymentRouteOrder.getRouteAmount());
+            }else {
+                studentPaymentRouteOrder.setServiceAmount(studentPaymentRouteOrder.getRouteAmount());
+            }
         }
         Date nowDate = new Date();
         String orderNo = idGeneratorService.generatorId("payment") + "";
@@ -208,7 +213,7 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
         MusicGroupPaymentCalender musicGroupPaymentCalender = null;
         MusicGroupPaymentCalenderAddress address = null;
         MusicGroup musicGroup = null;
-                //是否同步过商城的发货数据
+        //是否同步过商城的发货数据
         Boolean syncFlag = true;
         if (auditStatus == AuditStatusEnum.PASS) {
             if (studentPaymentRouteOrder.getCalenderId() != null) {
@@ -218,7 +223,7 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
                     address = musicGroupPaymentCalenderAddressService.lambdaQuery().
                             eq(MusicGroupPaymentCalenderAddress::getCalenderId, studentPaymentRouteOrder.getCalenderId()).one();
                     StudentPaymentOrder addressOrder = studentPaymentOrderService.findOrderByOrderNo(address.getOrderNo());
-                    syncFlag = Objects.isNull(addressOrder);
+                    syncFlag = Objects.nonNull(addressOrder);
                     if (!syncFlag){
                         orderNo = address.getOrderNo();
                     }
@@ -312,7 +317,6 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
             }
             //同步商城的发货数据
             if(!syncFlag){
-                AccountType accountType = sysPaymentConfigService.checkAccountType(PaymentChannelEnum.valueOf(studentPaymentOrder.getPaymentChannel()), studentPaymentOrder.getMerNos(), studentPaymentOrder.getTenantId());
                 List<MusicGroupPaymentCalenderGoods> calenderGoods = musicGroupPaymentCalenderGoodsService.lambdaQuery()
                         .eq(MusicGroupPaymentCalenderGoods::getCalenderId, studentPaymentRouteOrder.getCalenderId()).list();
                 List<SellOrder> sellOrderList = new ArrayList<>();
@@ -335,7 +339,7 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
                             SellOrder sellOrder = new SellOrder();
                             sellOrder.setGoodsSkuId(goodsDto.getSkuStockId());
                             sellOrder.setOrganSellCost(goodsDto.getOrganCostPrice());
-                            sellOrder.setOrderId(studentPaymentOrder.getId());
+                            sellOrder.setOrderId(studentPaymentOrder.getOrganId().longValue());
                             sellOrder.setType(StringUtils.endsWithIgnoreCase("INSTRUMENT", calenderGood.getGoodsType()) ? SellTypeEnum.INSTRUMENT
                                     : StringUtils.endsWithIgnoreCase("ACCESSORIES", calenderGood.getGoodsType()) ? SellTypeEnum.ACCESSORIES
                                     : StringUtils.endsWithIgnoreCase("TEACHING", calenderGood.getGoodsType()) ? SellTypeEnum.TEACHING
@@ -356,7 +360,7 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
                             sellOrder.setParentGoodsId(calenderGood.getGoodsId());
                             sellOrder.setNum(1);
                             sellOrder.setGoodsName(calenderGood.getGoodsName());
-                            sellOrder.setAccountType(accountType);
+                            sellOrder.setAccountType(AccountType.INTERNAL);
                             sellOrder.setCooperationOrganId(musicGroup.getCooperationOrganId());
                             sellOrder.setEduTeacherId(musicGroup.getEducationalTeacherId());
                             sellOrder.setTransNo(studentPaymentOrder.getTransNo());
@@ -372,7 +376,7 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
                 if(address.getDeliveryFlag()){
                     OrderSkuSync orderSkuSync = new OrderSkuSync();
                     orderSkuSync.setOrderNo(orderNo);
-                    orderSkuSync.setSkuSyncList(JSONArray.parseArray(address.getAddress(), OrderSkuSync.SkuSync.class));
+                    orderSkuSync.setSkuSyncList(JSONArray.parseArray(address.getDeliveryDetail(), OrderSkuSync.SkuSync.class));
                     List<OrderSkuSync> orderSkuSyncs = new ArrayList<>();
                     orderSkuSyncs.add(orderSkuSync);
                     studentPaymentOrderService.updateShippedStatus(orderSkuSyncs);