Browse Source

Merge remote-tracking branch 'origin/master'

周箭河 4 năm trước cách đây
mục cha
commit
7c133574c5

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

@@ -10,6 +10,7 @@ import org.apache.ibatis.annotations.Param;
 import org.apache.poi.ss.formula.functions.Index;
 
 import java.util.Collection;
+import java.util.Date;
 import java.util.List;
 import java.util.Set;
 
@@ -112,7 +113,7 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
     List<Long> queryApplyForQuitGroupNum(@Param("organIds") Set<Integer> organIds);
 
     List<Long> queryStudentAttendanceInfo(@Param("organIds") Set<Integer> organIds,
-                                   @Param("type") String type);
+                                          @Param("type") String type, @Param("firstDayOfMonth") Date firstDayOfMonth);
 
 
     /**
@@ -120,14 +121,14 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
      * @param organIds
      * @return
      */
-    List<Long> getAttendanceError(@Param("organIds") String organIds);
+    List<Long> getAttendanceError(@Param("organIds") String organIds, @Param("firstDayOfMonth") Date firstDayOfMonth);
 
     /**
      * 获取旷课考勤
      * @param organIds
      * @return
      */
-    List<Long> getNoAttendance(@Param("organIds") String organIds);
+    List<Long> getNoAttendance(@Param("organIds") String organIds, @Param("firstDayOfMonth") Date firstDayOfMonth);
 
     /**
      * 获取老师离职申请数

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

@@ -336,12 +336,15 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		two.setDesc(IndexErrorType.STUDENT_INFO.getMsg());
 		List<IndexErrInfoDto> twoChild = new ArrayList<>();
 
+
+		Date firstDayOfMonth = DateUtil.getFirstDayOfMonth(DateUtil.addMonths(date, -1));
+
 		twoChild.add(new IndexErrInfoDto(IndexErrorType.STUDENT_NOT_PAYMENT, IndexErrorType.STUDENT_NOT_PAYMENT.getMsg(), indexBaseMonthDataDao.countNoPaymentStudentNum(organIds), indexBaseMonthDataDao.getNoPaymentMusicGroup(organIds)));
 		List<Long> quitGroupNum = indexBaseMonthDataDao.queryApplyForQuitGroupNum(organIds);
 		twoChild.add(new IndexErrInfoDto(IndexErrorType.STUDENT_APPLY_FOR_QUIT_MUSIC_GROUP, IndexErrorType.STUDENT_APPLY_FOR_QUIT_MUSIC_GROUP.getMsg(), quitGroupNum.size(),  quitGroupNum));
-		List<Long> attendanceInfo = indexBaseMonthDataDao.queryStudentAttendanceInfo(organIds, StudentAttendanceStatusEnum.TRUANT.getCode());
+		List<Long> attendanceInfo = indexBaseMonthDataDao.queryStudentAttendanceInfo(organIds, StudentAttendanceStatusEnum.TRUANT.getCode(),firstDayOfMonth);
 		twoChild.add(new IndexErrInfoDto(IndexErrorType.COURSE_TRUANT_STUDENT_NUM, IndexErrorType.COURSE_TRUANT_STUDENT_NUM.getMsg(), attendanceInfo.size(), attendanceInfo));
-		List<Long> attendanceInfo1 = indexBaseMonthDataDao.queryStudentAttendanceInfo(organIds, StudentAttendanceStatusEnum.LEAVE.getCode());
+		List<Long> attendanceInfo1 = indexBaseMonthDataDao.queryStudentAttendanceInfo(organIds, StudentAttendanceStatusEnum.LEAVE.getCode(),null);
 		twoChild.add(new IndexErrInfoDto(IndexErrorType.COURSE_LEAVE_STUDENT_NUM, IndexErrorType.COURSE_LEAVE_STUDENT_NUM.getMsg(), attendanceInfo1.size(), attendanceInfo1));
 		two.setNum(twoChild.stream().mapToInt(IndexErrInfoDto::getNum).sum());
 		two.setResult(twoChild);
@@ -353,10 +356,10 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		three.setDesc(IndexErrorType.TEACHER_INFO.getMsg());
 		List<IndexErrInfoDto> threeChild = new ArrayList<>();
 
-		List<Long> attendanceError = indexBaseMonthDataDao.getAttendanceError(organIdsStr);
+		List<Long> attendanceError = indexBaseMonthDataDao.getAttendanceError(organIdsStr,firstDayOfMonth);
 		threeChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_EXCEPTION_ATTENDANCE, IndexErrorType.TEACHER_EXCEPTION_ATTENDANCE.getMsg(), attendanceError.size(), attendanceError));
 
-		List<Long> noAttendance = indexBaseMonthDataDao.getNoAttendance(organIdsStr);
+		List<Long> noAttendance = indexBaseMonthDataDao.getNoAttendance(organIdsStr,firstDayOfMonth);
 		threeChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_NOT_A_CLASS, IndexErrorType.TEACHER_NOT_A_CLASS.getMsg(), noAttendance.size(), noAttendance));
 
 		List<Long> teacherLeave = indexBaseMonthDataDao.queryTeacherLeave(organIdsStr);

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

@@ -102,6 +102,7 @@ import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.http.HttpUtil;
+import org.springframework.util.Assert;
 
 @Service
 public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> implements MusicGroupService {
@@ -1771,6 +1772,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
     public boolean approveQuitMusicGroup(Long id, ApprovalStatus status, String reason, boolean isRefundCourseFee, boolean isRefundInstrumentFee,
                                          boolean isRefundTeachingAssistantsFee) {
+
         MusicGroupQuit musicGroupQuit = musicGroupQuitDao.get(id);
         if (musicGroupQuit == null) {
             throw new BizException("数据不存在");

+ 40 - 39
mec-biz/src/main/resources/config/mybatis/IndexBaseMonthDataMapper.xml

@@ -439,50 +439,42 @@
 
 	<select id="countLessThenThreeClassGroupNum" resultType="int">
 		SELECT COUNT(t.id_) FROM (
-			SELECT
-			DISTINCT cg.id_
-			FROM
-			class_group cg
-			LEFT JOIN class_group_student_mapper cgsm ON cg.id_ = cgsm.class_group_id_
-			LEFT JOIN music_group mg ON cg.music_group_id_=mg.id_
-			WHERE
-			cg.type_ = 'HIGH'
-			AND mg.status_ = 'PROGRESS'
-			AND cgsm.status_ = 'NORMAL'
-			<if test="organIds!=null and organIds.size()>0">
-				AND mg.organ_id_ IN
-				<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
-					#{organId}
-				</foreach>
-			</if>
-			GROUP BY
-			cg.id_
-			HAVING
-			COUNT( DISTINCT cgsm.user_id_ )&lt;3
+		SELECT cg.id_ FROM
+		class_group cg
+		LEFT JOIN class_group_student_mapper cgsm ON cg.id_ = cgsm.class_group_id_
+		LEFT JOIN music_group mg ON cg.music_group_id_=mg.id_
+		WHERE
+		cg.type_ IN ('HIGH','HIGH_ONLINE')
+		AND mg.status_ = 'PROGRESS'
+		<if test="organIds!=null and organIds.size()>0">
+			AND mg.organ_id_ IN
+			<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
+				#{organId}
+			</foreach>
+		</if>
+		GROUP BY cg.id_
+		HAVING
+		COUNT(CASE WHEN cgsm.status_ = 'NORMAL' THEN 1 ELSE NULL END) &lt; 3
 		) t
 	</select>
 
     <select id="getLessThenThreeMusicGroup" resultType="java.lang.String">
-		SELECT
-			cg.music_group_id_
-		FROM
-			class_group cg
-			LEFT JOIN class_group_student_mapper cgsm ON cg.id_ = cgsm.class_group_id_
-			LEFT JOIN music_group mg ON cg.music_group_id_=mg.id_
+		SELECT cg.music_group_id_ FROM
+		class_group cg
+		LEFT JOIN class_group_student_mapper cgsm ON cg.id_ = cgsm.class_group_id_
+		LEFT JOIN music_group mg ON cg.music_group_id_=mg.id_
 		WHERE
-			cg.type_ = 'HIGH'
-		  	AND mg.status_ = 'PROGRESS'
-			AND cgsm.status_ = 'NORMAL'
-			<if test="organIds!=null and organIds.size()>0">
-				AND mg.organ_id_ IN
-				<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
-					#{organId}
-				</foreach>
-			</if>
-		GROUP BY
-			cg.id_
+		cg.type_ IN ('HIGH','HIGH_ONLINE')
+		AND mg.status_ = 'PROGRESS'
+		<if test="organIds!=null and organIds.size()>0">
+			AND mg.organ_id_ IN
+			<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
+				#{organId}
+			</foreach>
+		</if>
+		GROUP BY cg.id_
 		HAVING
-			COUNT( DISTINCT cgsm.user_id_ )&lt;3
+		COUNT(CASE WHEN cgsm.status_ = 'NORMAL' THEN 1 ELSE NULL END) &lt; 3
 	</select>
 
 	<select id="countNoPaymentStudentNum" resultType="int">
@@ -551,6 +543,9 @@
 			<if test="type!=null and type=='TRUANT'">
 				(sa.status_ = 'TRUANT' OR sa.id_ IS NULL)
 			</if>
+			<if test="firstDayOfMonth != null">
+				AND cs.class_date_ >= DATE_FORMAT(#{firstDayOfMonth},'%Y-%m-%d')
+			</if>
 			<if test="organIds!=null and organIds.size()>0">
 				AND cs.organ_id_ IN
 				<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
@@ -566,6 +561,9 @@
 		<if test="organIds != null and organIds != ''">
 			AND FIND_IN_SET(cs.organ_id_,#{organIds})
 		</if>
+		<if test="firstDayOfMonth != null">
+			AND cs.class_date_ >= DATE_FORMAT(#{firstDayOfMonth},'%Y-%m-%d')
+		</if>
 	</select>
 	<select id="getNoAttendance" resultType="java.lang.Long">
 		SELECT DISTINCT ta.id_ FROM teacher_attendance ta
@@ -574,6 +572,9 @@
 		<if test="organIds != null and organIds != ''">
 			AND FIND_IN_SET(cs.organ_id_,#{organIds})
 		</if>
+		<if test="firstDayOfMonth != null">
+			AND cs.class_date_ >= DATE_FORMAT(#{firstDayOfMonth},'%Y-%m-%d')
+		</if>
 	</select>
 	<select id="queryTeacherLeave" resultType="java.lang.Long">
 		SELECT DISTINCT tlr.id_ FROM teacher_leave_record tlr
@@ -614,7 +615,7 @@
 		</if>
 	</select>
 
-    <select id="queryErrInspection" resultType="int">
+    <select id="queryErrInspection" resultType="java.lang.Long">
 		SELECT
 			id_
 		FROM

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

@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 
+import org.springframework.beans.factory.FactoryBean;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;