Van333
2022-10-26 b54ea64cbb2cf8d613ca1ecf6ed9e5140abb4b9f
参数调整
已添加14个文件
已修改10个文件
375 ■■■■■ 文件已修改
.idea/dataSources.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/jpa-buddy.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/sonarlint/issuestore/3/2/324fc0690731dcdebc792576448ba5a6e8c06d62 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/sonarlint/issuestore/4/4/442292b8a7efeabbe4cc176709b833b1792140ec 补丁 | 查看 | 原始文档 | blame | 历史
.idea/sonarlint/issuestore/9/3/93a9bd117cced6b9c7148662c8fd3c4c897df38c 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/sonarlint/issuestore/a/6/a679d63f2053a2d504b84084e321ec7f09f6cf28 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/sonarlint/issuestore/b/a/ba3268bafd7e0ebaede0ee9191f3fb1e1c429db1 补丁 | 查看 | 原始文档 | blame | 历史
.idea/sonarlint/issuestore/b/e/be870e2f29a0ab9bfbd918142d7c9cfa227eb2d5 补丁 | 查看 | 原始文档 | blame | 历史
.idea/sonarlint/issuestore/c/7/c72fbd54d77e074dc19b9a2f8657b608014f95ab 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/sonarlint/issuestore/c/e/ce4a830e5e4def64dc852bb018931e75b6adb0a2 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/sonarlint/issuestore/d/0/d0d1e8f47438a32015e088e692535feeed269aef 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/sonarlint/issuestore/f/c/fc6f2f2e5667325ffa3dddc5f8a06a6b6678fc4d 补丁 | 查看 | 原始文档 | blame | 历史
.idea/sonarlint/issuestore/index.pb 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/api/bean/LoginForm.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/api/bean/PoleSensorV2SoilVOEntity.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/api/bean/ReqParams.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/api/controller/CameraController.java 88 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/api/controller/OldSystemLoginController.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/api/controller/TimerController.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/api/dao/AccessDao.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/api/service/AccessService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
target/api-1.0-SNAPSHOT.jar.original 补丁 | 查看 | 原始文档 | blame | 历史
target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/dataSources.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="DataSourceManagerImpl" format="xml" multifile-model="true">
    <data-source source="LOCAL" name="@47.106.172.9" uuid="6c957196-4c2d-4e6b-a901-88fb72b1200e">
      <driver-ref>mysql.8</driver-ref>
      <synchronize>true</synchronize>
      <jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
      <jdbc-url>jdbc:mysql://47.106.172.9:2512</jdbc-url>
      <working-dir>$ProjectFileDir$</working-dir>
    </data-source>
  </component>
</project>
.idea/jpa-buddy.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="JpaBuddyIdeaProjectConfig">
    <option name="renamerInitialized" value="true" />
  </component>
