修改主数据

This commit is contained in:
lvleigang 2024-07-04 13:44:32 +08:00
parent 99c9bc958a
commit 195846ba99
10 changed files with 224 additions and 52 deletions

2
.gitignore vendored
View File

@ -52,7 +52,7 @@ $RECYCLE.BIN/
# Windows shortcuts
*.lnk
./idea/
/buildpackage/src/main/resources/banner.txt
/webapp/target/
/service/target/

View File

@ -117,10 +117,6 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) {
boolean flags = true;
if(flags){
return null;
}
try{
//重试方法
if (null != requestJson) {
@ -403,8 +399,10 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
return BaseResult.getFailureMessageEntity("发送错误:"+rzjsonResultEntity.getMsg());
}
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
logger.info("认证接口返回信息:"+ attritube.toJSONString());
querys = getQuery(apiEntity,querys,attritube);
headers = getHeaders(apiEntity,headers,attritube);
bodys = getBodys(apiEntity,bodys,attritube);
}
//组装数据发送
@ -522,21 +520,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(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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,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(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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,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(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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,null,apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"3");
}
return ;
}
@ -546,7 +544,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(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"3");
}
return ;
}
@ -558,6 +556,9 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
mdmModuleSendLogEntity.setTableName(mainDb+"_send_log");
mdmModuleSendLogEntity.setFormmainId(doObjects.get(i).getString("id"));
mdmModuleSendLogEntity.setSts("Y");
mdmModuleSendLogEntity.setAppId(sysApplicationEntity.getId());
mdmModuleSendLogEntity.setApiId(apiEntity.getId());
//mdmModuleSendLogEntity.setDistributeId(mdmModuleDistributeEntities.get(i1).getId());
mdmModuleSendLogEntity.setOptionType("3");
Integer num = mdmModuleSendLogDao.getCount(mdmModuleSendLogEntity);
if(num > 0){//已经过不发送
@ -593,7 +594,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
querys = jsonResultEntity.getString("querys");
bodys = jsonResultEntity.getString("bodys");
}catch (Exception e){
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"3");
continue;
}
}
@ -609,7 +610,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
//找到登陆接口
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
if (null == loginApi) {
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
continue;
}
String rzquerys = getQuery(loginApi,null,null);
@ -622,7 +623,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
String rzbodys = getBodys(loginApi,null,null);
JsonResultEntity rzjsonResultEntity = sendData(loginApi,rzheaders,rzbodys,rzquerys);
if (!rzjsonResultEntity.isFlag()) {
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
continue;
}
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
@ -634,11 +635,11 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
if(jsonResultEntity.isFlag()){
//保存日志
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"3");
continue;
}else {
//保存日志
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"3");
continue;
}
}
@ -700,21 +701,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(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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,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(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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,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(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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,null,apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"2");
}
return ;
}
@ -724,7 +725,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(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"2");
}
return ;
}
@ -762,7 +763,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
querys = jsonResultEntity.getString("querys");
bodys = jsonResultEntity.getString("bodys");
}catch (Exception e){
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"2");
continue;
}
}
@ -778,7 +779,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
//找到登陆接口
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
if (null == loginApi) {
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
continue;
}
String rzquerys = getQuery(loginApi,null,null);
@ -791,7 +792,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
String rzbodys = getBodys(loginApi,null,null);
JsonResultEntity rzjsonResultEntity = sendData(loginApi,rzheaders,rzbodys,rzquerys);
if (!rzjsonResultEntity.isFlag()) {
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
continue;
}
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
@ -803,11 +804,11 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
if(jsonResultEntity.isFlag()){
//保存日志
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"2");
continue;
}else {
//保存日志
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"2");
continue;
}
}
@ -877,21 +878,21 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
if(mdmModuleDistributeEntities.get(i1).getAddApi() == null || "".equals(mdmModuleDistributeEntities.get(i1).getAddApi())){
for (int i = 0; i < doObjects.size(); i++) {
//taskLivingDetailsService.saveLogToSuccess();
saveMdmModuleSendLogEntity( mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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,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(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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,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(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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,null,apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
}
return ;
}
@ -901,7 +902,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(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
}
return ;
}
@ -913,6 +914,9 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
mdmModuleSendLogEntity.setTableName(mainDb+"_send_log");
mdmModuleSendLogEntity.setFormmainId(doObjects.get(i).getString("id"));
mdmModuleSendLogEntity.setSts("Y");
mdmModuleSendLogEntity.setAppId(sysApplicationEntity.getId());
mdmModuleSendLogEntity.setApiId(apiEntity.getId());
//mdmModuleSendLogEntity.setDistributeId(mdmModuleDistributeEntities.get(i1).getId());
mdmModuleSendLogEntity.setOptionType("1");
Integer num = mdmModuleSendLogDao.getCount(mdmModuleSendLogEntity);
if(num > 0){//已经新增过不发送
@ -948,7 +952,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
querys = jsonResultEntity.getString("querys");
bodys = jsonResultEntity.getString("bodys");
}catch (Exception e){
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
continue;
}
}
@ -964,7 +968,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
//找到登陆接口
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
if (null == loginApi) {
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
continue;
}
String rzquerys = getQuery(loginApi,null,null);
@ -977,7 +981,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
String rzbodys = getBodys(loginApi,null,null);
JsonResultEntity rzjsonResultEntity = sendData(loginApi,rzheaders,rzbodys,rzquerys);
if (!rzjsonResultEntity.isFlag()) {
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
continue;
}
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
@ -990,11 +994,11 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
if(jsonResultEntity.isFlag()){
//保存日志
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
continue;
}else {
//保存日志
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"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(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
continue;
}
}
@ -1011,11 +1015,14 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
}
}
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 {
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.setId(UUIDUtils.getUUID());
mdmModuleSendLogEntity.setSts("Y");
mdmModuleSendLogEntity.setDistributeId(distributeId);
mdmModuleSendLogEntity.setAppId(appId);
mdmModuleSendLogEntity.setApiId(apiID);
mdmModuleSendLogEntity.setCreate_user_id("1");
mdmModuleSendLogEntity.setModify_user_id("1");
mdmModuleSendLogEntity.setCreate_time(new Date());

View File

@ -63,6 +63,6 @@ public interface IMdmModuleDao extends IBaseDao<MdmModuleEntity, String> {
* @param
* @return java.util.List<java.lang.Object>
**/
//List<String> queryMdMFields(Map<String, Object> maps);
List<String> queryMdMFields(Map<String, Object> maps);
}

View File

@ -171,11 +171,11 @@ 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<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, Object> maps) {

View File

@ -467,7 +467,7 @@ where id = #{id}
</select>
<select id="alterTableField" resultType="java.lang.Integer">
<select id="alterTableField" databaseId="mysql" resultType="java.lang.Integer">
ALTER TABLE ${dbName}
<choose>
@ -532,6 +532,65 @@ where id = #{id}
</when>
</choose>
</select>
<select id="alterTableField" databaseId="oracle" resultType="java.lang.Integer">
ALTER TABLE "businesscenter".${dbName}
<choose>
<when test="filedType == '1'.toString()">
<choose>
<when test="dataType == '1'.toString()">
add ${enName} bigint(${filedLength}) DEFAULT NULL
</when>
<when test="dataType == '3'.toString()">
drop ${enName}
</when>
<otherwise>
MODIFY ${enName} bigint(${filedLength}) DEFAULT NULL
</otherwise>
</choose>
</when>
<when test="filedType == '3'.toString()">
<choose>
<when test="dataType == '1'.toString()">
add ${enName} varchar(${filedLength}) DEFAULT NULL
</when>
<when test="dataType == '3'.toString()">
drop ${enName}
</when>
<otherwise>
MODIFY ${enName} varchar(${filedLength}) DEFAULT NULL
</otherwise>
</choose>
</when>
<when test="filedType == '2'.toString()">
<choose>
<when test="dataType == '1'.toString()">
add ${enName} decimal(${filedLength}) DEFAULT NULL
</when>
<when test="dataType == '3'.toString()">
drop ${enName}
</when>
<otherwise>
MODIFY ${enName} decimal(${filedLength}) DEFAULT NULL
</otherwise>
</choose>
</when>
<when test="filedType == '4'.toString()">
<choose>
<when test="dataType == '1'.toString()">
add ${enName} datetime DEFAULT NULL
</when>
<when test="dataType == '3'.toString()">
drop ${enName}
</when>
<otherwise>
MODIFY ${enName} datetime DEFAULT NULL
</otherwise>
</choose>
</when>
</choose>
</select>

View File

@ -863,6 +863,23 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
remark.setCreate();
remark.setDataType("1");
mdmModuleDbFiledsEntities.add(remark);
MdmModuleDbFiledsEntity distribute_id = new MdmModuleDbFiledsEntity();
distribute_id.setMdmId(entity.getMdmId());
distribute_id.setDbId(entity.getId());
distribute_id.setEnName("distribute_id");
distribute_id.setChName("下发表id");
distribute_id.setFiledType("3");
distribute_id.setAddType("1");
distribute_id.setUpdateType("1");
distribute_id.setShowType("1");
distribute_id.setQueryType("1");
distribute_id.setListType("1");
distribute_id.setViewType("1");
distribute_id.setFiledLength("50");
distribute_id.setCreate();
distribute_id.setDataType("1");
mdmModuleDbFiledsEntities.add(distribute_id);
}
if ("2".equals(entity.getDbType()) || "1".equals(entity.getDbType())) {
MdmModuleDbFiledsEntity data_status = new MdmModuleDbFiledsEntity();

View File

@ -12,7 +12,7 @@ import com.hzya.frame.web.entity.BaseEntity;
* @since 2024-06-18 11:39:46
*/
public class MdmModuleDistributeEntity extends BaseEntity {
/** 主数据模版ID */
private String mdmId;
/** 应用id */

View File

@ -29,6 +29,12 @@ public class MdmModuleSendLogEntity extends BaseEntity {
private String optionType;
/** 公司id */
private String companyId;
/** 下发表id */
private String distributeId;
/** 应用id */
private String appId;
/** apiID */
private String apiId;
public String getRemark() {
return remark;
@ -109,5 +115,29 @@ public class MdmModuleSendLogEntity extends BaseEntity {
public void setMdmCode(Long mdmCode) {
this.mdmCode = mdmCode;
}
public String getDistributeId() {
return distributeId;
}
public void setDistributeId(String distributeId) {
this.distributeId = distributeId;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getApiId() {
return apiId;
}
public void setApiId(String apiId) {
this.apiId = apiId;
}
}

View File

@ -8,6 +8,9 @@
<result property="targetApp" column="target_app" jdbcType="VARCHAR"/>
<result property="targetApi" column="target_api" jdbcType="VARCHAR"/>
<result property="sourceData" column="source_data" jdbcType="VARCHAR"/>
<result property="distributeId" column="distribute_id" jdbcType="VARCHAR"/>
<result property="appId" column="app_id" jdbcType="VARCHAR"/>
<result property="apiId" column="api_id" jdbcType="VARCHAR"/>
<result property="optionType" column="option_type" jdbcType="VARCHAR"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
<result property="dataType" column="data_type" jdbcType="VARCHAR"/>
@ -27,7 +30,10 @@
,target_app
,target_api
,source_data
,option_type
,distribute_id
,app_id
,api_id
,option_type
,remark
,data_type
,sorts
@ -56,6 +62,9 @@
<if test="targetApp != null and targetApp != ''"> and target_app = #{targetApp} </if>
<if test="targetApi != null and targetApi != ''"> and target_api = #{targetApi} </if>
<if test="sourceData != null and sourceData != ''"> and source_data = #{sourceData} </if>
<if test="distributeId != null and distributeId != ''"> and distribute_id = #{distributeId} </if>
<if test="appId != null and appId != ''"> and app_id = #{appId} </if>
<if test="apiId != null and apiId != ''"> and api_id = #{apiId} </if>
<if test="optionType != null and optionType != ''"> and option_type = #{optionType} </if>
<if test="remark != null and remark != ''"> and remark = #{remark} </if>
<if test="dataType != null and dataType != ''"> and data_type = #{dataType} </if>
@ -82,6 +91,9 @@
<if test="targetApp != null and targetApp != ''"> and target_app = #{targetApp} </if>
<if test="targetApi != null and targetApi != ''"> and target_api = #{targetApi} </if>
<if test="sourceData != null and sourceData != ''"> and source_data = #{sourceData} </if>
<if test="distributeId != null and distributeId != ''"> and distribute_id = #{distributeId} </if>
<if test="appId != null and appId != ''"> and app_id = #{appId} </if>
<if test="apiId != null and apiId != ''"> and api_id = #{apiId} </if>
<if test="optionType != null and optionType != ''"> and option_type = #{optionType} </if>
<if test="remark != null and remark != ''"> and remark = #{remark} </if>
<if test="dataType != null and dataType != ''"> and data_type = #{dataType} </if>
@ -110,6 +122,9 @@
<if test="targetApp != null and targetApp != ''"> and target_app like concat('%',#{targetApp},'%') </if>
<if test="targetApi != null and targetApi != ''"> and target_api like concat('%',#{targetApi},'%') </if>
<if test="sourceData != null and sourceData != ''"> and source_data like concat('%',#{sourceData},'%') </if>
<if test="distributeId != null and distributeId != ''"> and distribute_id like concat('%',#{distributeId},'%') </if>
<if test="appId != null and appId != ''"> and app_id like concat('%',#{appId},'%') </if>
<if test="apiId != null and apiId != ''"> and api_id like concat('%',#{apiId},'%') </if>
<if test="optionType != null and optionType != ''"> and option_type like concat('%',#{optionType},'%') </if>
<if test="remark != null and remark != ''"> and remark like concat('%',#{remark},'%') </if>
<if test="dataType != null and dataType != ''"> and data_type like concat('%',#{dataType},'%') </if>
@ -138,6 +153,9 @@
<if test="targetApp != null and targetApp != ''"> or target_app = #{targetApp} </if>
<if test="targetApi != null and targetApi != ''"> or target_api = #{targetApi} </if>
<if test="sourceData != null and sourceData != ''"> or source_data = #{sourceData} </if>
<if test="distributeId != null and distributeId != ''"> or distribute_id = #{distributeId} </if>
<if test="appId != null and appId != ''"> or app_id = #{appId} </if>
<if test="apiId != null and apiId != ''"> or api_id = #{apiId} </if>
<if test="optionType != null and optionType != ''"> or option_type = #{optionType} </if>
<if test="remark != null and remark != ''"> or remark = #{remark} </if>
<if test="dataType != null and dataType != ''"> or data_type = #{dataType} </if>
@ -164,6 +182,9 @@
<if test="targetApp != null and targetApp != ''"> target_app , </if>
<if test="targetApi != null and targetApi != ''"> target_api , </if>
<if test="sourceData != null and sourceData != ''"> source_data , </if>
<if test="distributeId != null and distributeId != ''"> distribute_id , </if>
<if test="appId != null and appId != ''"> app_id , </if>
<if test="apiId != null and apiId != ''"> api_id , </if>
<if test="optionType != null and optionType != ''"> option_type , </if>
<if test="remark != null and remark != ''"> remark , </if>
<if test="dataType != null and dataType != ''"> data_type , </if>
@ -184,6 +205,9 @@
<if test="targetApp != null and targetApp != ''"> #{targetApp} ,</if>
<if test="targetApi != null and targetApi != ''"> #{targetApi} ,</if>
<if test="sourceData != null and sourceData != ''"> #{sourceData} ,</if>
<if test="distributeId != null and distributeId != ''"> #{distributeId} ,</if>
<if test="appId != null and appId != ''"> #{appId} ,</if>
<if test="apiId != null and apiId != ''"> #{apiId} ,</if>
<if test="optionType != null and optionType != ''"> #{optionType} ,</if>
<if test="remark != null and remark != ''"> #{remark} ,</if>
<if test="dataType != null and dataType != ''"> #{dataType} ,</if>
@ -201,24 +225,27 @@
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" >
insert into ${tableName}(formmain_id, target_app, target_api, source_data, option_type,remark,data_type, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts)
insert into ${tableName}(formmain_id, target_app, target_api, source_data,distribute_id,app_id,api_id, option_type,remark,data_type, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.formmainId},#{entity.targetApp},#{entity.targetApi},#{entity.sourceData},#{entity.optionType},#{entity.remark},#{entity.dataType},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y')
(#{entity.formmainId},#{entity.targetApp},#{entity.targetApi},#{entity.sourceData},#{entity.distributeId},#{entity.appId},#{entity.apiId},#{entity.optionType},#{entity.remark},#{entity.dataType},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y')
</foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" >
insert into ${tableName}(formmain_id, target_app, target_api, source_data, option_type,remark,data_type, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id)
insert into ${tableName}(formmain_id, target_app, target_api, source_data,distribute_id,app_id,api_id, option_type,remark,data_type, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.formmainId},#{entity.targetApp},#{entity.targetApi},#{entity.sourceData},#{entity.optionType},#{entity.remark},#{entity.dataType},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId})
(#{entity.formmainId},#{entity.targetApp},#{entity.targetApi},#{entity.sourceData},#{entity.distributeId},#{entity.appId},#{entity.apiId},#{entity.optionType},#{entity.remark},#{entity.dataType},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId})
</foreach>
on duplicate key update
formmain_id = values(formmain_id),
target_app = values(target_app),
target_api = values(target_api),
source_data = values(source_data),
distribute_id = values(distribute_id),
app_id = values(app_id),
api_id = values(api_id),
option_type = values(option_type),
remark = values(remark),
data_type = values(data_type),
@ -237,6 +264,9 @@ update ${tableName} set
<if test="targetApp != null and targetApp != ''"> target_app = #{targetApp},</if>
<if test="targetApi != null and targetApi != ''"> target_api = #{targetApi},</if>
<if test="sourceData != null and sourceData != ''"> source_data = #{sourceData},</if>
<if test="distributeId != null and distributeId != ''"> distribute_id = #{distributeId},</if>
<if test="appId != null and appId != ''"> app_id = #{appId},</if>
<if test="apiId != null and apiId != ''"> api_id = #{apiId},</if>
<if test="optionType != null and optionType != ''"> option_type = #{optionType},</if>
<if test="remark != null and remark != ''"> remark = #{remark},</if>
<if test="dataType != null and dataType != ''"> data_type = #{dataType},</if>
@ -264,6 +294,9 @@ update ${tableName} set sts= 'N' ,modify_time = #{modify_time},modify_user_id =
<if test="targetApp != null and targetApp != ''"> and target_app = #{targetApp} </if>
<if test="targetApi != null and targetApi != ''"> and target_api = #{targetApi} </if>
<if test="sourceData != null and sourceData != ''"> and source_data = #{sourceData} </if>
<if test="distributeId != null and distributeId != ''"> and distribute_id = #{distributeId} </if>
<if test="appId != null and appId != ''"> and app_id = #{appId} </if>
<if test="apiId != null and apiId != ''"> and api_id = #{apiId} </if>
<if test="optionType != null and optionType != ''"> and option_type = #{optionType} </if>
<if test="remark != null and remark != ''"> and remark = #{remark} </if>
<if test="dataType != null and dataType != ''"> and data_type = #{dataType} </if>

View File

@ -1847,7 +1847,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(), apiEntity.getApiName(), 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("发送错误,认证接口不存在");
}
@ -1861,22 +1861,34 @@ 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(), apiEntity.getApiName(), 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());
//JSONObject attritube = attritube1.getJSONObject("attribute");
//logger.info("认证接口返回信息:"+ attritube.toJSONString());
querys = getQuery(apiEntity, querys, attritube);
//logger.info("认证接口拼接querys信息"+ querys);
headers = getHeaders(apiEntity, headers, attritube);
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);
}
bodys = getBodys(apiEntity, bodys, attritube);
//logger.info("认证接口拼接bodys信息"+ bodys);
}
//组装数据发送
JsonResultEntity jsonResultEntity = sendData(apiEntity, headers, bodys, querys);
if (jsonResultEntity.isFlag()) {
saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(),mdmModuleDistributeEntity.getId(),"1", "发送成功", dbname, object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), 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(), apiEntity.getApiName(), 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());
}
}
@ -2223,6 +2235,17 @@ public class MdmServiceImpl implements IMdmService {
entity.setContentType("application/json");
post.setEntity(entity);
}
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("接口拼接bodys信息"+ bodys);
response = closeableHttpClient.execute(post);
HttpEntity entity = response.getEntity();
@ -2266,10 +2289,13 @@ 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 target_api, 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.setId(UUIDUtils.getUUID());
mdmModuleSendLogEntity.setDistributeId(distributeId);
mdmModuleSendLogEntity.setAppId(appID);
mdmModuleSendLogEntity.setApiId(apiId);
mdmModuleSendLogEntity.setSts("Y");
mdmModuleSendLogEntity.setCreate_user_id("1");
mdmModuleSendLogEntity.setModify_user_id("1");