From 65ebec9fa37bee40e9f1a302cdc060df0ccd6f56 Mon Sep 17 00:00:00 2001 From: "youHong.ai" <774495953@qq.com> Date: Wed, 8 Feb 2023 16:22:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=B9=E5=AE=8F=E7=94=B5=E6=A2=AF=E9=98=B6?= =?UTF-8?q?=E6=AE=B5=E5=9B=BE=E8=8A=82=E7=82=B9=E5=8F=B0=E8=B4=A6=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/aiyh/utils/Util.java | 59 +++++++++++++++++-- .../annotation/recordset/SqlDbFieldAnn.java | 19 ++++++ .../java/aiyh/utils/mapper/UtilMapper.java | 11 ++-- .../utils/recordset/BooleanTypeHandler.java | 6 +- .../aiyh/utils/recordset/DataTypeHandler.java | 6 +- .../utils/recordset/FloatTypeHandler.java | 5 +- .../aiyh/utils/recordset/GetRsValueUtil.java | 44 ++++++++++++++ .../utils/recordset/IntegerTypeHandler.java | 4 +- .../utils/recordset/StringTypeHandler.java | 4 +- .../stagediagram/ModeExpandSaveAction.java | 14 +++-- .../stagediagram/dto/StageNodeInfo.java | 38 ++++++++++++ .../mapper/ModeExpandSaveActionMapper.java | 49 ++++++++++++++- .../service/ModeExpandSaveService.java | 50 +++++++++++++++- src/test/java/youhong/ai/pcn/UtilTest.java | 7 +++ .../ai/pcn/mapper/TransTestMapper.java | 7 +++ .../java/youhong/ai/pcn/pojo/Student.java | 13 ++++ 16 files changed, 308 insertions(+), 28 deletions(-) create mode 100644 src/main/java/aiyh/utils/annotation/recordset/SqlDbFieldAnn.java create mode 100644 src/main/java/aiyh/utils/recordset/GetRsValueUtil.java create mode 100644 src/main/java/weaver/youhong/ai/yihong/formmode/stagediagram/dto/StageNodeInfo.java diff --git a/src/main/java/aiyh/utils/Util.java b/src/main/java/aiyh/utils/Util.java index 7157faf..7933038 100644 --- a/src/main/java/aiyh/utils/Util.java +++ b/src/main/java/aiyh/utils/Util.java @@ -2603,6 +2603,17 @@ public class Util extends weaver.general.Util { return mdu.getModeDataNewId(tableName, formModeId, userId, 0, TimeUtil.getCurrentDateString(), TimeUtil.getOnlyCurrentTimeString()); } + /** + * 获取建模表数据ID + * + * @param tableName 表名 + * @param userId 用户ID + * @return 数据ID + */ + public static int getModeDataId(String tableName, int userId) { + return mdu.getModeDataNewId(tableName, Integer.parseInt(getModeIdByTableName(tableName)), userId, 0, TimeUtil.getCurrentDateString(), TimeUtil.getOnlyCurrentTimeString()); + } + /** * 建模表数据权限重构 * @@ -2614,6 +2625,17 @@ public class Util extends weaver.general.Util { MODE_RIGHT_INFO.rebuildModeDataShareByEdit(userId, formId, id); } + /** + * 建模表数据权限重构 + * + * @param userId 用户ID + * @param tableName 表单名称 + * @param id 数据ID + */ + public static void rebuildModeDataShare(Integer userId, String tableName, Integer id) { + MODE_RIGHT_INFO.rebuildModeDataShareByEdit(userId, Integer.parseInt(getModeIdByTableName(tableName)), id); + } + /** * 异步权限重构数据 * @@ -2625,6 +2647,17 @@ public class Util extends weaver.general.Util { threadPool.execute(() -> Util.rebuildModeDataShare(userId, formId, id)); } + /** + * 异步权限重构数据 + * + * @param userId 用户ID + * @param tableName 表单名称 + * @param id 数据ID + */ + public static void rebuildModeDataShareByAsync(Integer userId, String tableName, Integer id) { + threadPool.execute(() -> Util.rebuildModeDataShare(userId, Integer.parseInt(getModeIdByTableName(tableName)), id)); + } + /** * 异步权限重构数据 * @@ -2641,6 +2674,22 @@ public class Util extends weaver.general.Util { } + /** + * 异步权限重构数据 + * + * @param userId 用户ID + * @param tableName 表单名称 + * @param idList 数据ID + */ + public static void rebuildModeDataShareByAsyncList(Integer userId, String tableName, List idList) { + threadPool.execute(() -> { + for (Integer id : idList) { + Util.rebuildModeDataShare(userId, Integer.parseInt(getModeIdByTableName(tableName)), id); + } + }); + } + + /** * 生成文件并创建文档信息,权限继承文档目录 * @@ -3528,7 +3577,7 @@ public class Util extends weaver.general.Util { key:hah value:haode*/ // 最终通过反射调用weaver.aiyh_jitu.pushdata.service.GetAssignProcessorProcessorImpl类,将参数传递给这个类, - //String pattern = "&?(?([#.\\w\\u4E00-\\u9FA5]+))=" + + // String pattern = "&?(?([#.\\w\\u4E00-\\u9FA5]+))=" + // "(?(`([\\s():/\\t\\-&*'?$#={ }.\\w\\u4E00-\\u9FA5]*)`|" + // "((#(\\{|sql\\{))?([():/\\-$#={ }.\\w\\u4E00-\\u9FA5?]+)?}?)))&?"; String pattern = "&?(?([#.\\w\\u4E00-\\u9FA5]+))=" + @@ -3594,9 +3643,11 @@ public class Util extends weaver.general.Util { } - - public static String selectBillTableByFromId(String fromId){ - return mapper.selectBillTableByFromId(fromId); + public static String selectBillTableByFromId(String fromId) { + return mapper.selectBillTableByFromId(fromId); } + public static void deleteModeId(String tableName, Integer dataId) { + mapper.deleteModeId(tableName, dataId); + } } diff --git a/src/main/java/aiyh/utils/annotation/recordset/SqlDbFieldAnn.java b/src/main/java/aiyh/utils/annotation/recordset/SqlDbFieldAnn.java new file mode 100644 index 0000000..6482e25 --- /dev/null +++ b/src/main/java/aiyh/utils/annotation/recordset/SqlDbFieldAnn.java @@ -0,0 +1,19 @@ +package aiyh.utils.annotation.recordset; + +import java.lang.annotation.*; + +/** + *

