Commit aba9626384521c88029f89f53fd6ff6487e67217
1 parent
31c2e81d
feat: 审批签名代码评审
Showing
6 changed files
with
8 additions
and
12 deletions
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmApprovalDetailRespVO.java
| @@ -101,9 +101,8 @@ public class BpmApprovalDetailRespVO { | @@ -101,9 +101,8 @@ public class BpmApprovalDetailRespVO { | ||
| 101 | @Schema(description = "审批意见", example = "同意") | 101 | @Schema(description = "审批意见", example = "同意") |
| 102 | private String reason; | 102 | private String reason; |
| 103 | 103 | ||
| 104 | - // TODO @lesan:改成 signPicUrl 会好点 | ||
| 105 | @Schema(description = "签名", example = "https://www.iocoder.cn/sign.png") | 104 | @Schema(description = "签名", example = "https://www.iocoder.cn/sign.png") |
| 106 | - private String sign; | 105 | + private String signPicUrl; |
| 107 | 106 | ||
| 108 | } | 107 | } |
| 109 | 108 |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskApproveReqVO.java
| @@ -18,9 +18,8 @@ public class BpmTaskApproveReqVO { | @@ -18,9 +18,8 @@ public class BpmTaskApproveReqVO { | ||
| 18 | @NotEmpty(message = "审批意见不能为空") | 18 | @NotEmpty(message = "审批意见不能为空") |
| 19 | private String reason; | 19 | private String reason; |
| 20 | 20 | ||
| 21 | - // TODO @lesan:改成 signPicUrl 会好点 | ||
| 22 | @Schema(description = "签名", example = "https://www.iocoder.cn/sign.png") | 21 | @Schema(description = "签名", example = "https://www.iocoder.cn/sign.png") |
| 23 | - private String sign; | 22 | + private String signPicUrl; |
| 24 | 23 | ||
| 25 | @Schema(description = "变量实例(动态表单)", requiredMode = Schema.RequiredMode.REQUIRED) | 24 | @Schema(description = "变量实例(动态表单)", requiredMode = Schema.RequiredMode.REQUIRED) |
| 26 | private Map<String, Object> variables; | 25 | private Map<String, Object> variables; |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmProcessInstanceConvert.java
| @@ -187,7 +187,7 @@ public interface BpmProcessInstanceConvert { | @@ -187,7 +187,7 @@ public interface BpmProcessInstanceConvert { | ||
| 187 | } | 187 | } |
| 188 | return BeanUtils.toBean(task, BpmApprovalDetailRespVO.ActivityNodeTask.class) | 188 | return BeanUtils.toBean(task, BpmApprovalDetailRespVO.ActivityNodeTask.class) |
| 189 | .setStatus(FlowableUtils.getTaskStatus(task)).setReason(FlowableUtils.getTaskReason(task)) | 189 | .setStatus(FlowableUtils.getTaskStatus(task)).setReason(FlowableUtils.getTaskReason(task)) |
| 190 | - .setSign(FlowableUtils.getTaskSign(task)); | 190 | + .setSignPicUrl(FlowableUtils.getTaskSignPicUrl(task)); |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | default Set<Long> parseUserIds(HistoricProcessInstance processInstance, | 193 | default Set<Long> parseUserIds(HistoricProcessInstance processInstance, |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/enums/BpmnVariableConstants.java
| @@ -59,7 +59,6 @@ public class BpmnVariableConstants { | @@ -59,7 +59,6 @@ public class BpmnVariableConstants { | ||
| 59 | */ | 59 | */ |
| 60 | public static final String TASK_VARIABLE_REASON = "TASK_REASON"; | 60 | public static final String TASK_VARIABLE_REASON = "TASK_REASON"; |
| 61 | 61 | ||
| 62 | - // TODO @lesan:TASK_SIGN_PIC_URL 。。。虽然长一点,嘿嘿 | ||
| 63 | - public static final String TASK_VARIABLE_SIGN = "TASK_SIGN"; | 62 | + public static final String TASK_SIGN_PIC_URL = "TASK_SIGN_PIC_URL"; |
| 64 | 63 | ||
| 65 | } | 64 | } |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/FlowableUtils.java
| @@ -213,9 +213,8 @@ public class FlowableUtils { | @@ -213,9 +213,8 @@ public class FlowableUtils { | ||
| 213 | return (String) task.getTaskLocalVariables().get(BpmnVariableConstants.TASK_VARIABLE_REASON); | 213 | return (String) task.getTaskLocalVariables().get(BpmnVariableConstants.TASK_VARIABLE_REASON); |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | - // TODO @lesan:这个方法名,也改咧 | ||
| 217 | - public static String getTaskSign(TaskInfo task) { | ||
| 218 | - return (String) task.getTaskLocalVariables().get(BpmnVariableConstants.TASK_VARIABLE_SIGN); | 216 | + public static String getTaskSignPicUrl(TaskInfo task) { |
| 217 | + return (String) task.getTaskLocalVariables().get(BpmnVariableConstants.TASK_SIGN_PIC_URL); | ||
| 219 | } | 218 | } |
| 220 | 219 | ||
| 221 | /** | 220 | /** |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java
| @@ -485,7 +485,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -485,7 +485,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 485 | // 1.3 校验签名 | 485 | // 1.3 校验签名 |
| 486 | BpmnModel bpmnModel = modelService.getBpmnModelByDefinitionId(task.getProcessDefinitionId()); | 486 | BpmnModel bpmnModel = modelService.getBpmnModelByDefinitionId(task.getProcessDefinitionId()); |
| 487 | Boolean signEnable = parseSignEnable(bpmnModel, task.getTaskDefinitionKey()); | 487 | Boolean signEnable = parseSignEnable(bpmnModel, task.getTaskDefinitionKey()); |
| 488 | - if (signEnable && StrUtil.isEmpty(reqVO.getSign())) { | 488 | + if (signEnable && StrUtil.isEmpty(reqVO.getSignPicUrl())) { |
| 489 | throw exception(TASK_SIGNATURE_NOT_EXISTS); | 489 | throw exception(TASK_SIGNATURE_NOT_EXISTS); |
| 490 | } | 490 | } |
| 491 | 491 | ||
| @@ -505,7 +505,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -505,7 +505,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 505 | // 2.1 更新 task 状态、原因、签字 | 505 | // 2.1 更新 task 状态、原因、签字 |
| 506 | updateTaskStatusAndReason(task.getId(), BpmTaskStatusEnum.APPROVE.getStatus(), reqVO.getReason()); | 506 | updateTaskStatusAndReason(task.getId(), BpmTaskStatusEnum.APPROVE.getStatus(), reqVO.getReason()); |
| 507 | if (signEnable) { | 507 | if (signEnable) { |
| 508 | - taskService.setVariableLocal(task.getId(), BpmnVariableConstants.TASK_VARIABLE_SIGN, reqVO.getSign()); | 508 | + taskService.setVariableLocal(task.getId(), BpmnVariableConstants.TASK_SIGN_PIC_URL, reqVO.getSignPicUrl()); |
| 509 | } | 509 | } |
| 510 | // 2.2 添加评论 | 510 | // 2.2 添加评论 |
| 511 | taskService.addComment(task.getId(), task.getProcessInstanceId(), BpmCommentTypeEnum.APPROVE.getType(), | 511 | taskService.addComment(task.getId(), task.getProcessInstanceId(), BpmCommentTypeEnum.APPROVE.getType(), |