1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060 |
- package com.huimv.admin.service.impl;
- import cn.hutool.core.date.DateTime;
- import cn.hutool.core.date.DateUtil;
- import cn.hutool.core.util.ObjectUtil;
- import com.alibaba.fastjson.JSONArray;
- import com.alibaba.fastjson.JSONObject;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.huimv.admin.common.utils.DataUill;
- import com.huimv.admin.common.utils.Result;
- import com.huimv.admin.common.utils.ResultCode;
- import com.huimv.admin.entity.ProdFermentDevice;
- import com.huimv.admin.entity.ProtData;
- import com.huimv.admin.entity.ProtWarningInfo;
- import com.huimv.admin.entity.WriteProtData;
- import com.huimv.admin.entity.dto.ProCountDto;
- import com.huimv.admin.entity.vo.ProCountVo;
- import com.huimv.admin.entity.vo.ProDataVo;
- import com.huimv.admin.entity.vo.WriteProtDataVo;
- import com.huimv.admin.mapper.ProdFermentDeviceMapper;
- import com.huimv.admin.mapper.ProtDataMapper;
- import com.huimv.admin.mapper.ProtWarningInfoMapper;
- import com.huimv.admin.mapper.WriteProtDataMapper;
- import com.huimv.admin.service.IProtDataService;
- import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import javax.servlet.http.HttpServletRequest;
- import java.text.SimpleDateFormat;
- import java.util.*;
- /**
- * <p>
- * 服务实现类
- * </p>
- *
- * @author author
- * @since 2023-02-14
- */
- @Service
- public class ProtDataServiceImpl extends ServiceImpl<ProtDataMapper, ProtData> implements IProtDataService {
- @Autowired
- private ProtDataMapper protDataMapper;
- @Autowired
- private ProtWarningInfoMapper protWarningInfoMapper;
- @Autowired
- private ProdFermentDeviceMapper fermentDeviceMapper;
- @Autowired
- private WriteProtDataMapper writeProtDataMapper;
- @Override
- public Result list(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
- String farmId = paramsMap.get("farmId");
- String displayType = paramsMap.get("displayType");//2为填报数据展示
- String startTime = paramsMap.get("startTime");
- String endTime = paramsMap.get("endTime");
- String type = paramsMap.get("type");
- String dataType = paramsMap.get("dataType");
- if (type == null || type == "") {
- type = "1";
- }
- if (dataType == null || dataType == "") {
- dataType = "1";
- }
- if (displayType == null || displayType == "") {
- displayType = "0";
- }
- ProCountDto proCountDto = new ProCountDto();
- if ("0".equals(displayType)) {
- QueryWrapper<ProtData> queryWrapper = new QueryWrapper<>();
- queryWrapper.eq("farm_id", farmId);
- //ph
- if ("1".equals(dataType)) {
- if ("4".equals(type)) {
- startTime = startTime + " 00:00:00";
- endTime = endTime + " 23:59:59";
- queryWrapper.between("create_date", startTime, endTime);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listPh(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId);
- queryWrapper2.between("create_date", startTime, endTime);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listPh(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId);
- queryWrapper3.between("create_date", startTime, endTime);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listPh(queryWrapper3);
- proCountDto.setOutList(protData3);
- }
- //本年
- else if ("3".equals(type)) {
- Calendar dateTime = Calendar.getInstance();
- int i = dateTime.get(Calendar.YEAR);
- // DateTime dateTime = DateUtil.beginOfYear(new Date());
- queryWrapper.ge("create_date", i);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listPhYear(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId).ge("create_date", i);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listPhYear(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId).ge("create_date", i);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listPhYear(queryWrapper3);
- proCountDto.setOutList(protData3);
- }
- //本月
- else if ("2".equals(type)) {
- Date timesMonthmorning = DataUill.getTimesMonthmorning();
- queryWrapper.ge("create_date", timesMonthmorning);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listPh(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId).ge("create_date", timesMonthmorning);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listPh(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId).ge("create_date", timesMonthmorning);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listPh(queryWrapper3);
- proCountDto.setOutList(protData3);
- }
- //本周
- else if ("1".equals(type)) {
- Calendar calendar = Calendar.getInstance();
- calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) - 7);
- Date dateTime = calendar.getTime();
- queryWrapper.ge("create_date", dateTime);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listPh(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId).ge("create_date", dateTime);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listPh(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId).ge("create_date", dateTime);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listPh(queryWrapper3);
- proCountDto.setOutList(protData3);
- }
- }
- //cod
- else if ("2".equals(dataType)) {
- if ("4".equals(type)) {
- startTime = startTime + " 00:00:00";
- endTime = endTime + " 23:59:59";
- queryWrapper.between("create_date", startTime, endTime);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listCod(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId);
- queryWrapper2.between("create_date", startTime, endTime);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listCod(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId);
- queryWrapper3.between("create_date", startTime, endTime);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listCod(queryWrapper3);
- proCountDto.setOutList(protData3);
- }
- //本年
- else if ("3".equals(type)) {
- Calendar dateTime = Calendar.getInstance();
- int i = dateTime.get(Calendar.YEAR);
- // DateTime dateTime = DateUtil.beginOfYear(new Date());
- queryWrapper.ge("create_date", i);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listCodYear(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId).ge("create_date", i);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listCodYear(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId).ge("create_date", i);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listCodYear(queryWrapper3);
- proCountDto.setOutList(protData3);
- }
- //本月
- else if ("2".equals(type)) {
- Date timesMonthmorning = DataUill.getTimesMonthmorning();
- queryWrapper.ge("create_date", timesMonthmorning);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listCod(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId).ge("create_date", timesMonthmorning);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listCod(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId).ge("create_date", timesMonthmorning);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listCod(queryWrapper3);
- proCountDto.setOutList(protData3);
- }
- //本周
- else if ("1".equals(type)) {
- Calendar calendar = Calendar.getInstance();
- calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) - 7);
- Date dateTime = calendar.getTime();
- queryWrapper.ge("create_date", dateTime);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listCod(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId).ge("create_date", dateTime);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listCod(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId).ge("create_date", dateTime);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listCod(queryWrapper3);
- proCountDto.setOutList(protData3);
- }
- }
- //NH3N
- else if ("3".equals(dataType)) {
- if ("4".equals(type)) {
- startTime = startTime + " 00:00:00";
- endTime = endTime + " 23:59:59";
- queryWrapper.between("create_date", startTime, endTime);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listNh3n(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId);
- queryWrapper2.between("create_date", startTime, endTime);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listNh3n(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId);
- queryWrapper3.between("create_date", startTime, endTime);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listNh3n(queryWrapper3);
- proCountDto.setOutList(protData3);
- // protDataList=endList;
- }
- //本年
- else if ("3".equals(type)) {
- Calendar dateTime = Calendar.getInstance();
- int i = dateTime.get(Calendar.YEAR);
- // DateTime dateTime = DateUtil.beginOfYear(new Date());
- queryWrapper.ge("create_date", i);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listNh3nYear(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId).ge("create_date", i);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listNh3nYear(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId).ge("create_date", i);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listNh3nYear(queryWrapper3);
- proCountDto.setOutList(protData3);
- }
- //本月
- else if ("2".equals(type)) {
- Date timesMonthmorning = DataUill.getTimesMonthmorning();
- queryWrapper.ge("create_date", timesMonthmorning);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listNh3n(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId).ge("create_date", timesMonthmorning);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listNh3n(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId).ge("create_date", timesMonthmorning);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listNh3n(queryWrapper3);
- proCountDto.setOutList(protData3);
- }
- //本周
- else if ("1".equals(type)) {
- Calendar calendar = Calendar.getInstance();
- calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) - 7);
- Date dateTime = calendar.getTime();
- queryWrapper.ge("create_date", dateTime);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listNh3n(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId).ge("create_date", dateTime);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listNh3n(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId).ge("create_date", dateTime);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listNh3n(queryWrapper3);
- proCountDto.setOutList(protData3);
- }
- }
- //TP
- else if ("4".equals(dataType)) {
- if ("4".equals(type)) {
- startTime = startTime + " 00:00:00";
- endTime = endTime + " 23:59:59";
- queryWrapper.between("create_date", startTime, endTime);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listTp(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId);
- queryWrapper2.between("create_date", startTime, endTime);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listTp(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId);
- queryWrapper3.between("create_date", startTime, endTime);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listTp(queryWrapper3);
- proCountDto.setOutList(protData3);
- // protDataList=endList;
- }
- //本年
- else if ("3".equals(type)) {
- Calendar dateTime = Calendar.getInstance();
- int i = dateTime.get(Calendar.YEAR);
- // DateTime dateTime = DateUtil.beginOfYear(new Date());
- queryWrapper.ge("create_date", i);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listTpYear(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId).ge("create_date", i);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listTpYear(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId).ge("create_date", i);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listTpYear(queryWrapper3);
- proCountDto.setOutList(protData3);
- }
- //本月
- else if ("2".equals(type)) {
- Date timesMonthmorning = DataUill.getTimesMonthmorning();
- queryWrapper.ge("create_date", timesMonthmorning);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listTp(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId).ge("create_date", timesMonthmorning);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listTp(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId).ge("create_date", timesMonthmorning);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listTp(queryWrapper3);
- proCountDto.setOutList(protData3);
- }
- //本周
- else if ("1".equals(type)) {
- Calendar calendar = Calendar.getInstance();
- calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) - 7);
- Date dateTime = calendar.getTime();
- queryWrapper.ge("create_date", dateTime);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listTp(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId).ge("create_date", dateTime);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listTp(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId).ge("create_date", dateTime);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listTp(queryWrapper3);
- proCountDto.setOutList(protData3);
- }
- }
- //TN
- else if ("5".equals(dataType)) {
- if ("4".equals(type)) {
- startTime = startTime + " 00:00:00";
- endTime = endTime + " 23:59:59";
- queryWrapper.between("create_date", startTime, endTime);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listTn(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId);
- queryWrapper2.between("create_date", startTime, endTime);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listTn(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId);
- queryWrapper3.between("create_date", startTime, endTime);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listTn(queryWrapper3);
- proCountDto.setOutList(protData3);
- // protDataList=endList;
- }
- //本年
- else if ("3".equals(type)) {
- Calendar dateTime = Calendar.getInstance();
- int i = dateTime.get(Calendar.YEAR);
- // DateTime dateTime = DateUtil.beginOfYear(new Date());
- queryWrapper.ge("create_date", i);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listTnYear(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId).ge("create_date", i);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listTnYear(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId).ge("create_date", i);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listTnYear(queryWrapper3);
- proCountDto.setOutList(protData3);
- }
- //本月
- else if ("2".equals(type)) {
- Date timesMonthmorning = DataUill.getTimesMonthmorning();
- queryWrapper.ge("create_date", timesMonthmorning);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listTn(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId).ge("create_date", timesMonthmorning);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listTn(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId).ge("create_date", timesMonthmorning);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listTn(queryWrapper3);
- proCountDto.setOutList(protData3);
- }
- //本周
- else if ("1".equals(type)) {
- Calendar calendar = Calendar.getInstance();
- calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) - 7);
- Date dateTime = calendar.getTime();
- queryWrapper.ge("create_date", dateTime);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listTn(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId).ge("create_date", dateTime);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listTn(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId).ge("create_date", dateTime);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listTn(queryWrapper3);
- proCountDto.setOutList(protData3);
- }
- }
- //FLOW
- else if ("6".equals(dataType)) {
- if ("4".equals(type)) {
- startTime = startTime + " 00:00:00";
- endTime = endTime + " 23:59:59";
- queryWrapper.between("create_date", startTime, endTime);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listFlow(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId);
- queryWrapper2.between("create_date", startTime, endTime);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listFlow(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId);
- queryWrapper3.between("create_date", startTime, endTime);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listFlow(queryWrapper3);
- proCountDto.setOutList(protData3);
- // protDataList=endList;
- }
- //本年
- else if ("3".equals(type)) {
- Calendar dateTime = Calendar.getInstance();
- int i = dateTime.get(Calendar.YEAR);
- // DateTime dateTime = DateUtil.beginOfYear(new Date());
- queryWrapper.ge("create_date", i);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listFlowYear(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId).ge("create_date", i);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listFlowYear(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId).ge("create_date", i);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listFlowYear(queryWrapper3);
- proCountDto.setOutList(protData3);
- }
- //本月
- else if ("2".equals(type)) {
- Date timesMonthmorning = DataUill.getTimesMonthmorning();
- queryWrapper.ge("create_date", timesMonthmorning);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listFlow(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId).ge("create_date", timesMonthmorning);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listFlow(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId).ge("create_date", timesMonthmorning);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listFlow(queryWrapper3);
- proCountDto.setOutList(protData3);
- }
- //本周
- else if ("1".equals(type)) {
- Calendar calendar = Calendar.getInstance();
- calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) - 7);
- Date dateTime = calendar.getTime();
- queryWrapper.ge("create_date", dateTime);
- queryWrapper.eq("loction_type", 1);
- List<ProCountVo> protData1 = protDataMapper.listFlow(queryWrapper);
- proCountDto.setInList(protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId).ge("create_date", dateTime);
- queryWrapper2.eq("loction_type", 2);
- List<ProCountVo> protData2 = protDataMapper.listFlow(queryWrapper2);
- proCountDto.setDealList(protData2);
- QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
- queryWrapper3.eq("farm_id", farmId).ge("create_date", dateTime);
- queryWrapper3.eq("loction_type", 3);
- List<ProCountVo> protData3 = protDataMapper.listFlow(queryWrapper3);
- proCountDto.setOutList(protData3);
- }
- }
- } else {
- QueryWrapper<WriteProtData> queryWrapper = new QueryWrapper<>();
- queryWrapper.eq("farm_id", farmId);
- //ph
- List<ProCountVo> inList = new ArrayList<>();
- List<ProCountVo> dealList = new ArrayList<>();
- List<ProCountVo> outList = new ArrayList<>();
- List<WriteProtDataVo> writeProtDataVos;
- if ("1".equals(dataType)) {
- if ("3".equals(type)) {
- Calendar dateTime = Calendar.getInstance();
- int i = dateTime.get(Calendar.YEAR);
- queryWrapper.ge("create_date", i);
- writeProtDataVos = writeProtDataMapper.listWriteYear(queryWrapper);
- } else {
- if ("4".equals(type)) {
- startTime = startTime + " 00:00:00";
- endTime = endTime + " 23:59:59";
- queryWrapper.between("create_date", startTime, endTime);
- } else if ("2".equals(type)) {
- Date timesMonthmorning = DataUill.getTimesMonthmorning();
- queryWrapper.ge("create_date", timesMonthmorning);
- } else if ("1".equals(type)) {
- Calendar calendar = Calendar.getInstance();
- calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) - 7);
- Date dateTime = calendar.getTime();
- queryWrapper.ge("create_date", dateTime);
- }
- writeProtDataVos = writeProtDataMapper.listWrite(queryWrapper);
- }
- for (WriteProtDataVo writeProtDataVo : writeProtDataVos) {
- ProCountVo proCountVo = new ProCountVo();
- proCountVo.setValue(writeProtDataVo.getPh());
- proCountVo.setCreateDate(writeProtDataVo.getCreateDate());
- if (writeProtDataVo.getLoctionType().equals("1")) {
- proCountVo.setLoctionType("1");
- inList.add(proCountVo);
- }
- if (writeProtDataVo.getLoctionType().equals("2")) {
- proCountVo.setLoctionType("2");
- dealList.add(proCountVo);
- }
- if (writeProtDataVo.getLoctionType().equals("3")) {
- proCountVo.setLoctionType("3");
- outList.add(proCountVo);
- }
- }
- proCountDto.setInList(inList);
- proCountDto.setDealList(dealList);
- proCountDto.setOutList(outList);
- }
- else if ("2".equals(dataType)) {
- if ("3".equals(type)) {
- Calendar dateTime = Calendar.getInstance();
- int i = dateTime.get(Calendar.YEAR);
- queryWrapper.ge("create_date", i);
- writeProtDataVos = writeProtDataMapper.listWriteYear(queryWrapper);
- } else {
- if ("4".equals(type)) {
- startTime = startTime + " 00:00:00";
- endTime = endTime + " 23:59:59";
- queryWrapper.between("create_date", startTime, endTime);
- } else if ("2".equals(type)) {
- Date timesMonthmorning = DataUill.getTimesMonthmorning();
- queryWrapper.ge("create_date", timesMonthmorning);
- } else if ("1".equals(type)) {
- Calendar calendar = Calendar.getInstance();
- calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) - 7);
- Date dateTime = calendar.getTime();
- queryWrapper.ge("create_date", dateTime);
- }
- writeProtDataVos = writeProtDataMapper.listWrite(queryWrapper);
- }
- for (WriteProtDataVo writeProtDataVo : writeProtDataVos) {
- ProCountVo proCountVo = new ProCountVo();
- proCountVo.setValue(writeProtDataVo.getCod());
- proCountVo.setCreateDate(writeProtDataVo.getCreateDate());
- if (writeProtDataVo.getLoctionType().equals("1")) {
- proCountVo.setLoctionType("1");
- inList.add(proCountVo);
- }
- if (writeProtDataVo.getLoctionType().equals("2")) {
- proCountVo.setLoctionType("2");
- dealList.add(proCountVo);
- }
- if (writeProtDataVo.getLoctionType().equals("3")) {
- proCountVo.setLoctionType("3");
- outList.add(proCountVo);
- }
- }
- proCountDto.setInList(inList);
- proCountDto.setDealList(dealList);
- proCountDto.setOutList(outList);
- }
- else if ("3".equals(dataType)) {
- if ("3".equals(type)) {
- Calendar dateTime = Calendar.getInstance();
- int i = dateTime.get(Calendar.YEAR);
- queryWrapper.ge("create_date", i);
- writeProtDataVos = writeProtDataMapper.listWriteYear(queryWrapper);
- } else {
- if ("4".equals(type)) {
- startTime = startTime + " 00:00:00";
- endTime = endTime + " 23:59:59";
- queryWrapper.between("create_date", startTime, endTime);
- } else if ("2".equals(type)) {
- Date timesMonthmorning = DataUill.getTimesMonthmorning();
- queryWrapper.ge("create_date", timesMonthmorning);
- } else if ("1".equals(type)) {
- Calendar calendar = Calendar.getInstance();
- calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) - 7);
- Date dateTime = calendar.getTime();
- queryWrapper.ge("create_date", dateTime);
- }
- writeProtDataVos = writeProtDataMapper.listWrite(queryWrapper);
- }
- for (WriteProtDataVo writeProtDataVo : writeProtDataVos) {
- ProCountVo proCountVo = new ProCountVo();
- proCountVo.setValue(writeProtDataVo.getNh3n());
- proCountVo.setCreateDate(writeProtDataVo.getCreateDate());
- if (writeProtDataVo.getLoctionType().equals("1")) {
- proCountVo.setLoctionType("1");
- inList.add(proCountVo);
- }
- if (writeProtDataVo.getLoctionType().equals("2")) {
- proCountVo.setLoctionType("2");
- dealList.add(proCountVo);
- }
- if (writeProtDataVo.getLoctionType().equals("3")) {
- proCountVo.setLoctionType("3");
- outList.add(proCountVo);
- }
- }
- proCountDto.setInList(inList);
- proCountDto.setDealList(dealList);
- proCountDto.setOutList(outList);
- }
- else if ("4".equals(dataType)) {
- if ("3".equals(type)) {
- Calendar dateTime = Calendar.getInstance();
- int i = dateTime.get(Calendar.YEAR);
- queryWrapper.ge("create_date", i);
- writeProtDataVos = writeProtDataMapper.listWriteYear(queryWrapper);
- } else {
- if ("4".equals(type)) {
- startTime = startTime + " 00:00:00";
- endTime = endTime + " 23:59:59";
- queryWrapper.between("create_date", startTime, endTime);
- } else if ("2".equals(type)) {
- Date timesMonthmorning = DataUill.getTimesMonthmorning();
- queryWrapper.ge("create_date", timesMonthmorning);
- } else if ("1".equals(type)) {
- Calendar calendar = Calendar.getInstance();
- calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) - 7);
- Date dateTime = calendar.getTime();
- queryWrapper.ge("create_date", dateTime);
- }
- writeProtDataVos = writeProtDataMapper.listWrite(queryWrapper);
- }
- for (WriteProtDataVo writeProtDataVo : writeProtDataVos) {
- ProCountVo proCountVo = new ProCountVo();
- proCountVo.setValue(writeProtDataVo.getTp());
- proCountVo.setCreateDate(writeProtDataVo.getCreateDate());
- if (writeProtDataVo.getLoctionType().equals("1")) {
- proCountVo.setLoctionType("1");
- inList.add(proCountVo);
- }
- if (writeProtDataVo.getLoctionType().equals("2")) {
- proCountVo.setLoctionType("2");
- dealList.add(proCountVo);
- }
- if (writeProtDataVo.getLoctionType().equals("3")) {
- proCountVo.setLoctionType("3");
- outList.add(proCountVo);
- }
- }
- proCountDto.setInList(inList);
- proCountDto.setDealList(dealList);
- proCountDto.setOutList(outList);
- }
- else if ("5".equals(dataType)) {
- if ("3".equals(type)) {
- Calendar dateTime = Calendar.getInstance();
- int i = dateTime.get(Calendar.YEAR);
- queryWrapper.ge("create_date", i);
- writeProtDataVos = writeProtDataMapper.listWriteYear(queryWrapper);
- } else {
- if ("4".equals(type)) {
- startTime = startTime + " 00:00:00";
- endTime = endTime + " 23:59:59";
- queryWrapper.between("create_date", startTime, endTime);
- } else if ("2".equals(type)) {
- Date timesMonthmorning = DataUill.getTimesMonthmorning();
- queryWrapper.ge("create_date", timesMonthmorning);
- } else if ("1".equals(type)) {
- Calendar calendar = Calendar.getInstance();
- calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) - 7);
- Date dateTime = calendar.getTime();
- queryWrapper.ge("create_date", dateTime);
- }
- writeProtDataVos = writeProtDataMapper.listWrite(queryWrapper);
- }
- for (WriteProtDataVo writeProtDataVo : writeProtDataVos) {
- ProCountVo proCountVo = new ProCountVo();
- proCountVo.setValue(writeProtDataVo.getTn());
- proCountVo.setCreateDate(writeProtDataVo.getCreateDate());
- if (writeProtDataVo.getLoctionType().equals("1")) {
- proCountVo.setLoctionType("1");
- inList.add(proCountVo);
- }
- if (writeProtDataVo.getLoctionType().equals("2")) {
- proCountVo.setLoctionType("2");
- dealList.add(proCountVo);
- }
- if (writeProtDataVo.getLoctionType().equals("3")) {
- proCountVo.setLoctionType("3");
- outList.add(proCountVo);
- }
- }
- proCountDto.setInList(inList);
- proCountDto.setDealList(dealList);
- proCountDto.setOutList(outList);
- }
- else if ("6".equals(dataType)) {
- if ("3".equals(type)) {
- Calendar dateTime = Calendar.getInstance();
- int i = dateTime.get(Calendar.YEAR);
- queryWrapper.ge("create_date", i);
- writeProtDataVos = writeProtDataMapper.listWriteYear(queryWrapper);
- } else {
- if ("4".equals(type)) {
- startTime = startTime + " 00:00:00";
- endTime = endTime + " 23:59:59";
- queryWrapper.between("create_date", startTime, endTime);
- } else if ("2".equals(type)) {
- Date timesMonthmorning = DataUill.getTimesMonthmorning();
- queryWrapper.ge("create_date", timesMonthmorning);
- } else if ("1".equals(type)) {
- Calendar calendar = Calendar.getInstance();
- calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) - 7);
- Date dateTime = calendar.getTime();
- queryWrapper.ge("create_date", dateTime);
- }
- writeProtDataVos = writeProtDataMapper.listWrite(queryWrapper);
- }
- for (WriteProtDataVo writeProtDataVo : writeProtDataVos) {
- ProCountVo proCountVo = new ProCountVo();
- proCountVo.setValue(writeProtDataVo.getFlow());
- proCountVo.setCreateDate(writeProtDataVo.getCreateDate());
- if (writeProtDataVo.getLoctionType().equals("1")) {
- proCountVo.setLoctionType("1");
- inList.add(proCountVo);
- }
- if (writeProtDataVo.getLoctionType().equals("2")) {
- proCountVo.setLoctionType("2");
- dealList.add(proCountVo);
- }
- if (writeProtDataVo.getLoctionType().equals("3")) {
- proCountVo.setLoctionType("3");
- outList.add(proCountVo);
- }
- }
- proCountDto.setInList(inList);
- proCountDto.setDealList(dealList);
- proCountDto.setOutList(outList);
- }
- }
- return new Result(ResultCode.SUCCESS, proCountDto);
- }
- @Override
- public Result listProt(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
- String farmId = paramsMap.get("farmId");
- QueryWrapper<ProtWarningInfo> queryWrapper = new QueryWrapper<>();
- queryWrapper.eq("farm_id", farmId).orderByDesc("date").last(" limit 10");
- List<ProtWarningInfo> protWarningInfos = protWarningInfoMapper.selectList(queryWrapper);
- //今日
- Date timesmorning = DataUill.getTimesmorning();
- //本周
- DateTime dateTime = DateUtil.beginOfWeek(new Date());
- //本月
- Date timesMonthmorning = DataUill.getTimesMonthmorning();
- 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());
- 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", count);
- jsonObject.put("data", voList);
- return new Result(ResultCode.SUCCESS, jsonObject);
- }
- @Override
- public Result listType(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
- String farmId = paramsMap.get("farmId");
- String displayType = paramsMap.get("displayType");
- if ("".equals(displayType) || null == displayType) {
- displayType = "0";
- }
- JSONObject jsonObject = new JSONObject();
- if ("0".equals(displayType)) {
- QueryWrapper<ProtData> queryWrapper = new QueryWrapper<>();
- // ProCountDto proCountDto = new ProCountDto();
- queryWrapper.eq("farm_id", farmId).eq("loction_type", 1).orderByDesc("create_date").last(" limit 1");
- ProtData protData = protDataMapper.selectOne(queryWrapper);
- jsonObject.put("in", protData);
- QueryWrapper<ProtData> queryWrapper1 = new QueryWrapper<>();
- queryWrapper1.eq("farm_id", farmId).eq("loction_type", 2).orderByDesc("create_date").last(" limit 1");
- ProtData protData1 = protDataMapper.selectOne(queryWrapper1);
- jsonObject.put("deal", protData1);
- QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId).eq("loction_type", 3).orderByDesc("create_date").last(" limit 1");
- ProtData protData2 = protDataMapper.selectOne(queryWrapper2);
- jsonObject.put("out", protData2);
- } else {
- QueryWrapper<WriteProtData> queryWrapper = new QueryWrapper<>();
- // ProCountDto proCountDto = new ProCountDto();
- queryWrapper.eq("farm_id", farmId).eq("type", 1).orderByDesc("create_date").last(" limit 1");
- WriteProtData writeProtData = writeProtDataMapper.selectOne(queryWrapper);
- if (ObjectUtil.isEmpty(writeProtData)) {
- jsonObject.put("in", new WriteProtData());
- } else {
- jsonObject.put("in", writeProtData);
- }
- QueryWrapper<WriteProtData> queryWrapper1 = new QueryWrapper<>();
- queryWrapper1.eq("farm_id", farmId).eq("type", 2).orderByDesc("create_date").last(" limit 1");
- WriteProtData writeProtData1 = writeProtDataMapper.selectOne(queryWrapper1);
- if (ObjectUtil.isEmpty(writeProtData1)) {
- jsonObject.put("deal", new WriteProtData());
- } else {
- jsonObject.put("deal", writeProtData1);
- }
- QueryWrapper<WriteProtData> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId).eq("type", 3).orderByDesc("create_date").last(" limit 1");
- WriteProtData writeProtData2 = writeProtDataMapper.selectOne(queryWrapper2);
- if (ObjectUtil.isEmpty(writeProtData2)) {
- jsonObject.put("out", new WriteProtData());
- } else {
- jsonObject.put("out", writeProtData2);
- }
- }
- return new Result(ResultCode.SUCCESS, jsonObject);
- }
- @Override
- public Result listScreen(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
- Date timesmorning = DataUill.getTimesmorning();
- String farmId = paramsMap.get("farmId");
- QueryWrapper<ProtData> queryWrapper = new QueryWrapper<>();
- queryWrapper.eq("farm_id", farmId).ge("create_date", timesmorning);
- Integer count = protDataMapper.selectCount(queryWrapper);//监测数据条数
- QueryWrapper<ProtWarningInfo> queryWrapper1 = new QueryWrapper<>();
- queryWrapper1.eq("farm_id", farmId);
- Integer count1 = protWarningInfoMapper.selectCount(queryWrapper1);//全年报警条数
- queryWrapper1.ge("date", timesmorning);
- Integer countDay = protWarningInfoMapper.selectCount(queryWrapper1);//今日报警条数
- QueryWrapper<ProdFermentDevice> queryWrapper2 = new QueryWrapper<>();
- queryWrapper2.eq("farm_id", farmId);
- Integer day = fermentDeviceMapper.selectCount(queryWrapper2);
- JSONObject jsonObject = new JSONObject();
- jsonObject.put("locCount", 27);
- jsonObject.put("ProtCount", count);
- jsonObject.put("WarningCount", countDay);
- jsonObject.put("day", day);
- jsonObject.put("flowCount", count1);
- return new Result(ResultCode.SUCCESS, jsonObject);
- }
- }
|