Merge branch 'dev' of http://ufidahz.com.cn:9015/root/kangarooDataCenterV3 into dongj
This commit is contained in:
commit
331b0f03e0
|
@ -66,5 +66,7 @@ public interface IMdmModuleDao extends IBaseDao<MdmModuleEntity, String> {
|
|||
List<String> queryMdMFields(Map<String, Object> maps);
|
||||
|
||||
void updataTreeUpData(Map<String, String> updateMaps);
|
||||
|
||||
void updataTreeUpDataDetail(Map<String, String> updateMaps);
|
||||
}
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ public class MdmModuleDaoImpl extends MybatisGenericDao<MdmModuleEntity, String>
|
|||
}
|
||||
@Override
|
||||
public List<JSONObject> queryMdmSTs(Map<String, Object> maps) {
|
||||
List<JSONObject> o = (List<JSONObject>) super.selectList(getSqlIdPrifx() + "queryMdmSTs", maps);
|
||||
List<JSONObject> o = (List<JSONObject>) super.selectList(getSqlIdPrifx() + "queryMdmST", maps);
|
||||
return o;
|
||||
}
|
||||
|
||||
|
@ -176,6 +176,11 @@ public class MdmModuleDaoImpl extends MybatisGenericDao<MdmModuleEntity, String>
|
|||
super.update(getSqlIdPrifx() + "updataTreeUpData", maps);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updataTreeUpDataDetail(Map<String, String> maps) {
|
||||
super.update(getSqlIdPrifx() + "updataTreeUpDataDetail", maps);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> queryMdMFields(Map<String, Object> maps) {
|
||||
List<String> o = (List<String>) super.selectList(getSqlIdPrifx() + "queryMdMFields", maps);
|
||||
|
|
|
@ -936,7 +936,7 @@ where id = #{id}
|
|||
WHERE table_name = #{tableName}
|
||||
</select>
|
||||
<!-- 分页查询列表 采用like格式 -->
|
||||
<select id="queryMdmSTs" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.util.HashMap">
|
||||
<select id="queryMdmST" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.util.HashMap">
|
||||
select
|
||||
|
||||
<if test="field != null and field.size>0">
|
||||
|
@ -1056,5 +1056,28 @@ where id = #{id}
|
|||
AND sts = 'Y'
|
||||
AND data_status != 'N'
|
||||
</update>
|
||||
|
||||
|
||||
<update id="updataTreeUpDataDetail" parameterType="java.util.HashMap">
|
||||
UPDATE ${tableName} a
|
||||
JOIN ${mainDBTable} b ON a.formmain_id = b.id and b.sts = 'Y'
|
||||
SET
|
||||
a.${upFiled}=CONCAT(#{newData},SUBSTRING_INDEX(${upFiled},#{oldData},-1)),
|
||||
a.modify_time = now(),
|
||||
a.modify_user_id = '1',
|
||||
a.data_status = 'F',
|
||||
|
||||
b.update_status = '0' ,
|
||||
b.data_status = 'F',
|
||||
b.modify_time = now(),
|
||||
b.modify_user_id = '1'
|
||||
|
||||
WHERE
|
||||
a.${upFiled} LIKE concat( #{oldData}, '%' )
|
||||
AND a.sts = 'Y'
|
||||
AND a.data_status != 'N'
|
||||
AND b.sts = 'Y'
|
||||
AND b.data_status != 'N'
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package com.hzya.frame.mdm.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.mdm.entity.MdmDataFiledDto;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 主数据服务接口
|
||||
*/
|
||||
|
@ -118,6 +121,15 @@ public interface IMdmService {
|
|||
* @Date 9:40 上午 2023/10/18
|
||||
**/
|
||||
JsonResultEntity doMdmDistribute(JSONObject jsonObject) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 修改树结构的下级以及其他使用地方数据
|
||||
* @Date 9:12 上午 2024/8/2
|
||||
* @param mdmId 主数据mdmId
|
||||
* @param tableName 主数据的表名
|
||||
* @param id 数据id
|
||||
* @param mdmDataFiledDtos 数据
|
||||
* @return void
|
||||
**/
|
||||
void updateTreeUseData(String mdmId, String tableName, String id, List<MdmDataFiledDto> mdmDataFiledDtos);
|
||||
}
|
||||
|
|
|
@ -2611,104 +2611,12 @@ public class MdmServiceImpl implements IMdmService {
|
|||
if (flag) {
|
||||
mdmDataDto.setId(jsonObject.getString("id"));
|
||||
id = jsonObject.getString("id");
|
||||
boolean asdasd = false;
|
||||
if(asdasd){
|
||||
//查询是否设置的树形
|
||||
MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity();
|
||||
mdmModuleViewEntity.setMdmId(mdmModuleEntity.getId());
|
||||
mdmModuleViewEntity.setViewName("1");
|
||||
mdmModuleViewEntity.setSts("Y");
|
||||
List<MdmModuleViewEntity> moduleViewEntityList = mdmModuleViewDao.queryBase(mdmModuleViewEntity);
|
||||
if (moduleViewEntityList != null && moduleViewEntityList.size() == 1) {
|
||||
mdmModuleViewEntity = moduleViewEntityList.get(0);
|
||||
//查询数据
|
||||
Map<String, Object> queryData = new HashMap<>();
|
||||
queryData.put("tableName", mdmDataDto.getTableName());//表名
|
||||
queryData.put("detailFlag", false);//是否明细
|
||||
queryData.put("id", id);//字段
|
||||
HashMap<String, Object> datas = mdmModuleDbDao.getServiceDataById(queryData);
|
||||
convertKeysToLowerCase(datas);
|
||||
//对比值是否有修改
|
||||
boolean upFlag = false;
|
||||
String oldData = "";
|
||||
|
||||
String newData = "";
|
||||
|
||||
for (int i1 = 0; i1 < mdmDataFiledDtos.size(); i1++) {
|
||||
if (mdmDataFiledDtos.get(i1).getFiledsName().equals(mdmModuleViewEntity.getUpIdFiled())) {
|
||||
newData = mdmDataFiledDtos.get(i1).getFiledsValue();
|
||||
oldData = datas.get(mdmDataFiledDtos.get(i1).getFiledsName()).toString();
|
||||
|
||||
if (mdmDataFiledDtos.get(i1).getFiledsValue().equals(datas.get(mdmDataFiledDtos.get(i1).getFiledsName()).toString())) {
|
||||
upFlag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (upFlag) {
|
||||
//查询引用地方
|
||||
Map<String, String> maps = new HashMap<>();
|
||||
maps.put("service",mdmDataDto.getTableName());
|
||||
maps.put("upId",mdmModuleViewEntity.getUpIdFiled());
|
||||
//maps.put("mdmId",mdmModuleEntity.getId());
|
||||
List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryServiceQuote(maps);
|
||||
if(mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0){
|
||||
for (int i1 = 0; i1 < mdmModuleDbFiledsRuleEntities.size(); i1++) {
|
||||
//查询字段
|
||||
String upFiled = "";
|
||||
|
||||
MdmModuleDbFiledsEntity moduleDbFiledsEntity = new MdmModuleDbFiledsEntity();
|
||||
moduleDbFiledsEntity.setMdmId(mdmModuleDbFiledsRuleEntities.get(i1).getMdmId());
|
||||
moduleDbFiledsEntity.setSts("Y");
|
||||
List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(moduleDbFiledsEntity);
|
||||
if(mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0){
|
||||
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
|
||||
if(mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())){
|
||||
upFiled = mdmModuleDbFiledsEntities.get(i2).getEnName();
|
||||
}
|
||||
}
|
||||
}
|
||||
//修改引用数据
|
||||
//查看是否主表
|
||||
MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity();
|
||||
mdmModuleDbEntity.setMdmId(mdmModuleDbFiledsRuleEntities.get(i1).getMdmId());
|
||||
mdmModuleDbEntity.setSts("Y");
|
||||
List<MdmModuleDbEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity);
|
||||
//设置主表
|
||||
String mainDBTable = "";
|
||||
String dataDBTable = "";
|
||||
if(mdmModuleDbEntities != null && mdmModuleDbEntities.size() > 0){
|
||||
for (int i2 = 0; i2 < mdmModuleDbEntities.size(); i2++) {
|
||||
//主表
|
||||
if("1".equals(mdmModuleDbEntities.get(i2).getDbType())){
|
||||
mainDBTable = mdmModuleDbEntities.get(i2).getDbName();
|
||||
}
|
||||
if(mdmModuleDbFiledsRuleEntities.get(i1).getDbId().equals(mdmModuleDbEntities.get(i2).getId())){
|
||||
dataDBTable = mdmModuleDbEntities.get(i2).getDbName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(mainDBTable.equals(dataDBTable)){//主表上的字段
|
||||
Map<String, String> updateMaps = new HashMap<>();
|
||||
updateMaps.put("tableName",dataDBTable);
|
||||
updateMaps.put("upFiled",upFiled);
|
||||
updateMaps.put("oldData",oldData);
|
||||
updateMaps.put("newData",newData);
|
||||
updateMaps.put("modify_user_id",StpUtil.getLoginIdAsString());
|
||||
mdmModuleDao.updataTreeUpData(updateMaps);
|
||||
}else {//明细表上的字段
|
||||
updateTreeUseData(mdmModuleEntity.getId(),mdmDataDto.getTableName(),id,mdmDataFiledDtos);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
int a = mdmModuleDao.updateForm(mdmDataDto);
|
||||
} else {
|
||||
|
||||
|
@ -2875,6 +2783,132 @@ public class MdmServiceImpl implements IMdmService {
|
|||
return str.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 修改树结构的下级以及其他使用地方数据
|
||||
* @Date 9:12 上午 2024/8/2
|
||||
* @param mdmId 主数据mdmId
|
||||
* @param tableName 主数据的表名
|
||||
* @param id 数据id
|
||||
* @param mdmDataFiledDtos 数据
|
||||
* @return void
|
||||
**/
|
||||
public void updateTreeUseData(String mdmId, String tableName, String id, List<MdmDataFiledDto> mdmDataFiledDtos) {
|
||||
//查询是否设置的树形
|
||||
MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity();
|
||||
mdmModuleViewEntity.setMdmId(mdmId);
|
||||
mdmModuleViewEntity.setViewName("1");
|
||||
mdmModuleViewEntity.setSts("Y");
|
||||
List<MdmModuleViewEntity> moduleViewEntityList = mdmModuleViewDao.queryBase(mdmModuleViewEntity);
|
||||
if (moduleViewEntityList != null && moduleViewEntityList.size() == 1) {
|
||||
mdmModuleViewEntity = moduleViewEntityList.get(0);
|
||||
//查询数据
|
||||
Map<String, Object> queryData = new HashMap<>();
|
||||
queryData.put("tableName", tableName);//表名
|
||||
queryData.put("detailFlag", false);//是否明细
|
||||
queryData.put("id", id);//字段
|
||||
HashMap<String, Object> datas = mdmModuleDbDao.getServiceDataById(queryData);
|
||||
convertKeysToLowerCase(datas);
|
||||
//对比值是否有修改
|
||||
boolean upFlag = false;
|
||||
String oldData = "";
|
||||
|
||||
String newData = "";
|
||||
|
||||
for (int i1 = 0; i1 < mdmDataFiledDtos.size(); i1++) {
|
||||
if (mdmDataFiledDtos.get(i1).getFiledsName().equals(mdmModuleViewEntity.getUpIdFiled())) {
|
||||
newData = mdmDataFiledDtos.get(i1).getFiledsValue();
|
||||
oldData = datas.get(mdmDataFiledDtos.get(i1).getFiledsName()).toString();
|
||||
|
||||
if (mdmDataFiledDtos.get(i1).getFiledsValue().equals(datas.get(mdmDataFiledDtos.get(i1).getFiledsName()).toString())) {
|
||||
upFlag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!"".equals(oldData)) {
|
||||
oldData = oldData + "," + id;
|
||||
} else {
|
||||
oldData = id;
|
||||
}
|
||||
if (!"".equals(newData)) {
|
||||
newData = newData + "," + id;
|
||||
} else {
|
||||
newData = id;
|
||||
}
|
||||
if (!upFlag) {
|
||||
//查询引用地方
|
||||
Map<String, String> maps = new HashMap<>();
|
||||
maps.put("service", tableName);
|
||||
maps.put("upId", mdmModuleViewEntity.getUpIdFiled());
|
||||
//maps.put("mdmId",mdmModuleEntity.getId());
|
||||
List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryServiceQuote(maps);
|
||||
if (mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0) {
|
||||
for (int i1 = 0; i1 < mdmModuleDbFiledsRuleEntities.size(); i1++) {
|
||||
//查询字段
|
||||
String upFiled = "";
|
||||
|
||||
MdmModuleDbFiledsEntity moduleDbFiledsEntity = new MdmModuleDbFiledsEntity();
|
||||
moduleDbFiledsEntity.setMdmId(mdmModuleDbFiledsRuleEntities.get(i1).getMdmId());
|
||||
moduleDbFiledsEntity.setSts("Y");
|
||||
List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(moduleDbFiledsEntity);
|
||||
if (mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0) {
|
||||
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
|
||||
if (mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())) {
|
||||
upFiled = mdmModuleDbFiledsEntities.get(i2).getEnName();
|
||||
}
|
||||
}
|
||||
}
|
||||
//修改引用数据
|
||||
//查看是否主表
|
||||
MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity();
|
||||
mdmModuleDbEntity.setMdmId(mdmModuleDbFiledsRuleEntities.get(i1).getMdmId());
|
||||
mdmModuleDbEntity.setSts("Y");
|
||||
List<MdmModuleDbEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity);
|
||||
//设置主表
|
||||
String mainDBTable = "";
|
||||
String dataDBTable = "";
|
||||
if (mdmModuleDbEntities != null && mdmModuleDbEntities.size() > 0) {
|
||||
for (int i2 = 0; i2 < mdmModuleDbEntities.size(); i2++) {
|
||||
//主表
|
||||
if ("1".equals(mdmModuleDbEntities.get(i2).getDbType())) {
|
||||
mainDBTable = mdmModuleDbEntities.get(i2).getDbName();
|
||||
}
|
||||
if (mdmModuleDbFiledsRuleEntities.get(i1).getDbId().equals(mdmModuleDbEntities.get(i2).getId())) {
|
||||
dataDBTable = mdmModuleDbEntities.get(i2).getDbName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mainDBTable.equals(dataDBTable)) {//主表上的字段
|
||||
Map<String, String> updateMaps = new HashMap<>();
|
||||
updateMaps.put("tableName", dataDBTable);
|
||||
updateMaps.put("upFiled", upFiled);
|
||||
updateMaps.put("oldData", oldData);
|
||||
updateMaps.put("newData", newData);
|
||||
updateMaps.put("modify_user_id", StpUtil.getLoginIdAsString());
|
||||
mdmModuleDao.updataTreeUpData(updateMaps);
|
||||
} else {//明细表上的字段
|
||||
Map<String, String> updateMaps = new HashMap<>();
|
||||
updateMaps.put("mainDBTable", mainDBTable);
|
||||
updateMaps.put("tableName", dataDBTable);
|
||||
updateMaps.put("upFiled", upFiled);
|
||||
updateMaps.put("oldData", oldData);
|
||||
updateMaps.put("newData", newData);
|
||||
updateMaps.put("modify_user_id", StpUtil.getLoginIdAsString());
|
||||
mdmModuleDao.updataTreeUpDataDetail(updateMaps);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param jsonObject
|
||||
|
|
Loading…
Reference in New Issue