Browse Source

外网端口映射访问测试

yinhao 4 years ago
parent
commit
381e59f33e

+ 6 - 7
huimv-smart-apiservice/src/main/java/com/huimv/apiservice/controller/TokenController.java

@@ -3,6 +3,7 @@ package com.huimv.apiservice.controller;
 import cn.hutool.json.JSONObject;
 import com.huimv.common.utils.TokenUtil;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
@@ -11,8 +12,6 @@ import org.apache.commons.codec.binary.Hex;
 import java.nio.charset.StandardCharsets;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
-import java.util.Map;
-
 /**
  * @Project : huimv.shiwan
  * @Package : com.huimv.apiservice.controller
@@ -26,7 +25,7 @@ public class TokenController {
     @Value("${renyang.client}")
     private String clientId;
 
-    @RequestMapping("/getToken")
+    @GetMapping("/getToken")
     public JSONObject getToken(@RequestParam("userId") String userId,
                                @RequestParam("random") String random,
                                @RequestParam("timestamp") String timestamp,
@@ -35,7 +34,7 @@ public class TokenController {
         JSONObject result = new JSONObject();
 
         if (!clientId.equals(userId)) {
-            result.put("state", 201);
+            result.put("code", 201);
             result.put("msg", "用户信息错误");
             return result;
         }
@@ -50,15 +49,15 @@ public class TokenController {
 
 
         if (!sign.equals(twoSign)) {
-            result.put("state", 201);
+            result.put("code", 201);
             result.put("msg", "加密方式错误");
             return result;
         }
 
         String token = TokenUtil.sign(userId);
         System.out.println(token);
-        result.put("state", 200);
-        result.put("token", token);
+        result.put("code", 200);
+        result.put("accessToken", token);
 
         return result;
     }

+ 1 - 1
huimv-smart-apiservice/src/main/java/com/huimv/apiservice/entity/SleepStatusEntity.java

@@ -36,7 +36,7 @@ public class SleepStatusEntity implements Serializable {
     /**
      * 睡眠时长
      */
-    private Integer sleepCount;
+    private Double sleepCount;
     /**
      * 采集时间
      */

+ 1 - 1
huimv-smart-apiservice/src/main/java/com/huimv/apiservice/entity/SportTimeEntity.java

@@ -32,7 +32,7 @@ public class SportTimeEntity implements Serializable {
     /**
      * 运动量
      */
-    private String sportCount;
+    private Integer sportCount;
     /**
      * 采集时间
      */

+ 7 - 8
huimv-smart-apiservice/src/main/java/com/huimv/apiservice/entity/vo/PigSportVo.java

@@ -12,16 +12,15 @@ import lombok.Data;
 @Data
 public class PigSportVo {
 
-   /*
-   * 耳标号
-   */
-    private String pigEartagNo;
-
+    /**
+     * 耳标号
+     */
+    private String pigEarTagNo;
 
 
-    /*
-     * 运动次数
+    /**
+     * 运动
      */
-    private String activityAmount;
+    private Integer activityAmount;
 
 }

+ 3 - 3
huimv-smart-apiservice/src/main/java/com/huimv/apiservice/service/impl/PigServiceImpl.java

@@ -59,12 +59,12 @@ public class PigServiceImpl extends ServiceImpl<PigDao, YearPigBaseEntity> imple
 
         Map<String, Object> result = new LinkedHashMap<>(16);
         List<Map<String, Object>> temperature = new ArrayList<>();
-        List<Map<String, Object>> healthStatus = new ArrayList<>();
+//        List<Map<String, Object>> healthStatus = new ArrayList<>();
         List<Map<String, Object>> feedingStatus = new ArrayList<>();
         List<Map<String, Object>> sleepStatus = new ArrayList<>();
         List<Map<String, Object>> sportStatus = new ArrayList<>();
         result.put("temperature", temperature);
-        result.put("healthStatus", healthStatus);
+//        result.put("healthStatus", healthStatus);
         result.put("feedingStatus", feedingStatus);
         result.put("sleepStatus", sleepStatus);
         result.put("sportStatus", sportStatus);
@@ -318,7 +318,7 @@ public class PigServiceImpl extends ServiceImpl<PigDao, YearPigBaseEntity> imple
         lambdaQueryWrapper.eq(SportTimeEntity::getEartag, pigEarTagNo);
         SportTimeEntity sportTimeEntity = sportTimeDao.selectOne(lambdaQueryWrapper);
         sportVo.setActivityAmount(sportTimeEntity.getSportCount());
-        sportVo.setPigEartagNo(pigEarTagNo);
+        sportVo.setPigEarTagNo(pigEarTagNo);
         return sportVo;
     }
 

+ 2 - 2
huimv-smart-apiservice/src/main/resources/application-dev.yml

@@ -24,9 +24,9 @@ spring:
     type: com.alibaba.druid.pool.DruidDataSource
     druid:
       driver-class-name: com.mysql.cj.jdbc.Driver
-      url: jdbc:mysql://192.168.1.54:3306/huimv_smart_mgt?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
+      url: jdbc:mysql://192.168.1.7:3306/huimv_smart_apiservice?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
       username: root
-      password: root
+      password: hm123456
       initial-size: 10
       max-active: 100
       min-idle: 10