gaodd пре 1 година
родитељ
комит
ab32b10125

+ 5 - 4
src/main/java/com/chinaitop/depot/device/controller/StorageDeviceRepairController.java

@@ -13,6 +13,7 @@ import javax.servlet.http.HttpServletRequest;
13 13
 import com.chinaitop.depot.device.model.*;
14 14
 import com.chinaitop.depot.device.service.DSblxxjyService;
15 15
 import org.springframework.http.MediaType;
16
+import org.springframework.web.bind.annotation.RequestBody;
16 17
 import org.springframework.web.bind.annotation.RequestMapping;
17 18
 import org.springframework.web.bind.annotation.RequestMethod;
18 19
 import org.springframework.web.bind.annotation.RestController;
@@ -86,13 +87,13 @@ public class StorageDeviceRepairController {
86 87
      */
87 88
     @RequestMapping(value = "/save", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
88 89
     @ApiOperation(value = "保存数据", notes = "保存增加或修改的数据")
89
-    public Map<String, Object> save(String deviceRepairJson) {
90
+    public Map<String, Object> save(@RequestBody StorageDevicerepair storageDevicerepair) {
90 91
         Map<String, Object> modelMap = new HashMap<>();
91 92
         // JSON字符串转对象
92 93
         ObjectMapper mapper = new ObjectMapper();
93
-        StorageDevicerepair storageDevicerepair = null;
94
+        //StorageDevicerepair storageDevicerepair = null;
94 95
         try {
95
-            storageDevicerepair = (StorageDevicerepair) mapper.readValue(deviceRepairJson, StorageDevicerepair.class);
96
+            //storageDevicerepair = (StorageDevicerepair) mapper.readValue(deviceRepairJson, StorageDevicerepair.class);
96 97
             storageDevicerepair.setRepairStatus(1);//改变维修表中的状态
97 98
             deviceRepairService.save(storageDevicerepair);
98 99
 
@@ -107,7 +108,7 @@ public class StorageDeviceRepairController {
107 108
             dSbxxsjy.setMqzt("3");
108 109
             sblxxjyService.update(dSbxxsjy);
109 110
             modelMap.put("status", "success");
110
-        } catch (IOException e) {
111
+        } catch (Exception e) {
111 112
             modelMap.put("status", "error");
112 113
             e.printStackTrace();
113 114
         }