Browse Source

Merge remote-tracking branch 'origin/master'

周箭河 4 years ago
parent
commit
3625b7ca3b
26 changed files with 471 additions and 128 deletions
  1. 1 1
      .gitignore
  2. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java
  3. 14 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ImUserFriendDao.java
  4. 39 4
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/IndexBaseMonthDataDao.java
  5. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TeacherDao.java
  6. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/IndexDataType.java
  7. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/event/listener/CourseEventListener.java
  8. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleStudentPaymentService.java
  9. 14 0
      mec-biz/src/main/java/com/ym/mec/biz/service/TeacherService.java
  10. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java
  11. 4 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java
  12. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleStudentPaymentServiceImpl.java
  13. 38 56
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java
  14. 90 7
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  15. 21 21
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  16. 75 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherServiceImpl.java
  17. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java
  18. 6 0
      mec-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml
  19. 2 1
      mec-biz/src/main/resources/config/mybatis/ImGroupMapper.xml
  20. 2 2
      mec-biz/src/main/resources/config/mybatis/ImGroupMemberMapper.xml
  21. 15 9
      mec-biz/src/main/resources/config/mybatis/ImUserFriendMapper.xml
  22. 117 11
      mec-biz/src/main/resources/config/mybatis/IndexBaseMonthDataMapper.xml
  23. 1 0
      mec-biz/src/main/resources/config/mybatis/StudentMapper.xml
  24. 1 10
      mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml
  25. 3 0
      mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml
  26. 12 0
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherController.java

+ 1 - 1
.gitignore

@@ -7,6 +7,6 @@ target
 /p2p-biz/test-output
 bin
 /manage-center/src/main/resources/config/properties/generatorConfig.xml
-/p2p-utils/.gitignore
+.gitignore
 .idea
 *.iml

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java

@@ -400,7 +400,7 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
      * @date 2020/12/2 0002
      * @return java.util.List<com.ym.mec.biz.dal.entity.CourseScheduleStudentPaymentDto>
      */
-    List<CourseScheduleStudentPaymentDto> findNeedUpdateActualPriceStudentCourses();
+    List<CourseScheduleStudentPaymentDto> findNeedUpdateActualPriceStudentCourses(@Param("courseIds") List<Long> courseIds);
 
     /**
      * 根据课程编号和,学员编号获取列表信息

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ImUserFriendDao.java

@@ -2,6 +2,7 @@ package com.ym.mec.biz.dal.dao;
 
 import java.util.List;
 
+import com.ym.mec.biz.dal.dto.BasicUserDto;
 import org.apache.ibatis.annotations.Param;
 
 import com.ym.mec.biz.dal.dto.ImUserFriendDto;
@@ -21,4 +22,17 @@ public interface ImUserFriendDao extends BaseDAO<Long, ImUserFriend> {
 	List<ImUserFriendDto> queryFriendListByUserId(@Param("userId") Integer userId, @Param("search") String search);
 
 	ImUserFriendDto queryFriendDetail(@Param("userId") Integer userId, @Param("friendUserId") Integer friendUserId);
+
+	/**
+	 * 清除通讯录
+	 * @param teacherId
+	 */
+    void deleteByUserId(Integer teacherId);
+
+	/**
+	 * 批量新增
+	 * @param teachers
+	 * @param teacherId
+	 */
+	void batchInsert(@Param("teachers") List<BasicUserDto> teachers, @Param("teacherId") Integer teacherId);
 }

+ 39 - 4
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/IndexBaseMonthDataDao.java

@@ -1,7 +1,9 @@
 package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.entity.IndexBaseMonthData;
+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.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
 import org.apache.poi.ss.formula.functions.Index;
@@ -39,19 +41,52 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
      * @describe 统计系统中指定时间段的学员注册数据
      * @author Joburgess
      * @date 2021/1/7 0007
-     * @param startMonth:
+     * @param month:
      * @return java.util.List<com.ym.mec.biz.dal.dto.IndexBaseMonthDto>
      */
-    List<IndexBaseMonthData> getStudentSignUpData(@Param("startMonth") String startMonth);
+    List<IndexBaseMonthData> getStudentSignUpData(@Param("month") String month);
 
     /**
      * @describe 统计作业布置数据
      * @author Joburgess
      * @date 2021/1/7 0007
-     * @param startMonth:
+     * @param month:
      * @return java.util.List<com.ym.mec.biz.dal.dto.IndexBaseMonthDto>
      */
-    List<IndexBaseMonthData> getHomeworkDate(@Param("startMonth") String startMonth,
+    List<IndexBaseMonthData> getHomeworkData(@Param("month") String month,
                                              @Param("type") String type);
 
+    /**
+     * @describe 统计合作单位数据
+     * @author Joburgess
+     * @date 2021/1/11 0011
+     * @param month:
+     * @return java.util.List<com.ym.mec.biz.dal.entity.IndexBaseMonthData>
+     */
+    List<IndexBaseMonthData> getSchoolData(@Param("month") String month);
+
+    /**
+     * @describe 统计乐团数据
+     * @author Joburgess
+     * @date 2021/1/11 0011
+     * @param month:
+     * @return java.util.List<com.ym.mec.biz.dal.entity.IndexBaseMonthData>
+     */
+    List<IndexBaseMonthData> getMusicData(@Param("month") String month);
+
+    /**
+     * @describe 统计乐团学员数据
+     * @author Joburgess
+     * @date 2021/1/11 0011
+     * @param month:
+     * @return java.util.List<com.ym.mec.biz.dal.entity.IndexBaseMonthData>
+     */
+    List<IndexBaseMonthData> getMusicStudentData(@Param("month") String month);
+
+    List<IndexBaseMonthData> getTeacherData(@Param("month") String month,
+                                            @Param("jobNature") JobNatureEnum jobNature,
+                                            @Param("isDemission") Boolean isDemission);
+
+    List<IndexBaseMonthData> getGroupCourseData(@Param("month") String month,
+                                                @Param("groupType")GroupType groupType);
 }

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TeacherDao.java

