diff --git a/README.md b/README.md index 81610385042a52a41b4567401bda75fce9d0a970..16f3f6da36bff48cda3b4e2f308d84c7d60b7055 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 10679c9dd934dc744d7d89220231a4de66964e8a..ec44073d41431713c5c877e59bf26610b9a5bb1e 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 b5983610741ed3931f6fdbd1b5cfea887ae3dcff..6d26cc4347427db5cca5aeb4cc0f4d4769ab4cc4 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 2d77bc7f95e494fd712f2ed6fe27f4f4543f6c56..6f06ae602132056ec8ac65856931db2280a9962a 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 22aba7f72bc58c21ad0e659aba12b0563ac95181..4ab1f8073d699ecaf4ee771b39f0a3853dd23e9a 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 9c395c7e4a463c033b20146b51b2bd25808aab5a..b662f6eb283b9803c11cdc302e968ebfe9346830 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 2bcdbe8270701e1f4fee3f6040aceac7b6cb1590..3b5b9c2a0117db84d8244f6802e5e9e0d0328ec6 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 141b94d68560845695ee82f166d6e7944109eea7..cfd0f104840d15e041e0fa926519eddd29ac22dd 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 ac3693eaa6577485279d3d489b3ef3f891c6b528..300349e8a4125ce005d86eafa1bcb10bc6920cd4 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 67a162a1b2d918b1dd4e4d4a231b67e3638aff0b..c996bbb1ced7fd7b4885070726a0ec3d5f702eba 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 4a90c641709a35f7c7a5b9df5f19b5aabd1f3878..e4ecdef2c2ec6ac74df69440716ad95809268698 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 d74f762e6cc7a41fe726300395ee87d19b4f6e35..1dda6680ac2a4c45e53b3af315a55c9c2a335caf 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);