Browse Source

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

zouxuan 4 years ago
parent
commit
28b86f88bf

+ 11 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDetailDao.java

@@ -74,6 +74,7 @@ public interface StudentPaymentOrderDetailDao extends BaseDAO<Long, StudentPayme
 
     /**
      * 获取订单商品
+     *
      * @param orderId
      * @return
      */
@@ -81,15 +82,24 @@ public interface StudentPaymentOrderDetailDao extends BaseDAO<Long, StudentPayme
 
     /**
      * 获取订单详细
+     *
      * @param orderId
      * @return
      */
     List<StudentPaymentOrderDetail> getOrderDetail(@Param("orderId") Long orderId);
 
     /**
-     *
      * @param orderId
      * @return
      */
     List<String> getOrderDetailType(@Param("orderId") Long orderId);
+
+    /**
+     * 获取学生乐团报名购买的乐器信息
+     *
+     * @param studentId
+     * @param musicGroupId
+     * @return
+     */
+    List<StudentPaymentOrderDetail> getStudentApplyDetail(@Param("studentId") Integer studentId, @Param("musicGroupId") String musicGroupId);
 }

+ 27 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SubjectChangeDao.java

@@ -0,0 +1,27 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.biz.dal.entity.SubjectChange;
+import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface SubjectChangeDao extends BaseDAO<Integer, SubjectChange> {
+
+
+    /**
+     * 获取学生最后一次乐器替换记录
+     *
+     * @param studentId
+     * @param musicGroupId
+     * @return
+     */
+    SubjectChange getStudentLastChange(@Param("studentId") Integer studentId, @Param("musicGroupId") String musicGroupId);
+
+    /**
+     * 获取更换详情
+     * @param id
+     * @return
+     */
+    SubjectChange getChangeInfo(@Param("id") Integer id);
+}

+ 326 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SubjectChange.java

