Selaa lähdekoodia

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

zouxuan 5 vuotta sitten
vanhempi
commit
043a6622e5
19 muutettua tiedostoa jossa 248 lisäystä ja 54 poistoa
  1. 7 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDetailDao.java
  2. 26 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseFormDto.java
  3. 14 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/RegisterPayDto.java
  4. 15 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupSubjectGoodsGroup.java
  5. 12 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPaymentOrder.java
  6. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPaymentOrderDetail.java
  7. 6 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/OrderDetailTypeEnum.java
  8. 7 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentPaymentOrderDetailService.java
  9. 3 2
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java
  10. 58 5
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  11. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderDetailServiceImpl.java
  12. 61 31
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  13. 0 2
      mec-biz/src/main/resources/config/mybatis/EmployeeInfoMapper.xml
  14. 5 4
      mec-biz/src/main/resources/config/mybatis/MusicGroupSubjectGoodsGroupMapper.xml
  15. 6 2
      mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderDetailMapper.xml
  16. 6 2
      mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml
  17. 2 1
      mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml
  18. 2 0
      mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java
  19. 2 2
      mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDetailDao.java

@@ -78,4 +78,11 @@ public interface StudentPaymentOrderDetailDao extends BaseDAO<Long, StudentPayme
      * @return
      */
     StudentPaymentOrderDetail findApplyOrderMusical(@Param("orderId") Long orderId);
+
+    /**
+     *
+     * @param orderId
+     * @return
+     */
+    List<String> getOrderDetailType(@Param("orderId") Long orderId);
 }

+ 26 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseFormDto.java

@@ -0,0 +1,26 @@
+package com.ym.mec.biz.dal.dto;
+
+import java.math.BigDecimal;
+
+public class CourseFormDto {
+
+    private String type;
+
+    private BigDecimal price;
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public BigDecimal getPrice() {
+        return price;
+    }
+
+    public void setPrice(BigDecimal price) {
+        this.price = price;
+    }
+}

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/RegisterPayDto.java

@@ -1,6 +1,9 @@
 package com.ym.mec.biz.dal.dto;
 
