Explorar el Código

中途加学生缴费处理

周箭河 hace 5 años
padre
commit
b0da7cd268

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

@@ -29,8 +29,17 @@ public interface StudentPaymentOrderDetailDao extends BaseDAO<Long, StudentPayme
 
     /**
      * 查询订单商品
+     *
      * @param orderId
      * @return
      */
     List<StudentPaymentOrderDetail> findApplyOrderGoods(@Param("orderId") Long orderId);
+
+    /**
+     * 查询用户报名订单
+     * @param userId
+     * @param status
+     * @return
+     */
+    List<StudentPaymentOrderDetail> findUserApplyOrder(Integer userId,DealStatusEnum status);
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupSubjectGoodsAndInfoDto.java

@@ -21,6 +21,9 @@ public class MusicGroupSubjectGoodsAndInfoDto {
     //乐团计划及收费信息
     private MusicGroupSubjectPlan musicGroupSubjectPlan;
 
+    //学生定制商品
+    private List<Goods> studentGoods;
+
     //其他商品(教材、琴谱)
     private List<Goods> otherGoods;
 
@@ -55,4 +58,12 @@ public class MusicGroupSubjectGoodsAndInfoDto {
     public void setOtherGoods(List<Goods> otherGoods) {
         this.otherGoods = otherGoods;
     }
+
+    public List<Goods> getStudentGoods() {
+        return studentGoods;
+    }
+
+    public void setStudentGoods(List<Goods> studentGoods) {
+        this.studentGoods = studentGoods;
+    }
 }

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupSubjectPlanService.java

@@ -2,6 +2,7 @@ package com.ym.mec.biz.service;
 
 import com.ym.mec.biz.dal.dto.MusicGroupRegRespDto;
 import com.ym.mec.biz.dal.dto.MusicGroupSubjectGoodsAndInfoDto;
+import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
 import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
 import com.ym.mec.common.service.BaseService;
 
@@ -54,4 +55,13 @@ public interface MusicGroupSubjectPlanService extends BaseService<Integer, Music
      * @return
      */
     int batchUpdateFee(List<MusicGroupSubjectPlan> musicGroupSubjectPlans);
+
+    /**
+     * 中途添加的学生的缴费信息
+     *
+     * @param musicGroupId
+     * @param subjectId
+     * @return
+     */
+    MusicGroupSubjectGoodsAndInfoDto getStudentGoodsAndInfo(String musicGroupId, Integer subjectId, MusicGroupStudentFee musicGroupStudentFee);
 }

+ 35 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupSubjectPlanServiceImpl.java

@@ -1,12 +1,15 @@
 package com.ym.mec.biz.service.impl;
 
 import com.alibaba.fastjson.JSON;
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
 import com.ym.mec.biz.dal.dto.MusicGroupRegRespDto;
 import com.ym.mec.biz.dal.dto.MusicGroupSubjectGoodsAndInfoDto;
 import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.GoodsType;
 import com.ym.mec.biz.service.*;
 import com.ym.mec.util.collection.MapUtil;
