|
|
|
@ -83,8 +83,13 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
String key = resourceid + "_" + splitDate;
|
|
|
|
|
String change_key = splitDate + "_" + resourceid;
|
|
|
|
|
int changeType = Util.getIntValue("" + changeTypeMap.get(change_key), -1);
|
|
|
|
|
|
|
|
|
|
baseWriteLog("buildOvertime-changeType:"+changeType);
|
|
|
|
|
|
|
|
|
|
String changeType_key = splitDate + "_" + changeType;
|
|
|
|
|
int computingMode = Util.getIntValue(""+computingModeMap.get(changeType_key),-1);
|
|
|
|
|
baseWriteLog("buildOvertime-computingMode:"+computingMode);
|
|
|
|
|
|
|
|
|
|
if(computingMode == 2){
|
|
|
|
|
// 需审批,以打卡为准,但是不能超过审批时长
|
|
|
|
|
doComputingMode2(resourceid,splitDate,dateFormatter,changeTypeMap,overRulesDetailMap,restTimeMap,
|
|
|
|
@ -156,7 +161,11 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
while (iterator.hasNext()) {
|
|
|
|
|
Entry<String, KQOvertimeCardBean> next = iterator.next();
|
|
|
|
|
String mapKey = next.getKey();
|
|
|
|
|
baseWriteLog("mapKey:"+mapKey);
|
|
|
|
|
KQOvertimeCardBean kqOvertimeCardBean = next.getValue();
|
|
|
|
|
|
|
|
|
|
baseWriteLog("kqOvertimeCardBean:"+kqOvertimeCardBean.toString());
|
|
|
|
|
|
|
|
|
|
String[] mapKeys = mapKey.split("_");
|
|
|
|
|
if (mapKeys.length != 2) {
|
|
|
|
|
continue;
|
|
|
|
@ -169,6 +178,7 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
|
|
|
|
|
String change_key = realSplitDate+"_"+resourceid;
|
|
|
|
|
int changeType = Util.getIntValue(""+changeTypeMap.get(change_key),-1);
|
|
|
|
|
baseWriteLog("doComputingMode4--changeType:"+changeType);
|
|
|
|
|
String changeType_key = realSplitDate+"_"+changeType;
|
|
|
|
|
String changetypeName = 1==changeType ? "节假日" : (2 == changeType ? "工作日" : (3 == changeType ? "休息日" : "异常"));
|
|
|
|
|
String changetypeLogInfo = change_key+"|changeType|"+changeType+"|"+changetypeName;
|
|
|
|
@ -193,6 +203,7 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
if(kqOvertimeCardBean != null){
|
|
|
|
|
|
|
|
|
|
int[] initArrays = kqTimesArrayComInfo.getInitArr();
|
|
|
|
|
getInitArrays(initArrays,"1");
|
|
|
|
|
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,
|
|
|
|
@ -1225,7 +1236,7 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(all_has_duration_min > 0){
|
|
|
|
|
for(Map.Entry<String,String> me : hasCardMap.entrySet()){
|
|
|
|
|
for(Entry<String,String> me : hasCardMap.entrySet()){
|
|
|
|
|
String cardKey = me.getKey();
|
|
|
|
|
String cardValue = me.getValue();
|
|
|
|
|
if(cardKey.equalsIgnoreCase(nowCardKey)){
|
|
|
|
@ -1471,6 +1482,7 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
Arrays.fill(initArrays, signinTimeIndex, signoutTimeIndex,1);
|
|
|
|
|
}
|
|
|
|
|
KQOvertimeRulesDetailEntity kqOvertimeRulesDetailEntity = overRulesDetailMap.get(changeType_key);
|
|
|
|
|
baseWriteLog("restTimeMap.containsKey(changeType_key):"+restTimeMap.containsKey(changeType_key));
|
|
|
|
|
if(restTimeMap.containsKey(changeType_key)){
|
|
|
|
|
List<String[]> restTimeList = restTimeMap.get(changeType_key);
|
|
|
|
|
logOvertimeMap(overtimeLogMap, restTimeList, "非工作时间设置的排除休息时间区间|restTimeList");
|
|
|
|
@ -1505,11 +1517,14 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getInitArrays(initArrays,"7");
|
|
|
|
|
boolean isNextDay = false;
|
|
|
|
|
clearWorkAndRestTime(resourceid,splitDate,isNextDay,kqTimesArrayComInfo,overtimeLogMap,kqOvertimeRulesDetailEntity,initArrays,signinTimeIndex);
|
|
|
|
|
getInitArrays(initArrays,"71");
|
|
|
|
|
isNextDay = true;
|
|
|
|
|
clearWorkAndRestTime(resourceid,DateUtil.addDate(splitDate, 1),isNextDay, kqTimesArrayComInfo,
|
|
|
|
|
overtimeLogMap, kqOvertimeRulesDetailEntity, initArrays, signinTimeIndex);
|
|
|
|
|
getInitArrays(initArrays,"72");
|
|
|
|
|
|
|
|
|
|
if(!hasOverTimeList.isEmpty() && needHasOverTime){
|
|
|
|
|
if(hasOverTimeList != null && !hasOverTimeList.isEmpty()){
|
|
|
|
@ -1554,13 +1569,21 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
KQOvertimeRulesDetailEntity kqOvertimeRulesDetailEntity, int[] initArrays,
|
|
|
|
|
int signinTimeIndex) {
|
|
|
|
|
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime----splitDate:"+splitDate);
|
|
|
|
|
KQWorkTime kqWorkTime = new KQWorkTime();
|
|
|
|
|
WorkTimeEntity workTime = kqWorkTime.getWorkTime(resourceid, splitDate);
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---getRestShift:"+workTime.getRestShift());
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---getWorkMins:"+workTime.getWorkMins());
|
|
|
|
|
|
|
|
|
|
if (workTime == null || workTime.getWorkMins() == 0) {
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---22-");
|
|
|
|
|
}else{
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---333-");
|
|
|
|
|
if (workTime.getKQType().equals("3")) {//自由工时
|
|
|
|
|
//目前自由工时不加班
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---444-");
|
|
|
|
|
} else {
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---555-");
|
|
|
|
|
boolean oneSign = false;
|
|
|
|
|
List<TimeScopeEntity> lsSignTime = new ArrayList<>();
|
|
|
|
|
List<TimeScopeEntity> lsWorkTime = new ArrayList<>();
|
|
|
|
@ -1570,13 +1593,18 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
lsWorkTime = workTime.getWorkTime();//工作时间
|
|
|
|
|
lsRestTime = workTime.getRestTime();//休息时段时间
|
|
|
|
|
oneSign = lsWorkTime!=null&&lsWorkTime.size()==1;
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---oneSign:"+oneSign);
|
|
|
|
|
|
|
|
|
|
if(lsWorkTime != null && !lsWorkTime.isEmpty()){
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---6666");
|
|
|
|
|
for (int i = 0; lsWorkTime != null && i < lsWorkTime.size(); i++) {
|
|
|
|
|
TimeScopeEntity workTimeScope = lsWorkTime.get(i);
|
|
|
|
|
if(oneSign){
|
|
|
|
|
boolean is_flow_humanized = KQSettingsBiz.is_flow_humanized();
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---is_flow_humanized:"+is_flow_humanized);
|
|
|
|
|
|
|
|
|
|
if(is_flow_humanized){
|
|
|
|
|
|
|
|
|
|
String workBeginTime = Util.null2String(workTimeScope.getBeginTime());
|
|
|
|
|
String ori_workBeginTime = workBeginTime;
|
|
|
|
|
int workBeginIdx = kqTimesArrayComInfo.getArrayindexByTimes(workBeginTime);
|
|
|
|
@ -1605,6 +1633,12 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
workTimeScope.setBeginTimeAcross(workBeginIdx>=1440?true:false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---workBeginTime:"+workBeginTime);
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---workBeginIdx:"+workBeginIdx);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(shifRuleMap.containsKey("shift_endworktime")){
|
|
|
|
|
String shift_endworktime = Util.null2String(shifRuleMap.get("shift_endworktime"));
|
|
|
|
|
if(shift_endworktime.length() > 0){
|
|
|
|
@ -1614,6 +1648,12 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
workTimeScope.setEndTimeAcross(workEndIdx>=1440?true:false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---workBeginTime:"+workBeginTime);
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---workBeginIdx:"+workBeginIdx);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1626,6 +1666,14 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
String endtime = last_TimeScopeEntity.getEndTime();
|
|
|
|
|
int begintimeIndex = kqTimesArrayComInfo.getArrayindexByTimes(begintime);
|
|
|
|
|
int endtimeIndex = kqTimesArrayComInfo.getArrayindexByTimes(endtime);
|
|
|
|
|
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---begintime:"+begintime);
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---endtime:"+endtime);
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---begintimeIndex:"+begintimeIndex);
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---endtimeIndex:"+endtimeIndex);
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---isNextDay:"+isNextDay);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(isNextDay){
|
|
|
|
|
begintimeIndex = begintimeIndex + 1440;
|
|
|
|
|
endtimeIndex = endtimeIndex + 1440;
|
|
|
|
@ -1636,11 +1684,19 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
endtimeIndex = initArrays.length-1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getInitArrays(initArrays,"7-11");
|
|
|
|
|
|
|
|
|
|
String workTimeLogInfo = "begintime:"+begintime+":endtime:"+endtime+":isNextDay:"+isNextDay;
|
|
|
|
|
logOvertimeMap(overtimeLogMap, workTimeLogInfo, "工作日的上下班时间|workTimeLogInfo");
|
|
|
|
|
if(begintimeIndex < endtimeIndex){
|
|
|
|
|
Arrays.fill(initArrays, begintimeIndex, endtimeIndex, -2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getInitArrays(initArrays,"7-12");
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---isNextDay:"+isNextDay);
|
|
|
|
|
|
|
|
|
|
if(!isNextDay){
|
|
|
|
|
if(kqOvertimeRulesDetailEntity != null){
|
|
|
|
|
int startTime = kqOvertimeRulesDetailEntity.getStartTime();
|
|
|
|
@ -1650,6 +1706,7 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
Arrays.fill(initArrays, endtimeIndex, after_endtimeIndex, -2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
getInitArrays(initArrays,"7-13");
|
|
|
|
|
int has_cut_point = kqOvertimeRulesDetailEntity.getHas_cut_point();
|
|
|
|
|
if(has_cut_point == 1){
|
|
|
|
|
int before_startTime = kqOvertimeRulesDetailEntity.getBefore_startTime();
|
|
|
|
@ -1660,11 +1717,16 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
getInitArrays(initArrays,"7-14");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(lsRestTime != null && !lsRestTime.isEmpty()){
|
|
|
|
|
String restTimeLogInfo = JSON.toJSONString(lsRestTime);
|
|
|
|
|
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---restTimeLogInfo:"+restTimeLogInfo);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logOvertimeMap(overtimeLogMap, restTimeLogInfo, "工作日的休息时间|restTimeLogInfo");
|
|
|
|
|
for(int p = 0 ; p < lsRestTime.size(); p++){
|
|
|
|
|
TimeScopeEntity rest_TimeScopeEntity = lsRestTime.get(p);
|
|
|
|
@ -1672,6 +1734,13 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
String endtime = rest_TimeScopeEntity.getEndTime();
|
|
|
|
|
int begintimeIndex = kqTimesArrayComInfo.getArrayindexByTimes(begintime);
|
|
|
|
|
int endtimeIndex = kqTimesArrayComInfo.getArrayindexByTimes(endtime);
|
|
|
|
|
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---begintime2:"+begintime);
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---endtime2:"+endtime);
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---begintimeIndex2:"+begintimeIndex);
|
|
|
|
|
baseWriteLog("clearWorkAndRestTime---endtimeIndex2:"+endtimeIndex);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(isNextDay){
|
|
|
|
|
begintimeIndex = begintimeIndex + 1440;
|
|
|
|
|
endtimeIndex = endtimeIndex + 1440;
|
|
|
|
@ -1682,9 +1751,14 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
endtimeIndex = initArrays.length-1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getInitArrays(initArrays,"7-20");
|
|
|
|
|
|
|
|
|
|
if(begintimeIndex < endtimeIndex){
|
|
|
|
|
Arrays.fill(initArrays, begintimeIndex, endtimeIndex, -2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getInitArrays(initArrays,"7-21");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -3070,6 +3144,7 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
//如果是休班次,加班类型为休息日加班
|
|
|
|
|
if (isRestSerial(searIdFrom,rs)) {
|
|
|
|
|
jblxNew = "1";
|
|
|
|
|
new BaseBean().writeLog("insertJbtz 原始sc:"+sc);
|
|
|
|
|
sc = recalculateOverTime(sc,searIdFrom, ksrq, kssj, jsrq, jssj, rs, singleRs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -3083,7 +3158,7 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
findNew.execute(sqlFindnew);
|
|
|
|
|
|
|
|
|
|
if (findNew.next()){
|
|
|
|
|
idNew = weaver.general.Util.null2String(findNew.getString("id"));
|
|
|
|
|
idNew = Util.null2String(findNew.getString("id"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 权限重构
|
|
|
|
@ -3110,44 +3185,63 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
}
|
|
|
|
|
private static Double recalculateOverTime(Double sc, String serialId, String ksrq, String kssj, String jsrq, String jssj, RecordSet rs, RecordSet singleRs) {
|
|
|
|
|
BaseBean bb = new BaseBean();
|
|
|
|
|
|
|
|
|
|
bb.writeLog("recalculateOverTime 原始sc:"+sc);
|
|
|
|
|
bb.writeLog("recalculateOverTime serialId:"+serialId);
|
|
|
|
|
bb.writeLog("recalculateOverTime ksrq:"+ksrq);
|
|
|
|
|
bb.writeLog("recalculateOverTime kssj:"+kssj);
|
|
|
|
|
bb.writeLog("recalculateOverTime jsrq:"+jsrq);
|
|
|
|
|
bb.writeLog("recalculateOverTime jssj:"+jssj);
|
|
|
|
|
bb.writeLog("recalculateOverTime singleRs:"+singleRs);
|
|
|
|
|
try {
|
|
|
|
|
boolean isAcross = false;
|
|
|
|
|
BigDecimal workTimeTotal = new BigDecimal(TimeUtil.timeInterval(ksrq + " " + kssj + ":00", jsrq + " " + jssj + ":00"));
|
|
|
|
|
bb.writeLog("recalculateOverTime workTimeTotal:"+workTimeTotal);
|
|
|
|
|
BigDecimal restTimeCount = new BigDecimal(0);
|
|
|
|
|
if (ksrq.compareTo(jsrq) > 0) {
|
|
|
|
|
isAcross = true;
|
|
|
|
|
}
|
|
|
|
|
bb.writeLog("recalculateOverTime isAcross:"+isAcross);
|
|
|
|
|
String restStartSql = "select * from kq_ShiftRestTimeSections where serialid=? and resttype='start'";
|
|
|
|
|
rs.executeQuery(restStartSql, serialId);
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
//休息开始时间
|
|
|
|
|
String startTime = rs.getString("time");
|
|
|
|
|
String record1 = rs.getString("record1");
|
|
|
|
|
bb.writeLog("recalculateOverTime startTime:"+startTime);
|
|
|
|
|
bb.writeLog("recalculateOverTime record1:"+record1);
|
|
|
|
|
//休息结束时间
|
|
|
|
|
String restEndSql = "select * from kq_ShiftRestTimeSections where record1=? and resttype='end'";
|
|
|
|
|
singleRs.executeQuery(restEndSql, record1);
|
|
|
|
|
singleRs.next();
|
|
|
|
|
String endTime = singleRs.getString("time");
|
|
|
|
|
bb.writeLog("recalculateOverTime endTime:"+endTime);
|
|
|
|
|
if (isAcross) {
|
|
|
|
|
double restTime1 = TimeRangeCalculator.getRestTime(kssj, "23:59", startTime, endTime);
|
|
|
|
|
double restTime2 = TimeRangeCalculator.getRestTime("00:00", jssj, startTime, endTime);
|
|
|
|
|
bb.writeLog("recalculateOverTime restTime1:"+restTime1);
|
|
|
|
|
bb.writeLog("recalculateOverTime restTime2:"+restTime2);
|
|
|
|
|
restTimeCount = restTimeCount.add(BigDecimal.valueOf(restTime1));
|
|
|
|
|
restTimeCount = restTimeCount.add(BigDecimal.valueOf(restTime2));
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
double restTime = TimeRangeCalculator.getRestTime(kssj, jssj, startTime, endTime);
|
|
|
|
|
bb.writeLog("recalculateOverTime restTime:"+restTime);
|
|
|
|
|
restTimeCount = restTimeCount.add(BigDecimal.valueOf(restTime));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
sc = divideRoundModeDown(workTimeTotal.subtract(restTimeCount).toString(), "3600");
|
|
|
|
|
bb.writeLog("recalculateOverTime sc1:"+sc);
|
|
|
|
|
//单双休休班次 加班最小单位是2小时
|
|
|
|
|
String twoStartSerId = bb.getPropValue("nbkq_main", "twoStartSerId");
|
|
|
|
|
if (Arrays.asList(twoStartSerId.split(",")).contains(serialId) && sc < 2) {
|
|
|
|
|
sc = 0.0;
|
|
|
|
|
}
|
|
|
|
|
bb.writeLog("recalculateOverTime sc3:"+sc);
|
|
|
|
|
return sc;
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
bb.writeLog("biz-recalculateOverTime-e-" + e.getMessage());
|
|
|
|
|
bb.writeLog("biz-recalculateOverTime-sc-" + sc);
|
|
|
|
|
return sc;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -3199,4 +3293,29 @@ public class KQOverTimeRuleCalBiz {
|
|
|
|
|
String sql = "delete from uf_jbtz where jbr='"+jbr+"' and ly ="+ly+" and gzrq = '"+date+"' ";
|
|
|
|
|
rs.executeUpdate(sql);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void getInitArrays(int[] initArrays,String type){
|
|
|
|
|
BaseBean bb = new BaseBean();
|
|
|
|
|
int cou1 = 0;
|
|
|
|
|
int cou2 = 0;
|
|
|
|
|
bb.writeLog("====getInitArrays-type:"+type);
|
|
|
|
|
bb.writeLog("====getInitArrays-length:"+initArrays.length);
|
|
|
|
|
for(int i=0;i<initArrays.length;i++){
|
|
|
|
|
if(initArrays[i] == 1){
|
|
|
|
|
cou1++;
|
|
|
|
|
}else{
|
|
|
|
|
cou2++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bb.writeLog("====getInitArrays-1-length:"+cou1);
|
|
|
|
|
bb.writeLog("====getInitArrays-0-length:"+cou2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void baseWriteLog(String data){
|
|
|
|
|
BaseBean bb = new BaseBean();
|
|
|
|
|
bb.writeLog("====baseWriteLog-data:"+data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|