1.更改传参类型
This commit is contained in:
parent
51d3c5b57c
commit
1f33bb61cd
|
@ -1,18 +1,23 @@
|
|||
package com.example.liteflow.mysql;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.json.JSON;
|
||||
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.CostCenterContext;
|
||||
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.boot.CommandLineRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class LiteFlowCommand implements CommandLineRunner {
|
||||
|
@ -22,20 +27,25 @@ public class LiteFlowCommand implements CommandLineRunner {
|
|||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
private final List<String> chainNameList = Lists.newArrayList("cost01AndCost02", "cost01", "cost02", "profit01AndProfit02", "profit01", "profit02");
|
||||
private final List<String> profitCenterList = Lists.newArrayList("profit01AndProfit02", "profit01", "profit02");
|
||||
private final List<String> costCenterList = Lists.newArrayList("cost01AndCost02", "cost01", "cost02");
|
||||
|
||||
|
||||
@Override
|
||||
public void run(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("银行科目");
|
||||
// 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匹配
|
||||
|
@ -45,10 +55,31 @@ public class LiteFlowCommand implements CommandLineRunner {
|
|||
// LiteflowResponse response = flowExecutor.execute2Resp("cost02", costCenter);
|
||||
// LiteflowResponse response = flowExecutor.execute2Resp("profit01AndProfit02", profitCenter);
|
||||
// LiteflowResponse response = flowExecutor.execute2Resp("profit01", profitCenter);
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("profit02", profitCenter);
|
||||
|
||||
log.info("costCenter = {}", JSONUtil.toJsonStr(costCenter));
|
||||
log.info("profitCenter = {}", JSONUtil.toJsonStr(profitCenter));
|
||||
List<BaseCenter> 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(s, 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();
|
||||
|
@ -59,11 +90,44 @@ public class LiteFlowCommand implements CommandLineRunner {
|
|||
// costCenter.setName(name);
|
||||
// costCenter.setGenerateCode(generateCode);
|
||||
// log.info(JSONUtil.toJsonStr(costCenter));
|
||||
if (response.isSuccess()) {
|
||||
log.info("执行成功");
|
||||
} else {
|
||||
log.info("执行失败");
|
||||
}
|
||||
// if (response.isSuccess()) {
|
||||
// log.info("执行成功");
|
||||
// } else {
|
||||
// log.info("执行失败");
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
private List<BaseCenter> generateCostCenterTestData() {
|
||||
List<BaseCenter> 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.example.liteflow.mysql.cmp;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.example.liteflow.mysql.model.BaseCenter;
|
||||
import com.example.liteflow.mysql.model.CostCenter;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
|
@ -9,7 +11,7 @@ public class SoutCmp extends NodeComponent {
|
|||
|
||||
@Override
|
||||
public void process() {
|
||||
CostCenter costCenter = this.getRequestData();
|
||||
BaseCenter requestData = this.getRequestData();
|
||||
// LinkedHashMap<String, String> map = new LinkedHashMap<>();
|
||||
// Field[] fields = ReflectUtil.getFields(CostCenter.class);
|
||||
// for (Field field : fields) {
|
||||
|
@ -19,14 +21,12 @@ public class SoutCmp extends NodeComponent {
|
|||
// }
|
||||
// System.out.println(JsonUtil.toJsonString(map));
|
||||
|
||||
// String code = costCenter.getCode();
|
||||
// String name = costCenter.getName();
|
||||
// String generateCode = costCenter.getGenerateCode();
|
||||
//
|
||||
// if (StrUtil.isBlank(code) && StrUtil.isBlank(name) && StrUtil.isBlank(generateCode)) {
|
||||
// costCenter.setGenerateCode("无匹配项");
|
||||
// }
|
||||
costCenter.setGenerateCode("无匹配项");
|
||||
String costCenterGenerateCode = requestData.getCostCenterGenerateCode();
|
||||
String profitCenterGenerateCode = requestData.getProfitCenterGenerateCode();
|
||||
|
||||
if (StrUtil.isBlank(costCenterGenerateCode) && StrUtil.isBlank(profitCenterGenerateCode)) {
|
||||
requestData.setGenerateCode("无匹配项");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,10 +5,12 @@ import cn.hutool.core.util.BooleanUtil;
|
|||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSON;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.example.liteflow.mysql.entity.BaseDataEntity;
|
||||
import com.example.liteflow.mysql.enums.BaseDataAttributionEnum;
|
||||
import com.example.liteflow.mysql.model.BaseCenter;
|
||||
import com.example.liteflow.mysql.model.CostCenter;
|
||||
import com.example.liteflow.mysql.service.BaseDataService;
|
||||
import com.example.liteflow.mysql.util.ConditionParser;
|
||||
|
@ -34,9 +36,10 @@ public class CostCenter01Cmp extends NodeIfComponent {
|
|||
|
||||
@Override
|
||||
public boolean processIf() throws Exception {
|
||||
CostCenter requestData = this.getRequestData();
|
||||
BaseCenter requestData = this.getRequestData();
|
||||
log.info("requestData = {}", JSONUtil.toJsonStr(requestData));
|
||||
String droolStr = drool;
|
||||
Field[] fields = ReflectUtil.getFields(CostCenter.class);
|
||||
Field[] fields = ReflectUtil.getFields(BaseCenter.class);
|
||||
for (Field field : fields) {
|
||||
Object fieldValue = ReflectUtil.getFieldValue(requestData, field);
|
||||
String name = field.getName();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.example.liteflow.mysql.cmp.costCenter;
|
||||
|
||||
import com.example.liteflow.mysql.model.BaseCenter;
|
||||
import com.example.liteflow.mysql.model.CostCenter;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
|
@ -20,10 +21,11 @@ public class CostCenter01SoutCmp extends NodeComponent {
|
|||
|
||||
@Override
|
||||
public void process() {
|
||||
CostCenter costCenter = this.getRequestData();
|
||||
costCenter.setCode(costCenter01Code);
|
||||
costCenter.setName(costCenter01Name);
|
||||
costCenter.setGenerateCode(costCenter01Code + costCenter01Name);
|
||||
BaseCenter baseCenter = this.getRequestData();
|
||||
baseCenter.setCostCenterCode(costCenter01Code);
|
||||
baseCenter.setCostCenterName(costCenter01Name);
|
||||
baseCenter.setCostCenterGenerateCode(costCenter01Code + costCenter01Name);
|
||||
baseCenter.setGenerateCode(null);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import cn.hutool.json.JSONArray;
|
|||
import cn.hutool.json.JSONUtil;
|
||||
import com.example.liteflow.mysql.entity.BaseDataEntity;
|
||||
import com.example.liteflow.mysql.enums.BaseDataAttributionEnum;
|
||||
import com.example.liteflow.mysql.model.BaseCenter;
|
||||
import com.example.liteflow.mysql.model.CostCenter;
|
||||
import com.example.liteflow.mysql.service.BaseDataService;
|
||||
import com.example.liteflow.mysql.util.ConditionParser;
|
||||
|
@ -38,9 +39,9 @@ public class CostCenter02Cmp extends NodeIfComponent {
|
|||
private BaseDataService baseDataService;
|
||||
@Override
|
||||
public boolean processIf() throws Exception {
|
||||
CostCenter requestData = this.getRequestData();
|
||||
BaseCenter requestData = this.getRequestData();
|
||||
String droolStr = drool;
|
||||
Field[] fields = ReflectUtil.getFields(CostCenter.class);
|
||||
Field[] fields = ReflectUtil.getFields(BaseCenter.class);
|
||||
for (Field field : fields) {
|
||||
Object fieldValue = ReflectUtil.getFieldValue(requestData, field);
|
||||
String name = field.getName();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.example.liteflow.mysql.cmp.costCenter;
|
||||
|
||||
import com.example.liteflow.mysql.model.BaseCenter;
|
||||
import com.example.liteflow.mysql.model.CostCenter;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
|
@ -20,10 +21,11 @@ public class CostCenter02SoutCmp extends NodeComponent {
|
|||
|
||||
@Override
|
||||
public void process() {
|
||||
CostCenter costCenter = this.getRequestData();
|
||||
costCenter.setCode(costCenter02Code);
|
||||
costCenter.setName(costCenter02Name);
|
||||
costCenter.setGenerateCode(costCenter02Code + costCenter02Name);
|
||||
BaseCenter baseCenter = this.getRequestData();
|
||||
baseCenter.setCostCenterCode(costCenter02Code);
|
||||
baseCenter.setCostCenterName(costCenter02Name);
|
||||
baseCenter.setCostCenterGenerateCode(costCenter02Code + costCenter02Name);
|
||||
baseCenter.setGenerateCode(null);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import cn.hutool.json.JSONArray;
|
|||
import cn.hutool.json.JSONUtil;
|
||||
import com.example.liteflow.mysql.entity.BaseDataEntity;
|
||||
import com.example.liteflow.mysql.enums.BaseDataAttributionEnum;
|
||||
import com.example.liteflow.mysql.model.BaseCenter;
|
||||
import com.example.liteflow.mysql.model.CostCenter;
|
||||
import com.example.liteflow.mysql.service.BaseDataService;
|
||||
import com.example.liteflow.mysql.util.ConditionParser;
|
||||
|
@ -39,9 +40,9 @@ public class CostCenterCmp extends NodeIfComponent {
|
|||
private BaseDataService baseDataService;
|
||||
@Override
|
||||
public boolean processIf() throws Exception {
|
||||
CostCenter requestData = this.getRequestData();
|
||||
BaseCenter requestData = this.getRequestData();
|
||||
String droolStr = drool;
|
||||
Field[] fields = ReflectUtil.getFields(CostCenter.class);
|
||||
Field[] fields = ReflectUtil.getFields(BaseCenter.class);
|
||||
for (Field field : fields) {
|
||||
Object fieldValue = ReflectUtil.getFieldValue(requestData, field);
|
||||
String name = field.getName();
|
||||
|
|
|
@ -9,21 +9,16 @@ import cn.hutool.json.JSONArray;
|
|||
import cn.hutool.json.JSONUtil;
|
||||
import com.example.liteflow.mysql.entity.BaseDataEntity;
|
||||
import com.example.liteflow.mysql.enums.BaseDataAttributionEnum;
|
||||
import com.example.liteflow.mysql.model.CostCenter;
|
||||
import com.example.liteflow.mysql.model.ProfitCenter;
|
||||
import com.example.liteflow.mysql.model.BaseCenter;
|
||||
import com.example.liteflow.mysql.service.BaseDataService;
|
||||
import com.example.liteflow.mysql.util.ConditionParser;
|
||||
import com.googlecode.aviator.AviatorEvaluator;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeIfComponent;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.assertj.core.util.Lists;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author: 陈韦龙
|
||||
|
@ -39,9 +34,9 @@ public class ProfitCenter01Cmp extends NodeIfComponent {
|
|||
private BaseDataService baseDataService;
|
||||
@Override
|
||||
public boolean processIf() throws Exception {
|
||||
ProfitCenter requestData = this.getRequestData();
|
||||
BaseCenter requestData = this.getRequestData();
|
||||
String droolStr = drool;
|
||||
Field[] fields = ReflectUtil.getFields(CostCenter.class);
|
||||
Field[] fields = ReflectUtil.getFields(BaseCenter.class);
|
||||
for (Field field : fields) {
|
||||
Object fieldValue = ReflectUtil.getFieldValue(requestData, field);
|
||||
String name = field.getName();
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.example.liteflow.mysql.cmp.profitCenter;
|
||||
|
||||
import com.example.liteflow.mysql.model.CostCenter;
|
||||
import com.example.liteflow.mysql.model.ProfitCenter;
|
||||
import com.example.liteflow.mysql.model.BaseCenter;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -14,17 +13,17 @@ import lombok.extern.slf4j.Slf4j;
|
|||
@Slf4j
|
||||
public class ProfitCenter01SoutCmp extends NodeComponent {
|
||||
|
||||
private static final String profitCenter01Code = "P350401028";
|
||||
private static final String profitCenter01Name = "仓干配物流部利润中心";
|
||||
|
||||
private static final String profitCenter01Code = "P350401029";
|
||||
private static final String profitCenter01Name = "仓干配物流部成本中心";
|
||||
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
ProfitCenter profitCenter = this.getRequestData();
|
||||
profitCenter.setCode(profitCenter01Code);
|
||||
profitCenter.setName(profitCenter01Name);
|
||||
profitCenter.setGenerateCode(profitCenter01Code + profitCenter01Name);
|
||||
BaseCenter baseCenter = this.getRequestData();
|
||||
baseCenter.setProfitCenterCode(profitCenter01Code);
|
||||
baseCenter.setProfitCenterName(profitCenter01Name);
|
||||
baseCenter.setProfitCenterGenerateCode(profitCenter01Code + profitCenter01Name);
|
||||
baseCenter.setGenerateCode(null);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import cn.hutool.json.JSONArray;
|
|||
import cn.hutool.json.JSONUtil;
|
||||
import com.example.liteflow.mysql.entity.BaseDataEntity;
|
||||
import com.example.liteflow.mysql.enums.BaseDataAttributionEnum;
|
||||
import com.example.liteflow.mysql.model.BaseCenter;
|
||||
import com.example.liteflow.mysql.model.CostCenter;
|
||||
import com.example.liteflow.mysql.model.ProfitCenter;
|
||||
import com.example.liteflow.mysql.service.BaseDataService;
|
||||
|
@ -39,9 +40,9 @@ public class ProfitCenter02Cmp extends NodeIfComponent {
|
|||
private BaseDataService baseDataService;
|
||||
@Override
|
||||
public boolean processIf() throws Exception {
|
||||
ProfitCenter requestData = this.getRequestData();
|
||||
BaseCenter requestData = this.getRequestData();
|
||||
String droolStr = drool;
|
||||
Field[] fields = ReflectUtil.getFields(CostCenter.class);
|
||||
Field[] fields = ReflectUtil.getFields(BaseCenter.class);
|
||||
for (Field field : fields) {
|
||||
Object fieldValue = ReflectUtil.getFieldValue(requestData, field);
|
||||
String name = field.getName();
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.example.liteflow.mysql.cmp.profitCenter;
|
||||
|
||||
import com.example.liteflow.mysql.model.CostCenter;
|
||||
import com.example.liteflow.mysql.model.ProfitCenter;
|
||||
import com.example.liteflow.mysql.model.BaseCenter;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -14,17 +13,17 @@ import lombok.extern.slf4j.Slf4j;
|
|||
@Slf4j
|
||||
public class ProfitCenter02SoutCmp extends NodeComponent {
|
||||
|
||||
private static final String profitCenter02Code = "P350401026";
|
||||
private static final String profitCenter02Name = "商品车物流部利润中心";
|
||||
|
||||
private static final String profitCenter02Code = "P350401027";
|
||||
private static final String profitCenter02Name = "商品车物流部成本中心";
|
||||
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
ProfitCenter profitCenter = this.getRequestData();
|
||||
profitCenter.setCode(profitCenter02Code);
|
||||
profitCenter.setName(profitCenter02Name);
|
||||
profitCenter.setGenerateCode(profitCenter02Code + profitCenter02Name);
|
||||
BaseCenter baseCenter = this.getRequestData();
|
||||
baseCenter.setProfitCenterCode(profitCenter02Code);
|
||||
baseCenter.setProfitCenterName(profitCenter02Name);
|
||||
baseCenter.setProfitCenterGenerateCode(profitCenter02Code + profitCenter02Name);
|
||||
baseCenter.setGenerateCode(null);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,18 +8,16 @@ import cn.hutool.json.JSONArray;
|
|||
import cn.hutool.json.JSONUtil;
|
||||
import com.example.liteflow.mysql.entity.BaseDataEntity;
|
||||
import com.example.liteflow.mysql.enums.BaseDataAttributionEnum;
|
||||
import com.example.liteflow.mysql.model.CostCenter;
|
||||
import com.example.liteflow.mysql.model.BaseCenter;
|
||||
import com.example.liteflow.mysql.service.BaseDataService;
|
||||
import com.example.liteflow.mysql.util.ConditionParser;
|
||||
import com.googlecode.aviator.AviatorEvaluator;
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeIfComponent;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.assertj.core.util.Lists;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: 陈韦龙
|
||||
|
@ -35,9 +33,9 @@ public class ProfitCenterCmp extends NodeIfComponent {
|
|||
private BaseDataService baseDataService;
|
||||
@Override
|
||||
public boolean processIf() throws Exception {
|
||||
CostCenter requestData = this.getRequestData();
|
||||
BaseCenter requestData = this.getRequestData();
|
||||
String droolStr = drool;
|
||||
Field[] fields = ReflectUtil.getFields(CostCenter.class);
|
||||
Field[] fields = ReflectUtil.getFields(BaseCenter.class);
|
||||
for (Field field : fields) {
|
||||
Object fieldValue = ReflectUtil.getFieldValue(requestData, field);
|
||||
String name = field.getName();
|
||||
|
|
|
@ -3,12 +3,14 @@ package com.example.liteflow.mysql.entity;
|
|||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: 陈韦龙
|
||||
* @date: 2022年12月06日 09:59
|
||||
*/
|
||||
@TableName("base_data")
|
||||
@Data
|
||||
public class BaseDataEntity {
|
||||
@TableId(value = "ID", type = IdType.ASSIGN_UUID)
|
||||
|
|
|
@ -28,4 +28,12 @@ public class BaseCenter {
|
|||
private String code;
|
||||
private String name;
|
||||
private String generateCode;
|
||||
|
||||
private String costCenterCode;
|
||||
private String costCenterName;
|
||||
private String costCenterGenerateCode;
|
||||
|
||||
private String profitCenterCode;
|
||||
private String profitCenterName;
|
||||
private String profitCenterGenerateCode;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.example.liteflow.mysql.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.example.liteflow.mysql.entity.BaseDataEntity;
|
||||
import com.example.liteflow.mysql.mapper.BaseDataMapper;
|
||||
|
@ -16,9 +17,10 @@ import org.springframework.stereotype.Service;
|
|||
public class BaseDataServiceImpl extends ServiceImpl<BaseDataMapper, BaseDataEntity> implements BaseDataService {
|
||||
@Override
|
||||
public BaseDataEntity getByType(String type, String attribution) {
|
||||
return this.lambdaQuery()
|
||||
.eq(BaseDataEntity::getType, type)
|
||||
.eq(BaseDataEntity::getAttribution, attribution)
|
||||
.getEntity();
|
||||
log.info("type = {}, attribution = {}", type, attribution);
|
||||
LambdaQueryWrapper<BaseDataEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BaseDataEntity::getType, type)
|
||||
.eq(BaseDataEntity::getAttribution, attribution);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,22 +8,22 @@ spring:
|
|||
password: 123456
|
||||
|
||||
liteflow:
|
||||
rule-source: liteflow/*.el.xml
|
||||
# rule-source-ext-data-map:
|
||||
# url: jdbc:mysql://localhost:3306/test_db
|
||||
# driverClassName: com.mysql.cj.jdbc.Driver
|
||||
# username: root
|
||||
# password: 123456
|
||||
# applicationName: demo
|
||||
# #以下是chain表的配置,这个一定得有
|
||||
# chainTableName: chain
|
||||
# chainApplicationNameField: application_name
|
||||
# chainNameField: chain_name
|
||||
# elDataField: el_data
|
||||
# #以下是script表的配置,如果你没使用到脚本,下面可以不配置
|
||||
# scriptTableName: script
|
||||
# scriptApplicationNameField: application_name
|
||||
# scriptIdField: script_id
|
||||
# scriptNameField: script_name
|
||||
# scriptDataField: script_data
|
||||
# scriptTypeField: script_type
|
||||
# rule-source: liteflow/*.el.xml
|
||||
rule-source-ext-data-map:
|
||||
url: jdbc:mysql://localhost:3306/test_db
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
username: root
|
||||
password: 123456
|
||||
applicationName: demo
|
||||
#以下是chain表的配置,这个一定得有
|
||||
chainTableName: chain
|
||||
chainApplicationNameField: application_name
|
||||
chainNameField: chain_name
|
||||
elDataField: el_data
|
||||
#以下是script表的配置,如果你没使用到脚本,下面可以不配置
|
||||
scriptTableName: script
|
||||
scriptApplicationNameField: application_name
|
||||
scriptIdField: script_id
|
||||
scriptNameField: script_name
|
||||
scriptDataField: script_data
|
||||
scriptTypeField: script_type
|
||||
|
|
|
@ -37,16 +37,13 @@ INSERT INTO `script`(`id`, `application_name`, `script_id`, `script_name`, `scri
|
|||
CREATE TABLE `base_data` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`type` varchar(30) NULL,
|
||||
`attribution` varchar(30) NULL,
|
||||
`content` text NULL,
|
||||
`content_type` varchar(30) NULL,
|
||||
`content_name` varchar(30) NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
ALTER TABLE `base_data`
|
||||
ADD COLUMN `content_name` varchar(30) NULL AFTER `content_type`;
|
||||
|
||||
ALTER TABLE `base_data`
|
||||
ADD COLUMN `attribution` varchar(30) NULL AFTER `type`;
|
||||
|
||||
INSERT INTO `base_data`(`id`, `type`, `attribution`, `content`, `content_type`, `content_name`) VALUES ('0927941726325838', 'sectionClassification', 'costCenter', '[银行科目, 预付科目, 预收科目]', 'List', 'sectionClassificationList');
|
||||
INSERT INTO `base_data`(`id`, `type`, `attribution`, `content`, `content_type`, `content_name`) VALUES ('3927088550655742', 'businessCategory', 'costCenter', '[运输业务, 全货船业务, 进出岛仓干配]', 'List', 'businessCategoryList');
|
||||
|
@ -57,6 +54,13 @@ INSERT INTO `base_data`(`id`, `type`, `attribution`, `content`, `content_type`,
|
|||
INSERT INTO `base_data`(`id`, `type`, `attribution`, `content`, `content_type`, `content_name`) VALUES ('9047450688035130', 'businessType', 'costCenter', '[货代, 报关, 船代, 散杂货]', 'List', 'businessTypeList');
|
||||
INSERT INTO `base_data`(`id`, `type`, `attribution`, `content`, `content_type`, `content_name`) VALUES ('2790513253702116', 'salesman', 'costCenter', '[仓干配物流部(物流)]', 'List', 'salesmanList');
|
||||
|
||||
INSERT INTO `chain`(`id`, `application_name`, `chain_name`, `chain_desc`, `el_data`, `create_time`) VALUES (3, 'demo', 'cost01AndCost02', '测试流程', 'IF(costCenter01Cmp, CostCenter01SoutCmp, IF(costCenter02Cmp, CostCenter02SoutCmp, sout));', '2022-12-06 16:03:34');
|
||||
INSERT INTO `chain`(`id`, `application_name`, `chain_name`, `chain_desc`, `el_data`, `create_time`) VALUES (4, 'demo', 'cost01', '测试流程', 'IF(costCenter01Cmp, CostCenter01SoutCmp, sout);', '2022-12-06 16:03:34');
|
||||
INSERT INTO `chain`(`id`, `application_name`, `chain_name`, `chain_desc`, `el_data`, `create_time`) VALUES (5, 'demo', 'cost02', '测试流程', 'IF(costCenter02Cmp, CostCenter02SoutCmp, sout);', '2022-12-06 16:03:34');
|
||||
INSERT INTO `chain`(`id`, `application_name`, `chain_name`, `chain_desc`, `el_data`, `create_time`) VALUES (6, 'demo', 'profit01AndProfit02', '测试流程', 'IF(profitCenter01Cmp, ProfitCenter01SoutCmp, IF(profitCenter02Cmp, ProfitCenter02SoutCmp, sout));', '2022-12-06 16:03:34');
|
||||
INSERT INTO `chain`(`id`, `application_name`, `chain_name`, `chain_desc`, `el_data`, `create_time`) VALUES (7, 'demo', 'profit01', '测试流程', 'IF(profitCenter01Cmp, ProfitCenter01SoutCmp, sout);', '2022-12-06 16:03:34');
|
||||
INSERT INTO `chain`(`id`, `application_name`, `chain_name`, `chain_desc`, `el_data`, `create_time`) VALUES (8, 'demo', 'profit02', '测试流程', 'IF(profitCenter02Cmp, ProfitCenter02SoutCmp, sout);', '2022-12-06 16:03:34');
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue