diff --git a/fys-admin/src/main/java/com/fuyuanshen/app/controller/AppDeviceController.java b/fys-admin/src/main/java/com/fuyuanshen/app/controller/AppDeviceController.java index 4644d5b..7ad1bd2 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/app/controller/AppDeviceController.java +++ b/fys-admin/src/main/java/com/fuyuanshen/app/controller/AppDeviceController.java @@ -1,9 +1,11 @@ package com.fuyuanshen.app.controller; +import cn.hutool.json.JSON; import com.alibaba.fastjson2.JSONObject; import com.fuyuanshen.app.domain.bo.AppPersonnelInfoBo; import com.fuyuanshen.app.domain.dto.APPReNameDTO; import com.fuyuanshen.app.domain.dto.AppDeviceLogoUploadDto; +import com.fuyuanshen.app.domain.dto.DeviceInstructDto; import com.fuyuanshen.app.domain.vo.APPDeviceTypeVo; import com.fuyuanshen.app.domain.vo.AppDeviceDetailVo; import com.fuyuanshen.app.service.AppDeviceBizService; @@ -23,6 +25,7 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.util.List; +import java.util.Map; /** * APP设备信息管理 @@ -129,7 +132,8 @@ public class AppDeviceController extends BaseController { * 0(关灯),1(强光模式),2(弱光模式), 3(爆闪模式), 4(泛光模式) */ @PostMapping("/lightModeSettings") - public R lightModeSettings(@RequestBody JSONObject params) { + public R lightModeSettings(@RequestBody DeviceInstructDto params) { + // params 转 JSONObject appDeviceService.lightModeSettings(params); return R.ok(); } @@ -139,7 +143,7 @@ public class AppDeviceController extends BaseController { * */ @PostMapping("/lightBrightnessSettings") - public R lightBrightnessSettings(@RequestBody JSONObject params) { + public R lightBrightnessSettings(@RequestBody DeviceInstructDto params) { appDeviceService.lightBrightnessSettings(params); return R.ok(); } @@ -149,7 +153,7 @@ public class AppDeviceController extends BaseController { * */ @PostMapping("/laserModeSettings") - public R laserModeSettings(@RequestBody JSONObject params) { + public R laserModeSettings(@RequestBody DeviceInstructDto params) { appDeviceService.laserModeSettings(params); return R.ok(); } @@ -159,7 +163,7 @@ public class AppDeviceController extends BaseController { * */ @PostMapping("/mapReverseGeocoding") - public R mapReverseGeocoding(@RequestBody JSONObject params) { + public R mapReverseGeocoding(@RequestBody DeviceInstructDto params) { String mapJson = appDeviceService.mapReverseGeocoding(params); return R.ok(mapJson); } diff --git a/fys-admin/src/main/java/com/fuyuanshen/app/domain/dto/DeviceInstructDto.java b/fys-admin/src/main/java/com/fuyuanshen/app/domain/dto/DeviceInstructDto.java new file mode 100644 index 0000000..f176699 --- /dev/null +++ b/fys-admin/src/main/java/com/fuyuanshen/app/domain/dto/DeviceInstructDto.java @@ -0,0 +1,16 @@ +package com.fuyuanshen.app.domain.dto; + +import lombok.Data; + +@Data +public class DeviceInstructDto { + + private Long deviceId; + + private String deviceImei; + /** + * 下发指令 + */ + private Object instructValue; + +} diff --git a/fys-admin/src/main/java/com/fuyuanshen/app/service/AppDeviceBizService.java b/fys-admin/src/main/java/com/fuyuanshen/app/service/AppDeviceBizService.java index a063aef..2439513 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/app/service/AppDeviceBizService.java +++ b/fys-admin/src/main/java/com/fuyuanshen/app/service/AppDeviceBizService.java @@ -10,6 +10,7 @@ import com.fuyuanshen.app.domain.AppPersonnelInfo; import com.fuyuanshen.app.domain.bo.AppPersonnelInfoBo; import com.fuyuanshen.app.domain.dto.APPReNameDTO; import com.fuyuanshen.app.domain.dto.AppDeviceLogoUploadDto; +import com.fuyuanshen.app.domain.dto.DeviceInstructDto; import com.fuyuanshen.app.domain.vo.APPDeviceTypeVo; import com.fuyuanshen.app.domain.vo.AppDeviceBindRecordVo; import com.fuyuanshen.app.domain.vo.AppDeviceDetailVo; @@ -17,7 +18,6 @@ import com.fuyuanshen.app.domain.vo.AppPersonnelInfoVo; import com.fuyuanshen.app.mapper.AppDeviceBindRecordMapper; import com.fuyuanshen.app.mapper.AppPersonnelInfoMapper; import com.fuyuanshen.app.mapper.equipment.APPDeviceMapper; -import com.fuyuanshen.common.core.domain.R; import com.fuyuanshen.common.core.exception.ServiceException; import com.fuyuanshen.common.core.utils.ImageToCArrayConverter; import com.fuyuanshen.common.core.utils.MapstructUtils; @@ -384,14 +384,14 @@ public class AppDeviceBizService { * 灯光模式 * 0(关灯),1(强光模式),2(弱光模式), 3(爆闪模式), 4(泛光模式) */ - public void lightModeSettings(JSONObject params) { + public void lightModeSettings(DeviceInstructDto params) { try { - Long deviceId = params.getLong("deviceId"); + Long deviceId = params.getDeviceId(); Device device = deviceMapper.selectById(deviceId); if(device == null){ throw new ServiceException("设备不存在"); } - Integer instructValue = params.getInteger("instructValue"); + Integer instructValue = (Integer) params.getInstructValue(); ArrayList intData = new ArrayList<>(); intData.add(1); intData.add(instructValue); @@ -408,14 +408,14 @@ public class AppDeviceBizService { } //灯光亮度设置 - public void lightBrightnessSettings(JSONObject params) { + public void lightBrightnessSettings(DeviceInstructDto params) { try { - Long deviceId = params.getLong("deviceId"); + Long deviceId = params.getDeviceId(); Device device = deviceMapper.selectById(deviceId); if(device == null){ throw new ServiceException("设备不存在"); } - String instructValue = params.getString("instructValue"); + String instructValue = (String)params.getInstructValue(); ArrayList intData = new ArrayList<>(); intData.add(5); String[] values = instructValue.split("\\."); @@ -440,14 +440,14 @@ public class AppDeviceBizService { } //激光模式设置 - public void laserModeSettings(JSONObject params) { + public void laserModeSettings(DeviceInstructDto params) { try { - Long deviceId = params.getLong("deviceId"); + Long deviceId = params.getDeviceId(); Device device = deviceMapper.selectById(deviceId); if(device == null){ throw new ServiceException("设备不存在"); } - Integer instructValue = params.getInteger("instructValue"); + Integer instructValue = (Integer) params.getInstructValue(); ArrayList intData = new ArrayList<>(); intData.add(4); intData.add(instructValue); @@ -463,12 +463,15 @@ public class AppDeviceBizService { } } - public String mapReverseGeocoding(JSONObject params) { - Long deviceId = params.getLong("deviceId"); - Device device = deviceMapper.selectById(deviceId); - if(device == null){ + public String mapReverseGeocoding(DeviceInstructDto params) { +// Long deviceId = params.getDeviceId(); +// Device device = deviceMapper.selectById(deviceId); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("device_imei", params.getDeviceImei()); + List devices = deviceMapper.selectList(queryWrapper); + if(ObjectUtils.length( devices) ==0){ throw new ServiceException("设备不存在"); } - return RedisUtils.getCacheObject("device:location:" + device.getDeviceImei()); + return RedisUtils.getCacheObject("device:location:" + devices.get(0).getDeviceImei()); } } diff --git a/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/base/MqttMessageRule.java b/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/base/MqttMessageRule.java index ab41251..e69c06a 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/base/MqttMessageRule.java +++ b/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/base/MqttMessageRule.java @@ -9,7 +9,7 @@ public interface MqttMessageRule { * 获取命令类型 * @return 命令类型 */ - Integer getCommandType(); + String getCommandType(); /** * 执行处理 * @param context 处理上下文 diff --git a/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/base/MqttRuleEngine.java b/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/base/MqttRuleEngine.java index 9e55a8d..66ea4dc 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/base/MqttRuleEngine.java +++ b/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/base/MqttRuleEngine.java @@ -13,11 +13,12 @@ import java.util.List; public class MqttRuleEngine { - private final LinkedHashMap rulesMap = new LinkedHashMap<>(); + private final LinkedHashMap rulesMap = new LinkedHashMap<>(); public MqttRuleEngine(List rules) { // 按优先级排序 rules.sort(Comparator.comparing(MqttMessageRule::getPriority)); - rules.forEach(rule -> rulesMap.put(rule.getCommandType(), rule)); + rules.forEach(rule -> rulesMap.put(rule.getCommandType(), rule) + ); } /** @@ -27,7 +28,7 @@ public class MqttRuleEngine { */ public boolean executeRule(MqttRuleContext context) { int commandType = context.getCommandType(); - MqttMessageRule mqttMessageRule = rulesMap.get(commandType); + MqttMessageRule mqttMessageRule = rulesMap.get("Light_"+commandType); if (mqttMessageRule != null) { mqttMessageRule.execute(context); return true; diff --git a/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/constants/DeviceCommandTypeConstants.java b/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/constants/DeviceCommandTypeConstants.java deleted file mode 100644 index 0d93921..0000000 --- a/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/constants/DeviceCommandTypeConstants.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.fuyuanshen.global.mqtt.constants; - -/** - * 设备命令类型常量 - * Device Command Type Constants - */ -public class DeviceCommandTypeConstants { - - /** - * 灯光模式 (Light Mode) - */ - public static final int LIGHT_MODE = 1; - - /** - * 人员信息 (Personnel Information) - */ - public static final int PERSONNEL_INFO = 2; - - /** - * 开机LOGO (Boot Logo) - */ - public static final int BOOT_LOGO = 3; - - /** - * 激光灯 (Laser Light) - */ - public static final int LASER_LIGHT = 4; - - /** - * 主灯亮度 (Main Light Brightness) - */ - public static final int MAIN_LIGHT_BRIGHTNESS = 5; - - /** - * 定位数据 (Location Data) - */ - public static final int LOCATION_DATA = 11; - - /** - * 获取命令类型描述 - * - * @param commandType 命令类型 - * @return 命令类型描述 - */ - public static String getCommandTypeDescription(int commandType) { - switch (commandType) { - case LIGHT_MODE: - return "灯光模式 (Light Mode)"; - case PERSONNEL_INFO: - return "人员信息 (Personnel Information)"; - case BOOT_LOGO: - return "开机LOGO (Boot Logo)"; - case LASER_LIGHT: - return "激光灯 (Laser Light)"; - case MAIN_LIGHT_BRIGHTNESS: - return "主灯亮度 (Main Light Brightness)"; - case LOCATION_DATA: - return "定位数据 (Location Data)"; - default: - return "未知命令类型 (Unknown Command Type)"; - } - } - - /** - * 检查是否为有效命令类型 - * - * @param commandType 命令类型 - * @return 是否有效 - */ - public static boolean isValidCommandType(int commandType) { - return commandType == LIGHT_MODE || - commandType == PERSONNEL_INFO || - commandType == BOOT_LOGO || - commandType == LASER_LIGHT || - commandType == MAIN_LIGHT_BRIGHTNESS || - commandType == LOCATION_DATA; - } -} diff --git a/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/constants/LightingCommandTypeConstants.java b/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/constants/LightingCommandTypeConstants.java new file mode 100644 index 0000000..5687f33 --- /dev/null +++ b/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/constants/LightingCommandTypeConstants.java @@ -0,0 +1,76 @@ +package com.fuyuanshen.global.mqtt.constants; + +/** + * 设备命令类型常量 + * Device Command Type Constants + */ +public class LightingCommandTypeConstants { + + /** + * 灯光模式 (Light Mode) + */ + public static final String LIGHT_MODE = "Light_1"; + + /** + * 人员信息 (Personnel Information) + */ + public static final String PERSONNEL_INFO = "Light_2"; + + /** + * 开机LOGO (Boot Logo) + */ + public static final String BOOT_LOGO = "Light_3"; + + /** + * 激光灯 (Laser Light) + */ + public static final String LASER_LIGHT = "Light_4"; + + /** + * 主灯亮度 (Main Light Brightness) + */ + public static final String MAIN_LIGHT_BRIGHTNESS = "Light_5"; + + /** + * 定位数据 (Location Data) + */ + public static final String LOCATION_DATA = "Light_11"; + + /** + * 主动上报设备数据 (Active Reporting Device Data) + */ + public static final String ACTIVE_REPORTING_DEVICE_DATA = "Light_12"; + + /** + * 获取命令类型描述 + * + * @param commandType 命令类型 + * @return 命令类型描述 + */ + public static String getCommandTypeDescription(String commandType) { + return switch (commandType) { + case LIGHT_MODE -> "灯光模式 (Light Mode)"; + case PERSONNEL_INFO -> "人员信息 (Personnel Information)"; + case BOOT_LOGO -> "开机LOGO (Boot Logo)"; + case LASER_LIGHT -> "激光灯 (Laser Light)"; + case MAIN_LIGHT_BRIGHTNESS -> "主灯亮度 (Main Light Brightness)"; + case LOCATION_DATA -> "定位数据 (Location Data)"; + default -> "未知命令类型 (Unknown Command Type)"; + }; + } + + /** + * 检查是否为有效命令类型 + * + * @param commandType 命令类型 + * @return 是否有效 + */ + public static boolean isValidCommandType(String commandType) { + return commandType.equals(LIGHT_MODE) || + commandType.equals(PERSONNEL_INFO) || + commandType.equals(BOOT_LOGO) || + commandType.equals(LASER_LIGHT) || + commandType.equals(MAIN_LIGHT_BRIGHTNESS) || + commandType.equals(LOCATION_DATA); + } +} diff --git a/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/rule/ActiveReportingDeviceDataRule.java b/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/rule/ActiveReportingDeviceDataRule.java new file mode 100644 index 0000000..bad3faa --- /dev/null +++ b/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/rule/ActiveReportingDeviceDataRule.java @@ -0,0 +1,95 @@ +package com.fuyuanshen.global.mqtt.rule; + +import com.fuyuanshen.common.json.utils.JsonUtils; +import com.fuyuanshen.common.redis.utils.RedisUtils; +import com.fuyuanshen.global.mqtt.base.MqttMessageRule; +import com.fuyuanshen.global.mqtt.base.MqttRuleContext; +import com.fuyuanshen.global.mqtt.config.MqttGateway; +import com.fuyuanshen.global.mqtt.constants.LightingCommandTypeConstants; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.time.Duration; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +/** + * 主动上报设备数据命令处理 + * "第1位为12表示设备主动上报设备硬件状态,第2为表示当时设备主灯档位,第3位表示当时激光灯档位,第4位电量百分比,第5位为充电状态(0没有充电,1正在充电,2为已充满) + * 第6位200代表电池剩余续航时间200分钟" + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class ActiveReportingDeviceDataRule implements MqttMessageRule { + + private final MqttGateway mqttGateway; + + + @Override + public String getCommandType() { + return LightingCommandTypeConstants.ACTIVE_REPORTING_DEVICE_DATA; + } + + @Override + public void execute(MqttRuleContext context) { + try { + Object[] convertArr = context.getConvertArr(); + // Latitude, longitude + //主灯档位,激光灯档位,电量百分比,充电状态,电池剩余续航时间 + String mainLightMode = convertArr[1].toString(); + String laserLightMode = convertArr[2].toString(); + String batteryPercentage = convertArr[3].toString(); + String chargeState = convertArr[4].toString(); + String batteryRemainingTime = convertArr[5].toString(); + + // 异步发送设备状态和位置信息到Redis + asyncSendDeviceDataToRedisWithFuture(context.getDeviceImei(), mainLightMode, laserLightMode, + batteryPercentage, chargeState, batteryRemainingTime); + } catch (Exception e) { + log.error("处理定位数据命令时出错", e); + } + } + + /** + * 异步发送设备状态信息和位置信息到Redis(使用CompletableFuture) + * + * @param deviceImei 设备IMEI + * @param mainLightMode 主灯档位 + * @param laserLightMode 激光灯档位 + * @param batteryPercentage 电量百分比 + * @param chargeState 充电状态 + * @param batteryRemainingTime 电池剩余续航时间 + */ + public void asyncSendDeviceDataToRedisWithFuture(String deviceImei, String mainLightMode, String laserLightMode, + String batteryPercentage, String chargeState, String batteryRemainingTime) { + CompletableFuture.runAsync(() -> { + try { + // 构造设备状态信息对象 + Map deviceInfo = new LinkedHashMap<>(); + deviceInfo.put("deviceImei", deviceImei); + deviceInfo.put("mainLightMode", mainLightMode); + deviceInfo.put("laserLightMode", laserLightMode); + deviceInfo.put("batteryPercentage", batteryPercentage); + deviceInfo.put("chargeState", chargeState); + deviceInfo.put("batteryRemainingTime", batteryRemainingTime); + deviceInfo.put("timestamp", System.currentTimeMillis()); + + // 将设备状态信息存储到Redis中 + String deviceRedisKey = "device:status:" + deviceImei; + String deviceInfoJson = JsonUtils.toJsonString(deviceInfo); + + // 存储到Redis,设置过期时间(例如24小时) + RedisUtils.setCacheObject(deviceRedisKey, deviceInfoJson, Duration.ofSeconds(24 * 60 * 60)); + + log.info("设备状态信息已异步发送到Redis: device={}, mainLightMode={}, laserLightMode={}, batteryPercentage={}", + deviceImei, mainLightMode, laserLightMode, batteryPercentage); + } catch (Exception e) { + log.error("异步发送设备信息到Redis时出错: device={}, error={}", deviceImei, e.getMessage(), e); + } + }); + } + +} diff --git a/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/rule/LocationDataRule.java b/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/rule/LocationDataRule.java index 1345ce6..5becac6 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/rule/LocationDataRule.java +++ b/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/rule/LocationDataRule.java @@ -1,12 +1,14 @@ package com.fuyuanshen.global.mqtt.rule; +import com.fuyuanshen.common.core.utils.StringUtils; import com.fuyuanshen.common.json.utils.JsonUtils; import com.fuyuanshen.common.redis.utils.RedisUtils; import com.fuyuanshen.equipment.utils.c.map.GetAddressFromLatUtil; +import com.fuyuanshen.equipment.utils.c.map.LngLonUtil; import com.fuyuanshen.global.mqtt.base.MqttMessageRule; import com.fuyuanshen.global.mqtt.base.MqttRuleContext; import com.fuyuanshen.global.mqtt.config.MqttGateway; -import com.fuyuanshen.global.mqtt.constants.DeviceCommandTypeConstants; +import com.fuyuanshen.global.mqtt.constants.LightingCommandTypeConstants; import com.fuyuanshen.global.mqtt.constants.MqttConstants; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -31,8 +33,8 @@ public class LocationDataRule implements MqttMessageRule { @Override - public Integer getCommandType() { - return DeviceCommandTypeConstants.LOCATION_DATA; + public String getCommandType() { + return LightingCommandTypeConstants.LOCATION_DATA; } @Override @@ -101,12 +103,16 @@ public class LocationDataRule implements MqttMessageRule { public void asyncSendLocationToRedisWithFuture(String deviceImei, String latitude, String longitude) { CompletableFuture.runAsync(() -> { try { + if(StringUtils.isNotBlank(latitude) || StringUtils.isNotBlank(longitude)){ + return; + } // 构造位置信息对象 Map locationInfo = new LinkedHashMap<>(); + double[] doubles = LngLonUtil.gps84_To_Gcj02(Double.parseDouble(latitude), Double.parseDouble(longitude)); locationInfo.put("deviceImei", deviceImei); - locationInfo.put("latitude", latitude); - locationInfo.put("longitude", longitude); - String address = GetAddressFromLatUtil.getAdd(longitude, latitude); + locationInfo.put("latitude", doubles[0]); + locationInfo.put("longitude", doubles[1]); + String address = GetAddressFromLatUtil.getAdd(String.valueOf(doubles[1]), String.valueOf(doubles[0])); locationInfo.put("address", address); locationInfo.put("timestamp", System.currentTimeMillis()); @@ -130,7 +136,7 @@ public class LocationDataRule implements MqttMessageRule { String[] lonArr = longitude.split("\\."); ArrayList intData = new ArrayList<>(); - intData.add(DeviceCommandTypeConstants.LOCATION_DATA); + intData.add(11); intData.add(Integer.parseInt(latArr[0])); intData.add(Integer.parseInt(latArr[1])); intData.add(Integer.parseInt(lonArr[0])); diff --git a/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/rule/PersonnelInfoRule.java b/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/rule/PersonnelInfoRule.java index 1467561..eed9bde 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/rule/PersonnelInfoRule.java +++ b/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/rule/PersonnelInfoRule.java @@ -7,7 +7,7 @@ import com.fuyuanshen.common.redis.utils.RedisUtils; import com.fuyuanshen.global.mqtt.base.MqttMessageRule; import com.fuyuanshen.global.mqtt.base.MqttRuleContext; import com.fuyuanshen.global.mqtt.config.MqttGateway; -import com.fuyuanshen.global.mqtt.constants.DeviceCommandTypeConstants; +import com.fuyuanshen.global.mqtt.constants.LightingCommandTypeConstants; import com.fuyuanshen.global.mqtt.constants.MqttConstants; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -31,8 +31,8 @@ public class PersonnelInfoRule implements MqttMessageRule { private final MqttGateway mqttGateway; @Override - public Integer getCommandType() { - return DeviceCommandTypeConstants.PERSONNEL_INFO; + public String getCommandType() { + return LightingCommandTypeConstants.PERSONNEL_INFO; } @Override diff --git a/fys-admin/src/main/resources/application.yml b/fys-admin/src/main/resources/application.yml index 3744835..773715c 100644 --- a/fys-admin/src/main/resources/application.yml +++ b/fys-admin/src/main/resources/application.yml @@ -201,7 +201,7 @@ springdoc: in: HEADER name: ${sa-token.token-name} #这里定义了两个分组,可定义多个,也可以不定义 - group-configs: + s: - group: 1.演示模块 packages-to-scan: com.fuyuanshen.demo - group: 2.通用模块 diff --git a/fys-modules/fys-equipment/src/main/java/com/fuyuanshen/equipment/utils/c/map/GetAddressFromLatUtil.java b/fys-modules/fys-equipment/src/main/java/com/fuyuanshen/equipment/utils/c/map/GetAddressFromLatUtil.java index df5a655..c0fa47c 100644 --- a/fys-modules/fys-equipment/src/main/java/com/fuyuanshen/equipment/utils/c/map/GetAddressFromLatUtil.java +++ b/fys-modules/fys-equipment/src/main/java/com/fuyuanshen/equipment/utils/c/map/GetAddressFromLatUtil.java @@ -17,13 +17,13 @@ public class GetAddressFromLatUtil { public static void main(String[] args) { - double[] doubles = LngLonUtil.gps84_To_Gcj02(22.557395054991183, 113.98008942433216); + double[] doubles = LngLonUtil.gps84_To_Gcj02(22.6826096, 113.986969); System.out.println(doubles[0]); System.out.println(doubles[1]); // lat 31.2990170 纬度 39.909 116.40,39.92 113.39039,23.131798 113.97556991,22.67075292 // log 121.3466440 经度 116.39742 113.9751543,22.5603342 - String add = GetAddressFromLatUtil.getAdd("113.98008942433216", "22.557395054991183"); + String add = GetAddressFromLatUtil.getAdd(String.valueOf(doubles[1]), String.valueOf(doubles[0])); logger.info(add); // System.out.println(System.currentTimeMillis()); diff --git a/fys-modules/fys-equipment/src/main/resources/mapper/equipment/DeviceMapper.xml b/fys-modules/fys-equipment/src/main/resources/mapper/equipment/DeviceMapper.xml index e54ae78..8af7215 100644 --- a/fys-modules/fys-equipment/src/main/resources/mapper/equipment/DeviceMapper.xml +++ b/fys-modules/fys-equipment/src/main/resources/mapper/equipment/DeviceMapper.xml @@ -148,7 +148,7 @@ dt.type_name, dt.communication_mode, d.bluetooth_name, - d.binding_time + c.binding_time from device d inner join device_type dt on d.device_type = dt.id inner join app_device_bind_record c on d.id = c.device_id