From 112a87d32e19b47b9c92534900d9cdd02846bdb3 Mon Sep 17 00:00:00 2001 From: value <z1292839451@163.com> Date: 星期三, 24 四月 2024 18:17:25 +0800 Subject: [PATCH] 完善检验流程 --- cnas-server/src/main/java/com/yuanchu/mom/controller/DeviceController.java | 35 ++++++++++++++++++++++++++--------- 1 files changed, 26 insertions(+), 9 deletions(-) diff --git a/cnas-server/src/main/java/com/yuanchu/mom/controller/DeviceController.java b/cnas-server/src/main/java/com/yuanchu/mom/controller/DeviceController.java index 4536e8b..4110274 100644 --- a/cnas-server/src/main/java/com/yuanchu/mom/controller/DeviceController.java +++ b/cnas-server/src/main/java/com/yuanchu/mom/controller/DeviceController.java @@ -9,11 +9,14 @@ import com.yuanchu.mom.utils.JackSonUtil; import com.yuanchu.mom.vo.Result; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import javax.annotation.Resource; import java.io.File; import java.util.HashMap; import java.util.Map; @@ -22,13 +25,16 @@ * 璁惧(DeviceController)琛ㄦ帶鍒跺眰 */ @Api(tags = "璁惧") -@AllArgsConstructor @RestController @RequestMapping("/deviceScope") public class DeviceController { + @Resource private DeviceService deviceService; + + @Value("${file.path}") + private String filePath; @ApiOperation(value = "鏌ヨ璁惧璇︽儏鍒楄〃") @PostMapping("/selectDeviceParameter") @@ -78,16 +84,14 @@ } //鍥剧墖涓婁紶 - @ApiOperation(value = "鍥剧墖涓婁紶") + @ApiOperation(value = "璁惧鍥剧墖涓婁紶") @PostMapping("/uploadFile") public Result uploadFile(MultipartFile file) { - - System.out.println(file.getOriginalFilename()); - String urlString = null; - String pathName = null; + String urlString; + String pathName; String filename = file.getOriginalFilename(); try { - String path = "/Users/gaoaoy/webapp/images"; + String path = filePath; File realpath = new File(path); if (!realpath.exists()) { realpath.mkdirs(); @@ -95,7 +99,6 @@ pathName = UUID.randomUUID() + "_" + file.getOriginalFilename(); urlString = realpath + "/" + pathName; file.transferTo(new File(urlString)); - System.out.println(pathName); HashMap<String, String> map = new HashMap<>(); map.put("name", filename); map.put("url", pathName); @@ -113,5 +116,19 @@ public Result selectDevicePrincipal() { return Result.success(deviceService.selectDevicePrincipal()); } + + @ApiOperation(value = "閫氳繃椤圭洰鑾峰彇璁惧鍒楄〃") + @PostMapping("/selectDeviceByCategory") + @ValueAuth + public Result selectDeviceByCategory(String inspectionItem, String inspectionItemSubclass) { + return Result.success(deviceService.selectDeviceByCategory(inspectionItem, inspectionItemSubclass)); + } + + @ApiOperation(value = "閫氳繃璁惧缂栧彿鑾峰彇璁惧鍒楄〃") + @PostMapping("/selectDeviceByCode") + @ValueAuth + public Result selectDeviceByCode(String code) { + return Result.success(deviceService.selectDeviceByCode(code)); + } } -- Gitblit v1.9.3