还原转发接口
This commit is contained in:
parent
d1687abd91
commit
f17ade4145
|
@ -1,58 +0,0 @@
|
||||||
package com.hzya.frame.sysnew.application.entity;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 应用表(SysApplication)实体类
|
|
||||||
*
|
|
||||||
* @author makejava
|
|
||||||
* @since 2023-09-22 16:22:18
|
|
||||||
*/
|
|
||||||
public class U8CReturnEntity {
|
|
||||||
|
|
||||||
private String status;
|
|
||||||
private String data;
|
|
||||||
private String taskNumber;
|
|
||||||
private String errorcode;
|
|
||||||
private String errormsg;
|
|
||||||
|
|
||||||
public String getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(String status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getData() {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setData(String data) {
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTaskNumber() {
|
|
||||||
return taskNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTaskNumber(String taskNumber) {
|
|
||||||
this.taskNumber = taskNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getErrorcode() {
|
|
||||||
return errorcode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorcode(String errorcode) {
|
|
||||||
this.errorcode = errorcode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getErrormsg() {
|
|
||||||
return errormsg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrormsg(String errormsg) {
|
|
||||||
this.errormsg = errormsg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1689,18 +1689,10 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
@DSTransactional()
|
@DSTransactional()
|
||||||
public JsonResultEntity externalCallInterface(ServletRequest servletRequest, ServletResponse servletResponse) {
|
public JsonResultEntity externalCallInterface(ServletRequest servletRequest, ServletResponse servletResponse) {
|
||||||
|
|
||||||
long startTime1 = System.currentTimeMillis();
|
|
||||||
|
|
||||||
//例如:A应用发送数据到中台,中台转发到B应用
|
//例如:A应用发送数据到中台,中台转发到B应用
|
||||||
HttpServletRequest request = (HttpServletRequest) servletRequest;
|
HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||||
|
|
||||||
logger.info("发送数据1"+(System.currentTimeMillis()-startTime1));
|
|
||||||
String oldbodys = ServletUtil.getBody(servletRequest);
|
String oldbodys = ServletUtil.getBody(servletRequest);
|
||||||
logger.info("发送数据2"+(System.currentTimeMillis()-startTime1));
|
|
||||||
|
|
||||||
Map<String, String> oldheaderMap = ServletUtil.getHeaderMap(request);
|
Map<String, String> oldheaderMap = ServletUtil.getHeaderMap(request);
|
||||||
logger.info("发送数据3"+(System.currentTimeMillis()-startTime1));
|
|
||||||
|
|
||||||
String oldquerys = request.getQueryString();
|
String oldquerys = request.getQueryString();
|
||||||
//应用key
|
//应用key
|
||||||
String publicKey = request.getHeader("publicKey");
|
String publicKey = request.getHeader("publicKey");
|
||||||
|
@ -1710,11 +1702,8 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
String appId = request.getHeader("appId");
|
String appId = request.getHeader("appId");
|
||||||
//apiCode
|
//apiCode
|
||||||
String apiCode = request.getHeader("apiCode");
|
String apiCode = request.getHeader("apiCode");
|
||||||
logger.info("发送数据4"+(System.currentTimeMillis()-startTime1));
|
|
||||||
|
|
||||||
String ip = IPHelper.getIpAddr(request);
|
String ip = IPHelper.getIpAddr(request);
|
||||||
logger.info("发送数据5"+(System.currentTimeMillis()-startTime1));
|
|
||||||
|
|
||||||
if (publicKey == null || "".equals(publicKey)) {
|
if (publicKey == null || "".equals(publicKey)) {
|
||||||
return BaseResult.getFailureMessageEntity("请先传递公钥");
|
return BaseResult.getFailureMessageEntity("请先传递公钥");
|
||||||
}
|
}
|
||||||
|
@ -1730,20 +1719,17 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
|
|
||||||
logger.info("请求参数:publicKey:【" + publicKey + "】secretKey:【" + secretKey + "】appId:【" + appId + "】apiCode:【" + apiCode);
|
logger.info("请求参数:publicKey:【" + publicKey + "】secretKey:【" + secretKey + "】appId:【" + appId + "】apiCode:【" + apiCode);
|
||||||
//根据请求a应用的公钥、密钥是否能查找到一条数据
|
//根据请求a应用的公钥、密钥是否能查找到一条数据
|
||||||
logger.info("发送数据6"+(System.currentTimeMillis()-startTime1));
|
|
||||||
|
|
||||||
SysApplicationEntity sendApp = getAppByPublicKeySecretKey(publicKey, secretKey);
|
SysApplicationEntity sendApp = getAppByPublicKeySecretKey(publicKey, secretKey);
|
||||||
if (sendApp == null) {
|
if (sendApp == null) {
|
||||||
//saveLog(new SysApplicationEntity(), new SysApplicationEntity(), new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,"公钥、密钥错误");
|
//saveLog(new SysApplicationEntity(), new SysApplicationEntity(), new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,"公钥、密钥错误");
|
||||||
return BaseResult.getFailureMessageEntity("公钥、密钥错误,请联系管理员");
|
return BaseResult.getFailureMessageEntity("公钥、密钥错误,请联系管理员");
|
||||||
}
|
}
|
||||||
|
|
||||||
//判断应用是否启用
|
//判断应用是否启用
|
||||||
if (sendApp.getAppStatus() == null || !"1".equals(sendApp.getAppStatus())) {
|
if (sendApp.getAppStatus() == null || !"1".equals(sendApp.getAppStatus())) {
|
||||||
saveLog(sendApp, new SysApplicationEntity(), new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,sendApp.getName() + "应用未启用");
|
saveLog(sendApp, new SysApplicationEntity(), new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,sendApp.getName() + "应用未启用");
|
||||||
return BaseResult.getFailureMessageEntity(sendApp.getName() + "应用未启用,请联系管理员");
|
return BaseResult.getFailureMessageEntity(sendApp.getName() + "应用未启用,请联系管理员");
|
||||||
}
|
}
|
||||||
logger.info("发送数据7"+(System.currentTimeMillis()-startTime1));
|
|
||||||
|
|
||||||
|
|
||||||
SysApplicationEntity receiveApp = getAppByAppId(appId);
|
SysApplicationEntity receiveApp = getAppByAppId(appId);
|
||||||
|
@ -1761,14 +1747,12 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
saveLog(sendApp, receiveApp, new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApp.getName() + "应用接口环境未启用" );
|
saveLog(sendApp, receiveApp, new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApp.getName() + "应用接口环境未启用" );
|
||||||
return BaseResult.getFailureMessageEntity(receiveApp.getName() + "应用接口环境未启用,请联系管理员");
|
return BaseResult.getFailureMessageEntity(receiveApp.getName() + "应用接口环境未启用,请联系管理员");
|
||||||
}
|
}
|
||||||
logger.info("发送数据8"+(System.currentTimeMillis()-startTime1));
|
|
||||||
|
|
||||||
SysApplicationApiEntity receiveApi = getApiByAppIdApiCode(receiveApp.getId(), apiCode);
|
SysApplicationApiEntity receiveApi = getApiByAppIdApiCode(receiveApp.getId(), apiCode);
|
||||||
if (receiveApi == null) {
|
if (receiveApi == null) {
|
||||||
saveLog(sendApp, receiveApp, new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApp.getName() + ":" + apiCode + "未启用或者未创建" );
|
saveLog(sendApp, receiveApp, new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApp.getName() + ":" + apiCode + "未启用或者未创建" );
|
||||||
return BaseResult.getFailureMessageEntity(receiveApp.getName() + ":" + apiCode + "未启用或者未创建");
|
return BaseResult.getFailureMessageEntity(receiveApp.getName() + ":" + apiCode + "未启用或者未创建");
|
||||||
}
|
}
|
||||||
logger.info("发送数据9"+(System.currentTimeMillis()-startTime1));
|
|
||||||
|
|
||||||
SysApplicationApiAuthEntity sysApplicationApiAuthEntity = getApiAuthByNameAppId(sendApp.getId(), receiveApp.getId());
|
SysApplicationApiAuthEntity sysApplicationApiAuthEntity = getApiAuthByNameAppId(sendApp.getId(), receiveApp.getId());
|
||||||
if (sysApplicationApiAuthEntity == null) {
|
if (sysApplicationApiAuthEntity == null) {
|
||||||
|
@ -1780,7 +1764,6 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
saveLog(sendApp, receiveApp, receiveApi, oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApp.getName() + "发送应用" + receiveApp.getName() + "的ip白名单配置错误" );
|
saveLog(sendApp, receiveApp, receiveApi, oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApp.getName() + "发送应用" + receiveApp.getName() + "的ip白名单配置错误" );
|
||||||
return BaseResult.getFailureMessageEntity(receiveApp.getName() + "发送应用" + receiveApp.getName() + "的ip白名单配置错误");
|
return BaseResult.getFailureMessageEntity(receiveApp.getName() + "发送应用" + receiveApp.getName() + "的ip白名单配置错误");
|
||||||
}
|
}
|
||||||
logger.info("发送数据10"+(System.currentTimeMillis()-startTime1));
|
|
||||||
|
|
||||||
SysApplicationApiAuthDetailEntity sysApplicationApiAuthDetailEntity = getApiAuthDetailByAppIdApiIdTripartiteSystemId(receiveApp.getId(), receiveApi.getId(), sysApplicationApiAuthEntity.getId());
|
SysApplicationApiAuthDetailEntity sysApplicationApiAuthDetailEntity = getApiAuthDetailByAppIdApiIdTripartiteSystemId(receiveApp.getId(), receiveApi.getId(), sysApplicationApiAuthEntity.getId());
|
||||||
if (sysApplicationApiAuthDetailEntity == null) {
|
if (sysApplicationApiAuthDetailEntity == null) {
|
||||||
|
@ -1788,7 +1771,6 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
return BaseResult.getFailureMessageEntity(receiveApi.getApiName() + "未授权给" + sendApp.getName() + ",请联系管理员");
|
return BaseResult.getFailureMessageEntity(receiveApi.getApiName() + "未授权给" + sendApp.getName() + ",请联系管理员");
|
||||||
}
|
}
|
||||||
SysExtensionApiEntity sysExtensionApiEntity = new SysExtensionApiEntity();
|
SysExtensionApiEntity sysExtensionApiEntity = new SysExtensionApiEntity();
|
||||||
logger.info("发送数据11"+(System.currentTimeMillis()-startTime1));
|
|
||||||
|
|
||||||
|
|
||||||
List<String> a = Arrays.asList(new String[]{"apicode", "appid", "secretkey", "publickey", "x-forwarded-for", "cookie", "x-forwarded-proto", "x-real-ip", "content-length", "accept-language", "host", "content-type", "connection", "cache-control", "accept-encoding", "pragma", "accept", "user-agent"});
|
List<String> a = Arrays.asList(new String[]{"apicode", "appid", "secretkey", "publickey", "x-forwarded-for", "cookie", "x-forwarded-proto", "x-real-ip", "content-length", "accept-language", "host", "content-type", "connection", "cache-control", "accept-encoding", "pragma", "accept", "user-agent"});
|
||||||
|
@ -1810,7 +1792,6 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("发送数据12"+(System.currentTimeMillis()-startTime1));
|
|
||||||
|
|
||||||
|
|
||||||
sysExtensionApiEntity.setSendApp(sendApp);
|
sysExtensionApiEntity.setSendApp(sendApp);
|
||||||
|
@ -1858,8 +1839,6 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
logger.info("发送数据13"+(System.currentTimeMillis()-startTime1));
|
|
||||||
|
|
||||||
headers = sysExtensionApiEntity.getHeaders();
|
headers = sysExtensionApiEntity.getHeaders();
|
||||||
String querys = sysExtensionApiEntity.getQuerys();
|
String querys = sysExtensionApiEntity.getQuerys();
|
||||||
String bodys = sysExtensionApiEntity.getBodys();
|
String bodys = sysExtensionApiEntity.getBodys();
|
||||||
|
@ -1882,8 +1861,6 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
if ("2".equals(receiveApi.getRequestMethod())) {
|
if ("2".equals(receiveApi.getRequestMethod())) {
|
||||||
method = "GET";
|
method = "GET";
|
||||||
}
|
}
|
||||||
logger.info("发送数据14"+(System.currentTimeMillis()-startTime1));
|
|
||||||
|
|
||||||
//List<String> a = Arrays.asList(new String[]{"apicode", "appid", "secretkey", "publickey", "x-forwarded-for", "cookie", "x-forwarded-proto", "x-real-ip", "content-length", "accept-language", "host", "content-type", "connection", "cache-control", "accept-encoding", "pragma", "accept", "user-agent"});
|
//List<String> a = Arrays.asList(new String[]{"apicode", "appid", "secretkey", "publickey", "x-forwarded-for", "cookie", "x-forwarded-proto", "x-real-ip", "content-length", "accept-language", "host", "content-type", "connection", "cache-control", "accept-encoding", "pragma", "accept", "user-agent"});
|
||||||
//Map<String, String> headers = new HashMap<>();
|
//Map<String, String> headers = new HashMap<>();
|
||||||
//if (receiveApi.getHeaderIn() != null && !"".equals(receiveApi.getHeaderIn())) {
|
//if (receiveApi.getHeaderIn() != null && !"".equals(receiveApi.getHeaderIn())) {
|
||||||
|
@ -1905,8 +1882,6 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
|
|
||||||
|
|
||||||
if ("POST".equals(method)) {
|
if ("POST".equals(method)) {
|
||||||
logger.info("发送数据15"+(System.currentTimeMillis()-startTime1));
|
|
||||||
|
|
||||||
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
|
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
|
||||||
// HttpClient
|
// HttpClient
|
||||||
CloseableHttpClient closeableHttpClient = httpClientBuilder.disableCookieManagement().build();
|
CloseableHttpClient closeableHttpClient = httpClientBuilder.disableCookieManagement().build();
|
||||||
|
@ -1923,8 +1898,6 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
}
|
}
|
||||||
StringBuilder body = new StringBuilder();
|
StringBuilder body = new StringBuilder();
|
||||||
boolean flag = true;
|
boolean flag = true;
|
||||||
logger.info("发送数据16"+(System.currentTimeMillis()-startTime1));
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (bodys != null && !"".equals(bodys)) {
|
if (bodys != null && !"".equals(bodys)) {
|
||||||
ByteArrayEntity entity = new ByteArrayEntity(bodys.getBytes("UTF-8"));
|
ByteArrayEntity entity = new ByteArrayEntity(bodys.getBytes("UTF-8"));
|
||||||
|
@ -1932,16 +1905,13 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
post.setEntity(entity);
|
post.setEntity(entity);
|
||||||
}
|
}
|
||||||
response = closeableHttpClient.execute(post);
|
response = closeableHttpClient.execute(post);
|
||||||
logger.info("发送数据17"+(System.currentTimeMillis()-startTime1));
|
|
||||||
|
|
||||||
|
|
||||||
HttpEntity entity = response.getEntity();
|
HttpEntity entity = response.getEntity();
|
||||||
body.append(resultToStr(entity));
|
synchronized (lock) {
|
||||||
//body.append(EntityUtils.toString(entity,"UTF-8"));
|
body.append(EntityUtils.toString(entity,"UTF-8"));
|
||||||
|
}
|
||||||
flag = true;
|
flag = true;
|
||||||
logger.info("返回结果:" + body);
|
logger.info("返回结果:" + body);
|
||||||
logger.info("发送数据18"+(System.currentTimeMillis()-startTime1));
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("请求错误:" + e.getMessage());
|
logger.error("请求错误:" + e.getMessage());
|
||||||
body.append(e.getMessage());
|
body.append(e.getMessage());
|
||||||
|
@ -1961,13 +1931,8 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
logger.info("发送数据19 "+(System.currentTimeMillis()-startTime1));
|
|
||||||
|
|
||||||
logger.info("保存日志开始");
|
logger.info("保存日志开始");
|
||||||
|
|
||||||
SysMessageManageLogEntity sysMessageManageLogEntity = saveLog(sendApp, receiveApp, receiveApi, oldbodys,bodys, oldheaderMap,headers, headers, oldquerys,querys, body.toString(),true,null);
|
SysMessageManageLogEntity sysMessageManageLogEntity = saveLog(sendApp, receiveApp, receiveApi, oldbodys,bodys, oldheaderMap,headers, headers, oldquerys,querys, body.toString(),true,null);
|
||||||
logger.info("发送数据20 "+(System.currentTimeMillis()-startTime1));
|
|
||||||
|
|
||||||
if (methods != null && methods.length > 0) {
|
if (methods != null && methods.length > 0) {
|
||||||
for (Method m : methods) {
|
for (Method m : methods) {
|
||||||
if (null != m) {
|
if (null != m) {
|
||||||
|
@ -1983,30 +1948,16 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.info("发送数据21 "+(System.currentTimeMillis()-startTime1));
|
|
||||||
|
|
||||||
logger.info("保存日志结束");
|
logger.info("保存日志结束");
|
||||||
if (flag) {
|
if (flag) {
|
||||||
try {
|
if (JSONUtil.isTypeJSON(body.toString())) {
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(body.toString());
|
||||||
if(sysMessageManageLogEntity.getStatus() != null && "3".equals(sysMessageManageLogEntity.getStatus())){
|
if(sysMessageManageLogEntity.getStatus() != null && "3".equals(sysMessageManageLogEntity.getStatus())){
|
||||||
if(sysMessageManageLogEntity.getReturnObject() != null ){
|
return BaseResult.getSuccessMessageEntity("转发成功", jsonObject);
|
||||||
return BaseResult.getSuccessMessageEntity("转发成功", sysMessageManageLogEntity.getReturnObject());
|
|
||||||
}else {
|
|
||||||
return BaseResult.getSuccessMessageEntity("转发成功", sysMessageManageLogEntity.getU8CReturnEntity());
|
|
||||||
}
|
|
||||||
}else {
|
}else {
|
||||||
if(sysMessageManageLogEntity.getReturnObject() != null ){
|
return BaseResult.getFailureMessageEntity("转发失败", jsonObject);
|
||||||
return BaseResult.getFailureMessageEntity("转发失败", sysMessageManageLogEntity.getReturnObject());
|
|
||||||
}else if(sysMessageManageLogEntity.getU8CReturnEntity() != null ){
|
|
||||||
return BaseResult.getSuccessMessageEntity("转发失败", sysMessageManageLogEntity.getU8CReturnEntity());
|
|
||||||
}else {
|
|
||||||
JSONObject jsonObject = JSONObject.parseObject(body.toString());
|
|
||||||
logger.info("发送数据错误22 "+(System.currentTimeMillis()-startTime1));
|
|
||||||
return BaseResult.getFailureMessageEntity("转发失败", jsonObject);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} else {
|
||||||
logger.info("发送数据错误22 "+(System.currentTimeMillis()-startTime1));
|
|
||||||
if(sysMessageManageLogEntity.getStatus() != null && "3".equals(sysMessageManageLogEntity.getStatus())){
|
if(sysMessageManageLogEntity.getStatus() != null && "3".equals(sysMessageManageLogEntity.getStatus())){
|
||||||
return BaseResult.getSuccessMessageEntity("转发成功", body);
|
return BaseResult.getSuccessMessageEntity("转发成功", body);
|
||||||
}else {
|
}else {
|
||||||
|
@ -2036,7 +1987,6 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
|
|
||||||
boolean flag = true;
|
boolean flag = true;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
response = closeableHttpClient.execute(get);
|
response = closeableHttpClient.execute(get);
|
||||||
HttpEntity entity = response.getEntity();
|
HttpEntity entity = response.getEntity();
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
|
@ -2081,14 +2031,14 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
}
|
}
|
||||||
logger.info("保存日志结束");
|
logger.info("保存日志结束");
|
||||||
if (flag) {
|
if (flag) {
|
||||||
try {
|
if (JSONUtil.isTypeJSON(body.toString())) {
|
||||||
JSONObject jsonObject = JSONObject.parseObject(body.toString());
|
JSONObject jsonObject = JSONObject.parseObject(body.toString());
|
||||||
if(sysMessageManageLogEntity.getStatus() != null && "3".equals(sysMessageManageLogEntity.getStatus())){
|
if(sysMessageManageLogEntity.getStatus() != null && "3".equals(sysMessageManageLogEntity.getStatus())){
|
||||||
return BaseResult.getSuccessMessageEntity("转发成功", jsonObject);
|
return BaseResult.getSuccessMessageEntity("转发成功", jsonObject);
|
||||||
}else {
|
}else {
|
||||||
return BaseResult.getFailureMessageEntity("转发失败", jsonObject);
|
return BaseResult.getFailureMessageEntity("转发失败", jsonObject);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} else {
|
||||||
if(sysMessageManageLogEntity.getStatus() != null && "3".equals(sysMessageManageLogEntity.getStatus())){
|
if(sysMessageManageLogEntity.getStatus() != null && "3".equals(sysMessageManageLogEntity.getStatus())){
|
||||||
return BaseResult.getSuccessMessageEntity("转发成功", body);
|
return BaseResult.getSuccessMessageEntity("转发成功", body);
|
||||||
}else {
|
}else {
|
||||||
|
@ -2101,8 +2051,6 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****
|
/*****
|
||||||
* 请求结果转换str
|
* 请求结果转换str
|
||||||
* @content:
|
* @content:
|
||||||
|
@ -2593,7 +2541,7 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
JSONObject jsonObject1 = JSONObject.parseObject(body);
|
JSONObject jsonObject1 = JSONObject.parseObject(body);
|
||||||
String retCode = jsonObject1.getString("retCode");
|
String retCode = jsonObject1.getString("retCode");
|
||||||
if(retCode != null && "0000".equals(retCode)){
|
if(retCode != null && "0000".equals(retCode)){
|
||||||
JSONObject jsonObject2 = JSONObject.parseObject(jsonObject1.getString("Data"));
|
JSONObject jsonObject2 = JSONObject.parseObject(jsonObject1.getString("data"));
|
||||||
String fileBytes = jsonObject2.getString("fileBytes");
|
String fileBytes = jsonObject2.getString("fileBytes");
|
||||||
if(fileBytes != null && !"".equals(fileBytes)){
|
if(fileBytes != null && !"".equals(fileBytes)){
|
||||||
jsonObject2.put("fileBytes","");
|
jsonObject2.put("fileBytes","");
|
||||||
|
@ -2618,77 +2566,55 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
if (receiveApi.getReturnSuccessField() != null && !"".equals(receiveApi.getReturnSuccessField())
|
if (receiveApi.getReturnSuccessField() != null && !"".equals(receiveApi.getReturnSuccessField())
|
||||||
&& receiveApi.getReturnSuccessValue() != null && !"".equals(receiveApi.getReturnSuccessValue())) {
|
&& receiveApi.getReturnSuccessValue() != null && !"".equals(receiveApi.getReturnSuccessValue())) {
|
||||||
if (JSONUtil.isTypeJSON(body)) {
|
if (JSONUtil.isTypeJSON(body)) {
|
||||||
if(receiveApi.getApiCode() != null && "8000350006".equals(receiveApi.getApiCode())){
|
JSONObject cheackdatas = JSONObject.parseObject(body);
|
||||||
U8CReturnEntity u8CReturnEntity = JSONObject.parseObject(body, U8CReturnEntity.class);
|
JSONObject datas = JSONObject.parseObject(body);
|
||||||
sysMessageManageLogEntity.setU8CReturnEntity(u8CReturnEntity);
|
String checkdata = cheackdatas.getString(receiveApi.getReturnSuccessField());
|
||||||
if(u8CReturnEntity.getStatus() != null && "success".equals(u8CReturnEntity.getStatus())){
|
if (checkdata != null && receiveApi.getReturnSuccessValue().equals(checkdata)) {
|
||||||
sysMessageManageLogEntity.setStatus("3");//返回信息
|
sysMessageManageLogEntity.setStatus("3");//返回信息
|
||||||
|
if (receiveApi.getReturnMsg() != null && !"".equals(receiveApi.getReturnMsg())) {
|
||||||
|
String returnMsg = cheackdatas.getString(receiveApi.getReturnMsg());
|
||||||
|
sysMessageManageLogEntity.setRemark("接口调用成功,返回信息如下:" + returnMsg);//返回信息
|
||||||
|
} else {
|
||||||
|
sysMessageManageLogEntity.setRemark("接口调用成功");//返回信息
|
||||||
|
}
|
||||||
|
}else if(receiveApi.getReturnSuccessValue().equals("not null") && checkdata != null){
|
||||||
|
sysMessageManageLogEntity.setStatus("3");//返回信息
|
||||||
|
if (receiveApi.getReturnMsg() != null && !"".equals(receiveApi.getReturnMsg())) {
|
||||||
|
String returnMsg = cheackdatas.getString(receiveApi.getReturnMsg());
|
||||||
|
sysMessageManageLogEntity.setRemark("接口调用成功,返回信息如下:" + returnMsg);//返回信息
|
||||||
|
} else {
|
||||||
sysMessageManageLogEntity.setRemark("接口调用成功");//返回信息
|
sysMessageManageLogEntity.setRemark("接口调用成功");//返回信息
|
||||||
}else {
|
|
||||||
sysMessageManageLogEntity.setStatus("4");//返回信息
|
|
||||||
sysMessageManageLogEntity.setRemark("接口调用成功,返回信息如下:" + u8CReturnEntity.getErrormsg());//返回信息
|
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
JSONObject cheackdatas = JSONObject.parseObject(body);
|
String fieldname = receiveApi.getReturnSuccessField();
|
||||||
sysMessageManageLogEntity.setReturnObject(cheackdatas);
|
if(fieldname.contains(".")){
|
||||||
JSONObject datas = JSONObject.parseObject(body);
|
String[] fileds = fieldname.split("\\.");
|
||||||
String checkdata = cheackdatas.getString(receiveApi.getReturnSuccessField());
|
boolean flags = false;
|
||||||
if (checkdata != null && receiveApi.getReturnSuccessValue().equals(checkdata)) {
|
for (int i = 0; i < fileds.length; i++) {
|
||||||
sysMessageManageLogEntity.setStatus("3");//返回信息
|
if (JSONUtil.isTypeJSON(datas.getString(fileds[i]))) {
|
||||||
if (receiveApi.getReturnMsg() != null && !"".equals(receiveApi.getReturnMsg())) {
|
datas = datas.getJSONObject(fileds[i]);
|
||||||
String returnMsg = cheackdatas.getString(receiveApi.getReturnMsg());
|
if(fileds.length-2 == i ){
|
||||||
sysMessageManageLogEntity.setRemark("接口调用成功,返回信息如下:" + returnMsg);//返回信息
|
String a = datas.getString(fileds[i+1]);
|
||||||
} else {
|
if (a != null && receiveApi.getReturnSuccessValue().equals(a)) {
|
||||||
sysMessageManageLogEntity.setRemark("接口调用成功");//返回信息
|
flags = true;
|
||||||
}
|
break;
|
||||||
}else if(receiveApi.getReturnSuccessValue().equals("not null") && checkdata != null){
|
}else if(receiveApi.getReturnSuccessValue().equals("not null") && a != null){
|
||||||
sysMessageManageLogEntity.setStatus("3");//返回信息
|
flags = true;
|
||||||
if (receiveApi.getReturnMsg() != null && !"".equals(receiveApi.getReturnMsg())) {
|
break;
|
||||||
String returnMsg = cheackdatas.getString(receiveApi.getReturnMsg());
|
}else {
|
||||||
sysMessageManageLogEntity.setRemark("接口调用成功,返回信息如下:" + returnMsg);//返回信息
|
break;
|
||||||
} else {
|
|
||||||
sysMessageManageLogEntity.setRemark("接口调用成功");//返回信息
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
String fieldname = receiveApi.getReturnSuccessField();
|
|
||||||
if(fieldname.contains(".")){
|
|
||||||
String[] fileds = fieldname.split("\\.");
|
|
||||||
boolean flags = false;
|
|
||||||
for (int i = 0; i < fileds.length; i++) {
|
|
||||||
if (JSONUtil.isTypeJSON(datas.getString(fileds[i]))) {
|
|
||||||
datas = datas.getJSONObject(fileds[i]);
|
|
||||||
if(fileds.length-2 == i ){
|
|
||||||
String a = datas.getString(fileds[i+1]);
|
|
||||||
if (a != null && receiveApi.getReturnSuccessValue().equals(a)) {
|
|
||||||
flags = true;
|
|
||||||
break;
|
|
||||||
}else if(receiveApi.getReturnSuccessValue().equals("not null") && a != null){
|
|
||||||
flags = true;
|
|
||||||
break;
|
|
||||||
}else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(flags){
|
}
|
||||||
sysMessageManageLogEntity.setStatus("3");//返回信息
|
if(flags){
|
||||||
if (receiveApi.getReturnMsg() != null && !"".equals(receiveApi.getReturnMsg())) {
|
sysMessageManageLogEntity.setStatus("3");//返回信息
|
||||||
String returnMsg = cheackdatas.getString(receiveApi.getReturnMsg());
|
if (receiveApi.getReturnMsg() != null && !"".equals(receiveApi.getReturnMsg())) {
|
||||||
sysMessageManageLogEntity.setRemark("接口调用成功,返回信息如下:" + returnMsg);//返回信息
|
String returnMsg = cheackdatas.getString(receiveApi.getReturnMsg());
|
||||||
} else {
|
sysMessageManageLogEntity.setRemark("接口调用成功,返回信息如下:" + returnMsg);//返回信息
|
||||||
sysMessageManageLogEntity.setRemark("接口调用成功");//返回信息
|
} else {
|
||||||
}
|
sysMessageManageLogEntity.setRemark("接口调用成功");//返回信息
|
||||||
}else {
|
|
||||||
sysMessageManageLogEntity.setStatus("4");//返回信息
|
|
||||||
if (receiveApi.getReturnMsg() != null && !"".equals(receiveApi.getReturnMsg())) {
|
|
||||||
String returnMsg = cheackdatas.getString(receiveApi.getReturnMsg());
|
|
||||||
sysMessageManageLogEntity.setRemark("接口调用失败,返回值错误,返回信息如下:" + returnMsg);//返回信息
|
|
||||||
} else {
|
|
||||||
sysMessageManageLogEntity.setRemark("接口调用失败,返回值错误");//返回信息
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
sysMessageManageLogEntity.setStatus("4");//返回信息
|
sysMessageManageLogEntity.setStatus("4");//返回信息
|
||||||
if (receiveApi.getReturnMsg() != null && !"".equals(receiveApi.getReturnMsg())) {
|
if (receiveApi.getReturnMsg() != null && !"".equals(receiveApi.getReturnMsg())) {
|
||||||
|
@ -2698,6 +2624,15 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
sysMessageManageLogEntity.setRemark("接口调用失败,返回值错误");//返回信息
|
sysMessageManageLogEntity.setRemark("接口调用失败,返回值错误");//返回信息
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
|
sysMessageManageLogEntity.setStatus("4");//返回信息
|
||||||
|
if (receiveApi.getReturnMsg() != null && !"".equals(receiveApi.getReturnMsg())) {
|
||||||
|
String returnMsg = cheackdatas.getString(receiveApi.getReturnMsg());
|
||||||
|
sysMessageManageLogEntity.setRemark("接口调用失败,返回值错误,返回信息如下:" + returnMsg);//返回信息
|
||||||
|
} else {
|
||||||
|
sysMessageManageLogEntity.setRemark("接口调用失败,返回值错误");//返回信息
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.hzya.frame.sysnew.messageManageLog.entity;
|
package com.hzya.frame.sysnew.messageManageLog.entity;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.hzya.frame.sysnew.application.entity.U8CReturnEntity;
|
|
||||||
import com.hzya.frame.web.entity.BaseEntity;
|
import com.hzya.frame.web.entity.BaseEntity;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -49,9 +48,6 @@ public class SysMessageManageLogEntity extends BaseEntity {
|
||||||
private Date createTimeEnd;
|
private Date createTimeEnd;
|
||||||
private List<String> ids;
|
private List<String> ids;
|
||||||
|
|
||||||
private JSONObject returnObject;
|
|
||||||
private U8CReturnEntity u8CReturnEntity;
|
|
||||||
|
|
||||||
public String getReturnType() {
|
public String getReturnType() {
|
||||||
return returnType;
|
return returnType;
|
||||||
}
|
}
|
||||||
|
@ -203,20 +199,5 @@ public class SysMessageManageLogEntity extends BaseEntity {
|
||||||
this.createTimeEnd = createTimeEnd;
|
this.createTimeEnd = createTimeEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject getReturnObject() {
|
|
||||||
return returnObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReturnObject(JSONObject returnObject) {
|
|
||||||
this.returnObject = returnObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
public U8CReturnEntity getU8CReturnEntity() {
|
|
||||||
return u8CReturnEntity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setU8CReturnEntity(U8CReturnEntity u8CReturnEntity) {
|
|
||||||
this.u8CReturnEntity = u8CReturnEntity;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue