hasan 3 years ago
parent
commit
4cb46f61ca

+ 6 - 6
src/main/java/com/szls/nstths/controller/DataController.java

@@ -2,15 +2,12 @@ package com.szls.nstths.controller;
2 2
 
3 3
 import com.szls.nstths.entity.TeData;
4 4
 import com.szls.nstths.mapper.TeDataMapper;
5
-import com.szls.nstths.mapper.UserMapper;
6 5
 import org.slf4j.Logger;
7 6
 import org.slf4j.LoggerFactory;
8 7
 import org.springframework.beans.factory.annotation.Autowired;
9 8
 import org.springframework.web.bind.annotation.PostMapping;
10 9
 import org.springframework.web.bind.annotation.RequestBody;
11
-import org.springframework.web.bind.annotation.ResponseBody;
12 10
 import org.springframework.web.bind.annotation.RestController;
13
-import org.springframework.web.client.RestClientException;
14 11
 import org.springframework.web.client.RestTemplate;
15 12
 
16 13
 import java.util.Date;
@@ -32,14 +29,17 @@ public class DataController {
32 29
     public String equipmentTesting(@RequestBody TeData teData) {
33 30
         logger.info("{}", teData);
34 31
         int dbi = teDataMapper.insert(teData);
35
-        return dbi+" success";
32
+        if (dbi < 1) {
33
+            return "fail";
34
+        }
35
+        return "success";
36 36
     }
37 37
 
38 38
     /**
39 39
      * 组装待打点并发送
40 40
      */
41
-    public void sendTestAgain(){
42
-        String url ="http://local.wxlxit.com:61001/equipmentTestingStart";
41
+    public void sendTestAgain() {
42
+        String url = "http://local.wxlxit.com:61001/equipmentTestingStart";
43 43
         TeData teData = new TeData();
44 44
         teData.setEquipmentID("hljcbk1001");
45 45
         teData.setStime(new Date());

+ 2 - 0
src/main/java/com/szls/nstths/entity/TeData.java

@@ -17,6 +17,8 @@ public class TeData {
17 17
     private Long id;
18 18
     @TableField("equipmentID")
19 19
     private String equipmentID;
20
+    @TableField("taskID")
21
+    private String taskID;
20 22
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
21 23
     private Date stime;
22 24
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")

+ 11 - 1
src/main/resources/application.yml

@@ -6,6 +6,16 @@ spring:
6 6
     driver-class-name: com.mysql.cj.jdbc.Driver
7 7
     username: root
8 8
     password: 123456
9
-    url: jdbc:mysql://36.134.100.155:3306/nstths?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC
9
+    #url: jdbc:mysql://36.134.100.155:3306/nstths?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC
10
+    url: jdbc:mysql://192.168.1.123:3306/nstths?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC
11
+    hikari:
12
+      minimum-idle: 5
13
+      maximum-pool-size: 10
14
+      idle-timeout: 30000
15
+      max-lifetime: 0
16
+      connection-timeout: 60000
17
+      validation-timeout: 3000
18
+      connection-test-query: select 1
19
+      auto-commit: true
10 20
   thymeleaf:
11 21
     check-template-location: false

+ 1 - 1
src/test/java/com/szls/nstths/SampleTest.java

@@ -14,7 +14,7 @@ public class SampleTest {
14 14
     @Resource
15 15
     private UserMapper userMapper;
16 16
 
17
-    @Test
17
+    //@Test
18 18
     public void testSelect() {
19 19
         System.out.println(("----- selectAll method test ------"));
20 20
         List<User> userList = userMapper.selectList(null);