流程推送优化
parent
18625f6eaa
commit
368aecf920
@ -0,0 +1,150 @@
|
||||
package weaver.interfaces.dito.job;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.dito.comInfo.PropBean;
|
||||
import weaver.interfaces.dito.util.HttpUtils;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.engine.dito.ssologin.constant.DitoConstant.*;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Title ecology-9
|
||||
* @Company 泛微软件
|
||||
* @CreateDate 2022/12/26
|
||||
* @Description 流程同步建模
|
||||
* @Author Lee
|
||||
*/
|
||||
public class WorkflowSyncCornJob extends BaseCronJob {
|
||||
private static final Log logger = LogFactory.getLog(WorkflowSyncCornJob.class);
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
logger.info("WorkflowSyncModeCornJob start");
|
||||
try {
|
||||
String workflowSyncFormModeId = PropBean.getUfPropValue("workflowSyncFormModeId");
|
||||
RecordSet rs = new RecordSet();
|
||||
//建模表有效流程id
|
||||
String modelWorkflowSql = "SELECT workflowselect,workflowname FROM uf_sync_workflow";
|
||||
rs.execute(modelWorkflowSql);
|
||||
HashSet<String> modeWorkflowSet = new HashSet<>();
|
||||
HashMap<String, String> modeWorkflowInfo = new HashMap<>();
|
||||
while (rs.next()) {
|
||||
String modeWorkFlowId = rs.getString("workflowselect");
|
||||
String modeWorkFlowName = rs.getString("workflowname");
|
||||
modeWorkflowSet.add(modeWorkFlowId);
|
||||
modeWorkflowInfo.put(modeWorkFlowId, modeWorkFlowName);
|
||||
}
|
||||
|
||||
//系统有效流程id
|
||||
String baseWorkflowSql = "SELECT id,workflowname FROM workflow_base WHERE ISVALID = 1";
|
||||
rs.execute(baseWorkflowSql);
|
||||
HashSet<String> workflowSet = new HashSet<>();
|
||||
HashMap<String, String> workflowInfo = new HashMap<>();
|
||||
while (rs.next()) {
|
||||
String workflowId = rs.getString("id");
|
||||
String workflowName = rs.getString("workflowname");
|
||||
workflowInfo.put(workflowId, workflowName);
|
||||
workflowSet.add(workflowId);
|
||||
}
|
||||
|
||||
//系统有效流程新增或修改,无法判断流程更改了什么,新增后再更新
|
||||
syncWorkflow(ACTION_TYPE_ADD, workflowSyncFormModeId, workflowSet, modeWorkflowSet, workflowInfo);
|
||||
syncWorkflow(ACTION_TYPE_UPDATE, workflowSyncFormModeId, workflowSet, modeWorkflowSet, workflowInfo);
|
||||
//建模表的差集需要删除
|
||||
Set<String> deleteSet = new HashSet<>(modeWorkflowSet);
|
||||
deleteSet.removeAll(workflowSet);
|
||||
if (deleteSet.size() != 0) {
|
||||
syncWorkflow(ACTION_TYPE_DELETE, workflowSyncFormModeId, deleteSet, modeWorkflowSet, modeWorkflowInfo);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.info("WorkflowSyncModeCornJob:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 建模表流程同步
|
||||
*
|
||||
* @param actionType
|
||||
* @param insertList
|
||||
* @param updateList
|
||||
* @param deleteList
|
||||
*/
|
||||
private void syncModeWorkflow(String actionType, List<List> insertList, List<List> updateList, List<String> deleteList) {
|
||||
RecordSet recordSet = new RecordSet();
|
||||
if (actionType.equals(ACTION_TYPE_ADD) && CollectionUtils.isNotEmpty(insertList)) {
|
||||
String insertSql = "INSERT INTO uf_sync_workflow (formmodeid,workflowselect,workflowname) values (?,?,?)";
|
||||
recordSet.executeBatchSql(insertSql, insertList);
|
||||
} else if (actionType.equals(ACTION_TYPE_UPDATE) && CollectionUtils.isNotEmpty(updateList)) {
|
||||
String updateSql = "UPDATE uf_sync_workflow set workflowname=? where workflowselect=?";
|
||||
recordSet.executeBatchSql(updateSql, updateList);
|
||||
} else if (actionType.equals(ACTION_TYPE_DELETE) && CollectionUtils.isNotEmpty(deleteList)) {
|
||||
String deleteSql = "DELETE FROM uf_sync_workflow where workflowselect=?";
|
||||
for (String deleteID : deleteList) {
|
||||
recordSet.executeUpdate(deleteSql, deleteID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param actionType
|
||||
* @param updateOrAddSet
|
||||
* @param modeWorkflowSet
|
||||
* @param workflowInfo 流程信息
|
||||
*/
|
||||
private void syncWorkflow(String actionType, String workflowSyncFormModeId, Set<String> updateOrAddSet, HashSet<String> modeWorkflowSet, HashMap<String, String> workflowInfo) {
|
||||
String center = PropBean.getUfPropValue("newWorkflowCenter");
|
||||
String bpm_app_workflowurl = PropBean.getUfPropValue("bpm_app_workflowurl");
|
||||
String synchronizeFlowUrl = PropBean.getUfPropValue("synchronizeFlowUrl");
|
||||
String accountName = PropBean.getUfPropValue("username");
|
||||
String password = PropBean.getUfPropValue("passwd");
|
||||
RecordSet rs = new RecordSet();
|
||||
List<List> insertList = new ArrayList<>();
|
||||
List<List> updateList = new ArrayList<>();
|
||||
List<String> deleteList = new ArrayList<>();
|
||||
for (String workflowId : updateOrAddSet) {
|
||||
//查询要推送到哪个目录下
|
||||
String cataCodeSql = "select cataCodeName from uf_syncCataCode where flowCode=?";
|
||||
rs.executeQuery(cataCodeSql, workflowId);
|
||||
String cataCode = "";
|
||||
if (rs.next()) {
|
||||
cataCode = Util.null2String(rs.getString("cataCodeName"));
|
||||
}
|
||||
Map<String, Object> workflowMap = new HashMap<>();
|
||||
workflowMap.put("flowCode", workflowId);
|
||||
String workflowName = workflowInfo.get(workflowId);
|
||||
workflowMap.put("flowName", workflowName);
|
||||
workflowMap.put("actionType", actionType);
|
||||
workflowMap.put("cataCode", cataCode);
|
||||
workflowMap.put("center", center);
|
||||
workflowMap.put("urlPc", "/bpm/workflow/request/CreateRequestForward.jsp?workflowid=" + workflowId);
|
||||
workflowMap.put("urlApp", bpm_app_workflowurl + "/spa/workflow/static4mobileform/index.html#/req?iscreate=1&workflowid=" + workflowId);
|
||||
|
||||
HashMap<String, String> headers = new HashMap<>();
|
||||
headers.put("Authorization", "Basic " + Base64.getUrlEncoder().encodeToString((accountName + ":" + password).getBytes()));
|
||||
String data = HttpUtils.doPost(synchronizeFlowUrl, workflowMap, headers);
|
||||
logger.info("syncWorkflow:" + workflowId + data);
|
||||
if (actionType.equals(ACTION_TYPE_ADD) && !modeWorkflowSet.contains(workflowId)) {
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add(workflowSyncFormModeId);
|
||||
list.add(workflowId);
|
||||
list.add(workflowName);
|
||||
insertList.add(list);
|
||||
} else if (actionType.equals(ACTION_TYPE_UPDATE)) {
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add(workflowName);
|
||||
list.add(workflowId);
|
||||
updateList.add(list);
|
||||
} else if (actionType.equals(ACTION_TYPE_DELETE)) {
|
||||
deleteList.add(workflowId);
|
||||
}
|
||||
}
|
||||
syncModeWorkflow(actionType, insertList, updateList, deleteList);
|
||||
}
|
||||
}
|
@ -1,305 +0,0 @@
|
||||
package weaver.interfaces.dito.job;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.util.IdGenerator;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.interfaces.dito.comInfo.PropBean;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
import weaver.interfaces.dito.util.HttpUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.engine.dito.ssologin.constant.DitoConstant.*;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Title ecology-9
|
||||
* @Company 泛微软件
|
||||
* @CreateDate 2022/10/27
|
||||
* @Description 新建流程推送门(包含发起人权限)
|
||||
* @Author Lee
|
||||
*/
|
||||
public class WorkflowSyncCronJob extends BaseCronJob {
|
||||
/**
|
||||
* 推送类型(0全量、1增量)
|
||||
*/
|
||||
private String syncType;
|
||||
private static final Log logger = LogFactory.getLog(WorkflowSyncCronJob.class);
|
||||
String bpm_app_workflowurl = PropBean.getUfPropValue("bpm_app_workflowurl");
|
||||
@Override
|
||||
public void execute() {
|
||||
BaseBean bb = new BaseBean();
|
||||
bb.writeLog("WorkflowSyncCronJob start");
|
||||
try {
|
||||
//推送流程url
|
||||
String synchronizeFlowUrl = PropBean.getUfPropValue("synchronizeFlowUrl");
|
||||
// String synchronizeFlowUrl = bb.getPropValue("PORTAL_INFO", "synchronizeFlowUrl");
|
||||
//同步人员权限url
|
||||
String synchronizeUserUrl = PropBean.getUfPropValue("synchronizeUserUrl");
|
||||
// String synchronizeUserUrl = bb.getPropValue("PORTAL_INFO", "synchronizeUserUrl");
|
||||
//新建流程推送到目录code
|
||||
String center = PropBean.getUfPropValue("newWorkflowCenter");
|
||||
String workflowAuthTable = PropBean.getUfPropValue("workflowAuthTable");
|
||||
String timeNodeTable = PropBean.getUfPropValue("timeNodeTable");
|
||||
String accountName = PropBean.getUfPropValue("username");
|
||||
String password = PropBean.getUfPropValue("passwd");
|
||||
String timeNodeFormModeId = PropBean.getUfPropValue("timeNodeFormModeId");
|
||||
//全量同步使用全量同步方法
|
||||
if (SYNC_ALL.equals(syncType)) {
|
||||
bb.writeLog("WorkflowSyncCronJob ALL start");
|
||||
String currentTime = TimeUtil.getCurrentTimeString();
|
||||
allSynchronizeWorkflow(bb, synchronizeFlowUrl, synchronizeUserUrl, center, workflowAuthTable, accountName, password);
|
||||
writeTimeNode(bb, timeNodeTable, currentTime, SYNC_ALL, TIME_NODE_USE_WORKFLOW_SYNC, timeNodeFormModeId);
|
||||
}
|
||||
//增量同步使用增量同步方法
|
||||
if (SYNC_INCREMENT.equals(syncType)) {
|
||||
bb.writeLog("WorkflowSyncCronJob INCREMENT start");
|
||||
String currentTime = TimeUtil.getCurrentTimeString();
|
||||
IncrementSynchronizeWorkflow(bb, synchronizeFlowUrl, synchronizeUserUrl, center, workflowAuthTable, timeNodeTable, accountName, password);
|
||||
writeTimeNode(bb, timeNodeTable, currentTime, SYNC_INCREMENT, TIME_NODE_USE_WORKFLOW_SYNC, timeNodeFormModeId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
bb.writeLog("流程推送异常", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 增量同步
|
||||
private void IncrementSynchronizeWorkflow(BaseBean bb, String synchronizeFlowUrl, String synchronizeUserUrl, String center, String workflowAuthTable, String timeNodeTable, String accountName, String password) {
|
||||
RecordSet recordSet = new RecordSet();
|
||||
//查询时间节点表,上次流程推送增量同步的时间
|
||||
String timeSql = "select timenode from " + timeNodeTable + " where type=? and useto=? order by timenode desc";
|
||||
recordSet.executeQuery(timeSql, SYNC_INCREMENT, TIME_NODE_USE_WORKFLOW_SYNC);
|
||||
String preTime = "";
|
||||
if (recordSet.next()) {
|
||||
preTime = recordSet.getString("timenode");
|
||||
}
|
||||
syncWorkflowByCondition(synchronizeFlowUrl, synchronizeUserUrl, center, workflowAuthTable, accountName, password, preTime);
|
||||
}
|
||||
|
||||
// 全量同步
|
||||
private void allSynchronizeWorkflow(BaseBean bb, String synchronizeFlowUrl, String synchronizeUserUrl, String center, String workflowAuthTable, String accountName, String password) {
|
||||
syncWorkflowByCondition(synchronizeFlowUrl, synchronizeUserUrl, center, workflowAuthTable, accountName, password, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据不同条件请求同步方法
|
||||
*/
|
||||
private void syncWorkflowByCondition(String synchronizeFlowUrl, String synchronizeUserUrl, String center, String workflowAuthTable, String accountName, String password, String timeCondition) {
|
||||
logger.info("syncWorkflow-start:" + TimeUtil.getCurrentTimeString());
|
||||
RecordSet recordSet = new RecordSet();
|
||||
RecordSet recordSet2 = new RecordSet();
|
||||
RecordSet recordSet3 = new RecordSet();
|
||||
ArrayList<Map<String, Object>> addWorkflowList = new ArrayList<>();
|
||||
ArrayList<Map<String, Object>> delWorkflowList = new ArrayList<>();
|
||||
List<List<Map<String, Object>>> addUserList = new LinkedList<>();
|
||||
List<List<Map<String, Object>>> delUserList = new LinkedList<>();
|
||||
//查询建模所有流程
|
||||
String workflowSql = "SELECT DISTINCT workflowselect as flowCode,workflowname as flowName,effective FROM " + workflowAuthTable +
|
||||
" WHERE effective IN (SELECT DISTINCT effective FROM " + workflowAuthTable + ")";
|
||||
if (StringUtils.isNotEmpty(timeCondition)) {
|
||||
String[] time = timeCondition.split(" ");
|
||||
timeCondition = "'" + timeCondition + "'";
|
||||
workflowSql += " AND (modedatamodifydatetime >= " + timeCondition + " OR modedatacreatedate >= '" + time[0] + "' AND modedatacreatetime>= '" + time[1] + "')";
|
||||
}
|
||||
recordSet.execute(workflowSql);
|
||||
//区分有效和无效的流程
|
||||
while (recordSet.next()) {
|
||||
String effective = recordSet.getString("effective");
|
||||
String flowCode = recordSet.getString("flowCode");
|
||||
String flowName = recordSet.getString("flowName");
|
||||
String cataCode = "";
|
||||
//查询要推送到哪个目录下
|
||||
String cataCodeSql = "select cataCodeName from uf_syncCataCode where flowCode=?";
|
||||
recordSet3.executeQuery(cataCodeSql, flowCode);
|
||||
if (recordSet3.next()) {
|
||||
cataCode = Util.null2String(recordSet3.getString("cataCodeName"));
|
||||
}
|
||||
if (EFFECTIVE_YES.equals(effective)) {
|
||||
//拼接有效流程请求参数
|
||||
concatWorkflowCondition(center, cataCode, flowCode, flowName, ACTION_TYPE_ADD, addWorkflowList);
|
||||
//有效流程关联的人员参数拼接
|
||||
getUserConditionByWorkflow(workflowAuthTable, center, cataCode, flowCode, flowName, ACTION_TYPE_ADD_USER, addUserList, timeCondition, effective);
|
||||
} else if (EFFECTIVE_NO.equals(effective)) {
|
||||
//拼接无效流程请求参数,如果有流程还有效则不删除
|
||||
if (!workflowHasEffective(workflowAuthTable, recordSet2, flowCode)) {
|
||||
concatWorkflowCondition(center, cataCode, flowCode, flowName, ACTION_TYPE_DELETE, delWorkflowList);
|
||||
}
|
||||
//无效流程关联的人员参数拼接
|
||||
getUserConditionByWorkflow(workflowAuthTable, center, cataCode, flowCode, flowName, ACTION_TYPE_DELETE_USER, delUserList, timeCondition, effective);
|
||||
}
|
||||
}
|
||||
logger.info("syncWorkflow-end:" + TimeUtil.getCurrentTimeString());
|
||||
HashMap<String, String> headers = new HashMap<>();
|
||||
headers.put("Authorization", "Basic " + Base64.getUrlEncoder().encodeToString((accountName + ":" + password).getBytes()));
|
||||
//调用流程同步方法
|
||||
if (CollectionUtils.isNotEmpty(addWorkflowList)) {
|
||||
for (Map<String, Object> workflowMap : addWorkflowList) {
|
||||
String data = HttpUtils.doPost(synchronizeFlowUrl, workflowMap, headers);
|
||||
logger.info("addworkflow" + workflowMap.get("flowCode") + data);
|
||||
//无法判断流程的更改类型,所以在流程变动同时修改
|
||||
workflowMap.put("actionType", ACTION_TYPE_UPDATE);
|
||||
data = HttpUtils.doPost(synchronizeFlowUrl, workflowMap, headers);
|
||||
logger.info("updateworkflow" + workflowMap.get("flowCode") + data);
|
||||
}
|
||||
}
|
||||
logger.info("delUserList-start:" + TimeUtil.getCurrentTimeString());
|
||||
logger.info("delUserList-size:" + delUserList.size());
|
||||
//删除人员要在删除流程之前执行
|
||||
if (CollectionUtils.isNotEmpty(delUserList)) {
|
||||
addOrDeleteUser(synchronizeUserUrl, delUserList, headers);
|
||||
}
|
||||
logger.info("delUserList-end:" + TimeUtil.getCurrentTimeString());
|
||||
logger.info("delWorkflowList-start:" + TimeUtil.getCurrentTimeString());
|
||||
if (CollectionUtils.isNotEmpty(delWorkflowList)) {
|
||||
for (Map<String, Object> workflowMap : delWorkflowList) {
|
||||
String data = HttpUtils.doPost(synchronizeFlowUrl, workflowMap, headers);
|
||||
logger.info("deleteworkflow" + workflowMap.get("staffCode") + data);
|
||||
}
|
||||
}
|
||||
logger.info("delWorkflowList-end:" + TimeUtil.getCurrentTimeString());
|
||||
logger.info("addUserList-start:" + TimeUtil.getCurrentTimeString());
|
||||
logger.info("addUserList-size:" + addUserList.size());
|
||||
if (CollectionUtils.isNotEmpty(addUserList)) {
|
||||
addOrDeleteUser(synchronizeUserUrl, addUserList, headers);
|
||||
}
|
||||
logger.info("addUserList-end:" + TimeUtil.getCurrentTimeString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步删除或者新增人员
|
||||
*
|
||||
* @param synchronizeUserUrl
|
||||
* @param headers
|
||||
*/
|
||||
private void addOrDeleteUser(String synchronizeUserUrl, List<List<Map<String, Object>>> userLists, HashMap<String, String> headers) {
|
||||
for (List<Map<String, Object>> userList : userLists) {
|
||||
Map<String, Object> staffCodeMap = userList.get(0);
|
||||
Map<String, Object> userConditionMap = userList.get(1);
|
||||
Map<String, Object> userCondition = (Map<String, Object>) userConditionMap.get("userCondition");
|
||||
HashSet<String> staffCodeSet = (HashSet<String>) staffCodeMap.get("staffCodeSet");
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (String staffCode : staffCodeSet) {
|
||||
//超出字段长度限制请求接口后清空一次
|
||||
if (stringBuilder.length() > 10000) {
|
||||
userCondition.put("staffCode", stringBuilder.toString());
|
||||
logger.info("synchronizeUser-start" + TimeUtil.getCurrentTimeString());
|
||||
String data = HttpUtils.doPost(synchronizeUserUrl, userCondition, headers);
|
||||
logger.info("synchronizeUser-data" + data);
|
||||
logger.info("synchronizeUser-end" + TimeUtil.getCurrentTimeString());
|
||||
stringBuilder.delete(0, stringBuilder.length());
|
||||
}
|
||||
stringBuilder.append(staffCode).append("|");
|
||||
}
|
||||
//最后字段可能没有超限,再同步最后的人员
|
||||
if (stringBuilder.length() < 10000) {
|
||||
userCondition.put("staffCode", stringBuilder.toString());
|
||||
logger.info("synchronizeUser-last-start" + TimeUtil.getCurrentTimeString());
|
||||
String data = HttpUtils.doPost(synchronizeUserUrl, userCondition, headers);
|
||||
logger.info("synchronizeUser-last-data" + data);
|
||||
logger.info("synchronizeUser-last-end" + TimeUtil.getCurrentTimeString());
|
||||
logger.info("addOrDeleteUser-" + data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询还在使用中的流程
|
||||
*
|
||||
* @param workflowAuthTable
|
||||
* @param recordSet2
|
||||
* @param flowCode
|
||||
* @return
|
||||
*/
|
||||
private boolean workflowHasEffective(String workflowAuthTable, RecordSet recordSet2, String flowCode) {
|
||||
String querySql = "SELECT count(*) FROM " + workflowAuthTable + " WHERE workflowselect=? AND effective=?";
|
||||
recordSet2.executeQuery(querySql, flowCode, EFFECTIVE_YES);
|
||||
return recordSet2.next();
|
||||
}
|
||||
|
||||
/**
|
||||
* 组装流程同步API请求参数
|
||||
*
|
||||
* @param cataCode
|
||||
* @param flowCode
|
||||
* @param flowName
|
||||
* @param actionType
|
||||
* @param workflowList
|
||||
*/
|
||||
private void concatWorkflowCondition(String center, String cataCode, String flowCode, String flowName, String actionType, ArrayList<Map<String, Object>> workflowList) {
|
||||
Map<String, Object> workflowMap = new HashMap<>();
|
||||
workflowMap.put("flowCode", flowCode);
|
||||
workflowMap.put("flowName", flowName);
|
||||
workflowMap.put("actionType", actionType);
|
||||
workflowMap.put("cataCode", cataCode);
|
||||
workflowMap.put("center", center);
|
||||
workflowMap.put("urlPc", "/bpm/workflow/request/CreateRequestForward.jsp?workflowid=" + flowCode);
|
||||
workflowMap.put("urlApp", bpm_app_workflowurl+"/spa/workflow/static4mobileform/index.html#/req?iscreate=1&workflowid=" + flowCode);
|
||||
workflowList.add(workflowMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 组装人员同步API请求参数
|
||||
*
|
||||
* @param workflowAuthTable
|
||||
* @param cataCode
|
||||
* @param flowCode
|
||||
* @param flowName
|
||||
* @param actionType
|
||||
* @param timeCondition
|
||||
*/
|
||||
private void getUserConditionByWorkflow(String workflowAuthTable, String center, String cataCode, String flowCode, String flowName, String actionType, List<List<Map<String, Object>>> userLists, String timeCondition, String effective) {
|
||||
List<Map<String, Object>> userList = new LinkedList<>();
|
||||
Map<String, Object> userCondition = new HashMap<>();
|
||||
Map<String, Object> staffCodeMap = new HashMap<>();
|
||||
HashSet<String> staffCodeSet = new HashSet<>();
|
||||
String userSql = "SELECT workcode as staffCode FROM " + workflowAuthTable + " WHERE workflowselect=? AND effective=?";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery(userSql, flowCode, effective);
|
||||
while (rs.next()) {
|
||||
staffCodeSet.add(rs.getString("staffCode"));
|
||||
}
|
||||
staffCodeMap.put("staffCodeSet", staffCodeSet);
|
||||
userList.add(staffCodeMap);
|
||||
//组建人员同步map
|
||||
userCondition.put("flowCode", flowCode);
|
||||
userCondition.put("flowName", flowName);
|
||||
//同步所需参数一并拼接
|
||||
userCondition.put("actionType", actionType);
|
||||
userCondition.put("center", center);
|
||||
userCondition.put("cataCode", cataCode);
|
||||
Map<String, Object> userMap = new HashMap<>();
|
||||
userMap.put("userCondition", userCondition);
|
||||
userList.add(userMap);
|
||||
userLists.add(userList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将同步时间写入时间节点表
|
||||
*
|
||||
* @param timeNodeTable 表名
|
||||
* @param syncType 同步类型
|
||||
* @param timeNodeUse 同步作用
|
||||
* @param formmodeid 模块id
|
||||
*/
|
||||
private void writeTimeNode(BaseBean bb, String timeNodeTable, String currentTime, String syncType, String timeNodeUse, String formmodeid) throws Exception {
|
||||
RecordSet recordSet = new RecordSet();
|
||||
String sql = "";
|
||||
String dbType = recordSet.getDBType();
|
||||
if ("mysql".equalsIgnoreCase(dbType)) {
|
||||
sql = "insert into " + timeNodeTable + " (id,formmodeid,type,timenode,useto) values (?,?,?,?,?)";
|
||||
} else if ("oracle".equalsIgnoreCase(dbType)) {
|
||||
sql = "insert into " + timeNodeTable + " (id,formmodeid,type,timenode,useto) values (?,?,?,?,?)";
|
||||
} else if ("sqlserver".equalsIgnoreCase(dbType)) {
|
||||
sql = "SET IDENTITY_INSERT " + timeNodeTable + " ON insert into " + timeNodeTable + " (id,formmodeid,type,timenode,useto) values (?,?,?,?,?)";
|
||||
}
|
||||
boolean b = recordSet.executeUpdate(sql, IdGenerator.getNextId(timeNodeTable), formmodeid, syncType, currentTime, timeNodeUse);
|
||||
bb.writeLog("writeTimeNode result:" + b);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue