出差流程没有外勤打卡不计算考勤

dev-chenwnj
chenwei 1 year ago
parent addf7c3bf7
commit 21999092a9

@ -716,8 +716,8 @@ public class KQReportBiz extends BaseBean {
sqlWhere += " and c.loginid is not null " + (rs.getDBType().equals("oracle") ? "" : " and c.loginid<>'' "); sqlWhere += " and c.loginid is not null " + (rs.getDBType().equals("oracle") ? "" : " and c.loginid<>'' ");
} }
sql = " select * from (select * from uf_casleave a left join hrmresource on a.resourceid = b.id " + sql = " select * from (select * from uf_casleave a left join hrmresource b on a.resourceid = b.id " +
" where a.startdate >='" + fromDate + "' and a.enddate <='" + toDate +"' and (isdecu = 0 or isdecu is null ) ) c where 1=1 " + sqlWhere; " where a.startdate >='" + fromDate + "' and a.enddate <='" + toDate +"' and (a.isdecu = 0 or a.isdecu is null ) ) c where 1=1 " + sqlWhere;
basebean.writeLog("getToComLeaveData sql: " + sql); basebean.writeLog("getToComLeaveData sql: " + sql);
rs.executeQuery(sql); rs.executeQuery(sql);
@ -987,6 +987,7 @@ public class KQReportBiz extends BaseBean {
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
String sql = ""; String sql = "";
String sqlWhere = " "; String sqlWhere = " ";
String sqlWhere1 = " ";
try { try {
KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo(); KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo();
KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo(); KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo();
@ -1022,25 +1023,31 @@ public class KQReportBiz extends BaseBean {
String viewScope = Util.null2String(jsonObj.get("viewScope")); String viewScope = Util.null2String(jsonObj.get("viewScope"));
if (subCompanyId.length() > 0) { if (subCompanyId.length() > 0) {
sqlWhere += " and c.subcompanyid1 in(" + subCompanyId + ") "; sqlWhere += " and c.subcompanyid1 in(" + subCompanyId + ") ";
sqlWhere1 += " and c.subcompanyid1 in(" + subCompanyId + ") ";
} }
if (departmentId.length() > 0) { if (departmentId.length() > 0) {
sqlWhere += " and c.departmentid in(" + departmentId + ") "; sqlWhere += " and c.departmentid in(" + departmentId + ") ";
sqlWhere1 += " and c.departmentid in(" + departmentId + ") ";
} }
if (resourceId.length() > 0) { if (resourceId.length() > 0) {
sqlWhere += " and c.resourceid in(" + resourceId + ") "; sqlWhere += " and c.resourceid in(" + resourceId + ") ";
sqlWhere1 += " and c.jbry in(" + resourceId + ") ";
} }
if (viewScope.equals("4")) {//我的下属 if (viewScope.equals("4")) {//我的下属
if (allLevel.equals("1")) {//所有下属 if (allLevel.equals("1")) {//所有下属
sqlWhere += " and c.managerstr like '%," + user.getUID() + ",%'"; sqlWhere += " and c.managerstr like '%," + user.getUID() + ",%'";
sqlWhere1 += " and c.managerstr like '%," + user.getUID() + ",%'";
} else { } else {
sqlWhere += " and c.managerid=" + user.getUID();//直接下属 sqlWhere += " and c.managerid=" + user.getUID();//直接下属
sqlWhere1 += " and c.managerid=" + user.getUID();//直接下属
} }
} }
if (!"1".equals(isNoAccount)) { if (!"1".equals(isNoAccount)) {
sqlWhere += " and c.loginid is not null " + (rs.getDBType().equals("oracle") ? "" : " and c.loginid<>'' "); sqlWhere += " and c.loginid is not null " + (rs.getDBType().equals("oracle") ? "" : " and c.loginid<>'' ");
sqlWhere1 += " and c.loginid is not null " + (rs.getDBType().equals("oracle") ? "" : " and c.loginid<>'' ");
} }
//初始化需要检查的加班申请时长 //初始化需要检查的加班申请时长
int beginIdx = kqTimesArrayComInfo.getArrayindexByTimes("05:00"); int beginIdx = kqTimesArrayComInfo.getArrayindexByTimes("05:00");
@ -1079,7 +1086,7 @@ public class KQReportBiz extends BaseBean {
" select a.jbry, a.ksrq, a.kssj, a.jsrq, a.jssj, b.subcompanyid1, b.departmentid, b.managerstr, b.managerid, b.loginid " + " select a.jbry, a.ksrq, a.kssj, a.jsrq, a.jssj, b.subcompanyid1, b.departmentid, b.managerstr, b.managerid, b.loginid " +
" FROM "+overtimeBatchTableName+"_dt1 a " + " FROM "+overtimeBatchTableName+"_dt1 a " +
" left join hrmresource b on b.id = a.jbry " + " left join hrmresource b on b.id = a.jbry " +
" ) c where c.ksrq >= '"+fromDate+"' and c.jsrq <='" + toDate + "' " + sqlWhere; " ) c where c.ksrq >= '"+fromDate+"' and c.jsrq <='" + toDate + "' " + sqlWhere1;
rs.executeQuery(acqOverTimeBatchSql); rs.executeQuery(acqOverTimeBatchSql);
while (rs.next()) { while (rs.next()) {
String resourceid = Util.null2String(rs.getString("jbry")); String resourceid = Util.null2String(rs.getString("jbry"));

@ -21,6 +21,8 @@ import weaver.interfaces.schedule.BaseCronJob;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.Instant;
import java.util.*; import java.util.*;
import static weaver.interfaces.sskj.util.HttpsUtil.doPostJsonRequest; import static weaver.interfaces.sskj.util.HttpsUtil.doPostJsonRequest;
@ -29,36 +31,18 @@ import static weaver.interfaces.sskj.util.HttpsUtil.doPostJsonRequest;
/** /**
* Created with IntelliJ IDEA. * Created with IntelliJ IDEA.
* OA * OA
* @Auther: chenxu * @Auther: chenwnj
* @Date: 2023/02/27/14:03 * @Date: 2023/02/27/14:03
* @Description: * @Description:
*/ */
public class SyncZkKqDataJob extends BaseCronJob { public class SyncZkKqDataJob extends BaseCronJob {
private String startTime;
private String endTime;
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
@Override @Override
public void execute() { public void execute() {
new BaseBean(); new BaseBean();
BaseBean bb = new BaseBean(); BaseBean bb = new BaseBean();
bb.writeLog("获取中控的考勤数据同步至OA"); bb.writeLog("获取中控的考勤数据同步至OA");
Instant startDoTime = Instant.now();
try { try {
//获取所有在职人员的id和workcode //获取所有在职人员的id和workcode
Map<String, String> idWorkcodeMap = new HashMap<>(); Map<String, String> idWorkcodeMap = new HashMap<>();
@ -74,9 +58,11 @@ public class SyncZkKqDataJob extends BaseCronJob {
} }
//获取开始时间结束时间 //获取开始时间结束时间
String startTime = "";
String endTime = "";
bb.writeLog("startTime = " + startTime); bb.writeLog("startTime = " + startTime);
bb.writeLog("endTime = " + endTime); bb.writeLog("endTime = " + endTime);
if (StringUtils.isBlank(startTime) && StringUtils.isNotBlank(endTime)) { if (StringUtils.isBlank(startTime) && StringUtils.isBlank(endTime)) {
Calendar beforeTime = Calendar.getInstance(); Calendar beforeTime = Calendar.getInstance();
beforeTime.add(Calendar.MINUTE, -5);// 5分钟之前的时间 beforeTime.add(Calendar.MINUTE, -5);// 5分钟之前的时间
Date beforeD = beforeTime.getTime(); Date beforeD = beforeTime.getTime();
@ -229,21 +215,21 @@ public class SyncZkKqDataJob extends BaseCronJob {
" values (?,?,?,?,?,?,?,?,?,?)"; " values (?,?,?,?,?,?,?,?,?,?)";
boolean bLog = rsB.executeBatchSql(addLogSql, logParams); boolean bLog = rsB.executeBatchSql(addLogSql, logParams);
bb.writeLog("bLog: " + bLog); bb.writeLog("bLog: " + bLog);
if (bLog) { // if (bLog) {
List<Integer> billids = new ArrayList<>(); // List<Integer> billids = new ArrayList<>();
Map<Integer,Integer> billid_creator = new HashMap<>(); // Map<Integer,Integer> billid_creator = new HashMap<>();
String acqBillidsSql = "select id from uf_kqsynclog where id > ?"; // String acqBillidsSql = "select id from uf_kqsynclog where id > ?";
rsB.executeQuery(acqBillidsSql, maxId); // rsB.executeQuery(acqBillidsSql, maxId);
while (rsB.next()) { // while (rsB.next()) {
Integer id = Util.getIntValue(Util.null2String(rsB.getString("id"))); // Integer id = Util.getIntValue(Util.null2String(rsB.getString("id")));
billids.add(id); // billids.add(id);
billid_creator.put(id, 1); // billid_creator.put(id, 1);
} // }
if (billids != null && billids.size() > 0) { // if (billids != null && billids.size() > 0) {
SskjUtil ssutil = new SskjUtil(); // SskjUtil ssutil = new SskjUtil();
ssutil.modePerReconBatch(billid_creator, kqSyncLogModeId, billids); // ssutil.modePerReconBatch(billid_creator, kqSyncLogModeId, billids);
} // }
} // }
//删除本次同步数据 //删除本次同步数据
bb.writeLog("lsDelParams: " + lsDelParams); bb.writeLog("lsDelParams: " + lsDelParams);
@ -256,6 +242,8 @@ public class SyncZkKqDataJob extends BaseCronJob {
boolean b2 = rsB.executeBatchSql(sql, lsParams); boolean b2 = rsB.executeBatchSql(sql, lsParams);
bb.writeLog("b2: " + b2); bb.writeLog("b2: " + b2);
bb.writeLog("lsFormatParams:"+JSON.toJSONString(lsFormatParams));
bb.writeLog("lsFormatParams.size:"+lsFormatParams.size());
new KQFormatBiz().format(lsFormatParams); new KQFormatBiz().format(lsFormatParams);
bb.writeLog("开始处理加班生成"); bb.writeLog("开始处理加班生成");
@ -276,6 +264,11 @@ public class SyncZkKqDataJob extends BaseCronJob {
e.printStackTrace(); e.printStackTrace();
bb.writeLog(e); bb.writeLog(e);
bb.writeLog("获取中控的考勤数据同步至OA--error"+e.getMessage()); bb.writeLog("获取中控的考勤数据同步至OA--error"+e.getMessage());
}finally {
Instant endDoTime = Instant.now();
Duration timeElapsed = Duration.between(startDoTime, endDoTime);
bb.writeLog("中控考勤数据同步代码执行时间: " + timeElapsed.toMillis() + " 毫秒");
} }
} }

Loading…
Cancel
Save