浏览代码

Merge branch 'master' into export_order

周箭河 4 年之前
父节点
当前提交
f3d2d2d449
共有 31 个文件被更改,包括 303 次插入295 次删除
  1. 14 8
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/IndexBaseMonthDataDao.java
  2. 7 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderStudentDetailDao.java
  3. 7 7
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ImGroupMember.java
  4. 3 3
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderStudentDetail.java
  5. 13 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupStudentClassAdjust.java
  6. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/service/ClassGroupService.java
  7. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/service/ClassGroupStudentMapperService.java
  8. 0 6
      mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleStudentPaymentService.java
  9. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/IndexBaseMonthDataService.java
  10. 0 1
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java
  11. 20 10
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java
  12. 15 9
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupStudentMapperServiceImpl.java
  13. 4 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java
  14. 8 9
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ImGroupMemberServiceImpl.java
  15. 61 27
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java
  16. 0 16
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java
  17. 6 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  18. 32 122
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  19. 4 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentRouteOrderServiceImpl.java
  20. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  21. 1 1
      mec-biz/src/main/resources/config/mybatis/ClassGroupMapper.xml
  22. 1 1
      mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  23. 19 39
      mec-biz/src/main/resources/config/mybatis/ImGroupMemberMapper.xml
  24. 59 13
      mec-biz/src/main/resources/config/mybatis/IndexBaseMonthDataMapper.xml
  25. 1 1
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderDetailMapper.xml
  26. 4 1
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderStudentDetailMapper.xml
  27. 6 2
      mec-biz/src/main/resources/config/mybatis/MusicGroupStudentClassAdjustMapper.xml
  28. 1 1
      mec-biz/src/main/resources/config/mybatis/StudentMapper.xml
  29. 7 0
      mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupPaymentCalenderController.java
  30. 1 1
      mec-web/src/main/java/com/ym/mec/web/controller/CourseScheduleController.java
  31. 2 2
      mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

+ 14 - 8
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/IndexBaseMonthDataDao.java

@@ -43,7 +43,7 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
      * @date 2021/1/7 0007
      * @return java.util.List<com.ym.mec.biz.dal.dto.IndexBaseMonthDto>
      */
-    List<IndexBaseMonthData> getStudentSignUpData();
+    List<IndexBaseMonthData> getStudentSignUpData(@Param("month") String month);
 
     /**
      * @describe 统计作业布置数据
@@ -51,7 +51,8 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
      * @date 2021/1/7 0007
      * @return java.util.List<com.ym.mec.biz.dal.dto.IndexBaseMonthDto>
      */
-    List<IndexBaseMonthData> getHomeworkData(@Param("type") String type);
+    List<IndexBaseMonthData> getHomeworkData(@Param("month") String month,
+                                             @Param("type") String type);
 
     /**
      * @describe 统计合作单位数据
@@ -59,7 +60,7 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
      * @date 2021/1/11 0011
      * @return java.util.List<com.ym.mec.biz.dal.entity.IndexBaseMonthData>
      */
-    List<IndexBaseMonthData> getSchoolData();
+    List<IndexBaseMonthData> getSchoolData(@Param("month") String month);
 
     /**
      * @describe 统计乐团数据
@@ -67,7 +68,7 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
      * @date 2021/1/11 0011
      * @return java.util.List<com.ym.mec.biz.dal.entity.IndexBaseMonthData>
      */
-    List<IndexBaseMonthData> getMusicData();
+    List<IndexBaseMonthData> getMusicData(@Param("month") String month);
 
     /**
      * @describe 统计乐团学员数据
@@ -75,12 +76,17 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
      * @date 2021/1/11 0011
      * @return java.util.List<com.ym.mec.biz.dal.entity.IndexBaseMonthData>
      */
-    List<IndexBaseMonthData> getMusicStudentData();
+    List<IndexBaseMonthData> getMusicStudentData(@Param("month") String month,
+                                                 @Param("type") String type);
 
-    List<IndexBaseMonthData> getOtherStudentData();
+    List<IndexBaseMonthData> getStudentConversionData(@Param("month") String month);
 
-    List<IndexBaseMonthData> getTeacherData(@Param("jobNature") JobNatureEnum jobNature,
+    List<IndexBaseMonthData> getOtherStudentData(@Param("month") String month);
+
+    List<IndexBaseMonthData> getTeacherData(@Param("month") String month,
+                                            @Param("jobNature") JobNatureEnum jobNature,
                                             @Param("isDemission") Boolean isDemission);
 
-    List<IndexBaseMonthData> getGroupCourseData(@Param("groupType")GroupType groupType);
+    List<IndexBaseMonthData> getGroupCourseData(@Param("month") String month,
+                                                @Param("groupType")GroupType groupType);
 }

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderStudentDetailDao.java

@@ -24,4 +24,11 @@ public interface MusicGroupPaymentCalenderStudentDetailDao extends BaseDAO<Integ
      * @param batchNo
      */
     void delByBatchNo(String batchNo);
+
+    /**
+     * 获取跨团合班学员缴费详情
+     * @param batchNo
+     * @param userId
+     */
+    List<MusicGroupPaymentCalenderStudentDetail>  findByBatchNoAndUserId(@Param("batchNo") String batchNo, @Param("userId") Integer userId);
 }

+ 7 - 7
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ImGroupMember.java

@@ -69,15 +69,15 @@ public class ImGroupMember {
 	public boolean getIsAdmin(){
 		return this.isAdmin;
 	}
-			
-	public void setRoleType(String roleType){
-		this.roleType = roleType;
+
+	public String getRoleType() {
+		return roleType;
 	}
-	
-	public String getRoleType(){
-		return this.roleType;
+
+	public void setRoleType(String roleType) {
+		this.roleType = roleType;
 	}
-			
+
 	public void setCreateTime(java.util.Date createTime){
 		this.createTime = createTime;
 	}

+ 3 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderStudentDetail.java

@@ -168,14 +168,14 @@ public class MusicGroupPaymentCalenderStudentDetail {
 		if (o == null || getClass() != o.getClass()) return false;
 		MusicGroupPaymentCalenderStudentDetail that = (MusicGroupPaymentCalenderStudentDetail) o;
 		return userId.equals(that.userId) &&
-				courseOriginalPrice.equals(that.courseOriginalPrice) &&
-				courseCurrentPrice.equals(that.courseCurrentPrice) &&
+				courseOriginalPrice.doubleValue()==(that.courseOriginalPrice.doubleValue()) &&
+				courseCurrentPrice.doubleValue()==(that.courseCurrentPrice.doubleValue()) &&
 				courseType.equals(that.courseType) &&
 				classGroupId.equals(that.classGroupId);
 	}
 
 	@Override
 	public int hashCode() {
-		return Objects.hash(userId, courseOriginalPrice, courseCurrentPrice, courseType, classGroupId);
+		return Objects.hash(userId, courseOriginalPrice.doubleValue(), courseCurrentPrice.doubleValue(), courseType, classGroupId);
 	}
 }

+ 13 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupStudentClassAdjust.java

@@ -1,6 +1,8 @@
 package com.ym.mec.biz.dal.entity;
 
 import io.swagger.annotations.ApiModelProperty;
+
+import java.math.BigDecimal;
 import java.util.Date;
 
 /**
@@ -54,10 +56,21 @@ public class MusicGroupStudentClassAdjust {
 	@ApiModelProperty(value = "主班编号", required = false)
 	private Integer masterClassGroupId;
 
+	@ApiModelProperty(value = "主班剩余价值", required = false)
+	private BigDecimal masterTotalPrice;
+
 	private Date createTime;
 
 	private Date updateTime;
 
+	public BigDecimal getMasterTotalPrice() {
+		return masterTotalPrice;
+	}
+
+	public void setMasterTotalPrice(BigDecimal masterTotalPrice) {
+		this.masterTotalPrice = masterTotalPrice;
+	}
+
 	public Integer getMasterClassCourseTimes() {
 		return masterClassCourseTimes;
 	}

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/ClassGroupService.java

@@ -542,5 +542,6 @@ public interface ClassGroupService extends BaseService<Integer, ClassGroup> {
      * @param courseIds
      * @param classGroupStudents
      */
-    void spanGroupClassAdjustPass(Integer masterClassGroupId,List<Integer> studentIds,List<Long> courseIds,List<Map<String, String>> classGroupStudents,List<Long> allLockCourseIds,String batchNo);
+    void spanGroupClassAdjustPass(Integer masterClassGroupId,List<Integer> studentIds,List<Long> courseIds,List<Map<String,
+            String>> classGroupStudents,List<Long> allLockCourseIds,String batchNo,BigDecimal masterTotalPrice);
 }

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/ClassGroupStudentMapperService.java

@@ -9,6 +9,7 @@ import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.common.service.BaseService;
 
 import java.io.IOException;
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.Set;
 
@@ -91,12 +92,11 @@ public interface ClassGroupStudentMapperService extends BaseService<Long, ClassG
 
     /**
      * @describe 更新班级学员
-     * @author Joburgess
      * @date 2020.11.04
      * @param classGroupId:
      * @param studentIds:
      * @return void
      */
-    void updateClassGroupStudents1(Long classGroupId, List<Integer> studentIds,List<Long> allLockCourseIds,String batchNo);
+    void updateClassGroupStudents1(Long classGroupId, List<Integer> studentIds, List<Long> allLockCourseIds, String batchNo, BigDecimal masterTotalPrice);
 
 }

