فهرست منبع

feat:12月活动

Joburgess 4 سال پیش
والد
کامیت
d926b4279a

+ 28 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/DegreeRegistrationServiceImpl.java

@@ -165,6 +165,29 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
             if(Objects.isNull(practiceGroupSellPrice)){
                 throw new BizException("该分部暂未参与此活动");
             }
+
+            List<StudentPaymentOrderDetail> historyOrderDetails = studentPaymentOrderDetailDao.getWithUserAndOrderType(degreeRegistration.getUserId(), OrderTypeEnum.DEGREE_REGISTRATION);
+            int historyVipNum = 0, historyPracticeNum = 0, historyHighNum = 0;
+            for (StudentPaymentOrderDetail historyOrderDetail : historyOrderDetails) {
+                if(StringUtils.isBlank(historyOrderDetail.getGoodsIdList())){
+                    continue;
+                }
+                Map<String, Integer> courseNumMap = JSON.parseObject(historyOrderDetail.getGoodsIdList(), Map.class);
+                for (Map.Entry<String, Integer> stringIntegerEntry : courseNumMap.entrySet()) {
+                    switch (stringIntegerEntry.getKey()){
+                        case "VIP":
+                            historyVipNum = historyVipNum + stringIntegerEntry.getValue();
+                            break;
+                        case "PRACTICE":
+                            historyPracticeNum = historyPracticeNum + stringIntegerEntry.getValue();
+                            break;
+                        case "HIGH":
+                            historyHighNum = historyHighNum + stringIntegerEntry.getValue();
+                            break;
+                    }
+                }
+            }
+
             BigDecimal practiceUnitPrice = practiceGroupSellPrice.getOnceOriginalPrice(),
                     vipUnitPrice = new BigDecimal("0"), highUnitPrice;
             if(student.getIsNewUser()){
@@ -173,7 +196,10 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
                 if(!additionCourseInfo.containsKey(CourseSchedule.CourseScheduleType.VIP)){
                     additionCourseInfo.remove(CourseSchedule.CourseScheduleType.PRACTICE);
                 }
-                boolean vipMoreThan2 = additionCourseInfo.containsKey(CourseSchedule.CourseScheduleType.VIP)&&additionCourseInfo.get(CourseSchedule.CourseScheduleType.VIP)>=2;
+                if(additionCourseInfo.containsKey(CourseSchedule.CourseScheduleType.VIP)){
+                    historyVipNum = historyVipNum + additionCourseInfo.get(CourseSchedule.CourseScheduleType.VIP);
+                }
+                boolean vipMoreThan2 = historyVipNum>=2;
                 if(vipMoreThan2){
                     if(FREE_PRICE_LEVEL.contains(degreeRegistration.getLevel())){
                         degreeRegistration.setMoney(BigDecimal.ZERO);
@@ -227,6 +253,7 @@ public class DegreeRegistrationServiceImpl extends BaseServiceImpl<Integer, Degr
         studentPaymentOrder.setExpectAmount(amount);
         studentPaymentOrder.setActualAmount(amount);
         studentPaymentOrder.setStatus(DealStatusEnum.ING);
+        studentPaymentOrder.setClassGroupId(degreeRegistration.getId());
         if(Objects.nonNull(degreeRegistration.getSporadicId())){
             studentPaymentOrder.setMusicGroupId(degreeRegistration.getSporadicId().toString());
         }

+ 3 - 1
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderDetailMapper.xml

@@ -262,6 +262,8 @@
     <select id="getWithUserAndOrderType" resultType="com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail">
         SELECT spod.* FROM student_payment_order_detail spod
         LEFT JOIN student_payment_order spo ON spo.id_=spod.payment_order_id_
-        WHERE spo.user_id_= #{userId} AND spod.type_ = #{orderType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+        WHERE spo.user_id_= #{userId}
+        AND spod.type_ = #{orderType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+        AND spo.status_='SUCCESS'
     </select>
 </mapper>

+ 36 - 18
mec-student/src/main/java/com/ym/mec/student/controller/DegreeController.java

@@ -1,19 +1,15 @@
 package com.ym.mec.student.controller;
 
 
+import com.alibaba.fastjson.JSON;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.biz.dal.dao.DegreeRegistrationDao;
-import com.ym.mec.biz.dal.dao.OrganizationDao;
-import com.ym.mec.biz.dal.dao.SporadicChargeInfoDao;
-import com.ym.mec.biz.dal.dao.StudentDao;
+import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.DegreeRegistrationActivityDto;
 import com.ym.mec.biz.dal.dto.SporadicPayDto;
-import com.ym.mec.biz.dal.entity.DegreeRegistration;
-import com.ym.mec.biz.dal.entity.Employee;
-import com.ym.mec.biz.dal.entity.SporadicChargeInfo;
-import com.ym.mec.biz.dal.entity.Student;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
+import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 import com.ym.mec.biz.dal.enums.SporadicChargeTypeEnum;
 import com.ym.mec.biz.dal.page.SporadicChargeInfoQueryInfo;
 import com.ym.mec.biz.service.DegreeRegistrationService;
@@ -62,6 +58,9 @@ public class DegreeController extends BaseController {
     @Autowired
     private OrganizationDao organizationDao;
 
+    @Autowired
+    private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
+
     @ApiOperation(value = "考级报名支付")
     @PostMapping("/pay")
     public HttpResponseResult pay(@RequestBody DegreeRegistrationActivityDto degreeRegistration) throws Exception {
@@ -127,7 +126,7 @@ public class DegreeController extends BaseController {
     @GetMapping("/getParams")
     public HttpResponseResult getParams(){
         SysUser user = sysUserFeignService.queryUserInfo();
-        if(Objects.isNull(user)){
+        if(Objects.isNull(user)||Objects.isNull(user.getId())){
             return failed(HttpStatus.FORBIDDEN,"请登录");
         }
 
@@ -141,20 +140,39 @@ public class DegreeController extends BaseController {
 
         Map<String, Object> result = new HashMap<>();
 
-//        DegreeRegistration degreeRegistration = degreeRegistrationDao.getWithUserIdAndActivityTag(user.getId(), DegreeRegistrationService.ACTIVITY_TAG);
-
         Student student = studentDao.get(user.getId());
         result.put("userInfo", user);
         result.put("isNewUser", student.getIsNewUser());
         result.put("organs", organizationDao.getActivityOrgans());
         result.put("sporadicChargeInfo", sporadicChargeInfoService.queryDetailPage(queryInfo));
-//        if(Objects.isNull(degreeRegistration)||degreeRegistration.getStatus()==0){
-//            result.put("isApplied", 0);
-//        }else if(degreeRegistration.getStatus()==1){
-//            result.put("isApplied", 1);
-//        }else if(degreeRegistration.getStatus()==2){
-//            result.put("isApplied", 2);
-//        }
+
+        List<StudentPaymentOrderDetail> historyOrderDetails = studentPaymentOrderDetailDao.getWithUserAndOrderType(user.getId(), OrderTypeEnum.DEGREE_REGISTRATION);
+        int historyVipNum = 0, historyPracticeNum = 0, historyHighNum = 0;
+        for (StudentPaymentOrderDetail historyOrderDetail : historyOrderDetails) {
+            if(StringUtils.isBlank(historyOrderDetail.getGoodsIdList())){
+                continue;
+            }
+            Map<String, Integer> courseNumMap = JSON.parseObject(historyOrderDetail.getGoodsIdList(), Map.class);
+            for (Map.Entry<String, Integer> stringIntegerEntry : courseNumMap.entrySet()) {
+                switch (stringIntegerEntry.getKey()){
+                    case "VIP":
+                        historyVipNum = historyVipNum + stringIntegerEntry.getValue();
+                        break;
+                    case "PRACTICE":
+                        historyPracticeNum = historyPracticeNum + stringIntegerEntry.getValue();
+                        break;
+                    case "HIGH":
+                        historyHighNum = historyHighNum + stringIntegerEntry.getValue();
+                        break;
+                }
+            }
+        }
+        Map<String, Integer> historyCourseInfo = new HashMap<>();
+        historyCourseInfo.put(CourseSchedule.CourseScheduleType.VIP.getCode(), historyVipNum);
+        historyCourseInfo.put(CourseSchedule.CourseScheduleType.PRACTICE.getCode(), historyPracticeNum);
+        historyCourseInfo.put(CourseSchedule.CourseScheduleType.HIGH.getCode(), historyHighNum);
+        result.put("historyCourseInfo", historyCourseInfo);
+
         return succeed(result);
     }
 }

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

@@ -75,6 +75,8 @@ public class StudentOrderController extends BaseController {
     private StudentGoodsSellDao studentGoodsSellDao;
     @Autowired
     private LuckDrawCountService luckDrawCountService;
+    @Autowired
+    private DegreeRegistrationDao degreeRegistrationDao;
 
 
     @Value("${spring.profiles.active:dev}")
@@ -144,6 +146,8 @@ public class StudentOrderController extends BaseController {
                 LuckDrawCount luckDrawCount = luckDrawCountService.get(orderByOrderNo.getUserId().longValue());
                 orderDetail.put("drawTimes", luckDrawCount==null? 0: luckDrawCount.getAvailableCount());
             }else if(OrderTypeEnum.DEGREE_REGISTRATION.equals(orderByOrderNo.getType())){
+                DegreeRegistration degreeRegistration = degreeRegistrationDao.get(orderByOrderNo.getClassGroupId());
+                orderDetail.put("degree", degreeRegistration);
                 List<StudentPaymentOrderDetail> studentPaymentOrderDetails = studentPaymentOrderDetailService.getOrderDetail(orderByOrderNo.getId());
                 if(!CollectionUtils.isEmpty(studentPaymentOrderDetails)){
                     orderDetail.put("additionCourseInfo", studentPaymentOrderDetails.get(0).getGoodsIdList());