liupeng %!s(int64=3) %!d(string=hai) anos
pai
achega
c2cd429934

+ 11 - 13
code/sapparent/sapservice/src/main/java/org/fouram/job/CheckTaskSchedule.java

@@ -45,10 +45,10 @@ public class CheckTaskSchedule {
 				LoggerUtil.info(DateUtil.getDay() + "执行结束:" + DateUtil.getTime());
 			}
 			// 重新执行最近30天
-			if (DateUtil.getHour().equals("02")) {
+			if (DateUtil.getHour().equals("11")) {
 				for (String day : DateUtil.getSubDateList(DateUtil.getAfterDay(-30), DateUtil.getDay())) {
 					LoggerUtil.info(day + "执行开始:" + DateUtil.getTime());
-					executeBiz(day);
+					reloadBiz(day);
 					LoggerUtil.info(day + "执行结束:" + DateUtil.getTime());
 				}
 			}
@@ -63,36 +63,34 @@ public class CheckTaskSchedule {
 		String startDay = checkinDay;
 		String endDay = checkinDay;
 		wxDepartService.saveWxDeparts();
-		LoggerUtil.info("saveWxDeparts:" + DateUtil.getTime());
 		wxUserService.saveWxUsers();
-		LoggerUtil.info("saveWxUsers:" + DateUtil.getTime());
 		sapUserService.saveOrUpdateSapUsers();
-		LoggerUtil.info("saveOrUpdateSapUsers:" + DateUtil.getTime());
 		wxUserService.updateAllSapUserId();
-		LoggerUtil.info("updateAllSapUserIds:" + DateUtil.getTime());
 		wxCheckService.saveCheckInOffOuts(startDay, endDay);
-		LoggerUtil.info("saveCheckInOffOuts:" + DateUtil.getTime());
 		// 判断打卡记录小于10条记录认为是假期
 		int checkInTotal = wxCheckService.queryCheckInTotal().intValue();
 		if (checkInTotal < 10) {
 			return;
 		}
 		sapCheckdateService.saveCheckdate(startDay);
-		LoggerUtil.info("saveCheckout:" + DateUtil.getTime());
 		employeeTimeService.saveEmployeeTimes();
-		LoggerUtil.info("saveEmployeeTimes:" + DateUtil.getTime());
 		wxCheckOptionService.saveOptions(endDay);
-		LoggerUtil.info("saveOptions:" + DateUtil.getTime());
 		wxApprovalInfoService.saveApprovalInfos(endDay.substring(0, 7));
-		LoggerUtil.info("saveApprovalInfos:" + DateUtil.getTime());
 		boolean specialCheckinDay = false;
 		// 判断小于50条为特殊日期,比如周六有的部分需要上班的,只针对他们生成打卡记录
 		if (checkInTotal < 50) {
 			specialCheckinDay = true;
 		}
 		wxCheckService.saveReportResultData(startDay, endDay, specialCheckinDay);
-		LoggerUtil.info("saveReportResultData:" + DateUtil.getTime());
 		wxCheckService.updateReportResultData(startDay, endDay);
-		LoggerUtil.info("updateReportResultData:" + DateUtil.getTime());
+	}
+	
+	@Transactional
+	public void reloadBiz(String checkinDay) throws Exception {
+		String startDay = checkinDay;
+		String endDay = checkinDay;
+		employeeTimeService.saveEmployeeTimes();
+		wxApprovalInfoService.saveApprovalInfos(endDay.substring(0, 7));
+		wxCheckService.updateReportResultData(startDay, endDay);
 	}
 }

+ 0 - 6
code/sapparent/sapservice/src/main/java/org/fouram/mapper/SapCheckMapper.xml

@@ -126,12 +126,6 @@
 			and f.approvalStatus = 'APPROVED' and f.delFlag=0 and a.checkinDay >= #{startDay} and a.checkinDay &lt;= #{endDay}
 	</update>
 	
-	<update id="updateAllHour">
-		update sap_check_report 
-		set hour = #{hour} 
-		where checkinDay >= #{startDay} and checkinDay &lt;= #{endDay}
-	</update>
-	
 	<update id="updateRealCheckinDate">
 		update sap_check_report a
 		set a.realCheckinDate = (

+ 22 - 13
code/sapparent/sapservice/src/main/java/org/fouram/service/WxCheckService.java

@@ -125,8 +125,16 @@ public class WxCheckService extends BaseService {
 		}
 	}
 
+	/**
+	 * 当天数据再次执行清空
+	 * @param startDay
+	 * @param endDay
+	 * @param specialCheckinDay
+	 * @throws Exception
+	 */
 	public void saveReportResultData(String startDay, String endDay, boolean specialCheckinDay) throws Exception {
 		Map<String, Object> param = Maps.newHashMap();
+		param.put("hour", "");
 		param.put("startDay", startDay);
 		param.put("endDay", endDay);
 		param.put("startDayT", startDay.replace("-", ""));
@@ -136,31 +144,32 @@ public class WxCheckService extends BaseService {
 		// 生成报表数据
 		update("SapCheckMapper.deleteCheckReport", param);
 		update("SapCheckMapper.saveCheckReport", param);
-	}
-
-	public void updateReportResultData(String startDay, String endDay) throws Exception {
-		Map<String, String> param = Maps.newHashMap();
-		param.put("hour", "");
-		param.put("startDay", startDay);
-		param.put("endDay", endDay);
-		param.put("startDayT", startDay.replace("-", ""));
-		param.put("endDayT", endDay.replace("-", ""));
-
+		
 		// 更新打卡规则时间
 		update("SapCheckMapper.updateWorkTime", param);
 		update("SapCheckMapper.updateOffWorkTime", param);
+		
 		// 更新noNeedOffwork
 		update("SapCheckMapper.updateNoNeedOffwork", param);
 		update("SapCheckMapper.updateNoNeedOffworkDefault", param);
+		
 		// 更新时间为空的为后台更新未打卡
 		update("SapCheckMapper.updateCheckinNullException", param);
 		update("SapCheckMapper.updateCheckoffNullException", param);
+	}
+
+	public void updateReportResultData(String startDay, String endDay) throws Exception {
+		Map<String, String> param = Maps.newHashMap();
+		param.put("hour", "");
+		param.put("startDay", startDay);
+		param.put("endDay", endDay);
+		param.put("startDayT", startDay.replace("-", ""));
+		param.put("endDayT", endDay.replace("-", ""));
+		
 		// 更新补卡日期
 		update("SapCheckMapper.updateBuKaDay", param);
-		// 查询请假日期
+		// 更新请假日期
 		update("SapCheckMapper.updateLeaveTime", param);
-		// 更新hour字段
-		update("SapCheckMapper.updateAllHour", param);
 		// 新增列:上班时间
 		// 如“固定打卡”未打,“最早外出打卡时间”有则取“最早外出打卡时间”作为“上班时间”
 		// 如“固定打卡”or“最早外出打卡时间”都有则取“固定时间”作为“上班时间”