KQFormatData 申请源码

csxg
dxfeng 2 years ago
parent bc855b294b
commit dee3855003

@ -31,7 +31,7 @@ public class KQFormatData extends BaseBean {
private String today = DateUtil.getCurrentDate(); private String today = DateUtil.getCurrentDate();
private KQLog kqLog = new KQLog(); private KQLog kqLog = new KQLog();
private boolean writeLog = false; private boolean writeLog = false;
private LinkedHashMap<String, Object> logInfo = new LinkedHashMap<>(); private LinkedHashMap<String,Object> logInfo = new LinkedHashMap<>();
/*** /***
* *
@ -51,7 +51,7 @@ public class KQFormatData extends BaseBean {
try { try {
kqLog.info("formatKqDate in userId=" + userId + "kqDate==" + kqDate); kqLog.info("formatKqDate in userId=" + userId + "kqDate==" + kqDate);
if (DateUtil.timeInterval(kqDate, today) < 0) {//今天之后的无需处理 if (DateUtil.timeInterval(kqDate, today) < 0) {//今天之后的无需处理
kqLog.info("今天之后的无需处理的数据resourceid==" + userId + "kqdate==" + kqDate + "today==" + today); kqLog.info("今天之后的无需处理的数据resourceid=="+userId+"kqdate=="+kqDate+"today=="+today);
return resultMap; return resultMap;
} }
String uuid = UUID.randomUUID().toString(); String uuid = UUID.randomUUID().toString();
@ -62,37 +62,37 @@ public class KQFormatData extends BaseBean {
KQFlowDataBiz kqFlowDataBiz = new KQFlowDataBiz.FlowDataParamBuilder().resourceidParam(userId).fromDateParam(kqDate).toDateParam(kqDateNext).build(); KQFlowDataBiz kqFlowDataBiz = new KQFlowDataBiz.FlowDataParamBuilder().resourceidParam(userId).fromDateParam(kqDate).toDateParam(kqDateNext).build();
Map<String, Object> workFlowInfo = new HashMap<>();//userid|date--工作流程 Map<String, Object> workFlowInfo = new HashMap<>();//userid|date--工作流程
kqFlowDataBiz.getAllFlowData(workFlowInfo, false); kqFlowDataBiz.getAllFlowData(workFlowInfo,false);
WorkTimeEntity workTime = kqWorkTime.getWorkTime(userId, kqDate); WorkTimeEntity workTime = kqWorkTime.getWorkTime(userId, kqDate);
kqLog.info("userId:" + userId + ":kqDate:" + kqDate + ":formatKqDate workTime=" + JSONObject.toJSONString(workTime) + "::uuid::" + uuid); kqLog.info("userId:"+userId+":kqDate:"+kqDate+":formatKqDate workTime=" + JSONObject.toJSONString(workTime)+"::uuid::"+uuid);
kqLog.info("userId:" + userId + ":kqDate:" + kqDate + ":formatKqDate workFlowInfo=" + JSONObject.toJSONString(workFlowInfo) + "::uuid::" + uuid); kqLog.info("userId:"+userId+":kqDate:"+kqDate+":formatKqDate workFlowInfo=" + JSONObject.toJSONString(workFlowInfo)+"::uuid::"+uuid);
if (this.writeLog) { if(this.writeLog) {
logInfo.put("userId", userId); logInfo.put("userId",userId);
logInfo.put("kqDate", kqDate); logInfo.put("kqDate",kqDate);
logInfo.put("" + weaver.systeminfo.SystemEnv.getHtmlLabelName(16253, weaver.general.ThreadVarLanguage.getLang()) + "", workTime); logInfo.put(""+weaver.systeminfo.SystemEnv.getHtmlLabelName(16253,weaver.general.ThreadVarLanguage.getLang())+"",workTime);
logInfo.put("" + weaver.systeminfo.SystemEnv.getHtmlLabelName(126871, weaver.general.ThreadVarLanguage.getLang()) + "", workFlowInfo); logInfo.put(""+weaver.systeminfo.SystemEnv.getHtmlLabelName(126871,weaver.general.ThreadVarLanguage.getLang())+"",workFlowInfo);
} }
new KQFormatBiz().delFormatData(userId, kqDate); new KQFormatBiz().delFormatData(userId, kqDate);
String excludecount = Util.null2String(kqGroupComInfo.getExcludecount(workTime.getGroupId()));//是否参与考勤报表统计 String excludecount = Util.null2String(kqGroupComInfo.getExcludecount(workTime.getGroupId()));//是否参与考勤报表统计
if (workTime.getIsExclude()) {//无需考勤人员没有异常状态 if (workTime.getIsExclude()) {//无需考勤人员没有异常状态
if (!excludecount.equals("1")) { if(!excludecount.equals("1")){
kqLog.info("无需考勤人员没有异常状态 workTime.getIsExclude()=" + workTime.getIsExclude() + "excludecount==" + excludecount); kqLog.info("无需考勤人员没有异常状态 workTime.getIsExclude()="+workTime.getIsExclude()+"excludecount=="+excludecount);
return resultMap; return resultMap;
} }
} }
if (Util.null2String(workTime.getGroupId()).length() == 0) { if( Util.null2String(workTime.getGroupId()).length()==0){
//没有考勤组不需格式化 //没有考勤组不需格式化
return resultMap; return resultMap;
} }
if (workTime == null || workTime.getWorkMins() == 0) { if (workTime == null || workTime.getWorkMins() == 0) {
kqLog.info("workTime == null || workTime.getWorkMins() == 0 插入空记录"); kqLog.info("workTime == null || workTime.getWorkMins() == 0 插入空记录");
nonlsParam = new ArrayList<>(); nonlsParam = new ArrayList<>();
formatNonWork(userId, kqDate, nonlsParam, workTime, workFlowInfo); formatNonWork(userId, kqDate,nonlsParam,workTime, workFlowInfo);
if (!nonlsParam.isEmpty()) { if(!nonlsParam.isEmpty()){
sql = " insert into kq_format_detail(resourceid,kqdate,groupid,serialnumber,signindate,signintime,signinid,signoutdate,signouttime,signoutid,leaveMins,leaveinfo,evectionMins,outMins)values(?,?,?,?,?,?,?,?,?,?,?,?,?,?) "; sql = " insert into kq_format_detail(resourceid,kqdate,groupid,serialnumber,signindate,signintime,signinid,signoutdate,signouttime,signoutid,leaveMins,leaveinfo,evectionMins,outMins)values(?,?,?,?,?,?,?,?,?,?,?,?,?,?) ";
rs.executeUpdate(sql, nonlsParam); rs.executeUpdate(sql, nonlsParam);
@ -115,8 +115,8 @@ public class KQFormatData extends BaseBean {
" group by resourceid,kqdate,b.subcompanyid1,b.departmentid,b.jobtitle,groupid,serialid,workmins"; " group by resourceid,kqdate,b.subcompanyid1,b.departmentid,b.jobtitle,groupid,serialid,workmins";
rs.executeUpdate(sql, userId, kqDate); rs.executeUpdate(sql, userId, kqDate);
} }
} else { }else{
Map<String, Object> definedFieldInfo = new KQFormatBiz().getDefinedField(); Map<String,Object> definedFieldInfo = new KQFormatBiz().getDefinedField();
String definedField = ""; String definedField = "";
String definedParam = ""; String definedParam = "";
String definedParamSum = ""; String definedParamSum = "";
@ -126,7 +126,7 @@ public class KQFormatData extends BaseBean {
definedField = Util.null2String(definedFieldInfo.get("definedField")); definedField = Util.null2String(definedFieldInfo.get("definedField"));
definedParam = Util.null2String(definedFieldInfo.get("definedParam")); definedParam = Util.null2String(definedFieldInfo.get("definedParam"));
definedParamSum = Util.null2String(definedFieldInfo.get("definedParamSum")); definedParamSum = Util.null2String(definedFieldInfo.get("definedParamSum"));
lsParam.addAll(format(userId, kqDate, workTime, workFlowInfo, uuid)); lsParam.addAll(format(userId, kqDate, workTime, workFlowInfo,uuid));
} }
if (lsParam.size() > 0) { if (lsParam.size() > 0) {
@ -134,18 +134,18 @@ public class KQFormatData extends BaseBean {
" resourceid,kqdate,groupid,serialid,serialnumber,workbegindate,workbegintime,workenddate,workendtime,workmins," + " resourceid,kqdate,groupid,serialid,serialnumber,workbegindate,workbegintime,workenddate,workendtime,workmins," +
" signindate,signintime,signinid,signoutdate,signouttime,signoutid,signMins," + " signindate,signintime,signinid,signoutdate,signouttime,signoutid,signMins," +
" attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins," + " attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins," +
" leaveMins,leaveinfo,evectionMins,outMins,forgotbeginworkcheckmins,otherinfo" + (definedField.length() > 0 ? "," + definedField + "" : "") + ") " + " leaveMins,leaveinfo,evectionMins,outMins,forgotbeginworkcheckmins,otherinfo"+(definedField.length()>0?","+definedField+"":"")+") " +
" values(?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?,?,?,?" + (definedField.length() > 0 ? "," + definedParam + "" : "") + ")"; " values(?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?,?,?,?"+(definedField.length()>0?","+definedParam+"":"")+")";
for (int i = 0; i < lsParam.size(); i++) { for (int i = 0; i < lsParam.size(); i++) {
List<Object> param = lsParam.get(i); List<Object> param = lsParam.get(i);
boolean isok = rs.executeUpdate(sql, param); boolean isok = rs.executeUpdate(sql, param);
kqLog.info("插入记录:userId:" + userId + ":kqDate:" + kqDate + ":param:" + JSON.toJSONString(param) + ":isok:" + isok + "::uuid::" + uuid); kqLog.info("插入记录:userId:"+userId+":kqDate:"+kqDate+":param:"+JSON.toJSONString(param)+":isok:"+isok+"::uuid::"+uuid);
} }
sql = " insert into kq_format_total(resourceid,kqdate,subcompanyid,departmentid,jobtitle,groupid,serialid,workdays,workmins," + sql = " insert into kq_format_total(resourceid,kqdate,subcompanyid,departmentid,jobtitle,groupid,serialid,workdays,workmins," +
" attendancedays,attendancemins,signdays,signmins,belate,belatemins,gravebelate,gravebelatemins,leaveeearly,leaveearlymins,graveleaveearly," + " attendancedays,attendancemins,signdays,signmins,belate,belatemins,gravebelate,gravebelatemins,leaveeearly,leaveearlymins,graveleaveearly," +
" graveleaveearlymins,absenteeism,absenteeismmins,forgotcheck,forgotcheckmins," + " graveleaveearlymins,absenteeism,absenteeismmins,forgotcheck,forgotcheckmins," +
" leaveMins,evectionMins,outMins,forgotbeginworkcheck,forgotbeginworkcheckmins" + (definedField.length() > 0 ? "," + definedField + "" : "") + ") " + " leaveMins,evectionMins,outMins,forgotbeginworkcheck,forgotbeginworkcheckmins"+(definedField.length()>0?","+definedField+"":"")+") " +
" select a.resourceid,kqdate,b.subcompanyid1,b.departmentid,b.jobtitle,groupid,serialid," + " select a.resourceid,kqdate,b.subcompanyid1,b.departmentid,b.jobtitle,groupid,serialid," +
" case when sum(workmins)>0 then 1 end as workdays, sum(workmins) as workmins," + " case when sum(workmins)>0 then 1 end as workdays, sum(workmins) as workmins," +
" cast(sum(attendanceMins)AS decimal(10, 2))/sum(workmins) as attendancedays, sum(attendanceMins) as attendanceMins," + " cast(sum(attendanceMins)AS decimal(10, 2))/sum(workmins) as attendancedays, sum(attendanceMins) as attendanceMins," +
@ -158,14 +158,14 @@ public class KQFormatData extends BaseBean {
" sum(case when forgotcheckmins> 0 then 1 else 0 end) as forgotcheck,sum(forgotcheckmins) as forgotcheckmins,sum(leaveMins) as leaveMins," + " sum(case when forgotcheckmins> 0 then 1 else 0 end) as forgotcheck,sum(forgotcheckmins) as forgotcheckmins,sum(leaveMins) as leaveMins," +
" sum(evectionMins) as evectionMins,sum(outMins) as outMins, " + " sum(evectionMins) as evectionMins,sum(outMins) as outMins, " +
" sum(case when forgotbeginworkcheckmins> 0 then 1 else 0 end) as forgotbeginworkcheck,sum(forgotbeginworkcheckmins) as forgotbeginworkcheckmins " + " sum(case when forgotbeginworkcheckmins> 0 then 1 else 0 end) as forgotbeginworkcheck,sum(forgotbeginworkcheckmins) as forgotbeginworkcheckmins " +
(definedField.length() > 0 ? "," + definedParamSum + "" : "") + (definedField.length()>0?","+definedParamSum+"":"")+
" from kq_format_detail a, hrmresource b" + " from kq_format_detail a, hrmresource b" +
" where a.resourceid = b.id and resourceid = ? and kqdate=?" + " where a.resourceid = b.id and resourceid = ? and kqdate=?" +
" group by resourceid,kqdate,b.subcompanyid1,b.departmentid,b.jobtitle,groupid,serialid"; " group by resourceid,kqdate,b.subcompanyid1,b.departmentid,b.jobtitle,groupid,serialid";
rs.executeUpdate(sql, userId, kqDate); rs.executeUpdate(sql, userId, kqDate);
} }
} }
} catch (Exception e) { }catch (Exception e) {
writeLog(e); writeLog(e);
kqLog.info(e); kqLog.info(e);
} }
@ -178,7 +178,7 @@ public class KQFormatData extends BaseBean {
List<Object> params = null; List<Object> params = null;
try { try {
KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo(); KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo();
String nosign_is_absent = Util.null2String(kqSettingsComInfo.getMain_val("nosign_is_absent"), "1"); String nosign_is_absent = Util.null2String(kqSettingsComInfo.getMain_val("nosign_is_absent"),"1");
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo(); KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
KQFormatShiftRule kqFormatShiftRule = new KQFormatShiftRule(); KQFormatShiftRule kqFormatShiftRule = new KQFormatShiftRule();
String preDate = DateUtil.addDate(kqDate, -1);//上一天日期 String preDate = DateUtil.addDate(kqDate, -1);//上一天日期
@ -186,7 +186,7 @@ public class KQFormatData extends BaseBean {
String dateKey = userId + "|" + kqDate; String dateKey = userId + "|" + kqDate;
String nextDateKey = userId + "|" + nextDate; String nextDateKey = userId + "|" + nextDate;
ArrayList<String> hostIps = InitServer.getRealIp(); ArrayList<String> hostIps = InitServer.getRealIp();
kqLog.info("format in >>>>>userId" + userId + "kqDate==" + kqDate + ":hostIps:" + hostIps + ":uuid::" + uuid); kqLog.info("format in >>>>>userId" + userId + "kqDate==" + kqDate+":hostIps:"+hostIps+":uuid::"+uuid);
boolean oneSign = false; boolean oneSign = false;
List<TimeScopeEntity> lsSignTime = new ArrayList<>(); List<TimeScopeEntity> lsSignTime = new ArrayList<>();
List<TimeScopeEntity> lsWorkTime = new ArrayList<>(); List<TimeScopeEntity> lsWorkTime = new ArrayList<>();
@ -197,7 +197,7 @@ public class KQFormatData extends BaseBean {
lsSignTime = workTime.getSignTime();//允许打卡时间 lsSignTime = workTime.getSignTime();//允许打卡时间
lsWorkTime = workTime.getWorkTime();//工作时间 lsWorkTime = workTime.getWorkTime();//工作时间
lsRestTime = workTime.getRestTime();//休息时段时间 lsRestTime = workTime.getRestTime();//休息时段时间
oneSign = lsWorkTime != null && lsWorkTime.size() == 1; oneSign = lsWorkTime!=null&&lsWorkTime.size()==1;
} }
int[] dayMins = new int[2880];//一天所有分钟数 int[] dayMins = new int[2880];//一天所有分钟数
@ -206,7 +206,7 @@ public class KQFormatData extends BaseBean {
params = new ArrayList<>(); params = new ArrayList<>();
TimeScopeEntity signTimeScope = lsSignTime.get(i); TimeScopeEntity signTimeScope = lsSignTime.get(i);
TimeScopeEntity workTimeScope = lsWorkTime.get(i); TimeScopeEntity workTimeScope = lsWorkTime.get(i);
TimeScopeEntity restTimeScope = lsRestTime.isEmpty() ? null : lsRestTime.get(i); TimeScopeEntity restTimeScope = lsRestTime.isEmpty()?null:lsRestTime.get(i);
String workBeginTime = Util.null2String(workTimeScope.getBeginTime()); String workBeginTime = Util.null2String(workTimeScope.getBeginTime());
String ori_workBeginTime = workBeginTime; String ori_workBeginTime = workBeginTime;
int workBeginIdx = kqTimesArrayComInfo.getArrayindexByTimes(workBeginTime); int workBeginIdx = kqTimesArrayComInfo.getArrayindexByTimes(workBeginTime);
@ -243,8 +243,8 @@ public class KQFormatData extends BaseBean {
int graveLeaveEarlyMins = 0; int graveLeaveEarlyMins = 0;
int absenteeismMins = 0; int absenteeismMins = 0;
int leaveMins = 0;//请假时长 int leaveMins = 0;//请假时长
Map<String, Object> leaveInfo = new HashMap<>();//请假信息 Map<String,Object> leaveInfo = new HashMap<>();//请假信息
Map<String, Object> otherinfo = new HashMap<>();//存一些用得到的信息 Map<String,Object> otherinfo = new HashMap<>();//存一些用得到的信息
int evectionMins = 0;//出差时长 int evectionMins = 0;//出差时长
int outMins = 0;//公出时长 int outMins = 0;//公出时长
int otherMins = 0;//异常流程时长 int otherMins = 0;//异常流程时长
@ -258,24 +258,24 @@ public class KQFormatData extends BaseBean {
int signInTimeOutdx4Sign = -1; int signInTimeOutdx4Sign = -1;
String signBeginDateTime = signTimeScope.getBeginTimeAcross() ? nextDate : kqDate; String signBeginDateTime = signTimeScope.getBeginTimeAcross() ? nextDate : kqDate;
if (signTimeScope.isBeginTimePreAcross()) { if(signTimeScope.isBeginTimePreAcross()){
signBeginDateTime = preDate; signBeginDateTime = preDate;
} }
signBeginDateTime += " " + kqTimesArrayComInfo.turn48to24Time(signTimeScope.getBeginTime()) + ":00"; signBeginDateTime+=" "+kqTimesArrayComInfo.turn48to24Time(signTimeScope.getBeginTime())+":00";
String signEndDateTime = signTimeScope.getEndTimeAcross() ? nextDate : kqDate; String signEndDateTime = signTimeScope.getEndTimeAcross() ? nextDate : kqDate;
signEndDateTime += " " + kqTimesArrayComInfo.turn48to24Time(signTimeScope.getEndTime()) + ":59"; signEndDateTime+=" "+kqTimesArrayComInfo.turn48to24Time(signTimeScope.getEndTime())+":59";
String workBeginDateTime = workTimeScope.getBeginTimeAcross() ? nextDate : kqDate; String workBeginDateTime = workTimeScope.getBeginTimeAcross() ? nextDate : kqDate;
workBeginDateTime += " " + kqTimesArrayComInfo.turn48to24Time(workTimeScope.getBeginTime()) + ":00"; workBeginDateTime+=" "+kqTimesArrayComInfo.turn48to24Time(workTimeScope.getBeginTime())+":00";
String workEndDateTime = workTimeScope.getEndTimeAcross() ? nextDate : kqDate; String workEndDateTime = workTimeScope.getEndTimeAcross() ? nextDate : kqDate;
workEndDateTime += " " + kqTimesArrayComInfo.turn48to24Time(workTimeScope.getEndTime()) + ":00"; workEndDateTime+=" "+kqTimesArrayComInfo.turn48to24Time(workTimeScope.getEndTime())+":00";
kqLog.info("signBeginDateTime" + signBeginDateTime + "::userId" + userId + "kqDate==" + kqDate + ":hostIps:" + hostIps + ":uuid::" + uuid); kqLog.info("signBeginDateTime" + signBeginDateTime+"::userId" + userId + "kqDate==" + kqDate+":hostIps:"+hostIps+":uuid::"+uuid);
kqLog.info("signEndDateTime" + signEndDateTime + "::userId" + userId + "kqDate==" + kqDate + ":hostIps:" + hostIps + ":uuid::" + uuid); kqLog.info("signEndDateTime" + signEndDateTime+"::userId" + userId + "kqDate==" + kqDate+":hostIps:"+hostIps+":uuid::"+uuid);
kqLog.info("workBeginDateTime" + workBeginDateTime + "::userId" + userId + "kqDate==" + kqDate + ":hostIps:" + hostIps + ":uuid::" + uuid); kqLog.info("workBeginDateTime" + workBeginDateTime+"::userId" + userId + "kqDate==" + kqDate+":hostIps:"+hostIps+":uuid::"+uuid);
kqLog.info("workEndDateTime" + workEndDateTime + "::userId" + userId + "kqDate==" + kqDate + ":hostIps:" + hostIps + ":uuid::" + uuid); kqLog.info("workEndDateTime" + workEndDateTime+"::userId" + userId + "kqDate==" + kqDate+":hostIps:"+hostIps+":uuid::"+uuid);
Map<String, String> shifRuleMap = Maps.newHashMap(); Map<String, String> shifRuleMap = Maps.newHashMap();
if (oneSign) { if(oneSign){
//个性化设置只支持一天一次上下班 //个性化设置只支持一天一次上下班
ShiftInfoBean shiftInfoBean = new ShiftInfoBean(); ShiftInfoBean shiftInfoBean = new ShiftInfoBean();
shiftInfoBean.setSplitDate(kqDate); shiftInfoBean.setSplitDate(kqDate);
@ -283,28 +283,28 @@ public class KQFormatData extends BaseBean {
shiftInfoBean.setSignTime(lsSignTime); shiftInfoBean.setSignTime(lsSignTime);
shiftInfoBean.setWorkTime(lsWorkTime); shiftInfoBean.setWorkTime(lsWorkTime);
List<String> logList = Lists.newArrayList(); List<String> logList = Lists.newArrayList();
KQShiftRuleInfoBiz.getShiftRuleInfo(shiftInfoBean, userId, shifRuleMap, logList); KQShiftRuleInfoBiz.getShiftRuleInfo(shiftInfoBean, userId, shifRuleMap,logList);
if (!shifRuleMap.isEmpty()) { if(!shifRuleMap.isEmpty()){
if (!logList.isEmpty()) { if(!logList.isEmpty()){
otherinfo.put("logList", logList); otherinfo.put("logList", logList);
} }
otherinfo.put("shiftRule", shifRuleMap); otherinfo.put("shiftRule", shifRuleMap);
if (shifRuleMap.containsKey("shift_beginworktime")) { if(shifRuleMap.containsKey("shift_beginworktime")){
String shift_beginworktime = Util.null2String(shifRuleMap.get("shift_beginworktime")); String shift_beginworktime = Util.null2String(shifRuleMap.get("shift_beginworktime"));
if (shift_beginworktime.length() > 0) { if(shift_beginworktime.length() > 0){
workBeginTime = Util.null2String(shift_beginworktime); workBeginTime = Util.null2String(shift_beginworktime);
workBeginIdx = kqTimesArrayComInfo.getArrayindexByTimes(workBeginTime); workBeginIdx = kqTimesArrayComInfo.getArrayindexByTimes(workBeginTime);
workTimeScope.setBeginTime(workBeginTime); workTimeScope.setBeginTime(workBeginTime);
workTimeScope.setBeginTimeAcross(workBeginIdx >= 1440 ? true : false); workTimeScope.setBeginTimeAcross(workBeginIdx>=1440?true:false);
} }
} }
if (shifRuleMap.containsKey("shift_endworktime")) { if(shifRuleMap.containsKey("shift_endworktime")){
String shift_endworktime = Util.null2String(shifRuleMap.get("shift_endworktime")); String shift_endworktime = Util.null2String(shifRuleMap.get("shift_endworktime"));
if (shift_endworktime.length() > 0) { if(shift_endworktime.length() > 0){
workEndTime = Util.null2String(shift_endworktime); workEndTime = Util.null2String(shift_endworktime);
workEndIdx = kqTimesArrayComInfo.getArrayindexByTimes(workEndTime); workEndIdx = kqTimesArrayComInfo.getArrayindexByTimes(workEndTime);
workTimeScope.setEndTime(workEndTime); workTimeScope.setEndTime(workEndTime);
workTimeScope.setEndTimeAcross(workEndIdx >= 1440 ? true : false); workTimeScope.setEndTimeAcross(workEndIdx>=1440?true:false);
} }
} }
} }
@ -313,14 +313,14 @@ public class KQFormatData extends BaseBean {
kqLog.info("个性化之后 workBeginDateTime" + workBeginDateTime); kqLog.info("个性化之后 workBeginDateTime" + workBeginDateTime);
kqLog.info("个性化之后 workEndDateTime" + workEndDateTime); kqLog.info("个性化之后 workEndDateTime" + workEndDateTime);
} }
List<Object> lsCheckInfo = new KQFormatSignData().getSignInfo(userId, signTimeScope, workTimeScope, kqDate, preDate, nextDate, kqTimesArrayComInfo, hostIps, uuid); List<Object> lsCheckInfo = new KQFormatSignData().getSignInfo(userId,signTimeScope,workTimeScope,kqDate,preDate,nextDate,kqTimesArrayComInfo,hostIps,uuid);
kqLog.info("lsCheckInfo" + JSONObject.toJSONString(lsCheckInfo) + "::userId" + userId + "kqDate==" + kqDate + ":hostIps:" + hostIps + ":uuid::" + uuid); kqLog.info("lsCheckInfo" + JSONObject.toJSONString(lsCheckInfo)+"::userId" + userId + "kqDate==" + kqDate+":hostIps:"+hostIps+":uuid::"+uuid);
if (this.writeLog) { if(this.writeLog) {
logInfo.put("" + weaver.systeminfo.SystemEnv.getHtmlLabelName(10005297, weaver.general.ThreadVarLanguage.getLang()) + "", signBeginDateTime); logInfo.put(""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005297,weaver.general.ThreadVarLanguage.getLang())+"",signBeginDateTime);
logInfo.put("" + weaver.systeminfo.SystemEnv.getHtmlLabelName(10005298, weaver.general.ThreadVarLanguage.getLang()) + "", signEndDateTime); logInfo.put(""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005298,weaver.general.ThreadVarLanguage.getLang())+"",signEndDateTime);
logInfo.put("" + weaver.systeminfo.SystemEnv.getHtmlLabelName(1940, weaver.general.ThreadVarLanguage.getLang()) + "", workBeginDateTime); logInfo.put(""+weaver.systeminfo.SystemEnv.getHtmlLabelName(1940,weaver.general.ThreadVarLanguage.getLang())+"",workBeginDateTime);
logInfo.put("" + weaver.systeminfo.SystemEnv.getHtmlLabelName(10005299, weaver.general.ThreadVarLanguage.getLang()) + "", workEndDateTime); logInfo.put(""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005299,weaver.general.ThreadVarLanguage.getLang())+"",workEndDateTime);
logInfo.put("" + weaver.systeminfo.SystemEnv.getHtmlLabelName(10005300, weaver.general.ThreadVarLanguage.getLang()) + "", lsCheckInfo); logInfo.put(""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005300,weaver.general.ThreadVarLanguage.getLang())+"",lsCheckInfo);
} }
for (int j = 0; lsCheckInfo != null && j < lsCheckInfo.size(); j++) { for (int j = 0; lsCheckInfo != null && j < lsCheckInfo.size(); j++) {
Map<String, Object> checkInfo = (Map<String, Object>) lsCheckInfo.get(j); Map<String, Object> checkInfo = (Map<String, Object>) lsCheckInfo.get(j);
@ -332,122 +332,122 @@ public class KQFormatData extends BaseBean {
String deduct_signofftime = Util.null2String(checkInfo.get("deduct_signofftime")); String deduct_signofftime = Util.null2String(checkInfo.get("deduct_signofftime"));
String flow_signInTime = ""; String flow_signInTime = "";
String flow_signOutTime = ""; String flow_signOutTime = "";
if (kqDate.compareTo(signDate) < 0) endIdx += 1440; if(kqDate.compareTo(signDate) < 0)endIdx+=1440;
if (signTime.length() > 8) { if (signTime.length() > 8) {
signTime = signTime.substring(0, 8); signTime = signTime.substring(0, 8);
} }
if (checkInfo.get("signType").equals("1")) {//签到 if (checkInfo.get("signType").equals("1")) {//签到
checkIn++; checkIn++;
//如果流程抵扣存在,打卡时长也存在,那么相互比较得到出勤时长和打卡时长 暂不这样处理,还是按照漏签的逻辑来处理 //如果流程抵扣存在,打卡时长也存在,那么相互比较得到出勤时长和打卡时长 暂不这样处理,还是按照漏签的逻辑来处理
if (signTime.length() > 0) { if(signTime.length() > 0){
signInTimeIndx4Sign = kqTimesArrayComInfo.getArrayindexByTimes(signTime); signInTimeIndx4Sign = kqTimesArrayComInfo.getArrayindexByTimes(signTime);
} }
signInId = signId; signInId = signId;
signInDate = signDate; signInDate = signDate;
signInTime = signTime; signInTime = signTime;
signInTimeIndx = kqTimesArrayComInfo.getArrayindexByTimes(signInTime); signInTimeIndx = kqTimesArrayComInfo.getArrayindexByTimes(signInTime);
if (deduct_signintime.length() > 0) { if(deduct_signintime.length() > 0){
if (signTime.length() > 0) { if(signTime.length() > 0){
if (deduct_signintime.compareTo(signTime) < 0) { if(deduct_signintime.compareTo(signTime) < 0){
flow_signInTime = deduct_signintime; flow_signInTime = deduct_signintime;
} }
} else { }else{
flow_signInTime = deduct_signintime; flow_signInTime = deduct_signintime;
} }
} }
if (flow_signInTime.length() > 0) { if(flow_signInTime.length() > 0){
flowSignInTimeIndx = kqTimesArrayComInfo.getArrayindexByTimes(flow_signInTime); flowSignInTimeIndx = kqTimesArrayComInfo.getArrayindexByTimes(flow_signInTime);
} }
if (kqDate.compareTo(signDate) < 0) { if(kqDate.compareTo(signDate) < 0) {
signInTimeIndx += 1440; signInTimeIndx += 1440;
flowSignInTimeIndx += 1440; flowSignInTimeIndx += 1440;
} else if (kqDate.compareTo(signDate) > 0) { }else if(kqDate.compareTo(signDate) > 0){
signInTimeIndx -= 1440; signInTimeIndx -= 1440;
signInTimeIndx = signInTimeIndx < 0 ? 0 : signInTimeIndx; signInTimeIndx = signInTimeIndx < 0 ? 0 : signInTimeIndx;
flowSignInTimeIndx -= 1440; flowSignInTimeIndx -= 1440;
flowSignInTimeIndx = flowSignInTimeIndx < 0 ? 0 : flowSignInTimeIndx; flowSignInTimeIndx = flowSignInTimeIndx < 0 ? 0 : flowSignInTimeIndx;
} }
if (oneSign) { if(oneSign){
if (workBeginIdx > signInTimeIndx) { if(workBeginIdx>signInTimeIndx) {
earlyInMins = workBeginIdx - signInTimeIndx; earlyInMins = workBeginIdx-signInTimeIndx;
} }
} }
} else if (checkInfo.get("signType").equals("2")) {//签退 } else if (checkInfo.get("signType").equals("2")) {//签退
checkOut++; checkOut++;
//如果流程抵扣存在,打卡时长也存在,那么相互比较得到出勤时长和打卡时长 暂不这样处理,还是按照漏签的逻辑来处理 //如果流程抵扣存在,打卡时长也存在,那么相互比较得到出勤时长和打卡时长 暂不这样处理,还是按照漏签的逻辑来处理
if (signTime.length() > 0) { if(signTime.length() > 0){
signInTimeOutdx4Sign = kqTimesArrayComInfo.getArrayindexByTimes(signTime); signInTimeOutdx4Sign = kqTimesArrayComInfo.getArrayindexByTimes(signTime);
} }
signOutId = signId; signOutId = signId;
signOutDate = signDate; signOutDate = signDate;
signOutTime = signTime; signOutTime = signTime;
signInTimeOutdx = kqTimesArrayComInfo.getArrayindexByTimes(signOutTime); signInTimeOutdx = kqTimesArrayComInfo.getArrayindexByTimes(signOutTime);
if (deduct_signofftime.length() > 0) { if(deduct_signofftime.length() > 0){
if (signTime.length() > 0) { if(signTime.length() > 0){
if (deduct_signofftime.compareTo(signTime) > 0) { if(deduct_signofftime.compareTo(signTime) > 0){
flow_signOutTime = deduct_signofftime; flow_signOutTime = deduct_signofftime;
} }
} else { }else{
flow_signOutTime = deduct_signofftime; flow_signOutTime = deduct_signofftime;
} }
} }
if (flow_signOutTime.length() > 0) { if(flow_signOutTime.length() > 0){
signInTimeOutdx = kqTimesArrayComInfo.getArrayindexByTimes(flow_signOutTime); signInTimeOutdx = kqTimesArrayComInfo.getArrayindexByTimes(flow_signOutTime);
} }
if (kqDate.compareTo(signDate) < 0) { if(kqDate.compareTo(signDate) < 0){
signInTimeOutdx += 1440; signInTimeOutdx+=1440;
} else if (kqDate.compareTo(signDate) > 0) { }else if(kqDate.compareTo(signDate) > 0){
signInTimeOutdx -= 1440; signInTimeOutdx -= 1440;
signInTimeOutdx = signInTimeOutdx < 0 ? 0 : signInTimeOutdx; signInTimeOutdx = signInTimeOutdx < 0 ? 0 : signInTimeOutdx;
} }
if (oneSign) { if(oneSign){
if (signInTimeOutdx > workEndIdx) { if(signInTimeOutdx>workEndIdx) {
lateOutMins = signInTimeOutdx - workEndIdx; lateOutMins = signInTimeOutdx-workEndIdx;
} }
} }
} }
if (checkInfo.get("signType").equals("1")) {//签到 if (checkInfo.get("signType").equals("1")) {//签到
if (signTime.length() > 0) { if(signTime.length() > 0){
String signMinTime = signTime.substring(0, 5) + ":00"; String signMinTime = signTime.substring(0,5)+":00";
endIdx = kqTimesArrayComInfo.getArrayindexByTimes(signTime); endIdx = kqTimesArrayComInfo.getArrayindexByTimes(signTime);
if (signTime.compareTo(signMinTime) > 0) { if(signTime.compareTo(signMinTime) > 0){
//如果签到时间是带秒的且是迟到,那么签到时间多一秒和多一分钟是一样的 //如果签到时间是带秒的且是迟到,那么签到时间多一秒和多一分钟是一样的
endIdx += 1; endIdx += 1;
signInTimeIndx = signInTimeIndx + 1;//如果是带秒的打卡数据不应该影响流程抵扣的数据的下标 signInTimeIndx = signInTimeIndx + 1;//如果是带秒的打卡数据不应该影响流程抵扣的数据的下标
} }
if (kqDate.compareTo(signDate) < 0) { if(kqDate.compareTo(signDate) < 0){
endIdx += 1440; endIdx+=1440;
} else if (kqDate.compareTo(signDate) > 0) { }else if(kqDate.compareTo(signDate) > 0){
endIdx -= 1440; endIdx -= 1440;
endIdx = endIdx < 0 ? 0 : endIdx; endIdx = endIdx < 0 ? 0 : endIdx;
} }
if (endIdx > workBeginIdx) { if (endIdx > workBeginIdx) {
if (flow_signInTime.length() > 0) { if(flow_signInTime.length() > 0){
if (flowSignInTimeIndx > workBeginIdx) { if(flowSignInTimeIndx > workBeginIdx){
//增加一个判断,流程抵扣打卡如果开启了并且有抵扣上班打卡,那么也就不是迟到了 //增加一个判断,流程抵扣打卡如果开启了并且有抵扣上班打卡,那么也就不是迟到了
Arrays.fill(dayMins, workBeginIdx, endIdx, 2);//迟到时段标识 2 Arrays.fill(dayMins, workBeginIdx, endIdx, 2);//迟到时段标识 2
} }
} else { }else{
Arrays.fill(dayMins, workBeginIdx, endIdx, 2);//迟到时段标识 2 Arrays.fill(dayMins, workBeginIdx, endIdx, 2);//迟到时段标识 2
} }
} }
} }
} else if (checkInfo.get("signType").equals("2")) {//签退 } else if (checkInfo.get("signType").equals("2")) {//签退
if (signTime.length() > 0) { if(signTime.length() > 0){
beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(signTime); beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(signTime);
if (StringUtils.isNotBlank(signDate) && signDate.compareTo(kqDate) > 0) { if(StringUtils.isNotBlank(signDate) && signDate.compareTo(kqDate) > 0){
beginIdx += 1440; beginIdx+=1440;
} else if (kqDate.compareTo(signDate) > 0) { }else if(kqDate.compareTo(signDate) > 0){
beginIdx -= 1440; beginIdx -= 1440;
beginIdx = beginIdx < 0 ? 0 : beginIdx; beginIdx = beginIdx < 0 ? 0 : beginIdx;
} }
if (workEndIdx > beginIdx) { if (workEndIdx > beginIdx) {
if (flow_signOutTime.length() > 0) { if(flow_signOutTime.length() > 0){
if (workEndIdx > signInTimeOutdx) { if (workEndIdx > signInTimeOutdx) {
//增加一个判断,流程抵扣打卡如果开启了并且有抵扣下班打卡,那么也就不是早退了 //增加一个判断,流程抵扣打卡如果开启了并且有抵扣下班打卡,那么也就不是早退了
Arrays.fill(dayMins, beginIdx, workEndIdx, 3);//早退时段标识 3 Arrays.fill(dayMins, beginIdx, workEndIdx, 3);//早退时段标识 3
} }
} else { }else{
Arrays.fill(dayMins, beginIdx, workEndIdx, 3);//早退时段标识 3 Arrays.fill(dayMins, beginIdx, workEndIdx, 3);//早退时段标识 3
} }
@ -457,22 +457,22 @@ public class KQFormatData extends BaseBean {
} }
//打卡时长=签退时间-签到时间(有签到签退才计算) //打卡时长=签退时间-签到时间(有签到签退才计算)
if (checkIn == 1 && checkOut == 1) { if(checkIn==1&&checkOut==1){
if (signInTimeIndx4Sign > -1 && signInTimeOutdx4Sign > -1) { if(signInTimeIndx4Sign > -1 && signInTimeOutdx4Sign > -1){
if (DateUtil.dayDiff(signInDate, signOutDate) == 0) {//同一天签到和签退 if(DateUtil.dayDiff(signInDate,signOutDate)==0){//同一天签到和签退
signMins = signInTimeOutdx4Sign - signInTimeIndx4Sign; signMins=signInTimeOutdx4Sign - signInTimeIndx4Sign;
} else if (DateUtil.dayDiff(signInDate, signOutDate) == 1) {//第一天签到,第二天签退 }else if(DateUtil.dayDiff(signInDate,signOutDate)==1) {//第一天签到,第二天签退
if (signInTimeOutdx4Sign < signInTimeIndx4Sign) { if(signInTimeOutdx4Sign<signInTimeIndx4Sign){
signMins = 1440 + signInTimeOutdx4Sign - signInTimeIndx4Sign; signMins = 1440 + signInTimeOutdx4Sign - signInTimeIndx4Sign;
} else { }else{
signMins = signInTimeOutdx4Sign - signInTimeIndx4Sign; signMins = signInTimeOutdx4Sign - signInTimeIndx4Sign;
} }
} }
} else { }else{
signMins = 0; signMins=0;
} }
if (signMins < 0) { if(signMins<0){
signMins = 0; signMins=0;
} }
} }
@ -483,7 +483,7 @@ public class KQFormatData extends BaseBean {
} }
if (checkOut == 0 && checkIn > 0) {//漏签(有签到无签退) if (checkOut == 0 && checkIn > 0) {//漏签(有签到无签退)
if (signInTimeIndx > -1) { if(signInTimeIndx > -1){
if (workEndIdx > signInTimeIndx) { if (workEndIdx > signInTimeIndx) {
//漏签就是从本次时段内的打卡到下班点 //漏签就是从本次时段内的打卡到下班点
//上班漏签应该是从签到到签到结束时间,不过这里可以不用管,只是一个次数 //上班漏签应该是从签到到签到结束时间,不过这里可以不用管,只是一个次数
@ -492,7 +492,7 @@ public class KQFormatData extends BaseBean {
//签到晚于本次时段结束时间,也算漏签 //签到晚于本次时段结束时间,也算漏签
forgotCheckMins++; forgotCheckMins++;
} }
} else if (flowSignInTimeIndx > -1) { }else if(flowSignInTimeIndx > -1){
if (workEndIdx > flowSignInTimeIndx) { if (workEndIdx > flowSignInTimeIndx) {
//漏签就是从本次时段内的打卡到下班点 //漏签就是从本次时段内的打卡到下班点
//上班漏签应该是从签到到签到结束时间,不过这里可以不用管,只是一个次数 //上班漏签应该是从签到到签到结束时间,不过这里可以不用管,只是一个次数
@ -505,11 +505,11 @@ public class KQFormatData extends BaseBean {
} }
if (checkIn == 0 && checkOut > 0) {//漏签(有签退无签到) if (checkIn == 0 && checkOut > 0) {//漏签(有签退无签到)
if (signInTimeOutdx > 0) { if(signInTimeOutdx > 0){
if (workBeginIdx < signInTimeOutdx) { if(workBeginIdx < signInTimeOutdx) {
//下班漏签应该是从签退到签退开始时间,不过这里可以不用管,只是一个次数 //下班漏签应该是从签退到签退开始时间,不过这里可以不用管,只是一个次数
Arrays.fill(dayMins, workBeginIdx, signInTimeOutdx, 66);//下班漏签时段标识 6666呼应前面的漏签的6 Arrays.fill(dayMins, workBeginIdx, signInTimeOutdx, 66);//下班漏签时段标识 6666呼应前面的漏签的6
} else { }else{
//这种数据理论上不会存在,也记下吧 //这种数据理论上不会存在,也记下吧
forgotBeginWorkCheckMins++; forgotBeginWorkCheckMins++;
} }
@ -533,29 +533,29 @@ public class KQFormatData extends BaseBean {
continue; continue;
} }
if (flowType.equals(FlowReportTypeEnum.EVECTION.getFlowType())) { if(flowType.equals(FlowReportTypeEnum.EVECTION.getFlowType())){
Arrays.fill(dayMins, beginIdx, endIdx, 7);//出差抵扣时段标识 7 Arrays.fill(dayMins, beginIdx, endIdx, 7);//出差抵扣时段标识 7
} else if (flowType.equals(FlowReportTypeEnum.OUT.getFlowType())) { }else if(flowType.equals(FlowReportTypeEnum.OUT.getFlowType())){
Arrays.fill(dayMins, beginIdx, endIdx, 8);//公出抵扣时段标识 8 Arrays.fill(dayMins, beginIdx, endIdx, 8);//公出抵扣时段标识 8
} else if (flowType.equalsIgnoreCase(FlowReportTypeEnum.LEAVE.getFlowType())) { }else if(flowType.equalsIgnoreCase(FlowReportTypeEnum.LEAVE.getFlowType())){
if (endIdx > beginIdx) { if (endIdx > beginIdx) {
Arrays.fill(dayMins, beginIdx, endIdx, 5);//流程抵扣时段标识 5 Arrays.fill(dayMins, beginIdx, endIdx, 5);//流程抵扣时段标识 5
int tmpBeginIdx = beginIdx; int tmpBeginIdx = beginIdx;
int tmpEndIdx = endIdx; int tmpEndIdx = endIdx;
Integer val = 0; Integer val = 0;
if (leaveInfo.get(newLeaveType) == null) { if(leaveInfo.get(newLeaveType)==null){
leaveInfo.put(newLeaveType, val); leaveInfo.put(newLeaveType,val);
} else { }else{
val = (Integer) leaveInfo.get(newLeaveType); val = (Integer) leaveInfo.get(newLeaveType);
} }
if (beginIdx < workBeginIdx) tmpBeginIdx = workBeginIdx; if(beginIdx<workBeginIdx)tmpBeginIdx=workBeginIdx;
if (endIdx > workEndIdx) tmpEndIdx = endIdx; if(endIdx>workEndIdx)tmpEndIdx=endIdx;
if (tmpEndIdx > tmpBeginIdx) { if(tmpEndIdx>tmpBeginIdx){
leaveInfo.put(newLeaveType, val + (tmpEndIdx - tmpBeginIdx)); leaveInfo.put(newLeaveType,val+(tmpEndIdx-tmpBeginIdx));
} }
} }
} else { }else{
if (endIdx > beginIdx) { if (endIdx > beginIdx) {
Arrays.fill(dayMins, beginIdx, endIdx, 99);//异常流程抵扣时段标识99 Arrays.fill(dayMins, beginIdx, endIdx, 99);//异常流程抵扣时段标识99
} }
@ -572,21 +572,21 @@ public class KQFormatData extends BaseBean {
for (int j = 0; workFlow != null && j < workFlow.size(); j++) { for (int j = 0; workFlow != null && j < workFlow.size(); j++) {
Map<String, Object> data = (Map<String, Object>) workFlow.get(j); Map<String, Object> data = (Map<String, Object>) workFlow.get(j);
String flowType = Util.null2String(data.get("flowtype")); String flowType = Util.null2String(data.get("flowtype"));
beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(Util.null2String(data.get("begintime"))) + 1440; beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(Util.null2String(data.get("begintime")))+1440;
endIdx = kqTimesArrayComInfo.getArrayindexByTimes(Util.null2String(data.get("endtime"))) + 1440; endIdx = kqTimesArrayComInfo.getArrayindexByTimes(Util.null2String(data.get("endtime")))+1440;
if (endIdx >= 2880) { if(endIdx>=2880){
endIdx = 2880; endIdx = 2880;
} }
if (flowType.equals(FlowReportTypeEnum.EVECTION.getFlowType())) { if(flowType.equals(FlowReportTypeEnum.EVECTION.getFlowType())){
Arrays.fill(dayMins, beginIdx, endIdx, 7);//出差抵扣时段标识 7 Arrays.fill(dayMins, beginIdx, endIdx, 7);//出差抵扣时段标识 7
} else if (flowType.equals(FlowReportTypeEnum.OUT.getFlowType())) { }else if(flowType.equals(FlowReportTypeEnum.OUT.getFlowType())){
Arrays.fill(dayMins, beginIdx, endIdx, 8);//公出抵扣时段标识 8 Arrays.fill(dayMins, beginIdx, endIdx, 8);//公出抵扣时段标识 8
} else if (flowType.equalsIgnoreCase(FlowReportTypeEnum.LEAVE.getFlowType())) { }else if(flowType.equalsIgnoreCase(FlowReportTypeEnum.LEAVE.getFlowType())){
if (endIdx > beginIdx) { if (endIdx > beginIdx) {
Arrays.fill(dayMins, beginIdx, endIdx, 5);//流程抵扣时段标识 5 Arrays.fill(dayMins, beginIdx, endIdx, 5);//流程抵扣时段标识 5
} }
} else { }else{
if (endIdx > beginIdx) { if (endIdx > beginIdx) {
Arrays.fill(dayMins, beginIdx, endIdx, 99);//异常流程抵扣时段标识99 Arrays.fill(dayMins, beginIdx, endIdx, 99);//异常流程抵扣时段标识99
} }
@ -594,14 +594,14 @@ public class KQFormatData extends BaseBean {
} }
} }
if (restTimeScope != null) { if (restTimeScope!=null) {
String restBeginTime = Util.null2String(restTimeScope.getBeginTime()); String restBeginTime = Util.null2String(restTimeScope.getBeginTime());
String restEndTime = Util.null2String(restTimeScope.getEndTime()); String restEndTime = Util.null2String(restTimeScope.getEndTime());
beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(restBeginTime); beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(restBeginTime);
endIdx = kqTimesArrayComInfo.getArrayindexByTimes(restEndTime); endIdx = kqTimesArrayComInfo.getArrayindexByTimes(restEndTime);
if (endIdx > beginIdx) { if (endIdx > beginIdx) {
Arrays.fill(dayMins, beginIdx, endIdx, -1);//休息时间 Arrays.fill(dayMins, beginIdx, endIdx, -1);//休息时间
workMins = workMins - (endIdx - beginIdx); workMins = workMins-(endIdx-beginIdx);
} }
} }
@ -642,7 +642,7 @@ public class KQFormatData extends BaseBean {
} }
} }
if (forgotCheckMins == 1 && beLateMins == 0 && tmpAttendanceMins == 0) {//forgotCheckMins==1表示下班后漏签不是迟到流程已完全抵扣异常 if(forgotCheckMins == 1 && beLateMins==0 && tmpAttendanceMins==0){//forgotCheckMins==1表示下班后漏签不是迟到流程已完全抵扣异常
forgotCheckMins = 0; forgotCheckMins = 0;
} }
@ -657,14 +657,14 @@ public class KQFormatData extends BaseBean {
kqShiftRuleEntity.setEarlyInMins(earlyInMins); kqShiftRuleEntity.setEarlyInMins(earlyInMins);
kqShiftRuleEntity.setLateOutMins(lateOutMins); kqShiftRuleEntity.setLateOutMins(lateOutMins);
kqLog.info("人性化规则处理前数据" + JSONObject.toJSONString(kqShiftRuleEntity)); kqLog.info("人性化规则处理前数据" + JSONObject.toJSONString(kqShiftRuleEntity));
if (this.writeLog) { if(this.writeLog) {
logInfo.put("" + weaver.systeminfo.SystemEnv.getHtmlLabelName(10005301, weaver.general.ThreadVarLanguage.getLang()) + "", kqShiftRuleEntity); logInfo.put(""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005301,weaver.general.ThreadVarLanguage.getLang())+"",kqShiftRuleEntity);
} }
//人性化规则 //人性化规则
kqShiftRuleEntity = kqFormatShiftRule.doShiftRule(workTime, kqShiftRuleEntity); kqShiftRuleEntity = kqFormatShiftRule.doShiftRule(workTime,kqShiftRuleEntity);
kqLog.info("人性化规则处理后数据" + JSONObject.toJSONString(kqShiftRuleEntity)); kqLog.info("人性化规则处理后数据" + JSONObject.toJSONString(kqShiftRuleEntity));
if (this.writeLog) { if(this.writeLog) {
logInfo.put("" + weaver.systeminfo.SystemEnv.getHtmlLabelName(10005302, weaver.general.ThreadVarLanguage.getLang()) + "", kqShiftRuleEntity); logInfo.put(""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005302,weaver.general.ThreadVarLanguage.getLang())+"",kqShiftRuleEntity);
} }
beLateMins = kqShiftRuleEntity.getBelatemins(); beLateMins = kqShiftRuleEntity.getBelatemins();
graveBeLateMins = kqShiftRuleEntity.getGravebelatemins(); graveBeLateMins = kqShiftRuleEntity.getGravebelatemins();
@ -674,8 +674,8 @@ public class KQFormatData extends BaseBean {
forgotCheckMins = kqShiftRuleEntity.getForgotcheckmins(); forgotCheckMins = kqShiftRuleEntity.getForgotcheckmins();
forgotBeginWorkCheckMins = kqShiftRuleEntity.getForgotBeginWorkCheckMins(); forgotBeginWorkCheckMins = kqShiftRuleEntity.getForgotBeginWorkCheckMins();
boolean beforeBegin = !new KQFormatBiz().needCal(workBeginDate, workBeginTime); boolean beforeBegin = !new KQFormatBiz().needCal(workBeginDate,workBeginTime);
if (beforeBegin) {//还未到上班时间,不用计算任何状态 if(beforeBegin) {//还未到上班时间,不用计算任何状态
kqLog.writeLog("还未到上班时间,不用计算任何状态"); kqLog.writeLog("还未到上班时间,不用计算任何状态");
beLateMins = 0; beLateMins = 0;
graveBeLateMins = 0; graveBeLateMins = 0;
@ -684,7 +684,7 @@ public class KQFormatData extends BaseBean {
absenteeismMins = 0; absenteeismMins = 0;
forgotCheckMins = 0; forgotCheckMins = 0;
forgotBeginWorkCheckMins = 0; forgotBeginWorkCheckMins = 0;
} else if (!new KQFormatBiz().needCal(workEndDate, workEndTime)) {//还未到下班时间 }else if(!new KQFormatBiz().needCal(workEndDate,workEndTime)) {//还未到下班时间
kqLog.writeLog("还未到上班时间"); kqLog.writeLog("还未到上班时间");
leaveEarlyMins = 0; leaveEarlyMins = 0;
graveLeaveEarlyMins = 0; graveLeaveEarlyMins = 0;
@ -702,19 +702,19 @@ public class KQFormatData extends BaseBean {
} }
//计算实际出勤时间(出差公出算出勤)=应出勤-旷工-请假-迟到-早退 //计算实际出勤时间(出差公出算出勤)=应出勤-旷工-请假-迟到-早退
attendanceMins = workMins - absenteeismMins - leaveMins - beLateMins - graveBeLateMins - leaveEarlyMins - graveLeaveEarlyMins; attendanceMins = workMins - absenteeismMins-leaveMins-beLateMins-graveBeLateMins-leaveEarlyMins-graveLeaveEarlyMins;
// 如果没有开启"漏签是否算实际出勤"开关,则漏签不算实际出勤时长 // 如果没有开启"漏签是否算实际出勤"开关,则漏签不算实际出勤时长
if ("0".equals(nosign_is_absent)) { if("0".equals(nosign_is_absent)) {
attendanceMins = attendanceMins - forgotCheckMins - forgotBeginWorkCheckMins; attendanceMins = attendanceMins-forgotCheckMins-forgotBeginWorkCheckMins;
} }
if (beforeBegin || attendanceMins < 0) {//还未到上班时间,不用计算任何状体 if(beforeBegin || attendanceMins < 0) {//还未到上班时间,不用计算任何状体
attendanceMins = 0; attendanceMins = 0;
} }
kqLog.info("实际出勤计算公式" + "实际出勤=应出勤- 旷工-请假-迟到-早退 userId" + userId + "kqDate==" + kqDate + ":hostIps:" + hostIps + ":uuid::" + uuid); kqLog.info("实际出勤计算公式" + "实际出勤=应出勤- 旷工-请假-迟到-早退 userId" + userId + "kqDate==" + kqDate+":hostIps:"+hostIps+":uuid::"+uuid);
kqLog.info("实际出勤计算结果" + attendanceMins + "=" + workMins + "- " + absenteeismMins + "-" + leaveMins + "-" + (beLateMins + graveBeLateMins) + "-" + (leaveEarlyMins - graveLeaveEarlyMins) + " userId" + userId + "kqDate==" + kqDate + ":hostIps:" + hostIps + ":uuid::" + uuid); kqLog.info("实际出勤计算结果" + attendanceMins + "=" + workMins + "- " + absenteeismMins + "-" + leaveMins + "-" + (beLateMins + graveBeLateMins) + "-" + (leaveEarlyMins - graveLeaveEarlyMins)+" userId" + userId + "kqDate==" + kqDate+":hostIps:"+hostIps+":uuid::"+uuid);
if (this.writeLog) { if(this.writeLog) {
logInfo.put("" + weaver.systeminfo.SystemEnv.getHtmlLabelName(10005303, weaver.general.ThreadVarLanguage.getLang()) + "", "" + weaver.systeminfo.SystemEnv.getHtmlLabelName(130566, weaver.general.ThreadVarLanguage.getLang()) + "=" + weaver.systeminfo.SystemEnv.getHtmlLabelName(132056, weaver.general.ThreadVarLanguage.getLang()) + "- " + weaver.systeminfo.SystemEnv.getHtmlLabelName(20085, weaver.general.ThreadVarLanguage.getLang()) + "-" + weaver.systeminfo.SystemEnv.getHtmlLabelName(670, weaver.general.ThreadVarLanguage.getLang()) + "-" + weaver.systeminfo.SystemEnv.getHtmlLabelName(20081, weaver.general.ThreadVarLanguage.getLang()) + "-" + weaver.systeminfo.SystemEnv.getHtmlLabelName(20082, weaver.general.ThreadVarLanguage.getLang()) + ""); logInfo.put(""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005303,weaver.general.ThreadVarLanguage.getLang())+"",""+weaver.systeminfo.SystemEnv.getHtmlLabelName(130566,weaver.general.ThreadVarLanguage.getLang())+"="+weaver.systeminfo.SystemEnv.getHtmlLabelName(132056,weaver.general.ThreadVarLanguage.getLang())+"- "+weaver.systeminfo.SystemEnv.getHtmlLabelName(20085,weaver.general.ThreadVarLanguage.getLang())+"-"+weaver.systeminfo.SystemEnv.getHtmlLabelName(670,weaver.general.ThreadVarLanguage.getLang())+"-"+weaver.systeminfo.SystemEnv.getHtmlLabelName(20081,weaver.general.ThreadVarLanguage.getLang())+"-"+weaver.systeminfo.SystemEnv.getHtmlLabelName(20082,weaver.general.ThreadVarLanguage.getLang())+"");
logInfo.put("" + weaver.systeminfo.SystemEnv.getHtmlLabelName(10005304, weaver.general.ThreadVarLanguage.getLang()) + "", attendanceMins + "=" + workMins + "- " + absenteeismMins + "-" + leaveMins + "-" + (beLateMins + graveBeLateMins) + "-" + (leaveEarlyMins - graveLeaveEarlyMins)); logInfo.put(""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005304,weaver.general.ThreadVarLanguage.getLang())+"",attendanceMins+"="+workMins+"- "+absenteeismMins+"-"+leaveMins+"-"+(beLateMins+graveBeLateMins)+"-"+(leaveEarlyMins-graveLeaveEarlyMins));
} }
//判断当天考勤状态 //判断当天考勤状态
// if (beLateMins > 0) { // if (beLateMins > 0) {
@ -748,8 +748,8 @@ public class KQFormatData extends BaseBean {
params.add(signOutDate); params.add(signOutDate);
params.add(signOutTime); params.add(signOutTime);
params.add(signOutId.length() == 0 ? null : signOutId); params.add(signOutId.length() == 0 ? null : signOutId);
kqLog.info("format in >>>>>userId" + userId + "kqDate==" + kqDate + ":hostIps:" + hostIps + ":uuid::" + uuid kqLog.info("format in >>>>>userId" + userId + "kqDate==" + kqDate+":hostIps:"+hostIps+":uuid::"+uuid
+ ":signInDate:" + signInDate + ":signInTime::" + signInTime + ":signOutDate:" + signOutDate + ":signOutTime::" + signOutTime); +":signInDate:"+signInDate+":signInTime::"+signInTime+":signOutDate:"+signOutDate+":signOutTime::"+signOutTime);
params.add(signMins); params.add(signMins);
params.add(attendanceMins); params.add(attendanceMins);
params.add(beLateMins); params.add(beLateMins);
@ -765,15 +765,15 @@ public class KQFormatData extends BaseBean {
params.add(forgotBeginWorkCheckMins); params.add(forgotBeginWorkCheckMins);
params.add(JSONObject.toJSONString(otherinfo)); params.add(JSONObject.toJSONString(otherinfo));
Map<String, Object> definedFieldInfo = new KQFormatBiz().getDefinedField(); Map<String,Object> definedFieldInfo = new KQFormatBiz().getDefinedField();
String[] definedFields = Util.splitString(Util.null2String(definedFieldInfo.get("definedField")), ","); String[] definedFields = Util.splitString(Util.null2String(definedFieldInfo.get("definedField")),",");
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo(); KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
for (int tmpIdx = 0; tmpIdx < definedFields.length; tmpIdx++) { for (int tmpIdx = 0; tmpIdx<definedFields.length; tmpIdx++) {
String fieldname = definedFields[tmpIdx]; String fieldname = definedFields[tmpIdx];
// System.out.println("fieldname=="+fieldname); // System.out.println("fieldname=="+fieldname);
String fieldid = KQReportFieldComInfo.field2Id.get(fieldname); String fieldid = KQReportFieldComInfo.field2Id.get(fieldname);
String formula = kqReportFieldComInfo.getFormula(fieldid); String formula = kqReportFieldComInfo.getFormula(fieldid);
if (formula.length() == 0) continue; if(formula.length()==0)continue;
String expression = formula; String expression = formula;
Pattern pattern = Pattern.compile("\\$\\{[^}]+\\}"); Pattern pattern = Pattern.compile("\\$\\{[^}]+\\}");
Matcher matcher = pattern.matcher(expression); Matcher matcher = pattern.matcher(expression);
@ -783,19 +783,19 @@ public class KQFormatData extends BaseBean {
String key = matcher.group(0); String key = matcher.group(0);
keyname = key.substring(2, key.length() - 1).trim(); keyname = key.substring(2, key.length() - 1).trim();
expression = matcher.replaceAll(keyname); expression = matcher.replaceAll(keyname);
env.put(keyname, keyname.equals("beLateMins") ? beLateMins : leaveEarlyMins); env.put(keyname, keyname.equals("beLateMins")?beLateMins:leaveEarlyMins);
} }
Expression compiledExp = AviatorEvaluator.compile(expression, true); Expression compiledExp = AviatorEvaluator.compile(expression,true);
String value = Util.null2String(compiledExp.execute(env)); String value = Util.null2String(compiledExp.execute(env));
params.add(value); params.add(value);
if (value.equals("1")) { if(value.equals("1")) {
params.add(keyname.equals("beLateMins") ? beLateMins : leaveEarlyMins); params.add(keyname.equals("beLateMins") ? beLateMins : leaveEarlyMins);
} else { }else{
params.add("0"); params.add("0");
} }
} }
kqLog.info("format in >>>>>userId" + userId + "kqDate==" + kqDate + ":hostIps:" + hostIps + ":uuid::" + uuid kqLog.info("format in >>>>>userId" + userId + "kqDate==" + kqDate+":hostIps:"+hostIps+":uuid::"+uuid
+ ":params:" + JSON.toJSONString(params)); +":params:"+JSON.toJSONString(params));
lsParam.add(params); lsParam.add(params);
} }
} catch (Exception e) { } catch (Exception e) {
@ -809,7 +809,7 @@ public class KQFormatData extends BaseBean {
this.writeLog = writeLog; this.writeLog = writeLog;
} }
public Map<String, Object> getLogInfo() { public Map<String,Object> getLogInfo() {
return logInfo; return logInfo;
} }
@ -835,7 +835,6 @@ public class KQFormatData extends BaseBean {
/** /**
* *
*
* @param userId * @param userId
* @param kqDate * @param kqDate
* @param nonlsParam * @param nonlsParam
@ -852,7 +851,7 @@ public class KQFormatData extends BaseBean {
int beginIdx = 0; int beginIdx = 0;
int endIdx = 0; int endIdx = 0;
int leaveMins = 0;//请假时长 int leaveMins = 0;//请假时长
Map<String, Object> leaveInfo = new HashMap<>();//请假信息 Map<String,Object> leaveInfo = new HashMap<>();//请假信息
int evectionMins = 0;//出差时长 int evectionMins = 0;//出差时长
int outMins = 0;//公出时长 int outMins = 0;//公出时长
int otherMins = 0;//异常流程时长 int otherMins = 0;//异常流程时长
@ -878,7 +877,7 @@ public class KQFormatData extends BaseBean {
next_lsSignTime = next_lsSignTime != null ? next_lsSignTime : new ArrayList<>(); next_lsSignTime = next_lsSignTime != null ? next_lsSignTime : new ArrayList<>();
} }
List<Object> lsCheckInfo = new KQFormatSignData().getNonWorkSignInfo(userId, preDate, kqDate, pre_lsSignTime, next_lsSignTime); List<Object> lsCheckInfo = new KQFormatSignData().getNonWorkSignInfo(userId,preDate,kqDate,pre_lsSignTime,next_lsSignTime);
for (int j = 0; lsCheckInfo != null && j < lsCheckInfo.size(); j++) { for (int j = 0; lsCheckInfo != null && j < lsCheckInfo.size(); j++) {
Map<String, Object> checkInfo = (Map<String, Object>) lsCheckInfo.get(j); Map<String, Object> checkInfo = (Map<String, Object>) lsCheckInfo.get(j);
@ -907,26 +906,26 @@ public class KQFormatData extends BaseBean {
String newLeaveType = Util.null2String(data.get("newleavetype")); String newLeaveType = Util.null2String(data.get("newleavetype"));
beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(Util.null2String(data.get("begintime"))); beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(Util.null2String(data.get("begintime")));
endIdx = kqTimesArrayComInfo.getArrayindexByTimes(Util.null2String(data.get("endtime"))); endIdx = kqTimesArrayComInfo.getArrayindexByTimes(Util.null2String(data.get("endtime")));
if (flowType.equals(FlowReportTypeEnum.EVECTION.getFlowType())) { if(flowType.equals(FlowReportTypeEnum.EVECTION.getFlowType())){
Arrays.fill(dayMins, beginIdx, endIdx, 7);//出差抵扣时段标识 7 Arrays.fill(dayMins, beginIdx, endIdx, 7);//出差抵扣时段标识 7
} else if (flowType.equals(FlowReportTypeEnum.OUT.getFlowType())) { }else if(flowType.equals(FlowReportTypeEnum.OUT.getFlowType())){
Arrays.fill(dayMins, beginIdx, endIdx, 8);//公出抵扣时段标识 8 Arrays.fill(dayMins, beginIdx, endIdx, 8);//公出抵扣时段标识 8
} else if (flowType.equalsIgnoreCase(FlowReportTypeEnum.LEAVE.getFlowType())) { }else if(flowType.equalsIgnoreCase(FlowReportTypeEnum.LEAVE.getFlowType())){
if (endIdx > beginIdx) { if (endIdx > beginIdx) {
Arrays.fill(dayMins, beginIdx, endIdx, 5);//流程抵扣时段标识 5 Arrays.fill(dayMins, beginIdx, endIdx, 5);//流程抵扣时段标识 5
int tmpBeginIdx = beginIdx; int tmpBeginIdx = beginIdx;
int tmpEndIdx = endIdx; int tmpEndIdx = endIdx;
Integer val = 0; Integer val = 0;
if (leaveInfo.get(newLeaveType) == null) { if(leaveInfo.get(newLeaveType)==null){
leaveInfo.put(newLeaveType, val); leaveInfo.put(newLeaveType,val);
} else { }else{
val = (Integer) leaveInfo.get(newLeaveType); val = (Integer) leaveInfo.get(newLeaveType);
} }
if (tmpEndIdx > tmpBeginIdx) { if(tmpEndIdx>tmpBeginIdx){
leaveInfo.put(newLeaveType, val + (tmpEndIdx - tmpBeginIdx)); leaveInfo.put(newLeaveType,val+(tmpEndIdx-tmpBeginIdx));
} }
} }
} else { }else{
if (endIdx > beginIdx) { if (endIdx > beginIdx) {
Arrays.fill(dayMins, beginIdx, endIdx, 99);//异常流程抵扣时段标识99 Arrays.fill(dayMins, beginIdx, endIdx, 99);//异常流程抵扣时段标识99
} }

Loading…
Cancel
Save