Przeglądaj źródła

流程处理-通过功能

tags/24080901
CMM 1 rok temu
rodzic
commit
488c02e20f
6 zmienionych plików z 186 dodań i 337 usunięć
  1. +166
    -166
      pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java
  2. +1
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/ProgressNode.java
  3. +0
    -97
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enums/ProcessHandlerEnum.java
  4. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/extension/cmd/BackToHisApprovalNodeCmd.java
  5. +17
    -29
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
  6. +1
    -42
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqProcessHandlerDTO.java

+ 166
- 166
pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java Wyświetl plik

@@ -1,167 +1,167 @@
package com.ningdatech.pmapi.ding.task;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.google.common.collect.Lists;
import com.ningdatech.basic.model.GenericResult;
import com.ningdatech.pmapi.ding.model.DingOrgInfoTreeDTO;
import com.ningdatech.pmapi.organization.entity.DingOrganization;
import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
import com.ningdatech.zwdd.client.ZwddAuthClient;
import com.ningdatech.zwdd.client.ZwddClient;
import com.ningdatech.zwdd.model.dto.DingOrgInfoDTO;
import com.ningdatech.zwdd.model.dto.DingScopesV2DTO;
import com.ningdatech.zwdd.model.dto.PageSubOrganizationCodeDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* @author liuxinxin
* @date 2023/2/7 上午10:15
*/

