gaodandan %!s(int64=5) %!d(string=hai) anos
pai
achega
7c78d24cbd

+ 107 - 0
src/main/java/com/chinaitop/depot/storage/controller/VentilationOperationController.java

@@ -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
+}

+ 97 - 0
src/main/java/com/chinaitop/depot/storage/mapper/TVentilationOperationMapper.java

@@ -0,0 +1,97 @@
1
+package com.chinaitop.depot.storage.mapper;
2
+
3
+import java.util.List;
4
+import org.apache.ibatis.annotations.Param;
5
+
6
+import com.chinaitop.depot.storage.model.TVentilationOperation;
7
+import com.chinaitop.depot.storage.model.TVentilationOperationExample;
8
+
9
+public interface TVentilationOperationMapper {
10
+    /**
11
+     * This method was generated by MyBatis Generator.
12
+     * This method corresponds to the database table t_ventilation_operation
13
+     *
14
+     * @mbggenerated Sun Jun 28 17:44:27 CST 2020
15
+     */
16
+    int countByExample(TVentilationOperationExample example);
17
+
18
+    /**
19
+     * This method was generated by MyBatis Generator.
20
+     * This method corresponds to the database table t_ventilation_operation
21
+     *
22
+     * @mbggenerated Sun Jun 28 17:44:27 CST 2020
23
+     */
24
+    int deleteByExample(TVentilationOperationExample example);
25
+
26
+    /**
27
+     * This method was generated by MyBatis Generator.
28
+     * This method corresponds to the database table t_ventilation_operation
29
+     *
30
+     * @mbggenerated Sun Jun 28 17:44:27 CST 2020
31
+     */
32
+    int deleteByPrimaryKey(String id);
33
+
34
+    /**
35
+     * This method was generated by MyBatis Generator.
36
+     * This method corresponds to the database table t_ventilation_operation
37
+     *
38
+     * @mbggenerated Sun Jun 28 17:44:27 CST 2020
39
+     */
40
+    int insert(TVentilationOperation record);
41
+
42
+    /**
43
+     * This method was generated by MyBatis Generator.
44
+     * This method corresponds to the database table t_ventilation_operation
45
+     *
46
+     * @mbggenerated Sun Jun 28 17:44:27 CST 2020
47
+     */
48
+    int insertSelective(TVentilationOperation record);
49
+
50
+    /**
51
+     * This method was generated by MyBatis Generator.
52
+     * This method corresponds to the database table t_ventilation_operation
53
+     *
54
+     * @mbggenerated Sun Jun 28 17:44:27 CST 2020
55
+     */
56
+    List<TVentilationOperation> selectByExample(TVentilationOperationExample example);
57
+
58
+    /**
59
+     * This method was generated by MyBatis Generator.
60
+     * This method corresponds to the database table t_ventilation_operation
61
+     *
62
+     * @mbggenerated Sun Jun 28 17:44:27 CST 2020
63
+     */
64
+    TVentilationOperation selectByPrimaryKey(String id);
65
+
66
+    /**
67
+     * This method was generated by MyBatis Generator.
68
+     * This method corresponds to the database table t_ventilation_operation
69
+     *
70
+     * @mbggenerated Sun Jun 28 17:44:27 CST 2020
71
+     */
72
+    int updateByExampleSelective(@Param("record") TVentilationOperation record, @Param("example") TVentilationOperationExample example);
73
+
74
+    /**
75
+     * This method was generated by MyBatis Generator.
76
+     * This method corresponds to the database table t_ventilation_operation
77
+     *
78
+     * @mbggenerated Sun Jun 28 17:44:27 CST 2020
79
+     */
80
+    int updateByExample(@Param("record") TVentilationOperation record, @Param("example") TVentilationOperationExample example);
81
+
82
+    /**
83
+     * This method was generated by MyBatis Generator.
84
+     * This method corresponds to the database table t_ventilation_operation
85
+     *
86
+     * @mbggenerated Sun Jun 28 17:44:27 CST 2020
87
+     */
88
+    int updateByPrimaryKeySelective(TVentilationOperation record);
89
+
90
+    /**
91
+     * This method was generated by MyBatis Generator.
92
+     * This method corresponds to the database table t_ventilation_operation
93
+     *
94
+     * @mbggenerated Sun Jun 28 17:44:27 CST 2020
95
+     */
96
+    int updateByPrimaryKey(TVentilationOperation record);
97
+}

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1623 - 0
src/main/java/com/chinaitop/depot/storage/mapper/TVentilationOperationMapper.xml


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 2902 - 0
src/main/java/com/chinaitop/depot/storage/model/TVentilationOperation.java


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 6580 - 0
src/main/java/com/chinaitop/depot/storage/model/TVentilationOperationExample.java


+ 19 - 0
src/main/java/com/chinaitop/depot/storage/service/VentilationOperationService.java