+ 0 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleStudentPaymentService.java

@@ -1,17 +1,11 @@
 package com.ym.mec.biz.service;
 
-import com.ym.mec.biz.dal.dto.CourseScheduleStudentListDto;
 import com.ym.mec.biz.dal.dto.SimpleUserDto;
 import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment;
-import com.ym.mec.biz.dal.page.CourseScheduleQueryInfo;
 import com.ym.mec.biz.dal.page.CourseScheduleStudentPaymentQueryInfo;
-import com.ym.mec.common.page.PageInfo;
-import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.common.service.BaseService;
-import org.snaker.engine.access.Page;
-
 import java.util.List;
 import java.util.Map;
 

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/IndexBaseMonthDataService.java

@@ -11,6 +11,6 @@ public interface IndexBaseMonthDataService extends BaseService<Long, IndexBaseMo
 
     List<IndexBaseDto> getIndexBaseData(String dataType, String organIds, String startMonth, String endMonth);
 
-    Map<String, List<IndexBaseDto>> indexBaseDataTask(String startMonth, String endMonth);
+    Map<String, List<IndexBaseDto>> indexBaseDataTask(String month);
 
 }

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

@@ -141,7 +141,6 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
      * @param studentIds 学员列表
      * @param oldMusicGroupId 原乐团
      * @param newMusicGroupId 主乐团
-     * @param masterTotalPrice 主乐团剩余课程价值
      * @return
      */
     void insertStudent(String studentIds,String oldMusicGroupId,String newMusicGroupId,Map<Integer, List<MusicGroupPaymentCalenderStudentDetail>> collect);

+ 20 - 10
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -32,6 +32,7 @@ import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.service.*;
+import com.ym.mec.util.collection.ListUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -3723,21 +3724,22 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         MusicGroup musicGroup = musicGroupDao.findByClassGroupId(masterClassGroupId);
         BigDecimal masterTotalPrice = getMasterTotalPrice(masterClassGroupId);
         //是否有需要审核的缴费项目
-        //将学员加入新乐团、扣除原乐团剩余课程余额、补充到现有乐团
-        Map<Integer, List<MusicGroupPaymentCalenderStudentDetail>> collect = musicGroupPaymentCalenderStudentDetails.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<MusicGroupPaymentCalenderStudentDetail> calenderStudentDetails = paymentCalenderDto.getMusicGroupPaymentCalenderStudentDetails();
 
         paymentCalenderDto.setMusicGroupId(musicGroup.getId());
-        List<MusicGroupPaymentCalenderStudentDetail> calenderStudentDetails = paymentCalenderDto.getMusicGroupPaymentCalenderStudentDetails();
         boolean containsAll = musicGroupPaymentCalenderStudentDetails.containsAll(calenderStudentDetails);
         if(!containsAll){
             paymentCalenderDto.setStatus(AUDITING);
         }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);
         //生成缴费项目
@@ -3752,6 +3754,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         musicGroupStudentClassAdjust.setOperatorId(sysUser.getId());
         musicGroupStudentClassAdjust.setClassGroupIds(JSON.toJSONString(classGroupIds));
         musicGroupStudentClassAdjust.setStudentIds(JSON.toJSONString(studentIds));
+        musicGroupStudentClassAdjust.setMasterTotalPrice(masterTotalPrice);
         musicGroupStudentClassAdjust.setMasterClassCourseTimes(courseScheduleDao.queryTotalCourseTimes(masterClassGroupId));
         if (classGroupStudents != null && classGroupStudents.size() > 0) {
             musicGroupStudentClassAdjust.setClassGroupStudents(JSON.toJSONString(mergeClassSplitClassAffirmDto.getClassGroupStudents()));
@@ -3780,7 +3783,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         //没有需要审核的缴费项目
         if (paymentCalenderDto.getStatus() != AUDITING) {
             List<Map<String,String>> classGroupStudents1 = (List<Map<String,String>>)JSON.parse(musicGroupStudentClassAdjust.getClassGroupStudents());
-            spanGroupClassAdjustPass(masterClassGroupId,studentIds,courseIds,classGroupStudents1,allLockCourseIds,paymentCalenderDto.getBatchNo());
+            spanGroupClassAdjustPass(masterClassGroupId,studentIds,courseIds,classGroupStudents1,allLockCourseIds,paymentCalenderDto.getBatchNo(),masterTotalPrice);
         }else {
 //                冻结班级
             classGroupDao.batchUpdateLockByClassGroupIds(classGroupIds, 1);
@@ -3789,9 +3792,16 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         }
     }
 
