Kaynağa Gözat

Merge remote-tracking branch 'origin/master'

周箭河 4 yıl önce
ebeveyn
işleme
1999cdd662

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

@@ -266,11 +266,4 @@ public interface TeacherAttendanceDao extends BaseDAO<Long, TeacherAttendance> {
      * @return java.lang.Long
      */
 	Long findFirstSign(@Param("currentScheduleId") Long currentScheduleId, @Param("userId") Integer userId);
-
-	/**
-	 * 获取指定天数之后还没有审批的考勤申述列表
-	 * @param affirmDay
-	 * @return
-	 */
-	List<TeacherAttendance> queryAttendanceComplaintsAutoAffirmList(@Param("affirmDay") String affirmDay);
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentAttendanceQueryInfo.java

@@ -50,6 +50,9 @@ public class StudentAttendanceQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "课程结束时间")
     private Date endDateOfCourse;
 
+    @ApiModelProperty(value = "分部")
+    private String organId;
+
     public Long getCourseScheduleId() {
         return courseScheduleId;
     }
@@ -145,4 +148,12 @@ public class StudentAttendanceQueryInfo extends QueryInfo {
 	public void setEndDateOfCourse(Date endDateOfCourse) {
 		this.endDateOfCourse = endDateOfCourse;
 	}
+
+	public String getOrganId() {
+		return organId;
+	}
+
+	public void setOrganId(String organId) {
+		this.organId = organId;
+	}
 }

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

@@ -186,10 +186,4 @@ public interface TeacherAttendanceService extends BaseService<Long, TeacherAtten
 	 * @param teacherAttendanceId
 	 */
 	void rejectTeacherAttendanceComplaints(long teacherAttendanceId,String content);
-
-	/**
-	 * @author zouxuan
-	 * 考勤申述7天未处理默认同意
-	 */
-	void attendanceComplaintsAutoAffirmTask();
 }

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

@@ -4,6 +4,7 @@ import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.NON_P
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -277,6 +278,13 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 			throw new BizException("当前缴费状态不能添加学生");
 		}
 		
+		//判断学生是否已存在
+		Set<Integer> userList = musicGroupPaymentCalenderDetailDao.queryStudentIds(musicGroupPaymentCalenderId);
+
+		if(Collections.disjoint(userList, userIdList) == false){
+			throw new BizException("操作失败:包含已存在的学员");
+		}
+		
 		List<MusicGroupPaymentCalenderCourseSettings> courseSettingsList = musicGroupPaymentCalenderCourseSettingsDao.getWithPaymentCalender(musicGroupPaymentCalenderId);
 		
 		BigDecimal totalPrice = new BigDecimal(0);
@@ -356,6 +364,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 	}
 
 	@Override
+	@Transactional(rollbackFor = Exception.class)
 	public void batchAdd(String batchNo, List<Integer> userIdList) {
 		
 		List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList = musicGroupPaymentCalenderDao.findByBatchNo(batchNo);
@@ -376,6 +385,13 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 				throw new BizException("当前缴费状态不能添加学生");
 			}
 			
+			//判断学生是否已存在
+			Set<Integer> userList = musicGroupPaymentCalenderDetailDao.queryStudentIds(musicGroupPaymentCalenderId);
+
+			if(Collections.disjoint(userList, userIdList) == false){
+				throw new BizException("操作失败:包含已存在的学员");
+			}
+			
 			List<MusicGroupPaymentCalenderCourseSettings> courseSettingsList = musicGroupPaymentCalenderCourseSettingsDao.getWithPaymentCalender(musicGroupPaymentCalenderId);
 			
 			BigDecimal totalPrice = new BigDecimal(0);

+ 3 - 14
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherAttendanceServiceImpl.java

@@ -382,7 +382,9 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 			teacherAttendance.setSignInStatus(YesOrNoEnum.YES);
 			teacherAttendance.setCurrentClassTimes(classGroup.getCurrentClassTimes() + 1);
 			Date add1Minutes = DateUtil.addMinutes(classStartDateTime, -1);
