Browse Source

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

yonge 3 years ago
parent
commit
3ece915547

+ 0 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -785,7 +785,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     public HttpResponseResult pay(RegisterPayDto registerPayDto) throws Exception {
         //判断用户是否已存在订单
         List<StudentPaymentOrder> applyOrderList = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(registerPayDto.getUserId(), registerPayDto.getMusicGroupId(), DealStatusEnum.ING);
-
         if (CollectionUtils.isNotEmpty(applyOrderList)) {
             HttpResponseResult result = studentPaymentOrderService.checkRepeatPay(applyOrderList.get(0), registerPayDto.getRepeatPay());
             if (result.getCode() != 200) {

+ 1 - 10
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentAttendanceServiceImpl.java

@@ -15,6 +15,7 @@ import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.service.SysTenantConfigService;
 import com.ym.mec.common.tenant.TenantContextHolder;
+import com.ym.mec.util.encode.AES;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -214,16 +215,6 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
         if(students.size() > 0){
             studentDao.batchUpdate(students);
         }
-        //获取正常签到的学生信息
-//        List<StudentAttendance> normal = studentAttendances.stream().filter(studentAttendance -> studentAttendance.getStatus() == StudentAttendanceStatusEnum.NORMAL).collect(Collectors.toList());
-//        if (normal != null && normal.size() > 0) {
-//            Map<Integer, String> receivers = new HashMap<>();
-//            normal.forEach(e -> {
-//                receivers.put(e.getUserId(), e.getUserId().toString());
-//            });
-//            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_NAMES_ACHIEVE,
-//                    receivers, null, 0, "2", "STUDENT", DateUtil.format(new Date(), DateUtil.DATE_FORMAT_MIN));
-//        }
 
         Map<StudentAttendanceStatusEnum, List<StudentAttendance>> studentAttendanceGroupByStatus = studentAttendances.stream().collect(Collectors.groupingBy(StudentAttendance::getStatus));
         Integer studentNum = studentAttendanceGroupByStatus.get(StudentAttendanceStatusEnum.NORMAL) == null ? 0 : studentAttendanceGroupByStatus.get(StudentAttendanceStatusEnum.NORMAL).size();

+ 21 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java

@@ -104,7 +104,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     @Autowired
     private ActivityUserMapperDao activityUserMapperDao;
     @Autowired
-    private StudentService studentService;
+    private MusicGroupSubjectPlanService musicGroupSubjectPlanService;
     @Autowired
     private SysUserFeignService sysUserFeignService;
 
@@ -776,6 +776,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public HttpResponseResult checkRepeatPay(StudentPaymentOrder order, Boolean repeatPay) throws Exception {
         // 查询订单状态
         PayStatus payStatus = this.queryPayStatus(order.getPaymentChannel(), order.getOrderNo(), order.getTransNo());
@@ -788,6 +789,8 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
         //处理关闭订单
         order.setStatus(DealStatusEnum.CLOSE);
         order.setMemo("关闭订单");
+        //如果是报名订单,订单关闭时需要更改已缴费学员数
+        cutSubjectPlan(order);
         if (order.getBalancePaymentAmount() != null && order.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
             sysUserCashAccountService.updateBalance(order.getUserId(), order.getBalancePaymentAmount(),
                     PlatformCashAccountDetailTypeEnum.REFUNDS, "订单主动关闭退费");
@@ -797,6 +800,23 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
         return BaseController.succeed();
     }
 
+    @Transactional(rollbackFor = Exception.class)
+    public void cutSubjectPlan(StudentPaymentOrder order){
+        if(order.getType() == OrderTypeEnum.APPLY){
+            //如果是报名订单,订单关闭时需要更改已缴费学员数
+            // 判断之前是否已有订单
+            String musicGroupId = order.getMusicGroupId();
+            Integer userId = order.getUserId();
+            List<StudentPaymentOrder> oldStudentPaymentOrderList = this.queryByCondition(GroupType.MUSIC,musicGroupId, userId, DealStatusEnum.SUCCESS, OrderTypeEnum.APPLY);
+            if(oldStudentPaymentOrderList != null && oldStudentPaymentOrderList.size() > 0){
+                StudentRegistration studentRegistration = studentRegistrationService.getStudentRegister(musicGroupId, userId);
+                MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(musicGroupId, studentRegistration.getActualSubjectId());
+                musicOneSubjectClassPlan.setPaidStudentNum(musicOneSubjectClassPlan.getPaidStudentNum() == null?0:musicOneSubjectClassPlan.getPaidStudentNum() - 1);
+                musicGroupSubjectPlanService.update(musicOneSubjectClassPlan);
+            }
+        }
+    }
+
     /**
      * 只查询成功的订单
      *