@@ -490,4 +490,6 @@ public interface TeacherDao extends BaseDAO<Integer, Teacher> {
      * @return
      */
     String queryTeacherNameByTeacherIds(@Param("teachingTeacherIds") String teachingTeacherIds);
+
+    List<Integer> queryAllIds();
 }

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/IndexDataType.java

@@ -11,22 +11,27 @@ public enum IndexDataType implements BaseEnum<String, IndexDataType> {
     MUSIC_GROUP_NUM("MUSIC_GROUP_NUM","乐团数量"),
     MUSIC_GROUP_STUDENT("MUSIC_GROUP_STUDENT","乐团学员"),
     OTHER_STUDENT("OTHER_STUDENT","其他学员"),
+
     ACTIVATION_RATE("ACTIVATION_RATE","激活率"),
     HOMEWORK_CREATE_RATE("HOMEWORK_CREATE_RATE","作业布置率"),
     HOMEWORK_SUBMIT_RATE("HOMEWORK_SUBMIT_RATE","作业提交率"),
     HOMEWORK_COMMENT_RATE("HOMEWORK_COMMENT_RATE","作业点评率"),
+
     SHOULD_INCOME_MONEY("SHOULD_INCOME_MONEY","应收金额"),
     ANTICIPATED_INCOME_MONEY("ANTICIPATED_INCOME_MONEY","预收金额"),
     SHOULD_EXPEND_MONEY("SHOULD_EXPEND_MONEY","预付金额"),
     ANTICIPATED_EXPEND_MONEY("ANTICIPATED_EXPEND_MONEY","应付金额"),
     REVENUE_MONEY("REVENUE_MONEY","营收金额"),
+
     TEACHER_NUM("TEACHER_NUM","老师总数"),
     FULL_TIME_NUM("FULL_TIME_NUM","全职人数"),
     PART_TIME_NUM("PART_TIME_NUM","兼职人数"),
     DIMISSION_NUM("DIMISSION_NUM","离职人数"),
+
     NEWLY_STUDENT_NUM("NEWLY_STUDENT_NUM","新增学员"),
     QUIT_MUSIC_GROUP_STUDENT_NUM("QUIT_MUSIC_GROUP_STUDENT_NUM","退团学员"),
     STUDENT_CONVERSION("STUDENT_CONVERSION","学员转化"),
+
     MUSIC_GROUP_COURSE("MUSIC_GROUP_COURSE","乐团课"),
     VIP_GROUP_COURSE("VIP_GROUP_COURSE","VIP课"),
     PRACTICE_GROUP_COURSE("PRACTICE_GROUP_COURSE","网管课");

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/event/listener/CourseEventListener.java

@@ -56,7 +56,7 @@ public class CourseEventListener {
         logger.info("课程状态变更(执行开始):{}", courseStatusChangeEvent.getCourseIds());
 
         try{
-            courseScheduleStudentPaymentService.updateCourseActualPrice();
+            courseScheduleStudentPaymentService.updateCourseActualPrice(new ArrayList<>(courseStatusChangeEvent.getCourseIds()));
         } finally {
             redisCache.delete(KEY);
         }

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

@@ -125,6 +125,6 @@ public interface CourseScheduleStudentPaymentService extends BaseService<Long, C
 	 * @date 2020/12/2 0002
 	 * @return void
 	 */
-	void updateCourseActualPrice();
+	void updateCourseActualPrice(List<Long> courseIds);
 
 }

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/TeacherService.java

@@ -73,6 +73,14 @@ public interface TeacherService extends BaseService<Integer, Teacher> {
     List<BasicUserDto> queryGroupStudents(Integer id, String search);
 
     /**
+     * 获取教师通讯录
+     * @param id
+     * @param search
+     * @return
+     */
+    void queryGroupStudents1(Integer id, String search);
+
+    /**
      * 获取教师通讯录学员列表
      * @param id
      * @param search
@@ -194,4 +202,10 @@ public interface TeacherService extends BaseService<Integer, Teacher> {
      * @return
      */
     List<TeacherDefaultSalaryDto> queryTeacherDefaultSalary(String organIdList);
+
+    /**
+     * 获取所有教师编号列表
+     * @return
+     */
+    List<Integer> queryAllIds();
 }

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -1910,6 +1910,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         //学生结算表
         if (courseScheduleList.size() > 0) {
             courseScheduleStudentPaymentService.createForMusicGroup(musicGroupId, courseScheduleList, studentIdList);
+            studentDao.updateStudentServiceTag(null, studentIdList, YesOrNoEnum.YES.getCode());
         }
         return classGroup;
     }
@@ -2631,6 +2632,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         //学生结算表
         if (!CollectionUtils.isEmpty(studentIdList)) {
             courseScheduleStudentPaymentService.createForMusicGroup(musicGroupId, courseScheduleList, studentIdList);
+            studentDao.updateStudentServiceTag(null, studentIdList, YesOrNoEnum.YES.getCode());
         }
         return classGroup;
     }

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

@@ -3955,6 +3955,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 
         if (updateList.size() > 0) {
             courseScheduleDao.batchUpdate(updateList);
+			Set<Long> courseIds = updateList.stream().map(CourseSchedule::getId).collect(Collectors.toSet());
+			courseEventSource.courseStatusChange(courseIds);
         }
 
 		courseEventSource.courseStatusChange(null);
@@ -4002,6 +4004,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
     }
 
     @Override
+	@Transactional(rollbackFor = Exception.class)
 	public boolean updateCourseScheduleToUnderway() {
     	Date date = new Date();
     	List<CourseSchedule> list = courseScheduleDao.queryUnderwayWithNoUpdateStatus();
@@ -4016,7 +4019,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 
         if (updateList.size() > 0) {
             courseScheduleDao.batchUpdate(updateList);
-        }
+		}
 		return true;
 	}
 

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

@@ -691,8 +691,8 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public void updateCourseActualPrice() {
-		List<CourseScheduleStudentPaymentDto> courseScheduleStudentPayments = courseScheduleStudentPaymentDao.findNeedUpdateActualPriceStudentCourses();
+	public void updateCourseActualPrice(List<Long> courseIds) {
+		List<CourseScheduleStudentPaymentDto> courseScheduleStudentPayments = courseScheduleStudentPaymentDao.findNeedUpdateActualPriceStudentCourses(courseIds);
 		if(CollectionUtils.isEmpty(courseScheduleStudentPayments)){
 			return;
 		}

+ 38 - 56
mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java

@@ -3,7 +3,9 @@ package com.ym.mec.biz.service.impl;
 import com.ym.mec.biz.dal.dao.OrganizationDao;
 import com.ym.mec.biz.dal.dto.IndexBaseDto;
 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.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.util.date.DateUtil;
@@ -82,27 +84,48 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 
 		DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM");
 		LocalDate nowDate = LocalDate.now();
-		LocalDate startDate = nowDate.withMonth(1).withDayOfMonth(1);
-		LocalDate endDate = nowDate.withDayOfMonth(1);
-		if(StringUtils.isNotBlank(startMonth)){
-			startDate = LocalDate.parse(startMonth+"-01", DateUtil.dateFormatter);
-		}
-
-		if(StringUtils.isNotBlank(endMonth)){
-			endDate = LocalDate.parse(endMonth+"-01", DateUtil.dateFormatter);
-		}
 
 		List<Organization> allOrgans = organizationDao.findAllOrgans();
 		Set<Integer> organIds = allOrgans.stream().map(Organization::getId).collect(Collectors.toSet());
 		this.organIds.get().clear();
 		this.organIds.get().addAll(organIds);
 
-		while (startDate.compareTo(endDate)<=0){
-			countUserSignUpData(df.format(startDate));
-			countHomeworkData(startMonth);
-
-			startDate = startDate.plusMonths(1);
-		}
+		startMonth = df.format(nowDate);
+
+		//运营数据
+		saveData(indexBaseMonthDataDao.getSchoolData(startMonth), startMonth, IndexDataType.SCHOOL);
+		saveData(indexBaseMonthDataDao.getMusicData(startMonth), startMonth, IndexDataType.MUSIC_GROUP_NUM);
+		saveData(indexBaseMonthDataDao.getMusicStudentData(startMonth), startMonth, IndexDataType.MUSIC_GROUP_STUDENT);
+		saveData(null, startMonth, IndexDataType.OTHER_STUDENT);
+
+		//业务数据
+		saveData(indexBaseMonthDataDao.getStudentSignUpData(startMonth), startMonth, IndexDataType.ACTIVATION_RATE);
+		saveData(indexBaseMonthDataDao.getHomeworkData(startMonth, null), startMonth, IndexDataType.HOMEWORK_CREATE_RATE);
+		saveData(indexBaseMonthDataDao.getHomeworkData(startMonth, "submit"), startMonth, IndexDataType.HOMEWORK_SUBMIT_RATE);
+		saveData(indexBaseMonthDataDao.getHomeworkData(startMonth, "comment"), startMonth, 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(indexBaseMonthDataDao.getTeacherData(startMonth, null, null), startMonth, IndexDataType.TEACHER_NUM);
+		saveData(indexBaseMonthDataDao.getTeacherData(startMonth, JobNatureEnum.FULL_TIME, null), startMonth, IndexDataType.FULL_TIME_NUM);
+		saveData(indexBaseMonthDataDao.getTeacherData(startMonth, JobNatureEnum.PART_TIME, null), startMonth, IndexDataType.PART_TIME_NUM);
+		saveData(indexBaseMonthDataDao.getTeacherData(startMonth, null, true), startMonth, 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.getGroupCourseData(startMonth, GroupType.MUSIC), startMonth, IndexDataType.MUSIC_GROUP_COURSE);
+		saveData(indexBaseMonthDataDao.getGroupCourseData(startMonth, GroupType.VIP), startMonth, IndexDataType.VIP_GROUP_COURSE);
+		saveData(indexBaseMonthDataDao.getGroupCourseData(startMonth, GroupType.PRACTICE), startMonth, IndexDataType.PRACTICE_GROUP_COURSE);
 
 		return result;
 	}
@@ -129,45 +152,4 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		indexBaseMonthDataDao.deleteWithMonthAndType(Arrays.asList(startMonth), indexDataType);
 		indexBaseMonthDataDao.batchInsertWithDataType(dataList, indexDataType);
 	}
-
-	/**
-	 * @describe 激活率
-	 * @author Joburgess
-	 * @date 2021/1/11 0011
-	 * @param startMonth:
-	 * @return void
-	 */
-	private void countUserSignUpData(String startMonth){
-		List<IndexBaseMonthData> dataList = indexBaseMonthDataDao.getStudentSignUpData(startMonth);
-		saveData(dataList, startMonth, IndexDataType.ACTIVATION_RATE);
-	}
-
-	/**
-	 * @describe 作业数据
-	 * @author Joburgess
-	 * @date 2021/1/11 0011
-	 * @param startMonth:
-	 * @return void
-	 */
-	private void countHomeworkData(String startMonth){
-		List<IndexBaseMonthData> dataList = indexBaseMonthDataDao.getHomeworkDate(startMonth, null);
-		saveData(dataList, startMonth, IndexDataType.HOMEWORK_CREATE_RATE);
-
-		List<IndexBaseMonthData> dataList1 = indexBaseMonthDataDao.getHomeworkDate(startMonth, "submit");
-		saveData(dataList1, startMonth, IndexDataType.HOMEWORK_SUBMIT_RATE);
-
-		List<IndexBaseMonthData> dataList2 = indexBaseMonthDataDao.getHomeworkDate(startMonth, "comment");
-		saveData(dataList2, startMonth, IndexDataType.HOMEWORK_COMMENT_RATE);
-	}
-
-	/**
-	 * @describe 统计合作单位数据
-	 * @author Joburgess
-	 * @date 2021/1/11 0011
-	 * @param startMonth:
-	 * @return void
-	 */
-	private void countSchoolData(String startMonth){
-
-	}
 }

+ 90 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -18,9 +18,6 @@ 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.dto.*;
-import com.ym.mec.biz.dal.entity.*;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -33,7 +30,79 @@ 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;
+import com.ym.mec.biz.dal.dto.CourseScheduleTeachersDto;
+import com.ym.mec.biz.dal.dto.HighClassGroupDto;
+import com.ym.mec.biz.dal.dto.MusicCardDto;
+import com.ym.mec.biz.dal.dto.RegisterPayDto;
+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.enums.ClassGroupTypeEnum;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.GoodsType;
@@ -69,12 +138,10 @@ import com.ym.mec.biz.service.SysUserCashAccountDetailService;
 import com.ym.mec.biz.service.SysUserCashAccountService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.entity.ImGroupMember;
-import com.ym.mec.common.entity.ImGroupModel;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.IdGeneratorService;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
-import com.ym.mec.im.ImFeignService;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
@@ -1609,6 +1676,13 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             throw new BizException("申请失败,乐团状态[已取消]或[已暂停]");
         }
 
+		// 有进行中的课程不能退团
+		List<CourseSchedule> courseScheduleList = courseScheduleDao.findMusicGroupCourseSchedulesWithStudent(musicGroupId, GroupType.MUSIC.getCode(),
+				"UNDERWAY", userId);
+		if (courseScheduleList != null && courseScheduleList.size() > 0) {
+			throw new BizException("退团失败,存在[进行中]的课程");
+		}
+
         musicGroupQuit.setStatus(status);
         musicGroupQuit.setReason(reason);
         musicGroupQuit.setQuitDate(date);
@@ -1636,6 +1710,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             musicGroupStudentFeeDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
             // 退团
             studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.QUIT);
+            studentRegistration.setSurplusCourseFee(BigDecimal.ZERO);
             studentRegistration.setUpdateTime(date);
 
             studentRegistrationDao.update(studentRegistration);
@@ -1756,14 +1831,21 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         }
 
         if (musicGroup.getStatus() == MusicGroupStatusEnum.CANCELED || musicGroup.getStatus() == MusicGroupStatusEnum.PAUSE) {
-            throw new BizException("申请失败,乐团状态[已取消]或[已暂停]");
+            throw new BizException("退团失败,乐团状态[已取消]或[已暂停]");
         }
 
         // 判断乐器是否是租赁
         StudentRegistration studentRegistration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
         if (studentRegistration == null) {
             throw new BizException("用户注册信息不存在");
-        }
+		}
+
+		// 有进行中的课程不能退团
+		List<CourseSchedule> courseScheduleList = courseScheduleDao.findMusicGroupCourseSchedulesWithStudent(musicGroupId, GroupType.MUSIC.getCode(),
+				"UNDERWAY", userId);
+		if (courseScheduleList != null && courseScheduleList.size() > 0) {
+			throw new BizException("退团失败,存在[进行中]的课程");
+		}
 
         Date date = new Date();
 
@@ -1793,6 +1875,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         // 退团
         studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.QUIT);
+        studentRegistration.setSurplusCourseFee(BigDecimal.ZERO);
         studentRegistration.setUpdateTime(date);
 
         studentRegistrationDao.update(studentRegistration);

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

@@ -355,7 +355,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         studentRegistrationDao.insert(studentRegistration);
 
         // 增加报名学生数
-        musicGroupSubjectPlanService.addApplyStudentNum(studentRegistration.getMusicGroupId(), studentRegistration.getSubjectId(), 1);
+        musicGroupSubjectPlanService.addApplyStudentNum(studentRegistration.getMusicGroupId(), studentRegistration.getActualSubjectId(), 1);
         // 报名成功后,发送短信
         // String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + studentRegistration.getMusicGroupId();
         String serverPhone = sysConfigDao.findConfigValue(SysConfigService.SERVER_PHONE);
@@ -662,7 +662,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         }*/
         Date date = new Date();
         String musicGroupId = studentRegistration.getMusicGroupId();
-
+        
         studentRegistration.setCreateTime(date);
         studentRegistration.setUpdateTime(date);
 