-			if(yesOrNoEnum != YesOrNoEnum.YES && DateUtil.minutesBetween(date,add1Minutes) <= 0){
+			int secondsBetween = DateUtil.secondsBetween(date, add1Minutes);
+
+			if(yesOrNoEnum != YesOrNoEnum.YES && secondsBetween <= 60){
 				teacherAttendance.setSignInStatus(YesOrNoEnum.NO);
 			}
 			teacherAttendanceDao.update(teacherAttendance);
@@ -826,17 +828,4 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 			throw new BizException("操作失败: 当前申述状态不允许该操作");
 		}
 	}
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public void attendanceComplaintsAutoAffirmTask() {
-		String affirmDay = sysConfigDao.findConfigValue("attendance_complaints_auto_affirm_day");
-		if(StringUtils.isEmpty(affirmDay)){
-			affirmDay = "7";
-		}
-		List<TeacherAttendance> teacherAttendances = teacherAttendanceDao.queryAttendanceComplaintsAutoAffirmList(affirmDay);
-		teacherAttendances.forEach(e->{
-			agreeTeacherAttendanceComplaints(1,1,e.getId(),"系统自动审核通过");
-		});
-	}
 }

+ 10 - 4
mec-biz/src/main/resources/config/mybatis/StudentAttendanceMapper.xml

@@ -488,7 +488,7 @@
         su.username_,su.phone_,su.avatar_,cs.teach_mode_,cs.type_ course_type_,o.name_ organ_name_,tu.real_name_ teacher_name_,cs.name_ course_schedule_name_,cs.status_ course_status_,
         cs.actual_teacher_id_ teacher_id_,cs.class_date_ ,cs.start_class_time_,cs.end_class_time_ 
         FROM course_schedule_student_payment cssp left join course_schedule cs on cs.id_ = cssp.course_schedule_id_
-        left join student_attendance sa on cssp.course_schedule_id_ = sa.course_schedule_id_
+        left join student_attendance sa on cssp.course_schedule_id_ = sa.course_schedule_id_ and cssp.user_id_ = sa.user_id_
         LEFT JOIN sys_user su ON cssp.user_id_ = su.id_
         left join sys_user tu on tu.id_ = cs.actual_teacher_id_
         left join organization o on o.id_ = cs.organ_id_
@@ -497,7 +497,7 @@
         		cssp.course_schedule_id_ = #{courseScheduleId}
         	</if>
         	<if test="search != null">
-        		cssp.course_schedule_id_ = #{search}
+        		and cssp.course_schedule_id_ = #{search}
         	</if>
         	<if test="studentID != null">
         		and cssp.user_id_ = #{studentID}
@@ -526,6 +526,9 @@
         	<if test="musicGroupId != null">
         		and cssp.music_group_id_ = #{musicGroupId}
         	</if>
