Commit bbdfd05f authored by jichao's avatar jichao

增加网关数据监测

parent f880d13e
...@@ -113,6 +113,13 @@ public class BusProjectController extends PaginationController<BusProject> { ...@@ -113,6 +113,13 @@ public class BusProjectController extends PaginationController<BusProject> {
busProjectServiceImpl.downloadExcel(response, new ExcelParams(proId, start, end, code, type)); busProjectServiceImpl.downloadExcel(response, new ExcelParams(proId, start, end, code, type));
} }
@ApiOperation(value="检查网关数据", notes="返回值,1:正确,0:有错误")
@RequestMapping(value = "/checkData")
public Result checkData(@RequestParam String proId) {
Integer result = busProjectServiceImpl.checkData(proId);
return Result.builder(new PersistModel(result), null, "网关数据接收异常", null);
}
@InitBinder @InitBinder
public void initBinder(WebDataBinder webDataBinder, WebRequest webRequest) { public void initBinder(WebDataBinder webDataBinder, WebRequest webRequest) {
DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
......
...@@ -73,4 +73,11 @@ public interface BusProjectService { ...@@ -73,4 +73,11 @@ public interface BusProjectService {
*/ */
void downloadExcel(HttpServletResponse response, ExcelParams excelParams); void downloadExcel(HttpServletResponse response, ExcelParams excelParams);
/**
* 检查网关数据
* @param proId
* @return
*/
Integer checkData(String proId);
} }
...@@ -425,6 +425,20 @@ public class BusProjectServiceImpl implements BusProjectService { ...@@ -425,6 +425,20 @@ public class BusProjectServiceImpl implements BusProjectService {
} }
@Override
public Integer checkData(String proId) {
Integer result = 1;
String count = rcRedisService.get(proId + "-count");
// 如果等于空,认为是正确的值
if (StringUtils.isNotEmpty(count)) {
// 计数超过5,认为数据没有正确的接收
if (Integer.parseInt(count) > 5) {
result = 0;
}
}
return result;
}
/** /**
* 根据id,type获取表具或设备的名称 * 根据id,type获取表具或设备的名称
* @param type 1:表具,2:设备 * @param type 1:表具,2:设备
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment