瀏覽代碼

bug修改

wwh 2 年之前
父節點
當前提交
2d333eeae8

+ 4 - 3
huimv-admin/src/main/java/com/huimv/admin/entity/dto/ProCountDto.java

@@ -1,6 +1,7 @@
 package com.huimv.admin.entity.dto;
 
 import com.huimv.admin.entity.ProtData;
+import com.huimv.admin.entity.vo.ProCountVo;
 import com.huimv.admin.entity.vo.ProDataVo;
 import lombok.Data;
 
@@ -8,7 +9,7 @@ import java.util.List;
 
 @Data
 public class ProCountDto {
-    private List<ProtData> inList;
-    private List<ProtData> dealList;
-    private List<ProtData> outList;
+    private List<ProCountVo> inList;
+    private List<ProCountVo> dealList;
+    private List<ProCountVo> outList;
 }

+ 7 - 6
huimv-admin/src/main/java/com/huimv/admin/mapper/ProtDataMapper.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Constants;
 import com.huimv.admin.entity.ProtData;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.huimv.admin.entity.vo.ProCountVo;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
@@ -19,10 +20,10 @@ import java.util.List;
  */
 @Repository
 public interface ProtDataMapper extends BaseMapper<ProtData> {
-    List<ProtData> listPh(@Param(Constants.WRAPPER) QueryWrapper<ProtData> queryWrapper);
-    List<ProtData> listCod(@Param(Constants.WRAPPER) QueryWrapper<ProtData> queryWrapper);
-    List<ProtData> listNh3n(@Param(Constants.WRAPPER) QueryWrapper<ProtData> queryWrapper);
-    List<ProtData> listTp(@Param(Constants.WRAPPER) QueryWrapper<ProtData> queryWrapper);
-    List<ProtData> listTn(@Param(Constants.WRAPPER) QueryWrapper<ProtData> queryWrapper);
-    List<ProtData> listFlow(@Param(Constants.WRAPPER) QueryWrapper<ProtData> queryWrapper);
+    List<ProCountVo> listPh(@Param(Constants.WRAPPER) QueryWrapper<ProtData> queryWrapper);
+    List<ProCountVo> listCod(@Param(Constants.WRAPPER) QueryWrapper<ProtData> queryWrapper);
+    List<ProCountVo> listNh3n(@Param(Constants.WRAPPER) QueryWrapper<ProtData> queryWrapper);
+    List<ProCountVo> listTp(@Param(Constants.WRAPPER) QueryWrapper<ProtData> queryWrapper);
+    List<ProCountVo> listTn(@Param(Constants.WRAPPER) QueryWrapper<ProtData> queryWrapper);
+    List<ProCountVo> listFlow(@Param(Constants.WRAPPER) QueryWrapper<ProtData> queryWrapper);
 }

+ 4 - 4
huimv-admin/src/main/java/com/huimv/admin/service/impl/EnvDeviceMaintainServiceImpl.java

@@ -40,7 +40,7 @@ public class EnvDeviceMaintainServiceImpl extends ServiceImpl<EnvDeviceMaintainM
         String farmId = paramsMap.get("farmId");
         String deviceId = paramsMap.get("deviceId");
         QueryWrapper<EnvDeviceMaintain> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("device_id", deviceId).eq("farm_id", farmId);
+        queryWrapper.eq("device_id", deviceId).eq("farm_id", farmId).orderByDesc("maintain_time");
         return new Result(ResultCode.SUCCESS,envDeviceMaintainMapper.selectList(queryWrapper));
     }
 
@@ -51,11 +51,11 @@ public class EnvDeviceMaintainServiceImpl extends ServiceImpl<EnvDeviceMaintainM
         String maintainContent = paramsMap.get("maintainContent");
         String remark = paramsMap.get("remark");
 
-        DateTime dateTime = DateUtil.beginOfDay(new Date());
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Date dateTime = new Date();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         String format = simpleDateFormat.format(dateTime);
         Date date = null;
-        SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd");
+        SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         try {
             date = simpleDateFormat1.parse(format);
         } catch (ParseException e) {

+ 266 - 136
huimv-admin/src/main/java/com/huimv/admin/service/impl/ProtDataServiceImpl.java

@@ -11,6 +11,7 @@ import com.huimv.admin.common.utils.ResultCode;
 import com.huimv.admin.entity.ProtData;
 import com.huimv.admin.entity.ProtWarningInfo;
 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.mapper.ProtDataMapper;
 import com.huimv.admin.mapper.ProtWarningInfoMapper;
@@ -64,17 +65,23 @@ public class ProtDataServiceImpl extends ServiceImpl<ProtDataMapper, ProtData> i
                 startTime = startTime + " 00:00:00";
                 endTime = endTime + " 23:59:59";
                 queryWrapper.between("create_date",startTime, endTime);
-
                 queryWrapper.eq("loction_type" ,1);
-                List<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listPh(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                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.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                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);
 
 
@@ -85,35 +92,44 @@ public class ProtDataServiceImpl extends ServiceImpl<ProtDataMapper, ProtData> i
                 Calendar dateTime = Calendar.getInstance();
                 int i = dateTime.get(Calendar.YEAR);
                 // DateTime dateTime = DateUtil.beginOfYear(new Date());
-                queryWrapper.ge("create_date",i );
+                queryWrapper.ge("create_date", i);
                 queryWrapper.eq("loction_type" ,1);
-                List<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listPh(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
+                queryWrapper2.eq("farm_id",farmId).ge("create_date", i);
+                queryWrapper2.eq("loction_type" ,2);
+                List<ProCountVo> protData2 = protDataMapper.listPh(queryWrapper2);
                 proCountDto.setDealList(protData2);
 
-                queryWrapper.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
+                queryWrapper3.eq("farm_id",farmId).ge("create_date", i);
+                queryWrapper3.eq("loction_type" ,3);
+                List<ProCountVo> protData3 = protDataMapper.listPh(queryWrapper3);
                 proCountDto.setOutList(protData3);
 
 
+
             }
             //本月
             else if ("2".equals(type)) {
                 Date timesMonthmorning = DataUill.getTimesMonthmorning();
                 queryWrapper.ge("create_date", timesMonthmorning);
                 queryWrapper.eq("loction_type" ,1);
-                List<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listPh(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                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.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                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);
 
 
@@ -123,77 +139,98 @@ public class ProtDataServiceImpl extends ServiceImpl<ProtDataMapper, ProtData> i
                 Calendar calendar = Calendar.getInstance();
                 calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) - 7);
                 Date dateTime = calendar.getTime();
-                queryWrapper.ge("create_date", dateTime);
 
+                queryWrapper.ge("create_date", dateTime);
                 queryWrapper.eq("loction_type" ,1);
