Explorar el Código

Merge remote-tracking branch 'origin/master'

tags/24080901
liuxinxin hace 1 año
padre
commit
a2301d8554
Se han modificado 24 ficheros con 269 adiciones y 159 borrados
  1. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java
  2. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/event/ProjectStatusChangeEvent.java
  3. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java
  4. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectStatusEnum.java
  5. +17
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java
  6. +8
    -8
      pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RoleManage.java
  7. +6
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/BaseEntity.java
  8. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Menu.java
  9. +3
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Role.java
  10. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/RolePageReq.java
  11. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/RoleVO.java
  12. +2
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/ProgressNode.java
  13. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/vo/ProcessProgressDetailVo.java
  14. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/vo/ProgressNodeAuditInfoVo.java
  15. +2
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java
  16. +126
    -110
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
  17. +12
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqProcessHandlerDTO.java
  18. +1
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/res/ResToBeProcessedDTO.java
  19. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java
  20. +10
    -11
      pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java
  21. +28
    -0
      pmapi/src/test/java/com/ningdatech/pmapi/instance/InstanceTest.java
  22. +4
    -1
      pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java
  23. +26
    -0
      pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IMenuServiceTest.java
  24. +2
    -3
      pmapi/src/test/java/com/ningdatech/pmapi/todocenter/TodoCenterTest.java

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java Ver fichero

@@ -226,7 +226,7 @@ public class ProjectDeclareAction {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
// 终验审核通过后,项目一级状态变更为已归档
project.setStage(ProjectStatusEnum.ARCHIVED.getCode());
project.setStatus(ProjectStatusEnum.ARCHIVED.getCode());
project.setStatus(ProjectStatusEnum.ACCEPTED.getCode());
}

@OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED")


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/event/ProjectStatusChangeEvent.java Ver fichero

