1.字段特殊处理

This commit is contained in:
chenweilong 2022-12-09 11:12:23 +08:00
parent 4e501863e3
commit e9bb9ab48a
8 changed files with 39 additions and 5 deletions

View File

@ -57,7 +57,11 @@ public class CostCenter02Cmp extends NodeIfComponent {
String contentName = baseDataEntity.getContentName();
droolStr = StrUtil.replace(droolStr, contentName, content, false);
}
droolStr = StrUtil.replace(droolStr, name, "\"" + fieldValue + "\"", false);
String filedValueStr = "";
if (ObjectUtil.isNotNull(fieldValue)) {
filedValueStr = fieldValue.toString();
}
droolStr = StrUtil.replace(droolStr, name, filedValueStr, false);
}
log.info("after - replace4 = {}", droolStr);

View File

@ -52,7 +52,11 @@ public class CostCenterCmp extends NodeIfComponent {
String contentName = baseDataEntity.getContentName();
droolStr = StrUtil.replace(droolStr, contentName, content, false);
}
droolStr = StrUtil.replace(droolStr, name, "\"" + fieldValue + "\"", false);
String filedValueStr = "";
if (ObjectUtil.isNotNull(fieldValue)) {
filedValueStr = fieldValue.toString();
}
droolStr = StrUtil.replace(droolStr, name, filedValueStr, false);
}
log.info("after - droolStr = {}", droolStr);

View File

@ -46,7 +46,11 @@ public class ProfitCenter01Cmp extends NodeIfComponent {
String contentName = baseDataEntity.getContentName();
droolStr = StrUtil.replace(droolStr, contentName, content, false);
}
droolStr = StrUtil.replace(droolStr, name, "\"" + fieldValue + "\"", false);
String filedValueStr = "";
if (ObjectUtil.isNotNull(fieldValue)) {
filedValueStr = fieldValue.toString();
}
droolStr = StrUtil.replace(droolStr, name, filedValueStr, false);
}
log.info("after - droolStr = {}", droolStr);

View File

@ -52,7 +52,11 @@ public class ProfitCenter02Cmp extends NodeIfComponent {
String contentName = baseDataEntity.getContentName();
droolStr = StrUtil.replace(droolStr, contentName, content, false);
}
droolStr = StrUtil.replace(droolStr, name, "\"" + fieldValue + "\"", false);
String filedValueStr = "";
if (ObjectUtil.isNotNull(fieldValue)) {
filedValueStr = fieldValue.toString();
}
droolStr = StrUtil.replace(droolStr, name, filedValueStr, false);
}
log.info("after - droolStr = {}", droolStr);

View File

@ -45,7 +45,11 @@ public class ProfitCenterCmp extends NodeIfComponent {
String contentName = baseDataEntity.getContentName();
droolStr = StrUtil.replace(droolStr, contentName, content, false);
}
droolStr = StrUtil.replace(droolStr, name, "\"" + fieldValue + "\"", false);
String filedValueStr = "";
if (ObjectUtil.isNotNull(fieldValue)) {
filedValueStr = fieldValue.toString();
}
droolStr = StrUtil.replace(droolStr, name, filedValueStr, false);
}
log.info("after - droolStr = {}", droolStr);

View File

@ -28,4 +28,9 @@ public class ChainController {
public void executeChain(@PathVariable("chainName") String chainName) {
chainService.executeChain(chainName);
}
@GetMapping("/getChainByName/{chainName}")
public ChainEntity getChainByName(@PathVariable("chainName") String chainName) {
return chainService.getChainName(chainName);
}
}

View File

@ -11,4 +11,5 @@ public interface ChainService {
void executeChain(String chainName);
ChainEntity getChainName(String chainName);
}

View File

@ -2,6 +2,7 @@ package com.example.liteflow.mysql.service.impl;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.liteflow.mysql.entity.ChainEntity;
import com.example.liteflow.mysql.mapper.ChainMapper;
@ -35,6 +36,13 @@ public class ChainServiceImpl extends ServiceImpl<ChainMapper, ChainEntity> imp
flowExecutor.reloadRule();
}
@Override
public ChainEntity getChainName(String chainName) {
LambdaQueryWrapper<ChainEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ChainEntity::getChainName, chainName);
return this.getOne(queryWrapper);
}
@Override
public void executeChain(String chainName) {
List<BaseCenter> list = this.generateCostCenterTestData();