-                List<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listPh(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                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.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                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)) {
+        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<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listCod(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                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.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                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);
 
 
+                // 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", dateTime.get(Calendar.YEAR));
+                queryWrapper.ge("create_date", i);
                 queryWrapper.eq("loction_type" ,1);
-                List<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listCod(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
+                queryWrapper2.eq("farm_id",farmId).ge("create_date", i);
+                queryWrapper2.eq("loction_type" ,2);
+                List<ProCountVo> protData2 = protDataMapper.listCod(queryWrapper2);
                 proCountDto.setDealList(protData2);
 
-                queryWrapper.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
+                queryWrapper3.eq("farm_id",farmId).ge("create_date", i);
+                queryWrapper3.eq("loction_type" ,3);
+                List<ProCountVo> protData3 = protDataMapper.listCod(queryWrapper3);
                 proCountDto.setOutList(protData3);
 
 
+
             }
             //本月
             else if ("2".equals(type)) {
                 Date timesMonthmorning = DataUill.getTimesMonthmorning();
                 queryWrapper.ge("create_date", timesMonthmorning);
                 queryWrapper.eq("loction_type" ,1);
-                List<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listCod(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                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.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                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);
 
 
@@ -203,76 +240,98 @@ public class ProtDataServiceImpl extends ServiceImpl<ProtDataMapper, ProtData> i
                 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<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listCod(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                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.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                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)) {
+        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<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listNh3n(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                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.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                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", dateTime.get(Calendar.YEAR));
+                queryWrapper.ge("create_date", i);
                 queryWrapper.eq("loction_type" ,1);
-                List<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listNh3n(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
+                queryWrapper2.eq("farm_id",farmId).ge("create_date", i);
+                queryWrapper2.eq("loction_type" ,2);
+                List<ProCountVo> protData2 = protDataMapper.listNh3n(queryWrapper2);
                 proCountDto.setDealList(protData2);
 
-                queryWrapper.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
+                queryWrapper3.eq("farm_id",farmId).ge("create_date", i);
+                queryWrapper3.eq("loction_type" ,3);
+                List<ProCountVo> protData3 = protDataMapper.listNh3n(queryWrapper3);
                 proCountDto.setOutList(protData3);
 
 
+
             }
             //本月
             else if ("2".equals(type)) {
                 Date timesMonthmorning = DataUill.getTimesMonthmorning();
                 queryWrapper.ge("create_date", timesMonthmorning);
                 queryWrapper.eq("loction_type" ,1);
-                List<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listNh3n(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                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.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                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);
 
 
@@ -282,17 +341,22 @@ public class ProtDataServiceImpl extends ServiceImpl<ProtDataMapper, ProtData> i
                 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<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listNh3n(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                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.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                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);
 
 
@@ -305,53 +369,70 @@ public class ProtDataServiceImpl extends ServiceImpl<ProtDataMapper, ProtData> i
                 endTime = endTime + " 23:59:59";
                 queryWrapper.between("create_date",startTime, endTime);
                 queryWrapper.eq("loction_type" ,1);
-                List<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listTp(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                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.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                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", dateTime.get(Calendar.YEAR));
+                queryWrapper.ge("create_date", i);
                 queryWrapper.eq("loction_type" ,1);
-                List<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listTp(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
+                queryWrapper2.eq("farm_id",farmId).ge("create_date", i);
+                queryWrapper2.eq("loction_type" ,2);
+                List<ProCountVo> protData2 = protDataMapper.listTp(queryWrapper2);
                 proCountDto.setDealList(protData2);
 
-                queryWrapper.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
+                queryWrapper3.eq("farm_id",farmId).ge("create_date", i);
+                queryWrapper3.eq("loction_type" ,3);
+                List<ProCountVo> protData3 = protDataMapper.listTp(queryWrapper3);
                 proCountDto.setOutList(protData3);
 
 
+
             }
             //本月
             else if ("2".equals(type)) {
                 Date timesMonthmorning = DataUill.getTimesMonthmorning();
                 queryWrapper.ge("create_date", timesMonthmorning);
                 queryWrapper.eq("loction_type" ,1);
-                List<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listTp(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                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.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                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);
 
 
@@ -361,76 +442,98 @@ public class ProtDataServiceImpl extends ServiceImpl<ProtDataMapper, ProtData> i
                 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<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listTp(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                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.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                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)) {
+        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<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listTn(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                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.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                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", dateTime.get(Calendar.YEAR));
+                queryWrapper.ge("create_date", i);
                 queryWrapper.eq("loction_type" ,1);
-                List<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listTn(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
+                queryWrapper2.eq("farm_id",farmId).ge("create_date", i);
+                queryWrapper2.eq("loction_type" ,2);
+                List<ProCountVo> protData2 = protDataMapper.listTn(queryWrapper2);
                 proCountDto.setDealList(protData2);
 
-                queryWrapper.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
+                queryWrapper3.eq("farm_id",farmId).ge("create_date", i);
+                queryWrapper3.eq("loction_type" ,3);
+                List<ProCountVo> protData3 = protDataMapper.listTn(queryWrapper3);
                 proCountDto.setOutList(protData3);
 
 
+
             }
             //本月
             else if ("2".equals(type)) {
                 Date timesMonthmorning = DataUill.getTimesMonthmorning();
                 queryWrapper.ge("create_date", timesMonthmorning);
                 queryWrapper.eq("loction_type" ,1);
-                List<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listTn(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                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.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                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);
 
 
@@ -440,17 +543,22 @@ public class ProtDataServiceImpl extends ServiceImpl<ProtDataMapper, ProtData> i
                 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<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listTn(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                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.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                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);
 
 
@@ -463,53 +571,70 @@ public class ProtDataServiceImpl extends ServiceImpl<ProtDataMapper, ProtData> i
                 endTime = endTime + " 23:59:59";
                 queryWrapper.between("create_date",startTime, endTime);
                 queryWrapper.eq("loction_type" ,1);
-                List<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listFlow(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                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.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                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", dateTime.get(Calendar.YEAR));
+                queryWrapper.ge("create_date", i);
                 queryWrapper.eq("loction_type" ,1);
-                List<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listFlow(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                QueryWrapper<ProtData> queryWrapper2 = new QueryWrapper<>();
+                queryWrapper2.eq("farm_id",farmId).ge("create_date", i);
+                queryWrapper2.eq("loction_type" ,2);
+                List<ProCountVo> protData2 = protDataMapper.listFlow(queryWrapper2);
                 proCountDto.setDealList(protData2);
 
-                queryWrapper.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                QueryWrapper<ProtData> queryWrapper3 = new QueryWrapper<>();
+                queryWrapper3.eq("farm_id",farmId).ge("create_date", i);
+                queryWrapper3.eq("loction_type" ,3);
+                List<ProCountVo> protData3 = protDataMapper.listFlow(queryWrapper3);
                 proCountDto.setOutList(protData3);
 
 
+
             }
             //本月
             else if ("2".equals(type)) {
                 Date timesMonthmorning = DataUill.getTimesMonthmorning();
                 queryWrapper.ge("create_date", timesMonthmorning);
                 queryWrapper.eq("loction_type" ,1);
-                List<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listFlow(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                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.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                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);
 
 
@@ -519,17 +644,22 @@ public class ProtDataServiceImpl extends ServiceImpl<ProtDataMapper, ProtData> i
                 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<ProtData> protData1 = protDataMapper.listPh(queryWrapper);
+                List<ProCountVo> protData1 = protDataMapper.listFlow(queryWrapper);
                 proCountDto.setInList(protData1);
 
-                queryWrapper.eq("loction_type" ,2);
-                List<ProtData> protData2 = protDataMapper.listPh(queryWrapper);
+                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.eq("loction_type" ,3);
-                List<ProtData> protData3 = protDataMapper.listPh(queryWrapper);
+                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);
 
 

huimv-admin/src/main/resources/mapper/ProdAnalysisMapper.xml → huimv-admin/src/main/resources/com/huimv/admin/mapper/ProdAnalysisMapper.xml


huimv-admin/src/main/resources/mapper/ProdBaseMapper.xml → huimv-admin/src/main/resources/com/huimv/admin/mapper/ProdBaseMapper.xml


huimv-admin/src/main/resources/mapper/ProdProductionMapper.xml → huimv-admin/src/main/resources/com/huimv/admin/mapper/ProdProductionMapper.xml


huimv-admin/src/main/resources/mapper/ProdSaleMapper.xml → huimv-admin/src/main/resources/com/huimv/admin/mapper/ProdSaleMapper.xml


huimv-admin/src/main/resources/mapper/ProdStockMapper.xml → huimv-admin/src/main/resources/com/huimv/admin/mapper/ProdStockMapper.xml


+ 18 - 6
huimv-admin/src/main/resources/com/huimv/admin/mapper/ProtDataMapper.xml

@@ -20,27 +20,39 @@
         <result column="create_date" property="createDate" />
     </resultMap>
     <select id="listPh" resultType="com.huimv.admin.entity.vo.ProCountVo">
-        select ph 'value',create_date,loction_type from prot_data
+        select Convert((IFNULL(AVG(ph),0)),DECIMAL(10,2)) 'value',create_date,loction_type from prot_data
         ${ew.customSqlSegment}
+        group BY DATE_FORMAT(create_date,'%Y-%m-%d')
+        ORDER BY create_date ASC
     </select>
     <select id="listCod" resultType="com.huimv.admin.entity.vo.ProCountVo">
-        select cod 'value',create_date,loction_type from prot_data
+        select Convert((IFNULL(AVG(cod),0)),DECIMAL(10,2)) 'value',create_date,loction_type from prot_data
         ${ew.customSqlSegment}
+        group BY DATE_FORMAT(create_date,'%Y-%m-%d')
+        ORDER BY create_date ASC
     </select>
     <select id="listNh3n" resultType="com.huimv.admin.entity.vo.ProCountVo">
-        select NH3N 'value',create_date,loction_type from prot_data
+        select Convert((IFNULL(AVG(NH3N),0)),DECIMAL(10,2)) 'value',create_date,loction_type from prot_data
         ${ew.customSqlSegment}
+        group BY DATE_FORMAT(create_date,'%Y-%m-%d')
+        ORDER BY create_date ASC
     </select>
     <select id="listTp" resultType="com.huimv.admin.entity.vo.ProCountVo">
-        select TP 'value',create_date,loction_type from prot_data
+        select Convert((IFNULL(AVG(TP),0)),DECIMAL(10,2)) 'value',create_date,loction_type from prot_data
         ${ew.customSqlSegment}
+        group BY DATE_FORMAT(create_date,'%Y-%m-%d')
+        ORDER BY create_date ASC
     </select>
     <select id="listTn" resultType="com.huimv.admin.entity.vo.ProCountVo">
-        select TN 'value',create_date,loction_type from prot_data
+        select Convert((IFNULL(AVG(TN),0)),DECIMAL(10,2)) 'value',create_date,loction_type from prot_data
         ${ew.customSqlSegment}
+        group BY DATE_FORMAT(create_date,'%Y-%m-%d')
+        ORDER BY create_date ASC
     </select>
     <select id="listFlow" resultType="com.huimv.admin.entity.vo.ProCountVo">
-        select FLOW 'value',create_date,loction_type from prot_data
+        select Convert((IFNULL(AVG(FLOW),0)),DECIMAL(10,2)) 'value',create_date,loction_type from prot_data
         ${ew.customSqlSegment}
+        group BY DATE_FORMAT(create_date,'%Y-%m-%d')
+        ORDER BY create_date ASC
     </select>
 </mapper>

+ 0 - 23
huimv-admin/src/main/resources/mapper/ProtDataMapper.xml

@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.huimv.admin.mapper.ProtDataMapper">
-
-    <!-- 通用查询映射结果 -->
-    <resultMap id="BaseResultMap" type="com.huimv.admin.entity.ProtData">
-        <id column="id" property="id" />
-        <result column="loction_type" property="loctionType" />
-        <result column="ph" property="ph" />
-        <result column="cod" property="cod" />
-        <result column="NH3N" property="nh3n" />
-        <result column="TP" property="tp" />
-        <result column="TN" property="tn" />
-        <result column="FLOW" property="flow" />
-        <result column="original_data" property="originalData" />
-        <result column="farm_id" property="farmId" />
-        <result column="other1" property="other1" />
-        <result column="other2" property="other2" />
-        <result column="other3" property="other3" />
-        <result column="create_date" property="createDate" />
-    </resultMap>
-
-</mapper>