Simon 1 year ago
parent
commit
ba3e67a8fe

+ 5 - 5
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TDataDisplayController.java

@@ -138,7 +138,7 @@ public class TDataDisplayController extends BaseController {
 
     @GetMapping("/mapGpsView")
     public AjaxResult mapGpsView() {
-        List<MapGpsDto> dtoList = itShouhuanInfoService.selectMapGpsView();
+        List<TShouhuanInfo> dtoList = itShouhuanInfoService.selectMapGpsView();
         AjaxResult ajax = new AjaxResult();
         ajax.put("lnglat", dtoList);
         AjaxResult ajax1 = new AjaxResult();
@@ -148,16 +148,16 @@ public class TDataDisplayController extends BaseController {
 
     @GetMapping("/mapGpsViewV2")
     public AjaxResult mapGpsViewV2() {   //TODO 暂时写在Controller中
-        List<MapGpsDto> dtoList = itShouhuanInfoService.selectMapGpsView();
+        List<TShouhuanInfo> dtoList = itShouhuanInfoService.selectMapGpsView();
         List<AjaxResult> collect = new ArrayList<>();
         if (dtoList != null && !dtoList.isEmpty()) {
             collect = dtoList.stream()
                     .map(mapGpsDto -> {
                         AjaxResult ajax = new AjaxResult();
                         List<Float> list = new ArrayList<>();
-                        if (mapGpsDto != null && mapGpsDto.getGps_long() != null && mapGpsDto.getGps_lat() != null) {
-                            list.add(mapGpsDto.getGps_long());
-                            list.add(mapGpsDto.getGps_lat());
+                        if (mapGpsDto != null && mapGpsDto.getUseGpsLong() != null && mapGpsDto.getUseGpsLat() != null) {
+                            list.add(mapGpsDto.getUseGpsLong().floatValue());
+                            list.add(mapGpsDto.getUseGpsLat().floatValue());
                         }
                         ajax.put("lnglat", list);
                         return ajax;

+ 10 - 16
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TSettingController.java

@@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system;
 
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
+
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -23,14 +24,13 @@ import com.ruoyi.common.core.page.TableDataInfo;
 
 /**
  * 手环系统设置Controller
- * 
+ *
  * @author zhengjie
  * @date 2023-09-22
  */
 @RestController
 @RequestMapping("/system/setting")
-public class TSettingController extends BaseController
-{
+public class TSettingController extends BaseController {
     @Autowired
     private ITSettingService tSettingService;
 
@@ -38,8 +38,7 @@ public class TSettingController extends BaseController
      * 查询手环系统设置列表
      */
     @GetMapping("/list")
-    public AjaxResult list(TSetting tSetting)
-    {
+    public AjaxResult list(TSetting tSetting) {
         startPage();
         List<TSetting> list = tSettingService.selectTSettingList(tSetting);
         return success(list);
@@ -51,8 +50,7 @@ public class TSettingController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:setting:export')")
     @Log(title = "手环系统设置", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, TSetting tSetting)
-    {
+    public void export(HttpServletResponse response, TSetting tSetting) {
         List<TSetting> list = tSettingService.selectTSettingList(tSetting);
         ExcelUtil<TSetting> util = new ExcelUtil<TSetting>(TSetting.class);
         util.exportExcel(response, list, "手环系统设置数据");
@@ -63,8 +61,7 @@ public class TSettingController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:setting:query')")
     @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Integer id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Integer id) {
         return success(tSettingService.selectTSettingById(id));
     }
 
@@ -74,8 +71,7 @@ public class TSettingController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:setting:add')")
     @Log(title = "手环系统设置", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody TSetting tSetting)
-    {
+    public AjaxResult add(@RequestBody TSetting tSetting) {
         return toAjax(tSettingService.insertTSetting(tSetting));
     }
 
@@ -85,8 +81,7 @@ public class TSettingController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:setting:edit')")
     @Log(title = "手环系统设置", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody TSetting tSetting)
-    {
+    public AjaxResult edit(@RequestBody TSetting tSetting) {
         return toAjax(tSettingService.updateTSetting(tSetting));
     }
 
@@ -95,9 +90,8 @@ public class TSettingController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:setting:remove')")
     @Log(title = "手环系统设置", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Integer[] ids)
-    {
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Integer[] ids) {
         return toAjax(tSettingService.deleteTSettingByIds(ids));
     }
 }

+ 20 - 16
ruoyi-common/src/main/java/com/ruoyi/common/utils/LocationUtils.java

@@ -18,7 +18,9 @@ import java.util.Map;
 @Component
 public class LocationUtils {
 
-    /**日志对象*/
+    /**
+     * 日志对象
+     */
     private static final Logger logger = LoggerFactory.getLogger(LocationUtils.class);
 
     private String KEY = "67019de565fb4aa2a0e101b70ae3fd91";
@@ -35,9 +37,10 @@ public class LocationUtils {
 
     /**
      * 发送get请求
+     *
      * @return
      */
-    public JSONObject getLocation(Map<String, String> params){
+    public JSONObject getLocation(Map<String, String> params) {
 
         JSONObject jsonObject = null;
         CloseableHttpClient httpclient = HttpClients.createDefault();
@@ -61,32 +64,34 @@ public class LocationUtils {
 
     /**
      * 根据地址获取到经纬度
+     *
      * @param response
      * @return
      */
-    private static JSONObject getLocation(CloseableHttpResponse response) throws Exception{
+    private static JSONObject getLocation(CloseableHttpResponse response) throws Exception {
         JSONObject geocode = null;
         // 判断返回状态是否为200
         if (response.getStatusLine().getStatusCode() == 200) {
             String content = EntityUtils.toString(response.getEntity(), "UTF-8");
-            logger.info("调用高德地图接口返回的结果为:{}",content);
+            logger.info("调用高德地图接口返回的结果为:{}", content);
             JSONObject jsonObject = (JSONObject) JSONObject.parse(content);
             JSONArray geocodes = (JSONArray) jsonObject.get("geocodes");
             geocode = (JSONObject) geocodes.get(0);
 
-            logger.info("返回的结果为:{}",JSONObject.toJSONString(geocode));
+            logger.info("返回的结果为:{}", JSONObject.toJSONString(geocode));
         }
         return geocode;
     }
 
     /**
      * 地理编码封装URI
+     *
      * @param url
      * @param params
      * @return
      * @throws Exception
      */
-    private URI getBuilderLocation(String url, Map<String, String> params) throws Exception{
+    private URI getBuilderLocation(String url, Map<String, String> params) throws Exception {
         // 详细地址
         String address = params.get("address");
         String city = params.get("city");
@@ -104,38 +109,36 @@ public class LocationUtils {
 
     /**
      * 逆地理编码
+     *
      * @return
      */
-    public JSONObject getCounterLocation(Map<String, String> params){
-
+    public JSONObject getCounterLocation(Map<String, String> params) {
         JSONObject jsonObject = null;
         CloseableHttpClient httpclient = HttpClients.createDefault();
-
         // 创建URI对象,并且设置请求参数
         try {
             URI uri = getBuilderCounterLocation(COUNTER_LOCATION_URL, params);
             // 创建http GET请求
             HttpGet httpGet = new HttpGet(uri);
             CloseableHttpResponse response = httpclient.execute(httpGet);
-
             // 判断返回状态是否为200
             jsonObject = getCounterLocation(response);
             httpclient.close();
         } catch (Exception e) {
             e.printStackTrace();
         }
-
         return jsonObject;
     }
 
     /**
      * 逆地理编码封装URI
+     *
      * @param url
      * @param params
      * @return
      * @throws Exception
      */
-    private URI getBuilderCounterLocation(String url, Map<String, String> params) throws Exception{
+    private URI getBuilderCounterLocation(String url, Map<String, String> params) throws Exception {
         // 详细地址
         String location = params.get("location");
 
@@ -151,19 +154,20 @@ public class LocationUtils {
 
     /**
      * 根据地址获取到经纬度
+     *
      * @param response
      * @return
      */
-    private static JSONObject getCounterLocation(CloseableHttpResponse response) throws Exception{
+    private static JSONObject getCounterLocation(CloseableHttpResponse response) throws Exception {
         JSONObject regeocode = null;
         // 判断返回状态是否为200
         if (response.getStatusLine().getStatusCode() == 200) {
             String content = EntityUtils.toString(response.getEntity(), "UTF-8");
-            logger.info("调用高德地图接口返回的结果为:{}",content);
+            logger.info("调用高德地图接口返回的结果为:{}", content);
             JSONObject jsonObject = (JSONObject) JSONObject.parse(content);
-            regeocode =  (JSONObject)jsonObject.get("regeocode");
+            regeocode = (JSONObject) jsonObject.get("regeocode");
 
-            logger.info("返回的结果为:{}",JSONObject.toJSONString(regeocode));
+            logger.info("返回的结果为:{}", JSONObject.toJSONString(regeocode));
         }
         return regeocode;
     }