|
@@ -34,12 +34,10 @@ import com.ningdatech.pmapi.todocenter.enums.IsAppendProjectEnum; |
|
|
import com.ningdatech.pmapi.todocenter.enums.ProcessHandlerEnum; |
|
|
import com.ningdatech.pmapi.todocenter.enums.ProcessHandlerEnum; |
|
|
import com.ningdatech.pmapi.todocenter.enums.ProcessStatusEnum; |
|
|
import com.ningdatech.pmapi.todocenter.enums.ProcessStatusEnum; |
|
|
import com.ningdatech.pmapi.todocenter.extension.cmd.BackToHisApprovalNodeCmd; |
|
|
import com.ningdatech.pmapi.todocenter.extension.cmd.BackToHisApprovalNodeCmd; |
|
|
|
|
|
import com.ningdatech.pmapi.todocenter.extension.cmd.SaveCommentCmd; |
|
|
import com.ningdatech.pmapi.todocenter.model.dto.req.ReqProcessHandlerDTO; |
|
|
import com.ningdatech.pmapi.todocenter.model.dto.req.ReqProcessHandlerDTO; |
|
|
import com.ningdatech.pmapi.todocenter.model.dto.req.ReqToBeProcessedDTO; |
|
|
import com.ningdatech.pmapi.todocenter.model.dto.req.ReqToBeProcessedDTO; |
|
|
import com.ningdatech.pmapi.todocenter.model.dto.res.ResHandledExportDTO; |
|
|
|
|
|
import com.ningdatech.pmapi.todocenter.model.dto.res.ResMySubmittedExportDTO; |
|
|
|
|
|
import com.ningdatech.pmapi.todocenter.model.dto.res.ResToBeProcessedDTO; |
|
|
|
|
|
import com.ningdatech.pmapi.todocenter.model.dto.res.ResToBeExportDTO; |
|
|
|
|
|
|
|
|
import com.ningdatech.pmapi.todocenter.model.dto.res.*; |
|
|
import com.ningdatech.pmapi.todocenter.zwdd.model.MessageContent; |
|
|
import com.ningdatech.pmapi.todocenter.zwdd.model.MessageContent; |
|
|
import com.ningdatech.pmapi.todocenter.zwdd.model.MessageText; |
|
|
import com.ningdatech.pmapi.todocenter.zwdd.model.MessageText; |
|
|
import com.ningdatech.pmapi.user.entity.UserInfo; |
|
|
import com.ningdatech.pmapi.user.entity.UserInfo; |
|
@@ -85,6 +83,7 @@ import org.flowable.task.api.TaskQuery; |
|
|
import org.flowable.task.api.history.HistoricTaskInstance; |
|
|
import org.flowable.task.api.history.HistoricTaskInstance; |
|
|
import org.flowable.task.service.history.NativeHistoricTaskInstanceQuery; |
|
|
import org.flowable.task.service.history.NativeHistoricTaskInstanceQuery; |
|
|
import org.flowable.variable.api.history.HistoricVariableInstance; |
|
|
import org.flowable.variable.api.history.HistoricVariableInstance; |
|
|
|
|
|
import org.flowable.variable.api.history.NativeHistoricVariableInstanceQuery; |
|
|
import org.springframework.beans.BeanUtils; |
|
|
import org.springframework.beans.BeanUtils; |
|
|
import org.springframework.stereotype.Component; |
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
@@ -232,7 +231,7 @@ public class TodoCenterManage { |
|
|
.sheet(fileName) |
|
|
.sheet(fileName) |
|
|
.doWrite(collect); |
|
|
.doWrite(collect); |
|
|
} catch (IOException e) { |
|
|
} catch (IOException e) { |
|
|
throw new RuntimeException(e); |
|
|
|
|
|
|
|
|
throw new BizException("导出失败!"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
/** |
|
|
/** |
|
@@ -243,28 +242,30 @@ public class TodoCenterManage { |
|
|
* @since 2023/02/01 17:43 |
|
|
* @since 2023/02/01 17:43 |
|
|
*/ |
|
|
*/ |
|
|
public void handler(ReqProcessHandlerDTO param) { |
|
|
public void handler(ReqProcessHandlerDTO param) { |
|
|
Long userId = LoginUserUtil.getUserId(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取登录用户ID |
|
|
|
|
|
// Long userId = LoginUserUtil.getUserId(); |
|
|
|
|
|
|
|
|
|
|
|
Long userId = 381496L; |
|
|
|
|
|
|
|
|
Task task = taskService.createTaskQuery().taskId(param.getTaskId()).active().singleResult(); |
|
|
Task task = taskService.createTaskQuery().taskId(param.getTaskId()).active().singleResult(); |
|
|
HashMap<String, Object> formData = new HashMap<>(32); |
|
|
HashMap<String, Object> formData = new HashMap<>(32); |
|
|
if (Objects.isNull(task)) { |
|
|
if (Objects.isNull(task)) { |
|
|
throw new BizException("任务不存在"); |
|
|
throw new BizException("任务不存在"); |
|
|
} |
|
|
} |
|
|
if (hasComment(param.getAuditInfo())) { |
|
|
|
|
|
taskService.addComment(param.getTaskId(), param.getInstanceId(), JSONObject.toJSONString(param.getAuditInfo())); |
|
|
|
|
|
} |
|
|
|
|
|
switch (param.getAction()) { |
|
|
switch (param.getAction()) { |
|
|
// 通过 |
|
|
// 通过 |
|
|
case PASS: |
|
|
case PASS: |
|
|
formService.updateInstanceFormData(param.getInstanceId(), formData); |
|
|
formService.updateInstanceFormData(param.getInstanceId(), formData); |
|
|
doPass(task, param); |
|
|
|
|
|
|
|
|
doPass(task, userId, param); |
|
|
// 盖章并通过 |
|
|
// 盖章并通过 |
|
|
case SEAL_PASS: |
|
|
case SEAL_PASS: |
|
|
formService.updateInstanceFormData(param.getInstanceId(), formData); |
|
|
formService.updateInstanceFormData(param.getInstanceId(), formData); |
|
|
doSealPass(task, param); |
|
|
|
|
|
|
|
|
doSealPass(task, userId, param); |
|
|
// 驳回 |
|
|
// 驳回 |
|
|
case REJECT: |
|
|
case REJECT: |
|
|
formService.updateInstanceFormData(param.getInstanceId(), formData); |
|
|
formService.updateInstanceFormData(param.getInstanceId(), formData); |
|
|
doReject(task, param); |
|
|
|
|
|
|
|
|
doReject(task, userId, param); |
|
|
break; |
|
|
break; |
|
|
// 退回 |
|
|
// 退回 |
|
|
case BACK: |
|
|
case BACK: |
|
@@ -273,7 +274,7 @@ public class TodoCenterManage { |
|
|
break; |
|
|
break; |
|
|
// 撤回 |
|
|
// 撤回 |
|
|
case WITHDRAW: |
|
|
case WITHDRAW: |
|
|
doWithDrawProcess(task); |
|
|
|
|
|
|
|
|
doWithDrawProcess(task,userId); |
|
|
break; |
|
|
break; |
|
|
default: |
|
|
default: |
|
|
throw new IllegalStateException("Unexpected value: " + param.getAction()); |
|
|
throw new IllegalStateException("Unexpected value: " + param.getAction()); |
|
@@ -282,16 +283,22 @@ public class TodoCenterManage { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 审批任务:驳回 |
|
|
* 审批任务:驳回 |
|
|
|
|
|
* |
|
|
* @param task 当前任务 |
|
|
* @param task 当前任务 |
|
|
* @param param 参数 |
|
|
|
|
|
|
|
|
* @param userId |
|
|
|
|
|
* @param param 参数 |
|
|
*/ |
|
|
*/ |
|
|
private void doReject(Task task, ReqProcessHandlerDTO param) { |
|
|
|
|
|
|
|
|
private void doReject(Task task, Long userId, ReqProcessHandlerDTO param) { |
|
|
|
|
|
// 获取当前申报项目 |
|
|
|
|
|
Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) |
|
|
|
|
|
.eq(Project::getInstCode, task.getProcessInstanceId())); |
|
|
|
|
|
String projectName = declaredProject.getProjectName(); |
|
|
|
|
|
|
|
|
Map<String, Object> var = new HashMap<>(16); |
|
|
Map<String, Object> var = new HashMap<>(16); |
|
|
var.put("approve_" + task.getId(), param.getAction()); |
|
|
var.put("approve_" + task.getId(), param.getAction()); |
|
|
// TODO 中止流程并使项目进入对应状态,给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被驳回,请及时处理。 |
|
|
// TODO 中止流程并使项目进入对应状态,给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被驳回,请及时处理。 |
|
|
//获取流程定义 |
|
|
//获取流程定义 |
|
|
Process process = ProcessDefinitionUtil.getProcess(task.getProcessDefinitionId()); |
|
|
Process process = ProcessDefinitionUtil.getProcess(task.getProcessDefinitionId()); |
|
|
String projectName = getProjectName(task); |
|
|
|
|
|
// 获取根节点即流程发起节点 |
|
|
// 获取根节点即流程发起节点 |
|
|
FlowNode rootNode = (FlowNode) process.getFlowElement("root", true); |
|
|
FlowNode rootNode = (FlowNode) process.getFlowElement("root", true); |
|
|
// TODO 中止流程并使项目进入对应状态,给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被驳回,请及时处理。 |
|
|
// TODO 中止流程并使项目进入对应状态,给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被驳回,请及时处理。 |
|
@@ -349,68 +356,88 @@ public class TodoCenterManage { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 审批任务:盖章并通过 |
|
|
* 审批任务:盖章并通过 |
|
|
|
|
|
* |
|
|
* @param task 当前任务 |
|
|
* @param task 当前任务 |
|
|
* @param param 参数 |
|
|
|
|
|
|
|
|
* @param userId |
|
|
|
|
|
* @param param 参数 |
|
|
*/ |
|
|
*/ |
|
|
private void doSealPass(Task task, ReqProcessHandlerDTO param) { |
|
|
|
|
|
|
|
|
private void doSealPass(Task task, Long userId, ReqProcessHandlerDTO param) { |
|
|
Map<String, Object> var = new HashMap<>(16); |
|
|
Map<String, Object> var = new HashMap<>(16); |
|
|
var.put("approve_" + task.getId(), param.getAction()); |
|
|
var.put("approve_" + task.getId(), param.getAction()); |
|
|
|
|
|
|
|
|
// TODO 判断项目申报单位级别,区县单位申报有上级主管单位意见栏,市级单位没有 |
|
|
// TODO 判断项目申报单位级别,区县单位申报有上级主管单位意见栏,市级单位没有 |
|
|
|
|
|
|
|
|
// TODO 市级单位:为大数据局;区县单位:为大数据中心(根据附件区分?) |
|
|
// TODO 市级单位:为大数据局;区县单位:为大数据中心(根据附件区分?) |
|
|
|
|
|
|
|
|
|
|
|
// 获取当前申报项目 |
|
|
|
|
|
Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) |
|
|
|
|
|
.eq(Project::getInstCode, task.getProcessInstanceId())); |
|
|
// 更新项目状态到下一个状态 |
|
|
// 更新项目状态到下一个状态 |
|
|
updatePassProjectStatus(task); |
|
|
|
|
|
|
|
|
updatePassProjectStatus(task, userId, declaredProject); |
|
|
taskService.complete(param.getTaskId(), var); |
|
|
taskService.complete(param.getTaskId(), var); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 审批任务:通过 |
|
|
* 审批任务:通过 |
|
|
|
|
|
* |
|
|
* @param task 当前任务 |
|
|
* @param task 当前任务 |
|
|
* @param param 参数 |
|
|
|
|
|
|
|
|
* @param userId |
|
|
|
|
|
* @param param 参数 |
|
|
*/ |
|
|
*/ |
|
|
private void doPass(Task task, ReqProcessHandlerDTO param) { |
|
|
|
|
|
|
|
|
private void doPass(Task task, Long userId, ReqProcessHandlerDTO param) { |
|
|
|
|
|
String processInstanceId = task.getProcessInstanceId(); |
|
|
|
|
|
// 获取当前申报项目 |
|
|
|
|
|
Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) |
|
|
|
|
|
.eq(Project::getInstCode, task.getProcessInstanceId())); |
|
|
|
|
|
String projectName = declaredProject.getProjectName(); |
|
|
|
|
|
|
|
|
String projectName = getProjectName(task); |
|
|
|
|
|
Map<String, Object> var = new HashMap<>(16); |
|
|
Map<String, Object> var = new HashMap<>(16); |
|
|
var.put("approve_" + task.getId(), param.getAction()); |
|
|
var.put("approve_" + task.getId(), param.getAction()); |
|
|
//获取流程定义 |
|
|
|
|
|
Process process = ProcessDefinitionUtil.getProcess(task.getProcessDefinitionId()); |
|
|
|
|
|
// 获取当前节点 |
|
|
|
|
|
FlowNode currentNode = (FlowNode) process.getFlowElement(task.getTaskDefinitionKey(), true); |
|
|
|
|
|
|
|
|
// 保存审核意见 |
|
|
|
|
|
if (hasComment(param.getAuditInfo())) { |
|
|
|
|
|
//执行自定义的保存评论的功能 |
|
|
|
|
|
managementService.executeCommand(new SaveCommentCmd(param.getTaskId(),param.getInstanceId(),String.valueOf(userId),JSONObject.toJSONString(param.getAuditInfo()))); |
|
|
|
|
|
} |
|
|
|
|
|
updatePassProjectStatus(task,userId,declaredProject); |
|
|
|
|
|
taskService.complete(param.getTaskId(), var); |
|
|
|
|
|
////获取流程定义 |
|
|
|
|
|
//Process process = ProcessDefinitionUtil.getProcess(task.getProcessDefinitionId()); |
|
|
|
|
|
//// 获取当前节点 |
|
|
|
|
|
//FlowNode currentNode = (FlowNode) process.getFlowElement(task.getTaskDefinitionKey(), true); |
|
|
|
|
|
|
|
|
|
|
|
//获取bpm对象 |
|
|
|
|
|
BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); |
|
|
|
|
|
//传节点定义key 获取当前节点 |
|
|
|
|
|
FlowNode currentNode = (FlowNode) bpmnModel.getFlowElement(task.getTaskDefinitionKey()); |
|
|
|
|
|
|
|
|
// 获取流程下一个节点浙政钉用户ID |
|
|
// 获取流程下一个节点浙政钉用户ID |
|
|
String nextUserId = getNextUserId(currentNode); |
|
|
|
|
|
|
|
|
String nextUserId = getNextUserId(currentNode,processInstanceId); |
|
|
// 若有下一个审核人,向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 |
|
|
// 若有下一个审核人,向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 |
|
|
if (Objects.nonNull(nextUserId)){ |
|
|
if (Objects.nonNull(nextUserId)){ |
|
|
UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(nextUserId)); |
|
|
|
|
|
|
|
|
// UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(nextUserId)); |
|
|
// TODO 向其发送浙政钉工作通知 |
|
|
// TODO 向其发送浙政钉工作通知 |
|
|
String msg = String.format(PASS_MSG_TEMPLATE,null,projectName); |
|
|
String msg = String.format(PASS_MSG_TEMPLATE,null,projectName); |
|
|
sendWorkNotice(auditUserInfo,msg); |
|
|
|
|
|
|
|
|
// sendWorkNotice(auditUserInfo,msg); |
|
|
}else { |
|
|
}else { |
|
|
// 若没有,向发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 |
|
|
// 若没有,向发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 |
|
|
// TODO 向其发送浙政钉工作通知 获取根节点的孩子节点(即发起人节点),向其发送浙政钉工作通知 |
|
|
// TODO 向其发送浙政钉工作通知 获取根节点的孩子节点(即发起人节点),向其发送浙政钉工作通知 |
|
|
// 获取根节点即流程发起节点 |
|
|
// 获取根节点即流程发起节点 |
|
|
FlowNode rootNode = (FlowNode) process.getFlowElement("root", true); |
|
|
|
|
|
sendWorkNoticeToStartUser(task, projectName, rootNode); |
|
|
|
|
|
|
|
|
// FlowNode rootNode = (FlowNode) process.getFlowElement("root", true); |
|
|
|
|
|
// FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); |
|
|
|
|
|
// sendWorkNoticeToStartUser(task, projectName, rootNode); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
updatePassProjectStatus(task); |
|
|
|
|
|
taskService.complete(param.getTaskId(), var); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 当为通过操作时,更新项目表中项目状态 |
|
|
* 当为通过操作时,更新项目表中项目状态 |
|
|
* @param task 当前任务 |
|
|
|
|
|
|
|
|
* |
|
|
|
|
|
* @param task 当前任务 |
|
|
|
|
|
* @param userId |
|
|
|
|
|
* @param declaredProject |
|
|
* @return void |
|
|
* @return void |
|
|
* @author CMM |
|
|
* @author CMM |
|
|
* @since 2023/02/08 20:38 |
|
|
* @since 2023/02/08 20:38 |
|
|
*/ |
|
|
*/ |
|
|
private void updatePassProjectStatus(Task task) { |
|
|
|
|
|
// 获取当前登录用户 |
|
|
|
|
|
Long userId = LoginUserUtil.getUserId(); |
|
|
|
|
|
// 获取当前申报项目 |
|
|
|
|
|
Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) |
|
|
|
|
|
.eq(Project::getInstCode, task.getProcessInstanceId())); |
|
|
|
|
|
|
|
|
private void updatePassProjectStatus(Task task, Long userId, Project declaredProject) { |
|
|
// 获取当前流程项目状态 |
|
|
// 获取当前流程项目状态 |
|
|
Integer projectStatusSecond = declaredProject.getProjectStatusSecond(); |
|
|
Integer projectStatusSecond = declaredProject.getProjectStatusSecond(); |
|
|
// 根据当前状态获取对应的通过事件 |
|
|
// 根据当前状态获取对应的通过事件 |
|
@@ -474,12 +501,14 @@ public class TodoCenterManage { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 获取当前节点的下一个节点的浙政钉用户ID |
|
|
* 获取当前节点的下一个节点的浙政钉用户ID |
|
|
* @param currentNode 当前节点 |
|
|
|
|
|
|
|
|
* |
|
|
|
|
|
* @param currentNode 当前节点 |
|
|
|
|
|
* @param processInstanceId |
|
|
* @return java.lang.String 下一个节点的浙政钉用户ID |
|
|
* @return java.lang.String 下一个节点的浙政钉用户ID |
|
|
* @author CMM |
|
|
* @author CMM |
|
|
* @since 2023/02/02 16:49 |
|
|
* @since 2023/02/02 16:49 |
|
|
*/ |
|
|
*/ |
|
|
private String getNextUserId(FlowNode currentNode) { |
|
|
|
|
|
|
|
|
private String getNextUserId(FlowNode currentNode, String processInstanceId) { |
|
|
String nextUserId = null; |
|
|
String nextUserId = null; |
|
|
// 输出连线 |
|
|
// 输出连线 |
|
|
List<SequenceFlow> outgoingFlows = currentNode.getOutgoingFlows(); |
|
|
List<SequenceFlow> outgoingFlows = currentNode.getOutgoingFlows(); |
|
@@ -487,9 +516,25 @@ public class TodoCenterManage { |
|
|
for (SequenceFlow currentOutgoingFlow : outgoingFlows) { |
|
|
for (SequenceFlow currentOutgoingFlow : outgoingFlows) { |
|
|
// 类型自己判断 |
|
|
// 类型自己判断 |
|
|
FlowElement targetFlowElement = currentOutgoingFlow.getTargetFlowElement(); |
|
|
FlowElement targetFlowElement = currentOutgoingFlow.getTargetFlowElement(); |
|
|
|
|
|
// 如果下个审批节点为结束节点,那么跳过该节点 |
|
|
|
|
|
if (targetFlowElement instanceof EndEvent){ |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
// TODO 若要会签需判断候选人 |
|
|
// TODO 若要会签需判断候选人 |
|
|
// 用户任务 |
|
|
// 用户任务 |
|
|
if (targetFlowElement instanceof UserTask) { |
|
|
if (targetFlowElement instanceof UserTask) { |
|
|
|
|
|
String name = targetFlowElement.getName(); |
|
|
|
|
|
String extensionId = ((UserTask) targetFlowElement).getExtensionId(); |
|
|
|
|
|
//自定义sql查询所有已办的任务 |
|
|
|
|
|
String nativeSql = "SELECT arv.TEXT_\n" + |
|
|
|
|
|
"FROM ACT_RU_VARIABLE AS arv \n" + |
|
|
|
|
|
"WHERE arv.NAME_ = " + name + |
|
|
|
|
|
"AND arv.PROC_INST_ID_ = " + processInstanceId + |
|
|
|
|
|
"AND arv.EXECUTION_ID_ = " + extensionId; |
|
|
|
|
|
NativeHistoricVariableInstanceQuery query = historyService.createNativeHistoricVariableInstanceQuery().sql(nativeSql); |
|
|
|
|
|
List<HistoricVariableInstance> list = query.list(); |
|
|
|
|
|
HistoricVariableInstance historicVariableInstance = list.get(0); |
|
|
|
|
|
String variable = runtimeService.getVariable(extensionId, name, String.class); |
|
|
UserTask userTask = (UserTask) targetFlowElement; |
|
|
UserTask userTask = (UserTask) targetFlowElement; |
|
|
nextUserId = userTask.getAssignee(); |
|
|
nextUserId = userTask.getAssignee(); |
|
|
break; |
|
|
break; |
|
@@ -498,21 +543,6 @@ public class TodoCenterManage { |
|
|
return nextUserId; |
|
|
return nextUserId; |
|
|
} |
|
|
} |
|
|
/** |
|
|
/** |
|
|
* 获取任务节点的申报项目名称 |
|
|
|
|
|
* @param task 当前任务 |
|
|
|
|
|
* @return java.lang.String 项目名称 |
|
|
|
|
|
* @author CMM |
|
|
|
|
|
* @since 2023/02/01 17:27 |
|
|
|
|
|
*/ |
|
|
|
|
|
private String getProjectName(Task task) { |
|
|
|
|
|
String nodeId = task.getTaskDefinitionKey(); |
|
|
|
|
|
String instanceId = task.getProcessInstanceId(); |
|
|
|
|
|
ProcessProgressVo instanceProgress = processService.getInstanceProgress(nodeId, instanceId); |
|
|
|
|
|
Map<String, Object> formData = instanceProgress.getFormData(); |
|
|
|
|
|
String projectName = (String) formData.get(ProjectDeclareConstants.BasicInformation.PROJECT_NAME); |
|
|
|
|
|
return projectName; |
|
|
|
|
|
} |
|
|
|
|
|
/** |
|
|
|
|
|
* 判断处理操作是否含有审核意见 |
|
|
* 判断处理操作是否含有审核意见 |
|
|
* @param comment 审核意见 |
|
|
* @param comment 审核意见 |
|
|
* @return boolean |
|
|
* @return boolean |
|
@@ -562,9 +592,10 @@ public class TodoCenterManage { |
|
|
/** |
|
|
/** |
|
|
* 撤销流程处理 |
|
|
* 撤销流程处理 |
|
|
* |
|
|
* |
|
|
* @param task 当前任务 |
|
|
|
|
|
|
|
|
* @param task 当前任务 |
|
|
|
|
|
* @param userId |
|
|
*/ |
|
|
*/ |
|
|
private void doWithDrawProcess(Task task) { |
|
|
|
|
|
|
|
|
private void doWithDrawProcess(Task task, Long userId) { |
|
|
//获取流程定义 |
|
|
//获取流程定义 |
|
|
Process process = ProcessDefinitionUtil.getProcess(task.getProcessDefinitionId()); |
|
|
Process process = ProcessDefinitionUtil.getProcess(task.getProcessDefinitionId()); |
|
|
// 获取当前运行流程的发起人节点信息 |
|
|
// 获取当前运行流程的发起人节点信息 |
|
@@ -573,7 +604,6 @@ public class TodoCenterManage { |
|
|
FlowNode currentNode = (FlowNode) process.getFlowElement(task.getTaskDefinitionKey(), true); |
|
|
FlowNode currentNode = (FlowNode) process.getFlowElement(task.getTaskDefinitionKey(), true); |
|
|
String rootUserId = getRootUserId(rootNode); |
|
|
String rootUserId = getRootUserId(rootNode); |
|
|
// 判断当前登录用户是否是流程发起人 |
|
|
// 判断当前登录用户是否是流程发起人 |
|
|
Long userId = LoginUserUtil.getUserId(); |
|
|
|
|
|
if (rootUserId.equals(String.valueOf(userId))){ |
|
|
if (rootUserId.equals(String.valueOf(userId))){ |
|
|
// TODO 若是流程发起人点击撤回,项目回到上一个状态,并删除当前审核人对应的待办记录 |
|
|
// TODO 若是流程发起人点击撤回,项目回到上一个状态,并删除当前审核人对应的待办记录 |
|
|
updateWithdrawProjectStatus(task, userId); |
|
|
updateWithdrawProjectStatus(task, userId); |
|
@@ -617,7 +647,7 @@ public class TodoCenterManage { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 当为撤回操作时,更新项目表中的项目状态为前一个状态 |
|
|
* 当为撤回操作时,更新项目表中的项目状态为前一个状态 |
|
|
* @param task |
|
|
|
|
|
|
|
|
* @param task 当前任务 |
|
|
* @param userId |
|
|
* @param userId |
|
|
* @return void |
|
|
* @return void |
|
|
* @author CMM |
|
|
* @author CMM |
|
@@ -651,8 +681,10 @@ public class TodoCenterManage { |
|
|
* @param param 参数 |
|
|
* @param param 参数 |
|
|
*/ |
|
|
*/ |
|
|
private void doBackTask(Task task, Long userId, ReqProcessHandlerDTO param) { |
|
|
private void doBackTask(Task task, Long userId, ReqProcessHandlerDTO param) { |
|
|
// 获取项目名称 |
|
|
|
|
|
String projectName = getProjectName(task); |
|
|
|
|
|
|
|
|
// 获取当前申报项目 |
|
|
|
|
|
Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) |
|
|
|
|
|
.eq(Project::getInstCode, task.getProcessInstanceId())); |
|
|
|
|
|
String projectName = declaredProject.getProjectName(); |
|
|
//获取流程定义 |
|
|
//获取流程定义 |
|
|
Process process = ProcessDefinitionUtil.getProcess(task.getProcessDefinitionId()); |
|
|
Process process = ProcessDefinitionUtil.getProcess(task.getProcessDefinitionId()); |
|
|
// 获取根节点即流程发起节点 |
|
|
// 获取根节点即流程发起节点 |
|
@@ -678,7 +710,7 @@ public class TodoCenterManage { |
|
|
HistoricVariableInstance forms = historyService.createHistoricVariableInstanceQuery() |
|
|
HistoricVariableInstance forms = historyService.createHistoricVariableInstanceQuery() |
|
|
.processInstanceId(instanceId).variableName(WflowGlobalVarDef.WFLOW_FORMS).singleResult(); |
|
|
.processInstanceId(instanceId).variableName(WflowGlobalVarDef.WFLOW_FORMS).singleResult(); |
|
|
List<HistoricVariableInstance> formDatas = historyService.createHistoricVariableInstanceQuery() |
|
|
List<HistoricVariableInstance> formDatas = historyService.createHistoricVariableInstanceQuery() |
|
|
.processInstanceId(instanceId).variableNameLike("field%").list(); |
|
|
|
|
|
|
|
|
.processInstanceId(instanceId).list(); |
|
|
// 取节点设置 |
|
|
// 取节点设置 |
|
|
HistoricVariableInstance nodeProps = historyService.createHistoricVariableInstanceQuery() |
|
|
HistoricVariableInstance nodeProps = historyService.createHistoricVariableInstanceQuery() |
|
|
.processInstanceId(instanceId).variableName(WflowGlobalVarDef.WFLOW_NODE_PROPS).singleResult(); |
|
|
.processInstanceId(instanceId).variableName(WflowGlobalVarDef.WFLOW_NODE_PROPS).singleResult(); |
|
@@ -942,7 +974,7 @@ public class TodoCenterManage { |
|
|
.sheet(fileName) |
|
|
.sheet(fileName) |
|
|
.doWrite(collect); |
|
|
.doWrite(collect); |
|
|
} catch (IOException e) { |
|
|
} catch (IOException e) { |
|
|
throw new RuntimeException(e); |
|
|
|
|
|
|
|
|
throw new BizException("导出失败!"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -1085,8 +1117,87 @@ public class TodoCenterManage { |
|
|
.sheet(fileName) |
|
|
.sheet(fileName) |
|
|
.doWrite(collect); |
|
|
.doWrite(collect); |
|
|
} catch (IOException e) { |
|
|
} catch (IOException e) { |
|
|
throw new RuntimeException(e); |
|
|
|
|
|
|
|
|
throw new BizException("导出失败!"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public PageVo<ResToBeProcessedDTO> queryCcMeProjectList(ReqToBeProcessedDTO param) { |
|
|
|
|
|
// 获取当前登录用户ID |
|
|
|
|
|
// Long userId = LoginUserUtil.getUserId(); |
|
|
|
|
|
|
|
|
|
|
|
Long userId = 381496L; |
|
|
|
|
|
Page<Project> page = param.page(); |
|
|
|
|
|
Set<String> staterUsers = new HashSet<>(); |
|
|
|
|
|
List<WflowCcTasks> ccTasks = ccTasksMapper.selectList(Wrappers.lambdaQuery(WflowCcTasks.class) |
|
|
|
|
|
.eq(WflowCcTasks::getUserId, String.valueOf(userId)) |
|
|
|
|
|
.orderByDesc(WflowCcTasks::getCreateTime)); |
|
|
|
|
|
|
|
|
|
|
|
LambdaQueryWrapper<Project> wrapper = Wrappers.lambdaQuery(Project.class); |
|
|
|
|
|
wrapper.like(StrUtil.isNotBlank(param.getProjectName()),Project::getProjectName,param.getProjectName()) |
|
|
|
|
|
.like(StrUtil.isNotBlank(param.getBuildUnitName()),Project::getBuildUnitName,param.getBuildUnitName()) |
|
|
|
|
|
.eq(Objects.nonNull(param.getProjectYear()),Project::getProjectYear,param.getProjectYear()) |
|
|
|
|
|
.eq(Objects.nonNull(param.getIsSupplement()),Project::getIsTemporaryAugment,param.getIsSupplement()) |
|
|
|
|
|
.ge(Objects.nonNull(param.getProcessLaunchStartTime()),Project::getBeginTime,param.getProcessLaunchStartTime()) |
|
|
|
|
|
.le(Objects.nonNull(param.getProcessLaunchEndTime()),Project::getEndTime,param.getProcessLaunchEndTime()); |
|
|
|
|
|
projectService.page(page,wrapper); |
|
|
|
|
|
|
|
|
|
|
|
// 将抄送我的流程实例一次性取出来,减少查询次数 |
|
|
|
|
|
Map<String, HistoricProcessInstance> instanceMap = CollectionUtil.isNotEmpty(ccTasks) ? |
|
|
|
|
|
historyService.createHistoricProcessInstanceQuery().processInstanceIds(ccTasks.stream() |
|
|
|
|
|
.map(WflowCcTasks::getInstanceId).collect(Collectors.toSet())) |
|
|
|
|
|
.list().stream().collect(Collectors.toMap(HistoricProcessInstance::getId, v -> v)) : new HashMap<>(); |
|
|
|
|
|
List<String> processInsIds = ccTasks.stream().map(WflowCcTasks::getInstanceId).collect(Collectors.toList()); |
|
|
|
|
|
List<ResToBeProcessedDTO> resVos = page.getRecords().stream().filter(d -> processInsIds.contains(d.getInstCode())).map(d -> { |
|
|
|
|
|
ResToBeProcessedDTO res = new ResToBeProcessedDTO(); |
|
|
|
|
|
BeanUtils.copyProperties(d, res); |
|
|
|
|
|
res.setProcessStatusName(ProcessStatusEnum.getDescByCode(d.getProcessStatus())); |
|
|
|
|
|
LocalDateTime processLaunchTime = d.getCreateOn(); |
|
|
|
|
|
String launchTimeFormat = NdDateUtils.format(processLaunchTime, "yyyy-MM-dd HH:mm"); |
|
|
|
|
|
LocalDateTime launchTime = LocalDateTime.parse(launchTimeFormat, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); |
|
|
|
|
|
res.setProcessLaunchTime(launchTime); |
|
|
|
|
|
HistoricProcessInstance ist = instanceMap.get(d.getInstCode()); |
|
|
|
|
|
staterUsers.add(ist.getStartUserId()); |
|
|
|
|
|
ProcessInstanceVo processInstanceVo = getProcessInstanceVos(ist); |
|
|
|
|
|
res.setProcessInstanceInfo(processInstanceVo); |
|
|
|
|
|
return res; |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(staterUsers)) { |
|
|
|
|
|
Map<String, OrgUser> userMap = userDeptOrLeaderService.getUserMapByIds(staterUsers); |
|
|
|
|
|
resVos.stream().map(v -> { |
|
|
|
|
|
v.getProcessInstanceInfo().setStaterUser(userMap.get(v.getProcessInstanceInfo().getStaterUserId())); |
|
|
|
|
|
return v; |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//if (CollectionUtil.isNotEmpty(staterUsers)) { |
|
|
|
|
|
// Map<Long, UserInfo> userMap = userInfoService.getUserMapByIds(staterUsers); |
|
|
|
|
|
// resVos.stream().peek(v -> v.setOwner(userMap.get(startUserId))) |
|
|
|
|
|
// .collect(Collectors.toList()); |
|
|
|
|
|
//} |
|
|
|
|
|
return PageVo.of(resVos,resVos.size()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void exportCcMeProjectList(HttpServletResponse response, ReqToBeProcessedDTO param) { |
|
|
|
|
|
PageVo<ResToBeProcessedDTO> page = queryCcMeProjectList(param); |
|
|
|
|
|
List<ResToBeProcessedDTO> collect = (List<ResToBeProcessedDTO>) page.getRecords(); |
|
|
|
|
|
String fileName = null; |
|
|
|
|
|
if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsSupplement())){ |
|
|
|
|
|
fileName = "待办中心_抄送我的_增补项目列表"; |
|
|
|
|
|
}else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsSupplement())){ |
|
|
|
|
|
fileName = "待办中心_抄送我的_非增补项目列表"; |
|
|
|
|
|
} |
|
|
|
|
|
ExcelDownUtil.setFileName(fileName,response); |
|
|
|
|
|
//数据导出处理函数 |
|
|
|
|
|
try { |
|
|
|
|
|
EasyExcel.write(response.getOutputStream(), ResCcMeExportDTO.class) |
|
|
|
|
|
.autoCloseStream(false) |
|
|
|
|
|
.registerWriteHandler(ExcelExportStyle.formalStyle()) |
|
|
|
|
|
.sheet(fileName) |
|
|
|
|
|
.doWrite(collect); |
|
|
|
|
|
} catch (IOException e) { |
|
|
|
|
|
throw new BizException("导出失败!"); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |