mirror of
				https://github.com/YunaiV/ruoyi-vue-pro.git
				synced 2025-10-31 10:37:41 +08:00 
			
		
		
		
	feat: 完善UserTask审批签名
This commit is contained in:
		| @ -54,6 +54,7 @@ public interface ErrorCodeConstants { | |||||||
|     ErrorCode TASK_TRANSFER_FAIL_USER_REPEAT = new ErrorCode(1_009_005_013, "任务转办失败,转办人和当前审批人为同一人"); |     ErrorCode TASK_TRANSFER_FAIL_USER_REPEAT = new ErrorCode(1_009_005_013, "任务转办失败,转办人和当前审批人为同一人"); | ||||||
|     ErrorCode TASK_TRANSFER_FAIL_USER_NOT_EXISTS = new ErrorCode(1_009_005_014, "任务转办失败,转办人不存在"); |     ErrorCode TASK_TRANSFER_FAIL_USER_NOT_EXISTS = new ErrorCode(1_009_005_014, "任务转办失败,转办人不存在"); | ||||||
|     ErrorCode TASK_CREATE_FAIL_NO_CANDIDATE_USER = new ErrorCode(1_009_006_003, "操作失败,原因:找不到任务的审批人!"); |     ErrorCode TASK_CREATE_FAIL_NO_CANDIDATE_USER = new ErrorCode(1_009_006_003, "操作失败,原因:找不到任务的审批人!"); | ||||||
|  |     ErrorCode TASK_SIGNATURE_NOT_EXISTS = new ErrorCode(1_009_005_015, "签名不能为空!"); | ||||||
|  |  | ||||||
|     // ========== 动态表单模块 1-009-010-000 ========== |     // ========== 动态表单模块 1-009-010-000 ========== | ||||||
|     ErrorCode FORM_NOT_EXISTS = new ErrorCode(1_009_010_000, "动态表单不存在"); |     ErrorCode FORM_NOT_EXISTS = new ErrorCode(1_009_010_000, "动态表单不存在"); | ||||||
|  | |||||||
| @ -101,6 +101,9 @@ public class BpmApprovalDetailRespVO { | |||||||
|         @Schema(description = "审批意见", example = "同意") |         @Schema(description = "审批意见", example = "同意") | ||||||
|         private String reason; |         private String reason; | ||||||
|  |  | ||||||
|  |         @Schema(description = "签名", example = "http://xxx") | ||||||
|  |         private String sign; | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -18,6 +18,9 @@ public class BpmTaskApproveReqVO { | |||||||
|     @NotEmpty(message = "审批意见不能为空") |     @NotEmpty(message = "审批意见不能为空") | ||||||
|     private String reason; |     private String reason; | ||||||
|  |  | ||||||
|  |     @Schema(description = "签名", example = "http://xxx") | ||||||
|  |     private String sign; | ||||||
|  |  | ||||||
|     @Schema(description = "变量实例(动态表单)", requiredMode = Schema.RequiredMode.REQUIRED) |     @Schema(description = "变量实例(动态表单)", requiredMode = Schema.RequiredMode.REQUIRED) | ||||||
|     private Map<String, Object> variables; |     private Map<String, Object> variables; | ||||||
|  |  | ||||||
|  | |||||||
| @ -186,7 +186,8 @@ public interface BpmProcessInstanceConvert { | |||||||
|             return null; |             return null; | ||||||
|         } |         } | ||||||
|         return BeanUtils.toBean(task, BpmApprovalDetailRespVO.ActivityNodeTask.class) |         return BeanUtils.toBean(task, BpmApprovalDetailRespVO.ActivityNodeTask.class) | ||||||
|                 .setStatus(FlowableUtils.getTaskStatus(task)).setReason(FlowableUtils.getTaskReason(task)); |                 .setStatus(FlowableUtils.getTaskStatus(task)).setReason(FlowableUtils.getTaskReason(task)) | ||||||
|  |                 .setSign(FlowableUtils.getTaskSign(task)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     default Set<Long> parseUserIds(HistoricProcessInstance processInstance, |     default Set<Long> parseUserIds(HistoricProcessInstance processInstance, | ||||||
|  | |||||||
| @ -59,4 +59,6 @@ public class BpmnVariableConstants { | |||||||
|      */ |      */ | ||||||
|     public static final String TASK_VARIABLE_REASON = "TASK_REASON"; |     public static final String TASK_VARIABLE_REASON = "TASK_REASON"; | ||||||
|  |  | ||||||
|  |     public static final String TASK_VARIABLE_SIGN = "TASK_SIGN"; | ||||||
|  |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -213,6 +213,10 @@ public class FlowableUtils { | |||||||
|         return (String) task.getTaskLocalVariables().get(BpmnVariableConstants.TASK_VARIABLE_REASON); |         return (String) task.getTaskLocalVariables().get(BpmnVariableConstants.TASK_VARIABLE_REASON); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     public static String getTaskSign(TaskInfo task) { | ||||||
|  |         return (String) task.getTaskLocalVariables().get(BpmnVariableConstants.TASK_VARIABLE_SIGN); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 获得任务的表单 |      * 获得任务的表单 | ||||||
|      * |      * | ||||||
|  | |||||||
| @ -482,6 +482,12 @@ public class BpmTaskServiceImpl implements BpmTaskService { | |||||||
|         if (instance == null) { |         if (instance == null) { | ||||||
|             throw exception(PROCESS_INSTANCE_NOT_EXISTS); |             throw exception(PROCESS_INSTANCE_NOT_EXISTS); | ||||||
|         } |         } | ||||||
|  |         // 1.3 校验签名 | ||||||
|  |         BpmnModel bpmnModel = modelService.getBpmnModelByDefinitionId(task.getProcessDefinitionId()); | ||||||
|  |         Boolean signEnable = parseSignEnable(bpmnModel, task.getTaskDefinitionKey()); | ||||||
|  |         if (signEnable && StrUtil.isEmpty(reqVO.getSign())) { | ||||||
|  |             throw exception(TASK_SIGNATURE_NOT_EXISTS); | ||||||
|  |         } | ||||||
|  |  | ||||||
|         // 情况一:被委派的任务,不调用 complete 去完成任务 |         // 情况一:被委派的任务,不调用 complete 去完成任务 | ||||||
|         if (DelegationState.PENDING.equals(task.getDelegationState())) { |         if (DelegationState.PENDING.equals(task.getDelegationState())) { | ||||||
| @ -496,8 +502,11 @@ public class BpmTaskServiceImpl implements BpmTaskService { | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         // 情况三:审批普通的任务。大多数情况下,都是这样 |         // 情况三:审批普通的任务。大多数情况下,都是这样 | ||||||
|         // 2.1 更新 task 状态、原因 |         // 2.1 更新 task 状态、原因、签字 | ||||||
|         updateTaskStatusAndReason(task.getId(), BpmTaskStatusEnum.APPROVE.getStatus(), reqVO.getReason()); |         updateTaskStatusAndReason(task.getId(), BpmTaskStatusEnum.APPROVE.getStatus(), reqVO.getReason()); | ||||||
|  |         if (signEnable) { | ||||||
|  |             taskService.setVariableLocal(task.getId(), BpmnVariableConstants.TASK_VARIABLE_SIGN, reqVO.getSign()); | ||||||
|  |         } | ||||||
|         // 2.2 添加评论 |         // 2.2 添加评论 | ||||||
|         taskService.addComment(task.getId(), task.getProcessInstanceId(), BpmCommentTypeEnum.APPROVE.getType(), |         taskService.addComment(task.getId(), task.getProcessInstanceId(), BpmCommentTypeEnum.APPROVE.getType(), | ||||||
|                 BpmCommentTypeEnum.APPROVE.formatComment(reqVO.getReason())); |                 BpmCommentTypeEnum.APPROVE.formatComment(reqVO.getReason())); | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Lesan
					Lesan