|
|
|
@ -2,24 +2,25 @@ package com.engine.attendance.attendanceanalysis.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.engine.attendance.attendanceanalysis.cmd.item.WorkOvertimeItemCmd;
|
|
|
|
|
import com.engine.attendance.attendanceanalysis.service.WorkOverTimeService;
|
|
|
|
|
import com.engine.attendance.enums.CheckBoxEnum;
|
|
|
|
|
import com.engine.attendance.enums.ClassSegmentTypeEnum;
|
|
|
|
|
import com.engine.attendance.enums.DateTypeEnum;
|
|
|
|
|
import com.engine.attendance.enums.WorkForTimeEnum;
|
|
|
|
|
import com.engine.attendance.enums.*;
|
|
|
|
|
import com.engine.common.util.CommonUtil;
|
|
|
|
|
import com.engine.common.util.DateUtil;
|
|
|
|
|
import com.engine.common.util.DbTools;
|
|
|
|
|
import com.engine.common.util.Utils;
|
|
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import weaver.general.TimeUtil;
|
|
|
|
|
import weaver.general.Util;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.Calendar;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class WorkOverTimeServiceImpl extends Service implements WorkOverTimeService {
|
|
|
|
|
@Override
|
|
|
|
|
public List<Map<String, Object>> recordWorkOverTime(Map<String, Object> params) {
|
|
|
|
@ -31,10 +32,21 @@ public class WorkOverTimeServiceImpl extends Service implements WorkOverTimeServ
|
|
|
|
|
String analysisDate = Util.null2String(params.get("analysisDate"));
|
|
|
|
|
//请假记录
|
|
|
|
|
List<Map<String,Object>> askForLeaveList = (List<Map<String,Object>>)params.get("askForLeaveList");
|
|
|
|
|
//请假项目
|
|
|
|
|
Map<String,Map<String,Object>> askForLeaveItems = (Map<String,Map<String,Object>>)params.get("askForLeaveItems");
|
|
|
|
|
//外出记录
|
|
|
|
|
List<Map<String,Object>> evectionList = (List<Map<String,Object>>)params.get("evectionList");
|
|
|
|
|
//外出项目
|
|
|
|
|
Map<String,Map<String,Object>> evectionItems = (Map<String,Map<String,Object>>)params.get("evectionItems");
|
|
|
|
|
//打卡卡点
|
|
|
|
|
List<Map<String,Map<String,Object>>> clcokInTimeList = (List<Map<String,Map<String,Object>>>)params.get("clcokInTimeList");
|
|
|
|
|
//请假后消除的异常
|
|
|
|
|
List<Map<String,Object>> offsetAskForLeaveAnomaly = (List<Map<String,Object>>)params.get("offsetAskForLeaveAnomaly");
|
|
|
|
|
//出差外出后消除的异常
|
|
|
|
|
List<Map<String,Object>> offsetEvectionAnomaly = (List<Map<String,Object>>)params.get("offsetEvectionAnomaly");
|
|
|
|
|
|
|
|
|
|
//经过请假外出处理过的异常项目
|
|
|
|
|
List<Map<String,Object>> abnormalClockInList = (List<Map<String,Object>>)params.get("abnormalClockInList");
|
|
|
|
|
|
|
|
|
|
Map<String,Map<String,Object>> clcokInTimeMap = Maps.newHashMap();
|
|
|
|
|
|
|
|
|
@ -60,9 +72,7 @@ public class WorkOverTimeServiceImpl extends Service implements WorkOverTimeServ
|
|
|
|
|
//人员
|
|
|
|
|
String userId = Util.null2String(params.get("userId"));
|
|
|
|
|
List<Map<String, Object>> resultLists = Lists.newArrayList();
|
|
|
|
|
int maxDayTime = 0;
|
|
|
|
|
int maxWeekTime = 0;
|
|
|
|
|
int maxMonthTime = 0;
|
|
|
|
|
|
|
|
|
|
for (Map<String, Object> scheduleMap :scheduleResult){
|
|
|
|
|
String bdlx = Util.null2String(scheduleMap.get("bdlx"));
|
|
|
|
|
String rqlx = Util.null2String(scheduleMap.get("rqlx"));
|
|
|
|
@ -73,26 +83,27 @@ public class WorkOverTimeServiceImpl extends Service implements WorkOverTimeServ
|
|
|
|
|
//加班结束时间
|
|
|
|
|
String dtjssj = Util.null2String(scheduleMap.get("dtjssj"));
|
|
|
|
|
|
|
|
|
|
String kssj = analysisDate +" "+Util.null2String(scheduleMap.get("dtkssj"));
|
|
|
|
|
String jssj = analysisDate +" "+Util.null2String(scheduleMap.get("dtjssj"));
|
|
|
|
|
String kssj = analysisDate +" "+dtkssj;
|
|
|
|
|
String jssj = analysisDate +" "+dtjssj;
|
|
|
|
|
if (DateUtil.getTime(kssj).compareTo(DateUtil.getTime(jssj)) >0){
|
|
|
|
|
jssj = DateUtil.AfterDay(analysisDate,1)+" "+Util.null2String(scheduleMap.get("dtjssj"));
|
|
|
|
|
}
|
|
|
|
|
//加班实际开始时间
|
|
|
|
|
String realityStartTime = "";
|
|
|
|
|
//加班实际结束时间
|
|
|
|
|
String realityEndime = "";
|
|
|
|
|
//申请时间
|
|
|
|
|
int applicationTime = DateUtil.getBetWeenMinutes(kssj,jssj);
|
|
|
|
|
//扣除休息时间后的剩余
|
|
|
|
|
int applicationRestTime = applicationTime;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
resultLists.add(workOverTimeItems);
|
|
|
|
|
getWorkOverTimeParam.put("attendanceItems",attendanceItems);
|
|
|
|
|
getWorkOverTimeParam.put("rqlx",scheduleMap.get("rqlx"));
|
|
|
|
|
|
|
|
|
|
if (ClassSegmentTypeEnum.EXTENDED_OVERTIME.getKey().equals(bdlx)){
|
|
|
|
|
getWorkOverTimeParam.put("workfor", WorkForTimeEnum.DELAY_TO_WORK_OVERTIME.getKey());
|
|
|
|
|
}else if (ClassSegmentTypeEnum.EARLY_OVERTIME.getKey().equals(bdlx)){
|
|
|
|
|
getWorkOverTimeParam.put("workfor",WorkForTimeEnum.EARLY_TO_WORK_OVERTIME.getKey());
|
|
|
|
|
}else if (ClassSegmentTypeEnum.OVERTIME_PLAN.getKey().equals(bdlx)){
|
|
|
|
|
applicationRestTime = Utils.removeRestTime(kssj,jssj,scheduleResult,analysisDate);
|
|
|
|
|
getWorkOverTimeParam.put("workfor",WorkForTimeEnum.PLAN_WORK_OVERTIME.getKey());
|
|
|
|
|
}
|
|
|
|
|
Map<String,Object> result = commandExecutor.execute(new WorkOvertimeItemCmd(getWorkOverTimeParam));
|
|
|
|
@ -101,14 +112,20 @@ public class WorkOverTimeServiceImpl extends Service implements WorkOverTimeServ
|
|
|
|
|
if (workTimeBeLateItems.size() == 0){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
workOverTimeItems.put("item",workTimeBeLateItems.get(0).get("key"));
|
|
|
|
|
double jbsc = Integer.valueOf(Util.null2String(scheduleMap.get("jbsc")));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//开始加班必须打卡
|
|
|
|
|
String ksjbbxydk = Util.null2String(workTimeBeLateItems.get(0).get("ksjbbxydk"));
|
|
|
|
|
//结束加班必须打卡
|
|
|
|
|
String jsjbbxydk = Util.null2String(workTimeBeLateItems.get(0).get("jsjbbxydk"));
|
|
|
|
|
//提前打卡开始的时长计入加班
|
|
|
|
|
String tqdkjrjb = Util.null2String(workTimeBeLateItems.get(0).get("tqdkjrjb"));
|
|
|
|
|
//推后打卡结束的时长计入加班
|
|
|
|
|
String thdkjrjb = Util.null2String(workTimeBeLateItems.get(0).get("thdkjrjb"));
|
|
|
|
|
//结算加班时长不得超过申请的时长
|
|
|
|
|
String jbscbdccsqsc = Util.null2String(workTimeBeLateItems.get(0).get("jbscbdccsqsc"));
|
|
|
|
|
//结算加班时长不得超过申请的时长
|
|
|
|
|
//是否扣除时间区间内的就餐休息时长
|
|
|
|
|
String zdkcjcxxsc = Util.null2String(workTimeBeLateItems.get(0).get("zdkcjcxxsc"));
|
|
|
|
|
//超出限制时长的处理方式
|
|
|
|
|
String ccclfs = Util.null2String(workTimeBeLateItems.get(0).get("ccclfs"));
|
|
|
|
@ -120,21 +137,139 @@ public class WorkOverTimeServiceImpl extends Service implements WorkOverTimeServ
|
|
|
|
|
String zzdjbxss = Util.null2String(workTimeBeLateItems.get(0).get("zzdjbxss"));
|
|
|
|
|
//加班时长自动转入假期余额
|
|
|
|
|
String jbzdzjqye= Util.null2String(workTimeBeLateItems.get(0).get("jbzdzjqye"));
|
|
|
|
|
//最小加班分钟数
|
|
|
|
|
String jbqsfzs = Util.null2String(workTimeBeLateItems.get(0).get("jbqsfzs"));
|
|
|
|
|
//超出最小时长后的单次累加分钟数
|
|
|
|
|
String ccqszhdhsfzs = Util.null2String(workTimeBeLateItems.get(0).get("ccqszhdhsfzs"));
|
|
|
|
|
//核算量
|
|
|
|
|
double workOverTimeHsl = Double.valueOf(Util.null2String(workTimeBeLateItems.get(0).get("hsl")));
|
|
|
|
|
//核算单位
|
|
|
|
|
String workOverTimeHsdw = Util.null2String(workTimeBeLateItems.get(0).get("hsdw"));
|
|
|
|
|
|
|
|
|
|
if (CheckBoxEnum.CHECKED.getKey().equals(tqdkjrjb)){
|
|
|
|
|
/**
|
|
|
|
|
* 获得实际加班时间
|
|
|
|
|
*/
|
|
|
|
|
if (CheckBoxEnum.CHECKED.getKey().equals(ksjbbxydk)){
|
|
|
|
|
Map<String,Object> clcokInTimeData = clcokInTimeMap.get(dtkssj);
|
|
|
|
|
String signTime = clcokInTimeData.get("signdate")+" "+clcokInTimeData.get("signtime");
|
|
|
|
|
if (DateUtil.getTime(signTime).compareTo(DateUtil.getTime(dtkssj)) < 0){
|
|
|
|
|
dtkssj = signTime;
|
|
|
|
|
}
|
|
|
|
|
realityStartTime = signTime;
|
|
|
|
|
}else {
|
|
|
|
|
realityStartTime = kssj;
|
|
|
|
|
}
|
|
|
|
|
if (CheckBoxEnum.CHECKED.getKey().equals(thdkjrjb)){
|
|
|
|
|
if (CheckBoxEnum.CHECKED.getKey().equals(jsjbbxydk)){
|
|
|
|
|
Map<String,Object> clcokInTimeData = clcokInTimeMap.get(dtjssj);
|
|
|
|
|
String signTime = clcokInTimeData.get("signdate")+" "+clcokInTimeData.get("signtime");
|
|
|
|
|
if (DateUtil.getTime(signTime).compareTo(DateUtil.getTime(dtjssj)) > 0){
|
|
|
|
|
dtjssj = signTime;
|
|
|
|
|
realityEndime = signTime;
|
|
|
|
|
}else {
|
|
|
|
|
realityEndime= jssj;
|
|
|
|
|
}
|
|
|
|
|
jbsc = jbsc*60;
|
|
|
|
|
if (CheckBoxEnum.CHECKED.getKey().equals(tqdkjrjb)){
|
|
|
|
|
//提前打卡开始的时长计入加班
|
|
|
|
|
if (DateUtil.getTime(realityStartTime).compareTo(DateUtil.getTime(kssj)) <0){
|
|
|
|
|
jbsc +=DateUtil.getBetWeenMinutes(realityStartTime,kssj);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (CheckBoxEnum.CHECKED.getKey().equals(thdkjrjb)){
|
|
|
|
|
// 推后打卡结束的时长计入加班
|
|
|
|
|
if (DateUtil.getTime(realityEndime).compareTo(DateUtil.getTime(jssj)) >0){
|
|
|
|
|
jbsc +=DateUtil.getBetWeenMinutes(jssj,realityEndime);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 当存在迟到项目时扣除异常时长,不存在时
|
|
|
|
|
*/
|
|
|
|
|
List<Map<String,Object>> beLateAbnormal = abnormalClockInList.stream().filter(e->e.get("pointTime").toString().split(" ")[1].equals(dtkssj)).collect(Collectors.toList());
|
|
|
|
|
double beLateTime = 0;
|
|
|
|
|
if (beLateAbnormal.size() >0){
|
|
|
|
|
String hsdw = Util.null2String(beLateAbnormal.get(0).get("hsdw"));
|
|
|
|
|
String itemduration = Util.null2String(beLateAbnormal.get(0).get("itemduration"));
|
|
|
|
|
AttendanceItemTypeEnum itemType = (AttendanceItemTypeEnum)beLateAbnormal.get(0).get("itemType");
|
|
|
|
|
if (itemType == AttendanceItemTypeEnum.MISSE_CARD){
|
|
|
|
|
//早上漏卡
|
|
|
|
|
beLateTime = jbsc;
|
|
|
|
|
}else {
|
|
|
|
|
if (AccountingUnitEnum.DAY.getKey().equals(hsdw)){
|
|
|
|
|
beLateTime = Integer.valueOf(scheduleMap.get("edsc").toString()) * Double.valueOf(itemduration);
|
|
|
|
|
}else if (AccountingUnitEnum.HOUR.getKey().equals(hsdw)){
|
|
|
|
|
beLateTime = Double.valueOf(itemduration)*60;
|
|
|
|
|
}else if (AccountingUnitEnum.MINUTES.getKey().equals(hsdw)){
|
|
|
|
|
beLateTime = Double.valueOf(itemduration);
|
|
|
|
|
}else if (AccountingUnitEnum.ONCE.getKey().equals(hsdw)){
|
|
|
|
|
beLateTime = jbsc;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
if (DateUtil.getTime(realityStartTime).compareTo(DateUtil.getTime(kssj)) >0){
|
|
|
|
|
beLateTime = DateUtil.getBetWeenMinutes(kssj,realityStartTime);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 当存在早退项目时扣除异常时长,不存在时扣除实际早退时间
|
|
|
|
|
*/
|
|
|
|
|
List<Map<String,Object>> leaveEarlyAbnormal = abnormalClockInList.stream().filter(e->e.get("pointTime").toString().split(" ")[1].equals(dtjssj)).collect(Collectors.toList());
|
|
|
|
|
double leaveElaryTime=0;
|
|
|
|
|
if (leaveEarlyAbnormal.size() > 0){
|
|
|
|
|
String hsdw = Util.null2String(beLateAbnormal.get(0).get("hsdw"));
|
|
|
|
|
String itemduration = Util.null2String(beLateAbnormal.get(0).get("itemduration"));
|
|
|
|
|
AttendanceItemTypeEnum itemType = (AttendanceItemTypeEnum)beLateAbnormal.get(0).get("itemType");
|
|
|
|
|
if (itemType == AttendanceItemTypeEnum.MISSE_CARD){
|
|
|
|
|
//下午漏卡
|
|
|
|
|
leaveElaryTime = jbsc;
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
if (AccountingUnitEnum.DAY.getKey().equals(hsdw)){
|
|
|
|
|
leaveElaryTime = Integer.valueOf(scheduleMap.get("edsc").toString()) * Double.valueOf(itemduration);
|
|
|
|
|
}else if (AccountingUnitEnum.HOUR.getKey().equals(hsdw)){
|
|
|
|
|
leaveElaryTime = Double.valueOf(itemduration)*60;
|
|
|
|
|
}else if (AccountingUnitEnum.MINUTES.getKey().equals(hsdw)){
|
|
|
|
|
leaveElaryTime = Double.valueOf(itemduration);
|
|
|
|
|
}else if (AccountingUnitEnum.ONCE.getKey().equals(hsdw)){
|
|
|
|
|
leaveElaryTime = jbsc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
if (DateUtil.getTime(realityEndime).compareTo(DateUtil.getTime(jssj)) <0){
|
|
|
|
|
leaveElaryTime = DateUtil.getBetWeenMinutes(realityEndime,jssj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 当存在请假时,考虑扣除请假时长
|
|
|
|
|
*/
|
|
|
|
|
int askForLeaveTime = removeAskForLeave(realityStartTime,realityEndime,Util.null2String(getWorkOverTimeParam.get("workfor"))
|
|
|
|
|
,bdlx,evectionList,askForLeaveItems,offsetAskForLeaveAnomaly);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 当存在外出时,考虑扣除外出时长
|
|
|
|
|
*/
|
|
|
|
|
int evectionTime = removeEvection(realityStartTime,realityEndime,Util.null2String(getWorkOverTimeParam.get("workfor"))
|
|
|
|
|
,bdlx,askForLeaveList,evectionItems,offsetEvectionAnomaly);
|
|
|
|
|
|
|
|
|
|
log.info("加班时长: {}",jbsc);
|
|
|
|
|
log.info("beLateTime :[{}],leaveElaryTime :[{}],askForLeaveTime:[{}],evectionTime:[{}]",beLateTime,leaveElaryTime,askForLeaveTime,evectionTime);
|
|
|
|
|
BigDecimal jbscbig = new BigDecimal(jbsc);
|
|
|
|
|
jbsc = jbscbig.subtract(new BigDecimal(beLateTime)).subtract(new BigDecimal(leaveElaryTime)).subtract(new BigDecimal(askForLeaveTime)).subtract(new BigDecimal(evectionTime)).intValue();
|
|
|
|
|
log.info("jbsc :[{}]",jbsc);
|
|
|
|
|
if (!"".equals(jbqsfzs)){
|
|
|
|
|
if (jbsc < Integer.valueOf(jbqsfzs)){
|
|
|
|
|
//小于最小加班分钟数不算加班
|
|
|
|
|
continue;
|
|
|
|
|
}else if (jbsc >= Integer.valueOf(jbqsfzs) && !"".equals(ccqszhdhsfzs)){
|
|
|
|
|
jbsc = Double.valueOf(Utils.getItemdurationDown(Integer.valueOf(ccqszhdhsfzs),AccountingUnitEnum.MINUTES.getKey(),Double.valueOf(jbsc).intValue(),AccountingUnitEnum.MINUTES)).intValue();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (jbsc < 0){
|
|
|
|
|
//加班时长为0
|
|
|
|
|
workOverTimeItems.put("item",workTimeBeLateItems.get(0).get("key"));
|
|
|
|
|
workOverTimeItems.put("itemduration","0");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//自动扣除
|
|
|
|
|
if ("2".equals(ccclfs) && workOverTimeResults == null){
|
|
|
|
|
String startDate = analysisDate.split("-")[0]+"-"+ analysisDate.split("-")[1]+"-01";
|
|
|
|
@ -144,26 +279,122 @@ public class WorkOverTimeServiceImpl extends Service implements WorkOverTimeServ
|
|
|
|
|
}
|
|
|
|
|
if ("2".equals(ccclfs) && !"".equals(rzdjbxss) && DateTypeEnum.WORK_DAY.getKey().equals(rqlx)){
|
|
|
|
|
//工作日加班最大数
|
|
|
|
|
maxDayTime = getWorkDayTime(workOverTimeResults,analysisDate);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else if ("2".equals(ccclfs) && !"".equals(yzdjbxss)){
|
|
|
|
|
//每月最大加班数
|
|
|
|
|
maxWeekTime = getMonthTime(workOverTimeResults);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else if ("2".equals(ccclfs) && !"".equals(zzdjbxss)){
|
|
|
|
|
double dayTime = getWorkDayTime(workOverTimeResults,analysisDate) *60;
|
|
|
|
|
double maxDayTime = Double.valueOf(rzdjbxss) *60;
|
|
|
|
|
double time = jbsc+dayTime;
|
|
|
|
|
if (time > maxDayTime){
|
|
|
|
|
jbsc = maxDayTime-dayTime;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ("2".equals(ccclfs) && !"".equals(zzdjbxss)){
|
|
|
|
|
//每周最大加班小时数
|
|
|
|
|
maxMonthTime = getWeekTime(workOverTimeResults,analysisDate);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double weekTime = getWeekTime(workOverTimeResults,analysisDate);
|
|
|
|
|
double maxWeekTime = Double.valueOf(zzdjbxss) *60;
|
|
|
|
|
double time = jbsc+weekTime;
|
|
|
|
|
if (time > maxWeekTime){
|
|
|
|
|
jbsc = maxWeekTime-weekTime;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ("2".equals(ccclfs) && !"".equals(yzdjbxss)){
|
|
|
|
|
//每月最大加班数
|
|
|
|
|
double monthTime = getMonthTime(workOverTimeResults);
|
|
|
|
|
double maxMonthTime = Double.valueOf(yzdjbxss) *60;
|
|
|
|
|
double time = jbsc+monthTime;
|
|
|
|
|
if (time > maxMonthTime){
|
|
|
|
|
jbsc = maxMonthTime-monthTime;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (CheckBoxEnum.CHECKED.getKey().equals(jbscbdccsqsc)){
|
|
|
|
|
if (jbsc > Integer.valueOf(Util.null2String(scheduleMap.get("jbsc")))*60){
|
|
|
|
|
jbsc = Integer.valueOf(Util.null2String(scheduleMap.get("jbsc")))*60;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
log.info("最终加班时长: {}",jbsc);
|
|
|
|
|
workOverTimeItems.put("item",workTimeBeLateItems.get(0).get("key"));
|
|
|
|
|
double itemduration = Utils.getItemdurationDown(workOverTimeHsl,workOverTimeHsdw,Long.valueOf(Math.round(jbsc)).intValue(),AccountingUnitEnum.MINUTES);
|
|
|
|
|
workOverTimeItems.put("itemduration",itemduration);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 入加班结果表
|
|
|
|
|
*/
|
|
|
|
|
Map<String,Object> insertParam = Maps.newHashMap();
|
|
|
|
|
insertParam.put("jbry",userId);
|
|
|
|
|
insertParam.put("sjksrq",realityStartTime.split(" ")[0]);
|
|
|
|
|
insertParam.put("sjkssj",realityStartTime.split(" ")[1]);
|
|
|
|
|
insertParam.put("sjjsrq",realityEndime.split(" ")[0]);
|
|
|
|
|
insertParam.put("sjjssj",realityEndime.split(" ")[1]);
|
|
|
|
|
insertParam.put("sjjbsc",String.format ("%.2f", jbsc/60));
|
|
|
|
|
insertParam.put("jbjgly","4");
|
|
|
|
|
insertParam.put("zt","1");
|
|
|
|
|
DbTools.update(CommonUtil.makeInsertSql("uf_jcl_kq_jbjg",insertParam));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 入假期余额
|
|
|
|
|
*/
|
|
|
|
|
//加班时长自动转入假期余额
|
|
|
|
|
if (CheckBoxEnum.CHECKED.getKey().equals(jbzdzjqye)){
|
|
|
|
|
Map<String,Object> insertHoliDayParam = Maps.newHashMap();
|
|
|
|
|
insertHoliDayParam.put("ygid",userId);
|
|
|
|
|
insertHoliDayParam.put("jqid",workTimeBeLateItems.get(0).get("zrdjb"));
|
|
|
|
|
//转入的假期额度生效日期
|
|
|
|
|
String yesxrq = Util.null2String(workTimeBeLateItems.get(0).get("yesxrq"));
|
|
|
|
|
if ("0".equals(yesxrq)){
|
|
|
|
|
//一月后
|
|
|
|
|
insertHoliDayParam.put("sxrq",DateUtil.lastMonth(analysisDate,DateUtil.yyyyMMdd));
|
|
|
|
|
}else if ("1".equals(yesxrq)){
|
|
|
|
|
//次月
|
|
|
|
|
insertHoliDayParam.put("sxrq",DateUtil.lastMonth(analysisDate)+"-01");
|
|
|
|
|
}else if ("2".equals(yesxrq)){
|
|
|
|
|
//次日
|
|
|
|
|
insertHoliDayParam.put("sxrq",DateUtil.AfterDay(analysisDate,1));
|
|
|
|
|
}
|
|
|
|
|
//额度可用的周期
|
|
|
|
|
String yekyzq = Util.null2String(workTimeBeLateItems.get(0).get("yekyzq"));
|
|
|
|
|
if ("0".equals(yekyzq)){
|
|
|
|
|
//一个月
|
|
|
|
|
insertHoliDayParam.put("jzrq",DateUtil.nextMonth(analysisDate,1,DateUtil.yyyyMMdd));
|
|
|
|
|
}else if ("1".equals(yekyzq)){
|
|
|
|
|
//两个月
|
|
|
|
|
insertHoliDayParam.put("jzrq",DateUtil.nextMonth(analysisDate,2,DateUtil.yyyyMMdd));
|
|
|
|
|
}else if ("2".equals(yekyzq)){
|
|
|
|
|
//三个月
|
|
|
|
|
insertHoliDayParam.put("jzrq",DateUtil.nextMonth(analysisDate,3,DateUtil.yyyyMMdd));
|
|
|
|
|
}else if ("3".equals(yekyzq)){
|
|
|
|
|
//六个月
|
|
|
|
|
insertHoliDayParam.put("jzrq",DateUtil.nextMonth(analysisDate,6,DateUtil.yyyyMMdd));
|
|
|
|
|
}else if ("4".equals(yekyzq)){
|
|
|
|
|
//十二个月
|
|
|
|
|
insertHoliDayParam.put("jzrq",DateUtil.nextMonth(analysisDate,12,DateUtil.yyyyMMdd));
|
|
|
|
|
}else if ("5".equals(yekyzq)){
|
|
|
|
|
//季度
|
|
|
|
|
insertHoliDayParam.put("jzrq",DateUtil.nextMonth(analysisDate,3,DateUtil.yyyyMMdd));
|
|
|
|
|
}else if ("6".equals(yekyzq)){
|
|
|
|
|
//半年
|
|
|
|
|
insertHoliDayParam.put("jzrq",DateUtil.nextMonth(analysisDate,6,DateUtil.yyyyMMdd));
|
|
|
|
|
}else if ("7".equals(yekyzq)){
|
|
|
|
|
//一年
|
|
|
|
|
insertHoliDayParam.put("jzrq",DateUtil.nextMonth(analysisDate,12,DateUtil.yyyyMMdd));
|
|
|
|
|
}
|
|
|
|
|
insertHoliDayParam.put("ktsc",String.format ("%.2f", jbsc/60));
|
|
|
|
|
|
|
|
|
|
String zdyqsc = Util.null2String(workTimeBeLateItems.get(0).get("zdyqsc"));
|
|
|
|
|
if ("0".equals(zdyqsc)){
|
|
|
|
|
//一个月
|
|
|
|
|
insertHoliDayParam.put("yqsxrq",DateUtil.nextMonth(analysisDate,1,DateUtil.yyyyMMdd));
|
|
|
|
|
}else if ("1".equals(zdyqsc)){
|
|
|
|
|
//两个月
|
|
|
|
|
insertHoliDayParam.put("yqsxrq",DateUtil.nextMonth(analysisDate,2,DateUtil.yyyyMMdd));
|
|
|
|
|
}else if ("2".equals(zdyqsc)){
|
|
|
|
|
//三个月
|
|
|
|
|
insertHoliDayParam.put("yqsxrq",DateUtil.nextMonth(analysisDate,3,DateUtil.yyyyMMdd));
|
|
|
|
|
}else if ("3".equals(zdyqsc)){
|
|
|
|
|
//半年
|
|
|
|
|
insertHoliDayParam.put("yqsxrq",DateUtil.nextMonth(analysisDate,6,DateUtil.yyyyMMdd));
|
|
|
|
|
}else if ("4".equals(zdyqsc)){
|
|
|
|
|
//一年
|
|
|
|
|
insertHoliDayParam.put("yqsxrq",DateUtil.nextMonth(analysisDate,12,DateUtil.yyyyMMdd));
|
|
|
|
|
}
|
|
|
|
|
DbTools.update(CommonUtil.makeInsertSql("uf_jcl_kq_kqxm",insertHoliDayParam));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -219,4 +450,81 @@ public class WorkOverTimeServiceImpl extends Service implements WorkOverTimeServ
|
|
|
|
|
return totalHour;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 请假影响加班时长
|
|
|
|
|
* @param kssj 加班开始时间
|
|
|
|
|
* @param jssj 加班结束时间
|
|
|
|
|
* @param workFor 作用时段
|
|
|
|
|
* @param askForLeaveList 请假集合
|
|
|
|
|
* @param askForLeaveItems 请假项目
|
|
|
|
|
* @return 请假在加班中所占时间
|
|
|
|
|
*/
|
|
|
|
|
public int removeAskForLeave(String kssj,String jssj,String workFor,String bdlx,List<Map<String, Object>> askForLeaveList,
|
|
|
|
|
Map<String,Map<String,Object>> askForLeaveItems,List<Map<String, Object>> offsetAskForLeaveAnomaly ){
|
|
|
|
|
int employTime = 0;
|
|
|
|
|
for (int i=0;i<askForLeaveList.size();i++){
|
|
|
|
|
//请假时长
|
|
|
|
|
String qjsc = Util.null2String(askForLeaveList.get(i).get("qjsc"));
|
|
|
|
|
//请假项目
|
|
|
|
|
Map<String,Object> 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)){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if ("".equals(Util.null2String(askForLeaveList.get(i).get("kssj"))) || "".equals(Util.null2String(askForLeaveList.get(i).get("jssj")))){
|
|
|
|
|
if (!"".equals(qjsc)){
|
|
|
|
|
//时长请假
|
|
|
|
|
if (offsetAskForLeaveAnomaly.size() > 0){
|
|
|
|
|
List<Map<String, Object>> list = offsetAskForLeaveAnomaly.stream().filter(e->bdlx.equals(e.get("bdlx"))).collect(Collectors.toList());
|
|
|
|
|
employTime += Math.round(list.size()/Double.valueOf(offsetAskForLeaveAnomaly.size()) *Double.valueOf(qjsc)*60);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
//按照开始时间,结束时间请假
|
|
|
|
|
employTime +=Utils.getStartAndEndTime(kssj,jssj,askForLeaveList.get(i));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return employTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 外出影响加班时长
|
|
|
|
|
* @param kssj 加班开始时间
|
|
|
|
|
* @param jssj 加班结束时间
|
|
|
|
|
* @param evectionList 外出、请假集合
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public int removeEvection(String kssj,String jssj,String workFor,String bdlx,List<Map<String, Object>> evectionList,Map<String,
|
|
|
|
|
Map<String,Object>> evectionItems,List<Map<String, Object>> offsetEvectionAnomaly){
|
|
|
|
|
int askForLeaveTime=0;
|
|
|
|
|
for (int i=0;i<evectionList.size();i++){
|
|
|
|
|
Map<String, Object> resultMap = Maps.newHashMap();
|
|
|
|
|
resultMap.put("item",evectionList.get(i).get("cclx"));
|
|
|
|
|
//请假时长
|
|
|
|
|
String qjsc = Util.null2String(evectionList.get(i).get("ccsc"));
|
|
|
|
|
//请假项目
|
|
|
|
|
Map<String,Object> evectionItem = evectionItems.get(evectionList.get(i).get("cclx"));
|
|
|
|
|
//作用时段
|
|
|
|
|
String zysd = Util.null2String(evectionItem.get("zysd"));
|
|
|
|
|
if (!zysd.contains(workFor) && !WorkForTimeEnum.ALL_TIME.getKey().equals(zysd)){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ("".equals(Util.null2String(evectionList.get(i).get("kssj"))) || "".equals(Util.null2String(evectionList.get(i).get("jssj")))){
|
|
|
|
|
if (!"".equals(qjsc)){
|
|
|
|
|
if (offsetEvectionAnomaly.size() > 0){
|
|
|
|
|
List<Map<String, Object>> list = offsetEvectionAnomaly.stream().filter(e->bdlx.equals(e.get("bdlx"))).collect(Collectors.toList());
|
|
|
|
|
askForLeaveTime += Math.round(list.size()/Double.valueOf(offsetEvectionAnomaly.size()) *Double.valueOf(qjsc)*60);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
//按照开始时间,结束时间请假
|
|
|
|
|
askForLeaveTime +=Utils.getStartAndEndTime(kssj,jssj,evectionList.get(i));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return askForLeaveTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|