Procházet zdrojové kódy

测温列表修改为当天数据,仓房排序

hanqingsong před 5 roky
rodič
revize
db38492faa

+ 98 - 0
depot-intelligent/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
depot-intelligent/src/main/java/com/chinaitop/depot/intelligent/grainsituation/controller/TemperatureRecordController.java

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

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

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

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

@@ -482,12 +482,10 @@
482 482
     FROM
483 483
     t_testdata
484 484
     <where>
485
+      iLq_yq = #{tType}
485 486
       <if test="orgId != null">
486 487
         and org_id = #{orgId}
487 488
       </if>
488
-      <if test="tType != null">
489
-        AND iLq_yq = #{tType}
490
-      </if>
491 489
       <if test="vCfCode != null">
492 490
         AND storehouse = #{vCfCode}
493 491
       </if>
@@ -495,8 +493,7 @@
495 493
         AND time BETWEEN #{startTime} AND #{endTime}
496 494
       </if>
497 495
     </where>
498
-    ORDER BY
499
-    time DESC
496
+    ORDER BY storehouse ASC
500 497
   </select>
501 498
   <select id="selectByMapHistory" resultMap="BaseResultMap" parameterType="java.util.Map">
502 499
     SELECT

+ 9 - 1
depot-intelligent/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
 }

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

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

+ 1 - 1
depot-web/src/main/resources/static/app/intelligent/grainDetection/controller/humitureDetectionCtrl.js

@@ -6,7 +6,7 @@ angular.module('app.intelligent').controller("humitureDetectionCtrl", function (
6 6
     // 筛选条件
7 7
     $scope.search = {};
8 8
 
9
-    // 加载列表(温湿度检测只显示最新的一次检测数据)
9
+    // 加载列表(温湿度检测只显示当天数据,按仓房排序)
10 10
     $scope.loadData = function () {
11 11
         // 检测类型0测温,1粮油,2测水分
12 12
         temperatureRecordService.getTemperRecordPageInfoList($scope.pageInfo, $scope.search,'0').then(function (data) {

+ 1 - 3
depot-web/src/main/resources/static/app/intelligent/grainDetection/service/temperatureRecordService.js

@@ -27,7 +27,7 @@ angular.module('app.intelligent').service("temperatureRecordService", function($
27 27
         return d.promise;
28 28
     };
29 29
 
30
-    // 分页列表数据(温湿度检测只显示最新的一次检测数据)
30
+    // 分页列表数据(温湿度检测只显示当天数据,按仓房排序)
31 31
     this.getTemperRecordPageInfoList = function (pageInfo,search,tType) {
32 32
         var d = $q.defer();
33 33
         $http({
@@ -37,8 +37,6 @@ angular.module('app.intelligent').service("temperatureRecordService", function($
37 37
                 pageNum : pageInfo.pageNum,
38 38
                 pageSize : pageInfo.pageSize,
39 39
                 vDatatime : search == undefined ? "":search.time,
40
-                startTime : search == undefined ? "":search.startTime,
41
-                endTime : search == undefined ? "":search.endTime,
42 40
                 vCfCode : search == undefined ? "":search.vCfCode,
43 41
                 tType: tType,
44 42
                 orgId : $rootScope.orgInfo.orgId