Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -19,7 +19,7 @@
|
|||||||
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
|
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<revision>3.0.35</revision>
|
<revision>3.0.37</revision>
|
||||||
<!-- Maven 相关 -->
|
<!-- Maven 相关 -->
|
||||||
<java.version>17</java.version>
|
<java.version>17</java.version>
|
||||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
|
|||||||
@@ -12,6 +12,14 @@ import com.zt.plat.framework.common.exception.ErrorCode;
|
|||||||
public interface ErrorCodeConstants {
|
public interface ErrorCodeConstants {
|
||||||
|
|
||||||
// ========== 示例模块 1-001-000-000 ==========
|
// ========== 示例模块 1-001-000-000 ==========
|
||||||
ErrorCode EXAMPLE_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
|
ErrorCode MATERIAL_OTHER_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
|
||||||
|
ErrorCode ELEMENT_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
|
||||||
|
ErrorCode CONTACT_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
|
||||||
|
ErrorCode ACCOUNT_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
|
||||||
|
ErrorCode MATERIAL_DESTROY_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
|
||||||
|
ErrorCode MATERIAL_INFOMATION_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
|
||||||
|
ErrorCode COMPANY_RELATIVITY_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
|
||||||
|
ErrorCode WAREHOUSE_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
|
||||||
|
ErrorCode FACTORY_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.zt.plat.module.tmpltp.enums;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public enum DeleteStatusEnum {
|
||||||
|
|
||||||
|
STATUS_DRF(TmplStsEnum.DRAFT.getCode(), new HashSet<>() {{add(TmplStsEnum.DRAFT.getCode());}}),
|
||||||
|
STATUS_PUB(TmplStsEnum.PUBLISHED.getCode(), new HashSet<>()),
|
||||||
|
STATUS_STOP(TmplStsEnum.STOPPED.getCode(), new HashSet<>());
|
||||||
|
|
||||||
|
|
||||||
|
private final String code;
|
||||||
|
private final Set<String> allowedTransitions;
|
||||||
|
|
||||||
|
DeleteStatusEnum(String code, Set<String> allowedTransitions) {
|
||||||
|
this.code = code;
|
||||||
|
this.allowedTransitions = allowedTransitions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据状态码获取对应的枚举实例
|
||||||
|
*/
|
||||||
|
public static DeleteStatusEnum fromCode(String code) {
|
||||||
|
for (DeleteStatusEnum status : values()) {
|
||||||
|
if (status.code.equals(code)) {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验状态转换是否合法
|
||||||
|
*/
|
||||||
|
public boolean isTransitionAllowed(String targetStatus) {
|
||||||
|
return allowedTransitions.contains(targetStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,14 +14,15 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode TMPL_TP_DEl_ERROR = new ErrorCode(1_027_000_507, "模版分类删除失败");
|
ErrorCode TMPL_TP_DEl_ERROR = new ErrorCode(1_027_000_507, "模版分类删除失败");
|
||||||
ErrorCode TEMPLATE_INSTANCE_DATA_NOT_EXISTS = new ErrorCode(1_027_000_508, "实例字段值不存在");
|
ErrorCode TEMPLATE_INSTANCE_DATA_NOT_EXISTS = new ErrorCode(1_027_000_508, "实例字段值不存在");
|
||||||
ErrorCode TEMPLATE_INSTANCE_ITEM_NOT_EXISTS = new ErrorCode(1_027_000_509, "实例条款值不存在");
|
ErrorCode TEMPLATE_INSTANCE_ITEM_NOT_EXISTS = new ErrorCode(1_027_000_509, "实例条款值不存在");
|
||||||
|
ErrorCode TEMPLATE_INSTANCE_CREATE_FAIL = new ErrorCode(1_027_000_510, "实例创建失败");
|
||||||
ErrorCode PARAMS_IS_NULL_OR_ERR = new ErrorCode(1_027_000_510, "参数为空或参数错误");
|
ErrorCode PARAMS_IS_NULL_OR_ERR = new ErrorCode(1_027_000_510, "参数为空或参数错误");
|
||||||
ErrorCode DEPARTMENT_INSTANCE_RELATIVITY_NOT_EXISTS = new ErrorCode(1_027_000_511, "部门与实例关联不存在");
|
ErrorCode DEPARTMENT_INSTANCE_RELATIVITY_NOT_EXISTS = new ErrorCode(1_027_000_512, "部门与实例关联不存在");
|
||||||
ErrorCode ILLEGAL_OPERATION_TYPE = new ErrorCode(1_027_000_511, "非法操作类型");
|
ErrorCode ILLEGAL_OPERATION_TYPE = new ErrorCode(1_027_000_513, "非法操作类型");
|
||||||
ErrorCode OPERATION_FAIL= new ErrorCode(1_027_000_512, "操作失败");
|
ErrorCode OPERATION_FAIL= new ErrorCode(1_027_000_514, "操作失败");
|
||||||
ErrorCode STATUS_OPERATION_FAIL= new ErrorCode(1_027_000_513, "当前状态不支持此操作");
|
ErrorCode STATUS_OPERATION_FAIL= new ErrorCode(1_027_000_515, "当前状态不支持此操作");
|
||||||
ErrorCode NOT_FOUND_CLASS= new ErrorCode(1_027_000_514, "找不到对应的类");
|
ErrorCode NOT_FOUND_CLASS= new ErrorCode(1_027_000_516, "找不到对应的类");
|
||||||
ErrorCode UTIL_NOT_INIT= new ErrorCode(1_027_000_515, "工具类为未初始化");
|
ErrorCode UTIL_NOT_INIT= new ErrorCode(1_027_000_517, "工具类为未初始化");
|
||||||
ErrorCode TMPL_INS_FLD_CODE_EXISTS = new ErrorCode(1_027_000_516, "字段已存在");
|
ErrorCode TMPL_INS_FLD_CODE_EXISTS = new ErrorCode(1_027_000_518, "字段已存在");
|
||||||
//Illegal operation type
|
//Illegal operation type
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,25 +6,17 @@ import java.util.Set;
|
|||||||
/**
|
/**
|
||||||
* 状态枚举类,定义所有可能的状态及合法的状态转换
|
* 状态枚举类,定义所有可能的状态及合法的状态转换
|
||||||
*/
|
*/
|
||||||
public enum StatusEnum {
|
public enum PublishStatusEnum {
|
||||||
// 定义所有状态及对应的合法转换目标状态
|
|
||||||
STATUS_1("1", new HashSet<String>() {{
|
STATUS_DRF(TmplStsEnum.DRAFT.getCode(), new HashSet<>() {{add(TmplStsEnum.DRAFT.getCode());}}),
|
||||||
add("2");
|
STATUS_PUB(TmplStsEnum.PUBLISHED.getCode(), new HashSet<>()),
|
||||||
add("4");
|
STATUS_STOP(TmplStsEnum.STOPPED.getCode(), new HashSet<>() );
|
||||||
}}),
|
|
||||||
STATUS_2("2", new HashSet<String>() {{
|
|
||||||
add("3");
|
|
||||||
}}),
|
|
||||||
STATUS_3("3", new HashSet<String>() {{
|
|
||||||
add("4");
|
|
||||||
add("2");
|
|
||||||
}}),
|
|
||||||
STATUS_4("4", new HashSet<>()); // 没有合法的转换目标
|
|
||||||
|
|
||||||
private final String code;
|
private final String code;
|
||||||
private final Set<String> allowedTransitions;
|
private final Set<String> allowedTransitions;
|
||||||
|
|
||||||
StatusEnum(String code, Set<String> allowedTransitions) {
|
PublishStatusEnum(String code, Set<String> allowedTransitions) {
|
||||||
this.code = code;
|
this.code = code;
|
||||||
this.allowedTransitions = allowedTransitions;
|
this.allowedTransitions = allowedTransitions;
|
||||||
}
|
}
|
||||||
@@ -32,8 +24,8 @@ public enum StatusEnum {
|
|||||||
/**
|
/**
|
||||||
* 根据状态码获取对应的枚举实例
|
* 根据状态码获取对应的枚举实例
|
||||||
*/
|
*/
|
||||||
public static StatusEnum fromCode(String code) {
|
public static PublishStatusEnum fromCode(String code) {
|
||||||
for (StatusEnum status : values()) {
|
for (PublishStatusEnum status : values()) {
|
||||||
if (status.code.equals(code)) {
|
if (status.code.equals(code)) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.zt.plat.module.tmpltp.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum TmplStsEnum {
|
||||||
|
// 草稿状态
|
||||||
|
DRAFT("DRF", "草稿"),
|
||||||
|
// 已发布状态
|
||||||
|
PUBLISHED("PUB", "已发布"),
|
||||||
|
// 已停用状态
|
||||||
|
STOPPED("STOP", "已停用");
|
||||||
|
|
||||||
|
// 获取状态编码
|
||||||
|
private final String code;
|
||||||
|
// 获取状态描述
|
||||||
|
private final String description;
|
||||||
|
|
||||||
|
// 构造方法
|
||||||
|
TmplStsEnum(String code, String description) {
|
||||||
|
this.code = code;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据编码获取枚举实例
|
||||||
|
public static TmplStsEnum getByCode(String code) {
|
||||||
|
for (TmplStsEnum status : TmplStsEnum.values()) {
|
||||||
|
if (status.getCode().equals(code)) {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.zt.plat.module.tmpltp.enums;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public enum UpdateStatusEnum {
|
||||||
|
|
||||||
|
STATUS_DRF(TmplStsEnum.DRAFT.getCode(), new HashSet<>() {{
|
||||||
|
add(TmplStsEnum.DRAFT.getCode());
|
||||||
|
add(TmplStsEnum.STOPPED.getCode());
|
||||||
|
}}),
|
||||||
|
STATUS_PUB(TmplStsEnum.PUBLISHED.getCode(), new HashSet<>()),
|
||||||
|
STATUS_STOP(TmplStsEnum.STOPPED.getCode(), new HashSet<>(){{
|
||||||
|
add(TmplStsEnum.DRAFT.getCode());
|
||||||
|
add(TmplStsEnum.STOPPED.getCode());
|
||||||
|
}});
|
||||||
|
|
||||||
|
|
||||||
|
private final String code;
|
||||||
|
private final Set<String> allowedTransitions;
|
||||||
|
|
||||||
|
UpdateStatusEnum(String code, Set<String> allowedTransitions) {
|
||||||
|
this.code = code;
|
||||||
|
this.allowedTransitions = allowedTransitions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据状态码获取对应的枚举实例
|
||||||
|
*/
|
||||||
|
public static UpdateStatusEnum fromCode(String code) {
|
||||||
|
for (UpdateStatusEnum status : values()) {
|
||||||
|
if (status.code.equals(code)) {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验状态转换是否合法
|
||||||
|
*/
|
||||||
|
public boolean isTransitionAllowed(String targetStatus) {
|
||||||
|
return allowedTransitions.contains(targetStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,12 @@
|
|||||||
package com.zt.plat.module.base.controller.admin.base;
|
package com.zt.plat.module.base.controller.admin.base;
|
||||||
|
|
||||||
|
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
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;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
|
||||||
|
|
||||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user