Commit 43793954 by “zcwang”

init: 工单变更接口

parent 5ac447b9
package com.netease.mail.yanxuan.change.biz.meta; package com.netease.mail.yanxuan.change.biz.meta;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/** /**
* @author lwtang * @author lwtang
*/ */
@EqualsAndHashCode()
@Data
@Accessors(chain = true)
public class AjaxResult<T> { public class AjaxResult<T> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Integer code; private Integer code;
private String msg; private String msg;
private T data; private T data;
private Exception e; private Exception e;
public Boolean isSuccess() { public Boolean isSuccess() {
...@@ -18,180 +28,53 @@ public class AjaxResult<T> { ...@@ -18,180 +28,53 @@ public class AjaxResult<T> {
} }
public Boolean isFail() { public Boolean isFail() {
return !this.isSuccess(); return !isSuccess();
} }
public static <R> AjaxResult<R> success() { public static <R> AjaxResult<R> success() {
return of(ResponseCodeEnum.SUCCESS); return AjaxResult.of(ResponseCodeEnum.SUCCESS);
} }
public static <R> AjaxResult<R> success(R data) { public static <R> AjaxResult<R> success(R data) {
return of(ResponseCodeEnum.SUCCESS).setData(data); return AjaxResult.<R>of(ResponseCodeEnum.SUCCESS).setData(data);
} }
public static <R> AjaxResult<R> error() { public static <R> AjaxResult<R> error() {
return of(ResponseCodeEnum.INTERNAL_ERROR); return AjaxResult.of(ResponseCodeEnum.INTERNAL_ERROR);
} }
public static <R> AjaxResult<R> error(Exception e) { public static <R> AjaxResult<R> error(Exception e) {
return of(ResponseCodeEnum.INTERNAL_ERROR).setE(e); return AjaxResult.<R>of(ResponseCodeEnum.INTERNAL_ERROR).setE(e);
} }
public static <R> AjaxResult<R> badRequest() { public static <R> AjaxResult<R> badRequest() {
return of(ResponseCodeEnum.BAD_REQUEST); return AjaxResult.of(ResponseCodeEnum.BAD_REQUEST);
} }
public static <R> AjaxResult<R> badRequest(String msg) { public static <R> AjaxResult<R> badRequest(String msg) {
return of(ResponseCodeEnum.BAD_REQUEST).setMsg(msg); return AjaxResult.<R>of(ResponseCodeEnum.BAD_REQUEST).setMsg(msg);
} }
public static <R> AjaxResult<R> badRequest(Exception e) { public static <R> AjaxResult<R> badRequest(Exception e) {
return of(ResponseCodeEnum.BAD_REQUEST).setE(e); return AjaxResult.<R>of(ResponseCodeEnum.BAD_REQUEST).setE(e);
} }
public static <R> AjaxResult<R> badRequest(String msg, Exception e) { public static <R> AjaxResult<R> badRequest(String msg, Exception e) {
return of(ResponseCodeEnum.BAD_REQUEST).setMsg(msg).setE(e); return AjaxResult.<R>of(ResponseCodeEnum.BAD_REQUEST).setMsg(msg).setE(e);
} }
public static <R> AjaxResult<R> of(ResponseCodeEnum code) { public static <R> AjaxResult<R> of(ResponseCodeEnum code) {
return (new AjaxResult()).setCode(code.getCode()).setMsg(code.getMsg()); return new AjaxResult<R>().setCode(code.getCode()).setMsg(code.getMsg());
} }
public static <R> AjaxResult<R> of(Integer code, String msg) { public static <R> AjaxResult<R> of(Integer code, String msg) {
return (new AjaxResult()).setCode(code).setMsg(msg); return new AjaxResult<R>().setCode(code).setMsg(msg);
} }
public static <R> AjaxResult<R> of(Integer code, String msg, R data) { public static <R> AjaxResult<R> of(Integer code, String msg, R data) {
return of(code, msg).setData(data); return AjaxResult.<R>of(code, msg).setData(data);
} }
public static <R> AjaxResult<R> of(Integer code, String msg, R data, Exception e) { public static <R> AjaxResult<R> of(Integer code, String msg, R data, Exception e) {
return of(code, msg, data).setE(e); return AjaxResult.of(code, msg, data).setE(e);
}
public boolean equals(Object o) {
if (o == this) {
return true;
} else if (!(o instanceof AjaxResult)) {
return false;
} else {
AjaxResult<?> other = (AjaxResult)o;
if (!other.canEqual(this)) {
return false;
} else if (!super.equals(o)) {
return false;
} else {
label61: {
Object this$code = this.getCode();
Object other$code = other.getCode();
if (this$code == null) {
if (other$code == null) {
break label61;
}
} else if (this$code.equals(other$code)) {
break label61;
}
return false;
}
label54: {
Object this$msg = this.getMsg();
Object other$msg = other.getMsg();
if (this$msg == null) {
if (other$msg == null) {
break label54;
}
} else if (this$msg.equals(other$msg)) {
break label54;
}
return false;
}
Object this$data = this.getData();
Object other$data = other.getData();
if (this$data == null) {
if (other$data != null) {
return false;
}
} else if (!this$data.equals(other$data)) {
return false;
}
Object this$e = this.getE();
Object other$e = other.getE();
if (this$e == null) {
if (other$e != null) {
return false;
}
} else if (!this$e.equals(other$e)) {
return false;
}
return true;
}
}
}
protected boolean canEqual(Object other) {
return other instanceof AjaxResult;
}
public int hashCode() {
int PRIME = true;
int result = super.hashCode();
Object $code = this.getCode();
result = result * 59 + ($code == null ? 43 : $code.hashCode());
Object $msg = this.getMsg();
result = result * 59 + ($msg == null ? 43 : $msg.hashCode());
Object $data = this.getData();
result = result * 59 + ($data == null ? 43 : $data.hashCode());
Object $e = this.getE();
result = result * 59 + ($e == null ? 43 : $e.hashCode());
return result;
}
public AjaxResult() {
}
public Integer getCode() {
return this.code;
}
public String getMsg() {
return this.msg;
}
public T getData() {
return this.data;
}
public Exception getE() {
return this.e;
}
public AjaxResult<T> setCode(Integer code) {
this.code = code;
return this;
}
public AjaxResult<T> setMsg(String msg) {
this.msg = msg;
return this;
}
public AjaxResult<T> setData(T data) {
this.data = data;
return this;
}
public AjaxResult<T> setE(Exception e) {
this.e = e;
return this;
}
public String toString() {
return "AjaxResult(code=" + this.getCode() + ", msg=" + this.getMsg() + ", data=" + this.getData() + ", e=" + this.getE() + ")";
} }
} }
/**
* @(#)ResponseCodeEnum.java, 2022/11/14.
* <p/>
* Copyright 2022 Netease, Inc. All rights reserved.
* NETEASE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package com.netease.mail.yanxuan.change.biz.meta;
import java.util.HashMap;
import java.util.Map;
/**
* @Author zcwang
* @Date 2022/11/14
*/
public enum ResponseCodeEnum {
ZERO_CODE_SUCCESS(0, "成功"),
SUCCESS(200, "成功"),
BAD_REQUEST(400, "错误请求"),
SC_UNAUTHORIZED(401, "用户未登录"),
FORBIDDEN(403, "操作无权限"),
NO_FOUND(404, "服务器上没有请求的资源"),
TOO_MANY_REQUESTS(429, "服务请求达到上限(限流)"),
INTERNAL_ERROR(500, "系统内部错误"),
SERVICE_DEGRADATION(50010, "服务已降级"),
PARAM_ERROR(51000, "参数错误"),
NO_ROLE_AUTH(51006, "用户无角色权限"),
UNAUTHORIZED(51007, "用户未登录"),
RISK_CONTROL_USERS(51010, "风控用户"),
NO_CROWD_AUTH(51011, "用户人群不满足"),
ACT_DISSATISFIED(52000, "活动不满足条件"),
BIZ_EXCEPTION(52001, "业务异常"),
SYSTEM_EXCEPTION(52002, "系统异常"),
UNKNOWN_ERROR(52003, "未知错误"),
RPC_ERROR(52004, "rpc错误"),
RPC_RESULT_ERROR(52003, "rpc结果错误"),
FRAMEWORK_EXCEPTION(55000, "martech-act-framework异常");
private final Integer code;
private final String msg;
static Map<Integer, ResponseCodeEnum> map = new HashMap();
private ResponseCodeEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public static ResponseCodeEnum valueOf(Integer value) {
return (ResponseCodeEnum)map.get(value);
}
public int getCode() {
return this.code;
}
public String getMsg() {
return this.msg;
}
static {
ResponseCodeEnum[] var0 = values();
int var1 = var0.length;
for(int var2 = 0; var2 < var1; ++var2) {
ResponseCodeEnum codeEnum = var0[var2];
map.put(codeEnum.getCode(), codeEnum);
}
}
}
\ No newline at end of file
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
package com.netease.mail.yanxuan.change.web.controller; package com.netease.mail.yanxuan.change.web.controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
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;
...@@ -20,11 +21,91 @@ import com.netease.mail.yanxuan.change.biz.meta.AjaxResult; ...@@ -20,11 +21,91 @@ import com.netease.mail.yanxuan.change.biz.meta.AjaxResult;
@RequestMapping("/change/flow") @RequestMapping("/change/flow")
public class ChangeFlowController { public class ChangeFlowController {
/**
* 变更工单详情查询
* @return
*/
@GetMapping("/detail") @GetMapping("/detail")
public AjaxResult<String> detail() { public AjaxResult<Void> detail() {
return AjaxResult.success();
}
/**
* 变更工单列表查询
* @return
*/
@GetMapping("/query")
public AjaxResult<Void> query() {
return AjaxResult.success();
}
/**
* 返回提示文案
* @return
*/
@GetMapping("/title")
public AjaxResult<Void> title() {
return AjaxResult.success();
} }
public AjaxResult /**
* 发起变更
* @return
*/
@PostMapping("/create")
public AjaxResult<Boolean> create() {
return AjaxResult.success();
}
/**
* 变更工单提交
* @return
*/
@PostMapping("/submit")
public AjaxResult<Boolean> submit() {
return AjaxResult.success();
}
/**
* 工单转交
* @return
*/
@PostMapping("/deliver")
public AjaxResult<Boolean> deliver() {
return AjaxResult.success();
}
/**
* 工单取消
* @return
*/
@GetMapping("/cancel")
public AjaxResult<Void> cancel() {
return AjaxResult.success();
}
/**
* 引用变更工单
* @return
*/
@GetMapping("/quote")
public AjaxResult<Void> quote() {
return AjaxResult.success();
}
/**
* 导出变更
* @return
*/
@PostMapping("/export")
public AjaxResult<Void> export() {
return AjaxResult.success();
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment