|
|
|
@ -12,6 +12,7 @@ import com.engine.kq.timer.KQOvertimeCardBean;
|
|
|
|
|
import com.engine.kq.util.KQDurationCalculatorUtil;
|
|
|
|
|
import com.engine.kq.wfset.bean.OvertimeBalanceTimeBean;
|
|
|
|
|
import com.engine.kq.wfset.bean.SplitBean;
|
|
|
|
|
import com.engine.kq.wfset.util.SplitActionUtil;
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
|
import java.sql.Timestamp;
|
|
|
|
@ -112,14 +113,14 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
int computingMode = Util.getIntValue(""+computingModeMap.get(changeType_key),-1);
|
|
|
|
|
|
|
|
|
|
boolean isOk = true;
|
|
|
|
|
new BaseBean().writeLog("新加班规则计算开始 ==>"+computingMode);
|
|
|
|
|
new BaseBean().writeLog("新加班规则5 ==>"+computingMode);
|
|
|
|
|
//把原来下面一个方法里的内容要抽出来,是因为存在如下的问题,如果我是跨天打卡,次日3点,加班归属点设置的是次日2点,2-3这部分的是属于第二天的,需要判断下第二天的加班方式是不是doComputingMode2,如果不是就需要去走对应的doComputingMode方法
|
|
|
|
|
if(2 == computingMode){
|
|
|
|
|
isOk = doComputingMode2WithCard(kqOvertimeCardBean,mapKey,resourceid,changeTypeMap,
|
|
|
|
|
dateFormatter,overtimeLogMap,splitDate,overRulesDetailMap,eventMap,kqTimesArrayComInfo,
|
|
|
|
|
restTimeMap,kqEventLogBiz,uuid,realSplitDate);
|
|
|
|
|
}else if(3 == computingMode){
|
|
|
|
|
isOk = doComputingMode3WithCard(kqOvertimeCardBean,mapKey,resourceid,changeTypeMap,
|
|
|
|
|
isOk = doComputingMode3WithCard(computingMode,kqOvertimeCardBean,mapKey,resourceid,changeTypeMap,
|
|
|
|
|
dateFormatter,overtimeLogMap,splitDate,overRulesDetailMap,eventMap,kqTimesArrayComInfo,
|
|
|
|
|
restTimeMap,kqEventLogBiz,uuid,realSplitDate);
|
|
|
|
|
}else if(4 == computingMode){
|
|
|
|
@ -127,7 +128,7 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
dateFormatter,overtimeLogMap,splitDate,overRulesDetailMap,eventMap,kqTimesArrayComInfo,
|
|
|
|
|
restTimeMap,kqEventLogBiz,uuid,realSplitDate);
|
|
|
|
|
}else if(5 == computingMode){
|
|
|
|
|
isOk = doComputingMode5WithCard(kqOvertimeCardBean,mapKey,resourceid,changeTypeMap,
|
|
|
|
|
isOk = doComputingMode5WithCard(computingMode,kqOvertimeCardBean,mapKey,resourceid,changeTypeMap,
|
|
|
|
|
dateFormatter,overtimeLogMap,splitDate,overRulesDetailMap,eventMap,kqTimesArrayComInfo,
|
|
|
|
|
restTimeMap,kqEventLogBiz,uuid,realSplitDate);
|
|
|
|
|
}
|
|
|
|
@ -315,7 +316,7 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
dateFormatter,overtimeLogMap,splitDate,overRulesDetailMap,eventMap,kqTimesArrayComInfo,
|
|
|
|
|
restTimeMap,kqEventLogBiz,uuid,realSplitDate);
|
|
|
|
|
}else if(3 == computingMode){
|
|
|
|
|
isOk = doComputingMode3WithCard(kqOvertimeCardBean,mapKey,resourceid,changeTypeMap,
|
|
|
|
|
isOk = doComputingMode3WithCard(computingMode,kqOvertimeCardBean,mapKey,resourceid,changeTypeMap,
|
|
|
|
|
dateFormatter,overtimeLogMap,splitDate,overRulesDetailMap,eventMap,kqTimesArrayComInfo,
|
|
|
|
|
restTimeMap,kqEventLogBiz,uuid,realSplitDate);
|
|
|
|
|
}else if(4 == computingMode){
|
|
|
|
@ -333,9 +334,9 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* todo 二开新加班规则为5 取流程和打卡的并集
|
|
|
|
|
* todo 二开新加班规则为5
|
|
|
|
|
*/
|
|
|
|
|
private boolean doComputingMode5WithCard(KQOvertimeCardBean kqOvertimeCardBean, String mapKey, String resourceid, Map<String, Integer> changeTypeMap, DateTimeFormatter dateFormatter, Map<String, Object> overtimeLogMap,
|
|
|
|
|
private boolean doComputingMode5WithCard(int computingMode,KQOvertimeCardBean kqOvertimeCardBean, String mapKey, String resourceid, Map<String, Integer> changeTypeMap, DateTimeFormatter dateFormatter, Map<String, Object> overtimeLogMap,
|
|
|
|
|
String splitDate, Map<String, KQOvertimeRulesDetailEntity> overRulesDetailMap, Map<String, Object> eventMap, KQTimesArrayComInfo kqTimesArrayComInfo, Map<String, List<String[]>> restTimeMap, KQOvertimeLogBiz kqEventLogBiz, String uuid,
|
|
|
|
|
String realSplitDate) throws Exception{
|
|
|
|
|
BaseBean bb = new BaseBean();
|
|
|
|
@ -343,249 +344,26 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
//获取加班流程数据
|
|
|
|
|
getOverTimeFlowData(resourceid,realSplitDate,realSplitDate,splitBeanMaps,dateFormatter);
|
|
|
|
|
|
|
|
|
|
String change_key = realSplitDate+"_"+resourceid;
|
|
|
|
|
int changeType = Util.getIntValue(""+changeTypeMap.get(change_key),-1);
|
|
|
|
|
String changeType_key = realSplitDate+"_"+changeType;
|
|
|
|
|
LocalDate localbelongDate = LocalDate.parse(realSplitDate);
|
|
|
|
|
LocalDate preLocalDate = localbelongDate.minusDays(1);
|
|
|
|
|
String preSplitDate = preLocalDate.format(dateFormatter);
|
|
|
|
|
String preChange_key = preSplitDate+"_"+resourceid;
|
|
|
|
|
int preChangeType = Util.getIntValue(""+changeTypeMap.get(preChange_key),-1);
|
|
|
|
|
String preChangeType_key = preSplitDate+"_"+preChangeType;
|
|
|
|
|
LocalDate nextLocalDate = localbelongDate.plusDays(1);
|
|
|
|
|
String nextSplitDate = nextLocalDate.format(dateFormatter);
|
|
|
|
|
String nextChange_key = nextSplitDate+"_"+resourceid;
|
|
|
|
|
int nextChangeType = Util.getIntValue(""+changeTypeMap.get(nextChange_key),-1);
|
|
|
|
|
String nextChangeType_key = nextSplitDate+"_"+nextChangeType;
|
|
|
|
|
|
|
|
|
|
String changetypeName = 1==changeType ? "节假日" : (2 == changeType ? "工作日" : (3 == changeType ? "休息日" : "异常"));
|
|
|
|
|
String changetypeLogInfo = change_key+"|changeType|"+changeType+"|"+changetypeName;
|
|
|
|
|
logOvertimeMap(overtimeLogMap, changetypeLogInfo, mapKey+"|"+"加班日期属性|changetypeLogInfo");
|
|
|
|
|
|
|
|
|
|
clearOvertimeTX(resourceid, realSplitDate,overtimeLogMap,splitDate);
|
|
|
|
|
logOvertimeMap(overtimeLogMap, kqOvertimeCardBean, mapKey+"|"+"打卡和上下班数据|KQOvertimeCardBean");
|
|
|
|
|
|
|
|
|
|
KQOvertimeRulesDetailEntity kqOvertimeRulesDetailEntity = overRulesDetailMap.get(changeType_key);
|
|
|
|
|
if(kqOvertimeRulesDetailEntity == null){
|
|
|
|
|
String overRuleInfo = "changeType_key:"+changeType_key+":kqOvertimeRulesDetailEntity:"+kqOvertimeRulesDetailEntity;
|
|
|
|
|
logOvertimeMap(overtimeLogMap, overRuleInfo, mapKey+"|"+"加班规则为null|kqOvertimeRulesDetailEntity");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
int overtimeEnable = kqOvertimeRulesDetailEntity.getOvertimeEnable();
|
|
|
|
|
if(overtimeEnable != 1){
|
|
|
|
|
String overtimeEnableInfo = "overtimeEnable:"+overtimeEnable;
|
|
|
|
|
logOvertimeMap(overtimeLogMap, overtimeEnableInfo, mapKey+"|"+"未开启加班规则|overtimeEnable");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(kqOvertimeCardBean != null){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int[] initArrays = kqTimesArrayComInfo.getInitArr();
|
|
|
|
|
bb.writeLog("初始化一天时间数组==>"+ Arrays.toString(initArrays));
|
|
|
|
|
|
|
|
|
|
List<Map<String, String>> hasOverTime4SignList = Lists.newArrayList();
|
|
|
|
|
getHasOverTimeData(resourceid,realSplitDate,hasOverTime4SignList);
|
|
|
|
|
Map<String,String> signinoffMap = buildOvertimeCard(kqOvertimeCardBean, resourceid, realSplitDate, kqTimesArrayComInfo, restTimeMap, changeType_key,initArrays,hasOverTime4SignList,
|
|
|
|
|
overRulesDetailMap,true,overtimeLogMap, preChangeType_key,nextChangeType_key);
|
|
|
|
|
logOvertimeMap(overtimeLogMap, signinoffMap, mapKey+"|"+"获取上下班打卡数据|signinoffMap");
|
|
|
|
|
|
|
|
|
|
String signinTime = Util.null2String(signinoffMap.get("signinTime"));
|
|
|
|
|
String signoutTime = Util.null2String(signinoffMap.get("signoutTime"));
|
|
|
|
|
String signinDate = Util.null2String(signinoffMap.get("signinDate"));
|
|
|
|
|
String signoutDate = Util.null2String(signinoffMap.get("signoutDate"));
|
|
|
|
|
|
|
|
|
|
int signinTimeIndex = kqTimesArrayComInfo.getArrayindexByTimes(signinTime);
|
|
|
|
|
int signoutTimeIndex = kqTimesArrayComInfo.getArrayindexByTimes(signoutTime);
|
|
|
|
|
|
|
|
|
|
if(signinTimeIndex < signoutTimeIndex){
|
|
|
|
|
//先覆盖打卡 打卡区间都是1
|
|
|
|
|
int over_count = kqTimesArrayComInfo.getCnt(initArrays, signinTimeIndex, signoutTimeIndex, 1);
|
|
|
|
|
String overCountLogInfo = "signinTimeIndex:"+signinTimeIndex+":signoutTimeIndex:"+signoutTimeIndex+":over_count:"+over_count;
|
|
|
|
|
|
|
|
|
|
bb.writeLog("打卡时长获取:"+overCountLogInfo+"=>"+Arrays.toString(initArrays));
|
|
|
|
|
logOvertimeMap(overtimeLogMap, overCountLogInfo, mapKey+"|"+"打卡区间,得到打卡时长|over_count");
|
|
|
|
|
if(over_count > 0){
|
|
|
|
|
int restTimeType = 1;
|
|
|
|
|
String kqOvertimeRulesDetailEntityLogInfo = kqOvertimeRulesDetailEntity==null ? "" :JSON.toJSONString(kqOvertimeRulesDetailEntity);
|
|
|
|
|
logOvertimeMap(overtimeLogMap, kqOvertimeRulesDetailEntityLogInfo, mapKey+"|具体这个人这一天对应的加班规则|KQOvertimeRulesDetailEntity");
|
|
|
|
|
int minimumLen = -1;
|
|
|
|
|
if(kqOvertimeRulesDetailEntity != null){
|
|
|
|
|
minimumLen = kqOvertimeRulesDetailEntity.getMinimumLen();
|
|
|
|
|
if(over_count < minimumLen){
|
|
|
|
|
String minInfo = "over_count:"+over_count+":minimumLen:"+minimumLen;
|
|
|
|
|
bb.writeLog("打卡时长小于最小加班时长=>"+minInfo);
|
|
|
|
|
logOvertimeMap(overtimeLogMap, minInfo, mapKey+"|打卡时长小于最小加班时长|over_count<minimumUnit");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bb.writeLog("进入计算 => "+splitBeanMaps.containsKey(mapKey));
|
|
|
|
|
if(splitBeanMaps.containsKey(mapKey)) {
|
|
|
|
|
List<SplitBean> splitBeans = splitBeanMaps.get(mapKey);
|
|
|
|
|
String flowinfo = "";
|
|
|
|
|
if(splitBeans != null && !splitBeans.isEmpty()){
|
|
|
|
|
flowinfo = JSON.toJSONString(splitBeans, SerializerFeature.DisableCheckSpecialChar,SerializerFeature.DisableCircularReferenceDetect);
|
|
|
|
|
}
|
|
|
|
|
eventMap.put(mapKey+"|"+"加班流程数据|flowinfo", flowinfo);
|
|
|
|
|
bb.writeLog("splitBeans size => "+splitBeans.isEmpty());
|
|
|
|
|
if(splitBeans == null || splitBeans.isEmpty()){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int m = 0; m < splitBeans.size(); m++) {
|
|
|
|
|
SplitBean splitBean = splitBeans.get(m);
|
|
|
|
|
String dataid = splitBean.getDataId();
|
|
|
|
|
String detailid = splitBean.getDetailId();
|
|
|
|
|
String flow_fromdate = splitBean.getFromDate();
|
|
|
|
|
String flow_fromtime = splitBean.getFromTime();
|
|
|
|
|
String flow_todate = splitBean.getToDate();
|
|
|
|
|
String flow_totime = splitBean.getToTime();
|
|
|
|
|
String fromdatedb = splitBean.getFromdatedb();
|
|
|
|
|
String fromtimedb = splitBean.getFromtimedb();
|
|
|
|
|
String todatedb = splitBean.getTodatedb();
|
|
|
|
|
String totimedb = splitBean.getTotimedb();
|
|
|
|
|
String requestid = splitBean.getRequestId();
|
|
|
|
|
double d_mins = splitBean.getD_Mins();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(d_mins <= 0){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
String flow_key = mapKey+"|"+"flow_fromdate|"+flow_fromdate+"|flow_todate|"+flow_todate
|
|
|
|
|
+"|flow_fromtime|"+flow_fromtime+"|flow_totime|"+flow_totime;
|
|
|
|
|
bb.writeLog("加班流程数据集:"+flow_key);
|
|
|
|
|
|
|
|
|
|
//如果打卡数据有了,再拿流程数据去覆盖,得到有效的打卡区间,这个区间肯定已经是去除了上下班时间和休息时间还有重复打卡的部分
|
|
|
|
|
List<Integer> cross_time_list = Lists.newArrayList();
|
|
|
|
|
// cross_time_list里存的是排除了工作时间的打卡段,找到1表示找到打卡开始的点了,找到-2表示找到打卡结束的点了
|
|
|
|
|
get_cross_time_list(cross_time_list,initArrays,signinTimeIndex,signoutTimeIndex,1,-2);
|
|
|
|
|
|
|
|
|
|
bb.writeLog("cross_time_list集合=>"+cross_time_list.toString()+"覆盖前1=>"+Arrays.toString(initArrays));
|
|
|
|
|
logOvertimeMap(overtimeLogMap, cross_time_list, flow_key+"|cross_time_list");
|
|
|
|
|
|
|
|
|
|
if(flow_fromdate.compareTo(realSplitDate) > 0){
|
|
|
|
|
flow_fromtime = kqTimesArrayComInfo.turn24to48Time(flow_fromtime);
|
|
|
|
|
}
|
|
|
|
|
if(flow_todate.compareTo(realSplitDate) > 0){
|
|
|
|
|
flow_totime = kqTimesArrayComInfo.turn24to48Time(flow_totime);
|
|
|
|
|
}
|
|
|
|
|
int flow_fromIndex = kqTimesArrayComInfo.getArrayindexByTimes(flow_fromtime);
|
|
|
|
|
int flow_toIndex = kqTimesArrayComInfo.getArrayindexByTimes(flow_totime);
|
|
|
|
|
bb.writeLog("流程加班开始和结束索引=>"+flow_fromIndex+"=>"+flow_toIndex);
|
|
|
|
|
|
|
|
|
|
//2.根据流程加班时间 在已有的数组上覆盖成2
|
|
|
|
|
Arrays.fill(initArrays, flow_fromIndex, flow_toIndex,2);
|
|
|
|
|
bb.writeLog("覆盖2后=>"+Arrays.toString(initArrays));
|
|
|
|
|
|
|
|
|
|
int across_mins = 0;
|
|
|
|
|
//3.获取一天数组中有多少2(流程)和多少 1(打卡)
|
|
|
|
|
int flow_count = kqTimesArrayComInfo.getCnt(initArrays, flow_fromIndex, flow_toIndex, 2);
|
|
|
|
|
bb.writeLog("flow_count => "+flow_count);
|
|
|
|
|
int dk_count = 0;
|
|
|
|
|
int mins = signoutTimeIndex-signinTimeIndex;
|
|
|
|
|
if(mins <= 0){
|
|
|
|
|
String crossInfo = "flow_cross_fromtime_index:"+signinTimeIndex+":flow_cross_totime_index:"+signoutTimeIndex+":mins:"+mins;
|
|
|
|
|
bb.writeLog("打卡时长小于最小加班时长|crossInfo"+crossInfo);
|
|
|
|
|
logOvertimeMap(overtimeLogMap, crossInfo, flow_key+"|打卡时长小于最小加班时长|crossInfo");
|
|
|
|
|
}else {
|
|
|
|
|
dk_count = kqTimesArrayComInfo.getCnt(initArrays, signinTimeIndex, signoutTimeIndex, 1);
|
|
|
|
|
}
|
|
|
|
|
across_mins = flow_count + dk_count;
|
|
|
|
|
|
|
|
|
|
String flow_cross_key = "加班计算区间|"+kqTimesArrayComInfo.getTimesByArrayindex(signinTimeIndex)+"-"+kqTimesArrayComInfo.getTimesByArrayindex(signoutTimeIndex);
|
|
|
|
|
logOvertimeMap(overtimeLogMap, mins, flow_cross_key+"|原始加班区间生成的加班时长|mins");
|
|
|
|
|
bb.writeLog("原始加班区间生成的加班时长|mins"+mins);
|
|
|
|
|
bb.writeLog("across_mins => "+across_mins);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(kqOvertimeRulesDetailEntity != null){
|
|
|
|
|
//我这个方法是针对每次生成的加班数据做排除休息时长的处理
|
|
|
|
|
restTimeType = kqOvertimeRulesDetailEntity.getRestTimeType();
|
|
|
|
|
if(restTimeType == 2){
|
|
|
|
|
across_mins = new KQOverTimeFlowBiz().handle_restlength(across_mins,restTimeMap,changeType_key);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
int card_mins = over_count;
|
|
|
|
|
double double_mins = getD_MinsByUnit((1.0*across_mins));
|
|
|
|
|
across_mins = (int)double_mins;
|
|
|
|
|
if(across_mins <= 0){
|
|
|
|
|
logOvertimeMap(overtimeLogMap, across_mins, flow_key+"|经过单位换算之后时长为0|across_mins");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if(across_mins < minimumLen){
|
|
|
|
|
String minInfo = "across_mins:"+across_mins+":minimumLen:"+minimumLen;
|
|
|
|
|
logOvertimeMap(overtimeLogMap, minInfo, flow_key+"|打卡时长小于最小加班时长|over_count<minimumUnit");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
String overtime_uuid = UUID.randomUUID().toString();
|
|
|
|
|
String tiaoxiuId = "";
|
|
|
|
|
String flow_dataid = dataid+"_"+detailid;
|
|
|
|
|
int computingMode = 5;
|
|
|
|
|
|
|
|
|
|
int unit = KQOvertimeRulesBiz.getMinimumUnit();
|
|
|
|
|
String workingHours = "";
|
|
|
|
|
String overtime_type = splitBean.getOvertime_type();
|
|
|
|
|
Map<String,Object> otherParam = Maps.newHashMap();
|
|
|
|
|
otherParam.put("overtime_type", overtime_type);
|
|
|
|
|
otherParam.put("changeType", String.valueOf(changeType));
|
|
|
|
|
int paidLeaveEnableType = kqOvertimeRulesDetailEntity.getPaidLeaveEnableType();
|
|
|
|
|
if(2 == paidLeaveEnableType){
|
|
|
|
|
logOvertimeMap(overtimeLogMap, overtime_type, flow_key+"|关联调休与否来自于流程选择,加班类型下拉框值|overtime_type");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int paidLeaveEnable = getPaidLeaveEnable(kqOvertimeRulesDetailEntity, overtime_type);
|
|
|
|
|
|
|
|
|
|
otherParam.put("overtimeLogMap", overtimeLogMap);
|
|
|
|
|
logOvertimeMap(overtimeLogMap, across_mins, flow_key+"|最终生成的加班分钟数|overtime_mins");
|
|
|
|
|
tiaoxiuId = KQBalanceOfLeaveBiz.addExtraAmountByDis5(resourceid,realSplitDate,across_mins+"","0",workingHours,requestid,"1",realSplitDate,otherParam);
|
|
|
|
|
if(Util.getIntValue(tiaoxiuId) > 0){
|
|
|
|
|
kqLog.info("doComputingMode4 生成调休成功,调休id:"+tiaoxiuId+":resourceid:"+resourceid+":realSplitDate:"+realSplitDate);
|
|
|
|
|
}else{
|
|
|
|
|
kqLog.info("doComputingMode4 生成调休失败,调休id:"+tiaoxiuId+":resourceid:"+resourceid+":realSplitDate:"+realSplitDate);
|
|
|
|
|
}
|
|
|
|
|
logOvertimeMap(overtimeLogMap, tiaoxiuId, flow_key+"|最终生成的调休id|tiaoxiuId");
|
|
|
|
|
|
|
|
|
|
String flow_overtime_sql = "insert into kq_flow_overtime (requestid,resourceid,fromdate,fromtime,todate,totime,duration_min,expiringdate,belongdate,"
|
|
|
|
|
+ "workMins,durationrule,changetype,paidLeaveEnable,computingMode,tiaoxiuId,uuid,fromdatedb,fromtimedb,todatedb,totimedb,flow_mins,card_mins,ori_belongdate,flow_dataid,create_time,update_time,creator)"+
|
|
|
|
|
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ";
|
|
|
|
|
if (rs.getDBType().equals("postgresql")) {
|
|
|
|
|
flow_overtime_sql = "insert into kq_flow_overtime (requestid,resourceid,fromdate,fromtime,todate,totime,duration_min,expiringdate,belongdate,"
|
|
|
|
|
+ "workMins,durationrule,changetype,paidLeaveEnable,computingMode,tiaoxiuId,uuid,fromdatedb,fromtimedb,todatedb,totimedb,flow_mins,card_mins,ori_belongdate,flow_dataid,create_time,update_time,creator)"+
|
|
|
|
|
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?::timestamp,?::timestamp,?) ";
|
|
|
|
|
}
|
|
|
|
|
signinTime = kqTimesArrayComInfo.turn48to24Time(signinTime);
|
|
|
|
|
signoutTime = kqTimesArrayComInfo.turn48to24Time(signoutTime);
|
|
|
|
|
if(signinTime.length() == 5){
|
|
|
|
|
signinTime = signinTime+":00";
|
|
|
|
|
}
|
|
|
|
|
if(signoutTime.length() == 5){
|
|
|
|
|
signoutTime = signoutTime+":00";
|
|
|
|
|
}
|
|
|
|
|
Long cur = System.currentTimeMillis();
|
|
|
|
|
Timestamp date = new Timestamp(cur);
|
|
|
|
|
boolean isUp = rs.executeUpdate(flow_overtime_sql, requestid,resourceid,signinDate,signinTime,signoutDate,signoutTime,across_mins,"",realSplitDate,
|
|
|
|
|
"",unit,changeType,paidLeaveEnable,computingMode,tiaoxiuId,overtime_uuid,fromdatedb,fromtimedb,todatedb,totimedb,d_mins,card_mins,splitDate,flow_dataid,date,date,Util.getIntValue(resourceid));
|
|
|
|
|
|
|
|
|
|
String overtimeid = get_overtime_uuid(overtime_uuid);
|
|
|
|
|
kqEventLogBiz.updateOvertimeId(uuid, overtimeid);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
//有打卡没有流程
|
|
|
|
|
logOvertimeMap(overtimeLogMap, mapKey, mapKey+"|"+"加班流程为空");
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
logOvertimeMap(overtimeLogMap, overCountLogInfo, mapKey+"|"+"打卡数据时长为0");
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
String overCountLogInfo = "signinTimeIndex:"+signinTimeIndex+":signoutTimeIndex:"+signoutTimeIndex;
|
|
|
|
|
logOvertimeMap(overtimeLogMap, overCountLogInfo, mapKey+"|"+"打卡数据异常");
|
|
|
|
|
//有加班流程 以加班流程数据为准
|
|
|
|
|
bb.writeLog("加班流程是否存在 =>"+splitBeanMaps.containsKey(mapKey));
|
|
|
|
|
if(splitBeanMaps.containsKey(mapKey)) {
|
|
|
|
|
List<SplitBean> splitBeans = splitBeanMaps.get(mapKey);
|
|
|
|
|
bb.writeLog("splitBeans是否为空 =>"+splitBeans.toString());
|
|
|
|
|
if(splitBeans == null || splitBeans.isEmpty()){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
logOvertimeMap(overtimeLogMap, "打卡数据KQOvertimeCardBean为null", mapKey+"|"+"打卡和上下班数据|KQOvertimeCardBean");
|
|
|
|
|
for (int i = 0; i < splitBeans.size(); i++) {
|
|
|
|
|
SplitBean splitBean = splitBeans.get(i);
|
|
|
|
|
bb.writeLog("生成加班数据 =>"+computingMode);
|
|
|
|
|
SplitActionUtil.doComputingMode1_splitBean(computingMode,splitBean);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
//没有加班流程 以打卡数据为准 直接走3
|
|
|
|
|
doComputingMode3WithCard(computingMode,kqOvertimeCardBean,mapKey,resourceid,changeTypeMap,
|
|
|
|
|
dateFormatter,overtimeLogMap,splitDate,overRulesDetailMap,eventMap,kqTimesArrayComInfo,
|
|
|
|
|
restTimeMap,kqEventLogBiz,uuid,realSplitDate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -923,7 +701,7 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
dateFormatter,overtimeLogMap,splitDate,overRulesDetailMap,eventMap,kqTimesArrayComInfo,
|
|
|
|
|
restTimeMap,kqEventLogBiz,uuid,realSplitDate);
|
|
|
|
|
}else if(3 == computingMode){
|
|
|
|
|
isOk = doComputingMode3WithCard(kqOvertimeCardBean,mapKey,resourceid,changeTypeMap,
|
|
|
|
|
isOk = doComputingMode3WithCard(computingMode,kqOvertimeCardBean,mapKey,resourceid,changeTypeMap,
|
|
|
|
|
dateFormatter,overtimeLogMap,splitDate,overRulesDetailMap,eventMap,kqTimesArrayComInfo,
|
|
|
|
|
restTimeMap,kqEventLogBiz,uuid,realSplitDate);
|
|
|
|
|
}else if(4 == computingMode){
|
|
|
|
@ -944,7 +722,7 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
/**
|
|
|
|
|
* 把获取打卡数据后处理的部分拆出来
|
|
|
|
|
*/
|
|
|
|
|
private boolean doComputingMode3WithCard(KQOvertimeCardBean kqOvertimeCardBean, String mapKey, String resourceid, Map<String, Integer> changeTypeMap, DateTimeFormatter dateFormatter, Map<String, Object> overtimeLogMap,
|
|
|
|
|
private boolean doComputingMode3WithCard(int computingMode,KQOvertimeCardBean kqOvertimeCardBean, String mapKey, String resourceid, Map<String, Integer> changeTypeMap, DateTimeFormatter dateFormatter, Map<String, Object> overtimeLogMap,
|
|
|
|
|
String splitDate, Map<String, KQOvertimeRulesDetailEntity> overRulesDetailMap, Map<String, Object> eventMap, KQTimesArrayComInfo kqTimesArrayComInfo, Map<String, List<String[]>> restTimeMap, KQOvertimeLogBiz kqEventLogBiz, String uuid,
|
|
|
|
|
String realSplitDate) throws Exception{
|
|
|
|
|
String change_key = realSplitDate+"_"+resourceid;
|
|
|
|
@ -1030,7 +808,7 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
String overtime_uuid = UUID.randomUUID().toString();
|
|
|
|
|
String tiaoxiuId = "";
|
|
|
|
|
String workingHours = "";
|
|
|
|
|
int computingMode = 3;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String,Object> otherParam = Maps.newHashMap();
|
|
|
|
|
otherParam.put("changeType", String.valueOf(changeType));
|
|
|
|
@ -1225,7 +1003,7 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
dateFormatter,overtimeLogMap,splitDate,overRulesDetailMap,eventMap,kqTimesArrayComInfo,
|
|
|
|
|
restTimeMap,kqEventLogBiz,uuid,realSplitDate);
|
|
|
|
|
}else if(3 == computingMode){
|
|
|
|
|
isOk = doComputingMode3WithCard(kqOvertimeCardBean,mapKey,resourceid,changeTypeMap,
|
|
|
|
|
isOk = doComputingMode3WithCard(computingMode,kqOvertimeCardBean,mapKey,resourceid,changeTypeMap,
|
|
|
|
|
dateFormatter,overtimeLogMap,splitDate,overRulesDetailMap,eventMap,kqTimesArrayComInfo,
|
|
|
|
|
restTimeMap,kqEventLogBiz,uuid,realSplitDate);
|
|
|
|
|
}else if(4 == computingMode){
|
|
|
|
|