From 0ba8aebf25e2ee3b7f37c2e0e899f8e45d22e7d3 Mon Sep 17 00:00:00 2001 From: lvleigang <957075182@qq.com> Date: Wed, 19 Jun 2024 10:16:47 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=B8=BB=E6=95=B0=E6=8D=AE=E4=B8=8B?= =?UTF-8?q?=E5=8F=91=EF=BC=8C=E9=87=8D=E6=96=B0=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/MdmModulePluginInitializer.java | 33 +++++-- .../mdm/mdmModule/dao/IMdmModuleDao.java | 2 +- .../mdmModule/dao/impl/MdmModuleDaoImpl.java | 2 +- .../mdm/mdmModule/entity/MdmModuleEntity.xml | 30 ++++++ .../service/impl/MdmModuleServiceImpl.java | 17 ++++ .../entity/MdmModuleOptionLogEntity.java | 9 ++ .../entity/MdmModuleOptionLogEntity.xml | 21 ++++- .../dao/IMdmModuleSourceDao.java | 12 +-- .../dao/impl/MdmModuleSourceDaoImpl.java | 5 +- .../entity/MdmModuleSourceEntity.java | 57 +++++++++++- .../entity/MdmModuleSourceEntity.xml | 91 +++++++++++++++---- .../service/IMdmModuleSourceService.java | 2 +- .../impl/MdmModuleSourceServiceImpl.java | 2 +- 13 files changed, 235 insertions(+), 48 deletions(-) diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java index e8e9d374..52b75b12 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java @@ -13,6 +13,8 @@ import com.hzya.frame.mdm.mdmModuleDbFiledsRule.dao.IMdmModuleDbFiledsRuleDao; import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; import com.hzya.frame.mdm.mdmModuleDistribute.dao.IMdmModuleDistributeDao; import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity; +import com.hzya.frame.mdm.mdmModuleDistributeDetail.dao.IMdmModuleDistributeDetailDao; +import com.hzya.frame.mdm.mdmModuleDistributeDetail.entity.MdmModuleDistributeDetailEntity; import com.hzya.frame.mdm.service.IMdmServiceCache; import com.hzya.frame.sysnew.application.api.dao.ISysApplicationApiDao; import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity; @@ -57,7 +59,7 @@ import java.util.Map; public class MdmModulePluginInitializer extends PluginBaseEntity { Logger logger = LoggerFactory.getLogger(MdmModulePluginInitializer.class); @Resource - private IIntegrationTaskLivingDetailsDao integrationTaskLivingDetailsDao; + private IMdmModuleDistributeDetailDao mdmModuleDistributeDetailDao; @Resource private IIntegrationTaskLivingDetailsService taskLivingDetailsService; @Resource @@ -176,6 +178,11 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { return BaseResult.getFailureMessageEntity("分发已停用"); } + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity() ; + mdmModuleDistributeDetailEntity.setDistributeId(distributeId); + mdmModuleDistributeDetailEntity.setSts("Y"); + List mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity); + // 启用停用 0、停用 //if("1".equals(mdmModuleDistributeEntity.getEnabledType())){ // taskDetailEntity.setResult("分发为手动下发"); @@ -221,7 +228,6 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { taskDetailEntity.setResult("应用不存在"); taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); return BaseResult.getFailureMessageEntity("应用不存在"); - } //获取主数据db字段,以及字段的规则 @@ -232,11 +238,12 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { queryFildRule.setMdmId(mdmModuleEntity.getId()); queryFildRule.setRuleCode("service"); List mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(queryFildRule); + //获取主数据db对应的实体表的数据 JSONObject object = new JSONObject(); for (int i = 0; i < mdmModuleDbEntities.size(); i++) { if("1".equals(mdmModuleDbEntities.get(i).getDbType())){ - Map map = new HashMap<>(); + Map map = new HashMap<>(); map.put("tableName",mdmModuleDbEntities.get(i).getDbName()); map.put("documentRule",documentRule); object = mdmModuleDao.queryMdmST(map); @@ -245,6 +252,20 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); return BaseResult.getFailureMessageEntity("当前数据不存在"); } + if(mdmModuleDistributeDetailEntities != null && mdmModuleDistributeDetailEntities.size() > 0){ + for (int i1 = 0; i1 < mdmModuleDistributeDetailEntities.size(); i1++) { + Map checkData = new HashMap<>(); + checkData.put("tableName",mdmModuleDbEntities.get(i).getDbName()); + checkData.put("documentRule",documentRule); + checkData.put("mdmModuleDistributeDetailEntities",mdmModuleDistributeDetailEntities); + JSONObject object1 = mdmModuleDao.queryMdmST(checkData); + if(object1.getString("id") == null || "".equals(object1.getString("id")) ){ + taskDetailEntity.setResult("当前数据不符合规则不发送"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("当前数据不符合规则不发送"); + } + } + } //查看主表是否有字段是关联的 if(mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0){ for (int i1 = 0; i1 < mdmModuleDbFiledsRuleEntities.size(); i1++) { @@ -252,7 +273,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { if(mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0){ for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) { if(mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())){ - Map mapDetail = new HashMap<>(); + Map mapDetail = new HashMap<>(); mapDetail.put("tableName",mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue()); mapDetail.put("id",object.getString(mdmModuleDbFiledsEntities.get(i2).getEnName())); JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail); @@ -281,7 +302,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) { if(mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())){ for (int i3 = 0; i3 < detail.size(); i3++) { - Map mapDetail = new HashMap<>(); + Map mapDetail = new HashMap<>(); mapDetail.put("tableName",mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue()); mapDetail.put("id",detail.get(i3).getString(mdmModuleDbFiledsEntities.get(i2).getEnName())); JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail); @@ -326,7 +347,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { }catch (Exception e){ taskDetailEntity.setResult("分发脚本转换错误"); taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); - //return BaseResult.getFailureMessageEntity("分发脚本转换错误"); + return BaseResult.getFailureMessageEntity("分发脚本转换错误"); } } Map headers = new HashMap<>(); diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java index f40843a7..482285af 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java @@ -49,7 +49,7 @@ public interface IMdmModuleDao extends IBaseDao { Integer deleteTable(Map maps); - JSONObject queryMdmST(Map maps); + JSONObject queryMdmST(Map maps); List queryMdmSTDetail(Map maps); } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java index 36537041..d17aa1d0 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java @@ -148,7 +148,7 @@ public class MdmModuleDaoImpl extends MybatisGenericDao } @Override - public JSONObject queryMdmST(Map maps) { + public JSONObject queryMdmST(Map maps) { JSONObject o = (JSONObject) super.selectOne(getSqlIdPrifx() + "queryMdmST", maps); return o; } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml index 75ff1531..dfc09897 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml @@ -801,6 +801,36 @@ where id = #{id} and document_rule = #{documentRule} and id = #{id} + + AND + + ${item.leftBracket} ${item.filedName} + + + = + + + != + + + > + + + < + + + #{item.filedVaule} + + + and + + + or + + + ${item.rightParenthesis} + + and sts = 'Y' diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java index 2bae850a..23437fe6 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java @@ -619,6 +619,23 @@ public class MdmModuleServiceImpl extends BaseService i source_name.setDataType("1"); mdmModuleDbFiledsEntities.add(source_name); + MdmModuleDbFiledsEntity data_type = new MdmModuleDbFiledsEntity(); + data_type.setMdmId(entity.getMdmId()); + data_type.setDbId(entity.getId()); + data_type.setEnName("data_type"); + data_type.setChName("状态"); + data_type.setFiledType("3"); + data_type.setAddType("1"); + data_type.setUpdateType("1"); + data_type.setShowType("1"); + data_type.setQueryType("1"); + data_type.setListType("1"); + data_type.setViewType("1"); + data_type.setFiledLength("255"); + data_type.setCreate(); + data_type.setDataType("1"); + mdmModuleDbFiledsEntities.add(data_type); + MdmModuleDbFiledsEntity code = new MdmModuleDbFiledsEntity(); code.setMdmId(entity.getMdmId()); code.setDbId(entity.getId()); diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.java index d4af3ede..aaf6f341 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.java @@ -17,6 +17,8 @@ public class MdmModuleOptionLogEntity extends BaseEntity { private String formmainId; /** 来源名称 */ private String sourceName; + /** 状态 1、成功2、失败 */ + private String dataType; /** 编码 */ private String code; /** source_data */ @@ -28,6 +30,13 @@ public class MdmModuleOptionLogEntity extends BaseEntity { /** 公司id */ private String companyId; + public String getDataType() { + return dataType; + } + + public void setDataType(String dataType) { + this.dataType = dataType; + } public String getFormmainId() { return formmainId; diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.xml index 0ff0cabc..f6708c43 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.xml @@ -6,6 +6,7 @@ + @@ -24,7 +25,8 @@ id ,formmain_id ,source_name - ,code + ,data_type + ,code ,source_data ,option_type ,option_name @@ -51,6 +53,7 @@ and id = #{id} and formmain_id = #{formmainId} and source_name = #{sourceName} + and data_type = #{dataType} and code = #{code} and source_data = #{sourceData} and option_type = #{optionType} @@ -76,6 +79,7 @@ and id = #{id} and formmain_id = #{formmainId} and source_name = #{sourceName} + and data_type = #{dataType} and code = #{code} and source_data = #{sourceData} and option_type = #{optionType} @@ -103,6 +107,7 @@ and id like concat('%',#{id},'%') and formmain_id like concat('%',#{formmainId},'%') and source_name like concat('%',#{sourceName},'%') + and data_type like concat('%',#{dataType},'%') and code like concat('%',#{code},'%') and source_data like concat('%',#{sourceData},'%') and option_type like concat('%',#{optionType},'%') @@ -130,6 +135,7 @@ or id = #{id} or formmain_id = #{formmainId} or source_name = #{sourceName} + or data_type = #{dataType} or code = #{code} or source_data = #{sourceData} or option_type = #{optionType} @@ -155,6 +161,7 @@ id , formmain_id , source_name , + data_type , code , source_data , option_type , @@ -174,6 +181,7 @@ #{id} , #{formmainId} , #{sourceName} , + #{dataType} , #{code} , #{sourceData} , #{optionType} , @@ -192,22 +200,23 @@ - insert into ${tableName}(formmain_id, source_name, code, source_data, option_type, option_name, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) + insert into ${tableName}(formmain_id, source_name,data_type, code, source_data, option_type, option_name, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) values - (#{entity.formmainId},#{entity.sourceName},#{entity.code},#{entity.sourceData},#{entity.optionType},#{entity.optionName},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') + (#{entity.formmainId},#{entity.sourceName},#{entity.dataType},#{entity.code},#{entity.sourceData},#{entity.optionType},#{entity.optionName},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') - insert into ${tableName}(formmain_id, source_name, code, source_data, option_type, option_name, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) + insert into ${tableName}(formmain_id, source_name,data_type, code, source_data, option_type, option_name, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) values - (#{entity.formmainId},#{entity.sourceName},#{entity.code},#{entity.sourceData},#{entity.optionType},#{entity.optionName},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) + (#{entity.formmainId},#{entity.sourceName},#{entity.dataType},#{entity.code},#{entity.sourceData},#{entity.optionType},#{entity.optionName},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) on duplicate key update formmain_id = values(formmain_id), source_name = values(source_name), + data_type = values(data_type), code = values(code), source_data = values(source_data), option_type = values(option_type), @@ -225,6 +234,7 @@ update ${tableName} set formmain_id = #{formmainId}, source_name = #{sourceName}, + data_type = #{dataType}, code = #{code}, source_data = #{sourceData}, option_type = #{optionType}, @@ -251,6 +261,7 @@ update ${tableName} set sts= 'N' ,modify_time = #{modify_time},modify_user_id = and id = #{id} and formmain_id = #{formmainId} and source_name = #{sourceName} + and data_type = #{dataType} and code = #{code} and source_data = #{sourceData} and option_type = #{optionType} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/dao/IMdmModuleSourceDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/dao/IMdmModuleSourceDao.java index cc3b08c8..6d290781 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/dao/IMdmModuleSourceDao.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/dao/IMdmModuleSourceDao.java @@ -9,19 +9,17 @@ import java.util.List; * 主数据数据来源(mdm_module_source: table)表数据库访问层 * * @author makejava - * @since 2024-06-05 11:42:56 + * @since 2024-06-19 09:11:50 */ public interface IMdmModuleSourceDao extends IBaseDao { - /** - * + * * @content 根据数据来源内类型是插件的应用类型做分组 - * @Param - * @Return - * @Author hecan + * @Param + * @Return + * @Author hecan * @Date 2024/6/6 10:43 * **/ List MdmModuleSourceentityGroupByType(); - } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/dao/impl/MdmModuleSourceDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/dao/impl/MdmModuleSourceDaoImpl.java index 4e025854..3392fd01 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/dao/impl/MdmModuleSourceDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/dao/impl/MdmModuleSourceDaoImpl.java @@ -11,10 +11,11 @@ import java.util.List; * 主数据数据来源(MdmModuleSource)表数据库访问层 * * @author makejava - * @since 2024-06-05 11:42:56 + * @since 2024-06-19 09:11:50 */ @Repository(value = "MdmModuleSourceDaoImpl") public class MdmModuleSourceDaoImpl extends MybatisGenericDao implements IMdmModuleSourceDao{ + //根据数据来源内类型是插件的应用类型做分组 @Override public List MdmModuleSourceentityGroupByType() { @@ -22,7 +23,5 @@ public class MdmModuleSourceDaoImpl extends MybatisGenericDao + + + + + @@ -23,7 +28,12 @@ ,mdm_id ,source_type ,source_name + ,trigger_type ,source_code + ,add_api + ,update_api + ,delete_api + ,enabled_state ,sorts ,create_user_id ,create_time @@ -33,11 +43,6 @@ ,org_id ,company_id - - - - - + insert into mdm_module_source( id , mdm_id , source_type , source_name , + trigger_type , source_code , + add_api , + update_api , + delete_api , + enabled_state , sorts , create_user_id , create_time , @@ -161,6 +183,7 @@ sts , org_id , company_id , + sorts, sts, )values( @@ -169,7 +192,12 @@ #{mdmId} , #{sourceType} , #{sourceName} , + #{triggerType} , #{sourceCode} , + #{addApi} , + #{updateApi} , + #{deleteApi} , + #{enabledState} , #{sorts} , #{create_user_id} , #{create_time} , @@ -178,30 +206,36 @@ #{sts} , #{org_id} , #{companyId} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module_source a WHERE a.sts = 'Y' ), 'Y', ) - - insert into mdm_module_source(mdm_id, source_type, source_name, source_code, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) + + insert into mdm_module_source(mdm_id, source_type, source_name, trigger_type, source_code, add_api, update_api, delete_api, enabled_state, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) values - (#{entity.mdmId},#{entity.sourceType},#{entity.sourceName},#{entity.sourceCode},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') + (#{entity.mdmId},#{entity.sourceType},#{entity.sourceName},#{entity.triggerType},#{entity.sourceCode},#{entity.addApi},#{entity.updateApi},#{entity.deleteApi},#{entity.enabledState},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') - - insert into mdm_module_source(mdm_id, source_type, source_name, source_code, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) + + insert into mdm_module_source(mdm_id, source_type, source_name, trigger_type, source_code, add_api, update_api, delete_api, enabled_state, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) values - (#{entity.mdmId},#{entity.sourceType},#{entity.sourceName},#{entity.sourceCode},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) + (#{entity.mdmId},#{entity.sourceType},#{entity.sourceName},#{entity.triggerType},#{entity.sourceCode},#{entity.addApi},#{entity.updateApi},#{entity.deleteApi},#{entity.enabledState},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) on duplicate key update mdm_id = values(mdm_id), source_type = values(source_type), source_name = values(source_name), + trigger_type = values(trigger_type), source_code = values(source_code), + add_api = values(add_api), + update_api = values(update_api), + delete_api = values(delete_api), + enabled_state = values(enabled_state), create_user_id = values(create_user_id), create_time = values(create_time), modify_user_id = values(modify_user_id), @@ -216,7 +250,12 @@ update mdm_module_source set mdm_id = #{mdmId}, source_type = #{sourceType}, source_name = #{sourceName}, + trigger_type = #{triggerType}, source_code = #{sourceCode}, + add_api = #{addApi}, + update_api = #{updateApi}, + delete_api = #{deleteApi}, + enabled_state = #{enabledState}, create_user_id = #{create_user_id}, create_time = #{create_time}, modify_user_id = #{modify_user_id}, @@ -240,7 +279,12 @@ update mdm_module_source set sts= 'N' ,modify_time = #{modify_time},modify_user and mdm_id = #{mdmId} and source_type = #{sourceType} and source_name = #{sourceName} + and trigger_type = #{triggerType} and source_code = #{sourceCode} + and add_api = #{addApi} + and update_api = #{updateApi} + and delete_api = #{deleteApi} + and enabled_state = #{enabledState} and sorts = #{sorts} and sts = #{sts} and company_id = #{companyId} @@ -251,6 +295,13 @@ update mdm_module_source set sts= 'N' ,modify_time = #{modify_time},modify_user delete from mdm_module_source where id = #{id} + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/service/IMdmModuleSourceService.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/service/IMdmModuleSourceService.java index f622682c..990da6bd 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/service/IMdmModuleSourceService.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/service/IMdmModuleSourceService.java @@ -6,7 +6,7 @@ import com.hzya.frame.basedao.service.IBaseService; * 主数据数据来源(MdmModuleSource)表服务接口 * * @author makejava - * @since 2024-06-05 11:42:57 + * @since 2024-06-19 09:11:50 */ public interface IMdmModuleSourceService extends IBaseService{ } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/service/impl/MdmModuleSourceServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/service/impl/MdmModuleSourceServiceImpl.java index f9afb989..206df786 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/service/impl/MdmModuleSourceServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/service/impl/MdmModuleSourceServiceImpl.java @@ -11,7 +11,7 @@ import com.hzya.frame.basedao.service.impl.BaseService; * 主数据数据来源(MdmModuleSource)表服务实现类 * * @author makejava - * @since 2024-06-05 11:42:57 + * @since 2024-06-19 09:11:50 */ @Service(value = "mdmModuleSourceService") public class MdmModuleSourceServiceImpl extends BaseService implements IMdmModuleSourceService { From b595bba61b829748b45e2b9d97bea3ede5087490 Mon Sep 17 00:00:00 2001 From: lvleigang <957075182@qq.com> Date: Wed, 19 Jun 2024 10:17:03 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=B8=BB=E6=95=B0=E6=8D=AE=E4=B8=8B?= =?UTF-8?q?=E5=8F=91=EF=BC=8C=E9=87=8D=E6=96=B0=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml index dfc09897..75d7a866 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml @@ -397,6 +397,9 @@ where id = #{id} + + + - + insert into mdm_org( id , @@ -276,7 +276,7 @@ ) - + insert into mdm_org(document_rule, document_rule_num, org_code, org_name, org_address, org_countryzone, org_innercode, org_memo, org_mnecode, org_ncindustry, org_fatherorg, org_principal, org_tel, data_status, add_status, update_status, delete_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) values @@ -284,7 +284,7 @@ - + insert into mdm_org(document_rule, document_rule_num, org_code, org_name, org_address, org_countryzone, org_innercode, org_memo, org_mnecode, org_ncindustry, org_fatherorg, org_principal, org_tel, data_status, add_status, update_status, delete_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) values diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/entity/MdmProjectEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/entity/MdmProjectEntity.xml index 93ec1958..467882e1 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/entity/MdmProjectEntity.xml +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/entity/MdmProjectEntity.xml @@ -204,7 +204,7 @@ - + insert into mdm_project( id , @@ -268,7 +268,7 @@ ) - + insert into mdm_project(document_rule, document_rule_num, project_code, project_name, project_bill_type, project_memo, project_currtype, project_dutier, project_duty_dept, project_org, project_parentpro, project_sh_name, data_status, add_status, update_status, delete_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) values @@ -276,7 +276,7 @@ - + insert into mdm_project(document_rule, document_rule_num, project_code, project_name, project_bill_type, project_memo, project_currtype, project_dutier, project_duty_dept, project_org, project_parentpro, project_sh_name, data_status, add_status, update_status, delete_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) values diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/entity/MdmUserEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/entity/MdmUserEntity.xml index a05e5cf0..b594d94b 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/entity/MdmUserEntity.xml +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/entity/MdmUserEntity.xml @@ -258,7 +258,7 @@ - + insert into mdm_user( id , @@ -340,7 +340,7 @@ ) - + insert into mdm_user(document_rule, document_rule_num, data_status, add_status, update_status, delete_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, user_name, user_code, user_password, pwdlevelcode, pwdparam, user_note, abledate, disabledate, islocked, user_type, base_doc_type, pk_base_doc, identityverifycode, pk_org, format, isca, enablestate, contentlang, user_code_q, sts) values @@ -348,7 +348,7 @@ - + insert into mdm_user(document_rule, document_rule_num, data_status, add_status, update_status, delete_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, user_name, user_code, user_password, pwdlevelcode, pwdparam, user_note, abledate, disabledate, islocked, user_type, base_doc_type, pk_base_doc, identityverifycode, pk_org, format, isca, enablestate, contentlang, user_code_q) values diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java index 52b75b12..7aff0fb1 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java @@ -253,17 +253,15 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { return BaseResult.getFailureMessageEntity("当前数据不存在"); } if(mdmModuleDistributeDetailEntities != null && mdmModuleDistributeDetailEntities.size() > 0){ - for (int i1 = 0; i1 < mdmModuleDistributeDetailEntities.size(); i1++) { - Map checkData = new HashMap<>(); - checkData.put("tableName",mdmModuleDbEntities.get(i).getDbName()); - checkData.put("documentRule",documentRule); - checkData.put("mdmModuleDistributeDetailEntities",mdmModuleDistributeDetailEntities); - JSONObject object1 = mdmModuleDao.queryMdmST(checkData); - if(object1.getString("id") == null || "".equals(object1.getString("id")) ){ - taskDetailEntity.setResult("当前数据不符合规则不发送"); - taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); - return BaseResult.getFailureMessageEntity("当前数据不符合规则不发送"); - } + Map checkData = new HashMap<>(); + checkData.put("tableName",mdmModuleDbEntities.get(i).getDbName()); + checkData.put("documentRule",documentRule); + checkData.put("mdmModuleDistributeDetailEntities",mdmModuleDistributeDetailEntities); + JSONObject object1 = mdmModuleDao.queryMdmST(checkData); + if(object1.getString("id") == null || "".equals(object1.getString("id")) ){ + taskDetailEntity.setResult("当前数据不符合规则不发送"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("当前数据不符合规则不发送"); } } //查看主表是否有字段是关联的 @@ -370,9 +368,63 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { return BaseResult.getFailureMessageEntity("发送错误"); } } - }else { - //执行正常下发 + }else {//执行正常下发 + //查询主数据 + MdmModuleEntity queryMdmModuleEntity = new MdmModuleEntity(); + queryMdmModuleEntity.setSts("Y"); + List mdmModuleEntities = mdmModuleDao.queryBase(queryMdmModuleEntity); + if(mdmModuleEntities == null || mdmModuleEntities.size() == 0){ + return BaseResult.getSuccessMessageEntity("主数据未设置,不需要下发"); + } + //查询下发的配置 没有直接跳过 + for (int i = 0; i < mdmModuleEntities.size(); i++) { + MdmModuleDistributeEntity queryMdmModuleDistributeEntity = new MdmModuleDistributeEntity(); + queryMdmModuleDistributeEntity.setMdmId(mdmModuleEntities.get(i).getId()); + queryMdmModuleDistributeEntity.setEnabledType("1"); + queryMdmModuleDistributeEntity.setEnabledState("1"); + List mdmModuleDistributeEntities = mdmModuleDistributeDao.queryBase(queryMdmModuleDistributeEntity); + if(mdmModuleDistributeEntities == null || mdmModuleDistributeEntities.size() == 0){ + continue; + } + for (int i1 = 0; i1 < mdmModuleDistributeEntities.size(); i1++) { + //查询主数据db + MdmModuleDbEntity queryMdmModuleDbEntity = new MdmModuleDbEntity(); + queryMdmModuleDbEntity.setMdmId(mdmModuleEntities.get(i).getId()); + List mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(queryMdmModuleDbEntity); + if(mdmModuleDbEntities == null || mdmModuleDbEntities.size() == 0){ + continue; + } + //查询主数据字段 + MdmModuleDbFiledsEntity queryFild = new MdmModuleDbFiledsEntity(); + queryFild.setMdmId(mdmModuleEntities.get(i).getId()); + List mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(queryFild); + if(mdmModuleDbFiledsEntities == null || mdmModuleDbFiledsEntities.size() == 0){ + continue; + } + //查询下发的配置 + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity() ; + mdmModuleDistributeDetailEntity.setDistributeId(mdmModuleDistributeEntities.get(i1).getId()); + mdmModuleDistributeDetailEntity.setSts("Y"); + List mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity); + + + + + } + } + + //查询一千条数据 + + //查询这一千条数据是否符合规则 + + //查询是否已经手动发送过。只有新增校验,查询发送日志是否已经有这条数据 + + //组装数据发送 + + //保存日志 + + //所有下发发送完成,修改数据状态 } } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml index 75d7a866..c1a13e78 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml @@ -806,7 +806,7 @@ where id = #{id} and id = #{id} AND - + ${item.leftBracket} ${item.filedName} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java index 23437fe6..84dba275 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java @@ -2268,6 +2268,24 @@ public class MdmModuleServiceImpl extends BaseService i return BaseResult.getFailureMessageEntity("系统错误"); } List list = mdmModuleDistributeDao.queryBase(entity); + if(list != null && list.size() > 0){ + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity(); + mdmModuleDistributeDetailEntity.setMdmId(entity.getMdmId()); + mdmModuleDistributeDetailEntity.setSts("Y"); + List listDetail = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity); + if(listDetail != null && listDetail.size() > 0){ + for (int i = 0; i < list.size(); i++) { + List mdmModuleDistributeDetailEntities = new ArrayList<>(); + for (int i1 = 0; i1 < listDetail.size(); i1++) { + if(listDetail.get(i1).getDistributeId().equals(list.get(i).getId())){ + mdmModuleDistributeDetailEntities.add(listDetail.get(i1) ); + } + } + list.get(i).setMdmModuleDistributeDetailEntities(mdmModuleDistributeDetailEntities); + } + } + + } return BaseResult.getSuccessMessageEntity("获取分发设置成功", list); } @@ -2348,12 +2366,16 @@ public class MdmModuleServiceImpl extends BaseService i mdmModuleDistributeDetailDao.logicRemoveMultiCondition(mdmModuleDistributeDetailEntity); if (entity.getMdmModuleDistributeDetailEntities() != null && entity.getMdmModuleDistributeDetailEntities().size() > 0) { for (int i = 0; i < entity.getMdmModuleDistributeDetailEntities().size(); i++) { + entity.getMdmModuleDistributeDetailEntities().get(i).setSts("Y"); + entity.getMdmModuleDistributeDetailEntities().get(i).setMdmId(entity.getMdmId()); entity.getMdmModuleDistributeDetailEntities().get(i).setSts("Y"); if (entity.getMdmModuleDistributeDetailEntities().get(i).getId() != null) { entity.getMdmModuleDistributeDetailEntities().get(i).setUpdate(); + entity.getMdmModuleDistributeDetailEntities().get(i).setDistributeId(entity.getId()); mdmModuleDistributeDetailDao.update(entity.getMdmModuleDistributeDetailEntities().get(i)); } else { entity.getMdmModuleDistributeDetailEntities().get(i).setCreate(); + entity.getMdmModuleDistributeDetailEntities().get(i).setDistributeId(entity.getId()); mdmModuleDistributeDetailDao.save(entity.getMdmModuleDistributeDetailEntities().get(i)); } } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.xml index 0a959f0f..ffedf135 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.xml @@ -181,7 +181,7 @@ - + insert into mdm_module_distribute( id , @@ -235,7 +235,7 @@ ) - + insert into mdm_module_distribute(mdm_id, app_id, enabled_type, update_api, update_script, add_api, add_script, delete_api, delete_script, enabled_state, db_id, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) values @@ -243,7 +243,7 @@ - + insert into mdm_module_distribute(mdm_id, app_id, enabled_type, update_api, update_script, add_api, add_script, delete_api, delete_script, enabled_state, db_id, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) values diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/IMdmModuleDistributeDetailDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/IMdmModuleDistributeDetailDao.java index 3b39e01d..962a0d5a 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/IMdmModuleDistributeDetailDao.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/IMdmModuleDistributeDetailDao.java @@ -7,7 +7,7 @@ import com.hzya.frame.basedao.dao.IBaseDao; * 主数据功能应用分发明细表(mdm_module_distribute_detail: table)表数据库访问层 * * @author makejava - * @since 2024-06-14 10:03:50 + * @since 2024-06-19 10:34:58 */ public interface IMdmModuleDistributeDetailDao extends IBaseDao { diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/impl/MdmModuleDistributeDetailDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/impl/MdmModuleDistributeDetailDaoImpl.java index c184298c..8507d00c 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/impl/MdmModuleDistributeDetailDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/impl/MdmModuleDistributeDetailDaoImpl.java @@ -8,7 +8,7 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao; * 主数据功能应用分发明细表(MdmModuleDistributeDetail)表数据库访问层 * * @author makejava - * @since 2024-06-14 10:03:50 + * @since 2024-06-19 10:34:58 */ @Repository(value = "MdmModuleDistributeDetailDaoImpl") public class MdmModuleDistributeDetailDaoImpl extends MybatisGenericDao implements IMdmModuleDistributeDetailDao{ diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.java index 18bd952c..d1acefd1 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.java @@ -6,7 +6,7 @@ import com.hzya.frame.web.entity.BaseEntity; * 主数据功能应用分发明细表(MdmModuleDistributeDetail)实体类 * * @author makejava - * @since 2024-06-14 10:03:50 + * @since 2024-06-19 10:34:58 */ public class MdmModuleDistributeDetailEntity extends BaseEntity { @@ -20,6 +20,8 @@ public class MdmModuleDistributeDetailEntity extends BaseEntity { private String dataType; /** 左括号 */ private String leftBracket; + /** 字段id */ + private String filedId; /** 字段名 */ private String filedName; /** 对比类型 1、等于 2、不等于 3、大于 4、小于 */ @@ -74,6 +76,14 @@ public class MdmModuleDistributeDetailEntity extends BaseEntity { this.leftBracket = leftBracket; } + public String getFiledId() { + return filedId; + } + + public void setFiledId(String filedId) { + this.filedId = filedId; + } + public String getFiledName() { return filedName; } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.xml index 171168f4..ceef3625 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.xml @@ -9,6 +9,7 @@ + @@ -31,6 +32,7 @@ ,api_id ,data_type ,left_bracket + ,filed_id ,filed_name ,compare_type ,filed_vaule @@ -45,12 +47,6 @@ ,org_id ,company_id - - - + insert into mdm_module_source( id , @@ -212,7 +212,7 @@ ) - + insert into mdm_module_source(mdm_id, source_type, source_name, trigger_type, source_code, add_api, update_api, delete_api, enabled_state, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) values @@ -220,7 +220,7 @@ - + insert into mdm_module_source(mdm_id, source_type, source_name, trigger_type, source_code, add_api, update_api, delete_api, enabled_state, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) values diff --git a/service/src/main/java/com/hzya/frame/sys/contrastTask/entity/SysContrastTaskEntity.xml b/service/src/main/java/com/hzya/frame/sys/contrastTask/entity/SysContrastTaskEntity.xml index 67e6d489..36518c9d 100644 --- a/service/src/main/java/com/hzya/frame/sys/contrastTask/entity/SysContrastTaskEntity.xml +++ b/service/src/main/java/com/hzya/frame/sys/contrastTask/entity/SysContrastTaskEntity.xml @@ -161,7 +161,7 @@ + keyProperty=""> insert into sys_contrast_task( id , @@ -209,7 +209,7 @@ ) - + insert into sys_contrast_task(id, service_name, left_app_id, left_api_id, right_app_id, right_api_id, task_status, task_msg, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, match_mode, sts) @@ -220,7 +220,7 @@ - + insert into sys_contrast_task(id, service_name, left_app_id, left_api_id, right_app_id, right_api_id, task_status, task_msg, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, match_mode) values diff --git a/service/src/main/java/com/hzya/frame/sys/file/download/entity/FileDownloadEntity.xml b/service/src/main/java/com/hzya/frame/sys/file/download/entity/FileDownloadEntity.xml index 514d0581..edea0765 100644 --- a/service/src/main/java/com/hzya/frame/sys/file/download/entity/FileDownloadEntity.xml +++ b/service/src/main/java/com/hzya/frame/sys/file/download/entity/FileDownloadEntity.xml @@ -179,7 +179,7 @@ 'Y' ) - + select last_insert_id() as id diff --git a/service/src/main/java/com/hzya/frame/sys/moduleNew/entity/SysModuleNewEntity.xml b/service/src/main/java/com/hzya/frame/sys/moduleNew/entity/SysModuleNewEntity.xml index 8863b52f..bd928cd1 100644 --- a/service/src/main/java/com/hzya/frame/sys/moduleNew/entity/SysModuleNewEntity.xml +++ b/service/src/main/java/com/hzya/frame/sys/moduleNew/entity/SysModuleNewEntity.xml @@ -272,7 +272,7 @@ 'Y' ) - + select last_insert_id() as id diff --git a/service/src/main/java/com/hzya/frame/sys/serviceMethod/entity/SysServiceMethodEntity.xml b/service/src/main/java/com/hzya/frame/sys/serviceMethod/entity/SysServiceMethodEntity.xml index ef755315..e7435715 100644 --- a/service/src/main/java/com/hzya/frame/sys/serviceMethod/entity/SysServiceMethodEntity.xml +++ b/service/src/main/java/com/hzya/frame/sys/serviceMethod/entity/SysServiceMethodEntity.xml @@ -120,7 +120,7 @@ - + insert into sys_service_method( id , @@ -156,7 +156,7 @@ ) - + insert into sys_service_method(service_key, service_value, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -164,7 +164,7 @@ - + insert into sys_service_method(service_key, service_value, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sys/templateButton/entity/SysTemplateButtonEntity.xml b/service/src/main/java/com/hzya/frame/sys/templateButton/entity/SysTemplateButtonEntity.xml index e6c368dc..3d57717c 100644 --- a/service/src/main/java/com/hzya/frame/sys/templateButton/entity/SysTemplateButtonEntity.xml +++ b/service/src/main/java/com/hzya/frame/sys/templateButton/entity/SysTemplateButtonEntity.xml @@ -169,8 +169,8 @@ + parameterType="com.hzya.frame.sys.templateButton.entity.SysTemplateButtonEntity" + > insert into sys_template_button( id , @@ -218,7 +218,7 @@ ) - + insert into sys_template_button(template_id, service_name, table_name, button_type, button_title, button_style, button_sort, button_icon, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -228,7 +228,7 @@ - + insert into sys_template_button(template_id, service_name, table_name, button_type, button_title, button_style, button_sort, button_icon, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sys/userTemplateButton/entity/SysUserTemplateButtonEntity.xml b/service/src/main/java/com/hzya/frame/sys/userTemplateButton/entity/SysUserTemplateButtonEntity.xml index 8faa1f95..b5771031 100644 --- a/service/src/main/java/com/hzya/frame/sys/userTemplateButton/entity/SysUserTemplateButtonEntity.xml +++ b/service/src/main/java/com/hzya/frame/sys/userTemplateButton/entity/SysUserTemplateButtonEntity.xml @@ -126,7 +126,7 @@ - + insert into sys_user_template_button( id , @@ -164,7 +164,7 @@ ) - + insert into sys_user_template_button(template_id, service_name, button_id, user_id, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -172,7 +172,7 @@ - + insert into sys_user_template_button(template_id, service_name, button_id, user_id, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.xml index 3b543b9a..0f46b8fa 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.xml @@ -354,7 +354,7 @@ WHERE + > insert into sys_application_api( id , @@ -442,7 +442,7 @@ WHERE ) - + insert into sys_application_api(api_status,api_code,api_path, app_id, catalogue_id, api_name, api_remark, need_Login, authentication_port, parameter_passing_mode, destination_address, request_coding, request_method, timeout_period, current_limiting, header_in, query_in, body_in_type, body_in, body_out, bean_name,return_msg,return_success_field,return_success_value, fun_name, extension_api, sorts, create_user_id, @@ -454,7 +454,7 @@ WHERE - + insert into sys_application_api(api_status,api_code,api_path, app_id, catalogue_id, api_name, api_remark, need_Login, authentication_port, parameter_passing_mode, destination_address, request_coding, request_method, timeout_period, current_limiting, header_in, query_in, body_in_type, body_in, body_out,bean_name,return_msg,return_success_field,return_success_value,fun_name,extension_api, sorts, create_user_id, diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/apiAuth/entity/SysApplicationApiAuthEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/application/apiAuth/entity/SysApplicationApiAuthEntity.xml index 1ab0fe04..320d6534 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/apiAuth/entity/SysApplicationApiAuthEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/application/apiAuth/entity/SysApplicationApiAuthEntity.xml @@ -132,7 +132,7 @@ - + insert into sys_application_api_auth( id , @@ -170,7 +170,7 @@ ) - + insert into sys_application_api_auth(app_id, system_status, name, system_address, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -178,7 +178,7 @@ - + insert into sys_application_api_auth(app_id, system_status, name, system_address, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/apiAythDetail/entity/SysApplicationApiAuthDetailEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/application/apiAythDetail/entity/SysApplicationApiAuthDetailEntity.xml index 4008260c..36f5b6e4 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/apiAythDetail/entity/SysApplicationApiAuthDetailEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/application/apiAythDetail/entity/SysApplicationApiAuthDetailEntity.xml @@ -132,7 +132,7 @@ - + insert into sys_application_api_auth_detail( id , @@ -170,7 +170,7 @@ ) - + insert into sys_application_api_auth_detail(app_id, catalogue_id, api_id, tripartite_system_id, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -178,7 +178,7 @@ - + insert into sys_application_api_auth_detail(app_id, catalogue_id, api_id, tripartite_system_id, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/apiPara/entity/SysApplicationApiParaEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/application/apiPara/entity/SysApplicationApiParaEntity.xml index 6229a63d..820be8f6 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/apiPara/entity/SysApplicationApiParaEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/application/apiPara/entity/SysApplicationApiParaEntity.xml @@ -132,7 +132,7 @@ - + insert into sys_application_api_para( id , @@ -170,7 +170,7 @@ ) - + insert into sys_application_api_para(app_id, interface_key, interface_value, interface_type, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id, sts) values @@ -178,7 +178,7 @@ - + insert into sys_application_api_para(app_id, interface_key, interface_value, interface_type, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/apiType/entity/SysApplicationApiTypeEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/application/apiType/entity/SysApplicationApiTypeEntity.xml index d0d9e9fe..2aff6d2c 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/apiType/entity/SysApplicationApiTypeEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/application/apiType/entity/SysApplicationApiTypeEntity.xml @@ -138,7 +138,7 @@ - + insert into sys_application_api_type( id , @@ -172,7 +172,7 @@ ) - + insert into sys_application_api_type(app_id, name, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id, sts) values @@ -180,7 +180,7 @@ - + insert into sys_application_api_type(app_id, name, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.xml index 2b51b38e..c9030192 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.xml @@ -168,7 +168,7 @@ - + insert into sys_application_database( id , @@ -220,7 +220,7 @@ ) - + insert into sys_application_database(app_id, source_code, source_name, source_type, source_ip, source_port, login_name, password, db_name, service_name, db_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -228,7 +228,7 @@ - + insert into sys_application_database(app_id, source_code, source_name, source_type, source_ip, source_port, login_name, password, db_name, service_name, db_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationEntity.xml index 63ca8873..45b65b4d 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationEntity.xml @@ -222,7 +222,7 @@ - + insert into sys_application( id , @@ -292,7 +292,7 @@ ) - + insert into sys_application(app_logo, app_status, name, version_number, app_id, system_address, access_mode, affiliation_field, manufacturer, app_introduction, client_path, web_path, program_path, public_key, secret_key, interface_address, interface_status, db_status,app_type, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id, sts) values @@ -300,7 +300,7 @@ - + insert into sys_application(app_logo, app_status, name, version_number,app_id,system_address, access_mode, affiliation_field, manufacturer, app_introduction, client_path, web_path, program_path, public_key, secret_key, interface_address, interface_status, db_status,app_type, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/plugin/entity/SysApplicationPluginEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/application/plugin/entity/SysApplicationPluginEntity.xml index 1338856a..cff4a897 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/plugin/entity/SysApplicationPluginEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/application/plugin/entity/SysApplicationPluginEntity.xml @@ -150,7 +150,7 @@ - + insert into sys_application_plugin( id , @@ -194,7 +194,7 @@ ) - + insert into sys_application_plugin(app_id, plugin_name, plugin_code, plugin_version, plugin_remark, release_date, plugin_status, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -202,7 +202,7 @@ - + insert into sys_application_plugin(app_id, plugin_name, plugin_code, plugin_version, plugin_remark, release_date, plugin_status, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/homeComponent/entity/SysHomeComponentEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/homeComponent/entity/SysHomeComponentEntity.xml index fbd96673..2028853d 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/homeComponent/entity/SysHomeComponentEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/homeComponent/entity/SysHomeComponentEntity.xml @@ -142,7 +142,7 @@ + keyProperty=""> insert into sys_home_component( id , @@ -184,7 +184,7 @@ ) - + insert into sys_home_component(id, name, code, state, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) values @@ -194,7 +194,7 @@ - + insert into sys_home_component(id, name, code, state, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTask/entity/SysIntegratedForegroundTaskEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTask/entity/SysIntegratedForegroundTaskEntity.xml index 78fd315d..19dcb1d6 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTask/entity/SysIntegratedForegroundTaskEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTask/entity/SysIntegratedForegroundTaskEntity.xml @@ -131,7 +131,7 @@ from sys_integrated_foreground_task where id = #{ id } and sts='Y' - + insert into sys_integrated_foreground_task( id , @@ -169,7 +169,7 @@ ) - + insert into sys_integrated_foreground_task(workshop_name, plug_id, plug_name, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -177,7 +177,7 @@ - + insert into sys_integrated_foreground_task(workshop_name, plug_id, plug_name, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTaskDetail/entity/SysIntegratedForegroundTaskDetailEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTaskDetail/entity/SysIntegratedForegroundTaskDetailEntity.xml index f9c35743..9f15654d 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTaskDetail/entity/SysIntegratedForegroundTaskDetailEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTaskDetail/entity/SysIntegratedForegroundTaskDetailEntity.xml @@ -138,7 +138,7 @@ - + insert into sys_integrated_foreground_task_detail( id , @@ -180,7 +180,7 @@ ) - + insert into sys_integrated_foreground_task_detail(formmain_id, arg_code, arg_name, arg_type, arg_value, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -188,7 +188,7 @@ - + insert into sys_integrated_foreground_task_detail(formmain_id, arg_code, arg_name, arg_type, arg_value, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTaskParameter/entity/SysIntegratedForegroundTaskParameterEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTaskParameter/entity/SysIntegratedForegroundTaskParameterEntity.xml index c124271e..ca053452 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTaskParameter/entity/SysIntegratedForegroundTaskParameterEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTaskParameter/entity/SysIntegratedForegroundTaskParameterEntity.xml @@ -120,7 +120,7 @@ - + insert into sys_integrated_foreground_task_parameter( id , @@ -156,7 +156,7 @@ ) - + insert into sys_integrated_foreground_task_parameter(formmain_id, in_parameter, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -164,7 +164,7 @@ - + insert into sys_integrated_foreground_task_parameter(formmain_id, in_parameter, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/messageManage/entity/SysMessageManageEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/messageManage/entity/SysMessageManageEntity.xml index a4968ef5..e89991a8 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/messageManage/entity/SysMessageManageEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/messageManage/entity/SysMessageManageEntity.xml @@ -172,7 +172,7 @@ + > insert into sys_message_manage( id , @@ -216,7 +216,7 @@ ) - + insert into sys_message_manage(theme, code, send_app, send_api, data_type, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -226,7 +226,7 @@ - + insert into sys_message_manage(theme, code, send_app, send_api, data_type, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/messageManageDetail/entity/SysMessageManageDetailEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/messageManageDetail/entity/SysMessageManageDetailEntity.xml index fde5ed64..8567830e 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/messageManageDetail/entity/SysMessageManageDetailEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/messageManageDetail/entity/SysMessageManageDetailEntity.xml @@ -162,8 +162,8 @@ + parameterType="com.hzya.frame.sysnew.messageManageDetail.entity.SysMessageManageDetailEntity" + > insert into sys_message_manage_detail( id , @@ -211,7 +211,7 @@ ) - + insert into sys_message_manage_detail(formmain_id, receive_name, receive_code, receive_app, receive_api, data_type, return_type, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -221,7 +221,7 @@ - + insert into sys_message_manage_detail(formmain_id, receive_name, receive_code, receive_app, receive_api, data_type, return_type, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/messageManageLog/entity/SysMessageManageLogEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/messageManageLog/entity/SysMessageManageLogEntity.xml index a0135edf..52e822e8 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/messageManageLog/entity/SysMessageManageLogEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/messageManageLog/entity/SysMessageManageLogEntity.xml @@ -290,7 +290,7 @@ + > insert into @@ -357,7 +357,7 @@ ) - + insert into sys_message_manage_log(message_manage_id, theme, message_code, send_app, send_api, receive_code, receive_app, receive_api, source_data, target_data, return_data, return_type,error_status, status, remark, sorts, create_user_id, @@ -369,7 +369,7 @@ - + insert into sys_message_manage_log(message_manage_id, theme, message_code, send_app, send_api, receive_code, receive_app, receive_api, source_data, target_data, return_data, return_type,error_status, status, remark, sorts, create_user_id, diff --git a/service/src/main/java/com/hzya/frame/sysnew/messageManageLogBack/detail/entity/SysMessageManageLogDetailBackEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/messageManageLogBack/detail/entity/SysMessageManageLogDetailBackEntity.xml index d8200586..99512ec8 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/messageManageLogBack/detail/entity/SysMessageManageLogDetailBackEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/messageManageLogBack/detail/entity/SysMessageManageLogDetailBackEntity.xml @@ -140,7 +140,7 @@ + > insert into sys_message_manage_log_detail_back( id , @@ -180,7 +180,7 @@ ) - + insert into sys_message_manage_log_detail_back(id,message_manage_id, source_data, target_data, return_data,sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values @@ -189,7 +189,7 @@ - + insert into sys_message_manage_log_detail_back(message_manage_id, source_data, target_data, return_data, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/messageManageLogBack/entity/SysMessageManageLogBackEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/messageManageLogBack/entity/SysMessageManageLogBackEntity.xml index 4bd5ff28..b4f63096 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/messageManageLogBack/entity/SysMessageManageLogBackEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/messageManageLogBack/entity/SysMessageManageLogBackEntity.xml @@ -273,7 +273,7 @@ + > insert into sys_message_manage_log_back( id , @@ -335,7 +335,7 @@ ) - + insert into sys_message_manage_log_back(id,message_manage_id, theme, message_code, send_app, send_api, receive_code, receive_app, receive_api, source_data, target_data, return_data, return_type,error_status, status, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) @@ -345,7 +345,7 @@ - + insert into sys_message_manage_log_back(message_manage_id, theme, message_code, send_app, send_api, receive_code, receive_app, receive_api, source_data, target_data, return_data, return_type,error_status, status, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) diff --git a/service/src/main/java/com/hzya/frame/sysnew/messageManageLogDetail/entity/SysMessageManageLogDetailEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/messageManageLogDetail/entity/SysMessageManageLogDetailEntity.xml index c12fe5ed..b7ebe0b4 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/messageManageLogDetail/entity/SysMessageManageLogDetailEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/messageManageLogDetail/entity/SysMessageManageLogDetailEntity.xml @@ -140,7 +140,7 @@ + > insert into sys_message_manage_log_detail( id , @@ -176,7 +176,7 @@ ) - + insert into sys_message_manage_log_detail(message_manage_id, source_data, target_data, return_data,sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -186,7 +186,7 @@ - + insert into sys_message_manage_log_detail(message_manage_id, source_data, target_data, return_data, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/plugArg/entity/SysPlugArgEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/plugArg/entity/SysPlugArgEntity.xml index e58a4c4f..69b3daf8 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/plugArg/entity/SysPlugArgEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/plugArg/entity/SysPlugArgEntity.xml @@ -131,7 +131,7 @@ - + insert into sys_plug_arg( id , @@ -169,7 +169,7 @@ ) - + insert into sys_plug_arg(id, plug_id, plug_code, plug_name, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -177,7 +177,7 @@ - + insert into sys_plug_arg(id, plug_id, plug_code, plug_name, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/plugArgDeatil/entity/SysPlugArgDetailEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/plugArgDeatil/entity/SysPlugArgDetailEntity.xml index 49543da7..91993353 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/plugArgDeatil/entity/SysPlugArgDetailEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/plugArgDeatil/entity/SysPlugArgDetailEntity.xml @@ -142,7 +142,7 @@ + > insert into sys_plug_arg_detail( id , @@ -184,7 +184,7 @@ ) - + insert into sys_plug_arg_detail(formmain_id, arg_code, arg_name, arg_type, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -194,7 +194,7 @@ - + insert into sys_plug_arg_detail(formmain_id, arg_code, arg_name, arg_type, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values From b11be510182acc98e776ada5d82ac25077754de5 Mon Sep 17 00:00:00 2001 From: xiang2lin <251481237@qq.com> Date: Wed, 19 Jun 2024 17:48:14 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BE=BE=E6=A2=A6?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../database/entity/SysApplicationDatabaseEntity.java | 3 +++ .../webapp/web/aop/AopDynamicRoutingDataSourceInit.java | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.java b/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.java index a7817419..19aba575 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.java +++ b/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.java @@ -159,6 +159,9 @@ public class SysApplicationDatabaseEntity extends BaseEntity { case "3": //mysql sourceTypeName = "mysql"; break; + case "4": //dm + sourceTypeName = "dm"; + break; default: } } diff --git a/webapp/src/main/java/com/hzya/frame/webapp/web/aop/AopDynamicRoutingDataSourceInit.java b/webapp/src/main/java/com/hzya/frame/webapp/web/aop/AopDynamicRoutingDataSourceInit.java index 9952517e..e4d9c3f1 100644 --- a/webapp/src/main/java/com/hzya/frame/webapp/web/aop/AopDynamicRoutingDataSourceInit.java +++ b/webapp/src/main/java/com/hzya/frame/webapp/web/aop/AopDynamicRoutingDataSourceInit.java @@ -116,9 +116,9 @@ public class AopDynamicRoutingDataSourceInit { } else if ("sqlServer".equalsIgnoreCase(source_type)) { driveClass = DataSourceUtilProperties.SQL2005DRIVER; } -// else if ("dm".equalsIgnoreCase(source_type)) { -// driveClass = DataSourceUtilProperties.dm; -// } + else if ("dm".equalsIgnoreCase(source_type)) { + driveClass = DataSourceUtilProperties.dm; + } try { //测试连接 Class.forName(driveClass); From 4e94526a30e3b48aef552388b53f75d006b15ed6 Mon Sep 17 00:00:00 2001 From: lvleigang <957075182@qq.com> Date: Thu, 20 Jun 2024 08:43:33 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=B8=BB=E6=95=B0=E6=8D=AE=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/MdmModulePluginInitializer.java | 580 +++++++++++++++-- .../com/hzya/frame/mdm/entity/MdmQuery.java | 10 + .../mdm/mdmModule/dao/IMdmModuleDao.java | 3 + .../mdmModule/dao/impl/MdmModuleDaoImpl.java | 10 + .../mdm/mdmModule/entity/MdmModuleEntity.xml | 50 +- .../service/impl/MdmModuleServiceImpl.java | 8 +- .../entity/MdmModuleDbFiledsEntity.xml | 8 + .../MdmModuleDistributeDetailEntity.xml | 592 ++++++++++-------- .../entity/MdmModuleSendLogEntity.java | 2 +- .../entity/MdmModuleSourceEntity.xml | 6 + .../mdm/service/impl/MdmServiceImpl.java | 174 ++++- 11 files changed, 1099 insertions(+), 344 deletions(-) diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java index 7aff0fb1..23a36396 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java @@ -2,7 +2,6 @@ package com.hzya.frame.plugin.mdmDistribute.plugin; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.hzya.frame.base.PluginBaseEntity; import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao; @@ -15,6 +14,8 @@ import com.hzya.frame.mdm.mdmModuleDistribute.dao.IMdmModuleDistributeDao; import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity; import com.hzya.frame.mdm.mdmModuleDistributeDetail.dao.IMdmModuleDistributeDetailDao; import com.hzya.frame.mdm.mdmModuleDistributeDetail.entity.MdmModuleDistributeDetailEntity; +import com.hzya.frame.mdm.mdmModuleSendLog.dao.IMdmModuleSendLogDao; +import com.hzya.frame.mdm.mdmModuleSendLog.entity.MdmModuleSendLogEntity; import com.hzya.frame.mdm.service.IMdmServiceCache; import com.hzya.frame.sysnew.application.api.dao.ISysApplicationApiDao; import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity; @@ -24,10 +25,9 @@ import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; import com.hzya.frame.sysnew.application.script.dao.ISysApplicationScriptDao; import com.hzya.frame.sysnew.application.script.entity.SysApplicationScriptEntity; import com.hzya.frame.sysnew.grovy.service.IGroovyIntegrationService; -import com.hzya.frame.sysnew.integtationTaskLivingDetails.dao.IIntegrationTaskLivingDetailsDao; import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService; -import com.hzya.frame.sysnew.messageManageLog.entity.SysMessageManageLogEntity; +import com.hzya.frame.uuid.UUIDUtils; import com.hzya.frame.web.entity.BaseResult; import com.hzya.frame.web.entity.JsonResultEntity; import org.apache.http.HttpEntity; @@ -40,12 +40,12 @@ import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import javax.annotation.Resource; import java.io.IOException; -import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -78,6 +78,8 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { private IMdmModuleDao mdmModuleDao; @Resource private IMdmServiceCache mdmServiceCache; + @Resource + private IMdmModuleSendLogDao mdmModuleSendLogDao; @Value("${ax.url}") private String url ; @@ -387,45 +389,35 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { if(mdmModuleDistributeEntities == null || mdmModuleDistributeEntities.size() == 0){ continue; } - for (int i1 = 0; i1 < mdmModuleDistributeEntities.size(); i1++) { - //查询主数据db - MdmModuleDbEntity queryMdmModuleDbEntity = new MdmModuleDbEntity(); - queryMdmModuleDbEntity.setMdmId(mdmModuleEntities.get(i).getId()); - List mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(queryMdmModuleDbEntity); - if(mdmModuleDbEntities == null || mdmModuleDbEntities.size() == 0){ - continue; - } - //查询主数据字段 - MdmModuleDbFiledsEntity queryFild = new MdmModuleDbFiledsEntity(); - queryFild.setMdmId(mdmModuleEntities.get(i).getId()); - List mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(queryFild); - if(mdmModuleDbFiledsEntities == null || mdmModuleDbFiledsEntities.size() == 0){ - continue; - } - //查询下发的配置 - MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity() ; - mdmModuleDistributeDetailEntity.setDistributeId(mdmModuleDistributeEntities.get(i1).getId()); - mdmModuleDistributeDetailEntity.setSts("Y"); - List mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity); - - - - + //查询主数据db + MdmModuleDbEntity queryMdmModuleDbEntity = new MdmModuleDbEntity(); + queryMdmModuleDbEntity.setMdmId(mdmModuleEntities.get(i).getId()); + List mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(queryMdmModuleDbEntity); + if(mdmModuleDbEntities == null || mdmModuleDbEntities.size() == 0){ + continue; } + //查询主数据字段 + MdmModuleDbFiledsEntity queryFild = new MdmModuleDbFiledsEntity(); + queryFild.setMdmId(mdmModuleEntities.get(i).getId()); + List mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(queryFild); + if(mdmModuleDbFiledsEntities == null || mdmModuleDbFiledsEntities.size() == 0){ + continue; + } + //字段的规则 + MdmModuleDbFiledsRuleEntity queryFildRule = new MdmModuleDbFiledsRuleEntity(); + queryFildRule.setMdmId(mdmModuleEntities.get(i).getId()); + queryFildRule.setRuleCode("service"); + List mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(queryFildRule); + + //新增 + doAdd(mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities); + //修改 + doUpdate(mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities); + //删除 + doDelete(mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities); + } - //查询一千条数据 - - //查询这一千条数据是否符合规则 - - //查询是否已经手动发送过。只有新增校验,查询发送日志是否已经有这条数据 - - //组装数据发送 - - //保存日志 - - //所有下发发送完成,修改数据状态 - } } logger.info("执行成功"); @@ -436,6 +428,512 @@ public class MdmModulePluginInitializer extends PluginBaseEntity { return BaseResult.getSuccessMessageEntity("执行成功"); } + private void doDelete(List mdmModuleDbEntities, List mdmModuleDistributeEntities, List mdmModuleDbFiledsRuleEntities, List mdmModuleDbFiledsEntities) { + //查询一千条数据 + String mainDb = null; + List objects = new ArrayList<>(); + for (int i2 = 0; i2 < mdmModuleDbEntities.size(); i2++) { + if("1".equals(mdmModuleDbEntities.get(i2).getDbType())) { + mainDb = mdmModuleDbEntities.get(i2).getDbName(); + } + } + if(mainDb == null){ + return; + } + Map map1 = new HashMap<>(); + map1.put("tableName",mainDb); + map1.put("dataStatus", "N"); + map1.put("deleteStatus", "0"); + map1.put("size", 1000); + objects = mdmModuleDao.queryMdmSTs(map1); + + if(objects == null || objects.size() == 0){ + return; + } + for (int i1 = 0; i1 < mdmModuleDistributeEntities.size(); i1++) { + //查询下发的配置 + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity() ; + mdmModuleDistributeDetailEntity.setDistributeId(mdmModuleDistributeEntities.get(i1).getId()); + mdmModuleDistributeDetailEntity.setSts("Y"); + List mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity); + //查询这一千条数据是否符合规则 + Map map = new HashMap<>(); + map.put("tableName", mainDb); + map.put("dataStatus", "N"); + map.put("deleteStatus", "0"); + map.put("mdmModuleDistributeDetailEntities", mdmModuleDistributeDetailEntities); + map.put("ids", objects); + List doObjects = mdmModuleDao.queryMdmSTs(map); + if(doObjects == null || doObjects.size() == 0){ + continue; + } + if(mdmModuleDistributeEntities.get(i1).getDeleteApi() == null || "".equals(mdmModuleDistributeEntities.get(i1).getDeleteApi())){ + for (int i = 0; i < doObjects.size(); i++) { + saveMdmModuleSendLogEntity(objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"3"); + } + return ; + } + SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(mdmModuleDistributeEntities.get(i1).getDeleteApi()); + if(apiEntity == null || apiEntity.getId() == null ){ + for (int i = 0; i < doObjects.size(); i++) { + saveMdmModuleSendLogEntity(objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"3"); + } + return ; + } + SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(apiEntity.getAppId()); + if(sysApplicationEntity == null || sysApplicationEntity.getId() == null ){ + for (int i = 0; i < doObjects.size(); i++) { + saveMdmModuleSendLogEntity(objects.get(i).getString("id"),null,apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3"); + } + return ; + } + + SysApplicationScriptEntity scriptEntity = null; + if(mdmModuleDistributeEntities.get(i1).getDeleteScript() != null && !"".equals(mdmModuleDistributeEntities.get(i1).getDeleteScript())){ + scriptEntity = sysApplicationScriptDao.get(mdmModuleDistributeEntities.get(i1).getDeleteScript()); + if(scriptEntity == null || scriptEntity.getId() == null ){ + for (int i = 0; i < doObjects.size(); i++) { + saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3"); + } + return ; + } + } + + for (int i = 0; i < doObjects.size(); i++) { + //查询发送日志是否已经有这条数据 + MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity(); + mdmModuleSendLogEntity.setTableName(mainDb+"_send_log"); + mdmModuleSendLogEntity.setFormmainId(doObjects.get(i).getString("id")); + mdmModuleSendLogEntity.setSts("Y"); + mdmModuleSendLogEntity.setOptionType("3"); + Integer num = mdmModuleSendLogDao.getCount(mdmModuleSendLogEntity); + if(num > 0){//已经过不发送 + continue; + } + getDetailData(mdmModuleDbEntities,doObjects.get(i),mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities); + + //执行脚本 + JSONObject groovy = new JSONObject(); + JSONObject parameterJson = new JSONObject(); + parameterJson.put("header",apiEntity.getHeaderIn()); + parameterJson.put("body",apiEntity.getBodyIn()); + parameterJson.put("query",apiEntity.getQueryIn()); + parameterJson.put("data",doObjects.get(i)); + /** head */ + Map header = null; + /** query */ + String querys = null; + /** body */ + String bodys = doObjects.get(i).toJSONString(); + if(scriptEntity != null && scriptEntity.getId() != null ){ + groovy.put("code",scriptEntity.getScriptCode()); + groovy.put("className",scriptEntity.getClassName()); + groovy.put("name",scriptEntity.getScriptName()); + groovy.put("methodStr",scriptEntity.getScriptData()); + groovy.put("parameterJson",parameterJson); + JSONObject groovyStr = new JSONObject(); + groovyStr.put("jsonStr",groovy); + try { + SysExtensionApiEntity jsonResultEntity = groovyIntegrationService.groovyScriptExecution(groovy); + header = jsonResultEntity.getHeaders(); + querys = jsonResultEntity.getQuerys(); + bodys = jsonResultEntity.getBodys(); + }catch (Exception e){ + saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3"); + continue; + } + } + Map headers = new HashMap<>(); + headers.put("publicKey","ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj"); + headers.put("secretKey","fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA="); + headers.put("appId",sysApplicationEntity.getAppId().toString()); + headers.put("apiCode",apiEntity.getApiCode().toString()); + if(header != null){ + headers.putAll(header); + } + //组装数据发送 + JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys); + if(jsonResultEntity.isFlag()){ + //保存日志 + saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3"); + continue; + }else { + //保存日志 + saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3"); + continue; + } + } + + } + + //所有下发发送完成,修改数据状态 + for (int i = 0; i < objects.size(); i++) { + Map updateMap = new HashMap<>(); + updateMap.put("tableName",mainDb); + updateMap.put("dataStatus", "N"); + updateMap.put("deleteStatus", "1"); + updateMap.put("id", objects.get(i).getString("id")); + mdmModuleDao.updateMdmSTs(updateMap); + } + } + + private void doUpdate(List mdmModuleDbEntities, List mdmModuleDistributeEntities, List mdmModuleDbFiledsRuleEntities, List mdmModuleDbFiledsEntities) { + //查询一千条数据 + String mainDb = null; + List objects = new ArrayList<>(); + for (int i2 = 0; i2 < mdmModuleDbEntities.size(); i2++) { + if("1".equals(mdmModuleDbEntities.get(i2).getDbType())) { + mainDb = mdmModuleDbEntities.get(i2).getDbName(); + } + } + if(mainDb == null){ + return; + } + Map map1 = new HashMap<>(); + map1.put("tableName",mainDb); + map1.put("dataStatus", "F"); + map1.put("updateStatus", "0"); + map1.put("size", 1000); + objects = mdmModuleDao.queryMdmSTs(map1); + + if(objects == null || objects.size() == 0){ + return; + } + for (int i1 = 0; i1 < mdmModuleDistributeEntities.size(); i1++) { + //查询下发的配置 + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity() ; + mdmModuleDistributeDetailEntity.setDistributeId(mdmModuleDistributeEntities.get(i1).getId()); + mdmModuleDistributeDetailEntity.setSts("Y"); + List mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity); + //查询这一千条数据是否符合规则 + Map map = new HashMap<>(); + map.put("tableName", mainDb); + map.put("dataStatus", "F"); + map.put("updateStatus", "0"); + map.put("mdmModuleDistributeDetailEntities", mdmModuleDistributeDetailEntities); + map.put("ids", objects); + List doObjects = mdmModuleDao.queryMdmSTs(map); + if(doObjects == null || doObjects.size() == 0){ + continue; + } + if(mdmModuleDistributeEntities.get(i1).getUpdateApi() == null || "".equals(mdmModuleDistributeEntities.get(i1).getUpdateApi())){ + for (int i = 0; i < doObjects.size(); i++) { + saveMdmModuleSendLogEntity(objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"2"); + } + return ; + } + SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(mdmModuleDistributeEntities.get(i1).getUpdateApi()); + if(apiEntity == null || apiEntity.getId() == null ){ + for (int i = 0; i < doObjects.size(); i++) { + saveMdmModuleSendLogEntity(objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"2"); + } + return ; + } + SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(apiEntity.getAppId()); + if(sysApplicationEntity == null || sysApplicationEntity.getId() == null ){ + for (int i = 0; i < doObjects.size(); i++) { + saveMdmModuleSendLogEntity(objects.get(i).getString("id"),null,apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2"); + } + return ; + } + + SysApplicationScriptEntity scriptEntity = null; + if(mdmModuleDistributeEntities.get(i1).getUpdateScript() != null && !"".equals(mdmModuleDistributeEntities.get(i1).getUpdateScript())){ + scriptEntity = sysApplicationScriptDao.get(mdmModuleDistributeEntities.get(i1).getUpdateScript()); + if(scriptEntity == null || scriptEntity.getId() == null ){ + for (int i = 0; i < doObjects.size(); i++) { + saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2"); + } + return ; + } + } + + for (int i = 0; i < doObjects.size(); i++) { + + getDetailData(mdmModuleDbEntities,doObjects.get(i),mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities); + + //执行脚本 + JSONObject groovy = new JSONObject(); + JSONObject parameterJson = new JSONObject(); + parameterJson.put("header",apiEntity.getHeaderIn()); + parameterJson.put("body",apiEntity.getBodyIn()); + parameterJson.put("query",apiEntity.getQueryIn()); + parameterJson.put("data",doObjects.get(i)); + /** head */ + Map header = null; + /** query */ + String querys = null; + /** body */ + String bodys = doObjects.get(i).toJSONString(); + if(scriptEntity != null && scriptEntity.getId() != null ){ + groovy.put("code",scriptEntity.getScriptCode()); + groovy.put("className",scriptEntity.getClassName()); + groovy.put("name",scriptEntity.getScriptName()); + groovy.put("methodStr",scriptEntity.getScriptData()); + groovy.put("parameterJson",parameterJson); + JSONObject groovyStr = new JSONObject(); + groovyStr.put("jsonStr",groovy); + try { + SysExtensionApiEntity jsonResultEntity = groovyIntegrationService.groovyScriptExecution(groovy); + header = jsonResultEntity.getHeaders(); + querys = jsonResultEntity.getQuerys(); + bodys = jsonResultEntity.getBodys(); + }catch (Exception e){ + saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2"); + continue; + } + } + Map headers = new HashMap<>(); + headers.put("publicKey","ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj"); + headers.put("secretKey","fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA="); + headers.put("appId",sysApplicationEntity.getAppId().toString()); + headers.put("apiCode",apiEntity.getApiCode().toString()); + if(header != null){ + headers.putAll(header); + } + //组装数据发送 + JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys); + if(jsonResultEntity.isFlag()){ + //保存日志 + saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2"); + continue; + }else { + //保存日志 + saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2"); + continue; + } + } + } + + //所有下发发送完成,修改数据状态 + for (int i = 0; i < objects.size(); i++) { + Map updateMap = new HashMap<>(); + updateMap.put("tableName",mainDb); + updateMap.put("dataStatus", "F"); + updateMap.put("updateStatus", "1"); + updateMap.put("id", objects.get(i).getString("id")); + mdmModuleDao.updateMdmSTs(updateMap); + } + } + + /** + * @Author lvleigang + * @Description 处理新增数据 + * @Date 1:55 下午 2024/6/19 + * @param mdmModuleDbEntities + * @param mdmModuleDistributeEntities + * @return void + **/ + private void doAdd(List mdmModuleDbEntities, List mdmModuleDistributeEntities,List mdmModuleDbFiledsRuleEntities,List mdmModuleDbFiledsEntities ) { + //查询一千条数据 + String mainDb = null; + List objects = new ArrayList<>(); + for (int i2 = 0; i2 < mdmModuleDbEntities.size(); i2++) { + if("1".equals(mdmModuleDbEntities.get(i2).getDbType())) { + mainDb = mdmModuleDbEntities.get(i2).getDbName(); + } + } + if(mainDb == null){ + return; + } + Map map1 = new HashMap<>(); + map1.put("tableName",mainDb); + map1.put("dataStatus", "Y"); + map1.put("addStatus", "0"); + map1.put("size", 1000); + objects = mdmModuleDao.queryMdmSTs(map1); + + if(objects == null || objects.size() == 0){ + return; + } + for (int i1 = 0; i1 < mdmModuleDistributeEntities.size(); i1++) { + //查询下发的配置 + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity() ; + mdmModuleDistributeDetailEntity.setDistributeId(mdmModuleDistributeEntities.get(i1).getId()); + mdmModuleDistributeDetailEntity.setSts("Y"); + List mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity); + //查询这一千条数据是否符合规则 + Map map = new HashMap<>(); + map.put("tableName", mainDb); + map.put("dataStatus", "Y"); + map.put("addStatus", "0"); + map.put("mdmModuleDistributeDetailEntities", mdmModuleDistributeDetailEntities); + map.put("ids", objects); + List doObjects = mdmModuleDao.queryMdmSTs(map); + if(doObjects == null || doObjects.size() == 0){ + continue; + } + if(mdmModuleDistributeEntities.get(i1).getAddApi() == null || "".equals(mdmModuleDistributeEntities.get(i1).getAddApi())){ + for (int i = 0; i < doObjects.size(); i++) { + saveMdmModuleSendLogEntity(objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"1"); + } + return ; + } + SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(mdmModuleDistributeEntities.get(i1).getAddApi()); + if(apiEntity == null || apiEntity.getId() == null ){ + for (int i = 0; i < doObjects.size(); i++) { + saveMdmModuleSendLogEntity(objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"1"); + } + return ; + } + SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(apiEntity.getAppId()); + if(sysApplicationEntity == null || sysApplicationEntity.getId() == null ){ + for (int i = 0; i < doObjects.size(); i++) { + saveMdmModuleSendLogEntity(objects.get(i).getString("id"),null,apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1"); + } + return ; + } + + SysApplicationScriptEntity scriptEntity = null; + if(mdmModuleDistributeEntities.get(i1).getAddScript() != null && !"".equals(mdmModuleDistributeEntities.get(i1).getAddScript())){ + scriptEntity = sysApplicationScriptDao.get(mdmModuleDistributeEntities.get(i1).getAddScript()); + if(scriptEntity == null || scriptEntity.getId() == null ){ + for (int i = 0; i < doObjects.size(); i++) { + saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1"); + } + return ; + } + } + + for (int i = 0; i < doObjects.size(); i++) { + //查询是否已经手动发送过。只有新增校验,查询发送日志是否已经有这条数据 + MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity(); + mdmModuleSendLogEntity.setTableName(mainDb+"_send_log"); + mdmModuleSendLogEntity.setFormmainId(doObjects.get(i).getString("id")); + mdmModuleSendLogEntity.setSts("Y"); + mdmModuleSendLogEntity.setOptionType("1"); + Integer num = mdmModuleSendLogDao.getCount(mdmModuleSendLogEntity); + if(num > 0){//已经新增过不发送 + continue; + } + getDetailData(mdmModuleDbEntities,doObjects.get(i),mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities); + + //执行脚本 + JSONObject groovy = new JSONObject(); + JSONObject parameterJson = new JSONObject(); + parameterJson.put("header",apiEntity.getHeaderIn()); + parameterJson.put("body",apiEntity.getBodyIn()); + parameterJson.put("query",apiEntity.getQueryIn()); + parameterJson.put("data",doObjects.get(i)); + /** head */ + Map header = null; + /** query */ + String querys = null; + /** body */ + String bodys = doObjects.get(i).toJSONString(); + if(scriptEntity != null && scriptEntity.getId() != null ){ + groovy.put("code",scriptEntity.getScriptCode()); + groovy.put("className",scriptEntity.getClassName()); + groovy.put("name",scriptEntity.getScriptName()); + groovy.put("methodStr",scriptEntity.getScriptData()); + groovy.put("parameterJson",parameterJson); + JSONObject groovyStr = new JSONObject(); + groovyStr.put("jsonStr",groovy); + try { + SysExtensionApiEntity jsonResultEntity = groovyIntegrationService.groovyScriptExecution(groovy); + header = jsonResultEntity.getHeaders(); + querys = jsonResultEntity.getQuerys(); + bodys = jsonResultEntity.getBodys(); + }catch (Exception e){ + saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1"); + continue; + } + } + Map headers = new HashMap<>(); + headers.put("publicKey","ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj"); + headers.put("secretKey","fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA="); + headers.put("appId",sysApplicationEntity.getAppId().toString()); + headers.put("apiCode",apiEntity.getApiCode().toString()); + if(header != null){ + headers.putAll(header); + } + //组装数据发送 + JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys); + if(jsonResultEntity.isFlag()){ + //保存日志 + saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1"); + continue; + }else { + //保存日志 + saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1"); + continue; + } + } + + + + + + } + + //所有下发发送完成,修改数据状态 + for (int i = 0; i < objects.size(); i++) { + Map updateMap = new HashMap<>(); + updateMap.put("tableName",mainDb); + updateMap.put("dataStatus", "Y"); + updateMap.put("addStatus", "1"); + updateMap.put("id", objects.get(i).getString("id")); + mdmModuleDao.updateMdmSTs(updateMap); + } + } + + private void saveMdmModuleSendLogEntity(String formmain_id,String target_app,String target_api,String source_data, String option_type) { + MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity(); + mdmModuleSendLogEntity.setCreate(); + mdmModuleSendLogEntity.setId(UUIDUtils.getUUID()); + mdmModuleSendLogEntity.setSts("Y"); + mdmModuleSendLogEntity.setCreate_user_id("1"); + mdmModuleSendLogEntity.setModify_user_id("1"); + mdmModuleSendLogEntity.setCreate_time(new Date()); + mdmModuleSendLogEntity.setModify_time(new Date()); + mdmModuleSendLogEntity.setOrg_id("0"); + mdmModuleSendLogEntity.setCompanyId("0"); + mdmModuleSendLogEntity.setFormmainId(formmain_id); + mdmModuleSendLogEntity.setTargetApp(target_app); + mdmModuleSendLogEntity.setTargetApi(target_api); + mdmModuleSendLogEntity.setSourceData(source_data); + mdmModuleSendLogEntity.setOptionType(option_type); + mdmModuleSendLogDao.save(mdmModuleSendLogEntity); + } + + private JSONObject getDetailData(List mdmModuleDbEntities, JSONObject object, List mdmModuleDbFiledsRuleEntities,List mdmModuleDbFiledsEntities) { + + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if("2".equals(mdmModuleDbEntities.get(i).getDbType())){ + Map map = new HashMap<>(); + map.put("tableName",mdmModuleDbEntities.get(i).getDbName()); + map.put("formmainId",object.getString("id")); + List detail = mdmModuleDao.queryMdmSTDetail(map); + //查看主表是否有字段是关联的 + if(detail != null && detail.size() > 0){ + if(mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0){ + for (int i1 = 0; i1 < mdmModuleDbFiledsRuleEntities.size(); i1++) { + if(mdmModuleDbFiledsRuleEntities.get(i1).getDbId().equals(mdmModuleDbEntities.get(i).getId())){ + if(mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0){ + for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) { + if(mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())){ + for (int i3 = 0; i3 < detail.size(); i3++) { + Map mapDetail = new HashMap<>(); + mapDetail.put("tableName",mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue()); + mapDetail.put("id",detail.get(i3).getString(mdmModuleDbFiledsEntities.get(i2).getEnName())); + JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail); + detail.get(i3).put(mdmModuleDbFiledsEntities.get(i2).getEnName(),objectDetail); + } + } + } + } + } + } + } + } + object.put(mdmModuleDbEntities.get(i).getDbName(),detail); + } + } + + return object; + } + + private JsonResultEntity sendData(SysApplicationApiEntity applicationApiEntity, Map headers ,String bodys ,String querys) { StringBuffer urls = new StringBuffer(url); if (querys != null) { diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmQuery.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmQuery.java index bda7c895..be40977f 100644 --- a/service/src/main/java/com/hzya/frame/mdm/entity/MdmQuery.java +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmQuery.java @@ -9,6 +9,8 @@ public class MdmQuery { //分页 private Integer pageNum; + //分页 + private Long mdmCode; private Integer pageSize; //表名 private String tableName; @@ -66,4 +68,12 @@ public class MdmQuery { public void setDetailQueryCondition(List detailQueryCondition) { this.detailQueryCondition = detailQueryCondition; } + + public Long getMdmCode() { + return mdmCode; + } + + public void setMdmCode(Long mdmCode) { + this.mdmCode = mdmCode; + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java index 482285af..c13defa1 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java @@ -52,5 +52,8 @@ public interface IMdmModuleDao extends IBaseDao { JSONObject queryMdmST(Map maps); List queryMdmSTDetail(Map maps); + List queryMdmSTs(Map map); + + void updateMdmSTs(Map updateMap); } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java index d17aa1d0..497b69b5 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java @@ -152,6 +152,16 @@ public class MdmModuleDaoImpl extends MybatisGenericDao JSONObject o = (JSONObject) super.selectOne(getSqlIdPrifx() + "queryMdmST", maps); return o; } + @Override + public List queryMdmSTs(Map maps) { + List o = (List) super.selectList(getSqlIdPrifx() + "queryMdmST", maps); + return o; + } + + @Override + public void updateMdmSTs(Map maps) { + super.update(getSqlIdPrifx() + "updateMdmSTs", maps); + } @Override public List queryMdmSTDetail(Map maps) { diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml index c1a13e78..931920b1 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml @@ -751,7 +751,8 @@ where id = #{id} update ${tableName} set - sts='N',modify_time = now(),modify_user_id = #{loginId} + data_status ='N',modify_time = now(),modify_user_id = #{loginId} + ,delete_status = '0' and id = #{id} and formmain_id = #{formmain_id} @@ -761,7 +762,7 @@ where id = #{id} update ${tableName} set - sts='N',modify_time = now(),modify_user_id = #{loginId} + data_status='N',modify_time = now(),modify_user_id = #{loginId},delete_status = '0' and ${upIdFiled} like concat(#{upIdFiledValue},'%') @@ -803,6 +804,10 @@ where id = #{id} select * from ${tableName} and document_rule = #{documentRule} + and data_status = #{dataStatus} + and add_status = #{addStatus} + and update_status = #{updateStatus} + and delete_status = #{deleteStatus} and id = #{id} AND @@ -825,16 +830,39 @@ where id = #{id} #{item.filedVaule} - and + + + ${item.rightParenthesis} and + + + ${item.rightParenthesis} + + - or + + + ${item.rightParenthesis} or + + + ${item.rightParenthesis} + + + + ${item.rightParenthesis} + - ${item.rightParenthesis} + + + + AND id in + + #{item.id} and sts = 'Y' + limit #{size} @@ -843,5 +871,17 @@ where id = #{id} parameterType="java.util.HashMap"> select * from ${tableName} where sts='Y' and formmain_id = #{formmainId} + + + update ${tableName} set + + , add_status = #{addStatus} + ,modify_time = now() + + + and id = #{id} + and data_status = #{dataStatus} + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java index 84dba275..59217212 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java @@ -558,7 +558,7 @@ public class MdmModuleServiceImpl extends BaseService i documentRule.setShowType("1"); documentRule.setQueryType("1"); documentRule.setListType("1"); - documentRule.setViewType("2"); + documentRule.setViewType("1"); documentRule.setFiledLength("50"); documentRule.setCreate(); documentRule.setDataType("1"); @@ -780,14 +780,14 @@ public class MdmModuleServiceImpl extends BaseService i data_status.setMdmId(entity.getMdmId()); data_status.setDbId(entity.getId()); data_status.setEnName("data_status"); - data_status.setChName("数据状态 Y正常 N删除 F修改"); + data_status.setChName("数据状态"); data_status.setFiledType("3"); data_status.setAddType("2"); data_status.setUpdateType("2"); data_status.setShowType("2"); data_status.setQueryType("2"); - data_status.setListType("2"); - data_status.setViewType("2"); + data_status.setListType("1"); + data_status.setViewType("1"); data_status.setFiledLength("1"); data_status.setCreate(); data_status.setDataType("1"); diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.xml index cdac2db1..540c0e9f 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.xml @@ -76,6 +76,14 @@ and sts = #{sts} and org_id = #{org_id} and company_id = #{companyId} + + and id in ( + select + filed_id + from mdm_module_db_fileds_rule + where sts='Y' and rule_code = #{roletype} and rule_value = #{roleValue} + ) + and sts='Y' order by sorts asc diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.xml index ceef3625..df6e705c 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.xml @@ -2,30 +2,31 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + id ,mdm_id ,distribute_id @@ -47,274 +48,311 @@ ,org_id ,company_id - - + select + + from mdm_module_distribute_detail + + and id = #{id} + and mdm_id = #{mdmId} + and distribute_id = #{distributeId} + and api_id = #{apiId} + and data_type = #{dataType} + and left_bracket = #{leftBracket} + and filed_id = #{filedId} + and filed_name = #{filedName} + and compare_type = #{compareType} + and filed_vaule = #{filedVaule} + and connection_symbol = #{connectionSymbol} + + and right_parenthesis = #{rightParenthesis} + + and sorts = #{sorts} + and create_user_id = #{create_user_id} + and create_time = #{create_time} + and modify_user_id = #{modify_user_id} + and modify_time = #{modify_time} + and sts = #{sts} + and org_id = #{org_id} + and company_id = #{companyId} and sts='Y' - - order by sorts asc - order by ${sort} ${order} - - - - + + + - + select + + from mdm_module_distribute_detail + + and id like concat('%',#{id},'%') + and mdm_id like concat('%',#{mdmId},'%') + and distribute_id like + concat('%',#{distributeId},'%') + + and api_id like concat('%',#{apiId},'%') + and data_type like concat('%',#{dataType},'%') + and left_bracket like concat('%',#{leftBracket},'%') + + and filed_id like concat('%',#{filedId},'%') + and filed_name like concat('%',#{filedName},'%') + and compare_type like concat('%',#{compareType},'%') + + and filed_vaule like concat('%',#{filedVaule},'%') + and connection_symbol like + concat('%',#{connectionSymbol},'%') + + and right_parenthesis like + concat('%',#{rightParenthesis},'%') + + and sorts like concat('%',#{sorts},'%') + and create_user_id like + concat('%',#{create_user_id},'%') + + and create_time like concat('%',#{create_time},'%') + and modify_user_id like + concat('%',#{modify_user_id},'%') + + and modify_time like concat('%',#{modify_time},'%') + and sts like concat('%',#{sts},'%') + and org_id like concat('%',#{org_id},'%') + and company_id like concat('%',#{companyId},'%') and sts='Y' - - order by sorts asc - order by ${sort} ${order} - + + order by sorts asc + order by ${sort} ${order} + - - + select + + from mdm_module_distribute_detail + + or id = #{id} + or mdm_id = #{mdmId} + or distribute_id = #{distributeId} + or api_id = #{apiId} + or data_type = #{dataType} + or left_bracket = #{leftBracket} + or filed_id = #{filedId} + or filed_name = #{filedName} + or compare_type = #{compareType} + or filed_vaule = #{filedVaule} + or connection_symbol = #{connectionSymbol} + + or right_parenthesis = #{rightParenthesis} + + or sorts = #{sorts} + or create_user_id = #{create_user_id} + or create_time = #{create_time} + or modify_user_id = #{modify_user_id} + or modify_time = #{modify_time} + or sts = #{sts} + or org_id = #{org_id} + or company_id = #{companyId} and sts='Y' - - order by sorts asc - order by ${sort} ${order} - + + order by sorts asc + order by ${sort} ${order} + - - - insert into mdm_module_distribute_detail( - - id , - mdm_id , - distribute_id , - api_id , - data_type , - left_bracket , - filed_id , - filed_name , - compare_type , - filed_vaule , - connection_symbol , - right_parenthesis , - sorts , - create_user_id , - create_time , - modify_user_id , - modify_time , - sts , - org_id , - company_id , + + + insert into mdm_module_distribute_detail( + + id , + mdm_id , + distribute_id , + api_id , + data_type , + left_bracket , + filed_id , + filed_name , + compare_type , + filed_vaule , + connection_symbol , + right_parenthesis , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + company_id , sorts, - sts, - - )values( - - #{id} , - #{mdmId} , - #{distributeId} , - #{apiId} , - #{dataType} , - #{leftBracket} , - #{filedId} , - #{filedName} , - #{compareType} , - #{filedVaule} , - #{connectionSymbol} , - #{rightParenthesis} , - #{sorts} , - #{create_user_id} , - #{create_time} , - #{modify_user_id} , - #{modify_time} , - #{sts} , - #{org_id} , - #{companyId} , - (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module_distribute_detail a WHERE a.sts = 'Y' ), - 'Y', - - ) - - - - insert into mdm_module_distribute_detail(mdm_id, distribute_id, api_id, data_type, left_bracket, filed_id, filed_name, compare_type, filed_vaule, connection_symbol, right_parenthesis, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) - values - - (#{entity.mdmId},#{entity.distributeId},#{entity.apiId},#{entity.dataType},#{entity.leftBracket},#{entity.filedId},#{entity.filedName},#{entity.compareType},#{entity.filedVaule},#{entity.connectionSymbol},#{entity.rightParenthesis},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') - - - - - insert into mdm_module_distribute_detail(mdm_id, distribute_id, api_id, data_type, left_bracket, filed_id, filed_name, compare_type, filed_vaule, connection_symbol, right_parenthesis, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) - values - - (#{entity.mdmId},#{entity.distributeId},#{entity.apiId},#{entity.dataType},#{entity.leftBracket},#{entity.filedId},#{entity.filedName},#{entity.compareType},#{entity.filedVaule},#{entity.connectionSymbol},#{entity.rightParenthesis},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) - - on duplicate key update - mdm_id = values(mdm_id), - distribute_id = values(distribute_id), - api_id = values(api_id), - data_type = values(data_type), - left_bracket = values(left_bracket), - filed_id = values(filed_id), - filed_name = values(filed_name), - compare_type = values(compare_type), - filed_vaule = values(filed_vaule), - connection_symbol = values(connection_symbol), - right_parenthesis = values(right_parenthesis), - create_user_id = values(create_user_id), - create_time = values(create_time), - modify_user_id = values(modify_user_id), - modify_time = values(modify_time), - sts = values(sts), - org_id = values(org_id), - company_id = values(company_id) - - -update mdm_module_distribute_detail set - - mdm_id = #{mdmId}, - distribute_id = #{distributeId}, - api_id = #{apiId}, - data_type = #{dataType}, - left_bracket = #{leftBracket}, - filed_id = #{filedId}, - filed_name = #{filedName}, - compare_type = #{compareType}, - filed_vaule = #{filedVaule}, - connection_symbol = #{connectionSymbol}, - right_parenthesis = #{rightParenthesis}, - create_user_id = #{create_user_id}, - create_time = #{create_time}, - modify_user_id = #{modify_user_id}, - modify_time = #{modify_time}, - sts = #{sts}, - org_id = #{org_id}, - company_id = #{companyId}, - -where id = #{id} - - - + sts, + + )values( + + #{id} , + #{mdmId} , + #{distributeId} , + #{apiId} , + #{dataType} , + #{leftBracket} , + #{filedId} , + #{filedName} , + #{compareType} , + #{filedVaule} , + #{connectionSymbol} , + #{rightParenthesis} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{companyId} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module_distribute_detail + a WHERE a.sts = 'Y' ), + + 'Y', + + ) + + + + insert into mdm_module_distribute_detail(mdm_id, distribute_id, api_id, data_type, left_bracket, filed_id, + filed_name, compare_type, filed_vaule, connection_symbol, right_parenthesis, create_user_id, create_time, + modify_user_id, modify_time, sts, org_id, company_id, sts) + values + + (#{entity.mdmId},#{entity.distributeId},#{entity.apiId},#{entity.dataType},#{entity.leftBracket},#{entity.filedId},#{entity.filedName},#{entity.compareType},#{entity.filedVaule},#{entity.connectionSymbol},#{entity.rightParenthesis},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, + 'Y') + + + + + insert into mdm_module_distribute_detail(mdm_id, distribute_id, api_id, data_type, left_bracket, filed_id, + filed_name, compare_type, filed_vaule, connection_symbol, right_parenthesis, create_user_id, create_time, + modify_user_id, modify_time, sts, org_id, company_id) + values + + (#{entity.mdmId},#{entity.distributeId},#{entity.apiId},#{entity.dataType},#{entity.leftBracket},#{entity.filedId},#{entity.filedName},#{entity.compareType},#{entity.filedVaule},#{entity.connectionSymbol},#{entity.rightParenthesis},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) + + on duplicate key update + mdm_id = values(mdm_id), + distribute_id = values(distribute_id), + api_id = values(api_id), + data_type = values(data_type), + left_bracket = values(left_bracket), + filed_id = values(filed_id), + filed_name = values(filed_name), + compare_type = values(compare_type), + filed_vaule = values(filed_vaule), + connection_symbol = values(connection_symbol), + right_parenthesis = values(right_parenthesis), + create_user_id = values(create_user_id), + create_time = values(create_time), + modify_user_id = values(modify_user_id), + modify_time = values(modify_time), + sts = values(sts), + org_id = values(org_id), + company_id = values(company_id) + + + + update mdm_module_distribute_detail set + + mdm_id = #{mdmId}, + distribute_id = #{distributeId}, + api_id = #{apiId}, + data_type = #{dataType}, + left_bracket = #{leftBracket}, + filed_id = #{filedId}, + filed_name = #{filedName}, + compare_type = #{compareType}, + filed_vaule = #{filedVaule}, + connection_symbol = #{connectionSymbol}, + right_parenthesis = #{rightParenthesis}, + create_user_id = #{create_user_id}, + create_time = #{create_time}, + modify_user_id = #{modify_user_id}, + modify_time = #{modify_time}, + sts = #{sts}, + org_id = #{org_id}, + company_id = #{companyId}, + + where id = #{id} + + + update mdm_module_distribute_detail set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} where id = #{id} - - -update mdm_module_distribute_detail set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} - - and id = #{id} - and mdm_id = #{mdmId} - and distribute_id = #{distributeId} - and api_id = #{apiId} - and data_type = #{dataType} - and left_bracket = #{leftBracket} - and filed_id = #{filedId} - and filed_name = #{filedName} - and compare_type = #{compareType} - and filed_vaule = #{filedVaule} - and connection_symbol = #{connectionSymbol} - and right_parenthesis = #{rightParenthesis} - and sorts = #{sorts} - and sts = #{sts} - and company_id = #{companyId} + + + update mdm_module_distribute_detail set sts= 'N' ,modify_time = #{modify_time},modify_user_id = + #{modify_user_id} + + and id = #{id} + and mdm_id = #{mdmId} + and distribute_id = #{distributeId} + and api_id = #{apiId} + and data_type = #{dataType} + and left_bracket = #{leftBracket} + and filed_id = #{filedId} + and filed_name = #{filedName} + and compare_type = #{compareType} + and filed_vaule = #{filedVaule} + and connection_symbol = #{connectionSymbol} + + and right_parenthesis = #{rightParenthesis} + + and sorts = #{sorts} + and sts = #{sts} + and company_id = #{companyId} and sts='Y' - - - - + + + + delete from mdm_module_distribute_detail where id = #{id} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.java index 20995957..05c4ec95 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.java @@ -21,7 +21,7 @@ public class MdmModuleSendLogEntity extends BaseEntity { private String targetApi; /** 源数据 */ private String sourceData; - /** 操作类型 */ + /** 操作类型 1新增2、修改3、删除*/ private String optionType; /** 公司id */ private String companyId; diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/entity/MdmModuleSourceEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/entity/MdmModuleSourceEntity.xml index 60b0346c..1918707d 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/entity/MdmModuleSourceEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/entity/MdmModuleSourceEntity.xml @@ -44,6 +44,12 @@ ,company_id + + @@ -608,7 +608,7 @@ where id = #{id} from ${tableName} and id = #{id} - and sts = 'Y' + and sts = 'Y' and data_status != 'N' order by sorts asc @@ -620,7 +620,7 @@ where id = #{id} ${label}, ${upId} from ${tableName} - where sts = 'Y' + where sts = 'Y' and data_status != 'N' order by sorts asc diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/IMdmModuleService.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/IMdmModuleService.java index 5d45e907..ca980443 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/IMdmModuleService.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/IMdmModuleService.java @@ -388,4 +388,13 @@ public interface IMdmModuleService extends IBaseService * @return com.hzya.frame.web.entity.JsonResultEntity **/ JsonResultEntity queryMdmMainDBField(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-分发设置-列表获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmDistributeByMdmCode(JSONObject jsonObject); } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java index 59217212..c5b3d267 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java @@ -311,6 +311,7 @@ public class MdmModuleServiceImpl extends BaseService i } entity.setCreate(); mdmModuleDao.save(entity); + entity = mdmModuleDao.get(entity.getId()); return BaseResult.getSuccessMessageEntity("保存成功",entity); } @@ -631,11 +632,28 @@ public class MdmModuleServiceImpl extends BaseService i data_type.setQueryType("1"); data_type.setListType("1"); data_type.setViewType("1"); - data_type.setFiledLength("255"); + data_type.setFiledLength("50"); data_type.setCreate(); data_type.setDataType("1"); mdmModuleDbFiledsEntities.add(data_type); + MdmModuleDbFiledsEntity remark = new MdmModuleDbFiledsEntity(); + remark.setMdmId(entity.getMdmId()); + remark.setDbId(entity.getId()); + remark.setEnName("remark"); + remark.setChName("备注"); + remark.setFiledType("3"); + remark.setAddType("1"); + remark.setUpdateType("1"); + remark.setShowType("1"); + remark.setQueryType("1"); + remark.setListType("1"); + remark.setViewType("1"); + remark.setFiledLength("255"); + remark.setCreate(); + remark.setDataType("1"); + mdmModuleDbFiledsEntities.add(remark); + MdmModuleDbFiledsEntity code = new MdmModuleDbFiledsEntity(); code.setMdmId(entity.getMdmId()); code.setDbId(entity.getId()); @@ -774,6 +792,40 @@ public class MdmModuleServiceImpl extends BaseService i option_type.setCreate(); option_type.setDataType("1"); mdmModuleDbFiledsEntities.add(option_type); + + MdmModuleDbFiledsEntity data_type = new MdmModuleDbFiledsEntity(); + data_type.setMdmId(entity.getMdmId()); + data_type.setDbId(entity.getId()); + data_type.setEnName("data_type"); + data_type.setChName("状态"); + data_type.setFiledType("3"); + data_type.setAddType("1"); + data_type.setUpdateType("1"); + data_type.setShowType("1"); + data_type.setQueryType("1"); + data_type.setListType("1"); + data_type.setViewType("1"); + data_type.setFiledLength("255"); + data_type.setCreate(); + data_type.setDataType("1"); + mdmModuleDbFiledsEntities.add(data_type); + + MdmModuleDbFiledsEntity remark = new MdmModuleDbFiledsEntity(); + remark.setMdmId(entity.getMdmId()); + remark.setDbId(entity.getId()); + remark.setEnName("remark"); + remark.setChName("备注"); + remark.setFiledType("3"); + remark.setAddType("1"); + remark.setUpdateType("1"); + remark.setShowType("1"); + remark.setQueryType("1"); + remark.setListType("1"); + remark.setViewType("1"); + remark.setFiledLength("255"); + remark.setCreate(); + remark.setDataType("1"); + mdmModuleDbFiledsEntities.add(remark); } if ("2".equals(entity.getDbType()) || "1".equals(entity.getDbType())) { MdmModuleDbFiledsEntity data_status = new MdmModuleDbFiledsEntity(); @@ -786,8 +838,8 @@ public class MdmModuleServiceImpl extends BaseService i data_status.setUpdateType("2"); data_status.setShowType("2"); data_status.setQueryType("2"); - data_status.setListType("1"); - data_status.setViewType("1"); + data_status.setListType("2"); + data_status.setViewType("2"); data_status.setFiledLength("1"); data_status.setCreate(); data_status.setDataType("1"); @@ -2616,4 +2668,27 @@ public class MdmModuleServiceImpl extends BaseService i } return BaseResult.getSuccessMessageEntity("查询数据成功", list); } + + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-分发设置-列表获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdmDistributeByMdmCode(JSONObject object) { + MdmModuleDistributeEntity entity = getData("jsonStr", object, MdmModuleDistributeEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); + entity.setMdmId(mdmModuleEntity.getId()); + List list = mdmModuleDistributeDao.queryBase(entity); + return BaseResult.getSuccessMessageEntity("获取分发设置成功", list); + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/IMdmModuleDistributeDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/IMdmModuleDistributeDao.java index ffa3cacc..44cc5cec 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/IMdmModuleDistributeDao.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/IMdmModuleDistributeDao.java @@ -11,5 +11,6 @@ import com.hzya.frame.basedao.dao.IBaseDao; */ public interface IMdmModuleDistributeDao extends IBaseDao { + Integer queryCountUse(MdmModuleDistributeEntity mdmModuleDistributeEntity); } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/impl/MdmModuleDistributeDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/impl/MdmModuleDistributeDaoImpl.java index 83ba2db8..3f9560f8 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/impl/MdmModuleDistributeDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/impl/MdmModuleDistributeDaoImpl.java @@ -4,6 +4,9 @@ import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity; import com.hzya.frame.mdm.mdmModuleDistribute.dao.IMdmModuleDistributeDao; import org.springframework.stereotype.Repository; import com.hzya.frame.basedao.dao.MybatisGenericDao; + +import java.util.HashMap; + /** * 主数据功能应用分发表(MdmModuleDistribute)表数据库访问层 * @@ -12,6 +15,11 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao; */ @Repository(value = "MdmModuleDistributeDaoImpl") public class MdmModuleDistributeDaoImpl extends MybatisGenericDao implements IMdmModuleDistributeDao{ - + + @Override + public Integer queryCountUse(MdmModuleDistributeEntity mdmModuleDistributeEntity) { + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "queryCountUse", mdmModuleDistributeEntity); + return o; + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.java index 30fcf0dc..02783ec9 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.java @@ -17,6 +17,8 @@ public class MdmModuleDistributeEntity extends BaseEntity { private String mdmId; /** 应用id */ private String appId; + /** 应用id */ + private Long mdmCode; /** 触发类型 0、手动1、自动 */ private String enabledType; /** 修改接口 */ @@ -40,6 +42,13 @@ public class MdmModuleDistributeEntity extends BaseEntity { /** 公司id */ private List mdmModuleDistributeDetailEntities; + public Long getMdmCode() { + return mdmCode; + } + + public void setMdmCode(Long mdmCode) { + this.mdmCode = mdmCode; + } public String getMdmId() { return mdmId; @@ -144,5 +153,7 @@ public class MdmModuleDistributeEntity extends BaseEntity { public void setMdmModuleDistributeDetailEntities(List mdmModuleDistributeDetailEntities) { this.mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailEntities; } + + } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.xml index ffedf135..03266e78 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.xml @@ -324,6 +324,16 @@ update mdm_module_distribute set sts= 'N' ,modify_time = #{modify_time},modify_ delete from mdm_module_distribute where id = #{id} - + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.java index aaf6f341..525fce33 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.java @@ -19,6 +19,8 @@ public class MdmModuleOptionLogEntity extends BaseEntity { private String sourceName; /** 状态 1、成功2、失败 */ private String dataType; + /** 备注 */ + private String remark; /** 编码 */ private String code; /** source_data */ @@ -30,6 +32,15 @@ public class MdmModuleOptionLogEntity extends BaseEntity { /** 公司id */ private String companyId; + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + public String getDataType() { return dataType; } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.xml index f6708c43..c4df7ee5 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.xml @@ -8,6 +8,7 @@ + @@ -27,7 +28,8 @@ ,source_name ,data_type ,code - ,source_data + ,remark + ,source_data ,option_type ,option_name ,sorts @@ -55,6 +57,7 @@ and source_name = #{sourceName} and data_type = #{dataType} and code = #{code} + and remark = #{remark} and source_data = #{sourceData} and option_type = #{optionType} and option_name = #{optionName} @@ -81,6 +84,7 @@ and source_name = #{sourceName} and data_type = #{dataType} and code = #{code} + and remark = #{remark} and source_data = #{sourceData} and option_type = #{optionType} and option_name = #{optionName} @@ -109,6 +113,7 @@ and source_name like concat('%',#{sourceName},'%') and data_type like concat('%',#{dataType},'%') and code like concat('%',#{code},'%') + and remark like concat('%',#{remark},'%') and source_data like concat('%',#{sourceData},'%') and option_type like concat('%',#{optionType},'%') and option_name like concat('%',#{optionName},'%') @@ -122,7 +127,7 @@ and company_id like concat('%',#{companyId},'%') and sts='Y' - order by sorts asc + order by sorts desc order by ${sort} ${order} @@ -137,6 +142,7 @@ or source_name = #{sourceName} or data_type = #{dataType} or code = #{code} + or remark = #{remark} or source_data = #{sourceData} or option_type = #{optionType} or option_name = #{optionName} @@ -163,6 +169,7 @@ source_name , data_type , code , + remark , source_data , option_type , option_name , @@ -183,6 +190,7 @@ #{sourceName} , #{dataType} , #{code} , + #{remark} , #{sourceData} , #{optionType} , #{optionName} , @@ -200,24 +208,25 @@ - insert into ${tableName}(formmain_id, source_name,data_type, code, source_data, option_type, option_name, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) + insert into ${tableName}(formmain_id, source_name,data_type, code,remark, source_data, option_type, option_name, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) values - (#{entity.formmainId},#{entity.sourceName},#{entity.dataType},#{entity.code},#{entity.sourceData},#{entity.optionType},#{entity.optionName},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') + (#{entity.formmainId},#{entity.sourceName},#{entity.dataType},#{entity.code},#{entity.remark},#{entity.sourceData},#{entity.optionType},#{entity.optionName},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') - insert into ${tableName}(formmain_id, source_name,data_type, code, source_data, option_type, option_name, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) + insert into ${tableName}(formmain_id, source_name,data_type, code, remark, source_data, option_type, option_name, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) values - (#{entity.formmainId},#{entity.sourceName},#{entity.dataType},#{entity.code},#{entity.sourceData},#{entity.optionType},#{entity.optionName},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) + (#{entity.formmainId},#{entity.sourceName},#{entity.dataType},#{entity.code},#{entity.remark},#{entity.sourceData},#{entity.optionType},#{entity.optionName},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) on duplicate key update formmain_id = values(formmain_id), source_name = values(source_name), data_type = values(data_type), code = values(code), + remark = values(remark), source_data = values(source_data), option_type = values(option_type), option_name = values(option_name), @@ -236,6 +245,7 @@ update ${tableName} set source_name = #{sourceName}, data_type = #{dataType}, code = #{code}, + remark = #{remark}, source_data = #{sourceData}, option_type = #{optionType}, option_name = #{optionName}, @@ -263,6 +273,7 @@ update ${tableName} set sts= 'N' ,modify_time = #{modify_time},modify_user_id = and source_name = #{sourceName} and data_type = #{dataType} and code = #{code} + and remark = #{remark} and source_data = #{sourceData} and option_type = #{optionType} and option_name = #{optionName} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.java index 05c4ec95..1a09ceed 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.java @@ -21,11 +21,30 @@ public class MdmModuleSendLogEntity extends BaseEntity { private String targetApi; /** 源数据 */ private String sourceData; + /** 状态 1、成功2、失败 */ + private String dataType; + /** 备注 */ + private String remark; /** 操作类型 1新增2、修改3、删除*/ private String optionType; /** 公司id */ private String companyId; + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getDataType() { + return dataType; + } + + public void setDataType(String dataType) { + this.dataType = dataType; + } public String getFormmainId() { return formmainId; diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.xml index e3beb6bd..718563ca 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.xml @@ -9,6 +9,8 @@ + + @@ -26,7 +28,9 @@ ,target_api ,source_data ,option_type - ,sorts + ,remark + ,data_type + ,sorts ,create_user_id ,create_time ,modify_user_id @@ -53,6 +57,8 @@ and target_api = #{targetApi} and source_data = #{sourceData} and option_type = #{optionType} + and remark = #{remark} + and data_type = #{dataType} and sorts = #{sorts} and create_user_id = #{create_user_id} and create_time = #{create_time} @@ -77,6 +83,8 @@ and target_api = #{targetApi} and source_data = #{sourceData} and option_type = #{optionType} + and remark = #{remark} + and data_type = #{dataType} and sorts = #{sorts} and create_user_id = #{create_user_id} and create_time = #{create_time} @@ -103,6 +111,8 @@ and target_api like concat('%',#{targetApi},'%') and source_data like concat('%',#{sourceData},'%') and option_type like concat('%',#{optionType},'%') + and remark like concat('%',#{remark},'%') + and data_type like concat('%',#{dataType},'%') and sorts like concat('%',#{sorts},'%') and create_user_id like concat('%',#{create_user_id},'%') and create_time like concat('%',#{create_time},'%') @@ -113,7 +123,7 @@ and company_id like concat('%',#{companyId},'%') and sts='Y' - order by sorts asc + order by sorts desc order by ${sort} ${order} @@ -129,6 +139,8 @@ or target_api = #{targetApi} or source_data = #{sourceData} or option_type = #{optionType} + or remark = #{remark} + or data_type = #{dataType} or sorts = #{sorts} or create_user_id = #{create_user_id} or create_time = #{create_time} @@ -153,6 +165,8 @@ target_api , source_data , option_type , + remark , + data_type , sorts , create_user_id , create_time , @@ -171,6 +185,8 @@ #{targetApi} , #{sourceData} , #{optionType} , + #{remark} , + #{dataType} , #{sorts} , #{create_user_id} , #{create_time} , @@ -185,18 +201,18 @@ - insert into ${tableName}(formmain_id, target_app, target_api, source_data, option_type, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) + insert into ${tableName}(formmain_id, target_app, target_api, source_data, option_type,remark,data_type, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) values - (#{entity.formmainId},#{entity.targetApp},#{entity.targetApi},#{entity.sourceData},#{entity.optionType},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') + (#{entity.formmainId},#{entity.targetApp},#{entity.targetApi},#{entity.sourceData},#{entity.optionType},#{entity.remark},#{entity.dataType},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') - insert into ${tableName}(formmain_id, target_app, target_api, source_data, option_type, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) + insert into ${tableName}(formmain_id, target_app, target_api, source_data, option_type,remark,data_type, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) values - (#{entity.formmainId},#{entity.targetApp},#{entity.targetApi},#{entity.sourceData},#{entity.optionType},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) + (#{entity.formmainId},#{entity.targetApp},#{entity.targetApi},#{entity.sourceData},#{entity.optionType},#{entity.remark},#{entity.dataType},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) on duplicate key update formmain_id = values(formmain_id), @@ -204,6 +220,8 @@ target_api = values(target_api), source_data = values(source_data), option_type = values(option_type), + remark = values(remark), + data_type = values(data_type), create_user_id = values(create_user_id), create_time = values(create_time), modify_user_id = values(modify_user_id), @@ -220,6 +238,8 @@ update ${tableName} set target_api = #{targetApi}, source_data = #{sourceData}, option_type = #{optionType}, + remark = #{remark}, + data_type = #{dataType}, create_user_id = #{create_user_id}, create_time = #{create_time}, modify_user_id = #{modify_user_id}, @@ -245,6 +265,8 @@ update ${tableName} set sts= 'N' ,modify_time = #{modify_time},modify_user_id = and target_api = #{targetApi} and source_data = #{sourceData} and option_type = #{optionType} + and remark = #{remark} + and data_type = #{dataType} and sorts = #{sorts} and sts = #{sts} and company_id = #{companyId} diff --git a/service/src/main/java/com/hzya/frame/mdm/service/IMdmService.java b/service/src/main/java/com/hzya/frame/mdm/service/IMdmService.java index ae9ef52c..557009fe 100644 --- a/service/src/main/java/com/hzya/frame/mdm/service/IMdmService.java +++ b/service/src/main/java/com/hzya/frame/mdm/service/IMdmService.java @@ -110,14 +110,14 @@ public interface IMdmService { * @Date 9:40 上午 2023/10/18 **/ JsonResultEntity deleteMdmShowDetailsData(JSONObject jsonObject); - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 处理分发数据 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity doMdmDistribute(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 处理分发数据 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity doMdmDistribute(JSONObject jsonObject); } diff --git a/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceImpl.java index d09b3cb4..168ca76b 100644 --- a/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceImpl.java @@ -1,10 +1,12 @@ package com.hzya.frame.mdm.service.impl; import cn.dev33.satoken.stp.StpUtil; +import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.hzya.frame.base.PluginBaseEntity; import com.hzya.frame.mdm.entity.DbFiledsDto; import com.hzya.frame.mdm.entity.MdmDataDto; import com.hzya.frame.mdm.entity.MdmDataFiledDto; @@ -30,6 +32,7 @@ import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEnti import com.hzya.frame.mdm.mdmModuleDistribute.dao.IMdmModuleDistributeDao; import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity; import com.hzya.frame.mdm.mdmModuleDistributeDetail.dao.IMdmModuleDistributeDetailDao; +import com.hzya.frame.mdm.mdmModuleDistributeDetail.entity.MdmModuleDistributeDetailEntity; import com.hzya.frame.mdm.mdmModuleOptionLog.dao.IMdmModuleOptionLogDao; import com.hzya.frame.mdm.mdmModuleOptionLog.entity.MdmModuleOptionLogEntity; import com.hzya.frame.mdm.mdmModuleSendLog.dao.IMdmModuleSendLogDao; @@ -47,24 +50,45 @@ import com.hzya.frame.mdm.service.IMdmService; import com.hzya.frame.mdm.service.IMdmServiceCache; import com.hzya.frame.sys.entity.FormmainDeleteDto; +import com.hzya.frame.sysnew.application.api.dao.ISysApplicationApiDao; +import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity; +import com.hzya.frame.sysnew.application.dao.ISysApplicationDao; +import com.hzya.frame.sysnew.application.entity.SysApplicationEntity; +import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; +import com.hzya.frame.sysnew.application.plugin.entity.SysApplicationPluginEntity; +import com.hzya.frame.sysnew.application.script.dao.ISysApplicationScriptDao; +import com.hzya.frame.sysnew.application.script.entity.SysApplicationScriptEntity; import com.hzya.frame.sysnew.buttonConfig.dao.ISysButtonConfigDao; import com.hzya.frame.sysnew.buttonConfig.entity.SysButtonConfigEntity; +import com.hzya.frame.sysnew.grovy.service.IGroovyIntegrationService; import com.hzya.frame.sysnew.menuConfig.dao.ISysMenuConfigDao; import com.hzya.frame.sysnew.menuConfig.entity.SysMenuConfigEntity; import com.hzya.frame.sysnew.popedomOperate.dao.ISysPopedomOperateDao; import com.hzya.frame.sysnew.popedomOperate.entity.SysPopedomOperateEntity; +import com.hzya.frame.sysnew.user.dao.ISysUserDao; import com.hzya.frame.sysnew.user.entity.SysUserEntity; import com.hzya.frame.sysnew.userCompany.entity.SysUserCompanyEntity; import com.hzya.frame.sysnew.userRoles.entity.SysUserRolesEntity; +import com.hzya.frame.util.PluginUtils; import com.hzya.frame.uuid.UUIDUtils; import com.hzya.frame.web.entity.BaseResult; import com.hzya.frame.web.entity.JsonResultEntity; +import org.apache.http.HttpEntity; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ByteArrayEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; import org.checkerframework.checker.units.qual.A; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; @@ -81,8 +105,17 @@ import java.util.Map; public class MdmServiceImpl implements IMdmService { private final Logger logger = LoggerFactory.getLogger(this.getClass()); + @Resource + private ISysApplicationDao sysApplicationDao; + @Resource + private ISysApplicationApiDao sysApplicationApiDao; + @Resource + private ISysApplicationScriptDao sysApplicationScriptDao; @Resource private IMdmModuleDao mdmModuleDao; + + @Resource + private IGroovyIntegrationService groovyIntegrationService; @Resource private IMdmModuleSendLogDao mdmModuleSendLogDao; @Resource @@ -98,6 +131,8 @@ public class MdmServiceImpl implements IMdmService { @Resource private IMdmModuleDbDao mdmModuleDbDao; @Resource + private ISysUserDao sysUserDao; + @Resource private IMdmModuleDbFiledsDao mdmModuleDbFiledsDao; @Resource private IMdmModuleDbFiledsRuleDao mdmModuleDbFiledsRuleDao; @@ -113,7 +148,10 @@ public class MdmServiceImpl implements IMdmService { private IMdmModuleViewButtonDao mdmModuleViewButtonDao; @Resource private IMdmModuleViewDetailDao mdmModuleViewDetailDao; - + //多线程请求加锁 HttpRequest 构造方法是静态的 + private final Object lock = new Object(); + @Value("${ax.url}") + private String url; /** * @param object @@ -133,7 +171,7 @@ public class MdmServiceImpl implements IMdmService { } //查询模版 MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); - if(mdmModuleEntity == null || mdmModuleEntity.getId() == null){ + if (mdmModuleEntity == null || mdmModuleEntity.getId() == null) { return BaseResult.getFailureMessageEntity("系统错误"); } @@ -184,28 +222,28 @@ public class MdmServiceImpl implements IMdmService { if (mdmModuleViewDetailEntities == null || mdmModuleViewDetailEntities.size() == 0) { return BaseResult.getFailureMessageEntity("系统错误"); } - List queryList = getFiledByType("1",mdmModuleViewDetailEntities,mdmModuleDbEntityList,mdmModuleDbFiledsEntityList,mdmModuleDbFiledsRuleEntityList); + List queryList = getFiledByType("1", mdmModuleViewDetailEntities, mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList); mdmViewVo.setQueryList(queryList); - List listList = getFiledByType("2",mdmModuleViewDetailEntities,mdmModuleDbEntityList,mdmModuleDbFiledsEntityList,mdmModuleDbFiledsRuleEntityList); + List listList = getFiledByType("2", mdmModuleViewDetailEntities, mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList); mdmViewVo.setListList(listList); return BaseResult.getSuccessMessageEntity("获取字段成功", mdmViewVo); } /** - * @Author lvleigang - * @Description 根据类型获取字段 - * @Date 9:18 上午 2024/6/6 - * @param viewType 类型 - * @param mdmModuleViewDetailEntities 显示设置的字段 - * @param mdmModuleDbEntityList 表 - * @param mdmModuleDbFiledsEntityList 表字段 + * @param viewType 类型 + * @param mdmModuleViewDetailEntities 显示设置的字段 + * @param mdmModuleDbEntityList 表 + * @param mdmModuleDbFiledsEntityList 表字段 * @param mdmModuleDbFiledsRuleEntityList 字段规则 * @return java.util.List + * @Author lvleigang + * @Description 根据类型获取字段 + * @Date 9:18 上午 2024/6/6 **/ private List getFiledByType(String viewType, List mdmModuleViewDetailEntities, List mdmModuleDbEntityList, List mdmModuleDbFiledsEntityList, List mdmModuleDbFiledsRuleEntityList) { List mdmViewFiledVos = new ArrayList<>(); for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { - if("1".equals(mdmModuleDbEntityList.get(i).getDbType())){ + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { MdmViewFiledVo rule = new MdmViewFiledVo(); rule.setDbName(mdmModuleDbEntityList.get(i).getDbName()); rule.setDbType("1"); @@ -252,16 +290,16 @@ public class MdmServiceImpl implements IMdmService { rule.setRuleList(msgRule); } } - if(mdmModuleViewDetailEntities != null && mdmModuleViewDetailEntities.size() > 0){ + if (mdmModuleViewDetailEntities != null && mdmModuleViewDetailEntities.size() > 0) { for (int i = 0; i < mdmModuleViewDetailEntities.size(); i++) { - if(viewType.equals(mdmModuleViewDetailEntities.get(i).getViewType())){ + if (viewType.equals(mdmModuleViewDetailEntities.get(i).getViewType())) { //类型一致 MdmViewFiledVo mdmViewFiledVo = new MdmViewFiledVo(); mdmViewFiledVo.setId(mdmModuleViewDetailEntities.get(i).getViewFiled()); for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { - if(mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleViewDetailEntities.get(i).getViewFiled())){ + if (mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleViewDetailEntities.get(i).getViewFiled())) { for (int i2 = 0; i2 < mdmModuleDbEntityList.size(); i2++) { - if(mdmModuleDbEntityList.get(i2).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())){ + if (mdmModuleDbEntityList.get(i2).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { mdmViewFiledVo.setDbName(mdmModuleDbEntityList.get(i2).getDbName()); mdmViewFiledVo.setDbType(mdmModuleDbEntityList.get(i2).getDbType()); mdmViewFiledVo.setMdmId(mdmModuleDbEntityList.get(i2).getMdmId()); @@ -275,15 +313,15 @@ public class MdmServiceImpl implements IMdmService { mdmViewFiledVo.setFiledType(mdmModuleDbFiledsEntityList.get(i1).getFiledType()); //字段规则 - if(mdmModuleDbFiledsRuleEntityList != null && mdmModuleDbFiledsRuleEntityList.size() > 0){ + if (mdmModuleDbFiledsRuleEntityList != null && mdmModuleDbFiledsRuleEntityList.size() > 0) { List ruleList = new ArrayList<>(); for (int i2 = 0; i2 < mdmModuleDbFiledsRuleEntityList.size(); i2++) { - if(mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getFiledId())){ + if (mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getFiledId())) { ruleList.add(mdmModuleDbFiledsRuleEntityList.get(i2)); } } mdmViewFiledVo.setRuleList(ruleList); - if("data_status".equals(mdmModuleDbFiledsEntityList.get(i1).getEnName())){ + if ("data_status".equals(mdmModuleDbFiledsEntityList.get(i1).getEnName())) { List a = new ArrayList<>(); MdmModuleDbFiledsRuleEntity msgRuleTitie = new MdmModuleDbFiledsRuleEntity(); @@ -330,7 +368,7 @@ public class MdmServiceImpl implements IMdmService { } } } - if(mdmViewFiledVos != null && mdmViewFiledVos.size() > 0){ + if (mdmViewFiledVos != null && mdmViewFiledVos.size() > 0) { for (int i = 0; i < mdmViewFiledVos.size(); i++) { mdmViewFiledVos.get(i).setSorts(i); } @@ -338,6 +376,7 @@ public class MdmServiceImpl implements IMdmService { return mdmViewFiledVos; } // + /** * @param object * @return com.hzya.frame.web.entity.JsonResultEntity @@ -370,7 +409,7 @@ public class MdmServiceImpl implements IMdmService { // if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { - if("1".equals(mdmModuleDbEntityList.get(i).getDbType()) || "2".equals(mdmModuleDbEntityList.get(i).getDbType())){ + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType()) || "2".equals(mdmModuleDbEntityList.get(i).getDbType())) { if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { @@ -586,6 +625,7 @@ public class MdmServiceImpl implements IMdmService { // mdmViewFiledVos.add(mdmViewFiledVo); //} // + /** * @param object * @return com.hzya.frame.web.entity.JsonResultEntity @@ -599,22 +639,23 @@ public class MdmServiceImpl implements IMdmService { if (entity == null) { return BaseResult.getFailureMessageEntity("参数不允许为空"); } - entity.setMdmCode(10007L); - MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); - if(mdmModuleEntity == null || mdmModuleEntity.getId() == null ){ - return BaseResult.getFailureMessageEntity("主数据设置错误"); - } - MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); - mdmModuleDbEntity.setSts("Y"); - List mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); - if(mdmModuleDbEntities == null || mdmModuleDbEntities.size() == 0){ - return BaseResult.getFailureMessageEntity("主数据设置错误"); - } - for (int i = 0; i < mdmModuleDbEntities.size(); i++) { - if("1".equals(mdmModuleDbEntities.get(i).getDbType())){ - entity.setTableName(mdmModuleDbEntities.get(i).getDbName()); - break; + if(entity.getMdmCode() != null && !"".equals(entity.getMdmCode())){ + MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); + if (mdmModuleEntity == null || mdmModuleEntity.getId() == null) { + return BaseResult.getFailureMessageEntity("主数据设置错误"); + } + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + if (mdmModuleDbEntities == null || mdmModuleDbEntities.size() == 0) { + return BaseResult.getFailureMessageEntity("主数据设置错误"); + } + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if ("1".equals(mdmModuleDbEntities.get(i).getDbType())) { + entity.setTableName(mdmModuleDbEntities.get(i).getDbName()); + break; + } } } //判断分页 @@ -710,6 +751,7 @@ public class MdmServiceImpl implements IMdmService { // return BaseResult.getSuccessMessageEntity("查询数据成功", returnData); //} // + /** * @param object * @return com.hzya.frame.web.entity.JsonResultEntity @@ -741,6 +783,7 @@ public class MdmServiceImpl implements IMdmService { } } // + /** * @param object * @return com.hzya.frame.web.entity.JsonResultEntity @@ -763,32 +806,28 @@ public class MdmServiceImpl implements IMdmService { if (entity.getUpId() == null || "".equals(entity.getUpId())) { return BaseResult.getFailureMessageEntity("系统错误"); } - if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - return BaseResult.getFailureMessageEntity("系统错误"); - - } - //查询模版 - MdmModuleEntity mdmModuleEntities = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); - if (mdmModuleEntities == null ) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - //查询数据源主表 - MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - mdmModuleDbEntity.setMdmId(mdmModuleEntities.getId()); - mdmModuleDbEntity.setSts("Y"); - List mdmModuleDbEntityList = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); - if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { - if("1".equals(mdmModuleDbEntityList.get(i).getDbType())){ - mdmModuleDbEntity = mdmModuleDbEntityList.get(i); - break; + if(entity.getMdmCode() != null && !"".equals(entity.getMdmCode())){ + //查询模版 + MdmModuleEntity mdmModuleEntities = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); + if (mdmModuleEntities == null) { + return BaseResult.getFailureMessageEntity("系统错误"); } + //查询数据源主表 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntities.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + mdmModuleDbEntity = mdmModuleDbEntityList.get(i); + break; + } + } + entity.setTableName(mdmModuleDbEntity.getDbName()); } - entity.setTableName(mdmModuleDbEntity.getDbName()); - - if (checkStr(entity.getId())) { if (!checkStr(entity.getValue())) { @@ -837,6 +876,7 @@ public class MdmServiceImpl implements IMdmService { return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); } } + // private List> gettochilder(String[] strArray, int i, List> mapList) { List> maps = new ArrayList<>(); @@ -851,6 +891,7 @@ public class MdmServiceImpl implements IMdmService { } return maps; } + // //private HashMap getFathers(List> mapListAll, HashMap mapList, MdmDto entity) { // if (mapList.get("upID") == null) { @@ -896,6 +937,7 @@ public class MdmServiceImpl implements IMdmService { return returnList; } // + /** * @param object * @return com.hzya.frame.web.entity.JsonResultEntity @@ -954,9 +996,9 @@ public class MdmServiceImpl implements IMdmService { mdmModuleViewDetailEntity.setViewType(entity.getShowType());//设置显示字段类型 List queryAll = mdmModuleViewDetailDao.queryBase(mdmModuleViewDetailEntity); List mdmModuleViewDetailEntityList = new ArrayList<>(); - if(queryAll != null && queryAll.size() > 0){ + if (queryAll != null && queryAll.size() > 0) { for (int i = 0; i < queryAll.size(); i++) { - if(entity.getShowType().equals(queryAll.get(i).getViewType())){ + if (entity.getShowType().equals(queryAll.get(i).getViewType())) { mdmModuleViewDetailEntityList.add(queryAll.get(i)); } } @@ -1250,6 +1292,7 @@ public class MdmServiceImpl implements IMdmService { // } //} // + /** * @param object * @return com.hzya.frame.web.entity.JsonResultEntity @@ -1272,7 +1315,7 @@ public class MdmServiceImpl implements IMdmService { //查询模版 MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); - if (mdmModuleEntity == null ) { + if (mdmModuleEntity == null) { return BaseResult.getFailureMessageEntity("系统错误"); } //查询数据源主表 @@ -1313,6 +1356,7 @@ public class MdmServiceImpl implements IMdmService { return BaseResult.getSuccessMessageEntity("获取数据成功", jsonObject); } + /** * @param object * @return com.hzya.frame.web.entity.JsonResultEntity @@ -1347,7 +1391,7 @@ public class MdmServiceImpl implements IMdmService { if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { return BaseResult.getFailureMessageEntity("系统错误"); } - String res = checkDataOnly(jsonObject.getInteger("mdmCode"), saveData, true, mdmModuleEntity, mdmModuleDbEntityList); + String res = checkDataOnly(jsonObject.getInteger("mdmCode"), saveData, true, mdmModuleEntity, mdmModuleDbEntityList,"界面修改"); if (res == null || "".equals(res)) { return BaseResult.getSuccessMessageEntity("修改数据成功"); @@ -1391,7 +1435,9 @@ public class MdmServiceImpl implements IMdmService { if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { return BaseResult.getFailureMessageEntity("系统错误"); } - String res = checkDataOnly(jsonObject.getInteger("mdmCode"), saveData, false, mdmModuleEntity, mdmModuleDbEntityList); + + + String res = checkDataOnly(jsonObject.getInteger("mdmCode"), saveData, false, mdmModuleEntity, mdmModuleDbEntityList,"界面新增"); if (res == null || "".equals(res)) { return BaseResult.getSuccessMessageEntity("保存数据成功"); @@ -1399,8 +1445,29 @@ public class MdmServiceImpl implements IMdmService { return BaseResult.getFailureMessageEntity(res); } } + + private void saveOption(String dbname ,Long mdmCode ,JSONObject jsonObject,String id,String msg) { + MdmModuleOptionLogEntity mdmModuleOptionLogEntity = new MdmModuleOptionLogEntity(); + mdmModuleOptionLogEntity.setTableName(dbname+"_option_log"); + mdmModuleOptionLogEntity.setMdmCode(mdmCode); + mdmModuleOptionLogEntity.setFormmainId(id); + mdmModuleOptionLogEntity.setSourceName("数智中台"); + mdmModuleOptionLogEntity.setDataType("1"); + mdmModuleOptionLogEntity.setRemark(msg); + mdmModuleOptionLogEntity.setCode("800004"); + mdmModuleOptionLogEntity.setSourceData(jsonObject.toJSONString()); + mdmModuleOptionLogEntity.setOptionType(msg); + SysUserEntity sysUserEntity = sysUserDao.get(StpUtil.getLoginIdAsString()); + if(sysUserEntity != null){ + mdmModuleOptionLogEntity.setOptionName(sysUserEntity.getPersonName()); + } + mdmModuleOptionLogEntity.setCreate(); + mdmModuleOptionLogDao.save(mdmModuleOptionLogEntity); + + } // // + /** * @param object * @return com.hzya.frame.web.entity.JsonResultEntity @@ -1420,7 +1487,7 @@ public class MdmServiceImpl implements IMdmService { } //校验唯一 MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(jsonObject.getLong("mdmCode")); - if (mdmModuleEntity == null ) { + if (mdmModuleEntity == null) { return BaseResult.getFailureMessageEntity("系统错误"); } MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); @@ -1430,9 +1497,10 @@ public class MdmServiceImpl implements IMdmService { if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { return BaseResult.getFailureMessageEntity("系统错误"); } + String dbname = null; for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { - + dbname = mdmModuleDbEntityList.get(i).getDbName(); //查询视图,如果树形,删除下级及子集 //查询展示类型 MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity(); @@ -1472,7 +1540,7 @@ public class MdmServiceImpl implements IMdmService { } mdmModuleDao.deleteTemplateById(formmainDeleteDto); - }else if ("2".equals(mdmModuleDbEntityList.get(i).getDbType())) { + } else if ("2".equals(mdmModuleDbEntityList.get(i).getDbType())) { //删除明细 FormmainDeleteDto formmainDeleteDto = new FormmainDeleteDto(); formmainDeleteDto.setFormmain_id(jsonObject.getString("id")); @@ -1480,168 +1548,338 @@ public class MdmServiceImpl implements IMdmService { formmainDeleteDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); mdmModuleDao.deleteTemplateById(formmainDeleteDto); } + + } + saveOption(dbname,mdmModuleEntity.getMdmCode(),jsonObject,jsonObject.getString("id"),"界面删除"); return BaseResult.getSuccessMessageEntity("删除数据成功"); } - // - // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 处理分发数据 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity doMdmDistribute(JSONObject object) { - // JSONObject jsonObject = getstrObj("jsonStr", object); - // //校验是否有servecr传参 - // if (!checkData(jsonObject, "mdmCode")) { - // return BaseResult.getFailureMessageEntity("请先传递服务名"); - // } - // if (!checkData(jsonObject, "id")) { - // return BaseResult.getFailureMessageEntity("请先传递要删除的数据"); - // } - // if (!checkData(jsonObject, "appID")) { - // return BaseResult.getFailureMessageEntity("请先传递要删除的数据"); - // } - // if (!checkData(jsonObject, "dataType")) { - // return BaseResult.getFailureMessageEntity("请先传递要删除的数据"); - // } - // if("2".equals(jsonObject.getString("dataType"))){ - // boolean flag = false; - // //1、根据服务名查询分发数据 - // MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); - // mdmModuleEntity.setMdmCode(jsonObject.getInteger("mdmCode")); - // mdmModuleEntity.setSts("Y"); - // List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); - // if (mdmModuleEntities != null && mdmModuleEntities.size() == 1) { - // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - // mdmModuleDbEntity.setMdmId(mdmModuleEntities.get(0).getId()); - // mdmModuleDbEntity.setDbType("1"); - // mdmModuleDbEntity.setSts("Y"); - // List mdmModuleDbEntities = mdmModuleDbDao.queryBase(mdmModuleDbEntity); - // if (mdmModuleDbEntities != null && mdmModuleDbEntities.size() == 1) { - // mdmModuleDbEntity = mdmModuleDbEntities.get(0); - // } - // MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity(); - // mdmModuleDistributeEntity.setAppId(jsonObject.getString("appID")); - // mdmModuleDistributeEntity.setMdmId(mdmModuleEntities.get(0).getId()); - // List mdmModuleDistributeEntities = mdmModuleDistributeDao.queryBase(mdmModuleDistributeEntity); - // if (mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() == 1) { - // if (mdmModuleDistributeEntities.get(0).getAddType() != null && "1".equals(mdmModuleDistributeEntities.get(0).getAddType())) { - // //2、查找插件 - // if (mdmModuleDistributeEntities.get(0).getAddPlug() != null && !"".equals(mdmModuleDistributeEntities.get(0).getAddPlug())) { - // //2、查找插件 - // SysApplicationPluginEntity sysApplicationPluginEntity = sysApplicationPluginDao.get(mdmModuleDistributeEntities.get(0).getAddPlug()); - // if(sysApplicationPluginEntity.getPluginCode() != null && !"".equals(sysApplicationPluginEntity.getPluginCode())){ - // //3、调用插件 - // PluginBaseEntity pluginBaseEntity = PluginUtils.getPluginsById(sysApplicationPluginEntity.getPluginCode()); - // try { - // JsonResultEntity s = pluginBaseEntity.executeBusiness(jsonObject); - // flag = true; - // } catch (Exception e) { - // logger.error("插件处理失败"+e.getMessage()); - // } - // } - // } - // } else { - // //TODO 连线 - // flag = true; - // } - // } - // if(mdmModuleDbEntity.getDbName()!= null && !"".equals(mdmModuleDbEntity.getDbName())) { - // MdmDistributeEntity mdmDistributeEntity = new MdmDistributeEntity(); - // mdmDistributeEntity.setCreate(); - // mdmDistributeEntity.setTableName(mdmModuleDbEntity.getDbName()+"_distribute"); - // mdmDistributeEntity.setFormmainId(jsonObject.getString("id")); - // mdmDistributeEntity.setAppId(jsonObject.getString("appID")); - // mdmDistributeEntity.setStatus("1"); - // mdmDistributeEntity.setMsg("发送成功"); - // if (!flag) { - // mdmDistributeEntity.setStatus("3"); - // mdmDistributeEntity.setMsg("发送失败"); - // } - // mdmModuleDao.saveDistribute(mdmDistributeEntity); - // return BaseResult.getSuccessMessageEntity("下发数据成功"); - // - // }else { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // }else { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // }else { - // if (!checkData(jsonObject, "distributeID")) { - // return BaseResult.getFailureMessageEntity("请先传递分发数据"); - // } - // boolean flag = false; - // //1、根据服务名查询分发数据 - // MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); - // mdmModuleEntity.setMdmCode(jsonObject.getInteger("mdmCode")); - // mdmModuleEntity.setSts("Y"); - // List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); - // if (mdmModuleEntities != null && mdmModuleEntities.size() == 1) { - // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - // mdmModuleDbEntity.setMdmId(mdmModuleEntities.get(0).getId()); - // mdmModuleDbEntity.setDbType("1"); - // mdmModuleDbEntity.setSts("Y"); - // List mdmModuleDbEntities = mdmModuleDbDao.queryBase(mdmModuleDbEntity); - // if (mdmModuleDbEntities != null && mdmModuleDbEntities.size() == 1) { - // mdmModuleDbEntity = mdmModuleDbEntities.get(0); - // } - // MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity(); - // mdmModuleDistributeEntity.setAppId(jsonObject.getString("appID")); - // mdmModuleDistributeEntity.setMdmId(mdmModuleEntities.get(0).getId()); - // List mdmModuleDistributeEntities = mdmModuleDistributeDao.queryBase(mdmModuleDistributeEntity); - // if (mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() == 1) { - // if (mdmModuleDistributeEntities.get(0).getDeleteType() != null && "1".equals(mdmModuleDistributeEntities.get(0).getDeleteType())) { - // //2、查找插件 - // if (mdmModuleDistributeEntities.get(0).getDeletePlug() != null && !"".equals(mdmModuleDistributeEntities.get(0).getDeletePlug())) { - // //2、查找插件 - // SysApplicationPluginEntity sysApplicationPluginEntity = sysApplicationPluginDao.get(mdmModuleDistributeEntities.get(0).getDeletePlug()); - // if(sysApplicationPluginEntity.getPluginCode() != null && !"".equals(sysApplicationPluginEntity.getPluginCode())){ - // //3、调用插件 - // PluginBaseEntity pluginBaseEntity = PluginUtils.getPluginsById(sysApplicationPluginEntity.getPluginCode()); - // try { - // JsonResultEntity s = pluginBaseEntity.executeBusiness(jsonObject); - // flag = true; - // } catch (Exception e) { - // logger.error("插件处理失败"+e.getMessage()); - // } - // } - // } - // } else { - // //TODO 连线 - // flag = true; - // } - // } - // if(mdmModuleDbEntity.getDbName()!= null && !"".equals(mdmModuleDbEntity.getDbName())) { - // //删除数据 - // MdmDistributeEntity mdmDistributeEntity = new MdmDistributeEntity(); - // mdmDistributeEntity.setId(jsonObject.getString("distributeID")); - // mdmDistributeEntity.setTableName(mdmModuleDbEntity.getDbName()+"_distribute"); - // mdmDistributeEntity.setFormmainId(jsonObject.getString("id")); - // mdmDistributeEntity.setAppId(jsonObject.getString("appID")); - // mdmDistributeEntity.setStatus("1"); - // mdmDistributeEntity.setMsg("删除成功"); - // if (!flag) { - // mdmDistributeEntity.setStatus("3"); - // mdmDistributeEntity.setMsg("删除失败"); - // } - // mdmModuleDao.updateDistribute(mdmDistributeEntity); - // return BaseResult.getSuccessMessageEntity("删除数据成功"); - // - // }else { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // }else { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // } - // - //} - // + + /** + * @param jsonStr + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 处理分发数据 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity doMdmDistribute(JSONObject jsonStr) { + JSONObject jsonObject = getstrObj("jsonStr", jsonStr); + //校验是否有servecr传参 + if (!checkData(jsonObject, "mdmCode")) { + return BaseResult.getFailureMessageEntity("请先传递服务名"); + } + if (!checkData(jsonObject, "id")) { + return BaseResult.getFailureMessageEntity("请先传递要下发数据"); + } + if (!checkData(jsonObject, "distributeId")) { + return BaseResult.getFailureMessageEntity("请先传递要下发的数据"); + } + if (!checkData(jsonObject, "type")) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + Long mdmCode = jsonObject.getLong("mdmCode");//主数据编码 + String id = jsonObject.getString("id");//行数据的单据规则编码 + String distributeId = jsonObject.getString("distributeId");//发送表id + String type = jsonObject.getString("type");//发送类型,1、新增2、修改3、删除 + + String apiId = null; + String scriptId = null; + //查找对应数据,组装数据发送 + + //获取主数据信息 + MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(mdmCode); + if (mdmModuleEntity == null || mdmModuleEntity.getId() == null) { + return BaseResult.getFailureMessageEntity("主数据不存在"); + } + + //获取主数据db + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + List mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + if (mdmModuleDbEntities == null || mdmModuleDbEntities.size() == 0) { + return BaseResult.getFailureMessageEntity("主数据数据源不存在"); + } + + //获取分发表 + //获取分发的接口 + MdmModuleDistributeEntity mdmModuleDistributeEntity = mdmModuleDistributeDao.get(distributeId); + if (mdmModuleDistributeEntity == null || mdmModuleDistributeEntity.getId() == null) { + return BaseResult.getFailureMessageEntity("分发不存在"); + } + // 启用停用 0、停用 + if ("0".equals(mdmModuleDistributeEntity.getEnabledState())) { + return BaseResult.getFailureMessageEntity("分发已停用"); + } + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity(); + mdmModuleDistributeDetailEntity.setDistributeId(distributeId); + mdmModuleDistributeDetailEntity.setSts("Y"); + List mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity); + + // 启用停用 0、停用 + if ("1".equals(mdmModuleDistributeEntity.getEnabledType())) { + return BaseResult.getFailureMessageEntity("分发为自动下发,不允许手动下发"); + } + //1、新增2、修改3、删除 + if ("1".equals(type)) { + apiId = mdmModuleDistributeEntity.getAddApi(); + scriptId = mdmModuleDistributeEntity.getAddScript(); + } else if ("2".equals(type)) { + apiId = mdmModuleDistributeEntity.getUpdateApi(); + scriptId = mdmModuleDistributeEntity.getUpdateScript(); + + } else if ("3".equals(type)) { + apiId = mdmModuleDistributeEntity.getDeleteApi(); + scriptId = mdmModuleDistributeEntity.getDeleteScript(); + } + if (apiId == null || "".equals(apiId)) { + return BaseResult.getFailureMessageEntity("分发接口未选择,请先选择"); + } + SysApplicationScriptEntity scriptEntity = null; + if (scriptId != null && !"".equals(scriptId)) { + scriptEntity = sysApplicationScriptDao.get(scriptId); + if (scriptEntity == null || scriptEntity.getId() == null) { + return BaseResult.getFailureMessageEntity("分发接口脚本不存在"); + } + } + SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(apiId); + if (apiEntity == null || apiEntity.getId() == null) { + return BaseResult.getFailureMessageEntity("分发接口不存在"); + + } + SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(apiEntity.getAppId()); + if (sysApplicationEntity == null || sysApplicationEntity.getId() == null) { + return BaseResult.getFailureMessageEntity("应用不存在"); + } + + //获取主数据db字段,以及字段的规则 + MdmModuleDbFiledsEntity queryFild = new MdmModuleDbFiledsEntity(); + queryFild.setMdmId(mdmModuleEntity.getId()); + List mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(queryFild); + MdmModuleDbFiledsRuleEntity queryFildRule = new MdmModuleDbFiledsRuleEntity(); + queryFildRule.setMdmId(mdmModuleEntity.getId()); + queryFildRule.setRuleCode("service"); + List mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(queryFildRule); + + String dbname = null; + //获取主数据db对应的实体表的数据 + JSONObject object = new JSONObject(); + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if ("1".equals(mdmModuleDbEntities.get(i).getDbType())) { + dbname = mdmModuleDbEntities.get(i).getDbName(); + Map map = new HashMap<>(); + map.put("tableName", mdmModuleDbEntities.get(i).getDbName()); + map.put("id", id); + object = mdmModuleDao.queryMdmST(map); + if (object.getString("id") == null || "".equals(object.getString("id"))) { + return BaseResult.getFailureMessageEntity("当前数据不存在"); + } + if (mdmModuleDistributeDetailEntities != null && mdmModuleDistributeDetailEntities.size() > 0) { + Map checkData = new HashMap<>(); + checkData.put("tableName", mdmModuleDbEntities.get(i).getDbName()); + checkData.put("id", id); + checkData.put("mdmModuleDistributeDetailEntities", mdmModuleDistributeDetailEntities); + JSONObject object1 = mdmModuleDao.queryMdmST(checkData); + if (object1.getString("id") == null || "".equals(object1.getString("id"))) { + return BaseResult.getFailureMessageEntity("当前数据不符合规则不发送"); + } + } + //查看主表是否有字段是关联的 + if (mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0) { + for (int i1 = 0; i1 < mdmModuleDbFiledsRuleEntities.size(); i1++) { + if (mdmModuleDbFiledsRuleEntities.get(i1).getDbId().equals(mdmModuleDbEntities.get(i).getId())) { + if (mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0) { + for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) { + if (mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())) { + Map mapDetail = new HashMap<>(); + mapDetail.put("tableName", mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue()); + mapDetail.put("id", object.getString(mdmModuleDbFiledsEntities.get(i2).getEnName())); + JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail); + object.put(mdmModuleDbFiledsEntities.get(i2).getEnName(), objectDetail); + } + } + } + } + } + } + } + } + + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if ("2".equals(mdmModuleDbEntities.get(i).getDbType())) { + Map map = new HashMap<>(); + map.put("tableName", mdmModuleDbEntities.get(i).getDbName()); + map.put("formmainId", object.getString("id")); + List detail = mdmModuleDao.queryMdmSTDetail(map); + //查看主表是否有字段是关联的 + if (detail != null && detail.size() > 0) { + if (mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0) { + for (int i1 = 0; i1 < mdmModuleDbFiledsRuleEntities.size(); i1++) { + if (mdmModuleDbFiledsRuleEntities.get(i1).getDbId().equals(mdmModuleDbEntities.get(i).getId())) { + if (mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0) { + for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) { + if (mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())) { + for (int i3 = 0; i3 < detail.size(); i3++) { + Map mapDetail = new HashMap<>(); + mapDetail.put("tableName", mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue()); + mapDetail.put("id", detail.get(i3).getString(mdmModuleDbFiledsEntities.get(i2).getEnName())); + JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail); + detail.get(i3).put(mdmModuleDbFiledsEntities.get(i2).getEnName(), objectDetail); + } + } + } + } + } + } + } + } + object.put(mdmModuleDbEntities.get(i).getDbName(), detail); + } + } + //执行脚本 + JSONObject groovy = new JSONObject(); + JSONObject parameterJson = new JSONObject(); + parameterJson.put("header", apiEntity.getHeaderIn()); + parameterJson.put("body", apiEntity.getBodyIn()); + parameterJson.put("query", apiEntity.getQueryIn()); + parameterJson.put("data", object); + /** head */ + Map header = null; + /** query */ + String querys = null; + /** body */ + String bodys = object.toJSONString(); + if (scriptEntity != null && scriptEntity.getId() != null) { + groovy.put("code", scriptEntity.getScriptCode()); + groovy.put("className", scriptEntity.getClassName()); + groovy.put("name", scriptEntity.getScriptName()); + groovy.put("methodStr", scriptEntity.getScriptData()); + groovy.put("parameterJson", parameterJson); + JSONObject groovyStr = new JSONObject(); + groovyStr.put("jsonStr", groovy); + try { + //SysExtensionApiEntity jsonResultEntity = groovyIntegrationService.groovyScriptExecution(groovy); + SysExtensionApiEntity jsonResultEntity = new SysExtensionApiEntity(); + jsonResultEntity.setBodys("{\"ufinterface\":{\"billtype\":\"supplier\",\"sender\":\"OA\",\"replace\":\"Y\",\"isexchange\":\"Y\",\"account\":\"01\",\"groupcode\":\"00\"},\"bill\":{\"billhead\":{\"pk_country\":\"CN\",\"pk_group\":\"00\",\"enablestate\":\"2\",\"code\":\"01004\",\"supprop\":\"0\",\"pk_format\":\"ZH-CN\",\"pk_supplierclass\":\"S01\",\"custstate\":\"1\",\"name\":\"\",\"pk_timezone\":\"P0800\",\"taxpayerid\":\"087981489021135119\",\"pk_org\":\"003\"}}}"); + header = jsonResultEntity.getHeaders(); + querys = jsonResultEntity.getQuerys(); + bodys = jsonResultEntity.getBodys(); + } catch (Exception e) { + return BaseResult.getFailureMessageEntity("分发脚本转换错误"); + } + } + Map headers = new HashMap<>(); + headers.put("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj"); + headers.put("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA="); + headers.put("appId", sysApplicationEntity.getAppId().toString()); + headers.put("apiCode", apiEntity.getApiCode().toString()); + if (header != null) { + headers.putAll(header); + } + //组装数据发送 + JsonResultEntity jsonResultEntity = sendData(apiEntity, headers, bodys, querys); + if (jsonResultEntity.isFlag()) { + saveMdmModuleSendLogEntity("1","发送成功",dbname,object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type); + return BaseResult.getFailureMessageEntity("发送成功"); + } else { + saveMdmModuleSendLogEntity("2","转发失败",dbname,object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type); + return BaseResult.getFailureMessageEntity("发送错误:"+jsonResultEntity.getMsg()); + } + } + + private void saveMdmModuleSendLogEntity(String dataType,String remark,String dbname,String formmain_id, String target_app, String target_api, String source_data, String option_type) { + MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity(); + mdmModuleSendLogEntity.setTableName(dbname+"_send_log"); + mdmModuleSendLogEntity.setCreate(); + mdmModuleSendLogEntity.setId(UUIDUtils.getUUID()); + mdmModuleSendLogEntity.setSts("Y"); + mdmModuleSendLogEntity.setCreate_user_id("1"); + mdmModuleSendLogEntity.setModify_user_id("1"); + mdmModuleSendLogEntity.setCreate_time(new Date()); + mdmModuleSendLogEntity.setModify_time(new Date()); + mdmModuleSendLogEntity.setOrg_id("0"); + mdmModuleSendLogEntity.setCompanyId("0"); + mdmModuleSendLogEntity.setFormmainId(formmain_id); + mdmModuleSendLogEntity.setTargetApp(target_app); + mdmModuleSendLogEntity.setTargetApi(target_api); + mdmModuleSendLogEntity.setSourceData(source_data); + mdmModuleSendLogEntity.setOptionType(option_type); + mdmModuleSendLogEntity.setDataType(dataType); + mdmModuleSendLogEntity.setRemark(remark); + mdmModuleSendLogDao.save(mdmModuleSendLogEntity); + } + + private JsonResultEntity sendData(SysApplicationApiEntity applicationApiEntity, Map headers, String bodys, String querys) { + StringBuffer urls = new StringBuffer(url); + if (querys != null) { + urls.append("?"); + urls.append(querys); + } + HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); + // HttpClient + CloseableHttpClient closeableHttpClient = httpClientBuilder.disableCookieManagement().build(); + HttpPost post = new HttpPost(urls.toString()); + CloseableHttpResponse response = null; + + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(Integer.valueOf(applicationApiEntity.getTimeoutPeriod())).build(); + post.setConfig(requestConfig);//设置请求参数【超时时间】 + + if (headers != null && headers.size() > 0) { + for (String key : headers.keySet()) { + post.setHeader(key, headers.get(key)); + } + } + StringBuilder body = new StringBuilder(); + boolean flag = true; + try { + if (bodys != null && !"".equals(bodys)) { + ByteArrayEntity entity = new ByteArrayEntity(bodys.getBytes("UTF-8")); + entity.setContentType("application/json"); + post.setEntity(entity); + } + response = closeableHttpClient.execute(post); + + HttpEntity entity = response.getEntity(); + synchronized (lock) { + body.append(EntityUtils.toString(entity, "UTF-8")); + } + flag = true; + logger.info("返回结果:" + body); + } catch (Exception e) { + logger.error("请求错误:" + e.getMessage()); + body.append(e.getMessage()); + flag = false; + } finally { + try { + // 关闭响应对象 + if (response != null) { + response.close(); + } + // 关闭响应对象 + if (closeableHttpClient != null) { + closeableHttpClient.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + + } + if (flag) { + if (JSONUtil.isTypeJSON(body.toString())) { + JsonResultEntity jsonResultEntity = JSONObject.parseObject(body.toString(), JsonResultEntity.class); + if (jsonResultEntity.isFlag()) { + return BaseResult.getSuccessMessageEntity("转发成功", body); + } else { + return BaseResult.getFailureMessageEntity("转发失败", body); + } + } else { + return BaseResult.getFailureMessageEntity("转发失败", body); + } + } else { + return BaseResult.getFailureMessageEntity("转发失败", body); + } + } + /** * @param mdmCode * @param saveData @@ -1653,9 +1891,14 @@ public class MdmServiceImpl implements IMdmService { * @Description 校验数据 * @Date 11:20 上午 2023/11/6 **/ - private String checkDataOnly(Integer mdmCode, JSONObject saveData, boolean flag, MdmModuleEntity mdmModuleEntity, List mdmModuleDbEntityList) { + private String checkDataOnly(long mdmCode, JSONObject saveData, boolean flag, MdmModuleEntity mdmModuleEntity, List mdmModuleDbEntityList,String msg) { StringBuffer str = new StringBuffer(); - + String dbname = null; + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if("1".equals(mdmModuleDbEntityList.get(i).getDbType())){ + dbname = mdmModuleDbEntityList.get(i).getDbName(); + } + } //查询字段 //查询字段下的必填规则 MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); @@ -1789,7 +2032,7 @@ public class MdmServiceImpl implements IMdmService { mdmTableCodeRuleEntity.setSts("Y"); List allMdmTableCodeRuleEntities = mdmTableCodeRuleDao.queryBase(mdmTableCodeRuleEntity); List mdmTableCodeRuleEntities = new ArrayList<>(); - if(allMdmTableCodeRuleEntities != null && allMdmTableCodeRuleEntities.size() > 0){ + if (allMdmTableCodeRuleEntities != null && allMdmTableCodeRuleEntities.size() > 0) { mdmTableCodeRuleEntities = allMdmTableCodeRuleEntities; //for (int i1 = 0; i1 < allMdmTableCodeRuleEntities.size(); i1++) { // if(mdmModuleDbEntityList.get(i).getId().equals(allMdmTableCodeRuleEntities.get(i1).getDbId())){ @@ -1838,7 +2081,8 @@ public class MdmServiceImpl implements IMdmService { mdmDataFiledDtos.add(update_status); MdmDataFiledDto data_status = new MdmDataFiledDto(); data_status.setFiledsName("data_status"); - data_status.setFiledsValue("F");; + data_status.setFiledsValue("F"); + ; mdmDataFiledDtos.add(data_status); int a = mdmModuleDao.updateForm(mdmDataDto); } else { @@ -1852,15 +2096,18 @@ public class MdmServiceImpl implements IMdmService { mdmDataFiledDtos.add(ids); MdmDataFiledDto data_status = new MdmDataFiledDto(); data_status.setFiledsName("data_status"); - data_status.setFiledsValue("Y");; + data_status.setFiledsValue("Y"); + ; mdmDataFiledDtos.add(data_status); MdmDataFiledDto org_id = new MdmDataFiledDto(); org_id.setFiledsName("org_id"); - org_id.setFiledsValue("Y");; + org_id.setFiledsValue("Y"); + ; mdmDataFiledDtos.add(org_id); MdmDataFiledDto company_id = new MdmDataFiledDto(); company_id.setFiledsName("company_id"); - company_id.setFiledsValue("Y");; + company_id.setFiledsValue("Y"); + ; mdmDataFiledDtos.add(company_id); MdmDataFiledDto add_status = new MdmDataFiledDto(); @@ -1897,9 +2144,9 @@ public class MdmServiceImpl implements IMdmService { mdmModuleDbFiledsEntity1.setSts("Y"); List allfileds = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity1); List fileds = new ArrayList<>(); - if(allfileds != null && allfileds.size() > 0){ + if (allfileds != null && allfileds.size() > 0) { for (int i1 = 0; i1 < allfileds.size(); i1++) { - if(mdmModuleDbEntityList.get(i).getId().equals(allfileds.get(i1).getDbId())){ + if (mdmModuleDbEntityList.get(i).getId().equals(allfileds.get(i1).getDbId())) { fileds.add(allfileds.get(i1)); } } @@ -1948,6 +2195,9 @@ public class MdmServiceImpl implements IMdmService { } } } + + saveOption(dbname,mdmCode,saveData,id,msg); + } return str.toString(); } diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java index d36dc4b2..ad3ba58b 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/sysnew/application/service/impl/SysApplicationServiceImpl.java @@ -11,6 +11,8 @@ import com.baomidou.dynamic.datasource.annotation.DSTransactional; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.mdm.mdmModuleDistribute.dao.IMdmModuleDistributeDao; +import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity; import com.hzya.frame.serviceUtil.DsDataSourceUtil; import com.hzya.frame.sysnew.application.api.dao.ISysApplicationApiDao; import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiDto; @@ -104,7 +106,8 @@ public class SysApplicationServiceImpl extends BaseService 0){ + return BaseResult.getFailureMessageEntity("脚本已经被使用,请先取消关联"); + } entity.setUpdate(); sysApplicationScriptDao.logicRemoveMultiCondition(entity); return BaseResult.getSuccessMessageEntity("删除脚本成功");