mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
5.0
This commit is contained in:
4
pom.xml
4
pom.xml
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>doc</module>
|
<module>doc</module>
|
||||||
<!-- <module>sop-common</module>-->
|
<module>sop-common</module>
|
||||||
<!-- <module>sop-auth</module>-->
|
<!-- <module>sop-auth</module>-->
|
||||||
<module>sop-example</module>
|
<module>sop-example</module>
|
||||||
<module>sop-admin</module>
|
<module>sop-admin</module>
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
<module>sop-test</module>
|
<module>sop-test</module>
|
||||||
<module>sop-sdk</module>
|
<module>sop-sdk</module>
|
||||||
<!-- <module>sop-website</module>-->
|
<!-- <module>sop-website</module>-->
|
||||||
<module>sop-index</module>
|
<module>sop-gateway</module>
|
||||||
<module>sop-registry</module>
|
<module>sop-registry</module>
|
||||||
<module>sop-support</module>
|
<module>sop-support</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
@@ -0,0 +1,14 @@
|
|||||||
|
package com.gitee.sop.adminbackend.common.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class IdDTO {
|
||||||
|
@NotNull(message = "id不能为空")
|
||||||
|
private Long id;
|
||||||
|
}
|
@@ -0,0 +1,16 @@
|
|||||||
|
package com.gitee.sop.adminbackend.common.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class StatusUpdateDTO extends IdDTO {
|
||||||
|
|
||||||
|
@NotNull(message = "状态不能为空")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.adminbackend.common;
|
package com.gitee.sop.adminbackend.common.enums;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
@@ -0,0 +1,33 @@
|
|||||||
|
package com.gitee.sop.adminbackend.common.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum StatusEnum {
|
||||||
|
DISABLED((byte)2),
|
||||||
|
ENABLE((byte)1),
|
||||||
|
SET_PWD((byte)3),
|
||||||
|
;
|
||||||
|
|
||||||
|
private final int status;
|
||||||
|
|
||||||
|
public static StatusEnum of(Integer value) {
|
||||||
|
for (StatusEnum statusEnum : StatusEnum.values()) {
|
||||||
|
if (Objects.equals(statusEnum.status, value)) {
|
||||||
|
return statusEnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return DISABLED;
|
||||||
|
}
|
||||||
|
|
||||||
|
StatusEnum(byte style) {
|
||||||
|
this.status = style;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,14 @@
|
|||||||
|
package com.gitee.sop.adminbackend.common.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class IdParam {
|
||||||
|
@NotNull(message = "id不能为空")
|
||||||
|
private Long id;
|
||||||
|
}
|
@@ -0,0 +1,16 @@
|
|||||||
|
package com.gitee.sop.adminbackend.common.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class StatusUpdateParam extends IdParam {
|
||||||
|
|
||||||
|
@NotNull(message = "状态不能为空")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,46 @@
|
|||||||
|
package com.gitee.sop.adminbackend.common.resp;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author thc
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class Result<T> {
|
||||||
|
|
||||||
|
private static final Result<?> RESULT = new Result<>();
|
||||||
|
|
||||||
|
private String code = "0";
|
||||||
|
private T data;
|
||||||
|
private String msg = "success";
|
||||||
|
|
||||||
|
public static Result<?> ok() {
|
||||||
|
return RESULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <E> Result<E> ok(E obj) {
|
||||||
|
Result<E> result = new Result<>();
|
||||||
|
result.setData(obj);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <E> Result<E> err(String msg) {
|
||||||
|
Result<E> result = new Result<>();
|
||||||
|
result.setCode("1");
|
||||||
|
result.setMsg(msg);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <E> Result<E> err(String code, String msg) {
|
||||||
|
Result<E> result = new Result<>();
|
||||||
|
result.setCode(code);
|
||||||
|
result.setMsg(msg);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getSuccess() {
|
||||||
|
return Objects.equals("0", code);
|
||||||
|
}
|
||||||
|
}
|
@@ -1,6 +1,6 @@
|
|||||||
package com.gitee.sop.adminbackend.config;
|
package com.gitee.sop.adminbackend.config;
|
||||||
|
|
||||||
import com.gitee.sop.adminbackend.common.ConfigKeyEnum;
|
import com.gitee.sop.adminbackend.common.enums.ConfigKeyEnum;
|
||||||
import com.gitee.sop.adminbackend.common.IConfig;
|
import com.gitee.sop.adminbackend.common.IConfig;
|
||||||
import com.gitee.sop.adminbackend.common.SpringContext;
|
import com.gitee.sop.adminbackend.common.SpringContext;
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
package com.gitee.sop.adminbackend.controller;
|
package com.gitee.sop.adminbackend.controller;
|
||||||
|
|
||||||
import com.gitee.sop.adminbackend.common.Result;
|
import com.gitee.sop.adminbackend.common.resp.Result;
|
||||||
import com.gitee.sop.adminbackend.common.exception.BizException;
|
import com.gitee.sop.adminbackend.common.exception.BizException;
|
||||||
import com.gitee.sop.adminbackend.common.exception.ErrorCode;
|
import com.gitee.sop.adminbackend.common.exception.ErrorCode;
|
||||||
import com.gitee.sop.adminbackend.common.exception.ExceptionCode;
|
import com.gitee.sop.adminbackend.common.exception.ExceptionCode;
|
||||||
|
@@ -0,0 +1,91 @@
|
|||||||
|
package com.gitee.sop.adminbackend.controller.isv;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.core.PageInfo;
|
||||||
|
import com.gitee.fastmybatis.core.query.Query;
|
||||||
|
import com.gitee.fastmybatis.core.query.param.PageParam;
|
||||||
|
import com.gitee.sop.adminbackend.common.req.IdParam;
|
||||||
|
import com.gitee.sop.adminbackend.common.resp.Result;
|
||||||
|
import com.gitee.sop.adminbackend.controller.isv.dto.IsvKeysDTO;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.IsvInfo;
|
||||||
|
import com.gitee.sop.adminbackend.service.isv.IsvInfoService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("isv")
|
||||||
|
public class IsvInfoController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IsvInfoService isvInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/page")
|
||||||
|
public Result<PageInfo<IsvInfo>> page(PageParam param) {
|
||||||
|
Query query = param.toQuery();
|
||||||
|
PageInfo<IsvInfo> pageInfo = isvInfoService.page(query);
|
||||||
|
return Result.ok(pageInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取秘钥信息
|
||||||
|
*
|
||||||
|
* @param appId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/getKeys")
|
||||||
|
public Result<IsvKeysDTO> getKeys(String appId) {
|
||||||
|
IsvKeysDTO isvKeysDTO = isvInfoService.getKeys(appId);
|
||||||
|
return Result.ok(isvKeysDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增记录
|
||||||
|
*
|
||||||
|
* @param user
|
||||||
|
* @return 返回添加后的主键值
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result<Long> add(@Validated @RequestBody IsvInfo user) {
|
||||||
|
isvInfoService.save(user);
|
||||||
|
// 返回添加后的主键值
|
||||||
|
return Result.ok(user.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改记录
|
||||||
|
*
|
||||||
|
* @param user 表单数据
|
||||||
|
* @return 返回影响行数
|
||||||
|
*/
|
||||||
|
@PostMapping("/update")
|
||||||
|
public Result<Integer> update(@Validated @RequestBody IsvInfo user) {
|
||||||
|
return Result.ok(isvInfoService.update(user));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除记录
|
||||||
|
*
|
||||||
|
* @param param 参数
|
||||||
|
* @return 返回影响行数
|
||||||
|
*/
|
||||||
|
@PostMapping("/delete")
|
||||||
|
public Result<Integer> delete(@Validated @RequestBody IdParam param) {
|
||||||
|
return Result.ok(isvInfoService.deleteById(param.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,31 @@
|
|||||||
|
package com.gitee.sop.adminbackend.controller.isv.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class IsvKeysDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开发者生成的公钥, 数据库字段:public_key_isv
|
||||||
|
*/
|
||||||
|
private String publicKeyIsv;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开发者生成的私钥(交给开发者), 数据库字段:private_key_isv
|
||||||
|
*/
|
||||||
|
private String privateKeyIsv;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台生成的公钥(交给开发者), 数据库字段:public_key_platform
|
||||||
|
*/
|
||||||
|
private String publicKeyPlatform;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台生成的私钥, 数据库字段:private_key_platform
|
||||||
|
*/
|
||||||
|
private String privateKeyPlatform;
|
||||||
|
|
||||||
|
}
|
@@ -2,11 +2,14 @@ package com.gitee.sop.adminbackend.controller.serve;
|
|||||||
|
|
||||||
import com.gitee.fastmybatis.core.PageInfo;
|
import com.gitee.fastmybatis.core.PageInfo;
|
||||||
import com.gitee.fastmybatis.core.query.Query;
|
import com.gitee.fastmybatis.core.query.Query;
|
||||||
import com.gitee.sop.adminbackend.common.IdParam;
|
import com.gitee.sop.adminbackend.common.dto.StatusUpdateDTO;
|
||||||
import com.gitee.sop.adminbackend.common.Result;
|
import com.gitee.sop.adminbackend.common.req.IdParam;
|
||||||
|
import com.gitee.sop.adminbackend.common.req.StatusUpdateParam;
|
||||||
|
import com.gitee.sop.adminbackend.common.resp.Result;
|
||||||
import com.gitee.sop.adminbackend.controller.serve.req.ApiInfoParam;
|
import com.gitee.sop.adminbackend.controller.serve.req.ApiInfoParam;
|
||||||
import com.gitee.sop.adminbackend.dao.entity.ApiInfo;
|
import com.gitee.sop.adminbackend.dao.entity.ApiInfo;
|
||||||
import com.gitee.sop.adminbackend.service.serve.ApiInfoService;
|
import com.gitee.sop.adminbackend.service.serve.ApiInfoService;
|
||||||
|
import com.gitee.sop.adminbackend.util.CopyUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -66,6 +69,18 @@ public class ApiInfoController {
|
|||||||
return Result.ok(apiInfoService.update(user));
|
return Result.ok(apiInfoService.update(user));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改状态
|
||||||
|
*
|
||||||
|
* @param param 表单数据
|
||||||
|
* @return 返回影响行数
|
||||||
|
*/
|
||||||
|
@PostMapping("/updateStatus")
|
||||||
|
public Result<Integer> updateStatus(@Validated @RequestBody StatusUpdateParam param) {
|
||||||
|
StatusUpdateDTO statusUpdateDTO = CopyUtil.copyBean(param, StatusUpdateDTO::new);
|
||||||
|
return Result.ok(apiInfoService.updateStatus(statusUpdateDTO));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除记录
|
* 删除记录
|
||||||
*
|
*
|
||||||
|
@@ -14,5 +14,7 @@ public class ApiInfoParam extends PageParam {
|
|||||||
@Condition(operator = Operator.like)
|
@Condition(operator = Operator.like)
|
||||||
private String apiName;
|
private String apiName;
|
||||||
|
|
||||||
|
@Condition
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
package com.gitee.sop.adminbackend.controller.sys;
|
package com.gitee.sop.adminbackend.controller.sys;
|
||||||
|
|
||||||
import com.gitee.sop.adminbackend.common.Result;
|
import com.gitee.sop.adminbackend.common.resp.Result;
|
||||||
import com.gitee.sop.adminbackend.controller.sys.req.LoginParam;
|
import com.gitee.sop.adminbackend.controller.sys.req.LoginParam;
|
||||||
import com.gitee.sop.adminbackend.controller.sys.resp.LoginResultVO;
|
import com.gitee.sop.adminbackend.controller.sys.resp.LoginResultVO;
|
||||||
import com.gitee.sop.adminbackend.service.sys.login.LoginService;
|
import com.gitee.sop.adminbackend.service.sys.login.LoginService;
|
||||||
|
@@ -3,14 +3,15 @@ package com.gitee.sop.adminbackend.controller.sys;
|
|||||||
import com.gitee.fastmybatis.core.PageInfo;
|
import com.gitee.fastmybatis.core.PageInfo;
|
||||||
import com.gitee.fastmybatis.core.query.Query;
|
import com.gitee.fastmybatis.core.query.Query;
|
||||||
import com.gitee.fastmybatis.core.query.param.PageParam;
|
import com.gitee.fastmybatis.core.query.param.PageParam;
|
||||||
import com.gitee.sop.adminbackend.common.Result;
|
import com.gitee.sop.adminbackend.common.req.IdParam;
|
||||||
|
import com.gitee.sop.adminbackend.common.resp.Result;
|
||||||
import com.gitee.sop.adminbackend.dao.entity.SysAdminUser;
|
import com.gitee.sop.adminbackend.dao.entity.SysAdminUser;
|
||||||
import com.gitee.sop.adminbackend.service.sys.SysAdminUserService;
|
import com.gitee.sop.adminbackend.service.sys.SysAdminUserService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@@ -28,8 +29,8 @@ public class SysAdminUserController {
|
|||||||
/**
|
/**
|
||||||
* 分页查询
|
* 分页查询
|
||||||
*
|
*
|
||||||
* @param param
|
* @param param 查询参数
|
||||||
* @return
|
* @return 返回分页结果
|
||||||
*/
|
*/
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public Result<PageInfo<SysAdminUser>> page(PageParam param) {
|
public Result<PageInfo<SysAdminUser>> page(PageParam param) {
|
||||||
@@ -41,36 +42,36 @@ public class SysAdminUserController {
|
|||||||
/**
|
/**
|
||||||
* 新增记录
|
* 新增记录
|
||||||
*
|
*
|
||||||
* @param user
|
* @param sysAdminUser 表单参数
|
||||||
* @return
|
* @return 返回添加后的主键值
|
||||||
*/
|
*/
|
||||||
@PostMapping("/save")
|
@PostMapping("/add")
|
||||||
public Result<Long> save(SysAdminUser user) {
|
public Result<Long> add(@Validated @RequestBody SysAdminUser sysAdminUser) {
|
||||||
sysAdminUserService.save(user);
|
sysAdminUserService.save(sysAdminUser);
|
||||||
// 返回添加后的主键值
|
// 返回添加后的主键值
|
||||||
return Result.ok(user.getId());
|
return Result.ok(sysAdminUser.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改记录
|
* 修改记录
|
||||||
*
|
*
|
||||||
* @param user 表单数据
|
* @param sysAdminUser 表单数据
|
||||||
* @return
|
* @return 返回影响行数
|
||||||
*/
|
*/
|
||||||
@PutMapping("/update")
|
@PostMapping("/update")
|
||||||
public Result<Integer> update(SysAdminUser user) {
|
public Result<Integer> update(@Validated @RequestBody SysAdminUser sysAdminUser) {
|
||||||
return Result.ok(sysAdminUserService.update(user));
|
return Result.ok(sysAdminUserService.update(sysAdminUser));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除记录
|
* 删除记录
|
||||||
*
|
*
|
||||||
* @param id 主键id
|
* @param param 参数
|
||||||
* @return
|
* @return 返回影响行数
|
||||||
*/
|
*/
|
||||||
@DeleteMapping("/delete")
|
@PostMapping("/delete")
|
||||||
public Result<?> delete(Long id) {
|
public Result<Integer> delete(@Validated @RequestBody IdParam param) {
|
||||||
return Result.ok(sysAdminUserService.deleteById(id));
|
return Result.ok(sysAdminUserService.deleteById(param.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -71,6 +71,11 @@ public class ApiInfo {
|
|||||||
*/
|
*/
|
||||||
private Integer isNeedToken;
|
private Integer isNeedToken;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册来源,1-系统注册,2-手动注册
|
||||||
|
*/
|
||||||
|
private Integer regSource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 1启用,2禁用
|
* 1启用,2禁用
|
||||||
*/
|
*/
|
||||||
|
@@ -0,0 +1,29 @@
|
|||||||
|
package com.gitee.sop.adminbackend.service.isv;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||||
|
import com.gitee.sop.adminbackend.controller.isv.dto.IsvKeysDTO;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.IsvInfo;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.IsvKeys;
|
||||||
|
import com.gitee.sop.adminbackend.dao.mapper.IsvInfoMapper;
|
||||||
|
import com.gitee.sop.adminbackend.dao.mapper.IsvKeysMapper;
|
||||||
|
import com.gitee.sop.adminbackend.util.CopyUtil;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class IsvInfoService implements LambdaService<IsvInfo, IsvInfoMapper> {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IsvKeysMapper isvKeysMapper;
|
||||||
|
|
||||||
|
public IsvKeysDTO getKeys(String appId) {
|
||||||
|
IsvKeys isvKeys = isvKeysMapper.get(IsvKeys::getAppId, appId);
|
||||||
|
return CopyUtil.copyBean(isvKeys, IsvKeysDTO::new);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -1,6 +1,7 @@
|
|||||||
package com.gitee.sop.adminbackend.service.serve;
|
package com.gitee.sop.adminbackend.service.serve;
|
||||||
|
|
||||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||||
|
import com.gitee.sop.adminbackend.common.dto.StatusUpdateDTO;
|
||||||
import com.gitee.sop.adminbackend.dao.entity.ApiInfo;
|
import com.gitee.sop.adminbackend.dao.entity.ApiInfo;
|
||||||
import com.gitee.sop.adminbackend.dao.mapper.ApiInfoMapper;
|
import com.gitee.sop.adminbackend.dao.mapper.ApiInfoMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -12,4 +13,11 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service
|
@Service
|
||||||
public class ApiInfoService implements LambdaService<ApiInfo, ApiInfoMapper> {
|
public class ApiInfoService implements LambdaService<ApiInfo, ApiInfoMapper> {
|
||||||
|
|
||||||
|
public int updateStatus(StatusUpdateDTO statusUpdateDTO) {
|
||||||
|
return this.query()
|
||||||
|
.eq(ApiInfo::getId, statusUpdateDTO.getId())
|
||||||
|
.set(ApiInfo::getStatus, statusUpdateDTO.getStatus())
|
||||||
|
.update();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,7 @@
|
|||||||
package com.gitee.sop.adminbackend.service.sys;
|
package com.gitee.sop.adminbackend.service.sys;
|
||||||
|
|
||||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||||
import com.gitee.sop.adminbackend.common.ConfigKeyEnum;
|
import com.gitee.sop.adminbackend.common.enums.ConfigKeyEnum;
|
||||||
import com.gitee.sop.adminbackend.config.AdminConfig;
|
|
||||||
import com.gitee.sop.adminbackend.config.Configs;
|
import com.gitee.sop.adminbackend.config.Configs;
|
||||||
import com.gitee.sop.adminbackend.dao.entity.SysAdminUser;
|
import com.gitee.sop.adminbackend.dao.entity.SysAdminUser;
|
||||||
import com.gitee.sop.adminbackend.dao.mapper.SysAdminUserMapper;
|
import com.gitee.sop.adminbackend.dao.mapper.SysAdminUserMapper;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
package com.gitee.sop.adminbackend.service.sys;
|
package com.gitee.sop.adminbackend.service.sys;
|
||||||
|
|
||||||
import com.gitee.sop.adminbackend.common.ConfigKeyEnum;
|
import com.gitee.sop.adminbackend.common.enums.ConfigKeyEnum;
|
||||||
import com.gitee.sop.adminbackend.dao.entity.SysAdminUser;
|
import com.gitee.sop.adminbackend.dao.entity.SysAdminUser;
|
||||||
import com.gitee.sop.adminbackend.dao.mapper.UpgradeMapper;
|
import com.gitee.sop.adminbackend.dao.mapper.UpgradeMapper;
|
||||||
import com.gitee.sop.adminbackend.service.sys.login.enums.RegTypeEnum;
|
import com.gitee.sop.adminbackend.service.sys.login.enums.RegTypeEnum;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package com.gitee.sop.adminbackend.service.sys.login;
|
package com.gitee.sop.adminbackend.service.sys.login;
|
||||||
|
|
||||||
import com.alibaba.nacos.shaded.com.google.common.collect.Sets;
|
import com.alibaba.nacos.shaded.com.google.common.collect.Sets;
|
||||||
import com.gitee.sop.adminbackend.common.ConfigKeyEnum;
|
import com.gitee.sop.adminbackend.common.enums.ConfigKeyEnum;
|
||||||
import com.gitee.sop.adminbackend.common.exception.BizException;
|
import com.gitee.sop.adminbackend.common.exception.BizException;
|
||||||
import com.gitee.sop.adminbackend.config.Configs;
|
import com.gitee.sop.adminbackend.config.Configs;
|
||||||
import com.gitee.sop.adminbackend.dao.entity.SysAdminUser;
|
import com.gitee.sop.adminbackend.dao.entity.SysAdminUser;
|
||||||
@@ -10,7 +10,7 @@ import com.gitee.sop.adminbackend.service.sys.login.dto.LoginDTO;
|
|||||||
import com.gitee.sop.adminbackend.service.sys.login.dto.LoginForm;
|
import com.gitee.sop.adminbackend.service.sys.login.dto.LoginForm;
|
||||||
import com.gitee.sop.adminbackend.service.sys.login.dto.LoginResult;
|
import com.gitee.sop.adminbackend.service.sys.login.dto.LoginResult;
|
||||||
import com.gitee.sop.adminbackend.service.sys.login.dto.LoginUser;
|
import com.gitee.sop.adminbackend.service.sys.login.dto.LoginUser;
|
||||||
import com.gitee.sop.adminbackend.common.StatusEnum;
|
import com.gitee.sop.adminbackend.common.enums.StatusEnum;
|
||||||
import com.gitee.sop.adminbackend.service.sys.login.enums.RegTypeEnum;
|
import com.gitee.sop.adminbackend.service.sys.login.enums.RegTypeEnum;
|
||||||
import com.gitee.sop.adminbackend.util.CopyUtil;
|
import com.gitee.sop.adminbackend.util.CopyUtil;
|
||||||
import com.gitee.sop.adminbackend.util.GenerateUtil;
|
import com.gitee.sop.adminbackend.util.GenerateUtil;
|
||||||
|
@@ -5,7 +5,7 @@ import com.gitee.sop.adminbackend.dao.entity.SysAdminUser;
|
|||||||
import com.gitee.sop.adminbackend.service.sys.SysAdminUserService;
|
import com.gitee.sop.adminbackend.service.sys.SysAdminUserService;
|
||||||
import com.gitee.sop.adminbackend.service.sys.login.UserCacheManager;
|
import com.gitee.sop.adminbackend.service.sys.login.UserCacheManager;
|
||||||
import com.gitee.sop.adminbackend.service.sys.login.dto.LoginUser;
|
import com.gitee.sop.adminbackend.service.sys.login.dto.LoginUser;
|
||||||
import com.gitee.sop.adminbackend.common.StatusEnum;
|
import com.gitee.sop.adminbackend.common.enums.StatusEnum;
|
||||||
import com.gitee.sop.adminbackend.util.CopyUtil;
|
import com.gitee.sop.adminbackend.util.CopyUtil;
|
||||||
import com.google.common.cache.CacheBuilder;
|
import com.google.common.cache.CacheBuilder;
|
||||||
import com.google.common.cache.CacheLoader;
|
import com.google.common.cache.CacheLoader;
|
||||||
|
@@ -1,27 +1,62 @@
|
|||||||
// 模拟后端动态生成路由
|
// 模拟后端动态生成路由
|
||||||
import { defineFakeRoute } from "vite-plugin-fake-server/client";
|
import { defineFakeRoute } from "vite-plugin-fake-server/client";
|
||||||
|
|
||||||
/**
|
const apiRouters = [
|
||||||
* 服务管理
|
{
|
||||||
*/
|
path: "/serve",
|
||||||
const apiRouter = {
|
meta: {
|
||||||
path: "/serve",
|
title: "服务管理",
|
||||||
meta: {
|
icon: "ri:server-line",
|
||||||
title: "服务管理",
|
rank: 10
|
||||||
icon: "ri:server-line",
|
},
|
||||||
rank: 10
|
children: [
|
||||||
},
|
{
|
||||||
children: [
|
path: "/serve/api/index",
|
||||||
{
|
name: "ApiManage",
|
||||||
path: "/serve/api/index",
|
meta: {
|
||||||
name: "ApiManage",
|
title: "接口管理",
|
||||||
meta: {
|
roles: ["admin"]
|
||||||
title: "接口管理",
|
}
|
||||||
roles: ["admin"]
|
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
]
|
},
|
||||||
};
|
{
|
||||||
|
path: "/isv",
|
||||||
|
meta: {
|
||||||
|
title: "ISV管理",
|
||||||
|
icon: "ri:shield-user-line",
|
||||||
|
rank: 10
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: "/isv/list/index",
|
||||||
|
name: "IsvManage",
|
||||||
|
meta: {
|
||||||
|
title: "ISV列表",
|
||||||
|
roles: ["admin"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/sys",
|
||||||
|
meta: {
|
||||||
|
title: "系统管理",
|
||||||
|
icon: "ri:settings-2-line",
|
||||||
|
rank: 10
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: "/admin/user/index",
|
||||||
|
name: "AdminUser",
|
||||||
|
meta: {
|
||||||
|
title: "用户管理",
|
||||||
|
roles: ["admin"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
export default defineFakeRoute([
|
export default defineFakeRoute([
|
||||||
{
|
{
|
||||||
@@ -30,7 +65,7 @@ export default defineFakeRoute([
|
|||||||
response: () => {
|
response: () => {
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
data: [apiRouter]
|
data: apiRouters
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
52
sop-admin/sop-admin-frontend/src/api/isvList.ts
Normal file
52
sop-admin/sop-admin-frontend/src/api/isvList.ts
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
import { createUrl, http } from "@/utils/http";
|
||||||
|
import type { PageResult, Result } from "@/model";
|
||||||
|
|
||||||
|
// 后端请求接口
|
||||||
|
const apiUrl: any = createUrl({
|
||||||
|
page: "/isv/page",
|
||||||
|
add: "/isv/add",
|
||||||
|
update: "/isv/update",
|
||||||
|
del: "/isv/delete",
|
||||||
|
getKeys: "/isv/getKeys"
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口管理
|
||||||
|
*/
|
||||||
|
export const api: any = {
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
* @param params 查询参数
|
||||||
|
*/
|
||||||
|
page(params: object): Promise<PageResult> {
|
||||||
|
return http.get<PageResult, any>(apiUrl.page, { params });
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
* @param data 表单内容
|
||||||
|
*/
|
||||||
|
add(data: object) {
|
||||||
|
return http.post<Result, any>(apiUrl.add, { data });
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
* @param data 表单内容
|
||||||
|
*/
|
||||||
|
update(data: object) {
|
||||||
|
return http.post<Result, any>(apiUrl.update, { data });
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
* @param data 表单内容
|
||||||
|
*/
|
||||||
|
del(data: object) {
|
||||||
|
return http.post<Result, any>(apiUrl.del, { data });
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 查看秘钥
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
viewKeys(params: object) {
|
||||||
|
return http.get<Result, any>(apiUrl.getKeys, { params });
|
||||||
|
}
|
||||||
|
};
|
@@ -6,5 +6,5 @@ type Result = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getAsyncRoutes = () => {
|
export const getAsyncRoutes = () => {
|
||||||
return http.request<Result>("get", "/mock/get-async-routes");
|
return http.request<Result>("get", "/get-async-routes");
|
||||||
};
|
};
|
||||||
|
52
sop-admin/sop-admin-frontend/src/api/serveApi.ts
Normal file
52
sop-admin/sop-admin-frontend/src/api/serveApi.ts
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
import { createUrl, http } from "@/utils/http";
|
||||||
|
import type { PageResult, Result } from "@/model";
|
||||||
|
|
||||||
|
// 后端请求接口
|
||||||
|
const apiUrl: any = createUrl({
|
||||||
|
page: "/serve/api/page",
|
||||||
|
add: "/serve/api/add",
|
||||||
|
update: "/serve/api/update",
|
||||||
|
del: "/serve/api/delete",
|
||||||
|
updateStatus: "/serve/api/updateStatus"
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口管理
|
||||||
|
*/
|
||||||
|
export const api: any = {
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
* @param params 查询参数
|
||||||
|
*/
|
||||||
|
page(params: object): Promise<PageResult> {
|
||||||
|
return http.get<PageResult, any>(apiUrl.page, { params });
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
* @param data 表单内容
|
||||||
|
*/
|
||||||
|
add(data: object) {
|
||||||
|
return http.post<Result, any>(apiUrl.add, { data });
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
* @param data 表单内容
|
||||||
|
*/
|
||||||
|
update(data: object) {
|
||||||
|
return http.post<Result, any>(apiUrl.update, { data });
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
* @param data 表单内容
|
||||||
|
*/
|
||||||
|
del(data: object) {
|
||||||
|
return http.post<Result, any>(apiUrl.del, { data });
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 修改状态
|
||||||
|
* @param data 表单内容
|
||||||
|
*/
|
||||||
|
updateStatus(data: object) {
|
||||||
|
return http.post<Result, any>(apiUrl.updateStatus, { data });
|
||||||
|
}
|
||||||
|
};
|
44
sop-admin/sop-admin-frontend/src/api/sysAdminUser.ts
Normal file
44
sop-admin/sop-admin-frontend/src/api/sysAdminUser.ts
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import { createUrl, http } from "@/utils/http";
|
||||||
|
import type { PageResult, Result } from "@/model";
|
||||||
|
|
||||||
|
// 后端请求接口
|
||||||
|
const apiUrl: any = createUrl({
|
||||||
|
page: "/sys/adminuser/page",
|
||||||
|
add: "/sys/adminuser/add",
|
||||||
|
update: "/sys/adminuser/update",
|
||||||
|
del: "/sys/adminuser/delete"
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口管理
|
||||||
|
*/
|
||||||
|
export const api: any = {
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
* @param params 查询参数
|
||||||
|
*/
|
||||||
|
page(params: object): Promise<PageResult> {
|
||||||
|
return http.get<PageResult, any>(apiUrl.page, { params });
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
* @param data 表单内容
|
||||||
|
*/
|
||||||
|
add(data: object) {
|
||||||
|
return http.post<Result, any>(apiUrl.add, { data });
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
* @param data 表单内容
|
||||||
|
*/
|
||||||
|
update(data: object) {
|
||||||
|
return http.post<Result, any>(apiUrl.update, { data });
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
* @param data 表单内容
|
||||||
|
*/
|
||||||
|
del(data: object) {
|
||||||
|
return http.post<Result, any>(apiUrl.del, { data });
|
||||||
|
}
|
||||||
|
};
|
@@ -1,4 +1,4 @@
|
|||||||
import { http } from "@/utils/http";
|
import { baseUrl, http } from "@/utils/http";
|
||||||
|
|
||||||
export type UserResult = {
|
export type UserResult = {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
@@ -34,12 +34,19 @@ export type RefreshTokenResult = {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const apiUrl = {
|
||||||
|
login: baseUrl("/sys/login"),
|
||||||
|
refreshToken: baseUrl("/sys/refresh-token")
|
||||||
|
};
|
||||||
|
|
||||||
/** 登录 */
|
/** 登录 */
|
||||||
export const getLogin = (data?: object) => {
|
export const getLogin = (data?: object) => {
|
||||||
return http.request<UserResult>("post", "/sys/login", { data });
|
return http.request<UserResult>("post", apiUrl.login, { data });
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 刷新`token` */
|
/** 刷新`token` */
|
||||||
export const refreshTokenApi = (data?: object) => {
|
export const refreshTokenApi = (data?: object) => {
|
||||||
return http.request<RefreshTokenResult>("post", "/refresh-token", { data });
|
return http.request<RefreshTokenResult>("post", apiUrl.refreshToken, {
|
||||||
|
data
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
4
sop-admin/sop-admin-frontend/src/model/enums/index.ts
Normal file
4
sop-admin/sop-admin-frontend/src/model/enums/index.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export enum StatusEnum {
|
||||||
|
ENABLE = 1,
|
||||||
|
DISABLE = 2
|
||||||
|
}
|
@@ -1,6 +1,8 @@
|
|||||||
export type Result = {
|
export type Result = {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
data: object;
|
data: object;
|
||||||
|
msg: "";
|
||||||
|
code: "";
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PageResult = {
|
export type PageResult = {
|
||||||
|
@@ -13,19 +13,23 @@ import { stringify } from "qs";
|
|||||||
import NProgress from "../progress";
|
import NProgress from "../progress";
|
||||||
import { getToken, formatToken } from "@/utils/auth";
|
import { getToken, formatToken } from "@/utils/auth";
|
||||||
import { useUserStoreHook } from "@/store/modules/user";
|
import { useUserStoreHook } from "@/store/modules/user";
|
||||||
|
import { ElMessage } from "element-plus";
|
||||||
const PREFIX_MOCK: string = "mock";
|
|
||||||
|
|
||||||
export const baseUrl = (url: string) => {
|
export const baseUrl = (url: string) => {
|
||||||
if (url.startsWith("/")) {
|
if (url.startsWith("/")) {
|
||||||
url = url.substring(1);
|
url = url.substring(1);
|
||||||
}
|
}
|
||||||
if (url.startsWith(PREFIX_MOCK)) {
|
|
||||||
return url.substring(PREFIX_MOCK.length);
|
|
||||||
}
|
|
||||||
return `/api/${url}`;
|
return `/api/${url}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const createUrl = (data: object) => {
|
||||||
|
const ret = {};
|
||||||
|
for (const dataKey in data) {
|
||||||
|
ret[dataKey] = baseUrl(data[dataKey]);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
// 相关配置请参考:www.axios-js.com/zh-cn/docs/#axios-request-config-1
|
// 相关配置请参考:www.axios-js.com/zh-cn/docs/#axios-request-config-1
|
||||||
const defaultConfig: AxiosRequestConfig = {
|
const defaultConfig: AxiosRequestConfig = {
|
||||||
// 请求超时时间
|
// 请求超时时间
|
||||||
@@ -45,6 +49,13 @@ class PureHttp {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.httpInterceptorsRequest();
|
this.httpInterceptorsRequest();
|
||||||
this.httpInterceptorsResponse();
|
this.httpInterceptorsResponse();
|
||||||
|
PureHttp.initConfig.beforeResponseCallback = response => {
|
||||||
|
const resp = response.data || {};
|
||||||
|
if (resp.code && resp.code !== "0") {
|
||||||
|
console.log(resp);
|
||||||
|
ElMessage.error(resp.msg || "后台出错,请查看日志");
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/** `token`过期后,暂存待执行的请求 */
|
/** `token`过期后,暂存待执行的请求 */
|
||||||
@@ -166,7 +177,7 @@ class PureHttp {
|
|||||||
): Promise<T> {
|
): Promise<T> {
|
||||||
const config = {
|
const config = {
|
||||||
method,
|
method,
|
||||||
url: baseUrl(url),
|
url: url,
|
||||||
...param,
|
...param,
|
||||||
...axiosConfig
|
...axiosConfig
|
||||||
} as PureHttpRequestConfig;
|
} as PureHttpRequestConfig;
|
||||||
|
306
sop-admin/sop-admin-frontend/src/views/admin/user/index.ts
Normal file
306
sop-admin/sop-admin-frontend/src/views/admin/user/index.ts
Normal file
@@ -0,0 +1,306 @@
|
|||||||
|
import { computed, ref } from "vue";
|
||||||
|
import {
|
||||||
|
type ButtonsCallBackParams,
|
||||||
|
type FieldValues,
|
||||||
|
type PageInfo,
|
||||||
|
type PlusColumn,
|
||||||
|
useTable
|
||||||
|
} from "plus-pro-components";
|
||||||
|
import { ElMessage } from "element-plus";
|
||||||
|
import { api } from "@/api/sysAdminUser";
|
||||||
|
|
||||||
|
const isAdd = ref(false);
|
||||||
|
|
||||||
|
// ========= search form =========
|
||||||
|
|
||||||
|
// 查询表单对象
|
||||||
|
export const searchFormData = ref({
|
||||||
|
id: "",
|
||||||
|
username: "",
|
||||||
|
password: "",
|
||||||
|
nickname: "",
|
||||||
|
email: "",
|
||||||
|
avatar: "",
|
||||||
|
status: "",
|
||||||
|
regType: "",
|
||||||
|
addTime: "",
|
||||||
|
updateTime: "",
|
||||||
|
pageIndex: 1,
|
||||||
|
pageSize: 10
|
||||||
|
});
|
||||||
|
|
||||||
|
// 查询表单字段定义
|
||||||
|
export const searchFormColumns: PlusColumn[] = [
|
||||||
|
{
|
||||||
|
label: "用户名",
|
||||||
|
prop: "username"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "密码",
|
||||||
|
prop: "password"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "用户名",
|
||||||
|
prop: "nickname"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "邮箱",
|
||||||
|
prop: "email"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "头像",
|
||||||
|
prop: "avatar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "状态,1:启用,2:禁用",
|
||||||
|
prop: "status"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "注册类型",
|
||||||
|
prop: "regType"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "addTime",
|
||||||
|
prop: "addTime"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "updateTime",
|
||||||
|
prop: "updateTime"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
// ========= table =========
|
||||||
|
|
||||||
|
// 表格对象
|
||||||
|
export const {
|
||||||
|
tableData,
|
||||||
|
total,
|
||||||
|
pageInfo,
|
||||||
|
buttons: actionButtons
|
||||||
|
} = useTable<any[]>();
|
||||||
|
// 默认每页条数,默认10
|
||||||
|
pageInfo.value.pageSize = 10;
|
||||||
|
|
||||||
|
// 表格字段定义
|
||||||
|
export const tableColumns: PlusColumn[] = [
|
||||||
|
{
|
||||||
|
label: "用户名",
|
||||||
|
prop: "username"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "密码",
|
||||||
|
prop: "password"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "用户名",
|
||||||
|
prop: "nickname"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "邮箱",
|
||||||
|
prop: "email"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "头像",
|
||||||
|
prop: "avatar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "状态,1:启用,2:禁用",
|
||||||
|
prop: "status"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "注册类型",
|
||||||
|
prop: "regType"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "addTime",
|
||||||
|
prop: "addTime"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "updateTime",
|
||||||
|
prop: "updateTime"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
// 表格按钮定义
|
||||||
|
actionButtons.value = [
|
||||||
|
{
|
||||||
|
// 修改
|
||||||
|
text: "修改",
|
||||||
|
code: "edit",
|
||||||
|
props: {
|
||||||
|
type: "primary"
|
||||||
|
},
|
||||||
|
show: computed(() => true),
|
||||||
|
onClick(params: ButtonsCallBackParams) {
|
||||||
|
isAdd.value = false;
|
||||||
|
editFormData.value = Object.assign({}, params.row);
|
||||||
|
dlgTitle.value = "修改";
|
||||||
|
dlgShow.value = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// 删除
|
||||||
|
text: "删除",
|
||||||
|
code: "delete",
|
||||||
|
props: {
|
||||||
|
type: "danger"
|
||||||
|
},
|
||||||
|
confirm: {
|
||||||
|
options: { draggable: false }
|
||||||
|
},
|
||||||
|
onConfirm(params: ButtonsCallBackParams) {
|
||||||
|
api.del(params).then(() => {
|
||||||
|
ElMessage({
|
||||||
|
message: "删除成功",
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
|
dlgShow.value = false;
|
||||||
|
search();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
// ========= dialog form =========
|
||||||
|
|
||||||
|
// 弹窗显示
|
||||||
|
export const dlgShow = ref(false);
|
||||||
|
export const dlgTitle = ref("");
|
||||||
|
// 表单值
|
||||||
|
const editFormDataGen = () => {
|
||||||
|
return {
|
||||||
|
username: "",
|
||||||
|
password: "",
|
||||||
|
nickname: "",
|
||||||
|
email: "",
|
||||||
|
avatar: "",
|
||||||
|
status: "",
|
||||||
|
regType: "",
|
||||||
|
addTime: "",
|
||||||
|
updateTime: ""
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export const editFormData = ref<FieldValues>(editFormDataGen());
|
||||||
|
export const editFormRules = {
|
||||||
|
id: [{ required: true, message: "请输入id" }],
|
||||||
|
username: [{ required: true, message: "请输入用户名" }],
|
||||||
|
password: [{ required: true, message: "请输入密码" }],
|
||||||
|
nickname: [{ required: true, message: "请输入用户名" }],
|
||||||
|
email: [{ required: true, message: "请输入邮箱" }],
|
||||||
|
avatar: [{ required: true, message: "请输入头像" }],
|
||||||
|
status: [{ required: true, message: "请输入状态,1:启用,2:禁用" }],
|
||||||
|
regType: [{ required: true, message: "请输入注册类型" }],
|
||||||
|
addTime: [{ required: true, message: "请输入addTime" }],
|
||||||
|
updateTime: [{ required: true, message: "请输入updateTime" }]
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表单内容
|
||||||
|
export const editFormColumns: PlusColumn[] = [
|
||||||
|
{
|
||||||
|
label: "id",
|
||||||
|
prop: "id",
|
||||||
|
valueType: "copy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "用户名",
|
||||||
|
prop: "username",
|
||||||
|
valueType: "copy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "密码",
|
||||||
|
prop: "password",
|
||||||
|
valueType: "copy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "用户名",
|
||||||
|
prop: "nickname",
|
||||||
|
valueType: "copy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "邮箱",
|
||||||
|
prop: "email",
|
||||||
|
valueType: "copy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "头像",
|
||||||
|
prop: "avatar",
|
||||||
|
valueType: "copy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "状态,1:启用,2:禁用",
|
||||||
|
prop: "status",
|
||||||
|
valueType: "copy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "注册类型",
|
||||||
|
prop: "regType",
|
||||||
|
valueType: "copy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "addTime",
|
||||||
|
prop: "addTime",
|
||||||
|
valueType: "copy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "updateTime",
|
||||||
|
prop: "updateTime",
|
||||||
|
valueType: "copy"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
// ========= event =========
|
||||||
|
|
||||||
|
// 添加按钮事件
|
||||||
|
export const handleAdd = () => {
|
||||||
|
isAdd.value = true;
|
||||||
|
editFormData.value = editFormDataGen();
|
||||||
|
dlgTitle.value = "新增";
|
||||||
|
dlgShow.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 保存按钮事件,校验成功后触发
|
||||||
|
export const handleSave = () => {
|
||||||
|
const postData = editFormData.value;
|
||||||
|
const pms = isAdd.value ? api.add(postData) : api.update(postData);
|
||||||
|
pms.then(() => {
|
||||||
|
ElMessage({
|
||||||
|
message: "保存成功",
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
|
dlgShow.value = false;
|
||||||
|
search();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 点击查询按钮
|
||||||
|
export const handleSearch = () => {
|
||||||
|
pageInfo.value.page = 1;
|
||||||
|
search();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 分页事件
|
||||||
|
export const handlePaginationChange = (_pageInfo: PageInfo): void => {
|
||||||
|
pageInfo.value = _pageInfo;
|
||||||
|
search();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 查询
|
||||||
|
const search = async () => {
|
||||||
|
try {
|
||||||
|
const { data } = await doSearch();
|
||||||
|
tableData.value = data.list;
|
||||||
|
total.value = data.total;
|
||||||
|
} catch (error) {}
|
||||||
|
};
|
||||||
|
// 请求接口
|
||||||
|
const doSearch = async () => {
|
||||||
|
// 查询参数
|
||||||
|
const data = searchFormData.value;
|
||||||
|
// 添加分页参数
|
||||||
|
data.pageIndex = pageInfo.value.page;
|
||||||
|
data.pageSize = pageInfo.value.pageSize;
|
||||||
|
|
||||||
|
return api.page(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 页面加载
|
||||||
|
search();
|
62
sop-admin/sop-admin-frontend/src/views/admin/user/index.vue
Normal file
62
sop-admin/sop-admin-frontend/src/views/admin/user/index.vue
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import {
|
||||||
|
actionButtons,
|
||||||
|
dlgShow,
|
||||||
|
dlgTitle,
|
||||||
|
editFormColumns,
|
||||||
|
editFormData,
|
||||||
|
editFormRules,
|
||||||
|
handleAdd,
|
||||||
|
handlePaginationChange,
|
||||||
|
handleSave,
|
||||||
|
handleSearch,
|
||||||
|
pageInfo,
|
||||||
|
searchFormColumns,
|
||||||
|
searchFormData,
|
||||||
|
tableColumns,
|
||||||
|
tableData,
|
||||||
|
total
|
||||||
|
} from "./index";
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<el-card shadow="never">
|
||||||
|
<template #header>
|
||||||
|
<PlusSearch
|
||||||
|
v-model="searchFormData"
|
||||||
|
:columns="searchFormColumns"
|
||||||
|
:show-number="2"
|
||||||
|
label-position="right"
|
||||||
|
:has-reset="false"
|
||||||
|
@search="handleSearch"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<PlusTable
|
||||||
|
:columns="tableColumns"
|
||||||
|
:table-data="tableData"
|
||||||
|
:action-bar="{ buttons: actionButtons, width: 120 }"
|
||||||
|
:pagination="{
|
||||||
|
total,
|
||||||
|
modelValue: pageInfo,
|
||||||
|
pageSizeList: [10, 20, 50, 100],
|
||||||
|
align: 'right'
|
||||||
|
}"
|
||||||
|
@paginationChange="handlePaginationChange"
|
||||||
|
>
|
||||||
|
<template #title>
|
||||||
|
<el-button type="primary" @click="handleAdd">新增</el-button>
|
||||||
|
</template>
|
||||||
|
</PlusTable>
|
||||||
|
<PlusDialogForm
|
||||||
|
v-model:visible="dlgShow"
|
||||||
|
v-model="editFormData"
|
||||||
|
:dialog="{ title: dlgTitle }"
|
||||||
|
:form="{
|
||||||
|
columns: editFormColumns,
|
||||||
|
rules: editFormRules,
|
||||||
|
labelWidth: '100px',
|
||||||
|
labelPosition: 'right'
|
||||||
|
}"
|
||||||
|
@confirm="handleSave"
|
||||||
|
/>
|
||||||
|
</el-card>
|
||||||
|
</template>
|
265
sop-admin/sop-admin-frontend/src/views/isv/list/index.ts
Normal file
265
sop-admin/sop-admin-frontend/src/views/isv/list/index.ts
Normal file
@@ -0,0 +1,265 @@
|
|||||||
|
import { computed, ref } from "vue";
|
||||||
|
import {
|
||||||
|
type ButtonsCallBackParams,
|
||||||
|
type FieldValues,
|
||||||
|
type PageInfo,
|
||||||
|
type PlusColumn,
|
||||||
|
useTable
|
||||||
|
} from "plus-pro-components";
|
||||||
|
import { ElMessage } from "element-plus";
|
||||||
|
import { StatusEnum } from "@/model/enums";
|
||||||
|
import { api } from "@/api/isvList";
|
||||||
|
|
||||||
|
const isAdd = ref(false);
|
||||||
|
|
||||||
|
// ========= search form =========
|
||||||
|
|
||||||
|
// 查询表单对象
|
||||||
|
export const searchFormData = ref({
|
||||||
|
id: "",
|
||||||
|
appId: "",
|
||||||
|
status: "",
|
||||||
|
remark: "",
|
||||||
|
pageIndex: 1,
|
||||||
|
pageSize: 10
|
||||||
|
});
|
||||||
|
|
||||||
|
// 查询表单字段定义
|
||||||
|
export const searchFormColumns: PlusColumn[] = [
|
||||||
|
{
|
||||||
|
label: "AppID",
|
||||||
|
prop: "appId"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "状态",
|
||||||
|
prop: "status",
|
||||||
|
valueType: "select",
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: "启用",
|
||||||
|
value: StatusEnum.ENABLE,
|
||||||
|
color: "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "禁用",
|
||||||
|
value: StatusEnum.DISABLE,
|
||||||
|
color: "red"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
// ========= table =========
|
||||||
|
|
||||||
|
// 表格对象
|
||||||
|
export const {
|
||||||
|
tableData,
|
||||||
|
total,
|
||||||
|
pageInfo,
|
||||||
|
buttons: actionButtons
|
||||||
|
} = useTable<any[]>();
|
||||||
|
// 默认每页条数,默认10
|
||||||
|
pageInfo.value.pageSize = 10;
|
||||||
|
|
||||||
|
// 表格字段定义
|
||||||
|
export const tableColumns: PlusColumn[] = [
|
||||||
|
{
|
||||||
|
label: "AppID",
|
||||||
|
prop: "appId",
|
||||||
|
width: 230
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "秘钥",
|
||||||
|
prop: "keys",
|
||||||
|
width: 80
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "角色",
|
||||||
|
prop: "roleNames",
|
||||||
|
width: 120
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "状态",
|
||||||
|
prop: "status",
|
||||||
|
width: 80,
|
||||||
|
valueType: "select",
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: "启用",
|
||||||
|
value: StatusEnum.ENABLE,
|
||||||
|
color: "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "禁用",
|
||||||
|
value: StatusEnum.DISABLE,
|
||||||
|
color: "red"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "备注",
|
||||||
|
prop: "remark"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "添加时间",
|
||||||
|
prop: "addTime"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "修改时间",
|
||||||
|
prop: "updateTime"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
// 表格按钮定义
|
||||||
|
actionButtons.value = [
|
||||||
|
{
|
||||||
|
// 修改
|
||||||
|
text: "修改",
|
||||||
|
code: "edit",
|
||||||
|
props: {
|
||||||
|
type: "primary"
|
||||||
|
},
|
||||||
|
show: computed(() => true),
|
||||||
|
onClick(params: ButtonsCallBackParams) {
|
||||||
|
isAdd.value = false;
|
||||||
|
editFormData.value = Object.assign({}, params.row);
|
||||||
|
dlgTitle.value = "修改";
|
||||||
|
dlgShow.value = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// 删除
|
||||||
|
text: "删除",
|
||||||
|
code: "delete",
|
||||||
|
props: {
|
||||||
|
type: "danger"
|
||||||
|
},
|
||||||
|
confirm: {
|
||||||
|
options: { draggable: false }
|
||||||
|
},
|
||||||
|
onConfirm(params: ButtonsCallBackParams) {
|
||||||
|
api.del(params).then(() => {
|
||||||
|
ElMessage({
|
||||||
|
message: "删除成功",
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
|
dlgShow.value = false;
|
||||||
|
search();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
// ========= dialog form =========
|
||||||
|
|
||||||
|
// 弹窗显示
|
||||||
|
export const dlgShow = ref(false);
|
||||||
|
export const dlgTitle = ref("");
|
||||||
|
// 表单值
|
||||||
|
const editFormDataGen = () => {
|
||||||
|
return {
|
||||||
|
id: "",
|
||||||
|
appId: "",
|
||||||
|
status: "",
|
||||||
|
remark: "",
|
||||||
|
addTime: "",
|
||||||
|
updateTime: ""
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export const editFormData = ref<FieldValues>(editFormDataGen());
|
||||||
|
export const editFormRules = {
|
||||||
|
id: [{ required: true, message: "请输入id" }],
|
||||||
|
appId: [{ required: true, message: "请输入appKey" }],
|
||||||
|
status: [{ required: true, message: "请输入1启用,2禁用" }]
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表单内容
|
||||||
|
export const editFormColumns: PlusColumn[] = [
|
||||||
|
{
|
||||||
|
label: "id",
|
||||||
|
prop: "id",
|
||||||
|
valueType: "copy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "AppID",
|
||||||
|
prop: "appId",
|
||||||
|
valueType: "copy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "1启用,2禁用",
|
||||||
|
prop: "status",
|
||||||
|
valueType: "copy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "备注",
|
||||||
|
prop: "remark",
|
||||||
|
valueType: "copy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "addTime",
|
||||||
|
prop: "addTime",
|
||||||
|
valueType: "copy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "updateTime",
|
||||||
|
prop: "updateTime",
|
||||||
|
valueType: "copy"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
// ========= event =========
|
||||||
|
|
||||||
|
// 添加按钮事件
|
||||||
|
export const handleAdd = () => {
|
||||||
|
isAdd.value = true;
|
||||||
|
editFormData.value = editFormDataGen();
|
||||||
|
dlgTitle.value = "新增";
|
||||||
|
dlgShow.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 保存按钮事件,校验成功后触发
|
||||||
|
export const handleSave = () => {
|
||||||
|
const postData = editFormData.value;
|
||||||
|
const pms = isAdd.value ? api.add(postData) : api.update(postData);
|
||||||
|
pms.then(() => {
|
||||||
|
ElMessage({
|
||||||
|
message: "保存成功",
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
|
dlgShow.value = false;
|
||||||
|
search();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 点击查询按钮
|
||||||
|
export const handleSearch = () => {
|
||||||
|
pageInfo.value.page = 1;
|
||||||
|
search();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 分页事件
|
||||||
|
export const handlePaginationChange = (_pageInfo: PageInfo): void => {
|
||||||
|
pageInfo.value = _pageInfo;
|
||||||
|
search();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 查询
|
||||||
|
const search = async () => {
|
||||||
|
try {
|
||||||
|
const { data } = await doSearch();
|
||||||
|
tableData.value = data.list;
|
||||||
|
total.value = data.total;
|
||||||
|
} catch (error) {}
|
||||||
|
};
|
||||||
|
// 请求接口
|
||||||
|
const doSearch = async () => {
|
||||||
|
// 查询参数
|
||||||
|
const data = searchFormData.value;
|
||||||
|
// 添加分页参数
|
||||||
|
data.pageIndex = pageInfo.value.page;
|
||||||
|
data.pageSize = pageInfo.value.pageSize;
|
||||||
|
|
||||||
|
return api.page(data);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 页面加载
|
||||||
|
search();
|
82
sop-admin/sop-admin-frontend/src/views/isv/list/index.vue
Normal file
82
sop-admin/sop-admin-frontend/src/views/isv/list/index.vue
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import {
|
||||||
|
actionButtons,
|
||||||
|
dlgShow,
|
||||||
|
dlgTitle,
|
||||||
|
editFormColumns,
|
||||||
|
editFormData,
|
||||||
|
editFormRules,
|
||||||
|
handleAdd,
|
||||||
|
handlePaginationChange,
|
||||||
|
handleSave,
|
||||||
|
handleSearch,
|
||||||
|
pageInfo,
|
||||||
|
searchFormColumns,
|
||||||
|
searchFormData,
|
||||||
|
tableColumns,
|
||||||
|
tableData,
|
||||||
|
total
|
||||||
|
} from "./index";
|
||||||
|
import {
|
||||||
|
dlgKeysShow,
|
||||||
|
showKeysFormColumns,
|
||||||
|
showKeysFormData,
|
||||||
|
viewKeys
|
||||||
|
} from "./showKeys";
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<el-card shadow="never">
|
||||||
|
<template #header>
|
||||||
|
<PlusSearch
|
||||||
|
v-model="searchFormData"
|
||||||
|
:columns="searchFormColumns"
|
||||||
|
:show-number="2"
|
||||||
|
label-position="right"
|
||||||
|
:has-reset="false"
|
||||||
|
@search="handleSearch"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<PlusTable
|
||||||
|
:columns="tableColumns"
|
||||||
|
:table-data="tableData"
|
||||||
|
:action-bar="{ buttons: actionButtons, width: 120 }"
|
||||||
|
:pagination="{
|
||||||
|
total,
|
||||||
|
modelValue: pageInfo,
|
||||||
|
pageSizeList: [10, 20, 50, 100],
|
||||||
|
align: 'right'
|
||||||
|
}"
|
||||||
|
@paginationChange="handlePaginationChange"
|
||||||
|
>
|
||||||
|
<template #title>
|
||||||
|
<el-button type="primary" @click="handleAdd">新增</el-button>
|
||||||
|
</template>
|
||||||
|
<template #plus-cell-keys="scoped">
|
||||||
|
<el-link type="primary" @click="viewKeys(scoped.row)">查看</el-link>
|
||||||
|
</template>
|
||||||
|
</PlusTable>
|
||||||
|
<PlusDialogForm
|
||||||
|
v-model:visible="dlgShow"
|
||||||
|
v-model="editFormData"
|
||||||
|
label-width="200px"
|
||||||
|
:dialog="{ title: dlgTitle }"
|
||||||
|
:form="{
|
||||||
|
columns: editFormColumns,
|
||||||
|
rules: editFormRules,
|
||||||
|
labelWidth: '100px',
|
||||||
|
labelPosition: 'right'
|
||||||
|
}"
|
||||||
|
@confirm="handleSave"
|
||||||
|
/>
|
||||||
|
<PlusDialogForm
|
||||||
|
v-model:visible="dlgKeysShow"
|
||||||
|
v-model="showKeysFormData"
|
||||||
|
:dialog="{ title: '秘钥' }"
|
||||||
|
:form="{ group: showKeysFormColumns, labelPosition: 'right' }"
|
||||||
|
>
|
||||||
|
<template #dialog-footer="{ handleCancel }">
|
||||||
|
<el-button type="primary" @click="handleCancel">关闭</el-button>
|
||||||
|
</template>
|
||||||
|
</PlusDialogForm>
|
||||||
|
</el-card>
|
||||||
|
</template>
|
86
sop-admin/sop-admin-frontend/src/views/isv/list/showKeys.ts
Normal file
86
sop-admin/sop-admin-frontend/src/views/isv/list/showKeys.ts
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
import { ref } from "vue";
|
||||||
|
import type { PlusFormGroupRow } from "plus-pro-components";
|
||||||
|
import { CreditCard } from "@element-plus/icons-vue";
|
||||||
|
import { api } from "@/api/isvList";
|
||||||
|
|
||||||
|
// 弹窗显示
|
||||||
|
export const dlgKeysShow = ref(false);
|
||||||
|
export const showKeysFormData = ref<object>({
|
||||||
|
publicKeyIsv: "",
|
||||||
|
privateKeyIsv: "",
|
||||||
|
publicKeyPlatform: "",
|
||||||
|
privateKeyPlatform: ""
|
||||||
|
});
|
||||||
|
// 表单内容
|
||||||
|
export const showKeysFormColumns: PlusFormGroupRow[] = [
|
||||||
|
{
|
||||||
|
title: "ISV公私钥 - 标识☆分配给开发者",
|
||||||
|
icon: CreditCard,
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
label: "ISV公钥",
|
||||||
|
prop: "publicKeyIsv",
|
||||||
|
valueType: "textarea",
|
||||||
|
labelWidth: 100,
|
||||||
|
fieldProps: {
|
||||||
|
showWordLimit: false,
|
||||||
|
placeholder: "",
|
||||||
|
readonly: true,
|
||||||
|
autosize: { minRows: 2, maxRows: 4 }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "☆ISV私钥",
|
||||||
|
prop: "privateKeyIsv",
|
||||||
|
valueType: "textarea",
|
||||||
|
labelWidth: 100,
|
||||||
|
fieldProps: {
|
||||||
|
showWordLimit: false,
|
||||||
|
placeholder: "",
|
||||||
|
readonly: true,
|
||||||
|
autosize: { minRows: 2, maxRows: 4 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "平台公私钥 - 标识☆分配给开发者",
|
||||||
|
icon: CreditCard,
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
label: "☆平台公钥",
|
||||||
|
prop: "publicKeyPlatform",
|
||||||
|
valueType: "textarea",
|
||||||
|
labelWidth: 100,
|
||||||
|
fieldProps: {
|
||||||
|
showWordLimit: false,
|
||||||
|
placeholder: "",
|
||||||
|
readonly: true,
|
||||||
|
autosize: { minRows: 2, maxRows: 4 }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "平台私钥",
|
||||||
|
prop: "privateKeyPlatform",
|
||||||
|
valueType: "textarea",
|
||||||
|
labelWidth: 100,
|
||||||
|
fieldProps: {
|
||||||
|
showWordLimit: false,
|
||||||
|
placeholder: "",
|
||||||
|
readonly: true,
|
||||||
|
autosize: { minRows: 2, maxRows: 4 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
export const viewKeys = (row: any) => {
|
||||||
|
const params = {
|
||||||
|
appId: row.appId
|
||||||
|
};
|
||||||
|
api.viewKeys(params).then(resp => {
|
||||||
|
showKeysFormData.value = resp.data;
|
||||||
|
dlgKeysShow.value = true;
|
||||||
|
});
|
||||||
|
};
|
@@ -1,29 +1,55 @@
|
|||||||
import { computed, ref } from "vue";
|
import { computed, ref } from "vue";
|
||||||
import {
|
import {
|
||||||
type PlusColumn,
|
type ButtonsCallBackParams,
|
||||||
useTable,
|
|
||||||
type PageInfo,
|
|
||||||
type FieldValues,
|
type FieldValues,
|
||||||
type ButtonsCallBackParams
|
type PageInfo,
|
||||||
|
type PlusColumn,
|
||||||
|
useTable
|
||||||
} from "plus-pro-components";
|
} from "plus-pro-components";
|
||||||
import { type PageResult } from "@/model";
|
|
||||||
import { http } from "@/utils/http";
|
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
|
import { StatusEnum } from "@/model/enums";
|
||||||
|
import { api } from "@/api/serveApi";
|
||||||
|
|
||||||
// 后端请求接口
|
const isAdd = ref(false);
|
||||||
const apiUrl = {
|
|
||||||
page: "/serve/api/page",
|
// ========= search form =========
|
||||||
add: "/serve/api/add",
|
|
||||||
update: "/serve/api/update",
|
|
||||||
del: "/serve/api/delete"
|
|
||||||
};
|
|
||||||
|
|
||||||
// 查询表单对象
|
// 查询表单对象
|
||||||
export const searchFormData = ref({
|
export const searchFormData = ref({
|
||||||
apiName: "",
|
apiName: "",
|
||||||
|
status: "",
|
||||||
pageIndex: 1,
|
pageIndex: 1,
|
||||||
pageSize: 10
|
pageSize: 10
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 查询表单字段定义
|
||||||
|
export const searchFormColumns: PlusColumn[] = [
|
||||||
|
{
|
||||||
|
label: "接口名称",
|
||||||
|
prop: "apiName"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "状态",
|
||||||
|
prop: "status",
|
||||||
|
width: 80,
|
||||||
|
valueType: "select",
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: "启用",
|
||||||
|
value: StatusEnum.ENABLE,
|
||||||
|
color: "green"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "禁用",
|
||||||
|
value: StatusEnum.DISABLE,
|
||||||
|
color: "red"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
// ========= table =========
|
||||||
|
|
||||||
// 表格对象
|
// 表格对象
|
||||||
export const {
|
export const {
|
||||||
tableData,
|
tableData,
|
||||||
@@ -34,14 +60,6 @@ export const {
|
|||||||
// 默认每页条数,默认10
|
// 默认每页条数,默认10
|
||||||
pageInfo.value.pageSize = 10;
|
pageInfo.value.pageSize = 10;
|
||||||
|
|
||||||
// 查询表单字段定义
|
|
||||||
export const searchFormColumns: PlusColumn[] = [
|
|
||||||
{
|
|
||||||
label: "接口名称",
|
|
||||||
prop: "apiName"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
// 表格字段定义
|
// 表格字段定义
|
||||||
export const tableColumns: PlusColumn[] = [
|
export const tableColumns: PlusColumn[] = [
|
||||||
{
|
{
|
||||||
@@ -104,14 +122,14 @@ export const tableColumns: PlusColumn[] = [
|
|||||||
valueType: "select",
|
valueType: "select",
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
label: "禁用",
|
label: "启用",
|
||||||
value: 0,
|
value: StatusEnum.ENABLE,
|
||||||
color: "red"
|
color: "green"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "启用",
|
label: "禁用",
|
||||||
value: 1,
|
value: StatusEnum.DISABLE,
|
||||||
color: "green"
|
color: "red"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -120,7 +138,7 @@ export const tableColumns: PlusColumn[] = [
|
|||||||
prop: "addTime"
|
prop: "addTime"
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
// 表格按钮定义
|
||||||
actionButtons.value = [
|
actionButtons.value = [
|
||||||
{
|
{
|
||||||
// 修改
|
// 修改
|
||||||
@@ -131,73 +149,66 @@ actionButtons.value = [
|
|||||||
},
|
},
|
||||||
show: computed(() => true),
|
show: computed(() => true),
|
||||||
onClick(params: ButtonsCallBackParams) {
|
onClick(params: ButtonsCallBackParams) {
|
||||||
if (params?.formRefs) {
|
isAdd.value = false;
|
||||||
// isEdit v0.1.8 新增
|
editFormData.value = Object.assign({}, params.row);
|
||||||
const isEdit = params.formRefs[0].isEdit.value;
|
dlgTitle.value = "修改接口";
|
||||||
isEdit
|
dlgShow.value = true;
|
||||||
? params.formRefs[0]?.stopCellEdit()
|
|
||||||
: params.formRefs[0]?.startCellEdit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// 删除
|
// 删除
|
||||||
text: "删除",
|
text: row => (row.status === StatusEnum.ENABLE ? "禁用" : "启用"),
|
||||||
code: "delete",
|
code: "delete",
|
||||||
props: {
|
|
||||||
type: "danger"
|
|
||||||
},
|
|
||||||
confirm: {
|
confirm: {
|
||||||
options: { draggable: true }
|
message: data => {
|
||||||
},
|
const opt = data.row.status === StatusEnum.ENABLE ? "禁用" : "启用";
|
||||||
onClick(params: ButtonsCallBackParams) {
|
return `确定${opt}吗?`;
|
||||||
console.log(params, "onClick");
|
},
|
||||||
|
options: { draggable: false }
|
||||||
},
|
},
|
||||||
onConfirm(params: ButtonsCallBackParams) {
|
onConfirm(params: ButtonsCallBackParams) {
|
||||||
console.log(params, "onConfirm");
|
const data = {
|
||||||
},
|
id: params.row.id,
|
||||||
onCancel(params: ButtonsCallBackParams) {
|
status:
|
||||||
console.log(params, "onCancel");
|
params.row.status === StatusEnum.ENABLE
|
||||||
|
? StatusEnum.DISABLE
|
||||||
|
: StatusEnum.ENABLE
|
||||||
|
};
|
||||||
|
api.updateStatus(data).then(() => {
|
||||||
|
ElMessage({
|
||||||
|
message: "修改成功",
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
|
dlgShow.value = false;
|
||||||
|
search();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
// 弹窗表单
|
// ========= dialog form =========
|
||||||
|
|
||||||
|
// 弹窗显示
|
||||||
export const dlgShow = ref(false);
|
export const dlgShow = ref(false);
|
||||||
export const editFormData = ref<FieldValues>({
|
export const dlgTitle = ref("");
|
||||||
application: "",
|
// 表单值
|
||||||
status: 1,
|
const editFormDataGen = () => {
|
||||||
isPermission: 0,
|
return {
|
||||||
isNeedToken: 0
|
application: "",
|
||||||
});
|
status: 1,
|
||||||
|
isPermission: 0,
|
||||||
|
isNeedToken: 0
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export const editFormData = ref<FieldValues>(editFormDataGen());
|
||||||
export const editFormRules = {
|
export const editFormRules = {
|
||||||
application: [{ required: true, message: "请输入应用名称" }],
|
application: [{ required: true, message: "请输入应用名称" }],
|
||||||
apiName: [{ required: true, message: "请输入接口名称" }],
|
apiName: [{ required: true, message: "请输入接口名称" }],
|
||||||
apiVersion: [{ required: true, message: "请输入版本号" }],
|
apiVersion: [{ required: true, message: "请输入版本号" }],
|
||||||
description: [{ required: true, message: "请输入接口描述" }]
|
description: [{ required: true, message: "请输入接口描述" }]
|
||||||
};
|
};
|
||||||
export const handleDlgOpen = () => {
|
|
||||||
dlgShow.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const handleSave = () => {
|
|
||||||
http
|
|
||||||
.post<PageResult, any>(apiUrl.add, { data: editFormData.value })
|
|
||||||
.then(resp => {
|
|
||||||
if (resp.success) {
|
|
||||||
ElMessage({
|
|
||||||
message: "保存成功",
|
|
||||||
type: "success"
|
|
||||||
});
|
|
||||||
dlgShow.value = false;
|
|
||||||
search();
|
|
||||||
} else {
|
|
||||||
console.log(resp);
|
|
||||||
ElMessage.error(`保存失败:${resp.msg}`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
// 表单内容
|
||||||
export const editFormColumns: PlusColumn[] = [
|
export const editFormColumns: PlusColumn[] = [
|
||||||
{
|
{
|
||||||
label: "应用名称",
|
label: "应用名称",
|
||||||
@@ -224,7 +235,7 @@ export const editFormColumns: PlusColumn[] = [
|
|||||||
prop: "remark",
|
prop: "remark",
|
||||||
valueType: "textarea",
|
valueType: "textarea",
|
||||||
fieldProps: {
|
fieldProps: {
|
||||||
maxlength: 10,
|
maxlength: 5000,
|
||||||
showWordLimit: true,
|
showWordLimit: true,
|
||||||
autosize: { minRows: 2, maxRows: 4 }
|
autosize: { minRows: 2, maxRows: 4 }
|
||||||
}
|
}
|
||||||
@@ -282,12 +293,42 @@ export const editFormColumns: PlusColumn[] = [
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// ========= event =========
|
||||||
|
|
||||||
|
// 添加按钮事件
|
||||||
|
export const handleAdd = () => {
|
||||||
|
isAdd.value = true;
|
||||||
|
editFormData.value = editFormDataGen();
|
||||||
|
dlgTitle.value = "新增接口";
|
||||||
|
dlgShow.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 保存按钮事件,校验成功后触发
|
||||||
|
export const handleSave = () => {
|
||||||
|
const postData = editFormData.value;
|
||||||
|
const pms = isAdd.value ? api.add(postData) : api.update(postData);
|
||||||
|
pms.then(() => {
|
||||||
|
ElMessage({
|
||||||
|
message: "保存成功",
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
|
dlgShow.value = false;
|
||||||
|
search();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// 点击查询按钮
|
// 点击查询按钮
|
||||||
export const handleSearch = () => {
|
export const handleSearch = () => {
|
||||||
pageInfo.value.page = 1;
|
pageInfo.value.page = 1;
|
||||||
search();
|
search();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 分页事件
|
||||||
|
export const handlePaginationChange = (_pageInfo: PageInfo): void => {
|
||||||
|
pageInfo.value = _pageInfo;
|
||||||
|
search();
|
||||||
|
};
|
||||||
|
|
||||||
// 查询
|
// 查询
|
||||||
const search = async () => {
|
const search = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -304,12 +345,8 @@ const doSearch = async () => {
|
|||||||
data.pageIndex = pageInfo.value.page;
|
data.pageIndex = pageInfo.value.page;
|
||||||
data.pageSize = pageInfo.value.pageSize;
|
data.pageSize = pageInfo.value.pageSize;
|
||||||
|
|
||||||
return http.get<PageResult, any>(apiUrl.page, { params: data });
|
return api.page(data);
|
||||||
};
|
|
||||||
// 分页事件
|
|
||||||
export const handlePaginationChange = (_pageInfo: PageInfo): void => {
|
|
||||||
pageInfo.value = _pageInfo;
|
|
||||||
search();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 页面加载
|
// 页面加载
|
||||||
search();
|
search();
|
||||||
|
@@ -2,10 +2,11 @@
|
|||||||
import {
|
import {
|
||||||
actionButtons,
|
actionButtons,
|
||||||
dlgShow,
|
dlgShow,
|
||||||
|
dlgTitle,
|
||||||
editFormColumns,
|
editFormColumns,
|
||||||
editFormData,
|
editFormData,
|
||||||
editFormRules,
|
editFormRules,
|
||||||
handleDlgOpen,
|
handleAdd,
|
||||||
handlePaginationChange,
|
handlePaginationChange,
|
||||||
handleSave,
|
handleSave,
|
||||||
handleSearch,
|
handleSearch,
|
||||||
@@ -42,13 +43,13 @@ import {
|
|||||||
@paginationChange="handlePaginationChange"
|
@paginationChange="handlePaginationChange"
|
||||||
>
|
>
|
||||||
<template #title>
|
<template #title>
|
||||||
<el-button type="primary" @click="handleDlgOpen">新增接口</el-button>
|
<el-button type="primary" @click="handleAdd">新增接口</el-button>
|
||||||
</template>
|
</template>
|
||||||
</PlusTable>
|
</PlusTable>
|
||||||
<PlusDialogForm
|
<PlusDialogForm
|
||||||
v-model:visible="dlgShow"
|
v-model:visible="dlgShow"
|
||||||
v-model="editFormData"
|
v-model="editFormData"
|
||||||
label-width="200px"
|
:dialog="{ title: dlgTitle }"
|
||||||
:form="{
|
:form="{
|
||||||
columns: editFormColumns,
|
columns: editFormColumns,
|
||||||
rules: editFormRules,
|
rules: editFormRules,
|
||||||
|
@@ -2,27 +2,28 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>com.gitee.sop</groupId>
|
|
||||||
<artifactId>sop-parent</artifactId>
|
|
||||||
<version>5.0.0-SNAPSHOT</version>
|
|
||||||
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>com.gitee.sop</groupId>
|
||||||
<artifactId>sop-common</artifactId>
|
<artifactId>sop-common</artifactId>
|
||||||
<packaging>pom</packaging>
|
<version>5.0.0-SNAPSHOT</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<modules>
|
|
||||||
<module>sop-bridge-nacos</module>
|
|
||||||
<module>sop-gateway-common</module>
|
|
||||||
<module>sop-service-common</module>
|
|
||||||
</modules>
|
|
||||||
|
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.34</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-context</artifactId>
|
||||||
|
<version>6.1.11</version>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
@@ -0,0 +1,32 @@
|
|||||||
|
package com.gitee.sop.common.bean;
|
||||||
|
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
public class SpringContext {
|
||||||
|
|
||||||
|
private static ApplicationContext ctx;
|
||||||
|
|
||||||
|
public static <T> T getBean(Class<T> clazz) {
|
||||||
|
return ctx.getBean(clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Object getBean(String beanName) {
|
||||||
|
return ctx.getBean(beanName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setApplicationContext(ApplicationContext ctx) {
|
||||||
|
SpringContext.ctx = ctx;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ApplicationContext getApplicationContext() {
|
||||||
|
return ctx;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void publishEvent(ApplicationEvent event) {
|
||||||
|
ctx.publishEvent(event);
|
||||||
|
}
|
||||||
|
}
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.adminbackend.common;
|
package com.gitee.sop.common.enums;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@@ -9,9 +9,9 @@ import java.util.Objects;
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public enum StatusEnum {
|
public enum StatusEnum {
|
||||||
DISABLED((byte)0),
|
DISABLED((byte)2),
|
||||||
ENABLE((byte)1),
|
ENABLE((byte)1),
|
||||||
SET_PWD((byte)2),
|
SET_PWD((byte)3),
|
||||||
;
|
;
|
||||||
|
|
||||||
private final int status;
|
private final int status;
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.adminbackend.common;
|
package com.gitee.sop.common.req;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@@ -0,0 +1,17 @@
|
|||||||
|
package com.gitee.sop.common.req;
|
||||||
|
|
||||||
|
import com.gitee.sop.adminbackend.common.req.IdParam;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class StatusUpdateParam extends IdParam {
|
||||||
|
|
||||||
|
@NotNull(message = "状态不能为空")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.adminbackend.common;
|
package com.gitee.sop.common.resp;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@@ -1,74 +1,251 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.gitee.sop</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>sop-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>5.0.0-SNAPSHOT</version>
|
<version>2.6.15</version>
|
||||||
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<groupId>com.gitee.sop</groupId>
|
||||||
<artifactId>sop-gateway</artifactId>
|
<artifactId>sop-gateway</artifactId>
|
||||||
|
<version>5.0.0-SNAPSHOT</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
|
||||||
|
<!-- springboot 版本-->
|
||||||
|
<spring-boot.version>2.6.15</spring-boot.version>
|
||||||
|
<!-- spring cloud 版本 -->
|
||||||
|
<spring-cloud.version>2021.0.5</spring-cloud.version>
|
||||||
|
<!-- spring cloud alibaba 版本 -->
|
||||||
|
<!-- 具体版本对应关系见:https://github.com/alibaba/spring-cloud-alibaba/wiki/%E7%89%88%E6%9C%AC%E8%AF%B4%E6%98%8E -->
|
||||||
|
<spring-cloud-alibaba.version>2021.0.5.0</spring-cloud-alibaba.version>
|
||||||
|
<!-- dubbo版本 -->
|
||||||
|
<dubbo.version>3.2.10</dubbo.version>
|
||||||
|
|
||||||
|
<junit.version>4.11</junit.version>
|
||||||
|
<commons-io.version>2.5</commons-io.version>
|
||||||
|
<commons-fileupload.version>1.3.3</commons-fileupload.version>
|
||||||
|
<commons-collection.version>3.2.2</commons-collection.version>
|
||||||
|
<commons-lang3.version>3.8.1</commons-lang3.version>
|
||||||
|
<commons-codec.version>1.11</commons-codec.version>
|
||||||
|
<commons-logging.version>1.2</commons-logging.version>
|
||||||
|
<validation-api.version>2.0.1.Final</validation-api.version>
|
||||||
|
<hibernate-validator.version>6.0.13.Final</hibernate-validator.version>
|
||||||
|
<fastmybatis.version>3.0.10</fastmybatis.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!--
|
<dependency>
|
||||||
<artifactId>sop-bridge-nacos</artifactId> : 使用nacos注册中心
|
|
||||||
<artifactId>sop-bridge-eureka</artifactId> : 使用eureka注册中心
|
|
||||||
-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.gitee.sop</groupId>
|
<groupId>com.gitee.sop</groupId>
|
||||||
<artifactId>sop-bridge-nacos</artifactId>
|
<artifactId>sop-service-support</artifactId>
|
||||||
<!-- <artifactId>sop-bridge-eureka</artifactId>-->
|
<version>5.0.0-SNAPSHOT</version>
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-gateway</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.oschina.durcframework</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.dubbo</groupId>
|
||||||
|
<artifactId>dubbo-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- nacos注册中心 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.dubbo</groupId>
|
||||||
|
<artifactId>dubbo-nacos-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.gitee.durcframework</groupId>
|
||||||
<artifactId>fastmybatis-spring-boot-starter</artifactId>
|
<artifactId>fastmybatis-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
<scope>runtime</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.servlet</groupId>
|
|
||||||
<artifactId>javax.servlet-api</artifactId>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- test -->
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-codec</groupId>
|
||||||
|
<artifactId>commons-codec</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-fileupload</groupId>
|
||||||
|
<artifactId>commons-fileupload</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hibernate</groupId>
|
||||||
|
<artifactId>hibernate-validator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||||
|
<artifactId>jackson-dataformat-xml</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- test-->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- provided -->
|
<!-- provided -->
|
||||||
|
|
||||||
|
<!-- 仅在开发中使用 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.dubbo</groupId>
|
||||||
|
<artifactId>dubbo-dependencies-zookeeper-curator5</artifactId>
|
||||||
|
<version>${dubbo.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.4</version>
|
<optional>true</optional>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<!-- 加了这个就不需要加版本号了 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-dependencies</artifactId>
|
||||||
|
<version>${spring-cloud.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
|
||||||
|
<version>${spring-cloud-alibaba.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.dubbo</groupId>
|
||||||
|
<artifactId>dubbo-bom</artifactId>
|
||||||
|
<version>${dubbo.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.gitee.durcframework</groupId>
|
||||||
|
<artifactId>fastmybatis-spring-boot-starter</artifactId>
|
||||||
|
<version>${fastmybatis.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
<artifactId>okhttp</artifactId>
|
||||||
|
<version>3.14.7</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.validation</groupId>
|
||||||
|
<artifactId>validation-api</artifactId>
|
||||||
|
<version>${validation-api.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hibernate</groupId>
|
||||||
|
<artifactId>hibernate-validator</artifactId>
|
||||||
|
<version>${hibernate-validator.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- commons -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
<version>${commons-lang3.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-collections</groupId>
|
||||||
|
<artifactId>commons-collections</artifactId>
|
||||||
|
<version>${commons-collection.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
<version>${commons-io.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-codec</groupId>
|
||||||
|
<artifactId>commons-codec</artifactId>
|
||||||
|
<version>${commons-codec.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-fileupload</groupId>
|
||||||
|
<artifactId>commons-fileupload</artifactId>
|
||||||
|
<version>${commons-fileupload.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-logging</groupId>
|
||||||
|
<artifactId>commons-logging</artifactId>
|
||||||
|
<version>${commons-logging.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.30</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>aliyun</id>
|
||||||
|
<name>aliyun</name>
|
||||||
|
<url>https://maven.aliyun.com/repository/public</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
@@ -85,20 +262,17 @@
|
|||||||
<skipTests>true</skipTests>
|
<skipTests>true</skipTests>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>${java.version}</source>
|
||||||
|
<target>${java.version}</target>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>spring-milestones</id>
|
|
||||||
<name>Spring Milestones</name>
|
|
||||||
<url>https://repo.spring.io/milestone</url>
|
|
||||||
</repository>
|
|
||||||
<repository>
|
|
||||||
<id>maven2</id>
|
|
||||||
<name>maven2</name>
|
|
||||||
<url>https://repo1.maven.org/maven2</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@@ -1,18 +1,15 @@
|
|||||||
package com.gitee.sop.gateway;
|
package com.gitee.sop.gateway;
|
||||||
|
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
@MapperScan(basePackages = {
|
@SpringBootApplication
|
||||||
"com.gitee.sop.gateway.mapper"
|
@EnableDubbo
|
||||||
})
|
|
||||||
@SpringBootApplication(scanBasePackages = "com.gitee.sop")
|
|
||||||
public class SopGatewayApplication {
|
public class SopGatewayApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(SopGatewayApplication.class, args);
|
SpringApplication.run(SopGatewayApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.common;
|
package com.gitee.sop.gateway.common;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.common;
|
package com.gitee.sop.gateway.common;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 六如
|
* @author 六如
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.common;
|
package com.gitee.sop.gateway.common;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@@ -1,6 +1,6 @@
|
|||||||
package com.gitee.sop.index.common;
|
package com.gitee.sop.gateway.common;
|
||||||
|
|
||||||
import com.gitee.sop.index.request.ApiRequestContext;
|
import com.gitee.sop.gateway.request.ApiRequestContext;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.common;
|
package com.gitee.sop.gateway.common;
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.common;
|
package com.gitee.sop.gateway.common;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -10,7 +10,7 @@ import lombok.Getter;
|
|||||||
@Getter
|
@Getter
|
||||||
public enum StatusEnum {
|
public enum StatusEnum {
|
||||||
ENABLE(1),
|
ENABLE(1),
|
||||||
DISABLE(0);
|
DISABLE(2);
|
||||||
|
|
||||||
private final int value;
|
private final int value;
|
||||||
|
|
@@ -0,0 +1,89 @@
|
|||||||
|
package com.gitee.sop.gateway.config;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties(prefix = "api")
|
||||||
|
@Data
|
||||||
|
public class ApiConfig {
|
||||||
|
|
||||||
|
// ========= 请求参数名 =========
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分配给开发者的应用ID
|
||||||
|
*/
|
||||||
|
private String appIdName = "app_id";
|
||||||
|
/**
|
||||||
|
* 接口名称
|
||||||
|
*/
|
||||||
|
private String apiName = "method";
|
||||||
|
/**
|
||||||
|
* 仅支持JSON
|
||||||
|
*/
|
||||||
|
private String formatName = "format";
|
||||||
|
/**
|
||||||
|
* 请求使用的编码格式
|
||||||
|
*/
|
||||||
|
private String charsetName = "charset";
|
||||||
|
/**
|
||||||
|
* 商户生成签名字符串所使用的签名算法类型,目前支持RSA2和RSA,推荐使用RSA2
|
||||||
|
*/
|
||||||
|
private String signTypeName = "sign_type";
|
||||||
|
/**
|
||||||
|
* 商户请求参数的签名串
|
||||||
|
*/
|
||||||
|
private String signName = "sign";
|
||||||
|
/**
|
||||||
|
* 发送请求的时间
|
||||||
|
*/
|
||||||
|
private String timestampName = "timestamp";
|
||||||
|
/**
|
||||||
|
* 调用的接口版本
|
||||||
|
*/
|
||||||
|
private String versionName = "version";
|
||||||
|
/**
|
||||||
|
* 开放平台主动通知商户服务器里指定的页面http/https路径
|
||||||
|
*/
|
||||||
|
private String notifyUrlName = "notify_url";
|
||||||
|
/**
|
||||||
|
* OAuth 2.0授权token
|
||||||
|
*/
|
||||||
|
private String appAuthTokenName = "app_auth_token";
|
||||||
|
/**
|
||||||
|
* 请求参数的集合,最大长度不限,除公共参数外所有请求参数都必须放在这个参数中传递,具体参照各产品快速接入文档
|
||||||
|
*/
|
||||||
|
private String bizContentName = "biz_content";
|
||||||
|
|
||||||
|
// ========= 请求参数名 end =========
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 超时时间
|
||||||
|
*/
|
||||||
|
private int timeoutSeconds = 60 * 5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否开启限流功能
|
||||||
|
*/
|
||||||
|
private boolean openLimit = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示返回sign
|
||||||
|
*/
|
||||||
|
private boolean showReturnSign = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间戳格式
|
||||||
|
*/
|
||||||
|
private String timestampPattern = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时区,默认:Asia/Shanghai
|
||||||
|
*/
|
||||||
|
private String zoneId = "Asia/Shanghai";
|
||||||
|
}
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.config;
|
package com.gitee.sop.gateway.config;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
@@ -1,20 +1,20 @@
|
|||||||
package com.gitee.sop.index.config;
|
package com.gitee.sop.gateway.config;
|
||||||
|
|
||||||
import com.gitee.sop.index.message.ErrorFactory;
|
import com.gitee.sop.gateway.message.ErrorFactory;
|
||||||
import com.gitee.sop.index.service.ParamExecutor;
|
import com.gitee.sop.gateway.service.ParamExecutor;
|
||||||
import com.gitee.sop.index.service.ParamExecutorImpl;
|
import com.gitee.sop.gateway.service.ParamExecutorImpl;
|
||||||
import com.gitee.sop.index.service.RouteService;
|
import com.gitee.sop.gateway.service.RouteService;
|
||||||
import com.gitee.sop.index.service.RouteServiceImpl;
|
import com.gitee.sop.gateway.service.RouteServiceImpl;
|
||||||
import com.gitee.sop.index.service.interceptor.internal.ResultRouteInterceptor;
|
import com.gitee.sop.gateway.service.interceptor.internal.ResultRouteInterceptor;
|
||||||
import com.gitee.sop.index.service.manager.ApiManager;
|
import com.gitee.sop.gateway.service.manager.ApiManager;
|
||||||
import com.gitee.sop.index.service.manager.IsvManager;
|
import com.gitee.sop.gateway.service.manager.IsvManager;
|
||||||
import com.gitee.sop.index.service.manager.SecretManager;
|
import com.gitee.sop.gateway.service.manager.SecretManager;
|
||||||
import com.gitee.sop.index.service.manager.impl.LocalApiManagerImpl;
|
import com.gitee.sop.gateway.service.manager.impl.LocalApiManagerImpl;
|
||||||
import com.gitee.sop.index.service.manager.impl.LocalIsvManagerImpl;
|
import com.gitee.sop.gateway.service.manager.impl.LocalIsvManagerImpl;
|
||||||
import com.gitee.sop.index.service.manager.impl.LocalSecretManagerImpl;
|
import com.gitee.sop.gateway.service.manager.impl.LocalSecretManagerImpl;
|
||||||
import com.gitee.sop.index.service.manager.impl.RedisApiManagerImpl;
|
import com.gitee.sop.gateway.service.manager.impl.RedisApiManagerImpl;
|
||||||
import com.gitee.sop.index.service.manager.impl.RedisIsvManagerImpl;
|
import com.gitee.sop.gateway.service.manager.impl.RedisIsvManagerImpl;
|
||||||
import com.gitee.sop.index.service.manager.impl.RedisSecretManager;
|
import com.gitee.sop.gateway.service.manager.impl.RedisSecretManager;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
@@ -31,37 +31,37 @@ import javax.annotation.PostConstruct;
|
|||||||
public class IndexConfig {
|
public class IndexConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(value = "index.manager.api", havingValue = "local", matchIfMissing = true)
|
@ConditionalOnProperty(value = "gateway.manager.api", havingValue = "local", matchIfMissing = true)
|
||||||
public ApiManager localApiManager() {
|
public ApiManager localApiManager() {
|
||||||
return new LocalApiManagerImpl();
|
return new LocalApiManagerImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(value = "index.manager.api", havingValue = "redis")
|
@ConditionalOnProperty(value = "gateway.manager.api", havingValue = "redis")
|
||||||
public ApiManager redisApiManager() {
|
public ApiManager redisApiManager() {
|
||||||
return new RedisApiManagerImpl();
|
return new RedisApiManagerImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(value = "index.manager.isv", havingValue = "local", matchIfMissing = true)
|
@ConditionalOnProperty(value = "gateway.manager.isv", havingValue = "local", matchIfMissing = true)
|
||||||
public IsvManager localIsvManager() {
|
public IsvManager localIsvManager() {
|
||||||
return new LocalIsvManagerImpl();
|
return new LocalIsvManagerImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(value = "index.manager.isv", havingValue = "redis")
|
@ConditionalOnProperty(value = "gateway.manager.isv", havingValue = "redis")
|
||||||
public IsvManager redisIsvManager() {
|
public IsvManager redisIsvManager() {
|
||||||
return new RedisIsvManagerImpl();
|
return new RedisIsvManagerImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(value = "index.manager.secret", havingValue = "local", matchIfMissing = true)
|
@ConditionalOnProperty(value = "gateway.manager.secret", havingValue = "local", matchIfMissing = true)
|
||||||
public SecretManager localSecretManager() {
|
public SecretManager localSecretManager() {
|
||||||
return new LocalSecretManagerImpl();
|
return new LocalSecretManagerImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(value = "index.manager.secret", havingValue = "redis")
|
@ConditionalOnProperty(value = "gateway.manager.secret", havingValue = "redis")
|
||||||
public SecretManager redisSecretManager() {
|
public SecretManager redisSecretManager() {
|
||||||
return new RedisSecretManager();
|
return new RedisSecretManager();
|
||||||
}
|
}
|
@@ -1,10 +1,9 @@
|
|||||||
package com.gitee.sop.index.controller;
|
package com.gitee.sop.gateway.controller;
|
||||||
|
|
||||||
import com.gitee.sop.index.request.ApiRequestContext;
|
import com.gitee.sop.gateway.request.ApiRequestContext;
|
||||||
import com.gitee.sop.index.request.ApiRequestContextFactory;
|
import com.gitee.sop.gateway.response.ApiResponse;
|
||||||
import com.gitee.sop.index.response.ApiResponse;
|
import com.gitee.sop.gateway.service.ParamExecutor;
|
||||||
import com.gitee.sop.index.service.ParamExecutor;
|
import com.gitee.sop.gateway.service.RouteService;
|
||||||
import com.gitee.sop.index.service.RouteService;
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -54,7 +53,7 @@ public class IndexController {
|
|||||||
biz_content String 是 请求参数的集合,最大长度不限,除公共参数外所有请求参数都必须放在这个参数中传递,具体参照各产品快速接入文档
|
biz_content String 是 请求参数的集合,最大长度不限,除公共参数外所有请求参数都必须放在这个参数中传递,具体参照各产品快速接入文档
|
||||||
</pre>
|
</pre>
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "${index.path:/api}", method = {RequestMethod.GET, RequestMethod.POST})
|
@RequestMapping(value = "${gateway.path:/api}", method = {RequestMethod.GET, RequestMethod.POST})
|
||||||
public void index(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
public void index(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||||
ApiRequestContext apiRequestContext = paramExecutor.build(request);
|
ApiRequestContext apiRequestContext = paramExecutor.build(request);
|
||||||
ApiResponse apiResponse = routeService.route(apiRequestContext);
|
ApiResponse apiResponse = routeService.route(apiRequestContext);
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.dao.entity;
|
package com.gitee.sop.gateway.dao.entity;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@@ -71,6 +71,11 @@ public class ApiInfo {
|
|||||||
*/
|
*/
|
||||||
private Integer isNeedToken;
|
private Integer isNeedToken;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册来源,1-系统注册,2-手动注册
|
||||||
|
*/
|
||||||
|
private Integer regSource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 1启用,2禁用
|
* 1启用,2禁用
|
||||||
*/
|
*/
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.dao.entity;
|
package com.gitee.sop.gateway.dao.entity;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.dao.entity;
|
package com.gitee.sop.gateway.dao.entity;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
@@ -1,8 +1,8 @@
|
|||||||
package com.gitee.sop.index.dao.mapper;
|
package com.gitee.sop.gateway.dao.mapper;
|
||||||
|
|
||||||
|
|
||||||
import com.gitee.fastmybatis.core.mapper.BaseMapper;
|
import com.gitee.fastmybatis.core.mapper.BaseMapper;
|
||||||
import com.gitee.sop.index.dao.entity.ApiInfo;
|
import com.gitee.sop.gateway.dao.entity.ApiInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 六如
|
* @author 六如
|
@@ -1,7 +1,7 @@
|
|||||||
package com.gitee.sop.index.dao.mapper;
|
package com.gitee.sop.gateway.dao.mapper;
|
||||||
|
|
||||||
import com.gitee.fastmybatis.core.mapper.BaseMapper;
|
import com.gitee.fastmybatis.core.mapper.BaseMapper;
|
||||||
import com.gitee.sop.index.dao.entity.IsvInfo;
|
import com.gitee.sop.gateway.dao.entity.IsvInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 六如
|
* @author 六如
|
@@ -1,7 +1,7 @@
|
|||||||
package com.gitee.sop.index.dao.mapper;
|
package com.gitee.sop.gateway.dao.mapper;
|
||||||
|
|
||||||
import com.gitee.fastmybatis.core.mapper.BaseMapper;
|
import com.gitee.fastmybatis.core.mapper.BaseMapper;
|
||||||
import com.gitee.sop.index.dao.entity.IsvKeys;
|
import com.gitee.sop.gateway.dao.entity.IsvKeys;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 六如
|
* @author 六如
|
@@ -1,8 +1,8 @@
|
|||||||
package com.gitee.sop.index.exception;
|
package com.gitee.sop.gateway.exception;
|
||||||
|
|
||||||
|
|
||||||
import com.gitee.sop.index.message.ErrorEnum;
|
import com.gitee.sop.gateway.message.ErrorEnum;
|
||||||
import com.gitee.sop.index.message.IError;
|
import com.gitee.sop.gateway.message.IError;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
@@ -1,7 +1,7 @@
|
|||||||
package com.gitee.sop.index.exception;
|
package com.gitee.sop.gateway.exception;
|
||||||
|
|
||||||
import com.gitee.sop.index.response.ApiResponse;
|
import com.gitee.sop.gateway.response.ApiResponse;
|
||||||
import com.gitee.sop.index.message.ErrorEnum;
|
import com.gitee.sop.gateway.message.ErrorEnum;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.validation.BindException;
|
import org.springframework.validation.BindException;
|
||||||
import org.springframework.validation.FieldError;
|
import org.springframework.validation.FieldError;
|
@@ -1,7 +1,7 @@
|
|||||||
package com.gitee.sop.index.exception;
|
package com.gitee.sop.gateway.exception;
|
||||||
|
|
||||||
import com.gitee.sop.index.request.ApiRequestContext;
|
import com.gitee.sop.gateway.request.ApiRequestContext;
|
||||||
import com.gitee.sop.index.response.ApiResponse;
|
import com.gitee.sop.gateway.response.ApiResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 六如
|
* @author 六如
|
@@ -1,6 +1,6 @@
|
|||||||
package com.gitee.sop.index.exception;
|
package com.gitee.sop.gateway.exception;
|
||||||
|
|
||||||
import com.gitee.sop.index.message.ErrorEnum;
|
import com.gitee.sop.gateway.message.ErrorEnum;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
@@ -1,10 +1,10 @@
|
|||||||
package com.gitee.sop.index.exception.impl;
|
package com.gitee.sop.gateway.exception.impl;
|
||||||
|
|
||||||
import com.gitee.sop.index.request.ApiRequestContext;
|
import com.gitee.sop.gateway.request.ApiRequestContext;
|
||||||
import com.gitee.sop.index.response.ApiResponse;
|
import com.gitee.sop.gateway.response.ApiResponse;
|
||||||
import com.gitee.sop.index.exception.ApiException;
|
import com.gitee.sop.gateway.exception.ApiException;
|
||||||
import com.gitee.sop.index.exception.ExceptionExecutor;
|
import com.gitee.sop.gateway.exception.ExceptionExecutor;
|
||||||
import com.gitee.sop.index.message.ErrorEnum;
|
import com.gitee.sop.gateway.message.ErrorEnum;
|
||||||
import org.apache.dubbo.rpc.service.GenericException;
|
import org.apache.dubbo.rpc.service.GenericException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.message;
|
package com.gitee.sop.gateway.message;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 网关错误定义
|
* 网关错误定义
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.message;
|
package com.gitee.sop.gateway.message;
|
||||||
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.message;
|
package com.gitee.sop.gateway.message;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.message;
|
package com.gitee.sop.gateway.message;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.message;
|
package com.gitee.sop.gateway.message;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定义错误返回
|
* 定义错误返回
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.request;
|
package com.gitee.sop.gateway.request;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.annotation.JSONField;
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.request;
|
package com.gitee.sop.gateway.request;
|
||||||
|
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
@@ -1,14 +1,13 @@
|
|||||||
package com.gitee.sop.index.request;
|
package com.gitee.sop.gateway.request;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.gitee.sop.index.common.SopConstants;
|
import com.gitee.sop.gateway.common.SopConstants;
|
||||||
import com.gitee.sop.index.config.RequestParamConfig;
|
import com.gitee.sop.gateway.config.ApiConfig;
|
||||||
import com.gitee.sop.index.util.RequestUtil;
|
import com.gitee.sop.gateway.util.RequestUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -26,7 +25,7 @@ public class ApiRequestContextFactory {
|
|||||||
private static final String MULTIPART = "multipart";
|
private static final String MULTIPART = "multipart";
|
||||||
public static final String FORM = "form";
|
public static final String FORM = "form";
|
||||||
|
|
||||||
public static ApiRequestContext build(HttpServletRequest request, RequestParamConfig requestParamConfig) {
|
public static ApiRequestContext build(HttpServletRequest request, ApiConfig apiConfig) {
|
||||||
// get请求可能返回null
|
// get请求可能返回null
|
||||||
String contentType = request.getHeader(CONTENT_TYPE);
|
String contentType = request.getHeader(CONTENT_TYPE);
|
||||||
if (contentType == null) {
|
if (contentType == null) {
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.request;
|
package com.gitee.sop.gateway.request;
|
||||||
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.request;
|
package com.gitee.sop.gateway.request;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.request;
|
package com.gitee.sop.gateway.request;
|
||||||
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
@@ -1,9 +1,9 @@
|
|||||||
package com.gitee.sop.index.response;
|
package com.gitee.sop.gateway.response;
|
||||||
|
|
||||||
import com.gitee.sop.index.exception.ApiException;
|
import com.gitee.sop.gateway.exception.ApiException;
|
||||||
import com.gitee.sop.index.message.ErrorEnum;
|
import com.gitee.sop.gateway.message.ErrorEnum;
|
||||||
import com.gitee.sop.index.message.ErrorMeta;
|
import com.gitee.sop.gateway.message.ErrorMeta;
|
||||||
import com.gitee.sop.index.message.IError;
|
import com.gitee.sop.gateway.message.IError;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.service;
|
package com.gitee.sop.gateway.service;
|
||||||
|
|
||||||
import org.apache.dubbo.common.config.ReferenceCache;
|
import org.apache.dubbo.common.config.ReferenceCache;
|
||||||
import org.apache.dubbo.config.ApplicationConfig;
|
import org.apache.dubbo.config.ApplicationConfig;
|
@@ -1,7 +1,7 @@
|
|||||||
package com.gitee.sop.index.service;
|
package com.gitee.sop.gateway.service;
|
||||||
|
|
||||||
import com.gitee.sop.index.request.ApiRequestContext;
|
import com.gitee.sop.gateway.request.ApiRequestContext;
|
||||||
import com.gitee.sop.index.response.ApiResponse;
|
import com.gitee.sop.gateway.response.ApiResponse;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
@@ -1,15 +1,15 @@
|
|||||||
package com.gitee.sop.index.service;
|
package com.gitee.sop.gateway.service;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.gitee.sop.index.common.SopConstants;
|
import com.gitee.sop.gateway.common.SopConstants;
|
||||||
import com.gitee.sop.index.config.RequestParamConfig;
|
import com.gitee.sop.gateway.config.ApiConfig;
|
||||||
import com.gitee.sop.index.request.ApiRequest;
|
import com.gitee.sop.gateway.request.ApiRequest;
|
||||||
import com.gitee.sop.index.request.ApiRequestContext;
|
import com.gitee.sop.gateway.request.ApiRequestContext;
|
||||||
import com.gitee.sop.index.request.UploadContext;
|
import com.gitee.sop.gateway.request.UploadContext;
|
||||||
import com.gitee.sop.index.response.ApiResponse;
|
import com.gitee.sop.gateway.response.ApiResponse;
|
||||||
import com.gitee.sop.index.util.RequestUtil;
|
import com.gitee.sop.gateway.util.RequestUtil;
|
||||||
import com.gitee.sop.index.util.ResponseUtil;
|
import com.gitee.sop.gateway.util.ResponseUtil;
|
||||||
import com.gitee.sop.support.dto.FileData;
|
import com.gitee.sop.support.dto.FileData;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
@@ -37,7 +37,7 @@ public class ParamExecutorImpl implements ParamExecutor<HttpServletRequest, Http
|
|||||||
private static final String FORM = "form";
|
private static final String FORM = "form";
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private RequestParamConfig requestParamConfig;
|
private ApiConfig apiConfig;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiRequestContext build(HttpServletRequest request) {
|
public ApiRequestContext build(HttpServletRequest request) {
|
||||||
@@ -88,17 +88,17 @@ public class ParamExecutorImpl implements ParamExecutor<HttpServletRequest, Http
|
|||||||
|
|
||||||
protected ApiRequest convertApiRequest(JSONObject jsonObject) {
|
protected ApiRequest convertApiRequest(JSONObject jsonObject) {
|
||||||
ApiRequest apiRequest = new ApiRequest();
|
ApiRequest apiRequest = new ApiRequest();
|
||||||
apiRequest.setAppId(jsonObject.getString(requestParamConfig.getAppIdName()));
|
apiRequest.setAppId(jsonObject.getString(apiConfig.getAppIdName()));
|
||||||
apiRequest.setMethod(jsonObject.getString(requestParamConfig.getApiName()));
|
apiRequest.setMethod(jsonObject.getString(apiConfig.getApiName()));
|
||||||
apiRequest.setFormat(jsonObject.getString(requestParamConfig.getFormatName()));
|
apiRequest.setFormat(jsonObject.getString(apiConfig.getFormatName()));
|
||||||
apiRequest.setCharset(jsonObject.getString(requestParamConfig.getCharsetName()));
|
apiRequest.setCharset(jsonObject.getString(apiConfig.getCharsetName()));
|
||||||
apiRequest.setSignType(jsonObject.getString(requestParamConfig.getSignTypeName()));
|
apiRequest.setSignType(jsonObject.getString(apiConfig.getSignTypeName()));
|
||||||
apiRequest.setSign(jsonObject.getString(requestParamConfig.getSignName()));
|
apiRequest.setSign(jsonObject.getString(apiConfig.getSignName()));
|
||||||
apiRequest.setTimestamp(jsonObject.getString(requestParamConfig.getTimestampName()));
|
apiRequest.setTimestamp(jsonObject.getString(apiConfig.getTimestampName()));
|
||||||
apiRequest.setVersion(jsonObject.getString(requestParamConfig.getVersionName()));
|
apiRequest.setVersion(jsonObject.getString(apiConfig.getVersionName()));
|
||||||
apiRequest.setNotifyUrl(jsonObject.getString(requestParamConfig.getNotifyUrlName()));
|
apiRequest.setNotifyUrl(jsonObject.getString(apiConfig.getNotifyUrlName()));
|
||||||
apiRequest.setAppAuthToken(jsonObject.getString(requestParamConfig.getAppAuthTokenName()));
|
apiRequest.setAppAuthToken(jsonObject.getString(apiConfig.getAppAuthTokenName()));
|
||||||
apiRequest.setBizContent(jsonObject.getString(requestParamConfig.getBizContentName()));
|
apiRequest.setBizContent(jsonObject.getString(apiConfig.getBizContentName()));
|
||||||
return apiRequest;
|
return apiRequest;
|
||||||
}
|
}
|
||||||
|
|
@@ -1,7 +1,7 @@
|
|||||||
package com.gitee.sop.index.service;
|
package com.gitee.sop.gateway.service;
|
||||||
|
|
||||||
import com.gitee.sop.index.request.ApiRequestContext;
|
import com.gitee.sop.gateway.request.ApiRequestContext;
|
||||||
import com.gitee.sop.index.response.ApiResponse;
|
import com.gitee.sop.gateway.response.ApiResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接口路由
|
* 接口路由
|
@@ -1,20 +1,20 @@
|
|||||||
package com.gitee.sop.index.service;
|
package com.gitee.sop.gateway.service;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.gitee.sop.index.common.ApiInfoDTO;
|
import com.gitee.sop.gateway.common.ApiInfoDTO;
|
||||||
import com.gitee.sop.index.common.AttachmentNames;
|
import com.gitee.sop.gateway.common.AttachmentNames;
|
||||||
import com.gitee.sop.index.common.ParamInfoDTO;
|
import com.gitee.sop.gateway.common.ParamInfoDTO;
|
||||||
import com.gitee.sop.index.exception.ApiException;
|
import com.gitee.sop.gateway.exception.ApiException;
|
||||||
import com.gitee.sop.index.exception.ExceptionExecutor;
|
import com.gitee.sop.gateway.exception.ExceptionExecutor;
|
||||||
import com.gitee.sop.index.message.ErrorEnum;
|
import com.gitee.sop.gateway.message.ErrorEnum;
|
||||||
import com.gitee.sop.index.request.ApiRequest;
|
import com.gitee.sop.gateway.request.ApiRequest;
|
||||||
import com.gitee.sop.index.request.ApiRequestContext;
|
import com.gitee.sop.gateway.request.ApiRequestContext;
|
||||||
import com.gitee.sop.index.request.UploadContext;
|
import com.gitee.sop.gateway.request.UploadContext;
|
||||||
import com.gitee.sop.index.response.ApiResponse;
|
import com.gitee.sop.gateway.response.ApiResponse;
|
||||||
import com.gitee.sop.index.service.interceptor.RouteInterceptor;
|
import com.gitee.sop.gateway.service.interceptor.RouteInterceptor;
|
||||||
import com.gitee.sop.index.service.validate.Validator;
|
import com.gitee.sop.gateway.service.validate.Validator;
|
||||||
import com.gitee.sop.index.util.ClassUtil;
|
import com.gitee.sop.gateway.util.ClassUtil;
|
||||||
import com.gitee.sop.support.dto.CommonFileData;
|
import com.gitee.sop.support.dto.CommonFileData;
|
||||||
import com.gitee.sop.support.dto.FileData;
|
import com.gitee.sop.support.dto.FileData;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
@@ -1,11 +1,11 @@
|
|||||||
package com.gitee.sop.index.service.dubbo;
|
package com.gitee.sop.gateway.service.dubbo;
|
||||||
|
|
||||||
import com.gitee.sop.index.common.ApiInfoDTO;
|
import com.gitee.sop.gateway.common.ApiInfoDTO;
|
||||||
import com.gitee.sop.index.common.StatusEnum;
|
import com.gitee.sop.gateway.common.StatusEnum;
|
||||||
import com.gitee.sop.index.dao.entity.ApiInfo;
|
import com.gitee.sop.gateway.dao.entity.ApiInfo;
|
||||||
import com.gitee.sop.index.dao.mapper.ApiInfoMapper;
|
import com.gitee.sop.gateway.dao.mapper.ApiInfoMapper;
|
||||||
import com.gitee.sop.index.service.manager.ApiManager;
|
import com.gitee.sop.gateway.service.manager.ApiManager;
|
||||||
import com.gitee.sop.index.util.CopyUtil;
|
import com.gitee.sop.gateway.util.CopyUtil;
|
||||||
import com.gitee.sop.support.service.ApiRegisterService;
|
import com.gitee.sop.support.service.ApiRegisterService;
|
||||||
import com.gitee.sop.support.service.dto.RegisterDTO;
|
import com.gitee.sop.support.service.dto.RegisterDTO;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -37,6 +37,7 @@ public class ApiRegisterServiceImpl implements ApiRegisterService {
|
|||||||
apiInfo = new ApiInfo();
|
apiInfo = new ApiInfo();
|
||||||
}
|
}
|
||||||
CopyUtil.copyPropertiesIgnoreNull(apiInfoDTO, apiInfo);
|
CopyUtil.copyPropertiesIgnoreNull(apiInfoDTO, apiInfo);
|
||||||
|
apiInfo.setRegSource(1);
|
||||||
// 保存到数据库
|
// 保存到数据库
|
||||||
apiInfoMapper.saveOrUpdate(apiInfo);
|
apiInfoMapper.saveOrUpdate(apiInfo);
|
||||||
// 保存到缓存
|
// 保存到缓存
|
@@ -1,6 +1,6 @@
|
|||||||
package com.gitee.sop.index.service.dubbo;
|
package com.gitee.sop.gateway.service.dubbo;
|
||||||
|
|
||||||
import com.gitee.sop.index.service.manager.IsvManager;
|
import com.gitee.sop.gateway.service.manager.IsvManager;
|
||||||
import com.gitee.sop.support.service.IsvService;
|
import com.gitee.sop.support.service.IsvService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.dubbo.config.annotation.DubboService;
|
import org.apache.dubbo.config.annotation.DubboService;
|
@@ -1,7 +1,7 @@
|
|||||||
package com.gitee.sop.index.service.interceptor;
|
package com.gitee.sop.gateway.service.interceptor;
|
||||||
|
|
||||||
import com.gitee.sop.index.common.ApiInfoDTO;
|
import com.gitee.sop.gateway.common.ApiInfoDTO;
|
||||||
import com.gitee.sop.index.request.ApiRequestContext;
|
import com.gitee.sop.gateway.request.ApiRequestContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 路由拦截器
|
* 路由拦截器
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.service.interceptor;
|
package com.gitee.sop.gateway.service.interceptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 六如
|
* @author 六如
|
@@ -1,9 +1,9 @@
|
|||||||
package com.gitee.sop.index.service.interceptor.internal;
|
package com.gitee.sop.gateway.service.interceptor.internal;
|
||||||
|
|
||||||
import com.gitee.sop.index.common.ApiInfoDTO;
|
import com.gitee.sop.gateway.common.ApiInfoDTO;
|
||||||
import com.gitee.sop.index.request.ApiRequestContext;
|
import com.gitee.sop.gateway.request.ApiRequestContext;
|
||||||
import com.gitee.sop.index.service.interceptor.RouteInterceptor;
|
import com.gitee.sop.gateway.service.interceptor.RouteInterceptor;
|
||||||
import com.gitee.sop.index.service.interceptor.RouteInterceptorOrders;
|
import com.gitee.sop.gateway.service.interceptor.RouteInterceptorOrders;
|
||||||
import com.gitee.sop.support.dto.CommonFileData;
|
import com.gitee.sop.support.dto.CommonFileData;
|
||||||
import com.gitee.sop.support.dto.FileData;
|
import com.gitee.sop.support.dto.FileData;
|
||||||
|
|
@@ -1,6 +1,6 @@
|
|||||||
package com.gitee.sop.index.service.manager;
|
package com.gitee.sop.gateway.service.manager;
|
||||||
|
|
||||||
import com.gitee.sop.index.common.ApiInfoDTO;
|
import com.gitee.sop.gateway.common.ApiInfoDTO;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.service.manager;
|
package com.gitee.sop.gateway.service.manager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IP黑名单管理
|
* IP黑名单管理
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.service.manager;
|
package com.gitee.sop.gateway.service.manager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* isv接口授权管理
|
* isv接口授权管理
|
@@ -1,6 +1,6 @@
|
|||||||
package com.gitee.sop.index.service.manager;
|
package com.gitee.sop.gateway.service.manager;
|
||||||
|
|
||||||
import com.gitee.sop.index.service.manager.dto.IsvDTO;
|
import com.gitee.sop.gateway.service.manager.dto.IsvDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 六如
|
* @author 六如
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.service.manager;
|
package com.gitee.sop.gateway.service.manager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 秘钥管理
|
* 秘钥管理
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.index.service.manager.dto;
|
package com.gitee.sop.gateway.service.manager.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@@ -1,6 +1,6 @@
|
|||||||
package com.gitee.sop.index.service.manager.impl;
|
package com.gitee.sop.gateway.service.manager.impl;
|
||||||
|
|
||||||
import com.gitee.sop.index.service.manager.IpBlacklistManager;
|
import com.gitee.sop.gateway.service.manager.IpBlacklistManager;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
@@ -1,6 +1,6 @@
|
|||||||
package com.gitee.sop.index.service.manager.impl;
|
package com.gitee.sop.gateway.service.manager.impl;
|
||||||
|
|
||||||
import com.gitee.sop.index.service.manager.IsvApiPermissionManager;
|
import com.gitee.sop.gateway.service.manager.IsvApiPermissionManager;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
@@ -1,10 +1,10 @@
|
|||||||
package com.gitee.sop.index.service.manager.impl;
|
package com.gitee.sop.gateway.service.manager.impl;
|
||||||
|
|
||||||
import com.gitee.sop.index.common.ApiInfoDTO;
|
import com.gitee.sop.gateway.common.ApiInfoDTO;
|
||||||
import com.gitee.sop.index.dao.entity.ApiInfo;
|
import com.gitee.sop.gateway.dao.entity.ApiInfo;
|
||||||
import com.gitee.sop.index.dao.mapper.ApiInfoMapper;
|
import com.gitee.sop.gateway.dao.mapper.ApiInfoMapper;
|
||||||
import com.gitee.sop.index.service.manager.ApiManager;
|
import com.gitee.sop.gateway.service.manager.ApiManager;
|
||||||
import com.gitee.sop.index.util.CopyUtil;
|
import com.gitee.sop.gateway.util.CopyUtil;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user