Merge branch 'fix/230801-修改jackson解析方法' into release/2.9.5.2309.01
# Conflicts: # src/com/engine/salary/service/impl/FormulaRunServiceImpl.java
This commit is contained in:
commit
e48f64e814
|
|
@ -11,9 +11,7 @@ import com.engine.salary.formlua.entity.parameter.DataType;
|
|||
import com.engine.salary.formlua.entity.standard.ExcelResult;
|
||||
import com.engine.salary.service.FormulaRunService;
|
||||
import com.engine.salary.sys.enums.OpenEnum;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.engine.salary.util.JsonUtil;
|
||||
import com.ql.util.express.DefaultContext;
|
||||
import com.ql.util.express.ExpressRunner;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -35,8 +33,6 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService
|
|||
|
||||
private static ExpressRunner runner = new ExpressRunner(true, false);
|
||||
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
private final BaseBean baseBean = new BaseBean();
|
||||
|
||||
private final Boolean isLog = "true".equals(baseBean.getPropValue("hrmSalary", "log"));
|
||||
|
|
@ -85,24 +81,25 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService
|
|||
String openDecrypt = "";
|
||||
String result = "";
|
||||
try {
|
||||
JsonNode jsonNode = objectMapper.readTree(extendParam);
|
||||
Map<String, String> map = JsonUtil.parseMap(extendParam, String.class);
|
||||
//返回值配置
|
||||
JsonNode sqlReturnKeyNode = jsonNode.get("sqlReturnKey");
|
||||
if (sqlReturnKeyNode != null) {
|
||||
sqlReturnKey = sqlReturnKeyNode.asText().trim();
|
||||
sqlReturnKey = map.getOrDefault("sqlReturnKey", "");
|
||||
if (StringUtils.isNotBlank(sqlReturnKey)) {
|
||||
sqlReturnKey = sqlReturnKey.trim();
|
||||
}
|
||||
//数据源配置
|
||||
JsonNode datasourceNode = jsonNode.get("datasource");
|
||||
if (datasourceNode != null) {
|
||||
JsonNode datasourceIdNode = datasourceNode.get("datasourceId");
|
||||
if (datasourceIdNode != null) {
|
||||
datasourceId = datasourceIdNode.asText();
|
||||
String datasourceJson = map.getOrDefault("datasource", "");
|
||||
if (StringUtils.isNotBlank(datasourceJson)) {
|
||||
Map<String, String> datasourceIdMap = JsonUtil.parseMap(datasourceJson, String.class);
|
||||
String datasourceIdNode = datasourceIdMap.getOrDefault("datasourceId","");
|
||||
if (StringUtils.isNotBlank(datasourceIdNode)) {
|
||||
datasourceId = datasourceIdNode;
|
||||
}
|
||||
}
|
||||
//是否需要解密
|
||||
JsonNode decrypt = jsonNode.get("openDecrypt");
|
||||
if (decrypt != null) {
|
||||
openDecrypt = decrypt.asText().trim();
|
||||
String decrypt = map.get("openDecrypt");
|
||||
if (StringUtils.isNotBlank(decrypt)) {
|
||||
openDecrypt = decrypt.trim();
|
||||
}
|
||||
|
||||
//解析sql
|
||||
|
|
@ -164,13 +161,13 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService
|
|||
|
||||
String extendParam = expressFormula.getExtendParam();
|
||||
try {
|
||||
JsonNode jsonNode = objectMapper.readTree(extendParam);
|
||||
Map<String, String> map = JsonUtil.parseMap(extendParam, String.class);
|
||||
//返回值配置
|
||||
JsonNode isCustomFunctionNode = jsonNode.get("isCustomFunction");
|
||||
if (isCustomFunctionNode != null) {
|
||||
isCustomFunction = StringUtils.equals(isCustomFunctionNode.asText().trim(), "1");
|
||||
String isCustomFunctionNode = map.getOrDefault("isCustomFunction", "");
|
||||
if (StringUtils.isNotBlank(isCustomFunctionNode)) {
|
||||
isCustomFunction = StringUtils.equals(isCustomFunctionNode.trim(), "1");
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
} catch (Exception e) {
|
||||
log.error("express execute fail, extendParam parse fail {}", extendParam, e);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,11 +18,9 @@ import com.engine.salary.mapper.formula.FormulaVarMapper;
|
|||
import com.engine.salary.service.FormulaRunService;
|
||||
import com.engine.salary.service.RemoteExcelService;
|
||||
import com.engine.salary.service.SalaryFormulaService;
|
||||
import com.engine.salary.util.JsonUtil;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import com.engine.salary.util.valid.ValidUtil;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import dm.jdbc.util.IdGenerator;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -47,7 +45,6 @@ import java.util.stream.Collectors;
|
|||
**/
|
||||
@Slf4j
|
||||
public class SalaryFormulaServiceImpl extends Service implements SalaryFormulaService {
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
private FormulaMapper getFormulaMapper() {
|
||||
return MapperProxyFactory.getProxy(FormulaMapper.class);
|
||||
|
|
@ -171,12 +168,9 @@ public class SalaryFormulaServiceImpl extends Service implements SalaryFormulaSe
|
|||
|
||||
String sqlReturnKey = "";
|
||||
try {
|
||||
JsonNode jsonNode = objectMapper.readTree(extendParam);
|
||||
JsonNode sqlReturnKeyNode = jsonNode.get("sqlReturnKey");
|
||||
if (sqlReturnKeyNode != null) {
|
||||
sqlReturnKey = sqlReturnKeyNode.asText();
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
Map<String, String> map = JsonUtil.parseMap(extendParam, String.class);
|
||||
sqlReturnKey = map.getOrDefault("sqlReturnKey", "");
|
||||
} catch (Exception e) {
|
||||
log.error("express execute fail, sql extendParam parse fail", e);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue