Explorar el Código

测温接口开发初步完成

my-csc-config-file.git hace 4 años
padre
commit
98e6554447

+ 5 - 0
src/main/java/com/chinaitop/depot/api/constant/Constant.java

@@ -18,6 +18,11 @@ public class Constant {
18 18
     public static final String SUCCESS = "上传成功";
19 19
 
20 20
     /**
21
+     * json格式错误
22
+     */
23
+    public static final String JSON_FAILED = "json格式错误";
24
+
25
+    /**
21 26
      * 判断标识
22 27
      */
23 28
     public static final int ZERO = 0;

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 8 - 2
src/main/java/com/chinaitop/depot/api/controller/ApiController.java


+ 3 - 3
src/main/java/com/chinaitop/depot/api/mapper/TTestdataMapper.xml

@@ -493,7 +493,7 @@
493 493
       <if test="ilqYq != null" >
494 494
         iLq_yq,
495 495
       </if>
496
-      <if test="tPoints != null" >
496
+      <if test="points != null" >
497 497
         t_points,
498 498
       </if>
499 499
     </trim>
@@ -543,8 +543,8 @@
543 543
       <if test="ilqYq != null" >
544 544
         #{ilqYq,jdbcType=VARCHAR},
545 545
       </if>
546
-      <if test="tPoints != null" >
547
-        #{tPoints,jdbcType=LONGVARCHAR},
546
+      <if test="points != null" >
547
+        #{points,jdbcType=LONGVARCHAR},
548 548
       </if>
549 549
     </trim>
550 550
   </insert>

+ 78 - 0
src/main/java/com/chinaitop/depot/api/model/TPoints.java

@@ -0,0 +1,78 @@
1
+package com.chinaitop.depot.api.model;
2
+
3
+import java.math.BigDecimal;
4
+
5
+public class TPoints {
6
+    private BigDecimal temp;
7
+
8
+    private String x;
9
+
10
+    private String y;
11
+
12
+    private String z;
13
+
14
+    /**
15
+     * 温度值 单位:摄氏度;坏点值以250表示;精确到小数点后1位;
16
+     * @return temp 温度值 单位:摄氏度;坏点值以250表示;精确到小数点后1位;
17
+     */
18
+    public BigDecimal getTemp() {
19
+        return temp;
20
+    }
21
+
22
+    /**
23
+     * 温度值 单位:摄氏度;坏点值以250表示;精确到小数点后1位;
24
+     * @param temp 温度值 单位:摄氏度;坏点值以250表示;精确到小数点后1位;
25
+     */
26
+    public void setTemp(BigDecimal temp) {
27
+        this.temp = temp;
28
+    }
29
+
30
+    /**
31
+     * 测温点在仓内的X坐标代表长度 代表列
32
+     * @return X 测温点在仓内的X坐标代表长度 代表列
33
+     */
34
+    public String getX() {
35
+        return x;
36
+    }
37
+
38
+    /**
39
+     * 测温点在仓内的X坐标代表长度 代表列
40
+     * @param x 测温点在仓内的X坐标代表长度 代表列
41
+     */
42
+    public void setX(String x) {
43
+        this.x = x == null ? null : x.trim();
44
+    }
45
+
46
+    /**
47
+     * 测温点在仓内的Y坐标宽度方向 代表行
48
+     * @return Y 测温点在仓内的Y坐标宽度方向 代表行
49
+     */
50
+    public String getY() {
51
+        return y;
52
+    }
53
+
54
+    /**
55
+     * 测温点在仓内的Y坐标宽度方向 代表行
56
+     * @param y 测温点在仓内的Y坐标宽度方向 代表行
57
+     */
58
+    public void setY(String y) {
59
+        this.y = y == null ? null : y.trim();
60
+    }
61
+
62
+    /**
63
+     * 测温点在仓内的Z坐标高度
64
+     * @return Z 测温点在仓内的Z坐标高度
65
+     */
66
+    public String getZ() {
67
+        return z;
68
+    }
69
+
70
+    /**
71
+     * 测温点在仓内的Z坐标高度
72
+     * @param z 测温点在仓内的Z坐标高度
73
+     */
74
+    public void setZ(String z) {
75
+        this.z = z == null ? null : z.trim();
76
+    }
77
+
78
+}

+ 19 - 9
src/main/java/com/chinaitop/depot/api/model/TestdataDO.java

@@ -37,10 +37,28 @@ public class TestdataDO {
37 37
 
38 38
     private String ilqYq;
39 39
 
40
-    private String tPoints;
40
+    public String getPoints() {
41
+        return points;
42
+    }
43
+
44
+    public void setPoints(String points) {
45
+        this.points = points;
46
+    }
47
+
48
+    private String points;
49
+
50
+    private List<TPoints> tPoints = Lists.newArrayList();
41 51
 
42 52
     private List<TTestdataLayer> layerLists = Lists.newArrayList();
43 53
 
54
+    public List<TPoints> gettPoints() {
55
+        return tPoints;
56
+    }
57
+
58
+    public void settPoints(List<TPoints> tPoints) {
59
+        this.tPoints = tPoints;
60
+    }
61
+
44 62
     public String getId() {
45 63
         return id;
46 64
     }
@@ -161,14 +179,6 @@ public class TestdataDO {
161 179
         this.ilqYq = ilqYq;
162 180
     }
163 181
 
164
-    public String gettPoints() {
165
-        return tPoints;
166
-    }
167
-
168
-    public void settPoints(String tPoints) {
169
-        this.tPoints = tPoints;
170
-    }
171
-
172 182
     public List<TTestdataLayer> getLayerLists() {
173 183
         return layerLists;
174 184
     }

+ 4 - 1
src/main/java/com/chinaitop/depot/api/service/impl/GrainApiServiceImpl.java

@@ -3,9 +3,9 @@ package com.chinaitop.depot.api.service.impl;
3 3
 import com.chinaitop.depot.api.constant.Constant;
4 4
 import com.chinaitop.depot.api.mapper.TTestdataLayerMapper;
5 5
 import com.chinaitop.depot.api.mapper.TTestdataMapper;
6
+import com.chinaitop.depot.api.model.TPoints;
6 7
 import com.chinaitop.depot.api.model.TTestdata;
7 8
 import com.chinaitop.depot.api.model.TTestdataLayer;
8
-import com.chinaitop.depot.api.model.TTestdataLayerExample;
9 9
 import com.chinaitop.depot.api.model.TestdataDO;
10 10
 import com.chinaitop.depot.api.service.GrainApiService;
11 11
 import com.chinaitop.depot.api.utils.JsonToObjectUtils;
@@ -54,6 +54,9 @@ public class GrainApiServiceImpl implements GrainApiService {
54 54
     @Override
55 55
     public String save(String grainJson) throws Exception {
56 56
         TestdataDO testdataDO = JsonToObjectUtils.jsonToTestdataDO(grainJson);
57
+        List<TPoints> tPoints = testdataDO.gettPoints();
58
+        String s = JsonToObjectUtils.listToString(tPoints);
59
+        testdataDO.setPoints(s);
57 60
         TTestdata tTestdata = testdataMapper.selectByPrimaryKey(testdataDO.getId());
58 61
         if (tTestdata != null) {
59 62
             return Constant.REPEAT_UPLOAD;

+ 11 - 0
src/main/java/com/chinaitop/depot/api/utils/JsonToObjectUtils.java

@@ -1,11 +1,13 @@
1 1
 package com.chinaitop.depot.api.utils;
2 2
 
3
+import com.chinaitop.depot.api.model.TPoints;
3 4
 import com.chinaitop.depot.api.model.TestdataDO;
4 5
 import com.fasterxml.jackson.databind.DeserializationFeature;
5 6
 import com.fasterxml.jackson.databind.ObjectMapper;
6 7
 import com.fasterxml.jackson.databind.SerializationFeature;
7 8
 
8 9
 import java.text.SimpleDateFormat;
10
+import java.util.List;
9 11
 
10 12
 public class JsonToObjectUtils {
11 13
 
@@ -37,4 +39,13 @@ public class JsonToObjectUtils {
37 39
         String jsonStr = mapper.writeValueAsString(testdataDO);
38 40
         return jsonStr;
39 41
     }
42
+
43
+    /**
44
+     * list转换字符串
45
+     * @param points list参数
46
+     * @return
47
+     */
48
+    public static String listToString(List<TPoints> points) throws Exception{
49
+            return mapper.writeValueAsString(points);
50
+    }
40 51
 }

+ 7 - 0
src/main/resources/bootstrap.yml

@@ -10,6 +10,10 @@ eureka:
10 10
     lease-renewal-interval-in-seconds: 10
11 11
     lease-expiration-duration-in-seconds: 30
12 12
 
13
+max-http-header-size: 4048576
14
+tomcat:
15
+  max-http-post-size: 1000MB  #请求参数长度
16
+
13 17
 spring:
14 18
   application:
15 19
     name: depot-api
@@ -37,4 +41,7 @@ spring:
37 41
   jackson:
38 42
     date-format: yyyy-MM-dd HH:mm:ss
39 43
     time-zone: GMT+8
44
+  servlet:
45
+    multipart:
46
+      max-request-size: 1000MB
40 47