From 0e2e6325f3d6fb13c51c9f379d3c2da317dbd07d Mon Sep 17 00:00:00 2001 From: "chaoyang.he" Date: Wed, 17 May 2023 10:29:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=87=E4=BB=BD---?= =?UTF-8?q?=E4=BD=95=E6=9C=9D=E9=98=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GMGatherOtherSystemInfoController.java | 43 +++ .../controller/GMGatherSMInfoController.java | 15 ++ .../GMGatherSameSystemInfoController.java | 39 +++ .../mapper/GMGatherOtherSystemInfoMapper.java | 14 + .../mapper/GMGatherSMInfoMapper.java | 7 + .../mapper/GMGatherSameSystemInfoMapper.java | 37 +++ .../GMGatherOtherSystemInfoService.java | 6 + .../service/GMGatherSMInfoService.java | 4 + .../GMGatherSameSystemInfoService.java | 5 + .../GMGatherOtherSystemInfoServiceImpl.java | 101 +++++++ .../impl/GMGatherSMInfoServiceImpl.java | 7 + .../GMGatherSameSystemInfoServiceImpl.java | 162 ++++++++++++ .../SMCountLowGroupDataController.java | 73 ++++++ .../mapper/SMCountLowGroupDataMapper.java | 56 ++++ .../service/SMCountLowGroupDataService.java | 9 + .../impl/SMCountLowGroupDataServiceImpl.java | 248 ++++++++++++++++++ 16 files changed, 826 insertions(+) create mode 100644 src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/controller/GMGatherOtherSystemInfoController.java create mode 100644 src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/controller/GMGatherSMInfoController.java create mode 100644 src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/controller/GMGatherSameSystemInfoController.java create mode 100644 src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/mapper/GMGatherOtherSystemInfoMapper.java create mode 100644 src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/mapper/GMGatherSMInfoMapper.java create mode 100644 src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/mapper/GMGatherSameSystemInfoMapper.java create mode 100644 src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/GMGatherOtherSystemInfoService.java create mode 100644 src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/GMGatherSMInfoService.java create mode 100644 src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/GMGatherSameSystemInfoService.java create mode 100644 src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/impl/GMGatherOtherSystemInfoServiceImpl.java create mode 100644 src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/impl/GMGatherSMInfoServiceImpl.java create mode 100644 src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/impl/GMGatherSameSystemInfoServiceImpl.java create mode 100644 src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/smcountlowgruop/controller/SMCountLowGroupDataController.java create mode 100644 src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/smcountlowgruop/mapper/SMCountLowGroupDataMapper.java create mode 100644 src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/smcountlowgruop/service/SMCountLowGroupDataService.java create mode 100644 src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/smcountlowgruop/service/impl/SMCountLowGroupDataServiceImpl.java diff --git a/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/controller/GMGatherOtherSystemInfoController.java b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/controller/GMGatherOtherSystemInfoController.java new file mode 100644 index 0000000..cc9678f --- /dev/null +++ b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/controller/GMGatherOtherSystemInfoController.java @@ -0,0 +1,43 @@ +package weaver.chaoyang.he.hcy_hangtiankeji.gmgetdatafromlowgroup.controller; + + +import aiyh.utils.Util; +import org.apache.log4j.Logger; +import weaver.chaoyang.he.hcy_hangtiankeji.gmgetdatafromlowgroup.service.GMGatherOtherSystemInfoService; +import weaver.chaoyang.he.hcy_hangtiankeji.gmgetdatafromlowgroup.service.impl.GMGatherOtherSystemInfoServiceImpl; +import weaver.interfaces.schedule.BaseCronJob; + +/** + *

GM集团获取GM集团下级单位合同台账信息

+ * @author hcy + * @date 2023/5/9 13:56 + */ +public class GMGatherOtherSystemInfoController extends BaseCronJob { + + //日志处理 + private final Logger logger = Util.getLogger(); + + private final GMGatherOtherSystemInfoService gmgatherOtherSystemInfoService = (GMGatherOtherSystemInfoService) new GMGatherOtherSystemInfoServiceImpl(); + + //同步标准:0 同步全量数据 1 同步前一天的数据 + public String syncStandard; + + //GM集团获取GM集团下级单位的url + public String URL; + + //GM集团数据库表名 + public String formTableNameGM; + + public void execute() { + try { + boolean insertDataBool = gmgatherOtherSystemInfoService.insertDataIntoGM(syncStandard,URL,formTableNameGM); + if (insertDataBool){ + logger.info("GM集团获取GM集团下级单位合同台账信息执行成功!"); + }else { + logger.error("GM集团获取GM集团下级单位合同台账信息执行失败!"); + } + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/controller/GMGatherSMInfoController.java b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/controller/GMGatherSMInfoController.java new file mode 100644 index 0000000..5660339 --- /dev/null +++ b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/controller/GMGatherSMInfoController.java @@ -0,0 +1,15 @@ +package weaver.chaoyang.he.hcy_hangtiankeji.gmgetdatafromlowgroup.controller; + +import weaver.interfaces.schedule.BaseCronJob; + +/** + *

GM集团获取商密集团合同台账信息

+ * @author hcy + * @date 2023/5/9 18:20 + */ +public class GMGatherSMInfoController extends BaseCronJob { + + public void execute() { + + } +} diff --git a/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/controller/GMGatherSameSystemInfoController.java b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/controller/GMGatherSameSystemInfoController.java new file mode 100644 index 0000000..cb5dafd --- /dev/null +++ b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/controller/GMGatherSameSystemInfoController.java @@ -0,0 +1,39 @@ +package weaver.chaoyang.he.hcy_hangtiankeji.gmgetdatafromlowgroup.controller; + +import aiyh.utils.Util; +import org.apache.log4j.Logger; +import weaver.chaoyang.he.hcy_hangtiankeji.gmgetdatafromlowgroup.service.GMGatherSameSystemInfoService; +import weaver.chaoyang.he.hcy_hangtiankeji.gmgetdatafromlowgroup.service.impl.GMGatherSameSystemInfoServiceImpl; +import weaver.interfaces.schedule.BaseCronJob; + + +/** + *

前提条件:GM集团与GM下级单位使用同一套系统,由GM集团每日执行定时任务,将对应的下级单位台账信息进行数据同步

+ * @author hcy + * @date 2023/5/9 17:16 + */ +public class GMGatherSameSystemInfoController extends BaseCronJob { + + + //业务主要逻辑 + private final GMGatherSameSystemInfoService gmgatherSameSystemInfoService = (GMGatherSameSystemInfoService) new GMGatherSameSystemInfoServiceImpl(); + + //日志处理 + private final Logger logger = Util.getLogger(); + + //配置表主表名称 + public String configurationMainTableName; + + //配置表明细表1名称 + public String configurationDetailTableName1; + + //配置表明细表2名称 + public String configurationDetailTableName2; + + //唯一标识 + public String uniqueIdentification; + + public void execute() { + gmgatherSameSystemInfoService.dealMainLogic(configurationMainTableName,configurationDetailTableName1,configurationDetailTableName2,uniqueIdentification); + } +} diff --git a/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/mapper/GMGatherOtherSystemInfoMapper.java b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/mapper/GMGatherOtherSystemInfoMapper.java new file mode 100644 index 0000000..8abf1dd --- /dev/null +++ b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/mapper/GMGatherOtherSystemInfoMapper.java @@ -0,0 +1,14 @@ +package weaver.chaoyang.he.hcy_hangtiankeji.gmgetdatafromlowgroup.mapper; + +import aiyh.utils.annotation.recordset.ParamMapper; +import aiyh.utils.annotation.recordset.Select; +import aiyh.utils.annotation.recordset.SqlMapper; + +@SqlMapper +public interface GMGatherOtherSystemInfoMapper { + + @Select("insert into $t{formTableNameGM} $t{keys} value $t{values}") + boolean insertData(@ParamMapper("formTableNameGM") String formTableNameGM, + @ParamMapper("keys") String keys, + @ParamMapper("values") String values); +} diff --git a/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/mapper/GMGatherSMInfoMapper.java b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/mapper/GMGatherSMInfoMapper.java new file mode 100644 index 0000000..97ace43 --- /dev/null +++ b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/mapper/GMGatherSMInfoMapper.java @@ -0,0 +1,7 @@ +package weaver.chaoyang.he.hcy_hangtiankeji.gmgetdatafromlowgroup.mapper; + +import aiyh.utils.annotation.recordset.SqlMapper; + +@SqlMapper +public class GMGatherSMInfoMapper { +} diff --git a/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/mapper/GMGatherSameSystemInfoMapper.java b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/mapper/GMGatherSameSystemInfoMapper.java new file mode 100644 index 0000000..6655d4a --- /dev/null +++ b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/mapper/GMGatherSameSystemInfoMapper.java @@ -0,0 +1,37 @@ +package weaver.chaoyang.he.hcy_hangtiankeji.gmgetdatafromlowgroup.mapper; + +import aiyh.utils.annotation.recordset.ParamMapper; +import aiyh.utils.annotation.recordset.Select; +import aiyh.utils.annotation.recordset.SqlMapper; + +import java.util.List; +import java.util.Map; + +@SqlMapper +public interface GMGatherSameSystemInfoMapper { + + + @Select("select * from #{configurationMainTableName} where wybs = #{uniqueIdentification}") + List> getConfigInformation(@ParamMapper("configurationMainTableName") String configurationMainTableName, + @ParamMapper("uniqueIdentification") String uniqueIdentification); + + @Select("select * from #{configurationDetailTableName1} where mainid = #{mainid}") + List> getConfigDetal1Information(@ParamMapper("configurationDetailTableName1")String configurationDetailTableName1, + @ParamMapper("mainid")String mainid); + + @Select("select * from #{configurationDetailTableName2} where mainid = #{mainid}") + List> getConfigDetal2Information(@ParamMapper("configurationDetailTableName2")String configurationDetailTableName2, + @ParamMapper("mainid")String mainid); + + @Select("select * from #{ejdwtzb_name} where LEFT(modedatacreatedate,7) = LEFT(#{yesterday},7)") + List> getSMCountLowGroupdata(@ParamMapper("ejdwtzb_name")String ejdwtzb_name, + @ParamMapper("yesterday")String yesterday); + + @Select("select * from #{ejdwtzb_name} where LEFT(modedatacreatedate,7) = LEFT(#{yesterday},7)") + List> getSMCountLowGroupDataUpdate(@ParamMapper("ejdwtzb_name")String ejdwtzb_name, + @ParamMapper("yesterday")String yesterday); + + @Select("select * from #{jttzbd} where htbm = #{htbm}") + List> selectHtbmData(@ParamMapper("jttzbd")String jttzbd, + @ParamMapper("htbm")String htbm); +} diff --git a/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/GMGatherOtherSystemInfoService.java b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/GMGatherOtherSystemInfoService.java new file mode 100644 index 0000000..0791018 --- /dev/null +++ b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/GMGatherOtherSystemInfoService.java @@ -0,0 +1,6 @@ +package weaver.chaoyang.he.hcy_hangtiankeji.gmgetdatafromlowgroup.service; + +public interface GMGatherOtherSystemInfoService { + + boolean insertDataIntoGM(String syncStandard, String url,String formTableNameGM); +} diff --git a/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/GMGatherSMInfoService.java b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/GMGatherSMInfoService.java new file mode 100644 index 0000000..e985245 --- /dev/null +++ b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/GMGatherSMInfoService.java @@ -0,0 +1,4 @@ +package weaver.chaoyang.he.hcy_hangtiankeji.gmgetdatafromlowgroup.service; + +public interface GMGatherSMInfoService { +} diff --git a/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/GMGatherSameSystemInfoService.java b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/GMGatherSameSystemInfoService.java new file mode 100644 index 0000000..a08081e --- /dev/null +++ b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/GMGatherSameSystemInfoService.java @@ -0,0 +1,5 @@ +package weaver.chaoyang.he.hcy_hangtiankeji.gmgetdatafromlowgroup.service; + +public interface GMGatherSameSystemInfoService { + void dealMainLogic(String configurationMainTableName, String configurationDetailTableName1, String configurationDetailTableName2, String uniqueIdentification); +} diff --git a/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/impl/GMGatherOtherSystemInfoServiceImpl.java b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/impl/GMGatherOtherSystemInfoServiceImpl.java new file mode 100644 index 0000000..f7acfb8 --- /dev/null +++ b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/impl/GMGatherOtherSystemInfoServiceImpl.java @@ -0,0 +1,101 @@ +package weaver.chaoyang.he.hcy_hangtiankeji.gmgetdatafromlowgroup.service.impl; + +import aiyh.utils.Util; +import aiyh.utils.httpUtil.ResponeVo; +import aiyh.utils.httpUtil.util.HttpUtils; +import com.wbi.util.StringUtil; +import org.apache.log4j.Logger; +import weaver.chaoyang.he.hcy_hangtiankeji.gmgetdatafromlowgroup.mapper.GMGatherOtherSystemInfoMapper; +import weaver.chaoyang.he.hcy_hangtiankeji.gmgetdatafromlowgroup.service.GMGatherOtherSystemInfoService; + + +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GMGatherOtherSystemInfoServiceImpl implements GMGatherOtherSystemInfoService { + + + //日志处理 + private final Logger logger = Util.getLogger(); + //sql + private final GMGatherOtherSystemInfoMapper gmGatherOtherSystemInfoMapper = Util.getMapper(GMGatherOtherSystemInfoMapper.class); + + public boolean insertDataIntoGM(String syncStandard, String URL,String formTableNameGM) { + try { + if (StringUtil.isNotBlank(syncStandard) && "0".equals(syncStandard)){ + //连接GM下级单位暴露的接口获取台账所有的数据 + this.getEntityInsertDB(syncStandard,URL,formTableNameGM); + + }else if (StringUtil.isNotBlank(syncStandard) && "1".equals(syncStandard)){ + //连接GM下级单位暴露的接口获取前一天的数据 + this.getEntityInsertDB(syncStandard,URL,formTableNameGM); + } + } catch (Exception e) { + e.printStackTrace(); + } + return false; + } + + public boolean getEntityInsertDB(String syncStandard, String URL,String formTableNameGM) { + try { + ResponeVo responeVo = getEntityMap(syncStandard, URL); + int code = responeVo.getCode(); + if (code != 200) { + logger.info("对方接口状态码为:" + code + " 程序执行错误"); + return false; + } + Map entityMap = responeVo.getResponseMap(); +// Map entityMap = responeVo.getEntityMap(); +// logger.info("接口返回的参数如下===" + entityMap); + List> datas = (List>) entityMap.get("data"); + + if (datas.isEmpty()) return false;//数据为空返回:数据为空 + int num = 0; +// Map totalDataMap = new HashMap<>(); + for (Map totalDataMap : datas) { + +// totalDataMap = (Map) data;//主要数据 + String keys = "("; + String values = "("; + for (Map.Entry entry : totalDataMap.entrySet()) { + String k = entry.getKey(); + String v = Util.null2String(entry.getValue()); + keys += k + ","; + values += v + ","; + } + keys = keys.substring(0, keys.length() - 1) + ")"; + values = values.substring(0, values.length() - 1) + ")"; + //todo:数据插入之前需要先进行数据校验 + //todo:改一下这个sql + boolean insertDataDataBool = gmGatherOtherSystemInfoMapper.insertData(formTableNameGM, keys, values); + if (!insertDataDataBool) { + num++; + logger.info("数据同步失败第" + num + "次"); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return false; + } + + /** + * 访问国密下级单位暴露的接口,获取ResponeVo + * @param syncStandard 同步标准:0 同步全量数据 1 同步前一天的数据 + * @param URL 接口访问路径 + * @return + */ + public ResponeVo getEntityMap(String syncStandard, String URL){ + try { + HttpUtils httpUtils = new HttpUtils(); + Map paramsMap = new HashMap<>(); + paramsMap.put("syncStandard", syncStandard); + return httpUtils.apiPost(URL, paramsMap); + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/impl/GMGatherSMInfoServiceImpl.java b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/impl/GMGatherSMInfoServiceImpl.java new file mode 100644 index 0000000..5c6c05f --- /dev/null +++ b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/impl/GMGatherSMInfoServiceImpl.java @@ -0,0 +1,7 @@ +package weaver.chaoyang.he.hcy_hangtiankeji.gmgetdatafromlowgroup.service.impl; + + +import weaver.chaoyang.he.hcy_hangtiankeji.gmgetdatafromlowgroup.service.GMGatherSMInfoService; + +public class GMGatherSMInfoServiceImpl implements GMGatherSMInfoService { +} diff --git a/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/impl/GMGatherSameSystemInfoServiceImpl.java b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/impl/GMGatherSameSystemInfoServiceImpl.java new file mode 100644 index 0000000..acd606e --- /dev/null +++ b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/gmgetdatafromlowgroup/service/impl/GMGatherSameSystemInfoServiceImpl.java @@ -0,0 +1,162 @@ +package weaver.chaoyang.he.hcy_hangtiankeji.gmgetdatafromlowgroup.service.impl; + +import aiyh.utils.Util; +import com.google.common.base.Joiner; +import com.weaver.formmodel.util.DateHelper; +import org.apache.log4j.Logger; +import weaver.chaoyang.he.hcy_hangtiankeji.gmgetdatafromlowgroup.mapper.GMGatherSameSystemInfoMapper; +import weaver.chaoyang.he.hcy_hangtiankeji.gmgetdatafromlowgroup.service.GMGatherSameSystemInfoService; +import weaver.conn.RecordSet; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class GMGatherSameSystemInfoServiceImpl implements GMGatherSameSystemInfoService { + /** + * 日志 + */ + private final Logger logger = Util.getLogger(); + + //sql + private final GMGatherSameSystemInfoMapper gmGatherSameSystemInfoMapper = Util.getMapper(GMGatherSameSystemInfoMapper.class); + + /** + * 处理从国密集团下级单位台账数据库查询数据向国密集团总台账数据库中插入或者更新数据 + * @param configurationMainTableName 配置表主表名称 + * @param configurationDetailTableName1 配置表明细表1名称 + * @param configurationDetailTableName2 配置表明细表2名称 + * @param uniqueIdentification 唯一标识 + */ + public void dealMainLogic(String configurationMainTableName, String configurationDetailTableName1, String configurationDetailTableName2, String uniqueIdentification) { + //第一步获取配置表中数据 + if (configurationMainTableName.equals("") && configurationDetailTableName1.equals("") && uniqueIdentification.equals("")) return; + //主表数据 + List> configMainTableData = gmGatherSameSystemInfoMapper.getConfigInformation(configurationMainTableName,uniqueIdentification); + logger.info("配置表主表数据---configMainTableData---"+configMainTableData); + if (configMainTableData.isEmpty()) return; + + String jttzbd = Util.null2String(configMainTableData.get(0).get("jttzbd"));//集团台账表单 + String mainid = Util.null2String(configMainTableData.get(0).get("mainid")); + logger.info("配置表主表数据---mainid---"+mainid); + if (mainid.equals("")) return; + + //配置表明细表1数据:用来统计商密下级单位台账名称 + List> configDetal1TableData = gmGatherSameSystemInfoMapper.getConfigDetal1Information(configurationDetailTableName1,mainid); + logger.info("配置表明细表数据---configDetal1TableData---"+configDetal1TableData); + //明细表2数据 + List> configDetal2TableData = gmGatherSameSystemInfoMapper.getConfigDetal2Information(configurationDetailTableName2,mainid); + logger.info("配置表明细表数据---configDetal2TableData---"+configDetal2TableData); + List keys = new ArrayList<>();//用于insert和update的key + for (Map configdetal2 : configDetal2TableData) { + keys.add(Util.null2String(configdetal2.get("tbzd"))); + } + + +//第二步:其次我们需要根据数据创建时间,和数据修改时间来判断二级单位中的这条数据是第一次进来的,还是二次进来修改的,如果只有创建时间没有修改时间那么就对这条数据进行增加,如果既有创建时间又有修改时间,那么就需要将这条数据进行修改 + if (configDetal1TableData.isEmpty()) return; + for (Map config1 : configDetal1TableData) { + String ejdwtzb_name = Util.null2String(config1.get("ejdwtzb")); //二级单位台账表数据库名称 + String bz = Util.null2String(config1.get("bz")); //备注 + logger.info("二级单位台账表数据库名称===="+ejdwtzb_name+" 二级单位台账表数名称==="+bz); + //获取当天日期的前一天,如果和创建时间吻合,并且满足修改时间为空那么,这条数据就是纯插入的数据 + List> smCountLowGroupDataInsert = gmGatherSameSystemInfoMapper.getSMCountLowGroupdata(ejdwtzb_name, DateHelper.getYesterday()); + logger.info("smCountLowGroupDataInsert===="+smCountLowGroupDataInsert); + + //获取当天日期的前一天,如果和修改时间吻合,那么这条数据就是更新操作的数据 + List> smCountLowGroupDataupdate = gmGatherSameSystemInfoMapper.getSMCountLowGroupDataUpdate(ejdwtzb_name,DateHelper.getYesterday()); + logger.info("smCountLowGroupDataupdate===="+smCountLowGroupDataupdate); + + //数据插入商密集团总台账 + if (smCountLowGroupDataInsert.size()>0){ + this.insertData(smCountLowGroupDataInsert,jttzbd,keys); + } + //数据更新商密集团总台账 + if (smCountLowGroupDataupdate.size()>0){ + this.updateData(smCountLowGroupDataupdate,jttzbd,keys); + } + } + } + + + /** + *

插入数据

+ * @param smCountLowGroupDataInsert 插入数据集合 + * @param jttzbd 集团台账数据库名 + * @param keys 需要insert的字段key + * @author hcy + * 2023/5/6 17:41 + */ + private void insertData(List> smCountLowGroupDataInsert, String jttzbd,List keys) { + + RecordSet recordSet = new RecordSet(); + for (Map insertDatas : smCountLowGroupDataInsert) { + String htbm = Util.null2String(insertDatas.get("htbm")); + List> selectHtbmData = gmGatherSameSystemInfoMapper.selectHtbmData(jttzbd,htbm); + if (selectHtbmData.size()==0){ + + String insertKey = Joiner.on(",").join((Iterable) keys);//key + ArrayList valueList = new ArrayList<>(); + for (String key : keys) { + String v = Util.null2String(insertDatas.get(key)); + valueList.add(v); + } + + String insertValue = Joiner.on(",").join((Iterable) valueList);//value + + String insertSql = "insert into "+jttzbd + "(" +insertKey + ")"+ "value " +"("+insertValue+")";//拼接插入的sql语句 + boolean insertBool = recordSet.executeQuery(insertSql); + if (insertBool){ + logger.info("数据插入成功"); + }else{ + logger.info("数据插入失败"); + } + } + } + } + + /** + *

更新数据

+ * @param smCountLowGroupDataupdate 更新语句集合 + * @param jttzbd 集团台账数据库名 + * @param keys 数据更新的key组成的集合 + * @author hcy + * 2023/5/6 17:40 + */ + + private void updateData(List> smCountLowGroupDataupdate, String jttzbd, List keys) { + try { + + RecordSet recordSet = new RecordSet(); + for (Map updateDates : smCountLowGroupDataupdate) { + String htbm = Util.null2String(updateDates.get("htbm")); + List> updateDatas = gmGatherSameSystemInfoMapper.selectHtbmData(jttzbd, htbm); + if (updateDatas.size()>0){ + //拼接sql + List updateValueList = new ArrayList<>(); + for (String key : keys) { + String value = Util.null2String(updateDates.get(key)); + updateValueList.add(value); + } + StringBuilder builder = new StringBuilder(); + + Joiner.on(", ").appendTo(builder, keys); + builder.append(" = "); + Joiner.on(", ").appendTo(builder, updateValueList); + + + String updateSql = "update "+jttzbd + "set " + builder + " where htbm = ?"; + boolean updateBool = recordSet.executeQuery(updateSql, htbm); + if (updateBool){ + logger.info("======数据更新成功======"); + }else { + logger.info("======数据更新失败======"); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + logger.info("----GMGatherSameSystemInfoServiceImpl----smCountLowGroupDataupdate----异常如下===="+e); + } + } +} diff --git a/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/smcountlowgruop/controller/SMCountLowGroupDataController.java b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/smcountlowgruop/controller/SMCountLowGroupDataController.java new file mode 100644 index 0000000..e0c6897 --- /dev/null +++ b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/smcountlowgruop/controller/SMCountLowGroupDataController.java @@ -0,0 +1,73 @@ +package weaver.chaoyang.he.hcy_hangtiankeji.smcountlowgruop.controller; + +import aiyh.utils.Util; +import lombok.SneakyThrows; +import org.apache.log4j.Logger; +import weaver.chaoyang.he.hcy_hangtiankeji.smcountlowgruop.service.SMCountLowGroupDataService; +import weaver.chaoyang.he.hcy_hangtiankeji.smcountlowgruop.service.impl.SMCountLowGroupDataServiceImpl; +import weaver.interfaces.schedule.BaseCronJob; + +/** + *

由于商密集团与商密下级单位使用同一套环境,所以可以使用定时任务的方式,商密集团每日执行定时任务,将下级单位的台账信息同步到商密集团的台账中

+ * @Author hcy + * @Date 2023/4/26 18:14 + */ +public class SMCountLowGroupDataController extends BaseCronJob { + + //业务主要逻辑 + private final SMCountLowGroupDataService smCountLowGroupData = (SMCountLowGroupDataService) new SMCountLowGroupDataServiceImpl(); + + //日志处理 + private final Logger logger = Util.getLogger(); + + //配置表主表名称 + public String configurationMainTableName; + + //配置表明细表1名称 + public String configurationDetailTableName1; + + //配置表明细表2名称 + public String configurationDetailTableName2; + + //唯一标识 + public String uniqueIdentification; + + @SneakyThrows + public void execute() { + smCountLowGroupData.dealMainLogic(configurationMainTableName,configurationDetailTableName1,configurationDetailTableName2,uniqueIdentification);//处理业务主要逻辑 + } + + public String getConfigurationDetailTableName1() { + return configurationDetailTableName1; + } + + public void setConfigurationDetailTableName1(String configurationDetailTableName1) { + this.configurationDetailTableName1 = configurationDetailTableName1; + } + + public String getConfigurationDetailTableName2() { + return configurationDetailTableName2; + } + + public void setConfigurationDetailTableName2(String configurationDetailTableName2) { + this.configurationDetailTableName2 = configurationDetailTableName2; + } + + + + public String getConfigurationMainTableName() { + return configurationMainTableName; + } + + public void setConfigurationMainTableName(String configurationMainTableName) { + this.configurationMainTableName = configurationMainTableName; + } + + public String getUniqueIdentification() { + return uniqueIdentification; + } + + public void setUniqueIdentification(String uniqueIdentification) { + this.uniqueIdentification = uniqueIdentification; + } +} diff --git a/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/smcountlowgruop/mapper/SMCountLowGroupDataMapper.java b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/smcountlowgruop/mapper/SMCountLowGroupDataMapper.java new file mode 100644 index 0000000..dfa1646 --- /dev/null +++ b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/smcountlowgruop/mapper/SMCountLowGroupDataMapper.java @@ -0,0 +1,56 @@ +package weaver.chaoyang.he.hcy_hangtiankeji.smcountlowgruop.mapper; + +import aiyh.utils.annotation.recordset.ParamMapper; +import aiyh.utils.annotation.recordset.Select; +import aiyh.utils.annotation.recordset.SqlMapper; + +import java.util.List; +import java.util.Map; + +@SqlMapper +public interface SMCountLowGroupDataMapper { + + @Select("select * from $t{configurationMainTableName} where wybs = #{uniqueIdentification}") + List> getConfigInformation(@ParamMapper("configurationMainTableName") String configurationMainTableName, + @ParamMapper("uniqueIdentification") String uniqueIdentification); + + @Select("select * from $t{configurationDetailTableName1} where mainid = #{mainid}") + List> getConfigDetal1Information(@ParamMapper("configurationDetailTableName1")String configurationDetailTableName1, + @ParamMapper("mainid")String mainid); + + @Select("select * from $t{configurationDetailTableName2} where mainid = #{mainid}") + List> getConfigDetal2Information(@ParamMapper("configurationDetailTableName2")String configurationDetailTableName2, + @ParamMapper("mainid")String mainid); + + @Select("select * from $t{ejdwtzb_name} where LEFT(modedatacreatedate,7) = LEFT(#{yesterday},7)") + List> getSMCountLowGroupdata(@ParamMapper("ejdwtzb_name")String ejdwtzb_name, + @ParamMapper("yesterday")String yesterday); + + @Select("select * from $t{ejdwtzb_name} where LEFT(modedatacreatedate,7) = LEFT(#{yesterday},7)") + List> getSMCountLowGroupDataUpdate(@ParamMapper("ejdwtzb_name")String ejdwtzb_name, + @ParamMapper("yesterday")String yesterday); + + @Select("select * from $t{jttzbd} where htbm = #{htbm}") + List> selectHtbmData(@ParamMapper("jttzbd")String jttzbd, + @ParamMapper("htbm")String htbm); + + @Select("select * from $t{ejdwtzb_name}") + List> getSMCountLowGroupTotalData(@ParamMapper("ejdwtzb_name") String ejdwtzb_name); + + @Select("select id from $t{jttzbd} where htbm = #{htbm}") + String selectIdByHtbm(@ParamMapper("jttzbd")String jttzbd, + @ParamMapper("htbm")String htbm); + + + @Select("delete from $t{s} where mainid = #{id}") + boolean deleteDetalDataByMainId(@ParamMapper("s")String s, + @ParamMapper("id")String id); + + + @Select("select id from $t{ejdwtzb_name} where id = #{htbm1}") + String selectDetailTableSouceId(@ParamMapper("ejdwtzb_name")String ejdwtzb_name, + @ParamMapper("htbm1")String htbm1); + @Select("select * from $t{s} where mainid = #{ejdw_id}") + List> selectDetailTableSouceData(String s, String ejdw_id); + +} diff --git a/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/smcountlowgruop/service/SMCountLowGroupDataService.java b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/smcountlowgruop/service/SMCountLowGroupDataService.java new file mode 100644 index 0000000..2592148 --- /dev/null +++ b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/smcountlowgruop/service/SMCountLowGroupDataService.java @@ -0,0 +1,9 @@ +package weaver.chaoyang.he.hcy_hangtiankeji.smcountlowgruop.service; + +import java.io.IOException; + +public interface SMCountLowGroupDataService { + + + void dealMainLogic(String configurationMainTableName, String configurationDetailTableName1, String configurationDetailTableName2, String uniqueIdentification) throws IOException; +} diff --git a/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/smcountlowgruop/service/impl/SMCountLowGroupDataServiceImpl.java b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/smcountlowgruop/service/impl/SMCountLowGroupDataServiceImpl.java new file mode 100644 index 0000000..6fda1b7 --- /dev/null +++ b/src/main/java/weaver/chaoyang/he/hcy_hangtiankeji/smcountlowgruop/service/impl/SMCountLowGroupDataServiceImpl.java @@ -0,0 +1,248 @@ +package weaver.chaoyang.he.hcy_hangtiankeji.smcountlowgruop.service.impl; + +import aiyh.utils.Util; +import aiyh.utils.sqlUtil.builderSql.impl.BuilderSqlImpl; +import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl; +import aiyh.utils.sqlUtil.whereUtil.impl.PrepWhereImpl; +import com.weaver.formmodel.util.DateHelper; +import org.apache.log4j.Logger; +import weaver.chaoyang.he.hcy_hangtiankeji.smcountlowgruop.mapper.SMCountLowGroupDataMapper; +import weaver.chaoyang.he.hcy_hangtiankeji.smcountlowgruop.service.SMCountLowGroupDataService; +import weaver.conn.RecordSet; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +// 3、开发补充详细开发方案 +// (1)我们现在要做的事情就是要将商密下级单位台账表中的数据同步到商密集团台账表uf_hthpjtz中 +// (2)首先我们需要根据合同台账同步表uf_httztb来获取数据库二级单位表名称和想要同步不来的字段名称,这里要求做成配置的是因为后续便于字段增删 +// (3)其次我们需要根据数据创建时间,和数据修改时间来判断二级单位中的这条数据是第一次进来的,还是二次进来修改的,如果只有创建时间没有修改时间那么就对这条数据进行增加,如果既有创建时间又有修改时间,那么就需要将这条数据进行修改 +// (4)在向商密集团总台账插入数据的时候,同时为了保证数据的准确性,我们首先需要根据合同编码来查询合同总台账中查询本条数据是否已经存在,如果存在执行更新操作,如果不存在执行插入操作。 +public class SMCountLowGroupDataServiceImpl implements SMCountLowGroupDataService { + + //处理sql + private final SMCountLowGroupDataMapper smCountLowGroupDataMapper = Util.getMapper(SMCountLowGroupDataMapper.class); + + //构建inser、update 的sql语句 + private final BuilderSqlImpl builderSqlImpl = new BuilderSqlImpl(); + + //日志 + private final Logger logger = Util.getLogger(); + + /** + *

处理从商密二级单位台账数据库查询数据向商密集团总台账数据库中插入或者更新数据

+ * @author hcy 2023/5/6 14:59 + */ + public void dealMainLogic(String configurationMainTableName, String configurationDetailTableName1, String configurationDetailTableName2, String uniqueIdentification) throws IOException { + //第一步获取配置表中数据 + if (configurationMainTableName.equals("") && configurationDetailTableName1.equals("") && uniqueIdentification.equals("")) return; + //主表数据 + List> configMainTableData = smCountLowGroupDataMapper.getConfigInformation(configurationMainTableName,uniqueIdentification); + logger.info("配置表主表数据---configMainTableData---"+configMainTableData); + if (configMainTableData.isEmpty()) return; + + String jttzbd = Util.null2String(configMainTableData.get(0).get("jttzbd"));//集团台账表单 + String mainid = Util.null2String(configMainTableData.get(0).get("id")); + logger.info("配置表主表数据---mainid---"+mainid); + if (mainid.equals("") && "".equals(jttzbd)) return; + + //配置表明细表1数据:用来统计商密下级单位台账名称 + List> configDetal1TableData = smCountLowGroupDataMapper.getConfigDetal1Information(configurationDetailTableName1,mainid); + logger.info("配置表明细表数据---configDetal1TableData---"+configDetal1TableData); + //明细表2数据 + List> configDetal2TableData = smCountLowGroupDataMapper.getConfigDetal2Information(configurationDetailTableName2,mainid); + logger.info("配置表明细表数据---configDetal2TableData---"+configDetal2TableData); + List mainTablekeys = new ArrayList<>();//用于存放主表中insert和update的key + List detalTablekeys = new ArrayList<>();//用于存放主表中insert和update的key + for (Map configdetal2 : configDetal2TableData) { + String sfzb = Util.null2String(configdetal2.get("sfzb")); + if ("0".equals(sfzb)){ + mainTablekeys.add(Util.null2String(configdetal2.get("tbzd"))); + }else if ("1".equals(sfzb)){ + detalTablekeys.add(Util.null2String(configdetal2.get("tbzd"))); + } + } + + +//第二步:其次我们需要根据数据创建时间,和数据修改时间来判断二级单位中的这条数据是第一次进来的,还是二次进来修改的,如果只有创建时间没有修改时间那么就对这条数据进行增加,如果既有创建时间又有修改时间,那么就需要将这条数据进行修改 + if (configDetal1TableData.isEmpty()) return; + for (Map config1 : configDetal1TableData) { + String ejdwtzb_name = Util.null2String(config1.get("ejdwtzb")); //二级单位台账表数据库名称 + String bz = Util.null2String(config1.get("bz")); //备注 + String tbzt = Util.null2String(config1.get("tbzt")); + logger.info("二级单位台账表数据库名称===="+ejdwtzb_name+" 二级单位台账表数名称==="+bz+" 同步状态==="+tbzt); + + if ("0".equals(tbzt)){ + //查询全量数据 + List> smCountLowGroupTotalData = smCountLowGroupDataMapper.getSMCountLowGroupTotalData(ejdwtzb_name);//第一次同步数据 + if (smCountLowGroupTotalData.size()>0){ + this.insertData(smCountLowGroupTotalData,jttzbd,ejdwtzb_name,mainTablekeys,detalTablekeys,tbzt);//全增量主表数据执行插入 并且包含明细表的删除,和再次添加 + } + }else if ("1".equals(tbzt)){ //非第一次同步数据 + //获取当天日期的前一天,如果和创建时间吻合,并且满足修改时间为空那么,这条数据就是纯插入的数据 + List> smCountLowGroupDataInsert = smCountLowGroupDataMapper.getSMCountLowGroupdata(ejdwtzb_name,DateHelper.getYesterday()); + logger.info("smCountLowGroupDataInsert===="+smCountLowGroupDataInsert); + + //获取当天日期的前一天,如果和修改时间吻合,那么这条数据就是更新操作的数据 + List> smCountLowGroupDataupdate = smCountLowGroupDataMapper.getSMCountLowGroupDataUpdate(ejdwtzb_name,DateHelper.getYesterday()); + logger.info("smCountLowGroupDataupdate===="+smCountLowGroupDataupdate); + + //数据插入商密集团总台账 + if (smCountLowGroupDataInsert.size()>0){ + this.insertData(smCountLowGroupDataInsert,jttzbd,ejdwtzb_name,mainTablekeys,detalTablekeys, tbzt); + } + //数据更新商密集团总台账 + if (smCountLowGroupDataupdate.size()>0){ + this.updateData(smCountLowGroupDataupdate,jttzbd,ejdwtzb_name,mainTablekeys,detalTablekeys); + } + } + + } + } + + + /** + *

插入数据

+ * @param smCountLowGroupDataInsert 插入数据集合 + * @param jttzbd 集团台账数据库名 + * @param ejdwtzb_name 二级单位数据库名 + * @param keys 需要insert的字段key + * @param detalTablekeys 需要插入的明细表字段数据库名组成的list + * @param tbzt 同步状态用来判断是第一次同步还是非首次同步 + * @author hcy + * 2023/5/6 17:41 + */ + private void insertData(List> smCountLowGroupDataInsert, String jttzbd, String ejdwtzb_name, List keys, List detalTablekeys, String tbzt) { + + RecordSet recordSet = new RecordSet(); + int successNum = 0; + int failNum = 0; + for (Map insertDatas : smCountLowGroupDataInsert) { + String htbm = Util.null2String(insertDatas.get("htbm")); + List> selectHtbmData = smCountLowGroupDataMapper.selectHtbmData(jttzbd,htbm); + if (selectHtbmData.size()==0){ +// String insertKey = Joiner.on(",").join((Iterable) keys);//key + Map keyValueMap = new HashMap<>(); + for (String key : keys) { + String v = Util.null2String(insertDatas.get(key)); + keyValueMap.put(key, v); + } + //执行主表数据的插入语句 + PrepSqlResultImpl prepSqlResult = builderSqlImpl.insertSql(jttzbd, keyValueMap); + if(recordSet.executeUpdate(prepSqlResult.getSqlStr(),prepSqlResult)){ + successNum++; + String htbm1 = Util.null2String(keyValueMap.get("htbm")); + //执行明细表的数据删除和数据插入 + deleteAndInsertDetailTable(htbm1,jttzbd,ejdwtzb_name,detalTablekeys); + }else{ + failNum++; + logger.error("台账数据插入失败,失败SQL:["+ prepSqlResult +"----失败次数:"+failNum+"]"); + } + logger.info("台账数据插入成功 "+successNum+"次"); + + } + } + } + + /** + *

更新数据

+ * @param smCountLowGroupDataupdate 更新语句集合 + * @param jttzbd 集团台账数据库名 + * @param ejdwtzb_name 二级单位数据库名 + * @param keys 数据更新的key组成的集合 + * @param detalTablekeys 需要插入的明细表字段数据库名组成的list + * @author hcy + * 2023/5/6 17:40 + */ + + private void updateData(List> smCountLowGroupDataupdate, String jttzbd, String ejdwtzb_name, List keys, List detalTablekeys) { + RecordSet recordSet = new RecordSet(); + int failNum = 0; + int successNum = 0; + for (Map updateDates : smCountLowGroupDataupdate) { + String htbm = Util.null2String(updateDates.get("htbm")); + List> selecthtbmData = smCountLowGroupDataMapper.selectHtbmData(jttzbd, htbm); + if (selecthtbmData.size()>0){ + Map keyValueMap = getKeyValueMap(updateDates, keys); + PrepWhereImpl prepWhere = new PrepWhereImpl(); + prepWhere.whereAnd("htbm = ?"); + prepWhere.addArgs(htbm); + PrepSqlResultImpl prepSqlResult = builderSqlImpl.updateSql(jttzbd, keyValueMap, prepWhere); + if (recordSet.executeQuery(prepSqlResult.getSqlStr(), prepSqlResult)){ + String htbm1 = Util.null2String(keyValueMap.get("htbm")); + //执行明细表的数据删除和数据插入 + deleteAndInsertDetailTable(htbm1,jttzbd,ejdwtzb_name,detalTablekeys); + successNum++; + }else { + failNum++; + logger.error("台账数据更新失败,SQL:["+ prepSqlResult +"------失败次数:"+failNum+"]"); + } + logger.info("台账数据更新成功 "+successNum + "次"); + } + } + } + + /** + * 用于封装insert或者update的key,value的map集合 + * @param datas 数据源 + * @param keys 需要更新或者插入的keys + * @return 预期的key,value对应的map集合 + */ + public Map getKeyValueMap(Map datas ,List keys){ + Map keyValueMap = new HashMap<>(); + for (String key : keys) { + String v = Util.null2String(datas.get(key)); + keyValueMap.put(key, v); + } + return keyValueMap; + } + + /** + * 删除并插入明细表中的数据 + * @param htbm1 合同编号用来作为唯一标识 + * @param jttzbd 商密集团台账数据库名称 + * @param ejdwtzb_name 二级单位名称 + * @param detalTablekeys 需要插入的明细表字段数据库名组成的list + */ + public void deleteAndInsertDetailTable(String htbm1,String jttzbd,String ejdwtzb_name,List detalTablekeys){ + + RecordSet insertDatailRS = new RecordSet(); + //执行明细表的插入语句 + String id = smCountLowGroupDataMapper.selectIdByHtbm(jttzbd,htbm1); + int successNum = 0; + int failNum = 0; + if (!"".equals(id)){ + boolean deleteBool = smCountLowGroupDataMapper.deleteDetalDataByMainId(jttzbd+"_dt1",id);//明细表插入数据之前,先执行删除语句 + if (deleteBool){ + //执行明细表插入逻辑 + String ejdw_id = smCountLowGroupDataMapper.selectDetailTableSouceId(ejdwtzb_name,htbm1); + List> souceDetailDatas = smCountLowGroupDataMapper.selectDetailTableSouceData(ejdwtzb_name+"_dt1",ejdw_id); + for (Map souceDetailData : souceDetailDatas) { + Map dealwithData = new HashMap<>();//根据配置表处理完需要字段后的数据Map + for (String key : detalTablekeys) { + dealwithData.put(key,souceDetailData.get(key)); + } + //将mainid拼进去 + dealwithData.put("mainid",id); + //开始插入明细表数据 insert into + PrepSqlResultImpl prepSqlResult = builderSqlImpl.insertSql(jttzbd, dealwithData); + if (insertDatailRS.executeUpdate(prepSqlResult.getSqlStr(),prepSqlResult.getArgs())){ + successNum++; + }else { + failNum++; + logger.error("明细表数据插入失败,SQL:["+prepSqlResult+"------失败次数:"+failNum+"]"); + } + logger.info("明细表数据插入成功数量:"+successNum); + } + + } + } + } + + + + +}