diff --git a/src/com/engine/jucailinkq/attendance/attendanceanalysis/cmd/workovertime/GetOvertimeDurationCmd.java b/src/com/engine/jucailinkq/attendance/attendanceanalysis/cmd/workovertime/GetOvertimeDurationCmd.java index 73c93cb..6c614ab 100644 --- a/src/com/engine/jucailinkq/attendance/attendanceanalysis/cmd/workovertime/GetOvertimeDurationCmd.java +++ b/src/com/engine/jucailinkq/attendance/attendanceanalysis/cmd/workovertime/GetOvertimeDurationCmd.java @@ -309,13 +309,13 @@ public class GetOvertimeDurationCmd extends AbstractCommonCommand> simpleDetailList; if (ccMode.equals(AskAndEvctionWayEnum.TIME_INTERVAL.getKey()) && !"1".equals(dailyRepeat)) { - simpleDetailList = createDetailListWithNoDaily(ccEmpIdList, ccDateList, removeNonWorkDayRange, scheduleInfoMap, + simpleDetailList = createDetailListWithNoDaily(mainTableData,ccEmpIdList, ccDateList, removeNonWorkDayRange, scheduleInfoMap, restDayInfo, startDate, endDate, startTime, endTime, countBdlxList, hsdw, hsl, ccType, empIdToName, checkItemName, shiftInfoMap, empIdToDateRatedHours); } else { - simpleDetailList = createDetailList(ccEmpIdList, ccDateList, removeNonWorkDayRange, scheduleInfoMap, + simpleDetailList = createDetailList(mainTableData,ccEmpIdList, ccDateList, removeNonWorkDayRange, scheduleInfoMap, restDayInfo, ccMode, startTime, endTime, ccDuration, countBdlxList, hsdw, hsl, ccType, empIdToName, checkItemName, shiftInfoMap, empIdToDateRatedHours, cclxIdToHsdw); } @@ -614,11 +614,14 @@ public class BusinessTripsApplyServiceImpl extends Service implements BusinessTr * @param countBdlxList 收集需要统计时长的班段类型 * @return 组装初步的出差明细 */ - private List> createDetailList(List empIdList, List dateList, boolean removeNonWorkDayRange, Map>> scheduleInfoMap, + private List> createDetailList(Map mainTableData,List empIdList, List dateList, boolean removeNonWorkDayRange, Map>> scheduleInfoMap, Map> restDayInfo, String mode, String startTime, String endTime, String ccDuration, List countBdlxList, String hsdw, double hsl, String ccType, Map empIdToName, String checkItemName, Map> shiftInfoMap, Map> empIdToDateRatedHours, Map cclxIdToHsdw) { List> simpleDetailList = new ArrayList<>(); + String halfDayRangeSelect = Util.null2String((String)mainTableData.get("sxwxz")); + String startRange = Util.null2String((String)mainTableData.get("kssd")); + String endRange = Util.null2String((String)mainTableData.get("jssd")); Map simpleDetailItem; Map dateToRatedHours; String ccScHours = ""; @@ -656,6 +659,14 @@ public class BusinessTripsApplyServiceImpl extends Service implements BusinessTr if (mode.equals(AskAndEvctionWayEnum.TIME_INTERVAL.getKey())) { simpleDetailItem = new HashMap<>(); //组装初步的明细数据 + if (CheckBoxEnum.CHECKED.getKey().equals(halfDayRangeSelect)){ + String startFromBc = this.getTimePointFromBc(ccDate, (Map)shiftInfoMap.get(currentDayBcId), "start", startRange); + String endFromBc = this.getTimePointFromBc(ccDate, (Map)shiftInfoMap.get(currentDayBcId), "end", endRange); + if (!"".equals(startFromBc) && !"".equals(endFromBc)) { + startTime = startFromBc.split(" ")[1]; + endTime = endFromBc.split(" ")[1]; + } + } simpleDetailItem.put("ccr", ccEmpId); simpleDetailItem.put("cclx", ccType); simpleDetailItem.put("ccrName", ccEmpName); @@ -793,7 +804,7 @@ public class BusinessTripsApplyServiceImpl extends Service implements BusinessTr * @param countBdlxList 收集需要统计时长的班段类型 * @return 组装初步的出差明细,这边只处理“每天同时段出差”未勾选,且出差方式为“指定时间区间” */ - private List> createDetailListWithNoDaily(List empIdList, List dateList, boolean removeNonWorkDayRange, Map>> scheduleInfoMap, + private List> createDetailListWithNoDaily(Map mainTableData,List empIdList, List dateList, boolean removeNonWorkDayRange, Map>> scheduleInfoMap, Map> restDayInfo, String startDate, String endDate, String startTime, String endTime, List countBdlxList, String hsdw, double hsl, String ccType, Map empIdToName, String checkItemName, Map> shiftInfoMap, Map> empIdToDateRatedHours) { @@ -804,6 +815,9 @@ public class BusinessTripsApplyServiceImpl extends Service implements BusinessTr String targetDateBcId = ""; dateList.add(0, DateUtil.beforeDay(startDate,1)); dateList.add(DateUtil.AfterDay(endDate,1)); + String halfDayRangeSelect = Util.null2String((String)mainTableData.get("sxwxz")); + String startRange = Util.null2String((String)mainTableData.get("kssd")); + String endRange = Util.null2String((String)mainTableData.get("jssd")); Map dateToRatedHours; for (String ccEmpId : empIdList) { dateToRatedHours = new HashMap<>(); @@ -829,6 +843,16 @@ public class BusinessTripsApplyServiceImpl extends Service implements BusinessTr restDateList.addAll(restDateListFromSchedule); } String ccEmpName = empIdToName.get(ccEmpId); + if (CheckBoxEnum.CHECKED.getKey().equals(halfDayRangeSelect)){ + String startDayBcId = ((List)restDateList).contains(startDate) ? "" : Util.null2String((String)dateToBcxxMap.get(startDate)).split("-")[0]; + String date = ((List)restDateList).contains(endDate) ? "" : Util.null2String((String)dateToBcxxMap.get(endDate)).split("-")[0]; + String startFromBc = getTimePointFromBc(startDate, shiftInfoMap.get(startDayBcId), "start", startRange); + String endFromBc = getTimePointFromBc(endDate, (Map)shiftInfoMap.get(date), "end", endRange); if ("".equals(startFromBc) || "".equals(endFromBc)) { + continue; + } + startTime = startFromBc.split(" ")[1]; + endTime = endFromBc.split(" ")[1]; + } simpleDetailItem = new HashMap<>(); //组装初步的出差明细数据 simpleDetailItem.put("ccr", ccEmpId); @@ -871,4 +895,128 @@ public class BusinessTripsApplyServiceImpl extends Service implements BusinessTr } return simpleDetailList; } + + private String getTimePointFromBc(String leaveDate, Map shiftInfo, String pointType, String timeRange) { + String sql = "select id, bdlx, gsrq, kssj as dtkssj, jssj as dtjssj, edts, edxss from uf_jcl_kq_bcxx_dt1 where mainid = " + shiftInfo.get("id") + " and (bdlx=0 or bdlx=3) order by gsrq, kssj"; + List> bdData = DbTools.getSqlToList(sql); + if (bdData.size() == 0) { + return ""; + } + //根据半天规则,处理班段的上下半天数据 + String halfDayRuleValue = shiftInfo.get("btgz").toString(); + double ratedSc = Double.parseDouble(shiftInfo.get("edsc").toString()); + double totalSc = Double.parseDouble(shiftInfo.get("zgzsc").toString()); + String wholeBdStartTime = Utils.getkssjTime(bdData.get(0), leaveDate); + String wholeBdEndTime = Utils.getjssjTime(bdData.get(bdData.size() - 1), leaveDate); + String firstHalfEndTime = ""; + String secondHalfStartTime = ""; + //按班次设置 取固定时间 取总时长一半 取额定时长一半 + if (HalfDayRuleREnum.BY_CLASS_SET.getKey().equals(halfDayRuleValue)) { + //按班次设置,根据班段明细中的额定天数来推断半天时间段,累计额定天数达到0.5天的时间点为上午结束的时间点,之后开始的工作时段的时间点为下午开始的时间点 + double countDays = 0; + for (Map bdItem : bdData) { + if (countDays == 0.50) { + secondHalfStartTime = Utils.getkssjTime(bdItem, leaveDate); + break; + } + double itemEdts = Double.parseDouble(bdItem.get("edts").toString()); + if (countDays + itemEdts > 0.50) { + double multiple = (0.50 - countDays) / itemEdts; + String itemStartTime = Utils.getkssjTime(bdItem, leaveDate); + String itemEndTime = Utils.getjssjTime(bdItem, leaveDate); + int minutes = (int) (DateUtil.getBetWeenMinutes(itemStartTime, itemEndTime) * multiple); + firstHalfEndTime = DateUtil.AfterMinutes(itemStartTime, minutes); + secondHalfStartTime = firstHalfEndTime; + break; + } else if (countDays + itemEdts == 0.50) { + firstHalfEndTime = Utils.getjssjTime(bdItem, leaveDate); + } + countDays = countDays + itemEdts; + } + } else if (HalfDayRuleREnum.FIXED_DURATION.getKey().equals(halfDayRuleValue)) { + //取固定时间,根据“分隔时间点”字段fgsjd来指定上午和下午分割的时间点 + String segmentTime = shiftInfo.get("fgsjd").toString(); + segmentTime = getSegmentTime(segmentTime, wholeBdStartTime, wholeBdEndTime); + if (segmentTime.equals("")) { + return ""; + } + firstHalfEndTime = segmentTime; + secondHalfStartTime = segmentTime; + } else if (HalfDayRuleREnum.HALF_TOTAL_DURATION.getKey().equals(halfDayRuleValue)) { + //取总时长一半,根据工作总时长的一半小时数,来确定半天小时数,累加班段明细的额定时长达到半天小时数的时间点为上午结束时间点 + double countHours = 0; + for (Map bdItem : bdData) { + if (countHours == totalSc / 2) { + secondHalfStartTime = Utils.getkssjTime(bdItem, leaveDate); + break; + } + double itemEdxss = Double.parseDouble(bdItem.get("edxss").toString()); + if (countHours + itemEdxss > totalSc / 2) { + String itemStartTime = Utils.getkssjTime(bdItem, leaveDate); + int diffMinutes = (int) ((totalSc / 2 - countHours) * 60); + firstHalfEndTime = DateUtil.AfterMinutes(itemStartTime, diffMinutes); + secondHalfStartTime = firstHalfEndTime; + break; + } else if (countHours + itemEdxss == totalSc / 2) { + firstHalfEndTime = Utils.getjssjTime(bdItem, leaveDate); + } + countHours = countHours + itemEdxss; + } + } else if (HalfDayRuleREnum.HALF_RATED_DURATION.getKey().equals(halfDayRuleValue)) { + //取额定时长一半,根据主表额定时长的一半小时数,来确定半天小时数,累加班段明细的额定时长达到半天小时数的时间点为上午结束时间点 + double countHours = 0; + for (Map bdItem : bdData) { + if (countHours == ratedSc / 2) { + secondHalfStartTime = Utils.getkssjTime(bdItem, leaveDate); + break; + } + double itemEdxss = Double.parseDouble(bdItem.get("edxss").toString()); + if (countHours + itemEdxss > ratedSc / 2) { + String itemStartTime = Utils.getkssjTime(bdItem, leaveDate); + int diffMinutes = (int) ((ratedSc / 2 - countHours) * 60); + firstHalfEndTime = DateUtil.AfterMinutes(itemStartTime, diffMinutes); + secondHalfStartTime = firstHalfEndTime; + break; + } else if (countHours + itemEdxss == ratedSc / 2) { + firstHalfEndTime = Utils.getjssjTime(bdItem, leaveDate); + } + countHours = countHours + itemEdxss; + } + } + + if ("0".equals(timeRange)) { + return "start".equals(pointType) ? wholeBdStartTime : firstHalfEndTime; + } else if ("1".equals(timeRange)) { + return "start".equals(pointType) ? secondHalfStartTime : wholeBdEndTime; + } else { + return ""; + } + } + + private String getSegmentTime(String segmentTime, String wholeBdStartTime, String wholeBdEndTime) { + String startDate = wholeBdStartTime.split(" ")[0]; + String endDate = wholeBdEndTime.split(" ")[0]; + String startPoint = wholeBdStartTime.split(" ")[1]; + String endPoint = wholeBdEndTime.split(" ")[1]; + if (startDate.equals(endDate)) { + if (segmentTime.compareTo(startPoint) > 0 && segmentTime.compareTo(endPoint) < 0) { + segmentTime = startDate + " " + segmentTime; + return segmentTime; + } else { + return ""; + } + } + String waitJudgeSegTime = ""; + int waitCompareMinutes = 9999; + for (int i = 0; i < 3; i++) { + String matchSegTime = DateUtil.AfterDay(startDate,i) + " " + segmentTime; + if (matchSegTime.compareTo(wholeBdStartTime) > 0 && matchSegTime.compareTo(wholeBdEndTime) < 0) { + int diffMinutes = Math.abs(DateUtil.getBetWeenMinutes(wholeBdStartTime, matchSegTime) - DateUtil.getBetWeenMinutes(matchSegTime, wholeBdEndTime)); + waitCompareMinutes = Math.min(waitCompareMinutes, diffMinutes); + waitJudgeSegTime = waitCompareMinutes == diffMinutes ? matchSegTime : waitJudgeSegTime; + } + } + return waitJudgeSegTime; + } + } diff --git a/src/com/engine/jucailinkq/common/cmd/CleanHaveLeaveUserDataCmd.java b/src/com/engine/jucailinkq/common/cmd/CleanHaveLeaveUserDataCmd.java index f14f152..f23d088 100644 --- a/src/com/engine/jucailinkq/common/cmd/CleanHaveLeaveUserDataCmd.java +++ b/src/com/engine/jucailinkq/common/cmd/CleanHaveLeaveUserDataCmd.java @@ -59,6 +59,8 @@ public class CleanHaveLeaveUserDataCmd extends AbstractCommonCommand0){ + DbTools.update(updateSql,user,startDate,endDate); } if (!"".equals(terminationDate) && DateUtil.getTime(terminationDate).compareTo(DateUtil.getTime(endDate)) <= 0 && DateUtil.getTime(terminationDate).compareTo(DateUtil.getTime(startDate)) >= 0) { @@ -70,6 +72,8 @@ public class CleanHaveLeaveUserDataCmd extends AbstractCommonCommand + + + + + + + diff --git a/workflow/request/hrmattendance/HrmjucailCheckAgain_e9.jsp b/workflow/request/hrmattendance/HrmjucailCheckAgain_e9.jsp index 24edbe8..cef6b28 100644 --- a/workflow/request/hrmattendance/HrmjucailCheckAgain_e9.jsp +++ b/workflow/request/hrmattendance/HrmjucailCheckAgain_e9.jsp @@ -6,41 +6,102 @@ diff --git a/workflow/request/hrmattendance/HrmjucailWorkOvertimePlan_e9.jsp b/workflow/request/hrmattendance/HrmjucailWorkOvertimePlan_e9.jsp index 95da958..141323e 100644 --- a/workflow/request/hrmattendance/HrmjucailWorkOvertimePlan_e9.jsp +++ b/workflow/request/hrmattendance/HrmjucailWorkOvertimePlan_e9.jsp @@ -122,6 +122,12 @@ } }else { let errorData = res.data.errorInfo; + WfForm.changeFieldValue(WfForm.convertFieldNameToId("jbsc", "detail_1")+"_"+rowindex, { + value: '' + }); + WfForm.changeFieldValue(WfForm.convertFieldNameToId("gsrq", "detail_1")+"_"+rowindex, { + value: WfForm.getFieldValue(WfForm.convertFieldNameToId("ksrq","detail_1")+"_"+rowindex) + }); if (errorData.length >0){ WfForm.showMessage(errorData[0], 2, 10);