</project>
.idea/sonarlint/issuestore/3/2/324fc0690731dcdebc792576448ba5a6e8c06d62
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,3 @@
E
java:S1172"/Remove this unused method parameter "hasToken".(厯霚
.idea/sonarlint/issuestore/4/4/442292b8a7efeabbe4cc176709b833b1792140ec
.idea/sonarlint/issuestore/9/3/93a9bd117cced6b9c7148662c8fd3c4c897df38c
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,25 @@
r
java:S1488-"\Immediately return this expression instead of assigning it to the temporary variable "page".(迍竹
r
java:S14884"\Immediately return this expression instead of assigning it to the temporary variable "page".(迍竹
e
java:S3252#"OUse static access with "com.github.pagehelper.page.PageMethod" for "startPage".(翂嗔
e
java:S3252&"OUse static access with "com.github.pagehelper.page.PageMethod" for "startPage".(翂嗔
e
java:S3252)"OUse static access with "com.github.pagehelper.page.PageMethod" for "startPage".(翂嗔
e
java:S32522"OUse static access with "com.github.pagehelper.page.PageMethod" for "startPage".(翂嗔
r
java:S1488-"\Immediately return this expression instead of assigning it to the temporary variable "page".(迍竹
r
java:S14884"\Immediately return this expression instead of assigning it to the temporary variable "page".(迍竹
e
java:S3252#"OUse static access with "com.github.pagehelper.page.PageMethod" for "startPage".(翂嗔
e
java:S3252&"OUse static access with "com.github.pagehelper.page.PageMethod" for "startPage".(翂嗔
e
java:S3252)"OUse static access with "com.github.pagehelper.page.PageMethod" for "startPage".(翂嗔
e
java:S32522"OUse static access with "com.github.pagehelper.page.PageMethod" for "startPage".(翂嗔
.idea/sonarlint/issuestore/a/6/a679d63f2053a2d504b84084e321ec7f09f6cf28
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,43 @@
E
java:S37402"/Provide the parametrized type for this generic.(彺涎
E
java:S37402"/Provide the parametrized type for this generic.(彺涎
E
java:S3740J"/Provide the parametrized type for this generic.(彺涎
E
java:S3740J"/Provide the parametrized type for this generic.(彺涎
`
java:S4488#"JReplace "@RequestMapping(method = RequestMethod.POST)" with "@PostMapping"(鴽垐
e
java:S4488;"JReplace "@RequestMapping(method = RequestMethod.POST)" with "@PostMapping"(óˆÿÜÿÿÿÿÿ
F
java:S1128"+Remove this unused import 'java.util.List'.(Õë±Äøÿÿÿÿ
E
java:S37402"/Provide the parametrized type for this generic.(彺涎
E
java:S37402"/Provide the parametrized type for this generic.(彺涎
E
java:S3740J"/Provide the parametrized type for this generic.(彺涎
E
java:S3740J"/Provide the parametrized type for this generic.(彺涎
`
java:S4488#"JReplace "@RequestMapping(method = RequestMethod.POST)" with "@PostMapping"(鴽垐
e
java:S4488;"JReplace "@RequestMapping(method = RequestMethod.POST)" with "@PostMapping"(óˆÿÜÿÿÿÿÿ
F
java:S1128"+Remove this unused import 'java.util.List'.(Õë±Äøÿÿÿÿ
E
java:S37402"/Provide the parametrized type for this generic.(彺涎
E
java:S37402"/Provide the parametrized type for this generic.(彺涎
E
java:S3740J"/Provide the parametrized type for this generic.(彺涎
E
java:S3740J"/Provide the parametrized type for this generic.(彺涎
`
java:S4488#"JReplace "@RequestMapping(method = RequestMethod.POST)" with "@PostMapping"(鴽垐
e
java:S4488;"JReplace "@RequestMapping(method = RequestMethod.POST)" with "@PostMapping"(óˆÿÜÿÿÿÿÿ
F
java:S1128"+Remove this unused import 'java.util.List'.(Õë±Äøÿÿÿÿ
.idea/sonarlint/issuestore/b/a/ba3268bafd7e0ebaede0ee9191f3fb1e1c429db1
.idea/sonarlint/issuestore/b/e/be870e2f29a0ab9bfbd918142d7c9cfa227eb2d5
.idea/sonarlint/issuestore/c/7/c72fbd54d77e074dc19b9a2f8657b608014f95ab
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,9 @@
w
java:S1488I"\Immediately return this expression instead of assigning it to the temporary variable "page".(¨Ý™žùÿÿÿÿ
]
java:S2259?"BA "NullPointerException" could be thrown; "list" is nullable here.(ƒüñ»üÿÿÿÿ
e
java:S3252'"OUse static access with "com.github.pagehelper.page.PageMethod" for "startPage".(翂嗔
e
java:S3252G"OUse static access with "com.github.pagehelper.page.PageMethod" for "startPage".(翂嗔
.idea/sonarlint/issuestore/c/e/ce4a830e5e4def64dc852bb018931e75b6adb0a2
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,4 @@
V    java:S125"<This block of commented-out lines of code should be removed.(äÅêÚûÿÿÿÿ
K
java:S1128"0Remove this unused import 'api.bean.LampEntity'.(ôݵ€ùÿÿÿÿ
.idea/sonarlint/issuestore/d/0/d0d1e8f47438a32015e088e692535feeed269aef
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
U
java:S6213":Rename this variable to not match a restricted identifier.(Ÿÿõ¥þÿÿÿÿ
P
java:S6213":Rename this variable to not match a restricted identifier.(諕旰
U
java:S6213":Rename this variable to not match a restricted identifier.(©ØýÁüÿÿÿÿ
U
java:S6213":Rename this variable to not match a restricted identifier.(õÉËýÿÿÿÿ
U
java:S6213":Rename this variable to not match a restricted identifier.(Ÿÿõ¥þÿÿÿÿ
P
java:S6213":Rename this variable to not match a restricted identifier.(諕旰
U
java:S6213":Rename this variable to not match a restricted identifier.(©ØýÁüÿÿÿÿ
U
java:S6213":Rename this variable to not match a restricted identifier.(õÉËýÿÿÿÿ
.idea/sonarlint/issuestore/f/c/fc6f2f2e5667325ffa3dddc5f8a06a6b6678fc4d
.idea/sonarlint/issuestore/index.pb
@@ -1,3 +1,19 @@
c
3src/main/java/api/controller/WeatherController.java,a\6\a679d63f2053a2d504b84084e321ec7f09f6cf28
3src/main/java/api/controller/WeatherController.java,a\6\a679d63f2053a2d504b84084e321ec7f09f6cf28
R
"src/main/java/api/dao/LampDao.java,d\0\d0d1e8f47438a32015e088e692535feeed269aef
]
-src/main/java/api/service/WeatherService.java,9\3\93a9bd117cced6b9c7148662c8fd3c4c897df38c
U
%src/main/java/api/APIApplication.java,b\a\ba3268bafd7e0ebaede0ee9191f3fb1e1c429db1
7
pom.xml,4\4\442292b8a7efeabbe4cc176709b833b1792140ec
\
,src/main/java/api/dao/SinglelampDataDao.java,c\e\ce4a830e5e4def64dc852bb018931e75b6adb0a2
c
3src/main/java/api/service/SinglelampDataServer.java,c\7\c72fbd54d77e074dc19b9a2f8657b608014f95ab
`
0src/main/java/api/bean/PoleSensorV2VOEntity.java,d\4\d4cc4e15977bad28854c14d8c280f689febe6570
U
%src/main/java/api/utils/HttpUtil.java,0\0\0097a929f7209d0ce32de24604bdd3ce8e365117
src/main/java/api/bean/LoginForm.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
package api.bean;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
 * @author van
 * @version 1.0
 * msg:
 * @date 2022/9/5 16:29
 */
