Merge remote-tracking branch 'ztcloud/test' into dev

This commit is contained in:
yangchaojin
2026-01-21 17:33:45 +08:00
20 changed files with 1218 additions and 7 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;
}
}