Commit 04088cd5 authored by zhangc's avatar zhangc

修改部分api接口,优化api列表查询,授权查询

parent 03996381
...@@ -4,7 +4,7 @@ CREATE TABLE `t_api_interface` ( ...@@ -4,7 +4,7 @@ CREATE TABLE `t_api_interface` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'api 信息表自增ID', `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'api 信息表自增ID',
`api_key` varchar(200) NOT NULL COMMENT 'api唯一标识', `api_key` varchar(200) NOT NULL COMMENT 'api唯一标识',
`api_name` varchar(100) DEFAULT NULL COMMENT 'api名称', `api_name` varchar(100) DEFAULT NULL COMMENT 'api名称',
`api_protocl` varchar(32) DEFAULT NULL COMMENT 'api请求协议:http,https', `api_protocl` int(4) DEFAULT NULL COMMENT 'api请求协议:0,http,1.https',
`target_url` varchar(100) DEFAULT NULL COMMENT '目标url', `target_url` varchar(100) DEFAULT NULL COMMENT '目标url',
`api_type` varchar(50) NULL DEFAULT '' COMMENT '接入类型:字典表对应key值', `api_type` varchar(50) NULL DEFAULT '' COMMENT '接入类型:字典表对应key值',
`req_type` varchar(20) NULL DEFAULT NULL COMMENT '请求方式: GET, POST', `req_type` varchar(20) NULL DEFAULT NULL COMMENT '请求方式: GET, POST',
...@@ -13,7 +13,7 @@ CREATE TABLE `t_api_interface` ( ...@@ -13,7 +13,7 @@ CREATE TABLE `t_api_interface` (
`output_type` varchar(50) NULL DEFAULT 'JSON' COMMENT '输出类型:flow 流形式输出, json格式输出', `output_type` varchar(50) NULL DEFAULT 'JSON' COMMENT '输出类型:flow 流形式输出, json格式输出',
`version` varchar(20) DEFAULT 'v1.0' COMMENT '版本号', `version` varchar(20) DEFAULT 'v1.0' COMMENT '版本号',
`sign_type` tinyint(2) DEFAULT NULL COMMENT '加密方式:0 无 1. MD5 2. RSA', `sign_type` tinyint(2) DEFAULT NULL COMMENT '加密方式:0 无 1. MD5 2. RSA',
`timeout` varchar(50) DEFAULT NULL COMMENT '超时时间', `timeout` int(20) DEFAULT "5000" COMMENT '超时时间',
`file_id` bigint(20) DEFAULT NULL COMMENT '文件夹id', `file_id` bigint(20) DEFAULT NULL COMMENT '文件夹id',
`limit_type` varchar(20) DEFAULT NULL COMMENT '限流类型:DAY 按天,MONTH 按月, YEAR 按年', `limit_type` varchar(20) DEFAULT NULL COMMENT '限流类型:DAY 按天,MONTH 按月, YEAR 按年',
`req_frequency` bigint(20) DEFAULT '100' COMMENT '限制次数', `req_frequency` bigint(20) DEFAULT '100' COMMENT '限制次数',
...@@ -59,7 +59,8 @@ CREATE TABLE `t_api_interface_custom` ( ...@@ -59,7 +59,8 @@ CREATE TABLE `t_api_interface_custom` (
DROP TABLE IF EXISTS `t_api_interface_file`; DROP TABLE IF EXISTS `t_api_interface_file`;
CREATE TABLE `t_api_interface_file` ( CREATE TABLE `t_api_interface_file` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'api文件表自增ID', `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'api文件表自增ID',
`project_id` bigint(20) NOT NULL COMMENT '项目编号', `project_id` bigint(20) DEFAULT NULL COMMENT '项目编号',
`org_code` varchar(100) DEFAULT NULL COMMENT '组织名称',
`file_source` varchar(50) DEFAULT NULL COMMENT '文件来源:,1 API制做,2 组织创建', `file_source` varchar(50) DEFAULT NULL COMMENT '文件来源:,1 API制做,2 组织创建',
`file_name` varchar(50) DEFAULT NULL COMMENT '文件名称', `file_name` varchar(50) DEFAULT NULL COMMENT '文件名称',
`file_en_name` varchar(50) DEFAULT NULL COMMENT '文件英文名称', `file_en_name` varchar(50) DEFAULT NULL COMMENT '文件英文名称',
......
...@@ -20,13 +20,13 @@ public enum ApiStatusEnum { ...@@ -20,13 +20,13 @@ public enum ApiStatusEnum {
*/ */
ISSUE("发布"), ISSUE("发布"),
/** /**
* 过时 * 授权
*/ */
OUTMODED("过时"), AUTHORIZATION("授权"),
/** /**
* 冻结 * 冻结
*/ *//*
FREEZE("冻结"), FREEZE("冻结"),*/
/** /**
* 下架(下架时可以调用/不可以购买) * 下架(下架时可以调用/不可以购买)
*/ */
......
...@@ -30,51 +30,40 @@ public class ApiInterfaceController { ...@@ -30,51 +30,40 @@ public class ApiInterfaceController {
@Autowired @Autowired
private ApiInterfaceService apiInterfaceService; private ApiInterfaceService apiInterfaceService;
/** @ApiOperation("服务管理---API计量(已调用)")
* @Description:API列表查询 @PostMapping(value = "/listCallApi")
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("API---(已调用列表)列表查询")
@PostMapping(value = "/listApiInterface")
public Mono<Result> getApiInterfaceCallList(@RequestBody @Valid ApiInterfaceInfoListReq req) { public Mono<Result> getApiInterfaceCallList(@RequestBody @Valid ApiInterfaceInfoListReq req) {
return Mono.fromSupplier(() -> Result.of_success(apiInterfaceService.listCallApiInterface(req))); return Mono.fromSupplier(() -> Result.of_success(apiInterfaceService.listCallApiInterface(req)));
} }
/**
* @Description:API列表查询 @ApiOperation("服务管理---API计量(未调用)")
* @Author: Mr.zhang @PostMapping(value = "/listUnCallApi")
* @Date: 2020-12-24
*/
@ApiOperation("API---(未调用列表)列表查询")
@PostMapping(value = "/listUnCallApiInterface")
public Mono<Result> getApiInterfaceList(@RequestBody @Valid ApiInterfaceInfoListReq req) { public Mono<Result> getApiInterfaceList(@RequestBody @Valid ApiInterfaceInfoListReq req) {
return Mono.fromSupplier(() -> Result.of_success(apiInterfaceService.listUnCallApiInterface(req))); return Mono.fromSupplier(() -> Result.of_success(apiInterfaceService.listUnCallApiInterface(req)));
} }
/** @ApiOperation("Api计量")
* @Description:API详情查询 @GetMapping(value = "/countAPiCallStat")
* @Author: Mr.zhang public Mono<Result> countAPiCallStat(@RequestParam(name = "date") String date) {
* @Date: 2020-12-24 return Mono.fromSupplier(() -> apiInterfaceService.countAPiCallStat(date));
*/ }
@ApiOperation("服务开发----API列表")
@PostMapping(value = "/listServerApplyApi")
public Mono<Result> getServerApplyApiInterfaceList(@RequestBody @Valid ApiInterfaceInfoListReq req) {
return Mono.fromSupplier(() -> apiInterfaceService.listServerApplyApi(req));
}
@ApiOperation("API详情查询") @ApiOperation("API详情查询")
@PostMapping(value = "/getApiInterfaceDetail") @PostMapping(value = "/getApiDetail")
public Mono<Result> getApiInterfaceDetail(@RequestBody @Valid ApiInterfaceDetailReq req) { public Mono<Result> getApiDetail(@RequestBody @Valid ApiInterfaceDetailReq req) {
return Mono.fromSupplier(() -> apiInterfaceService.getApiInterfaceDetail(req)); return Mono.fromSupplier(() -> apiInterfaceService.getApiInterfaceDetail(req));
} }
/**
* @Description:API删除
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("数据银行API删除") @ApiOperation("数据银行API删除")
@PostMapping(value = "/delDataBankApiInterface") @PostMapping(value = "/delDataBankApiInterface")
public Mono<Result> delDataBankApiInterface(@RequestParam (name="apiKey")String apiKey) { public Mono<Result> delDataBankApiInterface(@RequestParam (name="apiKey")String apiKey) {
return Mono.fromSupplier(() -> apiInterfaceService.delApiInterface(apiKey)); return Mono.fromSupplier(() -> apiInterfaceService.delApiInterface(apiKey));
} }
/**
* @Description:DMP-API删除
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("DMP-API删除/确认提示接口") @ApiOperation("DMP-API删除/确认提示接口")
@GetMapping(value = "/delDMPApiInterface") @GetMapping(value = "/delDMPApiInterface")
public Mono<Result> delDMPApiInterface(@RequestParam (name="type")String type, public Mono<Result> delDMPApiInterface(@RequestParam (name="type")String type,
...@@ -82,21 +71,13 @@ public class ApiInterfaceController { ...@@ -82,21 +71,13 @@ public class ApiInterfaceController {
return Mono.fromSupplier(() -> apiInterfaceService.dmpDeleteAuth(type,apiKey)); return Mono.fromSupplier(() -> apiInterfaceService.dmpDeleteAuth(type,apiKey));
} }
/**
* @Description:数据修改发送状态接口
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("数据修改发送状态接口") @ApiOperation("数据修改发送状态接口")
@GetMapping(value = "/updateSendStatus") @GetMapping(value = "/updateSendStatus")
public Mono<Result> updateApiSendStatus(@RequestParam (name="apiKey")String apiKey) { public Mono<Result> updateApiSendStatus(@RequestParam (name="apiKey")String apiKey) {
return Mono.fromSupplier(() -> apiInterfaceService.updateApiSendStatus(apiKey)); return Mono.fromSupplier(() -> apiInterfaceService.updateApiSendStatus(apiKey));
} }
/**
* @Description: 已发送到数据银行API列表
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("已发送到数据银行API列表") @ApiOperation("已发送到数据银行API列表")
@PostMapping(value = "/listSendDataBank") @PostMapping(value = "/listSendDataBank")
public Mono<Result> listSendDataBank(@RequestBody @Valid SendDataReq req) { public Mono<Result> listSendDataBank(@RequestBody @Valid SendDataReq req) {
......
package com.jz.dm.controller; package com.jz.dm.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
import com.jz.common.utils.Result; import com.jz.common.utils.Result;
import com.jz.dm.models.dto.DataBankNumberErrorDto; import com.jz.dm.models.dto.DataBankNumberErrorDto;
import com.jz.dm.models.req.DataBankNumberErrorReq; import com.jz.dm.models.req.DataBankNumberErrorReq;
...@@ -16,7 +13,6 @@ import org.springframework.web.bind.annotation.*; ...@@ -16,7 +13,6 @@ import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.List;
/** /**
* @author ZC * @author ZC
...@@ -35,39 +31,18 @@ public class ApiLogController { ...@@ -35,39 +31,18 @@ public class ApiLogController {
@Autowired @Autowired
private ApiLogService apiLogService; private ApiLogService apiLogService;
/**
* @Description:日志信息查询
* @return: 日志列表
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("日志列表查询") @ApiOperation("日志列表查询")
@PostMapping(value = "/listApiLog") @PostMapping(value = "/listApiLog")
public Mono<Result> getApiLogList(@RequestBody @Valid LogInfoListReq req) { public Mono<Result> getApiLogList(@RequestBody @Valid LogInfoListReq req) {
return Mono.fromSupplier(() -> Result.of_success(apiLogService.listApiLog(req))); return Mono.fromSupplier(() -> Result.of_success(apiLogService.listApiLog(req)));
} }
/**
* @Description:日志详情查询
* @return: 日志详情查询
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("日志详情查询") @ApiOperation("日志详情查询")
@PostMapping(value = "/getReqDetail") @PostMapping(value = "/getReqDetail")
public Mono<Result> getApiLogDetail(@RequestBody @Valid LogInfoDetailReq req) { public Mono<Result> getApiLogDetail(@RequestBody @Valid LogInfoDetailReq req) {
return Mono.fromSupplier(() -> apiLogService.getApiLogDetail(req)); return Mono.fromSupplier(() -> apiLogService.getApiLogDetail(req));
} }
/**
* @Description:Api调用统计
* @return: DMP-Api调用统计
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("DMP-Api调用统计")
@GetMapping(value = "/countAPiCallStat")
public Mono<Result> countAPiCallStat(@RequestParam(name = "date") String date) {
return Mono.fromSupplier(() -> apiLogService.countAPiCallStat(date));
}
/** /**
......
...@@ -29,101 +29,74 @@ public class AuthController { ...@@ -29,101 +29,74 @@ public class AuthController {
@Autowired @Autowired
private AuthService authService; private AuthService authService;
/**
* @Description:服务授权列表 @ApiOperation("授权API列表")
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation("服务授权列表")
@PostMapping(value = "/getServiceAuthList") @PostMapping(value = "/getServiceAuthList")
public Mono<Result> getServiceAuthList(@RequestBody @Valid ServiceAuthReq req) { public Mono<Result> getServiceAuthList(@RequestBody @Valid ServiceAuthReq req) {
return Mono.fromSupplier(() -> authService.getServiceAuthList(req)); return Mono.fromSupplier(() -> authService.getServiceAuthList(req));
} }
/**
* @Description:商城用户API认证 @ApiOperation("数据银行/DMP用户---授权")
* @return: 商城用户API认证 @PostMapping(value = "/user-auth-api")
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation("商城用户API认证")
@PostMapping(value = "/mall-user-auth-api")
public Mono<Result> authMallUserApi(@RequestBody @Valid AuthUserApiReq req) { public Mono<Result> authMallUserApi(@RequestBody @Valid AuthUserApiReq req) {
return Mono.fromSupplier(() -> authService.addMallUserApiAuth(req)); return Mono.fromSupplier(() -> authService.addUserApiAuth(req));
}
/**
* @Description:DMP用户API认证
* @return: DMP用户API认证
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation("DMP用户API认证")
@PostMapping(value = "dmp-auth-api")
public Mono<Result> authDmpUserApi(@RequestBody @Valid AuthUserApiReq req) {
return Mono.fromSupplier(() -> authService.addDmpUserApiAuth(req));
} }
/**
* @Description: 认证详情查询
* @return: 认证详情查询
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation("认证详情查询") @ApiOperation("认证详情查询")
@PostMapping(value = "/auth-detail-info") @PostMapping(value = "/auth-detail-info")
public Mono<Result> selectAuthDetailInfo(@RequestBody @Valid AuthDetailInfoReq req) { public Mono<Result> selectAuthDetailInfo(@RequestBody @Valid AuthDetailInfoReq req) {
return Mono.fromSupplier(() -> authService.getAuthDetailInfo(req)); return Mono.fromSupplier(() -> authService.getAuthDetailInfo(req));
} }
/** @ApiOperation("取消授权")
@PostMapping(value = "/update-auth-info")
public Mono<Result> updateAuthListInfo(@RequestBody @Valid AuthInfoUpdateReq req) {
return Mono.fromSupplier(() -> authService.updateAuthInfo(req));
}
@ApiOperation("盐值重置接口")
@PostMapping(value = "/reset-salt")
public Mono<Result> resetSalt(@RequestBody @Validated SaltResetReq req) {
return Mono.fromSupplier(() -> authService.updateSaltInfo(req));
}
@ApiOperation("商城授权续费")
@PostMapping(value = "/auth-renew")
public Mono<Result> authRenew(@RequestBody @Validated AuthRenewUpdateReq req) {
return Mono.fromSupplier(() -> authService.updateAuthDate(req));
}
/* *//**
* @Description: 认证列表查询 * @Description: 认证列表查询
* @return: 认证列表查询 * @return: 认证列表查询
* @Author: Mr.zhang * @Author: Mr.zhang
* @Date: 2020-12-26 * @Date: 2020-12-26
*/ *//*
@ApiOperation("认证列表查询") @ApiOperation("认证列表查询")
@PostMapping(value = "/auth-list") @PostMapping(value = "/auth-list")
public Mono<Result> selectAuthListInfo(@RequestBody @Valid AuthListInfoReq req) { public Mono<Result> selectAuthListInfo(@RequestBody @Valid AuthListInfoReq req) {
return Mono.fromSupplier(() -> authService.getAuthListInfo(req)); return Mono.fromSupplier(() -> authService.getAuthListInfo(req));
} }*/
/** /* *//**
* @Description: 授权模糊查询列表信息 * @Description: 授权模糊查询列表信息
* @return: 认证列表查询 * @return: 认证列表查询
* @Author: Mr.zhang * @Author: Mr.zhang
* @Date: 2020-12-26 * @Date: 2020-12-26
*/ *//*
@ApiOperation("授权模糊查询列表信息") @ApiOperation("授权模糊查询列表信息")
@GetMapping(value = "/getAuthNameList") @GetMapping(value = "/getAuthNameList")
public Mono<Result> getAuthNameList(@RequestParam("key") String key) { public Mono<Result> getAuthNameList(@RequestParam("key") String key) {
return Mono.fromSupplier(() -> authService.getAuthNameList(key)); return Mono.fromSupplier(() -> authService.getAuthNameList(key));
} }*/
/**
* @Description: 认证信息修改
* @return: 认证信息修改
* @Author: Mr.zhang
* @Date: 2020-12-26 /* *//**
*/ * @Description:DMP用户API认证
@ApiOperation("取消授权") * @return: DMP用户API认证
@PostMapping(value = "/update-auth-info")
public Mono<Result> updateAuthListInfo(@RequestBody @Valid AuthInfoUpdateReq req) {
return Mono.fromSupplier(() -> authService.updateAuthInfo(req));
}
/**
* @Description: 盐值重置接口
* @return: 盐值重置接口
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation("盐值重置接口")
@PostMapping(value = "/reset-salt")
public Mono<Result> resetSalt(@RequestBody @Validated SaltResetReq req) {
return Mono.fromSupplier(() -> authService.updateSaltInfo(req));
}
/**
* @Description: 商城授权续费
* @Author: Mr.zhang * @Author: Mr.zhang
* @Date: 2020-12-26 * @Date: 2020-12-26
*/ *//*
@ApiOperation("商城授权续费") @ApiOperation("DMP用户API认证")
@PostMapping(value = "/auth-renew") @PostMapping(value = "dmp-auth-api")
public Mono<Result> authRenew(@RequestBody @Validated AuthRenewUpdateReq req) { public Mono<Result> authDmpUserApi(@RequestBody @Valid AuthUserApiReq req) {
return Mono.fromSupplier(() -> authService.updateAuthDate(req)); return Mono.fromSupplier(() -> authService.addDmpUserApiAuth(req));
} }*/
} }
...@@ -30,43 +30,24 @@ public class OrganizationManageController { ...@@ -30,43 +30,24 @@ public class OrganizationManageController {
@Autowired @Autowired
private OrganizationManageService organizationManageService; private OrganizationManageService organizationManageService;
/**
* @Description:组织列表查询
* @return: 组织列表
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("组织列表查询") @ApiOperation("组织列表查询")
@PostMapping(value = "/listOrg") @PostMapping(value = "/listOrg")
public Mono<Result> listOrganization(@RequestBody @Valid OrganizationManageListQueryReq req) { public Mono<Result> listOrganization(@RequestBody @Valid OrganizationManageListQueryReq req) {
return Mono.fromSupplier(() -> Result.of_success(organizationManageService.listOrganization(req))); return Mono.fromSupplier(() -> Result.of_success(organizationManageService.listOrganization(req)));
} }
/**
* @Description:组织信息详情信息查询
* @return: 组织详情
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("组织详情查询") @ApiOperation("组织详情查询")
@PostMapping(value = "/getOrgDetail") @PostMapping(value = "/getOrgDetail")
public Mono<Result> getOrganizationDetail(@RequestBody @Valid OrganizationManageDetailQueryReq req) { public Mono<Result> getOrganizationDetail(@RequestBody @Valid OrganizationManageDetailQueryReq req) {
return Mono.fromSupplier(() -> organizationManageService.getOrganizationDetail(req)); return Mono.fromSupplier(() -> organizationManageService.getOrganizationDetail(req));
} }
/**
* @Description:添加组织信息
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("添加/更新组织") @ApiOperation("添加/更新组织")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Mono<Result> add(@RequestBody @Valid OrganizationManageAddReq req) { public Mono<Result> add(@RequestBody @Valid OrganizationManageAddReq req) {
return Mono.fromSupplier(() -> organizationManageService.add(req)); return Mono.fromSupplier(() -> organizationManageService.add(req));
} }
/**
* @Description:注销组织
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("注销组织") @ApiOperation("注销组织")
@GetMapping(value = "/logoutOrg") @GetMapping(value = "/logoutOrg")
public Mono<Result> delete(@RequestParam(name = "id")Long id) { public Mono<Result> delete(@RequestParam(name = "id")Long id) {
......
...@@ -3,7 +3,6 @@ package com.jz.dm.controller; ...@@ -3,7 +3,6 @@ package com.jz.dm.controller;
import com.jz.common.utils.Result; import com.jz.common.utils.Result;
import com.jz.dm.models.req.folder.CreateFolderReq; import com.jz.dm.models.req.folder.CreateFolderReq;
import com.jz.dm.models.req.producer.ApiInterfaceReq; import com.jz.dm.models.req.producer.ApiInterfaceReq;
import com.jz.dm.models.req.producer.ServiceIssueReq;
import com.jz.dm.service.ProducerService; import com.jz.dm.service.ProducerService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -30,45 +29,19 @@ public class ProducerController { ...@@ -30,45 +29,19 @@ public class ProducerController {
@Autowired @Autowired
private ProducerService producerService; private ProducerService producerService;
/**
* @Description:获取文件夹列表
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation("获取文件夹列表") @ApiOperation("获取文件夹列表")
@GetMapping(value = "/getFileCatalog") @GetMapping(value = "/getFileCatalog")
public Mono<Result> getFileCatalog(@RequestParam(name = "projectId") Long projectId) { public Mono<Result> getFileCatalog(@RequestParam(name = "projectId",required = false) Long projectId,
return Mono.fromSupplier(() -> producerService.getFileCatalog(projectId)); @RequestParam(name = "orgCode",required = false) String orgCode) {
return Mono.fromSupplier(() -> producerService.getFileCatalog(projectId,orgCode));
} }
/**
* @Description:创建文件夹
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation("创建项目文件夹") @ApiOperation("创建项目文件夹")
@PostMapping(value = "/createProjectFolder") @PostMapping(value = "/createProjectFolder")
public Mono<Result> createProjectFolder(@RequestBody @Valid CreateFolderReq req) { public Mono<Result> createProjectFolder(@RequestBody @Valid CreateFolderReq req) {
return Mono.fromSupplier(() -> producerService.createProjectFolder(req)); return Mono.fromSupplier(() -> producerService.createProjectFolder(req));
} }
/**
* @Description:服务发布列表
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation("服务发布列表")
@PostMapping(value = "/getServiceIssueList")
public Mono<Result> getServiceIssueList(@RequestBody @Valid ServiceIssueReq req) {
return Mono.fromSupplier(() -> producerService.getServiceIssueList(req));
}
/**
* @Description:服务发布/服务取消
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation("服务发布/服务取消") @ApiOperation("服务发布/服务取消")
@GetMapping(value = "/optionApiIssueStatus") @GetMapping(value = "/optionApiIssueStatus")
public Mono<Result> optionApiIssueStatus(@RequestParam(name = "id") Long id, public Mono<Result> optionApiIssueStatus(@RequestParam(name = "id") Long id,
...@@ -76,40 +49,36 @@ public class ProducerController { ...@@ -76,40 +49,36 @@ public class ProducerController {
return Mono.fromSupplier(() -> producerService.optionApiIssueStatus(id, optStatus)); return Mono.fromSupplier(() -> producerService.optionApiIssueStatus(id, optStatus));
} }
/** @ApiOperation("服务发布---上传")
* @Description:获取APIID @GetMapping(value = "/serverUpload")
* @Author: Mr.zhang public Mono<Result> serverUpload(@RequestParam(name = "id") Long id) {
* @Date: 2020-12-26 return Mono.fromSupplier(() -> producerService.serverUpload(id));
*/ }
@ApiOperation("Api制作(获取ApiId)")
@ApiOperation("服务开发---获取ApiId")
@PostMapping(value = "/getCustomApiId") @PostMapping(value = "/getCustomApiId")
public Mono<Result> getCustomApiId() { public Mono<Result> getCustomApiId() {
return Mono.fromSupplier(() -> producerService.getCustomApiId()); return Mono.fromSupplier(() -> producerService.getCustomApiId());
} }
/**
* @Description:Api制作(第三方) @ApiOperation("Api制作/编辑(第三方)")
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation("Api制作(第三方)")
@PostMapping(value = "/addCustomApi") @PostMapping(value = "/addCustomApi")
public Mono<Result> makeCustomApi(@RequestBody @Valid ApiInterfaceReq req) { public Mono<Result> makeCustomApi(@RequestBody @Valid ApiInterfaceReq req) {
return Mono.fromSupplier(() -> Result.of_success(producerService.saveInterfaceAPi(req))); return Mono.fromSupplier(() -> Result.of_success(producerService.saveInterfaceAPi(req)));
} }
/** @ApiOperation("Api制作/编辑(数据查询/标签查询)")
* @Description:Api制作(数据查询/标签查询)
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation("Api制作(数据查询/标签查询)")
@PostMapping(value = "/addDataTableSelect") @PostMapping(value = "/addDataTableSelect")
public Mono<Result> bigDataMakeApi(@RequestBody @Valid ApiInterfaceReq req) { public Mono<Result> bigDataMakeApi(@RequestBody @Valid ApiInterfaceReq req) {
return Mono.fromSupplier(() -> producerService.addBigDataMakeApi(req)); return Mono.fromSupplier(() -> producerService.addBigDataMakeApi(req));
} }
/* @ApiOperation("服务发布列表")
@PostMapping(value = "/getServiceIssueList")
public Mono<Result> getServiceIssueList(@RequestBody @Valid ServiceIssueReq req) {
return Mono.fromSupplier(() -> producerService.getServiceIssueList(req));
}*/
/** /**
* @Description:Api制作(大数据查询/标签查询)保存修改的api信息 * @Description:Api制作(大数据查询/标签查询)保存修改的api信息
* @return: (自定义更新同时使用) * @return: (自定义更新同时使用)
......
...@@ -4,6 +4,7 @@ import com.jz.common.base.BaseMapper; ...@@ -4,6 +4,7 @@ import com.jz.common.base.BaseMapper;
import com.jz.dm.models.domian.ApiInterfaceFile; import com.jz.dm.models.domian.ApiInterfaceFile;
import com.jz.dm.models.dto.ApiInterfaceFileDto; import com.jz.dm.models.dto.ApiInterfaceFileDto;
import com.jz.dm.models.dto.DataFileDto; import com.jz.dm.models.dto.DataFileDto;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -27,7 +28,17 @@ public interface ApiInterfaceFileMapper extends BaseMapper<ApiInterfaceFile> { ...@@ -27,7 +28,17 @@ public interface ApiInterfaceFileMapper extends BaseMapper<ApiInterfaceFile> {
/** /**
* 查询出所有项目文件列表 * 查询出所有项目文件列表
* @param projectId * @param projectId
* @param orgCode
* @return * @return
*/ */
List<DataFileDto> listFileFolders(Long projectId); List<DataFileDto> listFileFolders(@Param("projectId") Long projectId, @Param("orgCode")String orgCode);
/**
* 获取项目下所有文件夹id
* @param projectId
* @param orgCode
* @return
*/
List<Long> getProjectFileFolders(@Param("projectId") Long projectId, @Param("orgCode")String orgCode);
} }
...@@ -68,4 +68,12 @@ public interface ApiInterfaceMapper extends BaseMapper<ApiInterface> { ...@@ -68,4 +68,12 @@ public interface ApiInterfaceMapper extends BaseMapper<ApiInterface> {
* @return * @return
*/ */
IPage<ApiServiceApplyDto > listApiAuthService(IPage<ApiServiceApplyDto> page, @Param("ew") Wrapper<ApiServiceApplyDto> query); IPage<ApiServiceApplyDto > listApiAuthService(IPage<ApiServiceApplyDto> page, @Param("ew") Wrapper<ApiServiceApplyDto> query);
/**
* 查询api列表信息
* @param page
* @param query
* @return
*/
IPage<ApiServiceApplyDto > listApiDetail(IPage<ApiServiceApplyDto> page, @Param("ew") Wrapper<ApiServiceApplyDto> query);
} }
...@@ -37,10 +37,10 @@ public class ApiInterface extends BaseObject implements Serializable { ...@@ -37,10 +37,10 @@ public class ApiInterface extends BaseObject implements Serializable {
private String apiName; private String apiName;
/** /**
* api请求协议:http,https * api请求协议:0,http,1.https
*/ */
@TableField("api_protocl") @TableField("api_protocl")
private String apiProtocl; private Integer apiProtocl;
/** /**
* 接入类型:对应字典表key * 接入类型:对应字典表key
...@@ -102,10 +102,10 @@ public class ApiInterface extends BaseObject implements Serializable { ...@@ -102,10 +102,10 @@ public class ApiInterface extends BaseObject implements Serializable {
@TableField("req_frequency") @TableField("req_frequency")
private Long reqFrequency; private Long reqFrequency;
/** /**
* 超时时间 * 超时时间(秒)
*/ */
@TableField("timeout") @TableField("timeout")
private String timeout; private Integer timeout;
/** /**
......
package com.jz.dm.models.domian;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jz.dm.common.base.BaseObject;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**api数据源配置信息表
* @author ybz
*
*/
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@Accessors(chain = true)
@TableName("t_api_syncing_datasource")
public class ApiSyncingDatasource extends BaseObject implements Serializable {
/**
* 数据源类型ID
*/
@TableField("datasource_type")
private Long datasourceType;
/**
* 数据源名称
*/
@TableField("datasource_name")
private String datasourceName;
/**
* 数据源描述
*/
@TableField("datasource_desc")
private String datasourceDesc;
/**
* 项目编号
*/
@TableField("project_id")
private Long projectId;
/**
* JDBC URL
*/
@TableField("jdbc_url")
private String jdbcUrl;
/**
* 数据库名
*/
@TableField("db_name")
private String dbName;
/**
* 账号
*/
@TableField("user_name")
private String userName;
/**
* 密码
*/
@TableField("password")
private String password;
/**
* 终端信息
*/
@TableField("endpoint")
private String endpoint;
/**
* Bucket信息
*/
@TableField("bucket")
private String bucket;
/**
* accessId
*/
@TableField("access_id")
private String accessId;
/**
* accessKey
*/
@TableField("access_key")
private String accessKey;
/**
* FTP协议
*/
@TableField("protocol")
private String protocol;
/**
* IP
*/
@TableField("host")
private String host;
/**
* 端口
*/
@TableField("port")
private String port;
/**
* NameNode地址
*/
@TableField("default_fs")
private String defaultFs;
/**
* 表空间
*/
@TableField("table_schema")
private String tableSchema;
/**
* 数据状态
*/
@TableField("data_status")
private String dataStatus;
}
package com.jz.dm.models.domian;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jz.dm.common.base.BaseObject;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* @Description:
* @Author: Mr.zhang
* @Date: 2020-12-23
*/
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@Accessors(chain = true)
@TableName("t_api_syncing_datasource_type")
public class ApiSyncingDatasourceType extends BaseObject implements Serializable {
/**
* 数据源名称
*/
@TableField("datasource")
private String datasource;
/**
* 数据源分类编码
*/
@TableField("datasource_catecode")
private String datasourceCatecode;
/**
* 数据源分类名称
*/
@TableField("datasource_catename")
private String datasourceCatename;
/**
* 数据源类型
*/
@TableField("datasource_type")
private String datasourceType;
/**
* 数据源图标
*/
@TableField("img_url")
private String imgUrl;
/**
* 状态
*/
@TableField("data_status")
private String dataStatus;
/**
* 是否启用
*/
@TableField("is_enabled")
private String isEnabled;
/**
*
*/
@TableField("datasource_catetype")
private String datasourceCatetype;
/**
*
*/
@TableField("driver_class_name")
private String driverClassName;
/**
* 是否启用测试
*/
@TableField("is_enable_test")
private String isEnableTest;
/**
*
*/
@TableField("default_source_script")
private String defaultSourceScript;
/**
*
*/
@TableField("default_target_script")
private String defaultTargetScript;
/**
* 是否启用源
*/
@TableField("is_enable_source")
private String isEnableSource;
/**
* 是否启用目标
*/
@TableField("is_enable_target")
private String isEnableTarget;
}
package com.jz.dm.models.dto; package com.jz.dm.models.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
* @author ZC * @author ZC
...@@ -35,10 +38,19 @@ public class ApiServiceApplyDto implements Serializable { ...@@ -35,10 +38,19 @@ public class ApiServiceApplyDto implements Serializable {
private Long pageRow; private Long pageRow;
@ApiModelProperty(value = "描述") @ApiModelProperty(value = "描述")
private String apiFunction; private String apiFunction;
@ApiModelProperty(value = "组织名称")
private String orgName;
@ApiModelProperty(value = "API状态")
private String status;
@ApiModelProperty(value = "是否发布到数据银行,0 false 1 true") @ApiModelProperty(value = "是否发布到数据银行,0 false 1 true")
private Boolean isSendBank; private Boolean isSendBank;
@ApiModelProperty(value = "授权码") @ApiModelProperty(value = "授权码")
private String authCode; private String authCode;
@ApiModelProperty(value = "创建时间/授权时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createDate;
} }
...@@ -24,6 +24,9 @@ public class DataFileDto implements Serializable { ...@@ -24,6 +24,9 @@ public class DataFileDto implements Serializable {
private Long id; private Long id;
@ApiModelProperty(value = "项目编号") @ApiModelProperty(value = "项目编号")
private Long projectId; private Long projectId;
@ApiModelProperty(value = "组织编码")
private String orgCode;
@ApiModelProperty(value = "父类id") @ApiModelProperty(value = "父类id")
private Long parentId; private Long parentId;
@ApiModelProperty(value = "文件名称") @ApiModelProperty(value = "文件名称")
......
...@@ -22,6 +22,21 @@ public class ApiInterfaceInfoListReq extends BasePageBean implements Serializabl ...@@ -22,6 +22,21 @@ public class ApiInterfaceInfoListReq extends BasePageBean implements Serializabl
@ApiModelProperty(value = "状态:SUCCEED 请求成功, FAIL 请求失败") @ApiModelProperty(value = "状态:SUCCEED 请求成功, FAIL 请求失败")
private String status; private String status;
@ApiModelProperty(value = "ApiKey") @ApiModelProperty(value = "ApiKey")
private String apiKey; private String apiKey;
@ApiModelProperty(value = "api名称")
private String apiName;
@ApiModelProperty(value = "组织名称")
private String orgName;
// 服务开发----------------API列表
@ApiModelProperty(value = "项目id--服务开发")
private Long projectId;
@ApiModelProperty(value = "文件id--服务开发")
private Long fileId;
} }
...@@ -8,6 +8,7 @@ import org.springframework.format.annotation.DateTimeFormat; ...@@ -8,6 +8,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
* @author ZC * @author ZC
...@@ -29,5 +30,5 @@ public class AuthRenewUpdateReq implements Serializable { ...@@ -29,5 +30,5 @@ public class AuthRenewUpdateReq implements Serializable {
@NotNull(message = "有效截止时间不能空") @NotNull(message = "有效截止时间不能空")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private String validEndTime; private Date validEndTime;
} }
...@@ -49,7 +49,7 @@ public class AuthUserApiReq implements Serializable { ...@@ -49,7 +49,7 @@ public class AuthUserApiReq implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date validEndTime; private Date validEndTime;
@ApiModelProperty(value = "备注",required = false) @ApiModelProperty(value = "备注--加入来源信息",required = false)
private String remark; private String remark;
@ApiModelProperty(value = "创建用户",required = false) @ApiModelProperty(value = "创建用户",required = false)
......
...@@ -23,11 +23,7 @@ public class SaltResetReq implements Serializable { ...@@ -23,11 +23,7 @@ public class SaltResetReq implements Serializable {
@NotNull(message = "授权码不能为空") @NotNull(message = "授权码不能为空")
private String authCode; private String authCode;
/*@ApiModelProperty(value = "盐值",required = true) @ApiModelProperty(value = "更新用户",required = false)
@NotNull(message = "盐值不能为空") private String updateUser;
private String salt;*/
@ApiModelProperty(value = "创建用户",required = false)
private String createUser;
} }
...@@ -20,11 +20,12 @@ import java.io.Serializable; ...@@ -20,11 +20,12 @@ import java.io.Serializable;
@ApiModel(value = "服务授权请求体") @ApiModel(value = "服务授权请求体")
public class ServiceAuthReq extends BasePageBean implements Serializable { public class ServiceAuthReq extends BasePageBean implements Serializable {
@ApiModelProperty(value = "文件夹id",required = false) @ApiModelProperty(value = "文件夹id",required = false)
private Long folderId; private Long fileId;
@ApiModelProperty(value = "组织编码",required = false)
private String orgCode;
@ApiModelProperty(value = "组织名称",required = false)
private String orgName;
@ApiModelProperty(value = "api名称",required = false) @ApiModelProperty(value = "api名称",required = false)
private String apiName; private String apiName;
@ApiModelProperty(value = "apiId",required = false)
private String apiId;
} }
...@@ -23,6 +23,9 @@ public class CreateFolderReq implements Serializable { ...@@ -23,6 +23,9 @@ public class CreateFolderReq implements Serializable {
@ApiModelProperty(value = "项目id",required = false) @ApiModelProperty(value = "项目id",required = false)
private Long projectId; private Long projectId;
@ApiModelProperty(value = "组织编码",required = false)
private String orgCode;
@ApiModelProperty(value = "父类文件夹id ,创建同级不传",required = false) @ApiModelProperty(value = "父类文件夹id ,创建同级不传",required = false)
private Long parentId; private Long parentId;
...@@ -34,6 +37,8 @@ public class CreateFolderReq implements Serializable { ...@@ -34,6 +37,8 @@ public class CreateFolderReq implements Serializable {
@NotBlank(message = "文件来源不能为空") @NotBlank(message = "文件来源不能为空")
private String fileSource; private String fileSource;
@ApiModelProperty(value = "创建用户",required = false) @ApiModelProperty(value = "创建用户",required = false)
private String createUser; private String createUser;
......
...@@ -23,9 +23,6 @@ public class OrganizationManageListQueryReq extends BasePageBean implements Seri ...@@ -23,9 +23,6 @@ public class OrganizationManageListQueryReq extends BasePageBean implements Seri
@ApiModelProperty(value = "组织名称") @ApiModelProperty(value = "组织名称")
private String orgName; private String orgName;
@ApiModelProperty(value = "组织编码(组织唯一标识)")
private String orgCode;
@ApiModelProperty(value = "组织联系人") @ApiModelProperty(value = "组织联系人")
private String linkman; private String linkman;
......
...@@ -20,11 +20,11 @@ import java.io.Serializable; ...@@ -20,11 +20,11 @@ import java.io.Serializable;
@ApiModel(value = "api基本信息") @ApiModel(value = "api基本信息")
public class ApiInterfaceReq implements Serializable { public class ApiInterfaceReq implements Serializable {
@ApiModelProperty(value = "传输方式:http https",required = true) @ApiModelProperty(value = "传输方式:0,http 1.https",required = true)
@NotNull(message = "传输方式不能为空") @NotNull(message = "传输方式不能为空")
public String apiProtocl; public Integer apiProtocl;
@ApiModelProperty(value = "加密方式0 无,1:MD5 2:RSA",required = true) @ApiModelProperty(value = "加密方式,1:MD5 2:RSA",required = true)
@NotNull(message = "加密方式不能为空") @NotNull(message = "加密方式不能为空")
public Integer signType; public Integer signType;
...@@ -45,7 +45,7 @@ public class ApiInterfaceReq implements Serializable { ...@@ -45,7 +45,7 @@ public class ApiInterfaceReq implements Serializable {
@ApiModelProperty(value = "超时时间",required = true) @ApiModelProperty(value = "超时时间",required = true)
@NotNull(message="超时时间不能为空") @NotNull(message="超时时间不能为空")
public String timeout; public Integer timeout;
@ApiModelProperty(value = "限流类型:DAY 按天,MONTH 按月, YEAR 按年",required = true) @ApiModelProperty(value = "限流类型:DAY 按天,MONTH 按月, YEAR 按年",required = true)
@NotNull(message = "限流类型不能为空") @NotNull(message = "限流类型不能为空")
...@@ -64,12 +64,12 @@ public class ApiInterfaceReq implements Serializable { ...@@ -64,12 +64,12 @@ public class ApiInterfaceReq implements Serializable {
@NotNull(message="文件夹Id不能为空") @NotNull(message="文件夹Id不能为空")
public Long fileId; public Long fileId;
@ApiModelProperty(value = "项目编号",required = true) /* @ApiModelProperty(value = "项目编号",required = true)
@NotNull(message="项目编号不能为空") @NotNull(message="项目编号不能为空")
public Long projectId; public Long projectId;*/
@ApiModelProperty(value = "输出类型:JSON 文件流形式",required = false) @ApiModelProperty(value = "输出类型:JSON 文件流形式",required = false)
public String outType; public String outputType;
@ApiModelProperty(value = "最大行数:",required = false) @ApiModelProperty(value = "最大行数:",required = false)
public Long maxRow; public Long maxRow;
...@@ -83,6 +83,9 @@ public class ApiInterfaceReq implements Serializable { ...@@ -83,6 +83,9 @@ public class ApiInterfaceReq implements Serializable {
@ApiModelProperty(value = "响应参数:",required = false) @ApiModelProperty(value = "响应参数:",required = false)
public String responseParam; public String responseParam;
@ApiModelProperty(value = "固定参数:",required = false)
public String inboxParam;
@ApiModelProperty(value = "参数字段:",required = false) @ApiModelProperty(value = "参数字段:",required = false)
public String tableFields; public String tableFields;
...@@ -95,15 +98,16 @@ public class ApiInterfaceReq implements Serializable { ...@@ -95,15 +98,16 @@ public class ApiInterfaceReq implements Serializable {
@ApiModelProperty(value = "数据表名称",required = false) @ApiModelProperty(value = "数据表名称",required = false)
public String esTable; public String esTable;
@ApiModelProperty(value = "状态",required = false)
public String status;
@ApiModelProperty(value = "更新时传入api自增id",required = false) @ApiModelProperty(value = "更新时传入api自增id",required = false)
public Long id; public Long id;
@ApiModelProperty(value = "创建用户",hidden = true) @ApiModelProperty(value = "创建用户",hidden = true)
public String createUser; public String createUser;
@ApiModelProperty(value = "创建用户",hidden = true) @ApiModelProperty(value = "更新用户",hidden = true)
public String updateUser; public String updateUser;
@ApiModelProperty(value = "状态",required = false)
public String status;
/* @ApiModelProperty(value = "api类型:1.数据银行制作大数据表 " + /* @ApiModelProperty(value = "api类型:1.数据银行制作大数据表 " +
"2 数据银行制作数据包,3,数据银行制作自定义API " + "2 数据银行制作数据包,3,数据银行制作自定义API " +
......
...@@ -106,4 +106,18 @@ public interface ApiInterfaceService { ...@@ -106,4 +106,18 @@ public interface ApiInterfaceService {
* @return * @return
*/ */
Result getSendDataBankList(SendDataReq req); Result getSendDataBankList(SendDataReq req);
/**
* 服务开发--api列表查询
* @param req
* @return
*/
Result listServerApplyApi(ApiInterfaceInfoListReq req);
/**
* 统计API调用数据
* @param date
* @return
*/
Result countAPiCallStat(String date);
} }
...@@ -45,12 +45,7 @@ public interface ApiLogService { ...@@ -45,12 +45,7 @@ public interface ApiLogService {
*/ */
void updateLog(Long id,String response); void updateLog(Long id,String response);
/**
* 统计API调用数据
* @param date
* @return
*/
Result countAPiCallStat(String date);
/** /**
* 查询用户调用数和错误率-数据银行 * 查询用户调用数和错误率-数据银行
......
...@@ -14,12 +14,12 @@ import com.jz.dm.models.req.auth.*; ...@@ -14,12 +14,12 @@ import com.jz.dm.models.req.auth.*;
* @Description: * @Description:
**/ **/
public interface AuthService { public interface AuthService {
/** /* *//**
* 认证列表 * 认证列表
* @param req * @param req
* @return * @return
*/ *//*
Result getAuthListInfo(AuthListInfoReq req); Result getAuthListInfo(AuthListInfoReq req);*/
/** /**
* 获取认证详情信息 * 获取认证详情信息
...@@ -28,19 +28,19 @@ public interface AuthService { ...@@ -28,19 +28,19 @@ public interface AuthService {
*/ */
Result getAuthDetailInfo(AuthDetailInfoReq req); Result getAuthDetailInfo(AuthDetailInfoReq req);
/** /* *//**
* 添加Dmp用户认证 * 添加Dmp用户认证
* @param req * @param req
* @return * @return
*/ *//*
Result addDmpUserApiAuth(AuthUserApiReq req); Result addDmpUserApiAuth(AuthUserApiReq req);*/
/** /**
* 添加商城用户api认证 * 数据银行/DMP用户---授权
* @param req * @param req
* @return * @return
*/ */
Result addMallUserApiAuth(AuthUserApiReq req); Result addUserApiAuth(AuthUserApiReq req);
/** /**
* 修改认证信息 * 修改认证信息
...@@ -78,12 +78,12 @@ public interface AuthService { ...@@ -78,12 +78,12 @@ public interface AuthService {
*/ */
int updateApiAuthStatus(ApiAuth apiAuth); int updateApiAuthStatus(ApiAuth apiAuth);
/** /* *//**
* 根据名称/组织编号摸索查询 * 根据名称/组织编号摸索查询
* @param key * @param key
* @return * @return
*/ *//*
Result getAuthNameList(String key); Result getAuthNameList(String key);*/
/** /**
* 获取服务授权列表 * 获取服务授权列表
...@@ -98,4 +98,5 @@ public interface AuthService { ...@@ -98,4 +98,5 @@ public interface AuthService {
* @return * @return
*/ */
Result updateAuthDate(AuthRenewUpdateReq req); Result updateAuthDate(AuthRenewUpdateReq req);
} }
...@@ -52,4 +52,10 @@ public interface OrganizationManageService { ...@@ -52,4 +52,10 @@ public interface OrganizationManageService {
* @return * @return
*/ */
ApiOrg getAuthOrganization(Long apiOrgId); ApiOrg getAuthOrganization(Long apiOrgId);
/**
* 获取组织信息
* @param orgCode
* @return
*/
ApiOrg getOrganization(String orgCode);
} }
...@@ -3,7 +3,6 @@ package com.jz.dm.service; ...@@ -3,7 +3,6 @@ package com.jz.dm.service;
import com.jz.common.utils.Result; import com.jz.common.utils.Result;
import com.jz.dm.models.req.folder.CreateFolderReq; import com.jz.dm.models.req.folder.CreateFolderReq;
import com.jz.dm.models.req.producer.ApiInterfaceReq; import com.jz.dm.models.req.producer.ApiInterfaceReq;
import com.jz.dm.models.req.producer.ServiceIssueReq;
/** /**
* @author ZC * @author ZC
...@@ -86,9 +85,10 @@ public interface ProducerService { ...@@ -86,9 +85,10 @@ public interface ProducerService {
/** /**
* 获取文件列表 * 获取文件列表
* @param projectId * @param projectId
* @param orgCode
* @return * @return
*/ */
Result getFileCatalog(Long projectId); Result getFileCatalog(Long projectId,String orgCode);
/** /**
* 创建文件夹 * 创建文件夹
...@@ -103,12 +103,12 @@ public interface ProducerService { ...@@ -103,12 +103,12 @@ public interface ProducerService {
*/ */
Result getCustomApiId(); Result getCustomApiId();
/** /* *//**
* 获取服务发布列表 * 获取服务发布列表
* @param req * @param req
* @return * @return
*/ *//*
Result getServiceIssueList(ServiceIssueReq req); Result getServiceIssueList(ServiceIssueReq req);*/
/** /**
* 服务发布/取消操作 * 服务发布/取消操作
...@@ -118,6 +118,13 @@ public interface ProducerService { ...@@ -118,6 +118,13 @@ public interface ProducerService {
*/ */
Result optionApiIssueStatus(Long id, Boolean optStatus); Result optionApiIssueStatus(Long id, Boolean optStatus);
/**
* 服务开发--上传
* @param id
* @return
*/
Result serverUpload(Long id);
//Result saveObjOnRedis(); //Result saveObjOnRedis();
//Result getObjOnRedis(); //Result getObjOnRedis();
......
...@@ -10,12 +10,11 @@ import com.jz.common.utils.Result; ...@@ -10,12 +10,11 @@ import com.jz.common.utils.Result;
import com.jz.dm.common.enums.GeneralStatusTypeEnum; import com.jz.dm.common.enums.GeneralStatusTypeEnum;
import com.jz.dm.common.enums.apiInterface.ApiStatusEnum; import com.jz.dm.common.enums.apiInterface.ApiStatusEnum;
import com.jz.dm.common.enums.auth.AuthModeEnum; import com.jz.dm.common.enums.auth.AuthModeEnum;
import com.jz.dm.mapper.ApiAuthMapper; import com.jz.dm.mapper.*;
import com.jz.dm.mapper.ApiInterfaceCustomMapper;
import com.jz.dm.mapper.ApiInterfaceMapper;
import com.jz.dm.models.domian.ApiAuth; import com.jz.dm.models.domian.ApiAuth;
import com.jz.dm.models.domian.ApiInterface; import com.jz.dm.models.domian.ApiInterface;
import com.jz.dm.models.domian.ApiInterfaceCustom; import com.jz.dm.models.domian.ApiInterfaceCustom;
import com.jz.dm.models.dto.ApiServiceApplyDto;
import com.jz.dm.models.req.api.ApiInterfaceDetailReq; import com.jz.dm.models.req.api.ApiInterfaceDetailReq;
import com.jz.dm.models.req.api.ApiInterfaceInfoListReq; import com.jz.dm.models.req.api.ApiInterfaceInfoListReq;
import com.jz.dm.models.resp.SendDataReq; import com.jz.dm.models.resp.SendDataReq;
...@@ -27,6 +26,7 @@ import org.springframework.stereotype.Service; ...@@ -27,6 +26,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -46,7 +46,7 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService { ...@@ -46,7 +46,7 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
/** /**
* 测试url * 测试url
*/ */
public static final String testUrl =""; public static final String testUrl = "";
@Resource @Resource
private ApiInterfaceMapper apiInterfaceMapper; private ApiInterfaceMapper apiInterfaceMapper;
...@@ -54,6 +54,10 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService { ...@@ -54,6 +54,10 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
private ApiInterfaceCustomMapper apiInterfaceCustomMapper; private ApiInterfaceCustomMapper apiInterfaceCustomMapper;
@Resource @Resource
private ApiAuthMapper apiAuthMapper; private ApiAuthMapper apiAuthMapper;
@Resource
private ApiInterfaceFileMapper apiInterfaceFileMapper;
@Resource
private ApiReqLogMapper apiReqLogMapper;
@Autowired @Autowired
private HttpsUtils httpsUtils; private HttpsUtils httpsUtils;
...@@ -64,11 +68,11 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService { ...@@ -64,11 +68,11 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
* @return * @return
*/ */
@Override @Override
public IPage<ApiInterface > listCallApiInterface(ApiInterfaceInfoListReq req) { public IPage<ApiInterface> listCallApiInterface(ApiInterfaceInfoListReq req) {
IPage<ApiInterface > page = new Page<>(req.getPageNum(), req.getPageSize()); IPage<ApiInterface> page = new Page<>(req.getPageNum(), req.getPageSize());
QueryWrapper<ApiInterface > query = new QueryWrapper<>(); QueryWrapper<ApiInterface> query = new QueryWrapper<>();
if (StringUtils.isNotBlank(req.getApiKey())){ if (StringUtils.isNotBlank(req.getApiKey())) {
query.eq("ai.api_key",req.getApiKey()); query.eq("ai.api_key", req.getApiKey());
} }
query.eq("ai.is_deleted", 0); query.eq("ai.is_deleted", 0);
query.orderByDesc("ai.create_date"); query.orderByDesc("ai.create_date");
...@@ -79,15 +83,16 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService { ...@@ -79,15 +83,16 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
/** /**
* API---(未调用列表)列表查询 * API---(未调用列表)列表查询
*
* @param req * @param req
* @return * @return
*/ */
@Override @Override
public IPage<ApiInterface > listUnCallApiInterface(ApiInterfaceInfoListReq req) { public IPage<ApiInterface> listUnCallApiInterface(ApiInterfaceInfoListReq req) {
IPage<ApiInterface > page = new Page<>(req.getPageNum(), req.getPageSize()); IPage<ApiInterface> page = new Page<>(req.getPageNum(), req.getPageSize());
QueryWrapper<ApiInterface > query = new QueryWrapper<>(); QueryWrapper<ApiInterface> query = new QueryWrapper<>();
if (StringUtils.isNotBlank(req.getApiKey())){ if (StringUtils.isNotBlank(req.getApiKey())) {
query.eq("ai.api_key",req.getApiKey()); query.eq("ai.api_key", req.getApiKey());
} }
query.isNull("ar.api_key"); query.isNull("ar.api_key");
query.eq("ai.is_deleted", 0); query.eq("ai.is_deleted", 0);
...@@ -95,6 +100,38 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService { ...@@ -95,6 +100,38 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
return apiInterfaceMapper.listCallApiInterfaceInfo(page, query); return apiInterfaceMapper.listCallApiInterfaceInfo(page, query);
} }
/**
* 服务开发API列表
*
* @param req
* @return
*/
@Override
public Result listServerApplyApi(ApiInterfaceInfoListReq req) {
if (null == req.getProjectId()) {
return Result.of_error("工程id不能为空!");
}
List<Long> listFileIds = null;
if (null == req.getFileId()) {
listFileIds = apiInterfaceFileMapper.getProjectFileFolders(req.getProjectId(),null);
}
IPage<ApiServiceApplyDto> page = new Page<>(req.getPageNum(), req.getPageSize());
QueryWrapper<ApiServiceApplyDto> query = new QueryWrapper<>();
if (null == req.getFileId()) {
query.in("ai.file_id", listFileIds);
} else {
query.eq("ai.file_id", req.getFileId());
}
if (StringUtils.isNotBlank(req.getApiName())){
query.eq("ai.api_name",req.getApiName());
}
if (StringUtils.isNotBlank(req.getStatus())){
query.eq("ai.status",req.getStatus());
}
query.orderByDesc("ai.create_date");
return Result.of_success(apiInterfaceMapper.listApiDetail(page,query));
}
/** /**
* 获取API详情信息 * 获取API详情信息
* *
...@@ -105,7 +142,22 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService { ...@@ -105,7 +142,22 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
public Result getApiInterfaceDetail(ApiInterfaceDetailReq req) { public Result getApiInterfaceDetail(ApiInterfaceDetailReq req) {
return Result.of_success(apiInterfaceMapper.selectDetail(req)); return Result.of_success(apiInterfaceMapper.selectDetail(req));
} }
/**
* api计量统计
* @param date
* @return
*/
@Override
public Result countAPiCallStat(String date) {
Date dateParam = null;
try {
SimpleDateFormat dateFormat = new SimpleDateFormat("YYYY-MM");
dateParam = dateFormat.parse(date);
} catch (Exception ex) {
log.error("时间转换异常:{}", ex.getMessage());
}
return Result.of_success(apiReqLogMapper.countApiCallMonthData(dateParam));
}
/** /**
* 删除API信息 * 删除API信息
* *
...@@ -228,15 +280,16 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService { ...@@ -228,15 +280,16 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
/** /**
* 获取api自定义信息 * 获取api自定义信息
*
* @param apiInterfaceId * @param apiInterfaceId
* @return * @return
*/ */
@Override @Override
public ApiInterfaceCustom getApiCustomInfo(Long apiInterfaceId) { public ApiInterfaceCustom getApiCustomInfo(Long apiInterfaceId) {
QueryWrapper<ApiInterfaceCustom> queryWra = new QueryWrapper<>(); QueryWrapper<ApiInterfaceCustom> queryWra = new QueryWrapper<>();
queryWra.eq("api_interface_id",apiInterfaceId); queryWra.eq("api_interface_id", apiInterfaceId);
queryWra.eq("is_deleted",0); queryWra.eq("is_deleted", 0);
return apiInterfaceCustomMapper.selectOne(queryWra) ; return apiInterfaceCustomMapper.selectOne(queryWra);
} }
/** /**
...@@ -290,48 +343,48 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService { ...@@ -290,48 +343,48 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
/** /**
* 更新APi是否发送到数据银行状态 * 更新APi是否发送到数据银行状态
*
* @param apiKey * @param apiKey
* @return * @return
*/ */
@Override @Override
public Result updateApiSendStatus(String apiKey) { public Result updateApiSendStatus(String apiKey) {
QueryWrapper<ApiInterface> queryWra = new QueryWrapper<>(); QueryWrapper<ApiInterface> queryWra = new QueryWrapper<>();
queryWra.eq("api_key",apiKey); queryWra.eq("api_key", apiKey);
queryWra.eq("is_deleted",0); queryWra.eq("is_deleted", 0);
ApiInterface apiInterface = apiInterfaceMapper.selectOne(queryWra); ApiInterface apiInterface = apiInterfaceMapper.selectOne(queryWra);
if (null == apiInterface){ if (null == apiInterface) {
return Result.of_error(ResultMsg.DATA_NOT_FOUND); return Result.of_error(ResultMsg.DATA_NOT_FOUND);
} }
UpdateWrapper<ApiInterface> updateWra = new UpdateWrapper<>(); UpdateWrapper<ApiInterface> updateWra = new UpdateWrapper<>();
updateWra.set("is_send_bank",0); updateWra.set("is_send_bank", 0);
if (apiInterfaceMapper.update(null,updateWra) > 0){ if (apiInterfaceMapper.update(null, updateWra) > 0) {
return Result.of_success(ResultMsg.UPDATE_SUCCESS); return Result.of_success(ResultMsg.UPDATE_SUCCESS);
} }
return Result.of_error(ResultMsg.UPDATE_FAIL); return Result.of_error(ResultMsg.UPDATE_FAIL);
} }
/** /**
*
* @param req * @param req
* @return * @return
*/ */
@Override @Override
public Result getSendDataBankList(SendDataReq req) { public Result getSendDataBankList(SendDataReq req) {
IPage<ApiInterface> page = new Page<>(req.getPageNum(), req.getPageSize()); IPage<ApiInterface> page = new Page<>(req.getPageNum(), req.getPageSize());
QueryWrapper<ApiInterface > query = new QueryWrapper<>(); QueryWrapper<ApiInterface> query = new QueryWrapper<>();
if (StringUtils.isNotBlank(req.getApiType())){ if (StringUtils.isNotBlank(req.getApiType())) {
query.eq("api_type",req.getApiType()); query.eq("api_type", req.getApiType());
} }
if (StringUtils.isNotBlank(req.getOutputType())){ if (StringUtils.isNotBlank(req.getOutputType())) {
query.eq("output_type",req.getOutputType()); query.eq("output_type", req.getOutputType());
} }
if (StringUtils.isNotBlank(req.getStartTime()) && StringUtils.isNotBlank(req.getEndTime())){ if (StringUtils.isNotBlank(req.getStartTime()) && StringUtils.isNotBlank(req.getEndTime())) {
query.between("create_date",req.getStartTime(),req.getEndTime()); query.between("create_date", req.getStartTime(), req.getEndTime());
} }
query.and(wrapper -> wrapper.like("api_name",req.getKey())); query.and(wrapper -> wrapper.like("api_name", req.getKey()));
query.eq("is_send_bank",1); query.eq("is_send_bank", 1);
query.eq("status",ApiStatusEnum.ISSUE.name()); query.eq("status", ApiStatusEnum.ISSUE.name());
query.eq("is_deleted",0); query.eq("is_deleted", 0);
return Result.of_success(apiInterfaceMapper.selectPage(page, query)); return Result.of_success(apiInterfaceMapper.selectPage(page, query));
} }
} }
...@@ -23,7 +23,6 @@ import org.springframework.stereotype.Service; ...@@ -23,7 +23,6 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
/** /**
...@@ -74,7 +73,7 @@ public class ApiLogServiceImpl implements ApiLogService { ...@@ -74,7 +73,7 @@ public class ApiLogServiceImpl implements ApiLogService {
query.eq("is_deleted", 0); query.eq("is_deleted", 0);
query.orderByDesc("create_date"); query.orderByDesc("create_date");
IPage<ApiReqLog> apiReqLogIPage = apiReqLogMapper.selectPage(page, query); IPage<ApiReqLog> apiReqLogIPage = apiReqLogMapper.selectPage(page, query);
// 数据银行-历史查询返回参数 // 数据银行-历史查询返回参数 TODO 需要优化日志查询
if (req.getHistoryQuery().equals("01") && req.getHistoryQuery() != null) { if (req.getHistoryQuery().equals("01") && req.getHistoryQuery() != null) {
for (ApiReqLog record : apiReqLogIPage.getRecords()) { for (ApiReqLog record : apiReqLogIPage.getRecords()) {
DataBankNumberErrorReq errorReq = new DataBankNumberErrorReq(); DataBankNumberErrorReq errorReq = new DataBankNumberErrorReq();
...@@ -117,23 +116,7 @@ public class ApiLogServiceImpl implements ApiLogService { ...@@ -117,23 +116,7 @@ public class ApiLogServiceImpl implements ApiLogService {
apiReqLogMapper.insert(reqLog); apiReqLogMapper.insert(reqLog);
} }
/**
* api计量统计
*
* @param date
* @return
*/
@Override
public Result countAPiCallStat(String date) {
Date dateParam = null;
try {
SimpleDateFormat dateFormat = new SimpleDateFormat("YYYY-MM");
dateParam = dateFormat.parse(date);
} catch (Exception ex) {
log.error("时间转换异常:{}", ex.getMessage());
}
return Result.of_success(apiReqLogMapper.countApiCallMonthData(dateParam));
}
/** /**
* 查询用户调用数和错误率-数据银行 * 查询用户调用数和错误率-数据银行
......
...@@ -12,13 +12,13 @@ import com.jz.dm.common.enums.auth.AuthModeEnum; ...@@ -12,13 +12,13 @@ import com.jz.dm.common.enums.auth.AuthModeEnum;
import com.jz.dm.common.util.DateUtil; import com.jz.dm.common.util.DateUtil;
import com.jz.dm.common.util.RandomUtil; import com.jz.dm.common.util.RandomUtil;
import com.jz.dm.mapper.ApiAuthMapper; import com.jz.dm.mapper.ApiAuthMapper;
import com.jz.dm.mapper.ApiInterfaceFileMapper;
import com.jz.dm.mapper.ApiInterfaceMapper; import com.jz.dm.mapper.ApiInterfaceMapper;
import com.jz.dm.mapper.ApiOrgMapper; import com.jz.dm.mapper.ApiOrgMapper;
import com.jz.dm.models.domian.ApiAuth; import com.jz.dm.models.domian.ApiAuth;
import com.jz.dm.models.domian.ApiInterface; import com.jz.dm.models.domian.ApiInterface;
import com.jz.dm.models.domian.ApiOrg; import com.jz.dm.models.domian.ApiOrg;
import com.jz.dm.models.dto.ApiServiceApplyDto; import com.jz.dm.models.dto.ApiServiceApplyDto;
import com.jz.dm.models.dto.AuthInfoDto;
import com.jz.dm.models.req.auth.*; import com.jz.dm.models.req.auth.*;
import com.jz.dm.models.resp.AuthUserResponse; import com.jz.dm.models.resp.AuthUserResponse;
import com.jz.dm.service.AuthService; import com.jz.dm.service.AuthService;
...@@ -31,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -31,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date; import java.util.Date;
import java.util.List;
import static com.jz.dm.common.enums.auth.AuthModeEnum.fromTypeModeName; import static com.jz.dm.common.enums.auth.AuthModeEnum.fromTypeModeName;
import static com.jz.dm.common.enums.auth.AuthTypeEnum.fromAuthTypeName; import static com.jz.dm.common.enums.auth.AuthTypeEnum.fromAuthTypeName;
...@@ -55,13 +56,15 @@ public class AuthServiceImpl implements AuthService { ...@@ -55,13 +56,15 @@ public class AuthServiceImpl implements AuthService {
private ApiInterfaceMapper apiInterfaceMapper; private ApiInterfaceMapper apiInterfaceMapper;
@Resource @Resource
private ApiOrgMapper apiOrgMapper; private ApiOrgMapper apiOrgMapper;
@Resource
private ApiInterfaceFileMapper apiInterfaceFileMapper;
/** /* *//**
* 认证信息列表 * 认证信息列表
* *
* @param req * @param req
* @return * @return
*/ *//*
@Override @Override
public Result getAuthListInfo(AuthListInfoReq req) { public Result getAuthListInfo(AuthListInfoReq req) {
IPage<AuthInfoDto> page = new Page<>(req.getPageNum(), req.getPageSize()); IPage<AuthInfoDto> page = new Page<>(req.getPageNum(), req.getPageSize());
...@@ -76,7 +79,7 @@ public class AuthServiceImpl implements AuthService { ...@@ -76,7 +79,7 @@ public class AuthServiceImpl implements AuthService {
query.orderByDesc("au.create_date"); query.orderByDesc("au.create_date");
IPage<AuthInfoDto> listSelectApiAuth = apiAuthMapper.listSelectApiAuth(page, query); IPage<AuthInfoDto> listSelectApiAuth = apiAuthMapper.listSelectApiAuth(page, query);
return Result.of_success(listSelectApiAuth); return Result.of_success(listSelectApiAuth);
} }*/
/** /**
* 认证信息详情 * 认证信息详情
...@@ -96,28 +99,34 @@ public class AuthServiceImpl implements AuthService { ...@@ -96,28 +99,34 @@ public class AuthServiceImpl implements AuthService {
*/ */
@Override @Override
public Result getServiceAuthList(ServiceAuthReq req) { public Result getServiceAuthList(ServiceAuthReq req) {
List<Long> listFileIds = null;
if (null == req.getFileId()) {
listFileIds = apiInterfaceFileMapper.getProjectFileFolders(null,req.getOrgCode());
}
IPage<ApiServiceApplyDto> page = new Page<>(req.getPageNum(), req.getPageSize()); IPage<ApiServiceApplyDto> page = new Page<>(req.getPageNum(), req.getPageSize());
QueryWrapper<ApiServiceApplyDto> query = new QueryWrapper<>(); QueryWrapper<ApiServiceApplyDto> query = new QueryWrapper<>();
if (null != req.getFolderId()){ if (null == req.getFileId()) {
query.eq("ai.file_id",req.getFolderId()); query.in("ai.file_id", listFileIds);
} else {
query.eq("ai.file_id", req.getFileId());
} }
if (StringUtils.isNotBlank(req.getApiName())){ if (StringUtils.isNotBlank(req.getApiName())){
query.eq("ai.api_name",req.getApiName()); query.eq("ai.api_name",req.getApiName());
} }
if (StringUtils.isNotBlank(req.getApiId())){ if (StringUtils.isNotBlank(req.getOrgName())){
query.eq("ai.api_key",req.getApiId()); query.like("au.org_name",req.getOrgName());
} }
query.eq("ai.is_deleted",0); query.eq("ai.is_deleted",0);
query.orderByDesc("ai.create_time"); query.orderByDesc("au.create_time");
return Result.of_success(apiInterfaceMapper.listApiAuthService(page, query)); return Result.of_success(apiInterfaceMapper.listApiAuthService(page, query));
} }
/** /* *//**
* 添加dmp认证信息 * 添加dmp认证信息
* *
* @param req * @param req
* @return * @return
*/ *//*
@Override @Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW) @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public Result addDmpUserApiAuth(AuthUserApiReq req) { public Result addDmpUserApiAuth(AuthUserApiReq req) {
...@@ -128,7 +137,7 @@ public class AuthServiceImpl implements AuthService { ...@@ -128,7 +137,7 @@ public class AuthServiceImpl implements AuthService {
if (ApiStatusEnum.DRAFT.name().equals(apiInterface.getStatus())){ if (ApiStatusEnum.DRAFT.name().equals(apiInterface.getStatus())){
return Result.of_error("api未发布,无法授权"); return Result.of_error("api未发布,无法授权");
} }
if (ApiStatusEnum.EXPIRY.name().equals(apiInterface.getStatus())) { if () {
return Result.of_error("api已下架,无法授权"); return Result.of_error("api已下架,无法授权");
} }
ApiOrg apiOrg = apiOrgMapper.selectOne(new QueryWrapper<ApiOrg>().eq("org_code", req.getOrgCode())); ApiOrg apiOrg = apiOrgMapper.selectOne(new QueryWrapper<ApiOrg>().eq("org_code", req.getOrgCode()));
...@@ -155,21 +164,22 @@ public class AuthServiceImpl implements AuthService { ...@@ -155,21 +164,22 @@ public class AuthServiceImpl implements AuthService {
} }
return saveAuthInfo(apiInterface, apiOrg, req); return saveAuthInfo(apiInterface, apiOrg, req);
} }
*/
/** /**
* 添加商城用户认证信息 * 数据银行/DMP用户---授权
* *
* @param req * @param req
* @return * @return
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW) @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public Result addMallUserApiAuth(AuthUserApiReq req) { public Result addUserApiAuth(AuthUserApiReq req) {
ApiInterface apiInterface = getInterface(req.getApiKey()); ApiInterface apiInterface = getInterface(req.getApiKey());
if (null == apiInterface) { if (null == apiInterface) {
return Result.of_error("api授权信息不存在!"); return Result.of_error("api授权信息不存在!");
} }
if (ApiStatusEnum.SOLDOUT.name().equals(apiInterface.getStatus())) { if (ApiStatusEnum.SOLDOUT.name().equals(apiInterface.getStatus())
|| ApiStatusEnum.EXPIRY.name().equals(apiInterface.getStatus())) {
return Result.of_error("api已下架,无法授权"); return Result.of_error("api已下架,无法授权");
} }
if (ApiStatusEnum.DRAFT.name().equals(apiInterface.getStatus())){ if (ApiStatusEnum.DRAFT.name().equals(apiInterface.getStatus())){
...@@ -191,11 +201,6 @@ public class AuthServiceImpl implements AuthService { ...@@ -191,11 +201,6 @@ public class AuthServiceImpl implements AuthService {
return Result.of_error("授权方式不存在!"); return Result.of_error("授权方式不存在!");
} }
} }
//认证类型为永久授权
if (StringUtils.isNotBlank(req.getAuthMode()) &&
AuthModeEnum.PERMANENT_TIME_MODE.name().equals(req.getAuthMode())) {
return Result.of_error("授权类型错误!");
}
//认证类型 //认证类型
if (StringUtils.isNotBlank(req.getAuthMode()) && if (StringUtils.isNotBlank(req.getAuthMode()) &&
AuthModeEnum.RECORD_TIME_MODE.name().equals(req.getAuthMode())) { AuthModeEnum.RECORD_TIME_MODE.name().equals(req.getAuthMode())) {
...@@ -241,6 +246,7 @@ public class AuthServiceImpl implements AuthService { ...@@ -241,6 +246,7 @@ public class AuthServiceImpl implements AuthService {
return Result.of_error(ResultMsg.INSERT_FAIL); return Result.of_error(ResultMsg.INSERT_FAIL);
} }
/** /**
* 获取授权码 * 获取授权码
* *
...@@ -300,7 +306,7 @@ public class AuthServiceImpl implements AuthService { ...@@ -300,7 +306,7 @@ public class AuthServiceImpl implements AuthService {
UpdateWrapper<ApiAuth> update = new UpdateWrapper<>(); UpdateWrapper<ApiAuth> update = new UpdateWrapper<>();
update.set("salt", salt); update.set("salt", salt);
update.set("update_date", new Date()); update.set("update_date", new Date());
update.set("update_user", req.getCreateUser()); update.set("update_user", req.getUpdateUser());
update.eq("id", apiAuth.getId()); update.eq("id", apiAuth.getId());
if (apiAuthMapper.update(null, update) > 0) { if (apiAuthMapper.update(null, update) > 0) {
response.setSalt(salt); response.setSalt(salt);
...@@ -356,11 +362,11 @@ public class AuthServiceImpl implements AuthService { ...@@ -356,11 +362,11 @@ public class AuthServiceImpl implements AuthService {
return apiAuthMapper.update(null,update); return apiAuthMapper.update(null,update);
} }
/** /* *//**
* 模糊查询/ * 模糊查询/
* @param key * @param key
* @return * @return
*/ *//*
@Override @Override
public Result getAuthNameList(String key) { public Result getAuthNameList(String key) {
QueryWrapper<ApiOrg> query = new QueryWrapper<>(); QueryWrapper<ApiOrg> query = new QueryWrapper<>();
...@@ -370,7 +376,7 @@ public class AuthServiceImpl implements AuthService { ...@@ -370,7 +376,7 @@ public class AuthServiceImpl implements AuthService {
.or().like("linkman",key)); .or().like("linkman",key));
} }
return Result.of_success(apiOrgMapper.selectList(query)); return Result.of_success(apiOrgMapper.selectList(query));
} }*/
private ApiInterface getInterface(String apiKey) { private ApiInterface getInterface(String apiKey) {
QueryWrapper<ApiInterface> queryInface = new QueryWrapper<>(); QueryWrapper<ApiInterface> queryInface = new QueryWrapper<>();
......
...@@ -8,7 +8,6 @@ import com.jz.common.constant.ResultMsg; ...@@ -8,7 +8,6 @@ import com.jz.common.constant.ResultMsg;
import com.jz.common.utils.Result; import com.jz.common.utils.Result;
import com.jz.dm.mapper.ApiInterfaceFileMapper; import com.jz.dm.mapper.ApiInterfaceFileMapper;
import com.jz.dm.mapper.ApiOrgMapper; import com.jz.dm.mapper.ApiOrgMapper;
import com.jz.dm.models.domian.ApiInterfaceFile;
import com.jz.dm.models.domian.ApiOrg; import com.jz.dm.models.domian.ApiOrg;
import com.jz.dm.models.req.organizationManage.OrganizationManageAddReq; import com.jz.dm.models.req.organizationManage.OrganizationManageAddReq;
import com.jz.dm.models.req.organizationManage.OrganizationManageDetailQueryReq; import com.jz.dm.models.req.organizationManage.OrganizationManageDetailQueryReq;
...@@ -21,6 +20,7 @@ import org.springframework.stereotype.Service; ...@@ -21,6 +20,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @author ZC * @author ZC
...@@ -57,9 +57,6 @@ public class OrganizationManageImpl implements OrganizationManageService { ...@@ -57,9 +57,6 @@ public class OrganizationManageImpl implements OrganizationManageService {
if (StringUtils.isNotBlank(req.getLinkman())) { if (StringUtils.isNotBlank(req.getLinkman())) {
query.like("linkman", req.getLinkman()); query.like("linkman", req.getLinkman());
} }
if (StringUtils.isNotBlank(req.getOrgCode())) {
query.eq("org_code", req.getOrgCode());
}
if (null != req.getFileId()){ if (null != req.getFileId()){
query.eq("org_folder_id",req.getFileId()); query.eq("org_folder_id",req.getFileId());
} }
...@@ -102,11 +99,10 @@ public class OrganizationManageImpl implements OrganizationManageService { ...@@ -102,11 +99,10 @@ public class OrganizationManageImpl implements OrganizationManageService {
return Result.of_error("组织名称已存在!"); return Result.of_error("组织名称已存在!");
} }
} }
if (null != req.getOrgFolderId() && !req.getOrgFolderId().equals(org.getOrgFolderId())) { List<Long> fileFolders = apiInterfaceFileMapper.getProjectFileFolders(null, org.getOrgCode());
if (checkOrgFolderIsExist(req.getOrgFolderId())) { if (!fileFolders.contains(req.getOrgFolderId())){
return Result.of_error("目标文件夹不存在!"); return Result.of_error("目标文件夹不存在!");
} }
}
org.setUpdateDate(new Date()); org.setUpdateDate(new Date());
org.setOrgName(req.getOrgName()); org.setOrgName(req.getOrgName());
org.setLinkman(req.getLinkman()); org.setLinkman(req.getLinkman());
...@@ -146,26 +142,6 @@ public class OrganizationManageImpl implements OrganizationManageService { ...@@ -146,26 +142,6 @@ public class OrganizationManageImpl implements OrganizationManageService {
return false; return false;
} }
/**
* 校验组织文件夹是否存在
*
* @param folderId
* @return
*/
private boolean checkOrgFolderIsExist(Long folderId) {
if (null == folderId) {
return true;
}
QueryWrapper<ApiInterfaceFile> query = new QueryWrapper<>();
query.eq("id", folderId);
query.eq("file_source", 2);
query.eq("is_deleted", 0);
ApiInterfaceFile apiInterfaceFile = apiInterfaceFileMapper.selectOne(query);
if (null != apiInterfaceFile) {
return true;
}
return false;
}
/** /**
* 添加组织 * 添加组织
...@@ -246,5 +222,12 @@ public class OrganizationManageImpl implements OrganizationManageService { ...@@ -246,5 +222,12 @@ public class OrganizationManageImpl implements OrganizationManageService {
query.eq("is_deleted", 0); query.eq("is_deleted", 0);
return apiOrgMapper.selectOne(query); return apiOrgMapper.selectOne(query);
} }
@Override
public ApiOrg getOrganization(String orgCode) {
QueryWrapper<ApiOrg> query = new QueryWrapper<>();
query.eq("org_code", orgCode);
query.eq("status", 1);
query.eq("is_deleted", 0);
return apiOrgMapper.selectOne(query);
}
} }
...@@ -4,8 +4,6 @@ import com.alibaba.fastjson.JSONArray; ...@@ -4,8 +4,6 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jz.common.constant.ResultMsg; import com.jz.common.constant.ResultMsg;
import com.jz.common.exception.ResponseException; import com.jz.common.exception.ResponseException;
import com.jz.common.utils.HttpsUtils; import com.jz.common.utils.HttpsUtils;
...@@ -20,15 +18,10 @@ import com.jz.dm.mapper.ApiInterfaceCustomMapper; ...@@ -20,15 +18,10 @@ import com.jz.dm.mapper.ApiInterfaceCustomMapper;
import com.jz.dm.mapper.ApiInterfaceFileMapper; import com.jz.dm.mapper.ApiInterfaceFileMapper;
import com.jz.dm.mapper.ApiInterfaceMapper; import com.jz.dm.mapper.ApiInterfaceMapper;
import com.jz.dm.mapper.ApiOpenApiEsFieldsMapper; import com.jz.dm.mapper.ApiOpenApiEsFieldsMapper;
import com.jz.dm.models.domian.ApiInterface; import com.jz.dm.models.domian.*;
import com.jz.dm.models.domian.ApiInterfaceCustom;
import com.jz.dm.models.domian.ApiInterfaceFile;
import com.jz.dm.models.domian.ApiOpenApiEsFields;
import com.jz.dm.models.dto.ApiServiceApplyDto;
import com.jz.dm.models.dto.DataFileDto; import com.jz.dm.models.dto.DataFileDto;
import com.jz.dm.models.req.folder.CreateFolderReq; import com.jz.dm.models.req.folder.CreateFolderReq;
import com.jz.dm.models.req.producer.ApiInterfaceReq; import com.jz.dm.models.req.producer.ApiInterfaceReq;
import com.jz.dm.models.req.producer.ServiceIssueReq;
import com.jz.dm.service.ApiInterfaceService; import com.jz.dm.service.ApiInterfaceService;
import com.jz.dm.service.ProducerService; import com.jz.dm.service.ProducerService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -61,6 +54,7 @@ public class ProducerServiceImpl implements ProducerService { ...@@ -61,6 +54,7 @@ public class ProducerServiceImpl implements ProducerService {
@Resource @Resource
private ApiInterfaceMapper apiInterfaceMapper; private ApiInterfaceMapper apiInterfaceMapper;
@Resource @Resource
private ApiOpenApiEsFieldsMapper apiOpenApiEsFieldsMapper; private ApiOpenApiEsFieldsMapper apiOpenApiEsFieldsMapper;
@Resource @Resource
...@@ -70,6 +64,8 @@ public class ProducerServiceImpl implements ProducerService { ...@@ -70,6 +64,8 @@ public class ProducerServiceImpl implements ProducerService {
@Autowired @Autowired
private ApiInterfaceService apiInterfaceService; private ApiInterfaceService apiInterfaceService;
@Autowired @Autowired
private com.jz.dm.service.OrganizationManageService organizationManageService;
@Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
@Autowired @Autowired
private HttpsUtils httpsUtils; private HttpsUtils httpsUtils;
...@@ -95,37 +91,37 @@ public class ProducerServiceImpl implements ProducerService { ...@@ -95,37 +91,37 @@ public class ProducerServiceImpl implements ProducerService {
* 获取文件列表 * 获取文件列表
* *
* @param projectId * @param projectId
* @param orgCode
* @return * @return
*/ */
@Override @Override
public Result getFileCatalog(Long projectId) { public Result getFileCatalog(Long projectId, String orgCode) {
List<DataFileDto> interfaceFiles = apiInterfaceFileMapper.listFileFolders(projectId); List<DataFileDto> interfaceFiles = null;
ArrayList<DataFileDto> children=null; if (null != projectId) {
interfaceFiles = apiInterfaceFileMapper.listFileFolders(projectId, null);
} else if (StringUtils.isNotBlank(orgCode)) {
interfaceFiles = apiInterfaceFileMapper.listFileFolders(null, orgCode);
}
ArrayList<DataFileDto> children = null;
if (CollectionUtils.isNotEmpty(interfaceFiles)) { if (CollectionUtils.isNotEmpty(interfaceFiles)) {
// for (ApiInterfaceFile interfaceFile : interfaceFiles) { children = recursiveTree(0L, interfaceFiles);
//if (0 == interfaceFile.getParentId()){ }
children = recursiveTree(0L, interfaceFiles);
//}
// }
}
return Result.of_success(children); return Result.of_success(children);
//return Result.of_success(apiInterfaceFileMapper.getFileFolderLevel(projectId));
//return Result.of_success(apiInterfaceFileMapper.getFileFolderLevel(projectId));
} }
private ArrayList<DataFileDto> recursiveTree(Long parentId, List<DataFileDto> allList) { private ArrayList<DataFileDto> recursiveTree(Long parentId, List<DataFileDto> allList) {
ArrayList<DataFileDto> files = new ArrayList<>(); ArrayList<DataFileDto> files = new ArrayList<>();
for (DataFileDto interfaceFile : allList) { for (DataFileDto interfaceFile : allList) {
if (Objects.equals(parentId,interfaceFile.getParentId())){ if (Objects.equals(parentId, interfaceFile.getParentId())) {
DataFileDto file = new DataFileDto(); DataFileDto file = new DataFileDto();
file.setId(interfaceFile.getId()); file.setId(interfaceFile.getId());
file.setProjectId(interfaceFile.getProjectId()); file.setProjectId(interfaceFile.getProjectId());
file.setParentId(interfaceFile.getParentId()); file.setParentId(interfaceFile.getParentId());
file.setChildren(recursiveTree(interfaceFile.getId(),allList)); file.setChildren(recursiveTree(interfaceFile.getId(), allList));
files.add(file); files.add(file);
} }
} }
/* files.forEach(System.out::println);*/
return files; return files;
} }
...@@ -156,6 +152,10 @@ public class ProducerServiceImpl implements ProducerService { ...@@ -156,6 +152,10 @@ public class ProducerServiceImpl implements ProducerService {
} }
} else if (StringUtils.isNotBlank(req.getFileSource()) && } else if (StringUtils.isNotBlank(req.getFileSource()) &&
"2".equals(req.getFileSource())) { //组织创建文件夹 "2".equals(req.getFileSource())) { //组织创建文件夹
ApiOrg apiOrg = organizationManageService.getOrganization(req.getOrgCode());
if (null == apiOrg) {
return Result.of_error("组织信息不存在!");
}
if (!addFolder(req)) { if (!addFolder(req)) {
return Result.of_success(ResultMsg.INSERT_SUCCESS); return Result.of_success(ResultMsg.INSERT_SUCCESS);
} }
...@@ -182,32 +182,10 @@ public class ProducerServiceImpl implements ProducerService { ...@@ -182,32 +182,10 @@ public class ProducerServiceImpl implements ProducerService {
return false; return false;
} }
/**
* 获取服务发布列表
*
* @param req
* @return
*/
@Override
public Result getServiceIssueList(ServiceIssueReq req) {
IPage<ApiServiceApplyDto> page = new Page<>(req.getPageNum(), req.getPageSize());
QueryWrapper<ApiServiceApplyDto> query = new QueryWrapper<>();
if (null != req.getFileId()) {
query.eq("ai.file_id", req.getFileId());
}
if (StringUtils.isNotBlank(req.getApiName())) {
query.eq("ai.api_name", req.getApiName());
}
if (StringUtils.isNotBlank(req.getApiId())) {
query.eq("ai.api_key", req.getApiId());
}
query.eq("ai.is_deleted", 0);
query.orderByDesc("ai.create_date");
return Result.of_success(apiInterfaceMapper.listApiIssueService(page, query));
}
/** /**
* 服务发布取消操作 * 服务发布/取消操作
* *
* @param id * @param id
* @param optStatus * @param optStatus
...@@ -244,6 +222,29 @@ public class ProducerServiceImpl implements ProducerService { ...@@ -244,6 +222,29 @@ public class ProducerServiceImpl implements ProducerService {
return Result.of_error(ResultMsg.UPDATE_FAIL); return Result.of_error(ResultMsg.UPDATE_FAIL);
} }
/**
* 服务开发--上传
* @param id
* @return
*/
@Override
public Result serverUpload(Long id) {
ApiInterface apiInterface = apiInterfaceMapper.selectById(id);
if (null == apiInterface){
return Result.of_error("API信息不存在!");
}
//已上传的直接返回,防止重复提交
if (apiInterface.getIsSendBank()){
return Result.of_success(ResultMsg.UPDATE_SUCCESS);
}
UpdateWrapper<ApiInterface> updateWra = new UpdateWrapper<>();
updateWra.set("is_send_bank",1);
if (apiInterfaceMapper.update(null,updateWra) == 0){
return Result.of_error(ResultMsg.UPDATE_FAIL);
}
return Result.of_success(ResultMsg.UPDATE_SUCCESS);
}
/** /**
* 获取ApiId * 获取ApiId
* *
...@@ -264,7 +265,7 @@ public class ProducerServiceImpl implements ProducerService { ...@@ -264,7 +265,7 @@ public class ProducerServiceImpl implements ProducerService {
@Override @Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW) @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public Result addBigDataMakeApi(ApiInterfaceReq req) { public Result addBigDataMakeApi(ApiInterfaceReq req) {
ApiInterface anInterface = apiInterfaceService.getApiInfo(req.apiKey); ApiInterface anInterface = apiInterfaceService.getApiInfo(req.getApiKey());
if (null != anInterface) { if (null != anInterface) {
return Result.of_error("API已存在!"); return Result.of_error("API已存在!");
} }
...@@ -280,21 +281,21 @@ public class ProducerServiceImpl implements ProducerService { ...@@ -280,21 +281,21 @@ public class ProducerServiceImpl implements ProducerService {
return Result.of_error("限流次数不能小于或者等于零"); return Result.of_error("限流次数不能小于或者等于零");
} }
} }
if (null == req.getSignType() || 0 == req.getSignType()) {
return Result.of_error("加密类型错误!");
}
if (StringUtils.isNotBlank(req.getLimitType())) { if (StringUtils.isNotBlank(req.getLimitType())) {
if (null == fromAuthReqTypeEnum(req.getLimitType())) { if (null == fromAuthReqTypeEnum(req.getLimitType())) {
return Result.of_error("限流类型不存在!"); return Result.of_error("限流类型不存在!");
} }
} }
//校验文件夹信息 //校验文件夹信息
if (checkFileifExist(req.getFileId(), req.getProjectId())) { if (checkFileIfExist(req.getFileId())) {
return Result.of_error("目标文件夹不存在!"); return Result.of_error("目标文件夹不存在!");
} }
//保存表字段信息 //保存表字段信息
saveTableField(req); saveTableField(req);
if (null != req.getId()) {//更新 if (null != req.getId()) {//更新
if (!ApiStatusEnum.DRAFT.name().equals(anInterface.getStatus())) {
return Result.of_error("非草稿状态API不允许编辑!");
}
if (saveUpdateAPiBaseData(req) || saveUpdateApiExtendData(req)) { if (saveUpdateAPiBaseData(req) || saveUpdateApiExtendData(req)) {
throw ResponseException.of_error(ResultMsg.UPDATE_FAIL); throw ResponseException.of_error(ResultMsg.UPDATE_FAIL);
} }
...@@ -311,7 +312,6 @@ public class ProducerServiceImpl implements ProducerService { ...@@ -311,7 +312,6 @@ public class ProducerServiceImpl implements ProducerService {
/** /**
* 数据表查询 && 保存表字段信息 * 数据表查询 && 保存表字段信息
*
* @param req * @param req
*/ */
private void saveTableField(ApiInterfaceReq req) { private void saveTableField(ApiInterfaceReq req) {
...@@ -359,7 +359,7 @@ public class ProducerServiceImpl implements ProducerService { ...@@ -359,7 +359,7 @@ public class ProducerServiceImpl implements ProducerService {
@Override @Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public Result saveInterfaceAPi(ApiInterfaceReq req) { public Result saveInterfaceAPi(ApiInterfaceReq req) {
ApiInterface anInterface = apiInterfaceService.getApiInfo(req.apiKey); ApiInterface anInterface = apiInterfaceService.getApiInfo(req.getApiKey());
if (null != anInterface) { if (null != anInterface) {
return Result.of_error("API已存在!"); return Result.of_error("API已存在!");
} }
...@@ -380,7 +380,7 @@ public class ProducerServiceImpl implements ProducerService { ...@@ -380,7 +380,7 @@ public class ProducerServiceImpl implements ProducerService {
return Result.of_error("目标地址不存在!"); return Result.of_error("目标地址不存在!");
} }
//校验文件夹信息 //校验文件夹信息
if (checkFileifExist(req.getFileId(), req.getProjectId())) { if (checkFileIfExist(req.getFileId())) {
return Result.of_error("目标文件夹不存在!"); return Result.of_error("目标文件夹不存在!");
} }
ApiInterface apiInterface = saveApiBaseData(req); ApiInterface apiInterface = saveApiBaseData(req);
...@@ -419,20 +419,17 @@ public class ProducerServiceImpl implements ProducerService { ...@@ -419,20 +419,17 @@ public class ProducerServiceImpl implements ProducerService {
ApiInterface apiInterface = new ApiInterface(); ApiInterface apiInterface = new ApiInterface();
BeanUtils.copyProperties(req, apiInterface); BeanUtils.copyProperties(req, apiInterface);
apiInterface.setStatus(ApiStatusEnum.DRAFT.name());//草稿状态 apiInterface.setStatus(ApiStatusEnum.DRAFT.name());//草稿状态
apiInterface.setOutputType(ApiInfoOutTypeEnum.JSON.name());//输出类型默认为Json /*apiInterface.setOutputType(ApiInfoOutTypeEnum.JSON.name());//输出类型默认为Json*/
Long timeout = Long.parseLong(req.getTimeout()); if (req.getTimeout() < 0) {
if (timeout == null || timeout == 0) {
apiInterface.setTimeout(String.valueOf(defaultTimeout));
} else if (timeout < 0) {
throw ResponseException.of_error("接口超时时间最小0ms"); throw ResponseException.of_error("接口超时时间最小0ms");
} else if (timeout > maxTimeout) { } else if (req.getTimeout() > maxTimeout) {
throw ResponseException.of_error("接口超时时间最大5000ms"); throw ResponseException.of_error("接口超时时间最大" + maxTimeout + "ms");
} }
apiInterface.setTimeout(req.getTimeout()); /* apiInterface.setTimeout(req.getTimeout());*/
if ("10002".equals(req.getApiType())) {//数据表查询时添加 if ("10002".equals(req.getApiType())) {//数据表查询时添加
if (ApiInfoOutTypeEnum.JSON.name().equals(req.getOutType())) { if (ApiInfoOutTypeEnum.JSON.name().equals(req.getOutputType())) {
apiInterface.setTargetUrl(jsonUrl); apiInterface.setTargetUrl(jsonUrl);
} else if (ApiInfoOutTypeEnum.FLOW.name().equals(req.getOutType())) { } else if (ApiInfoOutTypeEnum.FLOW.name().equals(req.getOutputType())) {
apiInterface.setTargetUrl(flowUrl); apiInterface.setTargetUrl(flowUrl);
} }
} }
...@@ -446,15 +443,14 @@ public class ProducerServiceImpl implements ProducerService { ...@@ -446,15 +443,14 @@ public class ProducerServiceImpl implements ProducerService {
* 校验文件夹是否存在 * 校验文件夹是否存在
* *
* @param folderId * @param folderId
* @param projectId
*/ */
private Boolean checkFileifExist(Long folderId, Long projectId) { private Boolean checkFileIfExist(Long folderId) {
if (null == folderId) { if (null == folderId) {
return true; return true;
} }
QueryWrapper<ApiInterfaceFile> queryWra = new QueryWrapper<>(); QueryWrapper<ApiInterfaceFile> queryWra = new QueryWrapper<>();
queryWra.eq("file_source", 1);//Api制作 // queryWra.eq("file_source", 1);//Api制作
queryWra.eq("project_id", projectId); queryWra.eq("status", GeneralStatusTypeEnum.VALID.name());
queryWra.eq("id", folderId); queryWra.eq("id", folderId);
queryWra.eq("is_deleted", 0); queryWra.eq("is_deleted", 0);
ApiInterfaceFile apiInterfaceFile = apiInterfaceFileMapper.selectOne(queryWra); ApiInterfaceFile apiInterfaceFile = apiInterfaceFileMapper.selectOne(queryWra);
...@@ -493,12 +489,9 @@ public class ProducerServiceImpl implements ProducerService { ...@@ -493,12 +489,9 @@ public class ProducerServiceImpl implements ProducerService {
apiInterface.setUpdateDate(new Date()); apiInterface.setUpdateDate(new Date());
apiInterface.setUpdateUser(req.getCreateUser()); apiInterface.setUpdateUser(req.getCreateUser());
apiInterface.setTargetUrl(req.getTargetUrl()); apiInterface.setTargetUrl(req.getTargetUrl());
Long timeout = Long.parseLong(req.getTimeout()); if (req.getTimeout() < 0) {
if (timeout == null || timeout == 0) {
apiInterface.setTimeout(String.valueOf(defaultTimeout));
} else if (timeout < 0) {
throw ResponseException.of_error("接口超时时间最小0ms"); throw ResponseException.of_error("接口超时时间最小0ms");
} else if (timeout > maxTimeout) { } else if (req.getTimeout() > maxTimeout) {
throw ResponseException.of_error("接口超时时间最大5000ms"); throw ResponseException.of_error("接口超时时间最大5000ms");
} }
apiInterface.setTimeout(req.getTimeout()); apiInterface.setTimeout(req.getTimeout());
...@@ -520,18 +513,18 @@ public class ProducerServiceImpl implements ProducerService { ...@@ -520,18 +513,18 @@ public class ProducerServiceImpl implements ProducerService {
if (null != apiInterface) { if (null != apiInterface) {
QueryWrapper<ApiInterfaceCustom> query = new QueryWrapper<>(); QueryWrapper<ApiInterfaceCustom> query = new QueryWrapper<>();
query.eq("api_interface_id", req.getId()); query.eq("api_interface_id", req.getId());
query.eq("api_key", apiInterface.getApiKey());
query.eq("is_deleted", 0); query.eq("is_deleted", 0);
interfaceCustom = apiInterfaceCustomMapper.selectOne(query); interfaceCustom = apiInterfaceCustomMapper.selectOne(query);
} }
if (null == interfaceCustom) { if (null == interfaceCustom) {
throw ResponseException.of_error("更新API扩展信息不存在!"); throw ResponseException.of_error("API扩展信息不存在!");
} }
interfaceCustom.setMaxRow(req.getMaxRow()); interfaceCustom.setMaxRow(req.getMaxRow());
interfaceCustom.setPageRow(req.getPageRow()); interfaceCustom.setPageRow(req.getPageRow());
interfaceCustom.setUpdateUser(req.getUpdateUser()); interfaceCustom.setUpdateUser(req.getUpdateUser());
interfaceCustom.setRequestParam(req.getRequestParam()); interfaceCustom.setRequestParam(req.getRequestParam());
interfaceCustom.setResponseParam(req.getResponseParam()); interfaceCustom.setResponseParam(req.getResponseParam());
interfaceCustom.setInboxParam(req.getInboxParam());//固定参数
if (StringUtils.isNotBlank(req.getEsDataSource())) { if (StringUtils.isNotBlank(req.getEsDataSource())) {
interfaceCustom.setEsDataSource(req.getEsDataSource()); interfaceCustom.setEsDataSource(req.getEsDataSource());
} }
...@@ -598,7 +591,7 @@ public class ProducerServiceImpl implements ProducerService { ...@@ -598,7 +591,7 @@ public class ProducerServiceImpl implements ProducerService {
*/ */
private void saveObjOnRedis(ApiInterfaceReq req) { private void saveObjOnRedis(ApiInterfaceReq req) {
if (StringUtils.isBlank(req.getApiKey()) || if (StringUtils.isBlank(req.getApiKey()) ||
StringUtils.isBlank(req.getOutType()) || StringUtils.isBlank(req.getOutputType()) ||
StringUtils.isBlank(req.getTargetUrl()) || StringUtils.isBlank(req.getTargetUrl()) ||
StringUtils.isBlank(req.getReqType()) || StringUtils.isBlank(req.getReqType()) ||
StringUtils.isBlank(req.getApiType())) { StringUtils.isBlank(req.getApiType())) {
...@@ -622,6 +615,31 @@ public class ProducerServiceImpl implements ProducerService { ...@@ -622,6 +615,31 @@ public class ProducerServiceImpl implements ProducerService {
ex.printStackTrace(); ex.printStackTrace();
} }
} }
/* *//**
* 获取服务发布列表
*
* @param req
* @return
*//*
@Override
public Result getServiceIssueList(ServiceIssueReq req) {
IPage<ApiServiceApplyDto> page = new Page<>(req.getPageNum(), req.getPageSize());
QueryWrapper<ApiServiceApplyDto> query = new QueryWrapper<>();
if (null != req.getFileId()) {
query.eq("ai.file_id", req.getFileId());
}
if (StringUtils.isNotBlank(req.getApiName())) {
query.eq("ai.api_name", req.getApiName());
}
if (StringUtils.isNotBlank(req.getApiId())) {
query.eq("ai.api_key", req.getApiId());
}
query.eq("ai.is_deleted", 0);
query.orderByDesc("ai.create_date");
return Result.of_success(apiInterfaceMapper.listApiIssueService(page, query));
}
*/
/* *//** /* *//**
* 数据银行制作API/数据包/自定义 * 数据银行制作API/数据包/自定义
* *
......
...@@ -29,7 +29,23 @@ ...@@ -29,7 +29,23 @@
file_name AS fileName, file_name AS fileName,
parent_id AS parentId parent_id AS parentId
FROM t_api_interface_file FROM t_api_interface_file
WHERE project_id =#{projectId} WHERE `status`='VALID' AND is_deleted =0
AND `status`='VALID' AND is_deleted =0 <if test="projectId != null and projectId != ''">
AND project_id =#{projectId}
</if>
<if test="orgCode != null and orgCode != ''">
AND org_code =#{orgCode}
</if>
</select>
<select id="getProjectFileFolders" resultType="java.lang.Long">
SELECT id FROM t_api_interface_file
WHERE is_deleted =0
AND `status` ='VALID'
<if test="projectId != null and projectId != ''">
and project_id =#{projectId}
</if>
<if test="orgCode != null and orgCode != ''">
and org_code =#{orgCode}
</if>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -66,12 +66,29 @@ ...@@ -66,12 +66,29 @@
ai.api_function AS apiFunction, ai.api_function AS apiFunction,
aic.max_row AS maxRow, aic.max_row AS maxRow,
aic.page_row AS pageRow, aic.page_row AS pageRow,
au.auth_code AS authCode au.auth_code AS authCode,
au.org_name AS orgName,
au.create_date AS createDate
FROM t_api_interface AS ai FROM t_api_interface AS ai
JOIN t_api_interface_custom AS aic ON ai.id =aic.api_interface_id AND aic.is_deleted =0 JOIN t_api_interface_custom AS aic ON ai.id =aic.api_interface_id AND aic.is_deleted =0
JOIN t_api_auth AS au ON au.api_interface_id = ai.id AND aic.is_deleted =0 JOIN t_api_auth AS au ON au.api_interface_id = ai.id AND aic.is_deleted =0
${ew.customSqlSegment} ${ew.customSqlSegment}
</select> </select>
<select id="listApiDetail" resultType="com.jz.dm.models.dto.ApiServiceApplyDto">
SELECT ai.api_key AS apiKey,
ai.api_name AS apiName,
ai.api_type AS apiType,
ai.output_Type AS outputType,
ai.req_type AS reqType,
ai.status AS `status`,
ai.api_function AS apiFunction,
ai.create_date AS createDate,
aic.max_row AS maxRow,
aic.page_row AS pageRow
FROM t_api_interface AS ai
JOIN t_api_interface_custom AS aic ON ai.id =aic.api_interface_id AND aic.is_deleted =0
${ew.customSqlSegment}
</select>
</mapper> </mapper>
\ No newline at end of file
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