Compare commits

..

16 Commits
dev ... dev-zm

@ -0,0 +1,30 @@
<%@ page import="com.engine.kq.biz.KQWorkTime" %>
<%@ page import="java.util.Map" %>
<%@ page import="com.engine.kq.entity.WorkTimeEntity" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit" %>
<%
String userId = request.getParameter("userId");
String kqDate = request.getParameter("kqDate");
try {
KQWorkTime kqWorkTime = new KQWorkTime();
Map<String, Object> serialInfo = kqWorkTime.getSerialInfo(userId, kqDate, false);
if (serialInfo != null && serialInfo.size() > 0) {
int serialid = Util.getIntValue(Util.null2String(serialInfo.get(kqDate)), 0);
out.println("serialid:" + serialid + "<br>");
}
WorkTimeEntity workTime = kqWorkTime.getWorkTime(userId, kqDate);
String bc = workTime.getSerialId();
out.print("new serialid:" + bc + "<br>");
ShiftManagementToolKit shiftManagementToolKit = new ShiftManagementToolKit();
String shiftOnOffWorkSections = shiftManagementToolKit.getShiftOnOffWorkSections(bc, 7);
out.print("shiftOnOffWorkSections:" + shiftOnOffWorkSections + "<br>");
shiftOnOffWorkSections = shiftManagementToolKit.getShiftOnOffWorkSections("51", 7);
out.print("shiftOnOffWorkSections 51:" + shiftOnOffWorkSections + "<br>");
} catch (Exception e) {
out.print("get serialid error:" + e.getMessage());
}
%>

@ -1,2 +1,4 @@
# 餐补信息记录模块ID # 餐补信息记录模块ID
cbxxjl_modeid=82 cbxxjl_modeid=82
# 夜班补助指定班次
night_shift_appoint_bc=51,52