@Slf4j
@Component
public class OrganizationBatchGetTask {

@Autowired
private ZwddClient zwddClient;

@Autowired
private ZwddAuthClient zwddAuthClient;

private static final Integer GROUP_SIZE = 100;

@Autowired
private IDingOrganizationService iDingOrganizationService;

/**
* 获取浙政钉组织架构
*/
@Transactional(rollbackFor = Exception.class)
public void OrganizationBatchGetTask() {
// List<DingOrganization> allList = iDingOrganizationService.list();
// List<String> currentAllOrganizationCodeList = allList.stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toList());
// 全量删除
// iDingOrganizationService.remove(Wrappers.lambdaQuery(DingOrganization.class).isNotNull(DingOrganization::getId));
// 获取顶级组织code
GenericResult<DingScopesV2DTO> scopesV2Result = zwddClient.getScopesV2();
DingScopesV2DTO scopesV2 = scopesV2Result.getData();

if (Objects.nonNull(scopesV2)) {
// 顶级组织code
List<String> deptVisibleScopes = scopesV2.getDeptVisibleScopes();
log.info("顶级组织code: size = " + deptVisibleScopes.size() + "列表:" + JSONObject.toJSONString(deptVisibleScopes));
// 获取顶级节点信息
GenericResult<List<DingOrgInfoDTO>> listGenericResult = zwddClient.listOrganizationsByCodes(deptVisibleScopes);
List<DingOrgInfoDTO> dingOrgInfoDtos = listGenericResult.getData();
for (String orgCode : deptVisibleScopes) {
// if (currentAllOrganizationCodeList.contains(orgCode)) {
// log.info("已存在组织架构---{}", orgCode);
// continue;
//package com.ningdatech.pmapi.ding.task;
//
//import com.alibaba.fastjson.JSONObject;
//import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
//import com.google.common.collect.Lists;
//import com.ningdatech.basic.model.GenericResult;
//import com.ningdatech.pmapi.ding.model.DingOrgInfoTreeDTO;
//import com.ningdatech.pmapi.organization.entity.DingOrganization;
//import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
//import com.ningdatech.zwdd.client.ZwddAuthClient;
//import com.ningdatech.zwdd.client.ZwddClient;
//import com.ningdatech.zwdd.model.dto.DingOrgInfoDTO;
//import com.ningdatech.zwdd.model.dto.DingScopesV2DTO;
//import com.ningdatech.zwdd.model.dto.PageSubOrganizationCodeDTO;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//import org.springframework.transaction.annotation.Transactional;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Objects;
//import java.util.stream.Collectors;
//
///**
// * @author liuxinxin
// * @date 2023/2/7 上午10:15
// */
//
//@Slf4j
//@Component
//public class OrganizationBatchGetTask {
//
// @Autowired
// private ZwddClient zwddClient;
//
// @Autowired
// private ZwddAuthClient zwddAuthClient;
//
// private static final Integer GROUP_SIZE = 100;
//
// @Autowired
// private IDingOrganizationService iDingOrganizationService;
//
// /**
// * 获取浙政钉组织架构
// */
// @Transactional(rollbackFor = Exception.class)
// public void OrganizationBatchGetTask() {
//// List<DingOrganization> allList = iDingOrganizationService.list();
//// List<String> currentAllOrganizationCodeList = allList.stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toList());
// // 全量删除
// // iDingOrganizationService.remove(Wrappers.lambdaQuery(DingOrganization.class).isNotNull(DingOrganization::getId));
// // 获取顶级组织code
// GenericResult<DingScopesV2DTO> scopesV2Result = zwddClient.getScopesV2();
// DingScopesV2DTO scopesV2 = scopesV2Result.getData();
//
// if (Objects.nonNull(scopesV2)) {
// // 顶级组织code
// List<String> deptVisibleScopes = scopesV2.getDeptVisibleScopes();
// log.info("顶级组织code: size = " + deptVisibleScopes.size() + "列表:" + JSONObject.toJSONString(deptVisibleScopes));
// // 获取顶级节点信息
// GenericResult<List<DingOrgInfoDTO>> listGenericResult = zwddClient.listOrganizationsByCodes(deptVisibleScopes);
// List<DingOrgInfoDTO> dingOrgInfoDtos = listGenericResult.getData();
// for (String orgCode : deptVisibleScopes) {
//// if (currentAllOrganizationCodeList.contains(orgCode)) {
//// log.info("已存在组织架构---{}", orgCode);
//// continue;
//// }
// List<DingOrgInfoTreeDTO> treeDTOList = new ArrayList<>();
//
// DingOrgInfoTreeDTO childDingOrgInfoTreeDTO = new DingOrgInfoTreeDTO();
// //设置节点详情
// if (dingOrgInfoDtos != null && !dingOrgInfoDtos.isEmpty()) {
// for (DingOrgInfoDTO orgInfo : dingOrgInfoDtos) {
// if (orgInfo.getOrganizationCode().equals(orgCode)) {
// childDingOrgInfoTreeDTO.setDingOrgInfoDTO(orgInfo);
// }
// }
// }
List<DingOrgInfoTreeDTO> treeDTOList = new ArrayList<>();

DingOrgInfoTreeDTO childDingOrgInfoTreeDTO = new DingOrgInfoTreeDTO();
//设置节点详情
if (dingOrgInfoDtos != null && !dingOrgInfoDtos.isEmpty()) {
for (DingOrgInfoDTO orgInfo : dingOrgInfoDtos) {
if (orgInfo.getOrganizationCode().equals(orgCode)) {
childDingOrgInfoTreeDTO.setDingOrgInfoDTO(orgInfo);
}
}
}
childDingOrgInfoTreeDTO.setCode(orgCode);
childDingOrgInfoTreeDTO.setChildCodes(new ArrayList<>());
getDingOrgChild(childDingOrgInfoTreeDTO);
treeDTOList.add(childDingOrgInfoTreeDTO);

if (CollectionUtils.isNotEmpty(treeDTOList)) {
List<DingOrganization> saveRecordList = new ArrayList<>();
buildSaveRecordList(treeDTOList, saveRecordList);

// 批量保存
if (saveRecordList.size() <= GROUP_SIZE) {
iDingOrganizationService.saveBatch(saveRecordList);
} else {
List<List<DingOrganization>> split = Lists.partition(saveRecordList, GROUP_SIZE);
for (List<DingOrganization> segment : split) {
iDingOrganizationService.saveBatch(segment);
}
}
}
log.info("----拉取浙政钉组织结构结束---,顶级code:" + orgCode);
}
}
}

private void buildSaveRecordList(List<DingOrgInfoTreeDTO> treeDTOList, List<DingOrganization> saveRecordList) {
if (CollectionUtils.isEmpty(treeDTOList)) {
return;
}
for (DingOrgInfoTreeDTO dingOrgInfoTreeDTO : treeDTOList) {
DingOrganization saveRecord = new DingOrganization();
DingOrgInfoDTO dingOrgInfoDTO = dingOrgInfoTreeDTO.getDingOrgInfoDTO();
List<DingOrgInfoTreeDTO> childCodes = dingOrgInfoTreeDTO.getChildCodes();
saveRecord.setDisplayOrder(dingOrgInfoDTO.getDisplayOrder());
// saveRecord.setEnabled("1");
saveRecord.setParentCode(dingOrgInfoDTO.getParentCode());
saveRecord.setOrganizationCode(dingOrgInfoDTO.getOrganizationCode());
// saveRecord.setSubCount((long) dingOrgInfoTreeDTO.getChildCodes().size());
saveRecord.setOrganizationName(dingOrgInfoDTO.getOrganizationName());
saveRecordList.add(saveRecord);
if (CollectionUtils.isNotEmpty(childCodes)) {
buildSaveRecordList(childCodes, saveRecordList);
}
}

}

private void getDingOrgChild(DingOrgInfoTreeDTO parentDingOrgInfoTreeDTO) {
String parentOrgCode = parentDingOrgInfoTreeDTO.getCode();
DingOrgInfoDTO orgInfoDTO = parentDingOrgInfoTreeDTO.getDingOrgInfoDTO();
boolean leaf = orgInfoDTO.getLeaf();
if (!leaf) {
int currentPage = 1;
int pageSize = 100;
GenericResult<PageSubOrganizationCodeDTO> pageSubOrganizationCodeDTOGenericResult = zwddClient.pageSubOrganizationCodes(currentPage++, pageSize, parentOrgCode);
PageSubOrganizationCodeDTO pageSubOrganizationCodeDTO = pageSubOrganizationCodeDTOGenericResult.getData();

List<String> subOrganizationCodeList = new ArrayList<>(pageSubOrganizationCodeDTO.getSubOrganizationCodeList());
Long totalSize = pageSubOrganizationCodeDTO.getTotalSize();

while (totalSize > (long) currentPage * pageSize) {
GenericResult<PageSubOrganizationCodeDTO> subPageSubOrganizationCodeDTOGenericResult = zwddClient
.pageSubOrganizationCodes(currentPage++, pageSize, parentOrgCode);
PageSubOrganizationCodeDTO subOrganizationCodeDTO = subPageSubOrganizationCodeDTOGenericResult.getData();
if (CollectionUtils.isNotEmpty(subOrganizationCodeDTO.getSubOrganizationCodeList())) {
subOrganizationCodeList.addAll(subOrganizationCodeDTO.getSubOrganizationCodeList());
}
}

if (CollectionUtils.isNotEmpty(subOrganizationCodeList)) {
GenericResult<List<DingOrgInfoDTO>> listGenericResult = zwddClient
.listOrganizationsByCodes(subOrganizationCodeList);
List<DingOrgInfoDTO> dingOrgInfoDtos = listGenericResult.getData();
List<DingOrgInfoTreeDTO> dingOrgInfoTreeDTOList = dingOrgInfoDtos.stream().map(r -> {
DingOrgInfoTreeDTO dingOrgInfoTreeDTO = new DingOrgInfoTreeDTO();
dingOrgInfoTreeDTO.setCode(r.getOrganizationCode());
dingOrgInfoTreeDTO.setDingOrgInfoDTO(r);
dingOrgInfoTreeDTO.setChildCodes(new ArrayList<>());
getDingOrgChild(dingOrgInfoTreeDTO);
return dingOrgInfoTreeDTO;
}).collect(Collectors.toList());
parentDingOrgInfoTreeDTO.setChildCodes(dingOrgInfoTreeDTOList);
}

}
}

}
// childDingOrgInfoTreeDTO.setCode(orgCode);
// childDingOrgInfoTreeDTO.setChildCodes(new ArrayList<>());
// getDingOrgChild(childDingOrgInfoTreeDTO);
// treeDTOList.add(childDingOrgInfoTreeDTO);
//
// if (CollectionUtils.isNotEmpty(treeDTOList)) {
// List<DingOrganization> saveRecordList = new ArrayList<>();
// buildSaveRecordList(treeDTOList, saveRecordList);
//
// // 批量保存
// if (saveRecordList.size() <= GROUP_SIZE) {
// iDingOrganizationService.saveBatch(saveRecordList);
// } else {
// List<List<DingOrganization>> split = Lists.partition(saveRecordList, GROUP_SIZE);
// for (List<DingOrganization> segment : split) {
// iDingOrganizationService.saveBatch(segment);
// }
// }
// }
// log.info("----拉取浙政钉组织结构结束---,顶级code:" + orgCode);
// }
// }
// }
//
// private void buildSaveRecordList(List<DingOrgInfoTreeDTO> treeDTOList, List<DingOrganization> saveRecordList) {
// if (CollectionUtils.isEmpty(treeDTOList)) {
// return;
// }
// for (DingOrgInfoTreeDTO dingOrgInfoTreeDTO : treeDTOList) {
// DingOrganization saveRecord = new DingOrganization();
// DingOrgInfoDTO dingOrgInfoDTO = dingOrgInfoTreeDTO.getDingOrgInfoDTO();
// List<DingOrgInfoTreeDTO> childCodes = dingOrgInfoTreeDTO.getChildCodes();
// saveRecord.setDisplayOrder(dingOrgInfoDTO.getDisplayOrder());
//// saveRecord.setEnabled("1");
// saveRecord.setParentCode(dingOrgInfoDTO.getParentCode());
// saveRecord.setOrganizationCode(dingOrgInfoDTO.getOrganizationCode());
//// saveRecord.setSubCount((long) dingOrgInfoTreeDTO.getChildCodes().size());
// saveRecord.setOrganizationName(dingOrgInfoDTO.getOrganizationName());
// saveRecordList.add(saveRecord);
// if (CollectionUtils.isNotEmpty(childCodes)) {
// buildSaveRecordList(childCodes, saveRecordList);
// }
// }
//
// }
//
// private void getDingOrgChild(DingOrgInfoTreeDTO parentDingOrgInfoTreeDTO) {
// String parentOrgCode = parentDingOrgInfoTreeDTO.getCode();
// DingOrgInfoDTO orgInfoDTO = parentDingOrgInfoTreeDTO.getDingOrgInfoDTO();
// boolean leaf = orgInfoDTO.getLeaf();
// if (!leaf) {
// int currentPage = 1;
// int pageSize = 100;
// GenericResult<PageSubOrganizationCodeDTO> pageSubOrganizationCodeDTOGenericResult = zwddClient.pageSubOrganizationCodes(currentPage++, pageSize, parentOrgCode);
// PageSubOrganizationCodeDTO pageSubOrganizationCodeDTO = pageSubOrganizationCodeDTOGenericResult.getData();
//
// List<String> subOrganizationCodeList = new ArrayList<>(pageSubOrganizationCodeDTO.getSubOrganizationCodeList());
// Long totalSize = pageSubOrganizationCodeDTO.getTotalSize();
//
// while (totalSize > (long) currentPage * pageSize) {
// GenericResult<PageSubOrganizationCodeDTO> subPageSubOrganizationCodeDTOGenericResult = zwddClient
// .pageSubOrganizationCodes(currentPage++, pageSize, parentOrgCode);
// PageSubOrganizationCodeDTO subOrganizationCodeDTO = subPageSubOrganizationCodeDTOGenericResult.getData();
// if (CollectionUtils.isNotEmpty(subOrganizationCodeDTO.getSubOrganizationCodeList())) {
// subOrganizationCodeList.addAll(subOrganizationCodeDTO.getSubOrganizationCodeList());
// }
// }
//
// if (CollectionUtils.isNotEmpty(subOrganizationCodeList)) {
// GenericResult<List<DingOrgInfoDTO>> listGenericResult = zwddClient
// .listOrganizationsByCodes(subOrganizationCodeList);
// List<DingOrgInfoDTO> dingOrgInfoDtos = listGenericResult.getData();
// List<DingOrgInfoTreeDTO> dingOrgInfoTreeDTOList = dingOrgInfoDtos.stream().map(r -> {
// DingOrgInfoTreeDTO dingOrgInfoTreeDTO = new DingOrgInfoTreeDTO();
// dingOrgInfoTreeDTO.setCode(r.getOrganizationCode());
// dingOrgInfoTreeDTO.setDingOrgInfoDTO(r);
// dingOrgInfoTreeDTO.setChildCodes(new ArrayList<>());
// getDingOrgChild(dingOrgInfoTreeDTO);
// return dingOrgInfoTreeDTO;
// }).collect(Collectors.toList());
// parentDingOrgInfoTreeDTO.setChildCodes(dingOrgInfoTreeDTOList);
// }
//
// }
// }
//
//}

