|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+package com.chinaitop.depot.storage.controller;
|
|
|
2
|
+
|
|
|
3
|
+import com.chinaitop.depot.storage.model.TVentilationOperation;
|
|
|
4
|
+import com.chinaitop.depot.storage.service.VentilationOperationService;
|
|
|
5
|
+import com.chinaitop.depot.unissoft.model.ResponseEntity;
|
|
|
6
|
+import com.github.pagehelper.PageHelper;
|
|
|
7
|
+import com.github.pagehelper.PageInfo;
|
|
|
8
|
+import io.swagger.annotations.Api;
|
|
|
9
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
10
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
11
|
+import io.swagger.annotations.ApiOperation;
|
|
|
12
|
+import org.apache.commons.lang.StringUtils;
|
|
|
13
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
14
|
+import org.springframework.http.MediaType;
|
|
|
15
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
16
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
17
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
18
|
+
|
|
|
19
|
+import java.util.HashMap;
|
|
|
20
|
+import java.util.List;
|
|
|
21
|
+import java.util.Map;
|
|
|
22
|
+
|
|
|
23
|
+@RestController
|
|
|
24
|
+@RequestMapping(value = "/intelligents/VentilationOperationController")
|
|
|
25
|
+@Api(value = "VentilationOperationController", description = "通风作业")
|
|
|
26
|
+public class VentilationOperationController {
|
|
|
27
|
+
|
|
|
28
|
+ @Autowired
|
|
|
29
|
+ private VentilationOperationService ventilationOperationService;
|
|
|
30
|
+
|
|
|
31
|
+
|
|
|
32
|
+ @RequestMapping(value = "/getList", method = RequestMethod.GET)
|
|
|
33
|
+ @ApiOperation(value = "查询 通风作业列表", notes = "查询 通风作业列表,支持分页")
|
|
|
34
|
+ @ApiImplicitParams({
|
|
|
35
|
+ @ApiImplicitParam(name = "pageNum", value = "页码", paramType = "query"),
|
|
|
36
|
+ @ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "query"),
|
|
|
37
|
+ @ApiImplicitParam(name = "orgId", value = "库点编码", paramType = "query"),
|
|
|
38
|
+ @ApiImplicitParam(name = "vcfcode", value = "仓库名称", paramType = "query")
|
|
|
39
|
+ })
|
|
|
40
|
+ public ResponseEntity<PageInfo<TVentilationOperation>> getList(Integer pageNum, Integer pageSize, String orgId, String cfbh,String cfmc) {
|
|
|
41
|
+ List<TVentilationOperation> list = null;
|
|
|
42
|
+ try {
|
|
|
43
|
+ list = ventilationOperationService.getList(pageNum,pageSize,orgId,cfbh,cfmc);
|
|
|
44
|
+ } catch (Exception e) {
|
|
|
45
|
+ e.printStackTrace();
|
|
|
46
|
+ ResponseEntity.failed(e.getMessage());
|
|
|
47
|
+ }
|
|
|
48
|
+ PageInfo<TVentilationOperation> pageInfo = new PageInfo<TVentilationOperation>(list);
|
|
|
49
|
+ /*if(pageInfo.getList()!=null && pageInfo.getList().size()>0){
|
|
|
50
|
+ pageInfo.setStartRow(pageInfo.getStartRow()+1);
|
|
|
51
|
+ pageInfo.setEndRow(pageInfo.getEndRow()+1);
|
|
|
52
|
+ }*/
|
|
|
53
|
+ return ResponseEntity.ok(pageInfo);
|
|
|
54
|
+ }
|
|
|
55
|
+
|
|
|
56
|
+
|
|
|
57
|
+ @RequestMapping(value = "/getById", method = RequestMethod.POST)
|
|
|
58
|
+ @ApiOperation(value = "根据id查询信息", notes = "根据id查询信息")
|
|
|
59
|
+ @ApiImplicitParams({
|
|
|
60
|
+ @ApiImplicitParam(name = "id", value = "id", paramType = "query")
|
|
|
61
|
+ })
|
|
|
62
|
+ public ResponseEntity<TVentilationOperation> getById(String id) {
|
|
|
63
|
+ TVentilationOperation tVentilationOperation = null;
|
|
|
64
|
+ if (StringUtils.isNotBlank(id)) {
|
|
|
65
|
+ tVentilationOperation = ventilationOperationService.getById(id);
|
|
|
66
|
+ } else {
|
|
|
67
|
+ return ResponseEntity.failed("ID数据有误!");
|
|
|
68
|
+ }
|
|
|
69
|
+ return ResponseEntity.ok(tVentilationOperation);
|
|
|
70
|
+ }
|
|
|
71
|
+
|
|
|
72
|
+ @RequestMapping(value = "/save", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
|
|
|
73
|
+ @ApiOperation(value = "数据更新与添加", notes = "数据更新与添加")
|
|
|
74
|
+ @ApiImplicitParams({
|
|
|
75
|
+ @ApiImplicitParam(name = "ventilationOperationJson", value = "表数据json串", paramType = "form")
|
|
|
76
|
+ })
|
|
|
77
|
+ public ResponseEntity save(String ventilationOperationJson) {
|
|
|
78
|
+ try {
|
|
|
79
|
+ ventilationOperationService.save(ventilationOperationJson);
|
|
|
80
|
+ } catch (Exception e) {
|
|
|
81
|
+ e.printStackTrace();
|
|
|
82
|
+ ResponseEntity.failed(e.getMessage());
|
|
|
83
|
+ }
|
|
|
84
|
+ return ResponseEntity.ok();
|
|
|
85
|
+ }
|
|
|
86
|
+
|
|
|
87
|
+ @RequestMapping(value = "/deleteById", method = RequestMethod.POST)
|
|
|
88
|
+ @ApiOperation(value = "根据id删除信息", notes = "根据id删除信息")
|
|
|
89
|
+ @ApiImplicitParams({
|
|
|
90
|
+ @ApiImplicitParam(name = "id", value = "粮情id", paramType = "query"),
|
|
|
91
|
+ @ApiImplicitParam(name = "aerationParamJson", value = "通风参数json字符串", paramType = "query")
|
|
|
92
|
+ })
|
|
|
93
|
+ public ResponseEntity deleteById(String id) {
|
|
|
94
|
+ if (StringUtils.isNotBlank(id)) {
|
|
|
95
|
+ int count = ventilationOperationService.deleteById(id);
|
|
|
96
|
+ if (count > 0) {
|
|
|
97
|
+ return ResponseEntity.ok();
|
|
|
98
|
+ } else {
|
|
|
99
|
+ return ResponseEntity.failed("删除失败!");
|
|
|
100
|
+ }
|
|
|
101
|
+ }
|
|
|
102
|
+ return ResponseEntity.failed("ID数据有误!");
|
|
|
103
|
+ }
|
|
|
104
|
+
|
|
|
105
|
+
|
|
|
106
|
+
|
|
|
107
|
+}
|