Browse Source

Merge branch '20210401' of http://git.dayaedu.com/yonge/mec

zouxuan 4 years ago
parent
commit
4cd5735c38

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

@@ -161,6 +161,13 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
 
 
     /**
+     * 课程时间安排异常
+     * @param organIds
+     * @return
+     */
+    int getCourseTimeError(@Param("organIds") Set<Integer> organIds);
+
+    /**
      * 获取考勤异常编号
      * @param organIds
      * @return

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/IndexErrorType.java

@@ -21,6 +21,8 @@ public enum IndexErrorType implements BaseEnum<String, IndexErrorType> {
     COURSE_LEAVE_STUDENT_NUM("COURSE_LEAVE_STUDENT_NUM", "学员请假"),
 
     TEACHER_INFO("TEACHER_INFO", "日常行政"),
+
+    COURSE_TIME_ERROR("COURSE_TIME_ERROR", "课程时间安排异常"),
     TEACHER_LEAVE("TEACHER_LEAVE", "老师请假"),
     TEACHER_EXPECT_SALARY_BE_LOW("TEACHER_EXPECT_SALARY_BE_LOW", "预计课酬较低"),
     INSPECTION_ITEM("INSPECTION_ITEM", "乐团巡查任务未计划"),

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

@@ -25,6 +25,12 @@ public interface OrganizationService extends BaseService<Integer, Organization>
     List<Organization> queryEmployeeOrgan() throws Exception;
 
     /**
+     * 获取员工坐在分部列表
+     * @return
+     */
+    List<Organization> queryEmployeeOrganByUser() throws Exception;
+
+    /**
      * 获取分部名称
      * @return
      */

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java

@@ -351,6 +351,10 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			if (!userRole.contains(SysUserRole.SECTION_MANAGER) && !sysUser.getIsSuperAdmin()) {
 				userId = sysUser.getId();
 			}
+
+			int courseTimeError = indexBaseMonthDataDao.getCourseTimeError(organIds);
+			threeChild.add(new IndexErrInfoDto(IndexErrorType.COURSE_TIME_ERROR, IndexErrorType.COURSE_TIME_ERROR.getMsg(), courseTimeError, null));
+
 			int inspectionItem = indexBaseMonthDataDao.queryInspectionItem(organIdsStr,startTime,userId);
 			threeChild.add(new IndexErrInfoDto(IndexErrorType.INSPECTION_ITEM, IndexErrorType.INSPECTION_ITEM.getMsg(),inspectionItem, null));
 
