浏览代码

统一处理关单逻辑

zouxuan 3 月之前
父节点
当前提交
1d51f76762

+ 84 - 64
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -34,13 +34,13 @@ import com.ym.mec.util.date.DateUtil;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.jetbrains.annotations.NotNull;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
-import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.time.*;
@@ -64,113 +64,113 @@ import static com.ym.mec.biz.dal.enums.MusicGroupStatusEnum.PROGRESS;
 @Service
 public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup> implements ClassGroupService {
 
-    @Resource
+    @Autowired
     private ClassGroupDao classGroupDao;
-    @Resource
+    @Autowired
     private SchoolDao schoolDao;
-    @Resource
+    @Autowired
     private VipGroupDao vipGroupDao;
-    @Resource
+    @Autowired
     private TeacherAttendanceDao teacherAttendanceDao;
-    @Resource
+    @Autowired
     private MusicGroupDao musicGroupDao;
-    @Resource
+    @Autowired
     private PracticeGroupDao practiceGroupDao;
-    @Resource
+    @Autowired
     private CoursesGroupDao coursesGroupDao;
-    @Resource
+    @Autowired
     private MusicGroupBuildLogDao musicGroupBuildLogDao;
-    @Resource
+    @Autowired
     private ClassGroupRelationService classGroupRelationService;
-    @Resource
+    @Autowired
     private ClassGroupStudentMapperDao classGroupStudentMapperDao;
-    @Resource
+    @Autowired
     private ClassGroupStudentMapperService classGroupStudentMapperService;
-    @Resource
+    @Autowired
     private ClassGroupRelationDao classGroupRelationDao;
-    @Resource
+    @Autowired
     private ClassGroupTeacherMapperService classGroupTeacherMapperService;
-    @Resource
+    @Autowired
     private CourseScheduleDao courseScheduleDao;
-    @Resource
+    @Autowired
     private TeacherDefaultMusicGroupSalaryService teacherDefaultMusicGroupSalaryService;
-    @Resource
+    @Autowired
     private StudentRegistrationDao studentRegistrationDao;
-    @Resource
+    @Autowired
     private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
-    @Resource
+    @Autowired
     private SysUserService sysUserService;
-    @Resource
+    @Autowired
     private SubjectService subjectService;
-    @Resource
+    @Autowired
     private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
-    @Resource
+    @Autowired
     private CourseScheduleTeacherSalaryDao courseScheduleTeacherSalaryDao;
-    @Resource
+    @Autowired
     private StudentAttendanceDao studentAttendanceDao;
-    @Resource
+    @Autowired
     private CourseScheduleTeacherSalaryService courseScheduleTeacherSalaryService;
-    @Resource
+    @Autowired
     private StudentRegistrationService studentRegistrationService;
-    @Resource
+    @Autowired
     private ImGroupMemberService imGroupMemberService;
-    @Resource
+    @Autowired
     private ImGroupService imGroupService;
-    @Resource
+    @Autowired
     private ImUserFriendService imUserFriendService;
-    @Resource
+    @Autowired
     private CourseScheduleService courseScheduleService;
-    @Resource
+    @Autowired
     private CourseScheduleStudentPaymentService courseScheduleStudentPaymentService;
-    @Resource
+    @Autowired
     private CourseScheduleModifyLogService courseScheduleModifyLogService;
-    @Resource
+    @Autowired
     private StudentApplyRefundsDao studentApplyRefundsDao;
-    @Resource
+    @Autowired
     private RedisCache<String, Object> redisCache;
-    @Resource
+    @Autowired
     private ClassGroupService classGroupService;
-    @Resource
+    @Autowired
     private TeacherDao teacherDao;
-    @Resource
+    @Autowired
     private SysConfigDao sysConfigDao;
-    @Resource
+    @Autowired
     private SysTenantConfigService sysTenantConfigService;
-    @Resource
+    @Autowired
     private SubjectDao subjectDao;
-    @Resource
+    @Autowired
     private GroupDao groupDao;
-    @Resource
+    @Autowired
     private CourseScheduleEvaluateDao courseScheduleEvaluateDao;
-    @Resource
+    @Autowired
     private SysConfigService sysConfigService;
-    @Resource
+    @Autowired
     private StudentService studentService;
-    @Resource
+    @Autowired
     private MusicGroupPaymentCalenderCourseSettingsService musicGroupPaymentCalenderCourseSettingsService;
-    @Resource
+    @Autowired
     private OrganizationCourseUnitPriceSettingsDao organizationCourseUnitPriceSettingsDao;
-    @Resource
+    @Autowired
     private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
-    @Resource
+    @Autowired
     private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService;
-    @Resource
+    @Autowired
     private MusicGroupStudentClassAdjustDao musicGroupStudentClassAdjustDao;
-    @Resource
+    @Autowired
     private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
-    @Resource
+    @Autowired
     private MusicGroupQuitDao musicGroupQuitDao;
-    @Resource
+    @Autowired
     private MusicGroupSchoolTermStudentCourseDetailDao musicGroupSchoolTermStudentCourseDetailDao;
-    @Resource
+    @Autowired
     private MusicGroupSchoolTermCourseDetailDao musicGroupSchoolTermCourseDetailDao;
-    @Resource
+    @Autowired
     private CooperationOrganService cooperationOrganService;
-    @Resource
+    @Autowired
     private ClassGroupTeacherMapperDao classGroupTeacherMapperDao;
-    @Resource
+    @Autowired
     private ImPluginContext imPluginContext;
-    @Resource
+    @Autowired
     private ImLiveBroadcastRoomMemberService imLiveBroadcastRoomMemberService;
 
     @Override
@@ -2241,18 +2241,23 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             }
         }
 