@ -292,7 +292,7 @@ public class KqDevServiceImpl extends Service implements KqDevService {
List<String> userIds = new ArrayList<>(); List<String> userIds = new ArrayList<>();
if (org.apache.commons.lang3.StringUtils.isEmpty(ryParam)) { if (org.apache.commons.lang3.StringUtils.isEmpty(ryParam)) {
bb.writeLog("1111."); bb.writeLog("1111.");
rs.executeQuery("select id from hrmresource"); rs.executeQuery("select id from hrmresource where status in(0,1,2,3,5)");
while (rs.next()) { while (rs.next()) {
userIds.add(rs.getString("id")); userIds.add(rs.getString("id"));
} }
@ -307,15 +307,81 @@ public class KqDevServiceImpl extends Service implements KqDevService {
result.put("code", "200"); result.put("code", "200");
return result; return result;
} }
ExecutorService executorService = ThreadPoolUtil.getThreadPool(null, null);
// 获取离职人员以及日期
String queryDepartEmployeeSql = "select resourceid ,changedate from HRMSTATUSHISTORY where type_n = 5 and changedate is not null";
rs.execute(queryDepartEmployeeSql);
Map<String, String> departMap = new HashMap<>();
while (rs.next()) {
String ryIdT = rs.getString("resourceid");
String changedate = rs.getString("changedate");
if (org.apache.commons.lang3.StringUtils.isEmpty(ryIdT) || org.apache.commons.lang3.StringUtils.isEmpty(changedate)) {
continue;
}
departMap.put(ryIdT, changedate);
}
// 获取责任制、排班次班次
Set<String> zrzbcSet = new HashSet<>();
Set<String> pbzbcSet = new HashSet<>();
String acqSql = "select kqgroup, grouptype from uf_ZeroPointSubSft";
rs.executeQuery(acqSql);
while (rs.next()) {
String kqgroup = Util.null2String(rs.getString("kqgroup"));
String grouptype = Util.null2String(rs.getString("grouptype"));
if (org.apache.commons.lang3.StringUtils.isNotBlank(kqgroup) && org.apache.commons.lang3.StringUtils.equals(grouptype, "0")) {
zrzbcSet.addAll(Arrays.asList(kqgroup.split(",")));
}
if (org.apache.commons.lang3.StringUtils.isNotBlank(kqgroup) && org.apache.commons.lang3.StringUtils.equals(grouptype, "1")) {
pbzbcSet.addAll(Arrays.asList(kqgroup.split(",")));
}
}
// 鸿仁驻点餐补指定人员不享受
List<String> removeRes = new ArrayList<>();
String acqNoOtherStatAllResSql = "select resourceid from uf_NoOtherStatAllRe where isdelete is null or isdelete = 0 ";
rs.executeQuery(acqNoOtherStatAllResSql);
while (rs.next()){
String resourceid = Util.null2String(rs.getString("resourceid"));
if (org.apache.commons.lang3.StringUtils.isNotBlank(resourceid) ) {
removeRes.add(resourceid);
}
}
// 驻点餐补指定人员不享受
List<String> noRes = new ArrayList<>();
String acqNoResSql = "select resourceid from uf_NoStatAllRes where isdelete = 0 or isdelete is null";
rs.executeQuery(acqNoResSql);
while (rs.next()) {
String resourceid = Util.null2String(rs.getString("resourceid"));
if (org.apache.commons.lang3.StringUtils.isNotBlank(resourceid)) {
noRes.add(resourceid);
}
}
//获取夜班班次
List<String> nightShiftList = new ArrayList<>();
String acqNightShiftSql = "select shift from uf_nightshiftmanage where isdelete is null or isdelete = 0";
rs.executeQuery(acqNightShiftSql);
while (rs.next()) {
String shift = Util.null2String(rs.getString("shift"));
if (org.apache.commons.lang3.StringUtils.isNotBlank(shift)) {
nightShiftList.add(shift);
}
}
ExecutorService executorService = ThreadPoolUtil.getThreadPool("HandleCBDataThreadA", "20");
for (String userId : userIds) { for (String userId : userIds) {
for (String kqDate : allDates) { for (String kqDate : allDates) {
executorService.execute(new HandleCBDataThread(userId, kqDate)); if (departMap.containsKey(userId)) {
String changeDate = departMap.get(userId);
if (LocalDate.parse(changeDate).isBefore(LocalDate.parse(kqDate))) {
continue;
}
}
executorService.execute(new HandleCBDataThread(userId, kqDate, zrzbcSet, pbzbcSet, removeRes, nightShiftList, noRes));
} }
} }
if (executorService.isTerminated()) {
executorService.shutdown();
}
} catch (Exception e) { } catch (Exception e) {
bb.writeLog("updateCbInfo error:" + e.getMessage()); bb.writeLog("updateCbInfo error:" + e.getMessage());
result.put("mes", "系统错误,请联系管理员!"); result.put("mes", "系统错误,请联系管理员!");

File diff suppressed because it is too large Load Diff

@ -115,7 +115,7 @@ public class KQFormatData extends BaseBean {
//没有考勤组不需格式化 //没有考勤组不需格式化
return resultMap; return resultMap;
} }
if (workTime == null || workTime.getWorkMins() == 0) { if (workTime == null || (workTime.getWorkMins() == 0 && workTime.getRestShift() != 1)) {
kqLog.info("workTime == null || workTime.getWorkMins() == 0 插入空记录"); kqLog.info("workTime == null || workTime.getWorkMins() == 0 插入空记录");
nonlsParam = new ArrayList<>(); nonlsParam = new ArrayList<>();
formatNonWork(userId, kqDate,nonlsParam,workTime, workFlowInfo); formatNonWork(userId, kqDate,nonlsParam,workTime, workFlowInfo);
@ -143,6 +143,57 @@ public class KQFormatData extends BaseBean {
" group by resourceid,kqdate,b.subcompanyid1,b.departmentid,b.jobtitle,groupid,serialid,workmins"; " group by resourceid,kqdate,b.subcompanyid1,b.departmentid,b.jobtitle,groupid,serialid,workmins";
rs.executeUpdate(sql, userId, kqDate); rs.executeUpdate(sql, userId, kqDate);
} }
}else if (workTime.getWorkMins() == 0 && workTime.getRestShift() == 1){
Map<String,Object> definedFieldInfo = new KQFormatBiz().getDefinedField();
String definedField = "";
String definedParam = "";
String definedParamSum = "";
if (workTime.getKQType().equals("3")) {//自由工时
lsParam.addAll(kqFormatFreeData.format(userId, kqDate, workFlowInfo));
} else {
definedField = Util.null2String(definedFieldInfo.get("definedField"));
definedParam = Util.null2String(definedFieldInfo.get("definedParam"));
definedParamSum = Util.null2String(definedFieldInfo.get("definedParamSum"));
lsParam.addAll(format(userId, kqDate, workTime, workFlowInfo,uuid));
}
if (lsParam.size() > 0) {
sql = " insert into kq_format_detail( " +
" resourceid,kqdate,groupid,serialid,serialnumber,workbegindate,workbegintime,workenddate,workendtime,workmins," +
" signindate,signintime,signinid,signoutdate,signouttime,signoutid,signMins," +
" attendanceMins,belatemins,graveBeLateMins,leaveearlymins,graveLeaveEarlyMins,absenteeismmins,forgotcheckMins," +
" leaveMins,leaveinfo,evectionMins,outMins,forgotbeginworkcheckmins,otherinfo,zeropoint"+(definedField.length()>0?","+definedField+"":"")+") " +
" values(?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?"+(definedField.length()>0?","+definedParam+"":"")+")";
for (int i = 0; i < lsParam.size(); i++) {
List<Object> param = lsParam.get(i);
boolean isok = rs.executeUpdate(sql, param);
kqLog.info("插入记录新:userId:"+userId+":kqDate:"+kqDate+":param:"+JSON.toJSONString(param)+":isok:"+isok+"::uuid::"+uuid);
}
sql = " insert into kq_format_total(resourceid,kqdate,subcompanyid,departmentid,jobtitle,groupid,serialid,workdays,workmins," +
" attendancedays,attendancemins,signdays,signmins,belate,belatemins,gravebelate,gravebelatemins,leaveeearly,leaveearlymins,graveleaveearly," +
" graveleaveearlymins,absenteeism,absenteeismmins,forgotcheck,forgotcheckmins," +
" leaveMins,evectionMins,outMins,forgotbeginworkcheck,forgotbeginworkcheckmins,zeropoint"+(definedField.length()>0?","+definedField+"":"")+") " +
" select a.resourceid,kqdate,b.subcompanyid1,b.departmentid,b.jobtitle,groupid,serialid," +
" case when sum(workmins)>0 then 1 end as workdays, sum(workmins) as workmins," +
" 0 as attendancedays, sum(attendanceMins) as attendanceMins," +
" 0 as signdays, sum(signmins) as signmins," +
" sum(case when belatemins> 0 then 1 else 0 end) as belate,sum(belatemins) as belatemins," +
" sum(case when graveBeLateMins> 0 then 1 else 0 end) as graveBeLate,sum(graveBeLateMins) as graveBeLateMins," +
" sum(case when leaveearlymins> 0 then 1 else 0 end) as leaveearly,sum(leaveearlymins) as leaveearlymins," +
" sum(case when graveLeaveEarlyMins> 0 then 1 else 0 end) as graveLeaveEarly,sum(graveLeaveEarlyMins) as graveLeaveEarlyMins, " +
" sum(case when absenteeismmins> 0 then 1 else 0 end) as absenteeism,sum(absenteeismmins) as absenteeismmins," +
" sum(case when forgotcheckmins> 0 then 1 else 0 end) as forgotcheck,sum(forgotcheckmins) as forgotcheckmins,sum(leaveMins) as leaveMins," +
" sum(evectionMins) as evectionMins,sum(outMins) as outMins, " +
" sum(case when forgotbeginworkcheckmins> 0 then 1 else 0 end) as forgotbeginworkcheck,sum(forgotbeginworkcheckmins) as forgotbeginworkcheckmins,sum(zeropoint) as zeropoint " +
(definedField.length()>0?","+definedParamSum+"":"")+
" from kq_format_detail a, hrmresource b" +
" where a.resourceid = b.id and resourceid = ? and kqdate=?" +
" group by resourceid,kqdate,b.subcompanyid1,b.departmentid,b.jobtitle,groupid,serialid";
boolean isok2 = rs.executeUpdate(sql, userId, kqDate);
kqLog.info("插入记录2新:userId:"+userId+":kqDate:"+kqDate+":isok:"+isok2);
kqLog.info("sqlTotal:"+sql);
}
}else{ }else{
Map<String,Object> definedFieldInfo = new KQFormatBiz().getDefinedField(); Map<String,Object> definedFieldInfo = new KQFormatBiz().getDefinedField();
String definedField = ""; String definedField = "";
@ -157,7 +208,7 @@ public class KQFormatData extends BaseBean {
lsParam.addAll(format(userId, kqDate, workTime, workFlowInfo,uuid)); lsParam.addAll(format(userId, kqDate, workTime, workFlowInfo,uuid));
} }
bb.writeLog("lsParam: " + lsParam); // bb.writeLog("lsParam: " + lsParam);
if (lsParam.size() > 0) { if (lsParam.size() > 0) {
sql = " insert into kq_format_detail( " + sql = " insert into kq_format_detail( " +
" resourceid,kqdate,groupid,serialid,serialnumber,workbegindate,workbegintime,workenddate,workendtime,workmins," + " resourceid,kqdate,groupid,serialid,serialnumber,workbegindate,workbegintime,workenddate,workendtime,workmins," +
@ -194,85 +245,85 @@ public class KQFormatData extends BaseBean {
rs.executeUpdate(sql, userId, kqDate); rs.executeUpdate(sql, userId, kqDate);
} }
} }
long startTime = System.currentTimeMillis(); // long startTime = System.currentTimeMillis();
// 获取考勤二开--夜班补助 // // 获取考勤二开--夜班补助
String nightShiftSubsidy = getNightShiftSubsidy(userId, kqDate); // String nightShiftSubsidy = getNightShiftSubsidy(userId, kqDate);
bb.writeLog("nightShiftSubsidy:" + nightShiftSubsidy); // bb.writeLog("nightShiftSubsidy:" + nightShiftSubsidy);
if (StringUtils.isEmpty(nightShiftSubsidy)) { // if (StringUtils.isEmpty(nightShiftSubsidy)) {
nightShiftSubsidy = "0"; // nightShiftSubsidy = "0";
} // }
// 获取考勤二开--鸿仁驻点餐补 // // 获取考勤二开--鸿仁驻点餐补
String otherStatAllowance = getOtherStatAllowance(userId, kqDate); // String otherStatAllowance = getOtherStatAllowance(userId, kqDate);
bb.writeLog("otherStatAllowance:" + otherStatAllowance); // bb.writeLog("otherStatAllowance:" + otherStatAllowance);
if (StringUtils.isEmpty(otherStatAllowance)) { // if (StringUtils.isEmpty(otherStatAllowance)) {
otherStatAllowance = "0"; // otherStatAllowance = "0";
} // }
// 考勤二开--精密夜班餐补 // // 考勤二开--精密夜班餐补
String nightAllowance = getNightAllowance(userId, kqDate); // String nightAllowance = getNightAllowance(userId, kqDate);
bb.writeLog("nightAllowance:" + nightAllowance); // bb.writeLog("nightAllowance:" + nightAllowance);
if (StringUtils.isEmpty(nightAllowance)) { // if (StringUtils.isEmpty(nightAllowance)) {
nightAllowance = "0"; // nightAllowance = "0";
} // }
// 考勤二开--驻点餐补 // // 考勤二开--驻点餐补
String statAllowance = getStatAllowance(userId, kqDate); // String statAllowance = getStatAllowance(userId, kqDate);
bb.writeLog("statAllowance:" + statAllowance); // bb.writeLog("statAllowance:" + statAllowance);
if (StringUtils.isEmpty(statAllowance)) { // if (StringUtils.isEmpty(statAllowance)) {
statAllowance = "0"; // statAllowance = "0";
} // }
// 考勤二开--出差餐补 // // 考勤二开--出差餐补
String mealAllowance = getMealAllowance(userId, kqDate); // String mealAllowance = getMealAllowance(userId, kqDate);
bb.writeLog("mealAllowance:" + mealAllowance); // bb.writeLog("mealAllowance:" + mealAllowance);
if (StringUtils.isEmpty(mealAllowance)) { // if (StringUtils.isEmpty(mealAllowance)) {
mealAllowance = "0"; // mealAllowance = "0";
} // }
// 考勤二开--零点补助 // // 考勤二开--零点补助
String zeropoint = getZeroBt(userId, kqDate); // String zeropoint = getZeroBt(userId, kqDate);
bb.writeLog("zeropoint:" + zeropoint); // bb.writeLog("zeropoint:" + zeropoint);
if (StringUtils.isEmpty(zeropoint)) { // if (StringUtils.isEmpty(zeropoint)) {
zeropoint = "0"; // zeropoint = "0";
} // }
//
rs.executeQuery("select id from uf_cbxxjlb where xm = ? and rq = ?", userId, kqDate); // rs.executeQuery("select id from uf_cbxxjlb where xm = ? and rq = ?", userId, kqDate);
RecordSet rs1 = new RecordSet(); // RecordSet rs1 = new RecordSet();
String cbxxjlModeId = rs1.getPropValue("hostar_zm_prop","cbxxjl_modeid"); // String cbxxjlModeId = rs1.getPropValue("hostar_zm_prop","cbxxjl_modeid");
if (rs.next()) { // if (rs.next()) {
int cbxxjlId = rs.getInt("id"); // int cbxxjlId = rs.getInt("id");
rs1.executeUpdate("update uf_cbxxjlb set hrzdcb = ?, jmybcb = ?, zdcb = ?, ybbz = ?, cccb = ?, ldbz = ? where id = ?", // rs1.executeUpdate("update uf_cbxxjlb set hrzdcb = ?, jmybcb = ?, zdcb = ?, ybbz = ?, cccb = ?, ldbz = ? where id = ?",
otherStatAllowance, nightAllowance, statAllowance, nightShiftSubsidy, mealAllowance, zeropoint, cbxxjlId); // otherStatAllowance, nightAllowance, statAllowance, nightShiftSubsidy, mealAllowance, zeropoint, cbxxjlId);
//权限重构 // //权限重构
ModeRightInfo ModeRightInfo = new ModeRightInfo(); // ModeRightInfo ModeRightInfo = new ModeRightInfo();
ModeRightInfo.setNewRight(true); // ModeRightInfo.setNewRight(true);
ModeRightInfo.editModeDataShare(1, Integer.parseInt(cbxxjlModeId), cbxxjlId); // ModeRightInfo.editModeDataShare(1, Integer.parseInt(cbxxjlModeId), cbxxjlId);
} else { // } else {
String uuidT = UUID.randomUUID().toString(); // String uuidT = UUID.randomUUID().toString();
SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式 // SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
SimpleDateFormat sdfTime = new SimpleDateFormat("HH:mm:ss");//设置日期格式 // SimpleDateFormat sdfTime = new SimpleDateFormat("HH:mm:ss");//设置日期格式
String nowDate = sdfDate.format(new Date()); // String nowDate = sdfDate.format(new Date());
String nowTime = sdfTime.format(new Date()); // String nowTime = sdfTime.format(new Date());
String gh = null; // String gh = null;
String bm = null; // String bm = null;
rs1.executeQuery("SELECT workcode, departmentid from hrmresource where id = ?", userId); // rs1.executeQuery("SELECT workcode, departmentid from hrmresource where id = ?", userId);
if (rs1.next()) { // if (rs1.next()) {
gh = rs1.getString("workcode"); // gh = rs1.getString("workcode");
bm = rs1.getString("departmentid"); // bm = rs1.getString("departmentid");
} // }
rs1.executeUpdate("insert into uf_cbxxjlb (xm, rq, gh, bm, hrzdcb, jmybcb, zdcb, ybbz, cccb, ldbz, formmodeid, MODEUUID, " + // rs1.executeUpdate("insert into uf_cbxxjlb (xm, rq, gh, bm, hrzdcb, jmybcb, zdcb, ybbz, cccb, ldbz, formmodeid, MODEUUID, " +
"modedatacreater, modedatacreatertype, modedatacreatedate, modedatacreatetime) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ,? ,?)", // "modedatacreater, modedatacreatertype, modedatacreatedate, modedatacreatetime) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ,? ,?)",
userId, kqDate, gh, bm ,otherStatAllowance, nightAllowance, statAllowance, nightShiftSubsidy, mealAllowance, zeropoint, cbxxjlModeId, uuidT, "1", "0", nowDate, nowTime); // userId, kqDate, gh, bm ,otherStatAllowance, nightAllowance, statAllowance, nightShiftSubsidy, mealAllowance, zeropoint, cbxxjlModeId, uuidT, "1", "0", nowDate, nowTime);
RecordSet qxcgRs = new RecordSet(); // RecordSet qxcgRs = new RecordSet();
qxcgRs.execute("select id from uf_cbxxjlb where MODEUUID = '" + uuidT + "'"); // qxcgRs.execute("select id from uf_cbxxjlb where MODEUUID = '" + uuidT + "'");
Integer idT = 0; // Integer idT = 0;
while (qxcgRs.next()) { // while (qxcgRs.next()) {
idT = qxcgRs.getInt("id"); // idT = qxcgRs.getInt("id");
} // }
//权限重构 // //权限重构
ModeRightInfo ModeRightInfo = new ModeRightInfo(); // ModeRightInfo ModeRightInfo = new ModeRightInfo();
ModeRightInfo.setNewRight(true); // ModeRightInfo.setNewRight(true);
ModeRightInfo.editModeDataShare(1, Integer.parseInt(cbxxjlModeId), idT); // ModeRightInfo.editModeDataShare(1, Integer.parseInt(cbxxjlModeId), idT);
} // }
long endTime = System.currentTimeMillis(); // long endTime = System.currentTimeMillis();
long elapsedTime = endTime - startTime; // 执行时间 // long elapsedTime = endTime - startTime; // 执行时间
bb.writeLog("getDailyMealAllowanceData执行时间" + elapsedTime/1000 + "秒"); // bb.writeLog("getDailyMealAllowanceData执行时间" + elapsedTime/1000 + "秒");
}catch (Exception e) { }catch (Exception e) {
writeLog(e); writeLog(e);
kqLog.info(e); kqLog.info(e);
@ -305,11 +356,13 @@ public class KQFormatData extends BaseBean {
bb.writeLog("format.groupId:"+workTime.getGroupId()+"format.serialId:"+workTime.getSerialId()); bb.writeLog("format.groupId:"+workTime.getGroupId()+"format.serialId:"+workTime.getSerialId());
int workminsNew = 0;
if (workTime != null) { if (workTime != null) {
lsSignTime = workTime.getSignTime();//允许打卡时间 lsSignTime = workTime.getSignTime();//允许打卡时间
lsWorkTime = workTime.getWorkTime();//工作时间 lsWorkTime = workTime.getWorkTime();//工作时间
lsRestTime = workTime.getRestTime();//休息时段时间 lsRestTime = workTime.getRestTime();//休息时段时间
oneSign = lsWorkTime!=null&&lsWorkTime.size()==1; oneSign = lsWorkTime!=null&&lsWorkTime.size()==1;
workminsNew = workTime.getWorkMins();
} }
int[] dayMins = new int[2880];//一天所有分钟数 int[] dayMins = new int[2880];//一天所有分钟数
@ -820,6 +873,7 @@ public class KQFormatData extends BaseBean {
kqShiftRuleEntity.setForgotBeginWorkCheckMins(forgotBeginWorkCheckMins); kqShiftRuleEntity.setForgotBeginWorkCheckMins(forgotBeginWorkCheckMins);
kqShiftRuleEntity.setEarlyInMins(earlyInMins); kqShiftRuleEntity.setEarlyInMins(earlyInMins);
kqShiftRuleEntity.setLateOutMins(lateOutMins); kqShiftRuleEntity.setLateOutMins(lateOutMins);
kqShiftRuleEntity.setNosign_is_absent(nosign_is_absent);
kqLog.info("人性化规则处理前数据" + JSONObject.toJSONString(kqShiftRuleEntity)); kqLog.info("人性化规则处理前数据" + JSONObject.toJSONString(kqShiftRuleEntity));
bb.writeLog("人性化规则处理前数据: " + JSONObject.toJSONString(kqShiftRuleEntity)); bb.writeLog("人性化规则处理前数据: " + JSONObject.toJSONString(kqShiftRuleEntity));
@ -874,7 +928,7 @@ public class KQFormatData extends BaseBean {
forgotCheckMins = 0; forgotCheckMins = 0;
} }
if (workTime.getIsExclude()) {//无需考勤人员没有异常状态 if (workminsNew == 0 || workTime.getIsExclude()) {//无需考勤人员没有异常状态
beLateMins = 0; beLateMins = 0;
graveBeLateMins = 0; graveBeLateMins = 0;
leaveEarlyMins = 0; leaveEarlyMins = 0;
@ -914,9 +968,28 @@ public class KQFormatData extends BaseBean {
if("0".equals(nosign_is_absent)) { if("0".equals(nosign_is_absent)) {
attendanceMins = attendanceMins-forgotCheckMins-forgotBeginWorkCheckMins; attendanceMins = attendanceMins-forgotCheckMins-forgotBeginWorkCheckMins;
} }
if(workminsNew == 0) {
attendanceMins = 0;
workMins = 0;
}
if(beforeBegin || attendanceMins < 0) {//还未到上班时间,不用计算任何状体 if(beforeBegin || attendanceMins < 0) {//还未到上班时间,不用计算任何状体
attendanceMins = 0; attendanceMins = 0;
} }
/**
*
*
*/
String nosign_ishandle = Util.null2String(kqShiftRuleEntity.getNosign_ishandle());
if("1".equals(nosign_ishandle)){
forgotCheckMins = 0;
}else if("2".equals(nosign_ishandle)){
forgotCheckMins = 0;
forgotBeginWorkCheckMins = 0;
}
kqLog.info("实际出勤计算公式" + "实际出勤=应出勤- 旷工-请假-迟到-早退 userId" + userId + "kqDate==" + kqDate+":hostIps:"+hostIps+":uuid::"+uuid); kqLog.info("实际出勤计算公式" + "实际出勤=应出勤- 旷工-请假-迟到-早退 userId" + userId + "kqDate==" + kqDate+":hostIps:"+hostIps+":uuid::"+uuid);
kqLog.info("实际出勤计算结果" + attendanceMins + "=" + workMins + "- " + absenteeismMins + "-" + leaveMins + "-" + (beLateMins + graveBeLateMins) + "-" + (leaveEarlyMins - graveLeaveEarlyMins)+" userId" + userId + "kqDate==" + kqDate+":hostIps:"+hostIps+":uuid::"+uuid); kqLog.info("实际出勤计算结果" + attendanceMins + "=" + workMins + "- " + absenteeismMins + "-" + leaveMins + "-" + (beLateMins + graveBeLateMins) + "-" + (leaveEarlyMins - graveLeaveEarlyMins)+" userId" + userId + "kqDate==" + kqDate+":hostIps:"+hostIps+":uuid::"+uuid);
bb.writeLog("实际出勤计算结果" + attendanceMins + "=" + workMins + "- " + absenteeismMins + "-" + leaveMins + "-" + (beLateMins + graveBeLateMins) + "-" + (leaveEarlyMins - graveLeaveEarlyMins)+" userId" + userId + "kqDate==" + kqDate+":hostIps:"+hostIps); bb.writeLog("实际出勤计算结果" + attendanceMins + "=" + workMins + "- " + absenteeismMins + "-" + leaveMins + "-" + (beLateMins + graveBeLateMins) + "-" + (leaveEarlyMins - graveLeaveEarlyMins)+" userId" + userId + "kqDate==" + kqDate+":hostIps:"+hostIps);
@ -942,76 +1015,192 @@ public class KQFormatData extends BaseBean {
/*考勤二开--零点补助start*/ /*考勤二开--零点补助start*/
int zeroPointSub = 0; int zeroPointSub = 0;
// 判断是否关账
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
Map<String, Object> groupMap = new HashMap<>(); int userSubCompany1 = 0;
String acqSql = "select kqgroup, grouptype from uf_ZeroPointSubSft"; int userDepartment = 0;
rs.executeQuery(acqSql); if (userSubCompany1 <= 0 || userDepartment <= 0) {
while (rs.next()) { rs.execute("select departmentid, subcompanyid1 from hrmresource where id = " + userId);
String kqgroup = Util.null2String(rs.getString("kqgroup")); if (rs.next()) {
String grouptype = Util.null2String(rs.getString("grouptype")); userSubCompany1 = rs.getInt("subcompanyid1");
if (StringUtils.isNotBlank(kqgroup) && StringUtils.isNotBlank(grouptype)) { userDepartment = rs.getInt("departmentid");
groupMap.put(grouptype, kqgroup); }
}
String gzSql = "select count(*) as cnt from uf_kqfz where (','+CAST(bm AS varchar(max))+',' like '%,'+CAST("+userDepartment+" AS varchar(10))+',%' " +
"or ','+CAST(fb AS varchar(max))+',' like '%,'+CAST("+userSubCompany1+" AS varchar(10))+',%') and fczt = 1 and fzksrq <= '" + kqDate +"' and fzjsrq >= '" + kqDate + "'";
rs.execute(gzSql);
boolean isClose = false;
if (rs.next()) {
int cnt = rs.getInt("cnt");
if (cnt > 0) {
isClose = true;
} }
} }
bb.writeLog("groupMap: " + groupMap); if (!isClose) {
bb.writeLog("groupid: " + groupid); Map<String, Object> groupMap = new HashMap<>();
String acqSql = "select kqgroup, grouptype from uf_ZeroPointSubSft";
rs.executeQuery(acqSql);
while (rs.next()) {
String kqgroup = Util.null2String(rs.getString("kqgroup"));
String grouptype = Util.null2String(rs.getString("grouptype"));
if (StringUtils.isNotBlank(kqgroup) && StringUtils.isNotBlank(grouptype)) {
groupMap.put(grouptype, kqgroup);
}
}
// bb.writeLog("groupMap: " + groupMap);
bb.writeLog("groupid: " + groupid);
for (int j = 0; lsCheckInfo != null && j < lsCheckInfo.size(); j++) { //获取夜班班次
Map<String, Object> checkInfo = (Map<String, Object>) lsCheckInfo.get(j); List<String> nightShiftList = new ArrayList<>();
if ("2".equals(checkInfo.get("signType"))) {//签退 String acqNightShiftSql = "select shift from uf_nightshiftmanage where isdelete is null or isdelete = 0";
String signDate = Util.null2String(checkInfo.get("signDate")); rs.executeQuery(acqNightShiftSql);
String signTime = Util.null2String(checkInfo.get("signTime")); while (rs.next()) {
bb.writeLog("signDate: " + signDate); String shift = Util.null2String(rs.getString("shift"));
bb.writeLog("signTime: " + signTime); if (StringUtils.isNotBlank(shift)) {
nightShiftList.add(shift);
}
if (groupMap != null && groupMap.size() > 0) { }
for (String grouptype : groupMap.keySet()) {
bb.writeLog("grouptype: " + grouptype); boolean offGood = false;
if ("0".equals(grouptype)) {//责任制--23点 boolean inGood = false;
String kqgroups = Util.null2String(groupMap.get(grouptype)); if (StringUtils.isEmpty(serialid)) {
bb.writeLog("kqgroups: " + kqgroups); serialid = "0";
List<String> groupList = Arrays.asList(kqgroups.split(",")); }
bb.writeLog("groupList: " + groupList); if (CollectionUtils.isEmpty(nightShiftList) || !nightShiftList.contains(serialid)) {
if(groupList.contains(groupid)) { for (int j = 0; lsCheckInfo != null && j < lsCheckInfo.size(); j++) {
//23:00 bb.writeLog("lsCheckInfo is:" + JSONObject.toJSONString(lsCheckInfo));
if (signTime.length() == 5) { Map<String, Object> checkInfo = (Map<String, Object>) lsCheckInfo.get(j);
signTime = signTime + ":00"; if ("2".equals(checkInfo.get("signType")) && !offGood) {//签退
} String signStatus = Util.null2String(checkInfo.get("signStatus"));
String subsidyTime = kqDate + " 23:00:00"; if (StringUtils.isEmpty(signStatus) || !signStatus.equalsIgnoreCase(ButtonStatusEnum.NORMAL.getStatusCode())) {
bb.writeLog("subsidyTime: " + subsidyTime); continue;
String outTime = signDate + " " + signTime; }
bb.writeLog("outTime: " + outTime); String signDate = Util.null2String(checkInfo.get("signDate"));
if (outTime.compareTo(subsidyTime) > 0 ) { String signTime = Util.null2String(checkInfo.get("signTime"));
zeroPointSub = 1; // bb.writeLog("signDate: " + signDate);
// bb.writeLog("signTime: " + signTime);
if (groupMap != null && groupMap.size() > 0) {
for (String grouptype : groupMap.keySet()) {
// bb.writeLog("grouptype: " + grouptype);
// if ("0".equals(grouptype)) {//责任制--23点
// String kqgroups = Util.null2String(groupMap.get(grouptype));
// bb.writeLog("kqgroups: " + kqgroups);
// List<String> groupList = Arrays.asList(kqgroups.split(","));
// bb.writeLog("groupList: " + groupList);
// if(groupList.contains(groupid)) {
// //23:00
// if (signTime.length() == 5) {
// signTime = signTime + ":00";
// }
// String subsidyTime = kqDate + " 23:00:00";
// bb.writeLog("subsidyTime: " + subsidyTime);
// String outTime = signDate + " " + signTime;
// bb.writeLog("outTime: " + outTime);
// if (outTime.compareTo(subsidyTime) > 0 ) {
// zeroPointSub = 1;
// }
// }
// }
if ("0".equals(grouptype)) {//责任制--00点
String kqgroups = Util.null2String(groupMap.get(grouptype));
// bb.writeLog("kqgroups: " + kqgroups);
List<String> groupList = Arrays.asList(kqgroups.split(","));
// bb.writeLog("groupList: " + groupList);
if (groupList.contains(groupid)) {
//00:00
if (signTime.length() == 5) {
signTime = signTime + ":00";
}
// LocalDate date = LocalDate.parse(kqDate, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
// LocalDate localDate = date.plusDays(1);
// String kqDateNew = localDate.toString();
String subsidyTime = kqDate + " 23:00:00";
bb.writeLog("subsidyTime: " + subsidyTime);
String outTime = signDate + " " + signTime;
bb.writeLog("outTime: " + outTime);
if (outTime.compareTo(subsidyTime) > 0) {
offGood = true;
}
}
} }
} }
} }
if ("1".equals(grouptype)) {//排班制--00点 }
String kqgroups = Util.null2String(groupMap.get(grouptype));
bb.writeLog("kqgroups: " + kqgroups); if ("1".equals(checkInfo.get("signType")) && !inGood) {//签到
List<String> groupList = Arrays.asList(kqgroups.split(",")); String signStatus = Util.null2String(checkInfo.get("signStatus"));
bb.writeLog("groupList: " + groupList); if (StringUtils.isEmpty(signStatus) || !signStatus.equalsIgnoreCase(ButtonStatusEnum.NORMAL.getStatusCode())) {
if(groupList.contains(groupid)) { continue;
//00:00 }
if (signTime.length() == 5) { String signDate = Util.null2String(checkInfo.get("signDate"));
signTime = signTime + ":00"; String signTime = Util.null2String(checkInfo.get("signTime"));
} bb.writeLog("signDate: " + signDate);
LocalDate date = LocalDate.parse(kqDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")); bb.writeLog("signTime: " + signTime);
LocalDate localDate = date.plusDays(1);
String kqDateNew = localDate.toString(); if (groupMap != null && groupMap.size() > 0) {
String subsidyTime = kqDateNew + " 00:00:00"; for (String grouptype : groupMap.keySet()) {
bb.writeLog("subsidyTime: " + subsidyTime); bb.writeLog("grouptype: " + grouptype);
String outTime = signDate + " " + signTime; if ("0".equals(grouptype)) {//责任制--23点
bb.writeLog("outTime: " + outTime); String kqgroups = Util.null2String(groupMap.get(grouptype));
if (outTime.compareTo(subsidyTime) > 0 ) { bb.writeLog("kqgroups: " + kqgroups);
zeroPointSub = 1; List<String> groupList = Arrays.asList(kqgroups.split(","));
bb.writeLog("groupList: " + groupList);
if (groupList.contains(groupid)) {
//23:00
if (signTime.length() == 5) {
signTime = signTime + ":00";
}
String subsidyTime = kqDate + " 08:30:00";
bb.writeLog("subsidyTime: " + subsidyTime);
String inTime = signDate + " " + signTime;
bb.writeLog("inTime: " + inTime);
if (subsidyTime.compareTo(inTime) > 0) {
inGood = true;
}
}
} }
// if ("1".equals(grouptype)) {//排班制--00点
// String kqgroups = Util.null2String(groupMap.get(grouptype));
// bb.writeLog("kqgroups: " + kqgroups);
// List<String> groupList = Arrays.asList(kqgroups.split(","));
// bb.writeLog("groupList: " + groupList);
// if(groupList.contains(groupid)) {
// //00:00
// if (signTime.length() == 5) {
// signTime = signTime + ":00";
// }
// LocalDate date = LocalDate.parse(kqDate, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
// LocalDate localDate = date.plusDays(1);
// String kqDateNew = localDate.toString();
// String subsidyTime = kqDateNew + " 00:00:00";
// bb.writeLog("subsidyTime: " + subsidyTime);
// String outTime = signDate + " " + signTime;
// bb.writeLog("outTime: " + outTime);
// if (outTime.compareTo(subsidyTime) > 0 ) {
// zeroPointSub = 1;
// }
// }
// }
} }
} }
} }
} }
} }
if (offGood && inGood) {
zeroPointSub = 1;
}
} else {
rs.executeQuery("select zeropoint from kq_format_total where resourceid = ? and kqdate = ?", userId, kqDate);
if (rs.next()) {
String value = rs.getString("zeropoint");
if (StringUtils.isEmpty(value)) {
value = "0";
}
zeroPointSub = Integer.parseInt(value);
}
} }
bb.writeLog("zeroPointSub: " + zeroPointSub); bb.writeLog("zeroPointSub: " + zeroPointSub);
/*考勤二开--零点补助end*/ /*考勤二开--零点补助end*/

@ -25,7 +25,9 @@ import weaver.hrm.User;
import weaver.systeminfo.SystemEnv; import weaver.systeminfo.SystemEnv;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
@ -144,7 +146,7 @@ public class PunchOutButtonCmd extends AbstractCommonCommand<Map<String, Object>
KQWorkTime kqWorkTime = new KQWorkTime(); KQWorkTime kqWorkTime = new KQWorkTime();
WorkTimeEntity workTimeEntity = kqWorkTime.getWorkTime(user.getUID()+"", signDate); WorkTimeEntity workTimeEntity = kqWorkTime.getWorkTime(user.getUID()+"", signDate);
String userinfo = "#userid#"+user.getUID()+"#getUserSubCompany1#"+user.getUserSubCompany1()+"#getUserSubCompany1#"+user.getUserDepartment() String userinfo = "#userid#"+user.getUID()+"#getUserSubCompany1#"+user.getUserSubCompany1()+"#getUserSubCompany1#"+user.getUserDepartment()
+"#getJobtitle#"+user.getJobtitle(); +"#getJobtitle#"+user.getJobtitle();
workTimeEntityLogMap.put("resourceid", userinfo); workTimeEntityLogMap.put("resourceid", userinfo);
workTimeEntityLogMap.put("splitDate", signDate); workTimeEntityLogMap.put("splitDate", signDate);
workTimeEntityLogMap.put("workTimeEntity", workTimeEntity); workTimeEntityLogMap.put("workTimeEntity", workTimeEntity);
@ -173,7 +175,7 @@ public class PunchOutButtonCmd extends AbstractCommonCommand<Map<String, Object>
return ; return ;
} }
String mobile_sign_sql = "insert into mobile_sign(operater,operate_type,operate_date,operate_time,longitude,latitude,address,remark,attachment,crm,timezone) " String mobile_sign_sql = "insert into mobile_sign(operater,operate_type,operate_date,operate_time,longitude,latitude,address,remark,attachment,crm,timezone) "
+ " values(?,?,?,?,?,?,?,?,?,?,?) "; + " values(?,?,?,?,?,?,?,?,?,?,?) ";
rs1.executeUpdate(mobile_sign_sql, userId,signfrom,signDate,signTime,longitude,latitude,address,remark,attachment,crm,timeZone); rs1.executeUpdate(mobile_sign_sql, userId,signfrom,signDate,signTime,longitude,latitude,address,remark,attachment,crm,timeZone);
logMap.put("outsidesign", outsidesign); logMap.put("outsidesign", outsidesign);
@ -261,9 +263,9 @@ public class PunchOutButtonCmd extends AbstractCommonCommand<Map<String, Object>
} }
deviceInfo = deviceInfo.replaceAll("\\?", ""); deviceInfo = deviceInfo.replaceAll("\\?", "");
String punchSql = "insert into HrmScheduleSign(userId,userType,signType,signDate,signTime,clientAddress,isInCom,timeZone,belongdate,signfrom,longitude,latitude,addr,deviceInfo) "+ String punchSql = "insert into HrmScheduleSign(userId,userType,signType,signDate,signTime,clientAddress,isInCom,timeZone,belongdate,signfrom,longitude,latitude,addr,deviceInfo) "+
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
boolean isok = rs.executeUpdate(punchSql,userId,userType,signType,signDate,signTime,clientAddress,isInCom, boolean isok = rs.executeUpdate(punchSql,userId,userType,signType,signDate,signTime,clientAddress,isInCom,
timeZone,belongdate,signfrom,longitude,latitude,address,deviceInfo); timeZone,belongdate,signfrom,longitude,latitude,address,deviceInfo);
logMap.put("punchSql", punchSql); logMap.put("punchSql", punchSql);
logMap.put("punchSql_isok", isok); logMap.put("punchSql_isok", isok);
@ -289,133 +291,264 @@ public class PunchOutButtonCmd extends AbstractCommonCommand<Map<String, Object>
bb.writeLog("params: " + params); bb.writeLog("params: " + params);
bb.writeLog("signdate: " + signDate); bb.writeLog("signdate: " + signDate);
//先判断是否有外出出差流程 //先判断是否有外出出差流程
String evectionTableName = Util.null2String(bb.getPropValue("project_hostar","evectionTableName")); String evectionTableName = Util.null2String(bb.getPropValue("project_hostar", "evectionTableName"));
String outTableName = Util.null2String(bb.getPropValue("project_hostar","outTableName")); String outTableName = Util.null2String(bb.getPropValue("project_hostar", "outTableName"));
if ( StringUtils.isNotBlank(evectionTableName) && StringUtils.isNotBlank(outTableName) ) { if (StringUtils.isNotBlank(evectionTableName) && StringUtils.isNotBlank(outTableName)) {
Integer number = -1; Integer number = 0;
String sqlDate = ""; String sqlDate = "";
if (StringUtils.isNotBlank(belongdate)) { if (StringUtils.isNotBlank(belongdate)) {
sqlDate = belongdate; sqlDate = belongdate;
} else { } else {
sqlDate = signDate; sqlDate = signDate;
} }
String acqEvecAndOutSql = " select sum(a.number) as number " + // String acqEvecAndOutSql = " SELECT count(*) as number FROM workflow_requestbase WHERE requestid IN " +
" from ( " + // "( SELECT requestid FROM " + evectionTableName + " WHERE (sjccr = '" + userId + "' or ','+CAST(nbtxr AS varchar(max))+',' like '%,'+CAST("
" SELECT " + // +userId+" AS varchar(10))+',%') and ksrq <='" + sqlDate + "' and (((sjjsrq is null or sjjsrq = '') and yjjsrq >= '"
" count(*) as number " + // + sqlDate + "') or (sjjsrq is not null and sjjsrq != '' and sjjsrq >= '" + sqlDate + "'))) ";
" FROM " + String acqEvecAndOutSql = " SELECT requestid,kssj FROM " + evectionTableName + " WHERE (sjccr = '" + userId + "' or ','+CAST(nbtxr AS varchar(max))+',' like '%,'+CAST("
" workflow_requestbase " + + userId + " AS varchar(10))+',%') and ksrq <='" + sqlDate + "' and (((sjjsrq is null or sjjsrq = '') and yjjsrq >= '"
" WHERE " + + sqlDate + "') or (sjjsrq is not null and sjjsrq != '' and sjjsrq >= '" + sqlDate + "')) ";
" requestid IN ( SELECT requestid FROM " + evectionTableName + " WHERE (sqr = '" + userId + "' or ','+CAST(nbtxr AS varchar(max))+',' like '%,'+CAST("+userId+" AS varchar(10))+',%') and ksrq <='" + sqlDate + "' and (((sjjsrq is null or sjjsrq = '') and yjjsrq >= '" + sqlDate + "') or (sjjsrq is not null and sjjsrq != '' and sjjsrq >= '" + sqlDate + "'))) " +
// " AND currentnodetype = 3 " + // " AND currentnodetype = 3 " +
" UNION all " + // " UNION all " +
" SELECT " + // " SELECT " +
" count(*) as number " + // " count(*) as number " +
" FROM " + // " FROM " +
" workflow_requestbase " + // " workflow_requestbase " +
" WHERE " + // " WHERE " +
" requestid IN ( SELECT requestid FROM " + outTableName + " WHERE (sqr = '" + userId + "' or ','+CAST(nbtxr AS varchar(max))+',' like '%,'+CAST("+userId+" AS varchar(10))+',%') and ksrq <='" + sqlDate + "' and (((sjjsrq is null or sjjsrq = '') and yjjsrq >= '" + sqlDate + "') or (sjjsrq is not null and sjjsrq != '' and sjjsrq >= '" + sqlDate + "'))) " + // " requestid IN ( SELECT requestid FROM " + outTableName + " WHERE (sjccr = '" + userId + "' or ','+CAST(nbtxr AS varchar(max))+',' like '%,'+CAST("+userId+" AS varchar(10))+',%') and ksrq <='" + sqlDate + "' and (((sjjsrq is null or sjjsrq = '') and yjjsrq >= '" + sqlDate + "') or (sjjsrq is not null and sjjsrq != '' and sjjsrq >= '" + sqlDate + "'))) " +
// " AND currentnodetype = 3 " + //// " AND currentnodetype = 3 " +
") a "; // ") a ";
bb.writeLog("acqEvecAndOutSql: " + acqEvecAndOutSql); bb.writeLog("acqEvecAndOutSql: " + acqEvecAndOutSql);
rs.executeQuery(acqEvecAndOutSql); rs.executeQuery(acqEvecAndOutSql);
// 定义时间格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
while (rs.next()) { while (rs.next()) {
number = Util.getIntValue(Util.null2String(rs.getString("number"))); number = number + 1;
// String requestid = rs.getString("requestid");
// String kssj = rs.getString("kssj");
// if (StringUtils.isEmpty(requestid) || StringUtils.isEmpty(kssj)) {
// continue;
// }
// if (kssj.length() < 8) {
// kssj = kssj + ":00";
// }
//
// // 解析时间字符串为 LocalTime 对象
// LocalTime oldkssj = LocalTime.parse(kssj, formatter);
// LocalTime minKssj = LocalTime.parse("01:00:00", formatter);
// if (oldkssj.isBefore(minKssj)) {
// number = number + 1;
// continue;
// }
// // 减去一小时
// LocalTime previousHour = oldkssj.minusHours(1);
// LocalTime signTimeLt = LocalTime.parse(signTime, formatter);
// if (!signTimeLt.isBefore(previousHour)) {
// number = number + 1;
// }
} }
bb.writeLog("number: " + number); bb.writeLog("number: " + number);
if (number > 0) { if (number > 0) {
boolean isInIp = true; // 判断是否关账
String userType = user.getLogintype(); int userSubCompany1 = user.getUserSubCompany1();
String signType = "on".equalsIgnoreCase(type) ? "1" : "2"; int userDepartment = user.getUserDepartment();
String clientAddress = Util.getIpAddr(request); if (userSubCompany1 <= 0 || userDepartment <= 0) {
String isInCom = isInIp ? "1" : "0"; rs.execute("select departmentid, subcompanyid1 from hrmresource where id = " + userId);
JSONObject jsonObject = null; if (rs.next()) {
String deviceInfo = Util.null2String(params.get("deviceInfo")); userSubCompany1 = rs.getInt("subcompanyid1");
if(deviceInfo.length() > 0){ userDepartment = rs.getInt("departmentid");
jsonObject = JSON.parseObject(deviceInfo);
JSONObject jsonObject1 = new JSONObject();
Set<Entry<String, Object>> jsonSet = jsonObject.entrySet();
for(Entry<String, Object> js : jsonSet){
String key = js.getKey();
String value = Util.null2String(js.getValue());
jsonObject1.put(key, value);
} }
if(!jsonObject1.isEmpty()){ }
deviceInfo = jsonObject1.toJSONString(); String sqlDateA = "";
if (StringUtils.isNotBlank(belongdate)) {
sqlDateA = belongdate;
} else {
sqlDateA = signDate;
}
String gzSql = "select count(*) as cnt from uf_kqfz where (','+CAST(bm AS varchar(max))+',' like '%,'+CAST("+userDepartment+" AS varchar(10))+',%' " +
"or ','+CAST(fb AS varchar(max))+',' like '%,'+CAST("+userSubCompany1+" AS varchar(10))+',%') and fczt = 1 and fzksrq <= '" + sqlDateA +"' and fzjsrq >= '" + sqlDateA + "'";
rs.execute(gzSql);
boolean isClose = false;
if (rs.next()) {
int cnt = rs.getInt("cnt");
if (cnt > 0) {
isClose = true;
} }
} }
if (!isClose) {
boolean isInIp = true;
String userType = user.getLogintype();
String signType = "on".equalsIgnoreCase(type) ? "1" : "2";
String clientAddress = Util.getIpAddr(request);
String isInCom = isInIp ? "1" : "0";
JSONObject jsonObject = null;
String deviceInfo = Util.null2String(params.get("deviceInfo"));
if (deviceInfo.length() > 0) {
jsonObject = JSON.parseObject(deviceInfo);
JSONObject jsonObject1 = new JSONObject();
Set<Entry<String, Object>> jsonSet = jsonObject.entrySet();
for (Entry<String, Object> js : jsonSet) {
String key = js.getKey();
String value = Util.null2String(js.getValue());
jsonObject1.put(key, value);
}
if (!jsonObject1.isEmpty()) {
deviceInfo = jsonObject1.toJSONString();
}
}
String punchSql = "insert into HrmScheduleSign(userId,userType,signType,signDate,signTime,clientAddress,isInCom,timeZone,belongdate,signfrom,longitude,latitude,addr,deviceInfo,isdev) "+ String punchSql = "insert into HrmScheduleSign(userId,userType,signType,signDate,signTime,clientAddress,isInCom,timeZone,belongdate,signfrom,longitude,latitude,addr,deviceInfo,isdev) " +
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
boolean isok = rs.executeUpdate(punchSql,userId,userType,signType,signDate,signTime,clientAddress,isInCom, boolean isok = rs.executeUpdate(punchSql, userId, userType, signType, signDate, signTime, clientAddress, isInCom,
timeZone,belongdate,signfrom,longitude,latitude,address,deviceInfo,"1"); timeZone, belongdate, signfrom, longitude, latitude, address, deviceInfo, "1");
bb.writeLog("isok: " + isok); bb.writeLog("isok: " + isok);
//自动对班 //自动对班
kqLog.info("PunchOutButtonCmd.format in >>>>>userId" + userId + "kqDate==" + signDate+"format.groupId:"+groupid+"format.serialId:"+workTimeEntity.getSerialId()); kqLog.info("PunchOutButtonCmd.format in >>>>>userId" + userId + "kqDate==" + signDate + "format.groupId:" + groupid + "format.serialId:" + workTimeEntity.getSerialId());
//责任制考勤组id收集 //责任制考勤组id收集
rs.executeQuery("select kqzid from uf_zrzkqz"); rs.executeQuery("select kqzid from uf_zrzkqz");
while (rs.next()){ while (rs.next()) {
LIST.add(Util.null2String(rs.getString("kqzid"))); LIST.add(Util.null2String(rs.getString("kqzid")));
}
kqLog.info("PunchOutButtonCmd.LIST"+LIST);
if(LIST.contains(groupid)) {
RecordSet rt = new RecordSet();
boolean b;
BaseBean bb= new BaseBean();
//休息日或节假日给休息班次
//int changeType = KQOvertimeRulesBiz.getChangeType(Util.null2String(userId), signDate);
String fixedSerialid = Util.null2String(bb.getPropValue("project_hostar", "fixedSerialid"));
String defaultSerialid = Util.null2String(bb.getPropValue("project_hostar", "defaultSerialid"));
String weekendDefaultSerialid = Util.null2String(bb.getPropValue("project_hostar", "weekendDefaultSerialid"));
String holidayDefaultSerialid = Util.null2String(bb.getPropValue("project_hostar", "holidayDefaultSerialid"));
String fixedUserId = "";
//查询指定和考勤组成员
String query_sql = "select distinct typevalue from kq_groupmember where groupid = ? ";
rs.executeQuery(query_sql,fixedSerialid);
if (rs.next()) {
fixedUserId = rs.getString("typevalue");
} }
boolean holiday = KQHolidaySetBiz.isHoliday(fixedUserId, signDate,true); kqLog.info("PunchOutButtonCmd.LIST" + LIST);
kqLog.info("format.holiday:" + holiday); if (LIST.contains(groupid)) {
//String sql = "insert into kq_shiftschedule(kqdate,serialid,resourceid,groupid,isdelete)values(?,?,?,?,?)"; RecordSet rt = new RecordSet();
String sql = "update kq_shiftschedule set serialid = ? where resourceid = ? and kqdate= ? and groupid = ? and isdelete = 0 "; boolean b;
//考勤当天是节假日或者休息日 BaseBean bb = new BaseBean();
if (holiday) { //休息日或节假日给休息班次
//节假日休息班 //int changeType = KQOvertimeRulesBiz.getChangeType(Util.null2String(userId), signDate);
b = rt.executeUpdate(sql, signDate, holidayDefaultSerialid, Util.null2String(userId),signDate,groupid); String fixedSerialid = Util.null2String(bb.getPropValue("project_hostar", "fixedSerialid"));
kqLog.info("PunchOutButtonCmd.b1:" + b); String defaultSerialid = Util.null2String(bb.getPropValue("project_hostar", "defaultSerialid"));
}else{ String weekendDefaultSerialid = Util.null2String(bb.getPropValue("project_hostar", "weekendDefaultSerialid"));
//周末休息班 String holidayDefaultSerialid = Util.null2String(bb.getPropValue("project_hostar", "holidayDefaultSerialid"));
String fixedUserId = "";
//查询指定和考勤组成员
String query_sql = "select distinct typevalue from kq_groupmember where groupid = ? ";
rs.executeQuery(query_sql, fixedSerialid);
if (rs.next()) {
fixedUserId = rs.getString("typevalue");
}
boolean holiday = KQHolidaySetBiz.isHoliday(fixedUserId, signDate, true);
kqLog.info("format.holiday:" + holiday);
//String sql = "insert into kq_shiftschedule(kqdate,serialid,resourceid,groupid,isdelete)values(?,?,?,?,?)";
String sql = "update kq_shiftschedule set serialid = ? where resourceid = ? and kqdate= ? and groupid = ? and isdelete = 0 ";
//考勤当天是节假日或者休息日
if (holiday) {
//节假日休息班
b = rt.executeUpdate(sql, signDate, holidayDefaultSerialid, Util.null2String(userId), signDate, groupid);
kqLog.info("PunchOutButtonCmd.b1:" + b);
} else {
//周末休息班
// if(DateUtil.getWeek(signDate) == 6 || DateUtil.getWeek(signDate) == 7){ // if(DateUtil.getWeek(signDate) == 6 || DateUtil.getWeek(signDate) == 7){
// b = rt.executeUpdate(sql,weekendDefaultSerialid, Util.null2String(userId), signDate,groupid); // b = rt.executeUpdate(sql,weekendDefaultSerialid, Util.null2String(userId), signDate,groupid);
// kqLog.info("PunchOutButtonCmd.b2:"+b); // kqLog.info("PunchOutButtonCmd.b2:"+b);
// }else{ // }else{
//设置考勤班次为对应班次 //设置考勤班次为对应班次
b = rt.executeUpdate(sql,defaultSerialid, Util.null2String(userId), signDate,groupid); b = rt.executeUpdate(sql, defaultSerialid, Util.null2String(userId), signDate, groupid);
kqLog.info("PunchOutButtonCmd.b3:"+b); kqLog.info("PunchOutButtonCmd.b3:" + b);
//} //}
}
} }
} //同步更新考勤数据到考勤报表
//同步更新考勤数据到考勤报表 if (belongdateIsNull) {
if(belongdateIsNull){ //外勤签到没有归属日期,遇到跨天班次打卡可能归属前一天,需要格式化前一天考勤
//外勤签到没有归属日期,遇到跨天班次打卡可能归属前一天,需要格式化前一天考勤 bb.writeLog("PunchOutButtonCmd:userId:" + userId + ":belongdate:" + DateUtil.getYesterday());
bb.writeLog("PunchOutButtonCmd:userId:"+userId+":belongdate:"+DateUtil.getYesterday()); new KQFormatBiz().formatDate("" + userId, DateUtil.getYesterday());
new KQFormatBiz().formatDate(""+userId,DateUtil.getYesterday()); }
} bb.writeLog("PunchOutButtonCmd:userId:" + userId + ":belongdate:" + (belongdate.length() == 0 ? DateUtil.getCurrentDate() : belongdate));
bb.writeLog("PunchOutButtonCmd:userId:"+userId+":belongdate:"+(belongdate.length() == 0 ? DateUtil.getCurrentDate() : belongdate)); // if(belongdate.length()==0){
if(belongdate.length()==0){
//外勤签到没有归属日期,遇到跨天班次打卡可能归属前一天,需要格式化前一天考勤 //外勤签到没有归属日期,遇到跨天班次打卡可能归属前一天,需要格式化前一天考勤
new KQFormatBiz().formatDate(""+userId,DateUtil.getYesterday()); new KQFormatBiz().formatDate("" + userId, DateUtil.getYesterday());
// }
new KQFormatBiz().formatDate("" + userId, (belongdate.length() == 0 ? DateUtil.getCurrentDate() : belongdate));
//外勤签到转的考勤 处理加班规则
SplitActionUtil.pushOverTimeTasksAll(belongdate, belongdate, "" + userId);
SplitActionUtil.pushOverTimeTasksAll(signDate, signDate, "" + userId);
LocalDate specifiedDate = LocalDate.parse(signDate, dateFormatter);
SplitActionUtil.pushOverTimeTasksAll(specifiedDate.minusDays(1).toString(), specifiedDate.minusDays(1).toString(), "" + userId);
if (StringUtils.isNotEmpty(belongdate) && !StringUtils.equals(belongdate, signData)) {
LocalDate specifiedDateA = LocalDate.parse(belongdate, dateFormatter);
SplitActionUtil.pushOverTimeTasksAll(specifiedDateA.minusDays(1).toString(), specifiedDateA.minusDays(1).toString(), "" + userId);
}
} else {
bb.writeLog("已关账.");
String acqSql = "select id from mobile_sign where operater = ? and operate_date = ? and operate_time = ? ";
rs.executeQuery(acqSql, userId, signDate, signTime);
RecordSet rsTz = new RecordSet();
while (rs.next()) {
String id = Util.null2String(rs.getString("id"));
if (StringUtils.isNotBlank(id)) {
//整理原始打卡信息
Map<String, Object> signInfo = new HashMap<>();
boolean isInIp = true;
String userType = user.getLogintype();
String signType = "on".equalsIgnoreCase(type) ? "1" : "2";
String clientAddress = Util.getIpAddr(request);
String isInCom = isInIp ? "1" : "0";
JSONObject jsonObject = null;
String deviceInfo = Util.null2String(params.get("deviceInfo"));
if (deviceInfo.length() > 0) {
jsonObject = JSON.parseObject(deviceInfo);
JSONObject jsonObject1 = new JSONObject();
Set<Entry<String, Object>> jsonSet = jsonObject.entrySet();
for (Entry<String, Object> js : jsonSet) {
String key = js.getKey();
String value = Util.null2String(js.getValue());
jsonObject1.put(key, value);
}
if (!jsonObject1.isEmpty()) {
deviceInfo = jsonObject1.toJSONString();
}
}
signInfo.put("userId", userId);
signInfo.put("userType", userType);
signInfo.put("signType", signType);
signInfo.put("signDate", signDate);
signInfo.put("signTime", signTime);
signInfo.put("clientAddress", clientAddress);
signInfo.put("isInCom", isInCom);
signInfo.put("timeZone", timeZone);
signInfo.put("belongdate", belongdate);
signInfo.put("signfrom", signfrom);
signInfo.put("longitude", longitude);
signInfo.put("latitude", latitude);
signInfo.put("address", address);
signInfo.put("deviceInfo", deviceInfo);
signInfo.put("isdev", "1");
signInfo.put("belongdateIsNull", belongdateIsNull);
String signInfoString = signInfo.toString();
String outSignTypeModeId = bb.getPropValue("project_hostar", "outSignTypeModeId");
Integer modedatacreater = 1;
Integer modedatacreatertype = 0;
String modedatacreatedate = cn.hutool.core.date.DateUtil.format(new Date(), "yyyy-MM-dd");
String modedatacreatetime = cn.hutool.core.date.DateUtil.format(new Date(), "HH:mm:ss");
String abnUuid = UUID.randomUUID().toString();
String syncSql = "insert into uf_outsigntype (outsignid, signinfo, formmodeid, modedatacreater, " +
"modedatacreatertype, modedatacreatedate, modedatacreatetime, MODEUUID) values (?, ?, ?, ?, ?, ?, ?, ?)";
boolean b = rsTz.executeUpdate(syncSql, id, signInfoString, outSignTypeModeId, modedatacreater, modedatacreatertype, modedatacreatedate, modedatacreatetime, abnUuid);
if (b) {
RecordSet rsTz1 = new RecordSet();
String billid = "-1";
String acqModeIdSql = "select id from uf_outsigntype where MODEUUID = ?";
rsTz1.executeQuery(acqModeIdSql, abnUuid);
while (rsTz1.next()) {
billid = Util.null2String(rsTz1.getString("id"));
}
bb.writeLog("billid" + billid);
new HostarUtil().modePerRecon(modedatacreater, outSignTypeModeId, billid);
}
}
}
} }
new KQFormatBiz().formatDate(""+userId,(belongdate.length() == 0 ? DateUtil.getCurrentDate() : belongdate));
//外勤签到转的考勤 处理加班规则
SplitActionUtil.pushOverTimeTasksAll(belongdate,belongdate,""+userId);
} else { } else {
String acqSql = "select id from mobile_sign where operater = ? and operate_date = ? and operate_time = ? "; String acqSql = "select id from mobile_sign where operater = ? and operate_date = ? and operate_time = ? ";
rs.executeQuery(acqSql, userId, signDate, signTime); rs.executeQuery(acqSql, userId, signDate, signTime);
RecordSet rsTz = new RecordSet();
while (rs.next()) { while (rs.next()) {
String id = Util.null2String(rs.getString("id")); String id = Util.null2String(rs.getString("id"));
if (StringUtils.isNotBlank(id)) { if (StringUtils.isNotBlank(id)) {
@ -428,16 +561,16 @@ public class PunchOutButtonCmd extends AbstractCommonCommand<Map<String, Object>
String isInCom = isInIp ? "1" : "0"; String isInCom = isInIp ? "1" : "0";
JSONObject jsonObject = null; JSONObject jsonObject = null;
String deviceInfo = Util.null2String(params.get("deviceInfo")); String deviceInfo = Util.null2String(params.get("deviceInfo"));
if(deviceInfo.length() > 0){ if (deviceInfo.length() > 0) {
jsonObject = JSON.parseObject(deviceInfo); jsonObject = JSON.parseObject(deviceInfo);
JSONObject jsonObject1 = new JSONObject(); JSONObject jsonObject1 = new JSONObject();
Set<Entry<String, Object>> jsonSet = jsonObject.entrySet(); Set<Entry<String, Object>> jsonSet = jsonObject.entrySet();
for(Entry<String, Object> js : jsonSet){ for (Entry<String, Object> js : jsonSet) {
String key = js.getKey(); String key = js.getKey();
String value = Util.null2String(js.getValue()); String value = Util.null2String(js.getValue());
jsonObject1.put(key, value); jsonObject1.put(key, value);
} }
if(!jsonObject1.isEmpty()){ if (!jsonObject1.isEmpty()) {
deviceInfo = jsonObject1.toJSONString(); deviceInfo = jsonObject1.toJSONString();
} }
} }
@ -467,13 +600,14 @@ public class PunchOutButtonCmd extends AbstractCommonCommand<Map<String, Object>
String abnUuid = UUID.randomUUID().toString(); String abnUuid = UUID.randomUUID().toString();
String syncSql = "insert into uf_outsigntype (outsignid, signinfo, formmodeid, modedatacreater, " + String syncSql = "insert into uf_outsigntype (outsignid, signinfo, formmodeid, modedatacreater, " +
"modedatacreatertype, modedatacreatedate, modedatacreatetime, MODEUUID) values (?, ?, ?, ?, ?, ?, ?, ?)"; "modedatacreatertype, modedatacreatedate, modedatacreatetime, MODEUUID) values (?, ?, ?, ?, ?, ?, ?, ?)";
boolean b = rs.executeUpdate(syncSql, id, signInfoString, outSignTypeModeId, modedatacreater, modedatacreatertype, modedatacreatedate, modedatacreatetime, abnUuid); boolean b = rsTz.executeUpdate(syncSql, id, signInfoString, outSignTypeModeId, modedatacreater, modedatacreatertype, modedatacreatedate, modedatacreatetime, abnUuid);
if (b) { if (b) {
RecordSet rsTz1 = new RecordSet();
String billid = "-1"; String billid = "-1";
String acqModeIdSql = "select id from uf_outsigntype where MODEUUID = ?"; String acqModeIdSql = "select id from uf_outsigntype where MODEUUID = ?";
rs.executeQuery(acqModeIdSql, abnUuid); rsTz1.executeQuery(acqModeIdSql, abnUuid);
while (rs.next()) { while (rsTz1.next()) {
billid = Util.null2String(rs.getString("id")); billid = Util.null2String(rsTz1.getString("id"));
} }
bb.writeLog("billid" + billid); bb.writeLog("billid" + billid);
new HostarUtil().modePerRecon(modedatacreater, outSignTypeModeId, billid); new HostarUtil().modePerRecon(modedatacreater, outSignTypeModeId, billid);

@ -98,7 +98,8 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
}else if(showColumn.equals("signin3")){ }else if(showColumn.equals("signin3")){
cascadekey = "signout3"; cascadekey = "signout3";
}else if(showColumn.equals("beLate")){ }else if(showColumn.equals("beLate")){
cascadekey = "beLateMins"; // cascadekey = "beLateMins";
cascadekey = "";
}else if(showColumn.equals("leaveEearly")){ }else if(showColumn.equals("leaveEearly")){
cascadekey = "leaveEarlyMins"; cascadekey = "leaveEarlyMins";
}else if(showColumn.equals("graveBeLate")){ }else if(showColumn.equals("graveBeLate")){
@ -185,18 +186,20 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
}else { }else {
forgotBeginWorkCheck_field = " isnull(b.forgotBeginWorkCheck,0) "; forgotBeginWorkCheck_field = " isnull(b.forgotBeginWorkCheck,0) ";
} }
String backFields = " zm.cccb as mealAllowance," + String backFields = " zm.cccb as mealAllowance," +
" zm.zdcb as statAllowance," + " zm.zdcb as statAllowance," +
" zm.jmybcb as nightAllowance," + " zm.jmybcb as nightAllowance," +
" zm.hrzdcb as otherStatAllowance," + " zm.hrzdcb as otherStatAllowance," +
" zm.ybbz as nightShiftSubsidy, "+ " zm.ybbz as nightShiftSubsidy, "+
" zm.ldbz as zeropoint, "+
" zm.ybcbbb as nightShiftSubsidyDayShift, "+
" 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," +
" b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,FLOOR( b.attendanceMins / 30 ) * 30 AS attendanceMins ,b.beLate," + " b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,FLOOR( b.attendanceMins / 30 ) * 30 AS 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, "+
" b.absenteeismMins ,(b.forgotCheck+"+forgotBeginWorkCheck_field+") forgotCheck,zeropoint "; " b.absenteeismMins ,(b.forgotCheck+"+forgotBeginWorkCheck_field+") forgotCheck ";
String sqlFrom = " from hrmresource a, kq_format_total b,uf_cbxxjlb zm " + String sqlFrom = " from hrmresource a JOIN kq_format_total b ON a.id = b.resourceid LEFT JOIN uf_cbxxjlb zm ON zm.xm = a.id AND zm.rq = b.kqdate " +
"where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"' and zm.xm=a.id and zm.rq = b.kqdate "; " where b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
String sqlWhere = rightSql; String sqlWhere = rightSql;
if(subCompanyId.length()>0){ if(subCompanyId.length()>0){
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") "; sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
@ -242,7 +245,7 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
Map<String,Object> flowData = kqReportBiz.getDailyFlowData(params,user); Map<String,Object> flowData = kqReportBiz.getDailyFlowData(params,user);
long endTime = System.currentTimeMillis(); long endTime = System.currentTimeMillis();
long elapsedTime = endTime - startTime; // 执行时间 long elapsedTime = endTime - startTime; // 执行时间
bb.writeLog("getDailyMealAllowanceData执行时间" + elapsedTime/1000 + "秒"); bb.writeLog("getDailyMealAllowanceData执行时间" + elapsedTime);
// /*考勤二开--驻点餐补start*/ // /*考勤二开--驻点餐补start*/
// HostarUtil hostarUtil = new HostarUtil(); // HostarUtil hostarUtil = new HostarUtil();
// List<String> subComoanyList = new ArrayList<>(); // List<String> subComoanyList = new ArrayList<>();
@ -268,13 +271,19 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
// } // }
// } // }
// /*考勤二开--夜班餐补end*/ // /*考勤二开--夜班餐补end*/
long startTimeA = System.currentTimeMillis();
Map<String, Map<String, Object>> signDetailInfoBatch = getSignDetailInfoBatch(fromDate, toDate);
long endTimeB = System.currentTimeMillis();
elapsedTime = endTimeB - startTimeA; // 执行时间
bb.writeLog("getDailyMealAllowanceData执行时间" + elapsedTime);
bb.writeLog("ExportDailyExcelCmd sql:" + sql); bb.writeLog("ExportDailyExcelCmd sql:" + sql);
rs.execute(sql); rs.execute(sql);
while (rs.next()) { while (rs.next()) {
data = new ArrayList<>(); data = new ArrayList<>();
String id = rs.getString("id"); String id = rs.getString("id");
String kqdate = rs.getString("kqdate"); String kqdate = rs.getString("kqdate");
Map<String,Object> signDetailInfo = this.getSignDetailInfo(id,kqdate); // Map<String,Object> signDetailInfo = this.getSignDetailInfo(id,kqdate);
Map<String,Object> signDetailInfo = signDetailInfoBatch.get(id + "-" + kqdate);
for (int fieldDataKeyIdx =0;fieldDataKeyIdx<lsFieldDataKey.size();fieldDataKeyIdx++) { for (int fieldDataKeyIdx =0;fieldDataKeyIdx<lsFieldDataKey.size();fieldDataKeyIdx++) {
String fieldName = lsFieldDataKey.get(fieldDataKeyIdx); String fieldName = lsFieldDataKey.get(fieldDataKeyIdx);
@ -537,7 +546,12 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
// continue; // continue;
} else if(fieldName.equals("kqdate")){ } else if(fieldName.equals("kqdate")){
fieldValue=kqdate+" "+com.engine.portal.util.DateUtil.getDayWeekOfDate1(DateUtil.parseToDate(kqdate)); fieldValue=kqdate+" "+com.engine.portal.util.DateUtil.getDayWeekOfDate1(DateUtil.parseToDate(kqdate));
} else { } else if (fieldName.equals("beLateMinsOther")) {
fieldValue = Util.null2String(rs.getString("beLateMins"));
if (StringUtils.isEmpty(fieldValue)) {
fieldValue = "0.0";
}
}else {
fieldValue = Util.null2String(rs.getString(fieldName)); fieldValue = Util.null2String(rs.getString(fieldName));
fieldValue = getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(fieldid)); fieldValue = getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(fieldid));
} }
@ -772,6 +786,127 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
return data; return data;
} }
public Map<String, Map<String, Object>> getSignDetailInfoBatch(String startDate, String endDate){
Map<String, Map<String, Object>> resultMap = new HashMap<>();
Map<String,Object> signStatusInfo = null;
RecordSet rs = new RecordSet();
String sql = "";
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
try{
/*考勤二开--增加打卡地址start*/
sql = " select a.kqdate,a.resourceid,a.serialid,a.serialnumber,a.workbegindate,a.workbegintime, " +
" a.workenddate,a.workendtime,a.workmins,a.signindate,a.signintime,a.signoutdate,a.signouttime, \n" +
" a.attendanceMins,a.belatemins,a.graveBeLateMins,a.leaveearlymins,a.graveLeaveEarlyMins,a.absenteeismmins,a.forgotcheckMins,a.forgotBeginWorkCheckMins," +
" a.leaveMins,a.leaveInfo,a.evectionMins,a.outMins,a.signinid,a.signoutid, b.addr as signinaddr, c.addr as signoutaddr \n" +
" from kq_format_detail a " +
" left join hrmschedulesign b on b.id = a.signinid \n" +
" left join hrmschedulesign c on c.id = a.signoutid \n" +
" where a.kqdate >= '" + startDate + "' and a.kqdate <='" + endDate + "' \n" +
" order by a.serialnumber \n";
/*考勤二开--增加打卡地址end*/
rs.execute(sql);
while (rs.next()) {
String resourceid = Util.null2String(rs.getString("resourceid"));
String kqdate = Util.null2String(rs.getString("kqdate"));
String serialid = Util.null2String(rs.getString("serialid"));
int serialnumber = rs.getInt("serialnumber")+1;
String workbegindate = Util.null2String(rs.getString("workbegindate")).trim();
String workbegintime = Util.null2String(rs.getString("workbegintime")).trim();
String workenddate = Util.null2String(rs.getString("workenddate")).trim();
String workendtime = Util.null2String(rs.getString("workendtime")).trim();
int workMins = rs.getInt("workMins");
String signintime = Util.null2String(rs.getString("signintime")).trim();
String signouttime = Util.null2String(rs.getString("signouttime")).trim();
int attendanceMins = rs.getInt("attendanceMins");
String beLateMins = Util.null2String(rs.getString("beLateMins")).trim();
String graveBeLateMins = Util.null2String(rs.getString("graveBeLateMins")).trim();
String leaveEarlyMins= Util.null2String(rs.getString("leaveEarlyMins")).trim();
String graveLeaveEarlyMins= Util.null2String(rs.getString("graveLeaveEarlyMins")).trim();
String absenteeismMins= Util.null2String(rs.getString("absenteeismMins")).trim();
String forgotCheckMins = Util.null2String(rs.getString("forgotcheckMins")).trim();
String forgotBeginWorkCheckMins = Util.null2String(rs.getString("forgotBeginWorkCheckMins")).trim();
String signinid = Util.null2String(rs.getString("signinid")).trim();
String signoutid = Util.null2String(rs.getString("signoutid")).trim();
int leaveMins = rs.getInt("leaveMins");
String leaveInfo = Util.null2String(rs.getString("leaveInfo"));
int evectionMins = rs.getInt("evectionMins");
int outMins = rs.getInt("outMins");
String signInAddr = Util.null2String(rs.getString("signinaddr"));
String signOutAddr = Util.null2String(rs.getString("signoutaddr"));
// bb.writeLog("signInAddr: " + signInAddr);
// bb.writeLog("signOutAddr: " + signOutAddr);
Map<String, Object> data = new HashMap<>();
if(serialid.length()>0){
if (workbegintime.length() > 0) {
signStatusInfo = new HashMap();
signStatusInfo.put("workdate",workbegindate);
signStatusInfo.put("worktime",workbegintime);
signStatusInfo.put("beLateMins",beLateMins);
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
signStatusInfo.put("graveBeLateMins",graveBeLateMins);
signStatusInfo.put("absenteeismMins",absenteeismMins);
signStatusInfo.put("leaveMins",leaveMins);
signStatusInfo.put("leaveInfo",leaveInfo);
signStatusInfo.put("evectionMins",evectionMins);
signStatusInfo.put("outMins",outMins);
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
data.put("signinaddress"+serialnumber, signInAddr);
}
if (workendtime.length() > 0) {
signStatusInfo = new HashMap();
signStatusInfo.put("workdate",workenddate);
signStatusInfo.put("worktime",kqTimesArrayComInfo.turn48to24Time(workendtime));
signStatusInfo.put("leaveEarlyMins",leaveEarlyMins);
signStatusInfo.put("graveLeaveEarlyMins",graveLeaveEarlyMins);
signStatusInfo.put("forgotCheckMins",forgotCheckMins);
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
signStatusInfo.put("absenteeismMins",absenteeismMins);
signStatusInfo.put("leaveMins",leaveMins);
signStatusInfo.put("leaveInfo",leaveInfo);
signStatusInfo.put("evectionMins",evectionMins);
signStatusInfo.put("outMins",outMins);
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
data.put("signoutaddress"+serialnumber, signOutAddr);
}
}else{
if(workMins>0){
//弹性工时打卡时间取自签到签退数据
}
signStatusInfo = new HashMap();
signStatusInfo.put("leaveMins",leaveMins);
signStatusInfo.put("leaveInfo",leaveInfo);
signStatusInfo.put("evectionMins",evectionMins);
signStatusInfo.put("outMins",outMins);
if(signinid.length() > 0){
data.put("signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime);
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
data.put("signinaddress"+serialnumber, signInAddr);
if(signoutid.length() > 0){
data.put("signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime);
data.put("signoutstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"off"));
data.put("signoutaddress"+serialnumber, signOutAddr);
}
}else{
data.put("signinstatus"+serialnumber, KQReportBiz.getSignStatus(signStatusInfo,user,"on"));
}
}
resultMap.put(resourceid + "-" + kqdate, data);
}
}catch (Exception e){
writeLog("getSignDetailInfoBatch error:" + e);
}
return resultMap;
}
private String getFieldValueByUnitType(String fieldValue,String unittype){ private String getFieldValueByUnitType(String fieldValue,String unittype){
if (Util.null2String(unittype).length() > 0) { if (Util.null2String(unittype).length() > 0) {
if (fieldValue.length() == 0) { if (fieldValue.length() == 0) {

@ -10,6 +10,7 @@ import com.engine.kq.biz.*;
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;
import org.apache.commons.lang3.StringUtils;
import weaver.common.DateUtil; import weaver.common.DateUtil;
import weaver.common.StringUtil; import weaver.common.StringUtil;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
@ -89,7 +90,8 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
tmpShowColumns.add(showColumn); tmpShowColumns.add(showColumn);
String cascadekey = ""; String cascadekey = "";
if(showColumn.equals("beLate")){ if(showColumn.equals("beLate")){
cascadekey = "beLateMins"; // cascadekey = "beLateMins";
cascadekey = "";
}else if(showColumn.equals("leaveEearly")){ }else if(showColumn.equals("leaveEearly")){
cascadekey = "leaveEarlyMins"; cascadekey = "leaveEarlyMins";
}else if(showColumn.equals("graveBeLate")){ }else if(showColumn.equals("graveBeLate")){
@ -206,11 +208,13 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
Map<String,Object> definedFieldInfo = new KQFormatBiz().getDefinedField(); Map<String,Object> definedFieldInfo = new KQFormatBiz().getDefinedField();
String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum")); String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum"));
String backFields = " (select sum(zm.cccb) from uf_cbxxjlb zm where zm.xm = a.id and zm.rq >= '" + fromDate + "' and zm.rq <= '" + toDate + "') as mealAllowance," + String backFields = " sum(zm.cccb) as mealAllowance," +
" (select sum(zm.zdcb) from uf_cbxxjlb zm where zm.xm = a.id and zm.rq >= '" + fromDate + "' and zm.rq <= '" + toDate + "') as statAllowance," + " sum(zm.zdcb) as statAllowance," +
" (select sum(zm.jmybcb) from uf_cbxxjlb zm where zm.xm = a.id and zm.rq >= '" + fromDate + "' and zm.rq <= '" + toDate + "') as nightAllowance," + " sum(zm.jmybcb) as nightAllowance," +
" (select sum(zm.hrzdcb) from uf_cbxxjlb zm where zm.xm = a.id and zm.rq >= '" + fromDate + "' and zm.rq <= '" + toDate + "') as otherStatAllowance," + " sum(zm.hrzdcb) as otherStatAllowance," +
" (select sum(zm.ybbz) from uf_cbxxjlb zm where zm.xm = a.id and zm.rq >= '" + fromDate + "' and zm.rq <= '" + toDate + "') as nightShiftSubsidy," + " sum(zm.ybbz) as nightShiftSubsidy," +
" sum(zm.ldbz) as zeropoint," +
" sum(zm.ybcbbb) as nightShiftSubsidyDayShift," +
" 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," +
" 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(FLOOR( b.attendanceMins / 30 ) * 30 ) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " + " sum(FLOOR( b.attendanceMins / 30 ) * 30 ) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " +
@ -218,11 +222,12 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
" sum(b.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " + " sum(b.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " +
" sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " + " sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " +
" sum(b.signdays) as signdays,sum(b.signmins) as signmins, "+ " sum(b.signdays) as signdays,sum(b.signmins) as signmins, "+
" sum(b.absenteeismMins ) as absenteeismMins, sum(b.forgotCheck)+"+forgotBeginWorkCheck_field+" as forgotCheck,sum(b.zeropoint) as zeropoint "+(definedFieldSum.length()>0?","+definedFieldSum+"":""); " sum(b.absenteeismMins ) as absenteeismMins, sum(b.forgotCheck)+"+forgotBeginWorkCheck_field+" as forgotCheck "+(definedFieldSum.length()>0?","+definedFieldSum+"":"");
if(rs.getDBType().equals("oracle")){ if(rs.getDBType().equals("oracle")){
backFields = "/*+ index(kq_format_total IDX_KQ_FORMAT_TOTAL_KQDATE) */ "+backFields; backFields = "/*+ index(kq_format_total IDX_KQ_FORMAT_TOTAL_KQDATE) */ "+backFields;
} }
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='" + fromDate + "' and b.kqdate <='" + toDate + "'"; String sqlFrom = " from hrmresource a JOIN kq_format_total b ON a.id = b.resourceid LEFT JOIN uf_cbxxjlb zm ON zm.xm = a.id AND zm.rq = b.kqdate " +
" where 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,b.resourceid,a.subcompanyid1,a.departmentid,a.jobtitle ";
if (subCompanyId.length() > 0) { if (subCompanyId.length() > 0) {
@ -278,22 +283,22 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0"); String isShowFullPath = Util.null2String(kqSettingsComInfo.getMain_val(fullPathMainKey),"0");
/*考勤二开--驻点餐补start*/ // /*考勤二开--驻点餐补start*/
HostarUtil hostarUtil = new HostarUtil(); // HostarUtil hostarUtil = new HostarUtil();
Map<String, Double> attendanceMap = new HashMap<>(); // Map<String, Double> attendanceMap = new HashMap<>();
String acqAttendanceSql = "select a.id, b.attendanceMins, b.kqdate from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"' "+sqlWhere; // String acqAttendanceSql = "select a.id, b.attendanceMins, b.kqdate from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"' "+sqlWhere;
bb.writeLog("acqAttendanceSql: " + acqAttendanceSql); // bb.writeLog("acqAttendanceSql: " + acqAttendanceSql);
rs.executeQuery(acqAttendanceSql); // rs.executeQuery(acqAttendanceSql);
while (rs.next()) { // while (rs.next()) {
double attendanceMins = Util.getDoubleValue(Util.null2String(rs.getString("attendanceMins"))); // double attendanceMins = Util.getDoubleValue(Util.null2String(rs.getString("attendanceMins")));
String id = Util.null2String(rs.getString("id")); // String id = Util.null2String(rs.getString("id"));
String kqdate = Util.null2String(rs.getString("kqdate")); // String kqdate = Util.null2String(rs.getString("kqdate"));
if (attendanceMins >= 0.00) { // if (attendanceMins >= 0.00) {
attendanceMap.put(id + "|DailyStatAllowance" +"|" + kqdate, attendanceMins); // attendanceMap.put(id + "|DailyStatAllowance" +"|" + kqdate, attendanceMins);
} // }
} // }
bb.writeLog("attendanceMap: " + attendanceMap); // bb.writeLog("attendanceMap: " + attendanceMap);
/*考勤二开--驻点餐补end*/ // /*考勤二开--驻点餐补end*/
rs.execute(sql); rs.execute(sql);
@ -413,7 +418,7 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_nonleave"))); double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_nonleave")));
holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave; holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;
fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+ fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave)); workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("overtimeTotal")))); data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("overtimeTotal"))));
continue; continue;
}else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){ }else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
@ -546,6 +551,11 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
data.add(fieldValue); data.add(fieldValue);
} }
continue; continue;
} else if (fieldName.equals("beLateMinsOther")) {
fieldValue = Util.null2String(rs.getString("beLateMins"));
if (StringUtils.isEmpty(fieldValue)) {
fieldValue = "0.0";
}
}else { }else {
fieldValue = Util.formatMultiLang(Util.null2String(rs.getString(fieldName)),""+user.getLanguage()); fieldValue = Util.formatMultiLang(Util.null2String(rs.getString(fieldName)),""+user.getLanguage());
fieldValue = getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(fieldid)); fieldValue = getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(fieldid));

@ -145,17 +145,20 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
forgotBeginWorkCheck_field = " isnull(b.forgotBeginWorkCheck,0) "; forgotBeginWorkCheck_field = " isnull(b.forgotBeginWorkCheck,0) ";
} }
String backFields = " (select zm.cccb from uf_cbxxjlb zm where zm.xm = a.id and zm.rq = b.kqdate) as mealAllowance," + String backFields = " zm.cccb as mealAllowance," +
" (select zm.zdcb from uf_cbxxjlb zm where zm.xm = a.id and zm.rq = b.kqdate) as statAllowance," + " zm.zdcb as statAllowance," +
" (select zm.jmybcb from uf_cbxxjlb zm where zm.xm = a.id and zm.rq = b.kqdate) as nightAllowance," + " zm.jmybcb as nightAllowance," +
" (select zm.hrzdcb from uf_cbxxjlb zm where zm.xm = a.id and zm.rq = b.kqdate) as otherStatAllowance," + " zm.hrzdcb as otherStatAllowance," +
" (select zm.ybbz from uf_cbxxjlb zm where zm.xm = a.id and zm.rq = b.kqdate) as nightShiftSubsidy," + " zm.ybbz as nightShiftSubsidy," +
" zm.ldbz as zeropoint, "+
" zm.ybcbbb as nightShiftSubsidyDayShift, "+
" 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," +
" b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,FLOOR( b.attendanceMins / 30 ) * 30 AS attendanceMins," + " b.kqdate, b.workdays,b.workMins,b.serialid, b.attendancedays,FLOOR( b.attendanceMins / 30 ) * 30 AS 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, "+
" b.graveLeaveEarly,b.graveLeaveEarlyMins,b.absenteeism , b.absenteeismMins ,(b.forgotCheck+"+forgotBeginWorkCheck_field+") forgotCheck,zeropoint "; " b.graveLeaveEarly,b.graveLeaveEarlyMins,b.absenteeism , b.absenteeismMins ,(b.forgotCheck+"+forgotBeginWorkCheck_field+") forgotCheck ";
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'"; String sqlFrom = " from hrmresource a JOIN kq_format_total b ON a.id = b.resourceid LEFT JOIN uf_cbxxjlb zm ON zm.xm = a.id AND zm.rq = b.kqdate " +
"where b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'";
String sqlWhere = rightSql; String sqlWhere = rightSql;
if(subCompanyId.length()>0){ if(subCompanyId.length()>0){
sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") "; sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") ";
@ -446,7 +449,13 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
// } // }
//// bb.writeLog("fieldValue: " + fieldValue); //// bb.writeLog("fieldValue: " + fieldValue);
// data.put(fieldName, fieldValue); // data.put(fieldName, fieldValue);
} else { } else if (fieldName.equals("beLateMinsOther")) {
fieldValue = Util.null2String(rs.getString("beLateMins"));
if (StringUtils.isEmpty(fieldValue)) {
fieldValue = "0.0";
}
data.put(fieldName, fieldValue);
}else {
fieldValue = Util.null2String(rs.getString(fieldName)); fieldValue = Util.null2String(rs.getString(fieldName));
if (kqReportFieldComInfo.getUnittype().equals("2") && fieldValue.length() > 0) { if (kqReportFieldComInfo.getUnittype().equals("2") && fieldValue.length() > 0) {
fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0))); fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
@ -560,67 +569,67 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
sumChildColumnWidth+=65; sumChildColumnWidth+=65;
lsChildColumns.add(column); lsChildColumns.add(column);
} }
}else if(parentid.equals("overtime")){ }else if(parentid.equals("overtime")){
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"}; String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
for(int i=0;i<overtimeChild.length;i++){ for(int i=0;i<overtimeChild.length;i++){
String id = overtimeChild[i]; String id = overtimeChild[i];
column = new HashMap(); column = new HashMap();
String fieldlabel = ""; String fieldlabel = "";
column.put("unit", ""); column.put("unit", "");
if("overtime_nonleave".equalsIgnoreCase(id)){ if("overtime_nonleave".equalsIgnoreCase(id)){
fieldlabel = "125805"; fieldlabel = "125805";
}else if("overtime_4leave".equalsIgnoreCase(id)){ }else if("overtime_4leave".equalsIgnoreCase(id)){
fieldlabel = "125804"; fieldlabel = "125804";
}else{ }else{
fieldlabel = "523"; fieldlabel = "523";
column.put("showDetial","1"); column.put("showDetial","1");
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1"; String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
String unitTypeName = ""; String unitTypeName = "";
if(Util.null2String(unitType).length()>0){ if(Util.null2String(unitType).length()>0){
if(unitType.equals("1")){ if(unitType.equals("1")){
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage()); unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
}else if(unitType.equals("2")){ }else if(unitType.equals("2")){
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage()); unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
}else if(unitType.equals("3")){ }else if(unitType.equals("3")){
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage()); unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
} }
} }
column.put("unit", unitTypeName); column.put("unit", unitTypeName);
} }
column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage())); column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
column.put("dataIndex", id); column.put("dataIndex", id);
column.put("key", id); column.put("key", id);
column.put("rowSpan", 1); column.put("rowSpan", 1);
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user); Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
int childWidth = 65; int childWidth = 65;
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns"); List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
if(childColumns.size()>0) {//跨列width取子列的width if(childColumns.size()>0) {//跨列width取子列的width
column.put("children", childColumns); column.put("children", childColumns);
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65); childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
} }
column.put("width", childWidth+""); column.put("width", childWidth+"");
sumChildColumnWidth+=childWidth; sumChildColumnWidth+=childWidth;
lsChildColumns.add(column); lsChildColumns.add(column);
} }
}else{ }else{
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo(); KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
while (kqReportFieldComInfo.next()){ while (kqReportFieldComInfo.next()){
if(kqReportFieldComInfo.getParentid().equals(parentid)) { if(kqReportFieldComInfo.getParentid().equals(parentid)) {
if(!kqReportFieldComInfo.getReportType().equals("daily"))continue; if(!kqReportFieldComInfo.getReportType().equals("daily"))continue;
column = new HashMap(); column = new HashMap();
column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage())); column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user)); column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user));
column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth())); column.put("width", Util.getIntValue(kqReportFieldComInfo.getWidth()));
column.put("dataIndex", kqReportFieldComInfo.getFieldname()); column.put("dataIndex", kqReportFieldComInfo.getFieldname());
column.put("key", kqReportFieldComInfo.getFieldname()); column.put("key", kqReportFieldComInfo.getFieldname());
column.put("rowSpan", 2); column.put("rowSpan", 2);
column.put("colSpan", 1); column.put("colSpan", 1);
column.put("isdaily", kqReportFieldComInfo.getReportType1().equals("daily")?"1":"0"); column.put("isdaily", kqReportFieldComInfo.getReportType1().equals("daily")?"1":"0");
sumChildColumnWidth+=Util.getIntValue(kqReportFieldComInfo.getWidth()); sumChildColumnWidth+=Util.getIntValue(kqReportFieldComInfo.getWidth());
lsChildColumns.add(column); lsChildColumns.add(column);
} }
} }
} }
returnMap.put("childColumns",lsChildColumns); returnMap.put("childColumns",lsChildColumns);
returnMap.put("sumChildColumnWidth",sumChildColumnWidth); returnMap.put("sumChildColumnWidth",sumChildColumnWidth);
return returnMap; return returnMap;
@ -691,7 +700,7 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
signStatusInfo.put("workdate",workbegindate); signStatusInfo.put("workdate",workbegindate);
signStatusInfo.put("worktime",workbegintime); signStatusInfo.put("worktime",workbegintime);
signStatusInfo.put("beLateMins",beLateMins); signStatusInfo.put("beLateMins",beLateMins);
signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins); signStatusInfo.put("forgotBeginWorkCheckMins",forgotBeginWorkCheckMins);
signStatusInfo.put("graveBeLateMins",graveBeLateMins); signStatusInfo.put("graveBeLateMins",graveBeLateMins);
signStatusInfo.put("absenteeismMins",absenteeismMins); signStatusInfo.put("absenteeismMins",absenteeismMins);
signStatusInfo.put("leaveMins",leaveMins); signStatusInfo.put("leaveMins",leaveMins);

