Commit 1ef7d947 authored by zhangc's avatar zhangc

commit

parent 2b99b384
......@@ -8,7 +8,6 @@ import com.jz.dm.common.constant.Constants;
import com.jz.dm.common.enums.GatewayResultCode;
import com.jz.dm.common.enums.apiInterface.ApiStatusEnum;
import com.jz.dm.common.enums.auth.AuthReqTypeEnum;
import com.jz.dm.common.enums.org.OrgStatusEnum;
import com.jz.dm.common.exception.GatewayException;
import com.jz.dm.common.util.DateUtil;
import com.jz.dm.common.util.LogUtil;
......@@ -105,7 +104,7 @@ public class AuthFilter extends AbstractFilter {
throw new GatewayException(GatewayResultCode.ORG_NOT_EXIST);
}
//状态检查(只限制按次请求$$ 不限制按时间请求)
if (!OrgStatusEnum.NORMAL.name().equals(apiOrg.getStatus())) {
if (!apiOrg.getStatus()) {
throw new GatewayException(GatewayResultCode.ORG_STATE_EXCEPTION);
}
checkBill(request, authCode, authAuth, apiOrg);
......
......@@ -89,7 +89,6 @@ public class OrganizationManageImpl implements OrganizationManageService {
*/
@Override
public Result add(OrganizationManageAddReq req) {
String coding = "";
ApiOrg apiOrg = new ApiOrg();
BeanUtils.copyProperties(req, apiOrg);
if (null != req.getId()){//更新
......@@ -102,6 +101,20 @@ public class OrganizationManageImpl implements OrganizationManageService {
return Result.of_success(ResultMsg.UPDATE_SUCCESS);
}
}else {//添加
Result result = addOrg(req, apiOrg);
if (result != null) return result;
}
return Result.of_error(ResultMsg.FAILURE);
}
/**
* 添加组织
* @param req
* @param apiOrg
* @return
*/
private Result addOrg(OrganizationManageAddReq req, ApiOrg apiOrg) {
String coding = "";
if (StringUtils.isNotBlank(req.getOrgName())) {
ApiOrg orgNameInfo = getOrgNameInfo(req.getOrgName());
if (null != orgNameInfo) {
......@@ -126,8 +139,7 @@ public class OrganizationManageImpl implements OrganizationManageService {
if (apiOrgMapper.insert(apiOrg) > 0) {
return Result.of_success(ResultMsg.INSERT_SUCCESS);
}
}
return Result.of_error(ResultMsg.FAILURE);
return null;
}
/**
......
......@@ -4,6 +4,7 @@ package com.jz.dm.web.aspect;
import com.jz.common.utils.IpUtils;
import com.jz.common.utils.JsonUtils;
import com.jz.common.utils.UrlUtil;
import com.jz.dm.common.exception.GatewayException;
import com.jz.dm.mapper.ApiReqLogMapper;
import com.jz.dm.models.domian.ApiReqLog;
import com.jz.dm.service.ApiLogService;
......@@ -93,8 +94,9 @@ public class SystemLogAspect {
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(params);
String paramsList = jsonObject.getString("openApiParams");
com.alibaba.fastjson.JSONObject jsonParamsList = com.alibaba.fastjson.JSONObject.parseObject(paramsList);
try {
ApiReqLog reqLog = new ApiReqLog();
JSONObject jsonResult =null;
try {
reqLog.setRequestIp(ip);
reqLog.setApiKey(jsonObject.getString("apiKey"));
reqLog.setRequestParams(params);
......@@ -112,10 +114,13 @@ public class SystemLogAspect {
apiReqLogMapper.insert(reqLog);
}
Object result = joinPoint.proceed(joinPoint.getArgs());
JSONObject jsonResult = JSONObject.fromObject(result);
jsonResult = JSONObject.fromObject(result);
log.info("around响应结果为{}", jsonResult);
apiLogService.updateLog(reqLog.getId(), jsonResult);
} catch (Throwable throwable) {
} catch (GatewayException ex) {
log.info("切面处理保存异常信息:{}",ex.getMessage());
apiLogService.updateLog(reqLog.getId(), jsonResult);
}catch (Throwable throwable){
throwable.printStackTrace();
}
}
......
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