|
@@ -1,11 +1,13 @@
|
|
package com.huimv.produce.warning.service.impl;
|
|
package com.huimv.produce.warning.service.impl;
|
|
|
|
|
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.huimv.common.utils.DataUill;
|
|
import com.huimv.common.utils.Result;
|
|
import com.huimv.common.utils.Result;
|
|
import com.huimv.common.utils.ResultCode;
|
|
import com.huimv.common.utils.ResultCode;
|
|
import com.huimv.produce.warning.entity.BaseWarningInfo;
|
|
import com.huimv.produce.warning.entity.BaseWarningInfo;
|
|
@@ -267,33 +269,53 @@ public class BaseWarningInfoServiceImpl extends ServiceImpl<BaseWarningInfoMappe
|
|
}
|
|
}
|
|
|
|
|
|
List<BaseWarningInfoDto> baseWarningInfoDtos = null;
|
|
List<BaseWarningInfoDto> baseWarningInfoDtos = null;
|
|
|
|
+ QueryWrapper<BaseWarningInfo> wrapper = new QueryWrapper<>();
|
|
|
|
+ Date now = new Date();
|
|
|
|
+ DateTime dateTime = DateUtil.beginOfDay(now);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Page<BaseWarningInfoDto> page = new Page<>(Integer.parseInt(pageNo), Integer.parseInt(pageSize));
|
|
|
|
+ wrapper.orderByDesc("upload_time");
|
|
|
|
+ wrapper.eq("farm_id",farmId);
|
|
//默认显示
|
|
//默认显示
|
|
|
|
+ IPage page1 = null;
|
|
if (type == null) {
|
|
if (type == null) {
|
|
- baseWarningInfoDtos = baseWarningInfoMapper.listDayBaseWarn(farmId);
|
|
|
|
- } else {
|
|
|
|
|
|
+ wrapper.ge("upload_time",dateTime);
|
|
|
|
|
|
|
|
+ page1 = baseWarningInfoMapper.listData(page,wrapper);
|
|
|
|
+// baseWarningInfoDtos = baseWarningInfoMapper.listDayBaseWarn(farmId);
|
|
|
|
+ } else {
|
|
//自定义查询
|
|
//自定义查询
|
|
if ("4".equals(type)) {
|
|
if ("4".equals(type)) {
|
|
startDate = startDate + " 00:00:00";
|
|
startDate = startDate + " 00:00:00";
|
|
- endDate = endDate + " 23:59:59";
|
|
|
|
- baseWarningInfoDtos =baseWarningInfoMapper.listBaseWarn(farmId, startDate, endDate);
|
|
|
|
|
|
+ endDate = endDate + " 23:59:59";
|
|
|
|
+ wrapper.between("upload_time",startDate,endDate);
|
|
|
|
+ page1 = baseWarningInfoMapper.listData(page, wrapper);
|
|
|
|
+ // baseWarningInfoDtos =baseWarningInfoMapper.listBaseWarn(farmId, startDate, endDate);
|
|
}
|
|
}
|
|
//本月
|
|
//本月
|
|
else if ("3".equals(type)) {
|
|
else if ("3".equals(type)) {
|
|
- baseWarningInfoDtos = baseWarningInfoMapper.listMonthBaseWarn(farmId);
|
|
|
|
|
|
+ Date timesMonthmorning = DataUill.getTimesMonthmorning();
|
|
|
|
+ wrapper.ge("upload_time",timesMonthmorning );
|
|
|
|
+ page1 = baseWarningInfoMapper.listData(page, wrapper);
|
|
|
|
+ // baseWarningInfoDtos = baseWarningInfoMapper.listMonthBaseWarn(farmId);
|
|
}
|
|
}
|
|
//本周
|
|
//本周
|
|
else if ("2".equals(type)) {
|
|
else if ("2".equals(type)) {
|
|
- baseWarningInfoDtos = baseWarningInfoMapper.listWeekBaseWarn(farmId);
|
|
|
|
|
|
+ Date timesWeekmorning = DateUtil.beginOfWeek(new Date());
|
|
|
|
+ wrapper.ge("upload_time",timesWeekmorning );
|
|
|
|
+ page1 = baseWarningInfoMapper.listData(page,wrapper);
|
|
|
|
+ // baseWarningInfoDtos = baseWarningInfoMapper.listWeekBaseWarn(farmId);
|
|
}
|
|
}
|
|
//今日
|
|
//今日
|
|
else if ("1".equals(type)) {
|
|
else if ("1".equals(type)) {
|
|
- baseWarningInfoDtos = baseWarningInfoMapper.listDayBaseWarn(farmId);
|
|
|
|
- }
|
|
|
|
|
|
+ Date timesmorning = DataUill.getTimesmorning();
|
|
|
|
+ wrapper.ge("upload_time",dateTime);
|
|
|
|
+ page1 =baseWarningInfoMapper.listData(page,wrapper);
|
|
|
|
+ // baseWarningInfoDtos = baseWarningInfoMapper.listDayBaseWarn(farmId);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- Page<BaseWarningInfoDto> page = new Page<>(Integer.parseInt(pageNo), Integer.parseInt(pageSize));
|
|
|
|
- Page<BaseWarningInfoDto> page1 = page.setRecords(baseWarningInfoDtos);
|
|
|
|
return new Result(ResultCode.SUCCESS, page1);
|
|
return new Result(ResultCode.SUCCESS, page1);
|
|
}
|
|
}
|
|
|
|
|