diff --git a/.gitignore b/.gitignore index 0e9ec776..1b1d7c41 100644 --- a/.gitignore +++ b/.gitignore @@ -52,7 +52,7 @@ $RECYCLE.BIN/ # Windows shortcuts *.lnk - +./idea/ /buildpackage/src/main/resources/banner.txt /webapp/target/ /service/target/ diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java index d6a1240b..68f31657 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java @@ -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()); diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java index 7e82e37b..9a3aca15 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java @@ -63,6 +63,6 @@ public interface IMdmModuleDao extends IBaseDao { * @param * @return java.util.List **/ - //List queryMdMFields(Map maps); + List queryMdMFields(Map maps); } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java index c65d5056..234d5dad 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java @@ -171,11 +171,11 @@ public class MdmModuleDaoImpl extends MybatisGenericDao super.update(getSqlIdPrifx() + "updateMdmSTs", maps); } - //@Override - //public List queryMdMFields(Map maps) { - // List o = (List) super.selectList(getSqlIdPrifx() + "queryMdMFields", maps); - // return o; - //} + @Override + public List queryMdMFields(Map maps) { + List o = (List) super.selectList(getSqlIdPrifx() + "queryMdMFields", maps); + return o; + } @Override public List queryMdmSTDetail(Map maps) { diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml index b8866446..046fefdd 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml @@ -467,7 +467,7 @@ where id = #{id} - ALTER TABLE ${dbName} @@ -532,6 +532,65 @@ where id = #{id} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java index 74df1dc2..ccb28b2a 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java @@ -863,6 +863,23 @@ public class MdmModuleServiceImpl extends BaseService 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(); diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.java index 02783ec9..9a04e5ac 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.java @@ -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 */ diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.java index 1a09ceed..a6859873 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.java @@ -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; + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.xml index 718563ca..6f18954c 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.xml @@ -8,6 +8,9 @@ + + + @@ -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 @@ and target_app = #{targetApp} and target_api = #{targetApi} and source_data = #{sourceData} + and distribute_id = #{distributeId} + and app_id = #{appId} + and api_id = #{apiId} and option_type = #{optionType} and remark = #{remark} and data_type = #{dataType} @@ -82,6 +91,9 @@ and target_app = #{targetApp} and target_api = #{targetApi} and source_data = #{sourceData} + and distribute_id = #{distributeId} + and app_id = #{appId} + and api_id = #{apiId} and option_type = #{optionType} and remark = #{remark} and data_type = #{dataType} @@ -110,6 +122,9 @@ and target_app like concat('%',#{targetApp},'%') and target_api like concat('%',#{targetApi},'%') and source_data like concat('%',#{sourceData},'%') + and distribute_id like concat('%',#{distributeId},'%') + and app_id like concat('%',#{appId},'%') + and api_id like concat('%',#{apiId},'%') and option_type like concat('%',#{optionType},'%') and remark like concat('%',#{remark},'%') and data_type like concat('%',#{dataType},'%') @@ -138,6 +153,9 @@ or target_app = #{targetApp} or target_api = #{targetApi} or source_data = #{sourceData} + or distribute_id = #{distributeId} + or app_id = #{appId} + or api_id = #{apiId} or option_type = #{optionType} or remark = #{remark} or data_type = #{dataType} @@ -164,6 +182,9 @@ target_app , target_api , source_data , + distribute_id , + app_id , + api_id , option_type , remark , data_type , @@ -184,6 +205,9 @@ #{targetApp} , #{targetApi} , #{sourceData} , + #{distributeId} , + #{appId} , + #{apiId} , #{optionType} , #{remark} , #{dataType} , @@ -201,24 +225,27 @@ - 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 - (#{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') - 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 - (#{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}) 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 target_app = #{targetApp}, target_api = #{targetApi}, source_data = #{sourceData}, + distribute_id = #{distributeId}, + app_id = #{appId}, + api_id = #{apiId}, option_type = #{optionType}, remark = #{remark}, data_type = #{dataType}, @@ -264,6 +294,9 @@ update ${tableName} set sts= 'N' ,modify_time = #{modify_time},modify_user_id = and target_app = #{targetApp} and target_api = #{targetApi} and source_data = #{sourceData} + and distribute_id = #{distributeId} + and app_id = #{appId} + and api_id = #{apiId} and option_type = #{optionType} and remark = #{remark} and data_type = #{dataType} diff --git a/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceImpl.java index 7542769e..98483ea8 100644 --- a/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceImpl.java @@ -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");