Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/Joburgess' into Joburgess

Joburgess 5 rokov pred
rodič
commit
611e6c389c

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SellOrder.java

@@ -98,6 +98,12 @@ public class SellOrder {
     private SellTypeEnum type;
 
     /**
+     * 组合商品id
+     */
+    @ApiModelProperty(value="组合商品id")
+    private Integer parentGoodsId;
+
+    /**
     * 商品id
     */
     @ApiModelProperty(value="商品id")
@@ -437,4 +443,12 @@ public class SellOrder {
     public void setStatus(SellStatus status) {
         this.status = status;
     }
+
+    public Integer getParentGoodsId() {
+        return parentGoodsId;
+    }
+
+    public void setParentGoodsId(Integer parentGoodsId) {
+        this.parentGoodsId = parentGoodsId;
+    }
 }

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/AccountType.java

@@ -21,6 +21,6 @@ public enum AccountType implements BaseEnum<Integer, AccountType> {
 
     @Override
     public Integer getCode() {
-        return null;
+        return code;
     }
 }

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/SellStatus.java

@@ -22,6 +22,6 @@ public enum SellStatus implements BaseEnum<Integer, SellStatus> {
 
     @Override
     public Integer getCode() {
-        return null;
+        return code;
     }
 }

+ 22 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectChangeServiceImpl.java

@@ -213,7 +213,7 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
     @Transactional(rollbackFor = Exception.class)
     public SubjectChange addChange(SubjectChange subjectChange) {
         SubjectChange studentWaitPay = subjectChangeDao.getStudentWaitPay(subjectChange.getStudentId(), subjectChange.getMusicGroupId());
-        if(studentWaitPay != null){
+        if (studentWaitPay != null) {
             throw new BizException("已有未支付的声部更改,请勿重复创建");
         }
         Date nowDate = new Date();
@@ -257,6 +257,27 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
         subjectChange.setUpdateTime(nowDate);
         subjectChange.setVersion(0);
         subjectChangeDao.insert(subjectChange);
+
+        //
+        if (amountMargin.compareTo(BigDecimal.ZERO) <= 0) {
+            String orderNo = idGeneratorService.generatorId("payment") + "";
+            StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
+            studentPaymentOrder.setUserId(subjectChange.getStudentId());
+            studentPaymentOrder.setGroupType(GroupType.SUBJECT_CHANGE);
+            studentPaymentOrder.setOrderNo(orderNo);
+            studentPaymentOrder.setType(OrderTypeEnum.SUBJECT_CHANGE);
+            studentPaymentOrder.setExpectAmount(BigDecimal.ZERO);
+            studentPaymentOrder.setActualAmount(BigDecimal.ZERO);
+            studentPaymentOrder.setBalancePaymentAmount(BigDecimal.ZERO);
+            studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS);
+            studentPaymentOrder.setMusicGroupId(subjectChange.getId().toString());
+            studentPaymentOrder.setPaymentChannel("BALANCE");
+            studentPaymentOrder.setUpdateTime(nowDate);
+            studentPaymentOrder.setOrganId(subjectChange.getOrganId());
+            studentPaymentOrder.setRoutingOrganId(subjectChange.getOrganId());
+            studentPaymentOrderService.insert(studentPaymentOrder);
+
+        }
         return subjectChange;
     }
 

+ 9 - 5
mec-biz/src/main/resources/config/mybatis/SellOrderMapper.xml

@@ -17,6 +17,7 @@
         <result column="actual_amount_" property="actualAmount"/>
         <result column="balance_amount_" property="balanceAmount"/>
         <result column="type_" property="type"/>
+        <result column="parent_goods_id_" property="parentGoodsId"/>
         <result column="goods_id_" property="goodsId"/>
         <result column="goods_name_" property="goodsName"/>
         <result column="sell_cost_" property="sellCost"/>
@@ -38,7 +39,7 @@
     <sql id="Base_Column_List">
         <!--@mbg.generated-->
         id_, edu_teacher_id_,organ_id_, cooperation_organ_id_, trans_no_,order_id_, order_no_, expect_amount_,
-        actual_amount_,balance_amount_, sell_cost_, sell_cost2_, type_, goods_id_,goods_name_, num_, user_id_,
+        actual_amount_,balance_amount_, sell_cost_, sell_cost2_, type_,parent_goods_id_, goods_id_,goods_name_, num_, user_id_,
         payment_channel_,mer_no_,batch_no_,stock_type_,account_type_,status_, sell_time_, create_ime_, update_time_
     </sql>
     <select id="get" parameterType="java.lang.Integer" resultMap="SellOrder">
@@ -57,10 +58,10 @@
             useGeneratedKeys="true">
         <!--@mbg.generated-->
         insert into sell_order (edu_teacher_id_,organ_id_, cooperation_organ_id_, trans_no_,order_id_, order_no_,
-        expect_amount_,actual_amount_,balance_amount_, type_, goods_id_,goods_name_, sell_cost_, sell_cost2_, num_, user_id_, payment_channel_,
+        expect_amount_,actual_amount_,balance_amount_, type_,parent_goods_id_, goods_id_,goods_name_, sell_cost_, sell_cost2_, num_, user_id_, payment_channel_,
         mer_no_,batch_no_,stock_type_,account_type_, sell_time_, create_ime_, update_time_)
         values (#{eduTeacherId},#{organId}, #{cooperationOrganId}, #{transNo}, #{orderNo},#{orderId}, #{expectAmount},
-        #{actualAmount}, #{balanceAmount}, #{type}, #{goodsId}, #{goodsName}, #{sellCost}, #{sellCost2}, #{num}, #{userId},
+        #{actualAmount}, #{balanceAmount}, #{type},#{parentGoodsId}, #{goodsId}, #{goodsName}, #{sellCost}, #{sellCost2}, #{num}, #{userId},
         #{paymentChannel}, #{merNo},#{batchNo},#{stockType},#{accountType}, #{sellTime}, #{createIme}, #{updateTime})
     </insert>
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.SellOrder">
@@ -97,6 +98,9 @@
             <if test="type != null">
                 type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>
+            <if test="parentGoodsId != null">
+                parent_goods_id_ = #{parentGoodsId},
+            </if>
             <if test="goodsId != null">
                 goods_id_ = #{goodsId},
             </if>
@@ -148,12 +152,12 @@
 
     <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id_">
         insert into sell_order (organ_id_, cooperation_organ_id_, trans_no_,order_id_, order_no_, expect_amount_,
-        actual_amount_,balance_amount_, type_, goods_id_,goods_name_, sell_cost_, sell_cost2_, num_, user_id_, payment_channel_,
+        actual_amount_,balance_amount_, type_, parent_goods_id_, goods_id_,goods_name_, sell_cost_, sell_cost2_, num_, user_id_, payment_channel_,
         mer_no_,batch_no_,stock_type_,account_type_, sell_time_,edu_teacher_id_, create_ime_, update_time_)
         VALUE
         <foreach collection="sellOrders" separator="," item="sellOrder">
             (#{sellOrder.organId},#{sellOrder.cooperationOrganId},#{sellOrder.transNo},#{sellOrder.orderId},#{sellOrder.orderNo},
-            #{sellOrder.expectAmount},#{sellOrder.actualAmount},#{sellOrder.balanceAmount},#{sellOrder.type},#{sellOrder.goodsId},
+            #{sellOrder.expectAmount},#{sellOrder.actualAmount},#{sellOrder.balanceAmount},#{sellOrder.type},#{sellOrder.parentGoodsId},#{sellOrder.goodsId},
             #{sellOrder.goodsName},#{sellOrder.sellCost},#{sellOrder.sellCost2},#{sellOrder.num},#{sellOrder.userId},
             #{sellOrder.paymentChannel},#{sellOrder.merNo},#{sellOrder.batchNo},#{sellOrder.stockType},#{sellOrder.accountType},
             #{sellOrder.sellTime},#{sellOrder.eduTeacherId},NOW(),NOW())