liupeng 4 rokov pred
rodič
commit
c44e3e96c1

+ 43 - 38
code/sapparent/sapservice/src/main/java/org/fouram/mapper/SapCheckMapper.xml

@@ -79,76 +79,73 @@
 	<update id="updateWorkTime">
 		update sap_check_report a, sap_checkin_option b 
 		set a.workTime = b.workTime 
-		where a.userId = b.userId and a.workTime is null
+		where a.userId = b.userId and a.checkinDay >= #{startDay} and a.checkinDay &lt;= #{endDay}
 	</update>
 	
 	<update id="updateOffWorkTime">
 		update sap_check_report a, sap_checkin_option b 
 		set a.offWorkTime = b.offWorkTime 
-		where a.userId = b.userId and a.offWorkTime is null
+		where a.userId = b.userId and a.checkinDay >= #{startDay} and a.checkinDay &lt;= #{endDay}
 	</update>
 	
 	<update id="updateNoNeedOffwork">
 		update sap_check_report a, sap_checkin_option b 
 		set a.noNeedOffwork = b.noNeedOffwork 
-		where a.userId = b.userId and a.noNeedOffwork is null
+		where a.userId = b.userId and a.noNeedOffwork is null and a.checkinDay >= #{startDay} and a.checkinDay &lt;= #{endDay}
 	</update>
 	
 	<update id="updateNoNeedOffworkDefault">
-		update sap_check_report set noNeedOffwork = 0 where noNeedOffwork is null
+		update sap_check_report a
+		set a.noNeedOffwork = 0 
+		where a.noNeedOffwork is null and a.checkinDay >= #{startDay} and a.checkinDay &lt;= #{endDay}
 	</update>
 
 	<update id="updateCheckinNullException">
-		update sap_check_report set checkinException = '后台更新未打卡' where checkinDate is null
-			and checkinDay >= #{startDay} and checkinDay &lt;= #{endDay}
+		update sap_check_report a
+		set a.checkinException = '后台更新未打卡' 
+		where a.checkinDate is null and a.workTime is not null and a.checkinDay >= #{startDay} and a.checkinDay &lt;= #{endDay} 
 	</update>
 	
 	<update id="updateCheckoffNullException">
-		update sap_check_report set checkoffException = '后台更新未打卡' where checkoffDate is null
-			and checkinDay >= #{startDay} and checkinDay &lt;= #{endDay}
+		update sap_check_report a
+		set a.checkoffException = '后台更新未打卡' 
+		where a.checkoffDate is null and a.workTime is not null and checkinDay >= #{startDay} and checkinDay &lt;= #{endDay}
 	</update>
 
-	<update id="updateResultOk">
-		update sap_check_report set result = '正常' 
-		where id = #{id}
-	</update>
-	
 	<update id="updateBuKaDay">
 		update sap_check_report a, sap_approval_info b 
 		set a.bukaDay = b.`day`
-		where a.checkinDay = b.`day` and a.userId = b.userId 
-			and a.checkinDay >= #{startDay} and a.checkinDay &lt;= #{endDay}
+		where a.checkinDay = b.`day` and a.userId = b.userId and a.checkinDay >= #{startDay} and a.checkinDay &lt;= #{endDay}
 	</update>
 	
 	<update id="updateLeaveTime">
 		update sap_check_report a ,sap_employee_time f 
-		SET a.leaveCreatedTime = f.createdDateTime, 
-			a.leaveStartDate = f.startDate, a.leaveEndDate = f.endDate,
+		SET a.leaveCreatedTime = f.createdDateTime, a.leaveStartDate = f.startDate, a.leaveEndDate = f.endDate,
 			a.leaveDay = f.deductionQuantity, a.leaveComment =f.`comment`
 		where a.userId = f.userId and a.checkinDay >= f.startDate and a.checkinDay &lt;= f.endDate 
-			and f.approvalStatus = 'APPROVED' and f.delFlag=0 
-			and checkinDay >= #{startDay} and checkinDay &lt;= #{endDay}
+			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} 
+		update sap_check_report 
+		set hour = #{hour} 
 		where checkinDay >= #{startDay} and checkinDay &lt;= #{endDay}
 	</update>
 	
 	<update id="updateRealCheckinDate">
