Quellcode durchsuchen

温湿度检测列表修改

hanqingsong vor 5 Jahren
Ursprung
Commit
fdd4530eea

+ 98 - 0
src/main/java/com/chinaitop/depot/intelligent/common/ResultEnum.java

@@ -0,0 +1,98 @@
1
+package com.chinaitop.depot.intelligent.common;
2
+
3
+
4
+/**
5
+ * 结果枚举
6
+ */
7
+public enum ResultEnum {
8
+    /**
9
+     * 操作成功!
10
+     */
11
+    CODE_1(200, "操作成功!"),
12
+    /**
13
+     * 操作失败!
14
+     */
15
+    CODE_2(600, "操作失败!"),
16
+    /**
17
+     * 调用xxx服务失败!
18
+     */
19
+    CODE_3(3, "调用xxx服务失败!"),
20
+    /**
21
+     * 验证码错误或已过期!
22
+     */
23
+    CODE_4(4, "验证码错误或已过期!"),
24
+    /**
25
+     * 用户名或者密码错误!
26
+     */
27
+    CODE_5(5, "用户名或者密码错误!"),
28
+    /**
29
+     * 账号已存在!
30
+     */
31
+    CODE_6(6, "账号已存在!"),
32
+    /**
33
+     * 该client_id不存在
34
+     */
35
+    CODE_7(7, "该client_id不存在!"),
36
+    /**
37
+     * 文件格式不正确!
38
+     */
39
+    CODE_10(10, "文件格式不正确!"),
40
+    /**
41
+     * 业务常量2开头 --------------
42
+     */
43
+    /**
44
+     * 测温类型(检测类型0测温,1粮油,2测水分)
45
+     */
46
+    CODE_20(20, "查询类型不能为空数据(包含测温,粮油,水分)等数据!"),
47
+    /**
48
+     * token无效!
49
+     */
50
+    CODE_401(401, "token无效!"),
51
+    /**
52
+     * 抱歉,您没有访问权限!
53
+     */
54
+    CODE_403(403, "抱歉,您没有访问权限!"),
55
+
56
+    CODE_500(500, "服务器出错了,请联系后台开发人员!"),
57
+    /**
58
+     * 请求超时,请稍后再试!
59
+     */
60
+    CODE_504(504, "请求超时,请稍后再试!"),
61
+
62
+    /**
63
+     * 服务器神游中!
64
+     */
65
+    CODE_666(666, "服务器神游中!");
66
+
67
+
68
+    /**
69
+     * 状态码
70
+     */
71
+    private Integer code;
72
+
73
+    /**
74
+     * 消息
75
+     */
76
+    private String msg;
77
+
78
+    ResultEnum(Integer code, String msg) {
79
+        this.code = code;
80
+        this.msg = msg;
81
+    }
82
+
83
+    public Integer getCode() {
84
+        return code;
85
+    }
86
+
87
+    public void setCode(Integer code) {
88
+        this.code = code;
89
+    }
90
+
91
+    public String getMsg() {
92
+        return msg;
93
+    }
94
+
95
+    public void setMsg(String msg) {
96
+        this.msg = msg;
97
+    }
98
+}

+ 10 - 6
src/main/java/com/chinaitop/depot/intelligent/grainsituation/controller/TemperatureRecordController.java

@@ -2,6 +2,7 @@ package com.chinaitop.depot.intelligent.grainsituation.controller;
2 2
 
3 3
 import com.alibaba.fastjson.JSONObject;
4 4
 import com.chinaitop.depot.intelligent.basicdata.service.TUrlConfigService;
5
+import com.chinaitop.depot.intelligent.common.ResultEnum;
5 6
 import com.chinaitop.depot.intelligent.grainsituation.model.TTestdata;
6 7
 import com.chinaitop.depot.intelligent.grainsituation.model.TTestdataLayer;
7 8
 import com.chinaitop.depot.intelligent.grainsituation.model.TempMetadata;
@@ -84,25 +85,27 @@ public class TemperatureRecordController {
84 85
         PageInfo<TTestdata> pageInfo = new PageInfo<TTestdata>(list);
85 86
         return ResponseEntity.ok(pageInfo);
86 87
     }
