Merge branch 'main' into test
This commit is contained in:
commit
27eb2361ac
33
cpsp-common/cpsp-common-entity/pom.xml
Normal file
33
cpsp-common/cpsp-common-entity/pom.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<?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"
|
||||
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>
|
||||
<groupId>com.psbc.cpsp</groupId>
|
||||
<artifactId>cpsp-common</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>cpsp-common-entity</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.30</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.5.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.11.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
@ -0,0 +1,43 @@
|
||||
package com.psbc.cpsp.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 基础Entity
|
||||
*/
|
||||
@Data
|
||||
public class BaseEntity {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
/**
|
||||
* 创建用户
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String createUserId;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date lastModTime;
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private String lastModUserId;
|
||||
|
||||
/**
|
||||
* 租户
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String tenantId;
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.psbc.cpsp.entity;
|
||||
|
||||
import com.psbc.cpsp.entity.enums.BaseRespCodeInterFace;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 主动抛出异常
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class BizException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String code;
|
||||
private String message;
|
||||
|
||||
|
||||
public BizException(BaseRespCodeInterFace respCode) {
|
||||
super(respCode.getDesc());
|
||||
this.code = respCode.getCode();
|
||||
this.message = respCode.getDesc();
|
||||
}
|
||||
|
||||
|
||||
public BizException(BaseRespCodeInterFace respCode, String message) {
|
||||
super(message);
|
||||
this.code = respCode.getCode();
|
||||
this.message = message;
|
||||
}
|
||||
public BizException(String errorCode, String errorMessage) {
|
||||
super(errorCode + ":" + errorMessage);
|
||||
this.code = errorCode;
|
||||
this.message = errorMessage;
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package com.psbc.cpsp.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.psbc.cpsp.entity.enums.BaseRespCodeEnum;
|
||||
import com.psbc.cpsp.entity.enums.BaseRespCodeInterFace;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 智慧园区统一响应实体类
|
||||
* @param <T>
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CpspReponse<T> {
|
||||
private String code;
|
||||
private String message;
|
||||
private T data;
|
||||
|
||||
public CpspReponse(BaseRespCodeInterFace respCodeEnum, T data) {
|
||||
this.code = respCodeEnum.getCode();
|
||||
this.message = respCodeEnum.getDesc();
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public CpspReponse(BaseRespCodeInterFace respCodeEnum) {
|
||||
this.code = respCodeEnum.getCode();
|
||||
this.message = respCodeEnum.getDesc();
|
||||
}
|
||||
|
||||
public boolean isSuccess() {
|
||||
return BaseRespCodeEnum.SUCCESS.getCode().equals(this.getCode());
|
||||
}
|
||||
|
||||
|
||||
public static <T> CpspReponse<T> ok(T t) {
|
||||
return new CpspReponse<>(BaseRespCodeEnum.SUCCESS, t);
|
||||
}
|
||||
|
||||
public static <T> CpspReponse<T> ok(BaseRespCodeInterFace respCodeEnum,T t) {
|
||||
return new CpspReponse<>(respCodeEnum, t);
|
||||
}
|
||||
|
||||
public static CpspReponse ok() {
|
||||
return new CpspReponse(BaseRespCodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
public static <T> CpspReponse<PageInfo<T>> ok(IPage<T> pageData) {
|
||||
return CpspReponse.ok(PageInfo.toPageInfo(pageData));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.psbc.cpsp.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PageInfo<T> {
|
||||
private long pageSize;
|
||||
private long pageNum;
|
||||
private long total;
|
||||
private List<T> data;
|
||||
|
||||
public static <T> PageInfo<T> toPageInfo(IPage<T> data) {
|
||||
return new PageInfo<T>(data.getSize(), data.getCurrent(), data.getTotal(), data.getRecords());
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.psbc.cpsp.entity.config;
|
||||
|
||||
/**
|
||||
* 系统号
|
||||
*/
|
||||
public class ResponsePrefixConfig {
|
||||
/**
|
||||
* 智慧园区7位系统号
|
||||
*/
|
||||
public static final String preFix = "9900000";
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
package com.psbc.cpsp.entity.constant;
|
||||
|
||||
|
||||
/**
|
||||
* 公共响应码枚举类
|
||||
*/
|
||||
public class ResponseConstant {
|
||||
/**
|
||||
* 一级分类 技术类错误
|
||||
*/
|
||||
public static final String TECHNOLOGICAL_ERROR = "X";
|
||||
/**
|
||||
* 一级分类 业务类错误
|
||||
*/
|
||||
public static final String BUSINESS_ERROR = "Y";
|
||||
/**
|
||||
* 一级分类 第三方错误
|
||||
*/
|
||||
public static final String THIRD_PARTY_ERROR = "Z";
|
||||
|
||||
/**
|
||||
* 业务类错误 - 二级分类 密码与认证
|
||||
*/
|
||||
public static final String PASSWORD_AUTHENTICATION = "PA";
|
||||
|
||||
/**
|
||||
* 业务类错误 - 二级分类 数量与限额
|
||||
*/
|
||||
public static final String AMOUNT_LIMITATION = "AL";
|
||||
|
||||
/**
|
||||
* 业务类错误 - 二级分类 权限控制
|
||||
*/
|
||||
public static final String AUTHORITY_CONTROL = "AC";
|
||||
|
||||
/**
|
||||
* 业务类错误 - 二级分类 信息滥缺
|
||||
*/
|
||||
public static final String DATA_CONTEXT = "DC";
|
||||
|
||||
|
||||
/**
|
||||
* 业务类错误 - 二级分类 内容非法
|
||||
*/
|
||||
public static final String CONTENT_ERROR = "CE";
|
||||
|
||||
/**
|
||||
* 业务类错误 - 二级分类 重复交易
|
||||
*/
|
||||
public static final String DUPLICATE_TRANSACTION = "DT";
|
||||
|
||||
/**
|
||||
* 业务类错误 - 二级分类 时间与期限
|
||||
*/
|
||||
public static final String TIME = "TM";
|
||||
|
||||
/**
|
||||
* 业务类错误 - 二级分类 风险控制
|
||||
*/
|
||||
public static final String RISK_CONTROL = "RC";
|
||||
|
||||
/**
|
||||
* 业务类错误 - 二级分类 内部管理
|
||||
*/
|
||||
public static final String INTERNAL_MANAGEMENT = "IG";
|
||||
|
||||
/**
|
||||
* 业务类错误 - 二级分类 产品管控
|
||||
*/
|
||||
public static final String PRODUCT_SUPPORT = "PS";
|
||||
|
||||
/**
|
||||
* 业务类错误 - 二级分类 账户限制
|
||||
*/
|
||||
public static final String ACCOUNT_RESTRICTION = "AR";
|
||||
|
||||
/**
|
||||
* 业务类错误 - 二级分类 业务逻辑
|
||||
*/
|
||||
public static final String BUSINESS_LOGIC = "BL";
|
||||
|
||||
/**
|
||||
* 技术类错误 - 二级分类 硬件错误
|
||||
*/
|
||||
public static final String HARDWARE = "HW";
|
||||
|
||||
/**
|
||||
* 技术类错误 - 二级分类 数据内容相关
|
||||
*/
|
||||
public static final String TECHNOLOGICAL_DATA_CONTEXT = "DC";
|
||||
|
||||
/**
|
||||
* 技术类错误 - 二级分类 I/O类读写相关
|
||||
*/
|
||||
public static final String READ_AND_WRITE = "RW";
|
||||
|
||||
/**
|
||||
* 技术类错误 - 二级分类 数据库相关
|
||||
*/
|
||||
public static final String DATABASE_ERROR = "DB";
|
||||
|
||||
/**
|
||||
* 技术类错误 - 二级分类 网络通讯
|
||||
*/
|
||||
public static final String NETWORK_COMMUNICATION = "NC";
|
||||
|
||||
/**
|
||||
* 技术类错误 - 二级分类 安全服务
|
||||
*/
|
||||
public static final String SECURITY_SERVICE = "SS";
|
||||
|
||||
/**
|
||||
* 技术类错误 - 二级分类 组件模块
|
||||
*/
|
||||
public static final String COMPONENTS_MODULES = "CM";
|
||||
|
||||
/**
|
||||
* 技术类错误 - 二级分类 流量控制
|
||||
*/
|
||||
public static final String FLOW_CONTROL = "FC";
|
||||
|
||||
/**
|
||||
* 技术类错误 - 二级分类 重复交易
|
||||
*/
|
||||
public static final String TECHNOLOGICAL_DUPLICATE_TRANSACTION = "DT";
|
||||
|
||||
/**
|
||||
* 技术类错误 - 二级分类 技术逻辑
|
||||
*/
|
||||
public static final String TECHNICAL_LOGIC = "TL";
|
||||
|
||||
/**
|
||||
* 技术类错误 - 二级分类 纯技术性错误
|
||||
*/
|
||||
public static final String ABSOLUTE_TECHNIQUE = "AT";
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.psbc.cpsp.entity.enums;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* 园区16位响应码基础枚举类
|
||||
*/
|
||||
public enum BaseRespCodeEnum implements BaseRespCodeInterFace {
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
SUCCESS("0000000000000000","成功");
|
||||
/**
|
||||
* 智慧园区16位响应码-枚举编码
|
||||
*/
|
||||
private final String code;
|
||||
/**
|
||||
* 响应描述信息
|
||||
*/
|
||||
private final String desc;
|
||||
|
||||
@Override
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDesc(String... args) {
|
||||
if (args == null) {
|
||||
return desc;
|
||||
}
|
||||
|
||||
return MessageFormat.format(desc, args);
|
||||
}
|
||||
|
||||
BaseRespCodeEnum(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,28 @@
|
||||
package com.psbc.cpsp.entity.enums;
|
||||
|
||||
/**
|
||||
* 基础响应码类
|
||||
*/
|
||||
public interface BaseRespCodeInterFace {
|
||||
|
||||
/**
|
||||
* 获取响应码
|
||||
*
|
||||
* @return 响应码
|
||||
*/
|
||||
String getCode();
|
||||
|
||||
/**
|
||||
* 获取响应描述
|
||||
*
|
||||
* @return 响应描述
|
||||
*/
|
||||
String getDesc();
|
||||
|
||||
/**
|
||||
* 获取响应描述
|
||||
*
|
||||
* @return 响应描述
|
||||
*/
|
||||
String getDesc(String... args);
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.psbc.cpsp.entity.enums;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import static com.psbc.cpsp.entity.config.ResponsePrefixConfig.preFix;
|
||||
import static com.psbc.cpsp.entity.constant.ResponseConstant.BUSINESS_ERROR;
|
||||
import static com.psbc.cpsp.entity.constant.ResponseConstant.BUSINESS_LOGIC;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 业务类错误-Y
|
||||
* 说明:业务/人为错误,处理人为业务人员/用户 例举:密码 权限 风控等
|
||||
* 格式:一级分类代码 + 系统号 + 二级分类代码 + 6位响应码,描述需与二级分类代码匹配
|
||||
* 二级分类从ResponseConstant中引用
|
||||
*/
|
||||
public enum BusiErrRespCodeEnum implements BaseRespCodeInterFace {
|
||||
|
||||
|
||||
/**
|
||||
* 业务类错误-Y,业务逻辑-BL, 业务异常,交易映射相关配置有误
|
||||
*/
|
||||
TX_RELATION_INFO_CONFIG_ERROR(BUSINESS_ERROR + preFix + BUSINESS_LOGIC + "820022", "业务异常-交易映射相关配置有误"),
|
||||
/**
|
||||
* 业务异常,文件下载执行失败
|
||||
*/
|
||||
FILE_DOWNLOAD_ERROR(BUSINESS_ERROR + preFix + BUSINESS_LOGIC + "85T016", "文件下载失败:{0}");
|
||||
|
||||
|
||||
/**
|
||||
* 智慧园区16位响应码-枚举编码
|
||||
*/
|
||||
private final String code;
|
||||
/**
|
||||
* 响应描述信息
|
||||
*/
|
||||
private final String desc;
|
||||
|
||||
|
||||
@Override
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
BusiErrRespCodeEnum(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取描述具体信息
|
||||
*
|
||||
* @param args 参数信息
|
||||
* @return 描述具体信息
|
||||
*/
|
||||
@Override
|
||||
public String getDesc(String... args) {
|
||||
if (args == null) {
|
||||
return desc;
|
||||
}
|
||||
|
||||
return MessageFormat.format(desc, args);
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.psbc.cpsp.entity.enums;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import static com.psbc.cpsp.entity.config.ResponsePrefixConfig.preFix;
|
||||
import static com.psbc.cpsp.entity.constant.ResponseConstant.TECHNICAL_LOGIC;
|
||||
import static com.psbc.cpsp.entity.constant.ResponseConstant.TECHNOLOGICAL_ERROR;
|
||||
|
||||
|
||||
/**
|
||||
* 技术类错误-X
|
||||
* 说明:技术/机器错误,处理人为技术人员 例举:硬件 网络 系统等
|
||||
* 格式:一级分类代码 + 系统号 + 二级分类代码 + 6位响应码,描述需与二级分类代码匹配
|
||||
* 二级分类从ResponseConstant中引用
|
||||
*/
|
||||
public enum TechErrRespCodeEnum implements BaseRespCodeInterFace {
|
||||
|
||||
/**
|
||||
* 技术类错误-X, 技术逻辑-TL, 系统内部异常
|
||||
*/
|
||||
REQUEST_PROCESSING_FAILED(TECHNOLOGICAL_ERROR + preFix + TECHNICAL_LOGIC + "820001", "系统内部异常:{0}"),;
|
||||
|
||||
/**
|
||||
* 智慧园区16位响应码-枚举编码
|
||||
*/
|
||||
private final String code;
|
||||
/**
|
||||
* 响应描述信息
|
||||
*/
|
||||
private final String desc;
|
||||
|
||||
@Override
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDesc(String... args) {
|
||||
if (args == null) {
|
||||
return desc;
|
||||
}
|
||||
|
||||
return MessageFormat.format(desc, args);
|
||||
}
|
||||
|
||||
TechErrRespCodeEnum(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.psbc.cpsp.entity.enums;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import static com.psbc.cpsp.entity.config.ResponsePrefixConfig.preFix;
|
||||
import static com.psbc.cpsp.entity.constant.ResponseConstant.*;
|
||||
|
||||
|
||||
/**
|
||||
* 第三方错误-Z
|
||||
* 说明:行外因素,处理人为第三支持 例举:生态协同/开缴等第三方系统
|
||||
* 格式:一级分类代码 + 系统号 + 二级分类代码 + 6位响应码,描述需与二级分类代码匹配
|
||||
* 二级分类从ResponseConstant中引用
|
||||
*/
|
||||
public enum ThirdErrRespCodeEnum implements BaseRespCodeInterFace {
|
||||
|
||||
/**
|
||||
* 第三方错误-Z, 网络通讯-NC, 外系统系统异常-网络连接失败
|
||||
*/
|
||||
NETWORK_CONNECT_EXCEPTION(THIRD_PARTY_ERROR + preFix + NETWORK_COMMUNICATION + "820001", "外系统异常-网络连接失败");
|
||||
|
||||
/**
|
||||
* 园区16位响应码-枚举编码
|
||||
*/
|
||||
private final String code;
|
||||
|
||||
/**
|
||||
* 响应描述信息
|
||||
*/
|
||||
private final String desc;
|
||||
|
||||
@Override
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDesc(String... args) {
|
||||
if (args == null) {
|
||||
return desc;
|
||||
}
|
||||
|
||||
return MessageFormat.format(desc, args);
|
||||
}
|
||||
|
||||
ThirdErrRespCodeEnum(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
}
|
16
cpsp-common/pom.xml
Normal file
16
cpsp-common/pom.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?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"
|
||||
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>
|
||||
|
||||
<groupId>com.psbc.cpsp</groupId>
|
||||
<artifactId>cpsp-common</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>cpsp-common-entity</module>
|
||||
</modules>
|
||||
|
||||
|
||||
</project>
|
Loading…
x
Reference in New Issue
Block a user