加班规则完善

AISIN
Chengliang 5 months ago
parent afb05a2c10
commit 8fb90ca69a

@ -105,8 +105,13 @@ public class KQOverTimeRuleCalBiz {
String changeType_key = fromDate+"_"+changeType;
int computingMode = Util.getIntValue(""+computingModeMap.get(changeType_key),-1);
kqLog.info("AISIN: " + changeType_key+"--"+computingMode);
//清掉之前的加班和调休重新生成
clearOvertimeTX(resourceid, fromDate,overtimeLogMap,splitDate);
//获取加班流程数据
getOverTimeFlowData(resourceid,fromDate,toDate,splitBeanMaps,dateFormatter);
kqLog.info("splitBeanMaps.size():" + splitBeanMaps.size());
for (Map.Entry<String, List<SplitBean>> entry : splitBeanMaps.entrySet()) {
String mapKey = entry.getKey();
kqLog.info("加班流程是否存在 =>"+entry.getKey()+"=>"+splitBeanMaps.containsKey(mapKey));
@ -115,6 +120,7 @@ public class KQOverTimeRuleCalBiz {
if (splitBeans == null || splitBeans.isEmpty()) {
continue;
}
kqLog.info("splitBeans.size():" + splitBeans.size());
for (int j = 0; j < splitBeans.size(); j++) {
SplitBean splitBean = splitBeans.get(j);
kqLog.info("直接通过加班流程生成加班数据:" + splitBean.getRequestId());
@ -366,7 +372,7 @@ public class KQOverTimeRuleCalBiz {
}
/**
* todo 5
*5 ()
*/
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,
@ -375,14 +381,18 @@ public class KQOverTimeRuleCalBiz {
//获取加班流程数据
getOverTimeFlowData(resourceid,realSplitDate,realSplitDate,splitBeanMaps,dateFormatter);
//清掉之前的加班和调休重新生成
clearOvertimeTX(resourceid, realSplitDate,overtimeLogMap,splitDate);
//1.有加班流程 以加班流程数据为准
kqLog.info("加班流程是否存在 =>"+splitBeanMaps.containsKey(mapKey));
if(splitBeanMaps.containsKey(mapKey)) {
List<SplitBean> splitBeans = splitBeanMaps.get(mapKey);
kqLog.info("splitBeans是否为空 =>"+splitBeans.toString());
kqLog.info("splitBeans是否为空 =>"+splitBeans.size());
if(splitBeans == null || splitBeans.isEmpty()){
return false;
}
for (int i = 0; i < splitBeans.size(); i++) {
SplitBean splitBean = splitBeans.get(i);
SplitActionUtil.doComputingMode1_splitBean(computingMode,splitBean);
@ -2827,6 +2837,7 @@ public class KQOverTimeRuleCalBiz {
public void clearOvertimeTX(String resourceid, String belongdate,
Map<String, Object> overtimeLogMap, String splitDate) {
List<String> all_tiaoxiuidList = Lists.newArrayList();
kqLog.info("二开日志开始:"+resourceid+"::"+belongdate+"::"+splitDate );
String all_tiaoxiuids = "";
RecordSet rs = new RecordSet();
String sql = "select * from kq_flow_overtime where resourceid = ? and belongdate=? and ori_belongdate=? ";
@ -2908,6 +2919,7 @@ public class KQOverTimeRuleCalBiz {
String delSql = "delete from kq_flow_overtime where resourceid = ? and belongdate=? and ori_belongdate=? ";
boolean isDelOk = rs.executeUpdate(delSql,resourceid, belongdate,splitDate);
String delSqlLog = delSql+":resourceid:"+resourceid+":belongdate:"+belongdate+":splitDate:"+splitDate+":isDelOk:"+isDelOk;
kqLog.info("删除语句:"+delSqlLog );
logOvertimeMap(overtimeLogMap, delSqlLog, "删除加班中间表数据|delSql");
}

@ -83,7 +83,7 @@ public class SplitActionUtil extends BaseBean {
String fromtime = splitBean.getFromTime();
String belongToDate = DateUtil.addDate(belongDate, 1);
kqLog.info("AISIN参数:" + resourceId + "_" + belongDate + "_" + DateUtil.addDate(belongDate, 1));
if (computingMode == 2 || computingMode == 4) {
if (computingMode == 2 || computingMode == 4 || computingMode == 5) {
int fromtimeIndex = kqTimesArrayComInfo.getArrayindexByTimes(fromtime);
String key = resourceId + "_" + belongDate + "_" + belongDate;
if (fromtimeIndex > 1439) {
@ -97,11 +97,10 @@ public class SplitActionUtil extends BaseBean {
if (computingMode == 1) {
doComputingMode1_splitBean(computingMode,splitBean);
}
if (computingMode == 5) {
kqLog.info("加班规则5直接进入计算并返回");
kqOvertimeCalBiz.buildOvertime(resourceId, belongDate, belongToDate, "加班流程生成加班#flow,requestId:" + requestid);
return;
}
// if (computingMode == 5 && overKeys.isEmpty()) {
// kqLog.info("正常归档+升级方向加班规则5直接进入计算且无打卡数据");
// kqOvertimeCalBiz.buildOvertime(resourceId, belongDate, belongToDate, "加班流程生成加班#flow,requestId:" + requestid);
// }
}
kqLog.info("加班生成调休:handleOverTimeActionMode2 overKeys:"+requestid+"=>"+ JSON.toJSONString(overKeys));
@ -248,10 +247,13 @@ public class SplitActionUtil extends BaseBean {
*/
public static void handleOverTimeAction(List<SplitBean> splitBeans, String requestid,
boolean canMode2, String from_uuid) throws Exception {
// 保证同一个requestid能重复生成调休和加班
if (canMode2) {
clearSameRequestTX(requestid);
}
kqLog.info("归档节点:"+requestid+"::"+canMode2);
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
KQOverTimeRuleCalBiz kqOvertimeCalBiz = new KQOverTimeRuleCalBiz();
RecordSet rs = new RecordSet();
@ -281,7 +283,7 @@ public class SplitActionUtil extends BaseBean {
doComputingMode1_splitBean(computingMode,splitBean);
}
}
if (canMode2 && (computingMode == 2 || computingMode == 4)) {
if (canMode2 && (computingMode == 2 || computingMode == 4 || computingMode == 5)) {
//判断流程对应的日期下有没有打卡数据,如果有的话,需要生成相应的调休数据
String fromtime = splitBean.getFromTime();
int fromtimeIndex = kqTimesArrayComInfo.getArrayindexByTimes(fromtime);
@ -294,11 +296,10 @@ public class SplitActionUtil extends BaseBean {
overKeys.add(key);
}
}
if (computingMode == 5) {
kqLog.info("加班规则5直接进入计算并返回");
kqOvertimeCalBiz.buildOvertime(resourceId, belongDate, toDate, "加班流程生成加班#flow,requestId:" + requestid);
return;
}
// if (canMode2 && computingMode == 5 && overKeys.isEmpty()) {
// kqLog.info("强制归档加班规则5直接进入计算且没有打卡数据");
// kqOvertimeCalBiz.buildOvertime(resourceId, belongDate, toDate, "加班流程生成加班#flow,requestId:" + requestid);
// }
}
}
kqLog.info("加班生成调休:handleOverTimeAction overKeys:" + JSON.toJSONString(overKeys));
@ -508,14 +509,33 @@ public class SplitActionUtil extends BaseBean {
totime = totime + ":00";
Long cur = System.currentTimeMillis();
Timestamp date = new Timestamp(cur);
String flow_overtime_sql = "insert into kq_flow_overtime(requestid,resourceid,fromdate,fromtime,todate,totime,duration_min,expiringdate,belongdate,workMins,durationrule,changetype,paidLeaveEnable,computingMode,fromdatedb,fromtimedb,todatedb,totimedb,tiaoxiuid,create_time,update_time,creator)" +
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ";
if (rs.getDBType().equals("postgresql")) {
boolean isUp = true;
String flow_overtime_sql = "";
if (computingMode == 1) {
flow_overtime_sql = "insert into kq_flow_overtime(requestid,resourceid,fromdate,fromtime,todate,totime,duration_min,expiringdate,belongdate,workMins,durationrule,changetype,paidLeaveEnable,computingMode,fromdatedb,fromtimedb,todatedb,totimedb,tiaoxiuid,create_time,update_time,creator)" +
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?::timestamp,?::timestamp,?) ";
" 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,fromdatedb,fromtimedb,todatedb,totimedb,tiaoxiuid,create_time,update_time,creator)" +
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?::timestamp,?::timestamp,?) ";
}
isUp = rs.executeUpdate(flow_overtime_sql, requestId, resourceId, fromdate, fromtime, todate, totime, D_Mins, "", belongDate, "",
unit, changeType, paidLeaveEnable, computingMode, fromdateDB, fromtimedb, todatedb, totimedb, tiaoxiu_id,date,date, Util.getIntValue(resourceId));
}else if (computingMode == 5) {
flow_overtime_sql = "insert into kq_flow_overtime(requestid,resourceid,fromdate,fromtime,todate,totime,duration_min,expiringdate,belongdate,workMins,durationrule,changetype,paidLeaveEnable,computingMode,fromdatedb,fromtimedb,todatedb,totimedb,tiaoxiuid,create_time,update_time,creator,ori_belongdate)" +
" 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,fromdatedb,fromtimedb,todatedb,totimedb,tiaoxiuid,create_time,update_time,creator,ori_belongdate)" +
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?::timestamp,?::timestamp,?,?) ";
}
isUp = rs.executeUpdate(flow_overtime_sql, requestId, resourceId, fromdate, fromtime, todate, totime, D_Mins, "", belongDate, "",
unit, changeType, paidLeaveEnable, computingMode, fromdateDB, fromtimedb, todatedb, totimedb, tiaoxiu_id,date,date, Util.getIntValue(resourceId),belongDate);
}
boolean isUp = rs.executeUpdate(flow_overtime_sql, requestId, resourceId, fromdate, fromtime, todate, totime, D_Mins, "", belongDate, "",
unit, changeType, paidLeaveEnable, computingMode, fromdateDB, fromtimedb, todatedb, totimedb, tiaoxiu_id,date,date, Util.getIntValue(resourceId));
if (!isUp) {
kqLog.info("doComputingMode1 加班数据flow_overtime_sql记录失败");
} else {

Loading…
Cancel
Save