diff --git a/src/com/engine/attendance/attendanceanalysis/cmd/item/AbsenteeismItemCmd.java b/src/com/engine/attendance/attendanceanalysis/cmd/item/AbsenteeismItemCmd.java index e729f88..522f478 100644 --- a/src/com/engine/attendance/attendanceanalysis/cmd/item/AbsenteeismItemCmd.java +++ b/src/com/engine/attendance/attendanceanalysis/cmd/item/AbsenteeismItemCmd.java @@ -45,9 +45,9 @@ public class AbsenteeismItemCmd extends AbstractCommonCommand //最大核算分钟数(包含) int zdhsl = Util.null2String(e.get("zdhsl")).equals("")?0:Util.getIntValue(Util.null2String(e.get("zdhsl"))); - if(AttendanceItemTypeEnum.ABSENTEESIM.getKey().equals(xmlx) && (zysd.contains(workfor) || WorkForTimeEnum.ALL_TIME.getKey().equals(zysd)) && time > zxhsl && time<=zdhsl) { + if(AttendanceItemTypeEnum.ABSENTEESIM.getKey().equals(xmlx) && (zysd.contains(workfor) || zysd.contains(WorkForTimeEnum.ALL_TIME.getKey())) && time > zxhsl && time<=zdhsl) { return true; - }else if (AttendanceItemTypeEnum.ABSENTEESIM.getKey().equals(xmlx) && (zysd.contains(workfor) || WorkForTimeEnum.ALL_TIME.getKey().equals(zysd)) && zxhsl==0 && zdhsl==0){ + }else if (AttendanceItemTypeEnum.ABSENTEESIM.getKey().equals(xmlx) && (zysd.contains(workfor) || zysd.contains(WorkForTimeEnum.ALL_TIME.getKey())) && zxhsl==0 && zdhsl==0){ return true; }else { return false; diff --git a/src/com/engine/attendance/attendanceanalysis/cmd/item/BeAwayItemCmd.java b/src/com/engine/attendance/attendanceanalysis/cmd/item/BeAwayItemCmd.java index 3e016f6..f792468 100644 --- a/src/com/engine/attendance/attendanceanalysis/cmd/item/BeAwayItemCmd.java +++ b/src/com/engine/attendance/attendanceanalysis/cmd/item/BeAwayItemCmd.java @@ -40,7 +40,7 @@ public class BeAwayItemCmd extends AbstractCommonCommand> { //作用时段 String zysd = Util.null2String(e.get("zysd")); - if(AttendanceItemTypeEnum.EVECTION.getKey().equals(xmlx) && (zysd.contains(workfor) || WorkForTimeEnum.ALL_TIME.getKey().equals(zysd))) { + if(AttendanceItemTypeEnum.EVECTION.getKey().equals(xmlx) && (zysd.contains(workfor) || zysd.contains(WorkForTimeEnum.ALL_TIME.getKey()))) { return true; }else { return false; diff --git a/src/com/engine/attendance/attendanceanalysis/cmd/item/BeLateItemCmd.java b/src/com/engine/attendance/attendanceanalysis/cmd/item/BeLateItemCmd.java index 7a83362..ae8d462 100644 --- a/src/com/engine/attendance/attendanceanalysis/cmd/item/BeLateItemCmd.java +++ b/src/com/engine/attendance/attendanceanalysis/cmd/item/BeLateItemCmd.java @@ -45,7 +45,7 @@ public class BeLateItemCmd extends AbstractCommonCommand> { //最大核算分钟数(包含) int zdhsl = Util.null2String(e.get("zdhsl")).equals("")?0:Util.getIntValue(Util.null2String(e.get("zdhsl"))); - if(AttendanceItemTypeEnum.LATE.getKey().equals(xmlx) && (zysd.contains(workfor) || WorkForTimeEnum.ALL_TIME.getKey().equals(zysd)) && time > zxhsl && time<=zdhsl) { + if(AttendanceItemTypeEnum.LATE.getKey().equals(xmlx) && (zysd.contains(workfor) || zysd.contains(WorkForTimeEnum.ALL_TIME.getKey())) && time > zxhsl && time<=zdhsl) { return true; }else { return false; diff --git a/src/com/engine/attendance/attendanceanalysis/cmd/item/LeaveEarlyItemCmd.java b/src/com/engine/attendance/attendanceanalysis/cmd/item/LeaveEarlyItemCmd.java index b1a6c19..6bffbbd 100644 --- a/src/com/engine/attendance/attendanceanalysis/cmd/item/LeaveEarlyItemCmd.java +++ b/src/com/engine/attendance/attendanceanalysis/cmd/item/LeaveEarlyItemCmd.java @@ -46,7 +46,7 @@ public class LeaveEarlyItemCmd extends AbstractCommonCommand> //最大核算分钟数(包含) int zdhsl = Util.null2String(e.get("zdhsl")).equals("")?0:Util.getIntValue(Util.null2String(e.get("zdhsl"))); - if(AttendanceItemTypeEnum.LEAVE_EARLY.getKey().equals(xmlx) && (zysd.contains(workfor) || WorkForTimeEnum.ALL_TIME.getKey().equals(zysd)) && time > zxhsl && time<=zdhsl) { + if(AttendanceItemTypeEnum.LEAVE_EARLY.getKey().equals(xmlx) && (zysd.contains(workfor) || zysd.contains(WorkForTimeEnum.ALL_TIME.getKey())) && time > zxhsl && time<=zdhsl) { return true; }else { return false; diff --git a/src/com/engine/attendance/attendanceanalysis/cmd/item/VacationItemCmd.java b/src/com/engine/attendance/attendanceanalysis/cmd/item/VacationItemCmd.java index 6c014d2..c2cba46 100644 --- a/src/com/engine/attendance/attendanceanalysis/cmd/item/VacationItemCmd.java +++ b/src/com/engine/attendance/attendanceanalysis/cmd/item/VacationItemCmd.java @@ -40,7 +40,7 @@ public class VacationItemCmd extends AbstractCommonCommand> { //作用时段 String zysd = Util.null2String(e.get("zysd")); - if(AttendanceItemTypeEnum.HOLIDAY.getKey().equals(xmlx) && (zysd.contains(workfor) || WorkForTimeEnum.ALL_TIME.getKey().equals(zysd))) { + if(AttendanceItemTypeEnum.HOLIDAY.getKey().equals(xmlx) && (zysd.contains(workfor) || zysd.contains(WorkForTimeEnum.ALL_TIME.getKey()))) { return true; }else { return false; diff --git a/src/com/engine/attendance/attendanceanalysis/cmd/item/WorkOvertimeItemCmd.java b/src/com/engine/attendance/attendanceanalysis/cmd/item/WorkOvertimeItemCmd.java index 938c224..bc391ba 100644 --- a/src/com/engine/attendance/attendanceanalysis/cmd/item/WorkOvertimeItemCmd.java +++ b/src/com/engine/attendance/attendanceanalysis/cmd/item/WorkOvertimeItemCmd.java @@ -44,7 +44,7 @@ public class WorkOvertimeItemCmd extends AbstractCommonCommand> offsetAskForLeaveAnomaly = Lists.newArrayList(); for (int i=0;i=0){ - offsetAskForLeaveAnomaly.add(abnormalClockInList.get(i)); + String bdlx = Util.null2String(abnormalClockInList.get(i).get("bdlx")); + if (zysd.contains(Utils.getWorkFor(bdlx)) || zysd.contains(WorkForTimeEnum.ALL_TIME.getKey())){ + if (DateUtil.getTime(kssj).compareTo(DateUtil.getTime(pointTime)) <=0 && + DateUtil.getTime(jssj).compareTo(DateUtil.getTime(pointTime)) >=0){ + offsetAskForLeaveAnomaly.add(abnormalClockInList.get(i)); + } } } abnormalClockInList.removeAll(offsetAskForLeaveAnomaly); @@ -58,11 +65,14 @@ public class AskForLeaveServiceImpl extends Service implements AskForLeaveServic int qjsc = param.get("qjsc") == null?0:Double.valueOf(Double.valueOf(param.get("qjsc").toString())*60).intValue(); //同一天可抵消多个异常 String tybcndbjlhbjs = Util.null2String(param.get("tybcndbjlhbjs")); + //作用时段 + String zysd = Util.null2String(param.get("zysd")); if (CheckBoxEnum.CHECKED.getKey().equals(tybcndbjlhbjs)){ for (int i=abnormalClockInList.size() -1;i>=0;i--){ int time = Integer.valueOf(abnormalClockInList.get(i).get("betweenMinutes").toString()); - if (qjsc >= time){ + String bdlx = Util.null2String(abnormalClockInList.get(i).get("bdlx")); + if (qjsc >= time && (zysd.contains(Utils.getWorkFor(bdlx)) || zysd.contains(WorkForTimeEnum.ALL_TIME.getKey()))){ qjsc = qjsc-time; offsetAskForLeaveAnomaly.add(abnormalClockInList.get(i)); } @@ -71,7 +81,8 @@ public class AskForLeaveServiceImpl extends Service implements AskForLeaveServic }else{ for (int i=abnormalClockInList.size() -1;i>=0;i--){ int time = Integer.valueOf(abnormalClockInList.get(i).get("betweenMinutes").toString()); - if (qjsc >= time){ + String bdlx = Util.null2String(abnormalClockInList.get(i).get("bdlx")); + if (qjsc >= time && (zysd.contains(Utils.getWorkFor(bdlx)) || zysd.contains(WorkForTimeEnum.ALL_TIME.getKey()))){ offsetAskForLeaveAnomaly.add(abnormalClockInList.get(i)); abnormalClockInList.remove(i); break; diff --git a/src/com/engine/attendance/attendanceanalysis/service/impl/EvectionServiceImpl.java b/src/com/engine/attendance/attendanceanalysis/service/impl/EvectionServiceImpl.java index 273da65..49a8086 100644 --- a/src/com/engine/attendance/attendanceanalysis/service/impl/EvectionServiceImpl.java +++ b/src/com/engine/attendance/attendanceanalysis/service/impl/EvectionServiceImpl.java @@ -2,7 +2,9 @@ package com.engine.attendance.attendanceanalysis.service.impl; import com.engine.attendance.attendanceanalysis.service.EvectionService; import com.engine.attendance.enums.CheckBoxEnum; +import com.engine.attendance.enums.WorkForTimeEnum; import com.engine.common.util.DateUtil; +import com.engine.common.util.Utils; import com.engine.core.impl.Service; import com.google.common.collect.Lists; import com.google.common.collect.Maps; @@ -22,13 +24,18 @@ public class EvectionServiceImpl extends Service implements EvectionService { String kssj = Util.null2String(param.get("kssj")); //请假结束时间 String jssj = Util.null2String(param.get("jssj")); + //作用时段 + String zysd = Util.null2String(param.get("zysd")); List> offsetEvectionAnomaly = Lists.newArrayList(); for (int i=0;i=0){ - offsetEvectionAnomaly.add(abnormalClockInList.get(i)); + String bdlx = Util.null2String(abnormalClockInList.get(i).get("bdlx")); + if (zysd.contains(Utils.getWorkFor(bdlx)) || zysd.contains(WorkForTimeEnum.ALL_TIME.getKey())) { + if (DateUtil.getTime(kssj).compareTo(DateUtil.getTime(pointTime)) <= 0 && + DateUtil.getTime(jssj).compareTo(DateUtil.getTime(pointTime)) >= 0) { + offsetEvectionAnomaly.add(abnormalClockInList.get(i)); + } } } abnormalClockInList.removeAll(offsetEvectionAnomaly); @@ -50,12 +57,15 @@ public class EvectionServiceImpl extends Service implements EvectionService { int ccsc = param.get("ccsc") == null?0:Double.valueOf(Double.valueOf(param.get("ccsc").toString())*60).intValue(); //同一天可抵消多个异常 List> offsetEvectionAnomaly = Lists.newArrayList(); + //作用时段 + String zysd = Util.null2String(param.get("zysd")); String tybcndbjlhbjs = Util.null2String(param.get("tybcndbjlhbjs")); if (CheckBoxEnum.CHECKED.getKey().equals(tybcndbjlhbjs)){ for (int i=abnormalClockInList.size() -1;i>=0;i--){ int time = Integer.valueOf(abnormalClockInList.get(i).get("betweenMinutes").toString()); - if (ccsc > time){ + String bdlx = Util.null2String(abnormalClockInList.get(i).get("bdlx")); + if (ccsc > time && (zysd.contains(Utils.getWorkFor(bdlx)) || zysd.contains(WorkForTimeEnum.ALL_TIME.getKey()))){ ccsc = ccsc-time; offsetEvectionAnomaly.add(abnormalClockInList.get(i)); } @@ -64,7 +74,8 @@ public class EvectionServiceImpl extends Service implements EvectionService { }else{ for (int i=abnormalClockInList.size() -1;i>=0;i--){ int time = Integer.valueOf(abnormalClockInList.get(i).get("betweenMinutes").toString()); - if (ccsc > time){ + String bdlx = Util.null2String(abnormalClockInList.get(i).get("bdlx")); + if (ccsc > time && (zysd.contains(Utils.getWorkFor(bdlx)) || zysd.contains(WorkForTimeEnum.ALL_TIME.getKey()))){ offsetEvectionAnomaly.add(abnormalClockInList.get(i)); abnormalClockInList.remove(i); break; diff --git a/src/com/engine/attendance/attendanceanalysis/service/impl/WorkOverTimeServiceImpl.java b/src/com/engine/attendance/attendanceanalysis/service/impl/WorkOverTimeServiceImpl.java index 97fa3ed..7cdd183 100644 --- a/src/com/engine/attendance/attendanceanalysis/service/impl/WorkOverTimeServiceImpl.java +++ b/src/com/engine/attendance/attendanceanalysis/service/impl/WorkOverTimeServiceImpl.java @@ -509,7 +509,7 @@ public class WorkOverTimeServiceImpl extends Service implements WorkOverTimeServ Map askForLeaveItem = askForLeaveItems.get(askForLeaveList.get(i).get("jqlx")); //作用时段 String zysd = Util.null2String(askForLeaveItem.get("zysd")); - if (!zysd.contains(workFor) && !WorkForTimeEnum.ALL_TIME.getKey().equals(zysd)){ + if (!zysd.contains(workFor) && !zysd.contains(WorkForTimeEnum.ALL_TIME.getKey())){ continue; } if ("".equals(Util.null2String(askForLeaveList.get(i).get("kssj"))) || "".equals(Util.null2String(askForLeaveList.get(i).get("jssj")))){ diff --git a/src/com/engine/attendance/attendanceanalysis/wrapper/AttendanceAnalysisWrapper.java b/src/com/engine/attendance/attendanceanalysis/wrapper/AttendanceAnalysisWrapper.java index f8e52cb..6735a18 100644 --- a/src/com/engine/attendance/attendanceanalysis/wrapper/AttendanceAnalysisWrapper.java +++ b/src/com/engine/attendance/attendanceanalysis/wrapper/AttendanceAnalysisWrapper.java @@ -204,7 +204,7 @@ public class AttendanceAnalysisWrapper extends Service { put("dxhs",askForLeaveItem.get("thfghlfzs")); }}; - //scheduleResult.add(askForLeaveMap); + scheduleResult.add(askForLeaveMap); if (!"".equals(Util.null2String(askForLeaveData.get("kssj"))) && !"".equals(Util.null2String(askForLeaveData.get("jssj"))) &&(CheckBoxEnum.CHECKED.getKey().equals(askForLeaveItem.get("lgsbxydk")) || CheckBoxEnum.CHECKED.getKey().equals(askForLeaveItem.get("fgsbxydk")))){ needClockInSchedule.add(askForLeaveMap); } @@ -239,7 +239,7 @@ public class AttendanceAnalysisWrapper extends Service { put("zddxfz",evectionItem.get("tqlghlfzs")); put("dxhs",evectionItem.get("thfghlfzs")); }}; - //scheduleResult.add(evectionMap); + scheduleResult.add(evectionMap); if (!"".equals(Util.null2String(evectionData.get("kssj"))) && !"".equals(Util.null2String(evectionData.get("jssj"))) && (CheckBoxEnum.CHECKED.getKey().equals(evectionItem.get("lgsbxydk")) || CheckBoxEnum.CHECKED.getKey().equals(evectionItem.get("fgsbxydk")))){ needClockInSchedule.add(evectionMap); } diff --git a/src/com/engine/attendance/attendanceanalysis/wrapper/UpdateAttendanceResultWrapper.java b/src/com/engine/attendance/attendanceanalysis/wrapper/UpdateAttendanceResultWrapper.java index bb29d96..58205d5 100644 --- a/src/com/engine/attendance/attendanceanalysis/wrapper/UpdateAttendanceResultWrapper.java +++ b/src/com/engine/attendance/attendanceanalysis/wrapper/UpdateAttendanceResultWrapper.java @@ -177,6 +177,8 @@ public class UpdateAttendanceResultWrapper extends Service { String zdycbcndfgzsd = Util.null2String(askForLeaveItem.get("zdycbcndfgzsd")); //同一天可抵消多个异常 String tybcndbjlhbjs = Util.null2String(askForLeaveItem.get("tybcndbjlhbjs")); + //作用时段 + String zysd = Util.null2String(askForLeaveItem.get("zysd")); //核算量 double hsl = Double.valueOf(Util.null2String(askForLeaveItem.get("hsl"))); //核算单位 @@ -184,6 +186,7 @@ public class UpdateAttendanceResultWrapper extends Service { Map param = Maps.newHashMap(); param.put("abnormalClockInList",abnormalClockInList); + param.put("zysd",zysd); double itemduration = 0; if ("".equals(Util.null2String(askForLeaveList.get(i).get("kssj"))) || "".equals(Util.null2String(askForLeaveList.get(i).get("jssj")))){ //弹性请假,半天请假 @@ -270,10 +273,12 @@ public class UpdateAttendanceResultWrapper extends Service { double hsl = Double.valueOf(Util.null2String(evectionItem.get("hsl"))); //核算单位 String hsdw = Util.null2String(evectionItem.get("hsdw")); + //作用时间段 + String zysd = Util.null2String(evectionItem.get("zysd")); Map param = Maps.newHashMap(); param.put("abnormalClockInList",abnormalClockInList); - + param.put("zysd",zysd); double itemduration = 0; if ("".equals(Util.null2String(evectionList.get(i).get("kssj"))) || "".equals(Util.null2String(evectionList.get(i).get("jssj")))){ //弹性请假,半天出差 diff --git a/src/com/engine/common/util/Utils.java b/src/com/engine/common/util/Utils.java index fb86866..a9f1a64 100644 --- a/src/com/engine/common/util/Utils.java +++ b/src/com/engine/common/util/Utils.java @@ -1,9 +1,6 @@ package com.engine.common.util; -import com.engine.attendance.enums.AccountingUnitEnum; -import com.engine.attendance.enums.CheckBoxEnum; -import com.engine.attendance.enums.ClassSegmentTypeEnum; -import com.engine.attendance.enums.ClockPointEnum; +import com.engine.attendance.enums.*; import com.google.common.collect.Maps; import com.google.common.reflect.TypeToken; import com.google.gson.Gson; @@ -455,4 +452,21 @@ public class Utils { DbTools.update(CommonUtil.makeInsertSql(tableName,dataMap)); } + public static String getWorkFor(String bdlx){ + String workFor=""; + if (ClassSegmentTypeEnum.WORK_TIME.getKey().equals(bdlx)){ + workFor = WorkForTimeEnum.WORK_TIME.getKey(); + }else if (ClassSegmentTypeEnum.EXTENDED_OVERTIME.getKey().equals(bdlx)){ + workFor = WorkForTimeEnum.DELAY_TO_WORK_OVERTIME.getKey(); + }else if (ClassSegmentTypeEnum.EARLY_OVERTIME.getKey().equals(bdlx)){ + workFor = WorkForTimeEnum.EARLY_TO_WORK_OVERTIME.getKey(); + }else if (ClassSegmentTypeEnum.OVERTIME_PLAN.getKey().equals(bdlx)){ + workFor = WorkForTimeEnum.PLAN_WORK_OVERTIME.getKey(); + }else if (ClassSegmentTypeEnum.ASK_FOR_LEAVE.getKey().equals(bdlx)){ + workFor = WorkForTimeEnum.LEAVE_TIME.getKey(); + }else if (ClassSegmentTypeEnum.EVECTION.getKey().equals(bdlx)){ + workFor = WorkForTimeEnum.EVECTION.getKey(); + } + return workFor; + } }