浏览代码

Merge remote-tracking branch 'origin/master'

zouxuan 4 年之前
父节点
当前提交
33a4f9bd91

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupStudentMapperDao.java

@@ -456,4 +456,14 @@ public interface ClassGroupStudentMapperDao extends BaseDAO<Long, ClassGroupStud
      */
     Set<Integer> queryStudentIdsByClassGroupId(@Param("classGroupId") Integer classGroupId,@Param("musicGroupId") String musicGroupId,
                                                @Param("groupType") GroupType groupType);
+
+    /**
+     * @describe 获取学员班级主教关联记录
+     * @author Joburgess
+     * @date 2021/1/25 0025
+     * @param studentIds:
+     * @return java.util.List<com.ym.mec.biz.dal.dto.BaseMapDto>
+     */
+    List<BaseMapDto<Integer, Integer>> getStudentClassGroupBishopTeacherMap(@Param("studentIds") List<Integer> studentIds,
+                                                                            @Param("musicGroupId") String musicGroupId);
 }

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

@@ -464,14 +464,4 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
                                                @Param("monday") String monday,
                                                @Param("groupId") String groupId,
                                                @Param("courseType")CourseSchedule.CourseScheduleType courseType);
-
-    /**
-     * @describe 获取学员班级主教关联记录
-     * @author Joburgess
-     * @date 2021/1/25 0025
-     * @param studentIds:
-     * @return java.util.List<com.ym.mec.biz.dal.dto.BaseMapDto>
-     */
-    List<BaseMapDto<Integer, Integer>> getStudentClassGroupBishopTeacherMap(@Param("studentIds") List<Integer> studentIds,
-                                                                            @Param("musicGroupId") String musicGroupId);
 }

+ 11 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/TeacherVisitDto.java

@@ -1,9 +1,11 @@
 package com.ym.mec.biz.dal.dto;
 
 /**
- * 老师访
+ * 老师访数
  */
 public class TeacherVisitDto {
+    private Integer organId;
+
     private Integer teacherId;
 
     private String month;
@@ -33,4 +35,12 @@ public class TeacherVisitDto {
     public void setMonth(String month) {
         this.month = month;
     }
+
+    public Integer getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(Integer organId) {
+        this.organId = organId;
+    }
 }

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

@@ -121,7 +121,7 @@ public class InspectionItemPlanConclusionServiceImpl extends BaseServiceImpl<Lon
         if (courseSchedules.size() > 0) {
             return courseSchedules;
         }
-        courseSchedules = courseScheduleDao.getMusicGroupCourseInfo(plan.getMusicGroupId(), plan.getPlanStart(), plan.getPlanEnd());
+        courseSchedules = courseScheduleDao.getMusicGroupCourseInfo(plan.getMusicGroupId(), DateUtil.trunc(plan.getPlanStart()), DateUtil.getLastTimeWithDay(plan.getPlanStart()));
         return courseSchedules;
     }
 

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