87
-    // 要求修改为->温湿度检测只显示最新的一次检测数据
88
+
89
+    // 要求修改为->温湿度检测只显示当天数据,按仓房排序
88 90
     @RequestMapping(value = "/getListOfGroup", method = RequestMethod.GET)
89 91
     @ApiOperation(value = "查询 测温 信息列表", notes = "查询 测温 信息列表,支持分页")
90 92
     @ApiImplicitParams({
91 93
             @ApiImplicitParam(name = "pageNum", value = "页码", paramType = "query"),
92 94
             @ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "query"),
93 95
             @ApiImplicitParam(name = "vDatatime", value = "采集时间", paramType = "query"),
94
-            @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query"),
95
-            @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query"),
96 96
             @ApiImplicitParam(name = "vCfCode", value = "仓库名称", paramType = "query"),
97 97
             @ApiImplicitParam(name = "tType", value = "检测类型0测温,1粮油,2测水分", paramType = "query")
98 98
     })
99
-    public ResponseEntity getListOfGroup(Integer pageNum, Integer pageSize, String vCfCode, String vDatatime, String startTime, String endTime, String tType, String orgId) {
99
+    public ResponseEntity getListOfGroup(Integer pageNum, Integer pageSize, String vCfCode, String vDatatime, String tType, String orgId) {
100 100
         List<TTestdata> list = null;
101 101
         try {
102
+            // 查询检测类型不能为空(检测类型0测温,1粮油,2测水分)
103
+            if(StringUtils.isBlank(tType))
104
+                return ResponseEntity.failed(ResultEnum.CODE_20.getMsg());
102 105
             if (null != pageNum && null != pageSize) {
103 106
                 PageHelper.startPage(pageNum, pageSize);
104 107
             }
105
-            list = temperatureRecordService.getListOfGroup(vCfCode, vDatatime, startTime, endTime, tType, orgId);
108
+            list = temperatureRecordService.getListOfGroup(vCfCode, vDatatime, tType, orgId);
106 109
         } catch (Exception e) {
107 110
             e.printStackTrace();
108 111
             return ResponseEntity.failed(e.getMessage());
@@ -110,7 +113,8 @@ public class TemperatureRecordController {
110 113
         PageInfo<TTestdata> pageInfo = new PageInfo<TTestdata>(list);
111 114
         return ResponseEntity.ok(pageInfo);
112 115
     }
113
-    // 要求修改为->分页列表数据(测温记录列表,时间仓房排序)
116
+
117
+    // 要求修改为->分页列表数据(测温历史记录列表)
114 118
     @RequestMapping(value = "/getTemHistoryPageInfoList", method = RequestMethod.GET)
115 119
     @ApiOperation(value = "查询 测温 信息列表", notes = "查询 测温 信息列表,支持分页")
116 120
     @ApiImplicitParams({

+ 1 - 1
src/main/java/com/chinaitop/depot/intelligent/grainsituation/mapper/TTestdataMapper.java

@@ -64,7 +64,7 @@ public interface TTestdataMapper {
64 64
     String findByTempTable(@Param("id") String id);
65 65
 
66 66
     /**
67
-     * 要求修改为->温湿度检测只显示最新的一次检测数据
67
+     * 要求修改为->温湿度检测只显示当天数据,按仓房排序
68 68
      * @param sMap
69 69
      * @return
70 70
      */

+ 2 - 5
src/main/java/com/chinaitop/depot/intelligent/grainsituation/mapper/TTestdataMapper.xml

@@ -471,12 +471,10 @@
471 471
     FROM
472 472
     t_testdata
473 473
     <where>
474
+      iLq_yq = #{tType}
474 475
       <if test="orgId != null">
475 476
         and org_id = #{orgId}
476 477
       </if>
477
-      <if test="tType != null">
478
-        AND iLq_yq = #{tType}
479
-      </if>
480 478
       <if test="vCfCode != null">
481 479
         AND storehouse = #{vCfCode}
482 480
       </if>
@@ -484,8 +482,7 @@
484 482
         AND time BETWEEN #{startTime} AND #{endTime}
485 483
       </if>
486 484
     </where>
487
-    ORDER BY
488
-    time DESC
485
+    ORDER BY storehouse ASC
489 486
   </select>
490 487
   <select id="selectByMapHistory" resultMap="BaseResultMap" parameterType="java.util.Map">
491 488
     SELECT

+ 9 - 1
src/main/java/com/chinaitop/depot/intelligent/grainsituation/service/TemperatureRecordService.java

@@ -34,7 +34,15 @@ public interface TemperatureRecordService {
34 34
      */
35 35
     Map<Integer,List<TempMetadata>> findByTempTable(String id);
36 36
 
37
-    List<TTestdata> getListOfGroup(String vCfCode, String vDatatime, String startTime, String endTime, String tType, String orgId);
37
+    /**
38
+     * 分页列表数据(温湿度检测只显示当天数据,按仓房排序)
39
+     * @param vCfCode
40
+     * @param vDatatime
41
+     * @param tType
42
+     * @param orgId
43
+     * @return
44
+     */
45
+    List<TTestdata> getListOfGroup(String vCfCode, String vDatatime, String tType, String orgId);
38 46
 
39 47
     List<TTestdata> getTemHistoryPageInfoList(String vCfCode, String vDatatime, String startTime, String endTime, String tType, String orgId);
40 48
 }

+ 9 - 8
src/main/java/com/chinaitop/depot/intelligent/grainsituation/service/impl/TemperatureRecordServiceImpl.java

@@ -15,6 +15,7 @@ import org.springframework.stereotype.Service;
15 15
 import org.springframework.transaction.annotation.Transactional;
16 16
 
17 17
 import javax.annotation.Resource;
18
+import java.time.LocalDate;
18 19
 import java.util.*;
19 20
 import java.util.stream.Collectors;
20 21
 
@@ -50,18 +51,17 @@ public class TemperatureRecordServiceImpl implements TemperatureRecordService {
50 51
         testdataExample.setOrderByClause("time desc");
51 52
         return tTestdataMapper.selectByExample(testdataExample);
52 53
     }
54
+
53 55
     /**
54
-     * 要求修改为->温湿度检测只显示最新的一次检测数据
56
+     * 要求修改为->温湿度检测只显示当天数据,按仓房排序
55 57
      * @param vCfCode
56 58
      * @param vDatatime
57
-     * @param startTime
58
-     * @param endTime
59 59
      * @param tType
60 60
      * @param orgId
61 61
      * @return
62 62
      */
63 63
     @Override
64
-    public List<TTestdata> getListOfGroup(String vCfCode, String vDatatime, String startTime, String endTime, String tType, String orgId) {
64
+    public List<TTestdata> getListOfGroup(String vCfCode, String vDatatime, String tType, String orgId) {
65 65
         Map<String, Object> sMap = new HashMap<>();
66 66
         if (StringUtils.isNotEmpty(vCfCode)) {
67 67
             sMap.put("vCfCode", vCfCode);
@@ -69,10 +69,10 @@ public class TemperatureRecordServiceImpl implements TemperatureRecordService {
69 69
         if (StringUtils.isNotEmpty(vDatatime)) {
70 70
             sMap.put("startTime", DateUtils.stringToData(vDatatime + DateUtils.startTime));
71 71
             sMap.put("endTime", DateUtils.stringToData(vDatatime + DateUtils.endTime));
72
-        }
73
-        if (StringUtils.isNotBlank(startTime) && StringUtils.isNotBlank(endTime)) {
74
-            sMap.put("startTime", DateUtils.stringToData(startTime + DateUtils.startTime));
75
-            sMap.put("endTime", DateUtils.stringToData(endTime + DateUtils.endTime));
72
+        } else {
73
+            vDatatime = LocalDate.now().toString(); // 当天时间date
74
+            sMap.put("startTime", DateUtils.stringToData(vDatatime + DateUtils.startTime));
75
+            sMap.put("endTime", DateUtils.stringToData(vDatatime + DateUtils.endTime));
76 76
         }
77 77
         if (StringUtils.isNotEmpty(tType)) {
78 78
             sMap.put("tType", tType);
@@ -82,6 +82,7 @@ public class TemperatureRecordServiceImpl implements TemperatureRecordService {
82 82
         }
83 83
         return tTestdataMapper.selectByMap(sMap);
84 84
     }
85
+
85 86
     // 分页列表数据(测温记录列表,时间仓房排序)
86 87
     @Override
87 88
     public List<TTestdata> getTemHistoryPageInfoList(String vCfCode, String vDatatime, String startTime, String endTime, String tType, String orgId) {