@@ -512,6 +516,12 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 
 		boolean flag4 = false;
 		if(!flag4){
+			int courseTimeError = indexBaseMonthDataDao.getCourseTimeError(organIds);
+			if(courseTimeError > 0){
+				flag4 = true;
+			}
+		}
+		if(!flag4){
 			int attendanceError = indexBaseMonthDataDao.getAttendanceError(organIds,startTime);
 			if(attendanceError > 0){
 				flag4 = true;

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

@@ -42,7 +42,7 @@ public class OrganizationServiceImpl extends BaseServiceImpl<Integer, Organizati
 	}
 
 	@Override
-	public List<Organization> queryEmployeeOrgan() throws Exception {
+	public List<Organization> queryEmployeeOrgan(){
 		SysUser sysUser = sysUserFeignService.queryUserInfo();
 		if(sysUser == null){
 			throw new BizException("获取用户信息失败");
@@ -52,6 +52,19 @@ public class OrganizationServiceImpl extends BaseServiceImpl<Integer, Organizati
 	}
 
 	@Override
+	public List<Organization> queryEmployeeOrganByUser(){
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		if(sysUser == null){
+			throw new BizException("获取用户信息失败");
+		}
+		Integer userId = sysUser.getId();
+		if(sysUser.getIsSuperAdmin()){
+			userId = null;
+		}
+		return organizationDao.queryEmployeeOrgan(userId);
+	}
+
+	@Override
 	public String getOrganName(String organId) {
 		return organizationDao.getOrganName(organId);
 	}

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

@@ -2428,10 +2428,10 @@
             left join teacher_attendance ta on ta.course_schedule_id_ = cs.id_
             <if test="searchType == 'ERR_ATTENDANCE'">
                 LEFT JOIN course_schedule_student_payment cssp ON cssp.course_schedule_id_ = cs.id_
-                LEFT JOIN student_attendance sa ON sa.course_schedule_id_ = cs.id_ AND cssp.user_id_ = sa.user_id_
             </if>
-            <if test="searchType != 'ERR_ATTENDANCE'">
-                LEFT JOIN student_attendance sa ON sa.course_schedule_id_ = cs.id_
+            LEFT JOIN student_attendance sa ON sa.course_schedule_id_ = cs.id_
+            <if test="searchType == 'ERR_ATTENDANCE'">
+                AND cssp.user_id_ = sa.user_id_
             </if>
             <include refid="endFindCourseSchedulesCondition"/>
         GROUP BY
@@ -2452,10 +2452,10 @@
         course_schedule cs
         <if test="searchType == 'ERR_ATTENDANCE'">
             LEFT JOIN course_schedule_student_payment cssp ON cssp.course_schedule_id_ = cs.id_
-            LEFT JOIN student_attendance sa ON sa.course_schedule_id_ = cs.id_ AND cssp.user_id_ = sa.user_id_
         </if>
-        <if test="searchType != 'ERR_ATTENDANCE'">
-            LEFT JOIN student_attendance sa ON sa.course_schedule_id_ = cs.id_
+        LEFT JOIN student_attendance sa ON sa.course_schedule_id_ = cs.id_
+        <if test="searchType == 'ERR_ATTENDANCE'">
+            AND cssp.user_id_ = sa.user_id_
         </if>
         LEFT JOIN teacher_attendance ta on ta.course_schedule_id_ = cs.id_
         LEFT JOIN course_schedule_teacher_salary csts ON csts.course_schedule_id_ = cs.id_
@@ -2590,6 +2590,10 @@
             AND cs.status_ = 'OVER' AND ta.sign_in_time_ IS NULL AND ta.sign_out_time_ IS NULL AND ta.dispose_content_ IS NULL
             AND (cs.new_course_id_ IS NULL OR cs.new_course_id_ = cs.id_)
         </if>
+        <if test="searchType == 'COURSE_TIME_ERROR'">
+            AND cs.status_ = 'NOT_START' AND cs.start_class_time_ &lt; '06:00:00'
+            AND (cs.new_course_id_ IS NULL OR cs.new_course_id_ = cs.id_)
+        </if>
     </sql>
     <select id="queryPracticeCourseScheduleIds" resultType="java.lang.Integer">
         SELECT cs.id_ FROM course_schedule cs

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

@@ -739,6 +739,17 @@
 				</foreach>
 			</if>
 	</select>
+    <select id="getCourseTimeError" resultType="int">
+		SELECT COUNT(cs.id_) FROM course_schedule cs
+		WHERE cs.status_ = 'NOT_START' AND cs.del_flag_ = 0 AND cs.start_class_time_ &lt; '06:00:00'
+		AND (cs.new_course_id_ IS NULL OR cs.new_course_id_=cs.id_)
+		<if test="organIds != null and organIds.size()>0">
+			AND cs.organ_id_ IN
+			<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
+				#{organId}
+			</foreach>
+		</if>
+	</select>
     <select id="getAttendanceError" resultType="int">
 		SELECT COUNT(DISTINCT c.id_) FROM (SELECT cs.id_ FROM course_schedule cs
 		LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = cs.id_

+ 7 - 0
mec-web/src/main/java/com/ym/mec/web/controller/OrganizationController.java

@@ -45,6 +45,13 @@ public class OrganizationController extends BaseController {
         return succeed(organizationService.queryEmployeeOrgan());
     }
 
+    @ApiOperation(value = "获取员工所在分部列表(管理员查看所有的分部)")
+    @GetMapping("/queryEmployeeOrganByUser")
+    @PreAuthorize("@pcs.hasPermissions('organization/queryEmployeeOrganByUser')")
+    public Object queryEmployeeOrganByUser() throws Exception {
+        return succeed(organizationService.queryEmployeeOrganByUser());
+    }
+
     @ApiOperation(value = "新增分部")
     @PostMapping("/add")
     @PreAuthorize("@pcs.hasPermissions('organization/add')")