dxfeng 1 year ago
commit bd464fa4fb

@ -1,4 +1,4 @@
#宁波精华考勤需 #
#管理人员指定人员考勤组id #管理人员指定人员考勤组id
glrygroupid=6 glrygroupid=6
#管理人员考勤组id #管理人员考勤组id
@ -8,7 +8,7 @@ sjbjcjid=6,7,8
#婚假丧假id #婚假丧假id
hjsjid=10,11 hjsjid=10,11
#预入职流程id #预入职流程id
yrzWfid=518 yrzWfid=533
#固定流程创建人id #固定流程创建人id
lccjr=43 lccjr=43
#目录id #目录id
@ -22,9 +22,11 @@ searIdYb=2
#管理人员12小时班制夜班最大加班时长 #管理人员12小时班制夜班最大加班时长
ybMaxMins=240 ybMaxMins=240
#加班申请流程表名 #加班申请流程表名
lctableName=formtable_main_374 lctableName=formtable_main_436
#两小时起步加班休班次id #休班次两小时起步
twoStartSerId=12 twoStartSerId=12
#支援班次id 11 支援休班次id 21 支援夜班次id 22
supportSerId=11,21,22

@ -0,0 +1,10 @@
package com.api.nbkq.web;
import com.engine.nbkq.web.NbjhWorkflowAction;
import javax.ws.rs.Path;
@Path("/nbjh/leaveworkflow")
public class NbJhWorkflowActionApi extends NbjhWorkflowAction {
}

