|
@@ -64,7 +64,14 @@ public class ShowDataController {
|
|
|
@ApiOperation(value = "get sn")
|
|
|
@GetMapping("getSn/{fid}/{sid}")
|
|
|
public Map<String, Object> getSnForId(@PathVariable String fid, @PathVariable String sid) throws IOException {
|
|
|
- String sql = "select qrcode from py_battery where f_id=" + fid + " and s_id=" + sid;
|
|
|
+ return getSnList(fid, sid);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map<String, Object> getSnList(String fid, String sid) {
|
|
|
+ String sql = "select qrcode from py_battery where f_id=" + fid;
|
|
|
+ if (null != sid) {
|
|
|
+ sql.concat(" and s_id=" + sid);
|
|
|
+ }
|
|
|
List<Map<String, Object>> snData = moyuJdbcTemplate.queryForList(sql);
|
|
|
List<String> snList = new ArrayList();
|
|
|
snData.forEach(p -> snList.add(p.get("qrcode").toString()));
|
|
@@ -79,16 +86,8 @@ public class ShowDataController {
|
|
|
@ApiOperation(value = "获取美团sn")
|
|
|
@RequestMapping(value = "/getSn", method = RequestMethod.GET)
|
|
|
public Map<String, Object> getSn() throws IOException {
|
|
|
- String sql = "select qrcode from py_battery where f_id=141";
|
|
|
- List<Map<String, Object>> snData = moyuJdbcTemplate.queryForList(sql);
|
|
|
- List<String> snList = new ArrayList();
|
|
|
- snData.forEach(p -> snList.add(p.get("qrcode").toString()));
|
|
|
- String snString = "\'" + String.join("\',\'", snList) + "\'";
|
|
|
- Map res = new HashMap<String, String>();
|
|
|
- res.put("time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
|
- res.put("snString", snString);
|
|
|
- res.put("snList", snList);
|
|
|
- return res;
|
|
|
+ return getSnList("141", null);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "获取低电量信息")
|
|
@@ -97,7 +96,7 @@ public class ShowDataController {
|
|
|
String snString = this.getSn().get("snString").toString();
|
|
|
Map<String, Object> res = new HashMap<>();
|
|
|
String sql = "select product_id as sn, start_time as time,TIMESTAMPDIFF(hour,start_time,now()) as drua, Batpos from all_fault_info where end_time = '0000-00-00 00:00:00' " +
|
|
|
- "and code=58 and product_id in (%s)";
|
|
|
+ "and code=58 and product_id in (%s)";
|
|
|
List<Map<String, Object>> lowSocData;
|
|
|
|
|
|
try {
|
|
@@ -126,10 +125,10 @@ public class ShowDataController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "获取离线信息")
|
|
|
- @RequestMapping(value = "/getOffline", method = RequestMethod.GET)
|
|
|
- public Map<String, Object> getOffline() throws IOException {
|
|
|
- String snString = this.getSn().get("snString").toString();
|
|
|
- List<String> snList =(List<String>) this.getSn().get("snList");
|
|
|
+ @RequestMapping(value = "/getOffline/{fid}/{sid}", method = RequestMethod.GET)
|
|
|
+ public Map<String, Object> getOffline(@PathVariable String fid, @PathVariable String sid) throws IOException {
|
|
|
+ String snString = this.getSnList(fid, sid).get("snString").toString();
|
|
|
+ List<String> snList = (List<String>) this.getSn().get("snList");
|
|
|
Map<String, Object> res = new HashMap<>();
|
|
|
String sql = "select product_id as sn, start_time as time,TIMESTAMPDIFF(hour,start_time,now()) as drua, Batpos from all_fault_info where end_time = '0000-00-00 00:00:00' " +
|
|
|
"and code=59 and product_id in (%s)";
|
|
@@ -142,7 +141,7 @@ public class ShowDataController {
|
|
|
}
|
|
|
|
|
|
List<String> offLineList = new ArrayList<>();
|
|
|
- offlineData.forEach(p->offLineList.add(p.get("sn").toString()));
|
|
|
+ offlineData.forEach(p -> offLineList.add(p.get("sn").toString()));
|
|
|
|
|
|
Map<String, Object> thisData = new HashMap<>();
|
|
|
thisData.put("totalCount", snList.size());
|
|
@@ -151,33 +150,13 @@ public class ShowDataController {
|
|
|
res.put("code", 200);
|
|
|
res.put("message", "获取成功");
|
|
|
res.put("data", thisData);
|
|
|
-// final Integer[] offlineCount = {0};
|
|
|
-// if (!ObjectUtils.isEmpty(offlineData)) {
|
|
|
-// List<Object> data = new ArrayList<>();
|
|
|
-//
|
|
|
-// snList.forEach(p -> {
|
|
|
-// if (offLineList.contains(p)){
|
|
|
-// offlineCount[0] = offlineCount[0] + 1;
|
|
|
-// }
|
|
|
-// });
|
|
|
-// Map<String, Object> thisData = new HashMap<>();
|
|
|
-// thisData.put("offLineCount", offlineCount[0]);
|
|
|
-// thisData.put("onLineCount", snList.size() - offlineCount[0]);
|
|
|
-// res.put("code", 200);
|
|
|
-// res.put("message", "获取成功");
|
|
|
-// res.put("data", thisData);
|
|
|
-// } else {
|
|
|
-// res.put("code", 500);
|
|
|
-// res.put("message", "未获取到数据");
|
|
|
-// res.put("data", new HashMap<>());
|
|
|
-// }
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "获取故障信息")
|
|
|
- @RequestMapping(value = "/getAlarm", method = RequestMethod.GET)
|
|
|
- public Map<String, Object> getAlarm() throws IOException {
|
|
|
- String snString = this.getSn().get("snString").toString();
|
|
|
+ @RequestMapping(value = "/getAlarm/{fid}/{sid}", method = RequestMethod.GET)
|
|
|
+ public Map<String, Object> getAlarm(@PathVariable String fid, @PathVariable String sid) throws IOException {
|
|
|
+ String snString = this.getSnList(fid, sid).get("snString").toString();
|
|
|
Map<String, Object> res = new HashMap<>();
|
|
|
String sql = "select product_id as sn, start_time as time,TIMESTAMPDIFF(hour,start_time,now()) as drua, level, info, advice,Batpos from all_fault_info where end_time = '0000-00-00 00:00:00' " +
|
|
|
"and code not in (58,59) and product_id in (%s) and level >= 4";
|
|
@@ -213,9 +192,9 @@ public class ShowDataController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "获取gps数据")
|
|
|
- @RequestMapping(value = "/allrealtimeInfo", method = RequestMethod.GET)
|
|
|
- public Map<String, Object> gpsInfo() throws IOException {
|
|
|
- String snString = this.getSn().get("snString").toString();
|
|
|
+ @RequestMapping(value = "/allrealtimeInfo/{fid}/{sid}", method = RequestMethod.GET)
|
|
|
+ public Map<String, Object> gpsInfo(@PathVariable String fid, @PathVariable String sid) throws IOException {
|
|
|
+ String snString = this.getSnList(fid, sid).get("snString").toString();
|
|
|
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 where t2.devcode in (%s)";
|
|
|
List<Map<String, Object>> realtimeData;
|