考勤上线后问题处理

dev-chenwnj
chenwei 1 year ago
parent 98b6e1847f
commit 7cb5afa79d

@ -370,245 +370,245 @@ public class KQFormatSignData extends BaseBean {
} }
/*考勤二开--出差公出流程获取外勤打卡数据start*/ /*考勤二开--出差公出流程获取外勤打卡数据start*/
BaseBean bb = new BaseBean(); // BaseBean bb = new BaseBean();
//
bb.writeLog("+-出差公出流程获取外勤打卡数据start"); // bb.writeLog("+-出差公出流程获取外勤打卡数据start");
bb.writeLog("lsCheckInfo: " + lsCheckInfo); // bb.writeLog("lsCheckInfo: " + lsCheckInfo);
bb.writeLog("lsCheckInfo.size(): " + lsCheckInfo.size()); // bb.writeLog("lsCheckInfo.size(): " + lsCheckInfo.size());
//获取外勤打卡的前提是已经有归档的出差、公出流程 // //获取外勤打卡的前提是已经有归档的出差、公出流程
String evectionTableName = Util.null2String(bb.getPropValue("project_hostar","evectionTableName")); // String evectionTableName = Util.null2String(bb.getPropValue("project_hostar","evectionTableName"));
// bb.writeLog("evectionTableName: " + evectionTableName); //// bb.writeLog("evectionTableName: " + evectionTableName);
//
String outTableName = Util.null2String(bb.getPropValue("project_hostar","outTableName")); // String outTableName = Util.null2String(bb.getPropValue("project_hostar","outTableName"));
// bb.writeLog("outTableName: " + outTableName); //// bb.writeLog("outTableName: " + outTableName);
//
if ( StringUtils.isNotBlank(evectionTableName) && StringUtils.isNotBlank(outTableName) ) { // if ( StringUtils.isNotBlank(evectionTableName) && StringUtils.isNotBlank(outTableName) ) {
RecordSet rs = new RecordSet(); // RecordSet rs = new RecordSet();
Integer number = -1; // Integer number = -1;
String acqEvecAndOutSql = " select sum(a.number) as number " + // String acqEvecAndOutSql = " select sum(a.number) as number " +
" from ( " + // " from ( " +
" SELECT " + // " SELECT " +
" count(*) as number " + // " count(*) as number " +
" FROM " + // " FROM " +
" workflow_requestbase " + // " workflow_requestbase " +
" WHERE " + // " WHERE " +
" requestid IN ( SELECT requestid FROM "+evectionTableName+" WHERE sqr = '"+userId+"' and ksrq <='"+kqDate+"' and yjjsrq >='"+kqDate+"' ) " + // " requestid IN ( SELECT requestid FROM "+evectionTableName+" WHERE sqr = '"+userId+"' and ksrq <='"+kqDate+"' and yjjsrq >='"+kqDate+"' ) " +
" AND currentnodetype = 3 " +
" UNION all " +
" SELECT " +
" count(*) as number " +
" FROM " +
" workflow_requestbase " +
" WHERE " +
" requestid IN ( SELECT requestid FROM "+outTableName+" WHERE sqr = '"+userId+"' and ksrq <='"+kqDate+"' and yjjsrq >='"+kqDate+"') " +
// " AND currentnodetype = 3 " + // " AND currentnodetype = 3 " +
") a "; // " UNION all " +
rs.executeQuery(acqEvecAndOutSql); // " SELECT " +
// bb.writeLog("acqEvecAndOutSql: " + acqEvecAndOutSql); // " count(*) as number " +
// " FROM " +
while (rs.next()) { // " workflow_requestbase " +
number = Util.getIntValue(Util.null2String(rs.getString("number"))); // " WHERE " +
} // " requestid IN ( SELECT requestid FROM "+outTableName+" WHERE sqr = '"+userId+"' and ksrq <='"+kqDate+"' and yjjsrq >='"+kqDate+"') " +
bb.writeLog("number: " + number); //// " AND currentnodetype = 3 " +
// ") a ";
if (lsCheckInfo.size() < 2 && number > 0) {//只考虑每天一次上下班,原始打卡记录没有取到两次打卡记录则考虑外勤打卡 // rs.executeQuery(acqEvecAndOutSql);
List<String> legWorkInfos = new ArrayList<>(); //// bb.writeLog("acqEvecAndOutSql: " + acqEvecAndOutSql);
//获取允许打卡时间 //
String signBeginTime = signTimeScope.getBeginTime(); // while (rs.next()) {
// bb.writeLog("signBeginTime: " + signBeginTime); // number = Util.getIntValue(Util.null2String(rs.getString("number")));
if (StringUtils.isNotBlank(signBeginTime)) { // }
signBeginTime = signBeginTime + ":00"; // bb.writeLog("number: " + number);
} //
// bb.writeLog("signBeginTime: " + signBeginTime); // if (lsCheckInfo.size() < 2 && number > 0) {//只考虑每天一次上下班,原始打卡记录没有取到两次打卡记录则考虑外勤打卡
//获取上班时间 // List<String> legWorkInfos = new ArrayList<>();
String workBeginTime = workTimeScope.getBeginTime(); // //获取允许打卡时间
// bb.writeLog("workBeginTime: " + workBeginTime); // String signBeginTime = signTimeScope.getBeginTime();
if (StringUtils.isNotBlank(workBeginTime)) { //// bb.writeLog("signBeginTime: " + signBeginTime);
workBeginTime = workBeginTime + ":00"; // if (StringUtils.isNotBlank(signBeginTime)) {
} // signBeginTime = signBeginTime + ":00";
// bb.writeLog("workBeginTime: " + workBeginTime); // }
//// bb.writeLog("signBeginTime: " + signBeginTime);
String acqLegWorkSignSql = "select operate_time from mobile_sign where operater = ? and operate_date = '" + kqDate + "' and operate_time >='" + signBeginTime + "' order by operate_time asc "; // //获取上班时间
bb.writeLog("acqLegWorkSignSql: " + acqLegWorkSignSql); // String workBeginTime = workTimeScope.getBeginTime();
// bb.writeLog("userId: " + userId); //// bb.writeLog("workBeginTime: " + workBeginTime);
rs.executeQuery(acqLegWorkSignSql, userId); // if (StringUtils.isNotBlank(workBeginTime)) {
while ( rs.next()) { // workBeginTime = workBeginTime + ":00";
String operateTime = Util.null2String(rs.getString("operate_time")); // }
if ( StringUtils.isNotBlank(operateTime) ) { //// bb.writeLog("workBeginTime: " + workBeginTime);
legWorkInfos.add(operateTime); //
} // String acqLegWorkSignSql = "select operate_time from mobile_sign where operater = ? and operate_date = '" + kqDate + "' and operate_time >='" + signBeginTime + "' order by operate_time asc ";
} // bb.writeLog("acqLegWorkSignSql: " + acqLegWorkSignSql);
bb.writeLog("legWorkInfos: " + legWorkInfos); //// bb.writeLog("userId: " + userId);
// rs.executeQuery(acqLegWorkSignSql, userId);
if (legWorkInfos != null && legWorkInfos.size() > 0 ) { // while ( rs.next()) {
boolean onFlag = false;//上班卡 // String operateTime = Util.null2String(rs.getString("operate_time"));
boolean offFlag = false;//下班卡 // if ( StringUtils.isNotBlank(operateTime) ) {
// legWorkInfos.add(operateTime);
//判断需要获取的打卡 // }
for(Object obj: lsCheckInfo) { // }
if (obj != null) {
Map<String, Object> checkInfo = (Map<String, Object> ) obj;
Integer signType = Util.getIntValue(Util.null2String(checkInfo.get("signType")));
if (signType == 1) {
onFlag = true;
}
if (signType == 2) {
offFlag = true;
}
}
}
String tempSignIn = "";
String tempSignOut = "";
Map<String, Object> checkInfo = new HashMap<>();
if ( legWorkInfos.size() == 1) {//只有一笔外勤卡直接算上班
if ( onFlag && !offFlag ) {
checkInfo.put("signType", "2");
checkInfo.put("signDate", kqDate);//签到签退日期
checkInfo.put("signTime", legWorkInfos.get(0));//签到签退时间
checkInfo.put("deduct_signintime", "");//流程抵扣作为打卡时间
checkInfo.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode());
lsCheckInfo.add(checkInfo);
}
if ( !onFlag && offFlag ) {
checkInfo.put("signType", "1");
checkInfo.put("signDate", kqDate);//签到签退日期
checkInfo.put("signTime", legWorkInfos.get(0));//签到签退时间
checkInfo.put("deduct_signintime", "");//流程抵扣作为打卡时间
checkInfo.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode());
lsCheckInfo.add(checkInfo);
}
} else {
for ( String signTime : legWorkInfos) {
if (signTime.compareTo(workBeginTime) < 0) {//获取上班时间点之前最早的一笔卡
if (StringUtils.isBlank(tempSignIn)) {
tempSignIn = signTime;
} else {
if ( signTime.compareTo(tempSignIn) < 0 ) {
tempSignIn = signTime;
}
}
}
if ( signTime.compareTo(workBeginTime) > 0) {//下班卡取最晚的一笔
if (StringUtils.isBlank(tempSignIn)) {
tempSignOut = signTime;
} else {
if ( signTime.compareTo(tempSignOut) > 0 ) {
tempSignOut = signTime;
}
}
}
}
if (offFlag && !onFlag ) {
checkInfo.put("signType", "1");
checkInfo.put("signDate", kqDate);//签到签退日期
checkInfo.put("signTime", tempSignIn);//签到签退时间
checkInfo.put("deduct_signintime", "");//流程抵扣作为打卡时间
checkInfo.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode());
lsCheckInfo.add(checkInfo);
}
if (onFlag && !offFlag ) {
checkInfo = new HashMap<>();
checkInfo.put("signType", "2");
checkInfo.put("signDate", kqDate);//签到签退日期
checkInfo.put("signTime", tempSignOut);//签到签退时间
checkInfo.put("deduct_signintime", "");//流程抵扣作为打卡时间
checkInfo.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode());
lsCheckInfo.add(checkInfo);
}
}
}
} else if ( lsCheckInfo.size() == 2) {
List<String> legWorkInfos = new ArrayList<>();
//获取允许打卡时间
String signBeginTime = signTimeScope.getBeginTime();
// bb.writeLog("signBeginTime: " + signBeginTime);
if (StringUtils.isNotBlank(signBeginTime)) {
signBeginTime = signBeginTime + ":00";
}
// bb.writeLog("signBeginTime: " + signBeginTime);
//获取上班时间
String workBeginTime = workTimeScope.getBeginTime();
// bb.writeLog("workBeginTime: " + workBeginTime);
if (StringUtils.isNotBlank(workBeginTime)) {
workBeginTime = workBeginTime + ":00";
}
// bb.writeLog("workBeginTime: " + workBeginTime);
String acqLegWorkSignSql = "select operate_time from mobile_sign where operater = ? and operate_date = '" + kqDate + "' and operate_time >='" + signBeginTime + "' order by operate_time asc ";
bb.writeLog("acqLegWorkSignSql: " + acqLegWorkSignSql);
bb.writeLog("userId: " + userId);
rs.executeQuery(acqLegWorkSignSql, userId);
while ( rs.next()) {
String operateTime = Util.null2String(rs.getString("operate_time"));
if ( StringUtils.isNotBlank(operateTime) ) {
legWorkInfos.add(operateTime);
}
}
// bb.writeLog("legWorkInfos: " + legWorkInfos); // bb.writeLog("legWorkInfos: " + legWorkInfos);
//
if (legWorkInfos != null && legWorkInfos.size() > 0 ) { // if (legWorkInfos != null && legWorkInfos.size() > 0 ) {
// boolean onFlag = false;//上班卡
String tempSignIn = ""; // boolean offFlag = false;//下班卡
String tempSignOut = ""; //
Map<String, Object> checkInfo = new HashMap<>(); // //判断需要获取的打卡
if ( legWorkInfos.size() == 1) {//只有一笔外勤卡直接算上班 // for(Object obj: lsCheckInfo) {
// if (obj != null) {
checkInfo.put("signType", "1"); // Map<String, Object> checkInfo = (Map<String, Object> ) obj;
checkInfo.put("signDate", kqDate);//签到签退日期 // Integer signType = Util.getIntValue(Util.null2String(checkInfo.get("signType")));
checkInfo.put("signTime", legWorkInfos.get(0));//签到签退时间 // if (signType == 1) {
checkInfo.put("deduct_signintime", "");//流程抵扣作为打卡时间 // onFlag = true;
checkInfo.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode()); // }
lsCheckInfo.add(checkInfo); // if (signType == 2) {
// offFlag = true;
// }
} else { // }
for ( String signTime : legWorkInfos) { // }
if (signTime.compareTo(workBeginTime) < 0) {//获取上班时间点之前最早的一笔卡 //
if (StringUtils.isBlank(tempSignIn)) { // String tempSignIn = "";
tempSignIn = signTime; // String tempSignOut = "";
} else { // Map<String, Object> checkInfo = new HashMap<>();
if ( signTime.compareTo(tempSignIn) < 0 ) { // if ( legWorkInfos.size() == 1) {//只有一笔外勤卡直接算上班
tempSignIn = signTime; // if ( onFlag && !offFlag ) {
} // checkInfo.put("signType", "2");
} // checkInfo.put("signDate", kqDate);//签到签退日期
} // checkInfo.put("signTime", legWorkInfos.get(0));//签到签退时间
if ( signTime.compareTo(workBeginTime) > 0) {//下班卡取最晚的一笔 // checkInfo.put("deduct_signintime", "");//流程抵扣作为打卡时间
if (StringUtils.isBlank(tempSignOut)) { // checkInfo.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode());
tempSignOut = signTime; // lsCheckInfo.add(checkInfo);
} else { // }
if ( signTime.compareTo(tempSignOut) > 0 ) { // if ( !onFlag && offFlag ) {
tempSignOut = signTime; // checkInfo.put("signType", "1");
} // checkInfo.put("signDate", kqDate);//签到签退日期
} // checkInfo.put("signTime", legWorkInfos.get(0));//签到签退时间
} // checkInfo.put("deduct_signintime", "");//流程抵扣作为打卡时间
} // checkInfo.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode());
// lsCheckInfo.add(checkInfo);
if(StringUtils.isNotBlank(tempSignIn)) { // }
checkInfo.put("signType", "1"); //
checkInfo.put("signDate", kqDate);//签到签退日期 // } else {
checkInfo.put("signTime", tempSignIn);//签到签退时间 // for ( String signTime : legWorkInfos) {
checkInfo.put("deduct_signintime", "");//流程抵扣作为打卡时间 // if (signTime.compareTo(workBeginTime) < 0) {//获取上班时间点之前最早的一笔卡
checkInfo.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode()); // if (StringUtils.isBlank(tempSignIn)) {
lsCheckInfo.add(checkInfo); // tempSignIn = signTime;
} // } else {
// if ( signTime.compareTo(tempSignIn) < 0 ) {
if(StringUtils.isNotBlank(tempSignIn)) { // tempSignIn = signTime;
checkInfo = new HashMap<>(); // }
checkInfo.put("signType", "2"); // }
checkInfo.put("signDate", kqDate);//签到签退日期 // }
checkInfo.put("signTime", tempSignOut);//签到签退时间 // if ( signTime.compareTo(workBeginTime) > 0) {//下班卡取最晚的一笔
checkInfo.put("deduct_signintime", "");//流程抵扣作为打卡时间 // if (StringUtils.isBlank(tempSignIn)) {
checkInfo.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode()); // tempSignOut = signTime;
lsCheckInfo.add(checkInfo); // } else {
} // if ( signTime.compareTo(tempSignOut) > 0 ) {
// tempSignOut = signTime;
} // }
} // }
} // }
} // }
bb.writeLog("lsCheckInfo: " + lsCheckInfo); // if (offFlag && !onFlag ) {
// checkInfo.put("signType", "1");
// checkInfo.put("signDate", kqDate);//签到签退日期
// checkInfo.put("signTime", tempSignIn);//签到签退时间
// checkInfo.put("deduct_signintime", "");//流程抵扣作为打卡时间
// checkInfo.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode());
// lsCheckInfo.add(checkInfo);
// }
// if (onFlag && !offFlag ) {
// checkInfo = new HashMap<>();
// checkInfo.put("signType", "2");
// checkInfo.put("signDate", kqDate);//签到签退日期
// checkInfo.put("signTime", tempSignOut);//签到签退时间
// checkInfo.put("deduct_signintime", "");//流程抵扣作为打卡时间
// checkInfo.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode());
// lsCheckInfo.add(checkInfo);
// }
// }
// }
// } else if ( lsCheckInfo.size() == 2) {
// List<String> legWorkInfos = new ArrayList<>();
// //获取允许打卡时间
// String signBeginTime = signTimeScope.getBeginTime();
//// bb.writeLog("signBeginTime: " + signBeginTime);
// if (StringUtils.isNotBlank(signBeginTime)) {
// signBeginTime = signBeginTime + ":00";
// }
//// bb.writeLog("signBeginTime: " + signBeginTime);
// //获取上班时间
// String workBeginTime = workTimeScope.getBeginTime();
//// bb.writeLog("workBeginTime: " + workBeginTime);
// if (StringUtils.isNotBlank(workBeginTime)) {
// workBeginTime = workBeginTime + ":00";
// }
//// bb.writeLog("workBeginTime: " + workBeginTime);
//
// String acqLegWorkSignSql = "select operate_time from mobile_sign where operater = ? and operate_date = '" + kqDate + "' and operate_time >='" + signBeginTime + "' order by operate_time asc ";
// bb.writeLog("acqLegWorkSignSql: " + acqLegWorkSignSql);
// bb.writeLog("userId: " + userId);
// rs.executeQuery(acqLegWorkSignSql, userId);
// while ( rs.next()) {
// String operateTime = Util.null2String(rs.getString("operate_time"));
// if ( StringUtils.isNotBlank(operateTime) ) {
// legWorkInfos.add(operateTime);
// }
// }
//// bb.writeLog("legWorkInfos: " + legWorkInfos);
//
// if (legWorkInfos != null && legWorkInfos.size() > 0 ) {
//
// String tempSignIn = "";
// String tempSignOut = "";
// Map<String, Object> checkInfo = new HashMap<>();
// if ( legWorkInfos.size() == 1) {//只有一笔外勤卡直接算上班
//
// checkInfo.put("signType", "1");
// checkInfo.put("signDate", kqDate);//签到签退日期
// checkInfo.put("signTime", legWorkInfos.get(0));//签到签退时间
// checkInfo.put("deduct_signintime", "");//流程抵扣作为打卡时间
// checkInfo.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode());
// lsCheckInfo.add(checkInfo);
//
//
// } else {
// for ( String signTime : legWorkInfos) {
// if (signTime.compareTo(workBeginTime) < 0) {//获取上班时间点之前最早的一笔卡
// if (StringUtils.isBlank(tempSignIn)) {
// tempSignIn = signTime;
// } else {
// if ( signTime.compareTo(tempSignIn) < 0 ) {
// tempSignIn = signTime;
// }
// }
// }
// if ( signTime.compareTo(workBeginTime) > 0) {//下班卡取最晚的一笔
// if (StringUtils.isBlank(tempSignOut)) {
// tempSignOut = signTime;
// } else {
// if ( signTime.compareTo(tempSignOut) > 0 ) {
// tempSignOut = signTime;
// }
// }
// }
// }
//
// if(StringUtils.isNotBlank(tempSignIn)) {
// checkInfo.put("signType", "1");
// checkInfo.put("signDate", kqDate);//签到签退日期
// checkInfo.put("signTime", tempSignIn);//签到签退时间
// checkInfo.put("deduct_signintime", "");//流程抵扣作为打卡时间
// checkInfo.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode());
// lsCheckInfo.add(checkInfo);
// }
//
// if(StringUtils.isNotBlank(tempSignIn)) {
// checkInfo = new HashMap<>();
// checkInfo.put("signType", "2");
// checkInfo.put("signDate", kqDate);//签到签退日期
// checkInfo.put("signTime", tempSignOut);//签到签退时间
// checkInfo.put("deduct_signintime", "");//流程抵扣作为打卡时间
// checkInfo.put("signStatus", ButtonStatusEnum.NORMAL.getStatusCode());
// lsCheckInfo.add(checkInfo);
// }
//
// }
// }
// }
// }
// bb.writeLog("lsCheckInfo: " + lsCheckInfo);
/*考勤二开--出差公出流程获取外勤打卡数据end*/ /*考勤二开--出差公出流程获取外勤打卡数据end*/

