|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.engine.xmgsecond.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import com.engine.common.util.ServiceUtil;
|
|
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
|
import com.engine.workflow.entity.publicApi.PAResponseEntity;
|
|
|
|
@ -8,6 +9,7 @@ import com.engine.workflow.publicApi.WorkflowRequestOperatePA;
|
|
|
|
|
import com.engine.workflow.publicApi.impl.WorkflowRequestOperatePAImpl;
|
|
|
|
|
import com.engine.xmgsecond.entity.KqCloseSet;
|
|
|
|
|
import com.engine.xmgsecond.service.KqCloseAccountService;
|
|
|
|
|
import com.weaver.general.TimeUtil;
|
|
|
|
|
import weaver.conn.RecordSet;
|
|
|
|
|
import weaver.general.BaseBean;
|
|
|
|
|
import weaver.general.Util;
|
|
|
|
@ -15,6 +17,8 @@ import weaver.general.Util;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Author liang.cheng
|
|
|
|
@ -29,56 +33,70 @@ public class KqCloseAccountServiceImpl extends Service implements KqCloseAccount
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public PAResponseEntity closeAccount(Map<String, Object> param) {
|
|
|
|
|
public List<PAResponseEntity> closeAccount(Map<String, Object> param) {
|
|
|
|
|
|
|
|
|
|
String id = Util.null2String(param.get("billid"));
|
|
|
|
|
String billid = Util.null2String(param.get("billid"));
|
|
|
|
|
String subCompanyIds = Util.null2String(param.get("gzfb"));
|
|
|
|
|
String departmentIds = Util.null2String(param.get("gzbm"));
|
|
|
|
|
String startDate = Util.null2String(param.get("ksrq"));
|
|
|
|
|
String endDate = Util.null2String(param.get("jsrq"));
|
|
|
|
|
//0 发起 1 归档
|
|
|
|
|
String type = Util.null2String(param.get("type"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String currentTime = TimeUtil.getCurrentTimeString();
|
|
|
|
|
String lastname = user.getLastname();
|
|
|
|
|
List<PAResponseEntity> paResponseEntities = new ArrayList<>();
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
List<KqCloseSet> workflowList = getWorkflowList();
|
|
|
|
|
List<Integer> workflowIds = workflowList.stream()
|
|
|
|
|
.map(KqCloseSet::getWorkflowId)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
String join = CollectionUtil.join(workflowIds, ",");
|
|
|
|
|
|
|
|
|
|
WorkflowRequestOperatePA operatePA = getRequestOperatePA();
|
|
|
|
|
|
|
|
|
|
//1.获取系统流程数据,根据关账流程配置中流程id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rs.executeQuery("select a.requestid,a.currentnodeid,a.workflowid,a.creater,b.formid from \n" +
|
|
|
|
|
" workflow_requestbase a left join workflow_base b on a.workflowid = b.id \n" +
|
|
|
|
|
" where a.workflowid in ("+join+") and a.currentnodetype not in (0,3)");
|
|
|
|
|
|
|
|
|
|
//2.根据表单id,及配置字段参数,.获取分部or部门 开始日期和结束日期
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//3 值匹配筛选requestid
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//4.流程干预操作
|
|
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
int requestid = Util.getIntValue(rs.getString("requestid"));
|
|
|
|
|
int currentnodeid = Util.getIntValue(rs.getString("currentnodeid"));
|
|
|
|
|
int workflowid = Util.getIntValue(rs.getString("workflowid"));
|
|
|
|
|
int creater = Util.getIntValue(rs.getString("creater"));
|
|
|
|
|
int formid = Math.abs(Util.getIntValue(rs.getString("formid")));
|
|
|
|
|
|
|
|
|
|
String tableName = "formtable_main_"+formid;
|
|
|
|
|
KqCloseSet kqCloseSet = workflowList.stream()
|
|
|
|
|
.filter(k -> Objects.equals(k.getWorkflowId(), workflowid))
|
|
|
|
|
.findFirst()
|
|
|
|
|
.orElse(null);
|
|
|
|
|
|
|
|
|
|
//3 值匹配筛选requestid
|
|
|
|
|
if (checkRange(kqCloseSet,requestid,tableName,subCompanyIds,departmentIds,startDate,endDate)) {
|
|
|
|
|
//4.流程干预操作
|
|
|
|
|
ReqOperateRequestEntity requestParam = new ReqOperateRequestEntity();
|
|
|
|
|
requestParam.setRequestId(requestid);
|
|
|
|
|
requestParam.setSrc("intervenor");
|
|
|
|
|
requestParam.setWorkflowId(workflowid);
|
|
|
|
|
requestParam.setNodeId(currentnodeid);
|
|
|
|
|
requestParam.setRemark(currentTime+"-"+lastname+"-于考勤模块统一干预处理。");
|
|
|
|
|
requestParam.setEnableIntervenor(true);
|
|
|
|
|
requestParam.setSubmitNodeId("0".equals(type) ? kqCloseSet.getCreateNodeId() : kqCloseSet.getEndNodeId());
|
|
|
|
|
requestParam.setIntervenorid(String.valueOf(creater));
|
|
|
|
|
PAResponseEntity paResponseEntity = operatePA.doIntervenor(user, requestParam);
|
|
|
|
|
paResponseEntity.setExtra(requestid);
|
|
|
|
|
paResponseEntities.add(paResponseEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//5.更新关账记录表操作者信息
|
|
|
|
|
currentTime = currentTime.substring(0, currentTime.length() - 3);
|
|
|
|
|
rs.executeUpdate("update uf_kqgzjl set czr = ?, zhczsj = ? where id = ?",user.getUID(),currentTime,billid);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ReqOperateRequestEntity requestParam = new ReqOperateRequestEntity();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//流程干预
|
|
|
|
|
// requestParam.setRequestId(1681681);
|
|
|
|
|
// requestParam.setSrc("intervenor");
|
|
|
|
|
// requestParam.setWorkflowId(95);
|
|
|
|
|
// requestParam.setNodeId(392);
|
|
|
|
|
// requestParam.setRemark("考勤干预");
|
|
|
|
|
// requestParam.setEnableIntervenor(true);
|
|
|
|
|
// requestParam.setSubmitNodeId(391);
|
|
|
|
|
// requestParam.setIntervenorid("1");
|
|
|
|
|
// PAResponseEntity paResponseEntity = operatePA.doIntervenor(user, requestParam);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
return paResponseEntities;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -113,20 +131,58 @@ public class KqCloseAccountServiceImpl extends Service implements KqCloseAccount
|
|
|
|
|
boolean result = false;
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
|
|
|
|
|
String sql = "select id from uf_kqgzjl where ksrq <= ? and jsrq >= ?";
|
|
|
|
|
String sql = "select id from uf_kqgzjl where ksrq <= ? and jsrq >= ? and gbzt in (1,2)";
|
|
|
|
|
String sql1 = "select id from uf_kqgzjl where ksrq <= ? and jsrq >= ? and gbzt in (1,2)";
|
|
|
|
|
|
|
|
|
|
if(!subCompanyIds.isEmpty()) {
|
|
|
|
|
//like
|
|
|
|
|
sql += " and gzfb is not null and gzfb in ("+subCompanyIds+")";
|
|
|
|
|
rs.executeQuery(sql,endDate,startDate);
|
|
|
|
|
result = rs.getCounts()>0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!departmentIds.isEmpty() && !result) {
|
|
|
|
|
sql += " and gzbm is not null and gzbm in ("+departmentIds+")";
|
|
|
|
|
rs.executeQuery(sql,endDate,startDate);
|
|
|
|
|
sql1 += " and gzbm is not null and gzbm in ("+departmentIds+")";
|
|
|
|
|
rs.executeQuery(sql1,endDate,startDate);
|
|
|
|
|
result = rs.getCounts()>0;
|
|
|
|
|
}
|
|
|
|
|
rs.writeLog("KqCloseAccountServiceImpl:checkSubmit"+sql);
|
|
|
|
|
rs.writeLog("KqCloseAccountServiceImpl:checkSubmit:"+sql);
|
|
|
|
|
rs.writeLog("KqCloseAccountServiceImpl:checkSubmit1:"+sql1);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 校验流程内容 是否属于本条关账范围内
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private Boolean checkRange(KqCloseSet kqCloseSet,int requestid,String tableName,
|
|
|
|
|
String subCompanyIds,String departmentIds,String startDate,String endDate) {
|
|
|
|
|
|
|
|
|
|
boolean result = false;
|
|
|
|
|
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
|
|
|
|
|
String sql = "select id from "+tableName+" where requestid = ? and "+kqCloseSet.getStartDateCode()+" <= ? and "+kqCloseSet.getEndDateCode()+" >= ?";
|
|
|
|
|
String sql1 = "select id from "+tableName+" where requestid = ? and "+kqCloseSet.getStartDateCode()+" <= ? and "+kqCloseSet.getEndDateCode()+" >= ?";
|
|
|
|
|
|
|
|
|
|
if(!subCompanyIds.isEmpty()) {
|
|
|
|
|
String fbCode = kqCloseSet.getFbCode();
|
|
|
|
|
sql += " and "+fbCode+" is not null and "+fbCode+" in ("+subCompanyIds+")";
|
|
|
|
|
rs.executeQuery(sql,requestid,endDate,startDate);
|
|
|
|
|
result = rs.getCounts()>0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!departmentIds.isEmpty() && !result) {
|
|
|
|
|
String bmCode = kqCloseSet.getBmCode();
|
|
|
|
|
sql1 += " and "+bmCode+" is not null and "+bmCode+" in ("+departmentIds+")";
|
|
|
|
|
rs.executeQuery(sql1,requestid,endDate,startDate);
|
|
|
|
|
result = rs.getCounts()>0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rs.writeLog("KqCloseAccountServiceImpl:checkRange:"+sql);
|
|
|
|
|
rs.writeLog("KqCloseAccountServiceImpl:checkRange1:"+sql1);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|