-        if (courseScheduleList.size() > 0) {
+        if (CollectionUtils.isNotEmpty(courseScheduleList)) {
             //检测新排课冲突
             courseScheduleService.checkNewCourseSchedules(courseScheduleList, false, false);
         }
 
         //老师结算表
-        if (courseScheduleTeacherSalaryList.size() > 0) {
+        if (CollectionUtils.isNotEmpty(courseScheduleTeacherSalaryList)) {
             courseScheduleTeacherSalaryService.batchInsert(courseScheduleTeacherSalaryList);
         }
         //学生结算表
-        if (courseScheduleList.size() > 0) {
-            courseScheduleStudentPaymentService.createForMusicGroup(musicGroupId, courseScheduleList, studentIdList);
+        if (CollectionUtils.isNotEmpty(courseScheduleList)){
+            Map<Long,BigDecimal> salaryMap = new HashMap<>();
+            if (CollectionUtils.isNotEmpty(courseScheduleTeacherSalaryList)) {
+                salaryMap = courseScheduleTeacherSalaryList.stream()
+                        .collect(Collectors.toMap(CourseScheduleTeacherSalary::getCourseScheduleId, CourseScheduleTeacherSalary::getExpectSalary));
+            }
+            courseScheduleStudentPaymentService.createForMusicGroup(musicGroupId, courseScheduleList, studentIdList,salaryMap);
             studentService.updateStudentServiceTag(null, studentIdList, YesOrNoEnum.YES.getCode());
         }
         //创建IM群组
@@ -2476,7 +2481,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             //3、将老师加入关联关系
             classGroupTeacherMapperService.getDao().classGroupTeachersInsert(classGroupTeacherMapperList);
             //创建IM群组
-            addImGroup(classGroup, userIds, teacherIds);
+//            addImGroup(classGroup, userIds, teacherIds);
         }
         //排课
         List<CourseSchedule> courseScheduleList = new ArrayList<>();
@@ -2518,7 +2523,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             }
             Integer musicGroupStudentClassAdjustId = classGroup4MixDto.getMusicGroupStudentClassAdjustId();
             //学生结算表
-            courseScheduleStudentPaymentService.createForMusicGroup(courseScheduleList, studentIdList, musicGroupStudentClassAdjustId);
+            Map<Long,BigDecimal> salaryMap = new HashMap<>();
+            if (org.apache.commons.collections.CollectionUtils.isNotEmpty(courseScheduleTeacherSalaryList)) {
+                salaryMap = courseScheduleTeacherSalaryList.stream()
+                        .collect(Collectors.toMap(CourseScheduleTeacherSalary::getCourseScheduleId, CourseScheduleTeacherSalary::getExpectSalary));
+            }
+            courseScheduleStudentPaymentService.createForMusicGroup(courseScheduleList, studentIdList, musicGroupStudentClassAdjustId,salaryMap);
             return classGroup;
         }
         return null;
@@ -2832,9 +2842,14 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
         if (!CollectionUtils.isEmpty(studentList)) {
             studentService.updateStudentServiceTag(null, studentIds, YesOrNoEnum.YES.getCode());
-
+            Map<Long,BigDecimal> salaryMap = new HashMap<>();
+            if (CollectionUtils.isNotEmpty(courseScheduleTeacherSalaryList)) {
+                //汇总同一节课课程课酬
+                salaryMap = courseScheduleTeacherSalaryList.stream().collect(Collectors.groupingBy(CourseScheduleTeacherSalary::getCourseScheduleId,
+                        Collectors.reducing(BigDecimal.ZERO, CourseScheduleTeacherSalary::getExpectSalary, BigDecimal::add)));
+            }
             //学生结算表
-            courseScheduleStudentPaymentService.createForMusicGroup(musicGroupId, courseScheduleList, studentIds);
+            courseScheduleStudentPaymentService.createForMusicGroup(musicGroupId, courseScheduleList, studentIds,salaryMap);
         }
         //学校端推送
         courseScheduleModifyLogService.pushSchoolCourseCreate(courseScheduleList.get(0),musicGroup);
@@ -3482,7 +3497,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
         //学生结算表
         if (!CollectionUtils.isEmpty(studentIdList)) {
-            courseScheduleStudentPaymentService.createForMusicGroup(musicGroupId, courseScheduleList, studentIdList);
+            Map<Long,BigDecimal> salaryMap = new HashMap<>();
+            if (CollectionUtils.isNotEmpty(courseScheduleTeacherSalaryList)) {
+                salaryMap = courseScheduleTeacherSalaryList.stream()
+                        .collect(Collectors.toMap(CourseScheduleTeacherSalary::getCourseScheduleId, CourseScheduleTeacherSalary::getExpectSalary));
+            }
+            courseScheduleStudentPaymentService.createForMusicGroup(musicGroupId, courseScheduleList, studentIdList,salaryMap);
             studentService.updateStudentServiceTag(null, studentIdList, YesOrNoEnum.YES.getCode());
         }
         return classGroup;

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

