From c52679cbdaae778ecd858517d350feb099dc9b6e Mon Sep 17 00:00:00 2001 From: wu Date: Thu, 1 Aug 2024 19:34:46 +0800 Subject: [PATCH] bugfix --- .../java/com/ruoyi/common/core/domain/R.java | 74 ++++++++++--------- .../service/impl/WfModelServiceImpl.java | 8 +- 2 files changed, 43 insertions(+), 39 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java index b28f8f3..381a6f6 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java @@ -1,24 +1,31 @@ package com.ruoyi.common.core.domain; import com.ruoyi.common.constant.HttpStatus; +import lombok.Data; +import lombok.NoArgsConstructor; import java.io.Serializable; /** * 响应信息主体 * - * @author ruoyi + * @author Lion Li */ +@Data +@NoArgsConstructor public class R implements Serializable { + private static final long serialVersionUID = 1L; + /** * 成功 */ - public static final int SUCCESS = HttpStatus.SUCCESS; + public static final int SUCCESS = 200; + /** * 失败 */ - public static final int FAIL = HttpStatus.ERROR; - private static final long serialVersionUID = 1L; + public static final int FAIL = 500; + private int code; private String msg; @@ -37,7 +44,7 @@ public class R implements Serializable { return restResult(null, SUCCESS, msg); } - public static R ok(T data, String msg) { + public static R ok(String msg, T data) { return restResult(data, SUCCESS, msg); } @@ -53,7 +60,7 @@ public class R implements Serializable { return restResult(data, FAIL, "操作失败"); } - public static R fail(T data, String msg) { + public static R fail(String msg, T data) { return restResult(data, FAIL, msg); } @@ -61,12 +68,33 @@ public class R implements Serializable { return restResult(null, code, msg); } + /** + * 返回警告消息 + * + * @param msg 返回内容 + * @return 警告消息 + */ + public static R warn(String msg) { + return restResult(null, HttpStatus.WARN, msg); + } + + /** + * 返回警告消息 + * + * @param msg 返回内容 + * @param data 数据对象 + * @return 警告消息 + */ + public static R warn(String msg, T data) { + return restResult(data, HttpStatus.WARN, msg); + } + private static R restResult(T data, int code, String msg) { - R apiResult = new R<>(); - apiResult.setCode(code); - apiResult.setData(data); - apiResult.setMsg(msg); - return apiResult; + R r = new R<>(); + r.setCode(code); + r.setData(data); + r.setMsg(msg); + return r; } public static Boolean isError(R ret) { @@ -76,28 +104,4 @@ public class R implements Serializable { public static Boolean isSuccess(R ret) { return R.SUCCESS == ret.getCode(); } - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public String getMsg() { - return msg; - } - - public void setMsg(String msg) { - this.msg = msg; - } - - public T getData() { - return data; - } - - public void setData(T data) { - this.data = data; - } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/workflow/service/impl/WfModelServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/workflow/service/impl/WfModelServiceImpl.java index 7688614..998af4c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/workflow/service/impl/WfModelServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/workflow/service/impl/WfModelServiceImpl.java @@ -244,10 +244,10 @@ public class WfModelServiceImpl extends FlowServiceFactory implements IWfModelSe if (ObjectUtil.isNull(startEvent)) { throw new RuntimeException("开始节点不存在,请检查流程设计是否有误!"); } - // 获取开始节点配置的表单Key - if (StrUtil.isBlank(startEvent.getFormKey())) { - throw new RuntimeException("请配置流程表单"); - } +// // 获取开始节点配置的表单Key todo +// if (StrUtil.isBlank(startEvent.getFormKey())) { +// throw new RuntimeException("请配置流程表单"); +// } Model newModel; if (Boolean.TRUE.equals(modelBo.getNewVersion())) { newModel = repositoryService.newModel();