From bf555b5b3230a434da55b116cf42fcf4907d247f Mon Sep 17 00:00:00 2001 From: Harryxzy Date: Mon, 14 Aug 2023 16:38:40 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9jackson=E8=A7=A3=E6=9E=90?= =?UTF-8?q?map=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/FormulaRunServiceImpl.java | 41 +++++++++---------- .../impl/SalaryFormulaServiceImpl.java | 14 ++----- 2 files changed, 23 insertions(+), 32 deletions(-) diff --git a/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java b/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java index b1d19353a..9e5303a62 100644 --- a/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java +++ b/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java @@ -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; @@ -34,8 +32,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")); @@ -69,24 +65,25 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService String openDecrypt = ""; String result = ""; try { - JsonNode jsonNode = objectMapper.readTree(extendParam); + Map 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 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 @@ -144,13 +141,13 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService String extendParam = expressFormula.getExtendParam(); try { - JsonNode jsonNode = objectMapper.readTree(extendParam); + Map 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, sql extendParam parse fail", e); } diff --git a/src/com/engine/salary/service/impl/SalaryFormulaServiceImpl.java b/src/com/engine/salary/service/impl/SalaryFormulaServiceImpl.java index 401a761d7..3e34a2715 100644 --- a/src/com/engine/salary/service/impl/SalaryFormulaServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryFormulaServiceImpl.java @@ -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 map = JsonUtil.parseMap(extendParam, String.class); + sqlReturnKey = map.getOrDefault("sqlReturnKey", ""); + } catch (Exception e) { log.error("express execute fail, sql extendParam parse fail", e); } From 6f2436d808dab6f5359f4edaeea0e3fc5b49e704 Mon Sep 17 00:00:00 2001 From: Harryxzy Date: Mon, 4 Sep 2023 16:38:18 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E8=B0=83=E8=96=AA?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=BF=94=E5=9B=9E=E6=95=B0=E6=8D=AE=EF=BC=8C?= =?UTF-8?q?=E4=B8=BAnull=E6=97=B6=E4=B8=8D=E8=BF=94=E5=9B=9E=E2=80=9Cnull?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/wrapper/SalaryArchiveItemWrapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/engine/salary/wrapper/SalaryArchiveItemWrapper.java b/src/com/engine/salary/wrapper/SalaryArchiveItemWrapper.java index 98d9815a5..0f03e2906 100644 --- a/src/com/engine/salary/wrapper/SalaryArchiveItemWrapper.java +++ b/src/com/engine/salary/wrapper/SalaryArchiveItemWrapper.java @@ -74,7 +74,7 @@ public class SalaryArchiveItemWrapper extends Service implements SalaryArchiveIt // 控件数据 Map data = new HashMap<>(); - data.put("effectiveTime", effectiveTime + ""); + data.put("effectiveTime", effectiveTime == null ? null : effectiveTime + ""); data.put("adjustReason", adjustReason); data.put("description", description); data.put("adjustReasonList", SalaryArchiveItemAdjustReasonEnum.getList()); From 8de418b28b33a96bf5e28b08525254361a7b7ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Wed, 6 Sep 2023 10:13:22 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/service/impl/FormulaRunServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java b/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java index 615c148eb..7b7ad36d2 100644 --- a/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java +++ b/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java @@ -167,7 +167,7 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService isCustomFunction = StringUtils.equals(isCustomFunctionNode.asText().trim(), "1"); } } catch (JsonProcessingException e) { - log.error("express execute fail, sql extendParam parse fail", e); + log.error("express execute fail, extendParam parse fail {}", extendParam, e); } if (isLog) { From 1451c4b1924ac32463a2a92e7e4f51aada4d9dfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Wed, 6 Sep 2023 10:14:52 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../engine/salary/service/impl/FormulaRunServiceImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java b/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java index 7b7ad36d2..ff08478b3 100644 --- a/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java +++ b/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java @@ -155,6 +155,10 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService private ExcelResult runFormula(ExpressFormula expressFormula, List formulaVars) { + if (isLog) { + log.info("FORMULA ExpressFormula {} {}", expressFormula.getFormula(), expressFormula.getFormulaRunScript()); + } + //是否是自定义函数 boolean isCustomFunction = true; @@ -170,10 +174,6 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService log.error("express execute fail, extendParam parse fail {}", extendParam, e); } - if (isLog) { - log.info("FORMULA ExpressFormula {} {}", expressFormula.getFormula(), expressFormula.getFormulaRunScript()); - } - String formula = expressFormula.getFormulaRunScript(); ExcelResult execute = new ExcelResult(); From d7b9485d1802de8bdd993885390f25003faa7a82 Mon Sep 17 00:00:00 2001 From: sy Date: Wed, 6 Sep 2023 10:17:20 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E6=A0=B8=E7=AE=97?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=B8=AD=E9=97=B4=E8=A1=A8=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=88=86=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/SIAccountBiz.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index 47e0741f7..69b12aa04 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -504,7 +504,12 @@ public class SIAccountBiz extends Service { //TransactionStatus status = transactionManager.getTransaction(new DefaultTransactionDefinition()); String billMonth = param.getBillMonth(); try { - List list = getSIAccountDetailTempMapper().getListByEmployeeIdsAndBillMonth(ids, billMonth, param.getPaymentOrganization()); +// List list = getSIAccountDetailTempMapper().getListByEmployeeIdsAndBillMonth(ids, billMonth, param.getPaymentOrganization()); + List list = new ArrayList<>(); + List> partitionDetailTempInfo = Lists.partition((List) ids, 100); + partitionDetailTempInfo.forEach(part -> list.addAll( + getSIAccountDetailTempMapper().getListByEmployeeIdsAndBillMonth(part, billMonth, param.getPaymentOrganization()))); + encryptUtil.decryptList(list, InsuranceAccountDetailTempPO.class); Integer paymentStatus = 0; log.info("核算明细临时表 hrsa_bill_detail_temp待处理数量:{}", list.size());