|
@@ -63,8 +63,13 @@ public class ShowDataController {
|
|
|
@ApiOperation(value = "获取gps数据")
|
|
|
@RequestMapping(value = "/allrealtimeInfo", method = RequestMethod.GET)
|
|
|
public Map<String, Object> gpsInfo() throws IOException {
|
|
|
+ String sql = "select sn from app_device";
|
|
|
+ List<Map<String, Object>> snData = ossJdbcTemplate.queryForList(sql);
|
|
|
+ List snList = new ArrayList();
|
|
|
+ snData.forEach(p->snList.add(p.get("sn")));
|
|
|
+
|
|
|
Map<String, Object> res = new HashMap<>();
|
|
|
- String sql = "select t2.latitude, t2.longitude, t1.charge_state, t1.devcode from ff_battery_status t1 left join ff_location t2 on t1.devcode = t2.devcode";
|
|
|
+ sql = "select t2.latitude, t2.longitude, t1.charge_state, t1.devcode from ff_battery_status t1 left join ff_location t2 on t1.devcode = t2.devcode";
|
|
|
List<Map<String, Object>> realtimeData;
|
|
|
try {
|
|
|
realtimeData = iotpJdbcTemplate.queryForList(sql);
|
|
@@ -76,6 +81,7 @@ public Map<String, Object> gpsInfo() throws IOException {
|
|
|
realtimeData.forEach(p->{
|
|
|
Map<String, Object> thisData = new HashMap<>();
|
|
|
if (ObjectUtils.isEmpty(p.get("latitude"))) return;
|
|
|
+ if (!snList.contains(p.get("devcode"))) return;
|
|
|
thisData.put("latitude", p.getOrDefault("latitude", null));
|
|
|
thisData.put("longitude", p.getOrDefault("longitude", null));
|
|
|
thisData.put("devcode", p.getOrDefault("devcode", null));
|