|
|
@ -512,88 +512,6 @@ public class FlowTaskService extends MybatisBaseService<FlowTaskMapper, FlowTask |
|
|
|
return new ResultBean<Integer>().success().setData(Integer.parseInt(String.valueOf(num))); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询app或pc需要的参数 --( 废弃) |
|
|
|
* |
|
|
|
* @param task |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private Map<String, Map<String, Object>> getAppOrPcVariables(FlowTaskDto task) { |
|
|
|
List<SysProUrlVo> urlList = sysProUrlService.selectListByProcDefId(task.getProcDefId(), task.getTaskDefKey()); |
|
|
|
Map<String, Map<String, Object>> map = new HashMap<>(); |
|
|
|
Map<String, Object> appVariables = new HashMap<>(); |
|
|
|
Map<String, Object> pcVariables = new HashMap<>(); |
|
|
|
|
|
|
|
String businessSid = ""; |
|
|
|
HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().includeProcessVariables().taskId(task.getTaskId()).singleResult(); |
|
|
|
if (historicTaskInstance != null) { |
|
|
|
Object businessSidObj = historicTaskInstance.getProcessVariables().get("businessSid"); |
|
|
|
businessSid = businessSidObj == null ? "" : businessSidObj.toString(); |
|
|
|
} |
|
|
|
pcVariables.put("businessSid", businessSid); |
|
|
|
if (urlList.size() > 0) { |
|
|
|
// 手机端参数
|
|
|
|
String name = urlList.get(0).getModulePluginName(); |
|
|
|
ResultBean<AppSubsetVersionVo> resultBean = appSubsetVersionFeign.getLastBymodulePluginName(name); |
|
|
|
if (resultBean.getSuccess() && resultBean.getData() != null) { |
|
|
|
AppSubsetVersionVo subsetVersionVo = resultBean.getData(); |
|
|
|
appVariables.put("msgSid", ""); |
|
|
|
appVariables.put("type", "2"); |
|
|
|
appVariables.put("path", subsetVersionVo.getUpdateUrl()); |
|
|
|
appVariables.put("modulePluginName", subsetVersionVo.getModulePluginName()); |
|
|
|
// appVariables.put("moduleAction", subsetVersionVo.getSourceAction());
|
|
|
|
appVariables.put("moduleAction", urlList.get(0).getUrl()); |
|
|
|
appVariables.put("moduleVersion", subsetVersionVo.getVersionCode()); |
|
|
|
appVariables.put("moduleSid", ""); |
|
|
|
JSONObject json = new JSONObject(); |
|
|
|
json.put("businessSid", businessSid); |
|
|
|
json.put("taskId", task.getTaskId()); |
|
|
|
json.put("deployId", task.getDeployId()); |
|
|
|
json.put("procInsId", task.getProcInsId()); |
|
|
|
appVariables.put("json", json.toJSONString()); |
|
|
|
} else { |
|
|
|
|
|
|
|
} |
|
|
|
// pc端参数
|
|
|
|
if (urlList.size() == 4) { |
|
|
|
pcVariables.put("taskId", task.getTaskId()); |
|
|
|
pcVariables.put("deployId", task.getDeployId()); |
|
|
|
pcVariables.put("procInsId", task.getProcInsId()); |
|
|
|
pcVariables.put("handleUrl", urlList.get(2).getUrl()); |
|
|
|
pcVariables.put("detailUrl", urlList.get(3).getUrl()); |
|
|
|
} else { |
|
|
|
pcVariables.put("taskId", ""); |
|
|
|
pcVariables.put("deployId", ""); |
|
|
|
pcVariables.put("procInsId", ""); |
|
|
|
pcVariables.put("handleUrl", ""); |
|
|
|
pcVariables.put("detailUrl", ""); |
|
|
|
} |
|
|
|
} else { |
|
|
|
appVariables.put("msgSid", ""); |
|
|
|
appVariables.put("type", ""); |
|
|
|
appVariables.put("path", ""); |
|
|
|
appVariables.put("modulePluginName", ""); |
|
|
|
appVariables.put("moduleAction", ""); |
|
|
|
appVariables.put("moduleVersion", 0); |
|
|
|
appVariables.put("moduleSid", ""); |
|
|
|
JSONObject json = new JSONObject(); |
|
|
|
json.put("businessSid", businessSid); |
|
|
|
json.put("taskId", ""); |
|
|
|
json.put("deployId", ""); |
|
|
|
json.put("procInsId", ""); |
|
|
|
appVariables.put("json", json.toJSONString()); |
|
|
|
|
|
|
|
pcVariables.put("taskId", ""); |
|
|
|
pcVariables.put("deployId", ""); |
|
|
|
pcVariables.put("procInsId", ""); |
|
|
|
pcVariables.put("handleUrl", ""); |
|
|
|
pcVariables.put("detailUrl", ""); |
|
|
|
} |
|
|
|
map.put("appVariables", appVariables); |
|
|
|
map.put("pcVariables", pcVariables); |
|
|
|
return map; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取流程变量 |
|
|
|
* |
|
|
@ -1687,4 +1605,90 @@ public class FlowTaskService extends MybatisBaseService<FlowTaskMapper, FlowTask |
|
|
|
list.add(map); |
|
|
|
return rb.setData(list); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<Page<FlowTaskDto>> businessTodoListForApp(String userSid, List<BusinessTaskParam> params, int pageNum, int pageSize) { |
|
|
|
Page<FlowTaskDto> page = new Page<>(); |
|
|
|
TaskQuery taskQuery = taskService.createTaskQuery(); |
|
|
|
// 流程参数
|
|
|
|
Map<String, Object> paramMap = new HashMap<>(); |
|
|
|
// 挂载表单参数
|
|
|
|
for (BusinessTaskParam btq : params) { |
|
|
|
paramMap.put(btq.getField(), btq.getValue()); |
|
|
|
if (btq.getSqlOperationSymbol().equals(SQLOperationSymbol.NONE)) { |
|
|
|
if ("orgSid".equals(btq.getField())) { |
|
|
|
String value = btq.getValue(); |
|
|
|
String[] split = value.split(","); |
|
|
|
for (int i = 0; i < split.length; i++) { |
|
|
|
if (i != 0) { |
|
|
|
taskQuery.or().processVariableValueLike("orgSid", split[i] + "%"); |
|
|
|
} else { |
|
|
|
taskQuery.processVariableValueLike("orgSid", split[0] + "%"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
taskQuery.active() |
|
|
|
.includeProcessVariables() |
|
|
|
.or() |
|
|
|
//.taskCandidateGroupIn(roleSidList)
|
|
|
|
.taskAssigneeLike("%" + userSid + "%") |
|
|
|
.endOr() |
|
|
|
.orderByTaskCreateTime().desc(); |
|
|
|
// 查询筛选条件
|
|
|
|
if (paramMap.get("startDate") != null && StringUtils.isNotBlank(paramMap.get("startDate").toString())) { |
|
|
|
taskQuery.taskCreatedAfter(DateUtils.dateStrConvertDate(paramMap.get("startDate").toString(), "yyyy-MM-dd")); |
|
|
|
} |
|
|
|
if (paramMap.get("endDate") != null && StringUtils.isNotBlank(paramMap.get("endDate").toString())) { |
|
|
|
taskQuery.taskCreatedBefore(DateUtils.dateStrConvertDate(paramMap.get("endDate").toString(), "yyyy-MM-dd")); |
|
|
|
} |
|
|
|
if (paramMap.get("proDefName") != null && StringUtils.isNotBlank(paramMap.get("proDefName").toString())) { |
|
|
|
taskQuery.processDefinitionNameLike("%" + paramMap.get("proDefName") + "%"); |
|
|
|
} |
|
|
|
page.setTotal(taskQuery.count()); |
|
|
|
int p = (pageNum - 1) * pageSize; |
|
|
|
List<Task> taskList = taskQuery.listPage(p, pageSize); |
|
|
|
List<FlowTaskDto> flowList = new ArrayList<>(); |
|
|
|
for (Task task : taskList) { |
|
|
|
FlowTaskDto flowTask = new FlowTaskDto(); |
|
|
|
Map<String, Object> processVariables = task.getProcessVariables(); |
|
|
|
flowTask.setProcessVariables(processVariables); |
|
|
|
// 当前流程信息
|
|
|
|
flowTask.setTaskId(task.getId()); |
|
|
|
flowTask.setTaskDefKey(task.getTaskDefinitionKey()); |
|
|
|
flowTask.setCreateTime(task.getCreateTime()); |
|
|
|
flowTask.setProcDefId(task.getProcessDefinitionId()); |
|
|
|
flowTask.setTaskName(task.getName()); |
|
|
|
// 流程定义信息
|
|
|
|
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery() |
|
|
|
.processDefinitionId(task.getProcessDefinitionId()) |
|
|
|
.singleResult(); |
|
|
|
flowTask.setDeployId(pd.getDeploymentId()); |
|
|
|
flowTask.setProcDefName(pd.getName()); |
|
|
|
flowTask.setProcDefVersion(pd.getVersion()); |
|
|
|
flowTask.setProcInsId(task.getProcessInstanceId()); |
|
|
|
// 流程发起人信息
|
|
|
|
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() |
|
|
|
.processInstanceId(task.getProcessInstanceId()) |
|
|
|
.singleResult(); |
|
|
|
flowTask.setProcessCreateTime(historicProcessInstance.getStartTime()); |
|
|
|
ResultBean<SysUserVo> sysUserVoResultBean = sysUserFeign.fetchBySid(historicProcessInstance.getStartUserId()); |
|
|
|
flowTask.setStartUserSid(sysUserVoResultBean.getData().getSid()); |
|
|
|
flowTask.setStartUserName(sysUserVoResultBean.getData().getName()); |
|
|
|
flowTask.setStartDeptName(sysUserVoResultBean.getData().getOrganizationName()); |
|
|
|
ResultBean<SysUserVo> sysUserVoResultBean2 = sysUserFeign.fetchBySid(userSid); |
|
|
|
flowTask.setAssigneeName(sysUserVoResultBean2.getData().getName()); |
|
|
|
flowTask.setAssigneeSid(sysUserVoResultBean2.getData().getSid()); |
|
|
|
flowTask.setDeptName(sysUserVoResultBean2.getData().getOrganizationName()); |
|
|
|
String procDefId = flowTask.getProcDefId(); |
|
|
|
String taskDefKey = flowTask.getTaskDefKey(); |
|
|
|
ResultBean<SysProUrlVo> resultBean1 = sysProUrlService.selectUrlByKey(procDefId, taskDefKey, "1","2"); |
|
|
|
SysProUrlVo data = resultBean1.getData(); |
|
|
|
flowTask.setSysProUrlVo(data); |
|
|
|
flowList.add(flowTask); |
|
|
|
} |
|
|
|
page.setRecords(flowList); |
|
|
|
ResultBean<Page<FlowTaskDto>> rb = new ResultBean<Page<FlowTaskDto>>(); |
|
|
|
return rb.success().setData(page); |
|
|
|
} |
|
|
|
} |