Commit dfc8e881 authored by zhoushiguang's avatar zhoushiguang

研判分析接口设计

parent 39355d0d
...@@ -5,13 +5,13 @@ import com.alibaba.fastjson.JSON; ...@@ -5,13 +5,13 @@ import com.alibaba.fastjson.JSON;
/** /**
* 统一API响应结果封装 * 统一API响应结果封装
*/ */
public class Result { public class ResponseResult {
private int status; private int status;
private String message; private String message;
private Object content; private Object content;
private Integer code; private Integer code;
public Result setCode(ResultCode resultCode) { public ResponseResult setCode(ResultCode resultCode) {
this.status = resultCode.status; this.status = resultCode.status;
return this; return this;
} }
...@@ -22,7 +22,7 @@ public class Result { ...@@ -22,7 +22,7 @@ public class Result {
return content; return content;
} }
public Result setContent(Object data) { public ResponseResult setContent(Object data) {
this.content = data; this.content = data;
return this; return this;
} }
...@@ -38,7 +38,7 @@ public class Result { ...@@ -38,7 +38,7 @@ public class Result {
} }
public Result setStatus(int status) { public ResponseResult setStatus(int status) {
this.status = status; this.status = status;
return this; return this;
} }
...@@ -51,7 +51,7 @@ public class Result { ...@@ -51,7 +51,7 @@ public class Result {
public Result setMessage(String msg) { public ResponseResult setMessage(String msg) {
this.message = msg; this.message = msg;
return this; return this;
} }
......
...@@ -6,21 +6,21 @@ package net.wanji.opt.api; ...@@ -6,21 +6,21 @@ package net.wanji.opt.api;
public class ResultGenerator { public class ResultGenerator {
private static final String DEFAULT_SUCCESS_MESSAGE = "success"; private static final String DEFAULT_SUCCESS_MESSAGE = "success";
public static Result genSuccessResult() { public static ResponseResult genSuccessResult() {
return new Result() return new ResponseResult()
.setCode(ResultCode.SUCCESS) .setCode(ResultCode.SUCCESS)
.setMessage(DEFAULT_SUCCESS_MESSAGE); .setMessage(DEFAULT_SUCCESS_MESSAGE);
} }
public static Result genSuccessResult(Object data) { public static ResponseResult genSuccessResult(Object data) {
return new Result() return new ResponseResult()
.setCode(ResultCode.SUCCESS) .setCode(ResultCode.SUCCESS)
.setMessage(DEFAULT_SUCCESS_MESSAGE) .setMessage(DEFAULT_SUCCESS_MESSAGE)
.setContent(data); .setContent(data);
} }
public static Result genFailResult(String message) { public static ResponseResult genFailResult(String message) {
return new Result() return new ResponseResult()
.setCode(ResultCode.FAIL) .setCode(ResultCode.FAIL)
.setMessage(message); .setMessage(message);
} }
......
package net.wanji.opt.controllerv2.judgeanalysis; package net.wanji.opt.controllerv2.judgeanalysis;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponses;
...@@ -24,8 +25,9 @@ import java.util.List; ...@@ -24,8 +25,9 @@ import java.util.List;
* @author fengyi * @author fengyi
* @since 2025-03-13 * @since 2025-03-13
*/ */
@Api(tags = "区域问题分析")
@RestController @RestController
@RequestMapping("/analysisProblemGreenDay") @RequestMapping("/analysis-area-problem")
public class AnalysisProblemAreaDayController { public class AnalysisProblemAreaDayController {
......
...@@ -25,7 +25,6 @@ import java.util.List; ...@@ -25,7 +25,6 @@ import java.util.List;
* @since 2025-03-13 * @since 2025-03-13
*/ */
@Api(tags = "绿波问题分析") @Api(tags = "绿波问题分析")
@RestController @RestController
@RequestMapping("/analysis-problem-green-day") @RequestMapping("/analysis-problem-green-day")
public class AnalysisProblemGreenDayController { public class AnalysisProblemGreenDayController {
......
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