+ 1
- 2
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/ProgressNode.java Wyświetl plik

@@ -1,11 +1,10 @@
package com.ningdatech.pmapi.todocenter.bean.entity;

import com.ningdatech.pmapi.todocenter.bean.vo.ProgressNodeAuditInfoVo;
import com.ningdatech.pmapi.todocenter.enums.ProcessHandlerEnum;
import com.ningdatech.pmapi.todocenter.model.dto.req.ReqProcessHandlerDTO;
import com.wflow.workflow.bean.process.OrgUser;
import com.wflow.workflow.bean.process.enums.ApprovalModeEnum;
import com.wflow.workflow.bean.process.enums.NodeTypeEnum;
import com.wflow.workflow.enums.ProcessHandlerEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;


+ 0
- 97
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enums/ProcessHandlerEnum.java Wyświetl plik

@@ -1,97 +0,0 @@
package com.ningdatech.pmapi.todocenter.enums;

import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
* 流程处理类型
* @author CMM
* @since 2023/02/01 16:58
*/
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ProcessHandlerEnum", description = "流程处理类型-枚举")
public enum ProcessHandlerEnum {
/**
* 通过
*/

PASS(1, "通过"),

/**
* 盖章并通过
*/
SEAL_PASS(2, "盖章并通过"),

/**
* 退回
*/
BACK(3,"退回"),

/**
* 撤回
*/
WITHDRAW(4,"撤回"),
/**
* 驳回
*/
REJECT(5,"驳回");


private Integer code;
private String desc;

public String getDesc() {
return desc;
}

public void setDesc(String desc) {
this.desc = desc;
}

public static String getDescByCode(Integer code) {
if(Objects.isNull(code)){
return StringUtils.EMPTY;
}
for (ProcessHandlerEnum t : ProcessHandlerEnum.values()) {
if (code.equals(t.getCode())) {
return t.desc;
}
}
return StringUtils.EMPTY;
}

public static Integer getCodeByDesc(String desc) {
if(Objects.isNull(desc)){
return null;
}
for (ProcessHandlerEnum t : ProcessHandlerEnum.values()) {
if (desc.equals(t.getCode())) {
return t.code;
}
}
return null;
}

public static ProcessHandlerEnum getEnumByValue(Integer code) {
if(Objects.isNull(code)){
return null;
}
for (ProcessHandlerEnum t : ProcessHandlerEnum.values()) {
if (code.equals(t.getCode())) {
return t;
}
}
return null;
}

public boolean eq(String val) {
return this.name().equals(val);
}
}

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/extension/cmd/BackToHisApprovalNodeCmd.java Wyświetl plik