@@ -841,24 +841,24 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
     @Override
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
-    public void insertStudent(String studentIds, String oldMusicGroupId, String newMusicGroupId, BigDecimal masterTotalPrice) {
-        if (oldMusicGroupId == newMusicGroupId) {
+    public void insertStudent(String studentIds,String oldMusicGroupId,String newMusicGroupId,BigDecimal masterTotalPrice){
+        if(oldMusicGroupId == newMusicGroupId){
             return;
         }
         SysUser sysUser1 = sysUserFeignService.queryUserInfo();
         //获取旧乐团学员注册信息
-        List<StudentRegistration> studentRegistrations = studentRegistrationDao.queryByUserIdsAndMusicGroupId(studentIds, oldMusicGroupId);
+        List<StudentRegistration> studentRegistrations = studentRegistrationDao.queryByUserIdsAndMusicGroupId(studentIds,oldMusicGroupId);
         List<StudentCourseFeeDetail> studentCourseFeeDetails = new ArrayList<>();
         BigDecimal amount = BigDecimal.ZERO;
         for (StudentRegistration studentRegistration : studentRegistrations) {
             //记录课程余额消费日志
-            if (studentRegistration.getSurplusCourseFee().doubleValue() > 0d && masterTotalPrice.doubleValue() > 0d) {
+            if(studentRegistration.getSurplusCourseFee().doubleValue() > 0d && masterTotalPrice.doubleValue() > 0d){
                 StudentCourseFeeDetail studentCourseFeeDetail = new StudentCourseFeeDetail();
-                if (studentRegistration.getSurplusCourseFee().doubleValue() > masterTotalPrice.doubleValue()) {
+                if(studentRegistration.getSurplusCourseFee().doubleValue() > masterTotalPrice.doubleValue()){
                     amount = masterTotalPrice;
                     studentCourseFeeDetail.setAmount(masterTotalPrice.negate());
                     studentCourseFeeDetail.setSurplusCourseFee(studentRegistration.getSurplusCourseFee().subtract(masterTotalPrice));
-                } else {
+                }else {
                     amount = studentRegistration.getSurplusCourseFee();
                     studentCourseFeeDetail.setAmount(studentRegistration.getSurplusCourseFee().negate());
                     studentCourseFeeDetail.setSurplusCourseFee(BigDecimal.ZERO);
@@ -877,7 +877,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 //修改剩余课程余额
                 registration.setSurplusCourseFee(registration.getSurplusCourseFee().add(amount));
                 studentRegistrationDao.update(registration);
-            } else {
+            }else {
                 //生成学员乐团注册表
                 studentRegistration.setOrganId(musicGroupDao.get(newMusicGroupId).getOrganId());
                 studentRegistration.setSurplusCourseFee(amount);
@@ -888,16 +888,16 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 //增加报名学生数
                 musicGroupSubjectPlanService.addApplyStudentNum(newMusicGroupId, studentRegistration.getActualSubjectId(), 1);
                 //新增Fee表
-                MusicGroupStudentFee musicGroupStudentFee = musicGroupStudentFeeDao.findByUser(studentRegistration.getUserId(), newMusicGroupId);
-                if (musicGroupStudentFee == null) {
+                MusicGroupStudentFee musicGroupStudentFee = musicGroupStudentFeeDao.findByUser(studentRegistration.getUserId(),newMusicGroupId);
+                if(musicGroupStudentFee == null){
                     musicGroupStudentFee = new MusicGroupStudentFee(newMusicGroupId,
-                            studentRegistration.getUserId(), studentRegistration.getSubjectId(), BigDecimal.ZERO,
-                            null, studentRegistration.getTemporaryCourseFee(), studentRegistration.getPaymentStatus() == YES ? PAID_COMPLETED : NON_PAYMENT);
+                            studentRegistration.getUserId(), studentRegistration.getSubjectId(),BigDecimal.ZERO,
+                            null, studentRegistration.getTemporaryCourseFee(), studentRegistration.getPaymentStatus()==YES?PAID_COMPLETED:NON_PAYMENT);
                     musicGroupStudentFeeDao.insert(musicGroupStudentFee);
                 }
             }
             //主班新增余额日志
-            if (amount.doubleValue() != 0d && masterTotalPrice.doubleValue() > 0d) {
+            if(amount.doubleValue() != 0d && masterTotalPrice.doubleValue() > 0d){
                 StudentCourseFeeDetail studentCourseFeeDetail = new StudentCourseFeeDetail();
                 studentCourseFeeDetail.setAmount(amount);
                 studentCourseFeeDetail.setSurplusCourseFee(registration.getSurplusCourseFee());
@@ -907,7 +907,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentCourseFeeDetails.add(studentCourseFeeDetail);
             }
         }
-        if (studentCourseFeeDetails.size() > 0) {
+        if(studentCourseFeeDetails.size() > 0){
             studentCourseFeeDetailDao.batchInsert(studentCourseFeeDetails);
         }
     }
@@ -1395,7 +1395,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     @Override
     @Transactional
     public StudentRegistration updateStudent(StudentRegistration studentRegistration) {
-        if (StringUtils.isBlank(studentRegistration.getCertificateType())) {
+        if(StringUtils.isBlank(studentRegistration.getCertificateType())){
             studentRegistration.setCertificateType(CertificateTypeEnum.IDENTITY.getCode());
         }
         StudentRegistration student = get(studentRegistration.getId());
@@ -1407,7 +1407,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         update(student);
         studentRegistrationDao.updateUser(student.getUserId(), student.getParentsName(), student.getIdCardNo(), studentRegistration.getCertificateType());
         // 添加用户电子签章账户
-        if (CertificateTypeEnum.IDENTITY.getCode().equals(studentRegistration.getCertificateType())) {
+        if(CertificateTypeEnum.IDENTITY.getCode().equals(studentRegistration.getCertificateType())){
             contractService.register(student.getUserId(), student.getParentsName(), student.getIdCardNo(), student.getParentsPhone());
         }
         return student;
@@ -1595,10 +1595,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         return amount;
     }
 
-    @Override
-    public List<StudentMusicGroupDto> queryStudentMusicGroupInfo(Integer userId) {
-        return studentRegistrationDao.queryStudentMusicGroupInfo(userId);
-    }
+	@Override
+	public List<StudentMusicGroupDto> queryStudentMusicGroupInfo(Integer userId) {
+		return studentRegistrationDao.queryStudentMusicGroupInfo(userId);
+	}
 
     @Override
     @Transactional(rollbackFor = Exception.class)

+ 75 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherServiceImpl.java

@@ -69,6 +69,8 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  imple
 	private StudentExtracurricularExercisesSituationDao studentExtracurricularExercisesSituationDao;
 	@Autowired
 	private StudentDao studentDao;
+	@Autowired
+	private ImUserFriendDao imUserFriendDao;
 
 
 	@Override
@@ -234,6 +236,74 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  imple
 		return teachers.stream().distinct().collect(Collectors.toList());
 	}
 
+	@Transactional(rollbackFor = Exception.class)
+	public void queryGroupStudents1(Integer teacherId, String search) {
+		//获取关联的学员列表
+		Set<Integer> studentIds = teacherDao.queryCourseClassStudentIds(teacherId);
+		//获取关联的老师列表
+		studentIds.addAll(teacherDao.queryCourseClassTeacherIds(teacherId));
+		//获取关联的乐团的管理老师
+		List<String> musicLeaderIds = teacherDao.queryMusicLeaderIds(teacherId);
+		musicLeaderIds.removeAll(Collections.singleton(null));
+		if(musicLeaderIds.size() > 0){
+			Set<String> leaderIds = new HashSet<>();
+			musicLeaderIds.forEach(e->{
+				leaderIds.addAll(Arrays.asList(e.split(",")));
+			});
+			leaderIds.forEach(e->{
+				studentIds.add(Integer.valueOf(e));
+			});
+		}
+		studentIds.removeAll(Collections.singleton(null));
+		List<ImGroupModel> musicGroups =  musicGroupDao.queryTeacherGroups(teacherId,search);
+		List<BasicUserDto> teachers = new ArrayList<>();
+		if(musicGroups != null && musicGroups.size() > 0){
+			Set<String> musicGroupId = musicGroups.stream().map(ImGroupModel::getId).collect(Collectors.toSet());
+			List<MusicGroup> musicGroupList = musicGroupDao.queryListByIds(StringUtils.join(musicGroupId, ","));
+			Set<Integer> teacherIdSet = new HashSet<>();
+			if(musicGroupList != null && musicGroupList.size() > 0){
+				musicGroupList.forEach(e->{
+					teacherIdSet.add(e.getTeamTeacherId());
+					teacherIdSet.add(e.getEducationalTeacherId());
+					teacherIdSet.add(e.getDirectorUserId());
+				});
+			}
+			teacherIdSet.remove(teacherId);
+			teacherIdSet.removeAll(Collections.singleton(null));
+			if(teacherIdSet.size() > 0){
+				teachers = teacherDao.queryMusicGroupStudents(StringUtils.join(teacherIdSet,","), search);
+			}
+		}
+		List<BasicUserDto> userDtos = teacherDao.queryGroupStudents(teacherId, search);
+		if(userDtos != null && userDtos.size() > 0){
+			teachers.addAll(userDtos);
+			Set<String> musicGroupIds = userDtos.stream().map(e -> e.getMusicGroupId()).collect(Collectors.toSet());
+			if(musicGroupIds != null && musicGroupIds.size() > 0){
+				Map<String, String> musicGroupNameMap = MapUtil.convertIntegerMap(musicGroupDao.queryMusicGroupNameMap(musicGroupIds));
+				userDtos.forEach(e->{
+					e.setMusicGroupName(musicGroupNameMap.get(e.getMusicGroupId()));
+				});
+			}
+		}
+		studentIds.removeAll(userDtos.stream().map(e->e.getUserId()).collect(Collectors.toSet()));
+		studentIds.remove(teacherId);
+		//获取课程关联的学生列表
+//		teachers.addAll(teacherDao.findCloseCourseStudentIds(teacherId, search));
+		//获取相关vip陪练教务的学员编号
+//		teachers.addAll(teacherDao.findVipEducationalStudentId(teacherId,search));
+//		teachers.addAll(teacherDao.findCommEducationalStudentId(teacherId,search));
+//		teachers.addAll(teacherDao.findPracticeEducationalStudentId(teacherId,search));
+		if(studentIds.size() > 0){
+			teachers.addAll(teacherDao.queryTeacherBaseInfo(studentIds,search));
+		}
+		if(teachers.size() > 0){
+			//删除现有的用户通讯录
+			imUserFriendDao.deleteByUserId(teacherId);
+			//批量新增
+			imUserFriendDao.batchInsert(teachers,teacherId);
+		}
+	}
+
     @Override
     public List<TeacherBasicDto> findTeachers(String organId) {
 		return teacherDao.findByFlowOrganRangeTeachers(organId);
@@ -562,4 +632,9 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  imple
 		return teacherDao.queryTeacherDefaultSalary(organIdList);
 	}
 
+	@Override
+	public List<Integer> queryAllIds() {
+		return teacherDao.queryAllIds();
+	}
+
 }

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -2910,6 +2910,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			classGroupDao.update(classGroup);
 
 			try {
+				imGroupService.create(classGroup.getId().longValue(), null, classGroup.getName(), classGroup.getName(), vipGroup.getName(), null, null, GroupType.VIP.getCode());
 				imGroupMemberService.join(classGroup.getId().longValue(), userRoleMap);
 			} catch (Exception e) {
 				e.printStackTrace();
@@ -3091,6 +3092,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		studentDao.updateStudentServiceTag(null, studentIds, YesOrNoEnum.YES.getCode());
 
 		try {
+			imGroupService.create(classGroup.getId().longValue(), null, classGroup.getName(), classGroup.getName(), vipGroup.getName(), null, null, GroupType.VIP.getCode());
 			imGroupMemberService.join(classGroup.getId().longValue(), userRoleMap);
 		} catch (Exception e) {
 			e.printStackTrace();

+ 6 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml

@@ -634,6 +634,12 @@
 			AND cs.id_ IS NOT NULL
 			AND ((cs.status_ = 'OVER' AND (cssp.actual_price_ IS NULL OR cssp.actual_price_ &lt; cssp.expect_price_))
 			OR ( cs.status_ = 'NOT_START' AND cssp.actual_price_ IS NOT NULL AND cssp.actual_price_ &gt; 0))
+			<if test="courseIds!=null and courseIds.size()>0">
+				AND cs.id_ IN
+				<foreach collection="courseIds" item="courseId" open="(" close=")" separator=",">
+					#{courseId}
+				</foreach>
+			</if>
 	</select>
 	<select id="queryCourseByIdsAndStudentId" resultMap="CourseScheduleStudentPayment">
 		SELECT cssp.* FROM course_schedule_student_payment cssp

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

@@ -53,7 +53,8 @@
 		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
 		</selectKey>
 		-->
-		INSERT INTO im_group (id_,name_,introduce_,member_num_,memo_,tags_,img_,type_create_time_,update_time_) VALUES(#{id},#{name},#{introduce},#{memberNum},#{memo},#{tags},#{img},#{type},#{createTime},#{updateTime})
+		INSERT INTO im_group (id_,name_,introduce_,member_num_,memo_,tags_,img_,type_,create_time_,update_time_)
+		VALUES(#{id},#{name},#{introduce},#{memberNum},#{memo},#{tags},#{img},#{type},#{createTime},#{updateTime})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->

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

@@ -39,7 +39,7 @@
 	
 	<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
-		 <foreach collection="list" item="item" separator=";">
+		 <foreach collection="list" item="item" separator=",">
 		(#{item.id},#{item.imGroupId},#{item.userId},#{item.nickname},#{item.isAdmin},#{item.roleType},#{item.createTime},#{item.updateTime})
 		</foreach>
 	</insert>
@@ -134,6 +134,6 @@
 	</delete>
 	
 	<select id="queryByImGroupIdAndUserId" resultMap="ImGroupMember" parameterType="map">
-		SELECT * FROM im_group_member where find_in_set(im_group_id_,#{imGroupIdList}) and find_in_set(user_id_,#{userId})
+		SELECT * FROM im_group_member where find_in_set(im_group_id_,#{imGroupIdList}) and find_in_set(user_id_,#{userIdList})
 	</select>
 </mapper>

+ 15 - 9
mec-biz/src/main/resources/config/mybatis/ImUserFriendMapper.xml

@@ -36,14 +36,17 @@
 	
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ImUserFriend" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		<!--
-		<selectKey resultClass="int" keyProperty="id" > 
-		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
-		</selectKey>
-		-->
-		INSERT INTO im_user_friend (id_,user_id_,friend_id_,friend_nickname_,memo_,tags_,create_time_,update_time_) VALUES(#{id},#{userId},#{friendId},#{friendNickname},#{memo},#{tags},#{createTime},#{updateTime})
+		INSERT INTO im_user_friend (id_,user_id_,friend_id_,friend_nickname_,memo_,tags_,create_time_,update_time_)
+		VALUES(#{id},#{userId},#{friendId},#{friendNickname},#{memo},#{tags},#{createTime},#{updateTime})
 	</insert>
-	
+	<insert id="batchInsert">
+		INSERT INTO im_user_friend (user_id_,friend_id_,friend_nickname_,create_time_,update_time_)
+		VALUES
+		<foreach collection="teachers" item="item" separator=",">
+			(#{teacherId},#{item.userId},#{item.name},NOW(),NOW())
+		</foreach>
+	</insert>
+
 	<!-- 根据主键查询一条记录 -->
 	<update id="update" parameterType="com.ym.mec.biz.dal.entity.ImUserFriend">
 		UPDATE im_user_friend <set>
@@ -78,8 +81,11 @@
 	<delete id="delete" >
 		DELETE FROM im_user_friend WHERE id_ = #{id} 
 	</delete>
-	
-	<!-- 分页查询 -->
+    <delete id="deleteByUserId">
+		DELETE FROM im_user_friend WHERE user_id_ = #{teacherId}
+	</delete>
+
+    <!-- 分页查询 -->
 	<select id="queryPage" resultMap="ImUserFriend" parameterType="map">
 		SELECT * FROM im_user_friend ORDER BY id_ <include refid="global.limit"/>
 	</select>

+ 117 - 11
mec-biz/src/main/resources/config/mybatis/IndexBaseMonthDataMapper.xml

@@ -139,7 +139,7 @@
 	<select id="getStudentSignUpData" resultMap="IndexBaseMonthData">
 		SELECT
 			organ_id_,
-			CONCAT( #{startMonth}, '-01' ) month_,
+			CONCAT(DATE_FORMAT(NOW(), '%Y-%m'), '-01') month_,
 			COUNT( id_ ) total_num_,
 			COUNT(CASE WHEN password_ IS NOT NULL THEN id_ ELSE NULL END) activate_num_,
 			TRUNCATE(COUNT(CASE WHEN password_ IS NOT NULL THEN id_ ELSE NULL END)/COUNT( id_ )*100, 2) percent_
@@ -148,17 +148,15 @@
 			del_flag_=0
 		  	AND organ_id_ IS NOT NULL
 			AND user_type_ LIKE '%STUDENT%'
-			<if test="startMonth!=null and startMonth!=''">
-				AND DATE_FORMAT(create_time_, '%Y-%m')=#{startMonth}
-			</if>
+			AND YEAR(create_time_)=YEAR(NOW())
 		GROUP BY organ_id_
-		ORDER BY organ_id_,month_;
+		ORDER BY organ_id_;
 	</select>
 
-	<select id="getHomeworkDate" resultMap="IndexBaseMonthData">
+	<select id="getHomeworkData" resultMap="IndexBaseMonthData">
 		SELECT
 			su.organ_id_,
-			CONCAT( #{startMonth}, '-01' ) month_,
+			CONCAT(DATE_FORMAT(NOW(), '%Y-%m'), '-01') month_,
 			<choose>
 				<when test="type == 'submit'">
 					SUM(sees.expect_exercises_num_) total_num_,
@@ -180,10 +178,118 @@
 		LEFT JOIN sys_user su ON sees.student_id_=su.id_
 		WHERE su.del_flag_=0
 			AND su.organ_id_ IS NOT NULL
-			<if test="startMonth!=null and startMonth!=''">
-				AND DATE_FORMAT(sees.monday_, '%Y-%m')=#{startMonth}
-			</if>
+			AND DATE_FORMAT(sees.monday_, '%Y-%m')=#{month}
 		GROUP BY su.organ_id_
-		ORDER BY su.organ_id_,month_
+		ORDER BY su.organ_id_
+	</select>
+
+	<select id="getSchoolData" resultMap="IndexBaseMonthData">
+		SELECT
+			organ_id_,
+			CONCAT(DATE_FORMAT(NOW(), '%Y-%m'), '-01') month_,
+			COUNT( id_ ) total_num_,
+			COUNT( id_ ) activate_num_,
+			COUNT( id_ ) percent_
+		FROM
+			school
+		WHERE
+			del_flag_ = 0
+		  	AND organ_id_ IS NOT NULL
+			AND YEAR(create_time_)=YEAR(NOW())
+		GROUP BY
+			organ_id_
+		ORDER BY
+			organ_id_;
+	</select>
+	<select id="getMusicData" resultMap="IndexBaseMonthData">
+		SELECT
+			organ_id_,
+			CONCAT(DATE_FORMAT(NOW(), '%Y-%m'), '-01') month_,
+			COUNT( id_ ) total_num_,
+			COUNT( id_ ) activate_num_,
+			COUNT( id_ ) percent_
+		FROM
+			music_group
+		WHERE
+			del_flag_ = 0
+			AND status_ = 'PROGRESS'
+			AND organ_id_ IS NOT NULL
+			AND YEAR(create_time_)=YEAR(NOW())
+		GROUP BY
+			organ_id_
+		ORDER BY
+			organ_id_;
+	</select>
+	<select id="getMusicStudentData" resultMap="IndexBaseMonthData">
+		SELECT
+			mg.organ_id_,
+			CONCAT(DATE_FORMAT(NOW(), '%Y-%m'), '-01') month_,
+			COUNT( DISTINCT sr.user_id_ ) total_num_,
+			COUNT( DISTINCT sr.user_id_ ) activate_num_,
+			COUNT( DISTINCT sr.user_id_ ) percent_
+		FROM student_registration sr
+				 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 YEAR(sr.create_time_)=YEAR(NOW())
+		GROUP BY
+			mg.organ_id_
+		ORDER BY
+			mg.organ_id_;
+	</select>
+
+	<select id="getTeacherData" resultMap="IndexBaseMonthData">
+		SELECT
+			t.organ_id_,
+			CONCAT(DATE_FORMAT(NOW(), '%Y-%m'), '-01') month_,
+			COUNT( t.id_ ) total_num_,
+			COUNT( t.id_ ) activate_num_,
+			COUNT( t.id_ ) percent_
+		FROM
+			teacher t
+				LEFT JOIN sys_user su ON su.id_ = t.id_
+		WHERE
+			su.del_flag_ = 0
+		  	AND YEAR(t.create_time_)=YEAR(NOW())
+		  	<if test="isDemission==null">
+				AND su.lock_flag_ = 0
+			</if>
+		  	<if test="isDemission!=null">
+				AND (su.lock_flag_ = 1 OR t.demission_date_ IS NOT NULL)
+			</if>
+			AND t.organ_id_ IS NOT NULL
+			<if test="jobNature!=null">
+				AND t.job_nature_ = #{jobNature,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+			</if>
+		GROUP BY
+			t.organ_id_
+		ORDER BY
+			t.organ_id_;
+	</select>
+
+	<select id="getGroupCourseData" resultMap="IndexBaseMonthData">
+		SELECT
+			m.organ_id_,
+			CONCAT(DATE_FORMAT(NOW(), '%Y-%m'), '-01') month_,
+			COUNT( m.id_ ) total_num_,
+			COUNT( m.id_ ) activate_num_,
+			COUNT( m.id_ ) percent_
+		FROM
+			course_schedule m
+		WHERE
+			m.del_flag_ = 0
+			AND m.is_lock_ = 0
+			AND m.organ_id_ IS NOT NULL
+			AND YEAR(m.create_time_)=YEAR(NOW())
+			<if test="groupType!=null">
+				AND m.group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+			</if>
+		GROUP BY
+			m.organ_id_
+		ORDER BY
+			m.organ_id_;
 	</select>
 </mapper>

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

@@ -498,6 +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 cs.class_date_&gt;=#{monday}
             AND cs.type_ IN ('SINGLE','VIP','MIX','PRACTICE')
             AND cssp.create_time_&lt;#{nextMonday}

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

@@ -110,8 +110,7 @@
 
 
     <!-- 向数据库增加一条记录 -->
-    <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.StudentRegistration" useGeneratedKeys="true"
-            keyColumn="id" keyProperty="id">
+    <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.StudentRegistration" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
         INSERT INTO student_registration
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="userId!=null">user_id_,</if>
@@ -741,12 +740,4 @@
         LEFT JOIN sys_user su ON su.id_ = sr.user_id_
         WHERE sr.music_group_id_ = #{musicGroupId} AND FIND_IN_SET(sr.user_id_,#{studentIds}) AND sr.music_group_status_ != 'QUIT'
     </select>
-
-    <!-- 批量删除信息 -->
-    <delete id="batchDelete">
-        DELETE FROM student_registration WHERE id_ IN
-        <foreach collection="ids" item="id" open="(" close=")" separator=",">
-            #{id}
-        </foreach>
-    </delete>
 </mapper>

+ 3 - 0
mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -1244,4 +1244,7 @@
         SELECT GROUP_CONCAT(real_name_) FROM sys_user su
         WHERE FIND_IN_SET(su.id_,#{teachingTeacherIds})
     </select>
+    <select id="queryAllIds" resultType="java.lang.Integer">
+        SELECT id_ FROM sys_user
+    </select>
 </mapper>

+ 12 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherController.java

@@ -12,7 +12,9 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 
 import java.util.Date;
+import java.util.List;
 
+import jdk.internal.dynalink.linker.LinkerServices;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
@@ -127,6 +129,16 @@ public class TeacherController extends BaseController {
         return succeed(teacherService.queryGroupStudents(sysUser.getId(),search));
     }
 
+    @ApiOperation(value = "同步教师通讯录")
+    @GetMapping("/syncTeacherImFriend")
+    public Object syncTeacherImFriend(){
+        List<Integer> teacherIds = teacherService.queryAllIds();
+        for (Integer teacherId : teacherIds) {
+            teacherService.queryGroupStudents1(teacherId,null);
+        }
+        return succeed();
+    }
+
     @ApiOperation(value = "获取当前教师通讯录学员列表")
     @GetMapping("/queryGroupStudentList")
     public Object queryGroupStudentList(String search){