@@ -54,6 +54,7 @@ public class InspectionItemServiceImpl extends BaseServiceImpl<Long, InspectionI
                 if (row.getItem().equals(InspectionItemEnum.INSPECT)) continue;
                 for (TeacherVisitDto teacherVisitCount : teacherVisitCounts) {
                     if (teacherVisitCount.getTeacherId().equals(row.getUserId()) &&
+                            teacherVisitCount.getOrganId().equals(row.getOrganId()) &&
                             DateUtil.dateToString(row.getMonth(), "yyyy-MM").equals(teacherVisitCount.getMonth())
                     ) {
                         row.setSubmittedTimes(teacherVisitCount.getNum());

+ 9 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/InspectionServiceImpl.java

@@ -60,7 +60,11 @@ public class InspectionServiceImpl extends BaseServiceImpl<Long, Inspection> imp
     @Transactional(rollbackFor = Exception.class)
     public List<Inspection> add(List<Inspection> inspections, Integer operationUserId) {
         Date nowDate = new Date();
+        Date month = DateUtil.getFirstDayOfMonth(nowDate);
         for (Inspection inspection : inspections) {
+            if(inspection.getMonth().before(month)){
+                throw new BizException("工作周期不能早于当前月份");
+            }
             inspection.setOperation(operationUserId);
             inspection.setCreateTime(nowDate);
             inspection.setUpdateTime(nowDate);
@@ -86,10 +90,14 @@ public class InspectionServiceImpl extends BaseServiceImpl<Long, Inspection> imp
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Inspection updateInspection(Inspection inspection, Integer operationUserId) {
+        Date nowDate = new Date();
+        Date month = DateUtil.getFirstDayOfMonth(nowDate);
+        if(inspection.getMonth().before(month)){
+            throw new BizException("工作周期不能早于当前月份");
+        }
         if (inspection.getInspectionItems() == null || inspection.getInspectionItems().size() <= 0) {
             throw new BizException("任务事项不能为空");
         }
-        Date nowDate = new Date();
         Inspection oldInspection = inspectionDao.get(inspection.getId());
         if (oldInspection == null) {
             throw new BizException("巡查任务不存在,请核查");

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

@@ -51,6 +51,8 @@ public class StudentServeServiceImpl implements StudentServeService {
     private ClassGroupTeacherMapperDao classGroupTeacherMapperDao;
     @Autowired
     private SysConfigService sysConfigService;
+    @Autowired
+    private ClassGroupStudentMapperDao classGroupStudentMapperDao;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -444,7 +446,7 @@ public class StudentServeServiceImpl implements StudentServeService {
                 Map<Integer, Integer> teacherNumMap = new HashMap<>();
                 for (String groupId : groupCourseInfo.keySet()) {
                     Integer teacherId = null;
-                    List<BaseMapDto<Integer, Integer>> studentTeacherIdList = courseScheduleStudentPaymentDao.getStudentClassGroupBishopTeacherMap(Arrays.asList(studentCourseMapEntry.getKey()), groupId);
+                    List<BaseMapDto<Integer, Integer>> studentTeacherIdList = classGroupStudentMapperDao.getStudentClassGroupBishopTeacherMap(Arrays.asList(studentCourseMapEntry.getKey()), groupId);
                     if(!CollectionUtils.isEmpty(studentTeacherIdList)){
                         teacherId = studentTeacherIdList.get(0).getValue();
                     }
@@ -510,7 +512,7 @@ public class StudentServeServiceImpl implements StudentServeService {
             Map<Integer, Integer> teacherNumMap = new HashMap<>();
             for (String groupId : noCourseStudentMusicIdsMapEntry.getValue()) {
                 Integer teacherId = null;
-                List<BaseMapDto<Integer, Integer>> studentTeacherIdList = courseScheduleStudentPaymentDao.getStudentClassGroupBishopTeacherMap(Arrays.asList(noCourseStudentMusicIdsMapEntry.getKey()), groupId);
+                List<BaseMapDto<Integer, Integer>> studentTeacherIdList = classGroupStudentMapperDao.getStudentClassGroupBishopTeacherMap(Arrays.asList(noCourseStudentMusicIdsMapEntry.getKey()), groupId);
                 if(!CollectionUtils.isEmpty(studentTeacherIdList)){
                     teacherId = studentTeacherIdList.get(0).getValue();
                 }

+ 23 - 0
mec-biz/src/main/resources/config/mybatis/ClassGroupStudentMapperMapper.xml

@@ -610,4 +610,27 @@
             </if>
         </where>
     </sql>
+    <select id="getStudentClassGroupBishopTeacherMap" resultType="com.ym.mec.biz.dal.dto.BaseMapDto">
+        SELECT
+        cgsm.user_id_ 'key',
+        cgtm.user_id_ 'value'
+        FROM
+            class_group_student_mapper cgsm
+            LEFT JOIN class_group cg ON cgsm.class_group_id_ = cg.id_
+            LEFT JOIN class_group_teacher_mapper cgtm ON cgsm.class_group_id_ = cgtm.class_group_id_
+        WHERE
+        ( cg.del_flag_ IS NULL OR cg.del_flag_ = 0 )
+        AND cg.type_ IN ( 'NORMAL')
+        AND cgtm.teacher_role_ = 'BISHOP'
+        AND cgsm.status_='NORMAL'
+        <if test="musicGroupId!=null and musicGroupId!=''">
+            AND cgsm.music_group_id_ = #{musicGroupId}
+        </if>
+        <if test="studentIds!=null and studentIds.size()>0">
+            AND cgsm.user_id_ IN
+            <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
+                #{studentId}
+            </foreach>
+        </if>
+    </select>
 </mapper>

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

@@ -711,29 +711,4 @@
 			LEFT JOIN course_schedule cs ON cssp.course_schedule_id_=cs.id_
 		WHERE cs.new_course_id_=#{mainMergeCourseId}
 	</select>
-    <select id="getStudentClassGroupBishopTeacherMap" resultType="com.ym.mec.biz.dal.dto.BaseMapDto">
-		SELECT
-			cssp.user_id_ 'key',
-			cgtm.user_id_ 'value'
-		FROM
-			course_schedule_student_payment cssp
-			LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_
-			LEFT JOIN class_group_teacher_mapper cgtm ON cssp.class_group_id_ = cgtm.class_group_id_
-			LEFT JOIN class_group_student_mapper cgsm ON cssp.class_group_id_=cgsm.class_group_id_ AND cssp.user_id_=cgsm.user_id_
-		WHERE
-			( cs.del_flag_ IS NULL OR cs.del_flag_ = 0 )
-			AND ( cs.new_course_id_ IS NULL OR cs.new_course_id_ = cs.id_ )
-			AND cs.type_ IN ( 'SINGLE', 'TRAINING_SINGLE' )
-			AND cgtm.teacher_role_ = 'BISHOP'
-			AND cgsm.status_='NORMAL'
-			<if test="musicGroupId!=null and musicGroupId!=''">
-				AND cssp.music_group_id_ = #{musicGroupId}
-			</if>
-		  	<if test="studentIds!=null and studentIds.size()>0">
-				AND cssp.user_id_ IN
-				<foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
-					#{studentId}
-				</foreach>
-			</if>
-	</select>
 </mapper>

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

@@ -153,7 +153,7 @@
         LEFT JOIN organization o ON o.id_=ii.organ_id_
         LEFT JOIN sys_user su ON su.id_ = ii.user_id_
         <include refid="queryPageSql"/>
-        ORDER BY ii.id_
+        ORDER BY i.month_ DESC ,ii.id_ DESC
         <include refid="global.limit"/>
     </select>
 

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

@@ -73,7 +73,7 @@
         LEFT JOIN organization o ON o.id_=i.organ_id_
         LEFT JOIN sys_user su ON su.id_ = i.user_id_
         <include refid="queryPageSql"/>
-        ORDER BY i.id_
+            ORDER BY i.month_ DESC, i.id_ DESC
         <include refid="global.limit"/>
     </select>
 

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

@@ -707,7 +707,8 @@
     </select>
 
     <select id="getUserGroups" resultMap="UserGroupDto">
-        SELECT DISTINCT sr.user_id_, mg.id_ group_id_, mg.name_ group_name_ FROM student_registration sr
+        SELECT DISTINCT sr.user_id_, mg.id_ group_id_, mg.name_ group_name_
+        FROM student_registration sr
         LEFT JOIN music_group mg ON sr.music_group_id_=mg.id_
         WHERE sr.payment_status_=2 AND sr.user_id_ IN
         <foreach collection="userIds" item="userId" open="(" close=")" separator=",">

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

@@ -182,7 +182,7 @@
         </foreach>
     </select>
     <select id="getTeacherVisitCount" resultType="com.ym.mec.biz.dal.dto.TeacherVisitDto">
-        SELECT teacher_id_ teacherId,date_format(visit_time_, '%Y-%m') month, COUNT(*) num
+        SELECT organ_id_ organId, teacher_id_ teacherId,date_format(visit_time_, '%Y-%m') month, COUNT(*) num
         FROM student_visit
         WHERE teacher_id_ IN
         <foreach collection="teacherIds" item="teacherId" open="(" close=")" separator=",">
@@ -191,6 +191,6 @@
         AND visit_time_ >= #{startTime}
         <![CDATA[AND visit_time_ <= #{endTime}
         ]]>
-        GROUP BY teacher_id_,date_format(visit_time_, '%Y-%m')
+        GROUP BY organ_id_, teacher_id_,date_format(visit_time_, '%Y-%m')
     </select>
 </mapper>

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

@@ -2,6 +2,7 @@ package com.ym.mec.web.controller;
 
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.ClassGroupDao;
 import com.ym.mec.biz.dal.dao.EmployeeDao;
 import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.dto.ClassDateAdjustDto;
@@ -10,6 +11,7 @@ import com.ym.mec.biz.dal.dto.VipGroupApplyDto;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.entity.StudentApplyRefunds.StudentApplyRefundsStatus;
 import com.ym.mec.biz.dal.enums.AuditStatusEnum;
+import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 import com.ym.mec.biz.dal.enums.VipGroupStatusEnum;
 import com.ym.mec.biz.dal.page.VipGroupAttendanceQueryInfo;
 import com.ym.mec.biz.dal.page.VipGroupQueryInfo;
@@ -51,6 +53,8 @@ public class VipGroupManageController extends BaseController {
     private TeacherDao teacherDao;
     @Autowired
     private EmployeeDao employeeDao;
+    @Autowired
+    private ClassGroupDao classGroupDao;
 
     @Autowired
     private StudentApplyRefundsService studentApplyRefundsService;
@@ -70,8 +74,8 @@ public class VipGroupManageController extends BaseController {
     @PostMapping("/update")
     @PreAuthorize("@pcs.hasPermissions('vipGroupManage/update')")
     public HttpResponseResult update(VipGroup vipGroup){
+        VipGroup oldVipGroup = vipGroupService.get(vipGroup.getId());
         if(Objects.nonNull(vipGroup.getCoursesExpireDate())){
-            VipGroup oldVipGroup = vipGroupService.get(vipGroup.getId());
             if(Objects.isNull(oldVipGroup)){
                 throw new BizException("此课程组不存在");
             }
@@ -79,6 +83,18 @@ public class VipGroupManageController extends BaseController {
                 throw new BizException("此课程组状态暂不支持修改");
             }
         }
+        if(Objects.isNull(oldVipGroup.getVipGroupActivityId())){
+            if(VipGroupStatusEnum.PROGRESS.equals(vipGroup.getStatus())&&oldVipGroup.getStatus().getCode()>VipGroupStatusEnum.PROGRESS.getCode()){
+                throw new BizException("此课程组状态暂不支持修改");
+            }
+            ClassGroup classGroup = classGroupDao.findByMusicGroupAndType(oldVipGroup.getId().toString(), ClassGroupTypeEnum.VIP.getCode());
+            if(Objects.isNull(classGroup)){
+                throw new BizException("课程信息错误");
+            }
+            if(classGroup.getStudentNum()<3){
+                throw new BizException("班级任务尚未达到3人");
+            }
+        }
         vipGroupService.update(vipGroup);
         return succeed();
     }