@@ -4,7 +4,7 @@ import java.io.Serializable;
import java.util.*;
import java.util.stream.Collectors;

import com.ningdatech.pmapi.todocenter.enums.ProcessHandlerEnum;
import com.wflow.workflow.enums.ProcessHandlerEnum;
import lombok.RequiredArgsConstructor;
import org.assertj.core.util.Sets;
import org.flowable.bpmn.model.FlowNode;


+ 17
- 29
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java Wyświetl plik

@@ -19,7 +19,6 @@ import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.pmapi.common.constant.DingConstant;
import com.ningdatech.pmapi.common.constant.ProjectDeclareConstants;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
import com.ningdatech.pmapi.common.util.ExcelExportStyle;
@@ -31,7 +30,6 @@ import com.ningdatech.pmapi.todocenter.bean.entity.ProgressNode;
import com.ningdatech.pmapi.todocenter.bean.vo.ProcessProgressDetailVo;
import com.ningdatech.pmapi.todocenter.constant.HisProInsEndActId;
import com.ningdatech.pmapi.todocenter.enums.IsAppendProjectEnum;
import com.ningdatech.pmapi.todocenter.enums.ProcessHandlerEnum;
import com.ningdatech.pmapi.todocenter.enums.ProcessStatusEnum;
import com.ningdatech.pmapi.todocenter.extension.cmd.BackToHisApprovalNodeCmd;
import com.ningdatech.pmapi.todocenter.extension.cmd.SaveCommentCmd;
@@ -60,9 +58,9 @@ import com.wflow.workflow.bean.process.form.Form;
import com.wflow.workflow.bean.process.props.ApprovalProps;
import com.wflow.workflow.bean.vo.ProcessHandlerParamsVo;
import com.wflow.workflow.bean.vo.ProcessInstanceVo;
import com.wflow.workflow.bean.vo.ProcessProgressVo;
import com.wflow.workflow.bean.vo.ProcessTaskVo;
import com.wflow.workflow.config.WflowGlobalVarDef;
import com.wflow.workflow.enums.ProcessHandlerEnum;
import com.wflow.workflow.service.FormService;
import com.wflow.workflow.service.*;
import com.wflow.workflow.utils.Executor;
@@ -76,6 +74,7 @@ import org.flowable.engine.history.HistoricActivityInstance;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.history.HistoricProcessInstanceQuery;
import org.flowable.engine.impl.util.ProcessDefinitionUtil;
import org.flowable.engine.runtime.ActivityInstance;
import org.flowable.engine.runtime.Execution;
import org.flowable.task.api.Task;
import org.flowable.task.api.TaskInfo;
@@ -258,10 +257,12 @@ public class TodoCenterManage {
case PASS:
formService.updateInstanceFormData(param.getInstanceId(), formData);
doPass(task, userId, param);
break;
// 盖章并通过
case SEAL_PASS:
formService.updateInstanceFormData(param.getInstanceId(), formData);
doSealPass(task, userId, param);
break;
// 驳回
case REJECT:
formService.updateInstanceFormData(param.getInstanceId(), formData);
@@ -398,31 +399,26 @@ public class TodoCenterManage {
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);
taskService.complete(param.getTaskId(), var);

//获取bpm对象
// 获取bpm对象
BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId());
//传节点定义key 获取当前节点
FlowNode currentNode = (FlowNode) bpmnModel.getFlowElement(task.getTaskDefinitionKey());