@@ -42,13 +42,13 @@ import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
-import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.*;
@@ -63,93 +63,93 @@ import static com.ym.mec.biz.dal.enums.DealStatusEnum.SUCCESS;
 @Service
 public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, StudentPaymentOrder> implements StudentPaymentOrderService {
 
-    @Resource
+    @Autowired
     private StudentPaymentOrderDao studentPaymentOrderDao;
-    @Resource
+    @Autowired
     private YqPayFeignService yqPayFeignService;
-    @Resource
+    @Autowired
     private StudentRegistrationService studentRegistrationService;
-    @Resource
+    @Autowired
     @Lazy
     private VipGroupService vipGroupService;
-    @Resource
+    @Autowired
     private MusicGroupService musicGroupService;
-    @Resource
+    @Autowired
     private SporadicChargeInfoService sporadicChargeInfoService;
-    @Resource
+    @Autowired
     private PracticeGroupService practiceGroupService;
-    @Resource
+    @Autowired
     private StudentRepairService studentRepairService;
-    @Resource
+    @Autowired
     private SysUserCashAccountService sysUserCashAccountService;
-    @Resource
+    @Autowired
     private SubjectChangeService subjectChangeService;
-    @Resource
+    @Autowired
     private DegreeRegistrationService degreeRegistrationService;
-    @Resource
+    @Autowired
     private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
-    @Resource
+    @Autowired
     private IdGeneratorService idGeneratorService;
-    @Resource
+    @Autowired
     private SysConfigDao sysConfigDao;
-    @Resource
+    @Autowired
     private GoodsService goodsService;
-    @Resource
+    @Autowired
     private StudentInstrumentService studentInstrumentService;
-    @Resource
+    @Autowired
     private ReplacementInstrumentActivityService replacementInstrumentActivityService;
-    @Resource
+    @Autowired
     private ChildrenDayReserveService childrenDayReserveService;
-    @Resource
+    @Autowired
     private MemberRankSettingService memberRankSettingService;
-    @Resource
+    @Autowired
     private PayService payService;
-    @Resource
+    @Autowired
     private StudentPaymentRouteOrderService studentPaymentRouteOrderService;
-    @Resource
+    @Autowired
     private CloudTeacherOrderService cloudTeacherOrderService;
-    @Resource
+    @Autowired
     private SysCouponCodeService sysCouponCodeService;
-    @Resource
+    @Autowired
     private VipGroupActivityService vipGroupActivityService;
-    @Resource
+    @Autowired
     private ActivityUserMapperService activityUserMapperService;
-    @Resource
+    @Autowired
     private MusicGroupSubjectPlanService musicGroupSubjectPlanService;
-    @Resource
+    @Autowired
     private SysUserFeignService sysUserFeignService;
-    @Resource
+    @Autowired
     private TenantConfigService tenantConfigService;
-    @Resource
+    @Autowired
     private GoodsProcurementDao goodsProcurementDao;
-    @Resource
+    @Autowired
     private SysPaymentConfigService sysPaymentConfigService;
-    @Resource
+    @Autowired
     private SellOrderDao sellOrderDao;
     @Lazy
-    @Resource
+    @Autowired
     private ContractService contractService;
-    @Resource
+    @Autowired
     private StudentDao studentDao;
-    @Resource
+    @Autowired
     private SysUserCashAccountDetailService sysUserCashAccountDetailService;
-    @Resource
+    @Autowired
     private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
-    @Resource
+    @Autowired
     private StudentRepairDao studentRepairDao;
-    @Resource
+    @Autowired
     private MusicGroupDao musicGroupDao;
-    @Resource
+    @Autowired
     private StudentGoodsSellDao studentGoodsSellDao;
-    @Resource
+    @Autowired
     private StudentPaymentOrderService studentPaymentOrderService;
-    @Resource
+    @Autowired
     private TempDirectorTrainingCampDetailService tempDirectorTrainingCampDetailService;
-    @Resource
+    @Autowired
     private MusicGroupPaymentCalenderAddressService musicGroupPaymentCalenderAddressService;
-    @Resource
+    @Autowired
     private MusicGroupPaymentCalenderMemberService musicGroupPaymentCalenderMemberService;
-    @Resource
+    @Autowired
     private PaymentServiceContext paymentServiceContext;
 
     private final Logger logger = LoggerFactory.getLogger(this.getClass());

+ 108 - 107
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -28,6 +28,7 @@ import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.http.HttpStatus;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@@ -35,10 +36,8 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
-import javax.annotation.Resource;
 import java.io.IOException;
 import java.math.BigDecimal;
-import java.math.RoundingMode;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
@@ -54,105 +53,106 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
     private static final Logger LOGGER = LoggerFactory.getLogger(StudentRegistrationServiceImpl.class);
 
-    @Resource
+    @Autowired
     private StudentRegistrationDao studentRegistrationDao;
-    @Resource
+    @Autowired
     private StudentPaymentOrderService studentPaymentOrderService;
-    @Resource
+    @Autowired
     private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
-    @Resource
+    @Autowired
     private CourseScheduleStudentPaymentService courseScheduleStudentPaymentService;
-    @Resource
+    @Autowired
     private CourseScheduleService courseScheduleService;
-    @Resource
+    @Autowired
     private TeacherDao teacherDao;
-    @Resource
+    @Autowired
     private ClassGroupService classGroupDao;
-    @Resource
+    @Autowired
     private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
-    @Resource
+    @Autowired
     private ClassGroupStudentMapperService classGroupStudentMapperDao;
-    @Resource
+    @Autowired
     private SysMessageService sysMessageService;
-    @Resource
+    @Autowired
     private SendSeoMessageSource sendSeoMessageSource;
-    @Resource
+    @Autowired
     private MusicGroupSubjectPlanDao musicGroupSubjectPlanDao;
-    @Resource
+    @Autowired
     private SubjectDao subjectDao;
-    @Resource
+    @Autowired
     private SysUserCashAccountDao sysUserCashAccountDao;
-    @Resource
+    @Autowired
     private StudentDao studentDao;
+
     @Lazy
-    @Resource
+    @Autowired
     private ContractService contractService;
-    @Resource
+    @Autowired
     private ImFeignService imFeignService;
-    @Resource
+    @Autowired
     private ImGroupMemberService imGroupMemberService;
-    @Resource
+    @Autowired
     private MusicGroupSubjectPlanService musicGroupSubjectPlanService;
-    @Resource
+    @Autowired
     private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService;
-    @Resource
+    @Autowired
     private SubjectService subjectService;
-    @Resource
+    @Autowired
     private SysConfigDao sysConfigDao;
-    @Resource
+    @Autowired
     private SysTenantConfigService sysTenantConfigService;
-    @Resource
+    @Autowired
     private MusicGroupDao musicGroupDao;
-    @Resource
+    @Autowired
     private SysUserCashAccountDetailService sysUserCashAccountDetailService;
-    @Resource
+    @Autowired
     private SysUserCashAccountService sysUserCashAccountService;
-    @Resource
+    @Autowired
     private SysUserFeignService sysUserFeignService;
-    @Resource
+    @Autowired
     private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
-    @Resource
+    @Autowired
     private SubjectChangeDao subjectChangeDao;
-    @Resource
+    @Autowired
     private GoodsDao goodsDao;
-    @Resource
+    @Autowired
     private GoodsService goodsService;
-    @Resource
+    @Autowired
     private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
-    @Resource
+    @Autowired
     private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
-    @Resource
+    @Autowired
     private MusicGroupPaymentStudentCourseDetailDao musicGroupPaymentStudentCourseDetailDao;
-    @Resource
+    @Autowired
     private StudentCourseFeeDetailDao studentCourseFeeDetailDao;
-    @Resource
+    @Autowired
     private CourseScheduleDao courseScheduleDao;
-    @Resource
+    @Autowired
     private OrganizationDao organizationDao;
-    @Resource
+    @Autowired
     private StudentService studentService;
-    @Resource
+    @Autowired
     private ImGroupDao imGroupDao;
-    @Resource
+    @Autowired
     private StudentInstrumentDao studentInstrumentDao;
-    @Resource
+    @Autowired
     private MusicGroupPaymentCalenderStudentDetailDao musicGroupPaymentCalenderStudentDetailDao;
-    @Resource
+    @Autowired
     private CloudTeacherOrderService cloudTeacherOrderService;
-    @Resource
+    @Autowired
     private SysCouponCodeService sysCouponCodeService;
-    @Resource
+    @Autowired
     private SysUserCashAccountLogService sysUserCashAccountLogService;
-    @Resource
+    @Autowired
     private MusicGroupPaymentCalenderActivityService musicGroupPaymentCalenderActivityService;
-    @Resource
+    @Autowired
     private MusicGroupPaymentCalenderMemberService musicGroupPaymentCalenderMemberService;
-    @Resource
+    @Autowired
     private MusicGroupPaymentCalenderRepairService musicGroupPaymentCalenderRepairService;
 
-    @Resource
+    @Autowired
     private ImUserFriendService imUserFriendService;
-    @Resource
+    @Autowired
     private SysUserService sysUserService;
 
     @Override
@@ -234,18 +234,18 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         if (studentRegistration == null) {
             throw new BizException("学员信息不存在");
         }
-        
+
         Student student = studentService.get(userId);
         if(student == null){
         	throw new BizException("用户[{}]信息获取失败", userId);
         }
-        
+
         if(!StringUtils.equals(student.getSubjectIdList(), subId+"")){
         	student.setSubjectIdList(subId + "");
         	student.setUpdateTime(new Date());
         	studentService.update(student);
         }
-        
+
         //批量调剂(未缴费学员)
         int i = studentRegistrationDao.batchUpdateSubject(userId, subId, musicGroupId);
         if (i > 0) {
@@ -366,14 +366,14 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailDao.findUserApplyOrder(studentId, musicGroupId,
                     DealStatusEnum.SUCCESS);
 
-            if (CollectionUtils.isNotEmpty(studentPaymentOrderDetailList)) {
+            if (studentPaymentOrderDetailList != null && studentPaymentOrderDetailList.size() > 0) {
 
                 Map<Long, StudentPaymentOrderDetail> maintenanceMap = studentPaymentOrderDetailList.stream()
                         .filter(t -> (t.getType() == MAINTENANCE))
-                        .collect(Collectors.toMap(StudentPaymentOrderDetail::getStudentInstrumentId, StudentPaymentOrderDetail -> StudentPaymentOrderDetail));
+                        .collect(Collectors.toMap(t -> t.getStudentInstrumentId(), StudentPaymentOrderDetail -> StudentPaymentOrderDetail));
 
                 List<Long> instrumentIdList = new ArrayList<Long>(maintenanceMap.keySet());
-                if (CollectionUtils.isNotEmpty(instrumentIdList)) {
+                if (instrumentIdList != null && instrumentIdList.size() > 0) {
                     List<StudentInstrument> studentInstrumentList = studentInstrumentDao.queryById(instrumentIdList);
 
                     for (StudentInstrument si : studentInstrumentList) {
@@ -417,14 +417,14 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     public List<Map<String, Object>> getNoClassStuBySubjectId(String musicGroupId, String actualSubjectId) {
         List<StudentRegistration> students = studentRegistrationDao.getNoClassStuBySubjectId(musicGroupId, actualSubjectId);
         List<Map<String, Object>> mapArrayList = new ArrayList<>();
-        if (CollectionUtils.isNotEmpty(students)) {
+        if (students != null && students.size() > 0) {
             String[] subjectIds = actualSubjectId.split(",");
-            if (subjectIds.length > 0) {
+            if (subjectIds != null && subjectIds.length > 0) {
                 List<Map<Integer, String>> subjectNames = subjectDao.queryNameByIds(actualSubjectId);
                 Map<Integer, String> subjectNameMap = MapUtil.convertMybatisMap(subjectNames);
-                for (String id : subjectIds) {
+                for (int i = 0; i < subjectIds.length; i++) {
                     Map<String, Object> resultMap = new HashMap<>(3);
-                    int subjectId = Integer.parseInt(id);
+                    int subjectId = Integer.parseInt(subjectIds[i]);
                     List<StudentRegistration> collect = students.stream().filter(e -> e.getActualSubjectId().equals(subjectId)).collect(Collectors.toList());
                     resultMap.put("subjectId", subjectId);
                     resultMap.put("subjectName", subjectNameMap.get(subjectId));
@@ -468,7 +468,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         sysUser.setPhone(studentRegistration.getParentsPhone());
         sysUser.setOrganId(studentRegistration.getOrganId());
 
-        boolean updateNameFlag = false;
+        Boolean updateNameFlag = false;
 
         if (StringUtils.isEmpty(sysUser.getUsername())) {
             sysUser.setUsername(studentRegistration.getName());
@@ -538,16 +538,16 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                                         MusicGroupApplyGoodsDto goodsDto,
                                         RegisterPayDto registerPayDto,
                                         CouponPayParam couponPayParam) throws Exception {
-    	
+
         MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
-        
+
         if(musicGroup == null){
         	throw new BizException("乐团[{}]信息查询失败", studentRegistration.getMusicGroupId());
         }
         MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(studentPaymentOrder.getCalenderId());
 
         boolean isGiveAccessories = musicGroup.getIsGiveAccessories() != null && musicGroup.getIsGiveAccessories();
-        
+
         Date date = new Date();
         List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = new ArrayList<>();
         //乐器及打包辅件
@@ -557,26 +557,26 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         BigDecimal remitFee = goodsDto.getRemitFee();
         Boolean buyCloudTeacher = CollectionUtils.isNotEmpty(registerPayDto.getBuyCalenderMemberId());
         if (CollectionUtils.isNotEmpty(goodsGroups)) {
-        	
+
         	BigDecimal organShareProfit = BigDecimal.ZERO;
-        	
+
             for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
                 StudentPaymentOrderDetail studentPaymentOrderDetail4goodsGroup = new StudentPaymentOrderDetail();
                 studentPaymentOrderDetail4goodsGroup.setRemitFee(BigDecimal.ZERO);
                 OrderDetailTypeEnum type = null;
                 if (goodsGroup.getType().equals(GoodsType.INSTRUMENT)) {
-                    type = OrderDetailTypeEnum.MUSICAL;//  乐器
+                    type = OrderDetailTypeEnum.MUSICAL;//todo  乐器
                     goodsGroup.setPrice(goodsGroup.getPrice().subtract(remitFee));
                     studentPaymentOrderDetail4goodsGroup.setRemitFee(remitFee);
                 } else if (goodsGroup.getType().equals(GoodsType.ACCESSORIES)) {
-                    type = OrderDetailTypeEnum.ACCESSORIES;// 辅件
+                    type = OrderDetailTypeEnum.ACCESSORIES;//todo 辅件
                 } else if (goodsGroup.getType().equals(GoodsType.OTHER)) {
-                    type = OrderDetailTypeEnum.TEACHING;// 教谱
+                    type = OrderDetailTypeEnum.TEACHING;//todo 教谱
                 }
                 studentPaymentOrderDetail4goodsGroup.setType(type);
 
                 BigDecimal goodsPrice = new BigDecimal(0);
-                
+
 				if (!(type == OrderDetailTypeEnum.ACCESSORIES && (isGiveAccessories && buyCloudTeacher))) {
 
 	                if (studentRegistration.getOrganId() == 55 && musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE && !buyCloudTeacher) {
@@ -601,7 +601,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 if (OrderDetailTypeEnum.MUSICAL.equals(type)) {
                     maintenanceGoodsId = goodsGroup.getGoodsIdList();
                 }
-                
+
                 if(goodsGroup.getOrganShareProfit() != null && goodsGroup.getKitGroupPurchaseType() == KitGroupPurchaseTypeEnum.GROUP){
                 	organShareProfit = organShareProfit.add(goodsGroup.getOrganShareProfit());
                 }
@@ -620,7 +620,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             }
         }
 
-        //新的课程形态    合奏课  单技课
+        //新的课程形态  todo  合奏课  单技课
         if (CollectionUtils.isNotEmpty(newCourses)) {
             BigDecimal courseRemitFee = goodsDto.getCourseRemitFee();
             for (MusicGroupPaymentCalenderCourseSettings newCourse : newCourses) {
@@ -654,7 +654,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             }
         }
 
-        //乐保   乐保
+        //乐保 todo  乐保
         if (registerPayDto.getBuyMaintenance()) {
             if (StringUtils.isEmpty(maintenanceGoodsId)) {
                 throw new BizException("有乐器才能购买乐保,请核查");
@@ -671,7 +671,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             studentPaymentOrderDetailList.add(maintenanceOrderDetail);
         }
 
-        //活动   VIP 或 网管课
+        //活动 todo  VIP 或 网管课
         List<MusicGroupPaymentCalenderActivity> calenderActivities = null;
         List<Long> buyCalenderActivityId = registerPayDto.getBuyCalenderActivityId();
         if (CollectionUtils.isNotEmpty(buyCalenderActivityId)) {
@@ -699,7 +699,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         }
 
 
-        //云教练/云教练+    团练宝
+        //云教练/云教练+  todo  团练宝
         if (buyCloudTeacher || (Objects.nonNull(calender) && calender.getPayUserType() == MusicGroupPaymentCalender.PayUserType.SCHOOL)) {
             List<MusicGroupPaymentCalenderMember> calenderMembers = new ArrayList<>();
             if(buyCloudTeacher){
@@ -826,7 +826,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                           ){
         Date date = new Date();
         List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = new ArrayList<>();
-        //新的课程形态  合奏课  单技课
+        //新的课程形态  todo  合奏课  单技课
         if (CollectionUtils.isNotEmpty(newCourses)) {
             for (MusicGroupPaymentCalenderCourseSettings newCourse : newCourses) {
                 StudentPaymentOrderDetail studentPaymentOrderDetailCourse = new StudentPaymentOrderDetail();
@@ -840,7 +840,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             }
         }
 
-        //乐保 乐保
+        //乐保 todo  乐保
         if (Objects.nonNull(calenderRepair)) {
             StudentPaymentOrderDetail maintenanceOrderDetail = new StudentPaymentOrderDetail();
             maintenanceOrderDetail.setType(MAINTENANCE);
@@ -853,7 +853,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             studentPaymentOrderDetailList.add(maintenanceOrderDetail);
         }
 
-        //活动 VIP 或 网管课
+        //活动 todo  VIP 或 网管课
         if(CollectionUtils.isNotEmpty(calenderActivities)){
             for (MusicGroupPaymentCalenderActivity calenderActivity : calenderActivities) {
                 StudentPaymentOrderDetail maintenanceOrderDetail = new StudentPaymentOrderDetail();
@@ -873,7 +873,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             }
         }
 
-        //云教练/云教练+   团练宝
+        //云教练/云教练+  todo  团练宝
         if(CollectionUtils.isNotEmpty(calenderMembers)){
             for (MusicGroupPaymentCalenderMember calenderMember : calenderMembers) {
                 StudentPaymentOrderDetail cloudTeacherOrderDetail = new StudentPaymentOrderDetail();
@@ -900,12 +900,13 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
      * 计算使用优惠券后的每个明细均摊的金额
      *
      * @param couponParam          优惠券的信息
+     * @param orderDetailGroupList 订单信息
      */
     private void calculateCoupon(Map<String, CouponPayTypeInfo> couponParam,List<StudentPaymentOrderDetail> paymentOrderDetails) {
         List<StudentPaymentOrderDetail> singleTypeList = new ArrayList<>();
         List<StudentPaymentOrderDetail> allTypeList = new ArrayList<>();
         paymentOrderDetails.forEach(e->e.setCouponDetailTypeEnum(CouponDetailTypeEnum.valueOf(CouponDetailTypeEnum.of(e.getType().getCode()))));
-        Map<CouponDetailTypeEnum, List<StudentPaymentOrderDetail>> orderDetailGroupList = paymentOrderDetails.stream().collect(Collectors.groupingBy(StudentPaymentOrderDetail::getCouponDetailTypeEnum));
+        Map<CouponDetailTypeEnum, List<StudentPaymentOrderDetail>> orderDetailGroupList = paymentOrderDetails.stream().collect(Collectors.groupingBy(e -> e.getCouponDetailTypeEnum()));
         //先处理”非全类型券“的数据
         orderDetailGroupList.forEach((e, list) -> {
             //根据OrderDetailTypeEnum类型找到对应的券类型,默认全类型
@@ -1114,9 +1115,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     public void insertStudent(String studentIds, String oldMusicGroupId, String newMusicGroupId,
                               Map<Integer, List<MusicGroupPaymentCalenderStudentDetail>> collect,String batchNo) {
         //获取欠费学员列表
-        List<Integer> studentIdList = Arrays.stream(studentIds.split(",")).mapToInt(Integer::valueOf).boxed().collect(Collectors.toList());
+        List<Integer> studentIdList = Arrays.asList(studentIds.split(",")).stream().mapToInt(idStr -> Integer.valueOf(idStr)).boxed().collect(Collectors.toList());
         List<Integer> noPaymentUserIds = musicGroupPaymentCalenderDetailDao.queryNoPaymentUserIds(newMusicGroupId, studentIdList,batchNo);
-        if (CollectionUtils.isNotEmpty(noPaymentUserIds)) {
+        if (noPaymentUserIds.size() > 0) {
             throw new BizException("操作失败:有欠费的学员不允许创建缴费");
         }
         SysUser sysUser1 = sysUserFeignService.queryUserInfo();
@@ -1126,14 +1127,14 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         BigDecimal amount = BigDecimal.ZERO;
         for (StudentRegistration studentRegistration : studentRegistrations) {
             List<MusicGroupPaymentCalenderStudentDetail> details = collect.get(studentRegistration.getUserId());
-            BigDecimal masterTotalPrice = details.stream().map(MusicGroupPaymentCalenderStudentDetail::getCutAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+            BigDecimal masterTotalPrice = details.stream().map(e -> e.getCutAmount()).reduce(BigDecimal.ZERO, BigDecimal::add);
             if (masterTotalPrice.doubleValue() > studentRegistration.getSurplusCourseFee().doubleValue()) {
                 throw new BizException("用户信息发生变动,请重新提交");
             }
             if (oldMusicGroupId.equals(newMusicGroupId)) {
                 continue;
             }
-            courseScheduleStudentPaymentService.updateCourseActualPrice(Collections.singletonList(oldMusicGroupId), null, GroupType.MUSIC);
+            courseScheduleStudentPaymentService.updateCourseActualPrice(Arrays.asList(oldMusicGroupId), null, GroupType.MUSIC);
             //记录课程余额消费日志
             if (studentRegistration.getSurplusCourseFee().doubleValue() > 0d && masterTotalPrice.doubleValue() > 0d) {
                 StudentCourseFeeDetail studentCourseFeeDetail = new StudentCourseFeeDetail();
@@ -1198,7 +1199,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentCourseFeeDetails.add(studentCourseFeeDetail);
             }
         }
-        if (CollectionUtils.isNotEmpty(studentCourseFeeDetails)) {
+        if (studentCourseFeeDetails.size() > 0) {
             studentCourseFeeDetailDao.batchInsert(studentCourseFeeDetails);
         }
     }
@@ -1225,7 +1226,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 //        classGroupDao.updateClassStudentNum(classGroupId.longValue(), 1);
         //3、学生加入新班级未开始课程
         List<CourseSchedule> noStartCoursesByClassGroupId = courseScheduleService.findNoStartCoursesByClassGroupId(classGroupId);
-        if (CollectionUtils.isNotEmpty(noStartCoursesByClassGroupId)) {
+        if (noStartCoursesByClassGroupId != null && noStartCoursesByClassGroupId.size() > 0) {
             courseScheduleList.addAll(noStartCoursesByClassGroupId);
         }
         return courseScheduleList;
@@ -1251,8 +1252,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         String snapClassIds = studentAddDto.getSnapClassIds();
         if (StringUtils.isNotEmpty(snapClassIds)) {
             String[] split = snapClassIds.split(",");
-            for (String s : split) {
-                addStudent(Integer.parseInt(s), userId, nowDate, courseScheduleList);
+            for (int i = 0; i < split.length; i++) {
+                addStudent(Integer.parseInt(split[i]), userId, nowDate, courseScheduleList);
             }
         }
         List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<>();
@@ -1269,7 +1270,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             courseScheduleStudentPayments.add(courseScheduleStudentPayment);
         }
 
-        if (CollectionUtils.isEmpty(courseScheduleStudentPayments)) {
+        if (courseScheduleStudentPayments.size() == 0) {
             return;
         }
         courseScheduleStudentPaymentService.batchInsert(courseScheduleStudentPayments);
@@ -1381,7 +1382,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             } catch (Exception e) {
                 LOGGER.error("协议生成失败", e);
             }
-            
+
         }
 
         if (studentPaymentOrder.getStatus().equals(DealStatusEnum.FAILED) || studentPaymentOrder.getStatus().equals(DealStatusEnum.CLOSE)) {
@@ -1390,7 +1391,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             studentRegistrationDao.update(studentRegistration);
             //减去缴费人数(器乐收费,0元时不减缴费人数)
             studentPaymentOrderService.cutSubjectPlan(studentPaymentOrder);
-            
+
             //增加商品库存
             List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailService.queryOrderDetail(studentPaymentOrder.getId());
             String goodsIds = studentPaymentOrderDetailList.stream().map(StudentPaymentOrderDetail::getMinuendStockGoodsIdList)
@@ -1402,7 +1403,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             	Goods goods = null;
     			Map<Integer, Goods> batchUpdateGoodsMap = new HashMap<Integer, Goods>();
 //    			Map<Long, GoodsProcurement> goodsProcurementMap = new HashMap<Long, GoodsProcurement>();
-            	
+
             	for(String goodsIdStr : goodsIds.split(",")){
             		if(StringUtils.isBlank(goodsIdStr)){
 						continue;
@@ -1414,9 +1415,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 //					goods.setStockCount(new AtomicInteger(goods.getStockCount()).incrementAndGet());
 					goods.setSellCount(new AtomicInteger(goods.getSellCount()).decrementAndGet());
 					goods.setUpdateTime(nowDate);
-					
+
 					batchUpdateGoodsMap.put(goods.getId(), goods);
-					
+
 					// 进货清单
 					/*goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
 					if(goodsProcurement != null){
@@ -1427,13 +1428,13 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 						goodsProcurement.setUpdateTime(nowDate);
 						goodsProcurementMap.put(goodsProcurement.getId(), goodsProcurement);
 					}*/
-					
+
             	}
-            	
+
             	/*if(goodsProcurementMap.size() > 0){
             		goodsProcurementDao.batchUpdate(new ArrayList<GoodsProcurement>(goodsProcurementMap.values()));
             	}*/
-                
+
                 if(!batchUpdateGoodsMap.isEmpty()){
                 	goodsService.batchUpdate(new ArrayList<Goods>(batchUpdateGoodsMap.values()));
                 }
@@ -1726,7 +1727,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     public BigDecimal updateUserSurplusCourseFee(Integer userId, String musicGroupId, BigDecimal amount, String memo, Integer operatorId) {
         StudentRegistration studentRegistration = studentRegistrationDao.lockWithUserAndMusic(userId, musicGroupId);
         if (Objects.isNull(studentRegistration)) {
-            LOGGER.error("学员{}-{}可用排课余额更新失败:学员注册信息不存在", userId, musicGroupId);
+            LOGGER.error("学员{}-{}可用排课余额更新失败:学员注册信息不存在", amount);
             return BigDecimal.ZERO;
         }
 
@@ -1804,7 +1805,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
     @Override
     public List<StudentRegistration> getMusicGroupStuReBack(String musicGroupId) {
-        courseScheduleStudentPaymentService.updateCourseActualPrice(Collections.singletonList(musicGroupId), null, GroupType.MUSIC);
+        courseScheduleStudentPaymentService.updateCourseActualPrice(Arrays.asList(musicGroupId), null, GroupType.MUSIC);
         return this.findMusicGroupStudent(musicGroupId, null);
     }
 
@@ -1851,10 +1852,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         for (MusicGroupPaymentCalender regCalender : regCalenders) {
             viewMap.put(regCalender.getMusicGroupId(), true);
         }
-        
+
         //判断乐团是否开课
         List<MusicGroup> musicGroupList = musicGroupDao.getMusicGroupByIds(ids);
-        
+
         for(MusicGroup mg : musicGroupList){
         	if (viewMap.containsKey(mg.getId()) && mg.getFirstCourseStartTime() != null) {
                 viewMap.remove(mg.getId());
@@ -1920,7 +1921,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             if(totalPayNum == 0){
                 pageInfo.setPayScale(new BigDecimal(0));
             }else {
-                pageInfo.setPayScale(new BigDecimal(firstPayNum).multiply(new BigDecimal(100)).divide(new BigDecimal(totalPayNum), 2, RoundingMode.HALF_UP));
+                pageInfo.setPayScale(new BigDecimal(firstPayNum).multiply(new BigDecimal(100)).divide(new BigDecimal(totalPayNum), 2, BigDecimal.ROUND_HALF_UP));
             }
         }
 
@@ -2002,7 +2003,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
         List<StudentPaymentOrder> updateList = new ArrayList<StudentPaymentOrder>();
 
-        if (CollectionUtils.isNotEmpty(studentPaymentOrderList)) {
+        if (studentPaymentOrderList != null && studentPaymentOrderList.size() > 0) {
             for (StudentPaymentOrder studentPaymentOrder : studentPaymentOrderList) {
                 if (StringUtils.equals("205", studentPaymentOrder.getPaymentAccountNo())) {
                     studentPaymentOrder.setStatus(DealStatusEnum.CLOSE);
@@ -2013,7 +2014,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             }
         }
 
-        if (CollectionUtils.isNotEmpty(updateList)) {
+        if (updateList.size() > 0) {
             studentPaymentOrderService.batchUpdate(updateList);
         }
 
@@ -2049,7 +2050,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
         List<StudentPaymentOrder> updateList = new ArrayList<StudentPaymentOrder>();
 
-        if (CollectionUtils.isNotEmpty(studentPaymentOrderList)) {
+        if (studentPaymentOrderList != null && studentPaymentOrderList.size() > 0) {
             for (StudentPaymentOrder studentPaymentOrder : studentPaymentOrderList) {
                 if (StringUtils.equals("205", studentPaymentOrder.getPaymentAccountNo())) {
                     studentPaymentOrder.setStatus(DealStatusEnum.CLOSE);
@@ -2060,7 +2061,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             }
         }
 
-        if (CollectionUtils.isNotEmpty(updateList)) {
+        if (updateList.size() > 0) {
             studentPaymentOrderService.batchUpdate(updateList);
         }