+            <if test="organId != null and organId != ''">
+                AND FIND_IN_SET(cs.organ_id_,#{organId})
+            </if>
         </where>
         ORDER BY cs.id_ DESC
         <include refid="global.limit"/>
@@ -534,13 +537,13 @@
     <select id="countStudentAttendance" resultType="java.lang.Integer">
         SELECT count(cssp.id_) 
         FROM course_schedule_student_payment cssp left join course_schedule cs on cs.id_ = cssp.course_schedule_id_
-        left join student_attendance sa on cssp.course_schedule_id_ = sa.course_schedule_id_
+        left join student_attendance sa on cssp.course_schedule_id_ = sa.course_schedule_id_ and cssp.user_id_ = sa.user_id_
         <where>
         	<if test="courseScheduleId != null">
         		cssp.course_schedule_id_ = #{courseScheduleId}
         	</if>
         	<if test="search != null">
-        		cssp.course_schedule_id_ = #{search}
+        		and cssp.course_schedule_id_ = #{search}
         	</if>
         	<if test="studentID != null">
         		and cssp.user_id_ = #{studentID}
@@ -569,6 +572,9 @@
         	<if test="musicGroupId != null">
         		and cssp.music_group_id_ = #{musicGroupId}
         	</if>
+            <if test="organId != null and organId != ''">
+                AND FIND_IN_SET(cs.organ_id_,#{organId})
+            </if>
         </where>
     </select>
     <select id="findByCourseId" resultMap="StudentAttendance">

+ 0 - 5
mec-biz/src/main/resources/config/mybatis/TeacherAttendanceMapper.xml

@@ -572,11 +572,6 @@
         WHERE ta.current_schedule_id_ = #{currentScheduleId} AND ta.teacher_id_ = #{userId}
         AND ta.sign_in_time_ IS NOT NULL ORDER BY ta.sign_in_time_ ASC LIMIT 1
     </select>
-    <select id="queryAttendanceComplaintsAutoAffirmList" resultMap="TeacherAttendance">
-        SELECT * FROM teacher_attendance
-        WHERE complaints_status_ = 2 AND TIMESTAMPDIFF(DAY,complaints_time_,NOW()) >= #{affirmDay}
-    </select>
-
     <update id="updateViPSignOutStatus" parameterType="string">
     	UPDATE teacher_attendance SET sign_out_status_ = 1,sign_out_time_= now()
     	WHERE FIND_IN_SET(course_schedule_id_,#{courseScheduleIdList}) AND sign_in_status_ = 1

+ 0 - 4
mec-client-api/src/main/java/com/ym/mec/task/TaskRemoteService.java

@@ -13,10 +13,6 @@ public interface TaskRemoteService {
 	// 教师异常考勤推送
 	public void pushTeacherExceptionAttendanceTask();
 
-	@GetMapping(value = "task/attendanceComplaintsAutoAffirmTask")
-	// 考勤申述7天未处理默认同意
-	public void attendanceComplaintsAutoAffirmTask();
-
 	@GetMapping(value = "task/updateMusicGroupStudentFeeStatus")
 	// 更新学员缴费状态(新)
 	public void updateMusicGroupStudentFeeStatus();

+ 0 - 5
mec-client-api/src/main/java/com/ym/mec/task/fallback/TaskRemoteServiceFallback.java

@@ -157,11 +157,6 @@ public class TaskRemoteServiceFallback implements TaskRemoteService {
 	}
 
 	@Override
-	public void attendanceComplaintsAutoAffirmTask() {
-		logger.info("考勤申述系统自动处理");
-	}
-
-	@Override
 	public void updateMusicGroupStudentFeeStatus() {
 		logger.info("更新乐团学员缴费状态失败");
 	}

+ 0 - 19
mec-task/src/main/java/com/ym/mec/task/jobs/AttendanceComplaintsAutoAffirmTask.java

@@ -1,19 +0,0 @@
-package com.ym.mec.task.jobs;
-
-import com.ym.mec.task.TaskRemoteService;
-import com.ym.mec.task.core.BaseTask;
-import com.ym.mec.task.core.TaskException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-@Service
-public class AttendanceComplaintsAutoAffirmTask extends BaseTask {
-
-	@Autowired
-	private TaskRemoteService taskRemoteService;
-
-	@Override
-	public void execute() throws TaskException {
-		taskRemoteService.attendanceComplaintsAutoAffirmTask();
-	}
-}

+ 17 - 9
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/message/provider/JiguangPushPlugin.java

@@ -32,10 +32,10 @@ public class JiguangPushPlugin implements MessageSenderPlugin, InitializingBean
 	@Value("${push.jiguang.masterSecret.teacher}")
 	private String teacherMasterSecret;
 
-	@Value("${push.jiguang.appKey.system}")
-	private String systemAppKey;
-	@Value("${push.jiguang.masterSecret.system}")
-	private String systemMasterSecret;
+	@Value("${push.jiguang.appKey.edu}")
+	private String eduAppKey;
+	@Value("${push.jiguang.masterSecret.edu}")
+	private String eduMasterSecret;
 
 	@Value("${push.jiguang.apns_production:false}")
 	private boolean apns_production = true; // 推送环境 True 表示推送生产环境,False 表示要推送开发环境
@@ -127,7 +127,7 @@ public class JiguangPushPlugin implements MessageSenderPlugin, InitializingBean
 				base64_auth_string = encryptBASE64(this.teacherAppKey + ":" + this.teacherMasterSecret);
 				break;
 			default:
-				base64_auth_string = encryptBASE64(this.systemAppKey + ":" + this.systemMasterSecret);
+				base64_auth_string = encryptBASE64(this.eduAppKey + ":" + this.eduMasterSecret);
 				break;
 		}
 		String authorization = "Basic " + base64_auth_string;
@@ -215,12 +215,20 @@ public class JiguangPushPlugin implements MessageSenderPlugin, InitializingBean
 		this.teacherMasterSecret = teacherMasterSecret;
 	}
 
-	public void setSystemAppKey(String systemAppKey) {
-		this.systemAppKey = systemAppKey;
+	public String getEduAppKey() {
+		return eduAppKey;
 	}
 
-	public void setSystemMasterSecret(String systemMasterSecret) {
-		this.systemMasterSecret = systemMasterSecret;
+	public void setEduAppKey(String eduAppKey) {
+		this.eduAppKey = eduAppKey;
+	}
+
+	public String getEduMasterSecret() {
+		return eduMasterSecret;
+	}
+
+	public void setEduMasterSecret(String eduMasterSecret) {
+		this.eduMasterSecret = eduMasterSecret;
 	}
 
 	public void setApns_production(boolean apns_production) {

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

@@ -88,12 +88,6 @@ public class TaskController extends BaseController {
 		studentGoodsSellService.affirmReceive(null);
 	}
 
-	@GetMapping(value = "/attendanceComplaintsAutoAffirmTask")
-	// 考勤申述7天未处理默认同意
-	public void attendanceComplaintsAutoAffirmTask(){
-		teacherAttendanceService.attendanceComplaintsAutoAffirmTask();
-	}
-
 	@GetMapping(value = "/repertoryWarn")
 	// 商品库存预警
 	public void repertoryWarn(){

+ 29 - 0
mec-web/src/main/java/com/ym/mec/web/controller/student/StudentAttendanceController.java

@@ -1,8 +1,12 @@
 package com.ym.mec.web.controller.student;
 
+import java.util.Arrays;
+import java.util.List;
+
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -11,7 +15,11 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.EmployeeDao;
 import com.ym.mec.biz.dal.dto.StudentAttendanceDto;
+import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.page.CourseScheduleQueryInfo;
 import com.ym.mec.biz.dal.page.StudentAttendanceQueryInfo;
 import com.ym.mec.biz.service.ClassGroupService;
@@ -28,6 +36,10 @@ public class StudentAttendanceController extends BaseController {
     private StudentAttendanceService studentAttendanceService;
     @Autowired
     private ClassGroupService classGroupService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private EmployeeDao employeeDao;
 
     //修复逻辑:是连堂课,有签退记录,某个月,遍历有学员签到记录的每节课
     @GetMapping("/repairStudentAttendance")
@@ -55,6 +67,23 @@ public class StudentAttendanceController extends BaseController {
     @GetMapping("/findStudentAttendance")
     @PreAuthorize("@pcs.hasPermissions('studentAttendance/findStudentAttendance')")
     public Object findStudentAttendance(StudentAttendanceQueryInfo queryInfo){
+    	SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        if(!sysUser.getIsSuperAdmin()){
+            Employee employee = employeeDao.get(sysUser.getId());
+            if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+                queryInfo.setOrganId(employee.getOrganIdList());
+            }else if(StringUtils.isEmpty(employee.getOrganIdList())){
+                return failed("用户所在分部异常");
+            }else {
+                List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+                if(!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))){
+                    return failed("非法请求");
+                }
+            }
+        }
         return succeed(studentAttendanceService.findStudentAttendance(queryInfo));
     }