Commit b9097432 authored by ysongq's avatar ysongq

Merge remote-tracking branch 'origin/dm_dev' into dm_dev

parents 8557f5d9 f1259dc1
......@@ -4,7 +4,7 @@ CREATE TABLE `t_api_interface` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'api 信息表自增ID',
`api_key` varchar(200) NOT 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',
`api_type` varchar(50) NULL DEFAULT '' COMMENT '接入类型:字典表对应key值',
`req_type` varchar(20) NULL DEFAULT NULL COMMENT '请求方式: GET, POST',
......@@ -13,7 +13,7 @@ CREATE TABLE `t_api_interface` (
`output_type` varchar(50) NULL DEFAULT 'JSON' COMMENT '输出类型:flow 流形式输出, json格式输出',
`version` varchar(20) DEFAULT 'v1.0' COMMENT '版本号',
`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',
`limit_type` varchar(20) DEFAULT NULL COMMENT '限流类型:DAY 按天,MONTH 按月, YEAR 按年',
`req_frequency` bigint(20) DEFAULT '100' COMMENT '限制次数',
......@@ -59,7 +59,8 @@ CREATE TABLE `t_api_interface_custom` (
DROP TABLE IF EXISTS `t_api_interface_file`;
CREATE TABLE `t_api_interface_file` (
`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_name` varchar(50) DEFAULT NULL COMMENT '文件名称',
`file_en_name` varchar(50) DEFAULT NULL COMMENT '文件英文名称',
......
......@@ -20,13 +20,13 @@ public enum ApiStatusEnum {
*/
ISSUE("发布"),
/**
* 过时
* 授权
*/
OUTMODED("过时"),
AUTHORIZATION("授权"),
/**
* 冻结
*/
FREEZE("冻结"),
*//*
FREEZE("冻结"),*/
/**
* 下架(下架时可以调用/不可以购买)
*/
......
......@@ -30,51 +30,40 @@ public class ApiInterfaceController {
@Autowired
private ApiInterfaceService apiInterfaceService;
/**
* @Description:API列表查询
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("API---(已调用列表)列表查询")
@PostMapping(value = "/listApiInterface")
@ApiOperation("服务管理---API计量(已调用)")
@PostMapping(value = "/listCallApi")
public Mono<Result> getApiInterfaceCallList(@RequestBody @Valid ApiInterfaceInfoListReq req) {
return Mono.fromSupplier(() -> Result.of_success(apiInterfaceService.listCallApiInterface(req)));
}
/**
* @Description:API列表查询
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("API---(未调用列表)列表查询")
@PostMapping(value = "/listUnCallApiInterface")
@ApiOperation("服务管理---API计量(未调用)")
@PostMapping(value = "/listUnCallApi")
public Mono<Result> getApiInterfaceList(@RequestBody @Valid ApiInterfaceInfoListReq req) {
return Mono.fromSupplier(() -> Result.of_success(apiInterfaceService.listUnCallApiInterface(req)));
}
/**
* @Description:API详情查询
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("Api计量")
@GetMapping(value = "/countAPiCallStat")
public Mono<Result> countAPiCallStat(@RequestParam(name = "date") String date) {
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详情查询")
@PostMapping(value = "/getApiInterfaceDetail")
public Mono<Result> getApiInterfaceDetail(@RequestBody @Valid ApiInterfaceDetailReq req) {
@PostMapping(value = "/getApiDetail")
public Mono<Result> getApiDetail(@RequestBody @Valid ApiInterfaceDetailReq req) {
return Mono.fromSupplier(() -> apiInterfaceService.getApiInterfaceDetail(req));
}
/**
* @Description:API删除
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("数据银行API删除")
@PostMapping(value = "/delDataBankApiInterface")
public Mono<Result> delDataBankApiInterface(@RequestParam (name="apiKey")String apiKey) {
return Mono.fromSupplier(() -> apiInterfaceService.delApiInterface(apiKey));
}
/**
* @Description:DMP-API删除
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("DMP-API删除/确认提示接口")
@GetMapping(value = "/delDMPApiInterface")
public Mono<Result> delDMPApiInterface(@RequestParam (name="type")String type,
......@@ -82,21 +71,13 @@ public class ApiInterfaceController {
return Mono.fromSupplier(() -> apiInterfaceService.dmpDeleteAuth(type,apiKey));
}
/**
* @Description:数据修改发送状态接口
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("数据修改发送状态接口")
@GetMapping(value = "/updateSendStatus")
public Mono<Result> updateApiSendStatus(@RequestParam (name="apiKey")String apiKey) {
return Mono.fromSupplier(() -> apiInterfaceService.updateApiSendStatus(apiKey));
}
/**
* @Description: 已发送到数据银行API列表
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("已发送到数据银行API列表")
@PostMapping(value = "/listSendDataBank")
public Mono<Result> listSendDataBank(@RequestBody @Valid SendDataReq req) {
......
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.dm.models.dto.DataBankNumberErrorDto;
import com.jz.dm.models.req.DataBankNumberErrorReq;
......@@ -16,7 +13,6 @@ import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Mono;
import javax.validation.Valid;
import java.util.List;
/**
* @author ZC
......@@ -35,39 +31,18 @@ public class ApiLogController {
@Autowired
private ApiLogService apiLogService;
/**
* @Description:日志信息查询
* @return: 日志列表
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("日志列表查询")
@PostMapping(value = "/listApiLog")
public Mono<Result> getApiLogList(@RequestBody @Valid LogInfoListReq req) {
return Mono.fromSupplier(() -> Result.of_success(apiLogService.listApiLog(req)));
}
/**
* @Description:日志详情查询
* @return: 日志详情查询
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("日志详情查询")
@PostMapping(value = "/getReqDetail")
public Mono<Result> getApiLogDetail(@RequestBody @Valid LogInfoDetailReq 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 {
@Autowired
private AuthService authService;
/**
* @Description:服务授权列表
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation("服务授权列表")
@ApiOperation("授权API列表")
@PostMapping(value = "/getServiceAuthList")
public Mono<Result> getServiceAuthList(@RequestBody @Valid ServiceAuthReq req) {
return Mono.fromSupplier(() -> authService.getServiceAuthList(req));
}
/**
* @Description:商城用户API认证
* @return: 商城用户API认证
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation("商城用户API认证")
@PostMapping(value = "/mall-user-auth-api")
@ApiOperation("数据银行/DMP用户---授权")
@PostMapping(value = "/user-auth-api")
public Mono<Result> authMallUserApi(@RequestBody @Valid AuthUserApiReq req) {
return Mono.fromSupplier(() -> authService.addMallUserApiAuth(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));
return Mono.fromSupplier(() -> authService.addUserApiAuth(req));
}
/**
* @Description: 认证详情查询
* @return: 认证详情查询
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation("认证详情查询")
@PostMapping(value = "/auth-detail-info")
public Mono<Result> selectAuthDetailInfo(@RequestBody @Valid AuthDetailInfoReq 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: 认证列表查询
* @return: 认证列表查询
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
*//*
@ApiOperation("认证列表查询")
@PostMapping(value = "/auth-list")
public Mono<Result> selectAuthListInfo(@RequestBody @Valid AuthListInfoReq req) {
return Mono.fromSupplier(() -> authService.getAuthListInfo(req));
}
/**
}*/
/* *//**
* @Description: 授权模糊查询列表信息
* @return: 认证列表查询
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
*//*
@ApiOperation("授权模糊查询列表信息")
@GetMapping(value = "/getAuthNameList")
public Mono<Result> getAuthNameList(@RequestParam("key") String key) {
return Mono.fromSupplier(() -> authService.getAuthNameList(key));
}
/**
* @Description: 认证信息修改
* @return: 认证信息修改
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation("取消授权")
@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: 商城授权续费
}*/
/* *//**
* @Description:DMP用户API认证
* @return: DMP用户API认证
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation("商城授权续费")
@PostMapping(value = "/auth-renew")
public Mono<Result> authRenew(@RequestBody @Validated AuthRenewUpdateReq req) {
return Mono.fromSupplier(() -> authService.updateAuthDate(req));
}
*//*
@ApiOperation("DMP用户API认证")
@PostMapping(value = "dmp-auth-api")
public Mono<Result> authDmpUserApi(@RequestBody @Valid AuthUserApiReq req) {
return Mono.fromSupplier(() -> authService.addDmpUserApiAuth(req));
}*/
}
......@@ -30,43 +30,24 @@ public class OrganizationManageController {
@Autowired
private OrganizationManageService organizationManageService;
/**
* @Description:组织列表查询
* @return: 组织列表
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("组织列表查询")
@PostMapping(value = "/listOrg")
public Mono<Result> listOrganization(@RequestBody @Valid OrganizationManageListQueryReq req) {
return Mono.fromSupplier(() -> Result.of_success(organizationManageService.listOrganization(req)));
}
/**
* @Description:组织信息详情信息查询
* @return: 组织详情
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("组织详情查询")
@PostMapping(value = "/getOrgDetail")
public Mono<Result> getOrganizationDetail(@RequestBody @Valid OrganizationManageDetailQueryReq req) {
return Mono.fromSupplier(() -> organizationManageService.getOrganizationDetail(req));
}
/**
* @Description:添加组织信息
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("添加/更新组织")
@PostMapping(value = "/add")
public Mono<Result> add(@RequestBody @Valid OrganizationManageAddReq req) {
return Mono.fromSupplier(() -> organizationManageService.add(req));
}
/**
* @Description:注销组织
* @Author: Mr.zhang
* @Date: 2020-12-24
*/
@ApiOperation("注销组织")
@GetMapping(value = "/logoutOrg")
public Mono<Result> delete(@RequestParam(name = "id")Long id) {
......
......@@ -3,7 +3,6 @@ package com.jz.dm.controller;
import com.jz.common.utils.Result;
import com.jz.dm.models.req.folder.CreateFolderReq;
import com.jz.dm.models.req.producer.ApiInterfaceReq;
import com.jz.dm.models.req.producer.ServiceIssueReq;
import com.jz.dm.service.ProducerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -30,45 +29,19 @@ public class ProducerController {
@Autowired
private ProducerService producerService;
/**
* @Description:获取文件夹列表
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation("获取文件夹列表")
@GetMapping(value = "/getFileCatalog")
public Mono<Result> getFileCatalog(@RequestParam(name = "projectId") Long projectId) {
return Mono.fromSupplier(() -> producerService.getFileCatalog(projectId));
public Mono<Result> getFileCatalog(@RequestParam(name = "projectId",required = false) Long projectId,
@RequestParam(name = "orgCode",required = false) String orgCode) {
return Mono.fromSupplier(() -> producerService.getFileCatalog(projectId,orgCode));
}
/**
* @Description:创建文件夹
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation("创建项目文件夹")
@PostMapping(value = "/createProjectFolder")
public Mono<Result> createProjectFolder(@RequestBody @Valid CreateFolderReq 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("服务发布/服务取消")
@GetMapping(value = "/optionApiIssueStatus")
public Mono<Result> optionApiIssueStatus(@RequestParam(name = "id") Long id,
......@@ -76,40 +49,36 @@ public class ProducerController {
return Mono.fromSupplier(() -> producerService.optionApiIssueStatus(id, optStatus));
}
/**
* @Description:获取APIID
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation("Api制作(获取ApiId)")
@ApiOperation("服务发布---上传")
@GetMapping(value = "/serverUpload")
public Mono<Result> serverUpload(@RequestParam(name = "id") Long id) {
return Mono.fromSupplier(() -> producerService.serverUpload(id));
}
@ApiOperation("服务开发---获取ApiId")
@PostMapping(value = "/getCustomApiId")
public Mono<Result> getCustomApiId() {
return Mono.fromSupplier(() -> producerService.getCustomApiId());
}
/**
* @Description:Api制作(第三方)
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation("Api制作(第三方)")
@ApiOperation("Api制作/编辑(第三方)")
@PostMapping(value = "/addCustomApi")
public Mono<Result> makeCustomApi(@RequestBody @Valid ApiInterfaceReq req) {
return Mono.fromSupplier(() -> Result.of_success(producerService.saveInterfaceAPi(req)));
}
/**
* @Description:Api制作(数据查询/标签查询)
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation("Api制作(数据查询/标签查询)")
@ApiOperation("Api制作/编辑(数据查询/标签查询)")
@PostMapping(value = "/addDataTableSelect")
public Mono<Result> bigDataMakeApi(@RequestBody @Valid ApiInterfaceReq 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信息
* @return: (自定义更新同时使用)
......
......@@ -4,6 +4,7 @@ import com.jz.common.base.BaseMapper;
import com.jz.dm.models.domian.ApiInterfaceFile;
import com.jz.dm.models.dto.ApiInterfaceFileDto;
import com.jz.dm.models.dto.DataFileDto;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -27,7 +28,17 @@ public interface ApiInterfaceFileMapper extends BaseMapper<ApiInterfaceFile> {
/**
* 查询出所有项目文件列表
* @param projectId
* @param orgCode
* @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> {
* @return
*/
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 {
private String apiName;
/**
* api请求协议:http,https
* api请求协议:0,http,1.https
*/
@TableField("api_protocl")
private String apiProtocl;
private Integer apiProtocl;
/**
* 接入类型:对应字典表key
......@@ -102,10 +102,10 @@ public class ApiInterface extends BaseObject implements Serializable {
@TableField("req_frequency")
private Long reqFrequency;
/**
* 超时时间
* 超时时间(秒)
*/
@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;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* @author ZC
......@@ -35,10 +38,19 @@ public class ApiServiceApplyDto implements Serializable {
private Long pageRow;
@ApiModelProperty(value = "描述")
private String apiFunction;
@ApiModelProperty(value = "组织名称")
private String orgName;
@ApiModelProperty(value = "API状态")
private String status;
@ApiModelProperty(value = "是否发布到数据银行,0 false 1 true")
private Boolean isSendBank;
@ApiModelProperty(value = "授权码")
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 {
private Long id;
@ApiModelProperty(value = "项目编号")
private Long projectId;
@ApiModelProperty(value = "组织编码")
private String orgCode;
@ApiModelProperty(value = "父类id")
private Long parentId;
@ApiModelProperty(value = "文件名称")
......
package com.jz.dm.models.enity;
import com.alibaba.fastjson.JSON;
import com.jz.dm.common.enums.RouteType;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* open api接口
*
*/
public class OpenApi {
/**
* id
*/
private Long id;
/**
* 接口名称
*/
private String method;
/**
* 描述
*/
private String description;
/**
* 数据格式
*/
private String format;
/**
* 请求使用的编码格式,如utf-8,gbk,gb2312等
*/
private String charset;
/**
* 生成签名字符串所使用的签名算法类型
*/
private String signType;
/**
* 调用的接口版本
*/
private String version;
/**
* 负责人
*/
private String owner;
/**
* 应用
*/
private String application;
/**
* 是否删除
*/
private Boolean isDelete;
/**
* 路由类型
*/
private RouteType routeType;
/**
* 路由Url
*/
private String routeUrl;
/**
* 路由请求编码
*/
private String routeCharset;
/**
* 扩展属性
*/
private Map<String, Object> extProperties = new HashMap<String, Object>();
/**
* 创建时间
*/
private Date gmtCreate;
/**
* 创建者
*/
private String createOperator;
/**
* 修改时间
*/
private Date gmtModified;
/**
* 最后修改者
*/
private String lastModifyOperator;
/**
* Getter method for property <tt>id</tt>.
*
* @return property value of id
*/
public Long getId() {
return id;
}
/**
* Setter method for property <tt>id</tt>.
*
* @param id value to be assigned to property id
*/
public void setId(Long id) {
this.id = id;
}
/**
* Getter method for property <tt>method</tt>.
*
* @return property value of method
*/
public String getMethod() {
return method;
}
/**
* Setter method for property <tt>method</tt>.
*
* @param method value to be assigned to property method
*/
public void setMethod(String method) {
this.method = method;
}
/**
* Getter method for property <tt>description</tt>.
*
* @return property value of description
*/
public String getDescription() {
return description;
}
/**
* Setter method for property <tt>description</tt>.
*
* @param description value to be assigned to property description
*/
public void setDescription(String description) {
this.description = description;
}
/**
* Getter method for property <tt>format</tt>.
*
* @return property value of format
*/
public String getFormat() {
return format;
}
/**
* Setter method for property <tt>format</tt>.
*
* @param format value to be assigned to property format
*/
public void setFormat(String format) {
this.format = format;
}
/**
* Getter method for property <tt>charset</tt>.
*
* @return property value of charset
*/
public String getCharset() {
return charset;
}
/**
* Setter method for property <tt>charset</tt>.
*
* @param charset value to be assigned to property charset
*/
public void setCharset(String charset) {
this.charset = charset;
}
/**
* Getter method for property <tt>signType</tt>.
*
* @return property value of signType
*/
public String getSignType() {
return signType;
}
/**
* Setter method for property <tt>signType</tt>.
*
* @param signType value to be assigned to property signType
*/
public void setSignType(String signType) {
this.signType = signType;
}
/**
* Getter method for property <tt>version</tt>.
*
* @return property value of version
*/
public String getVersion() {
return version;
}
/**
* Setter method for property <tt>version</tt>.
*
* @param version value to be assigned to property version
*/
public void setVersion(String version) {
this.version = version;
}
/**
* Getter method for property <tt>owner</tt>.
*
* @return property value of owner
*/
public String getOwner() {
return owner;
}
/**
* Setter method for property <tt>owner</tt>.
*
* @param owner value to be assigned to property owner
*/
public void setOwner(String owner) {
this.owner = owner;
}
/**
* Getter method for property <tt>application</tt>.
*
* @return property value of application
*/
public String getApplication() {
return application;
}
/**
* Getter method for property <tt>isDelete</tt>.
*
* @return property value of isDelete
*/
public Boolean getIsDelete() {
return isDelete;
}
/**
* Setter method for property <tt>isDelete</tt>.
*
* @param isDelete value to be assigned to property isDelete
*/
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
/**
* Getter method for property <tt>routeType</tt>.
*
* @return property value of routeType
*/
public RouteType getRouteType() {
return routeType;
}
/**
* Setter method for property <tt>routeType</tt>.
*
* @param routeType value to be assigned to property routeType
*/
public void setRouteType(RouteType routeType) {
this.routeType = routeType;
}
/**
* Getter method for property <tt>routeUrl</tt>.
*
* @return property value of routeUrl
*/
public String getRouteUrl() {
return routeUrl;
}
/**
* Setter method for property <tt>routeUrl</tt>.
*
* @param routeUrl value to be assigned to property routeUrl
*/
public void setRouteUrl(String routeUrl) {
this.routeUrl = routeUrl;
}
/**
* Getter method for property <tt>routeCharset</tt>.
*
* @return property value of routeCharset
*/
public String getRouteCharset() {
return routeCharset;
}
/**
* Setter method for property <tt>routeCharset</tt>.
*
* @param routeCharset value to be assigned to property routeCharset
*/
public void setRouteCharset(String routeCharset) {
this.routeCharset = routeCharset;
}
/**
* Setter method for property <tt>application</tt>.
*
* @param application value to be assigned to property application
*/
public void setApplication(String application) {
this.application = application;
}
@SuppressWarnings("unchecked")
public <T> T getExtProperty(String key) {
if (this.extProperties == null) {
return null;
}
return (T) this.extProperties.get(key);
}
public void setExtProperty(String key, Object value) {
if (this.extProperties == null) {
return;
}
this.extProperties.put(key, value);
}
public String getExtProperty() {
if (this.extProperties == null) {
return null;
}
return JSON.toJSONString(this.extProperties);
}
public void setExtProperty(String extProperty) {
if (extProperty == null) {
return;
}
this.extProperties = new HashMap<String, Object>(JSON.parseObject(extProperty));
}
/**
* Getter method for property <tt>extProperties</tt>.
*
* @return property value of extProperties
*/
public Map<String, Object> getExtProperties() {
return extProperties;
}
/**
* Setter method for property <tt>extProperties</tt>.
*
* @param extProperties value to be assigned to property extProperties
*/
public void setExtProperties(Map<String, Object> extProperties) {
this.extProperties = extProperties;
}
/**
* Getter method for property <tt>gmtCreate</tt>.
*
* @return property value of gmtCreate
*/
public Date getGmtCreate() {
return gmtCreate;
}
/**
* Setter method for property <tt>gmtCreate</tt>.
*
* @param gmtCreate value to be assigned to property gmtCreate
*/
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
/**
* Getter method for property <tt>createOperator</tt>.
*
* @return property value of createOperator
*/
public String getCreateOperator() {
return createOperator;
}
/**
* Setter method for property <tt>createOperator</tt>.
*
* @param createOperator value to be assigned to property createOperator
*/
public void setCreateOperator(String createOperator) {
this.createOperator = createOperator;
}
/**
* Getter method for property <tt>gmtModified</tt>.
*
* @return property value of gmtModified
*/
public Date getGmtModified() {
return gmtModified;
}
/**
* Setter method for property <tt>gmtModified</tt>.
*
* @param gmtModified value to be assigned to property gmtModified
*/
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
/**
* Getter method for property <tt>lastModifyOperator</tt>.
*
* @return property value of lastModifyOperator
*/
public String getLastModifyOperator() {
return lastModifyOperator;
}
/**
* Setter method for property <tt>lastModifyOperator</tt>.
*
* @param lastModifyOperator value to be assigned to property lastModifyOperator
*/
public void setLastModifyOperator(String lastModifyOperator) {
this.lastModifyOperator = lastModifyOperator;
}
}
......@@ -20,7 +20,10 @@ import java.io.Serializable;
@ApiModel("API详情信息")
public class ApiInterfaceDetailReq implements Serializable {
@ApiModelProperty(value = "id",required = true)
@NotNull(message = "id不能为空")
@ApiModelProperty(value = "id",required = false)
private Long id;
@ApiModelProperty(value = "apiKey",required = true)
@NotNull(message = "apiKey不能为空")
private String apiKey;
}
......@@ -22,6 +22,21 @@ public class ApiInterfaceInfoListReq extends BasePageBean implements Serializabl
@ApiModelProperty(value = "状态:SUCCEED 请求成功, FAIL 请求失败")
private String status;
@ApiModelProperty(value = "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;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
* @author ZC
......@@ -29,5 +30,5 @@ public class AuthRenewUpdateReq implements Serializable {
@NotNull(message = "有效截止时间不能空")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@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 {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date validEndTime;
@ApiModelProperty(value = "备注",required = false)
@ApiModelProperty(value = "备注--加入来源信息",required = false)
private String remark;
@ApiModelProperty(value = "创建用户",required = false)
......
......@@ -23,11 +23,7 @@ public class SaltResetReq implements Serializable {
@NotNull(message = "授权码不能为空")
private String authCode;
/*@ApiModelProperty(value = "盐值",required = true)
@NotNull(message = "盐值不能为空")
private String salt;*/
@ApiModelProperty(value = "创建用户",required = false)
private String createUser;
@ApiModelProperty(value = "更新用户",required = false)
private String updateUser;
}
......@@ -20,11 +20,12 @@ import java.io.Serializable;
@ApiModel(value = "服务授权请求体")
public class ServiceAuthReq extends BasePageBean implements Serializable {
@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)
private String apiName;
@ApiModelProperty(value = "apiId",required = false)
private String apiId;
}
......@@ -23,6 +23,9 @@ public class CreateFolderReq implements Serializable {
@ApiModelProperty(value = "项目id",required = false)
private Long projectId;
@ApiModelProperty(value = "组织编码",required = false)
private String orgCode;
@ApiModelProperty(value = "父类文件夹id ,创建同级不传",required = false)
private Long parentId;
......@@ -34,6 +37,8 @@ public class CreateFolderReq implements Serializable {
@NotBlank(message = "文件来源不能为空")
private String fileSource;
@ApiModelProperty(value = "创建用户",required = false)
private String createUser;
......
......@@ -23,9 +23,6 @@ public class OrganizationManageListQueryReq extends BasePageBean implements Seri
@ApiModelProperty(value = "组织名称")
private String orgName;
@ApiModelProperty(value = "组织编码(组织唯一标识)")
private String orgCode;
@ApiModelProperty(value = "组织联系人")
private String linkman;
......
......@@ -20,11 +20,11 @@ import java.io.Serializable;
@ApiModel(value = "api基本信息")
public class ApiInterfaceReq implements Serializable {
@ApiModelProperty(value = "传输方式:http https",required = true)
@ApiModelProperty(value = "传输方式:0,http 1.https",required = true)
@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 = "加密方式不能为空")
public Integer signType;
......@@ -45,7 +45,7 @@ public class ApiInterfaceReq implements Serializable {
@ApiModelProperty(value = "超时时间",required = true)
@NotNull(message="超时时间不能为空")
public String timeout;
public Integer timeout;
@ApiModelProperty(value = "限流类型:DAY 按天,MONTH 按月, YEAR 按年",required = true)
@NotNull(message = "限流类型不能为空")
......@@ -64,12 +64,12 @@ public class ApiInterfaceReq implements Serializable {
@NotNull(message="文件夹Id不能为空")
public Long fileId;
@ApiModelProperty(value = "项目编号",required = true)
/* @ApiModelProperty(value = "项目编号",required = true)
@NotNull(message="项目编号不能为空")
public Long projectId;
public Long projectId;*/
@ApiModelProperty(value = "输出类型:JSON 文件流形式",required = false)
public String outType;
public String outputType;
@ApiModelProperty(value = "最大行数:",required = false)
public Long maxRow;
......@@ -83,6 +83,9 @@ public class ApiInterfaceReq implements Serializable {
@ApiModelProperty(value = "响应参数:",required = false)
public String responseParam;
@ApiModelProperty(value = "固定参数:",required = false)
public String inboxParam;
@ApiModelProperty(value = "参数字段:",required = false)
public String tableFields;
......@@ -95,15 +98,16 @@ public class ApiInterfaceReq implements Serializable {
@ApiModelProperty(value = "数据表名称",required = false)
public String esTable;
@ApiModelProperty(value = "状态",required = false)
public String status;
@ApiModelProperty(value = "更新时传入api自增id",required = false)
public Long id;
@ApiModelProperty(value = "创建用户",hidden = true)
public String createUser;
@ApiModelProperty(value = "创建用户",hidden = true)
@ApiModelProperty(value = "更新用户",hidden = true)
public String updateUser;
@ApiModelProperty(value = "状态",required = false)
public String status;
/* @ApiModelProperty(value = "api类型:1.数据银行制作大数据表 " +
"2 数据银行制作数据包,3,数据银行制作自定义API " +
......
......@@ -106,4 +106,18 @@ public interface ApiInterfaceService {
* @return
*/
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 {
*/
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.*;
* @Description:
**/
public interface AuthService {
/**
/* *//**
* 认证列表
* @param req
* @return
*/
Result getAuthListInfo(AuthListInfoReq req);
*//*
Result getAuthListInfo(AuthListInfoReq req);*/
/**
* 获取认证详情信息
......@@ -28,19 +28,19 @@ public interface AuthService {
*/
Result getAuthDetailInfo(AuthDetailInfoReq req);
/**
/* *//**
* 添加Dmp用户认证
* @param req
* @return
*/
Result addDmpUserApiAuth(AuthUserApiReq req);
*//*
Result addDmpUserApiAuth(AuthUserApiReq req);*/
/**
* 添加商城用户api认证
* 数据银行/DMP用户---授权
* @param req
* @return
*/
Result addMallUserApiAuth(AuthUserApiReq req);
Result addUserApiAuth(AuthUserApiReq req);
/**
* 修改认证信息
......@@ -78,12 +78,12 @@ public interface AuthService {
*/
int updateApiAuthStatus(ApiAuth apiAuth);
/**
/* *//**
* 根据名称/组织编号摸索查询
* @param key
* @return
*/
Result getAuthNameList(String key);
*//*
Result getAuthNameList(String key);*/
/**
* 获取服务授权列表
......@@ -98,4 +98,5 @@ public interface AuthService {
* @return
*/
Result updateAuthDate(AuthRenewUpdateReq req);
}
......@@ -52,4 +52,10 @@ public interface OrganizationManageService {
* @return
*/
ApiOrg getAuthOrganization(Long apiOrgId);
/**
* 获取组织信息
* @param orgCode
* @return
*/
ApiOrg getOrganization(String orgCode);
}
......@@ -3,7 +3,6 @@ package com.jz.dm.service;
import com.jz.common.utils.Result;
import com.jz.dm.models.req.folder.CreateFolderReq;
import com.jz.dm.models.req.producer.ApiInterfaceReq;
import com.jz.dm.models.req.producer.ServiceIssueReq;
/**
* @author ZC
......@@ -86,9 +85,10 @@ public interface ProducerService {
/**
* 获取文件列表
* @param projectId
* @param orgCode
* @return
*/
Result getFileCatalog(Long projectId);
Result getFileCatalog(Long projectId,String orgCode);
/**
* 创建文件夹
......@@ -103,12 +103,12 @@ public interface ProducerService {
*/
Result getCustomApiId();
/**
/* *//**
* 获取服务发布列表
* @param req
* @return
*/
Result getServiceIssueList(ServiceIssueReq req);
*//*
Result getServiceIssueList(ServiceIssueReq req);*/
/**
* 服务发布/取消操作
......@@ -118,6 +118,13 @@ public interface ProducerService {
*/
Result optionApiIssueStatus(Long id, Boolean optStatus);
/**
* 服务开发--上传
* @param id
* @return
*/
Result serverUpload(Long id);
//Result saveObjOnRedis();
//Result getObjOnRedis();
......
......@@ -10,12 +10,11 @@ import com.jz.common.utils.Result;
import com.jz.dm.common.enums.GeneralStatusTypeEnum;
import com.jz.dm.common.enums.apiInterface.ApiStatusEnum;
import com.jz.dm.common.enums.auth.AuthModeEnum;
import com.jz.dm.mapper.ApiAuthMapper;
import com.jz.dm.mapper.ApiInterfaceCustomMapper;
import com.jz.dm.mapper.ApiInterfaceMapper;
import com.jz.dm.mapper.*;
import com.jz.dm.models.domian.ApiAuth;
import com.jz.dm.models.domian.ApiInterface;
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.ApiInterfaceInfoListReq;
import com.jz.dm.models.resp.SendDataReq;
......@@ -27,6 +26,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
......@@ -46,7 +46,7 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
/**
* 测试url
*/
public static final String testUrl ="";
public static final String testUrl = "";
@Resource
private ApiInterfaceMapper apiInterfaceMapper;
......@@ -54,6 +54,10 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
private ApiInterfaceCustomMapper apiInterfaceCustomMapper;
@Resource
private ApiAuthMapper apiAuthMapper;
@Resource
private ApiInterfaceFileMapper apiInterfaceFileMapper;
@Resource
private ApiReqLogMapper apiReqLogMapper;
@Autowired
private HttpsUtils httpsUtils;
......@@ -64,11 +68,11 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
* @return
*/
@Override
public IPage<ApiInterface > listCallApiInterface(ApiInterfaceInfoListReq req) {
IPage<ApiInterface > page = new Page<>(req.getPageNum(), req.getPageSize());
QueryWrapper<ApiInterface > query = new QueryWrapper<>();
if (StringUtils.isNotBlank(req.getApiKey())){
query.eq("ai.api_key",req.getApiKey());
public IPage<ApiInterface> listCallApiInterface(ApiInterfaceInfoListReq req) {
IPage<ApiInterface> page = new Page<>(req.getPageNum(), req.getPageSize());
QueryWrapper<ApiInterface> query = new QueryWrapper<>();
if (StringUtils.isNotBlank(req.getApiKey())) {
query.eq("ai.api_key", req.getApiKey());
}
query.eq("ai.is_deleted", 0);
query.orderByDesc("ai.create_date");
......@@ -79,15 +83,16 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
/**
* API---(未调用列表)列表查询
*
* @param req
* @return
*/
@Override
public IPage<ApiInterface > listUnCallApiInterface(ApiInterfaceInfoListReq req) {
IPage<ApiInterface > page = new Page<>(req.getPageNum(), req.getPageSize());
QueryWrapper<ApiInterface > query = new QueryWrapper<>();
if (StringUtils.isNotBlank(req.getApiKey())){
query.eq("ai.api_key",req.getApiKey());
public IPage<ApiInterface> listUnCallApiInterface(ApiInterfaceInfoListReq req) {
IPage<ApiInterface> page = new Page<>(req.getPageNum(), req.getPageSize());
QueryWrapper<ApiInterface> query = new QueryWrapper<>();
if (StringUtils.isNotBlank(req.getApiKey())) {
query.eq("ai.api_key", req.getApiKey());
}
query.isNull("ar.api_key");
query.eq("ai.is_deleted", 0);
......@@ -95,6 +100,38 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
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详情信息
*
......@@ -105,7 +142,22 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
public Result getApiInterfaceDetail(ApiInterfaceDetailReq 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信息
*
......@@ -228,15 +280,16 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
/**
* 获取api自定义信息
*
* @param apiInterfaceId
* @return
*/
@Override
public ApiInterfaceCustom getApiCustomInfo(Long apiInterfaceId) {
QueryWrapper<ApiInterfaceCustom> queryWra = new QueryWrapper<>();
queryWra.eq("api_interface_id",apiInterfaceId);
queryWra.eq("is_deleted",0);
return apiInterfaceCustomMapper.selectOne(queryWra) ;
queryWra.eq("api_interface_id", apiInterfaceId);
queryWra.eq("is_deleted", 0);
return apiInterfaceCustomMapper.selectOne(queryWra);
}
/**
......@@ -290,48 +343,48 @@ public class ApiInterfaceServiceImpl implements ApiInterfaceService {
/**
* 更新APi是否发送到数据银行状态
*
* @param apiKey
* @return
*/
@Override
public Result updateApiSendStatus(String apiKey) {
QueryWrapper<ApiInterface> queryWra = new QueryWrapper<>();
queryWra.eq("api_key",apiKey);
queryWra.eq("is_deleted",0);
queryWra.eq("api_key", apiKey);
queryWra.eq("is_deleted", 0);
ApiInterface apiInterface = apiInterfaceMapper.selectOne(queryWra);
if (null == apiInterface){
if (null == apiInterface) {
return Result.of_error(ResultMsg.DATA_NOT_FOUND);
}
UpdateWrapper<ApiInterface> updateWra = new UpdateWrapper<>();
updateWra.set("is_send_bank",0);
if (apiInterfaceMapper.update(null,updateWra) > 0){
updateWra.set("is_send_bank", 0);
if (apiInterfaceMapper.update(null, updateWra) > 0) {
return Result.of_success(ResultMsg.UPDATE_SUCCESS);
}
return Result.of_error(ResultMsg.UPDATE_FAIL);
}
/**
*
* @param req
* @return
*/
@Override
public Result getSendDataBankList(SendDataReq req) {
IPage<ApiInterface> page = new Page<>(req.getPageNum(), req.getPageSize());
QueryWrapper<ApiInterface > query = new QueryWrapper<>();
if (StringUtils.isNotBlank(req.getApiType())){
query.eq("api_type",req.getApiType());
QueryWrapper<ApiInterface> query = new QueryWrapper<>();
if (StringUtils.isNotBlank(req.getApiType())) {
query.eq("api_type", req.getApiType());
}
if (StringUtils.isNotBlank(req.getOutputType())){
query.eq("output_type",req.getOutputType());
if (StringUtils.isNotBlank(req.getOutputType())) {
query.eq("output_type", req.getOutputType());
}
if (StringUtils.isNotBlank(req.getStartTime()) && StringUtils.isNotBlank(req.getEndTime())){
query.between("create_date",req.getStartTime(),req.getEndTime());
if (StringUtils.isNotBlank(req.getStartTime()) && StringUtils.isNotBlank(req.getEndTime())) {
query.between("create_date", req.getStartTime(), req.getEndTime());
}
query.and(wrapper -> wrapper.like("api_name",req.getKey()));
query.eq("is_send_bank",1);
query.eq("status",ApiStatusEnum.ISSUE.name());
query.eq("is_deleted",0);
query.and(wrapper -> wrapper.like("api_name", req.getKey()));
query.eq("is_send_bank", 1);
query.eq("status", ApiStatusEnum.ISSUE.name());
query.eq("is_deleted", 0);
return Result.of_success(apiInterfaceMapper.selectPage(page, query));
}
}
......@@ -23,7 +23,6 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*;
/**
......@@ -74,7 +73,7 @@ public class ApiLogServiceImpl implements ApiLogService {
query.eq("is_deleted", 0);
query.orderByDesc("create_date");
IPage<ApiReqLog> apiReqLogIPage = apiReqLogMapper.selectPage(page, query);
// 数据银行-历史查询返回参数
// 数据银行-历史查询返回参数 TODO 需要优化日志查询
if (req.getHistoryQuery().equals("01") && req.getHistoryQuery() != null) {
for (ApiReqLog record : apiReqLogIPage.getRecords()) {
DataBankNumberErrorReq errorReq = new DataBankNumberErrorReq();
......@@ -117,23 +116,7 @@ public class ApiLogServiceImpl implements ApiLogService {
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;
import com.jz.dm.common.util.DateUtil;
import com.jz.dm.common.util.RandomUtil;
import com.jz.dm.mapper.ApiAuthMapper;
import com.jz.dm.mapper.ApiInterfaceFileMapper;
import com.jz.dm.mapper.ApiInterfaceMapper;
import com.jz.dm.mapper.ApiOrgMapper;
import com.jz.dm.models.domian.ApiAuth;
import com.jz.dm.models.domian.ApiInterface;
import com.jz.dm.models.domian.ApiOrg;
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.resp.AuthUserResponse;
import com.jz.dm.service.AuthService;
......@@ -31,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
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.AuthTypeEnum.fromAuthTypeName;
......@@ -55,13 +56,15 @@ public class AuthServiceImpl implements AuthService {
private ApiInterfaceMapper apiInterfaceMapper;
@Resource
private ApiOrgMapper apiOrgMapper;
@Resource
private ApiInterfaceFileMapper apiInterfaceFileMapper;
/**
/* *//**
* 认证信息列表
*
* @param req
* @return
*/
*//*
@Override
public Result getAuthListInfo(AuthListInfoReq req) {
IPage<AuthInfoDto> page = new Page<>(req.getPageNum(), req.getPageSize());
......@@ -76,7 +79,7 @@ public class AuthServiceImpl implements AuthService {
query.orderByDesc("au.create_date");
IPage<AuthInfoDto> listSelectApiAuth = apiAuthMapper.listSelectApiAuth(page, query);
return Result.of_success(listSelectApiAuth);
}
}*/
/**
* 认证信息详情
......@@ -96,28 +99,34 @@ public class AuthServiceImpl implements AuthService {
*/
@Override
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());
QueryWrapper<ApiServiceApplyDto> query = new QueryWrapper<>();
if (null != req.getFolderId()){
query.eq("ai.file_id",req.getFolderId());
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.getApiId())){
query.eq("ai.api_key",req.getApiId());
if (StringUtils.isNotBlank(req.getOrgName())){
query.like("au.org_name",req.getOrgName());
}
query.eq("ai.is_deleted",0);
query.orderByDesc("ai.create_time");
query.orderByDesc("au.create_time");
return Result.of_success(apiInterfaceMapper.listApiAuthService(page, query));
}
/**
/* *//**
* 添加dmp认证信息
*
* @param req
* @return
*/
*//*
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public Result addDmpUserApiAuth(AuthUserApiReq req) {
......@@ -128,7 +137,7 @@ public class AuthServiceImpl implements AuthService {
if (ApiStatusEnum.DRAFT.name().equals(apiInterface.getStatus())){
return Result.of_error("api未发布,无法授权");
}
if (ApiStatusEnum.EXPIRY.name().equals(apiInterface.getStatus())) {
if () {
return Result.of_error("api已下架,无法授权");
}
ApiOrg apiOrg = apiOrgMapper.selectOne(new QueryWrapper<ApiOrg>().eq("org_code", req.getOrgCode()));
......@@ -155,21 +164,22 @@ public class AuthServiceImpl implements AuthService {
}
return saveAuthInfo(apiInterface, apiOrg, req);
}
*/
/**
* 添加商城用户认证信息
* 数据银行/DMP用户---授权
*
* @param req
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public Result addMallUserApiAuth(AuthUserApiReq req) {
public Result addUserApiAuth(AuthUserApiReq req) {
ApiInterface apiInterface = getInterface(req.getApiKey());
if (null == apiInterface) {
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已下架,无法授权");
}
if (ApiStatusEnum.DRAFT.name().equals(apiInterface.getStatus())){
......@@ -191,11 +201,6 @@ public class AuthServiceImpl implements AuthService {
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()) &&
AuthModeEnum.RECORD_TIME_MODE.name().equals(req.getAuthMode())) {
......@@ -241,6 +246,7 @@ public class AuthServiceImpl implements AuthService {
return Result.of_error(ResultMsg.INSERT_FAIL);
}
/**
* 获取授权码
*
......@@ -300,7 +306,7 @@ public class AuthServiceImpl implements AuthService {
UpdateWrapper<ApiAuth> update = new UpdateWrapper<>();
update.set("salt", salt);
update.set("update_date", new Date());
update.set("update_user", req.getCreateUser());
update.set("update_user", req.getUpdateUser());
update.eq("id", apiAuth.getId());
if (apiAuthMapper.update(null, update) > 0) {
response.setSalt(salt);
......@@ -356,11 +362,11 @@ public class AuthServiceImpl implements AuthService {
return apiAuthMapper.update(null,update);
}
/**
/* *//**
* 模糊查询/
* @param key
* @return
*/
*//*
@Override
public Result getAuthNameList(String key) {
QueryWrapper<ApiOrg> query = new QueryWrapper<>();
......@@ -370,7 +376,7 @@ public class AuthServiceImpl implements AuthService {
.or().like("linkman",key));
}
return Result.of_success(apiOrgMapper.selectList(query));
}
}*/
private ApiInterface getInterface(String apiKey) {
QueryWrapper<ApiInterface> queryInface = new QueryWrapper<>();
......
......@@ -8,7 +8,6 @@ import com.jz.common.constant.ResultMsg;
import com.jz.common.utils.Result;
import com.jz.dm.mapper.ApiInterfaceFileMapper;
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.req.organizationManage.OrganizationManageAddReq;
import com.jz.dm.models.req.organizationManage.OrganizationManageDetailQueryReq;
......@@ -21,6 +20,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
* @author ZC
......@@ -57,9 +57,6 @@ public class OrganizationManageImpl implements OrganizationManageService {
if (StringUtils.isNotBlank(req.getLinkman())) {
query.like("linkman", req.getLinkman());
}
if (StringUtils.isNotBlank(req.getOrgCode())) {
query.eq("org_code", req.getOrgCode());
}
if (null != req.getFileId()){
query.eq("org_folder_id",req.getFileId());
}
......@@ -102,10 +99,9 @@ public class OrganizationManageImpl implements OrganizationManageService {
return Result.of_error("组织名称已存在!");
}
}
if (null != req.getOrgFolderId() && !req.getOrgFolderId().equals(org.getOrgFolderId())) {
if (checkOrgFolderIsExist(req.getOrgFolderId())) {
return Result.of_error("目标文件夹不存在!");
}
List<Long> fileFolders = apiInterfaceFileMapper.getProjectFileFolders(null, org.getOrgCode());
if (!fileFolders.contains(req.getOrgFolderId())){
return Result.of_error("目标文件夹不存在!");
}
org.setUpdateDate(new Date());
org.setOrgName(req.getOrgName());
......@@ -146,26 +142,6 @@ public class OrganizationManageImpl implements OrganizationManageService {
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 {
query.eq("is_deleted", 0);
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;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.exception.ResponseException;
import com.jz.common.utils.HttpsUtils;
......@@ -20,15 +18,10 @@ import com.jz.dm.mapper.ApiInterfaceCustomMapper;
import com.jz.dm.mapper.ApiInterfaceFileMapper;
import com.jz.dm.mapper.ApiInterfaceMapper;
import com.jz.dm.mapper.ApiOpenApiEsFieldsMapper;
import com.jz.dm.models.domian.ApiInterface;
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.domian.*;
import com.jz.dm.models.dto.DataFileDto;
import com.jz.dm.models.req.folder.CreateFolderReq;
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.ProducerService;
import lombok.extern.slf4j.Slf4j;
......@@ -61,6 +54,7 @@ public class ProducerServiceImpl implements ProducerService {
@Resource
private ApiInterfaceMapper apiInterfaceMapper;
@Resource
private ApiOpenApiEsFieldsMapper apiOpenApiEsFieldsMapper;
@Resource
......@@ -70,6 +64,8 @@ public class ProducerServiceImpl implements ProducerService {
@Autowired
private ApiInterfaceService apiInterfaceService;
@Autowired
private com.jz.dm.service.OrganizationManageService organizationManageService;
@Autowired
private RedisUtils redisUtils;
@Autowired
private HttpsUtils httpsUtils;
......@@ -95,37 +91,37 @@ public class ProducerServiceImpl implements ProducerService {
* 获取文件列表
*
* @param projectId
* @param orgCode
* @return
*/
@Override
public Result getFileCatalog(Long projectId) {
List<DataFileDto> interfaceFiles = apiInterfaceFileMapper.listFileFolders(projectId);
ArrayList<DataFileDto> children=null;
public Result getFileCatalog(Long projectId, String orgCode) {
List<DataFileDto> interfaceFiles = 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)) {
// for (ApiInterfaceFile interfaceFile : interfaceFiles) {
//if (0 == interfaceFile.getParentId()){
children = recursiveTree(0L, interfaceFiles);
//}
// }
}
return Result.of_success(children);
//return Result.of_success(apiInterfaceFileMapper.getFileFolderLevel(projectId));
}
private ArrayList<DataFileDto> recursiveTree(Long parentId, List<DataFileDto> allList) {
ArrayList<DataFileDto> files = new ArrayList<>();
for (DataFileDto interfaceFile : allList) {
if (Objects.equals(parentId,interfaceFile.getParentId())){
if (Objects.equals(parentId, interfaceFile.getParentId())) {
DataFileDto file = new DataFileDto();
file.setId(interfaceFile.getId());
file.setProjectId(interfaceFile.getProjectId());
file.setParentId(interfaceFile.getParentId());
file.setChildren(recursiveTree(interfaceFile.getId(),allList));
file.setChildren(recursiveTree(interfaceFile.getId(), allList));
files.add(file);
}
}
/* files.forEach(System.out::println);*/
return files;
}
......@@ -156,6 +152,10 @@ public class ProducerServiceImpl implements ProducerService {
}
} else if (StringUtils.isNotBlank(req.getFileSource()) &&
"2".equals(req.getFileSource())) { //组织创建文件夹
ApiOrg apiOrg = organizationManageService.getOrganization(req.getOrgCode());
if (null == apiOrg) {
return Result.of_error("组织信息不存在!");
}
if (!addFolder(req)) {
return Result.of_success(ResultMsg.INSERT_SUCCESS);
}
......@@ -182,32 +182,10 @@ public class ProducerServiceImpl implements ProducerService {
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 optStatus
......@@ -244,6 +222,29 @@ public class ProducerServiceImpl implements ProducerService {
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
*
......@@ -264,7 +265,7 @@ public class ProducerServiceImpl implements ProducerService {
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public Result addBigDataMakeApi(ApiInterfaceReq req) {
ApiInterface anInterface = apiInterfaceService.getApiInfo(req.apiKey);
ApiInterface anInterface = apiInterfaceService.getApiInfo(req.getApiKey());
if (null != anInterface) {
return Result.of_error("API已存在!");
}
......@@ -280,21 +281,21 @@ public class ProducerServiceImpl implements ProducerService {
return Result.of_error("限流次数不能小于或者等于零");
}
}
if (null == req.getSignType() || 0 == req.getSignType()) {
return Result.of_error("加密类型错误!");
}
if (StringUtils.isNotBlank(req.getLimitType())) {
if (null == fromAuthReqTypeEnum(req.getLimitType())) {
return Result.of_error("限流类型不存在!");
}
}
//校验文件夹信息
if (checkFileifExist(req.getFileId(), req.getProjectId())) {
if (checkFileIfExist(req.getFileId())) {
return Result.of_error("目标文件夹不存在!");
}
//保存表字段信息
saveTableField(req);
if (null != req.getId()) {//更新
if (!ApiStatusEnum.DRAFT.name().equals(anInterface.getStatus())) {
return Result.of_error("非草稿状态API不允许编辑!");
}
if (saveUpdateAPiBaseData(req) || saveUpdateApiExtendData(req)) {
throw ResponseException.of_error(ResultMsg.UPDATE_FAIL);
}
......@@ -311,7 +312,6 @@ public class ProducerServiceImpl implements ProducerService {
/**
* 数据表查询 && 保存表字段信息
*
* @param req
*/
private void saveTableField(ApiInterfaceReq req) {
......@@ -359,7 +359,7 @@ public class ProducerServiceImpl implements ProducerService {
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public Result saveInterfaceAPi(ApiInterfaceReq req) {
ApiInterface anInterface = apiInterfaceService.getApiInfo(req.apiKey);
ApiInterface anInterface = apiInterfaceService.getApiInfo(req.getApiKey());
if (null != anInterface) {
return Result.of_error("API已存在!");
}
......@@ -380,7 +380,7 @@ public class ProducerServiceImpl implements ProducerService {
return Result.of_error("目标地址不存在!");
}
//校验文件夹信息
if (checkFileifExist(req.getFileId(), req.getProjectId())) {
if (checkFileIfExist(req.getFileId())) {
return Result.of_error("目标文件夹不存在!");
}
ApiInterface apiInterface = saveApiBaseData(req);
......@@ -419,20 +419,17 @@ public class ProducerServiceImpl implements ProducerService {
ApiInterface apiInterface = new ApiInterface();
BeanUtils.copyProperties(req, apiInterface);
apiInterface.setStatus(ApiStatusEnum.DRAFT.name());//草稿状态
apiInterface.setOutputType(ApiInfoOutTypeEnum.JSON.name());//输出类型默认为Json
Long timeout = Long.parseLong(req.getTimeout());
if (timeout == null || timeout == 0) {
apiInterface.setTimeout(String.valueOf(defaultTimeout));
} else if (timeout < 0) {
/*apiInterface.setOutputType(ApiInfoOutTypeEnum.JSON.name());//输出类型默认为Json*/
if (req.getTimeout() < 0) {
throw ResponseException.of_error("接口超时时间最小0ms");
} else if (timeout > maxTimeout) {
throw ResponseException.of_error("接口超时时间最大5000ms");
} else if (req.getTimeout() > maxTimeout) {
throw ResponseException.of_error("接口超时时间最大" + maxTimeout + "ms");
}
apiInterface.setTimeout(req.getTimeout());
/* apiInterface.setTimeout(req.getTimeout());*/
if ("10002".equals(req.getApiType())) {//数据表查询时添加
if (ApiInfoOutTypeEnum.JSON.name().equals(req.getOutType())) {
if (ApiInfoOutTypeEnum.JSON.name().equals(req.getOutputType())) {
apiInterface.setTargetUrl(jsonUrl);
} else if (ApiInfoOutTypeEnum.FLOW.name().equals(req.getOutType())) {
} else if (ApiInfoOutTypeEnum.FLOW.name().equals(req.getOutputType())) {
apiInterface.setTargetUrl(flowUrl);
}
}
......@@ -446,15 +443,14 @@ public class ProducerServiceImpl implements ProducerService {
* 校验文件夹是否存在
*
* @param folderId
* @param projectId
*/
private Boolean checkFileifExist(Long folderId, Long projectId) {
private Boolean checkFileIfExist(Long folderId) {
if (null == folderId) {
return true;
}
QueryWrapper<ApiInterfaceFile> queryWra = new QueryWrapper<>();
queryWra.eq("file_source", 1);//Api制作
queryWra.eq("project_id", projectId);
// queryWra.eq("file_source", 1);//Api制作
queryWra.eq("status", GeneralStatusTypeEnum.VALID.name());
queryWra.eq("id", folderId);
queryWra.eq("is_deleted", 0);
ApiInterfaceFile apiInterfaceFile = apiInterfaceFileMapper.selectOne(queryWra);
......@@ -493,12 +489,9 @@ public class ProducerServiceImpl implements ProducerService {
apiInterface.setUpdateDate(new Date());
apiInterface.setUpdateUser(req.getCreateUser());
apiInterface.setTargetUrl(req.getTargetUrl());
Long timeout = Long.parseLong(req.getTimeout());
if (timeout == null || timeout == 0) {
apiInterface.setTimeout(String.valueOf(defaultTimeout));
} else if (timeout < 0) {
if (req.getTimeout() < 0) {
throw ResponseException.of_error("接口超时时间最小0ms");
} else if (timeout > maxTimeout) {
} else if (req.getTimeout() > maxTimeout) {
throw ResponseException.of_error("接口超时时间最大5000ms");
}
apiInterface.setTimeout(req.getTimeout());
......@@ -520,18 +513,18 @@ public class ProducerServiceImpl implements ProducerService {
if (null != apiInterface) {
QueryWrapper<ApiInterfaceCustom> query = new QueryWrapper<>();
query.eq("api_interface_id", req.getId());
query.eq("api_key", apiInterface.getApiKey());
query.eq("is_deleted", 0);
interfaceCustom = apiInterfaceCustomMapper.selectOne(query);
}
if (null == interfaceCustom) {
throw ResponseException.of_error("更新API扩展信息不存在!");
throw ResponseException.of_error("API扩展信息不存在!");
}
interfaceCustom.setMaxRow(req.getMaxRow());
interfaceCustom.setPageRow(req.getPageRow());
interfaceCustom.setUpdateUser(req.getUpdateUser());
interfaceCustom.setRequestParam(req.getRequestParam());
interfaceCustom.setResponseParam(req.getResponseParam());
interfaceCustom.setInboxParam(req.getInboxParam());//固定参数
if (StringUtils.isNotBlank(req.getEsDataSource())) {
interfaceCustom.setEsDataSource(req.getEsDataSource());
}
......@@ -598,7 +591,7 @@ public class ProducerServiceImpl implements ProducerService {
*/
private void saveObjOnRedis(ApiInterfaceReq req) {
if (StringUtils.isBlank(req.getApiKey()) ||
StringUtils.isBlank(req.getOutType()) ||
StringUtils.isBlank(req.getOutputType()) ||
StringUtils.isBlank(req.getTargetUrl()) ||
StringUtils.isBlank(req.getReqType()) ||
StringUtils.isBlank(req.getApiType())) {
......@@ -622,6 +615,31 @@ public class ProducerServiceImpl implements ProducerService {
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/数据包/自定义
*
......
......@@ -29,7 +29,23 @@
file_name AS fileName,
parent_id AS parentId
FROM t_api_interface_file
WHERE project_id =#{projectId}
AND `status`='VALID' AND is_deleted =0
WHERE `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>
</mapper>
\ No newline at end of file
......@@ -33,7 +33,13 @@
aic.resp_code AS respCode
FROM t_api_interface AS ai
LEFT JOIN t_api_interface_custom AS aic ON ai.id = aic.api_interface_id AND aic.is_deleted =0
WHERE ai.id =#{id}
WHERE
<if test="apiKey != null and apiKey !=''">
ai.api_key =#{apiKey}
</if>
<if test="id != null and id !=''">
AND ai.id =#{id}
</if>
</select>
<select id="getTestData" resultType="com.jz.dm.models.domian.ApiInterfaceCustom">
SELECT aic.*
......@@ -66,12 +72,29 @@
ai.api_function AS apiFunction,
aic.max_row AS maxRow,
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
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
${ew.customSqlSegment}
</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>
\ 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