From 31286babb21efe9a12853375f984eecbded2dc62 Mon Sep 17 00:00:00 2001
From: wangxuanran <3055088966@qq.com>
Date: Tue, 6 Dec 2022 13:13:31 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=BD=E7=BD=97=E5=BE=B7=E4=BB=A3=E7=A0=81?=
=?UTF-8?q?=E5=BC=80=E5=8F=91=E4=BB=A5=E5=8F=8A=E7=94=9F=E6=88=90json?=
=?UTF-8?q?=E5=B7=A5=E5=85=B7=E7=B1=BB=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../config/service/DealWithMapping.java | 47 ++++++++++++++--
.../schroeder/action/PushSealTaskAction.java | 2 +-
.../PushSealTaskSealValue.java | 53 ++++++++++++++++++-
.../service/SchroederQRCodeService.java | 1 +
4 files changed, 96 insertions(+), 7 deletions(-)
diff --git a/src/main/java/weaver/xiao/commons/config/service/DealWithMapping.java b/src/main/java/weaver/xiao/commons/config/service/DealWithMapping.java
index a2ea70f..df97287 100644
--- a/src/main/java/weaver/xiao/commons/config/service/DealWithMapping.java
+++ b/src/main/java/weaver/xiao/commons/config/service/DealWithMapping.java
@@ -537,7 +537,12 @@ public class DealWithMapping extends ToolUtil {
* @param mainMap 主表数据结果集
* @param detailMap 明细数据结果集
* @param mappingDetail 配置节点信息
- * @return
+ *
+ *
代码版本改动说明:
+ *
+ * v2.0 xuanran.wang 转换类型是默认值时增加替换规则
+ * 将自定义文本中的{?requestid}替换成requestid 以及将 ? 替换成选择的流程字段对应的值
+ *
*/
private Object normalValueDeal(Map mainMap, Map detailMap, MappingDetail mappingDetail) {
@@ -563,7 +568,19 @@ public class DealWithMapping extends ToolUtil {
break;
// 默认值
case DEFAULT_VALUE: {
- value = valueContext;
+ FieldMessage fieldMassage = mappingDetail.getFieldMassage();
+ String workFlowVal = "";
+ if(fieldMassage != null){
+ String fieldName = fieldMassage.getFieldName().toLowerCase();
+ if ("1".equals(childSource)) {
+ workFlowVal = Util.null2String(detailMap.get(fieldName));
+ } else if ("0".equals(childSource)) {
+ workFlowVal = Util.null2String(mainMap.get(fieldName));
+ }
+ }
+ value = Util.null2String(valueContext)
+ .replace("{?requestid}", String.valueOf(mainMap.get("requestid")))
+ .replace("?", workFlowVal);
}
break;
// 当前时间
@@ -778,7 +795,12 @@ public class DealWithMapping extends ToolUtil {
* @param detailMap 明细数据结果集
* @param mappingDetail 配置节点信息
* @param relationRs 关联流程数据集合
- * @return
+ *
+ * 代码版本改动说明:
+ *
+ * v2.0 xuanran.wang 转换类型是默认值时增加替换规则
+ * 将自定义文本中的{?requestid}替换成requestid 以及将 ? 替换成选择的流程字段对应的值
+ *
*/
private Object normalValueDeal(Map mainMap, Map detailMap, RecordSet relationRs, MappingDetail mappingDetail) {
String paramType = mappingDetail.getParamType();
@@ -810,7 +832,24 @@ public class DealWithMapping extends ToolUtil {
break;
// 默认值
case DEFAULT_VALUE: {
- value = valueContext;
+ FieldMessage fieldMassage = mappingDetail.getFieldMassage();
+ String workFlowVal = "";
+ if(fieldMassage != null){
+ String fieldName = fieldMassage.getFieldName().toLowerCase();
+ if ("1".equals(childSource)) {
+ workFlowVal = Util.null2String(detailMap.get(fieldName));
+ } else if ("0".equals(childSource)) {
+ workFlowVal = Util.null2String(mainMap.get(fieldName));
+ } else {
+ workFlowVal = Util.null2String(relationRs.getString(fieldName));
+ }
+ if ("rootNode".equals(mappingDetail.getBelongTo()) && "2".equals(childSource)) {
+ workFlowVal = Util.null2String(tempRs.getString(fieldName));
+ }
+ }
+ value = Util.null2String(valueContext)
+ .replace("{?requestid}", String.valueOf(mainMap.get("requestid")))
+ .replace("?", workFlowVal);
}
break;
// 当前时间
diff --git a/src/main/java/weaver/xuanran/wang/schroeder/action/PushSealTaskAction.java b/src/main/java/weaver/xuanran/wang/schroeder/action/PushSealTaskAction.java
index 47538f7..d559208 100644
--- a/src/main/java/weaver/xuanran/wang/schroeder/action/PushSealTaskAction.java
+++ b/src/main/java/weaver/xuanran/wang/schroeder/action/PushSealTaskAction.java
@@ -45,7 +45,7 @@ public class PushSealTaskAction extends CusBaseAction {
}
}catch (Exception e){
trans.rollback();
- throw new CustomerException(e.getMessage());
+ throw new CustomerException(Util.logStr("执行提交方法异常:{}", e.getMessage()));
}
trans.commit();
}
diff --git a/src/main/java/weaver/xuanran/wang/schroeder/cus_field_value/PushSealTaskSealValue.java b/src/main/java/weaver/xuanran/wang/schroeder/cus_field_value/PushSealTaskSealValue.java
index c5394a4..96a484f 100644
--- a/src/main/java/weaver/xuanran/wang/schroeder/cus_field_value/PushSealTaskSealValue.java
+++ b/src/main/java/weaver/xuanran/wang/schroeder/cus_field_value/PushSealTaskSealValue.java
@@ -1,8 +1,17 @@
package weaver.xuanran.wang.schroeder.cus_field_value;
+import aiyh.utils.Util;
+import aiyh.utils.excention.CustomerException;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.log4j.Logger;
+import weaver.conn.RecordSet;
import weaver.xiao.commons.config.interfacies.CusInterfaceGetValue;
+import weaver.zwl.common.ToolUtil;
-import java.util.Map;
+import java.util.*;
+import java.util.stream.Collectors;
/**
*
@@ -11,12 +20,52 @@ import java.util.Map;
* @Date 2022/12/2 16:10
*/
public class PushSealTaskSealValue implements CusInterfaceGetValue {
+ private final ToolUtil toolUtil = new ToolUtil();
+
+ private final Logger logger = Util.getLogger();
@Override
public Object execute(Map mainMap, Map detailMap, String currentValue, Map pathParam) {
+ logger.info(Util.logStr("路径参数:[{}]", JSONObject.toJSONString(pathParam)));
+ // 接口字段
String sealSnField = pathParam.get("sealSnField");
String sealNumField = pathParam.get("sealNumField");
- return null;
+ // 表单字段
+ String workFlowSealNumField = pathParam.get("workFlowSealNumField");
+ String workFlowSealSnField = pathParam.get("workFlowSealSnField");
+ // 自定义sql业务印章类型
+ String sealSnCusSql = pathParam.get("sealSnCusSql");
+ // 使用次数
+ String sealNumCusSql = pathParam.get("sealNumCusSql");
+ // 非空校验
+ if(checkBlank(sealSnField, sealNumField, sealSnCusSql, sealNumCusSql, workFlowSealNumField, workFlowSealSnField)){
+ throw new CustomerException(Util.logStr("自定义类路径中必要参数为空,请检查!当前pathParam : {}", JSONObject.toJSONString(pathParam)));
+ }
+ // 表单印章使用类型值
+ String sealSnVal = Util.null2String(String.valueOf(detailMap.get(sealSnField)),"");
+ // 如果为空返回空集合
+ if(StringUtils.isBlank(sealSnVal)){
+ return Collections.emptyList();
+ }
+ ArrayList