主数据上传

This commit is contained in:
lvleigang 2024-05-16 08:43:54 +08:00
parent 561e69b6f5
commit 5cda40a03b
7 changed files with 497 additions and 252 deletions

View File

@ -12,6 +12,7 @@ public class MdmDistributeDto {
private String id;
private List<MdmModuleDistributeEntity> mdmModuleDistributeEntities;
public List<MdmModuleDistributeEntity> getMdmModuleDistributeEntities() {

View File

@ -0,0 +1,53 @@
package com.hzya.frame.mdm.entity;
import com.hzya.frame.web.entity.BaseEntity;
public class MdmDistributeEntity extends BaseEntity {
private String tableName;
private String formmainId;
private String appId;
private String status;//1发送成功 2发送中 3发送失败 4未发送
private String msg;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public String getFormmainId() {
return formmainId;
}
public void setFormmainId(String formmainId) {
this.formmainId = formmainId;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
}

View File

@ -1,6 +1,7 @@
package com.hzya.frame.mdm.mdmModule.dao;
import com.hzya.frame.mdm.entity.MdmDataDto;
import com.hzya.frame.mdm.entity.MdmDistributeEntity;
import com.hzya.frame.mdm.entity.MdmDto;
import com.hzya.frame.mdm.entity.MdmQuery;
import com.hzya.frame.mdm.entity.MdmVo;
@ -49,5 +50,9 @@ public interface IMdmModuleDao extends IBaseDao<MdmModuleEntity, String> {
List<HashMap<String, Object>> querySelectData(MdmDto entity);
Integer deleteChilder(FormmainDeleteDto formmainDeleteDto);
Integer saveDistribute(MdmDistributeEntity mdmDistributeEntity);
Integer updateDistribute(MdmDistributeEntity mdmDistributeEntity);
}

View File

@ -1,6 +1,7 @@
package com.hzya.frame.mdm.mdmModule.dao.impl;
import com.hzya.frame.mdm.entity.MdmDataDto;
import com.hzya.frame.mdm.entity.MdmDistributeEntity;
import com.hzya.frame.mdm.entity.MdmDto;
import com.hzya.frame.mdm.entity.MdmQuery;
import com.hzya.frame.mdm.entity.MdmVo;
@ -123,6 +124,17 @@ public class MdmModuleDaoImpl extends MybatisGenericDao<MdmModuleEntity, String>
}
@Override
public Integer saveDistribute(MdmDistributeEntity mdmDistributeEntity) {
Integer o = super.insert(getSqlIdPrifx() + "saveDistribute", mdmDistributeEntity);
return o;
}
@Override
public Integer updateDistribute(MdmDistributeEntity mdmDistributeEntity) {
Integer o = super.update(getSqlIdPrifx() + "updateDistribute", mdmDistributeEntity);
return o;
}
@Override
public HashMap<String, Object> queryTemplateDataOne(MdmDto entity) {
HashMap<String, Object> o = (HashMap<String, Object>) super.selectOne(getSqlIdPrifx() + "queryTemplateDataOne", entity);

View File

@ -696,5 +696,58 @@ where id = #{id}
</trim>
order by sorts asc
</select>
<insert id="saveDistribute" parameterType="com.hzya.frame.mdm.entity.MdmDistributeEntity" >
insert into ${tableName}(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''">id ,</if>
<if test="formmainId != null and formmainId != ''">formmain_id ,</if>
<if test="appId != null and appId != ''">app_id ,</if>
<if test="status != null and status != ''">status ,</if>
<if test="msg != null and msg != ''">msg ,</if>
<if test="sorts != null">sorts ,</if>
<if test="create_user_id != null and create_user_id != ''">create_user_id ,</if>
<if test="create_time != null">create_time ,</if>
<if test="modify_user_id != null and modify_user_id != ''">modify_user_id ,</if>
<if test="modify_time != null">modify_time ,</if>
<if test="sts != null and sts != ''">sts ,</if>
<if test="org_id != null and org_id != ''">org_id ,</if>
<if test="companyId != null and companyId != ''">company_id ,</if>
<if test="sts == null ">sts,</if>
</trim>
)values(
<trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''">#{id} ,</if>
<if test="formmainId != null and formmainId != ''">#{formmainId} ,</if>
<if test="appId != null and appId != ''">#{appId} ,</if>
<if test="status != null and status != ''">#{status} ,</if>
<if test="msg != null and msg != ''">#{msg} ,</if>
<if test="sorts != null">#{sorts} ,</if>
<if test="create_user_id != null and create_user_id != ''">#{create_user_id} ,</if>
<if test="create_time != null">#{create_time} ,</if>
<if test="modify_user_id != null and modify_user_id != ''">#{modify_user_id} ,</if>
<if test="modify_time != null">#{modify_time} ,</if>
<if test="sts != null and sts != ''">#{sts} ,</if>
<if test="org_id != null and org_id != ''">#{org_id} ,</if>
<if test="companyId != null and companyId != ''">#{companyId} ,</if>
<if test="sts == null ">'Y',</if>
</trim>
)
</insert>
<update id="updateDistribute" parameterType="com.hzya.frame.mdm.entity.MdmDistributeEntity">
update ${tableName} set
<trim suffix="" suffixOverrides=",">
<if test="formmainId != null and formmainId != ''">formmain_id = #{formmainId},</if>
<if test="appId != null and appId != ''">app_id = #{appId},</if>
<if test="status != null ">status = #{status},</if>
<if test="msg != null and msg != ''">msg = #{msg},</if>
<if test="modify_user_id != null and modify_user_id != ''">modify_user_id = #{modify_user_id},</if>
<if test="modify_time != null">modify_time = #{modify_time},</if>
<if test="sts != null and sts != ''">sts = #{sts},</if>
<if test="org_id != null and org_id != ''">org_id = #{org_id},</if>
</trim>
where id = #{id}
</update>
</mapper>

View File

@ -13,6 +13,7 @@ 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.MdmDistributeEntity;
import com.hzya.frame.mdm.entity.MdmDistributeVo;
import com.hzya.frame.mdm.entity.MdmDto;
import com.hzya.frame.mdm.entity.MdmModuleViewDto;
@ -58,6 +59,8 @@ import com.hzya.frame.sys.roleModule.dao.IRoleModuleMapper;
import com.hzya.frame.sys.roleModule.entity.RoleModule;
import com.hzya.frame.sys.userRole.dao.IUserRoleMapper;
import com.hzya.frame.sys.userRole.entity.UserRole;
import com.hzya.frame.sysnew.application.plugin.dao.ISysApplicationPluginDao;
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;
@ -66,6 +69,8 @@ import com.hzya.frame.util.PluginUtils;
import com.hzya.frame.uuid.UUIDUtils;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -83,6 +88,8 @@ import java.util.stream.Collectors;
*/
@Service(value = "mdmService")
public class MdmServiceImpl implements IMdmService {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Resource
protected IModuleMapper moduleMapper;
@Resource
@ -114,11 +121,12 @@ public class MdmServiceImpl implements IMdmService {
@Resource
private IMdmTableCodeRuleDao mdmTableCodeRuleDao;//模版数据表编码规则表
@Resource
protected IUserRoleMapper userRoleMapper;
protected ISysApplicationPluginDao sysApplicationPluginDao;
@Resource
private ISysMenuConfigDao sysMenuConfigDao;
@Resource
private ISysButtonConfigDao sysButtonConfigDao;
/**
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
@ -299,23 +307,22 @@ public class MdmServiceImpl implements IMdmService {
//查询数据源表
entity.setSts("Y");
List<MdmModuleDbEntity> dblist = mdmModuleDbDao.queryBase(entity);
if(dblist != null && dblist.size() == 1 ){
MdmModuleDbFiledsEntity queryDbFiled= new MdmModuleDbFiledsEntity();
if (dblist != null && dblist.size() == 1) {
MdmModuleDbFiledsEntity queryDbFiled = new MdmModuleDbFiledsEntity();
queryDbFiled.setSts("Y");
queryDbFiled.setDbId(dblist.get(0).getId());
List<MdmModuleDbFiledsEntity> list = mdmModuleDbFiledsDao.queryBase(queryDbFiled);
MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity();
mdmModuleDbFiledsEntity.setChName("id");
mdmModuleDbFiledsEntity.setEnName("id");
list.add(0,mdmModuleDbFiledsEntity);
list.add(0, mdmModuleDbFiledsEntity);
return BaseResult.getSuccessMessageEntity("查询数据成功", list);
}else {
} else {
return BaseResult.getFailureMessageEntity("服务不存在");
}
}
/**
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
@ -337,15 +344,15 @@ public class MdmServiceImpl implements IMdmService {
entity.setSts("Y");
entity.setDbType("1");
List<MdmModuleDbEntity> mdmModuleDbEntityList = mdmModuleDbDao.queryBase(entity);
if(mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() == 1){
if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() == 1) {
MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity();
mdmModuleDbFiledsEntity.setSts("Y");
mdmModuleDbFiledsEntity.setDbId(mdmModuleDbEntityList.get(0).getId());
List<MdmModuleDbFiledsEntity> list = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity);
return BaseResult.getSuccessMessageEntity("查询数据成功", list);
}else if(mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() == 0){
} else if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() == 0) {
return BaseResult.getFailureMessageEntity("请先配置数据源");
}else {
} else {
return BaseResult.getFailureMessageEntity("查询数据失败");
}
}
@ -485,7 +492,7 @@ public class MdmServiceImpl implements IMdmService {
deleteOldData.setModify_user_id(StpUtil.getLoginIdAsString());
deleteOldData.setModify_time(new Date());
mdmTableCodeRuleDao.logicRemoveMultiCondition(deleteOldData);
if(mdmTableCodeRuleEntityList != null && mdmTableCodeRuleEntityList.size() > 0){
if (mdmTableCodeRuleEntityList != null && mdmTableCodeRuleEntityList.size() > 0) {
for (int i = 0; i < mdmTableCodeRuleEntityList.size(); i++) {
MdmTableCodeRuleEntity mdmTableCodeRuleEntity = mdmTableCodeRuleEntityList.get(i);
mdmTableCodeRuleEntity.setMdmId(entity.getId());
@ -734,18 +741,18 @@ public class MdmServiceImpl implements IMdmService {
}
/**
* @param
* @return java.util.List<com.hzya.frame.mdm.entity.DbFiledsDto>
* @Author lvleigang
* @Description 设置分发表字段
* @Date 8:49 上午 2023/11/9
* @param
* @return java.util.List<com.hzya.frame.mdm.entity.DbFiledsDto>
**/
private List<DbFiledsDto> getDistribute() {
List<DbFiledsDto> dbFiledsDtos = new ArrayList<>();
dbFiledsDtos.add(new DbFiledsDto("1", "数据id","formmain_id", "3", "50"));
dbFiledsDtos.add(new DbFiledsDto("1", "应用id","app_id", "3", "50"));
dbFiledsDtos.add(new DbFiledsDto("1", "状态1、发送成功 2、发送中 3、发送失败","status", "3", "50"));
dbFiledsDtos.add(new DbFiledsDto("1", "描述","msg", "3", "50"));
dbFiledsDtos.add(new DbFiledsDto("1", "数据id", "formmain_id", "3", "50"));
dbFiledsDtos.add(new DbFiledsDto("1", "应用id", "app_id", "3", "50"));
dbFiledsDtos.add(new DbFiledsDto("1", "状态1、发送成功 2、发送中 3、发送失败", "status", "3", "50"));
dbFiledsDtos.add(new DbFiledsDto("1", "描述", "msg", "3", "50"));
return dbFiledsDtos;
}
@ -979,9 +986,9 @@ public class MdmServiceImpl implements IMdmService {
module.setFormId(entity.getId());
module.setParentMenuId("ea22757e99c144fb9ef381dd322e233c");
module.setMenuName(moduleEntity.getMdmName());
module.setMenuEnglishName("integrationOptionAdmin"+moduleEntity.getMdmCode());
module.setMenuEnglishName("integrationOptionAdmin" + moduleEntity.getMdmCode());
module.setMenuIcon(null);//模块图标
module.setRoute("integrationOptionAdmin/"+moduleEntity.getMdmCode());//路由地址
module.setRoute("integrationOptionAdmin/" + moduleEntity.getMdmCode());//路由地址
module.setMenuPage("integrationOptionV2/index");//一级Layout 二级 ParntView 三级component
module.setRemark("主数据生成菜单");
module.setVisibles("0");
@ -1503,7 +1510,7 @@ public class MdmServiceImpl implements IMdmService {
mdmModuleViewDetailEntity.setViewType("1");
List<MdmModuleViewDetailEntity> queryList = mdmModuleViewDetailDao.queryBase(mdmModuleViewDetailEntity);
//设置字段
List<MdmViewFiledVo> queryListVo = setQueryList(mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList, queryList,false);
List<MdmViewFiledVo> queryListVo = setQueryList(mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList, queryList, false);
mdmViewVo.setQueryList(queryListVo);
//查询用户设置字段
@ -1529,17 +1536,17 @@ public class MdmServiceImpl implements IMdmService {
} else {
dolistList = listList;
}
List<MdmViewFiledVo> listListVo = setQueryList(mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList, dolistList,true);
List<MdmViewFiledVo> listListVo = setQueryList(mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList, dolistList, true);
mdmViewVo.setListList(listListVo);
List<MdmViewButtonVo> 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","下发"));
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);
}
@ -1645,7 +1652,7 @@ public class MdmServiceImpl implements IMdmService {
* @Description 根据字段设置返回前台字段
* @Date 4:11 下午 2023/10/26
**/
private List<MdmViewFiledVo> setQueryList(List<MdmModuleDbEntity> mdmModuleDbEntityList, List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntityList, List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntityList, List<MdmModuleViewDetailEntity> queryList,boolean flag) {
private List<MdmViewFiledVo> setQueryList(List<MdmModuleDbEntity> mdmModuleDbEntityList, List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntityList, List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntityList, List<MdmModuleViewDetailEntity> queryList, boolean flag) {
List<MdmViewFiledVo> mdmViewFiledVos = new ArrayList<>();
if (queryList != null && queryList.size() > 0) {
@ -1690,9 +1697,9 @@ public class MdmServiceImpl implements IMdmService {
mdmViewFiledVo.setEnName("document_rule");//英文名
mdmViewFiledVo.setChName("单据编码");//中文名
mdmViewFiledVo.setDbType("1");//类型 1主表 2明细
if(mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0){
if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) {
for (int i = 0; i < mdmModuleDbEntityList.size(); i++) {
if("1".equals(mdmModuleDbEntityList.get(i).getDbType())){
if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) {
mdmViewFiledVo.setDbName(mdmModuleDbEntityList.get(i).getDbName());//表名
}
}
@ -1733,11 +1740,11 @@ public class MdmServiceImpl implements IMdmService {
msgRule.add(msgRulerow);
msgRule.add(msgRuleTitie);
mdmViewFiledVo.setRuleList(msgRule);
mdmViewFiledVos.add(0,mdmViewFiledVo);
mdmViewFiledVos.add(0, mdmViewFiledVo);
//添加分发数量
if(flag){
addFfsl(mdmModuleDbEntityList,mdmViewFiledVos);
if (flag) {
addFfsl(mdmModuleDbEntityList, mdmViewFiledVos);
}
return mdmViewFiledVos;
}
@ -1750,9 +1757,9 @@ public class MdmServiceImpl implements IMdmService {
mdmViewFiledVo.setEnName("qwqwasdasdzxasda");//英文名
mdmViewFiledVo.setChName("分发数量");//中文名
mdmViewFiledVo.setDbType("1");//类型 1主表 2明细
if(mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0){
if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) {
for (int i = 0; i < mdmModuleDbEntityList.size(); i++) {
if("1".equals(mdmModuleDbEntityList.get(i).getDbType())){
if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) {
mdmViewFiledVo.setDbName(mdmModuleDbEntityList.get(i).getDbName());//表名
}
}
@ -1851,7 +1858,7 @@ public class MdmServiceImpl implements IMdmService {
}
mdmModuleDbEntity = mdmModuleDbEntityList.get(0);
Map<String, Object> queryData = new HashMap<>();
queryData.put("tableName", mdmModuleDbEntity.getDbName()+"_distribute");//表名
queryData.put("tableName", mdmModuleDbEntity.getDbName() + "_distribute");//表名
queryData.put("id", entity.getId());//字段
List<MdmDistributeVo> datas = mdmModuleDbDao.getServiceByDistributeIdNoCase(queryData);
List<MdmDistributeVo> returnData = new ArrayList<>();
@ -1861,17 +1868,17 @@ public class MdmServiceImpl implements IMdmService {
mdmModuleDistributeEntity.setMdmId(mdmModuleEntities.get(0).getId());
mdmModuleDistributeEntity.setSts("Y");
List<MdmModuleDistributeEntity> mdmModuleDistributeEntities = mdmModuleDistributeDao.queryBase(mdmModuleDistributeEntity);
if(datas != null && datas.size() > 0){
if(mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() > 0){
if (datas != null && datas.size() > 0) {
if (mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() > 0) {
for (int i = 0; i < mdmModuleDistributeEntities.size(); i++) {
boolean flag = false;
for (int i1 = 0; i1 < datas.size(); i1++) {
if(datas.get(i1).getAppId().equals(mdmModuleDistributeEntities.get(i).getAppId())){
if (datas.get(i1).getAppId().equals(mdmModuleDistributeEntities.get(i).getAppId())) {
flag = true;
break;
}
}
if(!flag){
if (!flag) {
MdmDistributeVo mdmDistributeVo = new MdmDistributeVo();
mdmDistributeVo.setAppId(mdmModuleDistributeEntities.get(i).getAppId());
mdmDistributeVo.setStatus("4");
@ -1881,8 +1888,8 @@ public class MdmServiceImpl implements IMdmService {
}
}
returnData.addAll(datas);
}else {
if(mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() > 0){
} else {
if (mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() > 0) {
for (int i = 0; i < mdmModuleDistributeEntities.size(); i++) {
MdmDistributeVo mdmDistributeVo = new MdmDistributeVo();
mdmDistributeVo.setAppId(mdmModuleDistributeEntities.get(i).getAppId());
@ -1892,8 +1899,9 @@ public class MdmServiceImpl implements IMdmService {
}
}
}
return BaseResult.getSuccessMessageEntity("查询数据成功",returnData);
return BaseResult.getSuccessMessageEntity("查询数据成功", returnData);
}
/**
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
@ -1924,6 +1932,7 @@ public class MdmServiceImpl implements IMdmService {
return BaseResult.getSuccessMessageEntity("查询数据成功", mapList);
}
}
/**
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
@ -1973,7 +1982,7 @@ public class MdmServiceImpl implements IMdmService {
if (!checkStr(entity.getValue())) {
return BaseResult.getFailureMessageEntity("请先传递存储字段");
}
if(entity.getId().contains(",")){
if (entity.getId().contains(",")) {
String[] strArray = entity.getId().split(","); // 使用逗号和空格作为分隔符
entity.setIds(strArray);
List<HashMap<String, Object>> mapList = mdmModuleDao.queryTemplateDataMore(entity);
@ -1981,9 +1990,9 @@ public class MdmServiceImpl implements IMdmService {
List<HashMap<String, Object>> returnList = new ArrayList<>();
return BaseResult.getSuccessMessageEntity("查询数据成功", returnList);
}
List<HashMap<String, Object>> returnList = gettochilder(strArray,0,mapList);
List<HashMap<String, Object>> returnList = gettochilder(strArray, 0, mapList);
return BaseResult.getSuccessMessageEntity("查询数据成功", returnList);
}else {
} else {
HashMap<String, Object> mapList = mdmModuleDao.queryTemplateDataOne(entity);
if (mapList == null || mapList.size() == 0) {
List<HashMap<String, Object>> returnList = new ArrayList<>();
@ -1993,7 +2002,7 @@ public class MdmServiceImpl implements IMdmService {
returnList.add(mapList);
return BaseResult.getSuccessMessageEntity("查询数据成功", returnList);
}
}else {
} else {
List<HashMap<String, Object>> mapList = mdmModuleDao.queryDataAll(entity);
List<HashMap<String, Object>> returnList = new ArrayList<>();
@ -2013,16 +2022,16 @@ public class MdmServiceImpl implements IMdmService {
}
}
}
return BaseResult.getSuccessMessageEntity("查询数据成功",returnList);
return BaseResult.getSuccessMessageEntity("查询数据成功", returnList);
}
}
private List<HashMap<String, Object>> gettochilder(String[] strArray, int i, List<HashMap<String, Object>> mapList) {
List<HashMap<String, Object>> 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));
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;
@ -2060,7 +2069,7 @@ public class MdmServiceImpl implements IMdmService {
for (int i = 0; i < mapList.size(); i++) {
//等于上级id的时候
if (stringObjectHashMap.equals(mapList.get(i).get(entity.getUpId()))) {
List<HashMap<String, Object>> children = getchilder(mapList.get(i).get(entity.getUpId())+","+mapList.get(i).get("qsdfg"), mapList, entity);
List<HashMap<String, Object>> children = getchilder(mapList.get(i).get(entity.getUpId()) + "," + mapList.get(i).get("qsdfg"), mapList, entity);
HashMap<String, Object> re = new HashMap<>();
re.put("id", mapList.get(i).get("qsdfg"));
re.put("label", mapList.get(i).get(entity.getLabel()));
@ -2074,6 +2083,7 @@ public class MdmServiceImpl implements IMdmService {
}
return returnList;
}
/**
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
@ -2168,7 +2178,7 @@ public class MdmServiceImpl implements IMdmService {
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())){
if (mdmModuleViewDetailEntityList.get(b).getViewFiled().equals(mdmModuleDbFiledsEntityList.get(i1).getId())) {
mainMdmModuleDbFileds.add(mdmModuleDbFiledsEntityList.get(i1));
List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRules = new ArrayList<>();
//循环字段属性
@ -2195,7 +2205,7 @@ public class MdmServiceImpl implements IMdmService {
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())){
if (mdmModuleViewDetailEntityList.get(b).getViewFiled().equals(mdmModuleDbFiledsEntityList.get(i1).getId())) {
sublistMdmModuleDbFileds.add(mdmModuleDbFiledsEntityList.get(i1));
List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRules = new ArrayList<>();
//循环字段属性
@ -2221,14 +2231,14 @@ public class MdmServiceImpl implements IMdmService {
mdmViewVo.setMainMdmModuleDb(mainMdmModuleDb);
//主数据子表
List<MdmModuleDbEntity> mdmModuleDb = new ArrayList<>();
if(sublistMdmModuleDb != null && sublistMdmModuleDb.size() > 0){
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 ){
if (sublistMdmModuleDb.get(i).getSublistMdmModuleDbFileds() != null && sublistMdmModuleDb.get(i).getSublistMdmModuleDbFileds().size() > 0) {
mdmModuleDb.add(sublistMdmModuleDb.get(i));
}
}
}
if("5".equals(showType)){
if ("5".equals(showType)) {
MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity();
mdmModuleDbEntity.setDbName(mainMdmModuleDb.getDbName() + "_distribute");
mdmModuleDbEntity.setRemark(mainMdmModuleDb.getRemark() + "分发表");
@ -2240,7 +2250,6 @@ public class MdmServiceImpl implements IMdmService {
mdmViewVo.setSublistMdmModuleDb(mdmModuleDb);
} else {
mdmViewVo.setMainMdmModuleDb(mainMdmModuleDb);
mdmViewVo.setSublistMdmModuleDb(sublistMdmModuleDb);
@ -2346,7 +2355,6 @@ public class MdmServiceImpl implements IMdmService {
mdmModuleDbFiledsEntityList.add(statusFiled);
//msg
MdmModuleDbFiledsEntity msgFiled = new MdmModuleDbFiledsEntity();
msgFiled.setChName("描述");
@ -2468,25 +2476,25 @@ public class MdmServiceImpl implements IMdmService {
//查询数据
Map<String, Object> queryData = new HashMap<>();
queryData.put("tableName", mdmModuleDbEntityList.get(i).getDbName());//表名
if("1".equals(mdmModuleDbEntityList.get(i).getDbType())){
if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) {
queryData.put("detailFlag", false);//是否明细
queryData.put("id", entity.getId());//字段
HashMap<String, Object> datas = mdmModuleDbDao.getServiceDataById(queryData);
jsonObject.put(mdmModuleDbEntityList.get(i).getDbName(),datas);
tablename = mdmModuleDbEntityList.get(i).getDbName()+"_distribute";
}else {
jsonObject.put(mdmModuleDbEntityList.get(i).getDbName(), datas);
tablename = mdmModuleDbEntityList.get(i).getDbName() + "_distribute";
} else {
queryData.put("detailFlag", true);//是否明细
queryData.put("id", entity.getId());//字段
List<HashMap<String, Object>> datas = mdmModuleDbDao.getServiceByFormmainId(queryData);
jsonObject.put(mdmModuleDbEntityList.get(i).getDbName(),datas);
jsonObject.put(mdmModuleDbEntityList.get(i).getDbName(), datas);
}
}
if(tablename != null && !"".equals(tablename)){
if (tablename != null && !"".equals(tablename)) {
Map<String, Object> queryData = new HashMap<>();
queryData.put("tableName", tablename);//表名
queryData.put("id", entity.getId());//字段
List<HashMap<String, Object>> datas = mdmModuleDbDao.getServiceByDistributeId(queryData);
jsonObject.put(tablename,datas);
jsonObject.put(tablename, datas);
}
@ -2494,7 +2502,6 @@ public class MdmServiceImpl implements IMdmService {
}
/**
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
@ -2529,7 +2536,7 @@ public class MdmServiceImpl implements IMdmService {
if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) {
return BaseResult.getFailureMessageEntity("系统错误");
}
String res = checkDataOnly(jsonObject.getInteger("mdmCode"),saveData,true,mdmModuleEntity,mdmModuleDbEntityList);
String res = checkDataOnly(jsonObject.getInteger("mdmCode"), saveData, true, mdmModuleEntity, mdmModuleDbEntityList);
if (res == null || "".equals(res)) {
return BaseResult.getSuccessMessageEntity("修改数据成功");
@ -2539,7 +2546,6 @@ public class MdmServiceImpl implements IMdmService {
}
/**
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
@ -2574,7 +2580,7 @@ public class MdmServiceImpl implements IMdmService {
if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) {
return BaseResult.getFailureMessageEntity("系统错误");
}
String res = checkDataOnly(jsonObject.getInteger("mdmCode"),saveData,false,mdmModuleEntity,mdmModuleDbEntityList);
String res = checkDataOnly(jsonObject.getInteger("mdmCode"), saveData, false, mdmModuleEntity, mdmModuleDbEntityList);
if (res == null || "".equals(res)) {
return BaseResult.getSuccessMessageEntity("保存数据成功");
@ -2637,8 +2643,8 @@ public class MdmServiceImpl implements IMdmService {
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() )){
if (mdmModuleViewEntity != null && mdmModuleViewEntity.getViewName() != null && "1".equals(mdmModuleViewEntity.getViewName()) &&
mdmModuleViewEntity.getUpIdFiled() != null && !"".equals(mdmModuleViewEntity.getUpIdFiled())) {
formmainDeleteDto.setUpIdFiled(mdmModuleViewEntity.getUpIdFiled());
Map<String, Object> queryData = new HashMap<>();
@ -2647,19 +2653,19 @@ public class MdmServiceImpl implements IMdmService {
queryData.put("id", jsonObject.getString("id"));//字段
HashMap<String, Object> datas = mdmModuleDbDao.getServiceDataById(queryData);
String upValue = null;
if(datas != null && datas.get(mdmModuleViewEntity.getUpIdFiled()) != 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 {
if (upValue != null) {
formmainDeleteDto.setUpIdFiledValue(upValue + "," + jsonObject.getString("id"));
} else {
formmainDeleteDto.setUpIdFiledValue(jsonObject.getString("id"));
}
mdmModuleDao.deleteChilder(formmainDeleteDto);
}
mdmModuleDao.deleteTemplateById(formmainDeleteDto);
}else {
} else {
//删除明细
FormmainDeleteDto formmainDeleteDto = new FormmainDeleteDto();
formmainDeleteDto.setFormmain_id(jsonObject.getString("id"));
@ -2672,7 +2678,6 @@ public class MdmServiceImpl implements IMdmService {
}
/**
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
@ -2696,36 +2701,152 @@ public class MdmServiceImpl implements IMdmService {
if (!checkData(jsonObject, "dataType")) {
return BaseResult.getFailureMessageEntity("请先传递要删除的数据");
}
//TODO 后续完成下发或者删除业务
if("2".equals(jsonObject.getString("dataType"))){
boolean flag = false;
//1根据服务名查询分发数据
MdmModuleEntity mdmModuleEntity = new MdmModuleEntity();
mdmModuleEntity.setMdmCode(jsonObject.getInteger("mdmCode"));
mdmModuleEntity.setSts("Y");
List<MdmModuleEntity> mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity);
//if
if (mdmModuleEntities != null && mdmModuleEntities.size() == 1) {
MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity();
mdmModuleDbEntity.setMdmId(mdmModuleEntities.get(0).getId());
mdmModuleDbEntity.setDbType("1");
mdmModuleDbEntity.setSts("Y");
List<MdmModuleDbEntity> mdmModuleDbEntities = mdmModuleDbDao.queryBase(mdmModuleDbEntity);
if (mdmModuleDbEntities != null && mdmModuleDbEntities.size() == 1) {
mdmModuleDbEntity = mdmModuleDbEntities.get(0);
}
MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity();
//mdmModuleDistributeEntity
//mdmModuleDistributeDao.
mdmModuleDistributeEntity.setAppId(jsonObject.getString("appID"));
mdmModuleDistributeEntity.setMdmId(mdmModuleEntities.get(0).getId());
List<MdmModuleDistributeEntity> mdmModuleDistributeEntities = mdmModuleDistributeDao.queryBase(mdmModuleDistributeEntity);
if (mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() == 1) {
if (mdmModuleDistributeEntities.get(0).getAddType() != null && "1".equals(mdmModuleDistributeEntities.get(0).getAddType())) {
//2查找插件
if (mdmModuleDistributeEntities.get(0).getAddPlug() != null && !"".equals(mdmModuleDistributeEntities.get(0).getAddPlug())) {
//2查找插件
SysApplicationPluginEntity sysApplicationPluginEntity = sysApplicationPluginDao.get(mdmModuleDistributeEntities.get(0).getAddPlug());
if(sysApplicationPluginEntity.getPluginCode() != null && !"".equals(sysApplicationPluginEntity.getPluginCode())){
//3调用插件
//PluginBaseEntity pluginBaseEntity = PluginUtils.getPluginsById(jsonObjectStr.getString("plug_id"));
//JsonResultEntity s = pluginBaseEntity.executeBusiness(jsonObjectStr);
PluginBaseEntity pluginBaseEntity = PluginUtils.getPluginsById(sysApplicationPluginEntity.getPluginCode());
try {
JsonResultEntity s = pluginBaseEntity.executeBusiness(jsonObject);
flag = true;
} catch (Exception e) {
logger.error("插件处理失败"+e.getMessage());
}
}
}
} else {
//TODO 连线
flag = true;
}
}
if(mdmModuleDbEntity.getDbName()!= null && !"".equals(mdmModuleDbEntity.getDbName())) {
MdmDistributeEntity mdmDistributeEntity = new MdmDistributeEntity();
mdmDistributeEntity.setCreate();
mdmDistributeEntity.setTableName(mdmModuleDbEntity.getDbName()+"_distribute");
mdmDistributeEntity.setFormmainId(jsonObject.getString("id"));
mdmDistributeEntity.setAppId(jsonObject.getString("appID"));
mdmDistributeEntity.setStatus("1");
mdmDistributeEntity.setMsg("发送成功");
if (!flag) {
mdmDistributeEntity.setStatus("3");
mdmDistributeEntity.setMsg("发送失败");
}
mdmModuleDao.saveDistribute(mdmDistributeEntity);
return BaseResult.getSuccessMessageEntity("下发数据成功");
}else {
return BaseResult.getFailureMessageEntity("系统错误");
}
}else {
return BaseResult.getFailureMessageEntity("系统错误");
}
}else {
if (!checkData(jsonObject, "distributeID")) {
return BaseResult.getFailureMessageEntity("请先传递分发数据");
}
boolean flag = false;
//1根据服务名查询分发数据
MdmModuleEntity mdmModuleEntity = new MdmModuleEntity();
mdmModuleEntity.setMdmCode(jsonObject.getInteger("mdmCode"));
mdmModuleEntity.setSts("Y");
List<MdmModuleEntity> mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity);
if (mdmModuleEntities != null && mdmModuleEntities.size() == 1) {
MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity();
mdmModuleDbEntity.setMdmId(mdmModuleEntities.get(0).getId());
mdmModuleDbEntity.setDbType("1");
mdmModuleDbEntity.setSts("Y");
List<MdmModuleDbEntity> mdmModuleDbEntities = mdmModuleDbDao.queryBase(mdmModuleDbEntity);
if (mdmModuleDbEntities != null && mdmModuleDbEntities.size() == 1) {
mdmModuleDbEntity = mdmModuleDbEntities.get(0);
}
MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity();
mdmModuleDistributeEntity.setAppId(jsonObject.getString("appID"));
mdmModuleDistributeEntity.setMdmId(mdmModuleEntities.get(0).getId());
List<MdmModuleDistributeEntity> mdmModuleDistributeEntities = mdmModuleDistributeDao.queryBase(mdmModuleDistributeEntity);
if (mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() == 1) {
if (mdmModuleDistributeEntities.get(0).getDeleteType() != null && "1".equals(mdmModuleDistributeEntities.get(0).getDeleteType())) {
//2查找插件
if (mdmModuleDistributeEntities.get(0).getDeletePlug() != null && !"".equals(mdmModuleDistributeEntities.get(0).getDeletePlug())) {
//2查找插件
SysApplicationPluginEntity sysApplicationPluginEntity = sysApplicationPluginDao.get(mdmModuleDistributeEntities.get(0).getDeletePlug());
if(sysApplicationPluginEntity.getPluginCode() != null && !"".equals(sysApplicationPluginEntity.getPluginCode())){
//3调用插件
PluginBaseEntity pluginBaseEntity = PluginUtils.getPluginsById(sysApplicationPluginEntity.getPluginCode());
try {
JsonResultEntity s = pluginBaseEntity.executeBusiness(jsonObject);
flag = true;
} catch (Exception e) {
logger.error("插件处理失败"+e.getMessage());
}
}
}
} else {
//TODO 连线
flag = true;
}
}
if(mdmModuleDbEntity.getDbName()!= null && !"".equals(mdmModuleDbEntity.getDbName())) {
//删除数据
MdmDistributeEntity mdmDistributeEntity = new MdmDistributeEntity();
mdmDistributeEntity.setId(jsonObject.getString("distributeID"));
mdmDistributeEntity.setTableName(mdmModuleDbEntity.getDbName()+"_distribute");
mdmDistributeEntity.setFormmainId(jsonObject.getString("id"));
mdmDistributeEntity.setAppId(jsonObject.getString("appID"));
mdmDistributeEntity.setStatus("1");
mdmDistributeEntity.setMsg("删除成功");
if (!flag) {
mdmDistributeEntity.setStatus("3");
mdmDistributeEntity.setMsg("删除失败");
}
mdmModuleDao.updateDistribute(mdmDistributeEntity);
return BaseResult.getSuccessMessageEntity("删除数据成功");
}else {
return BaseResult.getFailureMessageEntity("系统错误");
}
}else {
return BaseResult.getFailureMessageEntity("系统错误");
}
}
return BaseResult.getSuccessMessageEntity("处理分发数据成功");
}
/**
* @Author lvleigang
* @Description 校验数据
* @Date 11:20 上午 2023/11/6
* @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<MdmModuleDbEntity> mdmModuleDbEntityList) {
private String checkDataOnly(Integer mdmCode, JSONObject saveData, boolean flag, MdmModuleEntity mdmModuleEntity, List<MdmModuleDbEntity> mdmModuleDbEntityList) {
StringBuffer str = new StringBuffer();
//查询字段
@ -2737,32 +2858,32 @@ public class MdmServiceImpl implements IMdmService {
mdmModuleDbFiledsEntity.setRoleValue("true");
List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntityList = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity);
if(mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0){
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())){
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()+"不为空");
str.append(mdmModuleDbEntityList.get(i).getRemark() + "" + mdmModuleDbFiledsEntityList.get(i1).getChName() + "不为空");
}
}
}
}else {
} else {
JSONArray jsonArray = saveData.getJSONArray(mdmModuleDbEntityList.get(i).getDbName());
if(jsonArray != null && jsonArray.size() > 0){
if (jsonArray != null && jsonArray.size() > 0) {
for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) {
if(mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())){
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())){
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()+"不为空");
str.append(mdmModuleDbEntityList.get(i).getRemark() + "" + mdmModuleDbFiledsEntityList.get(i1).getChName() + "不为空");
break;
}
}
@ -2783,51 +2904,51 @@ public class MdmServiceImpl implements IMdmService {
List<MdmModuleDbFiledsEntity> onlyEntityList = mdmModuleDbFiledsDao.queryBase(onlyFiledsEntity);
if(onlyEntityList != null && onlyEntityList.size() > 0){
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())){
if (onlyEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())) {
//校验唯一
Map<String,String> map = new HashMap<>();
map.put("tableName",mdmModuleDbEntityList.get(i).getDbName());
if(flag){
map.put("id",jsonObject.getString("id"));
Map<String, String> 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()));
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())){
if (count > 0) {
if (str.toString() != null && !"".equals(str.toString())) {
str.append("");
}
str.append(mdmModuleDbEntityList.get(i).getRemark()+""+mdmModuleDbFiledsEntityList.get(i1).getChName()+"已存在");
str.append(mdmModuleDbEntityList.get(i).getRemark() + "" + mdmModuleDbFiledsEntityList.get(i1).getChName() + "已存在");
}
}
}
}else {
} else {
JSONArray jsonArray = saveData.getJSONArray(mdmModuleDbEntityList.get(i).getDbName());
if(jsonArray != null && jsonArray.size() > 0){
if (jsonArray != null && jsonArray.size() > 0) {
for (int i1 = 0; i1 < onlyEntityList.size(); i1++) {
if(onlyEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())){
if (onlyEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())) {
for (int i2 = 0; i2 < jsonArray.size(); i2++) {
JSONObject jsonObject = jsonArray.getJSONObject(i2);
//校验唯一
Map<String,String> map = new HashMap<>();
map.put("tableName",mdmModuleDbEntityList.get(i).getDbName());
if(flag){
map.put("id",jsonObject.getString("id"));
Map<String, String> 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()));
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())){
if (count > 0) {
if (str.toString() != null && !"".equals(str.toString())) {
str.append("");
}
str.append(mdmModuleDbEntityList.get(i).getRemark()+""+mdmModuleDbFiledsEntityList.get(i1).getChName()+"已存在");
str.append(mdmModuleDbEntityList.get(i).getRemark() + "" + mdmModuleDbFiledsEntityList.get(i1).getChName() + "已存在");
break;
}
}
@ -2862,25 +2983,25 @@ public class MdmServiceImpl implements IMdmService {
List<MdmTableCodeRuleEntity> mdmTableCodeRuleEntities = mdmTableCodeRuleDao.queryBase(mdmTableCodeRuleEntity);
StringBuffer document_rule = new StringBuffer();
Integer document_rule_num = 0;
if(mdmTableCodeRuleEntities != null && mdmTableCodeRuleEntities.size() > 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())){
if ("1".equals(mdmTableCodeRuleEntities.get(i1).getDbType())) {
document_rule.append("-");
}else if("2".equals(mdmTableCodeRuleEntities.get(i1).getDbType())){
} else if ("2".equals(mdmTableCodeRuleEntities.get(i1).getDbType())) {
document_rule.append(mdmTableCodeRuleEntities.get(i1).getDbValue());
}else if("3".equals(mdmTableCodeRuleEntities.get(i1).getDbType())){
} 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())){
} else if ("4".equals(mdmTableCodeRuleEntities.get(i1).getDbType())) {
document_rule_num = mdmTableCodeRuleEntities.get(i1).getDbValue().length();
}
}
}
List<MdmDataFiledDto> mdmDataFiledDtos = new ArrayList<>();
for (int i1 = 0; i1 < fileds.size(); i1++) {
if(jsonObject.get(fileds.get(i1).getEnName()) != null ){
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()));
@ -2892,11 +3013,11 @@ public class MdmServiceImpl implements IMdmService {
mdmDataFiledDto.setFiledsValue(StpUtil.getLoginIdAsString());
mdmDataFiledDtos.add(mdmDataFiledDto);
mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos);
if(flag){
if (flag) {
mdmDataDto.setId(jsonObject.getString("id"));
id = jsonObject.getString("id");
int a = mdmModuleDao.updateForm(mdmDataDto);
}else {
} else {
mdmDataDto.setDbType(mdmModuleDbEntityList.get(i).getDbType());
mdmDataDto.setDocumentRule(document_rule.toString());
@ -2921,7 +3042,7 @@ public class MdmServiceImpl implements IMdmService {
mdmModuleDao.deleteTemplateById(formmainDeleteDto);
JSONArray jsonArray = saveData.getJSONArray(mdmModuleDbEntityList.get(i).getDbName());
if(jsonArray != null && jsonArray.size() > 0){
if (jsonArray != null && jsonArray.size() > 0) {
MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity1 = new MdmModuleDbFiledsEntity();
mdmModuleDbFiledsEntity1.setMdmId(mdmModuleEntity.getId());
mdmModuleDbFiledsEntity1.setDbId(mdmModuleDbEntityList.get(i).getId());
@ -2951,14 +3072,14 @@ public class MdmServiceImpl implements IMdmService {
mdmDataFiledDtos.add(formain_id);
mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos);
if(jsonObject.getString("id") != null ){
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 {
} else {
MdmDataFiledDto ids = new MdmDataFiledDto();
ids.setFiledsName("id");
ids.setFiledsValue(UUIDUtils.getUUID());

View File

@ -115,7 +115,7 @@
<if test="companyId != null and companyId != ''">and company_id like concat('%',#{companyId},'%')</if>
and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() ">order by sorts asc</if>
<if test=" sort == null or sort == ''.toString() ">order by sorts desc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>