浏览代码

管乐迷商城改造

zouxuan 1 年之前
父节点
当前提交
0ff7fa8ac6

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/SellOrderService.java

@@ -87,7 +87,7 @@ public interface SellOrderService extends BaseService<Integer, SellOrder> {
 
     void mallRefundByOrderId(List<SellOrder> sellOrders);
 
-    List<SellOrder> initSellOrder(StudentPaymentOrder order, String musicGroupId, List<Integer> goodsIds, KitGroupPurchaseTypeEnum kitGroupPurchaseType);
+    List<SellOrder> initSellOrder(StudentPaymentOrder order, String musicGroupId, List<Integer> goodsIds, KitGroupPurchaseTypeEnum kitGroupPurchaseType,Boolean saveFlag);
 
     List<SellOrder> initSellOrder(StudentPaymentOrder order, String musicGroupId, List<Integer> goodsIds, KitGroupPurchaseTypeEnum kitGroupPurchaseType,
                                   BigDecimal totalBalance, BigDecimal expectTotalAmount, BigDecimal couponRemitAmount, BigDecimal actualTotalAmount,Boolean saveFlag);

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

@@ -768,7 +768,7 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public List<SellOrder> initSellOrder(StudentPaymentOrder order, String musicGroupId, List<Integer> goodsIds, KitGroupPurchaseTypeEnum kitGroupPurchaseType) {
+    public List<SellOrder> initSellOrder(StudentPaymentOrder order, String musicGroupId, List<Integer> goodsIds, KitGroupPurchaseTypeEnum kitGroupPurchaseType,Boolean saveFlag) {
         BigDecimal totalBalance = order.getBalancePaymentAmount();
         if (totalBalance == null) {
             totalBalance = BigDecimal.ZERO;
@@ -776,7 +776,7 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
         BigDecimal expectTotalAmount = order.getExpectAmount();
         BigDecimal couponRemitAmount = order.getCouponRemitFee();
         BigDecimal actualTotalAmount = order.getActualAmount();
-        return this.initSellOrder(order, musicGroupId, goodsIds, kitGroupPurchaseType, totalBalance, expectTotalAmount, couponRemitAmount, actualTotalAmount,true);
+        return this.initSellOrder(order, musicGroupId, goodsIds, kitGroupPurchaseType, totalBalance, expectTotalAmount, couponRemitAmount, actualTotalAmount,saveFlag==null?true:saveFlag);
     }
 
     public Map<String, BigDecimal> calcSellAmount(StudentPaymentOrder order,BigDecimal cloudBalanceIncome,BigDecimal cloudIncome) {

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

@@ -250,9 +250,10 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
                         goodsIdList.add(goodsId);
                     }
                 }
-                List<SellOrder> sellOrderList = goodsService.subtractStock(goodsIdList, AccountType.INTERNAL);
-
-                int i = 1;
+//                List<SellOrder> sellOrderList = goodsService.subtractStock(goodsIdList, AccountType.INTERNAL);
+                List<SellOrder> sellOrders = sellOrderService.initSellOrder(studentPaymentOrder, null, goodsIdList, null, false);
+                sellOrderService.batchInsert(sellOrders);
+                /*int i = 1;
                 for (Entry<String, Object> goodsMap : jsonObj.entrySet()) {
                     Integer goodsId = Integer.parseInt(goodsMap.getKey());
                     Integer nums = Integer.parseInt(goodsMap.getValue().toString());
@@ -312,7 +313,7 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
                         sellOrder.setType(SellTypeEnum.SCHOOL_BUY);
                     }
                 }
-                sellOrderDao.batchInsert(sellOrderList);
+                sellOrderDao.batchInsert(sellOrderList);*/
                 if(calender == null || calender.getPaymentType() != MusicGroupPaymentCalender.PaymentType.GOODS_PURCHASE){
                     OrderCreate mallOrder = new OrderCreate();
                     mallOrder.setOrchestraId(studentPaymentOrder.getMusicGroupId());
@@ -339,7 +340,7 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
                     if(studentPaymentRouteOrder.getType() == OrderTypeEnum.OTHER){
                         mallOrder.setSourceType(4);
                     }
-                    List<OrderCreate.OrderItem> items = sellOrderService.convertMallOrder(sellOrderList);
+                    List<OrderCreate.OrderItem> items = sellOrderService.convertMallOrder(sellOrders);
                     mallOrder.setOrderItemList(items);
                     CommonResult<Boolean> result = mallFeignService.productOrderCreate(mallOrder);
                     if (result.getCode() != 200) {