新增callback方法
This commit is contained in:
parent
3849532576
commit
3ed14f2310
|
@ -1691,6 +1691,8 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
|||
sysExtensionApiEntity.setHeaders(oldheaderMap);
|
||||
sysExtensionApiEntity.setQuerys(oldquerys);
|
||||
sysExtensionApiEntity.setBodys(oldbodys);
|
||||
Method[] methods = null;
|
||||
Object object = null;
|
||||
|
||||
//TODO 判断是否有内部api 是否扩展api 1、启用 2、停用
|
||||
if (receiveApi.getExtensionApi() != null && "1".equals(receiveApi.getExtensionApi())
|
||||
|
@ -1698,14 +1700,13 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
|||
&& receiveApi.getFunName() != null && !"".equals(receiveApi.getFunName())
|
||||
) {
|
||||
//获取类
|
||||
Object object = null;
|
||||
try {
|
||||
object = ApplicationContextUtil.getBeanByName(receiveApi.getBeanName());
|
||||
} catch (SecurityException e) {
|
||||
|
||||
}
|
||||
//获取类下面的方法
|
||||
Method[] methods = object.getClass().getMethods();
|
||||
methods = object.getClass().getMethods();
|
||||
if (methods == null || methods.length == 0) {
|
||||
return BaseResult.getFailureMessageEntity("未找到内部方法,请联系管理员");
|
||||
}
|
||||
|
@ -1752,8 +1753,8 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
|||
JSONArray jsonArray = JSONArray.parseArray(receiveApi.getHeaderIn());
|
||||
if(jsonArray != null && jsonArray.size() > 0){
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject object = jsonArray.getJSONObject(i);
|
||||
headers.put(object.getString("parameterName"), object.getString("example"));
|
||||
JSONObject object1 = jsonArray.getJSONObject(i);
|
||||
headers.put(object1.getString("parameterName"), object1.getString("example"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1817,7 +1818,23 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
|||
|
||||
}
|
||||
logger.info("保存日志开始");
|
||||
saveLog(sendApp, receiveApp, receiveApi, oldbodys,bodys, oldheaderMap,headerMap, headers, oldquerys,querys, body.toString(),true);
|
||||
SysMessageManageLogEntity sysMessageManageLogEntity = saveLog(sendApp, receiveApp, receiveApi, oldbodys,bodys, oldheaderMap,headerMap, headers, oldquerys,querys, body.toString(),true);
|
||||
if (methods != null && methods.length > 0) {
|
||||
for (Method m : methods) {
|
||||
if (null != m) {
|
||||
if (m.getName().equals(receiveApi.getFunName().trim()+"CallBack")) {
|
||||
try {
|
||||
logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||
m.invoke(object, sysMessageManageLogEntity);
|
||||
logger.info("invoke结束>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||
} catch (Exception e) {
|
||||
logger.error("invokeException{}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logger.info("保存日志结束");
|
||||
if (flag) {
|
||||
if (JSONUtil.isTypeJSON(body.toString())) {
|
||||
|
@ -1875,7 +1892,22 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
|||
}
|
||||
}
|
||||
logger.info("保存日志开始");
|
||||
saveLog(sendApp, receiveApp, receiveApi, oldbodys,bodys, oldheaderMap,headerMap, headers, oldquerys,querys, body.toString(), true);
|
||||
SysMessageManageLogEntity sysMessageManageLogEntity = saveLog(sendApp, receiveApp, receiveApi, oldbodys,bodys, oldheaderMap,headerMap, headers, oldquerys,querys, body.toString(), true);
|
||||
if (methods != null && methods.length > 0) {
|
||||
for (Method m : methods) {
|
||||
if (null != m) {
|
||||
if (m.getName().equals(receiveApi.getFunName().trim()+"CallBack")) {
|
||||
try {
|
||||
logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||
m.invoke(object, sysMessageManageLogEntity);
|
||||
logger.info("invoke结束>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||
} catch (Exception e) {
|
||||
logger.error("invokeException{}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.info("保存日志结束");
|
||||
if (flag) {
|
||||
return BaseResult.getSuccessMessageEntity("转发成功", body);
|
||||
|
@ -1944,7 +1976,7 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
|||
* @Description 保存日志
|
||||
* @Date 11:36 上午 2023/10/20
|
||||
**/
|
||||
private void saveLog(SysApplicationEntity sendApp, SysApplicationEntity receiveApp, SysApplicationApiEntity receiveApi,
|
||||
private SysMessageManageLogEntity saveLog(SysApplicationEntity sendApp, SysApplicationEntity receiveApp, SysApplicationApiEntity receiveApi,
|
||||
String oldbodys,String bodys,
|
||||
Map<String, String> oldheaderMap,Map<String, String> headerMap,
|
||||
Map<String, String> headers,
|
||||
|
@ -2049,6 +2081,7 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
|||
sysMessageManageLogEntity.setModify_time(new Date());
|
||||
sysMessageManageLogEntity.setSts("Y");
|
||||
taskExecutor.execute(() -> doEsbTask(sysMessageManageLogEntity));
|
||||
return sysMessageManageLogEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue