Yansen 2 年之前
父節點
當前提交
4ddcf69dc2

+ 4
- 6
src/main/java/com/njyunzhi/nanyang/controller/CommController.java 查看文件

@@ -16,7 +16,7 @@ import java.util.Map;
16 16
 
17 17
 //@Api(tags = "通用")
18 18
 @RestController
19
-@RequestMapping("/{client}")
19
+@RequestMapping("/")
20 20
 public class CommController extends BaseController {
21 21
 
22 22
     @Autowired
@@ -32,8 +32,7 @@ public class CommController extends BaseController {
32 32
      */
33 33
 //    @ApiOperation(value = "图片上传", notes = "图片上传")
34 34
     @PostMapping("/image")
35
-    public ResponseBean uploadImage(@PathVariable String client,
36
-                                    @RequestParam("file") MultipartFile multipartFile) {
35
+    public ResponseBean uploadImage(@RequestParam("file") MultipartFile multipartFile) {
37 36
         try {
38 37
             String img = ossUtils.putObject(multipartFile);
39 38
             return ResponseBean.success(img);
@@ -49,8 +48,7 @@ public class CommController extends BaseController {
49 48
      */
50 49
 //    @ApiOperation(value = "base64 图片上传", notes = "base64 图片上传")
51 50
     @PostMapping("/image/base64")
52
-    public ResponseBean uploadBase64Image(@PathVariable String client,
53
-                                          @RequestBody Map<String, String> data) {
51
+    public ResponseBean uploadBase64Image(@RequestBody Map<String, String> data) {
54 52
         try {
55 53
             String base64Str = data.get("base64");
56 54
             String img = ossUtils.putObject(base64Str);
@@ -66,7 +64,7 @@ public class CommController extends BaseController {
66 64
      */
67 65
 //    @ApiOperation(value = "获取文件上传凭证", notes = "获取文件上传凭证")
68 66
     @GetMapping("/oss-sts")
69
-    public ResponseBean getOSSSTS(@PathVariable String client) {
67
+    public ResponseBean getOSSSTS() {
70 68
         AliyunConfig.Oss oss = aliyunConfig.getOss();
71 69
 
72 70
         try {

+ 17
- 0
src/main/java/com/njyunzhi/nanyang/controller/TcBindController.java 查看文件

@@ -65,6 +65,17 @@ public class TcBindController extends BaseController {
65 65
 //    @ApiOperation("新增数据")
66 66
     @PostMapping("/tcBind")
67 67
     public ResponseBean add(@RequestBody TcBind tcBind) throws Exception {
68
+
69
+        QueryWrapper<TcBind> queryWrapper = new QueryWrapper<>();
70
+        queryWrapper.eq("device_type", tcBind.getDeviceType());
71
+        queryWrapper.eq("device_no", tcBind.getDeviceNo());
72
+        List<TcBind> list = tcBindService.list(queryWrapper);
73
+        if (list != null && list.size() > 0) {
74
+            return ResponseBean.error(String.format("设备 【%s】 已录入", tcBind.getDeviceNo()));
75
+        }
76
+
77
+        tcBind.setSerialNo(null);
78
+        tcBind.setStatus(0);
68 79
         tcBindService.save(tcBind);
69 80
         return ResponseBean.success(tcBind);
70 81
     }
@@ -92,6 +103,12 @@ public class TcBindController extends BaseController {
92 103
 //    @ApiOperation("通过主键删除数据")
93 104
     @DeleteMapping("/tcBind/{id}")
94 105
     public ResponseBean deleteById(@PathVariable Integer id){
106
+
107
+        TcBind origin = tcBindService.getById(id);
108
+        if (origin.getStatus() == 1) {
109
+            return ResponseBean.error("当前设备已入库");
110
+        }
111
+
95 112
         tcBindService.removeLogicById(id);
96 113
         return ResponseBean.success("success");
97 114
     }

+ 2
- 0
src/main/resources/application.yml 查看文件

@@ -1,5 +1,7 @@
1 1
 server:
2 2
   port: 7083
3
+  servlet:
4
+    context-path: /api
3 5
 
4 6
 spring:
5 7
   datasource: