|
@@ -195,7 +195,35 @@ public class AlarmImpl implements IAlarm {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Result getAlarmRate(Integer farmId) {
|
|
|
- return null;
|
|
|
+ public Result getAlarmRate(Integer farmId) throws ParseException {
|
|
|
+ String todayText = dateUtil.getTodayDateText();
|
|
|
+ //查询今天所有报警记录
|
|
|
+ List<BaseWarningInfoEntity> warningInfoEntityList = warningInfoRepo.findTodayAllAlarm(farmId,todayText);
|
|
|
+ if(warningInfoEntityList.size()>0){
|
|
|
+ JSONArray outJa = new JSONArray();
|
|
|
+ //
|
|
|
+ JSONObject dataJo1 = new JSONObject();
|
|
|
+ outJa.add(dataJo1);
|
|
|
+ dataJo1.put("name","生态监测");
|
|
|
+ dataJo1.put("value",25);
|
|
|
+ //
|
|
|
+ JSONObject dataJo2 = new JSONObject();
|
|
|
+ outJa.add(dataJo2);
|
|
|
+ dataJo2.put("name","环境监测");
|
|
|
+ dataJo2.put("value",30);
|
|
|
+ //
|
|
|
+ JSONObject dataJo3 = new JSONObject();
|
|
|
+ outJa.add(dataJo3);
|
|
|
+ dataJo3.put("name","人员违规");
|
|
|
+ dataJo3.put("value",45);
|
|
|
+ //
|
|
|
+ JSONObject dataJo4 = new JSONObject();
|
|
|
+ outJa.add(dataJo4);
|
|
|
+ dataJo4.put("name","报警总量");
|
|
|
+ dataJo4.put("value",100);
|
|
|
+ return new Result(ResultCode.SUCCESS,outJa);
|
|
|
+ }else{
|
|
|
+ return new Result(Const.ERROR_CODE_NOTEXIST,Const.ERROR_MSG_NOTEXIST,false);
|
|
|
+ }
|
|
|
}
|
|
|
}
|