dev
chenwei 1 year ago
parent 0d7251bd17
commit ee86e6f2cc

@ -1,19 +1,16 @@
package com.engine.kq.biz;
import com.alibaba.fastjson.JSON;
import com.engine.kq.entity.TimeScopeEntity;
import com.engine.kq.entity.WorkTimeEntity;
import com.engine.kq.log.KQLog;
import java.io.PrintWriter;
import java.io.StringWriter;
import weaver.common.DateUtil;
import weaver.conn.BatchRecordSet;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.systeminfo.SystemEnv;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.*;
/**

@ -6,16 +6,11 @@ import com.engine.kq.cmd.attendanceButton.ButtonStatusEnum;
import com.engine.kq.enums.KqSplitFlowTypeEnum;
import com.engine.kq.log.KQLog;
import com.engine.kq.util.KQDurationCalculatorUtil;
import java.text.DecimalFormatSymbols;
import java.util.Map.Entry;
import com.engine.kq.util.KQTransMethod;
import org.apache.commons.lang3.StringUtils;
import weaver.common.DateUtil;
import weaver.common.StringUtil;
import weaver.conn.RecordSet;
import weaver.file.Prop;
import weaver.general.BaseBean;
import weaver.general.TimeUtil;
import weaver.general.Util;
@ -24,7 +19,9 @@ import weaver.hrm.User;
import weaver.systeminfo.SystemEnv;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.*;
import java.util.Map.Entry;
public class KQReportBiz extends BaseBean {
@ -1126,10 +1123,10 @@ public class KQReportBiz extends BaseBean {
sqlWhere += " and b.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and b.loginid<>'' ");
}
sql = " select resourceId, kqDate from uf_reportsyncdata a " +
sql = " select a.resourceId, a.kqDate from uf_reportsyncdata a " +
" left join hrmresource b " +
" on b.id = a.resourceId " +
" where a.kqDate >='"+fromDate+"' and a.kqDate <='" + toDate +"' " + sqlWhere;
" where a.kqDate >='"+fromDate+"' and a.kqDate <='" + toDate +"' " + sqlWhere + "group by a.resourceId, a.kqDate";
bb.writeLog("----sql: " + sql);
rs.executeQuery(sql);
while (rs.next()) {
@ -1152,6 +1149,7 @@ public class KQReportBiz extends BaseBean {
}catch (Exception e){
writeLog(e);
}
bb.writeLog("--datas: " + datas);
return datas;
}

@ -5,7 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.kq.biz.*;
import com.engine.kq.biz.KQReportBiz;
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
import com.engine.kq.util.ExcelUtil;
import com.engine.kq.util.KQDurationCalculatorUtil;
@ -20,6 +20,7 @@ import weaver.hrm.company.SubCompanyComInfo;
import weaver.hrm.job.JobTitlesComInfo;
import weaver.hrm.resource.ResourceComInfo;
import weaver.systeminfo.SystemEnv;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
@ -435,7 +436,7 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand<Map<String, Objec
fieldValue=kqdate+" "+com.engine.portal.util.DateUtil.getDayWeekOfDate1(DateUtil.parseToDate(kqdate));
} else if (fieldName.equals("reportEve")) {//考勤二开--日报转出差
bb.writeLog("reportEve start");
Integer temp = Util.getIntValue(Util.null2String(flowData.get("DailyReportEve|" + resourceId + "|" +kqdate)));
Integer temp = Util.getIntValue(Util.null2String(flowData.get("DailyReportEve|" + id + "|" +kqdate)));
bb.writeLog("temp: " + temp);
if (temp ==1 ) {
data.add(temp);

@ -5,12 +5,12 @@ import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.kq.biz.*;
import com.engine.kq.biz.KQFormatBiz;
import com.engine.kq.biz.KQReportBiz;
import com.engine.kq.util.ExcelUtil;
import com.engine.kq.util.KQDurationCalculatorUtil;
import com.engine.kq.util.UtilKQ;
import weaver.common.DateUtil;
import weaver.common.StringUtil;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.TimeUtil;
@ -21,10 +21,10 @@ import weaver.hrm.company.SubCompanyComInfo;
import weaver.hrm.job.JobTitlesComInfo;
import weaver.hrm.resource.ResourceComInfo;
import weaver.systeminfo.SystemEnv;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.*;
public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
@ -403,7 +403,7 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
continue;
}else if (fieldName.equals("reportEve")) {//考勤二开--日报转出差
bb.writeLog("--reportEve start");
Integer temp = Util.getIntValue(Util.null2String(flowData.get("ReportEve|" + resourceId)));
Integer temp = Util.getIntValue(Util.null2String(flowData.get("ReportEve|" + id)));
bb.writeLog("--temp: " + temp);
if (temp <= 0 ) {
data.add(0);

@ -5,18 +5,15 @@ import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.kq.biz.*;
import com.engine.kq.biz.KQReportBiz;
import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit;
import com.engine.kq.entity.WorkTimeEntity;
import com.engine.kq.log.KQLog;
import com.engine.kq.util.KQDurationCalculatorUtil;
import com.engine.kq.util.PageUidFactory;
import java.math.BigDecimal;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.company.SubCompanyComInfo;
@ -24,6 +21,7 @@ import weaver.hrm.job.JobTitlesComInfo;
import weaver.hrm.resource.ResourceComInfo;
import weaver.systeminfo.SystemEnv;
import java.math.BigDecimal;
import java.util.*;
public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Object>> {
@ -327,7 +325,7 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand<Map<String, Objec
}
}
}else if (fieldName.equals("reportEve")) {//考勤二开--日报转出差
Integer temp = Util.getIntValue(Util.null2String(flowData.get("DailyReportEve|" + resourceId + "|" +kqdate)));
Integer temp = Util.getIntValue(Util.null2String(flowData.get("DailyReportEve|" + id + "|" +kqdate)));
if (temp ==1 ) {
data.put(fieldName, temp);
} else {

@ -5,8 +5,8 @@ import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.kq.biz.*;
import com.engine.kq.log.KQLog;
import com.engine.kq.biz.KQFormatBiz;
import com.engine.kq.biz.KQReportBiz;
import com.engine.kq.util.KQDurationCalculatorUtil;
import com.engine.kq.util.PageUidFactory;
import weaver.common.DateUtil;
@ -325,7 +325,7 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
params.put("uintType",uintType);
params.put("hoursToDay",hoursToDay);
Map<String,Object> flowData = kqReportBiz.getFlowData(params,user);
bb.writeLog("--flowData: " + flowData);
rs.execute(sql);
while (rs.next()) {
@ -425,8 +425,9 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id+"|"+fieldName)));
}
}else if (fieldName.equals("reportEve")) {//考勤二开--日报转出差
Integer temp = Util.getIntValue(Util.null2String(flowData.get("ReportEve|" + resourceId)));
bb.writeLog("--id: " + id);
Integer temp = Util.getIntValue(Util.null2String(flowData.get("ReportEve|" + id)));
bb.writeLog("--temp: " + temp);
if (temp <= 0 ) {
fieldValue = "0";

@ -1,18 +1,10 @@
package com.engine.kq.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.apache.poi.ss.util.RegionUtil;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
@ -21,6 +13,13 @@ import weaver.general.Util;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;
public class ExcelUtil extends BaseBean {
/*

@ -6,13 +6,10 @@ import com.engine.kq.biz.KQHolidaySetBiz;
import com.engine.kq.biz.KQWorkTime;
import com.engine.mingfeng.service.OverTimeService;
import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class OverTimeServiceImpl extends Service implements OverTimeService {

@ -284,7 +284,7 @@ public class SynResumeJob extends BaseCronJob {
"?, ?, ?, ?, ?, ?, ?, ?)";
String insertSql_dt1 = "INSERT INTO uf_ygjlxxb_dt1 (mainid, xm, gx, lxfs, zy, dz, sfjjlxr) VALUES(?, ?, ?, ?, ?, ?, ?)";
String insertSql_dt1 = "INSERT INTO uf_ygjlxxb_dt1 (mainid, xm, gx2, lxfs, zy, dz, sfjjlxr, dybs) VALUES(?, ?, ?, ?, ?, ?, ?, ?)";
String insertSql_dt2 = "INSERT INTO uf_ygjlxxb_dt2 (mainid, xx, zy, rxsj, bysj, xl, xllx, wyyz, yynl) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)";
@ -342,13 +342,39 @@ public class SynResumeJob extends BaseCronJob {
String address = Util.null2String(jsonObject_family.getString("address"));
// 是否紧急联系人 0 是 1 否
String emergencyContact = Util.null2String(jsonObject_family.getString("emergencyContact"));
//大易标识
String uniqueKey = Util.null2String(jsonObject_family.getString("uniqueKey"));
if("是".equals(emergencyContact)){
emergencyContact = "0";
}else{
emergencyContact = "1";
}
if("配偶".equals(relationship)){
relationship = "0";
}else if("儿子".equals(relationship)){
relationship = "1";
}else if("女儿".equals(relationship)){
relationship = "2";
}else if("父亲".equals(relationship)){
relationship = "3";
}else if("母亲".equals(relationship)){
relationship = "4";
}else if("其他".equals(relationship)){
relationship = "5";
}else if("兄妹".equals(relationship)){
relationship = "6";
}else if("兄弟".equals(relationship)){
relationship = "7";
}else if("姐妹".equals(relationship)){
relationship = "8";
}else{
relationship = "9";
}
// 写入 明细1
rst.executeUpdate(insertSql_dt1,new Object[]{billid,name1,relationship,contactNumber,jobTitle,address,emergencyContact});
rst.executeUpdate(insertSql_dt1,new Object[]{billid,name1,relationship,contactNumber,jobTitle,address,emergencyContact,uniqueKey});
}
// 明细2
@ -604,6 +630,7 @@ public class SynResumeJob extends BaseCronJob {
rst.executeUpdate(updateSql);
// 明细1
String acqFamilySql = "select count(*) as number from uf_ygjlxxb_dt1 where dybs = ?";
for(int j=0;j<array_familyRelationship.size();j++) {
JSONObject jsonObject_family = array_familyRelationship.getJSONObject(j);
@ -619,15 +646,50 @@ public class SynResumeJob extends BaseCronJob {
String address = Util.null2String(jsonObject_family.getString("address"));
// 是否紧急联系人 0 是 1 否
String emergencyContact = Util.null2String(jsonObject_family.getString("emergencyContact"));
//大易标识
String uniqueKey = Util.null2String(jsonObject_family.getString("uniqueKey"));
if("是".equals(emergencyContact)){
emergencyContact = "0";
}else{
emergencyContact = "1";
}
String updateSql_dt1 = "UPDATE uf_ygjlxxb_dt1 SET gx='"+ relationship +"',lxfs='"+ contactNumber +"',zy='"+ jobTitle +"',dz='"+ address +"',sfjjlxr='"+ emergencyContact +"' WHERE xm='"+ name1 +"' and mainid="+billid;
// 更新 明细1
rst.executeUpdate(updateSql_dt1);
if("配偶".equals(relationship)){
relationship = "0";
}else if("儿子".equals(relationship)){
relationship = "1";
}else if("女儿".equals(relationship)){
relationship = "2";
}else if("父亲".equals(relationship)){
relationship = "3";
}else if("母亲".equals(relationship)){
relationship = "4";
}else if("其他".equals(relationship)){
relationship = "5";
}else if("兄妹".equals(relationship)){
relationship = "6";
}else if("兄弟".equals(relationship)){
relationship = "7";
}else if("姐妹".equals(relationship)){
relationship = "8";
}else{
relationship = "9";
}
String updateSql_dt1 = "UPDATE uf_ygjlxxb_dt1 SET gx2='"+ relationship +"',lxfs='"+ contactNumber +"',zy='"+ jobTitle +"',dz='"+ address +"',sfjjlxr='"+ emergencyContact +"', xm='" + name1 + "' WHERE mainid="+billid +" and dybs = '" + uniqueKey + "'";
rst.executeQuery(acqFamilySql, uniqueKey);
Integer number = -1;
while(rst.next()) {
number = Util.getIntValue(Util.null2String(rst.getString("number")));
}
if (number <= 0 ) {
rst.executeUpdate(insertSql_dt1, new Object[]{billid,name1,relationship,contactNumber,jobTitle,address,emergencyContact,uniqueKey});
} else {
// 更新 明细1
rst.executeUpdate(updateSql_dt1);
}
}
// 明细2

@ -2,12 +2,7 @@ package weaver.interfaces.mfkj.util;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.engine.kq.util.KQDurationCalculatorUtil;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
@ -15,16 +10,11 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import weaver.general.BaseBean;
import weaver.general.TimeUtil;
import weaver.general.Util;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.*;
import java.util.HashMap;
/**
* @Title http

@ -0,0 +1,364 @@
package weaver.interfaces.mingfeng.action;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.engine.kq.biz.KQGroupMemberComInfo;
import com.engine.kq.biz.KQWorkTime;
import com.engine.kq.entity.KQGroupEntity;
import com.engine.kq.entity.TimeScopeEntity;
import com.engine.kq.entity.WorkTimeEntity;
import com.weaver.general.BaseBean;
import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.*;
import weaver.workflow.webservices.*;
import weaver.workflow.workflow.WorkflowComInfo;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
public class CreateCardWorkflowAction implements Action {
BaseBean bb = new BaseBean();
@Override
public String execute(RequestInfo requestInfo) {
bb.writeLog("--CreateCardWorkflowAction start" );
//获取流程参数
String resourceId = "0";
String startDate = "";
String endDate = "";
String startTime = "";
String endTime = "";
Property[] properties = requestInfo.getMainTableInfo().getProperty();
for (Property property: properties) {
if ("sqr".equals(property.getName())) {
resourceId = Util.null2String(property.getValue());
}
if ("qsrq".equals(property.getName())) {
startDate = Util.null2String(property.getValue());
}
if ("jsrq".equals(property.getName())) {
endDate = Util.null2String(property.getValue());
}
if ("qssj".equals(property.getName())) {
startTime = Util.null2String(property.getValue());
}
if ("jssj".equals(property.getName())) {
endTime = Util.null2String(property.getValue());
}
}
List<String> cardDates = new ArrayList<>();
List<String> allDates = getAllDates(startDate, endDate);
bb.writeLog("--allDates: " + allDates );
for (String date : allDates) {
bb.writeLog("--date: " + date );
KQGroupMemberComInfo kqGroupMemberComInfo = new KQGroupMemberComInfo();
//根据考勤组判断是否开启外勤打卡
String outsidesign = ""; //人员所在考勤组是否开启外勤签到转考勤
KQGroupEntity kqGroupEntity = kqGroupMemberComInfo.getUserKQGroupInfo(resourceId, date);
if ( kqGroupEntity != null) {
outsidesign = kqGroupEntity.getOutsidesign();
}
bb.writeLog("--outsidesign: " + outsidesign );
if ( !"1".equals(outsidesign)) {
cardDates.add(date);
}
}
bb.writeLog("--cardDates: " + cardDates );
String today = DateUtil.format(new Date(), "yyyy-MM-dd");
//获取补卡流程workflowid
String cardWorkflowId = Util.null2String(bb.getPropValue("syn_othersys_mfkj","cardWorkflowId"));
bb.writeLog("--cardWorkflowId: " + cardWorkflowId );
//获取申请人信息
String lastName = "";
String workCode = "";
String departmentId = "";
String jobTitle = "";
String acqLastNameSql = "select lastname, workCode, departmentId, jobTitle from hrmresource where id = ? ";
RecordSet rs = new RecordSet();
rs.executeQuery(acqLastNameSql, resourceId);
while (rs.next()) {
lastName = Util.null2String(rs.getString("lastname"));
workCode = Util.null2String(rs.getString("workCode"));
departmentId = Util.null2String(rs.getString("departmentId"));
jobTitle = Util.null2String(rs.getString("jobTitle"));
}
WorkflowComInfo workflowComInfo = new WorkflowComInfo();
KQWorkTime kqWorkTime = new KQWorkTime();
//流程基本信息
Map<String, String> workflowInfo = new HashMap<>();
String workflowname = workflowComInfo.getWorkflowname(cardWorkflowId);
String requestName = workflowname + "-" + lastName;
workflowInfo.put("requestName", requestName);
workflowInfo.put("requestLevel", "1");
workflowInfo.put("creatorId", resourceId);
workflowInfo.put("workflowId", cardWorkflowId);
workflowInfo.put("isNextFlow", "0");
bb.writeLog("--workflowInfo: " + workflowInfo );
//流程主表信息
Map<String, Object> mainTableInfo = new HashMap<>();
mainTableInfo.put("sqr", resourceId);
mainTableInfo.put("ygbh", workCode);
mainTableInfo.put("szbm", departmentId);
mainTableInfo.put("szzw", jobTitle);
mainTableInfo.put("sqrq", today);
bb.writeLog("--mainTableInfo: " + mainTableInfo );
try {
List<Map<String, Object>> detailTableInfos = new ArrayList<>();
if ( cardDates != null && cardDates.size() > 0) {
//流程明细表信息
if ( !startDate.equals(endDate)) {
for (String date : cardDates) {
//如果出差是多天的情况,那么只有开始日期的那天的开始卡是开始时间,其他的日期开始卡是取班次的开始时间
//获取当天班次,如果没有班次,按照开始时间处理
WorkTimeEntity workTime = kqWorkTime.getWorkTime(resourceId, date);
bb.writeLog("--workTime:" + JSONObject.toJSONString(workTime));
List<TimeScopeEntity> lsWorkTime = new ArrayList<>();
if (workTime != null) {
lsWorkTime = workTime.getWorkTime();//工作时间
}
if ( date.equals(startDate)) {
if (lsWorkTime != null && lsWorkTime.size() ==1 ) {
TimeScopeEntity workTimeEntity = lsWorkTime.get(0);
String shiftendTime = workTimeEntity.getEndTime();
if (StringUtils.isNotBlank(shiftendTime)) {
Map<String, Object> detailTableInfo = new HashMap<>();
detailTableInfo.put("bkrq", date);
detailTableInfo.put("bklx", "0");//上班
detailTableInfo.put("bksj1", startTime);
detailTableInfo.put("bkyy", "5");
detailTableInfos.add(detailTableInfo);
detailTableInfo = new HashMap<>();
detailTableInfo.put("bkrq", date);
detailTableInfo.put("bklx", "1");//下班
detailTableInfo.put("bksj1", shiftendTime);
detailTableInfo.put("bkyy", "5");
detailTableInfos.add(detailTableInfo);
}
}
} else {
if ( !date.equals(endDate)) {
if (lsWorkTime != null && lsWorkTime.size() ==1 ) {
TimeScopeEntity workTimeEntity = lsWorkTime.get(0);
String shiftendTime = workTimeEntity.getEndTime();
String shiftbeginTime = workTimeEntity.getBeginTime();
if (StringUtils.isNotBlank(shiftendTime) && StringUtils.isNotBlank(shiftbeginTime)) {
Map<String, Object> detailTableInfo = new HashMap<>();
detailTableInfo.put("bkrq", date);
detailTableInfo.put("bklx", "0");//上班
detailTableInfo.put("bksj1", shiftbeginTime);
detailTableInfo.put("bkyy", "5");
detailTableInfos.add(detailTableInfo);
detailTableInfo = new HashMap<>();
detailTableInfo.put("bkrq", date);
detailTableInfo.put("bklx", "1");//下班
detailTableInfo.put("bksj1", shiftendTime);
detailTableInfo.put("bkyy", "5");
detailTableInfos.add(detailTableInfo);
}
}
} else {
if (lsWorkTime != null && lsWorkTime.size() ==1 ) {
TimeScopeEntity workTimeEntity = lsWorkTime.get(0);
String beginTime = workTimeEntity.getBeginTime();
if (StringUtils.isNotBlank(beginTime)) {
Map<String, Object> detailTableInfo = new HashMap<>();
detailTableInfo.put("bkrq", date);
detailTableInfo.put("bklx", "0");//上班
detailTableInfo.put("bksj1", beginTime);
detailTableInfo.put("bkyy", "5");
detailTableInfos.add(detailTableInfo);
detailTableInfo = new HashMap<>();
detailTableInfo.put("bkrq", date);
detailTableInfo.put("bklx", "1");//下班
detailTableInfo.put("bksj1", endTime);
detailTableInfo.put("bkyy", "5");
detailTableInfos.add(detailTableInfo);
} else {
Map<String, Object> detailTableInfo = new HashMap<>();
detailTableInfo.put("bkrq", date);
detailTableInfo.put("bklx", "0");//上班
detailTableInfo.put("bksj1", startTime);
detailTableInfo.put("bkyy", "5");
detailTableInfos.add(detailTableInfo);
detailTableInfo = new HashMap<>();
detailTableInfo.put("bkrq", date);
detailTableInfo.put("bklx", "1");//下班
detailTableInfo.put("bksj1", endTime);
detailTableInfo.put("bkyy", "5");
detailTableInfos.add(detailTableInfo);
}
} else {
Map<String, Object> detailTableInfo = new HashMap<>();
detailTableInfo.put("bkrq", date);
detailTableInfo.put("bklx", "0");//上班
detailTableInfo.put("bksj1", startTime);
detailTableInfo.put("bkyy", "5");
detailTableInfos.add(detailTableInfo);
detailTableInfo = new HashMap<>();
detailTableInfo.put("bkrq", date);
detailTableInfo.put("bklx", "1");//下班
detailTableInfo.put("bksj1", endTime);
detailTableInfo.put("bkyy", "5");
detailTableInfos.add(detailTableInfo);
}
}
}
}
} else {
Map<String, Object> detailTableInfo = new HashMap<>();
detailTableInfo.put("bkrq", startDate);
detailTableInfo.put("bklx", "0");//上班
detailTableInfo.put("bksj1", startTime);
detailTableInfo.put("bkyy", "5");
detailTableInfos.add(detailTableInfo);
detailTableInfo = new HashMap<>();
detailTableInfo.put("bkrq", startDate);
detailTableInfo.put("bklx", "1");//下班
detailTableInfo.put("bksj1", endTime);
detailTableInfo.put("bkyy", "5");
detailTableInfos.add(detailTableInfo);
}
bb.writeLog("--detailTableInfos:" + detailTableInfos);
String requestid = WorkflowCreate(workflowInfo, mainTableInfo, detailTableInfos);
} else {
bb.writeLog("申请人所在考勤组在申请日期中没有关闭外勤打卡的考勤日期,不创建补卡流程");
}
}catch (Exception e) {
bb.writeLog(" -- Exception:" + e);
}
return null;
}
/**
*
*/
private String WorkflowCreate(Map<String, String> workflowInfo, Map<String, Object> mainTableInfo, List<Map<String, Object>> detailTableInfos) {
bb.writeLog("--WorkflowCreate start");
String requestid = "";
//工作流程请求信息
WorkflowRequestInfo workflowRequestInfo = new WorkflowRequestInfo();
//请求标题
workflowRequestInfo.setRequestName(workflowInfo.get("requestName"));
//请求重要级别
workflowRequestInfo.setRequestLevel(workflowInfo.get("requestLevel"));
//显示
workflowRequestInfo.setCanView(true);
//创建者id
workflowRequestInfo.setCreatorId(workflowInfo.get("creatorId"));
//是否流转
workflowRequestInfo.setIsnextflow(workflowInfo.get("isNextFlow"));
//工作流信息
WorkflowBaseInfo workflowBaseInfo = new WorkflowBaseInfo();
workflowBaseInfo.setWorkflowId(workflowInfo.get("workflowId"));
workflowRequestInfo.setWorkflowBaseInfo(workflowBaseInfo);
//主表赋值
WorkflowRequestTableField[] workflowRequestTableField = new WorkflowRequestTableField[mainTableInfo.size()];
int k = 0;
for (String key : mainTableInfo.keySet()) {
String name = key;
String value = Util.null2String(mainTableInfo.get(key));
workflowRequestTableField[k] = createWorkflowRequestTableField(name, value);
k++;
}
// workflowRequestTableField[0] = createWorkflowRequestTableField("sqr", "4");
// workflowRequestTableField[1] = createWorkflowRequestTableField("ygbh", "10086");
WorkflowMainTableInfo workflowMainTableInfo = new WorkflowMainTableInfo();
WorkflowRequestTableRecord[] workflowRequestTableRecord = new WorkflowRequestTableRecord[1];
workflowRequestTableRecord[0] = new WorkflowRequestTableRecord();
workflowRequestTableRecord[0].setWorkflowRequestTableFields(workflowRequestTableField);
workflowMainTableInfo.setRequestRecords(workflowRequestTableRecord);
workflowRequestInfo.setWorkflowMainTableInfo(workflowMainTableInfo);
//明细表赋值
WorkflowDetailTableInfo[] workflowDetailTableInfo = new WorkflowDetailTableInfo[1];
workflowRequestTableRecord = new WorkflowRequestTableRecord[detailTableInfos.size()];
for (int i = 0; i < detailTableInfos.size(); i++) {
Map<String, Object> detailTableInfo = detailTableInfos.get(i);
workflowRequestTableField = new WorkflowRequestTableField[detailTableInfo.size()];
int j = 0;
for (String key : detailTableInfo.keySet()) {
String name = key;
String value = Util.null2String(detailTableInfo.get(key));
workflowRequestTableField[j] = createWorkflowRequestTableField(name, value);
j++;
}
workflowRequestTableRecord[i] = new WorkflowRequestTableRecord();
workflowRequestTableRecord[i].setWorkflowRequestTableFields(workflowRequestTableField);
}
workflowDetailTableInfo[0] = new WorkflowDetailTableInfo();
workflowDetailTableInfo[0].setWorkflowRequestTableRecords(workflowRequestTableRecord);
workflowRequestInfo.setWorkflowDetailTableInfos(workflowDetailTableInfo);
WorkflowService workflow = new WorkflowServiceImpl();
bb.writeLog("--requestid start:");
bb.writeLog("--workflowRequestInfo:" + JSONObject.toJSONString(workflowRequestInfo));
try {
// RequestService
requestid = workflow.doCreateWorkflowRequest(workflowRequestInfo, Util.getIntValue(Util.null2String(workflowInfo.get("creatorId"))));
bb.writeLog("--requestid:" + requestid);
if (Util.getIntValue(requestid) > 0) {
return requestid;
}
bb.writeLog("createOrgAdjustWorkflow failed");
}catch (Exception e ) {
bb.writeLog("createOrgAdjustWorkflow exception: " + e);
}
return null;
}
private WorkflowRequestTableField createWorkflowRequestTableField(String fieldName, String fieldValue) {
WorkflowRequestTableField tableField = new WorkflowRequestTableField();
tableField.setFieldName(fieldName);
tableField.setFieldValue(fieldValue);
tableField.setView(true);
tableField.setEdit(true);
return tableField;
}
/**
*
* @params startDate
* @params endDate
*/
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;
}
}

@ -5,15 +5,11 @@ import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.tools.HrmDateCheck;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.MainTableInfo;
import weaver.soa.workflow.request.Property;
import weaver.soa.workflow.request.RequestInfo;
import java.time.LocalDate;
import java.time.Period;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;

Loading…
Cancel
Save