Commit 9569c3fbed80541ff685c35d427f4d63280ad867
1 parent
f5050807
【代码评审】BPM:触发器 - 表单修改
Showing
5 changed files
with
13 additions
and
5 deletions
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json/JsonUtils.java
| @@ -206,4 +206,5 @@ public class JsonUtils { | @@ -206,4 +206,5 @@ public class JsonUtils { | ||
| 206 | public static boolean isJsonObject(String str) { | 206 | public static boolean isJsonObject(String str) { |
| 207 | return JSONUtil.isTypeJSONObject(str); | 207 | return JSONUtil.isTypeJSONObject(str); |
| 208 | } | 208 | } |
| 209 | + | ||
| 209 | } | 210 | } |
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmTriggerTypeEnum.java
| @@ -17,8 +17,7 @@ import java.util.Arrays; | @@ -17,8 +17,7 @@ import java.util.Arrays; | ||
| 17 | public enum BpmTriggerTypeEnum implements ArrayValuable<Integer> { | 17 | public enum BpmTriggerTypeEnum implements ArrayValuable<Integer> { |
| 18 | 18 | ||
| 19 | HTTP_REQUEST(1, "发起 HTTP 请求"), | 19 | HTTP_REQUEST(1, "发起 HTTP 请求"), |
| 20 | - UPDATE_NORMAL_FORM(2, "更新流程表单"); | ||
| 21 | - | 20 | + UPDATE_NORMAL_FORM(2, "更新流程表单"); // TODO @jason:FORM_UPDATE |
| 22 | 21 | ||
| 23 | /** | 22 | /** |
| 24 | * 触发器执行动作类型 | 23 | * 触发器执行动作类型 |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/simple/BpmSimpleModelNodeVO.java
| @@ -345,6 +345,8 @@ public class BpmSimpleModelNodeVO { | @@ -345,6 +345,8 @@ public class BpmSimpleModelNodeVO { | ||
| 345 | @Valid | 345 | @Valid |
| 346 | private HttpRequestTriggerSetting httpRequestSetting; | 346 | private HttpRequestTriggerSetting httpRequestSetting; |
| 347 | 347 | ||
| 348 | + // TODO @jason:这个要不直接叫 formSetting,更好理解一点哈 | ||
| 349 | + // TODO @jason:如果搞成 List<NormalFormTriggerSetting>,是不是可以做条件组了?微信讨论哈 | ||
| 348 | /** | 350 | /** |
| 349 | * 流程表单触发器设置 | 351 | * 流程表单触发器设置 |
| 350 | */ | 352 | */ |
| @@ -376,6 +378,7 @@ public class BpmSimpleModelNodeVO { | @@ -376,6 +378,7 @@ public class BpmSimpleModelNodeVO { | ||
| 376 | */ | 378 | */ |
| 377 | @Schema(description = "请求返回处理设置", example = "[]") | 379 | @Schema(description = "请求返回处理设置", example = "[]") |
| 378 | private List<KeyValue<String, String>> response; | 380 | private List<KeyValue<String, String>> response; |
| 381 | + | ||
| 379 | } | 382 | } |
| 380 | 383 | ||
| 381 | @Schema(description = "流程表单触发器设置", example = "{}") | 384 | @Schema(description = "流程表单触发器设置", example = "{}") |
| @@ -384,6 +387,8 @@ public class BpmSimpleModelNodeVO { | @@ -384,6 +387,8 @@ public class BpmSimpleModelNodeVO { | ||
| 384 | 387 | ||
| 385 | @Schema(description = "修改的表单字段", example = "userName") | 388 | @Schema(description = "修改的表单字段", example = "userName") |
| 386 | private Map<String, Object> updateFormFields; | 389 | private Map<String, Object> updateFormFields; |
| 390 | + | ||
| 387 | } | 391 | } |
| 392 | + | ||
| 388 | } | 393 | } |
| 389 | } | 394 | } |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/trigger/BpmHttpRequestTrigger.java
| @@ -81,13 +81,14 @@ public class BpmHttpRequestTrigger implements BpmTrigger { | @@ -81,13 +81,14 @@ public class BpmHttpRequestTrigger implements BpmTrigger { | ||
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | // 4.1 判断是否需要解析返回值 | 83 | // 4.1 判断是否需要解析返回值 |
| 84 | - if (StrUtil.isEmpty(responseEntity.getBody()) || !responseEntity.getStatusCode().is2xxSuccessful() | 84 | + if (StrUtil.isEmpty(responseEntity.getBody()) |
| 85 | + || !responseEntity.getStatusCode().is2xxSuccessful() | ||
| 85 | || CollUtil.isEmpty(setting.getResponse())) { | 86 | || CollUtil.isEmpty(setting.getResponse())) { |
| 86 | return; | 87 | return; |
| 87 | } | 88 | } |
| 88 | // 4.2 解析返回值, 返回值必须符合 CommonResult 规范。 | 89 | // 4.2 解析返回值, 返回值必须符合 CommonResult 规范。 |
| 89 | - CommonResult<Map<String, Object>> respResult = JsonUtils.parseObjectQuietly(responseEntity.getBody(), | ||
| 90 | - new TypeReference<>() {}); | 90 | + CommonResult<Map<String, Object>> respResult = JsonUtils.parseObjectQuietly( |
| 91 | + responseEntity.getBody(), new TypeReference<>() {}); | ||
| 91 | if (respResult == null || !respResult.isSuccess()){ | 92 | if (respResult == null || !respResult.isSuccess()){ |
| 92 | return; | 93 | return; |
| 93 | } | 94 | } |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/trigger/BpmUpdateNormalFormTrigger.java
| @@ -9,6 +9,7 @@ import jakarta.annotation.Resource; | @@ -9,6 +9,7 @@ import jakarta.annotation.Resource; | ||
| 9 | import lombok.extern.slf4j.Slf4j; | 9 | import lombok.extern.slf4j.Slf4j; |
| 10 | import org.springframework.stereotype.Component; | 10 | import org.springframework.stereotype.Component; |
| 11 | 11 | ||
| 12 | +// TODO @jason:改成 BpmFormUpdateTrigger | ||
| 12 | /** | 13 | /** |
| 13 | * BPM 更新流程表单触发器 | 14 | * BPM 更新流程表单触发器 |
| 14 | * | 15 | * |
| @@ -39,4 +40,5 @@ public class BpmUpdateNormalFormTrigger implements BpmTrigger { | @@ -39,4 +40,5 @@ public class BpmUpdateNormalFormTrigger implements BpmTrigger { | ||
| 39 | processInstanceService.updateProcessInstanceVariables(processInstanceId, setting.getUpdateFormFields()); | 40 | processInstanceService.updateProcessInstanceVariables(processInstanceId, setting.getUpdateFormFields()); |
| 40 | } | 41 | } |
| 41 | } | 42 | } |
| 43 | + | ||
| 42 | } | 44 | } |