@ -9,6 +9,7 @@ import com.engine.hostar.util.HostarUtil;
import com.engine.kq.biz.*; import com.engine.kq.biz.*;
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 weaver.common.DateUtil; import weaver.common.DateUtil;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
import weaver.general.BaseBean; import weaver.general.BaseBean;
@ -173,11 +174,13 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
Map<String,Object> definedFieldInfo = new KQFormatBiz().getDefinedField(); Map<String,Object> definedFieldInfo = new KQFormatBiz().getDefinedField();
String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum")); String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum"));
String backFields = " (select sum(zm.cccb) from uf_cbxxjlb zm where zm.xm = a.id and zm.rq >= '" + fromDate + "' and zm.rq <= '" + toDate + "') as mealAllowance," + String backFields = " sum(zm.cccb) as mealAllowance," +
" (select sum(zm.zdcb) from uf_cbxxjlb zm where zm.xm = a.id and zm.rq >= '" + fromDate + "' and zm.rq <= '" + toDate + "') as statAllowance," + " sum(zm.zdcb) as statAllowance," +
" (select sum(zm.jmybcb) from uf_cbxxjlb zm where zm.xm = a.id and zm.rq >= '" + fromDate + "' and zm.rq <= '" + toDate + "') as nightAllowance," + " sum(zm.jmybcb) as nightAllowance," +
" (select sum(zm.hrzdcb) from uf_cbxxjlb zm where zm.xm = a.id and zm.rq >= '" + fromDate + "' and zm.rq <= '" + toDate + "') as otherStatAllowance," + " sum(zm.hrzdcb) as otherStatAllowance," +
" (select sum(zm.ybbz) from uf_cbxxjlb zm where zm.xm = a.id and zm.rq >= '" + fromDate + "' and zm.rq <= '" + toDate + "') as nightShiftSubsidy," + " sum(zm.ybbz) as nightShiftSubsidy," +
" sum(zm.ldbz) as zeropoint," +
" sum(zm.ybcbbb) as nightShiftSubsidyDayShift," +
" 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," +
" 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(FLOOR( b.attendanceMins / 30 ) * 30 ) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " + " sum(FLOOR( b.attendanceMins / 30 ) * 30 ) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " +
@ -185,12 +188,13 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
" sum(b.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " + " sum(b.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " +
" sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " + " sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " +
" sum(b.signdays) as signdays,sum(b.signmins) as signmins, "+ " sum(b.signdays) as signdays,sum(b.signmins) as signmins, "+
" sum(b.absenteeismMins ) as absenteeismMins, sum(b.forgotCheck)+"+forgotBeginWorkCheck_field+" as forgotCheck, sum(b.zeropoint) as zeropoint "+(definedFieldSum.length()>0?","+definedFieldSum+"":""); " sum(b.absenteeismMins ) as absenteeismMins, sum(b.forgotCheck)+"+forgotBeginWorkCheck_field+" as forgotCheck "+(definedFieldSum.length()>0?","+definedFieldSum+"":"");
if(rs.getDBType().equals("oracle")){ if(rs.getDBType().equals("oracle")){
backFields = "/*+ index(kq_format_total IDX_KQ_FORMAT_TOTAL_KQDATE) */ "+backFields; backFields = "/*+ index(kq_format_total IDX_KQ_FORMAT_TOTAL_KQDATE) */ "+backFields;
} }
String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"'"; String sqlFrom = " from hrmresource a JOIN kq_format_total b ON a.id = b.resourceid LEFT JOIN uf_cbxxjlb zm ON zm.xm = a.id AND zm.rq = b.kqdate " +
" where 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,b.resourceid,a.subcompanyid1,a.departmentid,a.jobtitle ";
if(subCompanyId.length()>0){ if(subCompanyId.length()>0){
@ -327,7 +331,7 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
// /*考勤二开--驻点餐补start*/ // /*考勤二开--驻点餐补start*/
HostarUtil hostarUtil = new HostarUtil(); // HostarUtil hostarUtil = new HostarUtil();
// Map<String, Double> attendanceMap = new HashMap<>(); // Map<String, Double> attendanceMap = new HashMap<>();
// String acqAttendanceSql = "select a.id, b.attendanceMins, b.kqdate from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"' "+sqlWhere; // String acqAttendanceSql = "select a.id, b.attendanceMins, b.kqdate from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='"+fromDate+"' and b.kqdate <='"+toDate+"' "+sqlWhere;
// bb.writeLog("acqAttendanceSql: " + acqAttendanceSql); // bb.writeLog("acqAttendanceSql: " + acqAttendanceSql);
@ -397,7 +401,7 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
data.put(serialIds.get(i), kqReportBiz.getSerialCount(id,fromDate,toDate,serialIds.get(i))); data.put(serialIds.get(i), kqReportBiz.getSerialCount(id,fromDate,toDate,serialIds.get(i)));
} }
}else if(kqReportFieldComInfo.getParentid().equals("overtime")||kqReportFieldComInfo.getParentid().equals("overtime_nonleave") }else if(kqReportFieldComInfo.getParentid().equals("overtime")||kqReportFieldComInfo.getParentid().equals("overtime_nonleave")
||kqReportFieldComInfo.getParentid().equals("overtime_4leave")||fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){ ||kqReportFieldComInfo.getParentid().equals("overtime_4leave")||fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
if(fieldName.equals("overtimeTotal")){ if(fieldName.equals("overtimeTotal")){
double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_4leave"))); double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_4leave")));
workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave; workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
@ -534,7 +538,13 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
// } // }
//// bb.writeLog("fieldValue: " + fieldValue); //// bb.writeLog("fieldValue: " + fieldValue);
// data.put(fieldName, fieldValue); // data.put(fieldName, fieldValue);
} else { } else if (fieldName.equals("beLateMinsOther")) {
fieldValue = Util.null2String(rs.getString("beLateMins"));
if (StringUtils.isEmpty(fieldValue)) {
fieldValue = "0.0";
}
data.put(fieldName, fieldValue);
}else {
fieldValue = Util.null2String(rs.getString(fieldName)); fieldValue = Util.null2String(rs.getString(fieldName));
if(Util.null2String(kqReportFieldComInfo.getUnittype()).length()>0) { if(Util.null2String(kqReportFieldComInfo.getUnittype()).length()>0) {
if(fieldValue.length() == 0){ if(fieldValue.length() == 0){
@ -641,7 +651,7 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
column.put("width", 65); column.put("width", 65);
column.put("dataIndex", serialIds.get(i)); column.put("dataIndex", serialIds.get(i));
column.put("key", serialIds.get(i)); column.put("key", serialIds.get(i));
column.put("rowSpan", 2); column.put("rowSpan", 2);
column.put("colSpan", 1); column.put("colSpan", 1);
sumChildColumnWidth+=65; sumChildColumnWidth+=65;
lsChildColumns.add(column); lsChildColumns.add(column);
@ -667,48 +677,48 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
lsChildColumns.add(column); lsChildColumns.add(column);
} }
}else if(parentid.equals("overtime")){ }else if(parentid.equals("overtime")){
String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"}; String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
for(int i=0;i<overtimeChild.length;i++){ for(int i=0;i<overtimeChild.length;i++){
String id = overtimeChild[i]; String id = overtimeChild[i];
column = new HashMap(); column = new HashMap();
String fieldlabel = ""; String fieldlabel = "";
column.put("unit", ""); column.put("unit", "");
if("overtime_nonleave".equalsIgnoreCase(id)){ if("overtime_nonleave".equalsIgnoreCase(id)){
fieldlabel = "125805"; fieldlabel = "125805";
}else if("overtime_4leave".equalsIgnoreCase(id)){ }else if("overtime_4leave".equalsIgnoreCase(id)){
fieldlabel = "125804"; fieldlabel = "125804";
}else{ }else{
fieldlabel = "523"; fieldlabel = "523";
column.put("showDetial","1"); column.put("showDetial","1");
String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1"; String unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";
String unitTypeName = ""; String unitTypeName = "";
if(Util.null2String(unitType).length()>0){ if(Util.null2String(unitType).length()>0){
if(unitType.equals("1")){ if(unitType.equals("1")){
unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage()); unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
}else if(unitType.equals("2")){ }else if(unitType.equals("2")){
unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage()); unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
}else if(unitType.equals("3")){ }else if(unitType.equals("3")){
unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage()); unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
} }
} }
column.put("unit", unitTypeName); column.put("unit", unitTypeName);
} }
column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage())); column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
column.put("dataIndex", id); column.put("dataIndex", id);
column.put("key", id); column.put("key", id);
column.put("rowSpan", 1); column.put("rowSpan", 1);
Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user); Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
int childWidth = 65; int childWidth = 65;
List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns"); List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
if(childColumns.size()>0) {//跨列width取子列的width if(childColumns.size()>0) {//跨列width取子列的width
column.put("children", childColumns); column.put("children", childColumns);
childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65); childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
} }
column.put("width", childWidth+""); column.put("width", childWidth+"");
sumChildColumnWidth+=childWidth; sumChildColumnWidth+=childWidth;
lsChildColumns.add(column); lsChildColumns.add(column);
} }
}else{ }else{
KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo(); KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
while (kqReportFieldComInfo.next()){ while (kqReportFieldComInfo.next()){
if(kqReportFieldComInfo.getParentid().equals(parentid)) { if(kqReportFieldComInfo.getParentid().equals(parentid)) {

@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import com.engine.kq.biz.KQFormatBiz; import com.engine.kq.biz.KQFormatBiz;
import com.engine.kq.timer.KQQueue; import com.engine.kq.timer.KQQueue;
import com.engine.kq.timer.KQTaskBean; import com.engine.kq.timer.KQTaskBean;
@ -12,6 +13,7 @@ import com.engine.kq.wfset.util.SplitActionUtil;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew; import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
import weaver.general.BaseBean; import weaver.general.BaseBean;
@ -30,7 +32,7 @@ public class AddScheduleSign extends AbstractModeExpandJavaCodeNew {
* param() * param()
* user * user
* importtype () 1 2,3(int)param.get("importtype") * importtype () 1 2,3(int)param.get("importtype")
* ()a=1param.get("a") * ()a=1param.get("a")
* b=2,param.get("b") * b=2,param.get("b")
* @return * @return
*/ */
@ -178,17 +180,21 @@ public class AddScheduleSign extends AbstractModeExpandJavaCodeNew {
bb.writeLog("开始处理加班生成"); bb.writeLog("开始处理加班生成");
//处理加班生成 //处理加班生成
List<KQTaskBean> tasks = new ArrayList<>(); // List<KQTaskBean> tasks = new ArrayList<>();
if (!CollectionUtils.isEmpty(overtimeMap)) {
bb.writeLog("AddScheduleSign overtimeMap:" + JSONObject.toJSONString(overtimeMap));
}
for(Map.Entry<String, List<String>> mme: overtimeMap.entrySet()){ for(Map.Entry<String, List<String>> mme: overtimeMap.entrySet()){
String resid = mme.getKey(); String resid = mme.getKey();
List<String> overList = mme.getValue(); List<String> overList = mme.getValue();
for(String date : overList){ for(String date : overList){
SplitActionUtil.pushOverTimeTasks(date,date,resid,tasks); SplitActionUtil.pushOverTimeTasksAll(date,date,""+resid);
// SplitActionUtil.pushOverTimeTasks(date,date,resid,tasks);
} }
} }
if(!tasks.isEmpty()){ // if(!tasks.isEmpty()){
KQQueue.writeTasks(tasks); // KQQueue.writeTasks(tasks);
} // }
} }
} }

@ -0,0 +1,143 @@
package weaver.interfaces.hostar.action;
import com.engine.hostar.thread.HandleCBDataThread;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.ThreadPoolUtil;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
/**
* @version 1.0
* @Title ecology-9
* @Company
* @CreateDate 2024/8/30
* @Description action
* @Author AdminZm
*/
public class HandleCBCommonAction implements Action {
BaseBean baseBean = new BaseBean();
private String ryField;
private String ksrqField;
private String jsrqField;
@Override
public String execute(RequestInfo requestInfo) {
baseBean.writeLog("HandleCBCommonAction start:" + ryField + "、" + ksrqField + "、" + jsrqField);
try {
if (StringUtils.isEmpty(ryField) || StringUtils.isEmpty(ksrqField) || StringUtils.isEmpty(jsrqField)) {
return Action.SUCCESS;
}
int billid = requestInfo.getRequestManager().getBillid();
String requestid = requestInfo.getRequestid();
String billTableName = requestInfo.getRequestManager().getBillTableName();
baseBean.writeLog("table info:" + billid + "、" + billTableName + "、" + requestid);
RecordSet rs = new RecordSet();
rs.execute("SELECT * FROM " + billTableName + " WHERE id = " + billid);
if (rs.next()) {
String ry = rs.getString(ryField);
String ksrq = rs.getString(ksrqField);
String jsrq = rs.getString(jsrqField);
if (StringUtils.isEmpty(ry) || StringUtils.isEmpty(ksrq) || StringUtils.isEmpty(jsrq)) {
return Action.SUCCESS;
}
List<String> ryList = Arrays.asList(ry.split(","));
List<String> allDates = getAllDates(ksrq, jsrq);
if (CollectionUtils.isEmpty(ryList) || CollectionUtils.isEmpty(allDates)) {
baseBean.writeLog("no user or date.");
return Action.SUCCESS;
}
// 获取责任制、排班次班次
Set<String> zrzbcSet = new HashSet<>();
Set<String> pbzbcSet = new HashSet<>();
String acqSql = "select kqgroup, grouptype from uf_ZeroPointSubSft";
rs.executeQuery(acqSql);
while (rs.next()) {
String kqgroup = Util.null2String(rs.getString("kqgroup"));
String grouptype = Util.null2String(rs.getString("grouptype"));
if (org.apache.commons.lang3.StringUtils.isNotBlank(kqgroup) && org.apache.commons.lang3.StringUtils.equals(grouptype, "0")) {
zrzbcSet.addAll(Arrays.asList(kqgroup.split(",")));
}
if (org.apache.commons.lang3.StringUtils.isNotBlank(kqgroup) && org.apache.commons.lang3.StringUtils.equals(grouptype, "1")) {
pbzbcSet.addAll(Arrays.asList(kqgroup.split(",")));
}
}
// 鸿仁驻点餐补指定人员不享受
List<String> removeRes = new ArrayList<>();
String acqNoOtherStatAllResSql = "select resourceid from uf_NoOtherStatAllRe where isdelete is null or isdelete = 0 ";
rs.executeQuery(acqNoOtherStatAllResSql);
while (rs.next()){
String resourceid = Util.null2String(rs.getString("resourceid"));
if (org.apache.commons.lang3.StringUtils.isNotBlank(resourceid) ) {
removeRes.add(resourceid);
}
}
// 驻点餐补指定人员不享受
List<String> noRes = new ArrayList<>();
String acqNoResSql = "select resourceid from uf_NoStatAllRes where isdelete = 0 or isdelete is null";
rs.executeQuery(acqNoResSql);
while (rs.next()) {
String resourceid = Util.null2String(rs.getString("resourceid"));
if (org.apache.commons.lang3.StringUtils.isNotBlank(resourceid)) {
noRes.add(resourceid);
}
}
//获取夜班班次
List<String> nightShiftList = new ArrayList<>();
String acqNightShiftSql = "select shift from uf_nightshiftmanage where isdelete is null or isdelete = 0";
rs.executeQuery(acqNightShiftSql);
while (rs.next()) {
String shift = Util.null2String(rs.getString("shift"));
if (org.apache.commons.lang3.StringUtils.isNotBlank(shift)) {
nightShiftList.add(shift);
}
}
ExecutorService executorService = ThreadPoolUtil.getThreadPool("HandleCBDataThreadAction", "20");
for (String userId : ryList) {
for (String kqDate : allDates) {
executorService.execute(new HandleCBDataThread(userId, kqDate, zrzbcSet, pbzbcSet, removeRes, nightShiftList, noRes));
}
}
}
baseBean.writeLog("HandleCBCommonAction end.");
} catch (Exception e) {
baseBean.writeLog("HandleCBCommonAction error:" + e.getMessage());
}
return Action.SUCCESS;
}
public List<String> getAllDates(String startDate, String endDate) {
List<String> result = new ArrayList<>();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate start = LocalDate.parse(startDate, formatter);
LocalDate end = LocalDate.parse(endDate, formatter);
while (!start.isAfter(end)) {
result.add(start.format(formatter));
start = start.plusDays(1);
}
return result;
}
}

@ -11,7 +11,12 @@ import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.Property; import weaver.soa.workflow.request.Property;
import weaver.soa.workflow.request.RequestInfo; import weaver.soa.workflow.request.RequestInfo;
import java.text.SimpleDateFormat;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -22,12 +27,13 @@ public class OutSignSyncAction implements Action {
@Override @Override
public String execute(RequestInfo requestInfo) { public String execute(RequestInfo requestInfo) {
bb.writeLog("OutSignSyncAction-start"); bb.writeLog("OutSignSyncAction-start:" + requestInfo.getRequestid());
String startDate = ""; String startDate = "";
String endDate = ""; String endDate = "";
String resourceid = ""; String resourceid = "";
String nbtxr = ""; String nbtxr = "";
String sjjsrq = ""; String sjjsrq = "";
String kssj = "";
try { try {
@ -36,6 +42,9 @@ public class OutSignSyncAction implements Action {
if ("ksrq".equals(property.getName())) { if ("ksrq".equals(property.getName())) {
startDate = Util.null2String(property.getValue()); startDate = Util.null2String(property.getValue());
} }
if ("kssj".equals(property.getName())) {
kssj = Util.null2String(property.getValue());
}
if ("yjjsrq".equals(property.getName())) { if ("yjjsrq".equals(property.getName())) {
endDate = Util.null2String(property.getValue()); endDate = Util.null2String(property.getValue());
} }
@ -49,29 +58,48 @@ public class OutSignSyncAction implements Action {
sjjsrq = Util.null2String(property.getValue()); sjjsrq = Util.null2String(property.getValue());
} }
} }
// if (StringUtils.isEmpty(kssj)) {
// return Action.SUCCESS;
// }
// if (kssj.length() < 8) {
// kssj = kssj + ":00";
// }
// 如果实际结束日期不为空,则用实际结束日期 // 如果实际结束日期不为空,则用实际结束日期
if (StringUtils.isNotBlank(sjjsrq)) { if (StringUtils.isNotBlank(sjjsrq)) {
endDate = sjjsrq; endDate = sjjsrq;
} }
bb.writeLog("start to handle data."); bb.writeLog("start to handle data:" + startDate + "、" + endDate + "、" + resourceid);
if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate) && StringUtils.isNotBlank(resourceid)) { if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate) && StringUtils.isNotBlank(resourceid)) {
// 内部同行人也要考虑 // 内部同行人也要考虑
if (StringUtils.isNotBlank(nbtxr)) { if (StringUtils.isNotBlank(nbtxr)) {
resourceid = resourceid + "," + nbtxr; resourceid = resourceid + "," + nbtxr;
} }
bb.writeLog("OutSignSyncAction resourceid:" + resourceid);
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
List<String> infos = new ArrayList<>(); List<String> infos = new ArrayList<>();
String acqOutSignSql = "select a.id, c.signinfo " + String acqOutSignSql = "select a.id, c.signinfo " +
"from mobile_sign a " + "from mobile_sign a " +
"left join uf_outsigntype c " + "left join uf_outsigntype c " +
"on c.outsignid = a.id " + "on c.outsignid = a.id " +
"where operate_date >= '" + startDate + "' and operate_date <= '" + endDate + "' and operater in (?) "; "where operate_date >= '" + startDate + "' and operate_date <= '" + endDate + "' and operater in (" + resourceid + ") ";
rs.executeQuery(acqOutSignSql, resourceid); bb.writeLog("OutSignSyncAction acqOutSignSql:" + acqOutSignSql);
rs.execute(acqOutSignSql);
while (rs.next()) { while (rs.next()) {
String signinfo = Util.null2String(rs.getString("signinfo")); String signinfo = Util.null2String(rs.getString("signinfo"));
infos.add(signinfo); infos.add(signinfo);
} }
bb.writeLog("infos is:" + infos); bb.writeLog("infos is:" + infos);
// 定义时间格式
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
// 解析时间字符串为 LocalTime 对象
// LocalTime oldkssj = LocalTime.parse(kssj, formatter);
// LocalTime minKssj = LocalTime.parse("01:00:00", formatter);
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
for (String inf : infos) { for (String inf : infos) {
if (StringUtils.isNotEmpty(inf)) { if (StringUtils.isNotEmpty(inf)) {
Map<String, Object> in = mapStringToMap(inf); Map<String, Object> in = mapStringToMap(inf);
@ -91,27 +119,86 @@ public class OutSignSyncAction implements Action {
String deviceInfo = Util.null2String(in.get("deviceInfo")); String deviceInfo = Util.null2String(in.get("deviceInfo"));
String belongdateIsNull = Util.null2String(in.get("belongdateIsNull")); String belongdateIsNull = Util.null2String(in.get("belongdateIsNull"));
String punchSql = "insert into HrmScheduleSign(userId,userType,signType,signDate,signTime,clientAddress,isInCom,timeZone,belongdate,signfrom,longitude,latitude,addr,deviceInfo,isdev) " + // if (!oldkssj.isBefore(minKssj)) {
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; // // 减去一小时
boolean isok = rs.executeUpdate(punchSql, resourceid, userType, signType, signDate, signTime, clientAddress, isInCom, // LocalTime previousHour = oldkssj.minusHours(1);
timeZone, belongdate, signfrom, longitude, latitude, address, deviceInfo, "1"); // LocalTime signTimeLt = LocalTime.parse(signTime, formatter);
bb.writeLog("isok: " + isok); // if (signTimeLt.isBefore(previousHour)) {
//同步更新考勤数据到考勤报表 // continue;
if ("true".equals(belongdateIsNull)) { // }
//外勤签到没有归属日期,遇到跨天班次打卡可能归属前一天,需要格式化前一天考勤 // }
bb.writeLog("PunchOutButtonCmd:userId:" + userId + ":belongdate:" + DateUtil.getYesterday()); // 判断是否关账
new KQFormatBiz().formatDate("" + userId, DateUtil.getYesterday()); int userSubCompany1 = 0;
int userDepartment = 0;
if (userSubCompany1 <= 0 || userDepartment <= 0) {
rs.execute("select departmentid, subcompanyid1 from hrmresource where id = " + userId);
if (rs.next()) {
userSubCompany1 = rs.getInt("subcompanyid1");
userDepartment = rs.getInt("departmentid");
}
} }
bb.writeLog("PunchOutButtonCmd:userId:" + userId + ":belongdate:" + (belongdate.length() == 0 ? DateUtil.getCurrentDate() : belongdate)); String sqlDateA = "";
if (belongdate.length() == 0) { if (StringUtils.isNotBlank(belongdate)) {
//外勤签到没有归属日期,遇到跨天班次打卡可能归属前一天,需要格式化前一天考勤 sqlDateA = belongdate;
new KQFormatBiz().formatDate("" + userId, DateUtil.getYesterday()); } else {
sqlDateA = signDate;
} }
new KQFormatBiz().formatDate("" + userId, (belongdate.length() == 0 ? DateUtil.getCurrentDate() : belongdate)); String gzSql = "select count(*) as cnt from uf_kqfz where (','+CAST(bm AS varchar(max))+',' like '%,'+CAST("+userDepartment+" AS varchar(10))+',%' " +
//外勤签到转的考勤 处理加班规则 "or ','+CAST(fb AS varchar(max))+',' like '%,'+CAST("+userSubCompany1+" AS varchar(10))+',%') and fczt = 1 and fzksrq <= '" + sqlDateA +"' and fzjsrq >= '" + sqlDateA + "'";
SplitActionUtil.pushOverTimeTasksAll(belongdate, belongdate, "" + userId); rs.execute(gzSql);
} boolean isClose = false;
if (rs.next()) {
int cnt = rs.getInt("cnt");
if (cnt > 0) {
isClose = true;
}
}
if (!isClose) {
String punchSql = "insert into HrmScheduleSign(userId,userType,signType,signDate,signTime,clientAddress,isInCom,timeZone,belongdate,signfrom,longitude,latitude,addr,deviceInfo,isdev) " +
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
boolean isok = rs.executeUpdate(punchSql, userId, userType, signType, signDate, signTime, clientAddress, isInCom,
timeZone, belongdate, signfrom, longitude, latitude, address, deviceInfo, "1");
bb.writeLog("isok: " + isok);
//同步更新考勤数据到考勤报表
if ("true".equals(belongdateIsNull)) {
//外勤签到没有归属日期,遇到跨天班次打卡可能归属前一天,需要格式化前一天考勤
bb.writeLog("PunchOutButtonCmd:userId:" + userId + ":belongdate:" + DateUtil.getYesterday());
new KQFormatBiz().formatDate(userId, DateUtil.getYesterday());
}
bb.writeLog("PunchOutButtonCmd:userId:" + userId + ":belongdate:" + (belongdate.length() == 0 ? DateUtil.getCurrentDate() : belongdate));
if (belongdate.length() == 0) {
//外勤签到没有归属日期,遇到跨天班次打卡可能归属前一天,需要格式化前一天考勤
new KQFormatBiz().formatDate(userId, DateUtil.getYesterday());
}
// new KQFormatBiz().formatDate(userId, (belongdate.length() == 0 ? DateUtil.getCurrentDate() : belongdate));
Date date = dateFormat.parse(signDate);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DATE, -1); // 减去一天
Date previousDay = calendar.getTime();
String previousDayString = dateFormat.format(previousDay);
new KQFormatBiz().formatDate(userId, signDate);
new KQFormatBiz().formatDate(userId, previousDayString);
//外勤签到转的考勤 处理加班规则
SplitActionUtil.pushOverTimeTasksAll(signDate, signDate, userId);
SplitActionUtil.pushOverTimeTasksAll(previousDayString, previousDayString, userId);
if (belongdate.length() != 0 && !StringUtils.equals(belongdate, signDate)) {
new KQFormatBiz().formatDate(userId, belongdate);
SplitActionUtil.pushOverTimeTasksAll(belongdate, belongdate, userId);
Date dateA = dateFormat.parse(belongdate);
Calendar calendarA = Calendar.getInstance();
calendarA.setTime(dateA);
calendarA.add(Calendar.DATE, -1); // 减去一天
Date previousDayA = calendar.getTime();
String previousDayAString = dateFormat.format(previousDayA);
new KQFormatBiz().formatDate(userId, previousDayAString);
SplitActionUtil.pushOverTimeTasksAll(previousDayAString, previousDayAString, userId);
}
} else {
bb.writeLog("OutSignSyncAction is close:" + userId + "、" + sqlDateA);
}
}
} }
} }
} catch (Exception e) { } catch (Exception e) {

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save