|
@@ -68,6 +68,7 @@ public class ShowDataController {
|
|
|
List<String> snList = new ArrayList();
|
|
|
snData.forEach(p -> snList.add(p.get("qrcode").toString()));
|
|
|
snList.add("PK504B00100004161");
|
|
|
+ snList.add("PK504B00100004260");
|
|
|
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()));
|
|
@@ -110,6 +111,44 @@ public class ShowDataController {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "获取故障信息")
|
|
|
+ @RequestMapping(value = "/getAlarm", method = RequestMethod.GET)
|
|
|
+ public Map<String, Object> getAlarm() throws IOException {
|
|
|
+ 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, 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 >= 1";
|
|
|
+ List<Map<String, Object>> lowSocData;
|
|
|
+
|
|
|
+ try {
|
|
|
+ lowSocData = safeJdbcTemplate.queryForList(String.format(sql, snString));
|
|
|
+ } catch (EmptyResultDataAccessException e) {
|
|
|
+ lowSocData = null;
|
|
|
+ }
|
|
|
+ if (!ObjectUtils.isEmpty(lowSocData)) {
|
|
|
+ List<Object> data = new ArrayList<>();
|
|
|
+ lowSocData.forEach(p -> {
|
|
|
+ Map<String, Object> thisData = new HashMap<>();
|
|
|
+ thisData.put("sn", p.getOrDefault("sn", null));
|
|
|
+ thisData.put("time", p.getOrDefault("time", null));
|
|
|
+ thisData.put("drua", p.getOrDefault("drua", null));
|
|
|
+ thisData.put("level", p.getOrDefault("level", null));
|
|
|
+ thisData.put("info", p.getOrDefault("info", null));
|
|
|
+ thisData.put("advice", p.getOrDefault("advice", null));
|
|
|
+
|
|
|
+ data.add(thisData);
|
|
|
+ });
|
|
|
+ res.put("code", 200);
|
|
|
+ res.put("message", "获取成功");
|
|
|
+ res.put("data", data);
|
|
|
+ } else {
|
|
|
+ res.put("code", 500);
|
|
|
+ res.put("message", "未获取到数据");
|
|
|
+ res.put("data", new ArrayList<>());
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value = "获取gps数据")
|
|
|
@RequestMapping(value = "/allrealtimeInfo", method = RequestMethod.GET)
|
|
|
public Map<String, Object> gpsInfo() throws IOException {
|