Commit a8f97b6b authored by mcb's avatar mcb

commit

parent bdf7e405
...@@ -68,4 +68,19 @@ public class GatewayApiConstant { ...@@ -68,4 +68,19 @@ public class GatewayApiConstant {
//服务发布/服务取消url //服务发布/服务取消url
public static final String apiPublishCancel = "/api/producer/optionApiIssueStatus"; public static final String apiPublishCancel = "/api/producer/optionApiIssueStatus";
//盐值重置url
public static final String saltReset = "/api/auth/reset-salt";
//授权管理-api列表url
public static final String authApiList = "/api/auth/getServiceAuthList";
//授权
public static final String authUserApi = "/api/auth/user-auth-api";
//上传(发送给数据银行)
public static final String serverUpload = "/api/producer/serverUpload";
//日志详情
public static final String logDetails = "/api/logging/getReqDetail";
} }
...@@ -36,13 +36,13 @@ public class DmpApiMangeController { ...@@ -36,13 +36,13 @@ public class DmpApiMangeController {
@Autowired @Autowired
private DmpApiMangeService dmpApiMangeService; private DmpApiMangeService dmpApiMangeService;
/** /* *//**
* 授权给他人的API-列表分页查询 * 授权给他人的API-列表分页查询
* *
* @return * @return
* @author Bellamy * @author Bellamy
* @since 2021-01-18 * @since 2021-01-18
*/ *//*
@ApiOperation(value = "授权给他人的API-列表分页查询", notes = "列表分页查询") @ApiOperation(value = "授权给他人的API-列表分页查询", notes = "列表分页查询")
@PostMapping(value = "/apiAuthListPage") @PostMapping(value = "/apiAuthListPage")
public JsonResult getApiAuthListPage(@RequestBody @Validated AuthListInfoReq req, HttpServletRequest httpRequest) { public JsonResult getApiAuthListPage(@RequestBody @Validated AuthListInfoReq req, HttpServletRequest httpRequest) {
...@@ -55,7 +55,7 @@ public class DmpApiMangeController { ...@@ -55,7 +55,7 @@ public class DmpApiMangeController {
e.printStackTrace(); e.printStackTrace();
} }
return jsonResult; return jsonResult;
} }*/
/** /**
* 取消授权 * 取消授权
...@@ -81,12 +81,12 @@ public class DmpApiMangeController { ...@@ -81,12 +81,12 @@ public class DmpApiMangeController {
return jsonResult; return jsonResult;
} }
/** /* *//**
* 发布的API-API列表分页查询 * 发布的API-API列表分页查询
* *
* @author Bellamy * @author Bellamy
* @since 2021-01-18 * @since 2021-01-18
*/ *//*
@ApiOperation(value = "发布的API-API列表分页查询", notes = "列表分页查询") @ApiOperation(value = "发布的API-API列表分页查询", notes = "列表分页查询")
@PostMapping(value = "/listPage") @PostMapping(value = "/listPage")
public JsonResult getApiListPage(@RequestBody @Validated ApiInterfaceInfoListReq req, HttpServletRequest httpRequest) { public JsonResult getApiListPage(@RequestBody @Validated ApiInterfaceInfoListReq req, HttpServletRequest httpRequest) {
...@@ -99,7 +99,7 @@ public class DmpApiMangeController { ...@@ -99,7 +99,7 @@ public class DmpApiMangeController {
e.printStackTrace(); e.printStackTrace();
} }
return jsonResult; return jsonResult;
} }*/
/** /**
* 删除api * 删除api
...@@ -110,8 +110,8 @@ public class DmpApiMangeController { ...@@ -110,8 +110,8 @@ public class DmpApiMangeController {
@ApiOperation(value = "删除api", notes = "删除api") @ApiOperation(value = "删除api", notes = "删除api")
@GetMapping(value = "/delApiInfo") @GetMapping(value = "/delApiInfo")
@ApiImplicitParams({@ApiImplicitParam(name = "apiKey", value = "apiKey", required = true), @ApiImplicitParams({@ApiImplicitParam(name = "apiKey", value = "apiKey", required = true),
@ApiImplicitParam(name = "type", value = "类型", required = false)}) @ApiImplicitParam(name = "type", value = "类型:0删除提示,1正式删除", required = true)})
public JsonResult delApiInfo(@RequestParam String apiKey, @RequestParam(required = false) String type, HttpServletRequest httpRequest) { public JsonResult delApiInfo(@RequestParam String apiKey, @RequestParam String type, HttpServletRequest httpRequest) {
if (StringUtils.isEmpty(apiKey)) { if (StringUtils.isEmpty(apiKey)) {
return JsonResult.error(ResultCode.PARAMS_ERROR, "apiKey不能为空!"); return JsonResult.error(ResultCode.PARAMS_ERROR, "apiKey不能为空!");
} }
...@@ -150,12 +150,12 @@ public class DmpApiMangeController { ...@@ -150,12 +150,12 @@ public class DmpApiMangeController {
return jsonResult; return jsonResult;
} }
/** /* *//**
* 授权给组织-提交保存 * 授权给组织-提交保存
* *
* @author Bellamy * @author Bellamy
* @since 2021-01-19 * @since 2021-01-19
*/ *//*
@ApiOperation(value = "授权给组织-提交保存", notes = "授权给组织-提交保存") @ApiOperation(value = "授权给组织-提交保存", notes = "授权给组织-提交保存")
@PostMapping(value = "/addApiAuthToOrg") @PostMapping(value = "/addApiAuthToOrg")
public JsonResult addApiAuthToOrg(@RequestBody @Validated AuthUserApiReq req, HttpServletRequest httpRequest) { public JsonResult addApiAuthToOrg(@RequestBody @Validated AuthUserApiReq req, HttpServletRequest httpRequest) {
...@@ -168,7 +168,7 @@ public class DmpApiMangeController { ...@@ -168,7 +168,7 @@ public class DmpApiMangeController {
e.printStackTrace(); e.printStackTrace();
} }
return jsonResult; return jsonResult;
} }*/
/** /**
* API测试 * API测试
...@@ -195,12 +195,12 @@ public class DmpApiMangeController { ...@@ -195,12 +195,12 @@ public class DmpApiMangeController {
} }
/** /**
* 查看日志 * API日志列表
* *
* @author Bellamy * @author Bellamy
* @since 2021-01-19 * @since 2021-01-19
*/ */
@ApiOperation(value = "查看日志", notes = "查看日志") @ApiOperation(value = "API日志列表", notes = "API日志列表")
@PostMapping(value = "/checkApiLogInfo") @PostMapping(value = "/checkApiLogInfo")
public JsonResult checkApiLogInfo(@RequestBody LogInfoListReq req, HttpServletRequest httpRequest) { public JsonResult checkApiLogInfo(@RequestBody LogInfoListReq req, HttpServletRequest httpRequest) {
/* if (StringUtils.isEmpty(req.getApiKey())) { /* if (StringUtils.isEmpty(req.getApiKey())) {
...@@ -217,12 +217,12 @@ public class DmpApiMangeController { ...@@ -217,12 +217,12 @@ public class DmpApiMangeController {
return jsonResult; return jsonResult;
} }
/** /* *//**
* 授权模糊查询组织信息 * 授权模糊查询组织信息
* *
* @author Bellamy * @author Bellamy
* @since 2021-01-19 * @since 2021-01-19
*/ *//*
@ApiOperation(value = "授权模糊查询组织信息", notes = "授权模糊查询组织信息") @ApiOperation(value = "授权模糊查询组织信息", notes = "授权模糊查询组织信息")
@GetMapping(value = "/authOrgList") @GetMapping(value = "/authOrgList")
@ApiImplicitParam(name = "key", value = "key", required = true) @ApiImplicitParam(name = "key", value = "key", required = true)
...@@ -239,7 +239,7 @@ public class DmpApiMangeController { ...@@ -239,7 +239,7 @@ public class DmpApiMangeController {
e.printStackTrace(); e.printStackTrace();
} }
return jsonResult; return jsonResult;
} }*/
/** /**
* 服务发布/服务取消 * 服务发布/服务取消
...@@ -265,4 +265,112 @@ public class DmpApiMangeController { ...@@ -265,4 +265,112 @@ public class DmpApiMangeController {
return jsonResult; return jsonResult;
} }
/**
* 盐值重置
*
* @author Bellamy
* @since 2021-02-20
*/
@ApiOperation(value = "盐值重置", notes = "盐值重置")
@PostMapping(value = "/saltReset")
public JsonResult saltReset(@RequestBody @Validated SaltResetReq req, HttpServletRequest httpRequest) {
JsonResult jsonResult = new JsonResult();
try {
jsonResult = dmpApiMangeService.saltReset(req);
} catch (Exception e) {
jsonResult.setMessage(e.getMessage());
jsonResult.setCode(ResultCode.INTERNAL_SERVER_ERROR);
e.printStackTrace();
}
return jsonResult;
}
/**
* 授权管理-api列表
*
* @author Bellamy
* @since 2021-02-20
*/
@ApiOperation(value = "授权管理-api列表", notes = "授权管理-api列表")
@PostMapping(value = "/authApiList")
public JsonResult authApiList(@RequestBody @Validated AuthApiListReq req, HttpServletRequest httpRequest) {
JsonResult jsonResult = new JsonResult();
try {
jsonResult = dmpApiMangeService.queryAuthApiList(req);
} catch (Exception e) {
jsonResult.setMessage(e.getMessage());
jsonResult.setCode(ResultCode.INTERNAL_SERVER_ERROR);
e.printStackTrace();
}
return jsonResult;
}
/**
* 用户授权
*
* @author Bellamy
* @since 2021-02-20
*/
@ApiOperation(value = "授权", notes = "授权")
@PostMapping(value = "/authUserApi")
public JsonResult authUserApi(@RequestBody @Validated AuthUserApiReq req, HttpServletRequest httpRequest) {
JsonResult jsonResult = new JsonResult();
try {
jsonResult = dmpApiMangeService.authUserApi(req);
} catch (Exception e) {
jsonResult.setMessage(e.getMessage());
jsonResult.setCode(ResultCode.INTERNAL_SERVER_ERROR);
e.printStackTrace();
}
return jsonResult;
}
/**
* 服务开发--上传(发送给数据银行)
*
* @author Bellamy
* @since 2021-02-20
*/
@ApiOperation(value = "服务开发--上传", notes = "上传")
@GetMapping(value = "/serverUpload")
@ApiImplicitParam(name = "id", value = "id", required = true)
public JsonResult serverUpload(@RequestParam String id) {
if (StringUtils.isEmpty(id)) {
return JsonResult.error(ResultCode.PARAMS_ERROR, "id不能为空!");
}
JsonResult jsonResult = new JsonResult();
try {
jsonResult = dmpApiMangeService.serverUpload(id);
} catch (Exception e) {
jsonResult.setMessage(e.getMessage());
jsonResult.setCode(ResultCode.INTERNAL_SERVER_ERROR);
e.printStackTrace();
}
return jsonResult;
}
/**
* 日志详情
*
* @author Bellamy
* @since 2021-02-20
*/
@ApiOperation(value = "日志详情", notes = "日志详情")
@GetMapping(value = "/logDetails")
@ApiImplicitParam(name = "id", value = "id", required = true)
public JsonResult logDetails(@RequestParam String id) {
if (StringUtils.isEmpty(id)) {
return JsonResult.error(ResultCode.PARAMS_ERROR, "id不能为空!");
}
JsonResult jsonResult = new JsonResult();
try {
jsonResult = dmpApiMangeService.logDetails(id);
} catch (Exception e) {
jsonResult.setMessage(e.getMessage());
jsonResult.setCode(ResultCode.INTERNAL_SERVER_ERROR);
e.printStackTrace();
}
return jsonResult;
}
} }
\ No newline at end of file
...@@ -149,12 +149,12 @@ public class DmpApiServiceMangeController { ...@@ -149,12 +149,12 @@ public class DmpApiServiceMangeController {
return jsonResult; return jsonResult;
} }
/** /* *//**
* API计量--API调用列表 * API计量--API调用列表
* *
* @author Bellamy * @author Bellamy
* @since 2021-01-19 * @since 2021-01-19
*/ *//*
@ApiOperation(value = "API计量--API调用列表", notes = "API计量--API调用列表") @ApiOperation(value = "API计量--API调用列表", notes = "API计量--API调用列表")
@PostMapping(value = "/apiCountListPage") @PostMapping(value = "/apiCountListPage")
public JsonResult apiCountListPage(@RequestBody @Validated ApiInterfaceInfoListReq req, HttpServletRequest httpRequest) { public JsonResult apiCountListPage(@RequestBody @Validated ApiInterfaceInfoListReq req, HttpServletRequest httpRequest) {
...@@ -167,7 +167,7 @@ public class DmpApiServiceMangeController { ...@@ -167,7 +167,7 @@ public class DmpApiServiceMangeController {
e.printStackTrace(); e.printStackTrace();
} }
return jsonResult; return jsonResult;
} }*/
/** /**
* API计量--API未调用列表 * API计量--API未调用列表
......
...@@ -93,9 +93,9 @@ public class DmpOrgMangeController { ...@@ -93,9 +93,9 @@ public class DmpOrgMangeController {
if (StringUtils.isEmpty(req.getOrgName())) { if (StringUtils.isEmpty(req.getOrgName())) {
return JsonResult.error(ResultCode.PARAMS_ERROR, "组织名称不能为空!"); return JsonResult.error(ResultCode.PARAMS_ERROR, "组织名称不能为空!");
} }
if (StringUtils.isEmpty(req.getOrgType())) { /* if (StringUtils.isEmpty(req.getOrgType())) {
return JsonResult.error(ResultCode.PARAMS_ERROR, "组织类型不能为空!"); return JsonResult.error(ResultCode.PARAMS_ERROR, "组织类型不能为空!");
} }*/
JsonResult jsonResult = new JsonResult(); JsonResult jsonResult = new JsonResult();
try { try {
jsonResult = dmpOrgMangeService.addOrg(req); jsonResult = dmpOrgMangeService.addOrg(req);
......
package com.jz.dmp.modules.controller.dataService.bean;
import com.jz.common.bean.BasePageBean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @ClassName: AuthApiListReq
* @Description: 授权api列表请求对象
* @Author: Bellamy
* @Date 2021/2/20
* @Version 1.0
*/
@Data
@ApiModel("授权api列表请求对象")
public class AuthApiListReq extends BasePageBean implements Serializable {
@ApiModelProperty(value = "文件夹id", required = false)
private Long fileId;
@ApiModelProperty(value = "组织编码", required = false)
private String orgCode;
@ApiModelProperty(value = "组织名称", required = false)
private String orgName;
@ApiModelProperty(value = "api名称", required = false)
private String apiName;
}
...@@ -36,7 +36,24 @@ public class AuthUserApiReq implements Serializable { ...@@ -36,7 +36,24 @@ public class AuthUserApiReq implements Serializable {
@NotNull(message = "授权方式不能为空") @NotNull(message = "授权方式不能为空")
private String authMode; private String authMode;
@ApiModelProperty(value = "授权类型:DATA_BANK_AUTH 数据银行 , DMP_AUTH 授权",required = true)
@NotNull(message = "授权类型不能为空")
private String authType;
@ApiModelProperty(value = "创建用户",required = false) @ApiModelProperty(value = "创建用户",required = false)
private String createUser; private String createUser;
@ApiModelProperty(value = "开始时间",required = false)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date validStartTime;
@ApiModelProperty(value = "结束时间",required = false)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date validEndTime;
@ApiModelProperty(value = "备注--加入来源信息",required = false)
private String remark;
} }
...@@ -20,4 +20,13 @@ public class LogInfoListReq extends BasePageBean implements Serializable { ...@@ -20,4 +20,13 @@ public class LogInfoListReq extends BasePageBean implements Serializable {
@ApiModelProperty(value = "ApiKey") @ApiModelProperty(value = "ApiKey")
private String apiKey; private String apiKey;
@ApiModelProperty(value = "客户请求token")
private String requestToken;
@ApiModelProperty(value = "创建时间")
private String createDate;
@ApiModelProperty(value = "历史查询-数据银行")
private String historyQuery;
} }
...@@ -20,24 +20,15 @@ import java.io.Serializable; ...@@ -20,24 +20,15 @@ import java.io.Serializable;
public class OrganizationManageAddReq implements Serializable { public class OrganizationManageAddReq implements Serializable {
private static final long serialVersionUID = 3131683881168540907L; private static final long serialVersionUID = 3131683881168540907L;
@ApiModelProperty(value = "组织类型:INT 内部组织 OUT 外部组织", required = true)
@NotNull(message = "组织类型不能为空!")
@NotEmpty(message = "组织类型不能为空!")
private String orgType;
@ApiModelProperty(value = "组织名称", required = true) @ApiModelProperty(value = "组织名称", required = true)
@NotNull(message = "组织名称不能为空") @NotNull(message = "组织名称不能为空")
@NotEmpty(message = "组织名称不能为空!") @NotEmpty(message = "组织名称不能为空!")
private String orgName; private String orgName;
@ApiModelProperty(value = "组织描述") @ApiModelProperty(value = "文件夹Id",required = true)
private String orgDesc; @NotNull(message="文件夹Id不能为空")
private Long orgFolderId;
@ApiModelProperty(value = "组织英文名称")
private String orgCnName;
@ApiModelProperty(value = "组织邮箱")
private String orgMail;
@ApiModelProperty(value = "联系方式", required = true) @ApiModelProperty(value = "联系方式", required = true)
@NotEmpty(message = "联系方式不能为空!") @NotEmpty(message = "联系方式不能为空!")
...@@ -46,9 +37,24 @@ public class OrganizationManageAddReq implements Serializable { ...@@ -46,9 +37,24 @@ public class OrganizationManageAddReq implements Serializable {
@ApiModelProperty(value = "联系人") @ApiModelProperty(value = "联系人")
private String linkman; private String linkman;
@ApiModelProperty(value = "状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)", required = true)
private Boolean status;
@ApiModelProperty(value = "创建人") @ApiModelProperty(value = "创建人")
private String createUser; private String createUser;
/* @ApiModelProperty(value = "状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)", required = true)
private Boolean status;
@ApiModelProperty(value = "组织描述")
private String orgDesc;
@ApiModelProperty(value = "组织英文名称")
private String orgCnName;
@ApiModelProperty(value = "组织邮箱")
private String orgMail;
@ApiModelProperty(value = "组织类型:INT 内部组织 OUT 外部组织", required = true)
@NotNull(message = "组织类型不能为空!")
@NotEmpty(message = "组织类型不能为空!")
private String orgType;*/
} }
...@@ -23,17 +23,26 @@ public class OrganizationManageUpdateReq implements Serializable { ...@@ -23,17 +23,26 @@ public class OrganizationManageUpdateReq implements Serializable {
@NotNull(message = "组织id不能为空") @NotNull(message = "组织id不能为空")
private Long id; private Long id;
@ApiModelProperty(value = "组织类型:INT 内部组织 OUT 外部组织", required = true)
@NotNull(message = "组织类型不能为空!")
@NotEmpty(message = "组织类型不能为空!")
private String orgType;
@ApiModelProperty(value = "组织名称", required = true) @ApiModelProperty(value = "组织名称", required = true)
@NotNull(message = "组织名称不能为空") @NotNull(message = "组织名称不能为空")
@NotEmpty(message = "组织名称不能为空!") @NotEmpty(message = "组织名称不能为空!")
private String orgName; private String orgName;
@ApiModelProperty(value = "组织描述") @ApiModelProperty(value = "联系方式", required = true)
@NotEmpty(message = "联系方式不能为空!")
private String orgPhone;
@ApiModelProperty(value = "文件夹Id",required = true)
@NotNull(message="文件夹Id不能为空")
private Long orgFolderId;
@ApiModelProperty(value = "联系人")
private String linkman;
@ApiModelProperty(value = "创建人")
private String createUser;
/* @ApiModelProperty(value = "组织描述")
private String orgDesc; private String orgDesc;
@ApiModelProperty(value = "组织英文名称") @ApiModelProperty(value = "组织英文名称")
...@@ -42,17 +51,12 @@ public class OrganizationManageUpdateReq implements Serializable { ...@@ -42,17 +51,12 @@ public class OrganizationManageUpdateReq implements Serializable {
@ApiModelProperty(value = "组织邮箱") @ApiModelProperty(value = "组织邮箱")
private String orgMail; private String orgMail;
@ApiModelProperty(value = "联系方式", required = true)
@NotEmpty(message = "联系方式不能为空!")
private String orgPhone;
@ApiModelProperty(value = "联系人")
private String linkman;
@ApiModelProperty(value = "状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)", required = true) @ApiModelProperty(value = "状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)", required = true)
private Boolean status; private Boolean status;
@ApiModelProperty(value = "创建人") @ApiModelProperty(value = "组织类型:INT 内部组织 OUT 外部组织", required = true)
private String createUser; @NotNull(message = "组织类型不能为空!")
@NotEmpty(message = "组织类型不能为空!")
private String orgType;*/
} }
package com.jz.dmp.modules.controller.dataService.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @ClassName: SaltResetReq
* @Description: 盐值重置请求对象
* @Author: Bellamy
* @Date 2021/2/20
* @Version 1.0
*/
@Data
@ApiModel("盐值重置请求对象")
public class SaltResetReq implements Serializable {
@ApiModelProperty(value = "授权码", required = true)
@NotNull(message = "授权码不能为空")
@NotEmpty(message = "授权码不能为空")
private String authCode;
@ApiModelProperty(value = "更新用户", required = false)
private String updateUser;
}
...@@ -90,4 +90,44 @@ public interface DmpApiMangeService { ...@@ -90,4 +90,44 @@ public interface DmpApiMangeService {
* @since 2021-02-07 * @since 2021-02-07
*/ */
JsonResult apiPublishCancel(String id, Boolean optStatus) throws Exception; JsonResult apiPublishCancel(String id, Boolean optStatus) throws Exception;
/**
* 盐值重置
*
* @author Bellamy
* @since 2021-02-20
*/
JsonResult saltReset(SaltResetReq req) throws Exception;
/**
* 授权管理-api列表
*
* @author Bellamy
* @since 2021-02-20
*/
JsonResult queryAuthApiList(AuthApiListReq req) throws Exception;
/**
* 用户授权
*
* @author Bellamy
* @since 2021-02-20
*/
JsonResult authUserApi(AuthUserApiReq req) throws Exception;
/**
* 服务开发--上传(发送给数据银行)
*
* @author Bellamy
* @since 2021-02-20
*/
JsonResult serverUpload(String id) throws Exception;
/**
* 日志详情
*
* @author Bellamy
* @since 2021-02-20
*/
JsonResult logDetails(String id) throws Exception;
} }
...@@ -348,4 +348,167 @@ public class DmpApiMangeServiceImpl implements DmpApiMangeService { ...@@ -348,4 +348,167 @@ public class DmpApiMangeServiceImpl implements DmpApiMangeService {
return result; return result;
} }
/**
* 盐值重置
*
* @param req
* @author Bellamy
* @since 2021-02-20
*/
@Override
public JsonResult saltReset(SaltResetReq req) throws Exception {
JsonResult result = new JsonResult();
String url = gatewayUrl + GatewayApiConstant.saltReset;
String resultData = HttpClientUtils.post(url, JSONObject.toJSONString(req));
if (StringUtils.isEmpty(resultData)) {
throw new RuntimeException("查询失败!");
}
logger.info("#################响应结果数据{}" + resultData);
Map jsonObject = JSONObject.parseObject(resultData);
if (jsonObject.containsKey("code")) {
if ("200".equals(jsonObject.get("code").toString())) {
result.setData(jsonObject.get("data"));
return result;
}
}
if (jsonObject.containsKey("message")) {
logger.info(jsonObject.get("message").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
result.setMessage(jsonObject.get("message").toString());
}
return result;
}
/**
* 授权管理-api列表
*
* @param req
* @author Bellamy
* @since 2021-02-20
*/
@Override
public JsonResult queryAuthApiList(AuthApiListReq req) throws Exception {
JsonResult result = new JsonResult();
String url = gatewayUrl + GatewayApiConstant.authApiList;
String resultData = HttpClientUtils.post(url, JSONObject.toJSONString(req));
if (StringUtils.isEmpty(resultData)) {
throw new RuntimeException("查询失败!");
}
logger.info("#################响应结果数据{}" + resultData);
Map jsonObject = JSONObject.parseObject(resultData);
if (jsonObject.containsKey("code")) {
if ("200".equals(jsonObject.get("code").toString())) {
result.setData(jsonObject.get("data"));
return result;
}
}
if (jsonObject.containsKey("message")) {
logger.info(jsonObject.get("message").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
result.setMessage(jsonObject.get("message").toString());
}
return result;
}
/**
* 用户授权
*
* @param req
* @author Bellamy
* @since 2021-02-20
*/
@Override
public JsonResult authUserApi(AuthUserApiReq req) throws Exception {
JsonResult result = new JsonResult();
String url = gatewayUrl + GatewayApiConstant.authUserApi;
String resultData = HttpClientUtils.post(url, JSONObject.toJSONString(req));
if (StringUtils.isEmpty(resultData)) {
throw new RuntimeException("查询失败!");
}
logger.info("#################响应结果数据{}" + resultData);
Map jsonObject = JSONObject.parseObject(resultData);
if (jsonObject.containsKey("code")) {
if ("200".equals(jsonObject.get("code").toString())) {
result.setData(jsonObject.get("data"));
return result;
}
}
if (jsonObject.containsKey("message")) {
logger.info(jsonObject.get("message").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
result.setMessage(jsonObject.get("message").toString());
}
return result;
}
/**
* 服务开发--上传(发送给数据银行)
*
* @param id
* @author Bellamy
* @since 2021-02-20
*/
@Override
public JsonResult serverUpload(String id) throws Exception {
JsonResult result = new JsonResult();
String url = gatewayUrl + GatewayApiConstant.serverUpload;
Map params = new HashMap();
params.put("id", Long.valueOf(id));
String returnData = HttpClientUtils.getJsonForParam(url, params);
if (StringUtils.isEmpty(returnData)) {
throw new RuntimeException("查询失败!");
}
logger.info("#################响应结果{}" + returnData);
Map map = JSONObject.parseObject(returnData);
if (map.containsKey("code")) {
if ("200".equals(map.get("code").toString())) {
return JsonResult.ok();
}
}
if (map.containsKey("message")) {
logger.info(map.get("message").toString());
result.setMessage(map.get("message").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
}
return result;
}
/**
* 日志详情
*
* @param id
* @author Bellamy
* @since 2021-02-20
*/
@Override
public JsonResult logDetails(String id) throws Exception {
JsonResult result = new JsonResult();
String url = gatewayUrl + GatewayApiConstant.logDetails;
Map params = new HashMap();
params.put("id", id);
String resultData = HttpClientUtils.post(url, JSONObject.toJSONString(params));
if (StringUtils.isEmpty(resultData)) {
throw new RuntimeException("查询失败!");
}
logger.info("#################响应结果数据{}" + resultData);
Map jsonObject = JSONObject.parseObject(resultData);
if (jsonObject.containsKey("code")) {
if ("200".equals(jsonObject.get("code").toString())) {
return JsonResult.ok(jsonObject.get("data"));
}
}
if (jsonObject.containsKey("message")) {
logger.info(jsonObject.get("message").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
result.setMessage(jsonObject.get("message").toString());
}
return result;
}
} }
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