Commit d63e3158762033f73efcbb4937f85e8303f9edbb

Authored by YunaiV
1 parent bb798681

【代码优化】Bpm:调整 IntArrayValuable 到 ArrayValuable

yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmAutoApproveTypeEnum.java
1 package cn.iocoder.yudao.module.bpm.enums.definition; 1 package cn.iocoder.yudao.module.bpm.enums.definition;
2 2
3 -import cn.iocoder.yudao.framework.common.core.IntArrayValuable; 3 +import cn.iocoder.yudao.framework.common.core.ArrayValuable;
4 import lombok.AllArgsConstructor; 4 import lombok.AllArgsConstructor;
5 import lombok.Getter; 5 import lombok.Getter;
6 6
@@ -13,19 +13,19 @@ import java.util.Arrays; @@ -13,19 +13,19 @@ import java.util.Arrays;
13 */ 13 */
14 @Getter 14 @Getter
15 @AllArgsConstructor 15 @AllArgsConstructor
16 -public enum BpmAutoApproveTypeEnum implements IntArrayValuable { 16 +public enum BpmAutoApproveTypeEnum implements ArrayValuable<Integer> {
17 17
18 NONE(0, "不自动通过"), 18 NONE(0, "不自动通过"),
19 APPROVE_ALL(1, "仅审批一次,后续重复的审批节点均自动通过"), 19 APPROVE_ALL(1, "仅审批一次,后续重复的审批节点均自动通过"),
20 APPROVE_SEQUENT(2, "仅针对连续审批的节点自动通过"); 20 APPROVE_SEQUENT(2, "仅针对连续审批的节点自动通过");
21 21
22 - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmAutoApproveTypeEnum::getType).toArray(); 22 + public static final Integer[] ARRAYS = Arrays.stream(values()).map(BpmAutoApproveTypeEnum::getType).toArray(Integer[]::new);
23 23
24 private final Integer type; 24 private final Integer type;
25 private final String name; 25 private final String name;
26 26
27 @Override 27 @Override
28 - public int[] array() { 28 + public Integer[] array() {
29 return ARRAYS; 29 return ARRAYS;
30 } 30 }
31 31
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmDelayTimerTypeEnum.java
1 package cn.iocoder.yudao.module.bpm.enums.definition; 1 package cn.iocoder.yudao.module.bpm.enums.definition;
2 2
3 -import cn.iocoder.yudao.framework.common.core.IntArrayValuable; 3 +import cn.iocoder.yudao.framework.common.core.ArrayValuable;
4 import lombok.AllArgsConstructor; 4 import lombok.AllArgsConstructor;
5 import lombok.Getter; 5 import lombok.Getter;
6 6
@@ -13,7 +13,7 @@ import java.util.Arrays; @@ -13,7 +13,7 @@ import java.util.Arrays;
13 */ 13 */
14 @Getter 14 @Getter
15 @AllArgsConstructor 15 @AllArgsConstructor
16 -public enum BpmDelayTimerTypeEnum implements IntArrayValuable { 16 +public enum BpmDelayTimerTypeEnum implements ArrayValuable<Integer> {
17 17
18 FIXED_TIME_DURATION(1, "固定时长"), 18 FIXED_TIME_DURATION(1, "固定时长"),
19 FIXED_DATE_TIME(2, "固定日期"); 19 FIXED_DATE_TIME(2, "固定日期");
@@ -21,10 +21,10 @@ public enum BpmDelayTimerTypeEnum implements IntArrayValuable { @@ -21,10 +21,10 @@ public enum BpmDelayTimerTypeEnum implements IntArrayValuable {
21 private final Integer type; 21 private final Integer type;
22 private final String name; 22 private final String name;
23 23
24 - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmDelayTimerTypeEnum::getType).toArray(); 24 + public static final Integer[] ARRAYS = Arrays.stream(values()).map(BpmDelayTimerTypeEnum::getType).toArray(Integer[]::new);
25 25
26 @Override 26 @Override
27 - public int[] array() { 27 + public Integer[] array() {
28 return ARRAYS; 28 return ARRAYS;
29 } 29 }
30 30
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmHttpRequestParamTypeEnum.java
1 package cn.iocoder.yudao.module.bpm.enums.definition; 1 package cn.iocoder.yudao.module.bpm.enums.definition;
2 2
3 -import cn.iocoder.yudao.framework.common.core.IntArrayValuable; 3 +import cn.iocoder.yudao.framework.common.core.ArrayValuable;
4 import lombok.AllArgsConstructor; 4 import lombok.AllArgsConstructor;
5 import lombok.Getter; 5 import lombok.Getter;
6 6
@@ -13,7 +13,7 @@ import java.util.Arrays; @@ -13,7 +13,7 @@ import java.util.Arrays;
13 */ 13 */
14 @Getter 14 @Getter
15 @AllArgsConstructor 15 @AllArgsConstructor
16 -public enum BpmHttpRequestParamTypeEnum implements IntArrayValuable { 16 +public enum BpmHttpRequestParamTypeEnum implements ArrayValuable<Integer> {
17 17
18 FIXED_VALUE(1, "固定值"), 18 FIXED_VALUE(1, "固定值"),
19 FROM_FORM(2, "表单"); 19 FROM_FORM(2, "表单");
@@ -21,10 +21,10 @@ public enum BpmHttpRequestParamTypeEnum implements IntArrayValuable { @@ -21,10 +21,10 @@ public enum BpmHttpRequestParamTypeEnum implements IntArrayValuable {
21 private final Integer type; 21 private final Integer type;
22 private final String name; 22 private final String name;
23 23
24 - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmHttpRequestParamTypeEnum::getType).toArray(); 24 + public static final Integer[] ARRAYS = Arrays.stream(values()).map(BpmHttpRequestParamTypeEnum::getType).toArray(Integer[]::new);
25 25
26 @Override 26 @Override
27 - public int[] array() { 27 + public Integer[] array() {
28 return ARRAYS; 28 return ARRAYS;
29 } 29 }
30 30
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmTriggerTypeEnum.java
1 package cn.iocoder.yudao.module.bpm.enums.definition; 1 package cn.iocoder.yudao.module.bpm.enums.definition;
2 2
3 import cn.hutool.core.util.ArrayUtil; 3 import cn.hutool.core.util.ArrayUtil;
4 -import cn.iocoder.yudao.framework.common.core.IntArrayValuable; 4 +import cn.iocoder.yudao.framework.common.core.ArrayValuable;
5 import lombok.AllArgsConstructor; 5 import lombok.AllArgsConstructor;
6 import lombok.Getter; 6 import lombok.Getter;
7 7
@@ -14,7 +14,7 @@ import java.util.Arrays; @@ -14,7 +14,7 @@ import java.util.Arrays;
14 */ 14 */
15 @Getter 15 @Getter
16 @AllArgsConstructor 16 @AllArgsConstructor
17 -public enum BpmTriggerTypeEnum implements IntArrayValuable { 17 +public enum BpmTriggerTypeEnum implements ArrayValuable<Integer> {
18 18
19 HTTP_REQUEST(1, "发起 HTTP 请求"); 19 HTTP_REQUEST(1, "发起 HTTP 请求");
20 20
@@ -28,14 +28,15 @@ public enum BpmTriggerTypeEnum implements IntArrayValuable { @@ -28,14 +28,15 @@ public enum BpmTriggerTypeEnum implements IntArrayValuable {
28 */ 28 */
29 private final String desc; 29 private final String desc;
30 30
31 - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmTriggerTypeEnum::getType).toArray(); 31 + public static final Integer[] ARRAYS = Arrays.stream(values()).map(BpmTriggerTypeEnum::getType).toArray(Integer[]::new);
32 32
33 @Override 33 @Override
34 - public int[] array() { 34 + public Integer[] array() {
35 return ARRAYS; 35 return ARRAYS;
36 } 36 }
37 37
38 public static BpmTriggerTypeEnum typeOf(Integer type) { 38 public static BpmTriggerTypeEnum typeOf(Integer type) {
39 return ArrayUtil.firstMatch(item -> item.getType().equals(type), values()); 39 return ArrayUtil.firstMatch(item -> item.getType().equals(type), values());
40 } 40 }
  41 +
41 } 42 }