-    public void spanGroupClassAdjustPass(Integer masterClassGroupId,List<Integer> studentIds,List<Long> courseIds,List<Map<String, String>> classGroupStudents,List<Long> allLockCourseIds,String batchNo){
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void spanGroupClassAdjustPass(Integer masterClassGroupId,
+                                         List<Integer> studentIds,
+                                         List<Long> courseIds,
+                                         List<Map<String, String>> classGroupStudents,
+                                         List<Long> allLockCourseIds,
+                                         String batchNo,BigDecimal masterTotalPrice){
         //将学员加进班级未开始的课程,以及班级关联、加群
-        classGroupStudentMapperService.updateClassGroupStudents1(masterClassGroupId.longValue(),studentIds,allLockCourseIds,batchNo);
+        classGroupStudentMapperService.updateClassGroupStudents1(masterClassGroupId.longValue(),studentIds,allLockCourseIds,batchNo,masterTotalPrice);
         //删除学员课程
         courseScheduleDao.deleteMusicGroupCourseSchedulesWithStudents(courseIds, studentIds);
         //删除班级关联的学员

+ 15 - 9
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupStudentMapperServiceImpl.java

@@ -549,7 +549,7 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public void updateClassGroupStudents1(Long classGroupId, List<Integer> studentIds,List<Long> allLockCourseIds,String batchNo) {
+    public void updateClassGroupStudents1(Long classGroupId, List<Integer> studentIds,List<Long> allLockCourseIds,String batchNo,BigDecimal masterTotalPrice) {
         ClassGroup classGroup = classGroupDao.lockClassGroup(classGroupId.intValue());
         if (Objects.isNull(classGroup)) {
             throw new BizException("班级信息错误");
@@ -561,8 +561,11 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
         Date now = new Date();
         List<ClassGroupStudentMapper> classGroupStudentMappers = new ArrayList<>();
         //获取分布默认的课程类型单价
-        MusicGroup musicGroup = musicGroupDao.findByClassGroupId(classGroupId.intValue());
-        Map<String, BigDecimal> unitPriceMap = MapUtil.convertIntegerMap(organizationCourseUnitPriceSettingsDao.queryMapByOrganIdAndChargeTypeId(musicGroup.getChargeTypeId(), musicGroup.getOrganId()));
+//        MusicGroup musicGroup = musicGroupDao.findByClassGroupId(classGroupId.intValue());
+//        Map<String, BigDecimal> unitPriceMap = MapUtil.convertIntegerMap(organizationCourseUnitPriceSettingsDao.queryMapByOrganIdAndChargeTypeId(musicGroup.getChargeTypeId(), musicGroup.getOrganId()));
+
+        BigDecimal divide = masterTotalPrice.divide(new BigDecimal(classGroupNotStartCourse.size()), 2, BigDecimal.ROUND_HALF_UP);
+        BigDecimal decimal = divide.multiply(new BigDecimal(classGroupNotStartCourse.size()));
 
         //生成班级关联
         for (Integer studentId : studentIds) {
@@ -575,10 +578,8 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
             classGroupStudentMapper.setGroupType(GroupType.MUSIC);
             classGroupStudentMappers.add(classGroupStudentMapper);
             //生成课程关联
-            for (CourseSchedule courseSchedule : classGroupNotStartCourse) {
-                //获取课程时长
-                int minutesBetween = DateUtil.minutesBetween(courseSchedule.getStartClassTime(), courseSchedule.getEndClassTime());
-                BigDecimal multiply = unitPriceMap.get(courseSchedule.getType().getCode()).multiply(new BigDecimal(minutesBetween));
+            for (int i = 0; i < classGroupNotStartCourse.size(); i++) {
+                CourseSchedule courseSchedule = classGroupNotStartCourse.get(i);
                 CourseScheduleStudentPayment cssp = new CourseScheduleStudentPayment();
                 cssp.setGroupType(courseSchedule.getGroupType());
                 cssp.setMusicGroupId(courseSchedule.getMusicGroupId());
@@ -586,8 +587,13 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
                 cssp.setClassGroupId(courseSchedule.getClassGroupId());
                 cssp.setBatchNo(batchNo);
                 cssp.setUserId(studentId);
-                cssp.setOriginalPrice(multiply);
-                cssp.setExpectPrice(multiply);
+                if(i == 0){
+                    cssp.setOriginalPrice(divide.add(masterTotalPrice.subtract(decimal)));
+                    cssp.setExpectPrice(divide.add(masterTotalPrice.subtract(decimal)));
+                }else {
+                    cssp.setOriginalPrice(divide);
+                    cssp.setExpectPrice(divide);
+                }
                 cssp.setActualPrice(BigDecimal.ZERO);
                 courseScheduleStudentPayments.add(cssp);
             }

+ 4 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -4654,12 +4654,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 
 		ClassGroup classGroup = classGroupDao.findByMusicGroupAndType(practiceGroupId, PRACTICE.getCode());
         if(Objects.nonNull(educationalTeacherId)&&!educationalTeacherId.equals(practiceGroup.getEducationalTeacherId())){
-			if(Objects.nonNull(practiceGroup.getEducationalTeacherId())){
-				imGroupMemberService.quit(classGroup.getId().longValue(), practiceGroup.getEducationalTeacherId());
-			}
+//			if(Objects.nonNull(practiceGroup.getEducationalTeacherId())){
+//				imGroupMemberService.quit(classGroup.getId().longValue(), practiceGroup.getEducationalTeacherId());
+//			}
 
 			practiceGroup.setEducationalTeacherId(educationalTeacherId);
-			imGroupMemberService.join(classGroup.getId().longValue(), educationalTeacherId, "", false);
+//			imGroupMemberService.join(classGroup.getId().longValue(), educationalTeacherId, "", false);
 		}
 		if(Objects.nonNull(subjectId)&&!subjectId.equals(practiceGroup.getSubjectId())){
 			Subject subject = subjectDao.get(subjectId);

+ 8 - 9
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ImGroupMemberServiceImpl.java

@@ -1,13 +1,12 @@
 package com.ym.mec.biz.service.impl;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.Map.Entry;
-import java.util.Objects;
 import java.util.stream.Collectors;
 
+import com.ym.mec.biz.dal.dao.TeacherDao;
+import com.ym.mec.util.collection.MapUtil;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -17,7 +16,6 @@ import com.ym.mec.biz.dal.dao.ImGroupMemberDao;
 import com.ym.mec.biz.dal.entity.ImGroup;
 import com.ym.mec.biz.dal.entity.ImGroupMember;
 import com.ym.mec.biz.service.ImGroupMemberService;
-import com.ym.mec.biz.service.ImGroupService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
@@ -35,10 +33,10 @@ public class ImGroupMemberServiceImpl extends BaseServiceImpl<Long, ImGroupMembe
 	private ImGroupDao imGroupDao;
 
 	@Autowired
-	private ImFeignService imFeignService;
+	private TeacherDao teacherDao;
 
 	@Autowired
-	private ImGroupService imGroupService;
+	private ImFeignService imFeignService;
 
 	@Override
 	public BaseDAO<Long, ImGroupMember> getDAO() {
@@ -98,7 +96,7 @@ public class ImGroupMemberServiceImpl extends BaseServiceImpl<Long, ImGroupMembe
 		List<GroupMember> groupMemberList = new ArrayList<GroupMember>();
 
 		String groupId = imGroup.getId().toString();
-
+		Map<Integer, String> nameIdMap= MapUtil.convertIntegerMap(teacherDao.queryNameByIdList(new ArrayList<>(userRoleMap.keySet())));
 		for (Entry<Integer, String> entry : userRoleMap.entrySet()) {
 			
 			if(existUserIdList.contains(entry.getKey())){
@@ -112,6 +110,7 @@ public class ImGroupMemberServiceImpl extends BaseServiceImpl<Long, ImGroupMembe
 			imGroupMember.setRoleType(entry.getValue());
 			imGroupMember.setUpdateTime(date);
 			imGroupMember.setUserId(entry.getKey());
+			imGroupMember.setNickname(nameIdMap.get(imGroupMember.getUserId()));
 
 			imGroupMemberList.add(imGroupMember);
 			groupMemberList.add(new GroupMember(imGroupMember.getUserId().toString(), groupId));

+ 61 - 27
mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java

@@ -6,6 +6,7 @@ import com.ym.mec.biz.dal.entity.Organization;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.IndexDataType;
 import com.ym.mec.biz.dal.enums.JobNatureEnum;
+import com.ym.mec.common.constant.CommonConstants;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.util.date.DateUtil;
@@ -18,8 +19,8 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
+import java.math.BigDecimal;
 import java.time.LocalDate;
-import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -48,8 +49,9 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 	public List<IndexBaseDto> getIndexBaseData(String dataTypesStr, String organIdsStr, String startMonth, String endMonth) {
 		List<IndexBaseDto> result = new ArrayList<>();
 
+		LocalDate nowDateTime = LocalDate.now();
+		nowDateTime.withDayOfMonth(1);
 		if(StringUtils.isBlank(startMonth)){
-			LocalDateTime nowDateTime = LocalDateTime.now();
 			startMonth = nowDateTime.getYear() + "-01";
 			endMonth = null;
 		}
@@ -67,8 +69,38 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			return result;
 		}
 
+		LocalDate startMonthDate = LocalDate.parse(startMonth + "-01", DateUtil.dateFormatter);
+
 		Map<IndexDataType, List<IndexBaseMonthData>> typeDateMap = indexBaseDatas.stream().collect(Collectors.groupingBy(IndexBaseMonthData::getDataType));
 		for (Map.Entry<IndexDataType, List<IndexBaseMonthData>> typeDateMapEntry : typeDateMap.entrySet()) {
+			Set<String> hasMonths = typeDateMapEntry.getValue().stream().map(d -> DateUtil.dateToString(d.getMonth(), "yyyy-MM-dd")).collect(Collectors.toSet());
+			LocalDate currentMonthDate = startMonthDate;
+			while (currentMonthDate.compareTo(nowDateTime)<=0){
+				if(hasMonths.contains(currentMonthDate.toString())){
+					currentMonthDate = currentMonthDate.plusMonths(1);
+					continue;
+				}
+				IndexBaseMonthData indexBaseMonthData = new IndexBaseMonthData();
+				indexBaseMonthData.setMonth(Date.from(currentMonthDate.atStartOfDay(DateUtil.zoneId).toInstant()));
+				indexBaseMonthData.setTotalNum(BigDecimal.ONE);
+				indexBaseMonthData.setActivateNum(BigDecimal.ZERO);
+				indexBaseMonthData.setPercent(BigDecimal.ZERO);
+				indexBaseMonthData.setDataType(typeDateMapEntry.getKey());
+				typeDateMapEntry.getValue().add(indexBaseMonthData);
+				currentMonthDate = currentMonthDate.plusMonths(1);
+			}
+			typeDateMapEntry.getValue().sort(Comparator.comparing(IndexBaseMonthData::getMonth));
+			if(IndexDataType.ACTIVATION_RATE.equals(typeDateMapEntry.getKey())||IndexDataType.HOMEWORK_CREATE_RATE.equals(typeDateMapEntry.getKey())
+					||IndexDataType.HOMEWORK_SUBMIT_RATE.equals(typeDateMapEntry.getKey())||IndexDataType.HOMEWORK_SUBMIT_RATE.equals(typeDateMapEntry.getKey())
+					||IndexDataType.STUDENT_CONVERSION.equals(typeDateMapEntry.getKey())){
+				for (IndexBaseMonthData indexBaseMonthData : typeDateMapEntry.getValue()) {
+					if(indexBaseMonthData.getTotalNum().compareTo(BigDecimal.ZERO)==0){
+						indexBaseMonthData.setPercent(BigDecimal.ZERO);
+						continue;
+					}
+					indexBaseMonthData.setPercent(indexBaseMonthData.getActivateNum().divide(indexBaseMonthData.getTotalNum(), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN));
+				}
+			}
 			IndexBaseDto indexBaseData = new IndexBaseDto(typeDateMapEntry.getKey(),typeDateMapEntry.getKey().getMsg());
 			indexBaseData.setIndexMonthData(typeDateMapEntry.getValue());
 			result.add(indexBaseData);
@@ -79,7 +111,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public Map<String, List<IndexBaseDto>> indexBaseDataTask(String startMonth, String endMonth) {
+	public Map<String, List<IndexBaseDto>> indexBaseDataTask(String month) {
 		Map<String, List<IndexBaseDto>> result = new HashMap<>();
 
 		DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM");
@@ -91,42 +123,44 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			this.organIds.get().addAll(allOrgans.stream().map(Organization::getId).collect(Collectors.toSet()));
 		}
 
-		startMonth = df.format(nowDate);
+		if(StringUtils.isBlank(month)){
+			month = df.format(nowDate);
+		}
 
 		//运营数据
-		saveData(indexBaseMonthDataDao.getSchoolData(), startMonth, IndexDataType.SCHOOL);
-		saveData(indexBaseMonthDataDao.getMusicData(), startMonth, IndexDataType.MUSIC_GROUP_NUM);
-		saveData(indexBaseMonthDataDao.getMusicStudentData(), startMonth, IndexDataType.MUSIC_GROUP_STUDENT);
-		saveData(indexBaseMonthDataDao.getOtherStudentData(), startMonth, IndexDataType.OTHER_STUDENT);
+		saveData(indexBaseMonthDataDao.getSchoolData(month), month, IndexDataType.SCHOOL);
+		saveData(indexBaseMonthDataDao.getMusicData(month), month, IndexDataType.MUSIC_GROUP_NUM);
+		saveData(indexBaseMonthDataDao.getMusicStudentData(month, null), month, IndexDataType.MUSIC_GROUP_STUDENT);
+		saveData(indexBaseMonthDataDao.getOtherStudentData(month), month, IndexDataType.OTHER_STUDENT);
 
 		//业务数据
-		saveData(indexBaseMonthDataDao.getStudentSignUpData(), startMonth, IndexDataType.ACTIVATION_RATE);
-		saveData(indexBaseMonthDataDao.getHomeworkData(null), startMonth, IndexDataType.HOMEWORK_CREATE_RATE);
-		saveData(indexBaseMonthDataDao.getHomeworkData("submit"), startMonth, IndexDataType.HOMEWORK_SUBMIT_RATE);
-		saveData(indexBaseMonthDataDao.getHomeworkData("comment"), startMonth, IndexDataType.HOMEWORK_COMMENT_RATE);
+		saveData(indexBaseMonthDataDao.getStudentSignUpData(month), month, IndexDataType.ACTIVATION_RATE);
+		saveData(indexBaseMonthDataDao.getHomeworkData(month, null), month, IndexDataType.HOMEWORK_CREATE_RATE);
+		saveData(indexBaseMonthDataDao.getHomeworkData(month, "submit"), month, IndexDataType.HOMEWORK_SUBMIT_RATE);
+		saveData(indexBaseMonthDataDao.getHomeworkData(month, "comment"), month, IndexDataType.HOMEWORK_COMMENT_RATE);
 
 		//经营数据
-		saveData(null, startMonth, IndexDataType.SHOULD_INCOME_MONEY);
-		saveData(null, startMonth, IndexDataType.ANTICIPATED_INCOME_MONEY);
-		saveData(null, startMonth, IndexDataType.SHOULD_EXPEND_MONEY);
-		saveData(null, startMonth, IndexDataType.ANTICIPATED_EXPEND_MONEY);
-		saveData(null, startMonth, IndexDataType.REVENUE_MONEY);
+		saveData(null, month, IndexDataType.SHOULD_INCOME_MONEY);
+		saveData(null, month, IndexDataType.ANTICIPATED_INCOME_MONEY);
+		saveData(null, month, IndexDataType.SHOULD_EXPEND_MONEY);
+		saveData(null, month, IndexDataType.ANTICIPATED_EXPEND_MONEY);
+		saveData(null, month, IndexDataType.REVENUE_MONEY);
 
 		//人事数据
-		saveData(indexBaseMonthDataDao.getTeacherData(null, null), startMonth, IndexDataType.TEACHER_NUM);
-		saveData(indexBaseMonthDataDao.getTeacherData(JobNatureEnum.FULL_TIME, null), startMonth, IndexDataType.FULL_TIME_NUM);
-		saveData(indexBaseMonthDataDao.getTeacherData(JobNatureEnum.PART_TIME, null), startMonth, IndexDataType.PART_TIME_NUM);
-		saveData(indexBaseMonthDataDao.getTeacherData(null, true), startMonth, IndexDataType.DIMISSION_NUM);
+		saveData(indexBaseMonthDataDao.getTeacherData(month, null, null), month, IndexDataType.TEACHER_NUM);
+		saveData(indexBaseMonthDataDao.getTeacherData(month, JobNatureEnum.FULL_TIME, null), month, IndexDataType.FULL_TIME_NUM);
+		saveData(indexBaseMonthDataDao.getTeacherData(month, JobNatureEnum.PART_TIME, null), month, IndexDataType.PART_TIME_NUM);
+		saveData(indexBaseMonthDataDao.getTeacherData(month, null, true), month, IndexDataType.DIMISSION_NUM);
 
 		//学员变动
-		saveData(null, startMonth, IndexDataType.NEWLY_STUDENT_NUM);
-		saveData(null, startMonth, IndexDataType.QUIT_MUSIC_GROUP_STUDENT_NUM);
-		saveData(null, startMonth, IndexDataType.STUDENT_CONVERSION);
+		saveData(indexBaseMonthDataDao.getMusicStudentData(month, "ALL"), month, IndexDataType.NEWLY_STUDENT_NUM);
+		saveData(indexBaseMonthDataDao.getMusicStudentData(month, "QUIT"), month, IndexDataType.QUIT_MUSIC_GROUP_STUDENT_NUM);
+		saveData(indexBaseMonthDataDao.getStudentConversionData(month), month, IndexDataType.STUDENT_CONVERSION);
 
 		//课程数据
-		saveData(indexBaseMonthDataDao.getGroupCourseData(GroupType.MUSIC), startMonth, IndexDataType.MUSIC_GROUP_COURSE);
-		saveData(indexBaseMonthDataDao.getGroupCourseData(GroupType.VIP), startMonth, IndexDataType.VIP_GROUP_COURSE);
-		saveData(indexBaseMonthDataDao.getGroupCourseData(GroupType.PRACTICE), startMonth, IndexDataType.PRACTICE_GROUP_COURSE);
+		saveData(indexBaseMonthDataDao.getGroupCourseData(month, GroupType.MUSIC), month, IndexDataType.MUSIC_GROUP_COURSE);
+		saveData(indexBaseMonthDataDao.getGroupCourseData(month, GroupType.VIP), month, IndexDataType.VIP_GROUP_COURSE);
+		saveData(indexBaseMonthDataDao.getGroupCourseData(month, GroupType.PRACTICE), month, IndexDataType.PRACTICE_GROUP_COURSE);
 
 		return result;
 	}

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

@@ -377,9 +377,6 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 	@Transactional(rollbackFor = Exception.class)
 	public void batchAdd(MusicGroupPaymentCalender musicGroupPaymentCalender,List<MusicGroupPaymentCalenderStudentDetail> musicGroupPaymentCalenderStudentDetails) {
 		Map<Integer, List<MusicGroupPaymentCalenderStudentDetail>> collect = musicGroupPaymentCalenderStudentDetails.stream().collect(Collectors.groupingBy(e -> e.getUserId()));
-		//生成music_group_payment_calender_detail
-//		List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetailList = new ArrayList<MusicGroupPaymentStudentCourseDetail>();
-//		MusicGroupPaymentStudentCourseDetail musicGroupPaymentStudentCourseDetail = null;
 		MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = null;
 		Long musicGroupPaymentCalenderId = musicGroupPaymentCalender.getId();
 		for (Integer studentId : collect.keySet()) {
@@ -401,22 +398,9 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 			musicGroupPaymentCalenderDetail.setDeadlinePaymentDate(musicGroupPaymentCalender.getDeadlinePaymentDate());
 			musicGroupPaymentCalenderDetail.setResponsibleUserId(musicGroupPaymentCalender.getOperator());
 			musicGroupPaymentCalenderDetailDao.insert(musicGroupPaymentCalenderDetail);
-//			Long musicGroupPaymentCalenderDetailId = musicGroupPaymentCalenderDetail.getId();
-//			for (MusicGroupPaymentCalenderStudentDetail calenderStudentDetail : calenderStudentDetails) {
-//				//创建学生课排课分钟数
-//				musicGroupPaymentStudentCourseDetail = new MusicGroupPaymentStudentCourseDetail();
-//				musicGroupPaymentStudentCourseDetail.setCourseType(CourseSchedule.CourseScheduleType.valueOf(calenderStudentDetail.getCourseType()));
-//				musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalenderId);
-//				musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderDetailId(musicGroupPaymentCalenderDetailId);
-//				musicGroupPaymentStudentCourseDetail.setTotalCourseMinutes(0);
-//				musicGroupPaymentStudentCourseDetail.setUsedCourseMinutes(calenderStudentDetail.getCourseTime().intValue());
-//				musicGroupPaymentStudentCourseDetail.setUserId(studentId);
-//				musicGroupPaymentStudentCourseDetailList.add(musicGroupPaymentStudentCourseDetail);
-//			}
 		}
 		musicGroupPaymentCalender.setExpectNum(collect.keySet().size());
 		musicGroupPaymentCalenderService.update(musicGroupPaymentCalender);
-//		musicGroupPaymentStudentCourseDetailDao.batchInsert(musicGroupPaymentStudentCourseDetailList);
 		//给学员推送缴费通知
 		if(musicGroupPaymentCalender.getStatus() == PaymentCalenderStatusEnum.OPEN){
 			musicGroupPaymentCalenderService.pushWaitRenewMessage(musicGroupPaymentCalenderId,musicGroupDao.get(musicGroupPaymentCalender.getMusicGroupId()),collect.keySet());

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

@@ -23,6 +23,7 @@ import java.util.stream.Collectors;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.util.collection.ListUtil;
 import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -560,6 +561,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 				List<MusicGroupPaymentCalenderStudentDetail> musicGroupPaymentCalenderStudentDetails = classGroupService.queryStudentPaymentCalenders(adjust.getMasterClassGroupId(),
 						adjust.getClassGroupStudents(),studentIds);
 				List<MusicGroupPaymentCalenderStudentDetail> calenderStudentDetails = musicGroupPaymentCalenderDto.getMusicGroupPaymentCalenderStudentDetails();
+
 				boolean containsAll = musicGroupPaymentCalenderStudentDetails.containsAll(calenderStudentDetails);
 				if(!containsAll){
 					status = AUDITING;
@@ -762,7 +764,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 				List<Long> courseIds = JSON.parseArray(adjust.getSubLockCourseIds(), Long.class);
 				List<Long> allLockCourseIds = JSON.parseArray(adjust.getAllLockCourseIds(), Long.class);
 				classGroupService.spanGroupClassAdjustPass(adjust.getMasterClassGroupId()
-						,studentIds,courseIds,classGroupStudents,allLockCourseIds,batchNo);
+						,studentIds,courseIds,classGroupStudents,allLockCourseIds,batchNo,adjust.getMasterTotalPrice());
 			}
 		}
 		return batchNo;
@@ -1076,8 +1078,10 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			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));
 			classGroupService.spanGroupClassAdjustPass(adjust.getMasterClassGroupId()
-					,studentIds,courseIds,classGroupStudents,allLockCourseIds,batchNo);
+					,studentIds,courseIds,classGroupStudents,allLockCourseIds,batchNo,adjust.getMasterTotalPrice());
 		}
 		musicGroupPaymentCalenderDao.batchUpdate(musicGroupPaymentCalenders);
 	}

+ 32 - 122
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -19,6 +19,8 @@ import java.util.Objects;
 import java.util.Set;
 import java.util.stream.Collectors;
 
+import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.*;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -32,39 +34,6 @@ import com.alibaba.fastjson.TypeReference;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.entity.SysUserRole;
-import com.ym.mec.biz.dal.dao.ChargeTypeDao;
-import com.ym.mec.biz.dal.dao.ClassGroupDao;
-import com.ym.mec.biz.dal.dao.ClassGroupStudentMapperDao;
-import com.ym.mec.biz.dal.dao.CooperationOrganDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleTeacherSalaryDao;
-import com.ym.mec.biz.dal.dao.EmployeeDao;
-import com.ym.mec.biz.dal.dao.MusicGroupBuildLogDao;
-import com.ym.mec.biz.dal.dao.MusicGroupDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentEntitiesDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentStudentCourseDetailDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPurchaseListDao;
-import com.ym.mec.biz.dal.dao.MusicGroupQuitDao;
-import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
-import com.ym.mec.biz.dal.dao.MusicGroupSubjectGoodsGroupDao;
-import com.ym.mec.biz.dal.dao.MusicGroupSubjectPlanDao;
-import com.ym.mec.biz.dal.dao.OrganizationDao;
-import com.ym.mec.biz.dal.dao.SchoolDao;
-import com.ym.mec.biz.dal.dao.SporadicChargeInfoDao;
-import com.ym.mec.biz.dal.dao.StudentDao;
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
-import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
-import com.ym.mec.biz.dal.dao.StudentVisitDao;
-import com.ym.mec.biz.dal.dao.SubjectChangeDao;
-import com.ym.mec.biz.dal.dao.SubjectDao;
-import com.ym.mec.biz.dal.dao.SysConfigDao;
-import com.ym.mec.biz.dal.dao.TeacherAttendanceDao;
-import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.dto.CloseMusicGroupDto;
 import com.ym.mec.biz.dal.dto.CourseFormDto;
@@ -76,35 +45,7 @@ import com.ym.mec.biz.dal.dto.SporadicPayDto;
 import com.ym.mec.biz.dal.dto.SubFeeSettingDto;
 import com.ym.mec.biz.dal.dto.SubjectRegisterDto;
 import com.ym.mec.biz.dal.dto.UpdateExpectedNumDto;
-import com.ym.mec.biz.dal.entity.ApprovalStatus;
-import com.ym.mec.biz.dal.entity.ChargeType;
-import com.ym.mec.biz.dal.entity.ClassGroup;
-import com.ym.mec.biz.dal.entity.CooperationOrgan;
-import com.ym.mec.biz.dal.entity.CourseSchedule;
-import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
-import com.ym.mec.biz.dal.entity.Goods;
-import com.ym.mec.biz.dal.entity.MusicGroup;
-import com.ym.mec.biz.dal.entity.MusicGroupBuildLog;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
-import com.ym.mec.biz.dal.entity.MusicGroupPurchaseList;
-import com.ym.mec.biz.dal.entity.MusicGroupQuit;
-import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
-import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
-import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
-import com.ym.mec.biz.dal.entity.Organization;
-import com.ym.mec.biz.dal.entity.School;
-import com.ym.mec.biz.dal.entity.SporadicChargeInfo;
-import com.ym.mec.biz.dal.entity.Student;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
-import com.ym.mec.biz.dal.entity.StudentRegistration;
-import com.ym.mec.biz.dal.entity.Subject;
-import com.ym.mec.biz.dal.entity.SubjectChange;
-import com.ym.mec.biz.dal.entity.SysUserCashAccount;
-import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
 import com.ym.mec.biz.dal.page.MusicGroupQueryInfo;
 import com.ym.mec.biz.service.ClassGroupService;
 import com.ym.mec.biz.service.ClassGroupStudentMapperService;
@@ -180,6 +121,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     private SysUserCashAccountDetailService sysUserCashAccountDetailService;
 
     @Autowired
+    private MusicGroupPaymentCalenderStudentDetailDao musicGroupPaymentCalenderStudentDetailDao;
+
+    @Autowired
     private MusicGroupQuitDao musicGroupQuitDao;
 
     @Autowired
@@ -2156,17 +2100,31 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             rechargeDetail.setPerAmount(studentPaymentOrder.getPerAmount());
             sysUserCashAccountDetailService.insert(rechargeDetail);
 
-            List<MusicGroupPaymentCalenderCourseSettings> courseSettings = musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettings(calenderDetail.getMusicGroupPaymentCalenderId());
             List<StudentPaymentOrderDetail> paymentOrderDetails = new ArrayList<>();
-            courseSettings.forEach(e -> {
-                StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
-                studentPaymentOrderDetail.setType(OrderDetailTypeEnum.valueOf(e.getCourseType().getCode()));
-                studentPaymentOrderDetail.setPrice(e.getCourseCurrentPrice());
-                studentPaymentOrderDetail.setCreateTime(date);
-                studentPaymentOrderDetail.setUpdateTime(date);
-                studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
-                paymentOrderDetails.add(studentPaymentOrderDetail);
-            });
+            List<MusicGroupPaymentCalenderCourseSettings> courseSettings = musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettings(calenderDetail.getMusicGroupPaymentCalenderId());
+            //跨团合班没有settings
+            if(courseSettings.size() == 0){
+                List<MusicGroupPaymentCalenderStudentDetail> studentDetails = musicGroupPaymentCalenderStudentDetailDao.findByBatchNoAndUserId(paymentCalender.getBatchNo(), userId);
+                for (MusicGroupPaymentCalenderStudentDetail studentDetail : studentDetails) {
+                    StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
+                    studentPaymentOrderDetail.setType(OrderDetailTypeEnum.valueOf(studentDetail.getCourseType()));
+                    studentPaymentOrderDetail.setPrice(studentDetail.getCourseCurrentPrice());
+                    studentPaymentOrderDetail.setCreateTime(date);
+                    studentPaymentOrderDetail.setUpdateTime(date);
+                    studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
+                    paymentOrderDetails.add(studentPaymentOrderDetail);
+                }
+            }else {
+                courseSettings.forEach(e -> {
+                    StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
+                    studentPaymentOrderDetail.setType(OrderDetailTypeEnum.valueOf(e.getCourseType().getCode()));
+                    studentPaymentOrderDetail.setPrice(e.getCourseCurrentPrice());
+                    studentPaymentOrderDetail.setCreateTime(date);
+                    studentPaymentOrderDetail.setUpdateTime(date);
+                    studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
+                    paymentOrderDetails.add(studentPaymentOrderDetail);
+                });
+            }
             studentPaymentOrderDetailService.batchAdd(paymentOrderDetails);
 
             //缴费
@@ -2369,9 +2327,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         quitUserIdList.add(oldDirectorUserId);
 
         Map<Integer,String> userRoleMap = new HashMap<Integer, String>();
-        userRoleMap.put(teamTeacherId, null);
-        userRoleMap.put(educationalTeacherId, null);
-        userRoleMap.put(directorUserId, null);
+        userRoleMap.put(directorUserId, "乐队指导");
+        userRoleMap.put(educationalTeacherId, "运营主管");
+        userRoleMap.put(teamTeacherId, "教务老师");
         
         classGroups.forEach(e -> {
         	imGroupMemberService.quit(e.getId().longValue(), quitUserIdList);
@@ -2404,7 +2362,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             courseScheduleDao.updateCourseScheduleSchool("MUSIC", musicGroupId, musicGroup.getSchoolId());
         }
         updateTeamTeacher(group, musicGroup);
-//        List<Integer> months = subFeeSettingDto.getMonths();
 
         Date date = new Date();
         //缴费方式不同
@@ -2422,55 +2379,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                 musicGroupPaymentCalenderCourseSettingsDao.deleteByMusicGroupPaymentCalenderId(calenderIds);
             }
         }
-
-        //判断缴费日历是否修改
-        /*boolean isModifiedOfCalender = false;
-
-        List<MusicGroupPaymentCalender> calenderList = musicGroupPaymentCalenderDao.findByMusicGroupId(musicGroupId);
-        if (months.size() == calenderList.size()) {
-            for (MusicGroupPaymentCalender cal : calenderList) {
-                if (!months.contains(cal.getPaymentMonth())) {
-                    isModifiedOfCalender = true;
-                    break;
-                }
-            }
-        } else {
-            isModifiedOfCalender = true;
-        }
-
-        if (isModifiedOfCalender) {
-            Integer num = musicGroupStudentFeeDao.countStudentNoPayNum(musicGroupId);
-            if (num > 0) {
-                throw new BizException("缴费周期更新失败,当前乐团有未缴费的学员");
-            }
-
-            // 删除乐团相关付费周期
-            musicGroupPaymentCalenderDao.delByGroupId(musicGroupId);
-            if (months != null && months.size() > 0) {
-                // 批量插入
-                musicGroupPaymentCalenderDao.batchAdd(months, musicGroupId);
-            }
-        }
-        if (musicGroup.getStatus() == MusicGroupStatusEnum.PROGRESS) {
-            //修改未锁定学员缴费周期
-            String join = null;
-            if (months != null && months.size() > 0) {
-                join = StringUtils.join(months, ",");
-            }
-            musicGroupStudentFeeDao.batchUpdateCalender(join, musicGroupId);
-            List<MusicGroupStudentFee> fees = musicGroupStudentFeeDao.queryByMusicGroupId(musicGroupId);
-            fees.forEach(e -> {
-                e.setNextPaymentDate(musicGroupPaymentCalenderService.getNextPaymentDate(musicGroupId, null, e));
-                e.setUpdateTime(date);
-            });
-            musicGroupStudentFeeDao.batchUpdate(fees);
-        }*/
         musicGroup.setUpdateTime(date);
         musicGroupDao.update(musicGroup);
-        //修改课程里面的教学点
-//        if (!musicGroup.getSchoolId().equals(musicGroup.getSchoolId())) {
-//            courseScheduleDao.updateByMusicGroupId(musicGroupId, musicGroup.getSchoolId());
-//        }
         // 删除乐团付费主体列表
         musicGroupPaymentEntitiesDao.delByGroupId(musicGroupId);
         //批量新增

+ 4 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentRouteOrderServiceImpl.java

@@ -377,10 +377,10 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
             if (collect == null || collect.size() == 0) {
                 continue;
             }
-            List<String> list = studentPaymentRouteOrderDao.countByTransNo(collect);
-            if (list != null && list.size() > 0) {
-                throw new BizException("导入数据错误  重复的交易流水号:{}", list.get(0));
-            }
+//            List<String> list = studentPaymentRouteOrderDao.countByTransNo(collect);
+//            if (list != null && list.size() > 0) {
+//                throw new BizException("导入数据错误  重复的交易流水号:{}", list.get(0));
+//            }
             Date nowDate = new Date();
 
             List<Object> calenderIds = sheet.stream().map(m -> m.get("缴费单号")).collect(Collectors.toList());

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -785,7 +785,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         List<StudentCourseFeeDetail> studentCourseFeeDetails = new ArrayList<>();
         BigDecimal amount = BigDecimal.ZERO;
         for (StudentRegistration studentRegistration : studentRegistrations) {
-            BigDecimal masterTotalPrice = collect.get(studentRegistration.getUserId()).stream().map(e->e.getCutAmount()).reduce(BigDecimal.ZERO, BigDecimal::add);
+            List<MusicGroupPaymentCalenderStudentDetail> details = collect.get(studentRegistration.getUserId());
+            BigDecimal masterTotalPrice = details.stream().map(e->e.getCutAmount()).reduce(BigDecimal.ZERO, BigDecimal::add);
             if(masterTotalPrice.doubleValue() > studentRegistration.getSurplusCourseFee().doubleValue()){
                 throw new BizException("用户信息发生变动,请重新提交");
             }

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

@@ -988,7 +988,7 @@
 
     <select id="findClassGroups" resultMap="ClassGroup">
         SELECT * FROM class_group WHERE music_group_id_=#{musicGroupId}
-        AND del_flag_='0' AND group_type_ NOT IN ('PRACTICE','VIP','HIGH')
+        AND del_flag_='0' AND group_type_ = 'MUSIC'
     </select>
 
     <!-- 根据合奏班id获取子班及老师 -->

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

@@ -3509,6 +3509,6 @@
         WHERE cs.class_group_id_ = #{classGroupId} AND CONCAT(cs.class_date_,' ',cs.start_class_time_) > NOW()
     </select>
     <select id="getUnderwayCourseNum" resultType="int">
-        SELECT * FROM course_schedule WHERE music_group_id_ = #{musicGroupId} AND group_type_ = #{groupType} AND status_=#{status}
+        SELECT COUNT(*) FROM course_schedule WHERE music_group_id_ = #{musicGroupId} AND group_type_ = #{groupType} AND status_=#{status}
     </select>
 </mapper>

+ 19 - 39
mec-biz/src/main/resources/config/mybatis/ImGroupMemberMapper.xml

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!--
-这个文件是自动生成的
-不要修改此文件。所有改动将在下次重新自动生成时丢失。
+这个文件是自动生成的.
+不要修改此文件.所有改动将在下次重新自动生成时丢失.
 -->
 <mapper namespace="com.ym.mec.biz.dal.dao.ImGroupMemberDao">
 	
@@ -12,7 +12,7 @@
 		<result column="user_id_" property="userId" />
 		<result column="nickname_" property="nickname" />
 		<result column="is_admin_" property="isAdmin" />
-		<result column="role_type_" property="roleType" />
+		<result column="role_type_" property="roleType"/>
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
 	</resultMap>
@@ -29,18 +29,14 @@
 	
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ImGroupMember" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		<!--
-		<selectKey resultClass="int" keyProperty="id" > 
-		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
-		</selectKey>
-		-->
-		INSERT INTO im_group_member (id_,im_group_id_,user_id_,nickname_,is_admin_,role_type_,create_time_,update_time_) VALUES(#{id},#{imGroupId},#{userId},#{nickname},#{isAdmin},#{roleType},#{createTime},#{updateTime})
+		INSERT INTO im_group_member (im_group_id_,user_id_,nickname_,is_admin_,role_type_,create_time_,update_time_) 
+		VALUES(#{imGroupId},#{userId},#{nickname},#{isAdmin},#{roleType},NOW(),NOW())
 	</insert>
 	
 	<insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.ImGroupMember" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		INSERT INTO im_group_member (id_,im_group_id_,user_id_,nickname_,is_admin_,role_type_,create_time_,update_time_) VALUES
+		INSERT INTO im_group_member (im_group_id_,user_id_,nickname_,is_admin_,role_type_,create_time_,update_time_) VALUES
 		 <foreach collection="list" item="item" separator=",">
-		(#{item.id},#{item.imGroupId},#{item.userId},#{item.nickname},#{item.isAdmin},#{item.roleType},#{item.createTime},#{item.updateTime})
+		(#{item.imGroupId},#{item.userId},#{item.nickname},#{item.isAdmin},#{item.roleType},NOW(),NOW())
 		</foreach>
 	</insert>
 	
@@ -56,21 +52,13 @@
 		<if test="nickname != null">
 		nickname_ = #{nickname},
 		</if>
-		<if test="id != null">
-		id_ = #{id},
-		</if>
 		<if test="isAdmin != null">
 		is_admin_ = #{isAdmin},
 		</if>
 		<if test="imGroupId != null">
 		im_group_id_ = #{imGroupId},
 		</if>
-		<if test="updateTime != null">
-		update_time_ = #{updateTime},
-		</if>
-		<if test="createTime != null">
-		create_time_ = #{createTime},
-		</if>
+		update_time_ = NOW()
 		</set> WHERE id_ = #{id} 
 	</update>
 	
@@ -78,32 +66,24 @@
 		<foreach collection="list" item="item" index="index" open="" close="" separator=";">
 			UPDATE im_group_member 
 			<set>
-				<if test="itemroleType != null">
-				role_type_ = #{itemroleType},
+				<if test="item.roleType != null">
+				role_type_ = #{item.roleType},
 				</if>
-				<if test="itemuserId != null">
-				user_id_ = #{itemuserId},
+				<if test="item.userId != null">
+				user_id_ = #{item.userId},
 				</if>
 				<if test="item.nickname != null">
 				nickname_ = #{item.nickname},
 				</if>
-				<if test="item。id != null">
-				id_ = #{item。id},
-				</if>
-				<if test="item。isAdmin != null">
-				is_admin_ = #{item。isAdmin},
-				</if>
-				<if test="item。imGroupId != null">
-				im_group_id_ = #{item。imGroupId},
-				</if>
-				<if test="item。updateTime != null">
-				update_time_ = #{item。updateTime},
+				<if test="item.isAdmin != null">
+				is_admin_ = #{item.isAdmin},
 				</if>
-				<if test="item。createTime != null">
-				create_time_ = #{item。createTime},
+				<if test="item.imGroupId != null">
+				im_group_id_ = #{item.imGroupId},
 				</if>
-			</set> 
-			WHERE id_ = #{item。id}
+				update_time_ = NOW()
+			</set>
+			WHERE id_ = #{item.id}
 		</foreach> 
 	</update>
 	

+ 59 - 13
mec-biz/src/main/resources/config/mybatis/IndexBaseMonthDataMapper.xml

@@ -112,7 +112,8 @@
 	</select>
 
     <select id="getIndexBaseData" resultMap="IndexBaseMonthData">
-		SELECT *
+		SELECT
+			month_,data_type_,SUM(total_num_) total_num_,SUM(activate_num_) activate_num_,SUM(percent_) percent_
 		FROM index_base_month_data
 		<where>
 			<if test="dataTypes!=null and dataTypes.size()>0">
@@ -134,6 +135,7 @@
 				AND DATE_FORMAT(month_, '%Y-%m')&lt;=#{endMonth}
 			</if>
 		</where>
+		GROUP BY month_,data_type_
 	</select>
 
 	<select id="getStudentSignUpData" resultMap="IndexBaseMonthData">
@@ -186,7 +188,7 @@
 	<select id="getSchoolData" resultMap="IndexBaseMonthData">
 		SELECT
 			organ_id_,
-			CONCAT(DATE_FORMAT(NOW(), '%Y-%m'), '-01') month_,
+			CONCAT(#{month}, '-01') month_,
 			COUNT( id_ ) total_num_,
 			COUNT( id_ ) activate_num_,
 			COUNT( id_ ) percent_
@@ -195,6 +197,9 @@
 		WHERE
 			del_flag_ = 0
 		  	AND organ_id_ IS NOT NULL
+		  	<if test="month!=null and month!=''">
+				AND DATE_FORMAT(create_time_, '%Y-%m') &lt;= #{month}
+			</if>
 		GROUP BY
 			organ_id_
 		ORDER BY
@@ -203,7 +208,7 @@
 	<select id="getMusicData" resultMap="IndexBaseMonthData">
 		SELECT
 			organ_id_,
-			CONCAT(DATE_FORMAT(NOW(), '%Y-%m'), '-01') month_,
+			CONCAT(#{month}, '-01') month_,
 			COUNT( id_ ) total_num_,
 			COUNT( id_ ) activate_num_,
 			COUNT( id_ ) percent_
@@ -213,6 +218,9 @@
 			del_flag_ = 0
 			AND status_ = 'PROGRESS'
 			AND organ_id_ IS NOT NULL
+			<if test="month!=null and month!=''">
+				AND DATE_FORMAT(create_time_, '%Y-%m') &lt;= #{month}
+			</if>
 		GROUP BY
 			organ_id_
 		ORDER BY
@@ -221,7 +229,7 @@
 	<select id="getMusicStudentData" resultMap="IndexBaseMonthData">
 		SELECT
 			mg.organ_id_,
-			CONCAT(DATE_FORMAT(NOW(), '%Y-%m'), '-01') month_,
+			CONCAT(#{month}, '-01') month_,
 			COUNT( DISTINCT sr.user_id_ ) total_num_,
 			COUNT( DISTINCT sr.user_id_ ) activate_num_,
 			COUNT( DISTINCT sr.user_id_ ) percent_
@@ -229,9 +237,17 @@
 			LEFT JOIN music_group mg ON sr.music_group_id_=mg.id_
 		WHERE
 			mg.del_flag_ = 0
-			AND mg.status_ = 'PROGRESS'
-			AND mg.organ_id_ IS NOT NULL
-			AND sr.music_group_status_='NORMAL'
+		  	AND mg.organ_id_ IS NOT NULL
+			<if test="type==null">
+				AND mg.status_ = 'PROGRESS'
+				AND sr.music_group_status_='NORMAL'
+			</if>
+			<if test="type!=null and type=='QUIT'">
+				AND sr.music_group_status_='QUIT'
+			</if>
+			<if test="month!=null and month!=''">
+				AND DATE_FORMAT(sr.create_time_, '%Y-%m') &lt;= #{month}
+			</if>
 		GROUP BY
 			mg.organ_id_
 		ORDER BY
@@ -241,7 +257,7 @@
 	<select id="getTeacherData" resultMap="IndexBaseMonthData">
 		SELECT
 			t.organ_id_,
-			CONCAT(DATE_FORMAT(NOW(), '%Y-%m'), '-01') month_,
+			CONCAT(#{month}, '-01') month_,
 			COUNT( t.id_ ) total_num_,
 			COUNT( t.id_ ) activate_num_,
 			COUNT( t.id_ ) percent_
@@ -269,7 +285,7 @@
 	<select id="getGroupCourseData" resultMap="IndexBaseMonthData">
 		SELECT
 			m.organ_id_,
-			CONCAT(DATE_FORMAT(NOW(), '%Y-%m'), '-01') month_,
+			CONCAT(#{month}, '-01') month_,
 			COUNT( m.id_ ) total_num_,
 			COUNT( m.id_ ) activate_num_,
 			COUNT( m.id_ ) percent_
@@ -282,6 +298,9 @@
 			<if test="groupType!=null">
 				AND m.group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 			</if>
+			<if test="month!=null and month!=''">
+				AND (DATE_FORMAT(m.create_time_, '%Y-%m') &lt;= #{month} OR YEAR(m.create_time_)=3000)
+			</if>
 		GROUP BY
 			m.organ_id_
 		ORDER BY
@@ -291,7 +310,7 @@
 	<select id="getOtherStudentData" resultMap="IndexBaseMonthData">
 		SELECT
 			m.organ_id_,
-			CONCAT(DATE_FORMAT(NOW(), '%Y-%m'), '-01') month_,
+			CONCAT(#{month}, '-01') month_,
 			COUNT( DISTINCT s.user_id_ ) total_num_,
 			COUNT( DISTINCT s.user_id_ ) activate_num_,
 			COUNT( DISTINCT s.user_id_ ) percent_
@@ -300,12 +319,39 @@
 				LEFT JOIN course_schedule m ON s.course_schedule_id_=m.id_
 		WHERE
 			m.del_flag_ = 0
-		  AND m.is_lock_ = 0
-		  AND m.organ_id_ IS NOT NULL
-		  AND m.group_type_ IN ('VIP', 'PRACTICE')
+			AND m.is_lock_ = 0
+			AND m.organ_id_ IS NOT NULL
+			AND m.group_type_ IN ('VIP', 'PRACTICE')
+			<if test="month!=null and month!=''">
+				AND (DATE_FORMAT(m.create_time_, '%Y-%m') &lt;= #{month} OR YEAR(m.create_time_)=3000)
+			</if>
 		GROUP BY
 			m.organ_id_
 		ORDER BY
 			m.organ_id_;
 	</select>
+
+	<select id="getStudentConversionData" resultMap="IndexBaseMonthData">
+		SELECT
+			mg.organ_id_,
+			CONCAT( DATE_FORMAT( NOW(), '%Y-%m' ), '-01' ) month_,
+			COUNT( DISTINCT sr.user_id_ ) total_num_,
+			COUNT( DISTINCT IF((cssp.group_type_='PRACTICE' AND pg.type_='CHARGE') OR cssp.group_type_='VIP', cssp.user_id_, NULL) ) activate_num_,
+			TRUNCATE(COUNT( DISTINCT IF((cssp.group_type_='PRACTICE' AND pg.type_='CHARGE') OR cssp.group_type_='VIP', cssp.user_id_, NULL) )/COUNT( DISTINCT sr.user_id_ )*100, 2) percent_
+		FROM
+			student_registration sr
+				LEFT JOIN music_group mg ON sr.music_group_id_ = mg.id_
+				LEFT JOIN course_schedule_student_payment cssp ON sr.user_id_=cssp.user_id_
+				LEFT JOIN practice_group pg ON cssp.music_group_id_=pg.id_
+		WHERE
+			mg.del_flag_ = 0
+			AND mg.organ_id_ IS NOT NULL
+			<if test="month!=null and month!=''">
+				AND DATE_FORMAT(sr.create_time_, '%Y-%m') &lt;= #{month}
+			</if>
+		GROUP BY
+			mg.organ_id_
+		ORDER BY
+			mg.organ_id_;
+	</select>
 </mapper>

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

@@ -55,7 +55,7 @@
 		(id_,music_group_payment_calender_id_,user_id_,expect_amount_,actual_amount_,payment_status_,
 		user_status_,pay_time_,update_time_,create_time_,start_payment_date_,deadline_payment_date_,payment_order_id_,use_in_course_,responsible_user_id_,responsible_record_)
 		VALUES(#{id},#{musicGroupPaymentCalenderId},#{userId},#{expectAmount},#{actualAmount},#{paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-		#{userStatus},#{payTime},#{updateTime},#{createTime},#{startPaymentDate},#{deadlinePaymentDate},#{paymentOrderId},#{useInCourse},#{responsibleUserId},#{responsibleRecord})
+		#{userStatus},#{payTime},NOW(),NOW(),#{startPaymentDate},#{deadlinePaymentDate},#{paymentOrderId},#{useInCourse},#{responsibleUserId},#{responsibleRecord})
 	</insert>
 
     <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id"

+ 4 - 1
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderStudentDetailMapper.xml

@@ -116,8 +116,11 @@
 	<select id="findByBatchNo" resultMap="MusicGroupPaymentCalenderStudentDetail">
 		SELECT * FROM music_group_payment_calender_student_detail where batch_no_ = #{batchNo}
 	</select>
+    <select id="findByBatchNoAndUserId" resultMap="MusicGroupPaymentCalenderStudentDetail">
+		SELECT * FROM music_group_payment_calender_student_detail where batch_no_ = #{batchNo} AND user_id_ = #{userId}
+	</select>
 
-	<delete id="delByBatchNo">
+    <delete id="delByBatchNo">
 		DELETE FROM music_group_payment_calender_student_detail WHERE batch_no_ = #{batchNo}
 	</delete>
 </mapper>

+ 6 - 2
mec-biz/src/main/resources/config/mybatis/MusicGroupStudentClassAdjustMapper.xml

@@ -15,6 +15,7 @@
 		<result column="student_ids_" property="studentIds" />
 		<result column="class_course_minute_" property="classCourseMinute" />
 		<result column="master_class_course_times_" property="masterClassCourseTimes" />
+		<result column="master_total_price_" property="masterTotalPrice" />
 		<result column="default_course_type_minute_" property="defaultCourseTypeMinute" />
 		<result column="all_lock_course_ids_" property="allLockCourseIds" />
 		<result column="sub_lock_course_ids_" property="subLockCourseIds" />
@@ -40,15 +41,18 @@
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupStudentClassAdjust" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO music_group_student_class_adjust (music_group_id_,batch_no_,new_class_group_json_,
 		class_group_ids_,student_ids_,class_course_minute_,all_lock_course_ids_,sub_lock_course_ids_,
-		operator_id_,student_payment_ids_,class_group_students_,default_course_type_minute_,master_class_group_id_,master_class_course_times_,create_time_,update_time_)
+		operator_id_,student_payment_ids_,class_group_students_,default_course_type_minute_,master_class_group_id_,master_class_course_times_,master_total_price_,create_time_,update_time_)
 		VALUES(#{musicGroupId},#{batchNo},#{newClassGroupJson},#{classGroupIds},#{studentIds},
 		#{classCourseMinute},#{allLockCourseIds},#{subLockCourseIds},#{operatorId},#{studentPaymentIds},#{classGroupStudents},
-			   #{defaultCourseTypeMinute},#{masterClassGroupId},#{masterClassCourseTimes},NOW(),NOW())
+			   #{defaultCourseTypeMinute},#{masterClassGroupId},#{masterClassCourseTimes},#{masterTotalPrice},NOW(),NOW())
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
 	<update id="update" parameterType="com.ym.mec.biz.dal.entity.MusicGroupStudentClassAdjust">
 		UPDATE music_group_student_class_adjust <set>
+		<if test="masterTotalPrice != null">
+			master_total_price_ = #{masterTotalPrice},
+		</if>
 		<if test="masterClassCourseTimes != null">
 			master_class_course_times_ = #{masterClassCourseTimes},
 		</if>

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

@@ -498,7 +498,7 @@
             LEFT JOIN course_schedule cs ON cssp.course_schedule_id_=cs.id_
             LEFT JOIN student stu ON cssp.user_id_ = stu.user_id_
         WHERE stu.service_tag_=1
-            AND stu.service_tag_update_time_&lt;#{nextMonday}
+            AND (stu.service_tag_update_time_ IS NULL OR stu.service_tag_update_time_&lt;#{nextMonday})
             AND cs.class_date_&gt;=#{monday}
             AND cs.type_ IN ('SINGLE','VIP','MIX','PRACTICE')
             AND cssp.create_time_&lt;#{nextMonday}

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

@@ -5,6 +5,7 @@ import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.MusicGroupDao;
 import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
 import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderStudentDetailDao;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
@@ -45,6 +46,8 @@ public class MusicGroupPaymentCalenderController extends BaseController {
     @Autowired
     private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
     @Autowired
+    private MusicGroupPaymentCalenderStudentDetailDao musicGroupPaymentCalenderStudentDetailDao;
+    @Autowired
     private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
 
 
@@ -75,6 +78,10 @@ public class MusicGroupPaymentCalenderController extends BaseController {
             }
             List<MusicGroupPaymentCalenderCourseSettings> calenderCourseSettings = musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettings(calenderId);
             ModelMap model = new ModelMap();
+            musicGroupPaymentCalenderStudentDetailDao.findByBatchNoAndUserId(calender.getBatchNo(),userId);
+            if(calenderCourseSettings.size() == 0){
+                model.put("musicGroupPaymentCalenderStudentDetails",musicGroupPaymentCalenderStudentDetailDao.findByBatchNoAndUserId(calender.getBatchNo(),userId));
+            }
             model.put("musicGroup",musicGroupDao.get(musicGroupId));
             model.put("amount", calenderDetail.getExpectAmount());
             model.put("calenderCourseSettings", calenderCourseSettings);

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/controller/CourseScheduleController.java

@@ -195,7 +195,7 @@ public class CourseScheduleController extends BaseController {
         if(Objects.isNull(oldCourseSchedule)){
             return failed("未找到指定课程");
         }
-        if(Objects.nonNull(oldCourseSchedule.getNewCourseId())){
+        if(Objects.nonNull(oldCourseSchedule.getNewCourseId())&&!oldCourseSchedule.getNewCourseId().equals(oldCourseSchedule.getId())){
             return failed("被合并课程禁止调整");
         }
         if(GroupType.VIP.equals(oldCourseSchedule.getGroupType())){

+ 2 - 2
mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

@@ -321,7 +321,7 @@ public class TaskController extends BaseController {
 	}
 
 	@GetMapping("/countIndexBaseData")
-	public void countIndexBaseData(String startMonth, String endMonth){
-		indexBaseMonthDataService.indexBaseDataTask(startMonth, endMonth);
+	public void countIndexBaseData(String month){
+		indexBaseMonthDataService.indexBaseDataTask(month);
 	}
 }