+import org.snaker.engine.core.OrderService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -18,6 +21,7 @@ import org.springframework.transaction.annotation.Transactional;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 @Service
 public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, MusicGroupSubjectPlan> implements MusicGroupSubjectPlanService {
@@ -39,6 +43,8 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
 
     @Autowired
     private SubjectService subjectService;
+    @Autowired
+    private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
 
     @Override
     public BaseDAO<Integer, MusicGroupSubjectPlan> getDAO() {
@@ -125,4 +131,33 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
     public int batchUpdateFee(List<MusicGroupSubjectPlan> musicGroupSubjectPlans) {
         return musicGroupSubjectPlanDao.batchUpdateFee(musicGroupSubjectPlans);
     }
+
+    @Override
+    public MusicGroupSubjectGoodsAndInfoDto getStudentGoodsAndInfo(String musicGroupId, Integer subjectId, MusicGroupStudentFee musicGroupStudentFee) {
+        MusicGroup musicGroup = musicGroupService.get(musicGroupId);
+
+        //课程形态
+        Map<String, Object> courseForm = JSON.parseObject(musicGroup.getCourseForm(), Map.class);
+
+        //乐团计划及收费信息
+        MusicGroupSubjectPlan musicOneSubjectClassPlan = this.getMusicOneSubjectClassPlan(musicGroupId, subjectId);
+        musicOneSubjectClassPlan.setFee(musicGroupStudentFee.getTemporaryCourseFee());
+
+        List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailDao.findUserApplyOrder(musicGroupStudentFee.getUserId(), DealStatusEnum.WAIT_PAY);
+
+        String goodsIds = orderDetails.stream().filter(orderDetail -> orderDetail.getGoodsIdList() != null).map(orderDetail -> orderDetail.getGoodsIdList()).collect(Collectors.joining(","));
+
+        List<Goods> goodies = goodsService.findGoodsByIds(goodsIds);
+
+
+        //获取声部(科目)下其他商品
+        List<Goods> otherGoods = goodsService.findTypeGoods("OTHER");
+
+        MusicGroupSubjectGoodsAndInfoDto musicGroupSubjectGoodsAndInfo = new MusicGroupSubjectGoodsAndInfoDto();
+        musicGroupSubjectGoodsAndInfo.setMusicGroupSubjectPlan(musicOneSubjectClassPlan);
+        musicGroupSubjectGoodsAndInfo.setCourseScheduleInfo(courseForm);
+        musicGroupSubjectGoodsAndInfo.setStudentGoods(goodies);
+        musicGroupSubjectGoodsAndInfo.setOtherGoods(otherGoods);
+        return musicGroupSubjectGoodsAndInfo;
+    }
 }

+ 9 - 0
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderDetailMapper.xml

@@ -103,4 +103,13 @@
     <select id="findApplyOrderGoods" resultMap="StudentPaymentOrderDetail">
         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_
+        WHERE spo.user_id_ = #{userId}
+        AND spo.status_=#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+        AND spo.type_ = 'APPLY'
+    </select>
 </mapper>

+ 11 - 1
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java

@@ -97,6 +97,15 @@ public class MusicGroupController extends BaseController {
     @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String"),
             @ApiImplicitParam(name = "subjectId", value = "声部编号", required = true, dataType = "Integer")})
     public HttpResponseResult getSubjectGoodsAndInfo(String musicGroupId, Integer subjectId) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser != null && sysUser.getId() > 0) {
+            Integer userId = sysUser.getId();
+            MusicGroupStudentFee musicGroupStudentFee = musicGroupStudentFeeDao.findByUser(userId, musicGroupId);
+            if (musicGroupStudentFee != null && musicGroupStudentFee.getTemporaryCourseFee() != null) {
+                return succeed(musicGroupSubjectPlanService.getStudentGoodsAndInfo(musicGroupId, subjectId, musicGroupStudentFee));
+            }
+        }
+
         return succeed(musicGroupSubjectPlanService.getSubjectGoodsAndInfo(musicGroupId, subjectId));
     }
 
@@ -123,7 +132,8 @@ public class MusicGroupController extends BaseController {
         if (studentRegistration.getPaymentStatus() != null && studentRegistration.getPaymentStatus().equals(PaymentStatusEnum.YES)) {
             return failed("您已缴费,请等待乐团开启");
         }
-        if (!musicGroup.getStatus().equals(MusicGroupStatusEnum.PAY) && (studentRegistration.getPaymentStatus() == null || !studentRegistration.getPaymentStatus().equals(PaymentStatusEnum.OPEN))) {
+
+        if (!studentRegistration.getPaymentStatus().equals(PaymentStatusEnum.OPEN)) {
             return failed("乐团还未开启缴费,请等待通知");
         }
         return succeed(studentRegistration);