|
@@ -1,5 +1,7 @@
|
|
|
package com.huimv.env.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.huimv.common.utils.Result;
|
|
|
import com.huimv.common.utils.ResultCode;
|
|
|
import com.huimv.env.dao.entity.BaseWarningInfoEntity;
|
|
@@ -138,10 +140,19 @@ public class AlarmImpl implements IAlarm {
|
|
|
String today = dateUtil.getTodayDateText();
|
|
|
System.out.println("today>>"+today);
|
|
|
//
|
|
|
- List<BaseWarningInfoEntity> warningInfoEntityList = warningInfoRepo.findTodayAlarm(farmId,today,quantity);
|
|
|
+ List<Object[]> warningInfoEntityList = warningInfoRepo.findTodayAlarm(farmId,today,quantity);
|
|
|
System.out.println("size>>"+warningInfoEntityList.size());
|
|
|
if(warningInfoEntityList.size()>0){
|
|
|
- return new Result(ResultCode.SUCCESS,warningInfoEntityList);
|
|
|
+ JSONArray alarmJa = new JSONArray();
|
|
|
+ for(int a=0;a<warningInfoEntityList.size();a++){
|
|
|
+ Object[] alarmObj = (Object[]) warningInfoEntityList.get(a);
|
|
|
+ JSONObject alarmJo = new JSONObject();
|
|
|
+ alarmJa.add(alarmJo);
|
|
|
+ alarmJo.put("levelName",alarmObj[0]);
|
|
|
+ alarmJo.put("warningTime",alarmObj[1]);
|
|
|
+ alarmJo.put("msg",alarmObj[2]);
|
|
|
+ }
|
|
|
+ return new Result(ResultCode.SUCCESS,alarmJa);
|
|
|
}else{
|
|
|
return new Result(Const.ERROR_CODE_NOTEXIST,Const.ERROR_MSG_NOTEXIST,false);
|
|
|
}
|