feat(system): 新增外部系统推送配置功能

- 添加 BusinessTypeEnum 枚举定义采购、销售、生产三种业务类型
- 在 ErrorCodeConstants 中新增外部系统推送配置相关错误码
- 创建 ExternalPushConfigApi 定义推送配置的 RPC 接口
- 实现 ExternalPushConfigApiImpl 提供推送判断功能
- 设计 ExternalPushConfigDO 数据对象存储推送配置信息
- 开发 ExternalPushConfigMapper 提供数据库操作功能
- 实现 ExternalPushConfigService 业务逻辑处理
- 创建管理后台 Controller 提供 CRUD 和查询接口
- 定义请求响应 VO 对象规范接口参数和返回值
- 添加数据库表结构初始化脚本支持推送配置存储
This commit is contained in:
wuzongyong
2026-01-20 17:14:37 +08:00
parent a5d3afaf9b
commit 95d156940f
15 changed files with 1061 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
package com.zt.plat.module.system.api.push;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.module.system.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* 外部系统推送配置 Feign API
*
* @author ZT Cloud
*/
@FeignClient(name = ApiConstants.NAME)
@Tag(name = "RPC 服务 - 外部系统推送配置")
public interface ExternalPushConfigApi {
String PREFIX = ApiConstants.PREFIX + "/external-push-config";
/**
* 判断是否允许推送到外部系统
*
* @param companyId 公司编号(可选,为 null 时表示不限制公司)
* @param deptId 部门编号(可选,为 null 时只按公司配置判断)
* @param businessType 业务类型可选PURCHASE/SALE/PRODUCTION为 null 时表示所有业务类型)
* @param externalSystem 外部系统标识可选ERP/IWORK/等,为 null 时表示所有外部系统)
* @return 是否允许推送true=允许false=禁止,默认 true
*/
@GetMapping(PREFIX + "/is-push-enabled")
@Operation(summary = "判断是否允许推送到外部系统")
CommonResult<Boolean> isPushEnabled(
@RequestParam(value = "companyId", required = false) @Parameter(description = "公司编号") Long companyId,
@RequestParam(value = "deptId", required = false) @Parameter(description = "部门编号") Long deptId,
@RequestParam(value = "businessType", required = false) @Parameter(description = "业务类型") String businessType,
@RequestParam(value = "externalSystem", required = false) @Parameter(description = "外部系统标识") String externalSystem);
}

View File

@@ -230,4 +230,11 @@ public interface ErrorCodeConstants {
// ========== 门户网站 1-002-033-000 ==========
ErrorCode PORTAL_NOT_EXISTS = new ErrorCode(1_002_033_000, "门户不存在");
// ========== 外部系统推送配置 1_002_034_000 ==========
ErrorCode EXTERNAL_PUSH_CONFIG_NOT_EXISTS = new ErrorCode(1_002_034_001, "外部系统推送配置不存在");
ErrorCode EXTERNAL_PUSH_CONFIG_EXISTS = new ErrorCode(1_002_034_002, "该配置已存在");
ErrorCode EXTERNAL_PUSH_CONFIG_COMPANY_INVALID = new ErrorCode(1_002_034_003, "公司编号必须是公司节点is_company=1");
ErrorCode EXTERNAL_PUSH_CONFIG_DEPT_INVALID = new ErrorCode(1_002_034_004, "部门编号必须是部门节点is_company=0");
ErrorCode EXTERNAL_PUSH_CONFIG_BUSINESS_TYPE_INVALID = new ErrorCode(1_002_034_005, "业务类型无效,仅支持 PURCHASE/SALE/PRODUCTION");
}

View File

@@ -0,0 +1,70 @@
package com.zt.plat.module.system.enums.push;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 业务类型枚举
*
* @author ZT Cloud
*/
@AllArgsConstructor
@Getter
public enum BusinessTypeEnum {
PURCHASE(1, "PURCHASE", "采购"),
SALE(2, "SALE", "销售"),
PRODUCTION(3, "PRODUCTION", "生产");
/**
* 类型
*/
private final Integer type;
/**
* 编码
*/
private final String code;
/**
* 名称
*/
private final String name;
/**
* 根据编码获取枚举
*/
public static BusinessTypeEnum valueOfCode(String code) {
if (code == null) {
return null;
}
for (BusinessTypeEnum value : BusinessTypeEnum.values()) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}
/**
* 根据类型获取枚举
*/
public static BusinessTypeEnum valueOfType(Integer type) {
if (type == null) {
return null;
}
for (BusinessTypeEnum value : BusinessTypeEnum.values()) {
if (value.getType().equals(type)) {
return value;
}
}
return null;
}
/**
* 验证编码是否有效
*/
public static boolean isValidCode(String code) {
return valueOfCode(code) != null;
}
}