Browse Source

管乐迷商城改造

zouxuan 1 year ago
parent
commit
396a257d4c

+ 2 - 2
mec-application/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

@@ -888,7 +888,7 @@ public class StudentOrderController extends BaseController {
         return succeed(musicGroupRegCalender);
     }
 
-    @GetMapping("fixSellOrder")
+    /*@GetMapping("fixSellOrder")
     public HttpResponseResult<List<SellOrder>> fixSellOrder(String orderNo) {
         StudentPaymentOrder order = studentPaymentOrderService.findOrderByOrderNo(orderNo);
         List<SellOrder> sellOrders = new ArrayList<>();
@@ -915,7 +915,7 @@ public class StudentOrderController extends BaseController {
         }
         return succeed(sellOrders);
 
-    }
+    }*/
 
     @ApiImplicitParams({
             @ApiImplicitParam(name = "queryDate", dataType = "String", value = "年月"),

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

@@ -1,10 +1,7 @@
 package com.ym.mec.biz.service;
 
 
-import com.ym.mec.biz.dal.entity.MusicGroup;
-import com.ym.mec.biz.dal.entity.SellOrder;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
 import com.ym.mec.common.dto.OrderCreate;
 import com.ym.mec.common.service.BaseService;
@@ -12,6 +9,7 @@ import com.ym.mec.common.service.BaseService;
 import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
+import java.util.function.Function;
 
 
 public interface SellOrderService extends BaseService<Integer, SellOrder> {
@@ -87,8 +85,10 @@ public interface SellOrderService extends BaseService<Integer, SellOrder> {
 
     void mallRefundByOrderId(List<SellOrder> sellOrders);
 
-    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,Boolean saveFlag);
 
     List<SellOrder> initSellOrder(StudentPaymentOrder order, String musicGroupId, List<Integer> goodsIds, KitGroupPurchaseTypeEnum kitGroupPurchaseType,
-                                  BigDecimal totalBalance, BigDecimal expectTotalAmount, BigDecimal couponRemitAmount, BigDecimal actualTotalAmount,Boolean saveFlag);
+                                  BigDecimal totalBalance, BigDecimal expectTotalAmount, BigDecimal couponRemitAmount,
+                                  BigDecimal actualTotalAmount,Boolean saveFlag);
 }

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

@@ -452,8 +452,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
                 for (MusicGroupPaymentCalenderGoods e : musicGroupPaymentBaseCalender.getCalenderGoodsList()) {
                     Goods goods = goodsMap.get(e.getGoodsId());
                     e.setGoodsSn(goods.getSn());
-                    e.setTotalPrice(goods.getGroupPurchasePrice().multiply(new BigDecimal(e.getNum())));
-                    e.setSinglePrice(goods.getGroupPurchasePrice());
+                    e.setTotalPrice(goods.getDiscountPrice().multiply(new BigDecimal(e.getNum())));
+                    e.setSinglePrice(goods.getDiscountPrice());
                     e.setCalenderId(calenderId);
                     List<ComplementGoodsDto> childGoods = goodsSubService.getBaseMapper().queryChildGoods(e.getGoodsId());
                     if(CollectionUtils.isEmpty(childGoods)){

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

@@ -2,13 +2,16 @@ package com.ym.mec.biz.service.impl;
 
 
 import static com.ym.mec.biz.dal.enums.GroupType.GOODS_SELL;
+import static com.ym.mec.biz.dal.enums.GroupType.MUSIC;
 import static com.ym.mec.biz.dal.enums.OrderDetailTypeEnum.*;
 import static com.ym.mec.biz.dal.enums.OrderDetailTypeEnum.ORGAN_SHARE_PROFIT;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.*;
+import java.util.function.Consumer;
 import java.util.function.Function;
+import java.util.function.Supplier;
 import java.util.stream.Collectors;
 
 import com.alibaba.fastjson.JSON;
@@ -627,7 +630,8 @@ 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,
-                                         BigDecimal totalBalance, BigDecimal expectTotalAmount, BigDecimal couponRemitAmount, BigDecimal actualTotalAmount,Boolean saveFlag) {
+                                         BigDecimal totalBalance, BigDecimal expectTotalAmount, BigDecimal couponRemitAmount,
+                                         BigDecimal actualTotalAmount, Boolean saveFlag) {
         //可用优惠券金额
         BigDecimal subCouponRemitAmount = couponRemitAmount;
         //可用总金额
@@ -669,7 +673,8 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
             BigDecimal actualAmount;
 
             if (goodsTotalPrice.compareTo(BigDecimal.ZERO) > 0) {
-                goodsRatioAmount = nowGoods.getGroupPurchasePrice().divide(goodsTotalPrice, 6, RoundingMode.HALF_UP);
+                goodsRatioAmount = order.getGroupType() == MUSIC ?nowGoods.getGroupPurchasePrice():nowGoods.getDiscountPrice()
+                        .divide(goodsTotalPrice, 6, RoundingMode.HALF_UP);
             }
             if(i == goodies.size() - 1){
                 expectAmount = subExpectTotalAmount;
@@ -768,7 +773,8 @@ 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,Boolean saveFlag) {
+    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 +782,8 @@ 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,saveFlag==null?true:saveFlag);
+        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) {

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/StudentPaymentRouteOrderMapper.xml

@@ -60,7 +60,7 @@ calender_id_,create_time_,create_by_,update_time_,update_by_,tenant_id_,type_
     </sql>
     <select id="get" parameterType="java.lang.Long" resultMap="StudentPaymentRouteOrderMap">
         <!--@mbg.generated-->
-       SELECT spro.*,u.username_,u.phone_,s.name_ school_name_,o.name_ organ_name_,ou.username_ operator_name_ FROM student_payment_route_order spro
+       SELECT spro.*,u.username_,u.phone_,s.name_ school_name_,o.name_ organ_name_,ou.real_name_ operator_name_ FROM student_payment_route_order spro
         left join sys_user u on spro.user_id_ = u.id_
         left join sys_user ou on ou.id_ = spro.create_by_
         left join school s on s.id_ = spro.school_id_