sql字段映射

+ * + *

create: 2023-02-07 17:31

+ * + * @author youHong.ai + */ + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +@Documented +public @interface SqlDbFieldAnn { + + String value(); +} diff --git a/src/main/java/aiyh/utils/mapper/UtilMapper.java b/src/main/java/aiyh/utils/mapper/UtilMapper.java index c73a0b0..e9f3960 100644 --- a/src/main/java/aiyh/utils/mapper/UtilMapper.java +++ b/src/main/java/aiyh/utils/mapper/UtilMapper.java @@ -138,15 +138,18 @@ public interface UtilMapper { @ParamMapper("configTableName") String configTableName); /** - * *

selectBillTableByFromId 根据fromId查询billTable表明

* 2023/2/6 13:40 - ************************************************************* - * @author youHong.ai - ******************************************* + * ************************************************************ + * * @param fromId fromId * @return String 表名 + * @author youHong.ai + * ****************************************** */ @Select("select * from workflow_bill where id = #{fromId}") String selectBillTableByFromId(@ParamMapper("fromId") String fromId); + + @Delete("delete from $t{tableName} where id = #{dataId}") + void deleteModeId(@ParamMapper("tableName") String tableName, @ParamMapper("dataId") Integer dataId); } diff --git a/src/main/java/aiyh/utils/recordset/BooleanTypeHandler.java b/src/main/java/aiyh/utils/recordset/BooleanTypeHandler.java index 76fcc92..0b7ffb2 100644 --- a/src/main/java/aiyh/utils/recordset/BooleanTypeHandler.java +++ b/src/main/java/aiyh/utils/recordset/BooleanTypeHandler.java @@ -18,9 +18,11 @@ import java.lang.reflect.Field; public class BooleanTypeHandler implements TypeHandler { @Override public Object getValue(RecordSet rs, String fieldName, Field declaredField) { - return getBoolean(declaredField, rs.getString(fieldName)); + return getBoolean(declaredField, GetRsValueUtil.getRsValue(rs, fieldName, declaredField)); } + + @Override public Object getValue(RecordSet rs, int index, Field declaredField) { return getBoolean(declaredField, rs.getString(index)); @@ -28,7 +30,7 @@ public class BooleanTypeHandler implements TypeHandler { @Override public Object getValue(RecordSetTrans rs, String fieldName, Field declaredField) { - return getBoolean(declaredField, rs.getString(fieldName)); + return getBoolean(declaredField, GetRsValueUtil.getRsValue(rs, fieldName, declaredField)); } @Override diff --git a/src/main/java/aiyh/utils/recordset/DataTypeHandler.java b/src/main/java/aiyh/utils/recordset/DataTypeHandler.java index 2e6fa85..00a2abb 100644 --- a/src/main/java/aiyh/utils/recordset/DataTypeHandler.java +++ b/src/main/java/aiyh/utils/recordset/DataTypeHandler.java @@ -26,7 +26,7 @@ public class DataTypeHandler implements TypeHandler { if (annotation != null) { String value = annotation.value(); try { - date = new SimpleDateFormat(value).parse(rs.getString(fieldName)); + date = new SimpleDateFormat(value).parse(GetRsValueUtil.getRsValue(rs, fieldName, declaredField)); } catch (ParseException e) { e.printStackTrace(); throw new TypeNonsupportException("Failed to convert [" + rs.getString(fieldName) + "] to a Date object as [" + value + "]!!"); @@ -64,7 +64,7 @@ public class DataTypeHandler implements TypeHandler { if (annotation != null) { String value = annotation.value(); try { - date = new SimpleDateFormat(value).parse(rs.getString(fieldName)); + date = new SimpleDateFormat(value).parse(GetRsValueUtil.getRsValue(rs, fieldName, declaredField)); } catch (ParseException e) { e.printStackTrace(); throw new TypeNonsupportException("Failed to convert [" + rs.getString(fieldName) + "] to a Date object as [" + value + "]!!"); @@ -91,4 +91,6 @@ public class DataTypeHandler implements TypeHandler { } return date; } + + } diff --git a/src/main/java/aiyh/utils/recordset/FloatTypeHandler.java b/src/main/java/aiyh/utils/recordset/FloatTypeHandler.java index 7eda059..3dbe30b 100644 --- a/src/main/java/aiyh/utils/recordset/FloatTypeHandler.java +++ b/src/main/java/aiyh/utils/recordset/FloatTypeHandler.java @@ -16,7 +16,7 @@ import java.lang.reflect.Field; public class FloatTypeHandler implements TypeHandler { @Override public Object getValue(RecordSet rs, String fieldName, Field declaredField) { - String string = Util.null2DefaultStr(rs.getString(fieldName), "0.0"); + String string = Util.null2DefaultStr(GetRsValueUtil.getRsValue(rs, fieldName, declaredField), "0.0"); return Float.parseFloat(string); } @@ -28,7 +28,7 @@ public class FloatTypeHandler implements TypeHandler { @Override public Object getValue(RecordSetTrans rs, String fieldName, Field declaredField) { - String string = Util.null2DefaultStr(rs.getString(fieldName), "0.0"); + String string = Util.null2DefaultStr(GetRsValueUtil.getRsValue(rs, fieldName, declaredField), "0.0"); return Float.parseFloat(string); } @@ -37,4 +37,5 @@ public class FloatTypeHandler implements TypeHandler { String string = Util.null2DefaultStr(rs.getString(index), "0.0"); return Float.parseFloat(string); } + } diff --git a/src/main/java/aiyh/utils/recordset/GetRsValueUtil.java b/src/main/java/aiyh/utils/recordset/GetRsValueUtil.java new file mode 100644 index 0000000..c71e065 --- /dev/null +++ b/src/main/java/aiyh/utils/recordset/GetRsValueUtil.java @@ -0,0 +1,44 @@ +package aiyh.utils.recordset; + +import aiyh.utils.annotation.recordset.SqlDbFieldAnn; +import org.h2.util.StringUtils; +import org.jetbrains.annotations.Nullable; +import weaver.conn.RecordSet; +import weaver.conn.RecordSetTrans; + +import java.lang.reflect.Field; + +/** + *

获取rs的值

+ * + *

create: 2023-02-07 17:36

+ * + * @author youHong.ai + */ + +public class GetRsValueUtil { + + @Nullable + public static String getRsValue(RecordSet rs, String fieldName, Field declaredField) { + String value = rs.getString(fieldName); + if(StringUtils.isNullOrEmpty(value) && declaredField != null){ + SqlDbFieldAnn annotation = declaredField.getAnnotation(SqlDbFieldAnn.class); + if (annotation != null){ + value = rs.getString(annotation.value()); + } + } + return value; + } + + @Nullable + public static String getRsValue(RecordSetTrans rs, String fieldName, Field declaredField) { + String value = rs.getString(fieldName); + if(StringUtils.isNullOrEmpty(value) && declaredField != null){ + SqlDbFieldAnn annotation = declaredField.getAnnotation(SqlDbFieldAnn.class); + if (annotation != null){ + value = rs.getString(annotation.value()); + } + } + return value; + } +} diff --git a/src/main/java/aiyh/utils/recordset/IntegerTypeHandler.java b/src/main/java/aiyh/utils/recordset/IntegerTypeHandler.java index 48c3b5c..86d6c58 100644 --- a/src/main/java/aiyh/utils/recordset/IntegerTypeHandler.java +++ b/src/main/java/aiyh/utils/recordset/IntegerTypeHandler.java @@ -14,7 +14,7 @@ import java.lang.reflect.Field; public class IntegerTypeHandler implements TypeHandler { @Override public Object getValue(RecordSet rs, String fieldName, Field declaredField) { - String string = Util.null2DefaultStr(rs.getString(fieldName), "-1"); + String string = Util.null2DefaultStr(GetRsValueUtil.getRsValue(rs, fieldName, declaredField), "-1"); if (string.contains(".")) { string = string.substring(0, string.indexOf(".")); } @@ -32,7 +32,7 @@ public class IntegerTypeHandler implements TypeHandler { @Override public Object getValue(RecordSetTrans rs, String fieldName, Field declaredField) { - String string = Util.null2DefaultStr(rs.getString(fieldName), "-1"); + String string = Util.null2DefaultStr(GetRsValueUtil.getRsValue(rs, fieldName, declaredField), "-1"); if (string.contains(".")) { string = string.substring(0, string.indexOf(".")); } diff --git a/src/main/java/aiyh/utils/recordset/StringTypeHandler.java b/src/main/java/aiyh/utils/recordset/StringTypeHandler.java index 042d5da..bce0093 100644 --- a/src/main/java/aiyh/utils/recordset/StringTypeHandler.java +++ b/src/main/java/aiyh/utils/recordset/StringTypeHandler.java @@ -13,7 +13,7 @@ import java.lang.reflect.Field; public class StringTypeHandler implements TypeHandler { @Override public Object getValue(RecordSet rs, String fieldName, Field declaredField) { - return rs.getString(fieldName); + return GetRsValueUtil.getRsValue(rs, fieldName, declaredField); } @Override @@ -23,7 +23,7 @@ public class StringTypeHandler implements TypeHandler { @Override public Object getValue(RecordSetTrans rs, String fieldName, Field declaredField) { - return rs.getString(fieldName); + return GetRsValueUtil.getRsValue(rs, fieldName, declaredField); } @Override diff --git a/src/main/java/weaver/youhong/ai/yihong/formmode/stagediagram/ModeExpandSaveAction.java b/src/main/java/weaver/youhong/ai/yihong/formmode/stagediagram/ModeExpandSaveAction.java index 92d404d..9d51a57 100644 --- a/src/main/java/weaver/youhong/ai/yihong/formmode/stagediagram/ModeExpandSaveAction.java +++ b/src/main/java/weaver/youhong/ai/yihong/formmode/stagediagram/ModeExpandSaveAction.java @@ -4,7 +4,7 @@ import aiyh.utils.Util; import com.alibaba.fastjson.JSON; import org.apache.log4j.Logger; import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew; -import weaver.youhong.ai.yihong.formmode.stagediagram.mapper.ModeExpandSaveActionMapper; +import weaver.youhong.ai.yihong.formmode.stagediagram.service.ModeExpandSaveService; import java.util.HashMap; import java.util.Map; @@ -21,15 +21,17 @@ public class ModeExpandSaveAction extends AbstractModeExpandJavaCodeNew { private final Logger log = Util.getLogger(); - private final ModeExpandSaveActionMapper mapper = Util.getMapper(ModeExpandSaveActionMapper.class); - @Override public Map doModeExpand(Map param) { - Map result = new HashMap<>(); + Map result = new HashMap<>(8); + ModeExpandSaveService service = new ModeExpandSaveService(); try { log.info("自定义接口保存动作参数: " + JSON.toJSONString(param)); - }catch (Exception e){ - result.put("errmsg",e.getMessage()); + service.updateStageDiagramView(param, + "STAGE_DIAGRAM_AMOUNT_TABLE", "STAGE_DIAGRAM_PROJECT_ID_FIELD", + "STAGE_DIAGRAM_AMOUNT_FIELD"); + } catch (Exception e) { + result.put("errmsg", e.getMessage()); result.put("flag", "false"); log.error("建模自定义保存接口错误:" + e.getMessage() + Util.getErrString(e)); } diff --git a/src/main/java/weaver/youhong/ai/yihong/formmode/stagediagram/dto/StageNodeInfo.java b/src/main/java/weaver/youhong/ai/yihong/formmode/stagediagram/dto/StageNodeInfo.java new file mode 100644 index 0000000..77b2d9c --- /dev/null +++ b/src/main/java/weaver/youhong/ai/yihong/formmode/stagediagram/dto/StageNodeInfo.java @@ -0,0 +1,38 @@ +package weaver.youhong.ai.yihong.formmode.stagediagram.dto; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + *

项目节点台账信息

+ * + *

create: 2023/2/8 10:53

+ * + * @author youHong.ai + */ +@Setter +@Getter +@ToString +public class StageNodeInfo { + + /** + * id + */ + private Integer id; + + /** + * 项目id + */ + private String projectId; + + /** + * 金额 + */ + private String amount; + + /** + * 当前节点 + */ + private String currentNode; +} diff --git a/src/main/java/weaver/youhong/ai/yihong/formmode/stagediagram/mapper/ModeExpandSaveActionMapper.java b/src/main/java/weaver/youhong/ai/yihong/formmode/stagediagram/mapper/ModeExpandSaveActionMapper.java index b6683d4..1ca1d46 100644 --- a/src/main/java/weaver/youhong/ai/yihong/formmode/stagediagram/mapper/ModeExpandSaveActionMapper.java +++ b/src/main/java/weaver/youhong/ai/yihong/formmode/stagediagram/mapper/ModeExpandSaveActionMapper.java @@ -1,6 +1,12 @@ package weaver.youhong.ai.yihong.formmode.stagediagram.mapper; +import aiyh.utils.annotation.recordset.ParamMapper; +import aiyh.utils.annotation.recordset.Select; import aiyh.utils.annotation.recordset.SqlMapper; +import aiyh.utils.annotation.recordset.Update; +import weaver.youhong.ai.yihong.formmode.stagediagram.dto.StageNodeInfo; + +import java.util.Map; /** *

@@ -11,6 +17,47 @@ import aiyh.utils.annotation.recordset.SqlMapper; */ @SqlMapper -public class ModeExpandSaveActionMapper { +public interface ModeExpandSaveActionMapper { + /** + *

查询台账信息

+ * + * @param projectId 项目id + * @return 项目台账信息 + */ + @Select("select * from uf_stage_node_info where project_id = #{projectId}") + StageNodeInfo selectStageNodeInfoByProjectId(@ParamMapper("projectId") String projectId); + + /** + *

根据唯一标识查询配置表主表ID

+ * + * @param onlyMark 唯一标识 + * @return 主表id + */ + @Select("select id from uf_yh_stage_diagram where only_mark = #{onlyMark}") + Integer selectConfigMainId(@ParamMapper("onlyMark") String onlyMark); + + /** + *

查询配置表明细表信息

+ * + * @param formId 表单id + * @return 明细id + */ + // @Select("select * from uf_yh_stage_diagram_dt1 where mainid = #{mainId} and model_table = #{formId]") + // Map selectDetailConfig(@ParamMapper("mainId") Integer mainId, @ParamMapper("formId") String formId); + @Select("select * from uf_yh_stage_diagram_dt1 where model_table = #{formId}") + Map selectDetailConfig(@ParamMapper("formId") String formId); + + @Select("select $t{amountField} from $t{amountTable} where $t{projectIdField} = #{projectId}") + String selectAmountByProjectId(@ParamMapper("projectId") String projectId, + @ParamMapper("projectIdField") String projectIdField, + @ParamMapper("amountTable") String amountTable, + @ParamMapper("amountField") String amountField); + + @Update("update uf_stage_node_info set project_id = #{projectId}, amount = #{amount}, " + + "current_node = #{nodeName} where id = #{dataId}") + boolean updateStageNodeInfo(@ParamMapper("dataId") Integer dataId, + @ParamMapper("projectId") String projectId, + @ParamMapper("nodeName") String nodeName, + @ParamMapper("amount") String amount); } diff --git a/src/main/java/weaver/youhong/ai/yihong/formmode/stagediagram/service/ModeExpandSaveService.java b/src/main/java/weaver/youhong/ai/yihong/formmode/stagediagram/service/ModeExpandSaveService.java index 0ff3998..fcea666 100644 --- a/src/main/java/weaver/youhong/ai/yihong/formmode/stagediagram/service/ModeExpandSaveService.java +++ b/src/main/java/weaver/youhong/ai/yihong/formmode/stagediagram/service/ModeExpandSaveService.java @@ -2,15 +2,18 @@ package weaver.youhong.ai.yihong.formmode.stagediagram.service; import aiyh.utils.Util; import cn.hutool.core.lang.Assert; +import com.alibaba.fastjson.JSON; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; import weaver.soa.workflow.request.Property; import weaver.soa.workflow.request.RequestInfo; +import weaver.youhong.ai.yihong.formmode.stagediagram.dto.StageNodeInfo; import weaver.youhong.ai.yihong.formmode.stagediagram.mapper.ModeExpandSaveActionMapper; import java.util.Collections; import java.util.HashMap; import java.util.Map; +import java.util.Objects; /** *

保存自定义处理方法service

@@ -26,15 +29,56 @@ public class ModeExpandSaveService { private final ModeExpandSaveActionMapper mapper = Util.getMapper(ModeExpandSaveActionMapper.class); - public void updateStageDiagramView(String projectFieldMark, Map param){ + public void updateStageDiagramView(Map param, + String amountTable, + String projectIdField, + String amountField) { /* ******************* 查询当前节点对应的projectId ******************* */ - String stageDiagramProjectFieldName = Util.getCusConfigValue(projectFieldMark); + String formId = Util.null2String(param.get("formId")); + Map currentNodeConfig = mapper.selectDetailConfig(formId); + // String stageDiagramProjectFieldName = Util.getCusConfigValue(projectFieldMark); + String stageDiagramProjectFieldName = Util.null2String(currentNodeConfig.get("projectFieldName")); Assert.notBlank(stageDiagramProjectFieldName, "cna not find projectFieldMark from uf_cus_dev_config! the config can not be null!"); RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo"); Map mainTableValue = getMainTableValue(requestInfo); String projectId = mainTableValue.get(stageDiagramProjectFieldName); + log.info("主表数据:" + JSON.toJSONString(mainTableValue)); + // 获取当前模块id /* ******************* 查询台账中对应的project是否存在, 台账中不存在则插入,存在则更新 ******************* */ + StageNodeInfo nodeInfo = mapper.selectStageNodeInfoByProjectId(projectId); + log.info("查询到的nodeINFo数据:" + JSON.toJSONString(nodeInfo)); + if (Objects.isNull(nodeInfo)) { +// 不存在项目信息在台账中插入项目信息到台账信息中 + Integer dataId = Util.getModeDataId("uf_stage_node_info", 1); + // 查询配置表信息 + // Integer mainId = mapper.selectConfigMainId(Util.getCusConfigValue(onlyMarkCusMark)); + // Map currentNodeConfig = mapper.selectDetailConfig(mainId, formId); + String nodeName = (String) currentNodeConfig.get("nodeName"); + log.info("节点名称: " + nodeName); + String amount = mapper.selectAmountByProjectId(projectId, + Util.getCusConfigValueNullOrEmpty(projectIdField, ""), + Util.getCusConfigValueNullOrEmpty(amountTable, ""), + Util.getCusConfigValueNullOrEmpty(amountField, "")); + boolean update = mapper.updateStageNodeInfo(dataId, projectId, nodeName, amount); + if (!update) { + Util.deleteModeId("uf_stage_node_info", dataId); + } else { + Util.rebuildModeDataShare(1, Integer.parseInt(Util.getModeIdByTableName("uf_stage_node_info")), + dataId); + } + } else { + // 存在,更新当前项目的节点信息 + Integer dataId = nodeInfo.getId(); + // Integer mainId = mapper.selectConfigMainId(Util.getCusConfigValue(onlyMarkCusMark)); + // Map currentNodeConfig = mapper.selectDetailConfig(mainId, formId); + String nodeName = (String) currentNodeConfig.get("nodeName"); + String amount = mapper.selectAmountByProjectId(projectId, + Util.getCusConfigValueNullOrEmpty(projectIdField, ""), + Util.getCusConfigValueNullOrEmpty(amountTable, ""), + Util.getCusConfigValueNullOrEmpty(amountField, "")); + mapper.updateStageNodeInfo(dataId, projectId, nodeName, amount); + } } @@ -54,7 +98,7 @@ public class ModeExpandSaveService { if (null == propertyArr) { return Collections.emptyMap(); } - Map mainTable = new HashMap<>(); + Map mainTable = new HashMap<>(8); for (Property property : propertyArr) { String fieldName = property.getName(); String value = property.getValue(); diff --git a/src/test/java/youhong/ai/pcn/UtilTest.java b/src/test/java/youhong/ai/pcn/UtilTest.java index 43905c9..e9095d6 100644 --- a/src/test/java/youhong/ai/pcn/UtilTest.java +++ b/src/test/java/youhong/ai/pcn/UtilTest.java @@ -72,4 +72,11 @@ public class UtilTest extends BaseTest { "3\t7738\t看剧方\t加上撒u给你\t真个吧\t736\n" + "4\t83\t就啊啥地方\t纪念活动\t你先给你\t6383"; } + + + @Test + public void testResUtil(){ + TransTestMapper mapper = Util.getMapper(TransTestMapper.class); + System.out.println(mapper.selectStudent()); + } } diff --git a/src/test/java/youhong/ai/pcn/mapper/TransTestMapper.java b/src/test/java/youhong/ai/pcn/mapper/TransTestMapper.java index c82e239..4734416 100644 --- a/src/test/java/youhong/ai/pcn/mapper/TransTestMapper.java +++ b/src/test/java/youhong/ai/pcn/mapper/TransTestMapper.java @@ -1,6 +1,7 @@ package youhong.ai.pcn.mapper; import aiyh.utils.annotation.recordset.Insert; +import aiyh.utils.annotation.recordset.Select; import aiyh.utils.annotation.recordset.SqlMapper; import youhong.ai.pcn.pojo.Student; @@ -17,4 +18,10 @@ public interface TransTestMapper { @Insert("insert into test_trans (name,age,sex) values (#{name},#{age},#{sex})") boolean insertStudent(Student student); + + + + + @Select("select id, tablename a, namelabel b, uuid c from workflow_bill where id = -43") + Student selectStudent(); } diff --git a/src/test/java/youhong/ai/pcn/pojo/Student.java b/src/test/java/youhong/ai/pcn/pojo/Student.java index 0174767..fc79ff1 100644 --- a/src/test/java/youhong/ai/pcn/pojo/Student.java +++ b/src/test/java/youhong/ai/pcn/pojo/Student.java @@ -1,7 +1,9 @@ package youhong.ai.pcn.pojo; +import aiyh.utils.annotation.recordset.SqlDbFieldAnn; import lombok.Getter; import lombok.Setter; +import lombok.ToString; /** *

@@ -13,9 +15,20 @@ import lombok.Setter; @Getter @Setter +@ToString public class Student { private int id; + + @SqlDbFieldAnn("a") private String name; + + + @SqlDbFieldAnn("b") + private String test; + + @SqlDbFieldAnn("c") + private String bcd; + private int age; private int sex; }