소스 검색

Merge branch 'dev' of depot-qinghai/depot-device-qinghai into master

TangSong 1 년 전
부모
커밋
4feccb2022

+ 6 - 5
src/main/java/com/chinaitop/depot/device/controller/BasicEquipmentEquipmentPoolController.java

@@ -10,6 +10,7 @@ import javax.annotation.Resource;
10
 import javax.servlet.http.HttpServletRequest;
10
 import javax.servlet.http.HttpServletRequest;
11
 
11
 
12
 import org.springframework.http.MediaType;
12
 import org.springframework.http.MediaType;
13
+import org.springframework.web.bind.annotation.RequestBody;
13
 import org.springframework.web.bind.annotation.RequestMapping;
14
 import org.springframework.web.bind.annotation.RequestMapping;
14
 import org.springframework.web.bind.annotation.RequestMethod;
15
 import org.springframework.web.bind.annotation.RequestMethod;
15
 import org.springframework.web.bind.annotation.RestController;
16
 import org.springframework.web.bind.annotation.RestController;
@@ -121,14 +122,14 @@ public class BasicEquipmentEquipmentPoolController {
121
 		  @ApiImplicitParam(name = "orgId", value = "当前登录人组织id", paramType = "form"),
122
 		  @ApiImplicitParam(name = "orgId", value = "当前登录人组织id", paramType = "form"),
122
 		  @ApiImplicitParam(name = "poolJson", value = "数据对象", paramType = "form")
123
 		  @ApiImplicitParam(name = "poolJson", value = "数据对象", paramType = "form")
123
 	})
124
 	})
124
-	public Map<String, Object> update(String poolJson ,Integer userId ,Integer orgId) {
125
+	public Map<String, Object> update(@RequestBody BasicEquipmentEquipmentPool pool) {
125
 		Map<String, Object> map = new HashMap<String, Object>();
126
 		Map<String, Object> map = new HashMap<String, Object>();
126
-		ObjectMapper mapper = new ObjectMapper();
127
+		/*ObjectMapper mapper = new ObjectMapper();*/
127
 		try {
128
 		try {
128
-			BasicEquipmentEquipmentPool pool = mapper.readValue(poolJson, BasicEquipmentEquipmentPool.class);
129
+			/*BasicEquipmentEquipmentPool pool = mapper.readValue(poolJson, BasicEquipmentEquipmentPool.class);*/
129
 			if (pool.getId() == null) {
130
 			if (pool.getId() == null) {
130
-				pool.setOrgId(orgId);
131
-				pool.setInputPersonId(userId);
131
+				pool.setOrgId(pool.getOrgId());
132
+				pool.setInputPersonId(pool.getInputPersonId());
132
 				pool.setInputDate(new Date());
133
 				pool.setInputDate(new Date());
133
 				poolServivce.add(pool);
134
 				poolServivce.add(pool);
134
 			} else {
135
 			} else {

+ 0 - 10
src/main/java/com/chinaitop/depot/device/controller/BusinessImPurchaseSaleController.java

@@ -1,26 +1,16 @@
1
 package com.chinaitop.depot.device.controller;
1
 package com.chinaitop.depot.device.controller;
2
 
2
 
3
 
3
 
4
-import com.chinaitop.depot.device.model.BusinessImAsset;
5
 import com.chinaitop.depot.device.model.BusinessImPurchaseSale;
4
 import com.chinaitop.depot.device.model.BusinessImPurchaseSale;
6
-import com.chinaitop.depot.device.model.param.BusinessImPurchaseSaleAddParam;
7
-import com.chinaitop.depot.device.model.param.BusinessImPurchaseSaleEditParam;
8
 import com.chinaitop.depot.device.model.param.BusinessImPurchaseSalePageParam;
5
 import com.chinaitop.depot.device.model.param.BusinessImPurchaseSalePageParam;
9
 import com.chinaitop.depot.device.service.BusinessImPurchaseSaleService;
6
 import com.chinaitop.depot.device.service.BusinessImPurchaseSaleService;
10
-import com.fasterxml.jackson.databind.ObjectMapper;
11
-import com.github.pagehelper.Page;
12
 import com.github.pagehelper.PageInfo;
7
 import com.github.pagehelper.PageInfo;
13
 import io.swagger.annotations.Api;
8
 import io.swagger.annotations.Api;
14
-import io.swagger.annotations.ApiImplicitParam;
15
-import io.swagger.annotations.ApiImplicitParams;
16
 import io.swagger.annotations.ApiOperation;
9
 import io.swagger.annotations.ApiOperation;
17
 import org.springframework.beans.factory.annotation.Autowired;
10
 import org.springframework.beans.factory.annotation.Autowired;
18
-import org.springframework.http.MediaType;
19
 import org.springframework.http.ResponseEntity;
11
 import org.springframework.http.ResponseEntity;
20
-import org.springframework.validation.annotation.Validated;
21
 import org.springframework.web.bind.annotation.*;
12
 import org.springframework.web.bind.annotation.*;
22
 
13
 
23
-import java.io.IOException;
24
 import java.util.HashMap;
14
 import java.util.HashMap;
25
 import java.util.Map;
15
 import java.util.Map;
26
 
16
 

+ 10 - 15
src/main/java/com/chinaitop/depot/device/controller/DFacilitiesController.java

@@ -15,6 +15,7 @@ import org.springframework.http.MediaType;
15
 import org.springframework.web.bind.annotation.RequestBody;
15
 import org.springframework.web.bind.annotation.RequestBody;
16
 import org.springframework.web.bind.annotation.RequestMapping;
16
 import org.springframework.web.bind.annotation.RequestMapping;
17
 import org.springframework.web.bind.annotation.RequestMethod;
17
 import org.springframework.web.bind.annotation.RequestMethod;
18
+import org.springframework.web.bind.annotation.RequestParam;
18
 import org.springframework.web.bind.annotation.RestController;
19
 import org.springframework.web.bind.annotation.RestController;
19
 
20
 
20
 import javax.annotation.Resource;
21
 import javax.annotation.Resource;
@@ -96,14 +97,11 @@ public class DFacilitiesController {
96
 
97
 
97
     @RequestMapping(value = "/basics/remove", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
98
     @RequestMapping(value = "/basics/remove", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
98
     @ApiOperation(value = "根据id删除设施基础信息", notes = "根据id删除设施基础信息")
99
     @ApiOperation(value = "根据id删除设施基础信息", notes = "根据id删除设施基础信息")
99
-    @ApiImplicitParams({
100
-            @ApiImplicitParam(name = "id", value = "主键id", paramType = "query")
101
-    })
102
-    public Map<String, Object> remove(Integer id) {
100
+    public Map<String, Object> remove(@RequestBody DFacilitiesBasics dFacilitiesBasics) {
103
         Map<String, Object> modelMap = new HashMap<>();
101
         Map<String, Object> modelMap = new HashMap<>();
104
         try {
102
         try {
105
-            if (id != null) {
106
-                dFacilitiesBasicsService.remove(id);
103
+            if (dFacilitiesBasics.getId() != null) {
104
+                dFacilitiesBasicsService.remove(dFacilitiesBasics.getId());
107
                 modelMap.put("status", "success");
105
                 modelMap.put("status", "success");
108
             } else {
106
             } else {
109
                 modelMap.put("status", "error");
107
                 modelMap.put("status", "error");
@@ -144,12 +142,12 @@ public class DFacilitiesController {
144
     @ApiImplicitParams({
142
     @ApiImplicitParams({
145
             @ApiImplicitParam(name = "dFacilitiesBasicsJson", value = "设施基础信息数据", paramType = "form")
143
             @ApiImplicitParam(name = "dFacilitiesBasicsJson", value = "设施基础信息数据", paramType = "form")
146
     })
144
     })
147
-    public Map<String, Object> scrap(String dFacilitiesBasicsJson) {
145
+    public Map<String, Object> scrap(@RequestBody DFacilitiesBasics dFacilitiesBasics) {
148
         Map<String, Object> modelMap = new HashMap<>();
146
         Map<String, Object> modelMap = new HashMap<>();
149
         // JSON字符串转对象
147
         // JSON字符串转对象
150
-        ObjectMapper mapper = new ObjectMapper();
148
+        /*ObjectMapper mapper = new ObjectMapper();*/
151
         try {
149
         try {
152
-            DFacilitiesBasics dFacilitiesBasics = mapper.readValue(dFacilitiesBasicsJson, DFacilitiesBasics.class);
150
+            /*DFacilitiesBasics dFacilitiesBasics = mapper.readValue(dFacilitiesBasicsJson, DFacilitiesBasics.class);*/
153
             if (dFacilitiesBasics.getId()!=null) {
151
             if (dFacilitiesBasics.getId()!=null) {
154
                 dFacilitiesBasicsService.scrap(dFacilitiesBasics);
152
                 dFacilitiesBasicsService.scrap(dFacilitiesBasics);
155
             } else {
153
             } else {
@@ -199,16 +197,13 @@ public class DFacilitiesController {
199
 
197
 
200
     @RequestMapping(value = "/maintain/save", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
198
     @RequestMapping(value = "/maintain/save", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
201
     @ApiOperation(value = "保存/编辑设施保养信息", notes = "设施保养信息")
199
     @ApiOperation(value = "保存/编辑设施保养信息", notes = "设施保养信息")
202
-    @ApiImplicitParams({
203
-            @ApiImplicitParam(name = "dFacilitiesMaintainJson", value = "设施保养信息", paramType = "query")
204
-    })
205
-    public Map<String, Object> saveMaintain(String dFacilitiesMaintainJson) {
200
+    public Map<String, Object> saveMaintain(@RequestBody DFacilitiesMaintain dFacilitiesMaintain) {
206
         Map<String, Object> modelMap = new HashMap<>();
201
         Map<String, Object> modelMap = new HashMap<>();
207
         // JSON字符串转对象
202
         // JSON字符串转对象
208
         ObjectMapper mapper = new ObjectMapper();
203
         ObjectMapper mapper = new ObjectMapper();
209
         try {
204
         try {
210
-            DFacilitiesMaintain dFacilitiesMaintain = mapper.readValue(dFacilitiesMaintainJson, DFacilitiesMaintain.class);
211
-            if (dFacilitiesMaintain.getId()==null) {
205
+/*            DFacilitiesMaintain dFacilitiesMaintain = mapper.readValue(dFacilitiesMaintainJson, DFacilitiesMaintain.class);
206
+*/            if (dFacilitiesMaintain.getId()==null) {
212
                 dFacilitiesMaintain.setCreateTime(new Date()); // 创建时间
207
                 dFacilitiesMaintain.setCreateTime(new Date()); // 创建时间
213
                 dFacilitiesMaintainService.save(dFacilitiesMaintain); // 新增
208
                 dFacilitiesMaintainService.save(dFacilitiesMaintain); // 新增
214
             } else {
209
             } else {

+ 18 - 14
src/main/java/com/chinaitop/depot/device/controller/DSblxxjyController.java

@@ -12,9 +12,12 @@ import io.swagger.annotations.ApiImplicitParam;
12
 import io.swagger.annotations.ApiImplicitParams;
12
 import io.swagger.annotations.ApiImplicitParams;
13
 import io.swagger.annotations.ApiOperation;
13
 import io.swagger.annotations.ApiOperation;
14
 import org.apache.commons.lang.StringUtils;
14
 import org.apache.commons.lang.StringUtils;
15
+import org.apache.ibatis.annotations.Param;
15
 import org.springframework.http.MediaType;
16
 import org.springframework.http.MediaType;
17
+import org.springframework.web.bind.annotation.RequestBody;
16
 import org.springframework.web.bind.annotation.RequestMapping;
18
 import org.springframework.web.bind.annotation.RequestMapping;
17
 import org.springframework.web.bind.annotation.RequestMethod;
19
 import org.springframework.web.bind.annotation.RequestMethod;
20
+import org.springframework.web.bind.annotation.RequestParam;
18
 import org.springframework.web.bind.annotation.RestController;
21
 import org.springframework.web.bind.annotation.RestController;
19
 
22
 
20
 import javax.annotation.Resource;
23
 import javax.annotation.Resource;
@@ -89,12 +92,12 @@ public class DSblxxjyController {
89
     @ApiImplicitParams({
92
     @ApiImplicitParams({
90
             @ApiImplicitParam(name = "dSbxxsjyJson", value = "主表数据", paramType = "form")
93
             @ApiImplicitParam(name = "dSbxxsjyJson", value = "主表数据", paramType = "form")
91
     })
94
     })
92
-    public Map<String, Object> save(String dSbxxsjyJson) {
95
+    public Map<String, Object> save(@RequestBody DSbxxsjy dSbxxsjy) {
93
         Map<String, Object> modelMap = new HashMap<>();
96
         Map<String, Object> modelMap = new HashMap<>();
94
         // JSON字符串转对象
97
         // JSON字符串转对象
95
-        ObjectMapper mapper = new ObjectMapper();
96
-        try {
97
-            DSbxxsjy dSbxxsjy = mapper.readValue(dSbxxsjyJson, DSbxxsjy.class);
98
+/*        ObjectMapper mapper = new ObjectMapper();
99
+*/        try {
100
+            /*DSbxxsjy dSbxxsjy = mapper.readValue(dSbxxsjyJson, DSbxxsjy.class);*/
98
             dSbxxsjy.setWhsj(dSbxxsjy.getCreateDate()); // 维护时间
101
             dSbxxsjy.setWhsj(dSbxxsjy.getCreateDate()); // 维护时间
99
             // 生成设备器材编码
102
             // 生成设备器材编码
100
             if (StringUtils.isBlank(dSbxxsjy.getSbbh())) {
103
             if (StringUtils.isBlank(dSbxxsjy.getSbbh())) {
@@ -177,21 +180,22 @@ public class DSblxxjyController {
177
     }
180
     }
178
 
181
 
179
     @RequestMapping(value = "/outUpdate", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
182
     @RequestMapping(value = "/outUpdate", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
180
-    @ApiOperation(value = "保存数据", notes = "保存")
181
-    @ApiImplicitParams({
182
-            @ApiImplicitParam(name = "sbbh", value = "主表数据", paramType = "form")
183
-    })
184
-    public Map<String, Object> outUpdate(String sbbh) {
185
-        Map<String, Object> modelMap = new HashMap<>();
183
+    @ApiOperation(value = "报废", notes = "报废")
184
+    @ApiImplicitParams({ @ApiImplicitParam(name = "sbbh", value = "主表数据", dataType = "String", example = "example value", required = true) })
185
+    public Map<String,Object> outUpdate(@RequestParam String sbbh) {
186
+        Map<String,Object> modelMap = new HashMap<>();
186
         try {
187
         try {
187
             //根据设备编号获取入库表的该设备信息
188
             //根据设备编号获取入库表的该设备信息
188
             DSbxxsjyExample example = new DSbxxsjyExample();
189
             DSbxxsjyExample example = new DSbxxsjyExample();
189
             DSbxxsjyExample.Criteria criteria = example.createCriteria();
190
             DSbxxsjyExample.Criteria criteria = example.createCriteria();
190
             criteria.andSbbhEqualTo(sbbh);
191
             criteria.andSbbhEqualTo(sbbh);
191
-            DSbxxsjy dSbxxsjy = sblxxjyService.getList(example).get(0);
192
-            dSbxxsjy.setStatus("0");
193
-            sblxxjyService.update(dSbxxsjy); // 修改
194
-            modelMap.put("status", "success");
192
+            List<DSbxxsjy> dSbxxsjyList = sblxxjyService.getList(example);
193
+            if(dSbxxsjyList.size()>0){
194
+            	dSbxxsjyList.get(0).setStatus("0");
195
+                sblxxjyService.update(dSbxxsjyList.get(0)); // 修改
196
+                modelMap.put("status", "success");
197
+            }
198
+            
195
         } catch (Exception e) {
199
         } catch (Exception e) {
196
             modelMap.put("status", "error");
200
             modelMap.put("status", "error");
197
             e.printStackTrace();
201
             e.printStackTrace();

+ 4 - 3
src/main/java/com/chinaitop/depot/device/controller/StorageDeviceCheckController.java

@@ -1,6 +1,5 @@
1
 package com.chinaitop.depot.device.controller;
1
 package com.chinaitop.depot.device.controller;
2
 
2
 
3
-import com.chinaitop.depot.device.model.BasicEquipmentEquipmentPool;
4
 import com.chinaitop.depot.device.service.BasicEquipmentEquipmentPoolService;
3
 import com.chinaitop.depot.device.service.BasicEquipmentEquipmentPoolService;
5
 import com.chinaitop.depot.device.model.StorageDevicecheck;
4
 import com.chinaitop.depot.device.model.StorageDevicecheck;
6
 import com.chinaitop.depot.device.model.StorageDevicecheckExample;
5
 import com.chinaitop.depot.device.model.StorageDevicecheckExample;
@@ -17,6 +16,7 @@ import io.swagger.annotations.ApiImplicitParams;
17
 import io.swagger.annotations.ApiOperation;
16
 import io.swagger.annotations.ApiOperation;
18
 
17
 
19
 import org.springframework.http.MediaType;
18
 import org.springframework.http.MediaType;
19
+import org.springframework.web.bind.annotation.RequestBody;
20
 import org.springframework.web.bind.annotation.RequestMapping;
20
 import org.springframework.web.bind.annotation.RequestMapping;
21
 import org.springframework.web.bind.annotation.RequestMethod;
21
 import org.springframework.web.bind.annotation.RequestMethod;
22
 import org.springframework.web.bind.annotation.RestController;
22
 import org.springframework.web.bind.annotation.RestController;
@@ -173,10 +173,11 @@ public class StorageDeviceCheckController {
173
             @ApiImplicitParam(name = "deviceCheckJson", value = "新增数据", paramType = "form"),
173
             @ApiImplicitParam(name = "deviceCheckJson", value = "新增数据", paramType = "form"),
174
             @ApiImplicitParam(name = "type", value = "类型", paramType = "form")
174
             @ApiImplicitParam(name = "type", value = "类型", paramType = "form")
175
     })
175
     })
176
-    public Map<String, Object> add(String deviceCheckJson, String type) {
176
+    public Map<String, Object> add(@RequestBody StorageDevicecheck storageDevicecheck) {
177
         Map<String, Object> modelMap = new HashMap<>();
177
         Map<String, Object> modelMap = new HashMap<>();
178
         try {
178
         try {
179
-            storageDeviceCheckService.add(deviceCheckJson, type);
179
+            //storageDeviceCheckService.add(deviceCheckJson, type);
180
+            storageDeviceCheckService.insert(storageDevicecheck);
180
             modelMap.put("status", "success");
181
             modelMap.put("status", "success");
181
         } catch (Exception e) {
182
         } catch (Exception e) {
182
             e.printStackTrace();
183
             e.printStackTrace();

+ 9 - 8
src/main/java/com/chinaitop/depot/device/controller/StorageDeviceGetController.java

@@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletRequest;
12
 import com.chinaitop.depot.device.model.*;
12
 import com.chinaitop.depot.device.model.*;
13
 import com.chinaitop.depot.device.service.*;
13
 import com.chinaitop.depot.device.service.*;
14
 import org.springframework.http.MediaType;
14
 import org.springframework.http.MediaType;
15
+import org.springframework.web.bind.annotation.RequestBody;
15
 import org.springframework.web.bind.annotation.RequestMapping;
16
 import org.springframework.web.bind.annotation.RequestMapping;
16
 import org.springframework.web.bind.annotation.RequestMethod;
17
 import org.springframework.web.bind.annotation.RequestMethod;
17
 import org.springframework.web.bind.annotation.RestController;
18
 import org.springframework.web.bind.annotation.RestController;
@@ -107,15 +108,15 @@ public class StorageDeviceGetController {
107
     @ApiImplicitParams({
108
     @ApiImplicitParams({
108
             @ApiImplicitParam(name = "deviceGetJson", value = "新增数据", paramType = "form")
109
             @ApiImplicitParam(name = "deviceGetJson", value = "新增数据", paramType = "form")
109
     })
110
     })
110
-    public Map<String, Object> save(String deviceGetJson) {
111
+    public Map<String, Object> save(@RequestBody StorageDeviceget storageDeviceget) {
111
         Map<String, Object> modelMap = new HashMap<>();
112
         Map<String, Object> modelMap = new HashMap<>();
112
         // JSON字符串转对象
113
         // JSON字符串转对象
113
         ObjectMapper mapper = new ObjectMapper();
114
         ObjectMapper mapper = new ObjectMapper();
114
-        StorageDeviceget storageDeviceget = null;
115
+        //StorageDeviceget storageDeviceget = null;
115
         try {
116
         try {
116
             //保存领用数据
117
             //保存领用数据
117
 //        	ContentBean cb=(ContentBean)mapper.readValue(contentBeanJson, ContentBean.class);
118
 //        	ContentBean cb=(ContentBean)mapper.readValue(contentBeanJson, ContentBean.class);
118
-            storageDeviceget = (StorageDeviceget) mapper.readValue(deviceGetJson, StorageDeviceget.class);
119
+            //storageDeviceget = (StorageDeviceget) mapper.readValue(deviceGetJson, StorageDeviceget.class);
119
         	/*storageDeviceget.setDeviceName(cb.getDeviceName());//器材名称
120
         	/*storageDeviceget.setDeviceName(cb.getDeviceName());//器材名称
120
         	storageDeviceget.setDeviceType(cb.getDeviceTypeId());//类型
121
         	storageDeviceget.setDeviceType(cb.getDeviceTypeId());//类型
121
         	storageDeviceget.setModel(cb.getModel());//规格型号
122
         	storageDeviceget.setModel(cb.getModel());//规格型号
@@ -154,7 +155,7 @@ public class StorageDeviceGetController {
154
             	deviceInputService.save(storageDeviceinput);
155
             	deviceInputService.save(storageDeviceinput);
155
             }*/
156
             }*/
156
             modelMap.put("status", "success");
157
             modelMap.put("status", "success");
157
-        } catch (IOException e) {
158
+        } catch (Exception e) {
158
             modelMap.put("status", "error");
159
             modelMap.put("status", "error");
159
             e.printStackTrace();
160
             e.printStackTrace();
160
         }
161
         }
@@ -350,17 +351,17 @@ public class StorageDeviceGetController {
350
     @ApiImplicitParams({
351
     @ApiImplicitParams({
351
             @ApiImplicitParam(name = "deviceBackJson", value = "增加数据", paramType = "query")
352
             @ApiImplicitParam(name = "deviceBackJson", value = "增加数据", paramType = "query")
352
     })
353
     })
353
-    public Map<String, Object> endMore(String deviceBackJson) {
354
+    public Map<String, Object> endMore(@RequestBody StorageDeviceback storageDeviceback) {
354
         Map<String, Object> modelMap = new HashMap<>();
355
         Map<String, Object> modelMap = new HashMap<>();
355
         // JSON字符串转对象
356
         // JSON字符串转对象
356
-        ObjectMapper mapper = new ObjectMapper();
357
+        //ObjectMapper mapper = new ObjectMapper();
357
         StorageDeviceget storageDeviceget = null; //领用
358
         StorageDeviceget storageDeviceget = null; //领用
358
-        StorageDeviceback storageDeviceback = null; //归还
359
+        //StorageDeviceback storageDeviceback = null; //归还
359
 //        StorageDeviceinput storageDeviceinput = null;
360
 //        StorageDeviceinput storageDeviceinput = null;
360
 
361
 
361
         try {
362
         try {
362
             //storageDeviceget = (StorageDeviceget)mapper.readValue(deviceBackJson, StorageDeviceget.class);
363
             //storageDeviceget = (StorageDeviceget)mapper.readValue(deviceBackJson, StorageDeviceget.class);
363
-            storageDeviceback = (StorageDeviceback) mapper.readValue(deviceBackJson, StorageDeviceback.class);
364
+            //storageDeviceback = (StorageDeviceback) mapper.readValue(deviceBackJson, StorageDeviceback.class);
364
             //增加归还信息(归还表)
365
             //增加归还信息(归还表)
365
             storageDeviceback.setGetId(storageDeviceback.getId());
366
             storageDeviceback.setGetId(storageDeviceback.getId());
366
 //           storageDeviceback.setId(0);
367
 //           storageDeviceback.setId(0);

+ 10 - 9
src/main/java/com/chinaitop/depot/device/controller/StorageDeviceKeepController.java

@@ -17,6 +17,7 @@ import com.chinaitop.depot.device.service.DSblxxjyService;
17
 import com.google.common.collect.Maps;
17
 import com.google.common.collect.Maps;
18
 import org.apache.commons.lang.StringUtils;
18
 import org.apache.commons.lang.StringUtils;
19
 import org.springframework.http.MediaType;
19
 import org.springframework.http.MediaType;
20
+import org.springframework.web.bind.annotation.RequestBody;
20
 import org.springframework.web.bind.annotation.RequestMapping;
21
 import org.springframework.web.bind.annotation.RequestMapping;
21
 import org.springframework.web.bind.annotation.RequestMethod;
22
 import org.springframework.web.bind.annotation.RequestMethod;
22
 import org.springframework.web.bind.annotation.RestController;
23
 import org.springframework.web.bind.annotation.RestController;
@@ -108,13 +109,13 @@ public class StorageDeviceKeepController {
108
      */
109
      */
109
     @RequestMapping(value="/end", produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.POST)
110
     @RequestMapping(value="/end", produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.POST)
110
 	@ApiOperation(value="结束保养", notes = "结束保养")
111
 	@ApiOperation(value="结束保养", notes = "结束保养")
111
-    public Map<String, Object> end(String deviceListJson) {
112
+    public Map<String, Object> end(@RequestBody StorageDevicekeep storageDevicekeep) {
112
         Map<String, Object> map = new HashMap<>();
113
         Map<String, Object> map = new HashMap<>();
113
         // JSON字符串转对象
114
         // JSON字符串转对象
114
-        ObjectMapper mapper = new ObjectMapper();
115
-        StorageDevicekeep storageDevicekeep = null;
115
+        //ObjectMapper mapper = new ObjectMapper();
116
+        //StorageDevicekeep storageDevicekeep = null;
116
         try {
117
         try {
117
-        	storageDevicekeep = (StorageDevicekeep)mapper.readValue(deviceListJson, StorageDevicekeep.class);
118
+        	//storageDevicekeep = (StorageDevicekeep)mapper.readValue(deviceListJson, StorageDevicekeep.class);
118
         	storageDevicekeep.setKeepEnd(new Date());
119
         	storageDevicekeep.setKeepEnd(new Date());
119
         	storageDevicekeep.setKeepStatus(0);
120
         	storageDevicekeep.setKeepStatus(0);
120
         	deviceKeepService.updateByPrimaryKeySelective(storageDevicekeep);
121
         	deviceKeepService.updateByPrimaryKeySelective(storageDevicekeep);
@@ -137,7 +138,7 @@ public class StorageDeviceKeepController {
137
         	deviceInputService.updateByPrimaryKeySelective(inputList.get(0));
138
         	deviceInputService.updateByPrimaryKeySelective(inputList.get(0));
138
         	deviceKeepService.updateByPrimaryKeySelective(storageDevicekeep);*/
139
         	deviceKeepService.updateByPrimaryKeySelective(storageDevicekeep);*/
139
             map.put("status", "success");
140
             map.put("status", "success");
140
-        } catch (IOException e) {
141
+        } catch (Exception e) {
141
             map.put("status", "error");
142
             map.put("status", "error");
142
             e.printStackTrace();
143
             e.printStackTrace();
143
         }
144
         }
@@ -181,13 +182,13 @@ public class StorageDeviceKeepController {
181
      */
182
      */
182
     @RequestMapping(value="/save", produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.POST)
183
     @RequestMapping(value="/save", produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.POST)
183
    	@ApiOperation(value="新增保养", notes = "新增保养")
184
    	@ApiOperation(value="新增保养", notes = "新增保养")
184
-    public Map<String, Object> save(String deviceAddJson) {
185
+    public Map<String, Object> save(@RequestBody StorageDevicekeep storageDevicekeep) {
185
         Map<String, Object> modelMap = new HashMap<>();
186
         Map<String, Object> modelMap = new HashMap<>();
186
         // JSON字符串转对象
187
         // JSON字符串转对象
187
         ObjectMapper mapper = new ObjectMapper();
188
         ObjectMapper mapper = new ObjectMapper();
188
-        StorageDevicekeep storageDevicekeep = null;
189
+        /*StorageDevicekeep storageDevicekeep = null;*/
189
         try {
190
         try {
190
-        	storageDevicekeep = (StorageDevicekeep)mapper.readValue(deviceAddJson, StorageDevicekeep.class);
191
+        	/*storageDevicekeep = (StorageDevicekeep)mapper.readValue(deviceAddJson, StorageDevicekeep.class);*/
191
         	storageDevicekeep.setKeepStatus(1);
192
         	storageDevicekeep.setKeepStatus(1);
192
         	deviceKeepService.save(storageDevicekeep);
193
         	deviceKeepService.save(storageDevicekeep);
193
 
194
 
@@ -209,7 +210,7 @@ public class StorageDeviceKeepController {
209
         	inputList.get(0).setUseCount(inputList.get(0).getUseCount()-1);//数量减少
210
         	inputList.get(0).setUseCount(inputList.get(0).getUseCount()-1);//数量减少
210
         	deviceInputService.updateByPrimaryKeySelective(inputList.get(0));*/
211
         	deviceInputService.updateByPrimaryKeySelective(inputList.get(0));*/
211
             modelMap.put("status", "success");
212
             modelMap.put("status", "success");
212
-        } catch (IOException e) {
213
+        } catch (Exception e) {
213
             modelMap.put("status", "error");
214
             modelMap.put("status", "error");
214
             e.printStackTrace();
215
             e.printStackTrace();
215
         }
216
         }

+ 10 - 9
src/main/java/com/chinaitop/depot/device/controller/StorageDeviceRepairController.java

@@ -13,6 +13,7 @@ import javax.servlet.http.HttpServletRequest;
13
 import com.chinaitop.depot.device.model.*;
13
 import com.chinaitop.depot.device.model.*;
14
 import com.chinaitop.depot.device.service.DSblxxjyService;
14
 import com.chinaitop.depot.device.service.DSblxxjyService;
15
 import org.springframework.http.MediaType;
15
 import org.springframework.http.MediaType;
16
+import org.springframework.web.bind.annotation.RequestBody;
16
 import org.springframework.web.bind.annotation.RequestMapping;
17
 import org.springframework.web.bind.annotation.RequestMapping;
17
 import org.springframework.web.bind.annotation.RequestMethod;
18
 import org.springframework.web.bind.annotation.RequestMethod;
18
 import org.springframework.web.bind.annotation.RestController;
19
 import org.springframework.web.bind.annotation.RestController;
@@ -86,13 +87,13 @@ public class StorageDeviceRepairController {
86
      */
87
      */
87
     @RequestMapping(value = "/save", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
88
     @RequestMapping(value = "/save", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
88
     @ApiOperation(value = "保存数据", notes = "保存增加或修改的数据")
89
     @ApiOperation(value = "保存数据", notes = "保存增加或修改的数据")
89
-    public Map<String, Object> save(String deviceRepairJson) {
90
+    public Map<String, Object> save(@RequestBody StorageDevicerepair storageDevicerepair) {
90
         Map<String, Object> modelMap = new HashMap<>();
91
         Map<String, Object> modelMap = new HashMap<>();
91
         // JSON字符串转对象
92
         // JSON字符串转对象
92
         ObjectMapper mapper = new ObjectMapper();
93
         ObjectMapper mapper = new ObjectMapper();
93
-        StorageDevicerepair storageDevicerepair = null;
94
+        //StorageDevicerepair storageDevicerepair = null;
94
         try {
95
         try {
95
-            storageDevicerepair = (StorageDevicerepair) mapper.readValue(deviceRepairJson, StorageDevicerepair.class);
96
+            //storageDevicerepair = (StorageDevicerepair) mapper.readValue(deviceRepairJson, StorageDevicerepair.class);
96
             storageDevicerepair.setRepairStatus(1);//改变维修表中的状态
97
             storageDevicerepair.setRepairStatus(1);//改变维修表中的状态
97
             deviceRepairService.save(storageDevicerepair);
98
             deviceRepairService.save(storageDevicerepair);
98
 
99
 
@@ -107,7 +108,7 @@ public class StorageDeviceRepairController {
107
             dSbxxsjy.setMqzt("3");
108
             dSbxxsjy.setMqzt("3");
108
             sblxxjyService.update(dSbxxsjy);
109
             sblxxjyService.update(dSbxxsjy);
109
             modelMap.put("status", "success");
110
             modelMap.put("status", "success");
110
-        } catch (IOException e) {
111
+        } catch (Exception e) {
111
             modelMap.put("status", "error");
112
             modelMap.put("status", "error");
112
             e.printStackTrace();
113
             e.printStackTrace();
113
         }
114
         }
@@ -193,13 +194,13 @@ public class StorageDeviceRepairController {
193
      */
194
      */
194
     @RequestMapping(value = "/end", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
195
     @RequestMapping(value = "/end", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
195
     @ApiOperation(value = "结束维修", notes = "结束维修")
196
     @ApiOperation(value = "结束维修", notes = "结束维修")
196
-    public Map<String, Object> end(String deviceListJson) {
197
+    public Map<String, Object> end(@RequestBody StorageDevicerepair storageDevicerepair) {
197
         Map<String, Object> modelMap = new HashMap<>();
198
         Map<String, Object> modelMap = new HashMap<>();
198
         // JSON字符串转对象
199
         // JSON字符串转对象
199
         ObjectMapper mapper = new ObjectMapper();
200
         ObjectMapper mapper = new ObjectMapper();
200
-        StorageDevicerepair storageDevicerepair = null;
201
+        //StorageDevicerepair storageDevicerepair = null;
201
         try {
202
         try {
202
-            storageDevicerepair = (StorageDevicerepair) mapper.readValue(deviceListJson, StorageDevicerepair.class);
203
+            //storageDevicerepair = (StorageDevicerepair) mapper.readValue(deviceListJson, StorageDevicerepair.class);
203
             //改变维修表中的信息
204
             //改变维修表中的信息
204
             storageDevicerepair.setRepairEnd(new Date());
205
             storageDevicerepair.setRepairEnd(new Date());
205
             storageDevicerepair.setRepairStatus(0);
206
             storageDevicerepair.setRepairStatus(0);
@@ -217,7 +218,7 @@ public class StorageDeviceRepairController {
217
             dSbxxsjy.setMqzt("1");
218
             dSbxxsjy.setMqzt("1");
218
             sblxxjyService.update(dSbxxsjy);
219
             sblxxjyService.update(dSbxxsjy);
219
             modelMap.put("status", "success");
220
             modelMap.put("status", "success");
220
-        } catch (IOException e) {
221
+        } catch (Exception e) {
221
             modelMap.put("status", "error");
222
             modelMap.put("status", "error");
222
             e.printStackTrace();
223
             e.printStackTrace();
223
         }
224
         }
@@ -232,7 +233,7 @@ public class StorageDeviceRepairController {
232
     public Map<String, Object> endMore(String deviceListJson) {
233
     public Map<String, Object> endMore(String deviceListJson) {
233
         Map<String, Object> modelMap = new HashMap<>();
234
         Map<String, Object> modelMap = new HashMap<>();
234
         // JSON字符串转对象
235
         // JSON字符串转对象
235
-        ObjectMapper mapper = new ObjectMapper();
236
+        //ObjectMapper mapper = new ObjectMapper();
236
         try {
237
         try {
237
             JSONObject jsonObject = JSONObject.parseObject(deviceListJson);
238
             JSONObject jsonObject = JSONObject.parseObject(deviceListJson);
238
             String idStr = jsonObject.getString("id");
239
             String idStr = jsonObject.getString("id");

+ 2 - 0
src/main/java/com/chinaitop/depot/device/service/StorageDeviceCheckService.java

@@ -45,4 +45,6 @@ public interface StorageDeviceCheckService {
45
      * @return
45
      * @return
46
      */
46
      */
47
 	int getCountForDate(Map<String,Object> map);
47
 	int getCountForDate(Map<String,Object> map);
48
+
49
+	void insert(StorageDevicecheck storageDevicecheck);
48
 }
50
 }

+ 1 - 1
src/main/java/com/chinaitop/depot/device/service/impl/DSblxxjyServiceImpl.java

@@ -38,7 +38,7 @@ public class DSblxxjyServiceImpl implements DSblxxjyService {
38
     @Override
38
     @Override
39
     public void save(DSbxxsjy dSbxxsjy) {
39
     public void save(DSbxxsjy dSbxxsjy) {
40
         sbxxsjyMapper.insert(dSbxxsjy);
40
         sbxxsjyMapper.insert(dSbxxsjy);
41
-        this.gjjjk(dSbxxsjy.getSbbh(),dSbxxsjy.getSzdwdm(),"i");
41
+        //this.gjjjk(dSbxxsjy.getSbbh(),dSbxxsjy.getSzdwdm(),"i");
42
         
42
         
43
     }
43
     }
44
 
44
 

+ 10 - 0
src/main/java/com/chinaitop/depot/device/service/impl/StorageDeviceCheckServiceImpl.java

@@ -122,4 +122,14 @@ public class StorageDeviceCheckServiceImpl implements StorageDeviceCheckService
122
         deviceCheck.setCheckDate(new Date());
122
         deviceCheck.setCheckDate(new Date());
123
         storageDevicecheckMapper.insert(deviceCheck);
123
         storageDevicecheckMapper.insert(deviceCheck);
124
     }
124
     }
125
+
126
+
127
+	@Override
128
+	public void insert(StorageDevicecheck storageDevicecheck) {
129
+		// TODO Auto-generated method stub
130
+		remove(storageDevicecheck.getCheckNumber());
131
+		storageDevicecheck.setCheckDate(new Date());
132
+        storageDevicecheckMapper.insert(storageDevicecheck);
133
+		
134
+	}
125
 }
135
 }