+import io.swagger.annotations.ApiModelProperty;
+
 import java.math.BigDecimal;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -23,6 +26,9 @@ public class RegisterPayDto {
     //是否余额支付
     private Boolean isUseBalancePayment = false;
 
+    @ApiModelProperty(value = "可选课程的key",required = false)
+    private List<String> courseKeys;
+
 
     public Integer getRegisterId() {
         return registerId;
@@ -79,4 +85,12 @@ public class RegisterPayDto {
     public void setGoodsGroups(Map<Long, String> goodsGroups) {
         this.goodsGroups = goodsGroups;
     }
+
+    public List<String> getCourseKeys() {
+        return courseKeys;
+    }
+
+    public void setCourseKeys(List<String> courseKeys) {
+        this.courseKeys = courseKeys;
+    }
 }

+ 15 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupSubjectGoodsGroup.java

@@ -52,9 +52,14 @@ public class MusicGroupSubjectGoodsGroup {
 	//购买方式
 	private KitGroupPurchaseTypeEnum kitGroupPurchaseType;
 
-	//购买方式-减免金额 json
+	//购买方式-乐器减免金额 json
+	@ApiModelProperty(value = "购买方式-乐器减免金额 json",required = false)
 	private String kitGroupPurchaseTypeJson;
 
+	//购买方式-减免金额 json
+	@ApiModelProperty(value = "购买方式-课程减免金额 json",required = false)
+	private String coursePurchaseTypeJson;
+
 
 	/**  */
 	private java.util.Date createTime;
@@ -178,6 +183,14 @@ public class MusicGroupSubjectGoodsGroup {
 		this.kitGroupPurchaseType = kitGroupPurchaseType;
 	}
 
+	public String getCoursePurchaseTypeJson() {
+		return coursePurchaseTypeJson;
+	}
+
+	public void setCoursePurchaseTypeJson(String coursePurchaseTypeJson) {
+		this.coursePurchaseTypeJson = coursePurchaseTypeJson;
+	}
+
 
 	public String getKitGroupPurchaseTypeJson() {
 		return kitGroupPurchaseTypeJson;
@@ -191,4 +204,5 @@ public class MusicGroupSubjectGoodsGroup {
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);
 	}
+
 }

+ 12 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPaymentOrder.java

@@ -111,9 +111,12 @@ public class StudentPaymentOrder {
 	
 	private SysUser user = new SysUser();
 
-	//优惠金额
+	//乐器优惠金额
 	private BigDecimal remitFee;
 
+	//课程优惠金额
+	private BigDecimal courseRemitFee;
+
 	public void setId(Long id){
 		this.id = id;
 	}
@@ -342,4 +345,12 @@ public class StudentPaymentOrder {
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);
 	}
+
+	public BigDecimal getCourseRemitFee() {
+		return courseRemitFee;
+	}
+
+	public void setCourseRemitFee(BigDecimal courseRemitFee) {
+		this.courseRemitFee = courseRemitFee;
+	}
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPaymentOrderDetail.java

@@ -45,6 +45,9 @@ public class StudentPaymentOrderDetail {
 	//商品成本价
 	private String goodsPrices;
 
+	//减免费用
+	private BigDecimal remitFee;
+
 	public void setId(Long id){
 		this.id = id;
 	}
@@ -121,4 +124,12 @@ public class StudentPaymentOrderDetail {
 	public void setGoodsPrices(String goodsPrices) {
 		this.goodsPrices = goodsPrices;
 	}
+
+	public BigDecimal getRemitFee() {
+		return remitFee;
+	}
+
+	public void setRemitFee(BigDecimal remitFee) {
+		this.remitFee = remitFee;
+	}
 }

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

@@ -10,7 +10,12 @@ public enum OrderDetailTypeEnum implements BaseEnum<String, OrderDetailTypeEnum>
 	ACCESSORIES("ACCESSORIES", "辅件"),
 	TEACHING("TEACHING", "教谱"),
 	OTHER("OTHER", "其他"),
-	COURSE("COURSE", "课程");
+	COURSE("COURSE", "课程"),
+	MUSIC_COURSE("MUSIC_COURSE", "乐团声部训练"),
+	MIX_COURSE("MIX_COURSE", "乐团合奏训练"),
+	HIGH_ONLINE_COURSE("HIGH_ONLINE_COURSE", "网络基础训练"),
+	HOLIDAY_COURSE("HOLIDAY_COURSE", "假期集中训练"),
+	NETWORK_COURSE("NETWORK_COURSE", "乐团云课堂");
 
 	private String code;
 

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentPaymentOrderDetailService.java

@@ -70,4 +70,11 @@ public interface StudentPaymentOrderDetailService extends BaseService<Long, Stud
      * @return
      */
     StudentPaymentOrderDetail findApplyOrderMusical(Long orderId);
+
+    /**
+     * 获取订单类型的详情
+     * @param orderId
+     * @return
+     */
+    List<String> getOrderDetailType(Long orderId);
 }

+ 3 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java

@@ -89,7 +89,8 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
 	 * @return
 	 */
 	StudentPaymentOrder addOrder(StudentRegistration studentRegistration, BigDecimal amount, String orderNo, String paymentChannel, BigDecimal courseFee,
-			List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList) throws Exception;
+			List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList,List<CourseFormDto> courseForms,
+								 BigDecimal remitFee,BigDecimal courseRemitFee) throws Exception;
 
 	/**
 	 * 学生注册缴费重新下订单
@@ -103,7 +104,7 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
 	StudentPaymentOrder reAddOrder(
 			Integer userId, BigDecimal amount, String orderNo, String paymentChannel, BigDecimal courseFee,
 			List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList,
-			String musicGroupId,StudentPaymentOrder oldOrder);
+			String musicGroupId,StudentPaymentOrder oldOrder,List<CourseFormDto> courseForms,BigDecimal remitFee,BigDecimal courseRemitFee);
 
 	/**
 	 * 查询用户指定乐团的报名信息

+ 58 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.service.impl;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.TypeReference;
 import com.ym.mec.auth.api.client.SysUserFeignService;
@@ -409,6 +410,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         orderAmount = orderAmount.add(courseFee);
 
         BigDecimal remitFee = BigDecimal.ZERO;
+        BigDecimal courseRemitFee = BigDecimal.ZERO;
 
         //乐器及打包辅件
         List<MusicGroupSubjectGoodsGroup> goodsGroups = new ArrayList<>();
@@ -451,6 +453,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
                 Map<String, BigDecimal> groupType = JSONObject.parseObject(goodsGroup.getKitGroupPurchaseTypeJson(), new TypeReference<Map<String, BigDecimal>>() {
                 });
+                Map<String, BigDecimal> coursePurchase = JSONObject.parseObject(goodsGroup.getCoursePurchaseTypeJson(), new TypeReference<Map<String, BigDecimal>>() {
+                });
                 if (goodsGroup.getType().equals(GoodsType.INSTRUMENT)) {
                     String kitGroupPurchaseType = registerPayDto.getGoodsGroups().get(goodsGroup.getId());
                     if (!groupType.containsKey(kitGroupPurchaseType)) {
@@ -460,12 +464,13 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                         goodsGroup.setPrice(kitGroupPurchaseType.equals("FREE") ? new BigDecimal(0) : goodsGroup.getDepositFee());
                     }
                     goodsGroup.setKitGroupPurchaseType(KitGroupPurchaseTypeEnum.valueOf(kitGroupPurchaseType));
-                    remitFee = groupType.get(kitGroupPurchaseType);
+                    remitFee = groupType.get(kitGroupPurchaseType) == null ? BigDecimal.ZERO : groupType.get(kitGroupPurchaseType);
+                    courseRemitFee = coursePurchase.get(kitGroupPurchaseType) == null ? BigDecimal.ZERO : coursePurchase.get(kitGroupPurchaseType);
                 }
                 orderAmount = orderAmount.add(goodsGroup.getPrice());
                 goodsGroup.setGoodsList(goodsService.findGoodsByIds(goodsGroup.getGoodsIdList()));
             }
-            orderAmount = orderAmount.subtract(remitFee);
+            orderAmount = orderAmount.subtract(remitFee).subtract(courseRemitFee);
         }
 
         //单独辅件
@@ -485,6 +490,27 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                 orderAmount = orderAmount.add(goods.getGroupPurchasePrice());
             }
         }
+        //可选课程
+        List<CourseFormDto> courseForms = new ArrayList<>();
+        if (registerPayDto.getCourseKeys() != null && registerPayDto.getCourseKeys().size() > 0) {
+            MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
+            if (musicGroup.getCourseForm() == null) {
+                throw new BizException("可选课程不存在");
+            }
+            JSONObject courseForm = JSON.parseObject(musicGroup.getCourseForm());
+            for (String courseKey : registerPayDto.getCourseKeys()) {
+                if (courseForm.get(courseKey) == null) {
+                    throw new BizException("可选课程不存在");
+                }
+                CourseFormDto courseFormDto = new CourseFormDto();
+                JSONObject jsonObject = JSON.parseObject(courseForm.getString(courseKey));
+                orderAmount = orderAmount.add(jsonObject.getBigDecimal("value"));
+                courseFormDto.setType(courseKey);
+                courseFormDto.setPrice(jsonObject.getBigDecimal("value"));
+                courseForms.add(courseFormDto);
+            }
+        }
+
         if (amount.compareTo(orderAmount) != 0) {
             throw new BizException("商品价格不符");
         }
@@ -496,7 +522,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         String channelType = "";
 
-        StudentPaymentOrder studentPaymentOrder = studentRegistrationService.addOrder(studentRegistration, amount, orderNo, channelType, courseFee, goodsGroups, goodsList, otherGoodsList);
+        StudentPaymentOrder studentPaymentOrder = studentRegistrationService.addOrder(studentRegistration, amount, orderNo, channelType, courseFee, goodsGroups, goodsList, otherGoodsList, courseForms,remitFee,courseRemitFee);
         studentPaymentOrder.setVersion(0);
 
         Date date = new Date();
@@ -518,6 +544,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         }
         studentPaymentOrder.setPaymentChannel("BALANCE");
         studentPaymentOrder.setRemitFee(remitFee);
+        studentPaymentOrder.setCourseRemitFee(courseRemitFee);
         studentPaymentOrder.setOrganId(musicGroup.getOrganId());
         studentPaymentOrder.setRoutingOrganId(musicGroup.getOrganId());
         studentPaymentOrder.setUpdateTime(date);
@@ -589,6 +616,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         orderAmount = orderAmount.add(courseFee);
 
         BigDecimal remitFee = BigDecimal.ZERO;
+        BigDecimal courseRemitFee = BigDecimal.ZERO;
 
         //乐器及打包辅件
         List<MusicGroupSubjectGoodsGroup> goodsGroups = new ArrayList<>();
@@ -631,6 +659,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
                 Map<String, BigDecimal> groupType = JSONObject.parseObject(goodsGroup.getKitGroupPurchaseTypeJson(), new TypeReference<Map<String, BigDecimal>>() {
                 });
+                Map<String, BigDecimal> coursePurchase = JSONObject.parseObject(goodsGroup.getCoursePurchaseTypeJson(), new TypeReference<Map<String, BigDecimal>>() {
+                });
                 if (goodsGroup.getType().equals(GoodsType.INSTRUMENT)) {
                     String kitGroupPurchaseType = registerPayDto.getGoodsGroups().get(goodsGroup.getId());
                     if (!groupType.containsKey(kitGroupPurchaseType)) {
@@ -641,11 +671,12 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                     }
                     goodsGroup.setKitGroupPurchaseType(KitGroupPurchaseTypeEnum.valueOf(kitGroupPurchaseType));
                     remitFee = groupType.get(kitGroupPurchaseType);
+                    courseRemitFee = coursePurchase.get(kitGroupPurchaseType) == null ? BigDecimal.ZERO : coursePurchase.get(kitGroupPurchaseType);
                 }
                 orderAmount = orderAmount.add(goodsGroup.getPrice());
                 goodsGroup.setGoodsList(goodsService.findGoodsByIds(goodsGroup.getGoodsIdList()));
             }
-            orderAmount = orderAmount.subtract(remitFee);
+            orderAmount = orderAmount.subtract(remitFee).subtract(courseRemitFee);
         }
 
         //单独辅件
@@ -665,6 +696,27 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                 orderAmount = orderAmount.add(goods.getGroupPurchasePrice());
             }
         }
+        //可选课程
+        List<CourseFormDto> courseForms = new ArrayList<>();
+        if (registerPayDto.getCourseKeys() != null && registerPayDto.getCourseKeys().size() > 0) {
+            MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
+            if (musicGroup.getCourseForm() == null) {
+                throw new BizException("可选课程不存在");
+            }
+            JSONObject courseForm = JSON.parseObject(musicGroup.getCourseForm());
+            for (String courseKey : registerPayDto.getCourseKeys()) {
+                if (courseForm.get(courseKey) == null) {
+                    throw new BizException("可选课程不存在");
+                }
+                CourseFormDto courseFormDto = new CourseFormDto();
+                JSONObject jsonObject = JSON.parseObject(courseForm.getString(courseKey));
+                orderAmount = orderAmount.add(jsonObject.getBigDecimal("value"));
+                courseFormDto.setType(courseKey);
+                courseFormDto.setPrice(jsonObject.getBigDecimal("value"));
+                courseForms.add(courseFormDto);
+            }
+        }
+
         if (amount.compareTo(orderAmount) != 0) {
             throw new BizException("商品价格不符");
         }
@@ -677,7 +729,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         String channelType = "";
 
-        StudentPaymentOrder studentPaymentOrder = studentRegistrationService.reAddOrder(userId, amount, orderNo, channelType, courseFee, goodsGroups, goodsList, otherGoodsList, studentRegistration.getMusicGroupId(), ApplyOrder);
+        StudentPaymentOrder studentPaymentOrder = studentRegistrationService.reAddOrder(userId, amount, orderNo, channelType, courseFee, goodsGroups, goodsList, otherGoodsList, studentRegistration.getMusicGroupId(), ApplyOrder, courseForms,remitFee,courseRemitFee);
         studentPaymentOrder.setVersion(0);
         Date date = new Date();
 
@@ -699,6 +751,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         }
         studentPaymentOrder.setPaymentChannel("BALANCE");
         studentPaymentOrder.setRemitFee(remitFee);
+        studentPaymentOrder.setCourseRemitFee(courseRemitFee);
         studentPaymentOrder.setOrganId(musicGroup.getOrganId());
         studentPaymentOrder.setRoutingOrganId(musicGroup.getOrganId());
         studentPaymentOrder.setUpdateTime(date);

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderDetailServiceImpl.java

@@ -211,4 +211,9 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
     public StudentPaymentOrderDetail findApplyOrderMusical(Long orderId) {
         return studentPaymentOrderDetailDao.findApplyOrderMusical(orderId);
     }
+
+    @Override
+    public List<String> getOrderDetailType(Long orderId) {
+        return studentPaymentOrderDetailDao.getOrderDetailType(orderId);
+    }
 }

+ 61 - 31
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -277,7 +277,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
     @Override
     @Transactional
-    public StudentPaymentOrder addOrder(StudentRegistration studentRegistration, BigDecimal amount, String orderNo, String paymentChannel, BigDecimal courseFee, List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList) throws Exception {
+    public StudentPaymentOrder addOrder(StudentRegistration studentRegistration, BigDecimal amount, String orderNo, String paymentChannel, BigDecimal courseFee, List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList, List<CourseFormDto> courseForms,BigDecimal remitFee,BigDecimal courseRemitFee) throws Exception {
         Date date = new Date();
         StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
         studentPaymentOrder.setUserId(studentRegistration.getUserId());
@@ -294,7 +294,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         ArrayList<StudentPaymentOrderDetail> studentPaymentOrderDetailList = new ArrayList<>();
         StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
         studentPaymentOrderDetail.setType(OrderDetailTypeEnum.COURSE);
-        studentPaymentOrderDetail.setPrice(courseFee);
+        studentPaymentOrderDetail.setPrice(courseFee.subtract(courseRemitFee));
+        studentPaymentOrderDetail.setRemitFee(courseRemitFee);
         studentPaymentOrderDetail.setCreateTime(date);
         studentPaymentOrderDetail.setUpdateTime(date);
         studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
@@ -302,25 +303,18 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         //乐器及打包辅件
         if (goodsGroups != null && goodsGroups.size() > 0) {
             for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
-                List<Map<String, Object>> goodsPrices = new ArrayList<>();
-                for (Goods goods : goodsGroup.getGoodsList()) {
-                    HashMap<String, Object> goodsPrice = new HashMap<>();
-                    goodsPrice.put("id", goods.getId());
-                    goodsPrice.put("discountPrice", goods.getDiscountPrice());
-                    goodsPrice.put("agreeCostPrice", goods.getAgreeCostPrice());
-                    goodsPrices.add(goodsPrice);
-                }
-
                 StudentPaymentOrderDetail studentPaymentOrderDetail4goodsGroup = new StudentPaymentOrderDetail();
+                studentPaymentOrderDetail4goodsGroup.setRemitFee(BigDecimal.ZERO);
                 OrderDetailTypeEnum type = null;
                 if (goodsGroup.getType().equals(GoodsType.INSTRUMENT)) {
                     type = OrderDetailTypeEnum.MUSICAL;
+                    goodsGroup.setPrice(goodsGroup.getPrice().subtract(remitFee));
+                    studentPaymentOrderDetail4goodsGroup.setRemitFee(remitFee);
                 } else if (goodsGroup.getType().equals(GoodsType.ACCESSORIES)) {
                     type = OrderDetailTypeEnum.ACCESSORIES;
                 } else if (goodsGroup.getType().equals(GoodsType.OTHER)) {
                     type = OrderDetailTypeEnum.TEACHING;
                 }
-                studentPaymentOrderDetail4goodsGroup.setGoodsPrices(JSON.toJSONString(goodsPrices));
                 studentPaymentOrderDetail4goodsGroup.setType(type);
                 studentPaymentOrderDetail4goodsGroup.setPrice(goodsGroup.getPrice());
                 studentPaymentOrderDetail4goodsGroup.setGoodsIdList(goodsGroup.getGoodsIdList());
@@ -334,17 +328,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
         //单独辅件
         if (goodsList != null && goodsList.size() > 0) {
-            List<Map<String, Object>> goodsPrices = new ArrayList<>();
             for (Goods goods : goodsList) {
-                HashMap<String, Object> goodsPrice = new HashMap<>();
-                goodsPrice.put("id", goods.getId());
-                goodsPrice.put("discountPrice", goods.getDiscountPrice());
-                goodsPrice.put("agreeCostPrice", goods.getAgreeCostPrice());
-                goodsPrices.add(goodsPrice);
-
                 StudentPaymentOrderDetail studentPaymentOrderDetail4goods = new StudentPaymentOrderDetail();
                 OrderDetailTypeEnum orderDetailType = goods.getType().equals(GoodsType.INSTRUMENT) ? OrderDetailTypeEnum.MUSICAL : OrderDetailTypeEnum.ACCESSORIES;
-                studentPaymentOrderDetail4goods.setGoodsPrices(JSON.toJSONString(goodsPrices));
                 studentPaymentOrderDetail4goods.setType(orderDetailType);
                 studentPaymentOrderDetail4goods.setPrice(goods.getGroupPurchasePrice());
                 studentPaymentOrderDetail4goods.setGoodsIdList(goods.getId().toString());
@@ -356,17 +342,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         }
         //单独教谱
         if (otherGoodsList != null && otherGoodsList.size() > 0) {
-            List<Map<String, Object>> goodsPrices = new ArrayList<>();
 
             for (Goods goods : otherGoodsList) {
-                HashMap<String, Object> goodsPrice = new HashMap<>();
-                goodsPrice.put("id", goods.getId());
-                goodsPrice.put("discountPrice", goods.getDiscountPrice());
-                goodsPrice.put("agreeCostPrice_", goods.getAgreeCostPrice());
-                goodsPrices.add(goodsPrice);
-
                 StudentPaymentOrderDetail studentPaymentOrderDetail4otherGoods = new StudentPaymentOrderDetail();
-                studentPaymentOrderDetail4otherGoods.setGoodsPrices(JSON.toJSONString(goodsPrices));
                 studentPaymentOrderDetail4otherGoods.setType(OrderDetailTypeEnum.TEACHING);
                 studentPaymentOrderDetail4otherGoods.setPrice(goods.getGroupPurchasePrice());
                 studentPaymentOrderDetail4otherGoods.setGoodsIdList(goods.getId().toString());
@@ -376,6 +354,30 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentPaymentOrderDetailList.add(studentPaymentOrderDetail4otherGoods);
             }
         }
+        //可选课程
+        if (courseForms != null && courseForms.size() > 0) {
+            for (CourseFormDto courseForm : courseForms) {
+                OrderDetailTypeEnum courType = OrderDetailTypeEnum.MUSIC_COURSE;
+                if (courseForm.getType().equals("soundInfo")) {
+                    courType = OrderDetailTypeEnum.MUSIC_COURSE;
+                } else if (courseForm.getType().equals("allInfo")) {
+                    courType = OrderDetailTypeEnum.MIX_COURSE;
+                } else if (courseForm.getType().equals("baseInfo")) {
+                    courType = OrderDetailTypeEnum.HIGH_ONLINE_COURSE;
+                } else if (courseForm.getType().equals("holidayInfo")) {
+                    courType = OrderDetailTypeEnum.HOLIDAY_COURSE;
+                } else if (courseForm.getType().equals("networkInfo")) {
+                    courType = OrderDetailTypeEnum.NETWORK_COURSE;
+                }
+                StudentPaymentOrderDetail studentPaymentOrderDetailCourse = new StudentPaymentOrderDetail();
+                studentPaymentOrderDetailCourse.setType(courType);
+                studentPaymentOrderDetailCourse.setPrice(courseForm.getPrice());
+                studentPaymentOrderDetailCourse.setCreateTime(date);
+                studentPaymentOrderDetailCourse.setUpdateTime(date);
+                studentPaymentOrderDetailCourse.setPaymentOrderId(studentPaymentOrder.getId());
+                studentPaymentOrderDetailList.add(studentPaymentOrderDetailCourse);
+            }
+        }
 
         studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
 
@@ -407,7 +409,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
     @Override
     @Transactional
-    public StudentPaymentOrder reAddOrder(Integer userId, BigDecimal amount, String orderNo, String paymentChannel, BigDecimal courseFee, List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList, String musicGroupId, StudentPaymentOrder oldOrder) {
+    public StudentPaymentOrder reAddOrder(Integer userId, BigDecimal amount, String orderNo, String paymentChannel, BigDecimal courseFee, List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList, String musicGroupId, StudentPaymentOrder oldOrder, List<CourseFormDto> courseForms,BigDecimal remitFee,BigDecimal courseRemitFee) {
         //关闭老订单
         oldOrder.setStatus(DealStatusEnum.CLOSE);
         studentPaymentOrderService.update(oldOrder);
@@ -427,10 +429,11 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         studentPaymentOrder.setMusicGroupId(musicGroupId);
         studentPaymentOrderService.insert(studentPaymentOrder);
 
-        ArrayList<StudentPaymentOrderDetail> studentPaymentOrderDetailList = new ArrayList<>();
+        List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = new ArrayList<>();
         StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
         studentPaymentOrderDetail.setType(OrderDetailTypeEnum.COURSE);
-        studentPaymentOrderDetail.setPrice(courseFee);
+        studentPaymentOrderDetail.setPrice(courseFee.subtract(courseRemitFee));
+        studentPaymentOrderDetail.setRemitFee(courseRemitFee);
         studentPaymentOrderDetail.setCreateTime(date);
         studentPaymentOrderDetail.setUpdateTime(date);
         studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
@@ -439,9 +442,12 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         if (goodsGroups != null && goodsGroups.size() > 0) {
             for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
                 StudentPaymentOrderDetail studentPaymentOrderDetail4goodsGroup = new StudentPaymentOrderDetail();
+                studentPaymentOrderDetail4goodsGroup.setRemitFee(BigDecimal.ZERO);
                 OrderDetailTypeEnum type = null;
                 if (goodsGroup.getType().equals(GoodsType.INSTRUMENT)) {
                     type = OrderDetailTypeEnum.MUSICAL;
+                    goodsGroup.setPrice(goodsGroup.getPrice().subtract(remitFee));
+                    studentPaymentOrderDetail4goodsGroup.setRemitFee(remitFee);
                 } else if (goodsGroup.getType().equals(GoodsType.ACCESSORIES)) {
                     type = OrderDetailTypeEnum.ACCESSORIES;
                 } else if (goodsGroup.getType().equals(GoodsType.OTHER)) {
@@ -486,6 +492,30 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentPaymentOrderDetailList.add(studentPaymentOrderDetail4otherGoods);
             }
         }
+        //可选课程
+        if (courseForms != null && courseForms.size() > 0) {
+            for (CourseFormDto courseForm : courseForms) {
+                OrderDetailTypeEnum courType = OrderDetailTypeEnum.MUSIC_COURSE;
+                if (courseForm.getType().equals("soundInfo")) {
+                    courType = OrderDetailTypeEnum.MUSIC_COURSE;
+                } else if (courseForm.getType().equals("allInfo")) {
+                    courType = OrderDetailTypeEnum.MIX_COURSE;
+                } else if (courseForm.getType().equals("baseInfo")) {
+                    courType = OrderDetailTypeEnum.HIGH_ONLINE_COURSE;
+                } else if (courseForm.getType().equals("holidayInfo")) {
+                    courType = OrderDetailTypeEnum.HOLIDAY_COURSE;
+                } else if (courseForm.getType().equals("networkInfo")) {
+                    courType = OrderDetailTypeEnum.NETWORK_COURSE;
+                }
+                StudentPaymentOrderDetail studentPaymentOrderDetailCourse = new StudentPaymentOrderDetail();
+                studentPaymentOrderDetailCourse.setType(courType);
+                studentPaymentOrderDetailCourse.setPrice(courseForm.getPrice());
+                studentPaymentOrderDetailCourse.setCreateTime(date);
+                studentPaymentOrderDetailCourse.setUpdateTime(date);
+                studentPaymentOrderDetailCourse.setPaymentOrderId(studentPaymentOrder.getId());
+                studentPaymentOrderDetailList.add(studentPaymentOrderDetailCourse);
+            }
+        }
 
         studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
 

+ 0 - 2
mec-biz/src/main/resources/config/mybatis/EmployeeInfoMapper.xml

@@ -88,9 +88,7 @@
 			<if test="emergencyContactPhone != null">
 				emergency_contact_phone_ = #{emergencyContactPhone},
 			</if>
-			<if test="resignationDate != null">
 				resignation_date_ = #{resignationDate},
-			</if>
 			<if test="position != null">
 				position_ = #{position,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 			</if>

+ 5 - 4
mec-biz/src/main/resources/config/mybatis/MusicGroupSubjectGoodsGroupMapper.xml

@@ -18,6 +18,7 @@
         <result column="deposit_fee_" property="depositFee"/>
         <result column="remission_course_fee_" property="remissionCourseFee"/>
         <result column="kit_group_purchase_type_json_" property="kitGroupPurchaseTypeJson"/>
+        <result column="course_purchase_type_json_" property="coursePurchaseTypeJson"/>
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -38,16 +39,16 @@
             parameterType="com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup"
             useGeneratedKeys="true" keyColumn="id" keyProperty="id">
         INSERT INTO music_group_subject_goods_group
-        (id_,name_,type_,music_group_id_,subject_id_,goods_id_list_,create_time_,update_time_,price_,deposit_fee_,remission_course_fee_,kit_group_purchase_type_json_)
-        VALUES(#{id},#{name},#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{musicGroupId},#{subjectId},#{goodsIdList},NOW(),NOW(),#{price},#{depositFee},#{remissionCourseFee},#{kitGroupPurchaseTypeJson})
+        (id_,name_,type_,music_group_id_,subject_id_,goods_id_list_,create_time_,update_time_,price_,deposit_fee_,remission_course_fee_,kit_group_purchase_type_json_,course_purchase_type_json_)
+        VALUES(#{id},#{name},#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{musicGroupId},#{subjectId},#{goodsIdList},NOW(),NOW(),#{price},#{depositFee},#{remissionCourseFee},#{kitGroupPurchaseTypeJson},#{coursePurchaseTypeJson})
     </insert>
 
     <insert id="batchInsert" parameterType="java.util.List">
         INSERT INTO music_group_subject_goods_group
-        (name_,type_,music_group_id_,subject_id_,goods_id_list_,create_time_,update_time_,price_,deposit_fee_,remission_course_fee_,kit_group_purchase_type_json_) VALUES
+        (name_,type_,music_group_id_,subject_id_,goods_id_list_,create_time_,update_time_,price_,deposit_fee_,remission_course_fee_,kit_group_purchase_type_json_,course_purchase_type_json_) VALUES
         <foreach collection="lists" item="item" index="index" separator=",">
             (#{item.name},#{item.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-            #{musicGroupId},#{item.subjectId},#{item.goodsIdList},now(),now(),#{item.price},#{item.depositFee},#{item.remissionCourseFee},#{item.kitGroupPurchaseTypeJson})
+            #{musicGroupId},#{item.subjectId},#{item.goodsIdList},now(),now(),#{item.price},#{item.depositFee},#{item.remissionCourseFee},#{item.kitGroupPurchaseTypeJson},#{item.coursePurchaseTypeJson})
         </foreach>
     </insert>
 

+ 6 - 2
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderDetailMapper.xml

@@ -88,11 +88,11 @@
 
     <insert id="batchAdd" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id_">
         INSERT INTO student_payment_order_detail
-        (id_,type_,goods_id_list_,price_,create_time_,update_time_,payment_order_id_,kit_group_purchase_type_)
+        (id_,type_,goods_id_list_,price_,remit_fee_,create_time_,update_time_,payment_order_id_,kit_group_purchase_type_)
         VALUES
         <foreach collection="studentPaymentOrderDetailList" item="orderDetail" separator=",">
             (#{orderDetail.id},#{orderDetail.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-            #{orderDetail.goodsIdList},#{orderDetail.price},now(),now(),#{orderDetail.paymentOrderId},
+            #{orderDetail.goodsIdList},#{orderDetail.price},#{orderDetail.remitFee},now(),now(),#{orderDetail.paymentOrderId},
             #{orderDetail.kitGroupPurchaseType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler})
         </foreach>
     </insert>
@@ -163,4 +163,8 @@
     <select id="findApplyOrderMusical" resultMap="StudentPaymentOrderDetail">
         SELECT * FROM student_payment_order_detail WHERE payment_order_id_ = #{orderId} AND type_ = 'MUSICAL' LIMIT 1
     </select>
+
+    <select id="getOrderDetailType" resultType="java.lang.String">
+        SELECT DISTINCT type_ FROM student_payment_order_detail WHERE payment_order_id_ = #{orderId}
+    </select>
 </mapper>

+ 6 - 2
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml

@@ -18,6 +18,7 @@
         <result column="per_amount_" property="perAmount"/>
         <result column="balance_payment_amount_" property="balancePaymentAmount"/>
         <result column="remit_fee_" property="remitFee"/>
+        <result column="course_remit_fee_" property="courseRemitFee"/>
         <result column="trans_no_" property="transNo"/>
         <result column="status_" property="status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="memo_" property="memo"/>
@@ -85,14 +86,14 @@
         INSERT INTO student_payment_order
         (id_, group_type_, user_id_, organ_id_, routing_organ_id_, type_, expect_amount_, actual_amount_, com_amount_,
          per_amount_,
-         balance_payment_amount_, remit_fee_, trans_no_,
+         balance_payment_amount_, remit_fee_,course_remit_fee_, trans_no_,
          status_, memo_, create_time_, update_time_, payment_channel_, payment_business_channel_,
          payment_account_no_, mer_nos_, order_no_, music_group_id_, class_group_id_, pay_time_)
         VALUES (#{id}, #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
                 #{userId}, #{organId}, #{routingOrganId},
                 #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
                 #{expectAmount}, #{actualAmount}, #{comAmount}, #{perAmount}, #{balancePaymentAmount},
-                #{remitFee}, #{transNo},
+                #{remitFee},#{courseRemitFee}, #{transNo},
                 #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{memo}, now(), now(),
                 #{paymentChannel}, #{paymentBusinessChannel}, #{paymentAccountNo}, #{merNos}, #{orderNo},
                 #{musicGroupId},
@@ -157,6 +158,9 @@
             <if test="remitFee != null">
                 remit_fee_ = #{remitFee},
             </if>
+            <if test="courseRemitFee != null">
+                course_remit_fee_ = #{courseRemitFee},
+            </if>
             <if test="type != null">
                 type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>

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

@@ -302,9 +302,10 @@
 		FROM student_payment_order spo
         LEFT JOIN student_payment_order_detail spod ON spod.payment_order_id_ = spo.id_
         LEFT JOIN goods g ON FIND_IN_SET(g.id_,spod.goods_id_list_)
-        WHERE spo.type_ = 'APPLY' AND spo.group_type_ = 'MUSIC' AND spo.user_id_ = #{studentId} AND spo.music_group_id_ = #{musicGroupId}
+        WHERE spo.type_ = 'APPLY' AND spo.group_type_ = 'MUSIC' AND spo.user_id_ = #{studentId} AND spo.music_group_id_ = #{musicGroupId} AND spo.status_='SUCCESS'
         GROUP BY spo.id_,spod.type_
         ORDER BY spo.id_ DESC
+        LIMIT 1
     </select>
 
     <!-- 根据乐团和声部获取未分班的学生 -->

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

@@ -129,9 +129,11 @@ public class StudentOrderController extends BaseController {
         if (orderByOrderNo.getGroupType().equals(GroupType.MUSIC)) {
             MusicGroup musicGroup = musicGroupService.get(orderByOrderNo.getMusicGroupId());
             List<Goods> goodsList = studentPaymentOrderDetailService.findApplyOrderGoods(orderByOrderNo.getId());
+            List<String> orderDetailType = studentPaymentOrderDetailService.getOrderDetailType(orderByOrderNo.getId());
             orderDetail.put("goods", goodsList);
             orderDetail.put("course", musicGroup.getCourseForm());
             orderDetail.put("ownershipType", musicGroup.getOwnershipType());
+            orderDetail.put("detailType",orderDetailType);
         } else if (orderByOrderNo.getGroupType().equals(GroupType.VIP)) {
             VipBuyResultDto vipBuyResultInfo = vipGroupService.findVipBuyResultInfo(Integer.valueOf(orderByOrderNo.getMusicGroupId()));
             orderDetail.put("detail", vipBuyResultInfo);

+ 2 - 2
mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java

@@ -950,9 +950,9 @@ public class ExportController extends BaseController {
 
         try {
             String[] header = {"序号", "学生姓名", "交易流水号", "订单编号", "收款渠道", "收款账户", "应付金额", "现金支付", "余额支付", "到账时间",
-                    "关联乐团ID/VIP课ID", "课程形态", "课程费用", "减免费用", "押金", "乐器", "教辅费用", "零星收款费用", "零星收款类别", "手续费", "专业", "分部", "单位/学校", "合作机构", "备注"};
+                    "关联乐团ID/VIP课ID", "课程形态", "课程费用", "乐器减免费用","课程减免费用", "押金", "乐器", "教辅费用", "零星收款费用", "零星收款类别", "手续费", "专业", "分部", "单位/学校", "合作机构", "备注"};
             String[] body = {"id", "user.username", "transNo", "orderNo", "paymentChannel", "merNos", "expectAmount", "actualAmount", "balancePaymentAmount", "payTime", "musicGroupId",
-                    "groupType.desc", "courseFee", "remitFee", "leaseFee", "musicalFee", "teachingFee", "sporadicAmount", "sporadicType", "transferFee", "subjectName", "organName", "schoolName", "cooperationOrganName", "memo"};
+                    "groupType.desc", "courseFee", "remitFee","courseRemitFee", "leaseFee", "musicalFee", "teachingFee", "sporadicAmount", "sporadicType", "transferFee", "subjectName", "organName", "schoolName", "cooperationOrganName", "memo"};
             HSSFWorkbook workbook = POIUtil.exportExcel(header, body, studentPaymentOrderExportDtos);
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");