|
@@ -48,6 +48,9 @@ public class ShowDataController {
|
|
|
@Resource(name = "ossJdbcTemplate")
|
|
|
JdbcTemplate ossJdbcTemplate;
|
|
|
|
|
|
+ @Resource(name = "safeJdbcTemplate")
|
|
|
+ JdbcTemplate safeJdbcTemplate;
|
|
|
+
|
|
|
// @Resource
|
|
|
// FfLocationServiceImpl ffLocationService;
|
|
|
|
|
@@ -73,6 +76,40 @@ public class ShowDataController {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "获取低电量信息")
|
|
|
+ @RequestMapping(value = "/getLowSoc", method = RequestMethod.GET)
|
|
|
+ public Map<String, Object> getLowSoc() 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, Batpos from all_fault_info where end_time = '0000-00-00 00:00:00' " +
|
|
|
+ "and code=58 and product_id in (%s)";
|
|
|
+ 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));
|
|
|
+ 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 {
|