@Data
public class LoginForm {
    @NotBlank(message="用户名不能为空")
    private String username;
    @NotBlank(message="密码不能为空")
    private String password;
}
src/main/java/api/bean/PoleSensorV2SoilVOEntity.java
@@ -11,10 +11,11 @@
 * @date 2022/9/1 15:20
 */
@Data
public class PoleSensorV2SoilVOEntity  {
public class PoleSensorV2SoilVOEntity {
    //数据id
    private Long id;
    //mac地址
    private String mac;
    //土壤体积含水量
    private Double soilMoisture;
@@ -22,15 +23,15 @@
    private Double soilTemperature;
    //电导率
    private Double soilEc;
    //数据上报时间
    private Date soilCreateDate;
    //ph
    private Double soilPh;
    //设备类型
    private String deviceType;
    //灯杆名称
    private String streetlightName;
    //灯杆id
    private Long streetlightId;
}
src/main/java/api/bean/ReqParams.java
@@ -46,6 +46,8 @@
    private String timerExp;
    //    ç¯å¤´åºå·
    private Integer lightNumber;
    private String deviceSerial;
    public String getApiKey() {
        return "84b5f9d6b37c47edb1adae628aaaf3e5";
    }
src/main/java/api/controller/CameraController.java
@@ -7,7 +7,6 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.util.concurrent.RateLimiter;
import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -33,39 +32,102 @@
    RateLimiter rateLimiter = RateLimiter.create(10.0);
    @RequestMapping(value = "/getToken",method = RequestMethod.POST)
    public Msg listWithNotStatus(@RequestBody ReqParams reqParams){
    @RequestMapping(value = "/getToken", method = RequestMethod.POST)
    public Msg getToken(@RequestBody ReqParams reqParams) {
        rateLimiter.acquire(1);
        Long userId = accessService.getUserId(reqParams.getAccessToken());
        if(userId == null){
        if (userId == null) {
            return Msg.error("accessToken exception!!!");
        }
        //父accesstoken
        Map<String, String> parms =new HashMap<>(2);
        Map<String, String> parms = new HashMap<>(2);
        parms.put("appKey","51a534ebadf54c31a0848dc575dfa206");
        parms.put("appSecret","8c32c67a73c87b9e461b2e3bdf58967a");
        String post = HttpUtil.httpRequestToString("https://open.ys7.com/api/lapp/token/get","post",parms);
        String accessToken= JSON.parseObject(JSON.parseObject(post).getString("data")).getString("accessToken");
        parms.put("appKey", "51a534ebadf54c31a0848dc575dfa206");
        parms.put("appSecret", "8c32c67a73c87b9e461b2e3bdf58967a");
        String post = HttpUtil.httpRequestToString("https://open.ys7.com/api/lapp/token/get", "post", parms);
        String accessToken = JSON.parseObject(JSON.parseObject(post).getString("data")).getString("accessToken");
        //子accesstoken
        String ys7AccountId = accessService.getYs7AccountId(reqParams.getAccessToken());
        Map<String, String> parms02 =new HashMap<>(2);
        Map<String, String> parms02 = new HashMap<>(2);
        parms02.put("accessToken",accessToken);
        parms02.put("accountId",ys7AccountId);
        String post02 = HttpUtil.httpRequestToString("https://open.ys7.com/api/lapp/ram/token/get","post",parms02);
        parms02.put("accessToken", accessToken);
        parms02.put("accountId", ys7AccountId);
        String post02 = HttpUtil.httpRequestToString("https://open.ys7.com/api/lapp/ram/token/get", "post", parms02);
        System.out.println(post02);
        JSONObject data = JSON.parseObject(JSON.parseObject(post02).getString("data"));
//        System.out.println(data);
//        System.out.println(data.get("accessToken"));
//        accessService.setYs7Token((String) data.get("accessToken"), reqParams.getAccessToken());
        return Msg.ok(data);
    }
    @RequestMapping("/getLiveAddress")
    public Msg getUrl(@RequestBody ReqParams reqParams){
        System.out.println(reqParams.toString());
        rateLimiter.acquire(1);
        Long userId = accessService.getUserId(reqParams.getAccessToken());
        if (userId == null) {
            return Msg.error("accessToken exception!!!");
        }
        Map<String, String> parms = new HashMap<>(2);
        parms.put("appKey", "51a534ebadf54c31a0848dc575dfa206");
        parms.put("appSecret", "8c32c67a73c87b9e461b2e3bdf58967a");
        String post = HttpUtil.httpRequestToString("https://open.ys7.com/api/lapp/token/get", "post", parms);
        String accessToken = JSON.parseObject(JSON.parseObject(post).getString("data")).getString("accessToken");
        //子accesstoken
        String ys7AccountId = accessService.getYs7AccountId(reqParams.getAccessToken());
        Map<String, String> parms02 = new HashMap<>(2);
        parms02.put("accessToken", accessToken);
        parms02.put("accountId", ys7AccountId);
        String post02 = HttpUtil.httpRequestToString("https://open.ys7.com/api/lapp/ram/token/get", "post", parms02);
        System.out.println(post02);
        JSONObject data = JSON.parseObject(JSON.parseObject(post02).getString("data"));
        //可以单独传入http参数,这样参数会自动做URL编码,拼接在URL中
        HashMap<String, Object> paramMap = new HashMap<>();
        paramMap.put("accessToken", data.get("accessToken"));
        paramMap.put("deviceSerial", reqParams.getDeviceSerial());
        paramMap.put("protocol", 2);
        paramMap.put("expireTime", 720 * 60 * 60 * 24);
        paramMap.put("quality", 1);
        try {
            String result =
                    cn.hutool.http.HttpUtil.post
                            ("https://open.ys7.com/api/lapp/v2/live/address/get", paramMap);
            System.out.println(result);
            JSONObject url = JSON.parseObject(JSON.parseObject(result).getString("data"));
            return Msg.ok(url);
        } catch (Exception e) {
            return Msg.error();
        }
    }
}
src/main/java/api/controller/OldSystemLoginController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,60 @@
package api.controller;
import api.bean.LoginForm;
import api.bean.ReqParams;
import api.result.Msg;
import api.service.AccessService;
import api.utils.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.google.common.util.concurrent.RateLimiter;
import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
/**
 * @author van
 * @version 1.0
 * msg:
 * @date 2022/9/5 16:20
 */
@RestController
@RequestMapping("/server")
public class OldSystemLoginController {
        @Autowired
        private AccessService accessService;
        RateLimiter rateLimiter = RateLimiter.create(10.0);
        @RequestMapping(value = "/login",method = RequestMethod.POST)
        @CrossOrigin(origins = "*")
        public Msg getToken(@RequestBody LoginForm loginForm){
            rateLimiter.acquire(1);
            System.out.println(loginForm.toString());
            String result = HttpUtil.Post(
                    "http://47.106.172.9:8888/machine-fast/serv/sys/login",
                    new Gson().toJson(loginForm)
            );
            System.out.println(result);
            Map msg = JSON.parseObject(result, HashMap.class);
            if (msg.get("msg").equals("success")){
                return Msg.ok(msg);
            }
            else {
                return Msg.error(msg.get("msg").toString());
            }
        }
}
src/main/java/api/controller/TimerController.java
@@ -82,10 +82,50 @@
    }
    @RequestMapping(value = "info",method = RequestMethod.POST)
    public Msg timerInfo(@RequestBody ReqParams reqParams){
        rateLimiter.acquire(1);
        Long userId = accessService.getUserId(reqParams.getAccessToken());
        if(userId == null){
            return Msg.error("accessToken exception!!!");
        }
        reqParams.setApiKey(reqParams.getApiKey());
        reqParams.setUserId(userId);
        TimerRequest timerRequest = new TimerRequest();
        timerRequest.setTimerId(reqParams.getTimerId());
        reqParams.setTimerRequest(timerRequest);
        String result = HttpUtil.Post(
                "http://127.0.0.1:8888/machine-fast/serv/api/timer/getStreetlightListByTimerId",
                new Gson().toJson(reqParams)
        );
        Map msg = JSON.parseObject(result, HashMap.class);
        System.out.println(result);
        if (msg.get("msg").equals("success")){
            return Msg.ok().put("data",msg.get("list"));
        }
        else {
            return Msg.error(msg.get("msg").toString());
        }
    }
    /**
     * æŸ¥çœ‹å®šæ—¶ä»»åŠ¡ID对应绑定的灯杆列表
     * */
    @RequestMapping(value = "listByTimerId",method = RequestMethod.POST)
    @RequestMapping(value = "getSyncStatusByTimerId",method = RequestMethod.POST)
    public Msg getStreetlightListByTimerId(@RequestBody ReqParams reqParams){
        System.out.println(reqParams);
        rateLimiter.acquire(1);
src/main/java/api/dao/AccessDao.java
@@ -28,4 +28,7 @@
    @Select("select ys7_account_id from wog_user_access where access_token = #{accessToken} limit 1")
    String selectYs7AccountIdByAccessToken(String accessToken);
    @Update("update wog_user_access set ys7_access_token = #{ys7AccessToken} where access_token = #{accessToken}")
    void setYs7Token(String ys7AccessToken,String accessToken);
}
src/main/java/api/service/AccessService.java
@@ -70,4 +70,8 @@
        return ys7AccountId;
    }
    public void setYs7Token(String ys7AccessToken,String accessToken){
        accessDao.setYs7Token(ys7AccessToken,accessToken);
    }
}
target/api-1.0-SNAPSHOT.jar.original
Binary files differ
target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
@@ -2,6 +2,7 @@
api\service\PoleService.class
api\bean\SinglelampDataEntity.class
api\controller\PoleController.class
api\controller\OldSystemLoginController.class
api\dao\WeatherV2Dao.class
api\service\WeatherService.class
api\bean\PoleLightBatchEntity.class
@@ -12,6 +13,7 @@
api\service\WeatherV2Service.class
api\utils\HttpUtil.class
api\controller\WeatherController.class
api\bean\LoginForm.class
api\controller\SinglelampDataController.class
api\dao\SinglelampDataDao.class
api\bean\PoleSensorV2VOEntity.class
target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
@@ -9,6 +9,7 @@
D:\Coding\api\src\main\java\api\controller\AccessController.java
D:\Coding\api\src\main\java\api\bean\LampEntity.java
D:\Coding\api\src\main\java\api\dao\LampDao.java
D:\Coding\api\src\main\java\api\controller\OldSystemLoginController.java
D:\Coding\api\src\main\java\api\bean\PoleSensorV2SoilVOEntity.java
D:\Coding\api\src\main\java\api\dao\SinglelampDataDao.java
D:\Coding\api\src\main\java\api\bean\AccessEntity.java
@@ -27,4 +28,5 @@
D:\Coding\api\src\main\java\api\result\Msg.java
D:\Coding\api\src\main\java\api\utils\CommonHeader.java
D:\Coding\api\src\main\java\api\controller\WeatherController.java
D:\Coding\api\src\main\java\api\bean\LoginForm.java
D:\Coding\api\src\main\java\api\APIApplication.java