// 获取流程下一个节点浙政钉用户ID
// 获取流程下一个节点的审核用户ID
String nextUserId = getNextUserId(currentNode,processInstanceId);
// 若有下一个审核人,向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。
if (Objects.nonNull(nextUserId)){
// UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(nextUserId));
// TODO 向其发送浙政钉工作通知
UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(nextUserId));
// TODO 获取浙政钉用户dingKey,向其发送浙政钉工作通知
String msg = String.format(PASS_MSG_TEMPLATE,null,projectName);
// sendWorkNotice(auditUserInfo,msg);
}else {
// 若没有,向发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。
// TODO 向其发送浙政钉工作通知 获取根节点的孩子节点(即发起人节点),向其发送浙政钉工作通知
// 获取根节点即流程发起节点
// FlowNode rootNode = (FlowNode) process.getFlowElement("root", true);
// FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root");
FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root");
// sendWorkNoticeToStartUser(task, projectName, rootNode);
}
}
@@ -500,7 +496,7 @@ public class TodoCenterManage {
}

/**
* 获取当前节点的下一个节点的浙政钉用户ID
* 获取当前节点的下一个节点的审核用户ID
*
* @param currentNode 当前节点
* @param processInstanceId
@@ -523,20 +519,12 @@ public class TodoCenterManage {
// TODO 若要会签需判断候选人
// 用户任务
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;
nextUserId = userTask.getAssignee();
String actId = targetFlowElement.getId();
ActivityInstance activityInstance = runtimeService.createActivityInstanceQuery()
.processInstanceId(processInstanceId)
.activityId(actId).singleResult();
String executionId = activityInstance.getExecutionId();
nextUserId = runtimeService.getVariable(executionId, "assignee", String.class);
break;
}
}


+ 1
- 42
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqProcessHandlerDTO.java Wyświetl plik

@@ -1,12 +1,10 @@
package com.ningdatech.pmapi.todocenter.model.dto.req;

import com.ningdatech.pmapi.common.model.FileBasicInfo;
import com.ningdatech.pmapi.todocenter.bean.entity.ProcessComment;
import com.ningdatech.pmapi.todocenter.enums.ProcessHandlerEnum;
import com.wflow.workflow.enums.ProcessHandlerEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;

/**
* 流程处理操作参数实体
@@ -48,43 +46,4 @@ public class ReqProcessHandlerDTO {
* 审核信息
*/
private ProcessComment auditInfo;
///**
// * 审核通过意见
// */
//private String auditPassOpinion;
//
///**
// * 审核通过附件
// */
//private FileBasicInfo auditPassAppendix;
///**
// * 盖章通过意见
// */
//private String sealPassOpinion;
//
///**
// * 盖章通过附件
// */
//private FileBasicInfo sealPassAppendix;
///**
// * 审核退回意见
// */
//private String auditBackOpinion;
///**
// * 审核退回附件
// */
//private FileBasicInfo auditBackAppendix;
///**
// * 审核驳回意见
// */
//private String auditRejectOpinion;
//
///**
// * 审核驳回附件
// */
//private FileBasicInfo auditRejectAppendix;
//public enum Action{
// //通过、盖章并通过、退回、撤回、驳回
// pass, seal_pass ,back, withdraw, reject;
//}
}

Ładowanie…
Anuluj
Zapisz