Commit 77e8de6b authored by zhangc's avatar zhangc

修改部分代码

parent 30c66f80
...@@ -223,7 +223,7 @@ public class OrganizationManageImpl implements OrganizationManageService { ...@@ -223,7 +223,7 @@ public class OrganizationManageImpl implements OrganizationManageService {
public ApiOrg getAuthOrganization(Long apiOrgId) { public ApiOrg getAuthOrganization(Long apiOrgId) {
QueryWrapper<ApiOrg> query = new QueryWrapper<>(); QueryWrapper<ApiOrg> query = new QueryWrapper<>();
query.eq("id", apiOrgId); query.eq("id", apiOrgId);
query.eq("status", OrgStatusEnum.NORMAL.name()); query.eq("status",1);
query.eq("is_deleted", 0); query.eq("is_deleted", 0);
return apiOrgMapper.selectOne(query); return apiOrgMapper.selectOne(query);
} }
......
...@@ -69,7 +69,6 @@ public class SystemLogAspect { ...@@ -69,7 +69,6 @@ public class SystemLogAspect {
} }
@Around("aroundAspect()") @Around("aroundAspect()")
public void doAround(ProceedingJoinPoint joinPoint) { public void doAround(ProceedingJoinPoint joinPoint) {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
...@@ -81,8 +80,9 @@ public class SystemLogAspect { ...@@ -81,8 +80,9 @@ public class SystemLogAspect {
params += JsonUtils.objectToJson(joinPoint.getArgs()[i]) + ";"; params += JsonUtils.objectToJson(joinPoint.getArgs()[i]) + ";";
} }
} }
if (StringUtils.isNotBlank(params)){ if (StringUtils.isNotBlank(params)) {
params= params.substring(0,params.length()-1).split(";")[0];; params = params.substring(0, params.length() - 1).split(";")[0];
;
} }
//获取请求路径 //获取请求路径
String url = UrlUtil.getServerUrl(request); String url = UrlUtil.getServerUrl(request);
...@@ -95,33 +95,37 @@ public class SystemLogAspect { ...@@ -95,33 +95,37 @@ public class SystemLogAspect {
String paramsList = jsonObject.getString("openApiParams"); String paramsList = jsonObject.getString("openApiParams");
com.alibaba.fastjson.JSONObject jsonParamsList = com.alibaba.fastjson.JSONObject.parseObject(paramsList); com.alibaba.fastjson.JSONObject jsonParamsList = com.alibaba.fastjson.JSONObject.parseObject(paramsList);
ApiReqLog reqLog = new ApiReqLog(); ApiReqLog reqLog = new ApiReqLog();
JSONObject jsonResult =null; JSONObject jsonResult = null;
try { Boolean isTest = jsonParamsList.getBoolean("isTest");
reqLog.setRequestIp(ip); //不保存测试数据
reqLog.setApiKey(jsonObject.getString("apiKey")); if (!isTest) {
reqLog.setRequestParams(params); try {
reqLog.setResponseParams("");//响应参数 reqLog.setRequestIp(ip);
reqLog.setRequestUrl(url); reqLog.setApiKey(jsonObject.getString("apiKey"));
reqLog.setRequestMethod(contextPath); reqLog.setRequestParams(params);
reqLog.setEncryMode(jsonObject.getString("signType")); //加密方式:MD5,RSA reqLog.setResponseParams("");//响应参数
reqLog.setEncryMode("MD5"); //加密方式暂时写死MD5 reqLog.setRequestUrl(url);
reqLog.setTransMode(request.getMethod());//传输方式 GET POST reqLog.setRequestMethod(contextPath);
reqLog.setRequestToken(jsonParamsList.getString("authCode")); reqLog.setEncryMode(jsonObject.getString("signType")); //加密方式:MD5,RSA
reqLog.setRequestStartTime(new Date()); //reqLog.setEncryMode("MD5"); //加密方式暂时写死MD5
reqLog.setRemark(getServiceMethodDescription(joinPoint)); reqLog.setTransMode(request.getMethod());//传输方式 GET POST
log.info("请求参数:",reqLog); reqLog.setRequestToken(jsonParamsList.getString("authCode"));
if (null != reqLog) { reqLog.setRequestStartTime(new Date());
apiReqLogMapper.insert(reqLog); reqLog.setRemark(getServiceMethodDescription(joinPoint));
log.info("请求参数:", reqLog);
if (null != reqLog) {
apiReqLogMapper.insert(reqLog);
}
Object result = joinPoint.proceed(joinPoint.getArgs());
jsonResult = JSONObject.fromObject(result);
log.info("around响应结果为{}", jsonResult);
apiLogService.updateLog(reqLog.getId(), jsonResult);
} catch (GatewayException ex) {
log.info("切面处理保存异常信息:{}", ex.getMessage());
apiLogService.updateLog(reqLog.getId(), jsonResult);
} catch (Throwable throwable) {
throwable.printStackTrace();
} }
Object result = joinPoint.proceed(joinPoint.getArgs());
jsonResult = JSONObject.fromObject(result);
log.info("around响应结果为{}", jsonResult);
apiLogService.updateLog(reqLog.getId(), jsonResult);
} catch (GatewayException ex) {
log.info("切面处理保存异常信息:{}",ex.getMessage());
apiLogService.updateLog(reqLog.getId(), jsonResult);
}catch (Throwable throwable){
throwable.printStackTrace();
} }
} }
/*@Before("beforeAspect()") /*@Before("beforeAspect()")
...@@ -204,7 +208,7 @@ public class SystemLogAspect { ...@@ -204,7 +208,7 @@ public class SystemLogAspect {
// log.error("异常信息{}", e.getMessage()); // log.error("异常信息{}", e.getMessage());
// } // }
// } // }
/** /**
* 获取注解中对方法的描述信息 用于service层注解 * 获取注解中对方法的描述信息 用于service层注解
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment