修改适配达梦
This commit is contained in:
parent
783d8e5606
commit
c2b8961854
|
@ -1,5 +1,6 @@
|
|||
package com.hzya.frame.plugin.mdmDistribute.plugin;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
@ -24,7 +25,6 @@ import com.hzya.frame.sysnew.application.api.dao.ISysApplicationApiDao;
|
|||
import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity;
|
||||
import com.hzya.frame.sysnew.application.dao.ISysApplicationDao;
|
||||
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
|
||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||
import com.hzya.frame.sysnew.application.script.dao.ISysApplicationScriptDao;
|
||||
import com.hzya.frame.sysnew.application.script.entity.SysApplicationScriptEntity;
|
||||
import com.hzya.frame.sysnew.grovy.service.IGroovyIntegrationService;
|
||||
|
@ -47,11 +47,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 主数据模版(MdmModule)表服务接口
|
||||
|
@ -106,7 +102,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "MdmModulePlugin插件";
|
||||
return "主数据下发";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -252,6 +248,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
map.put("tableName",mdmModuleDbEntities.get(i).getDbName());
|
||||
map.put("documentRule",documentRule);
|
||||
object = mdmModuleDao.queryMdmST(map);
|
||||
object = toLowerCaseKeys(object);
|
||||
if(object.getString("id") == null || "".equals(object.getString("id")) ){
|
||||
taskDetailEntity.setResult("当前数据不存在");
|
||||
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
|
||||
|
@ -263,6 +260,8 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
checkData.put("documentRule",documentRule);
|
||||
checkData.put("mdmModuleDistributeDetailEntities",mdmModuleDistributeDetailEntities);
|
||||
JSONObject object1 = mdmModuleDao.queryMdmST(checkData);
|
||||
object1 = toLowerCaseKeys(object1);
|
||||
|
||||
if(object1.getString("id") == null || "".equals(object1.getString("id")) ){
|
||||
taskDetailEntity.setResult("当前数据不符合规则不发送");
|
||||
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
|
||||
|
@ -283,6 +282,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
String[] idss = ids.split(",");
|
||||
mapDetail.put("id", idss[idss.length-1]);
|
||||
JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail);
|
||||
objectDetail = toLowerCaseKeys(objectDetail);
|
||||
object.put(mdmModuleDbFiledsEntities.get(i2).getEnName(),objectDetail);
|
||||
}
|
||||
}
|
||||
|
@ -296,10 +296,12 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
|
||||
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
|
||||
if("2".equals(mdmModuleDbEntities.get(i).getDbType())){
|
||||
Map<String,String> map = new HashMap<>();
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("tableName",mdmModuleDbEntities.get(i).getDbName());
|
||||
map.put("formmainId",object.getString("id"));
|
||||
List<JSONObject> detail = mdmModuleDao.queryMdmSTDetail(map);
|
||||
detail = toLowerCaseKeys(detail);
|
||||
|
||||
//查看主表是否有字段是关联的
|
||||
if(detail != null && detail.size() > 0){
|
||||
if(mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0){
|
||||
|
@ -317,6 +319,8 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
mapDetail.put("id", idss[idss.length-1]);
|
||||
|
||||
JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail);
|
||||
objectDetail = toLowerCaseKeys(objectDetail);
|
||||
|
||||
detail.get(i3).put(mdmModuleDbFiledsEntities.get(i2).getEnName(),objectDetail);
|
||||
}
|
||||
|
||||
|
@ -422,6 +426,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
}
|
||||
//查询下发的配置 没有直接跳过
|
||||
for (int i = 0; i < mdmModuleEntities.size(); i++) {
|
||||
Long mdmCode = mdmModuleEntities.get(i).getMdmCode();
|
||||
MdmModuleDistributeEntity queryMdmModuleDistributeEntity = new MdmModuleDistributeEntity();
|
||||
queryMdmModuleDistributeEntity.setMdmId(mdmModuleEntities.get(i).getId());
|
||||
queryMdmModuleDistributeEntity.setEnabledType("1");
|
||||
|
@ -451,11 +456,11 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(queryFildRule);
|
||||
|
||||
//新增
|
||||
doAdd(mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
|
||||
doAdd(mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
|
||||
//修改
|
||||
doUpdate(mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
|
||||
//doUpdate(mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
|
||||
//删除
|
||||
doDelete(mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
|
||||
//doDelete(mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
|
||||
|
||||
}
|
||||
|
||||
|
@ -469,7 +474,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
return BaseResult.getSuccessMessageEntity("执行成功");
|
||||
}
|
||||
|
||||
private void doDelete(List<MdmModuleDbEntity> mdmModuleDbEntities, List<MdmModuleDistributeEntity> mdmModuleDistributeEntities, List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities, List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities) {
|
||||
private void doDelete(Long mainCode,List<MdmModuleDbEntity> mdmModuleDbEntities, List<MdmModuleDistributeEntity> mdmModuleDistributeEntities, List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities, List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities) throws Exception {
|
||||
//查询一千条数据
|
||||
String mainDb = null;
|
||||
List<JSONObject> objects = new ArrayList<>();
|
||||
|
@ -485,8 +490,9 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
map1.put("tableName",mainDb);
|
||||
map1.put("dataStatus", "N");
|
||||
map1.put("deleteStatus", "0");
|
||||
map1.put("size", 1000);
|
||||
map1.put("size", 10);
|
||||
objects = mdmModuleDao.queryMdmSTs(map1);
|
||||
objects = toLowerCaseKeys(objects);
|
||||
|
||||
if(objects == null || objects.size() == 0){
|
||||
return;
|
||||
|
@ -505,26 +511,28 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
map.put("mdmModuleDistributeDetailEntities", mdmModuleDistributeDetailEntities);
|
||||
map.put("ids", objects);
|
||||
List<JSONObject> doObjects = mdmModuleDao.queryMdmSTs(map);
|
||||
doObjects = toLowerCaseKeys(doObjects);
|
||||
|
||||
if(doObjects == null || doObjects.size() == 0){
|
||||
continue;
|
||||
}
|
||||
if(mdmModuleDistributeEntities.get(i1).getDeleteApi() == null || "".equals(mdmModuleDistributeEntities.get(i1).getDeleteApi())){
|
||||
for (int i = 0; i < doObjects.size(); i++) {
|
||||
saveMdmModuleSendLogEntity("2","删除接口未设置",mainDb,objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"3");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","删除接口未设置",mainDb,objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"3");
|
||||
}
|
||||
return ;
|
||||
}
|
||||
SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(mdmModuleDistributeEntities.get(i1).getDeleteApi());
|
||||
if(apiEntity == null || apiEntity.getId() == null ){
|
||||
for (int i = 0; i < doObjects.size(); i++) {
|
||||
saveMdmModuleSendLogEntity("2","删除接口未找到",mainDb,objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"3");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","删除接口未找到",mainDb,objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"3");
|
||||
}
|
||||
return ;
|
||||
}
|
||||
SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(apiEntity.getAppId());
|
||||
if(sysApplicationEntity == null || sysApplicationEntity.getId() == null ){
|
||||
for (int i = 0; i < doObjects.size(); i++) {
|
||||
saveMdmModuleSendLogEntity("2","删除接口的应用未找到",mainDb,objects.get(i).getString("id"),null,apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","删除接口的应用未找到",mainDb,objects.get(i).getString("id"),null,apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3");
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
@ -534,7 +542,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
scriptEntity = sysApplicationScriptDao.get(mdmModuleDistributeEntities.get(i1).getDeleteScript());
|
||||
if(scriptEntity == null || scriptEntity.getId() == null ){
|
||||
for (int i = 0; i < doObjects.size(); i++) {
|
||||
saveMdmModuleSendLogEntity("2","删除接口脚本未找到",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","删除接口脚本未找到",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3");
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
@ -581,7 +589,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
querys = jsonResultEntity.getString("querys");
|
||||
bodys = jsonResultEntity.getString("bodys");
|
||||
}catch (Exception e){
|
||||
saveMdmModuleSendLogEntity("2","脚本处理失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","脚本处理失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -597,7 +605,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
//找到登陆接口
|
||||
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
|
||||
if (null == loginApi) {
|
||||
saveMdmModuleSendLogEntity("2","发送错误,认证接口不存在",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","发送错误,认证接口不存在",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||
continue;
|
||||
}
|
||||
String rzquerys = getQuery(loginApi,null,null);
|
||||
|
@ -610,7 +618,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
String rzbodys = getBodys(loginApi,null,null);
|
||||
JsonResultEntity rzjsonResultEntity = sendData(loginApi,rzheaders,rzbodys,rzquerys);
|
||||
if (!rzjsonResultEntity.isFlag()) {
|
||||
saveMdmModuleSendLogEntity("2","发送错误,认证接口错误",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","发送错误,认证接口错误",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||
continue;
|
||||
}
|
||||
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
||||
|
@ -622,11 +630,11 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
|
||||
if(jsonResultEntity.isFlag()){
|
||||
//保存日志
|
||||
saveMdmModuleSendLogEntity("1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3");
|
||||
continue;
|
||||
}else {
|
||||
//保存日志
|
||||
saveMdmModuleSendLogEntity("2","转发失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -644,7 +652,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
}
|
||||
}
|
||||
|
||||
private void doUpdate(List<MdmModuleDbEntity> mdmModuleDbEntities, List<MdmModuleDistributeEntity> mdmModuleDistributeEntities, List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities, List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities) {
|
||||
private void doUpdate(Long mainCode,List<MdmModuleDbEntity> mdmModuleDbEntities, List<MdmModuleDistributeEntity> mdmModuleDistributeEntities, List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities, List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities) throws Exception {
|
||||
//查询一千条数据
|
||||
String mainDb = null;
|
||||
List<JSONObject> objects = new ArrayList<>();
|
||||
|
@ -660,8 +668,9 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
map1.put("tableName",mainDb);
|
||||
//map1.put("dataStatus", "F");
|
||||
map1.put("updateStatus", "0");
|
||||
map1.put("size", 1000);
|
||||
map1.put("size", 10);
|
||||
objects = mdmModuleDao.queryMdmSTs(map1);
|
||||
objects = toLowerCaseKeys(objects);
|
||||
|
||||
if(objects == null || objects.size() == 0){
|
||||
return;
|
||||
|
@ -680,26 +689,28 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
map.put("mdmModuleDistributeDetailEntities", mdmModuleDistributeDetailEntities);
|
||||
map.put("ids", objects);
|
||||
List<JSONObject> doObjects = mdmModuleDao.queryMdmSTs(map);
|
||||
doObjects = toLowerCaseKeys(doObjects);
|
||||
|
||||
if(doObjects == null || doObjects.size() == 0){
|
||||
continue;
|
||||
}
|
||||
if(mdmModuleDistributeEntities.get(i1).getUpdateApi() == null || "".equals(mdmModuleDistributeEntities.get(i1).getUpdateApi())){
|
||||
for (int i = 0; i < doObjects.size(); i++) {
|
||||
saveMdmModuleSendLogEntity("2","修改接口未设置",mainDb,objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"2");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","修改接口未设置",mainDb,objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"2");
|
||||
}
|
||||
return ;
|
||||
}
|
||||
SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(mdmModuleDistributeEntities.get(i1).getUpdateApi());
|
||||
if(apiEntity == null || apiEntity.getId() == null ){
|
||||
for (int i = 0; i < doObjects.size(); i++) {
|
||||
saveMdmModuleSendLogEntity("2","修改接口未查找到",mainDb,objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"2");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","修改接口未查找到",mainDb,objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"2");
|
||||
}
|
||||
return ;
|
||||
}
|
||||
SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(apiEntity.getAppId());
|
||||
if(sysApplicationEntity == null || sysApplicationEntity.getId() == null ){
|
||||
for (int i = 0; i < doObjects.size(); i++) {
|
||||
saveMdmModuleSendLogEntity("2","应用未查找到",mainDb,objects.get(i).getString("id"),null,apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","应用未查找到",mainDb,objects.get(i).getString("id"),null,apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2");
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
@ -709,7 +720,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
scriptEntity = sysApplicationScriptDao.get(mdmModuleDistributeEntities.get(i1).getUpdateScript());
|
||||
if(scriptEntity == null || scriptEntity.getId() == null ){
|
||||
for (int i = 0; i < doObjects.size(); i++) {
|
||||
saveMdmModuleSendLogEntity("2","脚本未查找到",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","脚本未查找到",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2");
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
@ -747,7 +758,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
querys = jsonResultEntity.getString("querys");
|
||||
bodys = jsonResultEntity.getString("bodys");
|
||||
}catch (Exception e){
|
||||
saveMdmModuleSendLogEntity("2","脚本处理失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","脚本处理失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -763,7 +774,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
//找到登陆接口
|
||||
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
|
||||
if (null == loginApi) {
|
||||
saveMdmModuleSendLogEntity("2","发送错误,认证接口不存在",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","发送错误,认证接口不存在",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||
continue;
|
||||
}
|
||||
String rzquerys = getQuery(loginApi,null,null);
|
||||
|
@ -776,7 +787,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
String rzbodys = getBodys(loginApi,null,null);
|
||||
JsonResultEntity rzjsonResultEntity = sendData(loginApi,rzheaders,rzbodys,rzquerys);
|
||||
if (!rzjsonResultEntity.isFlag()) {
|
||||
saveMdmModuleSendLogEntity("2","发送错误,认证接口错误",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","发送错误,认证接口错误",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||
continue;
|
||||
}
|
||||
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
||||
|
@ -788,11 +799,11 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
|
||||
if(jsonResultEntity.isFlag()){
|
||||
//保存日志
|
||||
saveMdmModuleSendLogEntity("1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2");
|
||||
continue;
|
||||
}else {
|
||||
//保存日志
|
||||
saveMdmModuleSendLogEntity("2","转发失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -817,7 +828,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
* @param mdmModuleDistributeEntities
|
||||
* @return void
|
||||
**/
|
||||
private void doAdd(List<MdmModuleDbEntity> mdmModuleDbEntities, List<MdmModuleDistributeEntity> mdmModuleDistributeEntities,List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities,List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities ) {
|
||||
private void doAdd(Long mainCode,List<MdmModuleDbEntity> mdmModuleDbEntities, List<MdmModuleDistributeEntity> mdmModuleDistributeEntities,List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities,List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities ) throws Exception {
|
||||
//查询一千条数据
|
||||
String mainDb = null;
|
||||
List<JSONObject> objects = new ArrayList<>();
|
||||
|
@ -833,8 +844,9 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
map1.put("tableName",mainDb);
|
||||
//map1.put("dataStatus", "Y");
|
||||
map1.put("addStatus", "0");
|
||||
map1.put("size", 1000);
|
||||
map1.put("size", 10);
|
||||
objects = mdmModuleDao.queryMdmSTs(map1);
|
||||
objects = toLowerCaseKeys(objects);
|
||||
|
||||
if(objects == null || objects.size() == 0){
|
||||
return;
|
||||
|
@ -853,26 +865,29 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
map.put("mdmModuleDistributeDetailEntities", mdmModuleDistributeDetailEntities);
|
||||
map.put("ids", objects);
|
||||
List<JSONObject> doObjects = mdmModuleDao.queryMdmSTs(map);
|
||||
doObjects = toLowerCaseKeys(doObjects);
|
||||
|
||||
if(doObjects == null || doObjects.size() == 0){
|
||||
continue;
|
||||
}
|
||||
if(mdmModuleDistributeEntities.get(i1).getAddApi() == null || "".equals(mdmModuleDistributeEntities.get(i1).getAddApi())){
|
||||
for (int i = 0; i < doObjects.size(); i++) {
|
||||
saveMdmModuleSendLogEntity("2","新增接口未设置",mainDb,objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"1");
|
||||
//taskLivingDetailsService.saveLogToSuccess();
|
||||
saveMdmModuleSendLogEntity( mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","新增接口未设置",mainDb,objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"1");
|
||||
}
|
||||
return ;
|
||||
}
|
||||
SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(mdmModuleDistributeEntities.get(i1).getAddApi());
|
||||
if(apiEntity == null || apiEntity.getId() == null ){
|
||||
for (int i = 0; i < doObjects.size(); i++) {
|
||||
saveMdmModuleSendLogEntity("2","新增接口未查找到",mainDb,objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"1");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","新增接口未查找到",mainDb,objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"1");
|
||||
}
|
||||
return ;
|
||||
}
|
||||
SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(apiEntity.getAppId());
|
||||
if(sysApplicationEntity == null || sysApplicationEntity.getId() == null ){
|
||||
for (int i = 0; i < doObjects.size(); i++) {
|
||||
saveMdmModuleSendLogEntity("2","应用未查找到",mainDb,objects.get(i).getString("id"),null,apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","应用未查找到",mainDb,objects.get(i).getString("id"),null,apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
@ -882,7 +897,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
scriptEntity = sysApplicationScriptDao.get(mdmModuleDistributeEntities.get(i1).getAddScript());
|
||||
if(scriptEntity == null || scriptEntity.getId() == null ){
|
||||
for (int i = 0; i < doObjects.size(); i++) {
|
||||
saveMdmModuleSendLogEntity("2","脚本未查找到",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","脚本未查找到",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
@ -929,7 +944,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
querys = jsonResultEntity.getString("querys");
|
||||
bodys = jsonResultEntity.getString("bodys");
|
||||
}catch (Exception e){
|
||||
saveMdmModuleSendLogEntity("2","脚本处理失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","脚本处理失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -945,7 +960,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
//找到登陆接口
|
||||
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
|
||||
if (null == loginApi) {
|
||||
saveMdmModuleSendLogEntity("2","发送错误,认证接口不存在",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","发送错误,认证接口不存在",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||
continue;
|
||||
}
|
||||
String rzquerys = getQuery(loginApi,null,null);
|
||||
|
@ -958,7 +973,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
String rzbodys = getBodys(loginApi,null,null);
|
||||
JsonResultEntity rzjsonResultEntity = sendData(loginApi,rzheaders,rzbodys,rzquerys);
|
||||
if (!rzjsonResultEntity.isFlag()) {
|
||||
saveMdmModuleSendLogEntity("2","发送错误,认证接口错误",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","发送错误,认证接口错误",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||
continue;
|
||||
}
|
||||
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
||||
|
@ -971,11 +986,11 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
|
||||
if(jsonResultEntity.isFlag()){
|
||||
//保存日志
|
||||
saveMdmModuleSendLogEntity("1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||
continue;
|
||||
}else {
|
||||
//保存日志
|
||||
saveMdmModuleSendLogEntity("2","转发失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","转发失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -992,7 +1007,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
}
|
||||
}
|
||||
|
||||
private void saveMdmModuleSendLogEntity(String dataType,String remark,String dbname,String formmain_id, String target_app, String target_api, String source_data, String option_type) {
|
||||
private void saveMdmModuleSendLogEntity(Long mdmCode,String distributeId,String dataType,String remark,String dbname,String formmain_id, String target_app, String target_api, String source_data, String option_type) throws Exception {
|
||||
MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity();
|
||||
mdmModuleSendLogEntity.setTableName(dbname+"_send_log");
|
||||
mdmModuleSendLogEntity.setId(UUIDUtils.getUUID());
|
||||
|
@ -1011,16 +1026,47 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
mdmModuleSendLogEntity.setDataType(dataType);
|
||||
mdmModuleSendLogEntity.setRemark(remark);
|
||||
mdmModuleSendLogDao.save(mdmModuleSendLogEntity);
|
||||
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(source_data);
|
||||
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
|
||||
integrationTaskLivingDetailsEntity.setId(UUIDUtils.getUUID());
|
||||
integrationTaskLivingDetailsEntity.setSts("Y");
|
||||
integrationTaskLivingDetailsEntity.setCreate_user_id("1");
|
||||
integrationTaskLivingDetailsEntity.setModify_user_id("1");
|
||||
integrationTaskLivingDetailsEntity.setCreate_time(new Date());
|
||||
integrationTaskLivingDetailsEntity.setModify_time(new Date());
|
||||
integrationTaskLivingDetailsEntity.setOrg_id("0");
|
||||
integrationTaskLivingDetailsEntity.setCompanyId("0");
|
||||
JSONObject aa = new JSONObject();
|
||||
aa.put("mdmCode",mdmCode);//主数据编码
|
||||
aa.put("documentRule",jsonObject.getString("document_rule"));//行数据的单据规则编码
|
||||
aa.put("distributeId",distributeId);//发送表id
|
||||
aa.put("type",option_type);//发送类型,1、新增2、修改3、删除
|
||||
integrationTaskLivingDetailsEntity.setRootAppPk(aa.toJSONString());
|
||||
integrationTaskLivingDetailsEntity.setRootAppBill(jsonObject.getString("document_rule"));
|
||||
integrationTaskLivingDetailsEntity.setPluginId("MdmModulePlugin");
|
||||
integrationTaskLivingDetailsEntity.setRootAppNewData(source_data);
|
||||
integrationTaskLivingDetailsEntity.setNewTransmitInfo(remark);
|
||||
if("1".equals(dataType)){
|
||||
taskLivingDetailsService.saveLogToSuccess(integrationTaskLivingDetailsEntity);
|
||||
}else {
|
||||
taskLivingDetailsService.saveLogToFail(integrationTaskLivingDetailsEntity);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private JSONObject getDetailData(List<MdmModuleDbEntity> mdmModuleDbEntities, JSONObject object, List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities,List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities) {
|
||||
|
||||
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
|
||||
if("2".equals(mdmModuleDbEntities.get(i).getDbType())){
|
||||
Map<String,String> map = new HashMap<>();
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("tableName",mdmModuleDbEntities.get(i).getDbName());
|
||||
map.put("formmainId",object.getString("id"));
|
||||
List<JSONObject> detail = mdmModuleDao.queryMdmSTDetail(map);
|
||||
detail = toLowerCaseKeys(detail);
|
||||
|
||||
//查看主表是否有字段是关联的
|
||||
if(detail != null && detail.size() > 0){
|
||||
if(mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0){
|
||||
|
@ -1037,6 +1083,8 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
String[] idss = ids.split(",");
|
||||
mapDetail.put("id", idss[idss.length-1]);
|
||||
JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail);
|
||||
objectDetail = toLowerCaseKeys(objectDetail);
|
||||
|
||||
detail.get(i3).put(mdmModuleDbFiledsEntities.get(i2).getEnName(),objectDetail);
|
||||
}
|
||||
}
|
||||
|
@ -1280,4 +1328,23 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
}
|
||||
return sendData.toString();
|
||||
}
|
||||
public JSONObject toLowerCaseKeys(JSONObject jsonObject) {
|
||||
JSONObject lowerCaseJson = new JSONObject();
|
||||
if (jsonObject != null) {
|
||||
for (String key : jsonObject.keySet()) {
|
||||
Object value = jsonObject.get(key);
|
||||
lowerCaseJson.put(key.toLowerCase(), value);
|
||||
}
|
||||
}
|
||||
return lowerCaseJson;
|
||||
}
|
||||
public List<JSONObject> toLowerCaseKeys(List<JSONObject> list) {
|
||||
List<JSONObject> jsonObjects = new ArrayList<>();
|
||||
if (list != null && list.size() > 0) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
jsonObjects.add(toLowerCaseKeys(list.get(i)));
|
||||
}
|
||||
}
|
||||
return jsonObjects;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,10 +50,19 @@ public interface IMdmModuleDao extends IBaseDao<MdmModuleEntity, String> {
|
|||
|
||||
|
||||
JSONObject queryMdmST(Map<String, Object> maps);
|
||||
List<JSONObject> queryMdmSTDetail(Map<String, String> maps);
|
||||
List<JSONObject> queryMdmSTDetail(Map<String, Object> maps);
|
||||
|
||||
List<JSONObject> queryMdmSTs(Map<String, Object> map);
|
||||
|
||||
void updateMdmSTs(Map<String, Object> updateMap);
|
||||
/****
|
||||
* 查询主数据字段
|
||||
* @content:
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2024-06-27 16:26
|
||||
* @param
|
||||
* @return java.util.List<java.lang.Object>
|
||||
**/
|
||||
//List<String> queryMdMFields(Map<String, Object> maps);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package com.hzya.frame.mdm.mdmModule.dao.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
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.mdm.mdmModule.entity.MdmModuleEntity;
|
||||
import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity;
|
||||
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;
|
||||
|
@ -30,6 +30,8 @@ public class MdmModuleDaoImpl extends MybatisGenericDao<MdmModuleEntity, String>
|
|||
return o;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public MdmModuleEntity getByMdmCode(Long mdmCode) {
|
||||
MdmModuleEntity mdmModuleEntity = (MdmModuleEntity) super.selectOne(getSqlIdPrifx() + "getByMdmCode",mdmCode);
|
||||
|
@ -112,6 +114,10 @@ public class MdmModuleDaoImpl extends MybatisGenericDao<MdmModuleEntity, String>
|
|||
|
||||
@Override
|
||||
public List<HashMap<String, Object>> queryMdmShowData(MdmQuery entity) {
|
||||
//HashMap<String, Object> maps = new HashMap<>();
|
||||
//maps.put("tableName",entity.getTableName());
|
||||
//List<String> fields = queryMdMFields(maps);
|
||||
//entity.setFields(fields);
|
||||
List<HashMap<String, Object>> o = (List<HashMap<String, Object>>) super.selectList(getSqlIdPrifx() + "queryMdmShowData", entity);
|
||||
return o;
|
||||
}
|
||||
|
@ -149,6 +155,8 @@ public class MdmModuleDaoImpl extends MybatisGenericDao<MdmModuleEntity, String>
|
|||
|
||||
@Override
|
||||
public JSONObject queryMdmST(Map<String, Object> maps) {
|
||||
//List<String> fields = queryMdMFields(maps);
|
||||
//maps.put("fields",fields);
|
||||
JSONObject o = (JSONObject) super.selectOne(getSqlIdPrifx() + "queryMdmST", maps);
|
||||
return o;
|
||||
}
|
||||
|
@ -163,8 +171,16 @@ public class MdmModuleDaoImpl extends MybatisGenericDao<MdmModuleEntity, String>
|
|||
super.update(getSqlIdPrifx() + "updateMdmSTs", maps);
|
||||
}
|
||||
|
||||
//@Override
|
||||
//public List<String> queryMdMFields(Map<String, Object> maps) {
|
||||
// List<String> o = (List<String>) super.selectList(getSqlIdPrifx() + "queryMdMFields", maps);
|
||||
// return o;
|
||||
//}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> queryMdmSTDetail(Map<String, String> maps) {
|
||||
public List<JSONObject> queryMdmSTDetail(Map<String, Object> maps) {
|
||||
//List<String> fields = queryMdMFields(maps);
|
||||
//maps.put("fields", fields );
|
||||
List<JSONObject> o = (List<JSONObject>) super.selectList(getSqlIdPrifx() + "queryMdmSTDetail", maps);
|
||||
return o;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
|
||||
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
<!-- 查询的字段-->
|
||||
<sql id="MdmModuleEntity_Base_Column_List">
|
||||
id
|
||||
|
@ -657,11 +660,61 @@ where id = #{id}
|
|||
</if>
|
||||
</foreach>
|
||||
</if>
|
||||
modify_time = now(),
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<insert id="saveForm" databaseId="oracle" parameterType="com.hzya.frame.mdm.entity.MdmDataDto">
|
||||
insert into ${tableName}(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="mdmDataFiledDtos != null and mdmDataFiledDtos.size>0">
|
||||
<foreach collection="mdmDataFiledDtos" item="item" index="index">
|
||||
<if test="item.filedsName != 'logid'.toString() ">
|
||||
${item.filedsName},
|
||||
</if>
|
||||
<if test="item.filedsName == 'logid'.toString() ">
|
||||
create_user_id,
|
||||
modify_user_id,
|
||||
</if>
|
||||
</foreach>
|
||||
</if>
|
||||
create_time,
|
||||
modify_time,
|
||||
sts,
|
||||
<if test="dbType == '1'.toString()">
|
||||
document_rule,
|
||||
document_rule_num,
|
||||
</if>
|
||||
</trim>
|
||||
)values
|
||||
(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="mdmDataFiledDtos != null and mdmDataFiledDtos.size>0">
|
||||
<foreach collection="mdmDataFiledDtos" item="item" index="index">
|
||||
<if test="item.filedsName != 'logid'.toString() ">
|
||||
#{item.filedsValue},
|
||||
</if>
|
||||
<if test="item.filedsName == 'logid'.toString() ">
|
||||
#{item.filedsValue},
|
||||
#{item.filedsValue},
|
||||
</if>
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
now(),
|
||||
now(),
|
||||
'Y',
|
||||
<if test="dbType == '1'.toString()">
|
||||
|
||||
|
||||
concat(#{documentRule},
|
||||
LPAD( CAST( ( 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' ) ) AS varchar(50) ), ${documentRuleNum} , '0' )
|
||||
),
|
||||
(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' )
|
||||
)
|
||||
</if>
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
<insert id="saveForm" parameterType="com.hzya.frame.mdm.entity.MdmDataDto">
|
||||
insert into ${tableName}(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
|
@ -803,11 +856,29 @@ where id = #{id}
|
|||
select count(1) from ${tableName} where sts='Y'
|
||||
</select>
|
||||
|
||||
<!-- 根据表名称查询所有的字段,返回小写个是-->
|
||||
<select id="queryMdMFields" resultType="String" parameterType="java.util.HashMap" >
|
||||
SELECT
|
||||
LOWER(COLUMN_NAME) as fileds
|
||||
FROM
|
||||
USER_TAB_COLUMNS
|
||||
WHERE
|
||||
TABLE_NAME = #{tableName}
|
||||
|
||||
</select>
|
||||
<!-- 分页查询列表 采用like格式 -->
|
||||
<select id="queryMdmST" resultType="com.alibaba.fastjson.JSONObject"
|
||||
parameterType="java.util.HashMap">
|
||||
select * from ${tableName}
|
||||
<select id="queryMdmST" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.util.HashMap">
|
||||
select
|
||||
|
||||
<if test="field != null and field.size>0">
|
||||
<foreach item="field" collection="fields" separator="," >
|
||||
${field}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="field == null or field.size == 0">
|
||||
*
|
||||
</if>
|
||||
from ${tableName}
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="documentRule != null and documentRule !='' ">and document_rule = #{documentRule}</if>
|
||||
<if test="dataStatus != null and dataStatus !='' ">and data_status = #{dataStatus}</if>
|
||||
|
@ -870,12 +941,23 @@ where id = #{id}
|
|||
and sts = 'Y'
|
||||
<if test="size != null and size !='' ">limit #{size}</if>
|
||||
</trim>
|
||||
order by sorts asc
|
||||
</select>
|
||||
|
||||
<!-- 分页查询列表 采用like格式 -->
|
||||
<select id="queryMdmSTDetail" resultType="com.alibaba.fastjson.JSONObject"
|
||||
parameterType="java.util.HashMap">
|
||||
select * from ${tableName} where sts='Y' and formmain_id = #{formmainId}
|
||||
select
|
||||
<if test="field != null and field.size>0">
|
||||
<foreach item="field" collection="fields" separator="," >
|
||||
${field}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="field == null or field.size == 0">
|
||||
*
|
||||
</if>
|
||||
|
||||
from ${tableName} where sts='Y' and formmain_id = #{formmainId}
|
||||
</select>
|
||||
|
||||
<update id="updateMdmSTs" parameterType="java.util.HashMap">
|
||||
|
|
|
@ -117,7 +117,7 @@ public interface IMdmService {
|
|||
* @Description 处理分发数据
|
||||
* @Date 9:40 上午 2023/10/18
|
||||
**/
|
||||
JsonResultEntity doMdmDistribute(JSONObject jsonObject);
|
||||
JsonResultEntity doMdmDistribute(JSONObject jsonObject) throws Exception;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,29 +1,13 @@
|
|||
package com.hzya.frame.mdm.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.Method;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
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.entity.*;
|
||||
import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao;
|
||||
import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity;
|
||||
import com.hzya.frame.mdm.mdmModuleDb.dao.IMdmModuleDbDao;
|
||||
|
@ -40,41 +24,31 @@ 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;
|
||||
import com.hzya.frame.mdm.mdmModuleViewButton.entity.MdmModuleViewButtonEntity;
|
||||
import com.hzya.frame.mdm.mdmModuleViewDetail.dao.IMdmModuleViewDetailDao;
|
||||
import com.hzya.frame.mdm.mdmModuleViewDetail.entity.MdmModuleViewDetailEntity;
|
||||
import com.hzya.frame.mdm.mdmTableCodeRule.dao.IMdmTableCodeRuleDao;
|
||||
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.sys.appApi.entity.AppApi;
|
||||
import com.hzya.frame.sys.entity.FormmainDeleteDto;
|
||||
import com.hzya.frame.sys.sysenum.SysEnum;
|
||||
import com.hzya.frame.sysnew.application.api.dao.ISysApplicationApiDao;
|
||||
import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity;
|
||||
import com.hzya.frame.sysnew.application.dao.ISysApplicationDao;
|
||||
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
|
||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||
import com.hzya.frame.sysnew.application.plugin.entity.SysApplicationPluginEntity;
|
||||
import com.hzya.frame.sysnew.application.script.dao.ISysApplicationScriptDao;
|
||||
import com.hzya.frame.sysnew.application.script.entity.SysApplicationScriptEntity;
|
||||
import com.hzya.frame.sysnew.buttonConfig.dao.ISysButtonConfigDao;
|
||||
import com.hzya.frame.sysnew.buttonConfig.entity.SysButtonConfigEntity;
|
||||
import com.hzya.frame.sysnew.grovy.service.IGroovyIntegrationService;
|
||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
|
||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
|
||||
import com.hzya.frame.sysnew.menuConfig.dao.ISysMenuConfigDao;
|
||||
import com.hzya.frame.sysnew.menuConfig.entity.SysMenuConfigEntity;
|
||||
import com.hzya.frame.sysnew.popedomOperate.dao.ISysPopedomOperateDao;
|
||||
import com.hzya.frame.sysnew.popedomOperate.entity.SysPopedomOperateEntity;
|
||||
import com.hzya.frame.sysnew.user.dao.ISysUserDao;
|
||||
import com.hzya.frame.sysnew.user.entity.SysUserEntity;
|
||||
import com.hzya.frame.sysnew.userCompany.entity.SysUserCompanyEntity;
|
||||
import com.hzya.frame.sysnew.userRoles.entity.SysUserRolesEntity;
|
||||
import com.hzya.frame.util.PluginUtils;
|
||||
import com.hzya.frame.uuid.UUIDUtils;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
|
@ -86,7 +60,6 @@ import org.apache.http.entity.ByteArrayEntity;
|
|||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
@ -95,12 +68,7 @@ import org.springframework.stereotype.Service;
|
|||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -119,6 +87,8 @@ public class MdmServiceImpl implements IMdmService {
|
|||
@Resource
|
||||
private IMdmModuleDao mdmModuleDao;
|
||||
|
||||
@Resource
|
||||
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
|
||||
@Resource
|
||||
private IGroovyIntegrationService groovyIntegrationService;
|
||||
@Resource
|
||||
|
@ -644,7 +614,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
if (entity == null) {
|
||||
return BaseResult.getFailureMessageEntity("参数不允许为空");
|
||||
}
|
||||
if(entity.getMdmCode() != null && !"".equals(entity.getMdmCode())){
|
||||
if (entity.getMdmCode() != null && !"".equals(entity.getMdmCode())) {
|
||||
MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode());
|
||||
if (mdmModuleEntity == null || mdmModuleEntity.getId() == null) {
|
||||
return BaseResult.getFailureMessageEntity("主数据设置错误");
|
||||
|
@ -653,11 +623,25 @@ public class MdmServiceImpl implements IMdmService {
|
|||
mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId());
|
||||
mdmModuleDbEntity.setSts("Y");
|
||||
List<MdmModuleDbEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity);
|
||||
MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity();
|
||||
mdmModuleDbFiledsEntity.setMdmId(mdmModuleEntity.getId());
|
||||
mdmModuleDbFiledsEntity.setSts("Y");
|
||||
List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity);
|
||||
if (mdmModuleDbEntities == null || mdmModuleDbEntities.size() == 0) {
|
||||
return BaseResult.getFailureMessageEntity("主数据设置错误");
|
||||
}
|
||||
if (mdmModuleDbFiledsEntities == null || mdmModuleDbFiledsEntities.size() == 0) {
|
||||
return BaseResult.getFailureMessageEntity("主数据设置错误");
|
||||
}
|
||||
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
|
||||
if ("1".equals(mdmModuleDbEntities.get(i).getDbType())) {
|
||||
List<String> returnField = new ArrayList<>();
|
||||
for (int i1 = 0; i1 < mdmModuleDbFiledsEntities.size(); i1++) {
|
||||
if (mdmModuleDbEntities.get(i).getId().equals(mdmModuleDbFiledsEntities.get(i1).getDbId())) {
|
||||
returnField.add(mdmModuleDbFiledsEntities.get(i1).getEnName());
|
||||
}
|
||||
}
|
||||
entity.setReturnField(returnField);
|
||||
entity.setTableName(mdmModuleDbEntities.get(i).getDbName());
|
||||
break;
|
||||
}
|
||||
|
@ -669,9 +653,35 @@ public class MdmServiceImpl implements IMdmService {
|
|||
}
|
||||
PageHelper.startPage(entity.getPageNum(), entity.getPageSize());
|
||||
List<HashMap<String, Object>> businessResult = mdmModuleDao.queryMdmShowData(entity);
|
||||
//强制把数据库字段转换小写
|
||||
if(null != businessResult && businessResult.size() >0){
|
||||
convertKeysToLowerCase(businessResult);
|
||||
}
|
||||
PageInfo pageInfo = new PageInfo(businessResult);
|
||||
return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo);
|
||||
}
|
||||
|
||||
//强制转换数据库字段为小写,出问题在说
|
||||
public void convertKeysToLowerCase(List<HashMap<String, Object>> list) {
|
||||
for (HashMap<String, Object> map : list) {
|
||||
HashMap<String, Object> lowerCaseMap = new HashMap<>();
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
lowerCaseMap.put(entry.getKey().toLowerCase(), entry.getValue());
|
||||
}
|
||||
map.clear(); // 清空原来的Map,避免重复存储
|
||||
map.putAll(lowerCaseMap); // 将转换后的Map全部放回原位
|
||||
}
|
||||
}
|
||||
|
||||
//强制转换数据库字段为小写,出问题在说
|
||||
public void convertKeysToLowerCase(HashMap<String, Object> list) {
|
||||
HashMap<String, Object> lowerCaseMap = new HashMap<>();
|
||||
for (Map.Entry<String, Object> entry : list.entrySet()) {
|
||||
lowerCaseMap.put(entry.getKey().toLowerCase(), entry.getValue());
|
||||
}
|
||||
list.clear(); // 清空原来的Map,避免重复存储
|
||||
list.putAll(lowerCaseMap); // 将转换后的Map全部放回原位
|
||||
}
|
||||
//
|
||||
///**
|
||||
// * @param object
|
||||
|
@ -780,10 +790,12 @@ public class MdmServiceImpl implements IMdmService {
|
|||
if (entity.getPageNum() != null && entity.getPageSize() != null) {
|
||||
PageHelper.startPage(entity.getPageNum(), entity.getPageSize());
|
||||
List<HashMap<String, Object>> mapList = mdmModuleDao.querySelectData(entity);
|
||||
convertKeysToLowerCase(mapList);
|
||||
PageInfo pageInfo = new PageInfo(mapList);
|
||||
return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo);
|
||||
} else {
|
||||
List<HashMap<String, Object>> mapList = mdmModuleDao.querySelectData(entity);
|
||||
convertKeysToLowerCase(mapList);
|
||||
return BaseResult.getSuccessMessageEntity("查询数据成功", mapList);
|
||||
}
|
||||
}
|
||||
|
@ -811,7 +823,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
if (entity.getUpId() == null || "".equals(entity.getUpId())) {
|
||||
return BaseResult.getFailureMessageEntity("系统错误");
|
||||
}
|
||||
if(entity.getMdmCode() != null && !"".equals(entity.getMdmCode())){
|
||||
if (entity.getMdmCode() != null && !"".equals(entity.getMdmCode())) {
|
||||
//查询模版
|
||||
MdmModuleEntity mdmModuleEntities = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode());
|
||||
if (mdmModuleEntities == null) {
|
||||
|
@ -831,6 +843,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
entity.setTableName(mdmModuleDbEntity.getDbName());
|
||||
}
|
||||
|
||||
|
@ -846,6 +859,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
List<HashMap<String, Object>> returnList = new ArrayList<>();
|
||||
return BaseResult.getSuccessMessageEntity("查询数据成功", returnList);
|
||||
}
|
||||
convertKeysToLowerCase(mapList);
|
||||
List<HashMap<String, Object>> returnList = gettochilder(strArray, 0, mapList);
|
||||
return BaseResult.getSuccessMessageEntity("查询数据成功", returnList);
|
||||
} else {
|
||||
|
@ -854,8 +868,12 @@ public class MdmServiceImpl implements IMdmService {
|
|||
List<HashMap<String, Object>> returnList = new ArrayList<>();
|
||||
return BaseResult.getSuccessMessageEntity("查询数据成功", returnList);
|
||||
}
|
||||
HashMap<String, Object> lowerCaseMap = new HashMap<>();
|
||||
for (Map.Entry<String, Object> entry : mapList.entrySet()) {
|
||||
lowerCaseMap.put(entry.getKey().toLowerCase(), entry.getValue());
|
||||
}
|
||||
List<HashMap<String, Object>> returnList = new ArrayList<>();
|
||||
returnList.add(mapList);
|
||||
returnList.add(lowerCaseMap);
|
||||
return BaseResult.getSuccessMessageEntity("查询数据成功", returnList);
|
||||
}
|
||||
} else {
|
||||
|
@ -863,6 +881,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
List<HashMap<String, Object>> returnList = new ArrayList<>();
|
||||
|
||||
if (mapList != null && mapList.size() > 0) {
|
||||
convertKeysToLowerCase(mapList);
|
||||
for (int i = 0; i < mapList.size(); i++) {
|
||||
//默认为根
|
||||
if (mapList.get(i).get(entity.getUpId()) == null || "".equals(mapList.get(i).get(entity.getUpId()))) {
|
||||
|
@ -1334,7 +1353,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
//String tablename = null;
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
for (int i = 0; i < mdmModuleDbEntityList.size(); i++) {
|
||||
if("1".equals(mdmModuleDbEntityList.get(i).getDbType()) || "2".equals(mdmModuleDbEntityList.get(i).getDbType())){
|
||||
if ("1".equals(mdmModuleDbEntityList.get(i).getDbType()) || "2".equals(mdmModuleDbEntityList.get(i).getDbType())) {
|
||||
//查询数据
|
||||
Map<String, Object> queryData = new HashMap<>();
|
||||
queryData.put("tableName", mdmModuleDbEntityList.get(i).getDbName());//表名
|
||||
|
@ -1342,12 +1361,15 @@ public class MdmServiceImpl implements IMdmService {
|
|||
queryData.put("detailFlag", false);//是否明细
|
||||
queryData.put("id", entity.getId());//字段
|
||||
HashMap<String, Object> datas = mdmModuleDbDao.getServiceDataById(queryData);
|
||||
convertKeysToLowerCase(datas);
|
||||
|
||||
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);
|
||||
convertKeysToLowerCase(datas);
|
||||
jsonObject.put(mdmModuleDbEntityList.get(i).getDbName(), datas);
|
||||
}
|
||||
}
|
||||
|
@ -1399,7 +1421,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("修改数据成功");
|
||||
|
@ -1445,7 +1467,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
}
|
||||
|
||||
|
||||
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("保存数据成功");
|
||||
|
@ -1454,9 +1476,9 @@ public class MdmServiceImpl implements IMdmService {
|
|||
}
|
||||
}
|
||||
|
||||
private void saveOption(String dbname ,Long mdmCode ,JSONObject jsonObject,String id,String msg) {
|
||||
private void saveOption(String dbname, Long mdmCode, JSONObject jsonObject, String id, String msg) {
|
||||
MdmModuleOptionLogEntity mdmModuleOptionLogEntity = new MdmModuleOptionLogEntity();
|
||||
mdmModuleOptionLogEntity.setTableName(dbname+"_option_log");
|
||||
mdmModuleOptionLogEntity.setTableName(dbname + "_option_log");
|
||||
mdmModuleOptionLogEntity.setMdmCode(mdmCode);
|
||||
mdmModuleOptionLogEntity.setFormmainId(id);
|
||||
mdmModuleOptionLogEntity.setSourceName("数智中台");
|
||||
|
@ -1466,7 +1488,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
mdmModuleOptionLogEntity.setSourceData(jsonObject.toJSONString());
|
||||
mdmModuleOptionLogEntity.setOptionType(msg);
|
||||
SysUserEntity sysUserEntity = sysUserDao.get(StpUtil.getLoginIdAsString());
|
||||
if(sysUserEntity != null){
|
||||
if (sysUserEntity != null) {
|
||||
mdmModuleOptionLogEntity.setOptionName(sysUserEntity.getPersonName());
|
||||
}
|
||||
mdmModuleOptionLogEntity.setCreate();
|
||||
|
@ -1535,6 +1557,8 @@ public class MdmServiceImpl implements IMdmService {
|
|||
queryData.put("detailFlag", false);//是否明细
|
||||
queryData.put("id", jsonObject.getString("id"));//字段
|
||||
HashMap<String, Object> datas = mdmModuleDbDao.getServiceDataById(queryData);
|
||||
convertKeysToLowerCase(datas);
|
||||
|
||||
String upValue = null;
|
||||
if (datas != null && datas.get(mdmModuleViewEntity.getUpIdFiled()) != null) {
|
||||
upValue = datas.get(mdmModuleViewEntity.getUpIdFiled()).toString();
|
||||
|
@ -1559,10 +1583,31 @@ public class MdmServiceImpl implements IMdmService {
|
|||
|
||||
|
||||
}
|
||||
saveOption(dbname,mdmModuleEntity.getMdmCode(),jsonObject,jsonObject.getString("id"),"界面删除");
|
||||
saveOption(dbname, mdmModuleEntity.getMdmCode(), jsonObject, jsonObject.getString("id"), "界面删除");
|
||||
return BaseResult.getSuccessMessageEntity("删除数据成功");
|
||||
}
|
||||
|
||||
public JSONObject toLowerCaseKeys(JSONObject jsonObject) {
|
||||
JSONObject lowerCaseJson = new JSONObject();
|
||||
if (jsonObject != null) {
|
||||
for (String key : jsonObject.keySet()) {
|
||||
Object value = jsonObject.get(key);
|
||||
lowerCaseJson.put(key.toLowerCase(), value);
|
||||
}
|
||||
}
|
||||
return lowerCaseJson;
|
||||
}
|
||||
|
||||
public List<JSONObject> toLowerCaseKeys(List<JSONObject> list) {
|
||||
List<JSONObject> jsonObjects = new ArrayList<>();
|
||||
if (list != null && list.size() > 0) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
jsonObjects.add(toLowerCaseKeys(list.get(i)));
|
||||
}
|
||||
}
|
||||
return jsonObjects;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param jsonStr
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
|
@ -1571,7 +1616,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
* @Date 9:40 上午 2023/10/18
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity doMdmDistribute(JSONObject jsonStr) {
|
||||
public JsonResultEntity doMdmDistribute(JSONObject jsonStr) throws Exception {
|
||||
JSONObject jsonObject = getstrObj("jsonStr", jsonStr);
|
||||
//校验是否有servecr传参
|
||||
if (!checkData(jsonObject, "mdmCode")) {
|
||||
|
@ -1679,6 +1724,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
map.put("tableName", mdmModuleDbEntities.get(i).getDbName());
|
||||
map.put("id", id);
|
||||
object = mdmModuleDao.queryMdmST(map);
|
||||
object = toLowerCaseKeys(object);
|
||||
if (object.getString("id") == null || "".equals(object.getString("id"))) {
|
||||
return BaseResult.getFailureMessageEntity("当前数据不存在");
|
||||
}
|
||||
|
@ -1688,6 +1734,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
checkData.put("id", id);
|
||||
checkData.put("mdmModuleDistributeDetailEntities", mdmModuleDistributeDetailEntities);
|
||||
JSONObject object1 = mdmModuleDao.queryMdmST(checkData);
|
||||
object1 = toLowerCaseKeys(object1);
|
||||
if (object1 == null || object1.getString("id") == null || "".equals(object1.getString("id"))) {
|
||||
return BaseResult.getFailureMessageEntity("当前数据不符合规则不发送");
|
||||
}
|
||||
|
@ -1699,13 +1746,14 @@ public class MdmServiceImpl implements IMdmService {
|
|||
if (mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0) {
|
||||
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
|
||||
if (mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())) {
|
||||
if(object.getString(mdmModuleDbFiledsEntities.get(i2).getEnName()) != null){
|
||||
if (object.getString(mdmModuleDbFiledsEntities.get(i2).getEnName()) != null) {
|
||||
Map<String, Object> mapDetail = new HashMap<>();
|
||||
mapDetail.put("tableName", mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue());
|
||||
String ids = object.getString(mdmModuleDbFiledsEntities.get(i2).getEnName());
|
||||
String[] idss = ids.split(",");
|
||||
mapDetail.put("id", idss[idss.length-1]);
|
||||
mapDetail.put("id", idss[idss.length - 1]);
|
||||
JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail);
|
||||
objectDetail = toLowerCaseKeys(objectDetail);
|
||||
object.put(mdmModuleDbFiledsEntities.get(i2).getEnName(), objectDetail);
|
||||
}
|
||||
}
|
||||
|
@ -1719,12 +1767,13 @@ public class MdmServiceImpl implements IMdmService {
|
|||
|
||||
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
|
||||
if ("2".equals(mdmModuleDbEntities.get(i).getDbType())) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("tableName", mdmModuleDbEntities.get(i).getDbName());
|
||||
map.put("formmainId", object.getString("id"));
|
||||
List<JSONObject> detail = mdmModuleDao.queryMdmSTDetail(map);
|
||||
//查看主表是否有字段是关联的
|
||||
if (detail != null && detail.size() > 0) {
|
||||
detail = toLowerCaseKeys(detail);
|
||||
if (mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0) {
|
||||
for (int i1 = 0; i1 < mdmModuleDbFiledsRuleEntities.size(); i1++) {
|
||||
if (mdmModuleDbFiledsRuleEntities.get(i1).getDbId().equals(mdmModuleDbEntities.get(i).getId())) {
|
||||
|
@ -1732,13 +1781,15 @@ public class MdmServiceImpl implements IMdmService {
|
|||
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
|
||||
if (mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())) {
|
||||
for (int i3 = 0; i3 < detail.size(); i3++) {
|
||||
if(detail.get(i3).getString(mdmModuleDbFiledsEntities.get(i2).getEnName()) != null){
|
||||
if (detail.get(i3).getString(mdmModuleDbFiledsEntities.get(i2).getEnName()) != null) {
|
||||
Map<String, Object> mapDetail = new HashMap<>();
|
||||
mapDetail.put("tableName", mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue());
|
||||
String ids = detail.get(i3).getString(mdmModuleDbFiledsEntities.get(i2).getEnName());
|
||||
String[] idss = ids.split(",");
|
||||
mapDetail.put("id", idss[idss.length-1]);
|
||||
mapDetail.put("id", idss[idss.length - 1]);
|
||||
JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail);
|
||||
objectDetail = toLowerCaseKeys(objectDetail);
|
||||
|
||||
detail.get(i3).put(mdmModuleDbFiledsEntities.get(i2).getEnName(), objectDetail);
|
||||
}
|
||||
}
|
||||
|
@ -1796,41 +1847,42 @@ public class MdmServiceImpl implements IMdmService {
|
|||
//找到登陆接口
|
||||
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
|
||||
if (null == loginApi) {
|
||||
saveMdmModuleSendLogEntity("2","转发失败,认证接口不存在",dbname,object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
|
||||
saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(),mdmModuleDistributeEntity.getId(),"2", "转发失败,认证接口不存在", dbname, object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
|
||||
return BaseResult.getFailureMessageEntity("发送错误,认证接口不存在");
|
||||
|
||||
}
|
||||
String rzquerys = getQuery(loginApi,null,null);
|
||||
String rzquerys = getQuery(loginApi, null, null);
|
||||
Map<String, String> headersa = new HashMap<>();
|
||||
headersa.put("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj");
|
||||
headersa.put("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=");
|
||||
headersa.put("appId", sysApplicationEntity.getAppId().toString());
|
||||
headersa.put("apiCode", loginApi.getApiCode().toString());
|
||||
Map<String, String> rzheaders = getHeaders(loginApi,headersa,null);
|
||||
String rzbodys = getBodys(loginApi,null,null);
|
||||
JsonResultEntity rzjsonResultEntity = sendData(loginApi,rzheaders,rzbodys,rzquerys);
|
||||
Map<String, String> rzheaders = getHeaders(loginApi, headersa, null);
|
||||
String rzbodys = getBodys(loginApi, null, null);
|
||||
JsonResultEntity rzjsonResultEntity = sendData(loginApi, rzheaders, rzbodys, rzquerys);
|
||||
if (!rzjsonResultEntity.isFlag()) {
|
||||
saveMdmModuleSendLogEntity("2","转发失败,认证接口调用失败",dbname,object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
|
||||
return BaseResult.getFailureMessageEntity("发送错误:"+rzjsonResultEntity.getMsg());
|
||||
saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(),mdmModuleDistributeEntity.getId(),"2", "转发失败,认证接口调用失败", dbname, object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
|
||||
return BaseResult.getFailureMessageEntity("发送错误:" + rzjsonResultEntity.getMsg());
|
||||
}
|
||||
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
||||
//JSONObject attritube = attritube1.getJSONObject("attribute");
|
||||
querys = getQuery(apiEntity,querys,attritube);
|
||||
headers = getHeaders(apiEntity,headers,attritube);
|
||||
bodys = getBodys(apiEntity,bodys,attritube);
|
||||
querys = getQuery(apiEntity, querys, attritube);
|
||||
headers = getHeaders(apiEntity, headers, attritube);
|
||||
bodys = getBodys(apiEntity, bodys, attritube);
|
||||
}
|
||||
//组装数据发送
|
||||
JsonResultEntity jsonResultEntity = sendData(apiEntity, headers,bodys,querys);
|
||||
JsonResultEntity jsonResultEntity = sendData(apiEntity, headers, bodys, querys);
|
||||
if (jsonResultEntity.isFlag()) {
|
||||
saveMdmModuleSendLogEntity("1","发送成功",dbname,object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
|
||||
saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(),mdmModuleDistributeEntity.getId(),"1", "发送成功", dbname, object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
|
||||
return BaseResult.getSuccessMessageEntity("发送成功");
|
||||
} else {
|
||||
saveMdmModuleSendLogEntity("2","转发失败",dbname,object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
|
||||
return BaseResult.getFailureMessageEntity("发送错误:"+jsonResultEntity.getMsg());
|
||||
saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(),mdmModuleDistributeEntity.getId(),"2", "转发失败", dbname, object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
|
||||
return BaseResult.getFailureMessageEntity("发送错误:" + jsonResultEntity.getMsg());
|
||||
}
|
||||
}
|
||||
private Map<String, String> getHeaders(SysApplicationApiEntity loginApi,Map<String, String> map,JSONObject loginData) {
|
||||
if(loginData == null){
|
||||
|
||||
private Map<String, String> getHeaders(SysApplicationApiEntity loginApi, Map<String, String> map, JSONObject loginData) {
|
||||
if (loginData == null) {
|
||||
loginData = new JSONObject();
|
||||
}
|
||||
if (loginApi.getHeaderIn() != null && !"".equals(loginApi.getHeaderIn())) {
|
||||
|
@ -1850,11 +1902,11 @@ public class MdmServiceImpl implements IMdmService {
|
|||
}
|
||||
} else {
|
||||
if (querys.getString(SysEnum.EXAMPLE.getValue()) != null && !"".equals(querys.getString(SysEnum.EXAMPLE.getValue()))) {//入参没有值用实例值,如果没有不添加
|
||||
if(map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null){
|
||||
if (map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null) {
|
||||
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), querys.getString(SysEnum.EXAMPLE.getValue()));
|
||||
}
|
||||
} else {//没有值直接拼接
|
||||
if(map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null){
|
||||
if (map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null) {
|
||||
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), "");
|
||||
}
|
||||
}
|
||||
|
@ -1865,27 +1917,25 @@ public class MdmServiceImpl implements IMdmService {
|
|||
return map;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private String getQuery(SysApplicationApiEntity loginApi,String sendDatastr,JSONObject loginData) {
|
||||
private String getQuery(SysApplicationApiEntity loginApi, String sendDatastr, JSONObject loginData) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
if(sendDatastr != null){
|
||||
if (sendDatastr != null) {
|
||||
String[] parts = sendDatastr.split("&");
|
||||
if(parts != null && parts.length > 0){
|
||||
if (parts != null && parts.length > 0) {
|
||||
for (int i = 0; i < parts.length; i++) {
|
||||
String[] part = parts[i].split("=");
|
||||
if(part != null && part.length >=2 ){
|
||||
if (part != null && part.length >= 2) {
|
||||
for (int a = 0; a < part.length; a++) {
|
||||
map.put(part[0],part[1]);
|
||||
map.put(part[0], part[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(loginData == null){
|
||||
if (loginData == null) {
|
||||
loginData = new JSONObject();
|
||||
}
|
||||
if (loginApi.getQueryIn() != null && !"".equals(loginApi.getQueryIn())) {
|
||||
|
@ -1906,11 +1956,11 @@ public class MdmServiceImpl implements IMdmService {
|
|||
} else {
|
||||
//不是认证类型直接取值
|
||||
if (querys.getString(SysEnum.EXAMPLE.getValue()) != null && !"".equals(querys.getString(SysEnum.EXAMPLE.getValue()))) {//入参没有值用实例值,如果没有不添加
|
||||
if(map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null){
|
||||
if (map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null) {
|
||||
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), querys.getString(SysEnum.EXAMPLE.getValue()));
|
||||
}
|
||||
} else {//没有值直接拼接
|
||||
if(map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null){
|
||||
if (map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null) {
|
||||
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), "");
|
||||
}
|
||||
}
|
||||
|
@ -1919,17 +1969,18 @@ public class MdmServiceImpl implements IMdmService {
|
|||
}
|
||||
}
|
||||
StringBuffer returnStr = new StringBuffer();
|
||||
if(map != null && map.size() > 0){
|
||||
if (map != null && map.size() > 0) {
|
||||
for (String key : map.keySet()) {
|
||||
if("".equals(returnStr)){
|
||||
if ("".equals(returnStr)) {
|
||||
returnStr.append(key).append("=").append(map.get(key));
|
||||
}else {
|
||||
} else {
|
||||
returnStr.append("&").append(key).append("=").append(map.get(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnStr.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param loginData
|
||||
* @param example
|
||||
|
@ -1955,12 +2006,13 @@ public class MdmServiceImpl implements IMdmService {
|
|||
}
|
||||
return values;
|
||||
}
|
||||
private String getBodys(SysApplicationApiEntity loginApi,String sendDatastr, JSONObject loginData) {
|
||||
|
||||
private String getBodys(SysApplicationApiEntity loginApi, String sendDatastr, JSONObject loginData) {
|
||||
JSONObject sendData = new JSONObject();
|
||||
if(sendDatastr != null ){
|
||||
if (sendDatastr != null) {
|
||||
sendData = JSONObject.parseObject(sendDatastr);
|
||||
}
|
||||
if(loginData == null){
|
||||
if (loginData == null) {
|
||||
loginData = new JSONObject();
|
||||
}
|
||||
if (loginApi.getBodyIn() != null && !"".equals(loginApi.getBodyIn())) {
|
||||
|
@ -1974,7 +2026,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
if (query != null && !"".equals(query)) {
|
||||
JSONArray example = JSONArray.parseArray(query);
|
||||
String logValue = getObjectValue(loginData, example);
|
||||
sendData.put(querys.getString(SysEnum.PARAMETERNAME.getValue()),logValue);
|
||||
sendData.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), logValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1982,6 +2034,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
}
|
||||
return sendData.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param querys 设置的字段属性
|
||||
* @param sendData 发送数据
|
||||
|
@ -2096,15 +2149,15 @@ public class MdmServiceImpl implements IMdmService {
|
|||
//设置api的参数
|
||||
//返回数据
|
||||
JSONArray sendArray = sendData.getJSONArray(querys.getString(SysEnum.PARAMETERNAME.getValue()));
|
||||
if(sendArray == null || sendArray.size() == 0){
|
||||
if (sendArray == null || sendArray.size() == 0) {
|
||||
return new JSONArray();
|
||||
}
|
||||
String childers = querys.getString(SysEnum.CHILDREN.getValue());
|
||||
if(childers == null || "".equals(childers)){
|
||||
if (childers == null || "".equals(childers)) {
|
||||
return new JSONArray();
|
||||
}
|
||||
JSONArray childersObj = JSONArray.parseArray(childers);
|
||||
if(childersObj == null || childersObj.size() == 0){
|
||||
if (childersObj == null || childersObj.size() == 0) {
|
||||
return new JSONArray();
|
||||
}
|
||||
JSONArray obj = new JSONArray();
|
||||
|
@ -2213,10 +2266,9 @@ public class MdmServiceImpl implements IMdmService {
|
|||
}
|
||||
}
|
||||
|
||||
private void saveMdmModuleSendLogEntity(String dataType,String remark,String dbname,String formmain_id, String target_app, String target_api, String source_data, String option_type) {
|
||||
private void saveMdmModuleSendLogEntity(Long mdmCode,String distributeId,String dataType,String remark,String dbname,String formmain_id, String target_app, String target_api, String source_data, String option_type) throws Exception {
|
||||
MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity();
|
||||
mdmModuleSendLogEntity.setTableName(dbname+"_send_log");
|
||||
mdmModuleSendLogEntity.setCreate();
|
||||
mdmModuleSendLogEntity.setId(UUIDUtils.getUUID());
|
||||
mdmModuleSendLogEntity.setSts("Y");
|
||||
mdmModuleSendLogEntity.setCreate_user_id("1");
|
||||
|
@ -2233,6 +2285,35 @@ public class MdmServiceImpl implements IMdmService {
|
|||
mdmModuleSendLogEntity.setDataType(dataType);
|
||||
mdmModuleSendLogEntity.setRemark(remark);
|
||||
mdmModuleSendLogDao.save(mdmModuleSendLogEntity);
|
||||
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(source_data);
|
||||
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
|
||||
integrationTaskLivingDetailsEntity.setId(UUIDUtils.getUUID());
|
||||
integrationTaskLivingDetailsEntity.setSts("Y");
|
||||
integrationTaskLivingDetailsEntity.setCreate_user_id("1");
|
||||
integrationTaskLivingDetailsEntity.setModify_user_id("1");
|
||||
integrationTaskLivingDetailsEntity.setCreate_time(new Date());
|
||||
integrationTaskLivingDetailsEntity.setModify_time(new Date());
|
||||
integrationTaskLivingDetailsEntity.setOrg_id("0");
|
||||
integrationTaskLivingDetailsEntity.setCompanyId("0");
|
||||
JSONObject aa = new JSONObject();
|
||||
aa.put("mdmCode",mdmCode);//主数据编码
|
||||
aa.put("documentRule",jsonObject.getString("document_rule"));//行数据的单据规则编码
|
||||
aa.put("distributeId",distributeId);//发送表id
|
||||
aa.put("type",option_type);//发送类型,1、新增2、修改3、删除
|
||||
integrationTaskLivingDetailsEntity.setRootAppPk(aa.toJSONString());
|
||||
integrationTaskLivingDetailsEntity.setRootAppBill(jsonObject.getString("document_rule"));
|
||||
integrationTaskLivingDetailsEntity.setPluginId("MdmModulePlugin");
|
||||
integrationTaskLivingDetailsEntity.setRootAppNewData(source_data);
|
||||
integrationTaskLivingDetailsEntity.setNewTransmitInfo(remark);
|
||||
if("1".equals(dataType)){
|
||||
taskLivingDetailsService.saveLogToSuccess(integrationTaskLivingDetailsEntity);
|
||||
}else {
|
||||
taskLivingDetailsService.saveLogToFail(integrationTaskLivingDetailsEntity);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -2247,11 +2328,11 @@ public class MdmServiceImpl implements IMdmService {
|
|||
* @Description 校验数据
|
||||
* @Date 11:20 上午 2023/11/6
|
||||
**/
|
||||
private String checkDataOnly(long mdmCode, JSONObject saveData, boolean flag, MdmModuleEntity mdmModuleEntity, List<MdmModuleDbEntity> mdmModuleDbEntityList,String msg) {
|
||||
private String checkDataOnly(long mdmCode, JSONObject saveData, boolean flag, MdmModuleEntity mdmModuleEntity, List<MdmModuleDbEntity> mdmModuleDbEntityList, String msg) {
|
||||
StringBuffer str = new StringBuffer();
|
||||
String dbname = null;
|
||||
for (int i = 0; i < mdmModuleDbEntityList.size(); i++) {
|
||||
if("1".equals(mdmModuleDbEntityList.get(i).getDbType())){
|
||||
if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) {
|
||||
dbname = mdmModuleDbEntityList.get(i).getDbName();
|
||||
}
|
||||
}
|
||||
|
@ -2417,12 +2498,29 @@ public class MdmServiceImpl implements IMdmService {
|
|||
List<MdmDataFiledDto> mdmDataFiledDtos = new ArrayList<>();
|
||||
for (int i1 = 0; i1 < fileds.size(); i1++) {
|
||||
if (jsonObject.get(fileds.get(i1).getEnName()) != null) {
|
||||
if (flag && "update_status".equals(fileds.get(i1).getEnName())) {
|
||||
MdmDataFiledDto update_status = new MdmDataFiledDto();
|
||||
update_status.setFiledsName("update_status");
|
||||
update_status.setFiledsValue("0");
|
||||
mdmDataFiledDtos.add(update_status);
|
||||
}else if(flag && "data_status".equals(fileds.get(i1).getEnName())) {
|
||||
MdmDataFiledDto data_status = new MdmDataFiledDto();
|
||||
data_status.setFiledsName("data_status");
|
||||
data_status.setFiledsValue("F");
|
||||
mdmDataFiledDtos.add(data_status);
|
||||
}else if(flag && "modify_user_id".equals(fileds.get(i1).getEnName())) {
|
||||
MdmDataFiledDto data_status = new MdmDataFiledDto();
|
||||
data_status.setFiledsName("modify_user_id");
|
||||
data_status.setFiledsValue("F");
|
||||
//mdmDataFiledDtos.add(data_status);
|
||||
}else {
|
||||
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());
|
||||
|
@ -2431,15 +2529,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
if (flag) {
|
||||
mdmDataDto.setId(jsonObject.getString("id"));
|
||||
id = jsonObject.getString("id");
|
||||
MdmDataFiledDto update_status = new MdmDataFiledDto();
|
||||
update_status.setFiledsName("update_status");
|
||||
update_status.setFiledsValue("0");
|
||||
mdmDataFiledDtos.add(update_status);
|
||||
MdmDataFiledDto data_status = new MdmDataFiledDto();
|
||||
data_status.setFiledsName("data_status");
|
||||
data_status.setFiledsValue("F");
|
||||
;
|
||||
mdmDataFiledDtos.add(data_status);
|
||||
|
||||
int a = mdmModuleDao.updateForm(mdmDataDto);
|
||||
} else {
|
||||
|
||||
|
@ -2515,7 +2605,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
mdmDataDto.setTableName(mdmModuleDbEntityList.get(i).getDbName());
|
||||
List<MdmDataFiledDto> mdmDataFiledDtos = new ArrayList<>();
|
||||
for (int i1 = 0; i1 < fileds.size(); i1++) {
|
||||
if("id".equals(fileds.get(i1).getEnName())){
|
||||
if ("id".equals(fileds.get(i1).getEnName())) {
|
||||
if (jsonObject.getString("id") != null) {
|
||||
MdmDataFiledDto ids = new MdmDataFiledDto();
|
||||
ids.setFiledsName("id");
|
||||
|
@ -2527,12 +2617,12 @@ public class MdmServiceImpl implements IMdmService {
|
|||
ids.setFiledsValue(UUIDUtils.getUUID());
|
||||
mdmDataFiledDtos.add(ids);
|
||||
}
|
||||
}else if("formmain_id".equals(fileds.get(i1).getEnName())){
|
||||
} else if ("formmain_id".equals(fileds.get(i1).getEnName())) {
|
||||
MdmDataFiledDto formain_id = new MdmDataFiledDto();
|
||||
formain_id.setFiledsName("formmain_id");
|
||||
formain_id.setFiledsValue(id);
|
||||
mdmDataFiledDtos.add(formain_id);
|
||||
}else if("data_status".equals(fileds.get(i1).getEnName())){
|
||||
} else if ("data_status".equals(fileds.get(i1).getEnName())) {
|
||||
if (jsonObject.getString("id") != null) {
|
||||
MdmDataFiledDto ids = new MdmDataFiledDto();
|
||||
ids.setFiledsName("data_status");
|
||||
|
@ -2544,9 +2634,9 @@ public class MdmServiceImpl implements IMdmService {
|
|||
ids.setFiledsValue("Y");
|
||||
mdmDataFiledDtos.add(ids);
|
||||
}
|
||||
}else if("sorts".equals(fileds.get(i1).getEnName())){
|
||||
} else if ("sorts".equals(fileds.get(i1).getEnName())) {
|
||||
|
||||
}else if("create_user_id".equals(fileds.get(i1).getEnName())){
|
||||
} else if ("create_user_id".equals(fileds.get(i1).getEnName())) {
|
||||
//if (jsonObject.getString("id") != null) {
|
||||
//
|
||||
//} else {
|
||||
|
@ -2555,28 +2645,28 @@ public class MdmServiceImpl implements IMdmService {
|
|||
// ids.setFiledsValue(UUIDUtils.getUUID());
|
||||
// mdmDataFiledDtos.add(ids);
|
||||
//}
|
||||
}else if("create_time".equals(fileds.get(i1).getEnName())){
|
||||
} else if ("create_time".equals(fileds.get(i1).getEnName())) {
|
||||
|
||||
}else if("modify_user_id".equals(fileds.get(i1).getEnName())){
|
||||
} else if ("modify_user_id".equals(fileds.get(i1).getEnName())) {
|
||||
//MdmDataFiledDto ids = new MdmDataFiledDto();
|
||||
//ids.setFiledsName("modify_user_id");
|
||||
//ids.setFiledsValue(UUIDUtils.getUUID());
|
||||
//mdmDataFiledDtos.add(ids);
|
||||
}else if("company_id".equals(fileds.get(i1).getEnName())){
|
||||
} else if ("company_id".equals(fileds.get(i1).getEnName())) {
|
||||
MdmDataFiledDto ids = new MdmDataFiledDto();
|
||||
ids.setFiledsName("company_id");
|
||||
ids.setFiledsValue("0");
|
||||
mdmDataFiledDtos.add(ids);
|
||||
}else if("org_id".equals(fileds.get(i1).getEnName())){
|
||||
} else if ("org_id".equals(fileds.get(i1).getEnName())) {
|
||||
MdmDataFiledDto ids = new MdmDataFiledDto();
|
||||
ids.setFiledsName("org_id");
|
||||
ids.setFiledsValue("0");
|
||||
mdmDataFiledDtos.add(ids);
|
||||
}else if("modify_time".equals(fileds.get(i1).getEnName())){
|
||||
} else if ("modify_time".equals(fileds.get(i1).getEnName())) {
|
||||
|
||||
}else if("sts".equals(fileds.get(i1).getEnName())){
|
||||
} else if ("sts".equals(fileds.get(i1).getEnName())) {
|
||||
|
||||
}else {
|
||||
} else {
|
||||
MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto();
|
||||
mdmDataFiledDto.setFiledsName(fileds.get(i1).getEnName());
|
||||
mdmDataFiledDto.setFiledsValue(jsonObject.getString(fileds.get(i1).getEnName()));
|
||||
|
@ -2600,7 +2690,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
}
|
||||
}
|
||||
}
|
||||
saveOption(dbname,mdmCode,saveData,id,msg);
|
||||
saveOption(dbname, mdmCode, saveData, id, msg);
|
||||
}
|
||||
return str.toString();
|
||||
}
|
||||
|
@ -2658,5 +2748,15 @@ public class MdmServiceImpl implements IMdmService {
|
|||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
///***
|
||||
// * 查询所有的字段根据表名称
|
||||
// * @content:
|
||||
// * @author 👻👻👻👻👻👻👻👻 gjh
|
||||
// * @date 2024-06-27 16:29
|
||||
// * @param
|
||||
// * @return java.util.List<com.alibaba.fastjson.JSONObject>
|
||||
// **/
|
||||
//private List<String> queryMdMFields(Map<String, Object> maps){
|
||||
// return mdmModuleDao.queryMdMFields(maps);
|
||||
//}
|
||||
}
|
||||
|
|
|
@ -318,5 +318,25 @@ where id = #{id}
|
|||
concat(replace(replace(DATE_FORMAT(now(),'%Y-%m-%d'),'-',''),'-',ifnull(max(right(task_code,4)), 0)+1)) end as task_code
|
||||
from integration_task where sts='Y' and task_code like concat('%',substring(replace(DATE_FORMAT(now(),'%Y-%m-%d'),'-',''),1,10),'%')
|
||||
</select>
|
||||
<!--查询最大编码+1-->
|
||||
<select id="IntegrationTaskEntity_maxCode" databaseId="oracle" resultMap="get-IntegrationTaskEntity-result">
|
||||
|
||||
SELECT decode(LENGTH(IFNULL(max(RIGHT (task_code, 4)), 0)+ 1),
|
||||
1,concat(concat(
|
||||
REPLACE (DATE_FORMAT(now(), '%Y-%m-%d'), '-', ''), '-', '000'), IFNULL(max(RIGHT (task_code, 4)), 0)+ 1),
|
||||
2,concat(concat(
|
||||
REPLACE (DATE_FORMAT(now(), '%Y-%m-%d'), '-', ''), '-', '00'), IFNULL(max(RIGHT (task_code, 4)), 0)+ 1),
|
||||
3,concat(concat(
|
||||
REPLACE (DATE_FORMAT(now(), '%Y-%m-%d'), '-', ''), '-', '0'), IFNULL(max(RIGHT (task_code, 4)), 0)+ 1),
|
||||
concat(concat(
|
||||
REPLACE (DATE_FORMAT(now(), '%Y-%m-%d'), '-', ''), '-', ''), IFNULL(max(RIGHT (task_code, 4)), 0)+ 1)) AS task_code
|
||||
FROM
|
||||
integration_task
|
||||
WHERE
|
||||
sts = 'Y'
|
||||
AND task_code LIKE concat('%', substring(
|
||||
REPLACE (DATE_FORMAT(now(), '%Y-%m-%d'), '-', ''), 1, 10), '%')
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
|
Loading…
Reference in New Issue