@ -6,6 +6,7 @@ import com.cloudstore.dev.api.util.EMManager;
import com.engine.common.biz.AbstractCommonCommand; import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext; import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext; import com.engine.core.interceptor.CommandContext;
import com.engine.hostar.util.HostarUtil;
import com.engine.kq.biz.*; import com.engine.kq.biz.*;
import com.engine.kq.entity.KQGroupEntity; import com.engine.kq.entity.KQGroupEntity;
import com.engine.kq.entity.WorkTimeEntity; import com.engine.kq.entity.WorkTimeEntity;
@ -26,11 +27,8 @@ import weaver.systeminfo.SystemEnv;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set;
/** /**
* 退 * 退
@ -359,6 +357,73 @@ public class PunchOutButtonCmd extends AbstractCommonCommand<Map<String, Object>
new KQFormatBiz().formatDate(""+userId,(belongdate.length() == 0 ? DateUtil.getCurrentDate() : belongdate)); new KQFormatBiz().formatDate(""+userId,(belongdate.length() == 0 ? DateUtil.getCurrentDate() : belongdate));
//外勤签到转的考勤 处理加班规则 //外勤签到转的考勤 处理加班规则
SplitActionUtil.pushOverTimeTasksAll(belongdate,belongdate,""+userId); SplitActionUtil.pushOverTimeTasksAll(belongdate,belongdate,""+userId);
} else {
String acqSql = "select id from mobile_sign where operater = ? and operate_date = ? and operate_time = ? ";
rs.executeQuery(acqSql, userId, signDate, signTime);
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("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 = rs.executeUpdate(syncSql, id, signInfoString, outSignTypeModeId, modedatacreater, modedatacreatertype, modedatacreatedate, modedatacreatetime, abnUuid);
if (b) {
String billid = "-1";
String acqModeIdSql = "select id from uf_AbnAttToComLeave where MODEUUID = ?";
rs.executeQuery(acqModeIdSql, abnUuid);
while (rs.next()) {
billid = Util.null2String(rs.getString("id"));
}
bb.writeLog("billid" + billid);
new HostarUtil().modePerRecon(modedatacreater, outSignTypeModeId, billid);
}
}
}
} }
} }

@ -0,0 +1,119 @@
package weaver.interfaces.hostar.action;
import com.engine.kq.biz.KQFormatBiz;
import com.engine.kq.wfset.util.SplitActionUtil;
import org.apache.commons.lang3.StringUtils;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.Property;
import weaver.soa.workflow.request.RequestInfo;
import java.util.*;
public class OutSignSyncAction implements Action {
BaseBean bb = new BaseBean();
@Override
public String execute(RequestInfo requestInfo) {
String startDate = "";
String endDate = "";
String resourceid = "";
try {
Property[] properties = requestInfo.getMainTableInfo().getProperty();
for (Property property : properties) {
if ("ksrq".equals(property.getName())) {
startDate = Util.null2String(property.getValue());
}
if ("yjjsrq".equals(property.getName())) {
endDate = Util.null2String(property.getValue());
}
if ("sjccr".equals(property.getName())) {
resourceid = Util.null2String(property.getValue());
}
}
if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate) && StringUtils.isNotBlank(resourceid)) {
RecordSet rs = new RecordSet();
List<String> infos = new ArrayList<>();
String acqOutSignSql = "select a.id, c.signinfo " +
"from mobile_sign a " +
"left join uf_outsigntype c " +
"on c.outsignid = a.id " +
"where operate_date > '" + startDate + "' and operate_date < '" + endDate + "' and operate = ? ";
rs.executeQuery(acqOutSignSql, resourceid);
while (rs.next()) {
String signinfo = Util.null2String(rs.getString("signinfo"));
infos.add(signinfo);
}
for (String inf : infos) {
if (inf != null ) {
Map<String, Object> in = mapStringToMap(inf);
String userId = Util.null2String(in.get("userId"));
String userType = Util.null2String(in.get("userType"));
String signType = Util.null2String(in.get("signType"));
String signDate = Util.null2String(in.get("signDate"));
String signTime = Util.null2String(in.get("signTime"));
String clientAddress = Util.null2String(in.get("clientAddress"));
String isInCom = Util.null2String(in.get("isInCom"));
String timeZone = Util.null2String(in.get("timeZone"));
String belongdate = Util.null2String(in.get("belongdate"));
String signfrom = Util.null2String(in.get("signfrom"));
String longitude = Util.null2String(in.get("longitude"));
String latitude = Util.null2String(in.get("latitude"));
String address = Util.null2String(in.get("address"));
String deviceInfo = Util.null2String(in.get("deviceInfo"));
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) "+
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
boolean isok = rs.executeUpdate(punchSql,resourceid,userType,signType,signDate,signTime,clientAddress,isInCom,
timeZone,belongdate,signfrom,longitude,latitude,address,deviceInfo);
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));
//外勤签到转的考勤 处理加班规则
SplitActionUtil.pushOverTimeTasksAll(belongdate,belongdate,""+userId);
}
}
}
} catch (Exception e) {
bb.writeLog("OutSignSyncAction Exception: " + e);
return Action.FAILURE_AND_CONTINUE;
}
return Action.SUCCESS;
}
public static Map<String,Object> mapStringToMap(String str){
str = str.substring(1, str.length()-1);
String[] strs = str.split(",");
Map<String,Object> map = new HashMap<>();
for (String string : strs) {
String key = string.split("=")[0];
String value = string.split("=")[1];
// 去掉头部空格
String key1 = key.trim();
String value1 = value.trim();
map.put(key1, value1);
}
return map;
}
}
Loading…
Cancel
Save