@@ -0,0 +1,19 @@
1
+package com.chinaitop.depot.storage.service;
2
+
3
+import java.util.List;
4
+
5
+import com.chinaitop.depot.storage.model.TVentilationOperation;
6
+
7
+public interface VentilationOperationService {
8
+
9
+	List<TVentilationOperation> getList(Integer pageNum, Integer pageSize,String orgId, String cfbh,String cfmc);
10
+
11
+	TVentilationOperation getById(String id);
12
+
13
+	void save(String ventilationOperationJson);
14
+
15
+	int deleteById(String id);
16
+
17
+    
18
+
19
+}

+ 83 - 0
src/main/java/com/chinaitop/depot/storage/service/impl/VentilationOperationServiceImpl.java

@@ -0,0 +1,83 @@
1
+package com.chinaitop.depot.storage.service.impl;
2
+
3
+import java.util.List;
4
+
5
+import org.apache.commons.lang.StringUtils;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.stereotype.Service;
8
+
9
+import com.alibaba.fastjson.JSON;
10
+import com.alibaba.fastjson.JSONObject;
11
+import com.chinaitop.depot.storage.mapper.TVentilationOperationMapper;
12
+import com.chinaitop.depot.storage.model.TVentilationOperation;
13
+import com.chinaitop.depot.storage.model.TVentilationOperationExample;
14
+import com.chinaitop.depot.storage.service.VentilationOperationService;
15
+import com.chinaitop.depot.unissoft.model.UuidUtils;
16
+import com.github.pagehelper.PageHelper;
17
+
18
+@Service
19
+public class VentilationOperationServiceImpl implements VentilationOperationService {
20
+    @Autowired
21
+    private TVentilationOperationMapper tVentilationOperationMapper;
22
+
23
+	@Override
24
+	public List<TVentilationOperation> getList(Integer pageNum, Integer pageSize,String orgId, String cfbh,String cfmc) {
25
+		TVentilationOperationExample tVentilationOperationExample = new TVentilationOperationExample();
26
+		tVentilationOperationExample.setDistinct(true);
27
+		TVentilationOperationExample.Criteria criteria = tVentilationOperationExample.createCriteria();
28
+        if (StringUtils.isNotEmpty(cfbh)) {
29
+            criteria.andCfbhEqualTo(cfbh);
30
+        }
31
+        if (StringUtils.isNotEmpty(cfmc)) {
32
+        	criteria.andCfmcEqualTo(cfmc);
33
+        }
34
+        if (StringUtils.isNotEmpty(orgId)) {
35
+        	criteria.andOrgIdEqualTo(Integer.parseInt(orgId));
36
+        }
37
+        tVentilationOperationExample.setOrderByClause("djrq desc");
38
+        if (null != pageNum && null != pageSize) {
39
+            PageHelper.startPage(pageNum, pageSize);
40
+        }
41
+        return tVentilationOperationMapper.selectByExample(tVentilationOperationExample);
42
+	}
43
+
44
+	@Override
45
+	public TVentilationOperation getById(String id) {
46
+		// TODO Auto-generated method stub
47
+		return tVentilationOperationMapper.selectByPrimaryKey(id);
48
+	}
49
+
50
+	@Override
51
+	public void save(String ventilationOperationJson) {
52
+		// TODO Auto-generated method stub
53
+		if (StringUtils.isNotBlank(ventilationOperationJson)) {
54
+			
55
+			TVentilationOperation tVentilationOperation;
56
+			
57
+			try {
58
+				JSONObject jsonObject = JSON.parseObject(ventilationOperationJson);
59
+				 tVentilationOperation = JSONObject.toJavaObject(jsonObject , TVentilationOperation.class);
60
+				if (StringUtils.isNotBlank(tVentilationOperation.getId())) {
61
+					tVentilationOperationMapper.updateByPrimaryKeySelective(tVentilationOperation);
62
+	            } else {
63
+	            	tVentilationOperation.setId(UuidUtils.getCode());
64
+	            	tVentilationOperationMapper.insert(tVentilationOperation);
65
+	            }
66
+			
67
+			} catch (Exception e) {
68
+				// TODO Auto-generated catch block
69
+				e.printStackTrace();
70
+			}
71
+			
72
+        }
73
+	}
74
+
75
+	@Override
76
+	public int deleteById(String id) {
77
+		// TODO Auto-generated method stub
78
+		return tVentilationOperationMapper.deleteByPrimaryKey(id);
79
+	}
80
+
81
+	
82
+
83
+}

+ 21 - 0
src/main/java/com/chinaitop/depot/unissoft/model/UuidUtils.java

@@ -0,0 +1,21 @@
1
+package com.chinaitop.depot.unissoft.model;
2
+
3
+import java.util.UUID;
4
+
5
+/**
6
+ * @author qingsong.han
7
+ * @description:
8
+ * @create 2020-07-02 17:37
9
+ */
10
+public class UuidUtils {
11
+
12
+    /**
13
+     * 生成32位随机数
14
+     *
15
+     * @return 返回32位随机数
16
+     */
17
+    public static String getCode() {
18
+        UUID uuid = UUID.randomUUID();
19
+        return uuid.toString().replace("-", "");
20
+    }
21
+}