@@ -105,7 +105,7 @@ public enum ProjectStatusChangeEvent {
/**
* 终验审核通过(项目状态变为:已归档)
*/
FINAL_ACCEPTANCE_PASS(null, null, null),
FINAL_ACCEPTANCE_PASS(20004, null, null),

// 下个节点还未提交审核意见时,流程发起人和前一个审核人可以点击撤回



+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java Ver fichero

@@ -81,7 +81,7 @@ public class ConstructionPlanManage {
//首先要判断 项目当前状态 是不是 方案待申报
VUtils.isTrue(!ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode().equals(projectInfo.getStatus()) ||
!ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage()))
.throwMessage("提交失败 该项目不是 待预审状态或者未立项阶段");
.throwMessage("提交失败 该项目不是 方案待申报状态或者未立项阶段");
// TODO 再判断 该项目是否 真实走完 预审审批

ProcessStartParamsVo params = new ProcessStartParamsVo();


+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectStatusEnum.java Ver fichero

@@ -54,7 +54,8 @@ public enum ProjectStatusEnum {
/**
* 项目阶段:已归档
*/
ARCHIVED(30000, "已归档");
ARCHIVED(30000, "已归档"),
ACCEPTED(30001, "已验收");

private Integer code;
private String desc;


+ 17
- 3
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java Ver fichero

@@ -1,9 +1,11 @@
package com.ningdatech.pmapi.projectlib.manage;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectRenewalFundDeclarationDTO;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration;
@@ -90,14 +92,26 @@ public class ProjectRenewalFundManage {
* @return
*/
public Long declared(ProjectRenewalFundDeclarationDTO dto) {
//要判断 项目id 是否 以及状态是 已验收
Long projectId = dto.getProjectId();
Project project = projectService.getById(projectId);
VUtils.isTrue(Objects.isNull(project)).throwMessage(String.format("关联的项目【%s】不存在 提交失败!",projectId));
VUtils.isTrue(!ProjectStatusEnum.ACCEPTED.getCode().equals(project.getStatus()) ||
!ProjectStatusEnum.ARCHIVED.getCode().equals(project.getStage()))
.throwMessage("提交失败 该项目不是 已验收状态或者已归档阶段");
ProjectRenewalFundDeclaration declaration = new ProjectRenewalFundDeclaration();
//如果是重新申报
if(Objects.nonNull(dto.getId())){
ProjectRenewalFundDeclaration oldDeclaration = projectRenewalFundDeclarationService.getById(dto.getId());
VUtils.isTrue(Objects.isNull(oldDeclaration)).throwMessage(String.format("重新申报失败 【%s】 该申报不存在!",dto.getId()));
BeanUtils.copyProperties(oldDeclaration,declaration);
}
BeanUtils.copyProperties(dto,declaration);
declaration.setId(null);
declaration.setCreateOn(LocalDateTime.now());
declaration.setUpdateOn(LocalDateTime.now());
declaration.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PENDING.name());
if(!projectRenewalFundDeclarationService.save(declaration)){
throw new BusinessException("申报失败");
if(!projectRenewalFundDeclarationService.saveOrUpdate(declaration)){
throw new BusinessException(String.format("申报失败 【%s】",dto.getId()));
}
return declaration.getId();
}


+ 8
- 8
pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RoleManage.java Ver fichero

@@ -12,8 +12,8 @@ import com.ningdatech.pmapi.sys.model.entity.RoleMenu;
import com.ningdatech.pmapi.sys.model.req.RolePageReq;
import com.ningdatech.pmapi.sys.model.vo.MenuRoleVO;
import com.ningdatech.pmapi.sys.model.vo.RoleVO;
import com.ningdatech.pmapi.sys.service.IRoleMenuService;
import com.ningdatech.pmapi.sys.service.IMenuService;
import com.ningdatech.pmapi.sys.service.IRoleMenuService;
import com.ningdatech.pmapi.sys.service.IRoleService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
@@ -35,9 +35,8 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
public class RoleManage {

private final IRoleService IRoleService;
private final IMenuService IMenuService;

private final IRoleService roleService;
private final IMenuService menuService;
private final IRoleMenuService roleMenuService;

public PageVo<RoleVO> queryList(RolePageReq rolePageReq) {
@@ -48,16 +47,17 @@ public class RoleManage {
return PageVo.of(data, page.getTotal());
}

private void searchList(Page<Role> page, LambdaQueryWrapper<Role> wrapper, RolePageReq rolePageReq) {
wrapper.like(StringUtils.isNotBlank(rolePageReq.getName()), Role::getName, rolePageReq.getName())
private void searchList(Page<Role> page, LambdaQueryWrapper<Role> wrapper, RolePageReq req) {
wrapper.like(StringUtils.isNotBlank(req.getName()), Role::getName, req.getName())
.eq(req.getFixed() != null, Role::getFixed, req.getFixed())
.orderByDesc(Role::getUpdateOn);
IRoleService.page(page, wrapper);
roleService.page(page, wrapper);
}


public void buildMenu(RoleVO query) {
//改成直接返回有权限的
List<Menu> list = IMenuService.list(Wrappers.lambdaQuery(Menu.class).orderByAsc(Menu::getSort));
List<Menu> list = menuService.list(Wrappers.lambdaQuery(Menu.class).orderByAsc(Menu::getSort));
List<RoleMenu> roleMenus = roleMenuService.list(Wrappers.lambdaQuery(RoleMenu.class)
.eq(RoleMenu::getRoleId, query.getId()));
List<MenuRoleVO> menus = list.stream().map(menu -> {


+ 6
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/BaseEntity.java Ver fichero

@@ -1,5 +1,7 @@
package com.ningdatech.pmapi.sys.model.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
@@ -20,15 +22,19 @@ import java.time.LocalDateTime;
public class BaseEntity implements Serializable {

@ApiModelProperty("创建人userId")
@TableField(fill = FieldFill.INSERT)
protected Long createBy;

@ApiModelProperty("最后修改人userId")
@TableField(fill = FieldFill.INSERT_UPDATE)
protected Long updateBy;

@ApiModelProperty("创建时间")
@TableField(fill = FieldFill.INSERT)
protected LocalDateTime createOn;

@ApiModelProperty("修改时间")
@TableField(fill = FieldFill.INSERT_UPDATE)
protected LocalDateTime updateOn;

}

+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Menu.java Ver fichero

@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.sys.model.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ningdatech.pmapi.common.model.entity.MenuTreeEntity;
@@ -62,12 +63,16 @@ public class Menu extends MenuTreeEntity<Menu, Long> {
@ApiModelProperty("数据权限选项")
private String dataScopeOption;

@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updateBy;

@TableField(fill = FieldFill.INSERT)
private Long createBy;

@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateOn;

@TableField(fill = FieldFill.INSERT)
private LocalDateTime createOn;

}

+ 3
- 1
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Role.java Ver fichero

@@ -29,7 +29,7 @@ public class Role extends BaseEntity {

private static final long serialVersionUID = 1L;

@TableId(value = "id",type = IdType.AUTO)
@TableId(value = "id", type = IdType.AUTO)
private Long id;

@ApiModelProperty(value = "名称")
@@ -38,6 +38,8 @@ public class Role extends BaseEntity {
@ApiModelProperty("角色编码")
private String code;

@ApiModelProperty("是否是内置角色")
private Boolean fixed;

@ApiModelProperty(value = "描述")
private String describe;


+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/RolePageReq.java Ver fichero

@@ -34,4 +34,7 @@ public class RolePageReq extends PagePo implements Serializable {
@ApiModelProperty(value = "名称")
private String name;

@ApiModelProperty("是否是内置角色")
private Boolean fixed;

}

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/RoleVO.java Ver fichero

@@ -43,6 +43,9 @@ public class RoleVO extends BaseEntity {
@ApiModelProperty(value = "描述")
private String describe;

@ApiModelProperty("是否是内置角色:true 是、false 否")
private Boolean fixed;

/**
* 数据范围
*/


+ 2
- 4
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/ProgressNode.java Ver fichero

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

import com.ningdatech.pmapi.todocenter.bean.vo.ProgressNodeAuditInfoVo;
import com.wflow.workflow.bean.process.OrgUser;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;
import com.wflow.workflow.bean.process.enums.ApprovalModeEnum;
import com.wflow.workflow.bean.process.enums.NodeTypeEnum;
import com.wflow.workflow.bean.vo.UserInfoVO;
import com.wflow.workflow.enums.ProcessHandlerEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -12,7 +11,6 @@ import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;

/**
* 流程节点实体
@@ -48,7 +46,7 @@ public class ProgressNode {
/**
* 节点相关人员
*/
private UserInfoVO user;
private ProcessInstanceUserDto user;
/**
* 该节点动作操作类型
*/


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/vo/ProcessProgressDetailVo.java Ver fichero

@@ -2,8 +2,8 @@ package com.ningdatech.pmapi.todocenter.bean.vo;


import com.ningdatech.pmapi.todocenter.bean.entity.ProgressNode;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;
import com.wflow.workflow.bean.process.form.Form;
import com.wflow.workflow.bean.vo.UserInfoVO;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -60,7 +60,7 @@ public class ProcessProgressDetailVo {
/**
* 发起人
*/
private UserInfoVO startUser;
private ProcessInstanceUserDto startUser;
/**
* 发起时间
*/


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/vo/ProgressNodeAuditInfoVo.java Ver fichero

@@ -1,7 +1,7 @@
package com.ningdatech.pmapi.todocenter.bean.vo;

import com.ningdatech.pmapi.todocenter.bean.entity.ProcessComment;
import com.wflow.workflow.bean.vo.UserInfoVO;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -34,7 +34,7 @@ public class ProgressNodeAuditInfoVo extends ProcessComment {
private String commentType;

@ApiModelProperty("评论用户信息")
private UserInfoVO user;
private ProcessInstanceUserDto user;

@ApiModelProperty("评论时间")
private Date createTime;


+ 2
- 4
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java Ver fichero

@@ -61,14 +61,12 @@ public class TodoCenterController {
/**
* 查询流程表单数据及审批的进度步骤
* @param instanceId 流程实例ID
* @param nodeId 当前获取流程人员关联的流程节点ID
* @return 流程进度及表单详情
*/
@GetMapping("/progress/{instanceId}/{nodeId}")
@GetMapping("/progress/{instanceId}/{projectId}")
public ApiResponse<ProcessProgressDetailVo> getProcessDetail(@PathVariable String instanceId,
@PathVariable(required = false) String nodeId,
@PathVariable Long projectId) {
return ApiResponse.ofSuccess(todoCenterManage.getProcessDetail(nodeId, instanceId, projectId));
return ApiResponse.ofSuccess(todoCenterManage.getProcessDetail(instanceId, projectId));
}

/**


+ 126
- 110
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java Ver fichero

@@ -48,7 +48,7 @@ import com.wflow.mapper.WflowCcTasksMapper;
import com.wflow.mapper.WflowModelHistorysMapper;
import com.wflow.service.OrgRepositoryService;
import com.wflow.utils.CodeUtil;
import com.wflow.workflow.bean.process.OrgUser;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;
import com.wflow.workflow.bean.process.ProcessNode;
import com.wflow.workflow.bean.process.enums.ApprovalModeEnum;
import com.wflow.workflow.bean.process.enums.NodeTypeEnum;
@@ -56,7 +56,6 @@ import com.wflow.workflow.bean.process.form.Form;
import com.wflow.workflow.bean.process.props.ApprovalProps;
import com.wflow.workflow.bean.vo.ProcessInstanceVo;
import com.wflow.workflow.bean.vo.ProcessTaskVo;
import com.wflow.workflow.bean.vo.UserInfoVO;
import com.wflow.workflow.config.WflowGlobalVarDef;
import com.wflow.workflow.enums.ProcessHandlerEnum;
import com.wflow.workflow.service.FormService;
@@ -177,15 +176,9 @@ public class TodoCenterManage {
// 从待办任务列表中取出当前登录用户及项目实例对应的任务
Task task = taskMap.get(d.getInstCode());
HistoricProcessInstance instance = instanceMap.get(task.getProcessInstanceId());
//HashSet<String> userSet = new HashSet<>();
//userSet.add(instance.getStartUserId()) ;
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet);
//res.setOwner(userMap.get(Long.valueOf(instance.getStartUserId())));
UserInfoVO owner = new UserInfoVO();
owner.setUserId(Long.valueOf(instance.getStartUserId()));
res.setOwner(owner);

// 从缓存取
staterUsers.add(String.valueOf(userId));
staterUsers.add(String.valueOf(instance.getStartUserId()));
ProcessTaskVo processTaskVo = ProcessTaskVo.builder()
.taskId(task.getId())
.taskName(task.getName())
@@ -210,7 +203,7 @@ public class TodoCenterManage {
// 取用户信息,减少数据库查询,一次构建
List<ResToBeProcessedDTO> result = null;
if (isNotEmpty(staterUsers)) {
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(staterUsers);
//Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(staterUsers);
//result = resVos.stream()
// .peek(v -> v.getProcessTaskInfo().setStartUser(userMap.get(Long.valueOf(v.getProcessTaskInfo().getOwnerId()))))
// .collect(Collectors.toList());
@@ -318,9 +311,7 @@ public class TodoCenterManage {
* @since 2023/02/01
*/
public void handler(ReqProcessHandlerDTO param) {

// 获取登录用户ID

// Long userId = LoginUserUtil.getUserId();

// Long userId = 381496L;
@@ -329,8 +320,12 @@ public class TodoCenterManage {

// 若进行的是撤回操作(流程发起人和当前流程审核人的前一个审核人操作)
if (param.getAction().equals(ProcessHandlerEnum.WITHDRAW)) {
HistoricTaskInstance handledTaskInstance = historyService.createHistoricTaskInstanceQuery().taskId(param.getTaskId()).singleResult();
doWithDrawProcess(handledTaskInstance, userId);
HistoricTaskInstance handledTaskInstance = historyService.createHistoricTaskInstanceQuery()
.taskId(param.getTaskId())
.singleResult();
// 获取要处理的项目ID
Long projectId = param.getProjectId();
doWithDrawProcess(handledTaskInstance, userId, projectId);
return;
}
Task task = taskService.createTaskQuery().taskId(param.getTaskId()).active().singleResult();
@@ -373,8 +368,9 @@ public class TodoCenterManage {
*/
private void doReject(Task task, Long userId, ReqProcessHandlerDTO param) {
// 获取当前申报项目
Project declaredProject = projectService
.getOne(Wrappers.lambdaQuery(Project.class).eq(Project::getInstCode, task.getProcessInstanceId()));
Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class)
.eq(Project::getInstCode, task.getProcessInstanceId())
.eq(Project::getId,param.getProjectId()));
String projectName = declaredProject.getProjectName();

Map<String, Object> var = new HashMap<>(16);
@@ -487,8 +483,9 @@ public class TodoCenterManage {
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()));
Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class)
.eq(Project::getInstCode, task.getProcessInstanceId())
.eq(Project::getId,param.getProjectId()));
String projectName = declaredProject.getProjectName();

Map<String, Object> var = new HashMap<>(16);
@@ -721,8 +718,9 @@ public class TodoCenterManage {
*
* @param handledTaskInstance 已处理的历史任务实例
* @param userId 当前登录用户ID
* @param projectId
*/
private void doWithDrawProcess(HistoricTaskInstance handledTaskInstance, Long userId) {
private void doWithDrawProcess(HistoricTaskInstance handledTaskInstance, Long userId, Long projectId) {
String processInstanceId = handledTaskInstance.getProcessInstanceId();
// 获取当前流程实例待审核任务信息
Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();
@@ -735,7 +733,8 @@ public class TodoCenterManage {
String startUserId = historicProcessInstance.getStartUserId();
// 获取当前申报项目
Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class)
.eq(Project::getInstCode, processInstanceId));
.eq(Project::getInstCode, processInstanceId)
.eq(Project::getId,projectId));
String projectName = declaredProject.getProjectName();

// 获取bpm对象
@@ -869,8 +868,9 @@ public class TodoCenterManage {
*/
private void doBackTask(Task task, Long userId, ReqProcessHandlerDTO param) {
// 获取当前申报项目
Project declaredProject = projectService
.getOne(Wrappers.lambdaQuery(Project.class).eq(Project::getInstCode, task.getProcessInstanceId()));
Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class)
.eq(Project::getInstCode, task.getProcessInstanceId())
.eq(Project::getId,param.getProjectId()));
String projectName = declaredProject.getProjectName();
// 保存审核意见
if (hasComment(param.getAuditInfo())) {
@@ -910,11 +910,10 @@ public class TodoCenterManage {

/**
* 查询流程表单数据及审批的进度步骤
* @param nodeId 当前获取流程人员关联的流程节点ID
* @param instanceId 流程实例ID
* @return 流程进度及表单详情
*/
public ProcessProgressDetailVo getProcessDetail(String nodeId, String instanceId, Long projectId) {
public ProcessProgressDetailVo getProcessDetail(String instanceId, Long projectId) {
HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery()
.processInstanceId(instanceId)
.singleResult();
@@ -924,39 +923,59 @@ public class TodoCenterManage {
.variableName(WflowGlobalVarDef.WFLOW_FORMS)
.singleResult();
List<HistoricVariableInstance> formDatas = null;
if (nodeId.equals("undefined")) {
List<HistoricTaskInstance> historicTaskInstances = historyService.createHistoricTaskInstanceQuery().processInstanceId(instanceId).list();
formDatas = historyService
.createHistoricVariableInstanceQuery()
.executionIds(historicTaskInstances.stream()
.map(HistoricTaskInstance::getExecutionId)
.collect(Collectors.toSet()))
.processInstanceId(instanceId)
.list();
} else {
formDatas = historyService
.createHistoricVariableInstanceQuery()
.processInstanceId(instanceId)
.list();
}
//if (nodeId.equals("undefined")) {
// List<HistoricTaskInstance> historicTaskInstances = historyService.createHistoricTaskInstanceQuery().processInstanceId(instanceId).list();
// formDatas = historyService
// .createHistoricVariableInstanceQuery()
// .executionIds(historicTaskInstances.stream()
// .map(HistoricTaskInstance::getExecutionId)
// .collect(Collectors.toSet()))
// .processInstanceId(instanceId)
// .list();
//} else {
// formDatas = historyService
// .createHistoricVariableInstanceQuery()
// .processInstanceId(instanceId)
// .list();
//}
List<HistoricTaskInstance> historicTaskInstances = historyService.createHistoricTaskInstanceQuery()
.processInstanceId(instanceId).list();
formDatas = historyService.createHistoricVariableInstanceQuery()
.executionIds(historicTaskInstances.stream()
.map(HistoricTaskInstance::getExecutionId)
.collect(Collectors.toSet()))
.processInstanceId(instanceId).list();

// 取节点设置
HistoricVariableInstance nodeProps = historyService.createHistoricVariableInstanceQuery()
.processInstanceId(instanceId).variableName(WflowGlobalVarDef.WFLOW_NODE_PROPS).singleResult();
Map<String, Object> nodePropsValue = (Map<String, Object>) nodeProps.getValue();

ProcessNode<?> currentNode = null;
if (StrUtil.isNotBlank(nodeId)) {
// 搜索当前版本流程的配置
WflowModelHistorys modelHistory = modelHistorysMapper.selectOne(new QueryWrapper<>(WflowModelHistorys.builder()

//if (StrUtil.isNotBlank(nodeId)) {
// // 搜索当前版本流程的配置
// WflowModelHistorys modelHistory = modelHistorysMapper.selectOne(new QueryWrapper<>(WflowModelHistorys.builder()
// .processDefId(instance.getProcessDefinitionId())
// .version(instance.getProcessDefinitionVersion())
// .build()));
// currentNode = nodeCatchService.reloadProcessByStr(modelHistory.getProcess()).get(nodeId);
//}
// 搜索当前版本流程的配置



WflowModelHistorys modelHistory = modelHistorysMapper.selectOne(new QueryWrapper<>(WflowModelHistorys.builder()
.processDefId(instance.getProcessDefinitionId())
.version(instance.getProcessDefinitionVersion())
.build()));
currentNode = nodeCatchService.reloadProcessByStr(modelHistory.getProcess()).get(nodeId);
}
currentNode = nodeCatchService.reloadProcessByStr(modelHistory.getProcess()).get("undefined");
//UserInfo userInfo = userInfoService.getById(Long.valueOf(instance.getStartUserId()));
//HashSet<String> userSet = new HashSet<>();
//userSet.add(String.valueOf(userInfo.getId()));
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet);
//UserInfoVO userInfoVO = userMap.get(userInfo.getId());
//Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(userSet);
//ProcessInstanceUserDto startUser = userMap.get(String.valueOf(userInfo.getId()));
List<ProgressNode> taskRecords = getHisTaskRecords(instanceId, nodePropsValue);
// 获取添加抄送任务
taskRecords.addAll(getCcTaskRecords(instanceId));
@@ -989,7 +1008,7 @@ public class TodoCenterManage {
.startTime(instance.getStartTime())
.progress(taskRecords)
.build();
//res.setStartUser(userInfoVO);
//res.setStartUser(startUser);
Project project = projectService.getById(projectId);
res.setStatus(ProcessStatusEnum.getDescByCode(project.getProcessStatus()));
return res;
@@ -1010,13 +1029,13 @@ public class TodoCenterManage {
ccUsers.add(task.getUserId());
return ProgressNode.builder().nodeId(task.getNodeId()).nodeType(NodeTypeEnum.CC)
.name(task.getNodeName())
.user(UserInfoVO.builder().userId(Long.valueOf(task.getUserId())).build())
.user(ProcessInstanceUserDto.builder().userId(task.getUserId()).build())
.startTime(task.getCreateTime())
.finishTime(task.getCreateTime())
.build();
}).collect(Collectors.toList());
if (isNotEmpty(ccUsers)) {
Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(ccUsers);
Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(ccUsers);
ccList.stream().peek(v -> v.setUser(userMap.get(v.getUser().getUserId()))).collect(Collectors.toList());
}
return ccList;
@@ -1051,7 +1070,7 @@ public class TodoCenterManage {
.commentType(comment.getType())
.type("COMMENT")
.createTime(comment.getTime())
.user(UserInfoVO.builder().userId(Long.valueOf(comment.getUserId())).build())
.user(ProcessInstanceUserDto.builder().userId(comment.getUserId()).build())
.build();
ProcessComment processComment = JSONObject.parseObject(comment.getFullMessage(), ProcessComment.class);
progressNodeAuditInfoVo.setText(processComment.getText());
@@ -1079,7 +1098,7 @@ public class TodoCenterManage {
.nodeId(his.getActivityId())
.name(his.getActivityName())
.nodeType(NodeTypeEnum.APPROVAL)
.user(UserInfoVO.builder().userId(Long.valueOf(his.getAssignee())).build())
.user(ProcessInstanceUserDto.builder().userId(his.getAssignee()).build())
.startTime(his.getStartTime())
.finishTime(his.getEndTime())
.taskId(his.getTaskId())
@@ -1088,7 +1107,7 @@ public class TodoCenterManage {
.result(varMap.get("approve_" + his.getTaskId())).build();
}).collect(Collectors.toList());
if (isNotEmpty(userSet)) {
Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet);
Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(userSet);
progressNodes.stream().peek(v -> v.setUser(userMap.get(v.getUser().getUserId()))).collect(Collectors.toList());
}
return progressNodes;
@@ -1158,34 +1177,35 @@ public class TodoCenterManage {
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"));
LocalDateTime launchTime = LocalDateTime.parse(launchTimeFormat, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
res.setProcessLaunchTime(launchTime);
LocalDateTime processHandleTime = d.getUpdateOn();
String handleTimeFormat = NdDateUtils.format(processHandleTime, "yyyy-MM-dd HH:mm");
LocalDateTime handleTime =
LocalDateTime.parse(handleTimeFormat, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
LocalDateTime handleTime = LocalDateTime.parse(handleTimeFormat, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
res.setProcessHandleTime(handleTime);

// 从已处理任务实例列表中取出当前登录用户及项目实例对应的任务实例
HistoricTaskInstance task = taskInstanceMap.get(d.getInstCode());
HistoricProcessInstance instance = instanceMap.get(task.getProcessInstanceId());
//HashSet<String> userSet = new HashSet<>();
//userSet.add(instance.getStartUserId()) ;
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet);
//res.setOwner(userMap.get(Long.valueOf(instance.getStartUserId())));
UserInfoVO owner = new UserInfoVO();
owner.setUserId(Long.valueOf(instance.getStartUserId()));
res.setOwner(owner);

// 从缓存取
staterUsers.add(instance.getStartUserId());
ProcessTaskVo processTaskVo = ProcessTaskVo.builder().taskId(task.getId()).taskName(task.getName())
.taskDefKey(task.getTaskDefinitionKey()).processDefId(task.getProcessDefinitionId())
.executionId(task.getExecutionId()).nodeId(task.getTaskDefinitionKey())
.deployId(instance.getDeploymentId()).processDefName(instance.getProcessDefinitionName())
.version(instance.getProcessDefinitionVersion()).instanceId(task.getProcessInstanceId())
.ownerId(instance.getStartUserId()).createTime(instance.getStartTime())
.taskCreateTime(task.getCreateTime()).build();
ProcessTaskVo processTaskVo = ProcessTaskVo
.builder()
.taskId(task.getId())
.taskName(task.getName())
.taskDefKey(task.getTaskDefinitionKey())
.processDefId(task.getProcessDefinitionId())
.executionId(task.getExecutionId())
.nodeId(task.getTaskDefinitionKey())
.deployId(instance.getDeploymentId())
.processDefName(instance.getProcessDefinitionName())
.version(instance.getProcessDefinitionVersion())
.instanceId(task.getProcessInstanceId())
.ownerId(instance.getStartUserId())
.createTime(instance.getStartTime())
.taskCreateTime(task.getCreateTime())
.build();
res.setProcessTaskInfo(processTaskVo);
return res;
}).collect(Collectors.toList());
@@ -1195,9 +1215,9 @@ public class TodoCenterManage {
// 取用户信息,减少数据库查询,一次构建
List<ResToBeProcessedDTO> result = null;
if (isNotEmpty(staterUsers)) {
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(staterUsers);
//Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(staterUsers);
//result = resVos.stream().peek(v -> v.getProcessTaskInfo()
// .setStartUser(userMap.get(Long.valueOf(v.getProcessTaskInfo().getOwnerId()))))
// .setStartUser(userMap.get(v.getProcessTaskInfo().getOwnerId())))
// .collect(Collectors.toList());
}
// return PageVo.of(result, total);
@@ -1315,10 +1335,10 @@ public class TodoCenterManage {
Long startUserId = 381496L;
HistoricProcessInstanceQuery instanceQuery = historyService.createHistoricProcessInstanceQuery();
Executor.builder().ifNotBlankNext(String.valueOf(startUserId), instanceQuery::startedBy);
List<HistoricProcessInstance> historicProcessInstances =
instanceQuery.orderByProcessInstanceStartTime().desc().orderByProcessInstanceEndTime().desc().list();
Set<String> historicProcessInstanceIds =
historicProcessInstances.stream().map(HistoricProcessInstance::getId).collect(Collectors.toSet());
List<HistoricProcessInstance> historicProcessInstances = instanceQuery.orderByProcessInstanceStartTime()
.desc().orderByProcessInstanceEndTime().desc().list();
Set<String> historicProcessInstanceIds = historicProcessInstances.stream()
.map(HistoricProcessInstance::getId).collect(Collectors.toSet());

List<Project> results = getMySubmittedProjects(param, historicProcessInstanceIds);

@@ -1335,8 +1355,11 @@ public class TodoCenterManage {
// 把已办任务流程实例一次性取出来,减少查询次数
Map<String, HistoricProcessInstance> instanceMap = isNotEmpty(historicProcessInstances) ? historyService
.createHistoricProcessInstanceQuery()
.processInstanceIds(historicProcessInstances.stream().map(HistoricProcessInstance::getId).collect(Collectors.toSet()))
.list().stream().collect(Collectors.toMap(HistoricProcessInstance::getId, v -> v)) : new HashMap<>();
.processInstanceIds(historicProcessInstances.stream()
.map(HistoricProcessInstance::getId)
.collect(Collectors.toSet()))
.list().stream()
.collect(Collectors.toMap(HistoricProcessInstance::getId, v -> v)) : new HashMap<>();

Set<String> staterUsers = new HashSet<>();

@@ -1348,18 +1371,11 @@ public class TodoCenterManage {
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"));
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());
//HashSet<String> userSet = new HashSet<>();
//userSet.add(instance.getStartUserId()) ;
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet);
//res.setOwner(userMap.get(Long.valueOf(ist.getStartUserId())));
UserInfoVO owner = new UserInfoVO();
owner.setUserId(Long.valueOf(ist.getStartUserId()));
res.setOwner(owner);

ProcessInstanceVo processInstanceVo = getProcessInstanceVos(ist);
res.setProcessInstanceInfo(processInstanceVo);
return res;
@@ -1371,9 +1387,9 @@ public class TodoCenterManage {
// 取用户信息,减少数据库查询,一次构建
List<ResToBeProcessedDTO> result = null;
if (isNotEmpty(staterUsers)) {
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(staterUsers);
//Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(staterUsers);
//result = resVos.stream()
// .peek(v -> v.getProcessTaskInfo().setStartUser(userMap.get(Long.valueOf(v.getProcessTaskInfo().getOwnerId()))))
// .peek(v -> v.getProcessInstanceInfo().setStartUser(userMap.get(v.getProcessTaskInfo().getOwnerId())))
// .collect(Collectors.toList());
}
// return PageVo.of(result, total);
@@ -1416,16 +1432,25 @@ public class TodoCenterManage {
*/
private ProcessInstanceVo getProcessInstanceVos(HistoricProcessInstance ist) {
Map<String, String> instanceNodeMap = new HashMap<>();
ProcessInstanceVo instanceVo = ProcessInstanceVo.builder().processDefId(ist.getProcessDefinitionId())
.instanceId(ist.getId()).nodeId(instanceNodeMap.get(ist.getId())).formId(ist.getProcessDefinitionKey())
.staterUserId(ist.getStartUserId()).startTime(ist.getStartTime()).finishTime(ist.getEndTime())
.processDefName(ist.getProcessDefinitionName()).result(ist.getEndActivityId())
.version(ist.getProcessDefinitionVersion()).build();
ProcessInstanceVo instanceVo = ProcessInstanceVo
.builder()
.processDefId(ist.getProcessDefinitionId())
.instanceId(ist.getId())
.nodeId(instanceNodeMap.get(ist.getId()))
.formId(ist.getProcessDefinitionKey())
.staterUserId(ist.getStartUserId())
.startTime(ist.getStartTime())
.finishTime(ist.getEndTime())
.processDefName(ist.getProcessDefinitionName())
.result(ist.getEndActivityId())
.version(ist.getProcessDefinitionVersion())
.build();

if (Objects.isNull(ist.getEndActivityId())) {
instanceVo.setStatus(ProcessStatusEnum.UNDER_REVIEW.name());
} else if (HisProInsEndActId.BACK.equals(ist.getEndActivityId())) {
// TODO 被退回的审核节点状态这里只是暂时这么判断,具体怎么保存这个退回状态,后面讨论
// 被流程发起人退回的审核节点状态,此时项目回到上一个状态,当前流程结束
// (由前一个审核人撤回的流程,未结束,仍在审核中)
instanceVo.setStatus(ProcessStatusEnum.BE_BACKED.name());
} else if (HisProInsEndActId.REJECT.equals(ist.getEndActivityId())) {
instanceVo.setStatus(ProcessStatusEnum.BE_REJECTED.name());
@@ -1435,8 +1460,7 @@ public class TodoCenterManage {

if (ObjectUtil.isNull(ist.getEndActivityId())) {
// 没有结束,还在走流程,获取任务
List<Task> list =
taskService.createTaskQuery().processInstanceId(ist.getId()).includeIdentityLinks().active().list();
List<Task> list = taskService.createTaskQuery().processInstanceId(ist.getId()).includeIdentityLinks().active().list();
instanceVo.setNodeId(Optional.ofNullable(instanceVo.getNodeId()).orElseGet(() -> {
if (isNotEmpty(list)) {
return list.get(0).getTaskDefinitionKey();
@@ -1453,7 +1477,6 @@ public class TodoCenterManage {
instanceVo.setTaskName(ProcessStatusEnum.APPROVED.getDesc());
}
}

return instanceVo;
}

@@ -1571,18 +1594,11 @@ public class TodoCenterManage {
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"));
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());
//HashSet<String> userSet = new HashSet<>();
//userSet.add(instance.getStartUserId()) ;
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet);
//res.setOwner(userMap.get(Long.valueOf(ist.getStartUserId())));
UserInfoVO owner = new UserInfoVO();
owner.setUserId(Long.valueOf(ist.getStartUserId()));
res.setOwner(owner);

ProcessInstanceVo processInstanceVo = getProcessInstanceVos(ist);
res.setProcessInstanceInfo(processInstanceVo);
return res;
@@ -1593,9 +1609,9 @@ public class TodoCenterManage {
// 取用户信息,减少数据库查询,一次构建
List<ResToBeProcessedDTO> result = null;
if (isNotEmpty(staterUsers)) {
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(staterUsers);
//Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(staterUsers);
//result = resVos.stream()
// .peek(v -> v.getProcessTaskInfo().setStartUser(userMap.get(Long.valueOf(v.getProcessTaskInfo().getOwnerId()))))
// .peek(v -> v.getProcessInstanceInfo().setStartUser(userMap.get(v.getProcessTaskInfo().getOwnerId())))
// .collect(Collectors.toList());
}
// return PageVo.of(result, total);


+ 12
- 0
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqProcessHandlerDTO.java Ver fichero

@@ -2,10 +2,13 @@ package com.ningdatech.pmapi.todocenter.model.dto.req;

import com.ningdatech.pmapi.todocenter.bean.entity.ProcessComment;
import com.wflow.workflow.enums.ProcessHandlerEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;

/**
* 流程处理操作参数实体
*
@@ -18,12 +21,20 @@ import lombok.NoArgsConstructor;
public class ReqProcessHandlerDTO {

/**
* 要处理的项目ID
*/
@NotNull(message = "要处理的项目ID不能为空!")
private Long projectId;

/**
* 实例ID
*/
@NotNull(message = "流程实例ID不能为空!")
private String instanceId;
/**
* 任务ID
*/
@NotNull(message = "任务ID不能为空!")
private String taskId;
/**
* 签名图片地址
@@ -32,6 +43,7 @@ public class ReqProcessHandlerDTO {
/**
* 操作类型
*/
@NotNull(message = "操作类型不能为空!")
private ProcessHandlerEnum action;
/**
* 目标用户


+ 1
- 4
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/res/ResToBeProcessedDTO.java Ver fichero

@@ -2,9 +2,9 @@ package com.ningdatech.pmapi.todocenter.model.dto.res;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;
import com.wflow.workflow.bean.vo.ProcessInstanceVo;
import com.wflow.workflow.bean.vo.ProcessTaskVo;
import com.wflow.workflow.bean.vo.UserInfoVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -67,7 +67,4 @@ public class ResToBeProcessedDTO implements Serializable {

@ApiModelProperty("流程实例信息")
private ProcessInstanceVo processInstanceInfo;

@ApiModelProperty("流程发起人信息")
private UserInfoVO owner;
}

+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java Ver fichero

@@ -2,7 +2,7 @@ package com.ningdatech.pmapi.user.service;

import com.ningdatech.pmapi.user.entity.UserInfo;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wflow.workflow.bean.vo.UserInfoVO;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;

import java.util.Map;
import java.util.Set;
@@ -16,5 +16,5 @@ import java.util.Set;
* @since 2023-02-01
*/
public interface IUserInfoService extends IService<UserInfo> {
Map<Long, UserInfoVO> getUserMapByIds(Set<String> staterUsers);
Map<String, ProcessInstanceUserDto> getUserMapByIds(Set<String> staterUsers);
}

+ 10
- 11
pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java Ver fichero

@@ -10,7 +10,7 @@ import com.ningdatech.pmapi.user.entity.UserInfo;
import com.ningdatech.pmapi.user.mapper.NdUserInfoMapper;
import com.ningdatech.pmapi.user.service.IUserInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wflow.workflow.bean.vo.UserInfoVO;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.*;
@@ -33,13 +33,12 @@ public class UserInfoServiceImpl extends ServiceImpl<NdUserInfoMapper, UserInfo>

private final IDingOrganizationService dingOrganizationService;
@Override
public Map<Long, UserInfoVO> getUserMapByIds(Set<String> staterUsers) {
public Map<String, ProcessInstanceUserDto> getUserMapByIds(Set<String> staterUsers) {
List<UserInfo> userInfos = userInfoMapper.selectBatchIds(staterUsers);
List<UserInfoVO> resVos = userInfos.stream().map(u -> {
UserInfoVO userInfoVO = new UserInfoVO();
userInfoVO.setUserId(u.getId());
userInfoVO.setRealName(u.getRealName());
userInfoVO.setAccountId(u.getAccountId());
List<ProcessInstanceUserDto> resVos = userInfos.stream().map(u -> {
ProcessInstanceUserDto userInfo = new ProcessInstanceUserDto();
userInfo.setUserId(String.valueOf(u.getId()));
userInfo.setUserName(u.getRealName());
Long accountId = u.getAccountId();
if (Objects.isNull(accountId)){
throw new BizException("该用户没有录入浙政钉用户信息!");
@@ -52,10 +51,10 @@ public class UserInfoServiceImpl extends ServiceImpl<NdUserInfoMapper, UserInfo>
DingOrganization dingOrganization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class)
.eq(DingOrganization::getOrganizationCode, organizationCode));
String organizationName = dingOrganization.getOrganizationName();
userInfoVO.setOrganizationCode(organizationCode);
userInfoVO.setOrganizationName(organizationName);
return userInfoVO;
userInfo.setOrgCode(organizationCode);
userInfo.setOrgName(organizationName);
return userInfo;
}).collect(Collectors.toList());
return resVos.stream().collect(Collectors.toMap(UserInfoVO::getUserId, v -> v));
return resVos.stream().collect(Collectors.toMap((ProcessInstanceUserDto::getUserId), v -> v));
}
}

+ 28
- 0
pmapi/src/test/java/com/ningdatech/pmapi/instance/InstanceTest.java Ver fichero

@@ -0,0 +1,28 @@
package com.ningdatech.pmapi.instance;

import com.alibaba.fastjson.JSON;
import com.ningdatech.pmapi.AppTests;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;
import org.flowable.engine.RuntimeService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

/**
* @Classname InstanceTest
* @Description
* @Date 2023/2/16 14:44
* @Author PoffyZhang
*/
public class InstanceTest extends AppTests {

@Autowired
private RuntimeService runtimeService;

@Test
public void test(){
String instanceId = "896fa188-96d8-11ed-9539-e2d4e8f16b2f";
Object user = runtimeService.getVariable(instanceId,
"owner");
System.out.println(JSON.toJSONString(user));
}
}

+ 4
- 1
pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java Ver fichero

@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.statemachine;

import com.alibaba.fastjson.JSON;
import com.ningdatech.pmapi.AppTests;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent;
@@ -24,9 +25,11 @@ public class StateMachineTest extends AppTests {
@Test
public void stateMachineTest() throws Exception {
Project project = new Project();
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode());
project.setDeclareAmount(BigDecimal.valueOf(2000));
// stateMachineUtils.execute(project, ProjectStatusChangeEvent.UNDER_INTERNAL_PASS);
stateMachineUtils.execute(project, stateMachineUtils.getProjectStatusPassEvent(project.getStatus()));
System.out.println(String.format("project:%s", JSON.toJSONString(project)));
}
}

+ 26
- 0
pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IMenuServiceTest.java Ver fichero

@@ -8,12 +8,17 @@ import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.ningdatech.pmapi.AppTests;
import com.ningdatech.pmapi.sys.model.entity.Menu;
import com.ningdatech.pmapi.sys.model.entity.Role;
import com.ningdatech.pmapi.sys.model.entity.RoleMenu;
import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.sql.SQLException;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;

/**
* <p>
@@ -27,6 +32,27 @@ class IMenuServiceTest extends AppTests {

@Autowired
private IMenuService menuService;
@Autowired
private IRoleService roleService;

/**
* 初始化固定角色
*/
@Test
public void roleService() {
roleService.remove(null);
AtomicLong integer = new AtomicLong(0);
Arrays.stream(RoleEnum.values()).map(w -> {
Role role = new Role();
role.setId(integer.incrementAndGet());
role.setCode(w.name());
role.setName(w.getDesc());
role.setDescribe(w.getDesc());
role.setFixed(true);
role.setCreateOn(LocalDateTime.now());
return role;
}).forEach(roleService::save);
}

@Test
public void test() throws SQLException {


+ 2
- 3
pmapi/src/test/java/com/ningdatech/pmapi/todocenter/TodoCenterTest.java Ver fichero

@@ -27,10 +27,9 @@ public class TodoCenterTest extends AppTests {
private ZwddClient zwddClient;
@Test
public void sendWorkNoticeTest(){
// String msg = String.format(PASS_MSG_TEMPLATE, "发改委", "0216-4-测试项目");
String msg = "发改委的0216-6-测试项目需要您审核";
String msg = String.format(PASS_MSG_TEMPLATE, "发改委", "0216-7-测试项目");
log.info("开始发送工作通知");
zwddClient.sendWorkNotice("846085","0216-7",msg);
zwddClient.sendWorkNotice("846085","0216-8",msg);
// zwddClient.sendWorkNotice("829728","0216-5",msg);
log.info("发送工作通知结束");
}


Cargando…
Cancelar
Guardar