@@ -0,0 +1,326 @@
+package com.ym.mec.biz.dal.entity;
+
+import com.ym.mec.biz.dal.enums.SubjectChangeStatusEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+@ApiModel(value="com-ym-SubjectChange")
+public class SubjectChange {
+    @ApiModelProperty(value="")
+    private Integer id;
+
+    @ApiModelProperty(value="学生id")
+    private Integer studentId;
+
+    private String studentName;
+
+    @ApiModelProperty(value="分部id")
+    private Integer organId;
+
+    @ApiModelProperty(value="乐团id")
+    private String musicGroupId;
+
+    /**
+    * 原始课程费用
+    */
+    @ApiModelProperty(value="原始课程费用")
+    private BigDecimal originalCourseFee;
+
+    /**
+    * 原始乐器编号
+    */
+    @ApiModelProperty(value="原始乐器编号")
+    private Integer originalMusical;
+
+    private Goods originalMusicalGoods;
+
+    /**
+    * 原始乐器价格
+    */
+    @ApiModelProperty(value="原始乐器价格")
+    private BigDecimal originalMusicalPrice;
+
+    /**
+    * 辅件ids
+    */
+    @ApiModelProperty(value="辅件ids")
+    private String originalAccessories;
+
+    private List<Goods> originalAccessoriesGoods;
+
+    /**
+    * 辅件价格
+    */
+    @ApiModelProperty(value="辅件价格")
+    private BigDecimal originalAccessoriesPrice;
+
+    /**
+    * 替换课程价格
+    */
+    @ApiModelProperty(value="替换课程价格")
+    private BigDecimal changeCourseFee;
+
+    /**
+    * 替换乐器
+    */
+    @ApiModelProperty(value="替换乐器")
+    private Integer changeMusical;
+
+    private Goods changeMusicalGoods;
+
+
+    /**
+    * 替换乐器价格
+    */
+    @ApiModelProperty(value="替换乐器价格")
+    private BigDecimal changeMusicalPrice;
+
+    /**
+    * 替换辅件
+    */
+    @ApiModelProperty(value="替换辅件")
+    private String changeAccessories;
+    private List<Goods> changeAccessoriesGoods;
+
+
+    /**
+    * 替换辅件价格
+    */
+    @ApiModelProperty(value="替换辅件价格")
+    private BigDecimal changeAccessoriesPrice;
+
+    /**
+    * 乐器辅件差额
+    */
+    @ApiModelProperty(value="乐器辅件差额")
+    private BigDecimal goodsMargin;
+
+    /**
+    * 课程差额
+    */
+    @ApiModelProperty(value="课程差额")
+    private BigDecimal courseMargin;
+
+    /**
+    * 状态
+    */
+    @ApiModelProperty(value="状态")
+    private SubjectChangeStatusEnum status;
+
+    /**
+    * 创建时间
+    */
+    @ApiModelProperty(value="创建时间")
+    private Date createTime;
+
+    /**
+    * 修改时间
+    */
+    @ApiModelProperty(value="修改时间")
+    private Date updateTime;
+
+    private Integer version;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public BigDecimal getOriginalCourseFee() {
+        return originalCourseFee;
+    }
+
+    public void setOriginalCourseFee(BigDecimal originalCourseFee) {
+        this.originalCourseFee = originalCourseFee;
+    }
+
+    public Integer getOriginalMusical() {
+        return originalMusical;
+    }
+
+    public void setOriginalMusical(Integer originalMusical) {
+        this.originalMusical = originalMusical;
+    }
+
+    public BigDecimal getOriginalMusicalPrice() {
+        return originalMusicalPrice;
+    }
+
+    public void setOriginalMusicalPrice(BigDecimal originalMusicalPrice) {
+        this.originalMusicalPrice = originalMusicalPrice;
+    }
+
+    public String getOriginalAccessories() {
+        return originalAccessories;
+    }
+
+    public void setOriginalAccessories(String originalAccessories) {
+        this.originalAccessories = originalAccessories;
+    }
+
+    public BigDecimal getOriginalAccessoriesPrice() {
+        return originalAccessoriesPrice;
+    }
+
+    public void setOriginalAccessoriesPrice(BigDecimal originalAccessoriesPrice) {
+        this.originalAccessoriesPrice = originalAccessoriesPrice;
+    }
+
+    public BigDecimal getChangeCourseFee() {
+        return changeCourseFee;
+    }
+
+    public void setChangeCourseFee(BigDecimal changeCourseFee) {
+        this.changeCourseFee = changeCourseFee;
+    }
+
+    public Integer getChangeMusical() {
+        return changeMusical;
+    }
+
+    public void setChangeMusical(Integer changeMusical) {
+        this.changeMusical = changeMusical;
+    }
+
+    public BigDecimal getChangeMusicalPrice() {
+        return changeMusicalPrice;
+    }
+
+    public void setChangeMusicalPrice(BigDecimal changeMusicalPrice) {
+        this.changeMusicalPrice = changeMusicalPrice;
+    }
+
+    public String getChangeAccessories() {
+        return changeAccessories;
+    }
+
+    public void setChangeAccessories(String changeAccessories) {
+        this.changeAccessories = changeAccessories;
+    }
+
+    public BigDecimal getChangeAccessoriesPrice() {
+        return changeAccessoriesPrice;
+    }
+
+    public void setChangeAccessoriesPrice(BigDecimal changeAccessoriesPrice) {
+        this.changeAccessoriesPrice = changeAccessoriesPrice;
+    }
+
+    public BigDecimal getGoodsMargin() {
+        return goodsMargin;
+    }
+
+    public void setGoodsMargin(BigDecimal goodsMargin) {
+        this.goodsMargin = goodsMargin;
+    }
+
+    public BigDecimal getCourseMargin() {
+        return courseMargin;
+    }
+
+    public void setCourseMargin(BigDecimal courseMargin) {
+        this.courseMargin = courseMargin;
+    }
+
+    public SubjectChangeStatusEnum getStatus() {
+        return status;
+    }
+
+    public void setStatus(SubjectChangeStatusEnum status) {
+        this.status = status;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Integer getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(Integer studentId) {
+        this.studentId = studentId;
+    }
+
+    public String getMusicGroupId() {
+        return musicGroupId;
+    }
+
+    public void setMusicGroupId(String musicGroupId) {
+        this.musicGroupId = musicGroupId;
+    }
+
+    public Integer getVersion() {
+        return version;
+    }
+
+    public void setVersion(Integer version) {
+        this.version = version;
+    }
+
+    public String getStudentName() {
+        return studentName;
+    }
+
+    public void setStudentName(String studentName) {
+        this.studentName = studentName;
+    }
+
+    public Goods getOriginalMusicalGoods() {
+        return originalMusicalGoods;
+    }
+
+    public void setOriginalMusicalGoods(Goods originalMusicalGoods) {
+        this.originalMusicalGoods = originalMusicalGoods;
+    }
+
+    public List<Goods> getOriginalAccessoriesGoods() {
+        return originalAccessoriesGoods;
+    }
+
+    public void setOriginalAccessoriesGoods(List<Goods> originalAccessoriesGoods) {
+        this.originalAccessoriesGoods = originalAccessoriesGoods;
+    }
+
+    public Goods getChangeMusicalGoods() {
+        return changeMusicalGoods;
+    }
+
+    public void setChangeMusicalGoods(Goods changeMusicalGoods) {
+        this.changeMusicalGoods = changeMusicalGoods;
+    }
+
+    public List<Goods> getChangeAccessoriesGoods() {
+        return changeAccessoriesGoods;
+    }
+
+    public void setChangeAccessoriesGoods(List<Goods> changeAccessoriesGoods) {
+        this.changeAccessoriesGoods = changeAccessoriesGoods;
+    }
+
+    public Integer getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(Integer organId) {
+        this.organId = organId;
+    }
+}

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

@@ -11,7 +11,8 @@ public enum GroupType implements BaseEnum<String, GroupType> {
 	COMM("对外课程"),
 	REPAIR("乐器维修"),
 	GOODS_SELL("商品销售"),
-	OUTORDER("外部订单");
+	OUTORDER("外部订单"),
+	SUBJECT_CHANGE("声部更换");
 
 	private String desc;
 

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

@@ -18,7 +18,8 @@ public enum OrderTypeEnum implements BaseEnum<String, OrderTypeEnum> {
 	TENANT_RECHARGE("TENANT_RECHARGE","租户充值"),
 	GOODS_SELL("GOODS_SELL","商品销售"),
 	OUTORDER("OUTORDER", "外部订单"),
-	REPAIR("REPAIR","乐器维修");
+	REPAIR("REPAIR","乐器维修"),
+	SUBJECT_CHANGE("SUBJECT_CHANGE","声部更换");
 
 
 	private String code;

+ 30 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/SubjectChangeStatusEnum.java

@@ -0,0 +1,30 @@
+package com.ym.mec.biz.dal.enums;
+
+import com.ym.mec.common.enums.BaseEnum;
+
+public enum SubjectChangeStatusEnum implements BaseEnum<Integer, SubjectChangeStatusEnum> {
+
+    CANCELED(-1, "已取消"),
+    WAIT_PAY(0, "待支付"),
+    ING(1, "支付中"),
+    SUCCESSED(2, "已支付");
+
+    private Integer code;
+
+    private String desc;
+
+    private SubjectChangeStatusEnum(Integer code, String desc) {
+        this.code = code;
+        this.desc = desc;
+    }
+
+    @Override
+    public Integer getCode() {
+        return code;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+}

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java

@@ -250,4 +250,12 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
 	 * @return
 	 */
 	StudentMusicDetailDto getStudentDetail(Integer studentId);
+
+	/**
+	 * 获取学生
+	 * @param studentId
+	 * @param musicGroupId
+	 * @return
+	 */
+	List<StudentPaymentOrderDetail> getStudentApplyDetail(Integer studentId,String musicGroupId);
 }

+ 22 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/SubjectChangeService.java

@@ -0,0 +1,22 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.entity.SubjectChange;
+import com.ym.mec.common.service.BaseService;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+public interface SubjectChangeService extends BaseService<Integer, SubjectChange> {
+
+    SubjectChange getChangeInfo(Integer id);
+
+    /**
+     * 支付声部更换费用
+     *
+     * @param id
+     * @param amount
+     * @param isUseBalancePayment
+     * @return
+     */
+    Map payChange(Integer id, BigDecimal amount, Boolean isUseBalancePayment) throws Exception;
+}

+ 42 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -96,6 +96,12 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     private SellOrderService sellOrderService;
     @Autowired
     private ESealPlugin eSealPlugin;
+    @Autowired
+    private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
+    @Autowired
+    private SubjectChangeDao subjectChangeDao;
+    @Autowired
+    private GoodsDao goodsDao;
 
     @Override
     public BaseDAO<Long, StudentRegistration> getDAO() {
@@ -236,8 +242,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 ImResult register = imFeignService.register(new ImUserModel(userId.toString(), sysUser.getUsername(), sysUser.getAvatar()));
                 sysUser.setImToken(register.getToken());
             } else {
-                if(StringUtils.isNotEmpty(sysUser.getUsername())){
-                    if(!sysUser.getUsername().equals(studentRegistration.getName())){
+                if (StringUtils.isNotEmpty(sysUser.getUsername())) {
+                    if (!sysUser.getUsername().equals(studentRegistration.getName())) {
                         throw new BizException("操作失败:账户已被注册");
                     }
                 }
@@ -592,8 +598,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 sysUser.setImToken(register.getToken());
                 teacherDao.updateUser(sysUser);
             } else {
-                if(StringUtils.isNotEmpty(sysUser.getUsername())){
-                    if(!sysUser.getUsername().equals(studentRegistration.getName())){
+                if (StringUtils.isNotEmpty(sysUser.getUsername())) {
+                    if (!sysUser.getUsername().equals(studentRegistration.getName())) {
                         throw new BizException("操作失败:账户已被注册");
                     }
                 }
@@ -917,7 +923,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             //销售订单详情
             List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailService.getOrderDetail(studentPaymentOrder.getId());
             if (orderDetails.size() > 0) {
-                sellOrderService.addOrderDetail2SellOrder(orderDetails, studentPaymentOrder,musicGroup);
+                sellOrderService.addOrderDetail2SellOrder(orderDetails, studentPaymentOrder, musicGroup);
             }
 
             //三方乐团不发送缴费通知
@@ -1118,4 +1124,35 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     public StudentMusicDetailDto getStudentDetail(Integer studentId) {
         return studentRegistrationDao.getStudentDetail(studentId);
     }
+
+    @Override
+    public List<StudentPaymentOrderDetail> getStudentApplyDetail(Integer studentId, String musicGroupId) {
+        SubjectChange studentLastChange = subjectChangeDao.getStudentLastChange(studentId, musicGroupId);
+        List<StudentPaymentOrderDetail> details = new ArrayList<>();
+        if (studentLastChange != null) {
+            StudentPaymentOrderDetail course = new StudentPaymentOrderDetail();
+            course.setType(OrderDetailTypeEnum.COURSE);
+            course.setPrice(studentLastChange.getChangeCourseFee());
+            details.add(course);
+            if (studentLastChange.getChangeMusical() != null) {
+                StudentPaymentOrderDetail musical = new StudentPaymentOrderDetail();
+                musical.setType(OrderDetailTypeEnum.MUSICAL);
+                musical.setPrice(studentLastChange.getChangeMusicalPrice());
+                musical.setGoodsList(goodsDao.findGoodsByIds(studentLastChange.getChangeMusical().toString()));
+                details.add(musical);
+            }
+
+            if (studentLastChange.getChangeAccessories() != null) {
+                StudentPaymentOrderDetail accessories = new StudentPaymentOrderDetail();
+                accessories.setType(OrderDetailTypeEnum.ACCESSORIES);
+                accessories.setPrice(studentLastChange.getChangeAccessoriesPrice());
+                accessories.setGoodsList(goodsDao.findGoodsByIds(studentLastChange.getChangeAccessories()));
+                details.add(accessories);
+            }
+        }
+        if (details.size() <= 0) {
+            details = studentPaymentOrderDetailDao.getStudentApplyDetail(studentId, musicGroupId);
+        }
+        return details;
+    }
 }

+ 161 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectChangeServiceImpl.java

@@ -0,0 +1,161 @@
+package com.ym.mec.biz.service.impl;
+
+import com.ym.mec.biz.dal.dao.GoodsDao;
+import com.ym.mec.biz.dal.dao.StudentDao;
+import com.ym.mec.biz.dal.dao.SubjectChangeDao;
+import com.ym.mec.biz.dal.dao.SysConfigDao;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import com.ym.mec.biz.dal.entity.SubjectChange;
+import com.ym.mec.biz.dal.entity.SysUserCashAccount;
+import com.ym.mec.biz.dal.enums.*;
+import com.ym.mec.biz.service.*;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.service.IdGeneratorService;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+@Service
+public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectChange> implements SubjectChangeService {
+
+    @Autowired
+    private SubjectChangeDao subjectChangeDao;
+    @Autowired
+    private GoodsDao goodsDao;
+    @Autowired
+    private StudentDao studentDao;
+    @Autowired
+    private IdGeneratorService idGeneratorService;
+    @Autowired
+    private StudentPaymentOrderService studentPaymentOrderService;
+    @Autowired
+    private SysUserCashAccountService sysUserCashAccountService;
+    @Autowired
+    private StudentPaymentRouteOrderService studentPaymentRouteOrderService;
+    @Autowired
+    private SysConfigDao sysConfigDao;
+    @Autowired
+    private PayService payService;
+
+    @Override
+    public BaseDAO<Integer, SubjectChange> getDAO() {
+        return subjectChangeDao;
+    }
+
+    @Override
+    public SubjectChange getChangeInfo(Integer id) {
+        SubjectChange subjectChange = subjectChangeDao.getChangeInfo(id);
+        if (subjectChange == null) {
+            return null;
+        }
+        if (subjectChange.getOriginalMusical() != null) {
+            subjectChange.setOriginalMusicalGoods(goodsDao.get(subjectChange.getOriginalMusical()));
+        }
+        if (subjectChange.getOriginalAccessories() != null) {
+            subjectChange.setChangeAccessoriesGoods(goodsDao.findGoodsByIds(subjectChange.getOriginalAccessories()));
+        }
+
+        if (subjectChange.getChangeMusical() != null) {
+            subjectChange.setChangeMusicalGoods(goodsDao.get(subjectChange.getChangeMusical()));
+        }
+        if (subjectChange.getChangeAccessories() != null) {
+            subjectChange.setChangeAccessoriesGoods(goodsDao.findGoodsByIds(subjectChange.getChangeAccessories()));
+        }
+
+        return subjectChange;
+    }
+
+    @Override
+    public Map payChange(Integer id, BigDecimal viewAmount, Boolean isUseBalancePayment) throws Exception {
+        SubjectChange subjectChange = subjectChangeDao.get(id);
+        BigDecimal amount = subjectChange.getGoodsMargin().add(subjectChange.getCourseMargin());
+
+        Date date = new Date();
+        studentDao.lockUser(subjectChange.getStudentId());
+        subjectChange.setUpdateTime(date);
+        subjectChange.setStatus(SubjectChangeStatusEnum.ING);
+        if (subjectChangeDao.update(subjectChange) <= 0) {
+            throw new BizException("下单失败,请重试");
+        }
+
+        String orderNo = idGeneratorService.generatorId("payment") + "";
+
+        String channelType = "";
+
+        StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
+        studentPaymentOrder.setUserId(subjectChange.getStudentId());
+        studentPaymentOrder.setGroupType(GroupType.SUBJECT_CHANGE);
+        studentPaymentOrder.setOrderNo(orderNo);
+        studentPaymentOrder.setType(OrderTypeEnum.SUBJECT_CHANGE);
+        studentPaymentOrder.setExpectAmount(amount);
+        studentPaymentOrder.setActualAmount(amount);
+        studentPaymentOrder.setStatus(DealStatusEnum.ING);
+        studentPaymentOrder.setMusicGroupId(subjectChange.getId().toString());
+        studentPaymentOrder.setPaymentChannel("BALANCE");
+        studentPaymentOrder.setUpdateTime(date);
+        studentPaymentOrder.setOrganId(subjectChange.getOrganId());
+        studentPaymentOrder.setRoutingOrganId(subjectChange.getOrganId());
+
+        studentPaymentOrderService.insert(studentPaymentOrder);
+        studentPaymentOrder.setVersion(0);
+
+        BigDecimal balance = BigDecimal.ZERO;
+        if (isUseBalancePayment != null && amount.compareTo(BigDecimal.ZERO) > 0) {
+            SysUserCashAccount userCashAccount = sysUserCashAccountService.getLocked(subjectChange.getStudentId());
+            if (userCashAccount == null) {
+                throw new BizException("用户账户找不到");
+            }
+            if (userCashAccount.getBalance() != null && userCashAccount.getBalance().compareTo(BigDecimal.ZERO) > 0) {
+                balance = amount.compareTo(userCashAccount.getBalance()) >= 0 ? userCashAccount.getBalance() : amount;
+                amount = amount.subtract(balance);
+                studentPaymentOrder.setActualAmount(amount);
+                studentPaymentOrder.setBalancePaymentAmount(balance);
+                sysUserCashAccountService.updateBalance(subjectChange.getStudentId(), balance.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "乐器维修");
+            }
+        }
+        if (amount.compareTo(viewAmount) != 0) {
+            throw new BizException("价格异常");
+        }
+        studentPaymentOrderService.update(studentPaymentOrder);
+
+        studentPaymentOrder.setVersion(studentPaymentOrder.getVersion() + 1);
+
+        if (amount.compareTo(BigDecimal.ZERO) == 0) {
+            studentPaymentRouteOrderService.addRouteOrder(orderNo, subjectChange.getOrganId(), studentPaymentOrder.getExpectAmount());
+            Map<String, String> notifyMap = new HashMap<>();
+            notifyMap.put("tradeState", "1");
+            notifyMap.put("merOrderNo", studentPaymentOrder.getOrderNo());
+            notifyMap.put("channelType", channelType);
+            notifyMap.put("orderNo", "");
+            studentPaymentOrderService.updateOrder(notifyMap);
+            notifyMap.put("orderNo", orderNo);
+            return notifyMap;
+        }
+
+        String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
+
+        Map<String, Object> payMap = payService.getPayMap(
+                amount,
+                balance,
+                orderNo,
+                baseApiUrl + "/api-student/studentOrder/notify",
+                baseApiUrl + "/api-student/studentOrder/paymentResult?orderNo=" + orderNo,
+                "声部更换",
+                "声部更换",
+                subjectChange.getOrganId(),
+                "subjectChange"
+        );
+
+        studentPaymentOrder.setMerNos((String) payMap.get("routingMerNos"));
+        studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
+        studentPaymentOrder.setUpdateTime(date);
+        studentPaymentOrderService.update(studentPaymentOrder);
+        return payMap;
+    }
+}

+ 70 - 24
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderDetailMapper.xml

@@ -14,7 +14,8 @@
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
         <result column="payment_order_id_" property="paymentOrderId"/>
-        <result column="kit_group_purchase_type_" property="kitGroupPurchaseType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="kit_group_purchase_type_" property="kitGroupPurchaseType"
+                typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <collection property="goodsList" ofType="com.ym.mec.biz.dal.entity.Goods">
             <result column="goods_id_" property="id"/>
             <result column="goods_name_" property="name"/>
@@ -27,7 +28,9 @@
 
     <!-- 根据主键查询一条记录 -->
     <select id="get" resultMap="StudentPaymentOrderDetail">
-        SELECT * FROM student_payment_order_detail WHERE id_ = #{id}
+        SELECT *
+        FROM student_payment_order_detail
+        WHERE id_ = #{id}
     </select>
 
     <!-- 全查询 -->
@@ -68,7 +71,8 @@
                 payment_order_id_ = #{paymentOrderId},
             </if>
             <if test="kitGroupPurchaseType != null">
-                kit_group_purchase_type_ = #{kitGroupPurchaseType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+                kit_group_purchase_type_ =
+                #{kitGroupPurchaseType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>
             <if test="type != null">
                 type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
@@ -79,7 +83,9 @@
 
     <!-- 根据主键删除一条记录 -->
     <delete id="delete">
-        DELETE FROM student_payment_order_detail WHERE id_ = #{id}
+        DELETE
+        FROM student_payment_order_detail
+        WHERE id_ = #{id}
     </delete>
 
     <!-- 分页查询 -->
@@ -107,27 +113,32 @@
 
     <!-- 查询注册订单详情 -->
     <select id="findApplyOrderSuccess" resultMap="StudentPaymentOrderDetail">
-        SELECT spod.* FROM student_payment_order spo
-        LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
-        LEFT JOIN student_registration sr ON spo.user_id_ = sr.user_id_
+        SELECT spod.*
+        FROM student_payment_order spo
+                 LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
+                 LEFT JOIN student_registration sr ON spo.user_id_ = sr.user_id_
         WHERE spo.music_group_id_ = #{musicGroupId}
-        AND spo.status_=#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
-        AND spo.type_ = 'APPLY'
-        AND sr.music_group_id_=#{musicGroupId} AND sr.music_group_status_ != 'QUIT'
+          AND spo.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+          AND spo.type_ = 'APPLY'
+          AND sr.music_group_id_ = #{musicGroupId}
+          AND sr.music_group_status_ != 'QUIT'
     </select>
 
     <!-- 查询订单详情 -->
     <select id="findApplyOrderGoods" resultMap="StudentPaymentOrderDetail">
-        SELECT * FROM student_payment_order_detail WHERE payment_order_id_ = #{orderId}
+        SELECT *
+        FROM student_payment_order_detail
+        WHERE payment_order_id_ = #{orderId}
     </select>
 
     <!-- 查询用户注册订单详情 -->
     <select id="findUserApplyOrder" resultMap="StudentPaymentOrderDetail">
-        SELECT spod.* FROM student_payment_order spo
-        LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
+        SELECT spod.*
+        FROM student_payment_order spo
+                 LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
         WHERE spo.user_id_ = #{userId}
-        AND spo.status_=#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
-        AND spo.type_ = 'APPLY'
+          AND spo.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+          AND spo.type_ = 'APPLY'
     </select>
     <resultMap id="musicalListDetailDtoMap" type="com.ym.mec.biz.dal.dto.MusicalListDetailDto">
         <result property="paymentOrderId" column="payment_order_id_"/>
@@ -143,10 +154,13 @@
         <result property="goodsNames" column="goods_names_"/>
     </resultMap>
     <select id="getMusicalListDetail" resultMap="musicalListDetailDtoMap">
-        SELECT MAX(spo.id_) payment_order_id_,spo.user_id_  FROM student_payment_order spo
-        LEFT JOIN student_registration sr ON spo.user_id_ = sr.user_id_
-        WHERE spo.music_group_id_ = #{musicGroupId} AND spo.status_ = 'SUCCESS'
-        AND sr.music_group_id_ = #{musicGroupId} AND sr.music_group_status_!='QUIT'
+        SELECT MAX(spo.id_) payment_order_id_, spo.user_id_
+        FROM student_payment_order spo
+                 LEFT JOIN student_registration sr ON spo.user_id_ = sr.user_id_
+        WHERE spo.music_group_id_ = #{musicGroupId}
+          AND spo.status_ = 'SUCCESS'
+          AND sr.music_group_id_ = #{musicGroupId}
+          AND sr.music_group_status_ != 'QUIT'
         GROUP BY spo.user_id_
     </select>
     <select id="queryGoodsNames" resultType="java.util.Map">
@@ -169,16 +183,48 @@
     </select>
 
     <select id="findApplyOrderMusical" resultMap="StudentPaymentOrderDetail">
-        SELECT * FROM student_payment_order_detail WHERE payment_order_id_ = #{orderId} AND type_ = 'MUSICAL' LIMIT 1
+        SELECT *
+        FROM student_payment_order_detail
+        WHERE payment_order_id_ = #{orderId}
+          AND type_ = 'MUSICAL'
+        LIMIT 1
     </select>
 
     <select id="getOrderDetail" resultMap="StudentPaymentOrderDetail">
-        SELECT spod.*,g.id_ goods_id_,g.name_ goods_name_,g.group_purchase_price_,g.discount_price_,g.agree_cost_price_,g.type_ goods_type_ FROM student_payment_order_detail spod
-                          LEFT JOIN goods g ON FIND_IN_SET(g.id_,spod.goods_id_list_)
-        WHERE spod.payment_order_id_ = #{orderId} AND spod.goods_id_list_ IS NOT NULL
+        SELECT spod.*,
+               g.id_   goods_id_,
+               g.name_ goods_name_,
+               g.group_purchase_price_,
+               g.discount_price_,
+               g.agree_cost_price_,
+               g.type_ goods_type_
+        FROM student_payment_order_detail spod
+                 LEFT JOIN goods g ON FIND_IN_SET(g.id_, spod.goods_id_list_)
+        WHERE spod.payment_order_id_ = #{orderId}
+          AND spod.goods_id_list_ IS NOT NULL
     </select>
 
     <select id="getOrderDetailType" resultType="java.lang.String">
-        SELECT DISTINCT type_ FROM student_payment_order_detail WHERE payment_order_id_ = #{orderId}
+        SELECT DISTINCT type_
+        FROM student_payment_order_detail
+        WHERE payment_order_id_ = #{orderId}
+    </select>
+
+    <select id="getStudentApplyDetail" resultMap="StudentPaymentOrderDetail">
+        SELECT spod.*,
+               g.id_   goods_id_,
+               g.name_ goods_name_,
+               g.group_purchase_price_,
+               g.discount_price_,
+               g.agree_cost_price_,
+               g.type_ goods_type_
+        FROM student_payment_order_detail spod
+                 LEFT JOIN goods g ON FIND_IN_SET(g.id_, spod.goods_id_list_)
+                 LEFT JOIN student_payment_order spo on spod.payment_order_id_ = spo.id_
+        WHERE spo.user_id_ = #{studentId}
+          AND spo.music_group_id_ = #{musicGroupId}
+          AND spo.status_ = 'SUCCESS'
+          AND spo.type_ = 'APPLY'
+          AND spod.type_ IN ('MUSICAL', 'ACCESSORIES', 'TEACHING', 'OTHER', 'COURSE')
     </select>
 </mapper>

+ 143 - 0
mec-biz/src/main/resources/config/mybatis/SubjectChangeMapper.xml

@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ym.mec.biz.dal.dao.SubjectChangeDao">
+    <resultMap id="SubjectChange" type="com.ym.mec.biz.dal.entity.SubjectChange">
+        <!--@mbg.generated-->
+        <!--@Table subject_change-->
+        <id column="id_" property="id"/>
+        <result column="student_id_" property="studentId"/>
+        <result column="studentName" property="studentName"/>
+        <result column="organ_id_" property="organId"/>
+        <result column="music_group_id_" property="musicGroupId"/>
+        <result column="original_course_fee_" property="originalCourseFee"/>
+        <result column="original_musical_" property="originalMusical"/>
+        <result column="original_musical_price_" property="originalMusicalPrice"/>
+        <result column="original_accessories_" property="originalAccessories"/>
+        <result column="original_accessories_price_" property="originalAccessoriesPrice"/>
+        <result column="change_course_fee_" property="changeCourseFee"/>
+        <result column="change_musical_" property="changeMusical"/>
+        <result column="change_musical_price_" property="changeMusicalPrice"/>
+        <result column="change_accessories_" property="changeAccessories"/>
+        <result column="change_accessories_price_" property="changeAccessoriesPrice"/>
+        <result column="goods_margin_" property="goodsMargin"/>
+        <result column="course_margin_" property="courseMargin"/>
+        <result column="status_" property="status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="create_time_" property="createTime"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="version_" property="version"/>
+    </resultMap>
+    <sql id="Base_Column_List">
+        <!--@mbg.generated-->
+        id_,student_id_,organ_id_, music_group_id_,original_course_fee_, original_musical_, original_musical_price_,
+        original_accessories_,
+        original_accessories_price_, change_course_fee_, change_musical_, change_musical_price_,
+        change_accessories_, change_accessories_price_, goods_margin_, course_margin_, status_,
+        create_time_, update_time,version_
+    </sql>
+    <select id="get" parameterType="java.lang.Integer" resultMap="SubjectChange">
+        <!--@mbg.generated-->
+        select
+        <include refid="Base_Column_List"/>
+        from subject_change
+        where id_ = #{id}
+    </select>
+    <delete id="delete" parameterType="java.lang.Integer">
+        <!--@mbg.generated-->
+        delete from subject_change
+        where id_ = #{id}
+    </delete>
+    <insert id="insert" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.SubjectChange"
+            useGeneratedKeys="true">
+        <!--@mbg.generated-->
+        insert into subject_change (student_id_,organ_id_,music_group_id_,original_course_fee_, original_musical_,
+        original_musical_price_,
+        original_accessories_,
+        original_accessories_price_, change_course_fee_, change_musical_, change_musical_price_,
+        change_accessories_, change_accessories_price_, goods_margin_, course_margin_,
+        status_, create_time_, update_time,version_)
+        values (#{studentId},#{organId},#{musicGroupId},#{originalCourseFee}, #{originalMusical}, #{originalMusicalPrice},
+        #{originalAccessories},
+        #{originalAccessoriesPrice}, #{changeCourseFee}, #{changeMusical}, #{changeMusicalPrice},
+        #{changeAccessories}, #{changeAccessoriesPrice}, #{goodsMargin}, #{courseMargin},
+        #{status}, #{createTime}, #{updateTime},0)
+    </insert>
+    <update id="update" parameterType="com.ym.mec.biz.dal.entity.SubjectChange">
+        <!--@mbg.generated-->
+        update subject_change
+        <set>
+            <if test="studentId != null">
+                student_id_ = #{studentId},
+            </if>
+            <if test="organId != null">
+                organ_id_ = #{organId},
+            </if>
+            <if test="musicGroupId != null">
+                music_group_id_ = #{musicGroupId},
+            </if>
+            <if test="originalCourseFee != null">
+                original_course_fee_ = #{originalCourseFee},
+            </if>
+            <if test="originalMusical != null">
+                original_musical_ = #{originalMusical},
+            </if>
+            <if test="originalMusicalPrice != null">
+                original_musical_price_ = #{originalMusicalPrice},
+            </if>
+            <if test="originalAccessories != null">
+                original_accessories_ = #{originalAccessories},
+            </if>
+            <if test="originalAccessoriesPrice != null">
+                original_accessories_price_ = #{originalAccessoriesPrice},
+            </if>
+            <if test="changeCourseFee != null">
+                change_course_fee_ = #{changeCourseFee},
+            </if>
+            <if test="changeMusical != null">
+                change_musical_ = #{changeMusical},
+            </if>
+            <if test="changeMusicalPrice != null">
+                change_musical_price_ = #{changeMusicalPrice},
+            </if>
+            <if test="changeAccessories != null">
+                change_accessories_ = #{changeAccessories},
+            </if>
+            <if test="changeAccessoriesPrice != null">
+                change_accessories_price_ = #{changeAccessoriesPrice},
+            </if>
+            <if test="goodsMargin != null">
+                goods_margin_ = #{goodsMargin},
+            </if>
+            <if test="courseMargin != null">
+                course_margin_ = #{courseMargin},
+            </if>
+            <if test="status != null">
+                status_ = #{status},
+            </if>
+            <if test="createTime != null">
+                create_time_ = #{createTime},
+            </if>
+            <if test="updateTime != null">
+                update_time = #{updateTime},
+            </if>
+            version_ = version_+1
+        </set>
+        where id_ = #{id} AND version_ = #{version}
+    </update>
+
+    <select id="getStudentLastChange" resultMap="SubjectChange">
+        SELECT *
+        FROM subject_change
+        WHERE student_id_ = #{studentId}
+          AND music_group_id_ = #{musicGroupId}
+          AND status_ = 'SUCCESSED'
+        ORDER BY create_time_ DESC
+        LIMIT 1
+    </select>
+
+    <select id="getChangeInfo" resultMap="SubjectChange">
+        SELECT sc.*,su.username_ studentName
+        FROM subject_change sc
+        LEFT jOIN sys_user su ON su.id_=sc.student_id_
+        WHERE sc.id_ = #{id}
+    </select>
+</mapper>

+ 51 - 0
mec-student/src/main/java/com/ym/mec/student/controller/SubjectChangeController.java

@@ -0,0 +1,51 @@
+package com.ym.mec.student.controller;
+
+import com.ym.mec.biz.dal.entity.SubjectChange;
+import com.ym.mec.biz.service.SubjectChangeService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+@RequestMapping("subjectChange")
+@Api(tags = "声部更换服务")
+@RestController
+public class SubjectChangeController extends BaseController {
+
+    @Autowired
+    private SubjectChangeService subjectChangeService;
+
+
+    @ApiOperation(value = "获取更换详情")
+    @GetMapping("/getChangeInfo")
+    @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Integer")})
+    public HttpResponseResult<SubjectChange> getChangeInfo(Integer id) {
+        if (id == null) {
+            return failed("参数校验异常");
+        }
+        return succeed(subjectChangeService.getChangeInfo(id));
+    }
+
+    @ApiOperation(value = "支付更换声部费用")
+    @PostMapping("/payChange")
+    @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Integer"),
+            @ApiImplicitParam(name = "金额", value = "amount", required = true, dataType = "BigDecimal"),
+            @ApiImplicitParam(name = "是否使余额", value = "isUseBalancePayment", required = true, dataType = "Boolean")
+    })
+    public HttpResponseResult<Map> payChaange(Integer id, BigDecimal amount, Boolean isUseBalancePayment) throws Exception {
+        return succeed(subjectChangeService.payChange(id, amount, isUseBalancePayment));
+    }
+
+
+}

+ 33 - 3
mec-web/src/main/java/com/ym/mec/web/controller/StudentRegistrationController.java

@@ -1,9 +1,13 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.biz.dal.dto.MusicGroupSubjectGoodsAndInfoDto;
 import com.ym.mec.biz.dal.dto.StudentAddDto;
+import com.ym.mec.biz.dal.entity.MusicGroup;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
+import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
 import com.ym.mec.biz.service.StudentRegistrationService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
@@ -18,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
 
 import java.io.IOException;
 import java.util.Date;
+import java.util.List;
 
 @RequestMapping("studentRegistration")
 @Api(tags = "学生报名信息服务")
@@ -26,6 +31,8 @@ public class StudentRegistrationController extends BaseController {
 
     @Autowired
     private StudentRegistrationService studentRegistrationService;
+    @Autowired
+    private MusicGroupSubjectPlanService musicGroupSubjectPlanService;
 
     @ApiOperation(value = "乐团添加学员")
     @PostMapping("/insertStudent")
@@ -49,11 +56,11 @@ public class StudentRegistrationController extends BaseController {
     @ApiImplicitParams({@ApiImplicitParam(name = "userId", value = "学生编号", required = true, dataType = "Integer"),
             @ApiImplicitParam(name = "subId", value = "声部编号", required = true, dataType = "Integer"),
             @ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "Integer")})
-    public Object batchUpdateSubject(Integer userId,Integer subId,String musicGroupId) throws Exception {
+    public Object batchUpdateSubject(Integer userId, Integer subId, String musicGroupId) throws Exception {
         if (null == userId || subId == null || StringUtils.isEmpty(musicGroupId)) {
             return failed("参数校验异常");
         }
-        return succeed(studentRegistrationService.batchUpdateSubject(userId, subId,musicGroupId));
+        return succeed(studentRegistrationService.batchUpdateSubject(userId, subId, musicGroupId));
     }
 
     @ApiOperation(value = "乐团【报名中、缴费中】 学生详情列表分页查询")
@@ -126,7 +133,30 @@ public class StudentRegistrationController extends BaseController {
             @ApiImplicitParam(name = "type", value = "类型(MIX,HIGH)", required = true, dataType = "ClassGroupTypeEnum"),
             @ApiImplicitParam(name = "actualSubjectId", value = "科目(声部)id,", required = false, dataType = "int")})
     public HttpResponseResult getMusicGroupStuNoClassType(String musicGroupId, ClassGroupTypeEnum type, Integer actualSubjectId) {
-        return succeed(studentRegistrationService.findMusicGroupStuNoClassType(musicGroupId, type,actualSubjectId));
+        return succeed(studentRegistrationService.findMusicGroupStuNoClassType(musicGroupId, type, actualSubjectId));
     }
 
+    @ApiOperation(value = "获取学生报名缴费详情")
+    @GetMapping("/getApplyDetail")
+    @PreAuthorize("@pcs.hasPermissions('studentRegistration/getApplyDetail')")
+    @ApiImplicitParams({@ApiImplicitParam(name = "studentId", value = "学生编号", required = true, dataType = "Integer"),
+            @ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String")})
+    public HttpResponseResult<List<StudentPaymentOrderDetail>> getApplyDetail(Integer studentId, String musicGroupId) {
+        if (studentId == null || StringUtils.isEmpty(musicGroupId)) {
+            return failed("参数校验异常");
+        }
+        return succeed(studentRegistrationService.getStudentApplyDetail(studentId, musicGroupId));
+    }
+
+    @ApiOperation(value = "获取乐团声部费用信息及乐器和辅件")
+    @GetMapping("/getSubjectGoodsAndInfo")
+    @PreAuthorize("@pcs.hasPermissions('studentRegistration/getSubjectGoodsAndInfo')")
+    @ApiImplicitParams({@ApiImplicitParam(name = "subjectId", value = "声部信息", required = true, dataType = "Integer"),
+            @ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String")})
+    public HttpResponseResult<MusicGroupSubjectGoodsAndInfoDto> getSubjectGoodsAndInfo(Integer subjectId, String musicGroupId) {
+        if (subjectId == null || StringUtils.isEmpty(musicGroupId)) {
+            return failed("参数校验异常");
+        }
+        return succeed(musicGroupSubjectPlanService.getSubjectGoodsAndInfo(musicGroupId, subjectId));
+    }
 }

+ 65 - 0
mec-web/src/main/java/com/ym/mec/web/controller/SubjectChangeController.java

@@ -0,0 +1,65 @@
+package com.ym.mec.web.controller;
+
+import com.ym.mec.biz.dal.dto.MusicGroupSubjectGoodsAndInfoDto;
+import com.ym.mec.biz.dal.dto.StudentAddDto;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
+import com.ym.mec.biz.dal.entity.SubjectChange;
+import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
+import com.ym.mec.biz.service.StudentRegistrationService;
+import com.ym.mec.biz.service.SubjectChangeService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RequestMapping("subjectChange")
+@Api(tags = "声部更换服务")
+@RestController
+public class SubjectChangeController extends BaseController {
+
+    @Autowired
+    private StudentRegistrationService studentRegistrationService;
+    @Autowired
+    private MusicGroupSubjectPlanService musicGroupSubjectPlanService;
+    @Autowired
+    private SubjectChangeService subjectChangeService;
+
+    @ApiOperation(value = "获取学生报名缴费详情")
+    @GetMapping("/getApplyDetail")
+    @PreAuthorize("@pcs.hasPermissions('subjectChange/getApplyDetail')")
+    @ApiImplicitParams({@ApiImplicitParam(name = "studentId", value = "学生编号", required = true, dataType = "Integer"),
+            @ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String")})
+    public HttpResponseResult<List<StudentPaymentOrderDetail>> getApplyDetail(Integer studentId, String musicGroupId) {
+        if (studentId == null || StringUtils.isEmpty(musicGroupId)) {
+            return failed("参数校验异常");
+        }
+        return succeed(studentRegistrationService.getStudentApplyDetail(studentId, musicGroupId));
+    }
+
+    @ApiOperation(value = "获取乐团声部费用信息及乐器和辅件")
+    @GetMapping("/getSubjectGoodsAndInfo")
+    @PreAuthorize("@pcs.hasPermissions('subjectChange/getSubjectGoodsAndInfo')")
+    @ApiImplicitParams({@ApiImplicitParam(name = "subjectId", value = "声部信息", required = true, dataType = "Integer"),
+            @ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String")})
+    public HttpResponseResult<MusicGroupSubjectGoodsAndInfoDto> getSubjectGoodsAndInfo(Integer subjectId, String musicGroupId) {
+        if (subjectId == null || StringUtils.isEmpty(musicGroupId)) {
+            return failed("参数校验异常");
+        }
+        return succeed(musicGroupSubjectPlanService.getSubjectGoodsAndInfo(musicGroupId, subjectId));
+    }
+
+    @ApiOperation(value = "添加乐器更换")
+    @PostMapping("/add")
+    @PreAuthorize("@pcs.hasPermissions('subjectChange/add')")
+    public Object add(SubjectChange subjectChange) throws Exception {
+        return succeed(subjectChangeService.insert(subjectChange));
+    }
+}

+ 0 - 3
mec-web/src/main/resources/application.yml

@@ -102,9 +102,6 @@ ribbon:
   ReadTimeout: 60000
   ConnectTimeout: 60000
 
-logging:
-  level:
-    com.ym.mec.auth.api.client.SysUserFeignService: INFO
 
 message:
   debugMode: true