主数据修改

This commit is contained in:
lvleigang 2024-07-24 11:06:16 +08:00
parent 256e616fe5
commit 9035801444
2 changed files with 42 additions and 37 deletions

View File

@ -262,6 +262,7 @@ where id = #{id}
<if test="!detailFlag"> <if test="!detailFlag">
and id = #{id} and id = #{id}
</if> </if>
and data_status != 'N'
and sts = 'Y' and sts = 'Y'
</trim> </trim>
</select> </select>
@ -279,6 +280,7 @@ where id = #{id}
and id = #{id} and id = #{id}
</if> </if>
and sts = 'Y' and sts = 'Y'
and data_status != 'N'
</trim> </trim>
order by sorts asc order by sorts asc
</select> </select>

View File

@ -657,7 +657,7 @@ public class MdmServiceImpl implements IMdmService {
PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); PageHelper.startPage(entity.getPageNum(), entity.getPageSize());
List<HashMap<String, Object>> businessResult = mdmModuleDao.queryMdmShowData(entity); List<HashMap<String, Object>> businessResult = mdmModuleDao.queryMdmShowData(entity);
//强制把数据库字段转换小写 //强制把数据库字段转换小写
if(null != businessResult && businessResult.size() >0){ if (null != businessResult && businessResult.size() > 0) {
convertKeysToLowerCase(businessResult); convertKeysToLowerCase(businessResult);
} }
PageInfo pageInfo = new PageInfo(businessResult); PageInfo pageInfo = new PageInfo(businessResult);
@ -1060,10 +1060,10 @@ public class MdmServiceImpl implements IMdmService {
//1主表 2明细 //1主表 2明细
mainMdmModuleDb = mdmModuleDbEntityList.get(i); mainMdmModuleDb = mdmModuleDbEntityList.get(i);
//循环字段表 //循环字段表
for (int b = 0; b < mdmModuleViewDetailEntityList.size(); b++) {
if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) {
for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) {
if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { 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)); mainMdmModuleDbFileds.add(mdmModuleDbFiledsEntityList.get(i1));
List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRules = new ArrayList<>(); List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRules = new ArrayList<>();
@ -1078,19 +1078,23 @@ public class MdmServiceImpl implements IMdmService {
} }
mdmModuleDbFiledsEntityList.get(i1).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRules); mdmModuleDbFiledsEntityList.get(i1).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRules);
} }
} }
} }
} }
} }
} else if ("2".equals(mdmModuleDbEntityList.get(i).getDbType())) { } else if ("2".equals(mdmModuleDbEntityList.get(i).getDbType())) {
//2明细 //2明细
sublistMdmModuleDb.add(mdmModuleDbEntityList.get(i)); sublistMdmModuleDb.add(mdmModuleDbEntityList.get(i));
//循环字段表 //循环字段表
if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) {
List<MdmModuleDbFiledsEntity> sublistMdmModuleDbFileds = new ArrayList<>(); List<MdmModuleDbFiledsEntity> sublistMdmModuleDbFileds = new ArrayList<>();
for (int b = 0; b < mdmModuleViewDetailEntityList.size(); b++) {
for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) {
if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { 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)); sublistMdmModuleDbFileds.add(mdmModuleDbFiledsEntityList.get(i1));
List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRules = new ArrayList<>(); List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRules = new ArrayList<>();
@ -1106,7 +1110,6 @@ public class MdmServiceImpl implements IMdmService {
mdmModuleDbFiledsEntityList.get(i1).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRules); mdmModuleDbFiledsEntityList.get(i1).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRules);
} }
} }
} }
} }
mdmModuleDbEntityList.get(i).setSublistMdmModuleDbFileds(sublistMdmModuleDbFileds); mdmModuleDbEntityList.get(i).setSublistMdmModuleDbFileds(sublistMdmModuleDbFileds);
@ -1824,7 +1827,7 @@ public class MdmServiceImpl implements IMdmService {
mdmModuleDistributeTripartiteEntity.setAppId(sysApplicationEntity.getId()); mdmModuleDistributeTripartiteEntity.setAppId(sysApplicationEntity.getId());
mdmModuleDistributeTripartiteEntity = mdmModuleDistributeTripartiteDao.queryOneTripartite(mdmModuleDistributeTripartiteEntity); mdmModuleDistributeTripartiteEntity = mdmModuleDistributeTripartiteDao.queryOneTripartite(mdmModuleDistributeTripartiteEntity);
String tripartiteId = ""; String tripartiteId = "";
if(mdmModuleDistributeTripartiteEntity != null && mdmModuleDistributeTripartiteEntity.getTripartiteId() != null ){ if (mdmModuleDistributeTripartiteEntity != null && mdmModuleDistributeTripartiteEntity.getTripartiteId() != null) {
tripartiteId = mdmModuleDistributeTripartiteEntity.getTripartiteId(); tripartiteId = mdmModuleDistributeTripartiteEntity.getTripartiteId();
} }
parameterJson.put("tripartiteId", tripartiteId); parameterJson.put("tripartiteId", tripartiteId);
@ -1836,7 +1839,7 @@ public class MdmServiceImpl implements IMdmService {
String querys = null; String querys = null;
/** body */ /** body */
String bodys = object.toJSONString(); String bodys = object.toJSONString();
if (scriptEntity != null && scriptEntity.getId() != null && scriptEntity.getScriptData() != null ) { if (scriptEntity != null && scriptEntity.getId() != null && scriptEntity.getScriptData() != null) {
groovy.put("code", scriptEntity.getScriptCode()); groovy.put("code", scriptEntity.getScriptCode());
groovy.put("className", scriptEntity.getClassName()); groovy.put("className", scriptEntity.getClassName());
groovy.put("name", scriptEntity.getScriptName()); groovy.put("name", scriptEntity.getScriptName());
@ -1866,7 +1869,7 @@ public class MdmServiceImpl implements IMdmService {
//找到登陆接口 //找到登陆接口
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort()); SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
if (null == loginApi) { if (null == loginApi) {
saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(),mdmModuleDistributeEntity.getId(),"2", "转发失败,认证接口不存在", dbname, object.getString("id"), sysApplicationEntity.getName(), sysApplicationEntity.getId(), apiEntity.getApiName(),apiEntity.getId(), object.toJSONString(), type); saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(), mdmModuleDistributeEntity.getId(), "2", "转发失败,认证接口不存在", dbname, object.getString("id"), sysApplicationEntity.getName(), sysApplicationEntity.getId(), apiEntity.getApiName(), apiEntity.getId(), object.toJSONString(), type);
return BaseResult.getFailureMessageEntity("发送错误,认证接口不存在"); return BaseResult.getFailureMessageEntity("发送错误,认证接口不存在");
} }
@ -1880,7 +1883,7 @@ public class MdmServiceImpl implements IMdmService {
String rzbodys = getBodys(loginApi, null, null); String rzbodys = getBodys(loginApi, null, null);
JsonResultEntity rzjsonResultEntity = sendData(loginApi, rzheaders, rzbodys, rzquerys); JsonResultEntity rzjsonResultEntity = sendData(loginApi, rzheaders, rzbodys, rzquerys);
if (!rzjsonResultEntity.isFlag()) { if (!rzjsonResultEntity.isFlag()) {
saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(),mdmModuleDistributeEntity.getId(),"2", "转发失败,认证接口调用失败", dbname, object.getString("id"), sysApplicationEntity.getName(),sysApplicationEntity.getId(), apiEntity.getApiName(),apiEntity.getId(), object.toJSONString(), type); saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(), mdmModuleDistributeEntity.getId(), "2", "转发失败,认证接口调用失败", dbname, object.getString("id"), sysApplicationEntity.getName(), sysApplicationEntity.getId(), apiEntity.getApiName(), apiEntity.getId(), object.toJSONString(), type);
return BaseResult.getFailureMessageEntity("发送错误:" + rzjsonResultEntity.getMsg()); return BaseResult.getFailureMessageEntity("发送错误:" + rzjsonResultEntity.getMsg());
} }
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString()); JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
@ -1906,21 +1909,21 @@ public class MdmServiceImpl implements IMdmService {
if (jsonResultEntity.isFlag()) { if (jsonResultEntity.isFlag()) {
if ("1".equals(type)) {//保存三方返回id if ("1".equals(type)) {//保存三方返回id
if (scriptEntity != null && scriptEntity.getId() != null && scriptEntity.getBackScriptData() != null ) { if (scriptEntity != null && scriptEntity.getId() != null && scriptEntity.getBackScriptData() != null) {
JSONObject backScriptJson = new JSONObject(); JSONObject backScriptJson = new JSONObject();
backScriptJson.put("data", jsonResultEntity.getAttribute()); backScriptJson.put("data", jsonResultEntity.getAttribute());
groovy.put("code", scriptEntity.getScriptCode()+"back"); groovy.put("code", scriptEntity.getScriptCode() + "back");
groovy.put("className", scriptEntity.getClassName()+"back"); groovy.put("className", scriptEntity.getClassName() + "back");
groovy.put("name", scriptEntity.getScriptName()+"back"); groovy.put("name", scriptEntity.getScriptName() + "back");
groovy.put("methodStr", scriptEntity.getBackScriptData()); groovy.put("methodStr", scriptEntity.getBackScriptData());
groovy.put("parameterJson", backScriptJson); groovy.put("parameterJson", backScriptJson);
JSONObject groovyStr = new JSONObject(); JSONObject groovyStr = new JSONObject();
groovyStr.put("jsonStr", groovy); groovyStr.put("jsonStr", groovy);
try { try {
Object str = groovyIntegrationService.groovyScriptExecution(groovyStr); Object str = groovyIntegrationService.groovyScriptExecution(groovyStr);
if(str != null){ if (str != null) {
JSONObject backJsonResultEntity = JSONObject.parseObject(str.toString()); JSONObject backJsonResultEntity = JSONObject.parseObject(str.toString());
if(backJsonResultEntity != null && backJsonResultEntity.getString("success") != null && "true".equals(backJsonResultEntity.getString("success"))){ if (backJsonResultEntity != null && backJsonResultEntity.getString("success") != null && "true".equals(backJsonResultEntity.getString("success"))) {
MdmModuleDistributeTripartiteEntity mdmModuleDistributeTripartiteEntity = new MdmModuleDistributeTripartiteEntity(); MdmModuleDistributeTripartiteEntity mdmModuleDistributeTripartiteEntity = new MdmModuleDistributeTripartiteEntity();
mdmModuleDistributeTripartiteEntity.setCreate(); mdmModuleDistributeTripartiteEntity.setCreate();
mdmModuleDistributeTripartiteEntity.setMdmId(mdmModuleEntity.getId()); mdmModuleDistributeTripartiteEntity.setMdmId(mdmModuleEntity.getId());
@ -1931,16 +1934,16 @@ public class MdmServiceImpl implements IMdmService {
} }
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("新增返回脚本解析保存三方id错误"+jsonResultEntity.getAttribute()); logger.error("新增返回脚本解析保存三方id错误" + jsonResultEntity.getAttribute());
saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(),mdmModuleDistributeEntity.getId(),"2", "转发失败", dbname, object.getString("id"), sysApplicationEntity.getName(),sysApplicationEntity.getId(), apiEntity.getApiName(),apiEntity.getId(), object.toJSONString(), type); saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(), mdmModuleDistributeEntity.getId(), "2", "转发失败", dbname, object.getString("id"), sysApplicationEntity.getName(), sysApplicationEntity.getId(), apiEntity.getApiName(), apiEntity.getId(), object.toJSONString(), type);
return BaseResult.getFailureMessageEntity("发送错误:" + jsonResultEntity.getMsg()); return BaseResult.getFailureMessageEntity("发送错误:" + jsonResultEntity.getMsg());
} }
} }
} }
saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(),mdmModuleDistributeEntity.getId(),"1", "发送成功", dbname, object.getString("id"), sysApplicationEntity.getName(),sysApplicationEntity.getId(), apiEntity.getApiName(),apiEntity.getId(), object.toJSONString(), type); saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(), mdmModuleDistributeEntity.getId(), "1", "发送成功", dbname, object.getString("id"), sysApplicationEntity.getName(), sysApplicationEntity.getId(), apiEntity.getApiName(), apiEntity.getId(), object.toJSONString(), type);
return BaseResult.getSuccessMessageEntity("发送成功"); return BaseResult.getSuccessMessageEntity("发送成功");
} else { } else {
saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(),mdmModuleDistributeEntity.getId(),"2", "转发失败", dbname, object.getString("id"), sysApplicationEntity.getName(),sysApplicationEntity.getId(), apiEntity.getApiName(),apiEntity.getId(), object.toJSONString(), type); saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(), mdmModuleDistributeEntity.getId(), "2", "转发失败", dbname, object.getString("id"), sysApplicationEntity.getName(), sysApplicationEntity.getId(), apiEntity.getApiName(), apiEntity.getId(), object.toJSONString(), type);
return BaseResult.getFailureMessageEntity("发送错误:" + jsonResultEntity.getMsg()); return BaseResult.getFailureMessageEntity("发送错误:" + jsonResultEntity.getMsg());
} }
} }
@ -2288,15 +2291,15 @@ public class MdmServiceImpl implements IMdmService {
post.setEntity(entity); post.setEntity(entity);
} }
logger.info("接口拼接querys信息"+ querys); logger.info("接口拼接querys信息" + querys);
if (headers != null && headers.size() > 0) { if (headers != null && headers.size() > 0) {
StringBuffer stringBuffer = new StringBuffer(); StringBuffer stringBuffer = new StringBuffer();
for (String key : headers.keySet()) { for (String key : headers.keySet()) {
stringBuffer.append(key).append("=").append(headers.get(key)).append("&"); stringBuffer.append(key).append("=").append(headers.get(key)).append("&");
} }
logger.info("接口拼接header信息"+ stringBuffer); logger.info("接口拼接header信息" + stringBuffer);
} }
logger.info("接口拼接bodys信息"+ bodys); logger.info("接口拼接bodys信息" + bodys);
response = closeableHttpClient.execute(post); response = closeableHttpClient.execute(post);
@ -2341,9 +2344,9 @@ public class MdmServiceImpl implements IMdmService {
} }
} }
private void saveMdmModuleSendLogEntity(Long mdmCode,String distributeId,String dataType,String remark,String dbname,String formmain_id, String target_app,String appID, String target_api,String apiId, String source_data, String option_type) throws Exception { private void saveMdmModuleSendLogEntity(Long mdmCode, String distributeId, String dataType, String remark, String dbname, String formmain_id, String target_app, String appID, String target_api, String apiId, String source_data, String option_type) throws Exception {
MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity(); MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity();
mdmModuleSendLogEntity.setTableName(dbname+"_send_log"); mdmModuleSendLogEntity.setTableName(dbname + "_send_log");
mdmModuleSendLogEntity.setId(UUIDUtils.getUUID()); mdmModuleSendLogEntity.setId(UUIDUtils.getUUID());
mdmModuleSendLogEntity.setDistributeId(distributeId); mdmModuleSendLogEntity.setDistributeId(distributeId);
mdmModuleSendLogEntity.setAppId(appID); mdmModuleSendLogEntity.setAppId(appID);
@ -2376,18 +2379,18 @@ public class MdmServiceImpl implements IMdmService {
integrationTaskLivingDetailsEntity.setOrg_id("0"); integrationTaskLivingDetailsEntity.setOrg_id("0");
integrationTaskLivingDetailsEntity.setCompanyId("0"); integrationTaskLivingDetailsEntity.setCompanyId("0");
JSONObject aa = new JSONObject(); JSONObject aa = new JSONObject();
aa.put("mdmCode",mdmCode);//主数据编码 aa.put("mdmCode", mdmCode);//主数据编码
aa.put("documentRule",jsonObject.getString("document_rule"));//行数据的单据规则编码 aa.put("documentRule", jsonObject.getString("document_rule"));//行数据的单据规则编码
aa.put("distributeId",distributeId);//发送表id aa.put("distributeId", distributeId);//发送表id
aa.put("type",option_type);//发送类型1新增2修改3删除 aa.put("type", option_type);//发送类型1新增2修改3删除
integrationTaskLivingDetailsEntity.setRootAppPk(aa.toJSONString()); integrationTaskLivingDetailsEntity.setRootAppPk(aa.toJSONString());
integrationTaskLivingDetailsEntity.setRootAppBill(jsonObject.getString("document_rule")); integrationTaskLivingDetailsEntity.setRootAppBill(jsonObject.getString("document_rule"));
integrationTaskLivingDetailsEntity.setPluginId("MdmModulePlugin"); integrationTaskLivingDetailsEntity.setPluginId("MdmModulePlugin");
integrationTaskLivingDetailsEntity.setRootAppNewData(source_data); integrationTaskLivingDetailsEntity.setRootAppNewData(source_data);
integrationTaskLivingDetailsEntity.setNewTransmitInfo(remark); integrationTaskLivingDetailsEntity.setNewTransmitInfo(remark);
if("1".equals(dataType)){ if ("1".equals(dataType)) {
taskLivingDetailsService.saveLogToSuccess(integrationTaskLivingDetailsEntity); taskLivingDetailsService.saveLogToSuccess(integrationTaskLivingDetailsEntity);
}else { } else {
taskLivingDetailsService.saveLogToFail(integrationTaskLivingDetailsEntity); taskLivingDetailsService.saveLogToFail(integrationTaskLivingDetailsEntity);
} }
@ -2581,17 +2584,17 @@ public class MdmServiceImpl implements IMdmService {
update_status.setFiledsName("update_status"); update_status.setFiledsName("update_status");
update_status.setFiledsValue("0"); update_status.setFiledsValue("0");
mdmDataFiledDtos.add(update_status); mdmDataFiledDtos.add(update_status);
}else if(flag && "data_status".equals(fileds.get(i1).getEnName())) { } else if (flag && "data_status".equals(fileds.get(i1).getEnName())) {
MdmDataFiledDto data_status = new MdmDataFiledDto(); MdmDataFiledDto data_status = new MdmDataFiledDto();
data_status.setFiledsName("data_status"); data_status.setFiledsName("data_status");
data_status.setFiledsValue("F"); data_status.setFiledsValue("F");
mdmDataFiledDtos.add(data_status); mdmDataFiledDtos.add(data_status);
}else if(flag && "modify_user_id".equals(fileds.get(i1).getEnName())) { } else if (flag && "modify_user_id".equals(fileds.get(i1).getEnName())) {
MdmDataFiledDto data_status = new MdmDataFiledDto(); MdmDataFiledDto data_status = new MdmDataFiledDto();
data_status.setFiledsName("modify_user_id"); data_status.setFiledsName("modify_user_id");
data_status.setFiledsValue("F"); data_status.setFiledsValue("F");
//mdmDataFiledDtos.add(data_status); //mdmDataFiledDtos.add(data_status);
}else { } else {
MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto(); MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto();
mdmDataFiledDto.setFiledsName(fileds.get(i1).getEnName()); mdmDataFiledDto.setFiledsName(fileds.get(i1).getEnName());
mdmDataFiledDto.setFiledsValue(jsonObject.getString(fileds.get(i1).getEnName())); mdmDataFiledDto.setFiledsValue(jsonObject.getString(fileds.get(i1).getEnName()));