Commit 1e9b3f69 authored by ysongq's avatar ysongq

Merge branch 'dm_dev' of http://gitlab.ioubuy.cn/yaobenzhang/dm_project into dm_dev

parents eb20785a 29646613
...@@ -45,6 +45,24 @@ CREATE TABLE `t_api_interface_custom` ( ...@@ -45,6 +45,24 @@ CREATE TABLE `t_api_interface_custom` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='api自定义信息表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='api自定义信息表';
#api api文件表
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',
`api_interface_id` bigint(20) NOT NULL COMMENT 'api表自增id',
`api_key` varchar(200) NOT NULL COMMENT 'api唯一标识',
`file_type` varchar(50) DEFAULT NULL COMMENT '文件类型',
`file_name` varchar(50) DEFAULT NULL COMMENT '文件名称',
`file_en_name` varchar(50) DEFAULT NULL COMMENT '文件英文名称',
`status` varchar(50) DEFAULT NULL COMMENT 'VALID 有效,UNVALID 无效',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`create_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`create_user` varchar(100) DEFAULT NULL COMMENT '创建人',
`update_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
`update_user` varchar(100) DEFAULT NULL COMMENT '更新人',
`is_deleted` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
PRIMARY KEY (`id`),
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='api文件表';
#api组织信息表 #api组织信息表
DROP TABLE IF EXISTS `t_api_org`; DROP TABLE IF EXISTS `t_api_org`;
......
...@@ -49,11 +49,7 @@ ...@@ -49,11 +49,7 @@
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.6</version>
</dependency>
<!--lang3工具类--> <!--lang3工具类-->
<dependency> <dependency>
......
package com.jz.dm.common.enums;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.common.enums
* @PROJECT_NAME: jz-dm-parent
* @NAME: GeneralStatusTypeEnum
* @DATE: 2020-12-30/20:08
* @DAY_NAME_SHORT: 周三
* @Description: 通用状态枚举
**/
public enum GeneralStatusTypeEnum {
/**
* 启用
*/
ENABLE("启用"),
/**
* 停用
*/
UNABLE("停用"),
/**
* 有效'
*/
VALID("有效"),
/**
* 无效
*/
UN_VALID("无效");
private String text;
GeneralStatusTypeEnum(String text) {
this.text = text;
}
public String getText() {
return text;
}
}
...@@ -124,7 +124,7 @@ public class RandomUtil { ...@@ -124,7 +124,7 @@ public class RandomUtil {
String userNum = addZeroForNum(userId, 8); String userNum = addZeroForNum(userId, 8);
builder.append(userNum); builder.append(userNum);
} }
coding = getCodeInfo(orgCode, coding, builder, month, day, hour, minute, second); coding = getCodeInfo(userId, coding, builder, month, day, hour, minute, second);
} }
return coding; return coding;
......
...@@ -28,6 +28,18 @@ public class ProducerController { ...@@ -28,6 +28,18 @@ public class ProducerController {
@Autowired @Autowired
private ProducerService producerService; private ProducerService producerService;
/**
* @Description:Api制作(自定义)
* @Author: Mr.zhang
* @Date: 2020-12-26
*/
@ApiOperation("Api制作(获取文件夹列表)")
@GetMapping(value = "/getFileCatalog")
public Mono<Result> getFileCatalog(@RequestParam(name = "pageNum",defaultValue = "1",required = false)String pageNum,
@RequestParam(name = "pageSize",defaultValue = "10",required = false)String pageSize) {
return Mono.fromSupplier(() -> Result.of_success(producerService.getFileCatalog(pageNum,pageSize)));
}
/** /**
* @Description:Api制作(自定义) * @Description:Api制作(自定义)
* @Author: Mr.zhang * @Author: Mr.zhang
......
package com.jz.dm.mapper;
import com.jz.common.base.BaseMapper;
import com.jz.dm.models.domian.ApiInterfaceFile;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.mapper
* @PROJECT_NAME: jz-dm-parent
* @NAME: ApiInterfaceFileMapper
* @DATE: 2020-12-30/20:34
* @DAY_NAME_SHORT: 周三
* @Description:
**/
public interface ApiInterfaceFileMapper extends BaseMapper<ApiInterfaceFile> {
}
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_interface_file")
public class ApiInterfaceFile extends BaseObject implements Serializable {
/**
* api唯一标识
*/
@TableField("api_key")
private String apiKey;
/**
* apiInterfaceId
*/
@TableField("api_interface_id")
private Long apiInterfaceId;
/**
* 文件类型
*/
@TableField("file_type")
private String apiType;
/**
* 文件名称
*/
@TableField("file_name")
private String fileName;
/**
* 文件英文名称
*/
@TableField("file_en_name")
private String fileEnName;
/**
* 'VALID 有效,UNVALID 无效'
*/
@TableField("status")
private String status;
}
...@@ -26,9 +26,13 @@ public class AuthDmpUserApiReq implements Serializable { ...@@ -26,9 +26,13 @@ public class AuthDmpUserApiReq implements Serializable {
@NotNull(message = "apiKey唯一标识不能为空") @NotNull(message = "apiKey唯一标识不能为空")
private String apiKey; private String apiKey;
@ApiModelProperty(value = "组织id",required = true) @ApiModelProperty(value = "组织编码",required = true)
@NotNull(message = "组织id不能为空") @NotNull(message = "组织编码不能为空")
private Long orgId; private String orgCode;
@ApiModelProperty(value = "组织类型: INT 内部, OUT 外部",required = true)
@NotNull(message = "组织类型不能为空")
private String orgType;
@ApiModelProperty(value = "授权类型:DATA_BANK_AUTH 数据银行 , DMP_AUTH dmp授权",required = true) @ApiModelProperty(value = "授权类型:DATA_BANK_AUTH 数据银行 , DMP_AUTH dmp授权",required = true)
@NotNull(message = "授权类型不能为空") @NotNull(message = "授权类型不能为空")
......
...@@ -26,9 +26,16 @@ public class AuthMallUserApiReq implements Serializable { ...@@ -26,9 +26,16 @@ public class AuthMallUserApiReq implements Serializable {
@NotNull(message = "apiKey唯一标识不能为空") @NotNull(message = "apiKey唯一标识不能为空")
private String apiKey; private String apiKey;
@ApiModelProperty(value = "组织id",required = true) @ApiModelProperty(value = "组织类型: INT 内部, OUT 外部",required = true)
@NotNull(message = "组织id不能为空") @NotNull(message = "组织类型不能为空")
private Long orgId; private String orgType;
@ApiModelProperty(value = "用户id",required = false)
private String userId;
@ApiModelProperty(value = "组织编码",required = true)
@NotNull(message = "组织编码不能为空")
private String orgCode;
@ApiModelProperty(value = "授权类型:DATA_BANK_AUTH 数据银行 , DMP_AUTHdmp 授权",required = true) @ApiModelProperty(value = "授权类型:DATA_BANK_AUTH 数据银行 , DMP_AUTHdmp 授权",required = true)
@NotNull(message = "授权类型不能为空") @NotNull(message = "授权类型不能为空")
......
package com.jz.dm.models.resp;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.models.resp
* @PROJECT_NAME: jz-dm-parent
* @NAME: AuthMallUserResponse
* @DATE: 2020-12-30/19:35
* @DAY_NAME_SHORT: 周三
* @Description:
**/
@Data
@ApiModel
public class AuthMallUserResponse implements Serializable {
@ApiModelProperty(value ="授权码")
public String authCode;
@ApiModelProperty(value ="盐值")
public String salt;
}
package com.jz.dm.service; package com.jz.dm.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jz.common.utils.Result; import com.jz.common.utils.Result;
import com.jz.dm.models.domian.ApiInterfaceFile;
import com.jz.dm.models.req.make.*; import com.jz.dm.models.req.make.*;
/** /**
...@@ -86,4 +88,12 @@ public interface ProducerService { ...@@ -86,4 +88,12 @@ public interface ProducerService {
* @return * @return
*/ */
Result saveInterfaceAPi(ApiInterfaceReq req); Result saveInterfaceAPi(ApiInterfaceReq req);
/**
* 获取文件列表
* @param pageNum
* @param pageSize
* @return
*/
IPage<ApiInterfaceFile> getFileCatalog( String pageNum, String pageSize);
} }
...@@ -6,8 +6,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -6,8 +6,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jz.common.constant.ResultMsg; import com.jz.common.constant.ResultMsg;
import com.jz.common.utils.Result; import com.jz.common.utils.Result;
import com.jz.dm.common.constant.Constants;
import com.jz.dm.common.enums.auth.AuthModeEnum; import com.jz.dm.common.enums.auth.AuthModeEnum;
import com.jz.dm.common.enums.auth.AuthTypeEnum; import com.jz.dm.common.enums.auth.AuthTypeEnum;
import com.jz.dm.common.util.RandomUtil;
import com.jz.dm.mapper.ApiAuthMapper; import com.jz.dm.mapper.ApiAuthMapper;
import com.jz.dm.mapper.ApiInterfaceMapper; import com.jz.dm.mapper.ApiInterfaceMapper;
import com.jz.dm.mapper.ApiOrgMapper; import com.jz.dm.mapper.ApiOrgMapper;
...@@ -16,6 +18,7 @@ import com.jz.dm.models.domian.ApiInterface; ...@@ -16,6 +18,7 @@ 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.AuthInfoDto; 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.AuthMallUserResponse;
import com.jz.dm.service.AuthService; import com.jz.dm.service.AuthService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -84,7 +87,7 @@ public class AuthServiceImpl implements AuthService { ...@@ -84,7 +87,7 @@ public class AuthServiceImpl implements AuthService {
if (null == apiInterface) { if (null == apiInterface) {
return Result.of_error("api授权信息不存在!"); return Result.of_error("api授权信息不存在!");
} }
ApiOrg apiOrg = apiOrgMapper.selectById(req.getOrgId()); ApiOrg apiOrg = apiOrgMapper.selectOne(new QueryWrapper<ApiOrg>().eq("org_code",req.getOrgCode()));
if (null == apiOrg) { if (null == apiOrg) {
return Result.of_error("组织信息不存在!"); return Result.of_error("组织信息不存在!");
} }
...@@ -103,11 +106,21 @@ public class AuthServiceImpl implements AuthService { ...@@ -103,11 +106,21 @@ public class AuthServiceImpl implements AuthService {
AuthModeEnum.POWER_CALL_MODE.name().equals(req.getAuthMode())) { AuthModeEnum.POWER_CALL_MODE.name().equals(req.getAuthMode())) {
return Result.of_error("授权类型错误!"); return Result.of_error("授权类型错误!");
} }
String authCode = "";
ApiAuth apiAuth = new ApiAuth(); ApiAuth apiAuth = new ApiAuth();
BeanUtils.copyProperties(req, apiAuth); BeanUtils.copyProperties(req, apiAuth);
apiAuth.setApiInterfaceId(apiInterface.getId()); apiAuth.setApiInterfaceId(apiInterface.getId());
apiAuth.setAuthCode("");//授权码 if (StringUtils.isNotBlank(req.getOrgType()) //内部组织
apiAuth.setSalt("");//盐值 && Constants.AUTH_INT.equalsIgnoreCase(req.getOrgType())) {
authCode = getAuthCode(apiOrg.getOrgCode(),"",Constants.AUTH_INT);
}
/*else if (StringUtils.isNotBlank(req.getOrgType()) //外部组织
&& Constants.AUTH_OUT.equalsIgnoreCase(req.getOrgType())) {
authCode = getAuthCode("", req.getUserId(),Constants.AUTH_OUT);
}*/
apiAuth.setAuthCode(authCode);//授权码
String salt = RandomUtil.getStringRandom(8);
apiAuth.setSalt(salt);//盐值
apiAuth.setStatus("1");//授权状态 apiAuth.setStatus("1");//授权状态
if (apiAuthMapper.insert(apiAuth) > 0) { if (apiAuthMapper.insert(apiAuth) > 0) {
return Result.of_success(ResultMsg.SUCCESS); return Result.of_success(ResultMsg.SUCCESS);
...@@ -123,11 +136,12 @@ public class AuthServiceImpl implements AuthService { ...@@ -123,11 +136,12 @@ public class AuthServiceImpl implements AuthService {
*/ */
@Override @Override
public Result addMallUserApiAuth(AuthMallUserApiReq req) { public Result addMallUserApiAuth(AuthMallUserApiReq req) {
AuthMallUserResponse response = new AuthMallUserResponse();
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授权信息不存在!");
} }
ApiOrg apiOrg = apiOrgMapper.selectById(req.getOrgId()); ApiOrg apiOrg = apiOrgMapper.selectOne(new QueryWrapper<ApiOrg>().eq("org_code",req.getOrgCode()));
if (null == apiOrg) { if (null == apiOrg) {
return Result.of_error("组织信息不存在!"); return Result.of_error("组织信息不存在!");
} }
...@@ -146,16 +160,46 @@ public class AuthServiceImpl implements AuthService { ...@@ -146,16 +160,46 @@ public class AuthServiceImpl implements AuthService {
AuthModeEnum.PERMANENT_TIME_MODE.name().equals(req.getAuthMode())) { AuthModeEnum.PERMANENT_TIME_MODE.name().equals(req.getAuthMode())) {
return Result.of_error("授权类型错误!"); return Result.of_error("授权类型错误!");
} }
String authCode = "";
ApiAuth apiAuth = new ApiAuth(); ApiAuth apiAuth = new ApiAuth();
BeanUtils.copyProperties(req, apiAuth); BeanUtils.copyProperties(req, apiAuth);
apiAuth.setApiInterfaceId(apiInterface.getId()); apiAuth.setApiInterfaceId(apiInterface.getId());
apiAuth.setAuthCode("");//授权码 if (StringUtils.isNotBlank(req.getOrgType()) //内部组织
apiAuth.setSalt("");//盐值 && Constants.AUTH_INT.equalsIgnoreCase(req.getOrgType())) {
authCode = getAuthCode(apiOrg.getOrgCode(),"",Constants.AUTH_INT);
} else if (StringUtils.isNotBlank(req.getOrgType()) //外部组织
&& Constants.AUTH_OUT.equalsIgnoreCase(req.getOrgType())) {
authCode = getAuthCode("", req.getUserId(),Constants.AUTH_OUT);
}
apiAuth.setAuthCode(authCode);//授权码
String salt = RandomUtil.getStringRandom(8);
apiAuth.setSalt(salt);//盐值
apiAuth.setStatus("1");//授权状态 apiAuth.setStatus("1");//授权状态
response.setAuthCode(authCode);
response.setSalt(salt);
if (apiAuthMapper.insert(apiAuth) > 0) { if (apiAuthMapper.insert(apiAuth) > 0) {
return Result.of_success(ResultMsg.SUCCESS); return Result.of_success(ResultMsg.SUCCESS,response);
} }
return Result.of_success(ResultMsg.FAILURE); return Result.of_success(ResultMsg.FAILURE,response);
}
/**
* 获取授权码
* @param type
* @param userId
* @param apiOrgCode
* @return
*/
private String getAuthCode(String apiOrgCode,String userId,String type) {
String authCode = "";
authCode = RandomUtil.generateTokenCode(type, apiOrgCode, userId);
QueryWrapper<ApiAuth> query = new QueryWrapper<>();
query.eq("auth_code", authCode);
ApiAuth auth = apiAuthMapper.selectOne(query);
if (null != auth) {
authCode = RandomUtil.generateTokenCode(type, apiOrgCode, userId);
}
return authCode;
} }
/** /**
...@@ -194,11 +238,12 @@ public class AuthServiceImpl implements AuthService { ...@@ -194,11 +238,12 @@ public class AuthServiceImpl implements AuthService {
} }
return Result.of_success(ResultMsg.UPDATE_FAIL); return Result.of_success(ResultMsg.UPDATE_FAIL);
} }
private ApiInterface getInterface(String apiKey){
private ApiInterface getInterface(String apiKey) {
QueryWrapper<ApiInterface> queryInface = new QueryWrapper<>(); QueryWrapper<ApiInterface> queryInface = new QueryWrapper<>();
queryInface.last("where is_deleted=0 and api_key ="+apiKey+""); queryInface.last("where is_deleted=0 and api_key =" + apiKey + "");
ApiInterface apiInterface = apiInterfaceMapper.selectOne(queryInface); ApiInterface apiInterface = apiInterfaceMapper.selectOne(queryInface);
if (null != apiInterface){ if (null != apiInterface) {
return apiInterface; return apiInterface;
} }
return null; return null;
......
...@@ -3,6 +3,8 @@ package com.jz.dm.service.impl; ...@@ -3,6 +3,8 @@ package com.jz.dm.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jz.common.bean.SysUserDto;
import com.jz.common.constant.RedisMessageConstant;
import com.jz.common.constant.ResultMsg; import com.jz.common.constant.ResultMsg;
import com.jz.common.utils.Result; import com.jz.common.utils.Result;
import com.jz.dm.common.constant.Constants; import com.jz.dm.common.constant.Constants;
...@@ -74,10 +76,10 @@ public class OrganizationManageImpl implements OrganizationManageService { ...@@ -74,10 +76,10 @@ public class OrganizationManageImpl implements OrganizationManageService {
*/ */
@Override @Override
public Result add(OrganizationManageAddReq req) { public Result add(OrganizationManageAddReq req) {
//SysUserDto currentUser = (SysUserDto)redisTemplate.opsForValue().get("user"+ RedisMessageConstant.SENDTYPE_LOGIN_SYS); SysUserDto currentUser = (SysUserDto)redisTemplate.opsForValue().get("user"+ RedisMessageConstant.SENDTYPE_LOGIN_SYS);
//if (null == currentUser){ if (null == currentUser){
// return Result.of_error(ResultMsg.USER_NOT_EXIST); return Result.of_error(ResultMsg.USER_NOT_EXIST);
//} }
if (StringUtils.isNotBlank(req.getOrgName())) { if (StringUtils.isNotBlank(req.getOrgName())) {
ApiOrg orgNameInfo = getOrgNameInfo(req.getOrgName()); ApiOrg orgNameInfo = getOrgNameInfo(req.getOrgName());
if (null != orgNameInfo) { if (null != orgNameInfo) {
...@@ -98,7 +100,7 @@ public class OrganizationManageImpl implements OrganizationManageService { ...@@ -98,7 +100,7 @@ public class OrganizationManageImpl implements OrganizationManageService {
} }
apiOrg.setOrgCode(coding);//组织编码需要生成 apiOrg.setOrgCode(coding);//组织编码需要生成
apiOrg.setStatus("1");//正常 apiOrg.setStatus("1");//正常
//apiOrg.setCreateUser(currentUser.getUserName()); apiOrg.setCreateUser(currentUser.getUserName());
if (apiOrgMapper.insert(apiOrg) > 0) { if (apiOrgMapper.insert(apiOrg) > 0) {
return Result.of_success(ResultMsg.INSERT_SUCCESS); return Result.of_success(ResultMsg.INSERT_SUCCESS);
} }
...@@ -130,10 +132,10 @@ public class OrganizationManageImpl implements OrganizationManageService { ...@@ -130,10 +132,10 @@ public class OrganizationManageImpl implements OrganizationManageService {
*/ */
@Override @Override
public Result update(OrganizationManageUpdateReq req) { public Result update(OrganizationManageUpdateReq req) {
//SysUserDto currentUser = (SysUserDto)redisTemplate.opsForValue().get("user"+ RedisMessageConstant.SENDTYPE_LOGIN_SYS); SysUserDto currentUser = (SysUserDto)redisTemplate.opsForValue().get("user"+ RedisMessageConstant.SENDTYPE_LOGIN_SYS);
//if (null == currentUser){ if (null == currentUser){
// return Result.of_error(ResultMsg.USER_NOT_EXIST); return Result.of_error(ResultMsg.USER_NOT_EXIST);
//} }
ApiOrg apiOrg = apiOrgMapper.selectById(req.getId()); ApiOrg apiOrg = apiOrgMapper.selectById(req.getId());
if (null == apiOrg) { if (null == apiOrg) {
return Result.of_error("组织信息不存在!"); return Result.of_error("组织信息不存在!");
...@@ -148,7 +150,7 @@ public class OrganizationManageImpl implements OrganizationManageService { ...@@ -148,7 +150,7 @@ public class OrganizationManageImpl implements OrganizationManageService {
apiOrgUpdate.setId(apiOrg.getId()); apiOrgUpdate.setId(apiOrg.getId());
BeanUtils.copyProperties(req, apiOrgUpdate); BeanUtils.copyProperties(req, apiOrgUpdate);
apiOrgUpdate.setUpdateDate(new Date()); apiOrgUpdate.setUpdateDate(new Date());
//apiOrgUpdate.setUpdateUser(currentUser.getUserName()); apiOrgUpdate.setUpdateUser(currentUser.getUserName());
if (apiOrgMapper.updateById(apiOrgUpdate) > 0) { if (apiOrgMapper.updateById(apiOrgUpdate) > 0) {
return Result.of_success(ResultMsg.UPDATE_SUCCESS); return Result.of_success(ResultMsg.UPDATE_SUCCESS);
} }
......
...@@ -3,7 +3,9 @@ package com.jz.dm.service.impl; ...@@ -3,7 +3,9 @@ package com.jz.dm.service.impl;
import com.alibaba.fastjson.JSONArray; 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.metadata.IPage;
import com.baomidou.mybatisplus.extension.exceptions.ApiException; import com.baomidou.mybatisplus.extension.exceptions.ApiException;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jz.common.bean.SysUserDto; import com.jz.common.bean.SysUserDto;
import com.jz.common.constant.ResultMsg; import com.jz.common.constant.ResultMsg;
import com.jz.common.utils.RedisUtils; import com.jz.common.utils.RedisUtils;
...@@ -54,6 +56,8 @@ public class ProducerServiceImpl implements ProducerService { ...@@ -54,6 +56,8 @@ public class ProducerServiceImpl implements ProducerService {
private ApiOpenApiEsTagconfigMapper apiOpenApiEsTagconfigMapper; private ApiOpenApiEsTagconfigMapper apiOpenApiEsTagconfigMapper;
@Resource @Resource
private ApiInterfaceCustomMapper apiInterfaceCustomMapper; private ApiInterfaceCustomMapper apiInterfaceCustomMapper;
@Resource
private ApiInterfaceFileMapper apiInterfaceFileMapper;
@Autowired @Autowired
private RedisTemplate<String, Object> redisTemplate; private RedisTemplate<String, Object> redisTemplate;
@Autowired @Autowired
...@@ -68,6 +72,21 @@ public class ProducerServiceImpl implements ProducerService { ...@@ -68,6 +72,21 @@ public class ProducerServiceImpl implements ProducerService {
@Value("${dmp.ignoreRedis}") @Value("${dmp.ignoreRedis}")
protected boolean ignoreRedis; protected boolean ignoreRedis;
/**
* 获取文件列表
* @param pageSize
* @param pageNum
* @return
*/
@Override
public IPage<ApiInterfaceFile> getFileCatalog(String pageNum,String pageSize) {
Integer pageN = Integer.valueOf(pageNum);
Integer pageS = Integer.valueOf(pageSize);
IPage<ApiInterfaceFile> page = new Page<>(pageN, pageS);
QueryWrapper<ApiInterfaceFile> query = new QueryWrapper<>();
query.orderByDesc("create_time");
return apiInterfaceFileMapper.selectPage(page, query);
}
/** /**
* 制作自定义Api * 制作自定义Api
...@@ -251,6 +270,8 @@ public class ProducerServiceImpl implements ProducerService { ...@@ -251,6 +270,8 @@ public class ProducerServiceImpl implements ProducerService {
return Result.of_success(ResultMsg.INSERT_SUCCESS); return Result.of_success(ResultMsg.INSERT_SUCCESS);
} }
/** /**
* 保存修改的api信息 * 保存修改的api信息
* *
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jz.dm.mapper.ApiInterfaceMapper"> <mapper namespace="com.jz.dm.mapper.ApiInterfaceCustomMapper">
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jz.dm.mapper.ApiInterfaceFileMapper">
</mapper>
\ No newline at end of file
...@@ -34,7 +34,12 @@ ...@@ -34,7 +34,12 @@
<groupId>org.springframework.session</groupId> <groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId> <artifactId>spring-session-data-redis</artifactId>
</dependency> </dependency>
<!--httpclient包-->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.6</version>
</dependency>
<!-- fastjson --> <!-- fastjson -->
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
...@@ -57,11 +62,11 @@ ...@@ -57,11 +62,11 @@
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
</dependency> </dependency>
<!-- lombok --> <!-- lombok -->
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
</dependency> </dependency>
<!-- swagger2接口文档 --> <!-- swagger2接口文档 -->
<dependency> <dependency>
......
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