修改保存数据到任务日志
This commit is contained in:
parent
c333f3f84f
commit
319bd2ba7a
|
@ -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;
|
||||
|
@ -101,7 +102,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "MdmModulePlugin插件";
|
||||
return "主数据下发";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -425,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");
|
||||
|
@ -454,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);
|
||||
|
||||
}
|
||||
|
||||
|
@ -472,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<>();
|
||||
|
@ -488,7 +490,7 @@ 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);
|
||||
|
||||
|
@ -516,21 +518,21 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
}
|
||||
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 ;
|
||||
}
|
||||
|
@ -540,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 ;
|
||||
}
|
||||
|
@ -587,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;
|
||||
}
|
||||
}
|
||||
|
@ -603,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);
|
||||
|
@ -616,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());
|
||||
|
@ -628,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;
|
||||
}
|
||||
}
|
||||
|
@ -650,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<>();
|
||||
|
@ -666,7 +668,7 @@ 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);
|
||||
|
||||
|
@ -694,21 +696,21 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
}
|
||||
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 ;
|
||||
}
|
||||
|
@ -718,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 ;
|
||||
}
|
||||
|
@ -756,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;
|
||||
}
|
||||
}
|
||||
|
@ -772,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);
|
||||
|
@ -785,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());
|
||||
|
@ -797,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;
|
||||
}
|
||||
}
|
||||
|
@ -826,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<>();
|
||||
|
@ -842,7 +844,7 @@ 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);
|
||||
|
||||
|
@ -870,21 +872,22 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
}
|
||||
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 ;
|
||||
}
|
||||
|
@ -894,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 ;
|
||||
}
|
||||
|
@ -941,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;
|
||||
}
|
||||
}
|
||||
|
@ -957,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);
|
||||
|
@ -970,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());
|
||||
|
@ -983,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;
|
||||
}
|
||||
}
|
||||
|
@ -1004,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());
|
||||
|
@ -1023,6 +1026,35 @@ 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) {
|
||||
|
|
|
@ -941,6 +941,7 @@ where id = #{id}
|
|||
and sts = 'Y'
|
||||
<if test="size != null and size !='' ">limit #{size}</if>
|
||||
</trim>
|
||||
order by sorts asc
|
||||
</select>
|
||||
|
||||
<!-- 分页查询列表 采用like格式 -->
|
||||
|
|
Loading…
Reference in New Issue