Переглянути джерело

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

刘俊驰 1 рік тому
батько
коміт
664782a0e9

+ 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 = "年月"),

+ 3 - 95
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CooperationCalenderRefundDto.java

@@ -2,9 +2,11 @@ package com.ym.mec.biz.dal.dto;
 
 
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 
 import java.math.BigDecimal;
 
+@Data
 public class CooperationCalenderRefundDto {
 
     @ApiModelProperty(value = "缴费项目编号",required = false)
@@ -43,99 +45,5 @@ public class CooperationCalenderRefundDto {
     @ApiModelProperty(value = "合同",required = false)
     private String contractUrl;
 
-    public String getContractUrl() {
-        return contractUrl;
-    }
-
-    public void setContractUrl(String contractUrl) {
-        this.contractUrl = contractUrl;
-    }
-
-    public Long getCalenderId() {
-        return calenderId;
-    }
-
-    public void setCalenderId(Long calenderId) {
-        this.calenderId = calenderId;
-    }
-
-    public String getMusicGroupId() {
-        return musicGroupId;
-    }
-
-    public void setMusicGroupId(String musicGroupId) {
-        this.musicGroupId = musicGroupId;
-    }
-
-    public String getMusicGroupName() {
-        return musicGroupName;
-    }
-
-    public void setMusicGroupName(String musicGroupName) {
-        this.musicGroupName = musicGroupName;
-    }
-
-    public String getBatchNo() {
-        return batchNo;
-    }
-
-    public void setBatchNo(String batchNo) {
-        this.batchNo = batchNo;
-    }
-
-    public String getPaymentType() {
-        return paymentType;
-    }
-
-    public void setPaymentType(String paymentType) {
-        this.paymentType = paymentType;
-    }
-
-    public String getCalenderFeeType() {
-        return calenderFeeType;
-    }
-
-    public void setCalenderFeeType(String calenderFeeType) {
-        this.calenderFeeType = calenderFeeType;
-    }
-
-    public BigDecimal getReceivable() {
-        return receivable;
-    }
-
-    public void setReceivable(BigDecimal receivable) {
-        this.receivable = receivable;
-    }
-
-    public BigDecimal getIncome() {
-        return income;
-    }
-
-    public void setIncome(BigDecimal income) {
-        this.income = income;
-    }
-
-    public BigDecimal getPrepaidFee() {
-        return prepaidFee;
-    }
-
-    public void setPrepaidFee(BigDecimal prepaidFee) {
-        this.prepaidFee = prepaidFee;
-    }
-
-    public String getNextRefundDate() {
-        return nextRefundDate;
-    }
-
-    public void setNextRefundDate(String nextRefundDate) {
-        this.nextRefundDate = nextRefundDate;
-    }
-
-    public String getRefundStatus() {
-        return refundStatus;
-    }
-
-    public void setRefundStatus(String refundStatus) {
-        this.refundStatus = refundStatus;
-    }
+    private String memo;
 }

+ 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);
 }

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

@@ -455,8 +455,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)){
@@ -1316,7 +1316,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
     		throw new BizException("缴费项目[{}]查询失败", calenderId);
     	}
     	
-    	if(musicGroupPaymentCalender.getStatus() != PaymentCalenderStatusEnum.DRAFT && musicGroupPaymentCalender.getStatus() != PaymentCalenderStatusEnum.REJECT){
+    	if(musicGroupPaymentCalender.getStatus() != PaymentCalenderStatusEnum.DRAFT
+                && musicGroupPaymentCalender.getStatus() != PaymentCalenderStatusEnum.REJECT
+        && musicGroupPaymentBaseCalender.getPaymentType() != GOODS_PURCHASE){
     		throw new BizException("当前缴费项目状态不支持修改");
     	}
     	

+ 20 - 7
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;
@@ -291,9 +294,15 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
         for (int i = 0; i < goodsOrderDetails.size(); i++) {
             StudentPaymentOrderDetail orderDetail = orderDetails.get(i);
             //获取支付金额比例
-            BigDecimal ratioAmount = orderDetail.getPrice().divide(detailTotalPrice, 6, BigDecimal.ROUND_HALF_UP);
-            //获取优惠券金额比例
-            BigDecimal ratioCouponAmount = orderDetail.getRemitFee().divide(detailTotalRemitPrice, 6, BigDecimal.ROUND_HALF_UP);
+            BigDecimal ratioAmount = BigDecimal.ZERO;
+            if(detailTotalPrice.compareTo(BigDecimal.ZERO) > 0){
+                ratioAmount = orderDetail.getPrice().divide(detailTotalPrice, 6, BigDecimal.ROUND_HALF_UP);
+            }
+            BigDecimal ratioCouponAmount = BigDecimal.ZERO;
+            if (detailTotalRemitPrice.compareTo(BigDecimal.ZERO) > 0) {
+                //获取优惠券金额比例
+                ratioCouponAmount = orderDetail.getRemitFee().divide(detailTotalRemitPrice, 6, BigDecimal.ROUND_HALF_UP);
+            }
             //获取分配的余额
             BigDecimal detailBalance;
             //获取分配的优惠券金额
@@ -627,7 +636,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 +679,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 +779,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 +788,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) {

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

@@ -31,6 +31,9 @@
 			<if test="bean.memo != null and bean.memo != ''">
 				memo_ = #{bean.memo},
 			</if>
+			<if test="bean.refundDate != null and bean.refundDate != ''">
+				refund_date_ = #{bean.refundDate},
+			</if>
 			<if test="bean.subRefundAmount != null">
 				sub_refund_amount_ = #{bean.subRefundAmount},
 			</if>
@@ -157,6 +160,7 @@
 		<result property="receivable" column="receivable_"/>
 		<result property="prepaidFee" column="prepaidFee"/>
 		<result property="income" column="income_"/>
+		<result property="memo" column="memo_"/>
 		<result property="nextRefundDate" column="nextRefundDate"/>
 		<result property="refundStatus" column="refundStatus"/>
 		<result property="contractUrl" column="contract_url_"/>
@@ -189,7 +193,7 @@
 		</if>
 	</sql>
 	<select id="queryCoopCalender" resultMap="CooperationCalenderRefundDto">
-		select crp.calender_id_,mgpc.music_group_id_,mg.name_ music_group_name_,mgpc.batch_no_,mgpc.payment_type_,mgpc.calender_fee_type_,
+		select crp.calender_id_,crp.memo_,mgpc.music_group_id_,mg.name_ music_group_name_,mgpc.batch_no_,mgpc.payment_type_,mgpc.calender_fee_type_,
 			   SUM(crp.refund_amount_) receivable_,SUM(crp.sub_refund_amount_) prepaidFee,SUM(crp.income_) income_,
 			   MIN(CASE WHEN crp.refund_flag_ = 0 THEN crp.refund_date_ ELSE NULL END) nextRefundDate,crp.organ_id_,mgpc.contract_url_
 		from music_group_calender_refund_period crp

+ 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_