|
@@ -15,6 +15,7 @@ import com.huimv.produce.warning.service.IBaseWarningInfoService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.text.DecimalFormat;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -310,5 +311,48 @@ public class BaseWarningInfoServiceImpl extends ServiceImpl<BaseWarningInfoMappe
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 最新预警状态(大屏)
|
|
|
|
+ * @param map
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public Result getLastWarning(Map<String, String> map) {
|
|
|
|
+ String farmId = map.get("farmId");
|
|
|
|
+ if (farmId == null) {
|
|
|
|
+ farmId = "331023001";
|
|
|
|
+ }
|
|
|
|
+ Integer readStatus = 1;
|
|
|
|
+
|
|
|
|
+ //今日预警记录
|
|
|
|
+ List<BaseWarningInfoDto> list = baseWarningInfoMapper.listDayBaseWarn(farmId);
|
|
|
|
+ //今日预警统计数量
|
|
|
|
+ int todayCount = baseWarningInfoMapper.listDayBaseWarn(farmId).size();
|
|
|
|
+ //本周预警统计数量
|
|
|
|
+ int weekCount = baseWarningInfoMapper.listWeekBaseWarn(farmId).size();
|
|
|
|
+ //本周预警已处理比率(1表示已处理)
|
|
|
|
+ QueryWrapper<BaseWarningInfo> wrapper = new QueryWrapper();
|
|
|
|
+ wrapper.eq("read_status", readStatus);
|
|
|
|
+ int count = baseWarningInfoMapper.selectCount(wrapper).intValue();
|
|
|
|
+ Map<String, Object> map1 = new HashMap<>();
|
|
|
|
+ if (weekCount != 0) {
|
|
|
|
+ float num = (float) count * 100 / weekCount;
|
|
|
|
+ DecimalFormat df = new DecimalFormat("0.00%");
|
|
|
|
+ String handleRate = df.format(num);
|
|
|
|
+ map1.put("todayCount", todayCount);
|
|
|
|
+ map1.put("handleRate", handleRate);
|
|
|
|
+ map1.put("weekCount", weekCount);
|
|
|
|
+ map1.put("list", list);
|
|
|
|
+ return new Result(ResultCode.SUCCESS, map1);
|
|
|
|
+ } else {
|
|
|
|
+ map1.put("todayCount", 0);
|
|
|
|
+ map1.put("handleRate",0);
|
|
|
|
+ map1.put("weekCount", 0);
|
|
|
|
+ map1.put("list", list);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return new Result(ResultCode.SUCCESS,map1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|