主数据修改
This commit is contained in:
parent
256e616fe5
commit
9035801444
|
@ -262,6 +262,7 @@ where id = #{id}
|
|||
<if test="!detailFlag">
|
||||
and id = #{id}
|
||||
</if>
|
||||
and data_status != 'N'
|
||||
and sts = 'Y'
|
||||
</trim>
|
||||
</select>
|
||||
|
@ -279,6 +280,7 @@ where id = #{id}
|
|||
and id = #{id}
|
||||
</if>
|
||||
and sts = 'Y'
|
||||
and data_status != 'N'
|
||||
</trim>
|
||||
order by sorts asc
|
||||
</select>
|
||||
|
|
|
@ -657,7 +657,7 @@ 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){
|
||||
if (null != businessResult && businessResult.size() > 0) {
|
||||
convertKeysToLowerCase(businessResult);
|
||||
}
|
||||
PageInfo pageInfo = new PageInfo(businessResult);
|
||||
|
@ -1060,10 +1060,10 @@ public class MdmServiceImpl implements IMdmService {
|
|||
//1、主表 2、明细
|
||||
mainMdmModuleDb = mdmModuleDbEntityList.get(i);
|
||||
//循环字段表
|
||||
if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) {
|
||||
for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) {
|
||||
if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) {
|
||||
for (int b = 0; b < mdmModuleViewDetailEntityList.size(); b++) {
|
||||
for (int b = 0; b < mdmModuleViewDetailEntityList.size(); b++) {
|
||||
if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) {
|
||||
for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) {
|
||||
if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) {
|
||||
if (mdmModuleViewDetailEntityList.get(b).getViewFiled().equals(mdmModuleDbFiledsEntityList.get(i1).getId())) {
|
||||
mainMdmModuleDbFileds.add(mdmModuleDbFiledsEntityList.get(i1));
|
||||
List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRules = new ArrayList<>();
|
||||
|
@ -1078,19 +1078,23 @@ public class MdmServiceImpl implements IMdmService {
|
|||
}
|
||||
mdmModuleDbFiledsEntityList.get(i1).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRules);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ("2".equals(mdmModuleDbEntityList.get(i).getDbType())) {
|
||||
//2、明细
|
||||
sublistMdmModuleDb.add(mdmModuleDbEntityList.get(i));
|
||||
|
||||
//循环字段表
|
||||
if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) {
|
||||
List<MdmModuleDbFiledsEntity> sublistMdmModuleDbFileds = new ArrayList<>();
|
||||
for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) {
|
||||
if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) {
|
||||
for (int b = 0; b < mdmModuleViewDetailEntityList.size(); b++) {
|
||||
for (int b = 0; b < mdmModuleViewDetailEntityList.size(); b++) {
|
||||
for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) {
|
||||
if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) {
|
||||
|
||||
if (mdmModuleViewDetailEntityList.get(b).getViewFiled().equals(mdmModuleDbFiledsEntityList.get(i1).getId())) {
|
||||
sublistMdmModuleDbFileds.add(mdmModuleDbFiledsEntityList.get(i1));
|
||||
List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRules = new ArrayList<>();
|
||||
|
@ -1106,7 +1110,6 @@ public class MdmServiceImpl implements IMdmService {
|
|||
mdmModuleDbFiledsEntityList.get(i1).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRules);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
mdmModuleDbEntityList.get(i).setSublistMdmModuleDbFileds(sublistMdmModuleDbFileds);
|
||||
|
@ -1824,7 +1827,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
mdmModuleDistributeTripartiteEntity.setAppId(sysApplicationEntity.getId());
|
||||
mdmModuleDistributeTripartiteEntity = mdmModuleDistributeTripartiteDao.queryOneTripartite(mdmModuleDistributeTripartiteEntity);
|
||||
String tripartiteId = "";
|
||||
if(mdmModuleDistributeTripartiteEntity != null && mdmModuleDistributeTripartiteEntity.getTripartiteId() != null ){
|
||||
if (mdmModuleDistributeTripartiteEntity != null && mdmModuleDistributeTripartiteEntity.getTripartiteId() != null) {
|
||||
tripartiteId = mdmModuleDistributeTripartiteEntity.getTripartiteId();
|
||||
}
|
||||
parameterJson.put("tripartiteId", tripartiteId);
|
||||
|
@ -1836,7 +1839,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
String querys = null;
|
||||
/** body */
|
||||
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("className", scriptEntity.getClassName());
|
||||
groovy.put("name", scriptEntity.getScriptName());
|
||||
|
@ -1866,7 +1869,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
//找到登陆接口
|
||||
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
|
||||
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("发送错误,认证接口不存在");
|
||||
|
||||
}
|
||||
|
@ -1880,7 +1883,7 @@ public class MdmServiceImpl implements IMdmService {
|
|||
String rzbodys = getBodys(loginApi, null, null);
|
||||
JsonResultEntity rzjsonResultEntity = sendData(loginApi, rzheaders, rzbodys, rzquerys);
|
||||
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());
|
||||
}
|
||||
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
||||
|
@ -1906,21 +1909,21 @@ public class MdmServiceImpl implements IMdmService {
|
|||
if (jsonResultEntity.isFlag()) {
|
||||
|
||||
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();
|
||||
backScriptJson.put("data", jsonResultEntity.getAttribute());
|
||||
groovy.put("code", scriptEntity.getScriptCode()+"back");
|
||||
groovy.put("className", scriptEntity.getClassName()+"back");
|
||||
groovy.put("name", scriptEntity.getScriptName()+"back");
|
||||
groovy.put("code", scriptEntity.getScriptCode() + "back");
|
||||
groovy.put("className", scriptEntity.getClassName() + "back");
|
||||
groovy.put("name", scriptEntity.getScriptName() + "back");
|
||||
groovy.put("methodStr", scriptEntity.getBackScriptData());
|
||||
groovy.put("parameterJson", backScriptJson);
|
||||
JSONObject groovyStr = new JSONObject();
|
||||
groovyStr.put("jsonStr", groovy);
|
||||
try {
|
||||
Object str = groovyIntegrationService.groovyScriptExecution(groovyStr);
|
||||
if(str != null){
|
||||
if (str != null) {
|
||||
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.setCreate();
|
||||
mdmModuleDistributeTripartiteEntity.setMdmId(mdmModuleEntity.getId());
|
||||
|
@ -1931,16 +1934,16 @@ public class MdmServiceImpl implements IMdmService {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
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);
|
||||
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);
|
||||
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("发送成功");
|
||||
} 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());
|
||||
}
|
||||
}
|
||||
|
@ -2288,15 +2291,15 @@ public class MdmServiceImpl implements IMdmService {
|
|||
post.setEntity(entity);
|
||||
}
|
||||
|
||||
logger.info("接口拼接querys信息:"+ querys);
|
||||
logger.info("接口拼接querys信息:" + querys);
|
||||
if (headers != null && headers.size() > 0) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
for (String key : headers.keySet()) {
|
||||
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);
|
||||
|
||||
|
@ -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.setTableName(dbname+"_send_log");
|
||||
mdmModuleSendLogEntity.setTableName(dbname + "_send_log");
|
||||
mdmModuleSendLogEntity.setId(UUIDUtils.getUUID());
|
||||
mdmModuleSendLogEntity.setDistributeId(distributeId);
|
||||
mdmModuleSendLogEntity.setAppId(appID);
|
||||
|
@ -2376,18 +2379,18 @@ public class MdmServiceImpl implements IMdmService {
|
|||
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、删除
|
||||
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)){
|
||||
if ("1".equals(dataType)) {
|
||||
taskLivingDetailsService.saveLogToSuccess(integrationTaskLivingDetailsEntity);
|
||||
}else {
|
||||
} else {
|
||||
taskLivingDetailsService.saveLogToFail(integrationTaskLivingDetailsEntity);
|
||||
|
||||
}
|
||||
|
@ -2581,17 +2584,17 @@ public class MdmServiceImpl implements IMdmService {
|
|||
update_status.setFiledsName("update_status");
|
||||
update_status.setFiledsValue("0");
|
||||
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();
|
||||
data_status.setFiledsName("data_status");
|
||||
data_status.setFiledsValue("F");
|
||||
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();
|
||||
data_status.setFiledsName("modify_user_id");
|
||||
data_status.setFiledsValue("F");
|
||||
//mdmDataFiledDtos.add(data_status);
|
||||
}else {
|
||||
} else {
|
||||
MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto();
|
||||
mdmDataFiledDto.setFiledsName(fileds.get(i1).getEnName());
|
||||
mdmDataFiledDto.setFiledsValue(jsonObject.getString(fileds.get(i1).getEnName()));
|
||||
|
|
Loading…
Reference in New Issue