@ -133,8 +133,8 @@ 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,flowinfo" + (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);
@ -285,7 +285,7 @@ public class KQFormatData extends BaseBean {
//用来计算实际打卡时长用的 //用来计算实际打卡时长用的
int signInTimeIndx4Sign = -1; int signInTimeIndx4Sign = -1;
int signInTimeOutdx4Sign = -1; int signInTimeOutdx4Sign = -1;
Map<String,Object> flowinfo = new HashMap<>();//流程信息 // Map<String,Object> flowinfo = new HashMap<>();//流程信息
String signBeginDateTime = signTimeScope.getBeginTimeAcross() ? nextDate : kqDate; String signBeginDateTime = signTimeScope.getBeginTimeAcross() ? nextDate : kqDate;
@ -551,7 +551,7 @@ public class KQFormatData extends BaseBean {
if (workFlowInfo.get(dateKey) != null) { if (workFlowInfo.get(dateKey) != null) {
workFlow = (List<Object>) workFlowInfo.get(dateKey); workFlow = (List<Object>) workFlowInfo.get(dateKey);
} }
List<Object> flowList = Lists.newArrayList(); // List<Object> flowList = Lists.newArrayList();
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"));
@ -559,27 +559,27 @@ public class KQFormatData extends BaseBean {
String signtype = Util.null2String(data.get("signtype")); String signtype = Util.null2String(data.get("signtype"));
String serial = Util.null2String(data.get("serial")); String serial = Util.null2String(data.get("serial"));
String requestId = Util.null2String(data.get("requestId")); String requestId = Util.null2String(data.get("requestId"));
// 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")));
String begintime = Util.null2String(data.get("begintime")); // String begintime = Util.null2String(data.get("begintime"));
String endtime = Util.null2String(data.get("endtime")); // String endtime = Util.null2String(data.get("endtime"));
beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(begintime); // beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(begintime);
endIdx = kqTimesArrayComInfo.getArrayindexByTimes(endtime); // endIdx = kqTimesArrayComInfo.getArrayindexByTimes(endtime);
if (beginIdx >= endIdx) { if (beginIdx >= endIdx) {
continue; continue;
} }
Map<String,String> flowMap = Maps.newHashMap(); // Map<String,String> flowMap = Maps.newHashMap();
flowMap.put("newLeaveType", newLeaveType); // flowMap.put("newLeaveType", newLeaveType);
flowMap.put("begintime", begintime); // flowMap.put("begintime", begintime);
flowMap.put("endtime", endtime); // flowMap.put("endtime", endtime);
List<Map<String,String>> flowMapList = Lists.newArrayList(); // List<Map<String,String>> flowMapList = Lists.newArrayList();
if(flowinfo.containsKey(flowType)){ // if(flowinfo.containsKey(flowType)){
List<Map<String,String>> tmpFlowMapList = (List<Map<String, String>>) flowinfo.get(flowType); // List<Map<String,String>> tmpFlowMapList = (List<Map<String, String>>) flowinfo.get(flowType);
tmpFlowMapList.add(flowMap); // tmpFlowMapList.add(flowMap);
}else{ // }else{
flowMapList.add(flowMap); // flowMapList.add(flowMap);
flowinfo.put(flowType, flowMapList); // flowinfo.put(flowType, flowMapList);
} // }
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
@ -881,7 +881,7 @@ public class KQFormatData extends BaseBean {
params.add(outMins); params.add(outMins);
params.add(forgotBeginWorkCheckMins); params.add(forgotBeginWorkCheckMins);
params.add(JSONObject.toJSONString(otherinfo)); params.add(JSONObject.toJSONString(otherinfo));
params.add(JSONObject.toJSONString(flowinfo)); // params.add(JSONObject.toJSONString(flowinfo));
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")), ",");

@ -24,6 +24,8 @@ import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import weaver.common.DateUtil; import weaver.common.DateUtil;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
import weaver.formmode.setup.ModeRightInfo; import weaver.formmode.setup.ModeRightInfo;
@ -106,6 +108,8 @@ public class KQOverTimeRuleCalBiz {
computingModeMap,kqTimesArrayComInfo,uuid,singleRs); computingModeMap,kqTimesArrayComInfo,uuid,singleRs);
} }
} }
fromDate=preFromDate.format(dateFormatter);
updateTiaoXiu(resourceid, fromDate, toDate);
}catch (Exception e){ }catch (Exception e){
kqLog.info("加班生成数据报错:KQOverTimeRuleCalBiz:"); kqLog.info("加班生成数据报错:KQOverTimeRuleCalBiz:");
StringWriter errorsWriter = new StringWriter(); StringWriter errorsWriter = new StringWriter();
@ -114,6 +118,116 @@ public class KQOverTimeRuleCalBiz {
} }
} }
/**
*
* @param resourceid
* @param fromDate
* @param toDate
*/
public void updateTiaoXiu(String resourceid, String fromDate, String toDate){
//假期类型的缓存类
KQLeaveRulesComInfo rulesComInfo = new KQLeaveRulesComInfo();
//[调休]的假期类型的ID
String leaveRulesId = "";
//找到[调休]的假期类型ID
rulesComInfo.setTofirstRow();
while (rulesComInfo.next()) {
if (KQLeaveRulesBiz.isTiaoXiu(rulesComInfo.getId())) {
if("1".equals(rulesComInfo.getIsEnable())){
leaveRulesId = rulesComInfo.getId();
break;
}
}
}
RecordSet recordSet = new RecordSet();
String sql = " select * from kq_balanceOfLeave " +
" where (isDelete is null or isDelete<>1) and resourceId=" + resourceid +
" and leaveRulesId=" + leaveRulesId +
" and effectiveDate>='" + fromDate + "' and effectiveDate<='" +toDate+"'"+
" order by belongYear asc,effectiveDate asc,id asc ";
recordSet.executeQuery(sql);
String all_tiaoxiuids = "";
BigDecimal duration = new BigDecimal("0");
while (recordSet.next()) {
//额外
BigDecimal extraAmount = new BigDecimal(Util.null2s(recordSet.getString("extraAmount"), "0"));
//加班生成调休
BigDecimal tiaoxiuAmount = new BigDecimal(Util.null2s(recordSet.getString("tiaoxiuamount"), "0"));
//已休
BigDecimal usedAmount = new BigDecimal(Util.null2s(recordSet.getString("usedAmount"), "0"));
if (extraAmount.add(tiaoxiuAmount).subtract(usedAmount).doubleValue() >= 0) {
continue;
}
String id = recordSet.getString("id");
if(id.length() > 0 && Util.getIntValue(id) > 0){
all_tiaoxiuids += ","+id;
duration =duration.add(extraAmount).add(tiaoxiuAmount).subtract(usedAmount);
}
}
duration = duration.abs();
List<String> updateList = new ArrayList<String>();
sql = " select * from kq_balanceOfLeave " +
" where (isDelete is null or isDelete<>1) and resourceId=" + resourceid +
" and leaveRulesId=" + leaveRulesId +
" and effectiveDate>='" + fromDate + "'"+
" order by belongYear asc,effectiveDate asc,id asc ";
recordSet.executeQuery(sql);
int total = recordSet.getCounts();
int index = 0;
while (recordSet.next()) {
index++;
String id = recordSet.getString("id");
//额外
BigDecimal extraAmount = new BigDecimal(Util.null2s(recordSet.getString("extraAmount"), "0"));
//加班生成调休
BigDecimal tiaoxiuAmount = new BigDecimal(Util.null2s(recordSet.getString("tiaoxiuamount"), "0"));
//已休
BigDecimal usedAmount = new BigDecimal(Util.null2s(recordSet.getString("usedAmount"), "0"));
if (extraAmount.add(tiaoxiuAmount).subtract(usedAmount).doubleValue() <= 0) {
continue;
}
BigDecimal temp = extraAmount.add(tiaoxiuAmount).subtract(usedAmount).subtract(duration);
/*该假期剩余假期余额不足以扣减,记录错误日志,退出方法*/
if (index == total && temp.doubleValue() < 0) {
kqLog.info("该人员的该假期所有的剩余假期余额都不足以扣减。" +
"resourceId=" + resourceid + ",date=" + fromDate + ",ruleId=" + leaveRulesId + ",duration=" + duration + ",extraAmount=" + extraAmount.doubleValue() + ",usedAmount=" + usedAmount.doubleValue());
String newUsedAmount = usedAmount.add(duration).setScale(5, RoundingMode.HALF_UP).toPlainString();
String updateSql = "update kq_balanceOfLeave set usedAmount=" + (newUsedAmount) + " where id=" + id;
updateList.add(updateSql);
break;
}
if (temp.doubleValue() >= 0) {
String newUsedAmount = usedAmount.add(duration).setScale(5, RoundingMode.HALF_UP).toPlainString();
String updateSql = "update kq_balanceOfLeave set usedAmount=" + (newUsedAmount) + " where id=" + id;
updateList.add(updateSql);
break;
} else {
duration = duration.add(usedAmount).subtract(extraAmount).subtract(tiaoxiuAmount);
String newUsedAmount = extraAmount.add(tiaoxiuAmount).setScale(5, RoundingMode.HALF_UP).toPlainString();
String updateSql = "update kq_balanceOfLeave set usedAmount=" + (newUsedAmount) + " where id=" + id;
updateList.add(updateSql);
continue;
}
}
if(all_tiaoxiuids.length() > 0) {
all_tiaoxiuids = all_tiaoxiuids.substring(1);
updateList.add("update kq_balanceOfLeave set isDelete=1 where id in (" +all_tiaoxiuids+")");
}
kqLog.info("updateList:"+updateList);
/*SQL操作批处理*/
for (int i = 0; i < updateList.size(); i++) {
boolean flag = recordSet.executeUpdate(updateList.get(i));
if (!flag) {
kqLog.info("刷新加班流程数据失败:数据库更新失败" );
return;
}
}
}
/** /**
* *
* @param resourceid * @param resourceid
@ -303,6 +417,8 @@ public class KQOverTimeRuleCalBiz {
// } // }
int across_mins = 0; int across_mins = 0;
String fromTimeCheck = "";
String toTimeCheck = "";
for(int i = 0 ; i < cross_time_list.size() ;) { for(int i = 0 ; i < cross_time_list.size() ;) {
int cross_fromtime_index = cross_time_list.get(i); int cross_fromtime_index = cross_time_list.get(i);
int cross_totime_index = cross_time_list.get(i + 1); int cross_totime_index = cross_time_list.get(i + 1);
@ -335,7 +451,8 @@ public class KQOverTimeRuleCalBiz {
String cross_totime = kqTimesArrayComInfo.getTimesByArrayindex(flow_cross_totime_index); String cross_totime = kqTimesArrayComInfo.getTimesByArrayindex(flow_cross_totime_index);
String cross_fromdate = realSplitDate; String cross_fromdate = realSplitDate;
String cross_todate = realSplitDate; String cross_todate = realSplitDate;
fromTimeCheck = cross_fromtime;
toTimeCheck = cross_totime;
boolean needSplitByTime = false; boolean needSplitByTime = false;
if(needSplitByTime){ if(needSplitByTime){
// 按照加班时长转调休的 时长设置 这个逻辑如果后面要开启来可以直接用的 // 按照加班时长转调休的 时长设置 这个逻辑如果后面要开启来可以直接用的
@ -440,6 +557,26 @@ public class KQOverTimeRuleCalBiz {
}else{ }else{
otherParam.put("overtimeLogMap", overtimeLogMap); otherParam.put("overtimeLogMap", overtimeLogMap);
logOvertimeMap(overtimeLogMap, across_mins, flow_key+"|最终生成的加班分钟数|overtime_mins"); logOvertimeMap(overtimeLogMap, across_mins, flow_key+"|最终生成的加班分钟数|overtime_mins");
String searIdFrom = workTimeEntity.getSerialId();
//如果是休班次,加班类型为休息日加班
if (isRestSerial(searIdFrom,rs)) {
kqLog.info("原始across_mins:"+across_mins+"fromTimeCheck:"+fromTimeCheck+"toTimeCheck:"+toTimeCheck);
String signinTimeNew = kqTimesArrayComInfo.turn48to24Time(signinTime);
String signoutTimeNew = kqTimesArrayComInfo.turn48to24Time(signoutTime);
if(StringUtils.isNotBlank(fromTimeCheck)){
signinTimeNew = fromTimeCheck;
}
if(StringUtils.isNotBlank(toTimeCheck)){
signoutTimeNew = toTimeCheck;
}
Double newHours = recalculateOverTime(divide(String.valueOf(across_mins),"60"),searIdFrom, signinDate, signinTimeNew, signoutDate, signoutTimeNew, rs, singleRs);
Double newMinsBy = newHours*60;
across_mins = newMinsBy.intValue();
kqLog.info("newHours:"+newHours+"mins:"+across_mins);
}
/*获取考勤组的ID因为考勤组有有效期所以需要传入日期*/ /*获取考勤组的ID因为考勤组有有效期所以需要传入日期*/
KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo(); KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo();
String groupId = kqGroupMemberComInfo.getKQGroupId(resourceid, realSplitDate); String groupId = kqGroupMemberComInfo.getKQGroupId(resourceid, realSplitDate);
@ -462,7 +599,7 @@ public class KQOverTimeRuleCalBiz {
String lctableName = bb.getPropValue("nbkq_main","lctableName"); String lctableName = bb.getPropValue("nbkq_main","lctableName");
Integer bxszh = changeBxs(across_mins); Integer bxszh = changeBxs(across_mins);
Integer yxszh = changeyxs(across_mins); Integer yxszh = changeyxs(across_mins);
String searIdFrom = workTimeEntity.getSerialId();
kqLog.info("半小时计提时长bxszh:"+bxszh+"yxszh:"+yxszh+"searIdFrom:"+searIdFrom); kqLog.info("半小时计提时长bxszh:"+bxszh+"yxszh:"+yxszh+"searIdFrom:"+searIdFrom);
String jblx = ""; String jblx = "";
String bxfs = ""; String bxfs = "";
@ -584,6 +721,40 @@ public class KQOverTimeRuleCalBiz {
String overtimeid = get_overtime_uuid(overtime_uuid); String overtimeid = get_overtime_uuid(overtime_uuid);
kqEventLogBiz.updateOvertimeId(uuid, overtimeid); kqEventLogBiz.updateOvertimeId(uuid, overtimeid);
new BaseBean().writeLog("tiaoxiuId---2"+tiaoxiuId);
if(StringUtils.isNotBlank(tiaoxiuId)){
if (isRestSerial(searIdFrom,rs)) {
Double sc = divide(String.valueOf(across_mins),"60");
new BaseBean().writeLog("更新kq_balanceOfLeave的sc"+across_mins);
// sc = recalculateOverTime(sc,searIdFrom, fromdatedb, fromtimedb, todatedb, totimedb, rs, singleRs);
new BaseBean().writeLog("重新计算后的sc"+sc);
String sql = " select * from kq_balanceOfLeave where id = "+tiaoxiuId ;
rs.executeQuery(sql);
if(rs.next()){
String tiaoxiuamount = Util.null2String(rs.getString("tiaoxiuamount"));
new BaseBean().writeLog("系统计算的调休是:"+tiaoxiuamount);
}
sql = "update kq_balanceOfLeave set tiaoxiuamount="+sc+" where id = "+tiaoxiuId ;
new BaseBean().writeLog("重新计算sql"+sql);
boolean isTrue = rs.executeUpdate(sql);
new BaseBean().writeLog("重新计算更新:"+isTrue);
new BaseBean().writeLog("overtime_uuid"+overtime_uuid);
// if(StringUtils.isNotBlank(overtime_uuid)){
// int duration_min = (int)sc.doubleValue()*60;
// sql = " update kq_flow_overtime set duration_min='"+duration_min+"' where uuid='"+overtime_uuid+"'" ;
// new BaseBean().writeLog("重新计算kq_flow_overtime的sql"+sql);
// isTrue = rs.executeUpdate(sql);
// new BaseBean().writeLog("kq_flow_overtime重新计算更新"+isTrue);
// }
}
}
} }
} }
}else{ }else{
@ -846,6 +1017,19 @@ public class KQOverTimeRuleCalBiz {
}else{ }else{
logOvertimeMap(overtimeLogMap, mins, flow_cross_key+"|最终生成的加班分钟数|overtime_mins"); logOvertimeMap(overtimeLogMap, mins, flow_cross_key+"|最终生成的加班分钟数|overtime_mins");
String searIdFrom = workTimeEntity.getSerialId();
//如果是休班次,加班类型为休息日加班
if (isRestSerial(searIdFrom,rs)) {
kqLog.info("原始across_mins:"+mins);
String signinTimeNew = kqTimesArrayComInfo.turn48to24Time(signinTime);
String signoutTimeNew = kqTimesArrayComInfo.turn48to24Time(signoutTime);
Double newHours = recalculateOverTime(divide(String.valueOf(mins),"60"),searIdFrom, signinDate, signinTimeNew, signoutDate, signoutTimeNew, rs, singleRs);
Double newMinsBy = newHours*60;
mins = newMinsBy.intValue();
kqLog.info("newHours:"+newHours+"mins:"+mins);
}
/*获取考勤组的ID因为考勤组有有效期所以需要传入日期*/ /*获取考勤组的ID因为考勤组有有效期所以需要传入日期*/
KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo(); KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo();
String groupId = kqGroupMemberComInfo.getKQGroupId(resourceid, realSplitDate); String groupId = kqGroupMemberComInfo.getKQGroupId(resourceid, realSplitDate);
@ -861,8 +1045,14 @@ public class KQOverTimeRuleCalBiz {
String searIdYb = bb.getPropValue("nbkq_main","searIdYb"); String searIdYb = bb.getPropValue("nbkq_main","searIdYb");
//管理人员12小时班制夜班最大加班时长 //管理人员12小时班制夜班最大加班时长
Integer ybMaxMins = Util.getIntValue(bb.getPropValue("nbkq_main","ybMaxMins")); Integer ybMaxMins = Util.getIntValue(bb.getPropValue("nbkq_main","ybMaxMins"));
if(searIdYb.equals(searIdFrom)){
//12夜补半小时
mins = mins + 30;
kqLog.info("12夜补半小时:"+mins);
}
Integer bxszh = changeBxs(mins); Integer bxszh = changeBxs(mins);
String searIdFrom = workTimeEntity.getSerialId();
kqLog.info("半小时计提时长bxszh:"+bxszh+"searIdFrom:"+searIdFrom); kqLog.info("半小时计提时长bxszh:"+bxszh+"searIdFrom:"+searIdFrom);
if(searIdBb.equals(searIdFrom)){ if(searIdBb.equals(searIdFrom)){
kqLog.info("白班"); kqLog.info("白班");
@ -906,8 +1096,39 @@ public class KQOverTimeRuleCalBiz {
String overtimeid = get_overtime_uuid(overtime_uuid); String overtimeid = get_overtime_uuid(overtime_uuid);
kqEventLogBiz.updateOvertimeId(uuid, overtimeid); kqEventLogBiz.updateOvertimeId(uuid, overtimeid);
}
new BaseBean().writeLog("tiaoxiuId---"+tiaoxiuId);
if(StringUtils.isNotBlank(tiaoxiuId)) {
if (isRestSerial(searIdFrom, rs)) {
Double sc = divide(String.valueOf(mins), "60");
new BaseBean().writeLog("更新kq_balanceOfLeave的sc" + mins);
// sc = recalculateOverTime(sc, searIdFrom, signinDate, signinTime, signoutDate, signoutTime, rs, singleRs);
new BaseBean().writeLog("重新计算后的sc" + sc);
String sql = " select * from kq_balanceOfLeave where id = " + tiaoxiuId;
rs.executeQuery(sql);
if (rs.next()) {
String tiaoxiuamount = Util.null2String(rs.getString("tiaoxiuamount"));
new BaseBean().writeLog("系统计算的调休是:" + tiaoxiuamount);
}
sql = "update kq_balanceOfLeave set tiaoxiuamount=" + sc + " where id = " + tiaoxiuId;
new BaseBean().writeLog("重新计算sql" + sql);
boolean isTrue = rs.executeUpdate(sql);
new BaseBean().writeLog("重新计算更新:" + isTrue);
new BaseBean().writeLog("overtime_uuid" + overtime_uuid);
// if(StringUtils.isNotBlank(overtime_uuid)){
// int duration_min = (int)sc.doubleValue()*60;
// sql = " update kq_flow_overtime set duration_min='"+duration_min+"' where uuid='"+overtime_uuid+"'" ;
// new BaseBean().writeLog("重新计算kq_flow_overtime的sql"+sql);
// isTrue = rs.executeUpdate(sql);
// new BaseBean().writeLog("kq_flow_overtime重新计算更新"+isTrue);
// }
}
}
}
} }
}else{ }else{
logOvertimeMap(overtimeLogMap, "打卡区间不正确|"+flow_cross_key, mapKey+"|"+"打卡区间,得到打卡时长|over_count"); logOvertimeMap(overtimeLogMap, "打卡区间不正确|"+flow_cross_key, mapKey+"|"+"打卡区间,得到打卡时长|over_count");
@ -3144,8 +3365,8 @@ public class KQOverTimeRuleCalBiz {
//如果是休班次,加班类型为休息日加班 //如果是休班次,加班类型为休息日加班
if (isRestSerial(searIdFrom,rs)) { if (isRestSerial(searIdFrom,rs)) {
jblxNew = "1"; jblxNew = "1";
new BaseBean().writeLog("insertJbtz 原始sc"+sc); // new BaseBean().writeLog("insertJbtz 原始sc"+sc);
sc = recalculateOverTime(sc,searIdFrom, ksrq, kssj, jsrq, jssj, rs, singleRs); // sc = recalculateOverTime(sc,searIdFrom, ksrq, kssj, jsrq, jssj, rs, singleRs);
} }
String sqlMode = "insert into uf_jbtz (jbr,gjsc,bcfs,jbxz,sqr,szbm,sjh,zzdksj,zwdkrq,ly,gh,bm,zw,jblx,ksrq,jsrq,sqsy,kssj,jssj,gzrq,FORMMODEID,MODEDATACREATER,MODEDATACREATERTYPE,MODEDATACREATEDATE,MODEDATACREATETIME) \n" + String sqlMode = "insert into uf_jbtz (jbr,gjsc,bcfs,jbxz,sqr,szbm,sjh,zzdksj,zwdkrq,ly,gh,bm,zw,jblx,ksrq,jsrq,sqsy,kssj,jssj,gzrq,FORMMODEID,MODEDATACREATER,MODEDATACREATERTYPE,MODEDATACREATEDATE,MODEDATACREATETIME) \n" +
@ -3250,7 +3471,7 @@ public class KQOverTimeRuleCalBiz {
BigDecimal b1 = new BigDecimal(v1); BigDecimal b1 = new BigDecimal(v1);
BigDecimal b2 = new BigDecimal(v2); BigDecimal b2 = new BigDecimal(v2);
BigDecimal divide = b1.divide(b2, 2, BigDecimal.ROUND_HALF_UP); BigDecimal divide = b1.divide(b2, 2, BigDecimal.ROUND_HALF_UP);
return divide.setScale(0, RoundingMode.DOWN).doubleValue(); return divide.doubleValue();
} }
/** /**

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.engine.kq.cmd.attendanceButton.ButtonStatusEnum; import com.engine.kq.cmd.attendanceButton.ButtonStatusEnum;
import com.engine.kq.enums.KqSplitFlowTypeEnum; import com.engine.kq.enums.KqSplitFlowTypeEnum;
import com.engine.kq.log.KQLog; import com.engine.kq.log.KQLog;
import com.engine.kq.nbjh.KqUtil;
import com.engine.kq.util.KQDurationCalculatorUtil; import com.engine.kq.util.KQDurationCalculatorUtil;
import weaver.common.DateUtil; import weaver.common.DateUtil;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
@ -84,10 +85,10 @@ public class KQReportBiz extends BaseBean {
List<Object> datas = null; List<Object> datas = null;
Map<String, Object> data = null; Map<String, Object> data = null;
sql = " select kqdate,serialid, workbegindate, workbegintime,workenddate, workendtime," + sql = " select kqdate,serialid, workbegindate, workbegintime,workenddate, workendtime," +
" signintime,signouttime,beLateMins,graveBeLateMins,leaveEarlyMins,graveLeaveEarlyMins," + " signintime,signouttime,beLateMins,graveBeLateMins,leaveEarlyMins,graveLeaveEarlyMins," +
" absenteeismMins, forgotCheckMins,forgotBeginWorkCheckMins,otherinfo "+ " absenteeismMins, forgotCheckMins,forgotBeginWorkCheckMins,otherinfo "+
" from kq_format_detail " + " from kq_format_detail " +
" where resourceid=? and kqdate>=? and kqdate<=? "; " where resourceid=? and kqdate>=? and kqdate<=? ";
if(!isAll){ if(!isAll){
if(rs.getDBType().equalsIgnoreCase("oracle") || Util.null2String(rs.getOrgindbtype()).equals("dm") || Util.null2String(rs.getOrgindbtype()).equals("st")) { if(rs.getDBType().equalsIgnoreCase("oracle") || Util.null2String(rs.getOrgindbtype()).equals("dm") || Util.null2String(rs.getOrgindbtype()).equals("st")) {
sql += " and beLateMins+graveBeLateMins+leaveEarlyMins+graveLeaveEarlyMins+absenteeismMins+forgotCheckMins+nvl(forgotBeginWorkCheckMins,0)>0 "; sql += " and beLateMins+graveBeLateMins+leaveEarlyMins+graveLeaveEarlyMins+absenteeismMins+forgotCheckMins+nvl(forgotBeginWorkCheckMins,0)>0 ";
@ -1176,8 +1177,8 @@ public class KQReportBiz extends BaseBean {
} }
sql = " select resourceid, durationrule, changetype,sum(duration) as val from hrmresource a, "+ KqSplitFlowTypeEnum.PROCESSCHANGE.getTablename()+" b "+ sql = " select resourceid, durationrule, changetype,sum(duration) as val from hrmresource a, "+ KqSplitFlowTypeEnum.PROCESSCHANGE.getTablename()+" b "+
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' "+sqlWhere+ " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' "+sqlWhere+
" group by resourceid, durationrule,changetype "; " group by resourceid, durationrule,changetype ";
rs.execute(sql); rs.execute(sql);
while (rs.next()) { while (rs.next()) {
String resourceid = rs.getString("resourceid"); String resourceid = rs.getString("resourceid");
@ -1277,8 +1278,8 @@ public class KQReportBiz extends BaseBean {
} }
sql = " select resourceid, newleavetype, durationrule, sum(duration) as val,belongdate from hrmresource a, "+ KqSplitFlowTypeEnum.LEAVE.getTablename()+" b "+ sql = " select resourceid, newleavetype, durationrule, sum(duration) as val,belongdate from hrmresource a, "+ KqSplitFlowTypeEnum.LEAVE.getTablename()+" b "+
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere + " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere +
" group by resourceid, newleavetype, durationrule,belongdate "; " group by resourceid, newleavetype, durationrule,belongdate ";
rs.execute(sql); rs.execute(sql);
while (rs.next()) { while (rs.next()) {
String resourceid = rs.getString("resourceid"); String resourceid = rs.getString("resourceid");
@ -1369,8 +1370,8 @@ public class KQReportBiz extends BaseBean {
} }
sql = " select resourceid, newleavetype, durationrule, sum(duration) as val,belongdate from hrmresource a, "+ KqSplitFlowTypeEnum.LEAVEBACK.getTablename()+" b "+ sql = " select resourceid, newleavetype, durationrule, sum(duration) as val,belongdate from hrmresource a, "+ KqSplitFlowTypeEnum.LEAVEBACK.getTablename()+" b "+
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere + " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere +
" group by resourceid, newleavetype, durationrule,belongdate "; " group by resourceid, newleavetype, durationrule,belongdate ";
rs.execute(sql); rs.execute(sql);
while (rs.next()) { while (rs.next()) {
String resourceid = rs.getString("resourceid"); String resourceid = rs.getString("resourceid");
@ -1464,9 +1465,9 @@ public class KQReportBiz extends BaseBean {
String valueField = ""; String valueField = "";
sql = " select resourceid,changeType, sum(cast(duration_min as decimal(18,4))) as val,paidLeaveEnable "+ sql = " select resourceid,changeType, sum(cast(duration_min as decimal(18,4))) as val,paidLeaveEnable "+
" from hrmresource a, kq_flow_overtime b "+ " from hrmresource a, kq_flow_overtime b "+
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere+ " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere+
" group by resourceid,changeType,paidLeaveEnable "; " group by resourceid,changeType,paidLeaveEnable ";
rs.execute(sql); rs.execute(sql);
kqLog.info("getFlowOverTimeDataNew:sql:"+sql); kqLog.info("getFlowOverTimeDataNew:sql:"+sql);
while (rs.next()) { while (rs.next()) {
@ -1675,9 +1676,9 @@ public class KQReportBiz extends BaseBean {
} }
sql = " select resourceid,changeType,belongdate,paidLeaveEnable, sum(cast(duration_min as decimal(18,4))) as val "+ sql = " select resourceid,changeType,belongdate,paidLeaveEnable, sum(cast(duration_min as decimal(18,4))) as val "+
" from hrmresource a, kq_flow_overtime b "+ " from hrmresource a, kq_flow_overtime b "+
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere+ " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere+
" group by resourceid,changeType,paidLeaveEnable,belongdate "; " group by resourceid,changeType,paidLeaveEnable,belongdate ";
rs.execute(sql); rs.execute(sql);
while (rs.next()) { while (rs.next()) {
String resourceid = rs.getString("resourceid"); String resourceid = rs.getString("resourceid");
@ -1822,13 +1823,15 @@ public class KQReportBiz extends BaseBean {
String sql = ""; String sql = "";
try { try {
sql = " select resourceid, kqdate, workMins, belatemins, graveBeLateMins, leaveearlymins, graveLeaveEarlyMins, absenteeismmins, forgotcheckMins, forgotBeginWorkCheckMins, "+ sql = " select resourceid, kqdate, workMins, belatemins, graveBeLateMins, leaveearlymins, graveLeaveEarlyMins, absenteeismmins, forgotcheckMins, forgotBeginWorkCheckMins, "+
" leaveMins,leaveInfo,evectionMins,outMins " + " leaveMins,leaveInfo,evectionMins,outMins " +
" from kq_format_detail " + " from kq_format_detail " +
" where resourceid = ? and kqdate>=? and kqdate<=? "+ " where resourceid = ? and kqdate>=? and kqdate<=? "+
" order by resourceid, kqdate, serialnumber "; " order by resourceid, kqdate, serialnumber ";
rs.executeQuery(sql,resourceId, fromDate,toDate); rs.executeQuery(sql,resourceId, fromDate,toDate);
while (rs.next()) { while (rs.next()) {
String key = rs.getString("resourceid") + "|" + rs.getString("kqdate"); String userid = rs.getString("resourceid");
String kqdate = rs.getString("kqdate");
String key = userid + "|" + kqdate;
int workMins = rs.getInt("workMins"); int workMins = rs.getInt("workMins");
int beLateMins = rs.getInt("beLateMins"); int beLateMins = rs.getInt("beLateMins");
int leaveEarlyMins = rs.getInt("leaveEarlyMins"); int leaveEarlyMins = rs.getInt("leaveEarlyMins");
@ -1856,6 +1859,9 @@ public class KQReportBiz extends BaseBean {
flag = Util.null2String(tmpmap.get("text")); flag = Util.null2String(tmpmap.get("text"));
} }
// 判断 指定日期 是否在 哺乳假流程 日期范围内
boolean bool = KqUtil.checkIsBetweenRange(userid,kqdate);
if (workMins<=0) { if (workMins<=0) {
if(text.length()>0) text +=" "; if(text.length()>0) text +=" ";
text += SystemEnv.getHtmlLabelName(26593, user.getLanguage()); text += SystemEnv.getHtmlLabelName(26593, user.getLanguage());
@ -1890,38 +1896,47 @@ public class KQReportBiz extends BaseBean {
} }
} }
} }
if (leaveMins > 0) {//请假 if (leaveMins > 0) {//请假
Map<String, Object> jsonObject = null; Map<String, Object> jsonObject = null;
if(leaveInfo.length()>0){ if(leaveInfo.length()>0){
jsonObject = JSON.parseObject(leaveInfo); jsonObject = JSON.parseObject(leaveInfo);
for (Entry<String, Object> entry : jsonObject.entrySet()) { for (Entry<String, Object> entry : jsonObject.entrySet()) {
String newLeaveType = entry.getKey(); String newLeaveType = entry.getKey();
String tmpLeaveMins = Util.null2String(entry.getValue()); String tmpLeaveMins = Util.null2String(entry.getValue());
if(text.indexOf(kqLeaveRulesComInfo.getLeaveName(newLeaveType))==-1){ if(text.indexOf(kqLeaveRulesComInfo.getLeaveName(newLeaveType))==-1){
if (text.length() > 0) text += " ";
//text += kqLeaveRulesComInfo.getLeaveName(newLeaveType)+tmpLeaveMins+SystemEnv.getHtmlLabelName(15049, user.getLanguage());
text += Util.formatMultiLang( kqLeaveRulesComInfo.getLeaveName(newLeaveType),""+user.getLanguage());
}
}
}else{
if(text.indexOf(SystemEnv.getHtmlLabelName(670, user.getLanguage()))==-1) {
if (text.length() > 0) text += " "; if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(670, user.getLanguage()); //text += kqLeaveRulesComInfo.getLeaveName(newLeaveType)+tmpLeaveMins+SystemEnv.getHtmlLabelName(15049, user.getLanguage());
text += Util.formatMultiLang( kqLeaveRulesComInfo.getLeaveName(newLeaveType),""+user.getLanguage());
} }
} }
} }else{
if (evectionMins > 0) {//出差 if(text.indexOf(SystemEnv.getHtmlLabelName(670, user.getLanguage()))==-1) {
if(text.indexOf(SystemEnv.getHtmlLabelName(20084, user.getLanguage()))==-1) {
if (text.length() > 0) text += " "; if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(20084, user.getLanguage()); text += SystemEnv.getHtmlLabelName(670, user.getLanguage());
} }
} }
if (outMins > 0) {//公出 }
if(text.indexOf(SystemEnv.getHtmlLabelName(24058, user.getLanguage()))==-1) { if (evectionMins > 0) {//出差
if (text.length() > 0) text += " "; if(text.indexOf(SystemEnv.getHtmlLabelName(20084, user.getLanguage()))==-1) {
text += SystemEnv.getHtmlLabelName(24058, user.getLanguage()); if (text.length() > 0) text += " ";
} text += SystemEnv.getHtmlLabelName(20084, user.getLanguage());
}
}
if (outMins > 0) {//公出
if(text.indexOf(SystemEnv.getHtmlLabelName(24058, user.getLanguage()))==-1) {
if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(24058, user.getLanguage());
}
}
// 指定日期 在 哺乳假流程范围内
if(bool){
if (text.length() > 0) text += " ";
//不包含 休息
if(!text.contains(SystemEnv.getHtmlLabelName(26593, user.getLanguage()))) {
text += SystemEnv.getHtmlLabelName(24062, user.getLanguage());
} }
}
if(text.length()==0) { if(text.length()==0) {
text = "√"; text = "√";
@ -2398,16 +2413,25 @@ public class KQReportBiz extends BaseBean {
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
int sixnight_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","sixnight_serialid")); int sixnight_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","sixnight_serialid"));
int twelvehours_night_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","twelvehours_night_serialid")); int twelvehours_night_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","twelvehours_night_serialid"));
int night_rest_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","night_rest_serialid"));
rs.executeQuery("select * from kq_format_total where kqdate = ? and resourceid=?",kqdate,userid); rs.executeQuery("select * from kq_format_total where kqdate = ? and resourceid=?",kqdate,userid);
rs.writeLog("select * from kq_format_total where kqdate = '"+ kqdate +"' and resourceid="+ userid); rs.writeLog("select * from kq_format_total where kqdate = '"+ kqdate +"' and resourceid="+ userid);
while(rs.next()){ while(rs.next()){
int serialid = Util.getIntValue(rs.getString("serialid")); int serialid = Util.getIntValue(rs.getString("serialid"));
double attendanceMins = Util.getDoubleValue(rs.getString("attendanceMins"),0.00); double attendanceMins = Util.getDoubleValue(rs.getString("attendanceMins"),0.00);
attendanceMins = attendanceMins / 60;
double overTimeTotal = getOverTimeTotal(kqdate,userid); double overTimeTotal = getOverTimeTotal(kqdate,userid);
double time = attendanceMins+overTimeTotal; double time = attendanceMins+overTimeTotal;
if(serialid == sixnight_serialid|| serialid == twelvehours_night_serialid){ //1、 12小时工作制夜班、做六休一夜班有夜班补贴并且出勤上班时间+加班时间)>=8小时统计一次
if(serialid == sixnight_serialid || serialid == twelvehours_night_serialid){
if(time >= 8){ if(time >= 8){
result = 1; result ++;
}
}
//2、当一线人员排“夜休”班次并且加班台账当天导入的加班时长>=8小时统计一次。
if(serialid == night_rest_serialid){
if(overTimeTotal >= 8){
result ++;
} }
} }
} }
@ -2426,19 +2450,32 @@ public class KQReportBiz extends BaseBean {
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
int sixnight_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","sixnight_serialid")); int sixnight_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","sixnight_serialid"));
int twelvehours_night_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","twelvehours_night_serialid")); int twelvehours_night_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","twelvehours_night_serialid"));
int night_rest_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","night_rest_serialid"));
rs.executeQuery("select * from kq_format_total where kqdate >= ? and kqdate <= ? and resourceid=?",fromDate,toDate,userid); rs.executeQuery("select * from kq_format_total where kqdate >= ? and kqdate <= ? and resourceid=?",fromDate,toDate,userid);
rs.writeLog("select * from kq_format_total where kqdate >= '"+ fromDate +"' and kqdate <= '"+ toDate +"' and resourceid="+ userid); rs.writeLog("select * from kq_format_total where kqdate >= '"+ fromDate +"' and kqdate <= '"+ toDate +"' and resourceid="+ userid);
while(rs.next()){ while(rs.next()){
int serialid = Util.getIntValue(rs.getString("serialid")); int serialid = Util.getIntValue(rs.getString("serialid"));
String kqdate = Util.null2String(rs.getString("kqdate")); String kqdate = Util.null2String(rs.getString("kqdate"));
double attendanceMins = Util.getDoubleValue(rs.getString("attendanceMins"),0.00); double attendanceMins = Util.getDoubleValue(rs.getString("attendanceMins"),0.00);
attendanceMins = attendanceMins / 60;
rs.writeLog("========= getNightSubsidyTotal attendanceMins ========== "+ attendanceMins);
double overTimeTotal = getOverTimeTotal(kqdate,userid); double overTimeTotal = getOverTimeTotal(kqdate,userid);
rs.writeLog("========= getNightSubsidyTotal overTimeTotal ========== "+ overTimeTotal);
double time = attendanceMins+overTimeTotal; double time = attendanceMins+overTimeTotal;
if(serialid == sixnight_serialid|| serialid == twelvehours_night_serialid){ rs.writeLog("========= getNightSubsidyTotal time ========== "+ time);
if(serialid == sixnight_serialid || serialid == twelvehours_night_serialid){
if(time >= 8){ if(time >= 8){
result++; result++;
} }
} }
rs.writeLog("========= getNightSubsidyTotal result 111 ========== "+ result);
//2、当一线人员排“夜休”班次并且加班台账当天导入的加班时长>=8小时统计一次。
if(serialid == night_rest_serialid){
if(overTimeTotal >= 8){
result ++;
}
}
rs.writeLog("========= getNightSubsidyTotal result 222 ========== "+ result);
} }
return result; return result;
} }
@ -2471,13 +2508,12 @@ public class KQReportBiz extends BaseBean {
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
String tablename = rs.getPropValue("nbjh_ygdjblc","fillcard_table"); String tablename = rs.getPropValue("nbjh_ygdjblc","fillcard_table");
String tablename_dt = tablename+"_dt1"; String tablename_dt = tablename+"_dt1";
rs.executeQuery("select b.* from "+ tablename +" a,"+ tablename_dt +" b,workflow_requestbase c" + rs.executeQuery("select b.* from "+ tablename +" a,"+ tablename_dt +" b,workflow_requestbase c " +
"where a.requestid = c.requestid and a.id=b.mainid and c.currentnodetype=3" + "where a.requestid = c.requestid and a.id=b.mainid and c.currentnodetype=3 " +
"and a.ksrq >=? and a.jsrq <=? and a.resourceId=?",fromDate,toDate,userid); "and b.detail_signdate >=? and b.detail_signdate <=? and a.resourceId=?",fromDate,toDate,userid);
if(rs.next()){ while(rs.next()){
result++;
} }
result = rs.getCounts();
return result; return result;
} }
@ -2495,8 +2531,8 @@ public class KQReportBiz extends BaseBean {
rs.executeQuery("select b.* from "+ tablename +" a,"+ tablename_dt +" b,workflow_requestbase c" + rs.executeQuery("select b.* from "+ tablename +" a,"+ tablename_dt +" b,workflow_requestbase c" +
"where a.requestid = c.requestid and a.id=b.mainid and c.currentnodetype=3" + "where a.requestid = c.requestid and a.id=b.mainid and c.currentnodetype=3" +
"and b.detail_signdate =? and a.resourceId=?",kqdate,userid); "and b.detail_signdate =? and a.resourceId=?",kqdate,userid);
if(rs.next()){ while(rs.next()){
result = 1; result ++;
} }
return result; return result;
} }

@ -7,12 +7,12 @@ import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext; import com.engine.core.interceptor.CommandContext;
import com.engine.kq.biz.*; import com.engine.kq.biz.*;
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit; import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
import com.engine.kq.nbjh.KqUtil;
import com.engine.kq.util.ExcelUtil; import com.engine.kq.util.ExcelUtil;
import com.engine.kq.util.KQDurationCalculatorUtil; import com.engine.kq.util.KQDurationCalculatorUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import weaver.common.DateUtil; import weaver.common.DateUtil;
import weaver.common.StringUtil;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
import weaver.general.BaseBean; import weaver.general.BaseBean;
import weaver.general.TimeUtil; import weaver.general.TimeUtil;
@ -27,11 +27,7 @@ import weaver.systeminfo.SystemEnv;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Object>> { public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
@ -196,7 +192,7 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
" (select zma.attendancedays from kq_format_total zma where zma.resourceid = a.id and zma.kqdate = b.kqdate and (DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND zma.groupid = groupId)) as saturdayattendancedays," + " (select zma.attendancedays from kq_format_total zma where zma.resourceid = a.id and zma.kqdate = b.kqdate and (DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND zma.groupid = groupId)) as saturdayattendancedays," +
" (select zma.workdays from kq_format_total zma where zma.resourceid = a.id and zma.kqdate = b.kqdate and ((DATEPART(dw, zma.kqdate) != 7 and DATEPART(dw, zma.kqdate) != 1) or ((DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate IN (select holidayDate from KQ_HolidaySet where changeType = 3 and zma.groupid = groupId)))) as weekdayworkdays," + " (select zma.workdays from kq_format_total zma where zma.resourceid = a.id and zma.kqdate = b.kqdate and ((DATEPART(dw, zma.kqdate) != 7 and DATEPART(dw, zma.kqdate) != 1) or ((DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate IN (select holidayDate from KQ_HolidaySet where changeType = 3 and zma.groupid = groupId)))) as weekdayworkdays," +
" (select zma.attendancedays from kq_format_total zma where zma.resourceid = a.id and zma.kqdate = b.kqdate and ((DATEPART(dw, zma.kqdate) != 7 and DATEPART(dw, zma.kqdate) != 1) or ((DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate IN (select holidayDate from KQ_HolidaySet where changeType = 3 and zma.groupid = groupId)))) as weekdayattendancedays," + " (select zma.attendancedays from kq_format_total zma where zma.resourceid = a.id and zma.kqdate = b.kqdate and ((DATEPART(dw, zma.kqdate) != 7 and DATEPART(dw, zma.kqdate) != 1) or ((DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate IN (select holidayDate from KQ_HolidaySet where changeType = 3 and zma.groupid = groupId)))) as weekdayattendancedays," +
" a.id,a.lastname,a.subcompanyid1 as subcompanyid,a.departmentid, a.workcode,b.jobtitle,a.dsporder," + " a.id,a.lastname,a.subcompanyid1 as subcompanyid,a.departmentid, a.workcode,b.jobtitle,a.dsporder,a.companystartdate," +
" b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,b.attendanceMins,b.beLate," + " b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,b.attendanceMins,b.beLate," +
" b.beLateMins,b.graveBeLate,b.graveBeLateMins,b.leaveEearly,b.leaveEarlyMins,b.graveLeaveEarly," + " b.beLateMins,b.graveBeLate,b.graveBeLateMins,b.leaveEearly,b.leaveEarlyMins,b.graveLeaveEarly," +
" b.graveLeaveEarlyMins,b.absenteeism,b.signdays,b.signmins, " + " b.graveLeaveEarlyMins,b.absenteeism,b.signdays,b.signmins, " +
@ -444,6 +440,10 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
//补卡次数 //补卡次数
int fillCard = kqReportBiz.getFillCardCountDaily(kqdate, id); int fillCard = kqReportBiz.getFillCardCountDaily(kqdate, id);
data.add(fillCard); data.add(fillCard);
}else if (fieldName.equals("breastfeedLeave")) {
//哺乳假
double breastfeedLeave = KqUtil.getBreastfeedLeave(kqdate, kqdate, id);
data.add(breastfeedLeave);
} else if (fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")) { } else if (fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")) {
String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id + "|" + kqdate + "|" + fieldName)), "0.0"); String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id + "|" + kqdate + "|" + fieldName)), "0.0");
String backType = fieldName + "_back"; String backType = fieldName + "_back";

@ -6,6 +6,7 @@ import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext; import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext; import com.engine.core.interceptor.CommandContext;
import com.engine.kq.biz.*; import com.engine.kq.biz.*;
import com.engine.kq.nbjh.KqUtil;
import com.engine.kq.util.ExcelUtil; import com.engine.kq.util.ExcelUtil;
import com.engine.kq.util.KQDurationCalculatorUtil; import com.engine.kq.util.KQDurationCalculatorUtil;
import com.engine.kq.util.UtilKQ; import com.engine.kq.util.UtilKQ;
@ -209,11 +210,11 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
//支援班次统计 //支援班次统计
String supportSerId = new BaseBean().getPropValue("nbkq_main", "supportSerId"); String supportSerId = new BaseBean().getPropValue("nbkq_main", "supportSerId");
String backFields = " (select sum(zma.workdays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and (DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) AND zma.kqdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND zma.groupid = groupId)) as saturdayworkdays," + String backFields = " (select sum(zma.workdays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and (DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) AND zma.kqdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND zma.groupid = groupId)) as saturdayworkdays," +
" (select count(0) from kq_shiftschedule where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and serialid=" + supportSerId + " )as supportTotal," + " (select count(0) from kq_shiftschedule where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and serialid in (" + supportSerId + ") )as supportTotal," +
" (select sum(zma.attendancedays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and (DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) AND zma.kqdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND zma.groupid = groupId)) as saturdayattendancedays," + " (select sum(zma.attendancedays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and (DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) AND zma.kqdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND zma.groupid = groupId)) as saturdayattendancedays," +
" (select sum(zma.workdays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and ((DATEPART(dw, zma.kqdate) != 7 and DATEPART(dw, zma.kqdate) != 1) or ((DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate IN (select holidayDate from KQ_HolidaySet where changeType = 3 and zma.groupid = groupId)))) as weekdayworkdays," + " (select sum(zma.workdays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and ((DATEPART(dw, zma.kqdate) != 7 and DATEPART(dw, zma.kqdate) != 1) or ((DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate IN (select holidayDate from KQ_HolidaySet where changeType = 3 and zma.groupid = groupId)))) as weekdayworkdays," +
" (select sum(zma.attendancedays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and ((DATEPART(dw, zma.kqdate) != 7 and DATEPART(dw, zma.kqdate) != 1) or ((DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate IN (select holidayDate from KQ_HolidaySet where changeType = 3 and zma.groupid = groupId)))) as weekdayattendancedays," + " (select sum(zma.attendancedays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and ((DATEPART(dw, zma.kqdate) != 7 and DATEPART(dw, zma.kqdate) != 1) or ((DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate IN (select holidayDate from KQ_HolidaySet where changeType = 3 and zma.groupid = groupId)))) as weekdayattendancedays," +
" a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle," + " a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle,a.companystartdate," +
" sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," + " sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," +
" sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " + " sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " +
" sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," + " sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," +
@ -228,7 +229,7 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
"where a.id= b.resourceid and c.id=b.serialid and (c.rest_shift is null or c.rest_shift=0) " + "where a.id= b.resourceid and c.id=b.serialid and (c.rest_shift is null or c.rest_shift=0) " +
"and b.kqdate >='" + fromDate + "' and b.kqdate <='" + toDate + "'"; "and b.kqdate >='" + fromDate + "' and b.kqdate <='" + toDate + "'";
String sqlWhere = rightSql; String sqlWhere = rightSql;
String groupBy = " group by a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1,a.departmentid,a.jobtitle "; String groupBy = " group by a.id,a.lastname,a.workcode,a.dsporder,a.companystartdate,b.resourceid,a.subcompanyid1,a.departmentid,a.jobtitle ";
if (subCompanyId.length() > 0) { if (subCompanyId.length() > 0) {
sqlWhere += " and a.subcompanyid1 in(" + subCompanyId + ") "; sqlWhere += " and a.subcompanyid1 in(" + subCompanyId + ") ";
} }
@ -291,6 +292,14 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
//补卡次数int //补卡次数int
if (fieldName.equals("fillCard")) { if (fieldName.equals("fillCard")) {
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(kqReportBiz.getFillCardCount(fromDate, toDate, id))); fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(kqReportBiz.getFillCardCount(fromDate, toDate, id)));
} else if (fieldName.equals("attendancedays")) {
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(KqUtil.getAttendancedays(id, fromDate, toDate, user)));
data.add(fieldValue);
continue;
}
//哺乳假
else if (fieldName.equals("breastfeedLeave")) {
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(KqUtil.getBreastfeedLeave(fromDate, toDate, id)));
} else if (fieldName.equals("subcompany")) { } else if (fieldName.equals("subcompany")) {
String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid")); String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
if (tmpSubcompanyId.length() == 0) { if (tmpSubcompanyId.length() == 0) {
@ -464,10 +473,13 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
if (Util.null2String(rs.getString(lsCascadekey.get(i))).length() > 0) { if (Util.null2String(rs.getString(lsCascadekey.get(i))).length() > 0) {
fieldid = KQReportFieldComInfo.field2Id.get(lsCascadekey.get(i)); fieldid = KQReportFieldComInfo.field2Id.get(lsCascadekey.get(i));
//迟到早退使用分钟 //迟到早退使用分钟
if (lsCascadekey.get(i).contains("LateMins") || lsCascadekey.get(i).contains("EarlyMins")) { String lsCascadeValue = lsCascadekey.get(i);
String unittype = kqReportFieldComInfo.getUnittype(fieldid);
if (unittype.equals("2")&&
(lsCascadeValue.contains("LateMins") || lsCascadeValue.contains("EarlyMins") || lsCascadeValue.contains("cd") || lsCascadeValue.contains("zt"))) {
fieldValue = rs.getString(lsCascadekey.get(i)); fieldValue = rs.getString(lsCascadekey.get(i));
} else { } else {
fieldValue = getFieldValueByUnitType(rs.getString(lsCascadekey.get(i)), kqReportFieldComInfo.getUnittype(fieldid)); fieldValue = getFieldValueByUnitType(rs.getString(lsCascadekey.get(i)), kqReportFieldComInfo.getUnittype(fieldid));
} }
} else { } else {
fieldValue = "0"; fieldValue = "0";
@ -731,11 +743,14 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
if (!kqReportFieldComInfo.getReportType().equals("month")) continue; if (!kqReportFieldComInfo.getReportType().equals("month")) continue;
if (kqReportFieldComInfo.getFieldname().equals(lsCascadeKey.get(i))) { if (kqReportFieldComInfo.getFieldname().equals(lsCascadeKey.get(i))) {
title = new HashMap<>(); title = new HashMap<>();
//二开 迟到使用分钟 //二开 迟到早退使用分钟
if (kqReportFieldComInfo.getFieldname().contains("LateMins") || kqReportFieldComInfo.getFieldname().contains("EarlyMins")) { String fieldname = kqReportFieldComInfo.getFieldname();
String unittype = kqReportFieldComInfo.getUnittype();
if (unittype.equals("2") && (fieldname.contains("LateMins") || fieldname.contains("EarlyMins")
|| fieldname.contains("cd") || fieldname.contains("zt"))) {
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(分钟)"); title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(分钟)");
} else { } else {
title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(" + KQReportBiz.getUnitType(kqReportFieldComInfo, user) + ")"); title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(" + KQReportBiz.getUnitType(kqReportFieldComInfo, user) + ")");
} }
title.put("width", 30 * 256); title.put("width", 30 * 256);
titleList.add(title); titleList.add(title);

@ -9,11 +9,11 @@ import com.engine.kq.biz.*;
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit; import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
import com.engine.kq.entity.WorkTimeEntity; import com.engine.kq.entity.WorkTimeEntity;
import com.engine.kq.log.KQLog; import com.engine.kq.log.KQLog;
import com.engine.kq.nbjh.KqUtil;
import com.engine.kq.util.KQDurationCalculatorUtil; import com.engine.kq.util.KQDurationCalculatorUtil;
import com.engine.kq.util.PageUidFactory; import com.engine.kq.util.PageUidFactory;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import weaver.common.StringUtil;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
import weaver.general.BaseBean; import weaver.general.BaseBean;
import weaver.general.TimeUtil; import weaver.general.TimeUtil;
@ -156,7 +156,7 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
" (select zma.attendancedays from kq_format_total zma where zma.resourceid = a.id and zma.kqdate = b.kqdate and (DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND zma.groupid = groupId)) as saturdayattendancedays," + " (select zma.attendancedays from kq_format_total zma where zma.resourceid = a.id and zma.kqdate = b.kqdate and (DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND zma.groupid = groupId)) as saturdayattendancedays," +
" (select zma.workdays from kq_format_total zma where zma.resourceid = a.id and zma.kqdate = b.kqdate and ((DATEPART(dw, zma.kqdate) != 7 and DATEPART(dw, zma.kqdate) != 1) or ((DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate IN (select holidayDate from KQ_HolidaySet where changeType = 3 and zma.groupid = groupId)))) as weekdayworkdays," + " (select zma.workdays from kq_format_total zma where zma.resourceid = a.id and zma.kqdate = b.kqdate and ((DATEPART(dw, zma.kqdate) != 7 and DATEPART(dw, zma.kqdate) != 1) or ((DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate IN (select holidayDate from KQ_HolidaySet where changeType = 3 and zma.groupid = groupId)))) as weekdayworkdays," +
" (select zma.attendancedays from kq_format_total zma where zma.resourceid = a.id and zma.kqdate = b.kqdate and ((DATEPART(dw, zma.kqdate) != 7 and DATEPART(dw, zma.kqdate) != 1) or ((DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate IN (select holidayDate from KQ_HolidaySet where changeType = 3 and zma.groupid = groupId)))) as weekdayattendancedays," + " (select zma.attendancedays from kq_format_total zma where zma.resourceid = a.id and zma.kqdate = b.kqdate and ((DATEPART(dw, zma.kqdate) != 7 and DATEPART(dw, zma.kqdate) != 1) or ((DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate IN (select holidayDate from KQ_HolidaySet where changeType = 3 and zma.groupid = groupId)))) as weekdayattendancedays," +
" a.id,a.lastname,a.subcompanyid1 as subcompanyid,a.departmentid, a.workcode,b.jobtitle,a.dsporder," + " a.id,a.lastname,a.subcompanyid1 as subcompanyid,a.departmentid, a.workcode,b.jobtitle,a.dsporder,a.companystartdate," +
" b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,b.attendanceMins," + " b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,b.attendanceMins," +
" b.beLate,b.beLateMins,b.graveBeLate,b.graveBeLateMins,b.leaveEearly,b.leaveEarlyMins," + " b.beLate,b.beLateMins,b.graveBeLate,b.graveBeLateMins,b.leaveEearly,b.leaveEarlyMins," +
" b.signdays,b.signmins, " + " b.signdays,b.signmins, " +
@ -496,6 +496,10 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
workingDayOvertime_nonleave + restDayOvertime_nonleave + holidayOvertime_nonleave)); workingDayOvertime_nonleave + restDayOvertime_nonleave + holidayOvertime_nonleave));
data.put("overtimeTotal", overtimeTotal); data.put("overtimeTotal", overtimeTotal);
//哺乳假
String breastfeedLeave = KQDurationCalculatorUtil.getDurationRound(String.valueOf(KqUtil.getBreastfeedLeave(kqdate, kqdate, id)));
data.put("breastfeedLeave", breastfeedLeave);
//夜班补贴次数 //夜班补贴次数
String nightSubsidy = KQDurationCalculatorUtil.getDurationRound(String.valueOf(kqReportBiz.getNightSubsidyDaily(kqdate, id))); String nightSubsidy = KQDurationCalculatorUtil.getDurationRound(String.valueOf(kqReportBiz.getNightSubsidyDaily(kqdate, id)));
data.put("nightSubsidy", nightSubsidy); data.put("nightSubsidy", nightSubsidy);
@ -647,7 +651,7 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
sql = " select kqdate,resourceid,serialid,serialnumber,workbegindate,workbegintime, " + sql = " select kqdate,resourceid,serialid,serialnumber,workbegindate,workbegintime, " +
" workenddate,workendtime,workmins,signindate,signintime,signoutdate,signouttime, \n" + " workenddate,workendtime,workmins,signindate,signintime,signoutdate,signouttime, \n" +
" attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins,forgotBeginWorkCheckMins," + " attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins,forgotBeginWorkCheckMins," +
" leaveMins,leaveInfo,evectionMins,outMins,signinid,signoutid,flowinfo \n" + " leaveMins,leaveInfo,evectionMins,outMins,signinid,signoutid \n" +
" from kq_format_detail b \n" + " from kq_format_detail b \n" +
" where resourceid = " + resourceId + " and kqdate ='" + kqDate + "' \n" + " where resourceid = " + resourceId + " and kqdate ='" + kqDate + "' \n" +
" order by serialnumber \n"; " order by serialnumber \n";
@ -676,7 +680,7 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
String signoutid = Util.null2String(rs.getString("signoutid")).trim(); String signoutid = Util.null2String(rs.getString("signoutid")).trim();
int leaveMins = rs.getInt("leaveMins"); int leaveMins = rs.getInt("leaveMins");
String leaveInfo = Util.null2String(rs.getString("leaveInfo")); String leaveInfo = Util.null2String(rs.getString("leaveInfo"));
String flowinfo = Util.null2String(rs.getString("flowinfo")); // String flowinfo = Util.null2String(rs.getString("flowinfo"));
int evectionMins = rs.getInt("evectionMins"); int evectionMins = rs.getInt("evectionMins");
int outMins = rs.getInt("outMins"); int outMins = rs.getInt("outMins");
@ -684,11 +688,11 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
if (serialid.length() > 0) { if (serialid.length() > 0) {
if (workbegintime.length() > 0) { if (workbegintime.length() > 0) {
signStatusInfo = new HashMap(); signStatusInfo = new HashMap();
signStatusInfo.put("resourceId",resourceid); // signStatusInfo.put("resourceId",resourceid);
signStatusInfo.put("kqdate",kqdate); // signStatusInfo.put("kqdate",kqdate);
signStatusInfo.put("flowinfo",flowinfo); // signStatusInfo.put("flowinfo",flowinfo);
signStatusInfo.put("workbegintime",workbegintime); // signStatusInfo.put("workbegintime",workbegintime);
signStatusInfo.put("workendtime",workendtime); // signStatusInfo.put("workendtime",workendtime);
signStatusInfo.put("workdate", workbegindate); signStatusInfo.put("workdate", workbegindate);
signStatusInfo.put("worktime", workbegintime); signStatusInfo.put("worktime", workbegintime);
signStatusInfo.put("beLateMins", beLateMins); signStatusInfo.put("beLateMins", beLateMins);
@ -711,11 +715,11 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
if (workendtime.length() > 0) { if (workendtime.length() > 0) {
signStatusInfo = new HashMap(); signStatusInfo = new HashMap();
signStatusInfo.put("resourceId",resourceid); // signStatusInfo.put("resourceId",resourceid);
signStatusInfo.put("kqdate",kqdate); // signStatusInfo.put("kqdate",kqdate);
signStatusInfo.put("flowinfo",flowinfo); // signStatusInfo.put("flowinfo",flowinfo);
signStatusInfo.put("workbegintime",workbegintime); // signStatusInfo.put("workbegintime",workbegintime);
signStatusInfo.put("workendtime",workendtime); // signStatusInfo.put("workendtime",workendtime);
signStatusInfo.put("workdate", workenddate); signStatusInfo.put("workdate", workenddate);
signStatusInfo.put("worktime", kqTimesArrayComInfo.turn48to24Time(workendtime)); signStatusInfo.put("worktime", kqTimesArrayComInfo.turn48to24Time(workendtime));
signStatusInfo.put("leaveEarlyMins", leaveEarlyMins); signStatusInfo.put("leaveEarlyMins", leaveEarlyMins);
@ -739,15 +743,11 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
//弹性工时打卡时间取自签到签退数据 //弹性工时打卡时间取自签到签退数据
} }
signStatusInfo = new HashMap(); signStatusInfo = new HashMap();
signStatusInfo.put("resourceId",resourceid); signStatusInfo.put("leaveMins", leaveMins);
signStatusInfo.put("kqdate",kqdate); signStatusInfo.put("leaveInfo", leaveInfo);
signStatusInfo.put("leaveMins",leaveMins); signStatusInfo.put("evectionMins", evectionMins);
signStatusInfo.put("leaveInfo",leaveInfo); signStatusInfo.put("outMins", outMins);
signStatusInfo.put("evectionMins",evectionMins);
signStatusInfo.put("outMins",outMins);
signStatusInfo.put("flowinfo",flowinfo);
signStatusInfo.put("workbegintime",workbegintime);
signStatusInfo.put("workendtime",workendtime);
if (signinid.length() > 0) { if (signinid.length() > 0) {
data.put("signintime" + serialnumber, signintime.length() == 0 ? SystemEnv.getHtmlLabelName(25994, user.getLanguage()) : signintime); data.put("signintime" + serialnumber, signintime.length() == 0 ? SystemEnv.getHtmlLabelName(25994, user.getLanguage()) : signintime);
data.put("signinstatus" + serialnumber, KQReportBiz.getSignStatus(signStatusInfo, user, "on")); data.put("signinstatus" + serialnumber, KQReportBiz.getSignStatus(signStatusInfo, user, "on"));

@ -6,6 +6,7 @@ import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext; import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext; import com.engine.core.interceptor.CommandContext;
import com.engine.kq.biz.*; import com.engine.kq.biz.*;
import com.engine.kq.nbjh.KqUtil;
import com.engine.kq.util.KQDurationCalculatorUtil; import com.engine.kq.util.KQDurationCalculatorUtil;
import com.engine.kq.util.PageUidFactory; import com.engine.kq.util.PageUidFactory;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -128,7 +129,9 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
columnsInfo.stream().forEach(item -> { columnsInfo.stream().forEach(item -> {
Map<String, Object> map = (Map<String, Object>) item; Map<String, Object> map = (Map<String, Object>) item;
String title = (String) map.get("title"); String title = (String) map.get("title");
if (title.contains("迟到时长") || title.contains("早退时长")) { String dataIndex = (String) map.get("dataIndex");
String unit = (String) map.get("unit");
if ((title.contains("迟到时长") || title.contains("早退时长") || dataIndex.contains("zt") || dataIndex.contains("cd")) && unit.contains("小时")) {
map.put("title", title + "(分钟)"); map.put("title", title + "(分钟)");
map.put("unit", ""); map.put("unit", "");
} }
@ -186,12 +189,12 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum")); String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum"));
//支援班次统计 //支援班次统计
String supportSerId = new BaseBean().getPropValue("nbkq_main", "supportSerId"); String supportSerId = new BaseBean().getPropValue("nbkq_main", "supportSerId");
String backFields = " (select sum(zma.workdays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and (DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) AND zma.kqdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND zma.groupid = groupId)) as saturdayworkdays," + String backFields = " (select sum(zma.workdays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and (DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) AND zma.kqdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND zma.groupid = groupId)) as saturdayworkdays," +
" (select count(0) from kq_shiftschedule where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and serialid=" + supportSerId + " )as supportTotal," + " (select count(0) from kq_shiftschedule where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and serialid in (" + supportSerId + ") )as supportTotal," +
" (select sum(zma.attendancedays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and (DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) AND zma.kqdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND zma.groupid = groupId)) as saturdayattendancedays," + " (select sum(zma.attendancedays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and (DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) AND zma.kqdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND zma.groupid = groupId)) as saturdayattendancedays," +
" (select sum(zma.workdays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and ((DATEPART(dw, zma.kqdate) != 7 and DATEPART(dw, zma.kqdate) != 1) or ((DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate IN (select holidayDate from KQ_HolidaySet where changeType = 3 and zma.groupid = groupId)))) as weekdayworkdays," + " (select sum(zma.workdays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and ((DATEPART(dw, zma.kqdate) != 7 and DATEPART(dw, zma.kqdate) != 1) or ((DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate IN (select holidayDate from KQ_HolidaySet where changeType = 3 and zma.groupid = groupId)))) as weekdayworkdays," +
" (select sum(zma.attendancedays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and ((DATEPART(dw, zma.kqdate) != 7 and DATEPART(dw, zma.kqdate) != 1) or ((DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate IN (select holidayDate from KQ_HolidaySet where changeType = 3 and zma.groupid = groupId)))) as weekdayattendancedays," + " (select sum(zma.attendancedays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and ((DATEPART(dw, zma.kqdate) != 7 and DATEPART(dw, zma.kqdate) != 1) or ((DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate IN (select holidayDate from KQ_HolidaySet where changeType = 3 and zma.groupid = groupId)))) as weekdayattendancedays," +
"a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle," + "a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle,a.companystartdate," +
" sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," + " sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," +
" sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " + " sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " +
" sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," + " sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," +
@ -207,7 +210,7 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
"where a.id= b.resourceid and c.id=b.serialid and (c.rest_shift is null or c.rest_shift=0) " + "where a.id= b.resourceid and c.id=b.serialid and (c.rest_shift is null or c.rest_shift=0) " +
"and b.kqdate >='" + fromDate + "' and b.kqdate <='" + toDate + "'"; "and b.kqdate >='" + fromDate + "' and b.kqdate <='" + toDate + "'";
String sqlWhere = rightSql; String sqlWhere = rightSql;
String groupBy = " group by a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1,a.departmentid,a.jobtitle "; String groupBy = " group by a.id,a.lastname,a.workcode,a.dsporder,a.companystartdate,b.resourceid,a.subcompanyid1,a.departmentid,a.jobtitle ";
if (subCompanyId.length() > 0) { if (subCompanyId.length() > 0) {
sqlWhere += " and a.subcompanyid1 in(" + subCompanyId + ") "; sqlWhere += " and a.subcompanyid1 in(" + subCompanyId + ") ";
} }
@ -438,10 +441,10 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
if (fieldValue.length() == 0) { if (fieldValue.length() == 0) {
fieldValue = "0"; fieldValue = "0";
} else { } else {
//2024-01-31 二开 迟到使用分钟 //2024-01-31 二开 迟到使用分钟 20240424迟到早退自定义列
writeLog("testreport-" + fieldName + fieldValue); writeLog("testreport-" + fieldName + fieldValue);
if (kqReportFieldComInfo.getUnittype().equals("2") if (kqReportFieldComInfo.getUnittype().equals("2")
&& !fieldName.contains("LateMins") && !fieldName.contains("EarlyMins")) { && !fieldName.contains("LateMins") && !fieldName.contains("EarlyMins") && !fieldName.contains("cd") && !fieldName.contains("zt")) {
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0))); fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
} }
} }
@ -593,6 +596,14 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
workingDayOvertime_nonleave + restDayOvertime_nonleave + holidayOvertime_nonleave)); workingDayOvertime_nonleave + restDayOvertime_nonleave + holidayOvertime_nonleave));
data.put("overtimeTotal", overtimeTotal); data.put("overtimeTotal", overtimeTotal);
//哺乳假
String breastfeedLeave = KQDurationCalculatorUtil.getDurationRound(String.valueOf(KqUtil.getBreastfeedLeave(fromDate, toDate, id)));
data.put("breastfeedLeave", breastfeedLeave);
//实际出勤天数
String attendancedays = KQDurationCalculatorUtil.getDurationRound(String.valueOf(KqUtil.getAttendancedays(id, fromDate, toDate, user)));
data.put("attendancedays", attendancedays);
//夜班补贴次数 //夜班补贴次数
String nightSubsidy = KQDurationCalculatorUtil.getDurationRound(String.valueOf(kqReportBiz.getNightSubsidyTotal(fromDate, toDate, id))); String nightSubsidy = KQDurationCalculatorUtil.getDurationRound(String.valueOf(kqReportBiz.getNightSubsidyTotal(fromDate, toDate, id)));
data.put("nightSubsidy", nightSubsidy); data.put("nightSubsidy", nightSubsidy);

@ -0,0 +1,325 @@
package com.engine.kq.nbjh;
import com.alibaba.fastjson.JSON;
import com.engine.kq.biz.KQLeaveRulesComInfo;
import com.engine.kq.biz.KQWorkTime;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.systeminfo.SystemEnv;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Map;
/**
* @Title
* @Author wangchaofa
* @CreateDate 2024/4/2
* @Version 1.0
* @Description
*/
public class KqUtil {
/**
*
* @param resourceId
* @param fromdate
* @param todate
* @return
*/
public static double getAttendancedays(String resourceId,String fromdate,String todate,User user){
double result = 0.00;
KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo();
RecordSet rs = new RecordSet();
String sql = " select resourceid, kqdate, workMins, belatemins, graveBeLateMins, leaveearlymins, graveLeaveEarlyMins, absenteeismmins, forgotcheckMins, forgotBeginWorkCheckMins, "+
" leaveMins,leaveInfo,evectionMins,outMins " +
" from kq_format_detail " +
" where resourceid = ? and kqdate>=? and kqdate<=? "+
" order by resourceid, kqdate, serialnumber ";
rs.executeQuery(sql,resourceId,fromdate,todate);
while (rs.next()) {
String userid = rs.getString("resourceid");
String kqdate = rs.getString("kqdate");
int workMins = rs.getInt("workMins");
int beLateMins = rs.getInt("beLateMins");
int leaveEarlyMins = rs.getInt("leaveEarlyMins");
int graveBeLateMins = rs.getInt("graveBeLateMins");
int absenteeismMins = rs.getInt("absenteeismMins");
int graveLeaveEarlyMins = rs.getInt("graveLeaveEarlyMins");
int forgotCheckMins = rs.getInt("forgotCheckMins");
int forgotBeginWorkCheckMins = rs.getInt("forgotBeginWorkCheckMins");
int leaveMins = rs.getInt("leaveMins");
String leaveInfo = rs.getString("leaveInfo");
int evectionMins = rs.getInt("evectionMins");
int outMins = rs.getInt("outMins");
// 判断 指定日期 是否在 哺乳假流程 日期范围内
boolean bool = checkIsBetweenRange(userid,kqdate);
String text = "";
if (workMins<=0) {
if(text.length()>0) text +=" ";
text += SystemEnv.getHtmlLabelName(26593, user.getLanguage());
} else {
if (absenteeismMins > 0) {//旷工
if(text.length()>0) text+=" ";
text += SystemEnv.getHtmlLabelName(20085, user.getLanguage());
}else {
if (beLateMins > 0) {//迟到
if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(20081, user.getLanguage());
}
if (graveBeLateMins > 0) {//严重迟到
if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(500546, user.getLanguage());
}
if (leaveEarlyMins > 0) {//早退
if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(20082, user.getLanguage());
}
if (graveLeaveEarlyMins > 0) {//严重早退
if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(500547, user.getLanguage());
}
if (forgotCheckMins > 0) {//漏签
if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(20086, user.getLanguage());
}
if (forgotBeginWorkCheckMins > 0) {//漏签
if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(20086, user.getLanguage());
}
}
}
if (leaveMins > 0) {//请假
Map<String, Object> jsonObject = null;
if(leaveInfo.length()>0){
jsonObject = JSON.parseObject(leaveInfo);
for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
String newLeaveType = entry.getKey();
String tmpLeaveMins = Util.null2String(entry.getValue());
if(text.indexOf(kqLeaveRulesComInfo.getLeaveName(newLeaveType))==-1){
if (text.length() > 0) text += " ";
text += Util.formatMultiLang( kqLeaveRulesComInfo.getLeaveName(newLeaveType),""+user.getLanguage());
}
}
}else{
if(text.indexOf(SystemEnv.getHtmlLabelName(670, user.getLanguage()))==-1) {
if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(670, user.getLanguage());
}
}
}
if (evectionMins > 0) {//出差
if(text.indexOf(SystemEnv.getHtmlLabelName(20084, user.getLanguage()))==-1) {
if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(20084, user.getLanguage());
}
}
if (outMins > 0) {//公出
if(text.indexOf(SystemEnv.getHtmlLabelName(24058, user.getLanguage()))==-1) {
if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(24058, user.getLanguage());
}
}
if(text.length()==0) {
result += 1;
}else{
//包含 漏签、早退、严重早退、迟到、严重迟到
if(checkHasSignInfo(userid,kqdate)) {
//当天有 哺乳假 或者 当天 在哺乳假的日期范围内
if(bool) {
result += 1;
}
}
}
}
rs.writeLog("================== KqUtil getAttendancedays ==================== "+ result);
return result;
}
public static boolean checkHasSignInfo(String userid,String date){
boolean bool = false;
RecordSet rs = new RecordSet();
rs.executeQuery("select * from HrmScheduleSign where userId=? and signDate=?",userid,date);
if(rs.next()){
bool = true;
}
return bool;
}
/**
*
* @param userid
* @param date
* @return
*/
public static boolean checkIsBetweenRange(String userid,String date){
boolean bool = false;
RecordSet rs = new RecordSet();
String breastfeedLeave_table = rs.getPropValue("nbjh_ygdjblc","breastfeedLeave_table");
rs.executeQuery(" select a.mtgjxs as result,a.ksrq,a.jsrq from "+ breastfeedLeave_table +" a,workflow_requestbase b " +
" where a.requestid=b.requestid and b.currentnodetype=3 " +
" and a.ksrq <= ? and a.jsrq >= ? and a.xm = ?",date,date,userid);
if(rs.next()){
bool = true;
}
return bool;
}
/**
*
* @param fromDate
* @param toDate
* @param userid
* @return
* 2024-03-01 2024-03-31
* 2024-03-12 2024-11-21
* 2024-02-10 2024-04-10
* 2024-02-10 2024-02-20
*/
public static double getBreastfeedLeave(String fromDate,String toDate,String userid){
double result = 0.00;
int ycqdays = 0;
double day = 0.00;
RecordSet rs = new RecordSet();
String lc_fromDate = "";
String lc_toDate = "";
rs.writeLog("============== fromDate =================== "+ fromDate);
rs.writeLog("============== toDate =================== "+ toDate);
String currentdate = TimeUtil.getCurrentDateString();
String breastfeedLeave_table = rs.getPropValue("nbjh_ygdjblc","breastfeedLeave_table");
rs.executeQuery(" select a.mtgjxs as result,a.ksrq,a.jsrq from "+ breastfeedLeave_table +" a,workflow_requestbase b " +
" where a.requestid=b.requestid and b.currentnodetype=3 " +
" and a.xm = ?",userid);
if(rs.next()){
lc_fromDate = Util.null2String(rs.getString("ksrq"));
lc_toDate = Util.null2String(rs.getString("jsrq"));
day = Util.getDoubleValue(rs.getString("result"),0.00);
// 流程里的开始日期 2024-03-12 >= 查询的开始日期 2024-03-01
if(compareDate(lc_fromDate,fromDate)){
//流程里的开始日期 2024-03-12 <= 查询的结束日期 2024-03-031
if(compareDate(toDate,lc_fromDate)){
//流程里的结束日期 2024-03-20 <= 查询的结束日期 2024-03-31 。 此时 应该 计算 流程里的开始日期 到 流程里的结束日期,这个范围内的 应出勤天数
if(compareDate(toDate,lc_toDate)){
ycqdays = getWorkdays(lc_fromDate,lc_toDate,userid);
}
//流程里的结束日期 2024-04-10 > 查询的结束日期 2024-03-31 。此时 应该 计算 流程里的开始日期 到 查询的结束日期,这个范围内的 应出勤天数
else{
ycqdays = getWorkdays(lc_fromDate,toDate,userid);
}
}
//流程里的开始日期 2024-04-10 > 查询的结束日期 2024-03-31
else{
ycqdays = 0;
}
}
//流程里的开始日期 2024-02-10 < 查询的开始日期 2024-03-01
else{
//流程里的结束日期 2024-03-10 >= 查询的开始日期 2024-03-01
if(compareDate(lc_toDate,fromDate)){
//流程里的结束日期 2024-03-10 <= 查询的结束日期 2024-03-31 。此时 应该 计算 查询的开始日期 到 流程里的结束日期,这个范围内的 应出勤天数
if(compareDate(toDate,lc_toDate)){
//流程里的结束日期 >= 当前日期
if(compareDate(lc_toDate,currentdate)){
ycqdays = getWorkdays(fromDate,currentdate,userid);
}else{
ycqdays = getWorkdays(fromDate,lc_toDate,userid);
}
}
// 流程里的结束日期 2024-04-10 > 查询的结束日期 2024-03-31 。此时 应该 计算 查询的开始日期 到 查询的结束日期,这个范围内的 应出勤天数
else{
//流程里的结束日期 >= 当前日期
if(compareDate(toDate,currentdate)){
ycqdays = getWorkdays(fromDate,currentdate,userid);
}else{
ycqdays = getWorkdays(fromDate,toDate,userid);
}
}
}
//查询的开始日期 2024-03-01 > 流程里的结束日期 2024-02-20
else{
ycqdays = 0;
}
}
}
rs.writeLog("=============== ycqdays ================= "+ ycqdays);
rs.writeLog("=============== day ================= "+ day);
result = ycqdays * day;
return result;
}
/**
*
* @param fromDate
* @param toDate
* @param resourceId id
* @return
*/
public static int getWorkdays(String fromDate, String toDate, String resourceId) {
int workDays = 0;
/**统计应出勤天数*/
KQWorkTime kqWorkTime = new KQWorkTime();
boolean isEnd = false;
for (String date = fromDate; !isEnd; ) {
if (date.compareTo(toDate)>=0) {
isEnd = true;
}
boolean isWorkDay = kqWorkTime.isWorkDay(resourceId, date);
if (isWorkDay) {
workDays += 1;
}
date = DateUtil.getDate(date, 1);
}
return workDays;
}
/**
*
* @param a
* @param b
* @return
* @throws ParseException
*/
public static boolean compareDate(String a, String b){
boolean bool = false;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
long t1 = sdf.parse(a).getTime();
long t2 = sdf.parse(b).getTime();
if (t1 >= t2) {
bool = true;
}
return bool;
}catch (Exception e){
e.printStackTrace();
}
return bool;
}
/**
* :
* @param a
* @param b
* @return
* String
*/
public static String floatAdd(String a, String b) {
a=a.equals("")?"0":a;
b=b.equals("")?"0":b;
BigDecimal bg1 = new BigDecimal(a);
BigDecimal bg2 = new BigDecimal(b);
BigDecimal bd = bg1.add(bg2);
return bd.toString();
}
}

@ -153,7 +153,7 @@ public class NbkqServiceImpl extends Service implements NbkqService {
requestMap.put("zy",zy); requestMap.put("zy",zy);
} }
if(StringUtils.isNotBlank(hklx)){ if(StringUtils.isNotBlank(hklx)){
requestMap.put("hklx",hklx); requestMap.put("hklx1",hklx);
} }
if(StringUtils.isNotBlank(zc)){ if(StringUtils.isNotBlank(zc)){
requestMap.put("zc",zc); requestMap.put("zc",zc);
@ -198,7 +198,7 @@ public class NbkqServiceImpl extends Service implements NbkqService {
requestMap.put("sg", sg); requestMap.put("sg", sg);
} }
if(StringUtils.isNotBlank(zzmm)) { if(StringUtils.isNotBlank(zzmm)) {
requestMap.put("zzmm", zzmm); requestMap.put("zzmr", zzmm);
} }
if(StringUtils.isNotBlank(cjgzsj)) { if(StringUtils.isNotBlank(cjgzsj)) {
requestMap.put("cjgzsj", cjgzsj); requestMap.put("cjgzsj", cjgzsj);
@ -248,7 +248,7 @@ public class NbkqServiceImpl extends Service implements NbkqService {
bb.writeLog("开始处理明细"); bb.writeLog("开始处理明细");
//明细表1处理 //明细表1处理
List<Map<String,String>> list = new ArrayList<Map<String,String>>(); List<Map<String,String>> list = new ArrayList<Map<String,String>>();
String sqlDt1 = " select ksrq,jsrq,xx,zy,bz from uf_yrzbd_dt1 where mainid = "+id; String sqlDt1 = " select ksrq,jsrq,xx,zy,bz,zmr,lxdh from uf_yrzbd_dt1 where mainid = "+id;
rs.executeQuery(sqlDt1); rs.executeQuery(sqlDt1);
while (rs.next()){ while (rs.next()){
Map<String,String> mapMode = new HashMap<>(); Map<String,String> mapMode = new HashMap<>();
@ -257,6 +257,8 @@ public class NbkqServiceImpl extends Service implements NbkqService {
String xxNew = Util.null2String(rs.getString("xx")); String xxNew = Util.null2String(rs.getString("xx"));
String zyNew = Util.null2String(rs.getString("zy")); String zyNew = Util.null2String(rs.getString("zy"));
String bz = Util.null2String(rs.getString("bz")); String bz = Util.null2String(rs.getString("bz"));
String zmr = Util.null2String(rs.getString("zmr"));
String lxdhDto = Util.null2String(rs.getString("lxdh"));
if (StringUtils.isNotBlank(ksrq)){ if (StringUtils.isNotBlank(ksrq)){
mapMode.put("ksrq",ksrq); mapMode.put("ksrq",ksrq);
} }
@ -272,6 +274,12 @@ public class NbkqServiceImpl extends Service implements NbkqService {
if (StringUtils.isNotBlank(bz)){ if (StringUtils.isNotBlank(bz)){
mapMode.put("bz",bz); mapMode.put("bz",bz);
} }
if (StringUtils.isNotBlank(zmr)){
mapMode.put("zmr",zmr);
}
if (StringUtils.isNotBlank(lxdhDto)){
mapMode.put("lxdh",lxdhDto);
}
list.add(mapMode); list.add(mapMode);
} }
@ -300,7 +308,7 @@ public class NbkqServiceImpl extends Service implements NbkqService {
//明细表2处理 //明细表2处理
List<Map<String,String>> list2 = new ArrayList<Map<String,String>>(); List<Map<String,String>> list2 = new ArrayList<Map<String,String>>();
String sqlDt2 = " select ksrq,jsrq,gzdw,zw,lzyy,zmr from uf_yrzbd_dt2 where mainid = "+id; String sqlDt2 = " select ksrq,jsrq,gzdw,zw,lzyy,zmr,xz,lxdh from uf_yrzbd_dt2 where mainid = "+id;
rs.executeQuery(sqlDt2); rs.executeQuery(sqlDt2);
while (rs.next()){ while (rs.next()){
Map<String,String> mapMode = new HashMap<>(); Map<String,String> mapMode = new HashMap<>();
@ -310,6 +318,8 @@ public class NbkqServiceImpl extends Service implements NbkqService {
String zw = Util.null2String(rs.getString("zw")); String zw = Util.null2String(rs.getString("zw"));
String lzyy = Util.null2String(rs.getString("lzyy")); String lzyy = Util.null2String(rs.getString("lzyy"));
String zmr = Util.null2String(rs.getString("zmr")); String zmr = Util.null2String(rs.getString("zmr"));
String xz = Util.null2String(rs.getString("xz"));
String lxdhDtT = Util.null2String(rs.getString("lxdh"));
if (StringUtils.isNotBlank(ksrq)){ if (StringUtils.isNotBlank(ksrq)){
mapMode.put("ksrq",ksrq); mapMode.put("ksrq",ksrq);
} }
@ -328,6 +338,12 @@ public class NbkqServiceImpl extends Service implements NbkqService {
if (StringUtils.isNotBlank(zmr)){ if (StringUtils.isNotBlank(zmr)){
mapMode.put("zmr",zmr); mapMode.put("zmr",zmr);
} }
if (StringUtils.isNotBlank(xz)){
mapMode.put("xz",xz);
}
if (StringUtils.isNotBlank(lxdhDtT)){
mapMode.put("lxdh",lxdhDtT);
}
list2.add(mapMode); list2.add(mapMode);
} }
@ -347,7 +363,7 @@ public class NbkqServiceImpl extends Service implements NbkqService {
//明细表3处理 //明细表3处理
List<Map<String,String>> list3 = new ArrayList<Map<String,String>>(); List<Map<String,String>> list3 = new ArrayList<Map<String,String>>();
String sqlDt3 = " select xm,nl,ybrgx,zz,zy from uf_yrzbd_dt3 where mainid = "+id; String sqlDt3 = " select xm,nl,ybrgx,zz,zy,lxdh from uf_yrzbd_dt3 where mainid = "+id;
rs.executeQuery(sqlDt3); rs.executeQuery(sqlDt3);
while (rs.next()){ while (rs.next()){
Map<String,String> mapMode = new HashMap<>(); Map<String,String> mapMode = new HashMap<>();
@ -356,6 +372,7 @@ public class NbkqServiceImpl extends Service implements NbkqService {
String ybrgx = Util.null2String(rs.getString("ybrgx")); String ybrgx = Util.null2String(rs.getString("ybrgx"));
String zz = Util.null2String(rs.getString("zz")); String zz = Util.null2String(rs.getString("zz"));
String zyNew = Util.null2String(rs.getString("zy")); String zyNew = Util.null2String(rs.getString("zy"));
String lxdhDtTh = Util.null2String(rs.getString("lxdh"));
if (StringUtils.isNotBlank(xmNew)){ if (StringUtils.isNotBlank(xmNew)){
mapMode.put("xm",xmNew); mapMode.put("xm",xmNew);
@ -372,6 +389,9 @@ public class NbkqServiceImpl extends Service implements NbkqService {
if (StringUtils.isNotBlank(zyNew)){ if (StringUtils.isNotBlank(zyNew)){
mapMode.put("zy",zyNew); mapMode.put("zy",zyNew);
} }
if (StringUtils.isNotBlank(lxdhDtTh)){
mapMode.put("lxdh",lxdhDtTh);
}
list3.add(mapMode); list3.add(mapMode);
} }

@ -0,0 +1,39 @@
package com.engine.nbkq.web;
import com.alibaba.fastjson.JSONObject;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.Map;
public class NbjhWorkflowAction {
@GET
@Path("/getUserSecLevel")
@Produces({MediaType.TEXT_PLAIN})
public String checkOverTime(@Context HttpServletRequest request, @Context HttpServletResponse response) {
Map<String,Object> apidatas = new HashMap<String,Object>();
try{
User user = HrmUserVarify.getUser(request, response);
String secLevel = user.getSeclevel();
String userId = user.getUID()+"";
apidatas.put("secLevel",secLevel);
apidatas.put("userId",userId);
apidatas.put("api_status",true);
}catch (Exception e) {
e.printStackTrace();
apidatas.put("api_status",false);
apidatas.put("api_errormsg","exception:"+e.getMessage());
}
return JSONObject.toJSONString(apidatas);
}
}

@ -1,13 +1,11 @@
package weaver.interfaces.bnkq.action; package weaver.interfaces.bnkq.action;
import com.engine.kq.biz.KQFormatBiz;
import com.engine.kq.biz.KQWorkTime; import com.engine.kq.biz.KQWorkTime;
import com.engine.kq.entity.WorkTimeEntity; import com.engine.kq.entity.WorkTimeEntity;
import com.engine.workflow.service.HtmlToPdfService;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
import weaver.general.BaseBean; import weaver.general.BaseBean;
import weaver.general.PinyinUtil;
import weaver.general.TimeUtil; import weaver.general.TimeUtil;
import weaver.general.Util; import weaver.general.Util;
import weaver.interfaces.workflow.action.Action; import weaver.interfaces.workflow.action.Action;
@ -20,7 +18,7 @@ import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
/** /**
* Action * Action
*/ */
public class UpdateCcTimeAction implements Action { public class UpdateCcTimeAction implements Action {
@ -50,36 +48,41 @@ public class UpdateCcTimeAction implements Action {
//实际出差结束时间 //实际出差结束时间
String sjccjsrq = Util.null2String(mainInfo.get("sjccjsrq")); String sjccjsrq = Util.null2String(mainInfo.get("sjccjsrq"));
//部门 //部门
String szbm = Util.null2String(mainInfo.get("szbm")); String szbm = Util.null2String(mainInfo.get("szbm"));
//分部 //分部
String szgs = Util.null2String(mainInfo.get("szgs")); String szgs = Util.null2String(mainInfo.get("szgs"));
//相差天数 //相差天数
Integer cz = TimeUtil.dateInterval(sjksrq, sjccjsrq) + 1; Integer cz = TimeUtil.dateInterval(sjksrq,sjccjsrq)+1;
//插入出差表 //插入出差表
Double czours = multiply(String.valueOf(cz), "8"); Double czours = multiply(String.valueOf(cz),"8");
Set<String> all = new HashSet<>(); Set<String> all = new HashSet<>();
all.add(sjksrq); all.add(sjksrq);
List<String> back = days(sjksrq, sjccjsrq); List<String> back = days(sjksrq,sjccjsrq);
all.addAll(back); all.addAll(back);
all.add(sjccjsrq); all.add(sjccjsrq);
KQWorkTime kqWorkTime = new KQWorkTime(); KQWorkTime kqWorkTime = new KQWorkTime();
kqWorkTime.setIsFormat(true); kqWorkTime.setIsFormat(true);
for (String date : all) { List<List<Object>> paramInsert = new ArrayList<>();
bb.writeLog("date:" + date); for(String date:all){
bb.writeLog("date:"+date);
WorkTimeEntity tmpworkTime = kqWorkTime.getWorkTime(sqr, date); WorkTimeEntity tmpworkTime = kqWorkTime.getWorkTime(sqr, date);
if (tmpworkTime.getWorkMins() > 0) { if(tmpworkTime.getWorkMins()>0){
bb.writeLog("当天排班了:" + tmpworkTime.getWorkMins()); bb.writeLog("当天排班了:"+tmpworkTime.getWorkMins());
insertLeave(reqid, Integer.valueOf(sqr), date, 8.00, "3", "1", szgs, szbm, date, wfid, tablaName); insertLeave(reqid,Integer.valueOf(sqr),date,8.00,"3","1",szgs,szbm,date,wfid,tablaName);
insertDetail(sqr, date, rs); List<Object> params = new ArrayList<>();
params.add(sqr);
params.add(date);
paramInsert.add(params);
} }
} }
new KQFormatBiz().format(paramInsert);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
bb.writeLog(e); bb.writeLog(e);
bb.writeLog("更新人员出差时长error" + e.getMessage()); bb.writeLog("更新人员出差时长error"+e.getMessage());
info.getRequestManager().setMessageid("2000"); info.getRequestManager().setMessageid("2000");
info.getRequestManager().setMessagecontent("更新人员出差时长error"); info.getRequestManager().setMessagecontent("更新人员出差时长error");
return Action.FAILURE_AND_CONTINUE; return Action.FAILURE_AND_CONTINUE;
@ -87,15 +90,9 @@ public class UpdateCcTimeAction implements Action {
return Action.SUCCESS; return Action.SUCCESS;
} }
private void insertDetail(String resourceId, String date, RecordSet rs) {
String sql = "update kq_format_detail set evectionMins=480,absenteeismMins=0 where resourceid=? and kqdate='" + date + "'";
rs.executeUpdate(sql, resourceId);
}
/** /**
* *
*
* @param date1 * @param date1
* @param date2 * @param date2
* @return * @return
@ -158,7 +155,6 @@ public class UpdateCcTimeAction implements Action {
/** /**
* *
*
* @param v1 * @param v1
* @param v2 * @param v2
* @return * @return
@ -171,34 +167,19 @@ public class UpdateCcTimeAction implements Action {
/** /**
* *
*
* @param requestid * @param requestid
* @param userid * @param userid
* @param fromDate * @param fromDate
* @param MaxHours * @param MaxHours
*/ */
private static void insertLeave(String requestid, Integer userid, String fromDate, Double MaxHours, String durationrule, String newleavetype, String subcompany, String department, String toDate, String wfid, String tablename) { private static void insertLeave(String requestid,Integer userid,String fromDate,Double MaxHours,String durationrule,String newleavetype,String subcompany,String department,String toDate,String wfid,String tablename){
BaseBean bb = new BaseBean(); BaseBean bb = new BaseBean();
//插入加班时间 //插入加班时间
RecordSet rsInsert = new RecordSet(); RecordSet rsInsert = new RecordSet();
String sql = "insert into kq_flow_split_evection (requestid,resourceid,fromdate,fromtime,todate,totime,duration,durationrule,belongdate,newleavetype,subcompanyid,departmentid,workflowid,tablenamedb) " String sql = "insert into kq_flow_split_evection (requestid,resourceid,fromdate,fromtime,todate,totime,duration,durationrule,belongdate,newleavetype,subcompanyid,departmentid,workflowid,tablenamedb) "
+ " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?) "; + " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?) ";
rsInsert.executeUpdate(sql, requestid, userid, fromDate, "08:00", toDate, "17:00", MaxHours, durationrule, fromDate, newleavetype, subcompany, department, wfid, tablename); rsInsert.executeUpdate(sql, requestid,userid,fromDate,"08:00",toDate,"17:00",MaxHours,durationrule,fromDate,newleavetype,subcompany,department,wfid,tablename);
bb.writeLog("insertSql:" + sql); bb.writeLog("insertSql:"+sql);
}
public static void main(String[] args) {
Set<String> all = new HashSet<>();
all.add("2023-12-20");
List<String> back = days("2023-12-20", "2023-12-20");
all.addAll(back);
all.add("2023-12-20");
for (String date : all) {
System.out.println(date);
}
} }
} }

Loading…
Cancel
Save