diff --git a/src/main/java/com/example/liteflow/mysql/LiteFlowCommand.java b/src/main/java/com/example/liteflow/mysql/LiteFlowCommand.java deleted file mode 100644 index e51d12c..0000000 --- a/src/main/java/com/example/liteflow/mysql/LiteFlowCommand.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.example.liteflow.mysql; - -import cn.hutool.core.util.RandomUtil; -import cn.hutool.json.JSONUtil; -import com.example.liteflow.mysql.model.BaseCenter; -import com.example.liteflow.mysql.model.CostCenter; -import com.example.liteflow.mysql.model.ProfitCenter; -import com.yomahub.liteflow.core.FlowExecutor; -import com.yomahub.liteflow.flow.LiteflowResponse; -import org.assertj.core.util.Lists; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; - -@Component -public class LiteFlowCommand -// implements CommandLineRunner -{ - - private final Logger log = LoggerFactory.getLogger(this.getClass()); - - @Resource - private FlowExecutor flowExecutor; - - private final List chainNameList = Lists.newArrayList("cost01AndCost02", "cost01", "cost02", "profit01AndProfit02", "profit01", "profit02"); - private final List profitCenterList = Lists.newArrayList("profit01AndProfit02", "profit01", "profit02"); - private final List costCenterList = Lists.newArrayList("cost01AndCost02", "cost01", "cost02"); - -// @Override - public void run1(String... args) throws Exception { - // 事实对象 -// CostCenter costCenter = new CostCenter(); -// costCenter.setSectionClassification("成本科目1"); -// costCenter.setBusinessType("货代"); -// costCenter.setSalesman("仓干配物流部(物流)"); -// costCenter.setBusinessCategory("全货船业务"); -// -// ProfitCenter profitCenter = new ProfitCenter(); -// profitCenter.setBusinessType("货代"); -// profitCenter.setSalesman("商品车物流部(物流)"); -// profitCenter.setBusinessCategory("运输业务"); -// profitCenter.setSectionClassification("银行科目"); - // 数据库匹配 -// LiteflowResponse response = flowExecutor.execute2Resp("costCenter", costCenter, CostCenterContext.class); - // xml匹配 -// LiteflowResponse response = flowExecutor.execute2Resp("mainChain", costCenter, CostCenterContext.class); -// LiteflowResponse response = flowExecutor.execute2Resp("cost01AndCost02", costCenter); -// LiteflowResponse response = flowExecutor.execute2Resp("cost01", costCenter); -// LiteflowResponse response = flowExecutor.execute2Resp("cost02", costCenter); -// LiteflowResponse response = flowExecutor.execute2Resp("profit01AndProfit02", profitCenter); -// LiteflowResponse response = flowExecutor.execute2Resp("profit01", profitCenter); - - List list = this.generateCostCenterTestData(); - log.info("before-list = {}", JSONUtil.toJsonStr(list)); - list.forEach(item -> { - int randomInt = RandomUtil.randomInt(0, 5); - String s = chainNameList.get(randomInt); - System.out.println("s = " + s); - LiteflowResponse response = flowExecutor.execute2Resp("costAndProfit", item); -// response = flowExecutor.execute2Resp("profit01AndProfit02", item); - -// if (costCenterList.contains(s)) { -// randomInt = RandomUtil.randomInt(0, 2); -// response = flowExecutor.execute2Resp(profitCenterList.get(randomInt), item); -// } else { -// randomInt = RandomUtil.randomInt(0, 2); -// response = flowExecutor.execute2Resp(costCenterList.get(randomInt), item); -// } - if (response.isSuccess()) { - log.info("执行成功"); - } else { - log.info("执行失败"); - } - }); - log.info("after-list = {}", JSONUtil.toJsonStr(list)); - -// log.info("costCenter = {}", JSONUtil.toJsonStr(costCenter)); -// log.info("profitCenter = {}", JSONUtil.toJsonStr(profitCenter)); - - -// CostCenterContext costCenterContext = response.getFirstContextBean(); -// String code = costCenterContext.getCode(); -// String name = costCenterContext.getName(); -// String generateCode = costCenterContext.getGenerateCode(); -// costCenter.setCode(code); -// costCenter.setName(name); -// costCenter.setGenerateCode(generateCode); -// log.info(JSONUtil.toJsonStr(costCenter)); -// if (response.isSuccess()) { -// log.info("执行成功"); -// } else { -// log.info("执行失败"); -// } - - } - - private List generateCostCenterTestData() { - List list = new ArrayList<>(); - CostCenter costCenter = new CostCenter(); - costCenter.setSectionClassification("成本科目"); - costCenter.setBusinessType("货代"); - costCenter.setSalesman("仓干配物流部(物流)"); - costCenter.setBusinessCategory("全货船业务"); - list.add(costCenter); - - costCenter = new CostCenter(); - costCenter.setBusinessType("货代"); - costCenter.setSalesman("仓干配物流部(物流)"); - list.add(costCenter); - - costCenter = new CostCenter(); - costCenter.setBusinessType("货代"); - list.add(costCenter); - - ProfitCenter profitCenter = new ProfitCenter(); - profitCenter.setSectionClassification("银行科目"); - profitCenter.setBusinessType("货代"); - profitCenter.setSalesman("商品车物流部(物流)"); - profitCenter.setBusinessCategory("运输业务"); - list.add(profitCenter); - - profitCenter = new ProfitCenter(); - profitCenter.setBusinessType("货代"); - profitCenter.setSalesman("商品车物流部(物流)"); - list.add(profitCenter); - - return list; - } -} diff --git a/src/main/java/com/example/liteflow/mysql/model/CostCenter.java b/src/main/java/com/example/liteflow/mysql/model/CostCenter.java deleted file mode 100644 index c6a8fd4..0000000 --- a/src/main/java/com/example/liteflow/mysql/model/CostCenter.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.example.liteflow.mysql.model; - -import lombok.Data; - -/** - * @author: 陈韦龙 - * @date: 2022年07月06日 12:08 - */ -@Data -public class CostCenter extends BaseCenter { -} diff --git a/src/main/java/com/example/liteflow/mysql/model/ProfitCenter.java b/src/main/java/com/example/liteflow/mysql/model/ProfitCenter.java deleted file mode 100644 index fc1da93..0000000 --- a/src/main/java/com/example/liteflow/mysql/model/ProfitCenter.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.example.liteflow.mysql.model; - -import lombok.Data; - -/** - * @author 陈韦龙 - * @date 2022/07/01/ 15:41 - */ -@Data -public class ProfitCenter extends BaseCenter { -} diff --git a/src/main/java/com/example/liteflow/mysql/service/impl/BaseChainServiceImpl.java b/src/main/java/com/example/liteflow/mysql/service/impl/BaseChainServiceImpl.java index d59adac..df92459 100644 --- a/src/main/java/com/example/liteflow/mysql/service/impl/BaseChainServiceImpl.java +++ b/src/main/java/com/example/liteflow/mysql/service/impl/BaseChainServiceImpl.java @@ -11,12 +11,10 @@ import com.example.liteflow.mysql.entity.BaseNodeEntity; import com.example.liteflow.mysql.entity.BaseTemplateEntity; import com.example.liteflow.mysql.enums.EnableMarkEnum; import com.example.liteflow.mysql.enums.NodeEnum; +import com.example.liteflow.mysql.mapper.BaseChainMapper; import com.example.liteflow.mysql.model.BaseCenter; import com.example.liteflow.mysql.model.CommonResult; -import com.example.liteflow.mysql.model.CostCenter; -import com.example.liteflow.mysql.model.ProfitCenter; import com.example.liteflow.mysql.service.BaseChainService; -import com.example.liteflow.mysql.mapper.BaseChainMapper; import com.example.liteflow.mysql.service.BaseNodeService; import com.example.liteflow.mysql.service.BaseTemplateService; import com.yomahub.liteflow.builder.LiteFlowNodeBuilder; @@ -32,14 +30,14 @@ import java.util.*; import java.util.stream.Collectors; /** -* @author 75349 -* @description 针对表【base_chain】的数据库操作Service实现 -* @createDate 2022-12-14 15:25:39 -*/ + * @author 75349 + * @description 针对表【base_chain】的数据库操作Service实现 + * @createDate 2022-12-14 15:25:39 + */ @Service @Slf4j public class BaseChainServiceImpl extends ServiceImpl - implements BaseChainService{ + implements BaseChainService { @Resource private BaseTemplateService baseTemplateService; @Resource @@ -295,30 +293,30 @@ public class BaseChainServiceImpl extends ServiceImpl generateCostCenterTestData() { List list = new ArrayList<>(); - CostCenter costCenter = new CostCenter(); + BaseCenter costCenter = new BaseCenter(); costCenter.setSectionClassification("成本科目"); costCenter.setBusinessType("货代"); costCenter.setSalesman("仓干配物流部(物流)"); costCenter.setBusinessCategory("全货船业务"); list.add(costCenter); - costCenter = new CostCenter(); + costCenter = new BaseCenter(); costCenter.setBusinessType("货代"); costCenter.setSalesman("仓干配物流部(物流)"); list.add(costCenter); - costCenter = new CostCenter(); + costCenter = new BaseCenter(); costCenter.setBusinessType("货代"); list.add(costCenter); - ProfitCenter profitCenter = new ProfitCenter(); + BaseCenter profitCenter = new BaseCenter(); profitCenter.setSectionClassification("银行科目"); profitCenter.setBusinessType("货代"); profitCenter.setSalesman("商品车物流部(物流)"); profitCenter.setBusinessCategory("运输业务"); list.add(profitCenter); - profitCenter = new ProfitCenter(); + profitCenter = new BaseCenter(); profitCenter.setBusinessType("货代"); profitCenter.setSalesman("商品车物流部(物流)"); list.add(profitCenter);