diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmDataDto.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDataDto.java new file mode 100644 index 00000000..0370431c --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDataDto.java @@ -0,0 +1,69 @@ +package com.hzya.frame.mdm.entity; + + +import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; + +import java.util.List; + +public class MdmDataDto { + + private String id; + private String tableName; + private String documentRule; + private Integer documentRuleNum; + /** + * 类型 1、主表 2、明细 + */ + private String dbType; + + private List mdmDataFiledDtos; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public List getMdmDataFiledDtos() { + return mdmDataFiledDtos; + } + + public void setMdmDataFiledDtos(List mdmDataFiledDtos) { + this.mdmDataFiledDtos = mdmDataFiledDtos; + } + + public String getDocumentRule() { + return documentRule; + } + + public void setDocumentRule(String documentRule) { + this.documentRule = documentRule; + } + + public Integer getDocumentRuleNum() { + return documentRuleNum; + } + + public void setDocumentRuleNum(Integer documentRuleNum) { + this.documentRuleNum = documentRuleNum; + } + + public String getDbType() { + return dbType; + } + + public void setDbType(String dbType) { + this.dbType = dbType; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmDataFiledDto.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDataFiledDto.java new file mode 100644 index 00000000..d9e40e8d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDataFiledDto.java @@ -0,0 +1,29 @@ +package com.hzya.frame.mdm.entity; + + +import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; + +import java.util.List; + +public class MdmDataFiledDto { + + private String filedsName; + private String filedsValue; + + public String getFiledsName() { + return filedsName; + } + + public void setFiledsName(String filedsName) { + this.filedsName = filedsName; + } + + public String getFiledsValue() { + return filedsValue; + } + + public void setFiledsValue(String filedsValue) { + this.filedsValue = filedsValue; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmDetailViewVo.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDetailViewVo.java new file mode 100644 index 00000000..586e4d7d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDetailViewVo.java @@ -0,0 +1,41 @@ +package com.hzya.frame.mdm.entity; + +import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; +import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; +import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; + +import java.util.List; + +public class MdmDetailViewVo { + //模版信息 + private MdmModuleEntity mdmModuleEntity; + //主数据主表 + private MdmModuleDbEntity mainMdmModuleDb; + //主数据子表 + private List sublistMdmModuleDb; + + public MdmModuleEntity getMdmModuleEntity() { + return mdmModuleEntity; + } + + public void setMdmModuleEntity(MdmModuleEntity mdmModuleEntity) { + this.mdmModuleEntity = mdmModuleEntity; + } + + public MdmModuleDbEntity getMainMdmModuleDb() { + return mainMdmModuleDb; + } + + public void setMainMdmModuleDb(MdmModuleDbEntity mainMdmModuleDb) { + this.mainMdmModuleDb = mainMdmModuleDb; + } + + public List getSublistMdmModuleDb() { + return sublistMdmModuleDb; + } + + public void setSublistMdmModuleDb(List sublistMdmModuleDb) { + this.sublistMdmModuleDb = sublistMdmModuleDb; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmDistributeDto.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDistributeDto.java new file mode 100644 index 00000000..57b97fdc --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDistributeDto.java @@ -0,0 +1,31 @@ +package com.hzya.frame.mdm.entity; + + +import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity; +import java.util.List; + +public class MdmDistributeDto { + + + //主数据编码 + private Long mdmCode; + + private List mdmModuleDistributeEntities; + + public List getMdmModuleDistributeEntities() { + return mdmModuleDistributeEntities; + } + + public void setMdmModuleDistributeEntities(List mdmModuleDistributeEntities) { + this.mdmModuleDistributeEntities = mdmModuleDistributeEntities; + } + + public Long getMdmCode() { + return mdmCode; + } + + public void setMdmCode(Long mdmCode) { + this.mdmCode = mdmCode; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmDto.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDto.java index b5e8332d..ae393466 100644 --- a/service/src/main/java/com/hzya/frame/mdm/entity/MdmDto.java +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDto.java @@ -17,6 +17,39 @@ public class MdmDto { //主数据子表 private List sublistMdmModuleDb; + + //id + private String id; + //3、新增4、修改 5、查看 + private String showType; + //分页 + private Integer pageNum; + private Integer pageSize; + /** + * 显示字段 + */ + private String viewFiled; + /** + * 上级id字段 + */ + private String upIdFiled; + //主数据名称 + private String mdmName; + //主数据类型 + private String mdmType; + //描述 + private String remark; + //描述 + private String[] ids; + + private String tableName; + private String value; + + private String label; + private String lableValue; + + private String upId; + public Long getMdmCode() { return mdmCode; } @@ -48,5 +81,125 @@ public class MdmDto { public void setSublistMdmModuleDb(List sublistMdmModuleDb) { this.sublistMdmModuleDb = sublistMdmModuleDb; } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getShowType() { + return showType; + } + + public void setShowType(String showType) { + this.showType = showType; + } + + public Integer getPageNum() { + return pageNum; + } + + public void setPageNum(Integer pageNum) { + this.pageNum = pageNum; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + public String getViewFiled() { + return viewFiled; + } + + public void setViewFiled(String viewFiled) { + this.viewFiled = viewFiled; + } + + public String getUpIdFiled() { + return upIdFiled; + } + + public void setUpIdFiled(String upIdFiled) { + this.upIdFiled = upIdFiled; + } + + public String getMdmName() { + return mdmName; + } + + public void setMdmName(String mdmName) { + this.mdmName = mdmName; + } + + public String getMdmType() { + return mdmType; + } + + public void setMdmType(String mdmType) { + this.mdmType = mdmType; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String[] getIds() { + return ids; + } + + public void setIds(String[] ids) { + this.ids = ids; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public String getLableValue() { + return lableValue; + } + + public void setLableValue(String lableValue) { + this.lableValue = lableValue; + } + + public String getUpId() { + return upId; + } + + public void setUpId(String upId) { + this.upId = upId; + } } 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 new file mode 100644 index 00000000..bda7c895 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmQuery.java @@ -0,0 +1,69 @@ +package com.hzya.frame.mdm.entity; + + +import com.hzya.frame.sys.entity.TemplateKeyValue; + +import java.util.List; + +public class MdmQuery { + + //分页 + private Integer pageNum; + private Integer pageSize; + //表名 + private String tableName; + //查询条件 + private List queryCondition; + //返回字段 + private List returnField; + //明细表查询条件 + private List detailQueryCondition; + + public Integer getPageNum() { + return pageNum; + } + + public void setPageNum(Integer pageNum) { + this.pageNum = pageNum; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public List getQueryCondition() { + return queryCondition; + } + + public void setQueryCondition(List queryCondition) { + this.queryCondition = queryCondition; + } + + public List getReturnField() { + return returnField; + } + + public void setReturnField(List returnField) { + this.returnField = returnField; + } + + public List getDetailQueryCondition() { + return detailQueryCondition; + } + + public void setDetailQueryCondition(List detailQueryCondition) { + this.detailQueryCondition = detailQueryCondition; + } +} diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmSourceDto.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmSourceDto.java new file mode 100644 index 00000000..e00af986 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmSourceDto.java @@ -0,0 +1,34 @@ +package com.hzya.frame.mdm.entity; + + +import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity; +import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity; + +import java.util.List; + +public class MdmSourceDto { + + + //主数据编码 + private Long mdmCode; + + private List mdmModuleSourceEntities; + + + public List getMdmModuleSourceEntities() { + return mdmModuleSourceEntities; + } + + public void setMdmModuleSourceEntities(List mdmModuleSourceEntities) { + this.mdmModuleSourceEntities = mdmModuleSourceEntities; + } + + public Long getMdmCode() { + return mdmCode; + } + + public void setMdmCode(Long mdmCode) { + this.mdmCode = mdmCode; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmViewFiledVo.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmViewFiledVo.java new file mode 100644 index 00000000..f1e25c5a --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmViewFiledVo.java @@ -0,0 +1,114 @@ +package com.hzya.frame.mdm.entity; + +import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; +import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; + +import java.util.List; + +public class MdmViewFiledVo { + + //字段id + private String id; + //表名 + private String dbName; + //类型 1、主表 2、明细 + private String dbType; + //主数据模版ID + private String mdmId; + //模版数据库id + private String dbId; + //中文名 + private String chName; + //英文名 + private String enName; + //排序 + private Integer sorts; + /** + * 字段类型 1、BIGINT 2、DECIMAL 3、VARCHAR 4、DATETIME + */ + private String filedType; + //字段规则 + private List ruleList; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDbName() { + return dbName; + } + + public void setDbName(String dbName) { + this.dbName = dbName; + } + + public String getDbType() { + return dbType; + } + + public void setDbType(String dbType) { + this.dbType = dbType; + } + + public String getMdmId() { + return mdmId; + } + + public void setMdmId(String mdmId) { + this.mdmId = mdmId; + } + + public String getDbId() { + return dbId; + } + + public void setDbId(String dbId) { + this.dbId = dbId; + } + + public String getChName() { + return chName; + } + + public void setChName(String chName) { + this.chName = chName; + } + + public String getEnName() { + return enName; + } + + public void setEnName(String enName) { + this.enName = enName; + } + + public List getRuleList() { + return ruleList; + } + + public void setRuleList(List ruleList) { + this.ruleList = ruleList; + } + + public Integer getSorts() { + return sorts; + } + + public void setSorts(Integer sorts) { + this.sorts = sorts; + } + + public String getFiledType() { + return filedType; + } + + public void setFiledType(String filedType) { + this.filedType = filedType; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmViewVo.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmViewVo.java new file mode 100644 index 00000000..8630811e --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmViewVo.java @@ -0,0 +1,64 @@ +package com.hzya.frame.mdm.entity; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; +import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; +import java.util.List; + +public class MdmViewVo { + + private String id; + //模版信息 + private MdmModuleEntity mdmModuleEntity; + //模版展示信息 + private MdmModuleViewEntity mdmModuleViewEntity; + //查询条件 + private List queryList; + //列表 + private List listList; + + public List getQueryList() { + return queryList; + } + + public void setQueryList(List queryList) { + this.queryList = queryList; + } + + public List getListList() { + return listList; + } + + public void setListList(List listList) { + this.listList = listList; + } + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public MdmModuleEntity getMdmModuleEntity() { + return mdmModuleEntity; + } + + public void setMdmModuleEntity(MdmModuleEntity mdmModuleEntity) { + this.mdmModuleEntity = mdmModuleEntity; + } + + public MdmModuleViewEntity getMdmModuleViewEntity() { + return mdmModuleViewEntity; + } + + public void setMdmModuleViewEntity(MdmModuleViewEntity mdmModuleViewEntity) { + this.mdmModuleViewEntity = mdmModuleViewEntity; + } +} + 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 e4a499ea..8854d3e8 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 @@ -1,8 +1,13 @@ package com.hzya.frame.mdm.mdmModule.dao; +import com.hzya.frame.mdm.entity.MdmDataDto; +import com.hzya.frame.mdm.entity.MdmDto; +import com.hzya.frame.mdm.entity.MdmQuery; import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.sys.entity.FormmainDeleteDto; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -22,5 +27,17 @@ public interface IMdmModuleDao extends IBaseDao { Integer createTable(Map maps); Integer alterTable(Map maps); Integer alterTableName(Map maps); + List> queryMdmShowData(MdmQuery entity); + List> queryTemplateDataMore(MdmDto entity); + HashMap queryTemplateDataOne(MdmDto entity); + Integer checkData(Map map); + Integer updateForm(MdmDataDto mdmDataDto); + Integer saveForm(MdmDataDto mdmDataDto); + Integer deleteTemplateById(FormmainDeleteDto formmainDeleteDto); + Integer deleteChilder(FormmainDeleteDto formmainDeleteDto); + List> querySelectData(MdmDto entity); + + List> queryDataAll(MdmDto entity); + } 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 f6742f3d..40cd1bab 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 @@ -1,10 +1,15 @@ package com.hzya.frame.mdm.mdmModule.dao.impl; +import com.hzya.frame.mdm.entity.MdmDataDto; +import com.hzya.frame.mdm.entity.MdmDto; +import com.hzya.frame.mdm.entity.MdmQuery; import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao; +import com.hzya.frame.sys.entity.FormmainDeleteDto; import org.springframework.stereotype.Repository; import com.hzya.frame.basedao.dao.MybatisGenericDao; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -25,7 +30,7 @@ public class MdmModuleDaoImpl extends MybatisGenericDao @Override public MdmModuleEntity getByMdmCode(Long mdmCode) { - MdmModuleEntity mdmModuleEntity = (MdmModuleEntity) super.query(getSqlIdPrifx() + "getByMdmCode",mdmCode); + MdmModuleEntity mdmModuleEntity = (MdmModuleEntity) super.selectOne(getSqlIdPrifx() + "getByMdmCode",mdmCode); return mdmModuleEntity; } @@ -35,8 +40,66 @@ public class MdmModuleDaoImpl extends MybatisGenericDao return o; } + @Override + public List> queryDataAll(MdmDto entity) { + List> o = (List>) super.selectList(getSqlIdPrifx() + "queryDataAll", entity); + return o; + } + @Override + public Integer checkData(Map maps) { + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "checkData", maps); + return o; + } + @Override + public Integer updateForm(MdmDataDto mdmDataDto) { + Integer o = super.update(getSqlIdPrifx() + "updateForm", mdmDataDto); + return o; + } + @Override + public List> querySelectData(MdmDto entity) { + List> o = (List>) super.selectList(getSqlIdPrifx() + "querySelectData", entity); + return o; + + } + @Override + public Integer deleteChilder(FormmainDeleteDto entity) { + Integer o = super.delete(getSqlIdPrifx() + "deleteChilder", entity); + return o; + + } + @Override + public Integer deleteTemplateById(FormmainDeleteDto entity) { + Integer o = super.delete(getSqlIdPrifx() + "deleteTemplateById", entity); + return o; + + } + @Override + public Integer saveForm(MdmDataDto mdmDataDto) { + Integer o = super.update(getSqlIdPrifx() + "saveForm", mdmDataDto); + return o; + + } + @Override + public List> queryTemplateDataMore(MdmDto entity) { + List> o = (List>) super.selectList(getSqlIdPrifx() + "queryTemplateDataMore", entity); + return o; + + } + + @Override + public HashMap queryTemplateDataOne(MdmDto entity) { + HashMap o = (HashMap) super.selectOne(getSqlIdPrifx() + "queryTemplateDataOne", entity); + return o; + + } + + @Override + public List> queryMdmShowData(MdmQuery entity) { + List> o = (List>) super.selectList(getSqlIdPrifx() + "queryMdmShowData", entity); + return o; + } @Override public Integer createTable(Map maps) { Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "createTable", 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 4acbf893..4e94d665 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 @@ -404,5 +404,258 @@ update mdm_module set sts= 'N' ,modify_time = #{modify_time},modify_user_id = # + + + + + + + + + + + + + update ${tableName} set + + + + + ${item.filedsName} = #{item.filedsValue}, + + + modify_user_id = #{item.filedsValue}, + + + + modify_time = now(), + + where id = #{id} + + + + insert into ${tableName}( + + + + + ${item.filedsName}, + + + create_user_id, + modify_user_id, + + + + create_time, + modify_time, + sts, + + document_rule, + document_rule_num, + + + )values + ( + + + + + #{item.filedsValue}, + + + #{item.filedsValue}, + #{item.filedsValue}, + + + + + now(), + now(), + 'Y', + + ( concat(#{documentRule}, + (SELECT + IF + ( + LENGTH( (SELECT + IFNULL(MAX(b.document_rule_num),0)+1 + FROM + ${tableName} b + WHERE + DATE_FORMAT( b.create_time, '%Y-%m' ) = DATE_FORMAT( now(), '%Y-%m' )) ) <= ${documentRuleNum}, + LPAD( (SELECT + IFNULL(MAX(c.document_rule_num),0)+1 + FROM + ${tableName} c + WHERE + DATE_FORMAT( c.create_time, '%Y-%m' ) = DATE_FORMAT( now(), '%Y-%m' )), ${documentRuleNum}, '0' ), + (SELECT + IFNULL(MAX(d.document_rule_num),0)+1 + FROM + ${tableName} d + WHERE + DATE_FORMAT( d.create_time, '%Y-%m' ) = DATE_FORMAT( now(), '%Y-%m' )) + ) + ) + )), + (SELECT + IF + ( + LENGTH( (SELECT + IFNULL(MAX(e.document_rule_num),0)+1 + FROM + ${tableName} e + WHERE + DATE_FORMAT( e.create_time, '%Y-%m' ) = DATE_FORMAT( now(), '%Y-%m' )) ) <= ${documentRuleNum}, + LPAD( (SELECT + IFNULL(MAX(f.document_rule_num),0)+1 + FROM + ${tableName} f + WHERE + DATE_FORMAT( f.create_time, '%Y-%m' ) = DATE_FORMAT( now(), '%Y-%m' )), ${documentRuleNum}, '0' ), + (SELECT + IFNULL(MAX(g.document_rule_num),0)+1 + FROM + ${tableName} g + WHERE + DATE_FORMAT( g.create_time, '%Y-%m' ) = DATE_FORMAT( now(), '%Y-%m' )) + ) + ) + + + ) + + + update ${tableName} set + sts='N',modify_time = now(),modify_user_id = #{loginId} + + and id = #{id} + and formmain_id = #{formmain_id} + and sts='Y' + + + + + update ${tableName} set + sts='N',modify_time = now(),modify_user_id = #{loginId} + + + and ${upIdFiled} like concat(#{upIdFiledValue},'%') + + and sts='Y' + + + + + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/IMdmModuleDbDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/IMdmModuleDbDao.java index 92b955dd..89849461 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/IMdmModuleDbDao.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/IMdmModuleDbDao.java @@ -1,7 +1,11 @@ package com.hzya.frame.mdm.mdmModuleDb.dao; import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; -import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.basedao.dao.IBaseDao; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * 模版数据库表(mdm_module_db: table)表数据库访问层 @@ -10,6 +14,8 @@ import com.hzya.frame.basedao.dao.IBaseDao; * @since 2024-06-03 08:46:48 */ public interface IMdmModuleDbDao extends IBaseDao { - + HashMap getServiceDataById(Map queryData); + List> getServiceByFormmainId(Map queryData); + List> getServiceByDistributeId(Map queryData); } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/impl/MdmModuleDbDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/impl/MdmModuleDbDaoImpl.java index 77d8c8bb..8bf06ee1 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/impl/MdmModuleDbDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/impl/MdmModuleDbDaoImpl.java @@ -4,6 +4,11 @@ import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; import com.hzya.frame.mdm.mdmModuleDb.dao.IMdmModuleDbDao; import org.springframework.stereotype.Repository; import com.hzya.frame.basedao.dao.MybatisGenericDao; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** * 模版数据库表(MdmModuleDb)表数据库访问层 * @@ -12,6 +17,25 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao; */ @Repository(value = "MdmModuleDbDaoImpl") public class MdmModuleDbDaoImpl extends MybatisGenericDao implements IMdmModuleDbDao{ - + @Override + public HashMap getServiceDataById(Map maps) { + HashMap o = (HashMap) super.selectOne(getSqlIdPrifx() + "getServiceDataById", maps); + return o; + + } + + @Override + public List> getServiceByFormmainId(Map maps) { + List> o = (List>) super.selectList(getSqlIdPrifx() + "getServiceByFormmainId", maps); + return o; + + } + @Override + public List> getServiceByDistributeId(Map maps) { + List> o = (List>) super.selectList(getSqlIdPrifx() + "getServiceByDistributeId", maps); + return o; + + } + } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/entity/MdmModuleDbEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/entity/MdmModuleDbEntity.xml index 383d4ca7..2340cbcd 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/entity/MdmModuleDbEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/entity/MdmModuleDbEntity.xml @@ -238,6 +238,66 @@ update mdm_module_db set sts= 'N' ,modify_time = #{modify_time},modify_user_id delete from mdm_module_db where id = #{id} + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.java index 194a0ace..abb89344 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.java @@ -41,6 +41,14 @@ public class MdmModuleDbFiledsEntity extends BaseEntity { private String companyId; /** 数据类型 1、新增 2、修改 */ private String dataType; + /** + * roletype + */ + private String roletype; + /** + * roletype + */ + private String roleValue; private List mdmModuleDbFiledsRules; public String getMdmId() { @@ -162,5 +170,21 @@ public class MdmModuleDbFiledsEntity extends BaseEntity { public void setDataType(String dataType) { this.dataType = dataType; } + + public String getRoletype() { + return roletype; + } + + public void setRoletype(String roletype) { + this.roletype = roletype; + } + + public String getRoleValue() { + return roleValue; + } + + public void setRoleValue(String roleValue) { + this.roleValue = roleValue; + } } 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 23df5360..0ce7e336 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 @@ -1,6 +1,9 @@ package com.hzya.frame.mdm.mdmModuleDistribute.entity; import java.util.Date; +import java.util.List; + +import com.hzya.frame.mdm.mdmModuleDistributeDetail.entity.MdmModuleDistributeDetailEntity; import com.hzya.frame.web.entity.BaseEntity; /** * 主数据功能应用分发表(MdmModuleDistribute)实体类 @@ -24,7 +27,7 @@ public class MdmModuleDistributeEntity extends BaseEntity { private String enabledState; /** 公司id */ private String companyId; - + private List mdmModuleDistributeDetailEntities; public String getMdmId() { return mdmId; @@ -82,5 +85,12 @@ public class MdmModuleDistributeEntity extends BaseEntity { this.companyId = companyId; } + public List getMdmModuleDistributeDetailEntities() { + return mdmModuleDistributeDetailEntities; + } + + public void setMdmModuleDistributeDetailEntities(List mdmModuleDistributeDetailEntities) { + this.mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailEntities; + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/dao/IMdmModuleOptionLogDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/dao/IMdmModuleOptionLogDao.java new file mode 100644 index 00000000..a65bb1bc --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/dao/IMdmModuleOptionLogDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.mdm.mdmModuleOptionLog.dao; + +import com.hzya.frame.mdm.mdmModuleOptionLog.entity.MdmModuleOptionLogEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 主数据模版(mdm_module_option_log: table)表数据库访问层 + * + * @author makejava + * @since 2024-06-05 16:10:31 + */ +public interface IMdmModuleOptionLogDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/dao/impl/MdmModuleOptionLogDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/dao/impl/MdmModuleOptionLogDaoImpl.java new file mode 100644 index 00000000..b0fc4626 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/dao/impl/MdmModuleOptionLogDaoImpl.java @@ -0,0 +1,17 @@ +package com.hzya.frame.mdm.mdmModuleOptionLog.dao.impl; + +import com.hzya.frame.mdm.mdmModuleOptionLog.entity.MdmModuleOptionLogEntity; +import com.hzya.frame.mdm.mdmModuleOptionLog.dao.IMdmModuleOptionLogDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +/** + * 主数据模版(MdmModuleOptionLog)表数据库访问层 + * + * @author makejava + * @since 2024-06-05 16:10:31 + */ +@Repository(value = "MdmModuleOptionLogDaoImpl") +public class MdmModuleOptionLogDaoImpl extends MybatisGenericDao implements IMdmModuleOptionLogDao{ + +} + 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 new file mode 100644 index 00000000..d4af3ede --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.java @@ -0,0 +1,104 @@ +package com.hzya.frame.mdm.mdmModuleOptionLog.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * 主数据模版(MdmModuleOptionLog)实体类 + * + * @author makejava + * @since 2024-06-05 16:10:32 + */ +public class MdmModuleOptionLogEntity extends BaseEntity { + //主数据表名 + private String tableName; + //主数据编码 + private Long mdmCode; + /** 主表id */ + private String formmainId; + /** 来源名称 */ + private String sourceName; + /** 编码 */ + private String code; + /** source_data */ + private String sourceData; + /** 操作类型 */ + private String optionType; + /** 操作人 */ + private String optionName; + /** 公司id */ + private String companyId; + + + public String getFormmainId() { + return formmainId; + } + + public void setFormmainId(String formmainId) { + this.formmainId = formmainId; + } + + public String getSourceName() { + return sourceName; + } + + public void setSourceName(String sourceName) { + this.sourceName = sourceName; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getSourceData() { + return sourceData; + } + + public void setSourceData(String sourceData) { + this.sourceData = sourceData; + } + + public String getOptionType() { + return optionType; + } + + public void setOptionType(String optionType) { + this.optionType = optionType; + } + + public String getOptionName() { + return optionName; + } + + public void setOptionName(String optionName) { + this.optionName = optionName; + } + + public String getCompanyId() { + return companyId; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public Long getMdmCode() { + return mdmCode; + } + + public void setMdmCode(Long mdmCode) { + this.mdmCode = mdmCode; + } +} + 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 new file mode 100644 index 00000000..af218694 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.xml @@ -0,0 +1,272 @@ + + + + + + + + + + + + + + + + + + + + + + + + id + ,formmain_id + ,source_name + ,code + ,source_data + ,option_type + ,option_name + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + ,company_id + + + + + + + + + + + + + + + + + insert into ${tableName}( + + id , + formmain_id , + source_name , + code , + source_data , + option_type , + option_name , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + company_id , + sorts, + sts, + + )values( + + #{id} , + #{formmainId} , + #{sourceName} , + #{code} , + #{sourceData} , + #{optionType} , + #{optionName} , + #{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 ${tableName} a WHERE a.sts = 'Y' ), + '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, 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') + + + + + 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) + 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}) + + on duplicate key update + formmain_id = values(formmain_id), + source_name = values(source_name), + code = values(code), + source_data = values(source_data), + option_type = values(option_type), + option_name = values(option_name), + 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 ${tableName} set + + formmain_id = #{formmainId}, + source_name = #{sourceName}, + code = #{code}, + source_data = #{sourceData}, + option_type = #{optionType}, + option_name = #{optionName}, + 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 ${tableName} set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update ${tableName} set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and formmain_id = #{formmainId} + and source_name = #{sourceName} + and code = #{code} + and source_data = #{sourceData} + and option_type = #{optionType} + and option_name = #{optionName} + and sorts = #{sorts} + and sts = #{sts} + and company_id = #{companyId} + and sts='Y' + + + + + delete from ${tableName} where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/dao/IMdmModuleSendLogDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/dao/IMdmModuleSendLogDao.java new file mode 100644 index 00000000..156977bb --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/dao/IMdmModuleSendLogDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.mdm.mdmModuleSendLog.dao; + +import com.hzya.frame.mdm.mdmModuleSendLog.entity.MdmModuleSendLogEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 主数据模版(mdm_module_send_log: table)表数据库访问层 + * + * @author makejava + * @since 2024-06-05 16:11:09 + */ +public interface IMdmModuleSendLogDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/dao/impl/MdmModuleSendLogDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/dao/impl/MdmModuleSendLogDaoImpl.java new file mode 100644 index 00000000..9e59822d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/dao/impl/MdmModuleSendLogDaoImpl.java @@ -0,0 +1,17 @@ +package com.hzya.frame.mdm.mdmModuleSendLog.dao.impl; + +import com.hzya.frame.mdm.mdmModuleSendLog.entity.MdmModuleSendLogEntity; +import com.hzya.frame.mdm.mdmModuleSendLog.dao.IMdmModuleSendLogDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +/** + * 主数据模版(MdmModuleSendLog)表数据库访问层 + * + * @author makejava + * @since 2024-06-05 16:11:09 + */ +@Repository(value = "MdmModuleSendLogDaoImpl") +public class MdmModuleSendLogDaoImpl extends MybatisGenericDao implements IMdmModuleSendLogDao{ + +} + 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 new file mode 100644 index 00000000..20995957 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.java @@ -0,0 +1,94 @@ +package com.hzya.frame.mdm.mdmModuleSendLog.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * 主数据模版(MdmModuleSendLog)实体类 + * + * @author makejava + * @since 2024-06-05 16:11:10 + */ +public class MdmModuleSendLogEntity extends BaseEntity { + //主数据表名 + private String tableName; + //主数据编码 + private Long mdmCode; + /** 主表id */ + private String formmainId; + /** 目标应用 */ + private String targetApp; + /** 目标api */ + private String targetApi; + /** 源数据 */ + private String sourceData; + /** 操作类型 */ + private String optionType; + /** 公司id */ + private String companyId; + + + public String getFormmainId() { + return formmainId; + } + + public void setFormmainId(String formmainId) { + this.formmainId = formmainId; + } + + public String getTargetApp() { + return targetApp; + } + + public void setTargetApp(String targetApp) { + this.targetApp = targetApp; + } + + public String getTargetApi() { + return targetApi; + } + + public void setTargetApi(String targetApi) { + this.targetApi = targetApi; + } + + public String getSourceData() { + return sourceData; + } + + public void setSourceData(String sourceData) { + this.sourceData = sourceData; + } + + public String getOptionType() { + return optionType; + } + + public void setOptionType(String optionType) { + this.optionType = optionType; + } + + public String getCompanyId() { + return companyId; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public Long getMdmCode() { + return mdmCode; + } + + public void setMdmCode(Long mdmCode) { + this.mdmCode = mdmCode; + } +} + 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 new file mode 100644 index 00000000..0cea9a23 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.xml @@ -0,0 +1,262 @@ + + + + + + + + + + + + + + + + + + + + + + + id + ,formmain_id + ,target_app + ,target_api + ,source_data + ,option_type + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + ,company_id + + + + + + + + + + + + + + + + + + insert into ${tableName}( + + id , + formmain_id , + target_app , + target_api , + source_data , + option_type , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + company_id , + sorts, + sts, + + )values( + + #{id} , + #{formmainId} , + #{targetApp} , + #{targetApi} , + #{sourceData} , + #{optionType} , + #{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 ${tableName} a WHERE a.sts = 'Y' ), + '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, 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') + + + + + 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) + 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}) + + on duplicate key update + formmain_id = values(formmain_id), + target_app = values(target_app), + target_api = values(target_api), + source_data = values(source_data), + option_type = values(option_type), + 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 ${tableName} set + + formmain_id = #{formmainId}, + target_app = #{targetApp}, + target_api = #{targetApi}, + source_data = #{sourceData}, + option_type = #{optionType}, + 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 ${tableName} set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update ${tableName} set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and formmain_id = #{formmainId} + and target_app = #{targetApp} + and target_api = #{targetApi} + and source_data = #{sourceData} + and option_type = #{optionType} + and sorts = #{sorts} + and sts = #{sts} + and company_id = #{companyId} + and sts='Y' + + + + + delete from ${tableName} where id = #{id} + + + + 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 d10dd02d..6476ebba 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 @@ -141,7 +141,7 @@ - + insert into mdm_module_source( id , @@ -181,7 +181,7 @@ ) - + 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) values @@ -189,7 +189,7 @@ - + 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) values 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 1369a2a9..d588e694 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 @@ -50,7 +50,7 @@ public interface IMdmService { * @param jsonObject * @return com.hzya.frame.web.entity.JsonResultEntity * @Author lvleigang - * @Description 主数据基本信息保存 + * @Description 主数据基本信息修改 * @Date 9:40 上午 2023/10/18 **/ JsonResultEntity doSaveMdmModule(JSONObject jsonObject); @@ -63,31 +63,31 @@ public interface IMdmService { **/ JsonResultEntity queryMdmModuleDb(JSONObject jsonObject); // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置查询数据源的服务 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity queryMdmModuleServer(JSONObject jsonObject); - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置查询数据源字段的服务 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity queryMdmModuleServerFiled(JSONObject jsonObject); - // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置查询主表字段 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity queryMdmModuleServerMainFiled(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询数据源的服务 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmModuleServer(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询数据源字段的服务 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmModuleServerFiled(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询主表字段 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmModuleServerMainFiled(JSONObject jsonObject); /** * @param jsonObject * @return com.hzya.frame.web.entity.JsonResultEntity @@ -135,57 +135,128 @@ public interface IMdmService { //JsonResultEntity doSaveMdmModuleRule(JSONObject jsonObject); // // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置查询分发设置 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity queryMdmModuleDistribute(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询分发设置 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmModuleDistribute(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置保存分发设置 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity doSaveMdmModuleDistribute(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询数据来源 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmModuleSource(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置保存数据来源 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity doSaveMdmModuleSource(JSONObject jsonObject); + + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询下发日志 + * @Date 11:52 上午 2024/3/27 + **/ + JsonResultEntity querySendEntityPage(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 获取下发日志 + * @Date 2:36 下午 2024/3/27 + **/ + JsonResultEntity getSendEntity(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 删除下发日志 + * @Date 2:37 下午 2024/3/27 + **/ + JsonResultEntity deleteSendEntity(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询操作日志 + * @Date 11:52 上午 2024/3/27 + **/ + JsonResultEntity queryOptionEntityPage(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 获取操作日志 + * @Date 2:36 下午 2024/3/27 + **/ + JsonResultEntity getOptionEntity(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 删除操作日志 + * @Date 2:37 下午 2024/3/27 + **/ + JsonResultEntity deleteOptionEntity(JSONObject jsonObject); // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置保存分发设置 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity doSaveMdmModuleDistribute(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据列表显示 树、查询条件、列表字段、按钮 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmShow(JSONObject jsonObject); // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据列表显示 树、查询条件、列表字段、按钮 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity queryMdmShow(JSONObject jsonObject); - // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据查询所有字段 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity queryMdmShowAll(JSONObject jsonObject); - ///** - // * @Author lvleigang - // * @Description 查询模版数据(list 或者 分页) - // * @Date 1:33 下午 2023/7/12 - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // **/ - //JsonResultEntity queryTemplateData(JSONObject jsonObject); - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据列表显示 业务数据 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity queryMdmShowData(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据查询所有字段 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmShowAll(JSONObject jsonObject); + /** + * @Author lvleigang + * @Description 查询模版数据(list 或者 分页) + * @Date 1:33 下午 2023/7/12 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryTemplateData(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据列表显示 业务数据 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmShowData(JSONObject jsonObject); // ///** // * @param jsonObject @@ -195,14 +266,14 @@ public interface IMdmService { // * @Date 9:40 上午 2023/10/18 // **/ //JsonResultEntity queryMdmShowDistribute(JSONObject jsonObject); - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据业务数据树结构 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity queryMdmShowTreeData(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据业务数据树结构 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmShowTreeData(JSONObject jsonObject); ///** // * @param jsonObject // * @return com.hzya.frame.web.entity.JsonResultEntity @@ -212,49 +283,49 @@ public interface IMdmService { // **/ //JsonResultEntity queryMdmOptionData(JSONObject jsonObject); // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据详情 区分类型 新增、修改、查看 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity queryMdmShowDetails(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情 区分类型 新增、修改、查看 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmShowDetails(JSONObject jsonObject); // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据详情数据 区分类型 新增、修改、查看 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity queryMdmShowDetailsData(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情数据 区分类型 新增、修改、查看 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmShowDetailsData(JSONObject jsonObject); // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据详情数据修改 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity updateMdmShowDetailsData(JSONObject jsonObject); - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据详情数据新增 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity saveMdmShowDetailsData(JSONObject jsonObject); - // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据删除业务数据 - // * @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 updateMdmShowDetailsData(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情数据新增 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity saveMdmShowDetailsData(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据删除业务数据 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity deleteMdmShowDetailsData(JSONObject jsonObject); // ///** // * @param jsonObject diff --git a/service/src/main/java/com/hzya/frame/mdm/service/IMdmServiceCache.java b/service/src/main/java/com/hzya/frame/mdm/service/IMdmServiceCache.java index bc3a5ad2..4174d5fa 100644 --- a/service/src/main/java/com/hzya/frame/mdm/service/IMdmServiceCache.java +++ b/service/src/main/java/com/hzya/frame/mdm/service/IMdmServiceCache.java @@ -5,6 +5,9 @@ import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity; import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; +import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity; +import com.hzya.frame.mdm.mdmModuleDistributeDetail.entity.MdmModuleDistributeDetailEntity; +import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity; import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; import com.hzya.frame.mdm.mdmModuleViewButton.entity.MdmModuleViewButtonEntity; import com.hzya.frame.mdm.mdmModuleViewDetail.entity.MdmModuleViewDetailEntity; @@ -27,14 +30,33 @@ public interface IMdmServiceCache { * @return com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity **/ MdmModuleEntity getMdmModuleEntity(Long mdmCode); + /** + * @Author lvleigang + * @Description 获取模版单据编码规则 + * @Date 10:13 上午 2024/6/3 + * @param mdmTableCodeRuleEntity + * @return com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity + **/ + List queryMdmTableCodeRuleEntity(MdmTableCodeRuleEntity mdmTableCodeRuleEntity); + /** + * @Author lvleigang + * @Description 获取模版表数据 + * @Date 10:13 上午 2024/6/3 + * @param queryDb + * @return com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity + **/ + List queryMdmModuleDb(MdmModuleDbEntity queryDb); + /** + * @Author lvleigang + * @Description 获取模版字段表数据 + * @Date 10:13 上午 2024/6/3 + * @param queryDbFiled + * @return com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity + **/ + List queryMdmModuleDbFileds(MdmModuleDbFiledsEntity queryDbFiled); void updateMdmModuleEntity(MdmModuleEntity entity); - List queryMdmTableCodeRuleEntity(MdmTableCodeRuleEntity mdmTableCodeRuleEntity); - - List queryMdmModuleDb(MdmModuleDbEntity queryDb); - - List queryMdmModuleDbFileds(MdmModuleDbFiledsEntity queryDbFiled); List queryMdmModuleDbFiledsRule(MdmModuleDbFiledsRuleEntity queryDbFiledRule); @@ -57,4 +79,14 @@ public interface IMdmServiceCache { void saveMdmModuleViewDetail(String id, List mdmModuleViewDetailEntities); void saveMdmModuleViewButton(String id, List mdmModuleViewButtonEntities); + + List queryMdmModuleDistribute(String id,MdmModuleDistributeEntity mdmModuleDistributeEntity); + + void saveMdmModuleDistribute(String id, List mdmModuleDistributeEntities); + + List queryMdmModuleSource(MdmModuleSourceEntity mdmModuleSourceEntity); + + void saveMdmModuleSource(String id, List mdmModuleSourceEntities); + + List queryMdmModuleDistributeDetail(MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity); } diff --git a/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceCache.java b/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceCache.java index 1e5c7e0f..b847f145 100644 --- a/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceCache.java +++ b/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceCache.java @@ -13,7 +13,11 @@ import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity; 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.mdmModuleSource.dao.IMdmModuleSourceDao; +import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity; import com.hzya.frame.mdm.mdmModuleView.dao.IMdmModuleViewDao; import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; import com.hzya.frame.mdm.mdmModuleViewButton.dao.IMdmModuleViewButtonDao; @@ -25,6 +29,7 @@ import com.hzya.frame.mdm.mdmTableCodeRule.entity.MdmTableCodeRuleEntity; import com.hzya.frame.mdm.service.IMdmService; import com.hzya.frame.mdm.service.IMdmServiceCache; import com.hzya.frame.sysnew.integtationTask.entity.IntegrationTaskEntity; +import com.hzya.frame.uuid.UUIDUtils; import com.hzya.frame.web.entity.BaseResult; import com.hzya.frame.web.entity.JsonResultEntity; import org.slf4j.Logger; @@ -34,6 +39,7 @@ import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -57,6 +63,8 @@ public class MdmServiceCache implements IMdmServiceCache { @Resource private IMdmModuleDistributeDetailDao mdmModuleDistributeDetailDao; @Resource + private IMdmModuleSourceDao mdmModuleSourceDao; + @Resource private IMdmModuleViewDao mdmModuleViewDao; @Resource private IMdmModuleViewButtonDao mdmModuleViewButtonDao; @@ -79,7 +87,7 @@ public class MdmServiceCache implements IMdmServiceCache { } @Override - @Cacheable(cacheNames="mdmTableCodeRule",key = "#mdmId") + @Cacheable(cacheNames="mdmTableCodeRule",key = "#entity.mdmId") public List queryMdmTableCodeRuleEntity(MdmTableCodeRuleEntity entity) { List mdmTableCodeRuleEntityList = mdmTableCodeRuleDao.queryBase(entity); return mdmTableCodeRuleEntityList; @@ -87,21 +95,21 @@ public class MdmServiceCache implements IMdmServiceCache { @Override - @Cacheable(cacheNames="mdmModuleDb",key = "#mdmId") + @Cacheable(cacheNames="mdmModuleDb",key = "#entity.mdmId") public List queryMdmModuleDb(MdmModuleDbEntity entity) { List mdmModuleDbEntities = mdmModuleDbDao.queryBase(entity); return mdmModuleDbEntities; } @Override - @Cacheable(cacheNames="mdmModuleDbFileds",key = "#mdmId") + @Cacheable(cacheNames="mdmModuleDbFileds",key = "#entity.mdmId") public List queryMdmModuleDbFileds(MdmModuleDbFiledsEntity entity) { List mdmModuleDbFiledsEntities = mdmModuleDbFiledsDao.queryBase(entity); return mdmModuleDbFiledsEntities; } @Override - @Cacheable(cacheNames="mdmModuleDbFiledsRule",key = "#mdmId") + @Cacheable(cacheNames="mdmModuleDbFiledsRule",key = "#entity.mdmId") public List queryMdmModuleDbFiledsRule(MdmModuleDbFiledsRuleEntity entity) { List mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(entity); return mdmModuleDbFiledsRuleEntities; @@ -168,23 +176,23 @@ public class MdmServiceCache implements IMdmServiceCache { } @Override - @Cacheable(cacheNames="mdmModuleViewDetail",key = "#mdmId") - public List queryMdmModuleViewDetail(MdmModuleViewDetailEntity mdmModuleViewDetailEntity) { - List mdmModuleViewDetailEntities = mdmModuleViewDetailDao.queryBase(mdmModuleViewDetailEntity); + @Cacheable(cacheNames="mdmModuleViewDetail",key = "#entity.mdmId") + public List queryMdmModuleViewDetail(MdmModuleViewDetailEntity entity) { + List mdmModuleViewDetailEntities = mdmModuleViewDetailDao.queryBase(entity); return mdmModuleViewDetailEntities; } @Override - @Cacheable(cacheNames="mdmModuleView",key = "#mdmId") - public List queryMdmModuleView(MdmModuleViewEntity mdmModuleViewEntity) { - List moduleViewEntities = mdmModuleViewDao.queryBase(mdmModuleViewEntity); + @Cacheable(cacheNames="mdmModuleView",key = "#entity.mdmId") + public List queryMdmModuleView(MdmModuleViewEntity entity) { + List moduleViewEntities = mdmModuleViewDao.queryBase(entity); return moduleViewEntities; } @Override - @Cacheable(cacheNames="mdmModuleViewButton",key = "#mdmId") - public List queryMdmModuleViewButton(MdmModuleViewButtonEntity mdmModuleViewButtonEntity) { - List mdmModuleViewButtonEntities = mdmModuleViewButtonDao.queryBase(mdmModuleViewButtonEntity); + @Cacheable(cacheNames="mdmModuleViewButton",key = "#entity.mdmId") + public List queryMdmModuleViewButton(MdmModuleViewButtonEntity entity) { + List mdmModuleViewButtonEntities = mdmModuleViewButtonDao.queryBase(entity); return mdmModuleViewButtonEntities; } @@ -229,5 +237,110 @@ public class MdmServiceCache implements IMdmServiceCache { } } } + @Override + @Cacheable(cacheNames="mdmModuleDistribute",key = "#mdmId") + public List queryMdmModuleDistribute(String mdmId,MdmModuleDistributeEntity mdmModuleDistributeEntity) { + List mdmModuleDistributeEntities = mdmModuleDistributeDao.queryBase(mdmModuleDistributeEntity); + //查询模块下的应用列表 + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity(); + mdmModuleDistributeDetailEntity.setSts("Y"); + mdmModuleDistributeDetailEntity.setMdmId(mdmId); + List mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity); + if(mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() > 0){ + for (int i = 0; i < mdmModuleDistributeEntities.size(); i++) { + List moduleDistributeDetailEntities = new ArrayList<>(); + if(mdmModuleDistributeDetailEntities != null && mdmModuleDistributeDetailEntities.size() > 0){ + for (int i1 = 0; i1 < mdmModuleDistributeDetailEntities.size(); i1++) { + if(mdmModuleDistributeEntities.get(i).getId().equals(mdmModuleDistributeDetailEntities.get(i1).getDistributeId())){ + moduleDistributeDetailEntities.add(mdmModuleDistributeDetailEntities.get(i1)); + } + } + } + mdmModuleDistributeEntities.get(i).setMdmModuleDistributeDetailEntities(moduleDistributeDetailEntities); + } + } + return mdmModuleDistributeEntities; + } + @Override + @Cacheable(cacheNames="mdmModuleDistributeDetail",key = "#entity.mdmId") + public List queryMdmModuleDistributeDetail(MdmModuleDistributeDetailEntity entity){ + List mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(entity); + return mdmModuleDistributeDetailEntities; + } + + @Override + @CacheEvict(cacheNames="mdmModuleDistribute",key = "#mdmId") + public void saveMdmModuleDistribute(String mdmId, List mdmModuleDistributeEntities) { + //先删除 + MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity(); + mdmModuleDistributeEntity.setMdmId(mdmId); + mdmModuleDistributeEntity.setUpdate(); + mdmModuleDistributeDao.logicRemoveMultiCondition(mdmModuleDistributeEntity); + //保存主数据 + if (mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() > 0) { + for (int i = 0; i < mdmModuleDistributeEntities.size(); i++) { + MdmModuleDistributeEntity moduleDistributeEntity = mdmModuleDistributeEntities.get(i); + moduleDistributeEntity.setMdmId(mdmId); + if (moduleDistributeEntity.getId() != null && !"".equals(moduleDistributeEntity.getId())) { + moduleDistributeEntity.setUpdate(); + //修改 + mdmModuleDistributeDao.update(moduleDistributeEntity); + } else { + //新增 + moduleDistributeEntity.setCreate(); + mdmModuleDistributeDao.save(moduleDistributeEntity); + } + if(moduleDistributeEntity.getMdmModuleDistributeDetailEntities() != null && moduleDistributeEntity.getMdmModuleDistributeDetailEntities().size() > 0){ + for (int i1 = 0; i1 < moduleDistributeEntity.getMdmModuleDistributeDetailEntities().size(); i1++) { + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = moduleDistributeEntity.getMdmModuleDistributeDetailEntities().get(i1); + mdmModuleDistributeDetailEntity.setMdmId(mdmId); + mdmModuleDistributeDetailEntity.setDistributeId(moduleDistributeEntity.getId()); + if (mdmModuleDistributeDetailEntity.getId() != null && !"".equals(mdmModuleDistributeDetailEntity.getId())) { + mdmModuleDistributeDetailEntity.setUpdate(); + //修改 + mdmModuleDistributeDetailDao.update(mdmModuleDistributeDetailEntity); + } else { + //新增 + mdmModuleDistributeDetailEntity.setCreate(); + mdmModuleDistributeDetailDao.save(mdmModuleDistributeDetailEntity); + } + } + } + } + } + } + + @Override + @Cacheable(cacheNames="mdmModuleSource",key = "#entity.mdmId") + public List queryMdmModuleSource(MdmModuleSourceEntity entity) { + List mdmModuleSourceEntities = mdmModuleSourceDao.queryBase(entity); + return mdmModuleSourceEntities; + } + + @Override + @CacheEvict(cacheNames="mdmModuleSource",key = "#mdmId") + public void saveMdmModuleSource(String mdmId, List mdmModuleSourceEntities) { + //先删除 + MdmModuleSourceEntity mdmModuleSourceEntity = new MdmModuleSourceEntity(); + mdmModuleSourceEntity.setMdmId(mdmId); + mdmModuleSourceEntity.setUpdate(); + mdmModuleSourceDao.logicRemoveMultiCondition(mdmModuleSourceEntity); + //保存主数据 + if (mdmModuleSourceEntities != null && mdmModuleSourceEntities.size() > 0) { + for (int i = 0; i < mdmModuleSourceEntities.size(); i++) { + MdmModuleSourceEntity mdmModuleSourceEntity1 = mdmModuleSourceEntities.get(i); + mdmModuleSourceEntity1.setMdmId(mdmId); + if (mdmModuleSourceEntity1.getId() != null && !"".equals(mdmModuleSourceEntity1.getId())) { + mdmModuleSourceEntity1.setUpdate(); + //修改 + mdmModuleSourceDao.update(mdmModuleSourceEntity1); + } else { + //新增 + mdmModuleSourceEntity1.setCreate(); + mdmModuleSourceDao.save(mdmModuleSourceEntity1); + } + } + } + } } 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 6756c7dc..145b9b67 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 @@ -5,13 +5,20 @@ 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; import com.hzya.frame.mdm.entity.MdmDbFiledVo; import com.hzya.frame.mdm.entity.MdmDbVo; +import com.hzya.frame.mdm.entity.MdmDetailViewVo; +import com.hzya.frame.mdm.entity.MdmDistributeDto; import com.hzya.frame.mdm.entity.MdmDto; import com.hzya.frame.mdm.entity.MdmModuleViewDto; import com.hzya.frame.mdm.entity.MdmModuleViewVo; +import com.hzya.frame.mdm.entity.MdmQuery; +import com.hzya.frame.mdm.entity.MdmSourceDto; +import com.hzya.frame.mdm.entity.MdmViewFiledVo; +import com.hzya.frame.mdm.entity.MdmViewVo; import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao; import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; import com.hzya.frame.mdm.mdmModuleDb.dao.IMdmModuleDbDao; @@ -23,7 +30,11 @@ 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; +import com.hzya.frame.mdm.mdmModuleSendLog.entity.MdmModuleSendLogEntity; +import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity; import com.hzya.frame.mdm.mdmModuleView.dao.IMdmModuleViewDao; import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; import com.hzya.frame.mdm.mdmModuleViewButton.dao.IMdmModuleViewButtonDao; @@ -35,20 +46,19 @@ 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.sys.entity.ModuleDto; -import com.hzya.frame.sys.module.entity.Module; -import com.hzya.frame.sys.roleModule.entity.RoleModule; -import com.hzya.frame.sysnew.application.plugin.entity.SysApplicationPluginEntity; import com.hzya.frame.sysnew.buttonConfig.dao.ISysButtonConfigDao; import com.hzya.frame.sysnew.buttonConfig.entity.SysButtonConfigEntity; 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.util.PluginUtils; +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.uuid.UUIDUtils; import com.hzya.frame.web.entity.BaseResult; import com.hzya.frame.web.entity.JsonResultEntity; +import org.checkerframework.checker.units.qual.A; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; @@ -60,8 +70,6 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; /** @@ -74,6 +82,10 @@ public class MdmServiceImpl implements IMdmService { @Resource private IMdmModuleDao mdmModuleDao; @Resource + private IMdmModuleSendLogDao mdmModuleSendLogDao; + @Resource + private IMdmModuleOptionLogDao mdmModuleOptionLogDao; + @Resource private IMdmServiceCache mdmServiceCache; @Resource private ISysMenuConfigDao sysMenuConfigDao; @@ -197,6 +209,11 @@ public class MdmServiceImpl implements IMdmService { if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { return BaseResult.getFailureMessageEntity("系统错误"); } + MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); + if(mdmModuleEntity == null ){ + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setId(mdmModuleEntity.getId()); //修改 entity.setUpdate(); mdmServiceCache.updateMdmModuleEntity(entity); @@ -594,11 +611,11 @@ public class MdmServiceImpl implements IMdmService { documentRule.setEnName("单据规则"); documentRule.setFiledType("3"); documentRule.setAddType("2"); - documentRule.setUpdateType("2"); - documentRule.setShowType("2"); - documentRule.setQueryType("2"); - documentRule.setListType("2"); - documentRule.setViewType("2"); + documentRule.setUpdateType("1"); + documentRule.setShowType("1"); + documentRule.setQueryType("1"); + documentRule.setListType("1"); + documentRule.setViewType("1"); documentRule.setFiledLength("50"); documentRule.setDataType("1"); mdmModuleDbFiledsEntities.add(documentRule); @@ -707,7 +724,7 @@ public class MdmServiceImpl implements IMdmService { MdmModuleDbFiledsEntity option_Name = new MdmModuleDbFiledsEntity(); option_Name.setMdmId(mdmId); option_Name.setDbId(dbId); - option_Name.setChName("option_Name"); + option_Name.setChName("option_name"); option_Name.setEnName("操作人"); option_Name.setFiledType("3"); option_Name.setAddType("2"); @@ -844,7 +861,7 @@ public class MdmServiceImpl implements IMdmService { delete_status.setMdmId(mdmId); delete_status.setDbId(dbId); delete_status.setChName("delete_status"); - delete_status.setEnName("修删除数据状态 0待下发 1已下发"); + delete_status.setEnName("删除数据状态 0待下发 1已下发"); delete_status.setFiledType("3"); delete_status.setAddType("2"); delete_status.setUpdateType("2"); @@ -1515,95 +1532,465 @@ public class MdmServiceImpl implements IMdmService { } } } - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置查询数据源的服务 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmModuleServer(JSONObject object) { - // MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); - // //判断分页 - // if (entity == null) { - // entity = new MdmModuleDbEntity(); - // } - // //查询数据源表 - // entity.setSts("Y"); - // List mdmModuleDbEntityList = mdmModuleDbDao.queryByLike(entity); - // return BaseResult.getSuccessMessageEntity("查询数据成功", mdmModuleDbEntityList); - //} - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置查询数据源的服务的字段 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmModuleServerFiled(JSONObject object) { - // MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); - // //判断分页 - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getDbName() == null || "".equals(entity.getDbName())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询数据源表 - // entity.setSts("Y"); - // List dblist = mdmModuleDbDao.queryBase(entity); - // if (dblist != null && dblist.size() == 1) { - // MdmModuleDbFiledsEntity queryDbFiled = new MdmModuleDbFiledsEntity(); - // queryDbFiled.setSts("Y"); - // queryDbFiled.setDbId(dblist.get(0).getId()); - // List list = mdmModuleDbFiledsDao.queryBase(queryDbFiled); - // MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); - // mdmModuleDbFiledsEntity.setChName("id"); - // mdmModuleDbFiledsEntity.setEnName("id"); - // list.add(0, mdmModuleDbFiledsEntity); - // return BaseResult.getSuccessMessageEntity("查询数据成功", list); - // } else { - // return BaseResult.getFailureMessageEntity("服务不存在"); - // } - //} + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询分发设置 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmModuleDistribute(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); + if(mdmModuleEntity == null || mdmModuleEntity.getId() == null){ + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询模块下的应用列表 + MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity(); + mdmModuleDistributeEntity.setSts("Y"); + mdmModuleDistributeEntity.setMdmId(mdmModuleEntity.getId()); + List mdmModuleDistributeEntities = mdmServiceCache.queryMdmModuleDistribute(mdmModuleEntity.getId(),mdmModuleDistributeEntity); + return BaseResult.getSuccessMessageEntity("查询成功", mdmModuleDistributeEntities); + } + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置保存分发设置 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity doSaveMdmModuleDistribute(JSONObject object) { + MdmDistributeDto entity = getData("jsonStr", object, MdmDistributeDto.class); + //判断是否有数据 + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); + if(mdmModuleEntity == null || mdmModuleEntity.getId() == null){ + return BaseResult.getFailureMessageEntity("系统错误"); + } + mdmServiceCache.saveMdmModuleDistribute(mdmModuleEntity.getId(),entity.getMdmModuleDistributeEntities()); + return BaseResult.getSuccessMessageEntity("保存发布设置成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询数据来源 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmModuleSource(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); + if(mdmModuleEntity == null || mdmModuleEntity.getId() == null){ + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询模块下的应用列表 + MdmModuleSourceEntity mdmModuleSourceEntity = new MdmModuleSourceEntity(); + mdmModuleSourceEntity.setSts("Y"); + mdmModuleSourceEntity.setMdmId(mdmModuleEntity.getId()); + List mdmModuleSourceEntities = mdmServiceCache.queryMdmModuleSource(mdmModuleSourceEntity); + return BaseResult.getSuccessMessageEntity("查询成功", mdmModuleSourceEntities); + } + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置保存数据来源 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity doSaveMdmModuleSource(JSONObject object) { + MdmSourceDto entity = getData("jsonStr", object, MdmSourceDto.class); + //判断是否有数据 + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); + if(mdmModuleEntity == null || mdmModuleEntity.getId() == null){ + return BaseResult.getFailureMessageEntity("系统错误"); + } + mdmServiceCache.saveMdmModuleSource(mdmModuleEntity.getId(),entity.getMdmModuleSourceEntities()); + return BaseResult.getSuccessMessageEntity("保存发布设置成功"); + } + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询下发日志 + * @Date 11:52 上午 2024/3/27 + **/ + @Override + public JsonResultEntity querySendEntityPage(JSONObject jsonObject) { + MdmModuleSendLogEntity entity = getData("jsonStr", jsonObject, MdmModuleSendLogEntity.class); + //判断分页 + if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + 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 ){ + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if("1".equals(mdmModuleDbEntities.get(i).getDbType())){ + entity.setTableName(mdmModuleDbEntities.get(i).getDbName()+"_send_log"); + break; + } + } + }else { + return BaseResult.getFailureMessageEntity("请先设置数据源"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List list = mdmModuleSendLogDao.queryByLike(entity); + PageInfo pageInfo = new PageInfo(list); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 获取下发日志 + * @Date 2:36 下午 2024/3/27 + **/ + @Override + public JsonResultEntity getSendEntity(JSONObject jsonObject) { + MdmModuleSendLogEntity entity = getData("jsonStr", jsonObject, MdmModuleSendLogEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + 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 ){ + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if("1".equals(mdmModuleDbEntities.get(i).getDbType())){ + entity.setTableName(mdmModuleDbEntities.get(i).getDbName()+"_send_log"); + break; + } + } + }else { + return BaseResult.getFailureMessageEntity("请先设置数据源"); + } + entity = mdmModuleSendLogDao.get(entity.getId()); + if (entity == null) { + return BaseResult.getFailureMessageEntity("获取日志失败"); + } + return BaseResult.getSuccessMessageEntity("获取日志成功", entity); + } + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 删除下发日志 + * @Date 2:37 下午 2024/3/27 + **/ + @Override + public JsonResultEntity deleteSendEntity(JSONObject jsonObject) { + MdmModuleSendLogEntity entity = getData("jsonStr", jsonObject, MdmModuleSendLogEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + 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 ){ + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if("1".equals(mdmModuleDbEntities.get(i).getDbType())){ + entity.setTableName(mdmModuleDbEntities.get(i).getDbName()+"_send_log"); + break; + } + } + }else { + return BaseResult.getFailureMessageEntity("请先设置数据源"); + } + entity.setUpdate(); + mdmModuleSendLogDao.logicRemove(entity); + return BaseResult.getSuccessMessageEntity("删除日志成功"); + } + + + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询操作日志 + * @Date 11:52 上午 2024/3/27 + **/ + @Override + public JsonResultEntity queryOptionEntityPage(JSONObject jsonObject) { + MdmModuleOptionLogEntity entity = getData("jsonStr", jsonObject, MdmModuleOptionLogEntity.class); + //判断分页 + if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + 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 ){ + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if("1".equals(mdmModuleDbEntities.get(i).getDbType())){ + entity.setTableName(mdmModuleDbEntities.get(i).getDbName()+"_option_log"); + break; + } + } + }else { + return BaseResult.getFailureMessageEntity("请先设置数据源"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List list = mdmModuleOptionLogDao.queryByLike(entity); + PageInfo pageInfo = new PageInfo(list); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 获取操作日志 + * @Date 2:36 下午 2024/3/27 + **/ + @Override + public JsonResultEntity getOptionEntity(JSONObject jsonObject) { + MdmModuleOptionLogEntity entity = getData("jsonStr", jsonObject, MdmModuleOptionLogEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + 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 ){ + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if("1".equals(mdmModuleDbEntities.get(i).getDbType())){ + entity.setTableName(mdmModuleDbEntities.get(i).getDbName()+"_option_log"); + break; + } + } + }else { + return BaseResult.getFailureMessageEntity("请先设置数据源"); + } + entity = mdmModuleOptionLogDao.get(entity.getId()); + if (entity == null) { + return BaseResult.getFailureMessageEntity("获取日志失败"); + } + return BaseResult.getSuccessMessageEntity("获取日志成功", entity); + } + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 删除操作日志 + * @Date 2:37 下午 2024/3/27 + **/ + @Override + public JsonResultEntity deleteOptionEntity(JSONObject jsonObject) { + MdmModuleOptionLogEntity entity = getData("jsonStr", jsonObject, MdmModuleOptionLogEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + 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 ){ + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if("1".equals(mdmModuleDbEntities.get(i).getDbType())){ + entity.setTableName(mdmModuleDbEntities.get(i).getDbName()+"_option_log"); + break; + } + } + }else { + return BaseResult.getFailureMessageEntity("请先设置数据源"); + } + entity.setUpdate(); + mdmModuleOptionLogDao.logicRemove(entity); + return BaseResult.getSuccessMessageEntity("删除日志成功"); + } + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询数据源的服务 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmModuleServer(JSONObject object) { + MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); + //判断分页 + if (entity == null) { + entity = new MdmModuleDbEntity(); + } + //查询数据源表 + entity.setSts("Y"); + List allDb = mdmModuleDbDao.queryByLike(entity); + List mdmModuleDbEntityList = new ArrayList<>(); + if(allDb != null && allDb.size() > 0){ + for (int i = 0; i < allDb.size(); i++) { + if("1".equals(allDb.get(i).getDbType()) || "2".equals(allDb.get(i).getDbType() )){ + mdmModuleDbEntityList.add(allDb.get(i)); + } + } + } + return BaseResult.getSuccessMessageEntity("查询数据成功", mdmModuleDbEntityList); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询数据源的服务的字段 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmModuleServerFiled(JSONObject object) { + MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); + //判断分页 + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getDbName() == null || "".equals(entity.getDbName())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询数据源表 + entity.setSts("Y"); + List dblist = mdmModuleDbDao.queryBase(entity); + if (dblist != null && dblist.size() == 1) { + MdmModuleDbFiledsEntity queryDbFiled = new MdmModuleDbFiledsEntity(); + queryDbFiled.setSts("Y"); + queryDbFiled.setDbId(dblist.get(0).getId()); + queryDbFiled.setViewType("1"); + List list = mdmModuleDbFiledsDao.queryBase(queryDbFiled); + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setChName("id"); + mdmModuleDbFiledsEntity.setEnName("id"); + list.add(0, mdmModuleDbFiledsEntity); + return BaseResult.getSuccessMessageEntity("查询数据成功", list); + } else { + return BaseResult.getFailureMessageEntity("服务不存在"); + } + } // // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置查询主表字段 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmModuleServerMainFiled(JSONObject object) { - // MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); - // //判断分页 - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询数据源表 - // entity.setSts("Y"); - // entity.setDbType("1"); - // List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(entity); - // if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() == 1) { - // MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); - // mdmModuleDbFiledsEntity.setSts("Y"); - // mdmModuleDbFiledsEntity.setDbId(mdmModuleDbEntityList.get(0).getId()); - // List list = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); - // return BaseResult.getSuccessMessageEntity("查询数据成功", list); - // } else if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() == 0) { - // return BaseResult.getFailureMessageEntity("请先配置数据源"); - // } else { - // return BaseResult.getFailureMessageEntity("查询数据失败"); - // } - //} + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据设置查询主表字段 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmModuleServerMainFiled(JSONObject object) { + MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); + //判断分页 + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询数据源表 + entity.setSts("Y"); + entity.setDbType("1"); + List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(entity); + if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() == 1) { + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setSts("Y"); + mdmModuleDbFiledsEntity.setViewType("1"); + mdmModuleDbFiledsEntity.setDbId(mdmModuleDbEntityList.get(0).getId()); + List list = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); + return BaseResult.getSuccessMessageEntity("查询数据成功", list); + } else if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("请先配置数据源"); + } else { + return BaseResult.getFailureMessageEntity("查询数据失败"); + } + } @@ -2066,316 +2453,196 @@ public class MdmServiceImpl implements IMdmService { // return BaseResult.getSuccessMessageEntity("保存成功"); //} // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置查询分发设置 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmModuleDistribute(JSONObject object) { - // MdmDto entity = getData("jsonStr", object, MdmDto.class); - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getId() == null || "".equals(entity.getId())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询模块下的应用列表 - // MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity(); - // mdmModuleDistributeEntity.setSts("Y"); - // mdmModuleDistributeEntity.setMdmId(entity.getId()); - // List mdmModuleDistributeEntities = mdmModuleDistributeDao.queryBase(mdmModuleDistributeEntity); - // if (mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() > 0) { - // MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity(); - // mdmModuleDistributeDetailEntity.setSts("Y"); - // mdmModuleDistributeDetailEntity.setMdmId(entity.getId()); - // List mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity); - // if (mdmModuleDistributeDetailEntities != null && mdmModuleDistributeDetailEntities.size() > 0) { - // for (int i = 0; i < mdmModuleDistributeEntities.size(); i++) { - // List addlist = new ArrayList<>(); - // List deletelist = new ArrayList<>(); - // for (int i1 = 0; i1 < mdmModuleDistributeDetailEntities.size(); i1++) { - // if (mdmModuleDistributeEntities.get(i).getAddApi().equals(mdmModuleDistributeDetailEntities.get(i1).getApiId()) - // && mdmModuleDistributeEntities.get(i).getId().equals(mdmModuleDistributeDetailEntities.get(i1).getDistributeId())) { - // addlist.add(mdmModuleDistributeDetailEntities.get(i1)); - // } - // if (mdmModuleDistributeEntities.get(i).getDeleteApi().equals(mdmModuleDistributeDetailEntities.get(i1).getApiId()) - // && mdmModuleDistributeEntities.get(i).getId().equals(mdmModuleDistributeDetailEntities.get(i1).getDistributeId())) { - // deletelist.add(mdmModuleDistributeDetailEntities.get(i1)); - // } - // } - // mdmModuleDistributeEntities.get(i).setAddList(addlist); - // mdmModuleDistributeEntities.get(i).setDeleteList(deletelist); - // } - // } - // } - // return BaseResult.getSuccessMessageEntity("查询成功", mdmModuleDistributeEntities); - //} + // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置保存分发设置 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity doSaveMdmModuleDistribute(JSONObject object) { - // MdmDistributeDto entity = getData("jsonStr", object, MdmDistributeDto.class); - // //判断是否有数据 - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getId() == null || "".equals(entity.getId())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //if(entity.getMdmModuleDistributeEntities() == null ){ - // // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // //} - // //先删除 - // MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity(); - // mdmModuleDistributeEntity.setMdmId(entity.getId()); - // mdmModuleDistributeEntity.setSts("Y"); - // mdmModuleDistributeEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDistributeEntity.setModify_time(new Date()); - // mdmModuleDistributeDao.logicRemoveMultiCondition(mdmModuleDistributeEntity); + // - // MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity(); - // mdmModuleDistributeDetailEntity.setMdmId(entity.getId()); - // mdmModuleDistributeDetailEntity.setSts("Y"); - // mdmModuleDistributeDetailEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDistributeDetailEntity.setModify_time(new Date()); - // mdmModuleDistributeDetailDao.logicRemoveMultiCondition(mdmModuleDistributeDetailEntity); + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据列表显示 树、查询条件、列表字段、按钮 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmShow(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询模版 + MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); + if(mdmModuleEntity == null || mdmModuleEntity.getId() == null){ + return BaseResult.getFailureMessageEntity("系统错误"); + } + + //设置模版 + MdmViewVo mdmViewVo = new MdmViewVo(); + mdmViewVo.setMdmModuleEntity(mdmModuleEntity); + //查询展示类型 + MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity(); + mdmModuleViewEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleViewEntity.setSts("Y"); + List moduleViewEntityList = mdmServiceCache.queryMdmModuleView(mdmModuleViewEntity); + if (moduleViewEntityList == null || moduleViewEntityList.size() != 1) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + mdmModuleViewEntity = moduleViewEntityList.get(0); + mdmViewVo.setMdmModuleViewEntity(mdmModuleViewEntity); + + //查询数据源主表 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询数据源表下面的字段 + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbFiledsEntity.setSts("Y"); + List mdmModuleDbFiledsEntityList = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity); + if (mdmModuleDbFiledsEntityList == null || mdmModuleDbFiledsEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询字段下的规则 + MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); + mdmModuleDbFiledsRuleEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbFiledsRuleEntity.setSts("Y"); + List mdmModuleDbFiledsRuleEntityList = mdmServiceCache.queryMdmModuleDbFiledsRule(mdmModuleDbFiledsRuleEntity); + if (mdmModuleDbFiledsRuleEntityList == null || mdmModuleDbFiledsRuleEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + + //查询设置的查询字段 + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleViewDetailEntity.setSts("Y"); + List mdmModuleViewDetailEntities = mdmServiceCache.queryMdmModuleViewDetail(mdmModuleViewDetailEntity); + if (mdmModuleViewDetailEntities == null || mdmModuleViewDetailEntities.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + List queryList = getFiledByType("1",mdmModuleViewDetailEntities,mdmModuleDbEntityList,mdmModuleDbFiledsEntityList,mdmModuleDbFiledsRuleEntityList); + mdmViewVo.setQueryList(queryList); + 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 mdmModuleDbFiledsRuleEntityList 字段规则 + * @return java.util.List + **/ + private List getFiledByType(String viewType, List mdmModuleViewDetailEntities, List mdmModuleDbEntityList, List mdmModuleDbFiledsEntityList, List mdmModuleDbFiledsRuleEntityList) { + List mdmViewFiledVos = new ArrayList<>(); + if(mdmModuleViewDetailEntities != null && mdmModuleViewDetailEntities.size() > 0){ + for (int i = 0; i < mdmModuleViewDetailEntities.size(); i++) { + 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())){ + for (int i2 = 0; i2 < mdmModuleDbEntityList.size(); i2++) { + 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()); + mdmViewFiledVo.setDbId(mdmModuleDbEntityList.get(i2).getId()); + + break; + } + } + mdmViewFiledVo.setChName(mdmModuleDbFiledsEntityList.get(i1).getChName()); + mdmViewFiledVo.setEnName(mdmModuleDbFiledsEntityList.get(i1).getEnName()); + mdmViewFiledVo.setFiledType(mdmModuleDbFiledsEntityList.get(i1).getFiledType()); + //字段规则 + 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())){ + ruleList.add(mdmModuleDbFiledsRuleEntityList.get(i2)); + } + } + mdmViewFiledVo.setRuleList(ruleList); + } + break; + } + } + } + } + } + if(mdmViewFiledVos != null && mdmViewFiledVos.size() > 0){ + for (int i = 0; i < mdmViewFiledVos.size(); i++) { + mdmViewFiledVos.get(i).setSorts(i); + } + } + return mdmViewFiledVos; + } // - // //保存主数据 - // List mdmModuleDistributeEntities = entity.getMdmModuleDistributeEntities(); - // - // if (mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() > 0) { - // for (int i = 0; i < mdmModuleDistributeEntities.size(); i++) { - // MdmModuleDistributeEntity moduleDistributeEntity = mdmModuleDistributeEntities.get(i); - // moduleDistributeEntity.setMdmId(entity.getId()); - // moduleDistributeEntity.setSts("Y"); - // moduleDistributeEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // moduleDistributeEntity.setModify_time(new Date()); - // if (moduleDistributeEntity.getId() != null && !"".equals(moduleDistributeEntity.getId())) { - // //修改 - // mdmModuleDistributeDao.update(moduleDistributeEntity); - // } else { - // //新增 - // moduleDistributeEntity.setId(UUIDUtils.getUUID()); - // moduleDistributeEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); - // moduleDistributeEntity.setCreate_time(new Date()); - // mdmModuleDistributeDao.save(moduleDistributeEntity); - // } - // if (moduleDistributeEntity.getAddList() != null && moduleDistributeEntity.getAddList().size() > 0) { - // for (int i1 = 0; i1 < moduleDistributeEntity.getAddList().size(); i1++) { - // MdmModuleDistributeDetailEntity moduleDistributeDetailEntity = moduleDistributeEntity.getAddList().get(i1); - // moduleDistributeDetailEntity.setMdmId(entity.getId()); - // moduleDistributeDetailEntity.setSts("Y"); - // moduleDistributeDetailEntity.setApiId(moduleDistributeEntity.getAddApi()); - // moduleDistributeDetailEntity.setDistributeId(moduleDistributeEntity.getId()); - // moduleDistributeDetailEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // moduleDistributeDetailEntity.setModify_time(new Date()); - // if (moduleDistributeDetailEntity.getId() != null && !"".equals(moduleDistributeDetailEntity.getId())) { - // //修改 - // mdmModuleDistributeDetailDao.update(moduleDistributeDetailEntity); - // } else { - // //新增 - // moduleDistributeDetailEntity.setId(UUIDUtils.getUUID()); - // moduleDistributeDetailEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); - // moduleDistributeDetailEntity.setCreate_time(new Date()); - // mdmModuleDistributeDetailDao.save(moduleDistributeDetailEntity); - // } - // } - // } - // if (moduleDistributeEntity.getDeleteList() != null && moduleDistributeEntity.getDeleteList().size() > 0) { - // for (int i1 = 0; i1 < moduleDistributeEntity.getDeleteList().size(); i1++) { - // MdmModuleDistributeDetailEntity moduleDistributeDetailEntity = moduleDistributeEntity.getDeleteList().get(i1); - // moduleDistributeDetailEntity.setMdmId(entity.getId()); - // moduleDistributeDetailEntity.setSts("Y"); - // moduleDistributeDetailEntity.setApiId(moduleDistributeEntity.getDeleteApi()); - // moduleDistributeDetailEntity.setDistributeId(moduleDistributeEntity.getId()); - // moduleDistributeDetailEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // moduleDistributeDetailEntity.setModify_time(new Date()); - // if (moduleDistributeDetailEntity.getId() != null && !"".equals(moduleDistributeDetailEntity.getId())) { - // //修改 - // mdmModuleDistributeDetailDao.update(moduleDistributeDetailEntity); - // } else { - // //新增 - // moduleDistributeDetailEntity.setId(UUIDUtils.getUUID()); - // moduleDistributeDetailEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); - // moduleDistributeDetailEntity.setCreate_time(new Date()); - // mdmModuleDistributeDetailDao.save(moduleDistributeDetailEntity); - // } - // } - // } - // } - // } - // return BaseResult.getSuccessMessageEntity("保存发布设置成功"); - //} - // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据列表显示 树、查询条件、列表字段、按钮 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmShow(JSONObject object) { - // MdmDto entity = getData("jsonStr", object, MdmDto.class); - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询模版 - // MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); - // mdmModuleEntity.setMdmCode(entity.getMdmCode()); - // mdmModuleEntity.setSts("Y"); - // List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); - // if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // - // MdmViewVo mdmViewVo = new MdmViewVo(); - // mdmModuleEntity = mdmModuleEntities.get(0); - // mdmViewVo.setMdmModuleEntity(mdmModuleEntity); - // //查询展示类型 - // MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity(); - // mdmModuleViewEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleViewEntity.setSts("Y"); - // List moduleViewEntityList = mdmModuleViewDao.queryBase(mdmModuleViewEntity); - // if (moduleViewEntityList == null || moduleViewEntityList.size() != 1) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // mdmModuleViewEntity = moduleViewEntityList.get(0); - // mdmViewVo.setMdmModuleViewEntity(mdmModuleViewEntity); - // - // //查询数据源主表 - // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - // mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbEntity.setSts("Y"); - // List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); - // if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询数据源表下面的字段 - // MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); - // mdmModuleDbFiledsEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbFiledsEntity.setSts("Y"); - // List mdmModuleDbFiledsEntityList = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); - // if (mdmModuleDbFiledsEntityList == null || mdmModuleDbFiledsEntityList.size() == 0) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询字段下的规则 - // MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); - // mdmModuleDbFiledsRuleEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbFiledsRuleEntity.setSts("Y"); - // List mdmModuleDbFiledsRuleEntityList = mdmModuleDbFiledsRuleDao.queryBase(mdmModuleDbFiledsRuleEntity); - // if (mdmModuleDbFiledsRuleEntityList == null || mdmModuleDbFiledsRuleEntityList.size() == 0) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询设置的查询字段 - // MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); - // mdmModuleViewDetailEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleViewDetailEntity.setSts("Y"); - // mdmModuleViewDetailEntity.setViewType("1"); - // List queryList = mdmModuleViewDetailDao.queryBase(mdmModuleViewDetailEntity); - // //设置字段 - // List queryListVo = setQueryList(mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList, queryList, false); - // mdmViewVo.setQueryList(queryListVo); - // - // //查询用户设置字段 - // MdmModuleUserViewEntity mdmModuleUserViewEntity = new MdmModuleUserViewEntity(); - // mdmModuleUserViewEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleUserViewEntity.setSts("Y"); - // mdmModuleUserViewEntity.setUserId(StpUtil.getLoginIdAsString()); - // List mdmModuleUserViewEntities = mdmModuleUserViewDao.queryBase(mdmModuleUserViewEntity); - // - // //查询设置的查询字段 - // MdmModuleViewDetailEntity mdmModuleViewDetailEntity1 = new MdmModuleViewDetailEntity(); - // mdmModuleViewDetailEntity1.setMdmId(mdmModuleEntity.getId()); - // mdmModuleViewDetailEntity1.setSts("Y"); - // mdmModuleViewDetailEntity1.setViewType("2"); - // List listList = mdmModuleViewDetailDao.queryBase(mdmModuleViewDetailEntity1); - // List dolistList = new ArrayList<>(); - // - // if (mdmModuleUserViewEntities != null && mdmModuleUserViewEntities.size() > 0) { - // dolistList = getDolist(listList, mdmModuleUserViewEntities); - // if (dolistList == null || dolistList.size() == 0) { - // dolistList = listList; - // } - // } else { - // dolistList = listList; - // } - // List listListVo = setQueryList(mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList, dolistList, true); - // mdmViewVo.setListList(listListVo); - // - // List buttonList = new ArrayList<>(); - // buttonList.add(new MdmViewButtonVo("new", "新建")); - // buttonList.add(new MdmViewButtonVo("resize", "重置")); - // buttonList.add(new MdmViewButtonVo("search", "查询")); - // buttonList.add(new MdmViewButtonVo("edit", "修改")); - // buttonList.add(new MdmViewButtonVo("dele", "删除")); - // buttonList.add(new MdmViewButtonVo("view", "查看")); - // buttonList.add(new MdmViewButtonVo("send", "下发")); - // mdmViewVo.setButtonList(buttonList); - // return BaseResult.getSuccessMessageEntity("获取字段成功", mdmViewVo); - //} - // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据查询所有字段 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmShowAll(JSONObject object) { - // MdmDto entity = getData("jsonStr", object, MdmDto.class); - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getId() == null || "".equals(entity.getId())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询设置各种类型字段 - // //查询模版数据源 - // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - // mdmModuleDbEntity.setMdmId(entity.getId()); - // mdmModuleDbEntity.setSts("Y"); - // List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); - // List listFiled = new ArrayList<>(); - // if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { - // MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); - // mdmModuleDbFiledsEntity.setMdmId(entity.getId()); - // mdmModuleDbFiledsEntity.setSts("Y"); - // List mdmModuleDbFiledsEntityList = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); - // // - // if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { - // for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { - // if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { - // for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { - // if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { - // if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { - // //1、主表 - // listFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - // } else { - // //2、明细 - // listFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - // } - // } - // } - // } - // } - // } - // } - // return BaseResult.getSuccessMessageEntity("查询视图成功", listFiled); - //} + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据查询所有字段 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmShowAll(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询设置各种类型字段 + MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); + //查询模版数据源 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + List listFiled = new ArrayList<>(); + if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbFiledsEntity.setSts("Y"); + List mdmModuleDbFiledsEntityList = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity); + // + 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 (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { + for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { + if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + //1、主表 + listFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } else { + //2、明细 + listFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } + } + } + } + } + } + } + } + return BaseResult.getSuccessMessageEntity("查询视图成功", listFiled); + } // ///** // * @param mdmModuleRoleButtonEntities @@ -2572,28 +2839,28 @@ public class MdmServiceImpl implements IMdmService { // mdmViewFiledVos.add(mdmViewFiledVo); //} // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据列表显示 业务数据 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmShowData(JSONObject object) { - // MdmQuery entity = getData("jsonStr", object, MdmQuery.class); - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // //判断分页 - // if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { - // return BaseResult.getFailureMessageEntity("分页查询参数不存在"); - // } - // PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); - // List> businessResult = mdmModuleDao.queryMdmShowData(entity); - // PageInfo pageInfo = new PageInfo(businessResult); - // return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); - //} + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据列表显示 业务数据 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmShowData(JSONObject object) { + MdmQuery entity = getData("jsonStr", object, MdmQuery.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + //判断分页 + if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List> businessResult = mdmModuleDao.queryMdmShowData(entity); + PageInfo pageInfo = new PageInfo(businessResult); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } // ///** // * @param object @@ -2678,143 +2945,147 @@ public class MdmServiceImpl implements IMdmService { // return BaseResult.getSuccessMessageEntity("查询数据成功", returnData); //} // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 查询数据(list 或者 分页) - // * @Date 1:33 下午 2023/7/12 - // **/ - //@Override - //public JsonResultEntity queryTemplateData(JSONObject object) { - // MdmDto entity = getData("jsonStr", object, MdmDto.class); - // //校验是否有servecr传参 - // if (!checkStr(entity.getTableName())) { - // return BaseResult.getFailureMessageEntity("请先传递服务名"); - // } - // if (!checkStr(entity.getValue())) { - // return BaseResult.getFailureMessageEntity("请先传递存储字段"); - // } - // if (!checkStr(entity.getLabel())) { - // return BaseResult.getFailureMessageEntity("请先传递显示字段"); - // } - // if (entity.getPageNum() != null && entity.getPageSize() != null) { - // PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); - // List> mapList = mdmModuleDao.querySelectData(entity); - // PageInfo pageInfo = new PageInfo(mapList); - // return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); - // } else { - // List> mapList = mdmModuleDao.querySelectData(entity); - // return BaseResult.getSuccessMessageEntity("查询数据成功", mapList); - // } - //} + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询数据(list 或者 分页) + * @Date 1:33 下午 2023/7/12 + **/ + @Override + public JsonResultEntity queryTemplateData(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + //校验是否有servecr传参 + if (!checkStr(entity.getTableName())) { + return BaseResult.getFailureMessageEntity("请先传递服务名"); + } + if (!checkStr(entity.getValue())) { + return BaseResult.getFailureMessageEntity("请先传递存储字段"); + } + if (!checkStr(entity.getLabel())) { + return BaseResult.getFailureMessageEntity("请先传递显示字段"); + } + if (entity.getPageNum() != null && entity.getPageSize() != null) { + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List> mapList = mdmModuleDao.querySelectData(entity); + PageInfo pageInfo = new PageInfo(mapList); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } else { + List> mapList = mdmModuleDao.querySelectData(entity); + return BaseResult.getSuccessMessageEntity("查询数据成功", mapList); + } + } // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 业务数据树形结构,数据查询 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmShowTreeData(JSONObject object) { - // MdmDto entity = getData("jsonStr", object, MdmDto.class); - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // //if (entity.getTableName() == null || "".equals(entity.getTableName())) { - // // return BaseResult.getFailureMessageEntity("系统错误"); - // //} - // if (entity.getLabel() == null || "".equals(entity.getLabel())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // if (entity.getUpId() == null || "".equals(entity.getUpId())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // if (entity.getMdmCode() != null && !"".equals(entity.getMdmCode())) { - // //查询模版 - // MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); - // mdmModuleEntity.setMdmCode(entity.getMdmCode()); - // mdmModuleEntity.setSts("Y"); - // List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); - // if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询数据源主表 - // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - // mdmModuleDbEntity.setMdmId(mdmModuleEntities.get(0).getId()); - // mdmModuleDbEntity.setDbType("1"); - // mdmModuleDbEntity.setSts("Y"); - // List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); - // if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // mdmModuleDbEntity = mdmModuleDbEntityList.get(0); - // entity.setTableName(mdmModuleDbEntity.getDbName()); - // } + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 业务数据树形结构,数据查询 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmShowTreeData(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + //if (entity.getTableName() == null || "".equals(entity.getTableName())) { + // return BaseResult.getFailureMessageEntity("系统错误"); + //} + if (entity.getLabel() == null || "".equals(entity.getLabel())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + 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; + } + } + entity.setTableName(mdmModuleDbEntity.getDbName()); + + + + if (checkStr(entity.getId())) { + if (!checkStr(entity.getValue())) { + return BaseResult.getFailureMessageEntity("请先传递存储字段"); + } + if (entity.getId().contains(",")) { + String[] strArray = entity.getId().split(","); // 使用逗号和空格作为分隔符 + entity.setIds(strArray); + List> mapList = mdmModuleDao.queryTemplateDataMore(entity); + if (mapList == null || mapList.size() == 0) { + List> returnList = new ArrayList<>(); + return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); + } + List> returnList = gettochilder(strArray, 0, mapList); + return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); + } else { + HashMap mapList = mdmModuleDao.queryTemplateDataOne(entity); + if (mapList == null || mapList.size() == 0) { + List> returnList = new ArrayList<>(); + return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); + } + List> returnList = new ArrayList<>(); + returnList.add(mapList); + return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); + } + } else { + List> mapList = mdmModuleDao.queryDataAll(entity); + List> returnList = new ArrayList<>(); + + if (mapList != null && mapList.size() > 0) { + for (int i = 0; i < mapList.size(); i++) { + //默认为根 + if (mapList.get(i).get(entity.getUpId()) == null || "".equals(mapList.get(i).get(entity.getUpId()))) { + List> children = getchilder(mapList.get(i).get("qsdfg").toString(), mapList, entity); + HashMap re = new HashMap<>(); + re.put("id", mapList.get(i).get("qsdfg")); + re.put("label", mapList.get(i).get(entity.getLabel())); + re.put("upID", mapList.get(i).get(entity.getUpId())); + if (children != null && children.size() > 0) { + re.put("children", children); + } + returnList.add(re); + } + } + } + return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); + } + } // - // - // if (checkStr(entity.getId())) { - // if (!checkStr(entity.getValue())) { - // return BaseResult.getFailureMessageEntity("请先传递存储字段"); - // } - // if (entity.getId().contains(",")) { - // String[] strArray = entity.getId().split(","); // 使用逗号和空格作为分隔符 - // entity.setIds(strArray); - // List> mapList = mdmModuleDao.queryTemplateDataMore(entity); - // if (mapList == null || mapList.size() == 0) { - // List> returnList = new ArrayList<>(); - // return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); - // } - // List> returnList = gettochilder(strArray, 0, mapList); - // return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); - // } else { - // HashMap mapList = mdmModuleDao.queryTemplateDataOne(entity); - // if (mapList == null || mapList.size() == 0) { - // List> returnList = new ArrayList<>(); - // return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); - // } - // List> returnList = new ArrayList<>(); - // returnList.add(mapList); - // return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); - // } - // } else { - // List> mapList = mdmModuleDao.queryDataAll(entity); - // List> returnList = new ArrayList<>(); - // - // if (mapList != null && mapList.size() > 0) { - // for (int i = 0; i < mapList.size(); i++) { - // //默认为根 - // if (mapList.get(i).get(entity.getUpId()) == null || "".equals(mapList.get(i).get(entity.getUpId()))) { - // List> children = getchilder(mapList.get(i).get("qsdfg").toString(), mapList, entity); - // HashMap re = new HashMap<>(); - // re.put("id", mapList.get(i).get("qsdfg")); - // re.put("label", mapList.get(i).get(entity.getLabel())); - // re.put("upID", mapList.get(i).get(entity.getUpId())); - // if (children != null && children.size() > 0) { - // re.put("children", children); - // } - // returnList.add(re); - // } - // } - // } - // return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); - // } - //} - // - //private List> gettochilder(String[] strArray, int i, List> mapList) { - // List> maps = new ArrayList<>(); - // for (int i1 = 0; i1 < mapList.size(); i1++) { - // if (strArray[i].equals(mapList.get(i1).get("id").toString())) { - // if (strArray.length >= (i + 2)) { - // mapList.get(i1).put("children", gettochilder(strArray, i + 1, mapList)); - // } - // maps.add(mapList.get(i1)); - // break; - // } - // } - // return maps; - //} + private List> gettochilder(String[] strArray, int i, List> mapList) { + List> maps = new ArrayList<>(); + for (int i1 = 0; i1 < mapList.size(); i1++) { + if (strArray[i].equals(mapList.get(i1).get("id").toString())) { + if (strArray.length >= (i + 2)) { + mapList.get(i1).put("children", gettochilder(strArray, i + 1, mapList)); + } + maps.add(mapList.get(i1)); + break; + } + } + return maps; + } // //private HashMap getFathers(List> mapListAll, HashMap mapList, MdmDto entity) { // if (mapList.get("upID") == null) { @@ -2839,198 +3110,202 @@ public class MdmServiceImpl implements IMdmService { // return a; //} // - //private List> getchilder(String stringObjectHashMap, List> mapList, MdmDto entity) { - // List> returnList = new ArrayList<>(); - // if (mapList != null && mapList.size() > 0) { - // for (int i = 0; i < mapList.size(); i++) { - // //等于上级id的时候 - // if (stringObjectHashMap.equals(mapList.get(i).get(entity.getUpId()))) { - // List> children = getchilder(mapList.get(i).get(entity.getUpId()) + "," + mapList.get(i).get("qsdfg"), mapList, entity); - // HashMap re = new HashMap<>(); - // re.put("id", mapList.get(i).get("qsdfg")); - // re.put("label", mapList.get(i).get(entity.getLabel())); - // re.put("upID", mapList.get(i).get(entity.getUpId())); - // if (children != null && children.size() > 0) { - // re.put("children", children); - // } - // returnList.add(re); - // } - // } - // } - // return returnList; - //} + private List> getchilder(String stringObjectHashMap, List> mapList, MdmDto entity) { + List> returnList = new ArrayList<>(); + if (mapList != null && mapList.size() > 0) { + for (int i = 0; i < mapList.size(); i++) { + //等于上级id的时候 + if (stringObjectHashMap.equals(mapList.get(i).get(entity.getUpId()))) { + List> children = getchilder(mapList.get(i).get(entity.getUpId()) + "," + mapList.get(i).get("qsdfg"), mapList, entity); + HashMap re = new HashMap<>(); + re.put("id", mapList.get(i).get("qsdfg")); + re.put("label", mapList.get(i).get(entity.getLabel())); + re.put("upID", mapList.get(i).get(entity.getUpId())); + if (children != null && children.size() > 0) { + re.put("children", children); + } + returnList.add(re); + } + } + } + return returnList; + } // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据详情 区分类型 新增、修改、查看 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmShowDetails(JSONObject object) { - // MdmDto entity = getData("jsonStr", object, MdmDto.class); - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // if (entity.getShowType() == null || "".equals(entity.getShowType())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询模版 - // MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); - // mdmModuleEntity.setMdmCode(entity.getMdmCode()); - // mdmModuleEntity.setSts("Y"); - // List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); - // if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // MdmDetailViewVo mdmViewVo = new MdmDetailViewVo(); - // mdmModuleEntity = mdmModuleEntities.get(0); - // mdmViewVo.setMdmModuleEntity(mdmModuleEntity); - // - // //查询数据源主表 - // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - // mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbEntity.setSts("Y"); - // List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); - // if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询数据源表下面的字段 - // MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); - // mdmModuleDbFiledsEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbFiledsEntity.setSts("Y"); - // List mdmModuleDbFiledsEntityList = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); - // if (mdmModuleDbFiledsEntityList == null || mdmModuleDbFiledsEntityList.size() == 0) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询字段下的规则 - // MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); - // mdmModuleDbFiledsRuleEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbFiledsRuleEntity.setSts("Y"); - // List mdmModuleDbFiledsRuleEntityList = mdmModuleDbFiledsRuleDao.queryBase(mdmModuleDbFiledsRuleEntity); - // if (mdmModuleDbFiledsRuleEntityList == null || mdmModuleDbFiledsRuleEntityList.size() == 0) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); - // mdmModuleViewDetailEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleViewDetailEntity.setSts("Y"); - // mdmModuleViewDetailEntity.setViewType(entity.getShowType());//设置显示字段类型 - // List mdmModuleViewDetailEntityList = mdmModuleViewDetailDao.queryBase(mdmModuleViewDetailEntity); - // //组装数据 - // assembleMdmShowDetails(mdmViewVo, mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList, mdmModuleViewDetailEntityList, entity.getShowType()); - // return BaseResult.getSuccessMessageEntity("获取字段成功", mdmViewVo); - //} - // - ///** - // * @param mdmViewVo 返回对象 - // * @param mdmModuleDbEntityList 数据源表 - // * @param mdmModuleDbFiledsEntityList 数据源字段 - // * @param mdmModuleDbFiledsRuleEntityList 数据源字段规则 - // * @param mdmModuleViewDetailEntityList 数据源显示字段 - // * @return void - // * @Author lvleigang - // * @Description 组装显示字段 - // * @Date 9:10 上午 2023/11/6 - // **/ - //private void assembleMdmShowDetails(MdmDetailViewVo mdmViewVo, List mdmModuleDbEntityList, List mdmModuleDbFiledsEntityList, List mdmModuleDbFiledsRuleEntityList, List mdmModuleViewDetailEntityList, String showType) { - // //主数据主表 - // MdmModuleDbEntity mainMdmModuleDb = new MdmModuleDbEntity(); - // List mainMdmModuleDbFileds = new ArrayList<>(); - // //主数据子表 - // List sublistMdmModuleDb = new ArrayList<>(); - // - // if (mdmModuleViewDetailEntityList != null && mdmModuleViewDetailEntityList.size() > 0) { - // //先循环数据源表,设置出数据字段 - // for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { - // if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { - // //1、主表 2、明细 - // mainMdmModuleDb = mdmModuleDbEntityList.get(i); - // //循环字段表 - // if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { - // for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { - // if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { - // for (int b = 0; b < mdmModuleViewDetailEntityList.size(); b++) { - // if (mdmModuleViewDetailEntityList.get(b).getViewFiled().equals(mdmModuleDbFiledsEntityList.get(i1).getId())) { - // mainMdmModuleDbFileds.add(mdmModuleDbFiledsEntityList.get(i1)); - // List mdmModuleDbFiledsRules = new ArrayList<>(); - // //循环字段属性 - // if (mdmModuleDbFiledsRuleEntityList != null && mdmModuleDbFiledsRuleEntityList.size() > 0) { - // for (int i2 = 0; i2 < mdmModuleDbFiledsRuleEntityList.size(); i2++) { - // if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getDbId()) - // && mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getFiledId())) { - // mdmModuleDbFiledsRules.add(mdmModuleDbFiledsRuleEntityList.get(i2)); - // } - // } - // } - // mdmModuleDbFiledsEntityList.get(i1).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRules); - // } - // } - // } - // } - // } - // } else if ("2".equals(mdmModuleDbEntityList.get(i).getDbType())) { - // //2、明细 - // sublistMdmModuleDb.add(mdmModuleDbEntityList.get(i)); - // //循环字段表 - // if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { - // List sublistMdmModuleDbFileds = new ArrayList<>(); - // for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { - // if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { - // for (int b = 0; b < mdmModuleViewDetailEntityList.size(); b++) { - // if (mdmModuleViewDetailEntityList.get(b).getViewFiled().equals(mdmModuleDbFiledsEntityList.get(i1).getId())) { - // sublistMdmModuleDbFileds.add(mdmModuleDbFiledsEntityList.get(i1)); - // List mdmModuleDbFiledsRules = new ArrayList<>(); - // //循环字段属性 - // if (mdmModuleDbFiledsRuleEntityList != null && mdmModuleDbFiledsRuleEntityList.size() > 0) { - // for (int i2 = 0; i2 < mdmModuleDbFiledsRuleEntityList.size(); i2++) { - // if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getDbId()) - // && mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getFiledId())) { - // mdmModuleDbFiledsRules.add(mdmModuleDbFiledsRuleEntityList.get(i2)); - // } - // } - // } - // mdmModuleDbFiledsEntityList.get(i1).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRules); - // } - // } - // - // } - // } - // mdmModuleDbEntityList.get(i).setSublistMdmModuleDbFileds(sublistMdmModuleDbFileds); - // } - // } - // } - // mainMdmModuleDb.setSublistMdmModuleDbFileds(mainMdmModuleDbFileds); - // mdmViewVo.setMainMdmModuleDb(mainMdmModuleDb); - // //主数据子表 - // List mdmModuleDb = new ArrayList<>(); - // if (sublistMdmModuleDb != null && sublistMdmModuleDb.size() > 0) { - // for (int i = 0; i < sublistMdmModuleDb.size(); i++) { - // if (sublistMdmModuleDb.get(i).getSublistMdmModuleDbFileds() != null && sublistMdmModuleDb.get(i).getSublistMdmModuleDbFileds().size() > 0) { - // mdmModuleDb.add(sublistMdmModuleDb.get(i)); - // } - // } - // } - // if ("5".equals(showType)) { - // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - // mdmModuleDbEntity.setDbName(mainMdmModuleDb.getDbName() + "_distribute"); - // mdmModuleDbEntity.setRemark(mainMdmModuleDb.getRemark() + "分发表"); - // mdmModuleDbEntity.setDbType("2"); - // List mdmModuleDbFiledsEntityList1 = getDistributeRole(); - // mdmModuleDbEntity.setSublistMdmModuleDbFileds(mdmModuleDbFiledsEntityList1); - // mdmModuleDb.add(mdmModuleDbEntity); - // } - // mdmViewVo.setSublistMdmModuleDb(mdmModuleDb); - // - // - // } else { - // mdmViewVo.setMainMdmModuleDb(mainMdmModuleDb); - // mdmViewVo.setSublistMdmModuleDb(sublistMdmModuleDb); - // } - //} + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情 区分类型 新增、修改、查看 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmShowDetails(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getShowType() == null || "".equals(entity.getShowType())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询模版 + //List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); + MdmModuleEntity mdmModuleEntities = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); + if (mdmModuleEntities == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmDetailViewVo mdmViewVo = new MdmDetailViewVo(); + mdmViewVo.setMdmModuleEntity(mdmModuleEntities); + + //查询数据源主表 + 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("系统错误"); + } + //查询数据源表下面的字段 + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setMdmId(mdmModuleEntities.getId()); + mdmModuleDbFiledsEntity.setSts("Y"); + List mdmModuleDbFiledsEntityList = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity); + if (mdmModuleDbFiledsEntityList == null || mdmModuleDbFiledsEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询字段下的规则 + MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); + mdmModuleDbFiledsRuleEntity.setMdmId(mdmModuleEntities.getId()); + mdmModuleDbFiledsRuleEntity.setSts("Y"); + List mdmModuleDbFiledsRuleEntityList = mdmServiceCache.queryMdmModuleDbFiledsRule(mdmModuleDbFiledsRuleEntity); + if (mdmModuleDbFiledsRuleEntityList == null || mdmModuleDbFiledsRuleEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setMdmId(mdmModuleEntities.getId()); + mdmModuleViewDetailEntity.setSts("Y"); + mdmModuleViewDetailEntity.setViewType(entity.getShowType());//设置显示字段类型 + List queryAll = mdmModuleViewDetailDao.queryBase(mdmModuleViewDetailEntity); + List mdmModuleViewDetailEntityList = new ArrayList<>(); + if(queryAll != null && queryAll.size() > 0){ + for (int i = 0; i < queryAll.size(); i++) { + if(entity.getShowType().equals(queryAll.get(i).getViewType())){ + mdmModuleViewDetailEntityList.add(queryAll.get(i)); + } + } + } + //组装数据 + assembleMdmShowDetails(mdmViewVo, mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList, mdmModuleViewDetailEntityList, entity.getShowType()); + return BaseResult.getSuccessMessageEntity("获取字段成功", mdmViewVo); + } + + /** + * @param mdmViewVo 返回对象 + * @param mdmModuleDbEntityList 数据源表 + * @param mdmModuleDbFiledsEntityList 数据源字段 + * @param mdmModuleDbFiledsRuleEntityList 数据源字段规则 + * @param mdmModuleViewDetailEntityList 数据源显示字段 + * @return void + * @Author lvleigang + * @Description 组装显示字段 + * @Date 9:10 上午 2023/11/6 + **/ + private void assembleMdmShowDetails(MdmDetailViewVo mdmViewVo, List mdmModuleDbEntityList, List mdmModuleDbFiledsEntityList, List mdmModuleDbFiledsRuleEntityList, List mdmModuleViewDetailEntityList, String showType) { + //主数据主表 + MdmModuleDbEntity mainMdmModuleDb = new MdmModuleDbEntity(); + List mainMdmModuleDbFileds = new ArrayList<>(); + //主数据子表 + List sublistMdmModuleDb = new ArrayList<>(); + + if (mdmModuleViewDetailEntityList != null && mdmModuleViewDetailEntityList.size() > 0) { + //先循环数据源表,设置出数据字段 + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + //1、主表 2、明细 + mainMdmModuleDb = mdmModuleDbEntityList.get(i); + //循环字段表 + if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { + for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { + if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { + for (int b = 0; b < mdmModuleViewDetailEntityList.size(); b++) { + if (mdmModuleViewDetailEntityList.get(b).getViewFiled().equals(mdmModuleDbFiledsEntityList.get(i1).getId())) { + mainMdmModuleDbFileds.add(mdmModuleDbFiledsEntityList.get(i1)); + List mdmModuleDbFiledsRules = new ArrayList<>(); + //循环字段属性 + if (mdmModuleDbFiledsRuleEntityList != null && mdmModuleDbFiledsRuleEntityList.size() > 0) { + for (int i2 = 0; i2 < mdmModuleDbFiledsRuleEntityList.size(); i2++) { + if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getDbId()) + && mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getFiledId())) { + mdmModuleDbFiledsRules.add(mdmModuleDbFiledsRuleEntityList.get(i2)); + } + } + } + mdmModuleDbFiledsEntityList.get(i1).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRules); + } + } + } + } + } + } else if ("2".equals(mdmModuleDbEntityList.get(i).getDbType())) { + //2、明细 + sublistMdmModuleDb.add(mdmModuleDbEntityList.get(i)); + //循环字段表 + if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { + List sublistMdmModuleDbFileds = new ArrayList<>(); + for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { + if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { + for (int b = 0; b < mdmModuleViewDetailEntityList.size(); b++) { + if (mdmModuleViewDetailEntityList.get(b).getViewFiled().equals(mdmModuleDbFiledsEntityList.get(i1).getId())) { + sublistMdmModuleDbFileds.add(mdmModuleDbFiledsEntityList.get(i1)); + List mdmModuleDbFiledsRules = new ArrayList<>(); + //循环字段属性 + if (mdmModuleDbFiledsRuleEntityList != null && mdmModuleDbFiledsRuleEntityList.size() > 0) { + for (int i2 = 0; i2 < mdmModuleDbFiledsRuleEntityList.size(); i2++) { + if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getDbId()) + && mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getFiledId())) { + mdmModuleDbFiledsRules.add(mdmModuleDbFiledsRuleEntityList.get(i2)); + } + } + } + mdmModuleDbFiledsEntityList.get(i1).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRules); + } + } + + } + } + mdmModuleDbEntityList.get(i).setSublistMdmModuleDbFileds(sublistMdmModuleDbFileds); + } + } + } + mainMdmModuleDb.setSublistMdmModuleDbFileds(mainMdmModuleDbFileds); + mdmViewVo.setMainMdmModuleDb(mainMdmModuleDb); + //主数据子表 + List mdmModuleDb = new ArrayList<>(); + if (sublistMdmModuleDb != null && sublistMdmModuleDb.size() > 0) { + for (int i = 0; i < sublistMdmModuleDb.size(); i++) { + if (sublistMdmModuleDb.get(i).getSublistMdmModuleDbFileds() != null && sublistMdmModuleDb.get(i).getSublistMdmModuleDbFileds().size() > 0) { + mdmModuleDb.add(sublistMdmModuleDb.get(i)); + } + } + } + //if ("5".equals(showType)) { + // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + // mdmModuleDbEntity.setDbName(mainMdmModuleDb.getDbName() + "_distribute"); + // mdmModuleDbEntity.setRemark(mainMdmModuleDb.getRemark() + "分发表"); + // mdmModuleDbEntity.setDbType("2"); + // List mdmModuleDbFiledsEntityList1 = getDistributeRole(); + // mdmModuleDbEntity.setSublistMdmModuleDbFileds(mdmModuleDbFiledsEntityList1); + // mdmModuleDb.add(mdmModuleDbEntity); + //} + mdmViewVo.setSublistMdmModuleDb(mdmModuleDb); + + } else { + mdmViewVo.setMainMdmModuleDb(mainMdmModuleDb); + mdmViewVo.setSublistMdmModuleDb(sublistMdmModuleDb); + } + } // //private List getDistributeRole() { // List mdmModuleDbFiledsEntityList = new ArrayList<>(); @@ -3210,248 +3485,239 @@ public class MdmServiceImpl implements IMdmService { // } //} // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据详情数据 区分类型 新增、修改、查看 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmShowDetailsData(JSONObject object) { - // MdmDto entity = getData("jsonStr", object, MdmDto.class); - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // if (entity.getId() == null || "".equals(entity.getId())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询模版 - // MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); - // mdmModuleEntity.setMdmCode(entity.getMdmCode()); - // mdmModuleEntity.setSts("Y"); - // List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); - // if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // mdmModuleEntity = mdmModuleEntities.get(0); - // //查询数据源主表 - // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - // mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbEntity.setSts("Y"); - // List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); - // if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // String tablename = null; - // JSONObject jsonObject = new JSONObject(); - // for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { - // //查询数据 - // Map queryData = new HashMap<>(); - // queryData.put("tableName", mdmModuleDbEntityList.get(i).getDbName());//表名 - // if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { - // queryData.put("detailFlag", false);//是否明细 - // queryData.put("id", entity.getId());//字段 - // HashMap datas = mdmModuleDbDao.getServiceDataById(queryData); - // jsonObject.put(mdmModuleDbEntityList.get(i).getDbName(), datas); - // tablename = mdmModuleDbEntityList.get(i).getDbName() + "_distribute"; - // } else { - // queryData.put("detailFlag", true);//是否明细 - // queryData.put("id", entity.getId());//字段 - // List> datas = mdmModuleDbDao.getServiceByFormmainId(queryData); - // jsonObject.put(mdmModuleDbEntityList.get(i).getDbName(), datas); - // } - // } - // if (tablename != null && !"".equals(tablename)) { - // Map queryData = new HashMap<>(); - // queryData.put("tableName", tablename);//表名 - // queryData.put("id", entity.getId());//字段 - // List> datas = mdmModuleDbDao.getServiceByDistributeId(queryData); - // jsonObject.put(tablename, datas); - // } + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情数据 区分类型 新增、修改、查看 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmShowDetailsData(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询模版 + + MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); + if (mdmModuleEntity == null ) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询数据源主表 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + String tablename = null; + JSONObject jsonObject = new JSONObject(); + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + //查询数据 + Map queryData = new HashMap<>(); + queryData.put("tableName", mdmModuleDbEntityList.get(i).getDbName());//表名 + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + queryData.put("detailFlag", false);//是否明细 + queryData.put("id", entity.getId());//字段 + HashMap datas = mdmModuleDbDao.getServiceDataById(queryData); + jsonObject.put(mdmModuleDbEntityList.get(i).getDbName(), datas); + tablename = mdmModuleDbEntityList.get(i).getDbName() + "_distribute"; + } else { + queryData.put("detailFlag", true);//是否明细 + queryData.put("id", entity.getId());//字段 + List> datas = mdmModuleDbDao.getServiceByFormmainId(queryData); + jsonObject.put(mdmModuleDbEntityList.get(i).getDbName(), datas); + } + } + if (tablename != null && !"".equals(tablename)) { + Map queryData = new HashMap<>(); + queryData.put("tableName", tablename);//表名 + queryData.put("id", entity.getId());//字段 + List> datas = mdmModuleDbDao.getServiceByDistributeId(queryData); + jsonObject.put(tablename, datas); + } + + + return BaseResult.getSuccessMessageEntity("获取数据成功", jsonObject); + } + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情数据修改 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity updateMdmShowDetailsData(JSONObject object) { + JSONObject jsonObject = getstrObj("jsonStr", object); + //校验是否有servecr传参 + if (!checkData(jsonObject, "mdmCode")) { + return BaseResult.getFailureMessageEntity("请先传递服务名"); + } + if (!checkData(jsonObject, "data")) { + return BaseResult.getFailureMessageEntity("请先传递要修改的数据"); + } + JSONObject saveData = jsonObject.getJSONObject("data"); + //校验唯一 + MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); + mdmModuleEntity.setMdmCode(jsonObject.getLong("mdmCode")); + mdmModuleEntity.setSts("Y"); + List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); + if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + mdmModuleEntity = mdmModuleEntities.get(0); + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); + if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + String res = checkDataOnly(jsonObject.getInteger("mdmCode"), saveData, true, mdmModuleEntity, mdmModuleDbEntityList); + + if (res == null || "".equals(res)) { + return BaseResult.getSuccessMessageEntity("修改数据成功"); + } else { + return BaseResult.getFailureMessageEntity(res); + } + } + + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情数据新增 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity saveMdmShowDetailsData(JSONObject object) { + JSONObject jsonObject = getstrObj("jsonStr", object); + //校验是否有servecr传参 + if (!checkData(jsonObject, "mdmCode")) { + return BaseResult.getFailureMessageEntity("请先传递服务名"); + } + if (!checkData(jsonObject, "data")) { + return BaseResult.getFailureMessageEntity("请先传递要修改的数据"); + } + JSONObject saveData = jsonObject.getJSONObject("data"); + //校验唯一 + MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); + mdmModuleEntity.setMdmCode(jsonObject.getLong("mdmCode")); + mdmModuleEntity.setSts("Y"); + List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); + if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + mdmModuleEntity = mdmModuleEntities.get(0); + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); + if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + String res = checkDataOnly(jsonObject.getInteger("mdmCode"), saveData, false, mdmModuleEntity, mdmModuleDbEntityList); + + if (res == null || "".equals(res)) { + return BaseResult.getSuccessMessageEntity("保存数据成功"); + } else { + return BaseResult.getFailureMessageEntity(res); + } + } // // - // return BaseResult.getSuccessMessageEntity("获取数据成功", jsonObject); - //} - // - // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据详情数据修改 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity updateMdmShowDetailsData(JSONObject object) { - // JSONObject jsonObject = getstrObj("jsonStr", object); - // //校验是否有servecr传参 - // if (!checkData(jsonObject, "mdmCode")) { - // return BaseResult.getFailureMessageEntity("请先传递服务名"); - // } - // if (!checkData(jsonObject, "data")) { - // return BaseResult.getFailureMessageEntity("请先传递要修改的数据"); - // } - // JSONObject saveData = jsonObject.getJSONObject("data"); - // //校验唯一 - // MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); - // mdmModuleEntity.setMdmCode(jsonObject.getInteger("mdmCode")); - // mdmModuleEntity.setSts("Y"); - // List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); - // if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // mdmModuleEntity = mdmModuleEntities.get(0); - // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - // mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbEntity.setSts("Y"); - // List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); - // if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // String res = checkDataOnly(jsonObject.getInteger("mdmCode"), saveData, true, mdmModuleEntity, mdmModuleDbEntityList); - // - // if (res == null || "".equals(res)) { - // return BaseResult.getSuccessMessageEntity("修改数据成功"); - // } else { - // return BaseResult.getFailureMessageEntity(res); - // } - //} - // - // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据详情数据新增 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity saveMdmShowDetailsData(JSONObject object) { - // JSONObject jsonObject = getstrObj("jsonStr", object); - // //校验是否有servecr传参 - // if (!checkData(jsonObject, "mdmCode")) { - // return BaseResult.getFailureMessageEntity("请先传递服务名"); - // } - // if (!checkData(jsonObject, "data")) { - // return BaseResult.getFailureMessageEntity("请先传递要修改的数据"); - // } - // JSONObject saveData = jsonObject.getJSONObject("data"); - // //校验唯一 - // MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); - // mdmModuleEntity.setMdmCode(jsonObject.getInteger("mdmCode")); - // mdmModuleEntity.setSts("Y"); - // List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); - // if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // mdmModuleEntity = mdmModuleEntities.get(0); - // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - // mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbEntity.setSts("Y"); - // List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); - // if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // String res = checkDataOnly(jsonObject.getInteger("mdmCode"), saveData, false, mdmModuleEntity, mdmModuleDbEntityList); - // - // if (res == null || "".equals(res)) { - // return BaseResult.getSuccessMessageEntity("保存数据成功"); - // } else { - // return BaseResult.getFailureMessageEntity(res); - // } - //} - // - // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据详情数据修改 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity deleteMdmShowDetailsData(JSONObject object) { - // JSONObject jsonObject = getstrObj("jsonStr", object); - // //校验是否有servecr传参 - // if (!checkData(jsonObject, "mdmCode")) { - // return BaseResult.getFailureMessageEntity("请先传递服务名"); - // } - // if (!checkData(jsonObject, "id")) { - // return BaseResult.getFailureMessageEntity("请先传递要删除的数据"); - // } - // //校验唯一 - // MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); - // mdmModuleEntity.setMdmCode(jsonObject.getInteger("mdmCode")); - // mdmModuleEntity.setSts("Y"); - // List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); - // if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // mdmModuleEntity = mdmModuleEntities.get(0); - // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - // mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbEntity.setSts("Y"); - // List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(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())) { - // - // //查询视图,如果树形,删除下级及子集 - // //查询展示类型 - // MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity(); - // mdmModuleViewEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleViewEntity.setSts("Y"); - // List moduleViewEntityList = mdmModuleViewDao.queryBase(mdmModuleViewEntity); - // if (moduleViewEntityList == null || moduleViewEntityList.size() != 1) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // mdmModuleViewEntity = moduleViewEntityList.get(0); - // - // - // //删除自己 - // FormmainDeleteDto formmainDeleteDto = new FormmainDeleteDto(); - // formmainDeleteDto.setId(jsonObject.getString("id")); - // formmainDeleteDto.setLoginId(StpUtil.getLoginIdAsString()); - // formmainDeleteDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); - // if (mdmModuleViewEntity != null && mdmModuleViewEntity.getViewName() != null && "1".equals(mdmModuleViewEntity.getViewName()) && - // mdmModuleViewEntity.getUpIdFiled() != null && !"".equals(mdmModuleViewEntity.getUpIdFiled())) { - // formmainDeleteDto.setUpIdFiled(mdmModuleViewEntity.getUpIdFiled()); - // - // Map queryData = new HashMap<>(); - // queryData.put("tableName", mdmModuleDbEntityList.get(i).getDbName());//表名 - // queryData.put("detailFlag", false);//是否明细 - // queryData.put("id", jsonObject.getString("id"));//字段 - // HashMap datas = mdmModuleDbDao.getServiceDataById(queryData); - // String upValue = null; - // if (datas != null && datas.get(mdmModuleViewEntity.getUpIdFiled()) != null) { - // upValue = datas.get(mdmModuleViewEntity.getUpIdFiled()).toString(); - // } - // if (upValue != null) { - // formmainDeleteDto.setUpIdFiledValue(upValue + "," + jsonObject.getString("id")); - // } else { - // formmainDeleteDto.setUpIdFiledValue(jsonObject.getString("id")); - // } - // mdmModuleDao.deleteChilder(formmainDeleteDto); - // } - // mdmModuleDao.deleteTemplateById(formmainDeleteDto); - // - // } else { - // //删除明细 - // FormmainDeleteDto formmainDeleteDto = new FormmainDeleteDto(); - // formmainDeleteDto.setFormmain_id(jsonObject.getString("id")); - // formmainDeleteDto.setLoginId(StpUtil.getLoginIdAsString()); - // formmainDeleteDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); - // mdmModuleDao.deleteTemplateById(formmainDeleteDto); - // } - // } - // return BaseResult.getSuccessMessageEntity("删除数据成功"); - //} + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情数据修改 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity deleteMdmShowDetailsData(JSONObject object) { + JSONObject jsonObject = getstrObj("jsonStr", object); + //校验是否有servecr传参 + if (!checkData(jsonObject, "mdmCode")) { + return BaseResult.getFailureMessageEntity("请先传递服务名"); + } + if (!checkData(jsonObject, "id")) { + return BaseResult.getFailureMessageEntity("请先传递要删除的数据"); + } + //校验唯一 + MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(jsonObject.getLong("mdmCode")); + if (mdmModuleEntity == null ) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.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())) { + + //查询视图,如果树形,删除下级及子集 + //查询展示类型 + MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity(); + mdmModuleViewEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleViewEntity.setSts("Y"); + List moduleViewEntityList = mdmServiceCache.queryMdmModuleView(mdmModuleViewEntity); + if (moduleViewEntityList == null || moduleViewEntityList.size() != 1) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + mdmModuleViewEntity = moduleViewEntityList.get(0); + + + //删除自己 + FormmainDeleteDto formmainDeleteDto = new FormmainDeleteDto(); + formmainDeleteDto.setId(jsonObject.getString("id")); + formmainDeleteDto.setLoginId(StpUtil.getLoginIdAsString()); + formmainDeleteDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); + if (mdmModuleViewEntity != null && mdmModuleViewEntity.getViewName() != null && "1".equals(mdmModuleViewEntity.getViewName()) && + mdmModuleViewEntity.getUpIdFiled() != null && !"".equals(mdmModuleViewEntity.getUpIdFiled())) { + formmainDeleteDto.setUpIdFiled(mdmModuleViewEntity.getUpIdFiled()); + + Map queryData = new HashMap<>(); + queryData.put("tableName", mdmModuleDbEntityList.get(i).getDbName());//表名 + queryData.put("detailFlag", false);//是否明细 + queryData.put("id", jsonObject.getString("id"));//字段 + HashMap datas = mdmModuleDbDao.getServiceDataById(queryData); + String upValue = null; + if (datas != null && datas.get(mdmModuleViewEntity.getUpIdFiled()) != null) { + upValue = datas.get(mdmModuleViewEntity.getUpIdFiled()).toString(); + } + if (upValue != null) { + formmainDeleteDto.setUpIdFiledValue(upValue + "," + jsonObject.getString("id")); + } else { + formmainDeleteDto.setUpIdFiledValue(jsonObject.getString("id")); + } + mdmModuleDao.deleteChilder(formmainDeleteDto); + } + mdmModuleDao.deleteTemplateById(formmainDeleteDto); + + } else { + //删除明细 + FormmainDeleteDto formmainDeleteDto = new FormmainDeleteDto(); + formmainDeleteDto.setFormmain_id(jsonObject.getString("id")); + formmainDeleteDto.setLoginId(StpUtil.getLoginIdAsString()); + formmainDeleteDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); + mdmModuleDao.deleteTemplateById(formmainDeleteDto); + } + } + return BaseResult.getSuccessMessageEntity("删除数据成功"); + } // // ///** @@ -3611,267 +3877,282 @@ public class MdmServiceImpl implements IMdmService { // //} // - ///** - // * @param mdmCode - // * @param saveData - // * @param mdmModuleEntity - // * @param mdmModuleDbEntityList - // * @param flag 修改 新增 - // * @return java.lang.String - // * @Author lvleigang - // * @Description 校验数据 - // * @Date 11:20 上午 2023/11/6 - // **/ - //private String checkDataOnly(Integer mdmCode, JSONObject saveData, boolean flag, MdmModuleEntity mdmModuleEntity, List mdmModuleDbEntityList) { - // StringBuffer str = new StringBuffer(); - // - // //查询字段 - // //查询字段下的必填规则 - // MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); - // mdmModuleDbFiledsEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbFiledsEntity.setSts("Y"); - // mdmModuleDbFiledsEntity.setRoletype("required"); - // mdmModuleDbFiledsEntity.setRoleValue("true"); - // List mdmModuleDbFiledsEntityList = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); - // - // if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { - // for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { - // if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { - // JSONObject jsonObject = saveData.getJSONObject(mdmModuleDbEntityList.get(i).getDbName()); - // for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { - // if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())) { - // if (jsonObject.get(mdmModuleDbFiledsEntityList.get(i1).getEnName()) == null || "".equals(jsonObject.getString(mdmModuleDbFiledsEntityList.get(i1).getEnName()))) { - // if (str.toString() != null && !"".equals(str.toString())) { - // str.append(";"); - // } - // str.append(mdmModuleDbEntityList.get(i).getRemark() + "的" + mdmModuleDbFiledsEntityList.get(i1).getChName() + "不为空"); - // } - // } - // } - // } else { - // JSONArray jsonArray = saveData.getJSONArray(mdmModuleDbEntityList.get(i).getDbName()); - // if (jsonArray != null && jsonArray.size() > 0) { - // for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { - // if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())) { - // for (int i2 = 0; i2 < jsonArray.size(); i2++) { - // JSONObject jsonObject = jsonArray.getJSONObject(i2); - // if (jsonObject.get(mdmModuleDbFiledsEntityList.get(i1).getEnName()) == null || "".equals(jsonObject.getString(mdmModuleDbFiledsEntityList.get(i1).getEnName()))) { - // if (str.toString() != null && !"".equals(str.toString())) { - // str.append(";"); - // } - // str.append(mdmModuleDbEntityList.get(i).getRemark() + "的" + mdmModuleDbFiledsEntityList.get(i1).getChName() + "不为空"); - // break; - // } - // } - // } - // } - // } - // } - // } - // } - // - // if (str == null || "".equals(str.toString())) { - // //校验数据 - // MdmModuleDbFiledsEntity onlyFiledsEntity = new MdmModuleDbFiledsEntity(); - // onlyFiledsEntity.setMdmId(mdmModuleEntity.getId()); - // onlyFiledsEntity.setSts("Y"); - // onlyFiledsEntity.setRoletype("fieldsSole"); - // onlyFiledsEntity.setRoleValue("true"); - // - // List onlyEntityList = mdmModuleDbFiledsDao.queryBase(onlyFiledsEntity); - // - // if (onlyEntityList != null && onlyEntityList.size() > 0) { - // for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { - // if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { - // JSONObject jsonObject = saveData.getJSONObject(mdmModuleDbEntityList.get(i).getDbName()); - // for (int i1 = 0; i1 < onlyEntityList.size(); i1++) { - // if (onlyEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())) { - // //校验唯一 - // Map map = new HashMap<>(); - // map.put("tableName", mdmModuleDbEntityList.get(i).getDbName()); - // if (flag) { - // map.put("id", jsonObject.getString("id")); - // } - // map.put("filedName", onlyEntityList.get(i1).getEnName()); - // map.put("filedValue", jsonObject.getString(onlyEntityList.get(i1).getEnName())); - // Integer count = mdmModuleDao.checkData(map); - // if (count > 0) { - // if (str.toString() != null && !"".equals(str.toString())) { - // str.append(";"); - // } - // str.append(mdmModuleDbEntityList.get(i).getRemark() + "的" + mdmModuleDbFiledsEntityList.get(i1).getChName() + "已存在"); - // } - // } - // } - // } else { - // JSONArray jsonArray = saveData.getJSONArray(mdmModuleDbEntityList.get(i).getDbName()); - // if (jsonArray != null && jsonArray.size() > 0) { - // for (int i1 = 0; i1 < onlyEntityList.size(); i1++) { - // if (onlyEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())) { - // for (int i2 = 0; i2 < jsonArray.size(); i2++) { - // JSONObject jsonObject = jsonArray.getJSONObject(i2); - // - // //校验唯一 - // Map map = new HashMap<>(); - // map.put("tableName", mdmModuleDbEntityList.get(i).getDbName()); - // if (flag) { - // map.put("id", jsonObject.getString("id")); - // } - // map.put("filedName", onlyEntityList.get(i1).getEnName()); - // map.put("filedValue", jsonObject.getString(onlyEntityList.get(i1).getEnName())); - // Integer count = mdmModuleDao.checkData(map); - // if (count > 0) { - // if (str.toString() != null && !"".equals(str.toString())) { - // str.append(";"); - // } - // str.append(mdmModuleDbEntityList.get(i).getRemark() + "的" + mdmModuleDbFiledsEntityList.get(i1).getChName() + "已存在"); - // break; - // } - // } - // } - // } - // } - // } - // } - // } - // } - // - // - // //保存数据 - // if (str == null || "".equals(str.toString())) { - // String id = UUIDUtils.getUUID(); - // for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { - // if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { - // JSONObject jsonObject = saveData.getJSONObject(mdmModuleDbEntityList.get(i).getDbName()); - // //保存数据 - // MdmDataDto mdmDataDto = new MdmDataDto(); - // mdmDataDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); - // MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity1 = new MdmModuleDbFiledsEntity(); - // mdmModuleDbFiledsEntity1.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbFiledsEntity1.setDbId(mdmModuleDbEntityList.get(i).getId()); - // mdmModuleDbFiledsEntity1.setSts("Y"); - // List fileds = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity1); - // //查询单据规则 - // MdmTableCodeRuleEntity mdmTableCodeRuleEntity = new MdmTableCodeRuleEntity(); - // mdmTableCodeRuleEntity.setMdmId(mdmModuleEntity.getId()); - // mdmTableCodeRuleEntity.setDbId(mdmModuleDbEntityList.get(i).getId()); - // mdmTableCodeRuleEntity.setSts("Y"); - // List mdmTableCodeRuleEntities = mdmTableCodeRuleDao.queryBase(mdmTableCodeRuleEntity); - // StringBuffer document_rule = new StringBuffer(); - // Integer document_rule_num = 0; - // if (mdmTableCodeRuleEntities != null && mdmTableCodeRuleEntities.size() > 0) { - // for (int i1 = 0; i1 < mdmTableCodeRuleEntities.size(); i1++) { - // //1、连接符号 2、字符串 3、日期 4、流水号 - // if ("1".equals(mdmTableCodeRuleEntities.get(i1).getDbType())) { - // document_rule.append("-"); - // } else if ("2".equals(mdmTableCodeRuleEntities.get(i1).getDbType())) { - // document_rule.append(mdmTableCodeRuleEntities.get(i1).getDbValue()); - // } else if ("3".equals(mdmTableCodeRuleEntities.get(i1).getDbType())) { - // SimpleDateFormat sdf = new SimpleDateFormat(mdmTableCodeRuleEntities.get(i1).getDbValue());//要转换的时间格式 - // String stra = sdf.format(new Date()); - // document_rule.append(stra); - // } else if ("4".equals(mdmTableCodeRuleEntities.get(i1).getDbType())) { - // document_rule_num = mdmTableCodeRuleEntities.get(i1).getDbValue().length(); - // } - // } - // } - // List mdmDataFiledDtos = new ArrayList<>(); - // for (int i1 = 0; i1 < fileds.size(); i1++) { - // if (jsonObject.get(fileds.get(i1).getEnName()) != null) { - // MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto(); - // mdmDataFiledDto.setFiledsName(fileds.get(i1).getEnName()); - // mdmDataFiledDto.setFiledsValue(jsonObject.getString(fileds.get(i1).getEnName())); - // mdmDataFiledDtos.add(mdmDataFiledDto); - // } - // } - // MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto(); - // mdmDataFiledDto.setFiledsName("logid"); - // mdmDataFiledDto.setFiledsValue(StpUtil.getLoginIdAsString()); - // mdmDataFiledDtos.add(mdmDataFiledDto); - // mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos); - // if (flag) { - // mdmDataDto.setId(jsonObject.getString("id")); - // id = jsonObject.getString("id"); - // int a = mdmModuleDao.updateForm(mdmDataDto); - // } else { - // - // mdmDataDto.setDbType(mdmModuleDbEntityList.get(i).getDbType()); - // mdmDataDto.setDocumentRule(document_rule.toString()); - // mdmDataDto.setDocumentRuleNum(document_rule_num); - // MdmDataFiledDto ids = new MdmDataFiledDto(); - // ids.setFiledsName("id"); - // ids.setFiledsValue(id); - // mdmDataFiledDtos.add(ids); - // mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos); - // int a = mdmModuleDao.saveForm(mdmDataDto); - // } - // } - // } - // - // for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { - // if ("2".equals(mdmModuleDbEntityList.get(i).getDbType())) { - // //删除明细 - // FormmainDeleteDto formmainDeleteDto = new FormmainDeleteDto(); - // formmainDeleteDto.setFormmain_id(id); - // formmainDeleteDto.setLoginId(StpUtil.getLoginIdAsString()); - // formmainDeleteDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); - // mdmModuleDao.deleteTemplateById(formmainDeleteDto); - // - // JSONArray jsonArray = saveData.getJSONArray(mdmModuleDbEntityList.get(i).getDbName()); - // if (jsonArray != null && jsonArray.size() > 0) { - // MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity1 = new MdmModuleDbFiledsEntity(); - // mdmModuleDbFiledsEntity1.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbFiledsEntity1.setDbId(mdmModuleDbEntityList.get(i).getId()); - // mdmModuleDbFiledsEntity1.setSts("Y"); - // List fileds = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity1); - // - // for (int i2 = 0; i2 < jsonArray.size(); i2++) { - // JSONObject jsonObject = jsonArray.getJSONObject(i2); - // //保存数据 - // MdmDataDto mdmDataDto = new MdmDataDto(); - // mdmDataDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); - // List mdmDataFiledDtos = new ArrayList<>(); - // for (int i1 = 0; i1 < fileds.size(); i1++) { - // MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto(); - // mdmDataFiledDto.setFiledsName(fileds.get(i1).getEnName()); - // mdmDataFiledDto.setFiledsValue(jsonObject.getString(fileds.get(i1).getEnName())); - // mdmDataFiledDtos.add(mdmDataFiledDto); - // } - // MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto(); - // mdmDataFiledDto.setFiledsName("logid"); - // mdmDataFiledDto.setFiledsValue(StpUtil.getLoginIdAsString()); - // mdmDataFiledDtos.add(mdmDataFiledDto); - // - // MdmDataFiledDto formain_id = new MdmDataFiledDto(); - // formain_id.setFiledsName("formmain_id"); - // formain_id.setFiledsValue(id); - // mdmDataFiledDtos.add(formain_id); - // - // mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos); - // if (jsonObject.getString("id") != null) { - // MdmDataFiledDto sts = new MdmDataFiledDto(); - // sts.setFiledsName("sts"); - // sts.setFiledsValue("Y"); - // mdmDataFiledDtos.add(sts); - // mdmDataDto.setId(jsonObject.getString("id")); - // int a = mdmModuleDao.updateForm(mdmDataDto); - // } else { - // MdmDataFiledDto ids = new MdmDataFiledDto(); - // ids.setFiledsName("id"); - // ids.setFiledsValue(UUIDUtils.getUUID()); - // mdmDataFiledDtos.add(ids); - // mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos); - // mdmDataDto.setDbType(mdmModuleDbEntityList.get(i).getDbType()); - // int a = mdmModuleDao.saveForm(mdmDataDto); - // } - // } - // } - // } - // } - // } - // return str.toString(); - //} - // + /** + * @param mdmCode + * @param saveData + * @param mdmModuleEntity + * @param mdmModuleDbEntityList + * @param flag 修改 新增 + * @return java.lang.String + * @Author lvleigang + * @Description 校验数据 + * @Date 11:20 上午 2023/11/6 + **/ + private String checkDataOnly(Integer mdmCode, JSONObject saveData, boolean flag, MdmModuleEntity mdmModuleEntity, List mdmModuleDbEntityList) { + StringBuffer str = new StringBuffer(); + + //查询字段 + //查询字段下的必填规则 + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbFiledsEntity.setSts("Y"); + mdmModuleDbFiledsEntity.setRoletype("required"); + mdmModuleDbFiledsEntity.setRoleValue("true"); + List mdmModuleDbFiledsEntityList = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); + + if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + JSONObject jsonObject = saveData.getJSONObject(mdmModuleDbEntityList.get(i).getDbName()); + for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { + if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())) { + if (jsonObject.get(mdmModuleDbFiledsEntityList.get(i1).getEnName()) == null || "".equals(jsonObject.getString(mdmModuleDbFiledsEntityList.get(i1).getEnName()))) { + if (str.toString() != null && !"".equals(str.toString())) { + str.append(";"); + } + str.append(mdmModuleDbEntityList.get(i).getRemark() + "的" + mdmModuleDbFiledsEntityList.get(i1).getChName() + "不为空"); + } + } + } + } else { + JSONArray jsonArray = saveData.getJSONArray(mdmModuleDbEntityList.get(i).getDbName()); + if (jsonArray != null && jsonArray.size() > 0) { + for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { + if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())) { + for (int i2 = 0; i2 < jsonArray.size(); i2++) { + JSONObject jsonObject = jsonArray.getJSONObject(i2); + if (jsonObject.get(mdmModuleDbFiledsEntityList.get(i1).getEnName()) == null || "".equals(jsonObject.getString(mdmModuleDbFiledsEntityList.get(i1).getEnName()))) { + if (str.toString() != null && !"".equals(str.toString())) { + str.append(";"); + } + str.append(mdmModuleDbEntityList.get(i).getRemark() + "的" + mdmModuleDbFiledsEntityList.get(i1).getChName() + "不为空"); + break; + } + } + } + } + } + } + } + } + + if (str == null || "".equals(str.toString())) { + //校验数据 + MdmModuleDbFiledsEntity onlyFiledsEntity = new MdmModuleDbFiledsEntity(); + onlyFiledsEntity.setMdmId(mdmModuleEntity.getId()); + onlyFiledsEntity.setSts("Y"); + onlyFiledsEntity.setRoletype("fieldsSole"); + onlyFiledsEntity.setRoleValue("true"); + + List onlyEntityList = mdmModuleDbFiledsDao.queryBase(onlyFiledsEntity); + + if (onlyEntityList != null && onlyEntityList.size() > 0) { + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + JSONObject jsonObject = saveData.getJSONObject(mdmModuleDbEntityList.get(i).getDbName()); + for (int i1 = 0; i1 < onlyEntityList.size(); i1++) { + if (onlyEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())) { + //校验唯一 + Map map = new HashMap<>(); + map.put("tableName", mdmModuleDbEntityList.get(i).getDbName()); + if (flag) { + map.put("id", jsonObject.getString("id")); + } + map.put("filedName", onlyEntityList.get(i1).getEnName()); + map.put("filedValue", jsonObject.getString(onlyEntityList.get(i1).getEnName())); + Integer count = mdmModuleDao.checkData(map); + if (count > 0) { + if (str.toString() != null && !"".equals(str.toString())) { + str.append(";"); + } + str.append(mdmModuleDbEntityList.get(i).getRemark() + "的" + mdmModuleDbFiledsEntityList.get(i1).getChName() + "已存在"); + } + } + } + } else { + JSONArray jsonArray = saveData.getJSONArray(mdmModuleDbEntityList.get(i).getDbName()); + if (jsonArray != null && jsonArray.size() > 0) { + for (int i1 = 0; i1 < onlyEntityList.size(); i1++) { + if (onlyEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())) { + for (int i2 = 0; i2 < jsonArray.size(); i2++) { + JSONObject jsonObject = jsonArray.getJSONObject(i2); + + //校验唯一 + Map map = new HashMap<>(); + map.put("tableName", mdmModuleDbEntityList.get(i).getDbName()); + if (flag) { + map.put("id", jsonObject.getString("id")); + } + map.put("filedName", onlyEntityList.get(i1).getEnName()); + map.put("filedValue", jsonObject.getString(onlyEntityList.get(i1).getEnName())); + Integer count = mdmModuleDao.checkData(map); + if (count > 0) { + if (str.toString() != null && !"".equals(str.toString())) { + str.append(";"); + } + str.append(mdmModuleDbEntityList.get(i).getRemark() + "的" + mdmModuleDbFiledsEntityList.get(i1).getChName() + "已存在"); + break; + } + } + } + } + } + } + } + } + } + + + //保存数据 + if (str == null || "".equals(str.toString())) { + String id = UUIDUtils.getUUID(); + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + JSONObject jsonObject = saveData.getJSONObject(mdmModuleDbEntityList.get(i).getDbName()); + //保存数据 + MdmDataDto mdmDataDto = new MdmDataDto(); + mdmDataDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity1 = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity1.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbFiledsEntity1.setDbId(mdmModuleDbEntityList.get(i).getId()); + mdmModuleDbFiledsEntity1.setSts("Y"); + List fileds = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity1); + //查询单据规则 + MdmTableCodeRuleEntity mdmTableCodeRuleEntity = new MdmTableCodeRuleEntity(); + mdmTableCodeRuleEntity.setMdmId(mdmModuleEntity.getId()); + mdmTableCodeRuleEntity.setDbId(mdmModuleDbEntityList.get(i).getId()); + mdmTableCodeRuleEntity.setSts("Y"); + List allMdmTableCodeRuleEntities = mdmServiceCache.queryMdmTableCodeRuleEntity(mdmTableCodeRuleEntity); + List mdmTableCodeRuleEntities = new ArrayList<>(); + if(allMdmTableCodeRuleEntities != null && allMdmTableCodeRuleEntities.size() > 0){ + for (int i1 = 0; i1 < allMdmTableCodeRuleEntities.size(); i1++) { + if(mdmModuleDbEntityList.get(i).getId().equals(allMdmTableCodeRuleEntities.get(i1).getDbId())){ + mdmTableCodeRuleEntities.add(allMdmTableCodeRuleEntities.get(i1)); + } + } + } + StringBuffer document_rule = new StringBuffer(); + Integer document_rule_num = 0; + if (mdmTableCodeRuleEntities != null && mdmTableCodeRuleEntities.size() > 0) { + for (int i1 = 0; i1 < mdmTableCodeRuleEntities.size(); i1++) { + //1、连接符号 2、字符串 3、日期 4、流水号 + if ("1".equals(mdmTableCodeRuleEntities.get(i1).getDbType())) { + document_rule.append("-"); + } else if ("2".equals(mdmTableCodeRuleEntities.get(i1).getDbType())) { + document_rule.append(mdmTableCodeRuleEntities.get(i1).getDbValue()); + } else if ("3".equals(mdmTableCodeRuleEntities.get(i1).getDbType())) { + SimpleDateFormat sdf = new SimpleDateFormat(mdmTableCodeRuleEntities.get(i1).getDbValue());//要转换的时间格式 + String stra = sdf.format(new Date()); + document_rule.append(stra); + } else if ("4".equals(mdmTableCodeRuleEntities.get(i1).getDbType())) { + document_rule_num = mdmTableCodeRuleEntities.get(i1).getDbValue().length(); + } + } + } + List mdmDataFiledDtos = new ArrayList<>(); + for (int i1 = 0; i1 < fileds.size(); i1++) { + if (jsonObject.get(fileds.get(i1).getEnName()) != null) { + MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto(); + mdmDataFiledDto.setFiledsName(fileds.get(i1).getEnName()); + mdmDataFiledDto.setFiledsValue(jsonObject.getString(fileds.get(i1).getEnName())); + mdmDataFiledDtos.add(mdmDataFiledDto); + } + } + MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto(); + mdmDataFiledDto.setFiledsName("logid"); + mdmDataFiledDto.setFiledsValue(StpUtil.getLoginIdAsString()); + mdmDataFiledDtos.add(mdmDataFiledDto); + mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos); + if (flag) { + mdmDataDto.setId(jsonObject.getString("id")); + id = jsonObject.getString("id"); + int a = mdmModuleDao.updateForm(mdmDataDto); + } else { + + mdmDataDto.setDbType(mdmModuleDbEntityList.get(i).getDbType()); + mdmDataDto.setDocumentRule(document_rule.toString()); + mdmDataDto.setDocumentRuleNum(document_rule_num); + MdmDataFiledDto ids = new MdmDataFiledDto(); + ids.setFiledsName("id"); + ids.setFiledsValue(id); + mdmDataFiledDtos.add(ids); + mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos); + int a = mdmModuleDao.saveForm(mdmDataDto); + } + } + } + + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if ("2".equals(mdmModuleDbEntityList.get(i).getDbType())) { + //删除明细 + FormmainDeleteDto formmainDeleteDto = new FormmainDeleteDto(); + formmainDeleteDto.setFormmain_id(id); + formmainDeleteDto.setLoginId(StpUtil.getLoginIdAsString()); + formmainDeleteDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); + mdmModuleDao.deleteTemplateById(formmainDeleteDto); + + JSONArray jsonArray = saveData.getJSONArray(mdmModuleDbEntityList.get(i).getDbName()); + if (jsonArray != null && jsonArray.size() > 0) { + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity1 = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity1.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbFiledsEntity1.setSts("Y"); + List allfileds = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity1); + List fileds = new ArrayList<>(); + if(allfileds != null && allfileds.size() > 0){ + for (int i1 = 0; i1 < allfileds.size(); i1++) { + if(mdmModuleDbEntityList.get(i).getId().equals(allfileds.get(i1).getDbId())){ + fileds.add(allfileds.get(i1)); + } + } + } + + for (int i2 = 0; i2 < jsonArray.size(); i2++) { + JSONObject jsonObject = jsonArray.getJSONObject(i2); + //保存数据 + MdmDataDto mdmDataDto = new MdmDataDto(); + mdmDataDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); + List mdmDataFiledDtos = new ArrayList<>(); + for (int i1 = 0; i1 < fileds.size(); i1++) { + MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto(); + mdmDataFiledDto.setFiledsName(fileds.get(i1).getEnName()); + mdmDataFiledDto.setFiledsValue(jsonObject.getString(fileds.get(i1).getEnName())); + mdmDataFiledDtos.add(mdmDataFiledDto); + } + MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto(); + mdmDataFiledDto.setFiledsName("logid"); + mdmDataFiledDto.setFiledsValue(StpUtil.getLoginIdAsString()); + mdmDataFiledDtos.add(mdmDataFiledDto); + + MdmDataFiledDto formain_id = new MdmDataFiledDto(); + formain_id.setFiledsName("formmain_id"); + formain_id.setFiledsValue(id); + mdmDataFiledDtos.add(formain_id); + + mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos); + if (jsonObject.getString("id") != null) { + MdmDataFiledDto sts = new MdmDataFiledDto(); + sts.setFiledsName("sts"); + sts.setFiledsValue("Y"); + mdmDataFiledDtos.add(sts); + mdmDataDto.setId(jsonObject.getString("id")); + int a = mdmModuleDao.updateForm(mdmDataDto); + } else { + MdmDataFiledDto ids = new MdmDataFiledDto(); + ids.setFiledsName("id"); + ids.setFiledsValue(UUIDUtils.getUUID()); + mdmDataFiledDtos.add(ids); + mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos); + mdmDataDto.setDbType(mdmModuleDbEntityList.get(i).getDbType()); + int a = mdmModuleDao.saveForm(mdmDataDto); + } + } + } + } + } + } + return str.toString(); + } + /** * @param jsonObject