|
@@ -677,34 +677,40 @@ public class ProtDataServiceImpl extends ServiceImpl<ProtDataMapper, ProtData> i
|
|
|
List<ProtWarningInfo> protWarningInfos = protWarningInfoMapper.selectList(queryWrapper);
|
|
|
//今日
|
|
|
Date timesmorning = DataUill.getTimesmorning();
|
|
|
- Integer dayCount = 0;
|
|
|
//本周
|
|
|
DateTime dateTime = DateUtil.beginOfWeek(new Date());
|
|
|
- Integer weekCount = 0;
|
|
|
+
|
|
|
//本月
|
|
|
Date timesMonthmorning = DataUill.getTimesMonthmorning();
|
|
|
- Integer monthCount = 0;
|
|
|
+
|
|
|
List<ProDataVo> voList = new LinkedList<>();
|
|
|
for (int i = 0; i < protWarningInfos.size(); i++) {
|
|
|
ProDataVo proDataVo = new ProDataVo();
|
|
|
proDataVo.setContent(protWarningInfos.get(i).getWarningContent());
|
|
|
proDataVo.setTime(protWarningInfos.get(i).getDate());
|
|
|
- if (protWarningInfos.get(i).getDate().after(timesmorning)) {
|
|
|
- dayCount++;
|
|
|
- }
|
|
|
- if (protWarningInfos.get(i).getDate().after(dateTime)) {
|
|
|
- weekCount++;
|
|
|
- }
|
|
|
- if (protWarningInfos.get(i).getDate().after(timesMonthmorning)) {
|
|
|
- monthCount++;
|
|
|
- }
|
|
|
voList.add(proDataVo);
|
|
|
}
|
|
|
+ QueryWrapper<ProtWarningInfo> queryWrapper1 = new QueryWrapper<>();
|
|
|
+ queryWrapper1.eq("farm_id", farmId).ge("date",timesmorning);
|
|
|
+ Integer dayCount = protWarningInfoMapper.selectCount(queryWrapper1);
|
|
|
+
|
|
|
+ QueryWrapper<ProtWarningInfo> queryWrapper2 = new QueryWrapper<>();
|
|
|
+ queryWrapper2.eq("farm_id", farmId).ge("date",dateTime);
|
|
|
+ Integer weekCount= protWarningInfoMapper.selectCount(queryWrapper2);
|
|
|
+
|
|
|
+ QueryWrapper<ProtWarningInfo> queryWrapper3 = new QueryWrapper<>();
|
|
|
+ queryWrapper3.eq("farm_id", farmId).ge("date",timesMonthmorning);
|
|
|
+ Integer monthCount = protWarningInfoMapper.selectCount(queryWrapper3);
|
|
|
+
|
|
|
+ QueryWrapper<ProtWarningInfo> queryWrapper4 = new QueryWrapper<>();
|
|
|
+ queryWrapper4.eq("farm_id", farmId);
|
|
|
+ Integer count = protWarningInfoMapper.selectCount(queryWrapper4);
|
|
|
+
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("dayCount", dayCount);
|
|
|
jsonObject.put("weekCount", weekCount);
|
|
|
jsonObject.put("monthCount", monthCount);
|
|
|
- jsonObject.put("count", protWarningInfos.size());
|
|
|
+ jsonObject.put("count", count);
|
|
|
jsonObject.put("data", voList);
|
|
|
|
|
|
|