feat(system): 新增外部系统推送配置功能
- 添加 BusinessTypeEnum 枚举定义采购、销售、生产三种业务类型 - 在 ErrorCodeConstants 中新增外部系统推送配置相关错误码 - 创建 ExternalPushConfigApi 定义推送配置的 RPC 接口 - 实现 ExternalPushConfigApiImpl 提供推送判断功能 - 设计 ExternalPushConfigDO 数据对象存储推送配置信息 - 开发 ExternalPushConfigMapper 提供数据库操作功能 - 实现 ExternalPushConfigService 业务逻辑处理 - 创建管理后台 Controller 提供 CRUD 和查询接口 - 定义请求响应 VO 对象规范接口参数和返回值 - 添加数据库表结构初始化脚本支持推送配置存储
This commit is contained in:
132
sql/dm/外部系统推送配置初始化_DM8_20260120.sql
Normal file
132
sql/dm/外部系统推送配置初始化_DM8_20260120.sql
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
}
|
||||
@@ -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");
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.zt.plat.module.system.api.push;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.module.system.service.push.ExternalPushConfigService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* 外部系统推送配置 Feign API 实现类
|
||||
*
|
||||
* @author ZT Cloud
|
||||
*/
|
||||
@RestController
|
||||
@Validated
|
||||
public class ExternalPushConfigApiImpl implements ExternalPushConfigApi {
|
||||
|
||||
@Resource
|
||||
private ExternalPushConfigService externalPushConfigService;
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> isPushEnabled(Long companyId, Long deptId, String businessType, String externalSystem) {
|
||||
Boolean result = externalPushConfigService.isPushEnabled(companyId, deptId, businessType, externalSystem);
|
||||
return success(result);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,22 @@
|
||||
package com.zt.plat.module.system.controller.admin.push.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Schema(description = "管理后台 - 业务类型 Response VO")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BusinessTypeRespVO {
|
||||
|
||||
@Schema(description = "类型", example = "1")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "编码", example = "PURCHASE")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "名称", example = "采购")
|
||||
private String name;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.zt.plat.module.system.controller.admin.push.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 外部系统推送配置基础信息")
|
||||
@Data
|
||||
public class ExternalPushConfigBaseVO {
|
||||
|
||||
@Schema(description = "公司编号(为空表示不限制公司)", example = "1024")
|
||||
private Long companyId;
|
||||
|
||||
@Schema(description = "部门编号(为空表示公司级配置)", example = "2048")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "业务类型(为空表示所有业务类型)", example = "PURCHASE")
|
||||
@Size(max = 32, message = "业务类型长度不能超过 32 个字符")
|
||||
private String businessType;
|
||||
|
||||
@Schema(description = "外部系统标识(为空表示所有外部系统)", example = "ERP")
|
||||
@Size(max = 64, message = "外部系统标识长度不能超过 64 个字符")
|
||||
private String externalSystem;
|
||||
|
||||
@Schema(description = "是否启用推送", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
@NotNull(message = "推送开关不能为空")
|
||||
private Boolean enablePush;
|
||||
|
||||
@Schema(description = "备注", example = "ERP 采购单推送配置")
|
||||
@Size(max = 512, message = "备注长度不能超过 512 个字符")
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.zt.plat.module.system.controller.admin.push.vo;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Schema(description = "管理后台 - 外部系统推送配置分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ExternalPushConfigPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "公司编号", example = "1024")
|
||||
private Long companyId;
|
||||
|
||||
@Schema(description = "部门编号", example = "2048")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "业务类型", example = "PURCHASE")
|
||||
private String businessType;
|
||||
|
||||
@Schema(description = "外部系统标识", example = "ERP")
|
||||
private String externalSystem;
|
||||
|
||||
@Schema(description = "是否启用推送", example = "true")
|
||||
private Boolean enablePush;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.zt.plat.module.system.controller.admin.push.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 外部系统推送配置 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ExternalPushConfigRespVO extends ExternalPushConfigBaseVO {
|
||||
|
||||
@Schema(description = "配置编号", example = "1024")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "公司名称", example = "浙江中天建设集团")
|
||||
private String companyName;
|
||||
|
||||
@Schema(description = "部门名称", example = "采购部")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "最后更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user