Merge remote-tracking branch 'base-version/main' into dev
# Conflicts: # zt-gateway/src/main/resources/application.yaml
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
package com.zt.plat.module.bpm.api.definition;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.module.bpm.api.definition.dto.BpmCategoryPageReqDTO;
|
||||
import com.zt.plat.module.bpm.api.definition.dto.BpmCategoryRespDTO;
|
||||
import com.zt.plat.module.bpm.api.definition.dto.BpmCategorySaveReqDTO;
|
||||
import com.zt.plat.module.bpm.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME)
|
||||
@Tag(name = "RPC 服务 - BPM 流程分类")
|
||||
public interface BpmCategoryApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/category";
|
||||
|
||||
@PostMapping(PREFIX + "/create")
|
||||
@Operation(summary = "创建流程分类")
|
||||
CommonResult<Long> createCategory(@Valid @RequestBody BpmCategorySaveReqDTO createReqDTO);
|
||||
|
||||
@PutMapping(PREFIX + "/update")
|
||||
@Operation(summary = "更新流程分类")
|
||||
CommonResult<Boolean> updateCategory(@Valid @RequestBody BpmCategorySaveReqDTO updateReqDTO);
|
||||
|
||||
@PutMapping(PREFIX + "/update-sort-batch")
|
||||
@Operation(summary = "批量更新流程分类的排序")
|
||||
@Parameter(name = "ids", description = "分类编号列表", required = true, example = "1,2,3")
|
||||
CommonResult<Boolean> updateCategorySortBatch(@RequestParam("ids") List<Long> ids);
|
||||
|
||||
@DeleteMapping(PREFIX + "/delete")
|
||||
@Operation(summary = "删除流程分类")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
CommonResult<Boolean> deleteCategory(@RequestParam("id") Long id);
|
||||
|
||||
@GetMapping(PREFIX + "/get")
|
||||
@Operation(summary = "获得流程分类")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
CommonResult<BpmCategoryRespDTO> getCategory(@RequestParam("id") Long id);
|
||||
|
||||
@PostMapping(PREFIX + "/page")
|
||||
@Operation(summary = "获得流程分类分页")
|
||||
CommonResult<PageResult<BpmCategoryRespDTO>> getCategoryPage(@Valid @RequestBody BpmCategoryPageReqDTO pageReqDTO);
|
||||
|
||||
@GetMapping(PREFIX + "/simple-list")
|
||||
@Operation(summary = "获取流程分类的精简信息列表", description = "只包含被开启的分类,主要用于前端的下拉选项")
|
||||
CommonResult<List<BpmCategoryRespDTO>> getCategorySimpleList();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.zt.plat.module.bpm.api.definition;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.module.bpm.api.definition.dto.BpmFormPageReqDTO;
|
||||
import com.zt.plat.module.bpm.api.definition.dto.BpmFormRespDTO;
|
||||
import com.zt.plat.module.bpm.api.definition.dto.BpmFormSaveReqDTO;
|
||||
import com.zt.plat.module.bpm.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME)
|
||||
@Tag(name = "RPC 服务 - 动态表单")
|
||||
public interface BpmFormApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/form";
|
||||
|
||||
@PostMapping(PREFIX + "/create")
|
||||
@Operation(summary = "创建动态表单")
|
||||
CommonResult<Long> createForm(@Valid @RequestBody BpmFormSaveReqDTO createReqDTO);
|
||||
|
||||
@PutMapping(PREFIX + "/update")
|
||||
@Operation(summary = "更新动态表单")
|
||||
CommonResult<Boolean> updateForm(@Valid @RequestBody BpmFormSaveReqDTO updateReqDTO);
|
||||
|
||||
@DeleteMapping(PREFIX + "/delete")
|
||||
@Operation(summary = "删除动态表单")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
CommonResult<Boolean> deleteForm(@RequestParam("id") Long id);
|
||||
|
||||
@GetMapping(PREFIX + "/get")
|
||||
@Operation(summary = "获得动态表单")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
CommonResult<BpmFormRespDTO> getForm(@RequestParam("id") Long id);
|
||||
|
||||
@PostMapping(PREFIX + "/page")
|
||||
@Operation(summary = "获得动态表单分页")
|
||||
CommonResult<PageResult<BpmFormRespDTO>> getFormPage(@Valid @RequestBody BpmFormPageReqDTO pageReqDTO);
|
||||
|
||||
@GetMapping(PREFIX + "/simple-list")
|
||||
@Operation(summary = "获得动态表单的精简列表", description = "用于表单下拉框")
|
||||
CommonResult<List<BpmFormRespDTO>> getFormSimpleList();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.zt.plat.module.bpm.api.definition;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.module.bpm.api.definition.dto.BpmUserGroupRespDTO;
|
||||
import com.zt.plat.module.bpm.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME)
|
||||
@Tag(name = "RPC 服务 - 用户组")
|
||||
public interface BpmUserGroupApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/user-group";
|
||||
|
||||
@GetMapping(PREFIX + "/get")
|
||||
@Operation(summary = "获得用户组")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
CommonResult<BpmUserGroupRespDTO> getUserGroup(@RequestParam("id") Long id);
|
||||
|
||||
@GetMapping(PREFIX + "/simple-list")
|
||||
@Operation(summary = "获取用户组精简信息列表", description = "只包含被开启的用户组,主要用于前端的下拉选项")
|
||||
CommonResult<List<BpmUserGroupRespDTO>> getUserGroupSimpleList();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.zt.plat.module.bpm.api.definition.dto;
|
||||
|
||||
import com.zt.plat.framework.common.enums.CommonStatusEnum;
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
import com.zt.plat.framework.common.validation.InEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "RPC 服务 - BPM 流程分类分页 Request DTO")
|
||||
@Data
|
||||
public class BpmCategoryPageReqDTO extends PageParam {
|
||||
|
||||
@Schema(description = "分类名", example = "王五")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "分类标志", example = "OA")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "分类状态", example = "1")
|
||||
@InEnum(CommonStatusEnum.class)
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.zt.plat.module.bpm.api.definition.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "RPC 服务 - BPM 流程分类 Response DTO")
|
||||
@Data
|
||||
public class BpmCategoryRespDTO {
|
||||
|
||||
@Schema(description = "分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3167")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "分类名", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "分类标志", requiredMode = Schema.RequiredMode.REQUIRED, example = "OA")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "分类描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "分类状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "分类排序", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.zt.plat.module.bpm.api.definition.dto;
|
||||
|
||||
import com.zt.plat.framework.common.enums.CommonStatusEnum;
|
||||
import com.zt.plat.framework.common.validation.InEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "RPC 服务 - BPM 流程分类新增/修改 Request DTO")
|
||||
@Data
|
||||
public class BpmCategorySaveReqDTO {
|
||||
|
||||
@Schema(description = "分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3167")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "分类名", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@NotEmpty(message = "分类名不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "分类描述", example = "你猜")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "分类标志", requiredMode = Schema.RequiredMode.REQUIRED, example = "OA")
|
||||
@NotEmpty(message = "分类标志不能为空")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "分类状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "分类状态不能为空")
|
||||
@InEnum(CommonStatusEnum.class)
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "分类排序", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "分类排序不能为空")
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.zt.plat.module.bpm.api.definition.dto;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "动态表单分页 Request DTO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class BpmFormPageReqDTO extends PageParam {
|
||||
|
||||
@Schema(description = "表单名称", example = "芋道")
|
||||
private String name;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.zt.plat.module.bpm.api.definition.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "RPC 服务 - 动态表单 Response DTO")
|
||||
@Data
|
||||
public class BpmFormRespDTO {
|
||||
|
||||
@Schema(description = "表单编号", example = "1024")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "表单名", example = "芋艿")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "表单状态", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "表单的配置")
|
||||
private String conf;
|
||||
|
||||
@Schema(description = "表单项的数组")
|
||||
private String fields;
|
||||
|
||||
@Schema(description = "备注", example = "我是备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.zt.plat.module.bpm.api.definition.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "RPC 服务 - 动态表单新增/修改 Request DTO")
|
||||
@Data
|
||||
public class BpmFormSaveReqDTO {
|
||||
|
||||
@Schema(description = "表单编号", example = "1024")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "表单名", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||
@NotEmpty(message = "表单名不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "表单状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "表单的配置", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "表单的配置不能为空")
|
||||
private String conf;
|
||||
|
||||
@Schema(description = "表单项的数组", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "表单项的数组不能为空")
|
||||
private String fields;
|
||||
|
||||
@Schema(description = "备注", example = "我是备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.zt.plat.module.bpm.api.definition.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Set;
|
||||
|
||||
@Schema(description = "RPC 服务 - 用户组 Response DTO")
|
||||
@Data
|
||||
public class BpmUserGroupRespDTO {
|
||||
|
||||
@Schema(description = "编号", example = "1024")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "组名", example = "芋艿")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "描述", example = "芋艿")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "成员用户编号数组", example = "1,2,3")
|
||||
private Set<Long> memberUserIds;
|
||||
|
||||
@Schema(description = "状态", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.zt.plat.module.bpm.api.task;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.module.bpm.api.task.dto.BpmTaskPageReqDTO;
|
||||
import com.zt.plat.module.bpm.api.task.dto.BpmTaskRespDTO;
|
||||
import com.zt.plat.module.bpm.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME)
|
||||
@Tag(name = "RPC 服务 - 流程任务实例")
|
||||
public interface BpmTaskApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/task";
|
||||
|
||||
@PostMapping(PREFIX + "/todo-page")
|
||||
@Operation(summary = "获取 Todo 待办任务分页")
|
||||
CommonResult<List<BpmTaskRespDTO>> getTaskTodoPage(@Valid @RequestBody BpmTaskPageReqDTO pageReqDTO);
|
||||
|
||||
@PostMapping(PREFIX + "/done-page")
|
||||
@Operation(summary = "获取 Done 已办任务分页")
|
||||
CommonResult<List<BpmTaskRespDTO>> getTaskDonePage(@Valid @RequestBody BpmTaskPageReqDTO pageReqDTO);
|
||||
|
||||
@PostMapping(PREFIX + "/manager-page")
|
||||
@Operation(summary = "获取全部任务的分页", description = "用于【流程任务】菜单")
|
||||
CommonResult<List<BpmTaskRespDTO>> getTaskManagerPage(@Valid @RequestBody BpmTaskPageReqDTO pageReqDTO);
|
||||
|
||||
@GetMapping(PREFIX + "/list-by-process-instance-id")
|
||||
@Operation(summary = "获得指定流程实例的任务列表", description = "包括完成的、未完成的")
|
||||
@Parameter(name = "processInstanceId", description = "流程实例的编号", required = true)
|
||||
CommonResult<List<BpmTaskRespDTO>> getTaskListByProcessInstanceId(
|
||||
@RequestParam("processInstanceId") String processInstanceId);
|
||||
|
||||
@GetMapping(PREFIX + "/list-by-return")
|
||||
@Operation(summary = "获取所有可退回的节点", description = "用于【流程详情】的【退回】按钮")
|
||||
@Parameter(name = "id", description = "当前任务ID", required = true)
|
||||
CommonResult<List<BpmTaskRespDTO>> getTaskListByReturn(@RequestParam("id") String id);
|
||||
|
||||
@GetMapping(PREFIX + "/list-by-parent-task-id")
|
||||
@Operation(summary = "获得指定父级任务的子任务列表") // 目前用于,减签的时候,获得子任务列表
|
||||
@Parameter(name = "parentTaskId", description = "父级任务编号", required = true)
|
||||
CommonResult<List<BpmTaskRespDTO>> getTaskListByParentTaskId(@RequestParam("parentTaskId") String parentTaskId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.zt.plat.module.bpm.api.task.dto;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "RPC 服务 - 流程实例分页 Request DTO")
|
||||
@Data
|
||||
public class BpmProcessInstancePageReqDTO extends PageParam {
|
||||
|
||||
@Schema(description = "流程实例的编号", example = "1024")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "流程实例的名字", example = "芋艿")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "流程定义的编号", example = "2048")
|
||||
private String processDefinitionId;
|
||||
|
||||
@Schema(description = "流程分类", example = "1")
|
||||
private String category;
|
||||
|
||||
@Schema(description = "流程实例的状态", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "流程实例的结果", example = "1")
|
||||
private Integer result;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.zt.plat.module.bpm.api.task.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
@Schema(description = "RPC 服务 - 流程实例 Response DTO")
|
||||
@Data
|
||||
public class BpmProcessInstanceRespDTO {
|
||||
|
||||
@Schema(description = "流程实例的编号", example = "1024")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "流程实例的名字", example = "芋艿")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "流程定义的编号", example = "2048")
|
||||
private String processDefinitionId;
|
||||
|
||||
@Schema(description = "流程分类", example = "1")
|
||||
private String category;
|
||||
|
||||
@Schema(description = "流程实例的状态", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "流程实例的结果", example = "1")
|
||||
private Integer result;
|
||||
|
||||
@Schema(description = "提交的表单值", example = "{\"name\": \"芋艿\"}")
|
||||
private Map<String, Object> formVariables;
|
||||
|
||||
@Schema(description = "业务的唯一标识", example = "1")
|
||||
private String businessKey;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "结束时间")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
@Schema(description = "持续时间", example = "1000")
|
||||
private Long durationInMillis;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.zt.plat.module.bpm.api.task.dto;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "RPC 服务 - 流程任务分页 Request DTO")
|
||||
@Data
|
||||
public class BpmTaskPageReqDTO extends PageParam {
|
||||
|
||||
@Schema(description = "流程任务名", example = "芋艿")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "流程定义的编号", example = "2048")
|
||||
private String processDefinitionId;
|
||||
|
||||
@Schema(description = "流程分类", example = "1")
|
||||
private String category;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.zt.plat.module.bpm.api.task.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Schema(description = "RPC 服务 - 流程任务 Response DTO")
|
||||
@Data
|
||||
public class BpmTaskRespDTO {
|
||||
|
||||
@Schema(description = "任务编号", example = "1024")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "任务名字", example = "芋艿")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "接收人的用户编号", example = "1")
|
||||
private Long assigneeUserId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "结束时间")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
@Schema(description = "持续时间", example = "1000")
|
||||
private Long durationInMillis;
|
||||
|
||||
@Schema(description = "流程实例的编号", example = "1024")
|
||||
private String processInstanceId;
|
||||
|
||||
@Schema(description = "流程定义的编号", example = "2048")
|
||||
private String processDefinitionId;
|
||||
|
||||
@Schema(description = "任务状态", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "审批建议", example = "不错不错!")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "任务定义的标识", example = "Activity_one")
|
||||
private String taskDefinitionKey;
|
||||
|
||||
@Schema(description = "表单编号", example = "1024")
|
||||
private Long formId;
|
||||
|
||||
@Schema(description = "表单的配置", example = "[]")
|
||||
private String formConf;
|
||||
|
||||
@Schema(description = "表单项的数组", example = "[]")
|
||||
private String formFields;
|
||||
|
||||
@Schema(description = "提交的表单值", example = "{\"name\": \"芋艿\"}")
|
||||
private Map<String, Object> formVariables;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.zt.plat.module.bpm.api.definition;
|
||||
|
||||
import com.zt.plat.framework.common.enums.CommonStatusEnum;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import com.zt.plat.module.bpm.api.definition.dto.BpmCategoryPageReqDTO;
|
||||
import com.zt.plat.module.bpm.api.definition.dto.BpmCategoryRespDTO;
|
||||
import com.zt.plat.module.bpm.api.definition.dto.BpmCategorySaveReqDTO;
|
||||
import com.zt.plat.module.bpm.controller.admin.definition.vo.category.BpmCategoryPageReqVO;
|
||||
import com.zt.plat.module.bpm.controller.admin.definition.vo.category.BpmCategorySaveReqVO;
|
||||
import com.zt.plat.module.bpm.dal.dataobject.definition.BpmCategoryDO;
|
||||
import com.zt.plat.module.bpm.service.definition.BpmCategoryService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* BPM 流程分类 Api 实现类
|
||||
*
|
||||
* @author ZT
|
||||
*/
|
||||
@RestController
|
||||
@Validated
|
||||
public class BpmCategoryApiImpl implements BpmCategoryApi {
|
||||
|
||||
@Resource
|
||||
private BpmCategoryService categoryService;
|
||||
|
||||
@Override
|
||||
public CommonResult<Long> createCategory(@Valid BpmCategorySaveReqDTO createReqDTO) {
|
||||
BpmCategorySaveReqVO createReqVO = BeanUtils.toBean(createReqDTO, BpmCategorySaveReqVO.class);
|
||||
return success(categoryService.createCategory(createReqVO));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> updateCategory(@Valid BpmCategorySaveReqDTO updateReqDTO) {
|
||||
BpmCategorySaveReqVO updateReqVO = BeanUtils.toBean(updateReqDTO, BpmCategorySaveReqVO.class);
|
||||
categoryService.updateCategory(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> updateCategorySortBatch(List<Long> ids) {
|
||||
categoryService.updateCategorySortBatch(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> deleteCategory(Long id) {
|
||||
categoryService.deleteCategory(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<BpmCategoryRespDTO> getCategory(Long id) {
|
||||
BpmCategoryDO category = categoryService.getCategory(id);
|
||||
return success(BeanUtils.toBean(category, BpmCategoryRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<PageResult<BpmCategoryRespDTO>> getCategoryPage(@Valid BpmCategoryPageReqDTO pageReqDTO) {
|
||||
BpmCategoryPageReqVO pageReqVO = BeanUtils.toBean(pageReqDTO, BpmCategoryPageReqVO.class);
|
||||
PageResult<BpmCategoryDO> pageResult = categoryService.getCategoryPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, BpmCategoryRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<BpmCategoryRespDTO>> getCategorySimpleList() {
|
||||
List<BpmCategoryDO> list = categoryService.getCategoryListByStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
return success(BeanUtils.toBean(list, BpmCategoryRespDTO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.zt.plat.module.bpm.api.definition;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import com.zt.plat.module.bpm.api.definition.dto.BpmFormPageReqDTO;
|
||||
import com.zt.plat.module.bpm.api.definition.dto.BpmFormRespDTO;
|
||||
import com.zt.plat.module.bpm.api.definition.dto.BpmFormSaveReqDTO;
|
||||
import com.zt.plat.module.bpm.controller.admin.definition.vo.form.BpmFormPageReqVO;
|
||||
import com.zt.plat.module.bpm.controller.admin.definition.vo.form.BpmFormSaveReqVO;
|
||||
import com.zt.plat.module.bpm.dal.dataobject.definition.BpmFormDO;
|
||||
import com.zt.plat.module.bpm.service.definition.BpmFormService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* 动态表单 Api 实现类
|
||||
*
|
||||
* @author ZT
|
||||
*/
|
||||
@RestController
|
||||
@Validated
|
||||
public class BpmFormApiImpl implements BpmFormApi {
|
||||
|
||||
@Resource
|
||||
private BpmFormService formService;
|
||||
|
||||
@Override
|
||||
public CommonResult<Long> createForm(@Valid BpmFormSaveReqDTO createReqDTO) {
|
||||
BpmFormSaveReqVO createReqVO = BeanUtils.toBean(createReqDTO, BpmFormSaveReqVO.class);
|
||||
return success(formService.createForm(createReqVO));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> updateForm(@Valid BpmFormSaveReqDTO updateReqDTO) {
|
||||
BpmFormSaveReqVO updateReqVO = BeanUtils.toBean(updateReqDTO, BpmFormSaveReqVO.class);
|
||||
formService.updateForm(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> deleteForm(Long id) {
|
||||
formService.deleteForm(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<BpmFormRespDTO> getForm(Long id) {
|
||||
BpmFormDO form = formService.getForm(id);
|
||||
return success(BeanUtils.toBean(form, BpmFormRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<PageResult<BpmFormRespDTO>> getFormPage(BpmFormPageReqDTO pageReqDTO) {
|
||||
BpmFormPageReqVO pageReqVO = BeanUtils.toBean(pageReqDTO, BpmFormPageReqVO.class);
|
||||
PageResult<BpmFormDO> pageResult = formService.getFormPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, BpmFormRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<BpmFormRespDTO>> getFormSimpleList() {
|
||||
List<BpmFormDO> list = formService.getFormList();
|
||||
// 只返回 id、name 字段
|
||||
List<BpmFormRespDTO> dtoList = list.stream()
|
||||
.map(formDO -> new BpmFormRespDTO().setId(formDO.getId()).setName(formDO.getName()))
|
||||
.collect(java.util.stream.Collectors.toList());
|
||||
return success(dtoList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.zt.plat.module.bpm.api.definition;
|
||||
|
||||
import com.zt.plat.framework.common.enums.CommonStatusEnum;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import com.zt.plat.module.bpm.api.definition.dto.BpmUserGroupRespDTO;
|
||||
import com.zt.plat.module.bpm.dal.dataobject.definition.BpmUserGroupDO;
|
||||
import com.zt.plat.module.bpm.service.definition.BpmUserGroupService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* 用户组 Api 实现类
|
||||
*
|
||||
* @author ZT
|
||||
*/
|
||||
@RestController
|
||||
@Validated
|
||||
public class BpmUserGroupApiImpl implements BpmUserGroupApi {
|
||||
|
||||
@Resource
|
||||
private BpmUserGroupService userGroupService;
|
||||
|
||||
@Override
|
||||
public CommonResult<BpmUserGroupRespDTO> getUserGroup(Long id) {
|
||||
BpmUserGroupDO userGroup = userGroupService.getUserGroup(id);
|
||||
return success(BeanUtils.toBean(userGroup, BpmUserGroupRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<BpmUserGroupRespDTO>> getUserGroupSimpleList() {
|
||||
List<BpmUserGroupDO> list = userGroupService.getUserGroupListByStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
return success(BeanUtils.toBean(list, BpmUserGroupRespDTO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
package com.zt.plat.module.bpm.api.task;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.zt.plat.framework.business.core.util.DeptUtil;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.util.number.NumberUtils;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.zt.plat.module.bpm.api.task.dto.BpmTaskPageReqDTO;
|
||||
import com.zt.plat.module.bpm.api.task.dto.BpmTaskRespDTO;
|
||||
import com.zt.plat.module.bpm.controller.admin.task.vo.task.BpmTaskPageReqVO;
|
||||
import com.zt.plat.module.bpm.convert.task.BpmTaskConvert;
|
||||
import com.zt.plat.module.bpm.dal.dataobject.definition.BpmFormDO;
|
||||
import com.zt.plat.module.bpm.dal.dataobject.definition.BpmProcessDefinitionInfoDO;
|
||||
import com.zt.plat.module.bpm.service.definition.BpmFormService;
|
||||
import com.zt.plat.module.bpm.service.definition.BpmProcessDefinitionService;
|
||||
import com.zt.plat.module.bpm.service.task.BpmProcessInstanceService;
|
||||
import com.zt.plat.module.bpm.service.task.BpmTaskService;
|
||||
import com.zt.plat.module.system.api.dept.DeptApi;
|
||||
import com.zt.plat.module.system.api.dept.dto.DeptRespDTO;
|
||||
import com.zt.plat.module.system.api.user.AdminUserApi;
|
||||
import com.zt.plat.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.flowable.task.api.Task;
|
||||
import org.flowable.task.api.history.HistoricTaskInstance;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||
import static com.zt.plat.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static com.zt.plat.framework.common.util.collection.CollectionUtils.convertSetByFlatMap;
|
||||
|
||||
/**
|
||||
* BPM 任务 API 实现类
|
||||
*
|
||||
* @author ZT
|
||||
*/
|
||||
@RestController
|
||||
@Validated
|
||||
public class BpmTaskApiImpl implements BpmTaskApi {
|
||||
|
||||
@Resource
|
||||
private BpmTaskService taskService;
|
||||
@Resource
|
||||
private BpmProcessInstanceService processInstanceService;
|
||||
@Resource
|
||||
private BpmFormService formService;
|
||||
@Resource
|
||||
private BpmProcessDefinitionService processDefinitionService;
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
|
||||
@Override
|
||||
public CommonResult<List<BpmTaskRespDTO>> getTaskTodoPage(@Valid BpmTaskPageReqDTO pageReqDTO) {
|
||||
// 转换请求参数
|
||||
BpmTaskPageReqVO pageReqVO = BeanUtils.toBean(pageReqDTO, BpmTaskPageReqVO.class);
|
||||
|
||||
// 调用 Service 层方法
|
||||
PageResult<Task> pageResult = taskService.getTaskTodoPage(SecurityFrameworkUtils.getLoginUserId(), pageReqVO);
|
||||
if (CollUtil.isEmpty(pageResult.getList())) {
|
||||
return success(new ArrayList<>());
|
||||
}
|
||||
|
||||
// 拼接数据 - 参考 Controller 逻辑
|
||||
Map<String, ProcessInstance> processInstanceMap = processInstanceService.getProcessInstanceMap(convertSet(pageResult.getList(), Task::getProcessInstanceId));
|
||||
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertSet(processInstanceMap.values(), instance -> Long.valueOf(instance.getStartUserId())));
|
||||
Map<String, BpmProcessDefinitionInfoDO> processDefinitionInfoMap = processDefinitionService.getProcessDefinitionInfoMap(convertSet(pageResult.getList(), Task::getProcessDefinitionId));
|
||||
|
||||
// 使用转换器构建结果并转换为 DTO
|
||||
var voPageResult = BpmTaskConvert.INSTANCE.buildTodoTaskPage(pageResult, processInstanceMap, userMap, processDefinitionInfoMap);
|
||||
return success(BeanUtils.toBean(voPageResult.getList(), BpmTaskRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<BpmTaskRespDTO>> getTaskDonePage(@Valid BpmTaskPageReqDTO pageReqDTO) {
|
||||
// 转换请求参数
|
||||
BpmTaskPageReqVO pageReqVO = BeanUtils.toBean(pageReqDTO, BpmTaskPageReqVO.class);
|
||||
|
||||
// 调用 Service 层方法
|
||||
PageResult<HistoricTaskInstance> pageResult = taskService.getTaskDonePage(SecurityFrameworkUtils.getLoginUserId(), pageReqVO);
|
||||
if (CollUtil.isEmpty(pageResult.getList())) {
|
||||
return success(new ArrayList<>());
|
||||
}
|
||||
|
||||
// 拼接数据 - 参考 Controller 逻辑
|
||||
Map<String, HistoricProcessInstance> processInstanceMap = processInstanceService.getHistoricProcessInstanceMap(convertSet(pageResult.getList(), HistoricTaskInstance::getProcessInstanceId));
|
||||
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertSet(processInstanceMap.values(), instance -> Long.valueOf(instance.getStartUserId())));
|
||||
Map<String, BpmProcessDefinitionInfoDO> processDefinitionInfoMap = processDefinitionService.getProcessDefinitionInfoMap(convertSet(pageResult.getList(), HistoricTaskInstance::getProcessDefinitionId));
|
||||
|
||||
// 使用转换器构建结果并转换为 DTO
|
||||
var voPageResult = BpmTaskConvert.INSTANCE.buildTaskPage(pageResult, processInstanceMap, userMap, null, processDefinitionInfoMap);
|
||||
return success(BeanUtils.toBean(voPageResult.getList(), BpmTaskRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<BpmTaskRespDTO>> getTaskManagerPage(@Valid BpmTaskPageReqDTO pageReqDTO) {
|
||||
// 转换请求参数
|
||||
BpmTaskPageReqVO pageReqVO = BeanUtils.toBean(pageReqDTO, BpmTaskPageReqVO.class);
|
||||
|
||||
// 调用 Service 层方法
|
||||
PageResult<HistoricTaskInstance> pageResult = taskService.getTaskPage(SecurityFrameworkUtils.getLoginUserId(), pageReqVO);
|
||||
if (CollUtil.isEmpty(pageResult.getList())) {
|
||||
return success(new ArrayList<>());
|
||||
}
|
||||
|
||||
// 拼接数据 - 参考 Controller 逻辑
|
||||
Map<String, HistoricProcessInstance> processInstanceMap = processInstanceService.getHistoricProcessInstanceMap(convertSet(pageResult.getList(), HistoricTaskInstance::getProcessInstanceId));
|
||||
// 获得 User 和 Dept Map
|
||||
Set<Long> userIds = convertSet(processInstanceMap.values(), instance -> Long.valueOf(instance.getStartUserId()));
|
||||
userIds.addAll(convertSet(pageResult.getList(), task -> NumberUtils.parseLong(task.getAssignee())));
|
||||
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIds);
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), DeptUtil::getDeptId));
|
||||
Map<String, BpmProcessDefinitionInfoDO> processDefinitionInfoMap = processDefinitionService.getProcessDefinitionInfoMap(convertSet(pageResult.getList(), HistoricTaskInstance::getProcessDefinitionId));
|
||||
|
||||
// 使用转换器构建结果并转换为 DTO
|
||||
var voPageResult = BpmTaskConvert.INSTANCE.buildTaskPage(pageResult, processInstanceMap, userMap, deptMap, processDefinitionInfoMap);
|
||||
return success(BeanUtils.toBean(voPageResult.getList(), BpmTaskRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<BpmTaskRespDTO>> getTaskListByProcessInstanceId(String processInstanceId) {
|
||||
// 调用 Service 层方法
|
||||
List<HistoricTaskInstance> taskList = taskService.getTaskListByProcessInstanceId(processInstanceId, true);
|
||||
if (CollUtil.isEmpty(taskList)) {
|
||||
return success(Collections.emptyList());
|
||||
}
|
||||
|
||||
// 拼接数据 - 参考 Controller 逻辑
|
||||
Set<Long> userIds = convertSetByFlatMap(taskList, task -> Stream.of(NumberUtils.parseLong(task.getAssignee()), NumberUtils.parseLong(task.getOwner())));
|
||||
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIds);
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), DeptUtil::getDeptId));
|
||||
// 获得 Form Map
|
||||
Map<Long, BpmFormDO> formMap = formService.getFormMap(convertSet(taskList, task -> {
|
||||
String formKey = task.getFormKey();
|
||||
if (formKey == null || formKey.isBlank()) {
|
||||
return 0L;
|
||||
}
|
||||
try {
|
||||
return Long.parseLong(formKey);
|
||||
} catch (NumberFormatException e) {
|
||||
// 如果 formKey 不是数字(比如是URL),返回0L
|
||||
return 0L;
|
||||
}
|
||||
}));
|
||||
|
||||
// 使用转换器构建结果并转换为 DTO
|
||||
var voList = BpmTaskConvert.INSTANCE.buildTaskListByProcessInstanceId(taskList, formMap, userMap, deptMap);
|
||||
List<BpmTaskRespDTO> result = BeanUtils.toBean(voList, BpmTaskRespDTO.class);
|
||||
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<BpmTaskRespDTO>> getTaskListByReturn(String id) {
|
||||
// 调用 Service 层方法
|
||||
var userTaskList = taskService.getUserTaskListByReturn(id);
|
||||
|
||||
// 转换返回结果 - 只返回 id 和 name(对应 taskDefinitionKey 和 name)
|
||||
List<BpmTaskRespDTO> result = userTaskList.stream().map(userTask -> {
|
||||
BpmTaskRespDTO dto = new BpmTaskRespDTO();
|
||||
dto.setName(userTask.getName());
|
||||
dto.setTaskDefinitionKey(userTask.getId());
|
||||
return dto;
|
||||
}).toList();
|
||||
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<BpmTaskRespDTO>> getTaskListByParentTaskId(String parentTaskId) {
|
||||
// 调用 Service 层方法
|
||||
List<Task> taskList = taskService.getTaskListByParentTaskId(parentTaskId);
|
||||
if (CollUtil.isEmpty(taskList)) {
|
||||
return success(Collections.emptyList());
|
||||
}
|
||||
|
||||
// 拼接数据 - 参考 Controller 逻辑
|
||||
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertSetByFlatMap(taskList, user -> Stream.of(NumberUtils.parseLong(user.getAssignee()), NumberUtils.parseLong(user.getOwner()))));
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), DeptUtil::getDeptId));
|
||||
|
||||
// 使用转换器构建结果并转换为 DTO
|
||||
var voList = BpmTaskConvert.INSTANCE.buildTaskListByParentTaskId(taskList, userMap, deptMap);
|
||||
List<BpmTaskRespDTO> result = BeanUtils.toBean(voList, BpmTaskRespDTO.class);
|
||||
|
||||
return success(result);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,6 +42,12 @@
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.zt.plat</groupId>
|
||||
<artifactId>zt-module-bpm-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 业务组件 -->
|
||||
<dependency>
|
||||
<groupId>com.zt.plat</groupId>
|
||||
|
||||
@@ -11,6 +11,9 @@ import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import com.zt.plat.framework.excel.core.util.ExcelUtils;
|
||||
import com.zt.plat.module.bpm.api.task.BpmProcessInstanceApi;
|
||||
import com.zt.plat.module.bpm.api.task.BpmTaskApi;
|
||||
import com.zt.plat.module.bpm.api.task.dto.BpmTaskRespDTO;
|
||||
import com.zt.plat.module.infra.api.businessfile.BusinessFileApi;
|
||||
import com.zt.plat.module.infra.api.businessfile.dto.BusinessFilePageReqDTO;
|
||||
import com.zt.plat.module.system.api.dept.DeptApi;
|
||||
@@ -60,6 +63,10 @@ public class DemoContractController extends AbstractFileUploadController impleme
|
||||
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
@Resource
|
||||
private BpmTaskApi bpmTaskApi;
|
||||
@Resource
|
||||
private BpmProcessInstanceApi bpmInsApi;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建合同")
|
||||
@@ -108,6 +115,7 @@ public class DemoContractController extends AbstractFileUploadController impleme
|
||||
@PreAuthorize("@ss.hasPermission('template:demo-contract:query')")
|
||||
public CommonResult<PageResult<DemoContractRespVO>> getDemoContractPage(@Valid DemoContractPageReqVO pageReqVO) {
|
||||
BusinessFilePageReqDTO pageReqDTO = new BusinessFilePageReqDTO();
|
||||
CommonResult<List<BpmTaskRespDTO>> taskTodoPage = bpmTaskApi.getTaskListByProcessInstanceId("1111");
|
||||
CommonResult<Set<CompanyDeptInfoRespDTO>> companyDeptInfoListByUserId = deptApi.getCompanyDeptInfoListByUserId(getLoginUserId());
|
||||
Long id = IdWorker.getId();
|
||||
System.out.println("Generated ID: " + id);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zt.plat.module.template.framework.rpc.config;
|
||||
|
||||
import com.zt.plat.module.bpm.api.task.BpmProcessInstanceApi;
|
||||
import com.zt.plat.module.bpm.api.task.BpmTaskApi;
|
||||
import com.zt.plat.module.infra.api.config.ConfigApi;
|
||||
import com.zt.plat.module.infra.api.file.FileApi;
|
||||
import com.zt.plat.module.infra.api.websocket.WebSocketSenderApi;
|
||||
@@ -9,6 +11,6 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(value = "templateRpcConfiguration", proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {FileApi.class, WebSocketSenderApi.class, ConfigApi.class, DeptApi.class, SequenceApi.class})
|
||||
@EnableFeignClients(clients = {FileApi.class, WebSocketSenderApi.class, ConfigApi.class, DeptApi.class, SequenceApi.class, BpmTaskApi.class, BpmProcessInstanceApi.class})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user