|
@@ -9,12 +9,15 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.huimv.common.utils.Result;
|
|
|
import com.huimv.common.utils.ResultCode;
|
|
|
import com.huimv.produce.warning.entity.BaseWarningInfo;
|
|
|
+import com.huimv.produce.warning.entity.BaseWarningInfoDto;
|
|
|
import com.huimv.produce.warning.mapper.BaseWarningInfoMapper;
|
|
|
import com.huimv.produce.warning.service.IBaseWarningInfoService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
@@ -241,8 +244,55 @@ public class BaseWarningInfoServiceImpl extends ServiceImpl<BaseWarningInfoMappe
|
|
|
|
|
|
@Override
|
|
|
public Result listAllWarning(Map<String, String> map) {
|
|
|
+ String farmId = map.get("farmId");
|
|
|
+ String startDate = map.get("startDate");
|
|
|
+ String endDate = map.get("endDate");
|
|
|
+ String type = map.get("type");
|
|
|
+
|
|
|
+ //判空
|
|
|
+ if (farmId == null) {
|
|
|
+ farmId = "331023001";
|
|
|
+ }
|
|
|
+ //pageNo
|
|
|
+ String pageNo = map.get("pageNo");
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isBlank(pageNo)) {
|
|
|
+ pageNo = "1";
|
|
|
+ }
|
|
|
+ //pageSize
|
|
|
+ String pageSize = map.get("pageSize");
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isBlank(pageSize)) {
|
|
|
+ pageSize = "20";
|
|
|
+ }
|
|
|
+
|
|
|
+ List<BaseWarningInfoDto> baseWarningInfoDtos = null;
|
|
|
+ //默认显示
|
|
|
+ if (type == null) {
|
|
|
+ baseWarningInfoDtos = baseWarningInfoMapper.listDayBaseWarn(farmId);
|
|
|
+ } else {
|
|
|
+
|
|
|
+ //自定义查询
|
|
|
+ if ("4".equals(type)) {
|
|
|
+ startDate = startDate + " 00:00:00";
|
|
|
+ endDate = endDate + " 23:59:59";
|
|
|
+ baseWarningInfoDtos =baseWarningInfoMapper.listBaseWarn(farmId, startDate, endDate);
|
|
|
+ }
|
|
|
+ //本月
|
|
|
+ else if ("3".equals(type)) {
|
|
|
+ baseWarningInfoDtos = baseWarningInfoMapper.listMonthBaseWarn(farmId);
|
|
|
+ }
|
|
|
+ //本周
|
|
|
+ else if ("2".equals(type)) {
|
|
|
+ baseWarningInfoDtos = baseWarningInfoMapper.listWeekBaseWarn(farmId);
|
|
|
+ }
|
|
|
+ //今日
|
|
|
+ else if ("1".equals(type)) {
|
|
|
+ baseWarningInfoDtos = baseWarningInfoMapper.listDayBaseWarn(farmId);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- return null;
|
|
|
+ Page<BaseWarningInfoDto> page = new Page<>(Integer.parseInt(pageNo), Integer.parseInt(pageSize));
|
|
|
+ Page<BaseWarningInfoDto> page1 = page.setRecords(baseWarningInfoDtos);
|
|
|
+ return new Result(ResultCode.SUCCESS, page1);
|
|
|
}
|
|
|
|
|
|
@Override
|