From 38fe423867c5de72b25f37deedbb79afb4cfa14a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A6=82=E6=A2=A6=E6=8A=80=E6=9C=AF?= <596392912@qq.com>
Date: Fri, 5 Jul 2024 14:17:18 +0800
Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E4=BE=9D=E8=B5=96=E5=8D=87?=
=?UTF-8?q?=E7=BA=A7=E5=92=8C=E4=BD=BF=E7=94=A8=E5=86=85=E7=BD=AE=20hutool?=
=?UTF-8?q?=20=E5=B7=A5=E5=85=B7=E7=B1=BB=E7=B2=BE=E7=AE=80=E4=BE=9D?=
=?UTF-8?q?=E8=B5=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 2 +-
pom.xml | 34 +++----------------
.../example/bean/PromotionPackVO.java | 3 --
.../example/component/FullCutCmp.java | 4 +--
.../example/component/FullDiscountCmp.java | 4 +--
.../liteflow/example/component/InitCmps.java | 8 ++---
.../example/component/MemberDiscountCmp.java | 8 ++---
.../example/component/PriceResultCmp.java | 4 +--
.../component/PromotionConvertCmp.java | 28 +++++++--------
.../example/component/RushBuyCmp.java | 4 +--
.../example/component/StepPrintCmp.java | 6 ++--
.../liteflow/example/slot/PriceContext.java | 4 +--
12 files changed, 36 insertions(+), 73 deletions(-)
diff --git a/README.md b/README.md
index 8161038..16f3f6d 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,3 @@
此工程是[LiteFlow](https://gitee.com/dromara/liteFlow)框架的示例工程。
-master目前是基于v2.8.0版本的
\ No newline at end of file
+master目前是基于v2.12.1版本的
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 10679c9..ec44073 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,8 +15,7 @@
example project for liteflow
- 3.4
- 4.1
+ 2.12.1
@@ -24,42 +23,20 @@
org.springframework.boot
spring-boot-starter-web
-
- org.apache.commons
- commons-lang3
- ${commons.lang3.version}
-
-
-
- org.apache.commons
- commons-collections4
- ${commons-collections.version}
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
-
com.yomahub
liteflow-spring-boot-starter
- 2.12.1
+ ${liteflow.version}
-
com.yomahub
liteflow-script-groovy
- 2.12.1
-
-
- org.springframework.boot
- spring-boot-starter-thymeleaf
+ ${liteflow.version}
-
-
- net.bytebuddy
- byte-buddy
- 1.14.10
-
-
-
com.alibaba
fastjson
@@ -69,7 +46,6 @@
liteflow-example
-
org.springframework.boot
diff --git a/src/main/java/com/yomahub/liteflow/example/bean/PromotionPackVO.java b/src/main/java/com/yomahub/liteflow/example/bean/PromotionPackVO.java
index b598361..6d26cc4 100644
--- a/src/main/java/com/yomahub/liteflow/example/bean/PromotionPackVO.java
+++ b/src/main/java/com/yomahub/liteflow/example/bean/PromotionPackVO.java
@@ -1,8 +1,5 @@
package com.yomahub.liteflow.example.bean;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-
import java.util.List;
public class PromotionPackVO extends PromotionInfoVO{
diff --git a/src/main/java/com/yomahub/liteflow/example/component/FullCutCmp.java b/src/main/java/com/yomahub/liteflow/example/component/FullCutCmp.java
index 2d77bc7..6f06ae6 100644
--- a/src/main/java/com/yomahub/liteflow/example/component/FullCutCmp.java
+++ b/src/main/java/com/yomahub/liteflow/example/component/FullCutCmp.java
@@ -1,5 +1,6 @@
package com.yomahub.liteflow.example.component;
+import cn.hutool.core.collection.CollUtil;
import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.example.bean.PriceStepVO;
import com.yomahub.liteflow.example.bean.ProductPackVO;
@@ -7,7 +8,6 @@ import com.yomahub.liteflow.example.bean.PromotionPackVO;
import com.yomahub.liteflow.example.enums.PriceTypeEnum;
import com.yomahub.liteflow.example.enums.PromotionTypeEnum;
import com.yomahub.liteflow.example.slot.PriceContext;
-import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
@@ -69,7 +69,7 @@ public class FullCutCmp extends NodeComponent {
}
}).collect(Collectors.toList());
- if(CollectionUtils.isNotEmpty(matchList)){
+ if(CollUtil.isNotEmpty(matchList)){
return matchList.get(0);
}else{
return null;
diff --git a/src/main/java/com/yomahub/liteflow/example/component/FullDiscountCmp.java b/src/main/java/com/yomahub/liteflow/example/component/FullDiscountCmp.java
index 22aba7f..4ab1f80 100644
--- a/src/main/java/com/yomahub/liteflow/example/component/FullDiscountCmp.java
+++ b/src/main/java/com/yomahub/liteflow/example/component/FullDiscountCmp.java
@@ -1,5 +1,6 @@
package com.yomahub.liteflow.example.component;
+import cn.hutool.core.collection.CollUtil;
import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.example.bean.PriceStepVO;
import com.yomahub.liteflow.example.bean.ProductPackVO;
@@ -7,7 +8,6 @@ import com.yomahub.liteflow.example.bean.PromotionPackVO;
import com.yomahub.liteflow.example.enums.PriceTypeEnum;
import com.yomahub.liteflow.example.enums.PromotionTypeEnum;
import com.yomahub.liteflow.example.slot.PriceContext;
-import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
@@ -70,7 +70,7 @@ public class FullDiscountCmp extends NodeComponent {
}
}).collect(Collectors.toList());
- if(CollectionUtils.isNotEmpty(matchList)){
+ if(CollUtil.isNotEmpty(matchList)){
return matchList.get(0);
}else{
return null;
diff --git a/src/main/java/com/yomahub/liteflow/example/component/InitCmps.java b/src/main/java/com/yomahub/liteflow/example/component/InitCmps.java
index 9c395c7..b662f6e 100644
--- a/src/main/java/com/yomahub/liteflow/example/component/InitCmps.java
+++ b/src/main/java/com/yomahub/liteflow/example/component/InitCmps.java
@@ -1,5 +1,6 @@
package com.yomahub.liteflow.example.component;
+import cn.hutool.core.collection.CollUtil;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.annotation.LiteflowMethod;
import com.yomahub.liteflow.core.NodeComponent;
@@ -9,7 +10,6 @@ import com.yomahub.liteflow.example.bean.PriceStepVO;
import com.yomahub.liteflow.example.bean.ProductPackVO;
import com.yomahub.liteflow.example.enums.PriceTypeEnum;
import com.yomahub.liteflow.example.slot.PriceContext;
-import org.apache.commons.collections4.CollectionUtils;
import java.math.BigDecimal;
import java.util.List;
@@ -69,10 +69,6 @@ public class InitCmps {
@LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "priceStepInitCmp")
public boolean accessPriceStepInitCmp(NodeComponent bindCmp){
PriceContext context = bindCmp.getContextBean(PriceContext.class);
- if(CollectionUtils.isNotEmpty(context.getProductPackList())){
- return true;
- }else{
- return false;
- }
+ return CollUtil.isNotEmpty(context.getProductPackList());
}
}
diff --git a/src/main/java/com/yomahub/liteflow/example/component/MemberDiscountCmp.java b/src/main/java/com/yomahub/liteflow/example/component/MemberDiscountCmp.java
index 2bcdbe8..3b5b9c2 100644
--- a/src/main/java/com/yomahub/liteflow/example/component/MemberDiscountCmp.java
+++ b/src/main/java/com/yomahub/liteflow/example/component/MemberDiscountCmp.java
@@ -1,11 +1,11 @@
package com.yomahub.liteflow.example.component;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.example.bean.PriceStepVO;
import com.yomahub.liteflow.example.enums.PriceTypeEnum;
import com.yomahub.liteflow.example.slot.PriceContext;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
@@ -41,8 +41,8 @@ public class MemberDiscountCmp extends NodeComponent {
@Override
public boolean isAccess() {
PriceContext context = this.getContextBean(PriceContext.class);
- if(CollectionUtils.isNotEmpty(context.getProductPackList())
- && StringUtils.isNotBlank(context.getMemberCode())){
+ if(CollUtil.isNotEmpty(context.getProductPackList())
+ && StrUtil.isNotBlank(context.getMemberCode())){
return true;
}else{
return false;
diff --git a/src/main/java/com/yomahub/liteflow/example/component/PriceResultCmp.java b/src/main/java/com/yomahub/liteflow/example/component/PriceResultCmp.java
index 141b94d..cfd0f10 100644
--- a/src/main/java/com/yomahub/liteflow/example/component/PriceResultCmp.java
+++ b/src/main/java/com/yomahub/liteflow/example/component/PriceResultCmp.java
@@ -1,9 +1,9 @@
package com.yomahub.liteflow.example.component;
+import cn.hutool.core.collection.CollUtil;
import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.example.bean.PriceStepVO;
import com.yomahub.liteflow.example.slot.PriceContext;
-import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
@@ -27,7 +27,7 @@ public class PriceResultCmp extends NodeComponent {
@Override
public boolean isAccess() {
PriceContext context = this.getContextBean(PriceContext.class);
- if(CollectionUtils.isNotEmpty(context.getPriceStepList())){
+ if(CollUtil.isNotEmpty(context.getPriceStepList())){
return true;
}else{
return false;
diff --git a/src/main/java/com/yomahub/liteflow/example/component/PromotionConvertCmp.java b/src/main/java/com/yomahub/liteflow/example/component/PromotionConvertCmp.java
index ac3693e..300349e 100644
--- a/src/main/java/com/yomahub/liteflow/example/component/PromotionConvertCmp.java
+++ b/src/main/java/com/yomahub/liteflow/example/component/PromotionConvertCmp.java
@@ -1,14 +1,15 @@
package com.yomahub.liteflow.example.component;
+import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.example.bean.ProductPackVO;
import com.yomahub.liteflow.example.bean.PromotionInfoVO;
import com.yomahub.liteflow.example.bean.PromotionPackVO;
import com.yomahub.liteflow.example.slot.PriceContext;
-import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
+import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.List;
@@ -23,23 +24,23 @@ public class PromotionConvertCmp extends NodeComponent {
PriceContext context = this.getContextBean(PriceContext.class);
List promotionPackList = new ArrayList<>();
- PromotionPackVO promotionPack = null;
- for(ProductPackVO pack : context.getProductPackList()){
- if(CollectionUtils.isEmpty(pack.getPromotionList())){
+ PromotionPackVO promotionPack;
+ for (ProductPackVO pack : context.getProductPackList()) {
+ if (ObjectUtils.isEmpty(pack.getPromotionList())) {
continue;
}
- for(PromotionInfoVO promotion : pack.getPromotionList()){
+ for (PromotionInfoVO promotion : pack.getPromotionList()) {
promotionPack = new PromotionPackVO();
promotionPack.setId(promotion.getId());
- if(promotionPackList.contains(promotionPack)){
+ if (promotionPackList.contains(promotionPack)) {
promotionPack = promotionPackList.get(promotionPackList.indexOf(promotionPack));
- if(promotionPack.getRelatedProductPackList().contains(pack)){
+ if (promotionPack.getRelatedProductPackList().contains(pack)) {
continue;
- }else{
+ } else {
promotionPack.getRelatedProductPackList().add(pack);
}
- }else{
- BeanUtils.copyProperties(promotion,promotionPack);
+ } else {
+ BeanUtils.copyProperties(promotion, promotionPack);
promotionPack.setRelatedProductPackList(ListUtil.toList(pack));
promotionPackList.add(promotionPack);
}
@@ -51,11 +52,6 @@ public class PromotionConvertCmp extends NodeComponent {
@Override
public boolean isAccess() {
PriceContext context = this.getContextBean(PriceContext.class);
- if(CollectionUtils.isNotEmpty(context.getProductPackList())){
- return true;
- }else{
- return false;
- }
-
+ return CollUtil.isNotEmpty(context.getProductPackList());
}
}
diff --git a/src/main/java/com/yomahub/liteflow/example/component/RushBuyCmp.java b/src/main/java/com/yomahub/liteflow/example/component/RushBuyCmp.java
index 67a162a..c996bbb 100644
--- a/src/main/java/com/yomahub/liteflow/example/component/RushBuyCmp.java
+++ b/src/main/java/com/yomahub/liteflow/example/component/RushBuyCmp.java
@@ -1,5 +1,6 @@
package com.yomahub.liteflow.example.component;
+import cn.hutool.core.collection.CollUtil;
import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.example.bean.PriceStepVO;
import com.yomahub.liteflow.example.bean.ProductPackVO;
@@ -7,7 +8,6 @@ import com.yomahub.liteflow.example.bean.PromotionPackVO;
import com.yomahub.liteflow.example.enums.PriceTypeEnum;
import com.yomahub.liteflow.example.enums.PromotionTypeEnum;
import com.yomahub.liteflow.example.slot.PriceContext;
-import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
@@ -72,7 +72,7 @@ public class RushBuyCmp extends NodeComponent {
}
}).collect(Collectors.toList());
- if(CollectionUtils.isNotEmpty(matchList)){
+ if(CollUtil.isNotEmpty(matchList)){
return matchList.get(0);
}else{
return null;
diff --git a/src/main/java/com/yomahub/liteflow/example/component/StepPrintCmp.java b/src/main/java/com/yomahub/liteflow/example/component/StepPrintCmp.java
index 4a90c64..e4ecdef 100644
--- a/src/main/java/com/yomahub/liteflow/example/component/StepPrintCmp.java
+++ b/src/main/java/com/yomahub/liteflow/example/component/StepPrintCmp.java
@@ -1,14 +1,12 @@
package com.yomahub.liteflow.example.component;
+import cn.hutool.core.collection.CollUtil;
import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.example.bean.PriceStepVO;
import com.yomahub.liteflow.example.bean.ProductPackVO;
import com.yomahub.liteflow.example.slot.PriceContext;
import com.yomahub.liteflow.log.LFLog;
import com.yomahub.liteflow.log.LFLoggerManager;
-import org.apache.commons.collections4.CollectionUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
@@ -52,7 +50,7 @@ public class StepPrintCmp extends NodeComponent {
@Override
public boolean isAccess() {
PriceContext context = this.getContextBean(PriceContext.class);
- if(CollectionUtils.isNotEmpty(context.getPriceStepList())){
+ if(CollUtil.isNotEmpty(context.getPriceStepList())){
return true;
}else{
return false;
diff --git a/src/main/java/com/yomahub/liteflow/example/slot/PriceContext.java b/src/main/java/com/yomahub/liteflow/example/slot/PriceContext.java
index d74f762..1dda668 100644
--- a/src/main/java/com/yomahub/liteflow/example/slot/PriceContext.java
+++ b/src/main/java/com/yomahub/liteflow/example/slot/PriceContext.java
@@ -1,10 +1,10 @@
package com.yomahub.liteflow.example.slot;
+import cn.hutool.core.collection.CollUtil;
import com.yomahub.liteflow.example.bean.PriceStepVO;
import com.yomahub.liteflow.example.bean.ProductPackVO;
import com.yomahub.liteflow.example.bean.PromotionPackVO;
import com.yomahub.liteflow.example.enums.OrderChannelEnum;
-import org.apache.commons.collections4.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
@@ -68,7 +68,7 @@ public class PriceContext {
private String printLog;
public PriceStepVO getLastestPriceStep(){
- if(CollectionUtils.isEmpty(priceStepList)){
+ if(CollUtil.isEmpty(priceStepList)){
return null;
}else{
return priceStepList.get(priceStepList.size()-1);
--
Gitee