-		update sap_check_report
-		set realCheckinDate = (
+		update sap_check_report a
+		set a.realCheckinDate = (
 			case when checkinException not like '%未打卡' and checkinDate is not null then checkinDate
 				 when checkoutDate1 is not null and checkoutDate1 &lt; concat(checkinDay,' 13:00:00') then checkoutDate1
 				 else ''
 			end
 		)
-		where realCheckinDate is null
+		where a.checkinDay >= #{startDay} and a.checkinDay &lt;= #{endDay}
 	</update>
 	
 	<update id="updateRealCheckoffDate">
-		update sap_check_report
-		set realCheckoffDate = (
+		update sap_check_report a
+		set a.realCheckoffDate = (
 			case when noNeedOffwork = 1 then concat(checkinDay,' ',offWorkTime,':00')
 				 when checkoutDate2 is not null and checkoutDate2 > concat(checkinDay,' 12:00:00') then checkoutDate2
 				 when checkoutDate1 is not null and checkoutDate1 > concat(checkinDay,' 12:00:00') then checkoutDate1
@@ -156,16 +153,18 @@
 				 else ''
 			end
 		)
-		where realCheckoffDate is null
+		where a.checkinDay >= #{startDay} and a.checkinDay &lt;= #{endDay}
 	</update>
 	
 	<update id="updateCheckoffExceptionByNoNeedOffwork">
-		update sap_check_report set checkoffException = '' where noNeedOffwork = 1;
+		update sap_check_report 
+		set checkoffException = '' 
+		where noNeedOffwork = 1 and checkinDay >= #{startDay} and checkinDay &lt;= #{endDay}
 	</update>
 	
 	<update id="updateRealResultRemark">
-		update sap_check_report
-		set realResultRemark = concat((
+		update sap_check_report a
+		set a.realResultRemark = concat((
 			case when realCheckinDate = '' then '上班未打卡,' 
 				 when realCheckinDate != '' and left(realCheckinDate, 16) > concat(checkinDay,' ', workTime) then '迟到,'
 				 else ''
@@ -176,12 +175,12 @@
 				 else ''
 			end
 		))
-		where realResultRemark is null
+		where a.checkinDay >= #{startDay} and a.checkinDay &lt;= #{endDay} and a.workTime is not null
 	</update>
 	
 	<update id="updateRealResult">
-		update sap_check_report
-		set realResult = (
+		update sap_check_report a
+		set a.realResult = (
 			case when length(realResultRemark) = 0 then '正常'
 				 when leaveDay >= 1 or (leaveDay = 0.5 and (
 							(realCheckinDate != '' and left(realCheckinDate, 16) &lt;= concat(checkinDay,' ', workTime))
@@ -189,15 +188,19 @@
 							(realCheckoffDate != '' and left(realCheckoffDate, 16) >= concat(checkinDay,' ', offWorkTime))
 					)) then '已申请休假' else '异常' 
 			end)
-		where realResult is null
+		where a.checkinDay >= #{startDay} and a.checkinDay &lt;= #{endDay} 
 	</update>
 	
 	<update id="updateRealResultRemarkOK">
-		update sap_check_report set realResultRemark = '' where realResult = '正常'
+		update sap_check_report 
+		set realResultRemark = '' 
+		where realResult = '正常' and checkinDay >= #{startDay} and checkinDay &lt;= #{endDay}
 	</update>
 	
 	<update id="updateRealResultRemarkLeave">
-		update sap_check_report set realResultRemark = '已申请休假', realResult = '正常' where realResult = '已申请休假'
+		update sap_check_report 
+		set realResultRemark = '已申请休假', realResult = '正常' 
+		where realResult = '已申请休假' and checkinDay >= #{startDay} and checkinDay &lt;= #{endDay}
 	</update>
 	
 	<update id="updateWorkMins">
@@ -208,17 +211,19 @@
 				 else '' 
 			end
 		)
-		where workMins is null
+		where checkinDay >= #{startDay} and checkinDay &lt;= #{endDay}
 	</update>
 	
 	<update id="updateWorkMinsZero">
-		update sap_check_report set workMins = 0 where workMins &lt; 0
+		update sap_check_report 
+		set workMins = 0 
+		where workMins &lt; 0 and checkinDay >= #{startDay} and checkinDay &lt;= #{endDay}
 	</update>
 	
 	<update id="updateWorkHours">
 		update sap_check_report
 		set workHours = ROUND(workMins / 60, 1)
-		where workHours is null
+		where checkinDay >= #{startDay} and checkinDay &lt;= #{endDay}
 	</update>
 	
 	<select id="selectRepeatCheckin" resultType="SapCheck">

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

@@ -146,11 +146,11 @@ public class WxCheckService extends BaseService {
 		param.put("endDayT", endDay.replace("-", ""));
 		
 		// 更新打卡规则时间
-		update("SapCheckMapper.updateWorkTime", null);
-		update("SapCheckMapper.updateOffWorkTime", null);
+		update("SapCheckMapper.updateWorkTime", param);
+		update("SapCheckMapper.updateOffWorkTime", param);
 		// 更新noNeedOffwork
-		update("SapCheckMapper.updateNoNeedOffwork", null);
-		update("SapCheckMapper.updateNoNeedOffworkDefault", null);
+		update("SapCheckMapper.updateNoNeedOffwork", param);
+		update("SapCheckMapper.updateNoNeedOffworkDefault", param);
 		// 更新时间为空的为后台更新未打卡
 		update("SapCheckMapper.updateCheckinNullException", param);
 		update("SapCheckMapper.updateCheckoffNullException", param);
@@ -164,13 +164,13 @@ public class WxCheckService extends BaseService {
 		// 如“固定打卡”未打,“最早外出打卡时间”有则取“最早外出打卡时间”作为“上班时间”
 		// 如“固定打卡”or“最早外出打卡时间”都有则取“固定时间”作为“上班时间”
 		// “最早外出打卡时间”在“13:00”前才能作为“上班时间”
-		update("SapCheckMapper.updateRealCheckinDate", null);
+		update("SapCheckMapper.updateRealCheckinDate", param);
 		// 新增列:下班时间
 		// 如有“固定打卡时间”or“最晚外出打卡时间”则取“最晚外出打卡时间”作为“下班时间”
 		// “最晚外出打卡时间”在“12:00”后才能作为“下班时间”
-		update("SapCheckMapper.updateRealCheckoffDate", null);
+		update("SapCheckMapper.updateRealCheckoffDate", param);
 		// 不需要下班打卡更新异常字段
-		update("SapCheckMapper.updateCheckoffExceptionByNoNeedOffwork", null);
+		update("SapCheckMapper.updateCheckoffExceptionByNoNeedOffwork", param);
 		//异常信息提示
 		//1.列“上班打卡异常信息”
 		//a.当“上班时间”为空,列“上班打卡时间”置为空值(现在会显示打卡规则时间),提示“上班未打卡”