From 239927b057f65a040594f7a4cb08c8881b303797 Mon Sep 17 00:00:00 2001
From: cjl <276999030@qq.com>
Date: Fri, 18 Aug 2023 14:52:16 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/cjl-230812' into cjl-230812
---
screen-api/src/main/java/com/moral/api/controller/SupervisionController.java | 27 ++++++++++++++++++++++++---
1 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/screen-api/src/main/java/com/moral/api/controller/SupervisionController.java b/screen-api/src/main/java/com/moral/api/controller/SupervisionController.java
index 5f07951..b266fa9 100644
--- a/screen-api/src/main/java/com/moral/api/controller/SupervisionController.java
+++ b/screen-api/src/main/java/com/moral/api/controller/SupervisionController.java
@@ -5,17 +5,21 @@
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.CrossOrigin;
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.RestController;
import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
+import com.alibaba.fastjson.JSONObject;
import com.moral.api.entity.Supervision;
import com.moral.api.service.SupervisionService;
import com.moral.constant.ResponseCodeEnum;
@@ -32,7 +36,10 @@
private SupervisionService supervisionService;
@PostMapping("add")
- public ResultMessage add(MultipartFile[] files, Supervision supervision) {
+ public ResultMessage add(HttpServletRequest request) {
+ Map<String, Object> params = WebUtils.getParametersStartingWith(request, null);
+ List<MultipartFile> files = ((MultipartHttpServletRequest) request).getFiles("files");
+ Supervision supervision = JSONObject.parseObject(JSONObject.toJSONString(params), Supervision.class);
Map<String, Object> response = supervisionService.add(files, supervision);
if (!response.isEmpty()) {
return ResultMessage.fail(Integer.parseInt(response.get("code").toString()), response.get("msg").toString());
@@ -42,6 +49,7 @@
@ApiOperation(value = "���������������������", notes = "���������������������")
@ApiImplicitParams({
+ @ApiImplicitParam(name = "organizationId", value = "������id", required = false, paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "cityCode", value = "���������", required = false, paramType = "query", dataType = "int"),
@ApiImplicitParam(name = "start", value = "������������", required = false, paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "end", value = "������������", required = false, paramType = "query", dataType = "String"),
@@ -51,7 +59,7 @@
@GetMapping("select")
public ResultMessage select(HttpServletRequest request) {
Map<String, Object> params = WebUtils.getParametersStartingWith(request, null);
- if (!params.containsKey("cityCode")) {
+ if (!params.containsKey("cityCode") && !params.containsKey("organizationId")) {
return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
}
@@ -61,7 +69,10 @@
@ApiOperation(value = "���������������", notes = "���������������")
@PostMapping("update")
- public ResultMessage update(MultipartFile[] files, Supervision supervision) {
+ public ResultMessage update(HttpServletRequest request) {
+ Map<String, Object> params = WebUtils.getParametersStartingWith(request, null);
+ List<MultipartFile> files = ((MultipartHttpServletRequest) request).getFiles("files");
+ Supervision supervision = JSONObject.parseObject(JSONObject.toJSONString(params), Supervision.class);
Map<String, Object> response = supervisionService.updateSupervision(files, supervision);
if (!response.isEmpty()) {
return ResultMessage.fail(Integer.parseInt(response.get("code").toString()), response.get("msg").toString());
@@ -69,4 +80,14 @@
return ResultMessage.ok();
}
+ @ApiOperation(value = "���������������", notes = "���������������")
+ @GetMapping("delete")
+ public ResultMessage delete(Integer supervisionId) {
+ if (ObjectUtils.isEmpty(supervisionId)) {
+ return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
+ }
+ supervisionService.deleteSupervision(supervisionId);
+ return ResultMessage.ok();
+ }
+
}
--
Gitblit v1.8.0