zouxuan před 3 roky
rodič
revize
d5b0d0a914

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

@@ -589,6 +589,16 @@ public interface ClassGroupService extends BaseService<Integer, ClassGroup> {
 
     CourseScheduleStatistics getMusicGroupCourseScheduleStatistics(queryMusicGroupCourseScheduleQueryInfo queryInfo);
 
+    /**
+     * 根据班级编号冻结所选班级
+     *
+     * @param classGroupIds
+     * @param lockFlag
+     * @return
+     * @author zouxuan
+     */
+    int batchUpdateLockByClassGroupIds(List<Integer> classGroupIds,int lockFlag);
+
     //修改班级基本信息
     int updateClassGroup(ClassGroup classGroup);
 }

+ 12 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -3413,6 +3413,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
     @Override
     @Transactional(rollbackFor = Exception.class)
+    public int batchUpdateLockByClassGroupIds(List<Integer> classGroupIds, int lockFlag) {
+        return classGroupDao.batchUpdateLockByClassGroupIds(classGroupIds,lockFlag);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
     public int updateClassGroup(ClassGroup classGroup) {
         ClassGroup group = classGroupDao.get(classGroup.getId());
         if(Objects.isNull(group)){
@@ -4660,13 +4666,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         } else {
             paymentCalenderDto.setStatus(NO);
         }
-
-        //将学员加入新乐团、扣除原乐团剩余课程余额、补充到现有乐团
-        Map<Integer, List<MusicGroupPaymentCalenderStudentDetail>> collect = calenderStudentDetails.stream().collect(Collectors.groupingBy(e -> e.getUserId()));
-        for (Map<Integer, String> classGroupStudent : classGroupStudents) {
-            Integer classGroupId = classGroupStudent.keySet().iterator().next();
-            studentRegistrationService.insertStudent(classGroupStudent.get(classGroupId), musicGroupDao.findByClassGroupId(classGroupId).getId(), musicGroup.getId(), collect);
-        }
         paymentCalenderDto.setPayUserType(MusicGroupPaymentCalender.PayUserType.STUDENT);
         paymentCalenderDto.setPaymentType(SPAN_GROUP_CLASS_ADJUST);
         //生成缴费项目
@@ -4712,6 +4711,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         httpResponseResult.setStatus(true);
         //没有需要审核的缴费项目
         if (paymentCalenderDto.getStatus() != AUDITING) {
+            //将学员加入新乐团、扣除原乐团剩余课程余额、补充到现有乐团
+            Map<Integer, List<MusicGroupPaymentCalenderStudentDetail>> collect = calenderStudentDetails.stream().collect(Collectors.groupingBy(e -> e.getUserId()));
+            for (Map<Integer, String> classGroupStudent : classGroupStudents) {
+                Integer classGroupId = classGroupStudent.keySet().iterator().next();
+                studentRegistrationService.insertStudent(classGroupStudent.get(classGroupId), musicGroupDao.findByClassGroupId(classGroupId).getId(), musicGroup.getId(), collect);
+            }
             List<Map> classGroupStudents1 = JSON.parseArray(musicGroupStudentClassAdjust.getClassGroupStudents(), Map.class);
             spanGroupClassAdjustPass(masterClassGroupId, studentIds, courseIds, classGroupStudents1, allLockCourseIds, paymentCalenderDto.getBatchNo(), masterTotalPrice);
             httpResponseResult.setMsg("操作成功:学员班级调整完成");

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

@@ -149,6 +149,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 			if(musicGroupPaymentCalender.getStatus() != AUDITING){
 				if (totalPrice.doubleValue() == 0d) {
 					musicGroupPaymentCalenderDetail.setPaymentStatus(PaymentStatus.PAID_COMPLETED);
+					musicGroupPaymentCalender.setActualNum(musicGroupPaymentCalender.getActualNum() + 1);
 //					musicGroupPaymentCalenderDetail.setActualAmount(totalPrice);
 				}
 			}

+ 30 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -116,6 +116,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
     private StudentDao studentDao;
     @Autowired
     private ActivityUserMapperService activityUserMapperService;
+    @Autowired
+    private StudentRegistrationService studentRegistrationService;
 
     @Override
     public BaseDAO<Long, MusicGroupPaymentCalender> getDAO() {
@@ -1003,14 +1005,21 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 //                    autoClassGroupAdjust(musicGroupStudentClassAdjust);
 //                }
             } else if (calender.getPaymentType() == SPAN_GROUP_CLASS_ADJUST) {
-                //删除和解冻班级,课程信息
+                List<MusicGroupPaymentCalenderStudentDetail> calenderStudentDetails = musicGroupPaymentCalenderStudentDetailDao.findByBatchNo(batchNo);
+                //将学员加入新乐团、扣除原乐团剩余课程余额、补充到现有乐团
+                Map<Integer, List<MusicGroupPaymentCalenderStudentDetail>> collect = calenderStudentDetails.stream().collect(Collectors.groupingBy(e -> e.getUserId()));
                 MusicGroupStudentClassAdjust adjust = musicGroupStudentClassAdjustDao.findByBatchNo(batchNo);
                 List<Map> classGroupStudents = JSON.parseArray(adjust.getClassGroupStudents(), Map.class);
+                for (Map<Integer, String> classGroupStudent : classGroupStudents) {
+                    Integer classGroupId = classGroupStudent.keySet().iterator().next();
+                    studentRegistrationService.insertStudent(classGroupStudent.get(classGroupId), musicGroupDao.findByClassGroupId(classGroupId).getId(), musicGroup.getId(), collect);
+                }
+                //删除和解冻班级,课程信息
                 List<Integer> studentIds = JSON.parseArray(adjust.getStudentIds(), Integer.class);
                 List<Long> courseIds = JSON.parseArray(adjust.getSubLockCourseIds(), Long.class);
                 List<Long> allLockCourseIds = JSON.parseArray(adjust.getAllLockCourseIds(), Long.class);
                 //如果是跨团班级合并,添加学员
-                musicGroupPaymentCalenderDetailService.batchAdd(calender, musicGroupPaymentCalenderStudentDetailDao.findByBatchNo(batchNo));
+                musicGroupPaymentCalenderDetailService.batchAdd(calender, calenderStudentDetails);
                 classGroupService.spanGroupClassAdjustPass(adjust.getMasterClassGroupId()
                         , studentIds, courseIds, classGroupStudents, allLockCourseIds, batchNo, adjust.getMasterTotalPrice());
             }
@@ -1091,7 +1100,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         Date date = new Date();
         calenders.forEach(e -> {
-            if (e.getPaymentType() == ADD_STUDENT || e.getPaymentType() == SPAN_GROUP_CLASS_ADJUST) {
+            if (e.getPaymentType() == ADD_STUDENT) {
                 throw new BizException("{} 的缴费项目不允许撤回", e.getStatus().getDesc());
             }
             if (e.getStatus() != AUDITING) {
@@ -1287,9 +1296,24 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
         if (musicGroupPaymentCalenderDetailList != null && musicGroupPaymentCalenderDetailList.size() > 0) {
             throw new BizException("操作失败:缴费项目中已存在学员");
         }
-        MusicGroupStudentClassAdjust byBatchNo = musicGroupStudentClassAdjustDao.findByBatchNo(calender.getBatchNo());
-        if (byBatchNo != null) {
-            throw new BizException("操作失败:班级调整的缴费项目不支持");
+        MusicGroupStudentClassAdjust adjust = musicGroupStudentClassAdjustDao.findByBatchNo(calender.getBatchNo());
+        if (!Objects.isNull(adjust)) {
+//            throw new BizException("操作失败:班级调整的缴费项目不支持");
+            List<Map> classGroupStudents = JSON.parseArray(adjust.getClassGroupStudents(), Map.class);
+            //删除班级关联的学员
+            List<Integer> classGroupIds = new ArrayList<>();
+            if (classGroupStudents != null && classGroupStudents.size() > 0) {
+                for (Map<Integer, String> classGroupStudent : classGroupStudents) {
+                    classGroupIds.addAll(classGroupStudent.keySet());
+                }
+            }
+            List<Long> allLockCourseIds = JSON.parseArray(adjust.getAllLockCourseIds(), Long.class);
+            //解冻课程
+            courseScheduleDao.batchUpdateLockByCourseIds(allLockCourseIds, 0,null);
+            //解冻班级
+            classGroupIds.add(adjust.getMasterClassGroupId());
+            classGroupService.batchUpdateLockByClassGroupIds(classGroupIds, 0);
+            musicGroupStudentClassAdjustDao.delete(adjust.getId());
         }
 
         if (calender.getPaymentType() == PaymentType.MUSIC_APPLY) {

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

@@ -46,8 +46,6 @@ public class MusicGroupPaymentCalenderController extends BaseController {
     private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
     @Autowired
     private MusicGroupPaymentCalenderStudentDetailDao musicGroupPaymentCalenderStudentDetailDao;
-	@Autowired
-	private MemberRankPrivilegesService memberRankPrivilegesService;
 
 
     @ApiOperation(value = "查询学员缴费详情")