|
|
@@ -1,20 +1,24 @@
|
|
|
package com.ruoyi.app.service.impl;
|
|
|
|
|
|
+import java.time.ZoneId;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.ruoyi.app.DTO.JsReportDto;
|
|
|
-import com.ruoyi.app.mapper.DistributeBatchMapper;
|
|
|
-import com.ruoyi.app.mapper.EntranceInspectionMapper;
|
|
|
-import com.ruoyi.app.mapper.HarmlessTreatmentMapper;
|
|
|
+import com.ruoyi.app.mapper.*;
|
|
|
+import com.ruoyi.app.model.DivideCircle;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import com.ruoyi.app.mapper.EntranceBatchMapper;
|
|
|
import com.ruoyi.app.model.EntranceBatch;
|
|
|
import com.ruoyi.app.service.IEntranceBatchService;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
/**
|
|
|
* 入场批次Service业务层处理
|
|
|
@@ -36,6 +40,9 @@ public class EntranceBatchServiceImpl implements IEntranceBatchService {
|
|
|
@Autowired
|
|
|
private HarmlessTreatmentMapper harmlessTreatmentMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private DivideCircleMapper divideCircleMapper;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 查询入场批次
|
|
|
@@ -68,6 +75,30 @@ public class EntranceBatchServiceImpl implements IEntranceBatchService {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<EntranceBatch> selectEntranceBatchList2(EntranceBatch entranceBatch) {
|
|
|
+ List<EntranceBatch> list;
|
|
|
+ if(!ObjectUtils.isEmpty(entranceBatch.getEntranceTime())) {
|
|
|
+ //限定数据的日期范围
|
|
|
+ entranceBatch.setCreateTime(Date.from(entranceBatch.getEntranceTime().atZone(ZoneId.systemDefault()).toInstant()));
|
|
|
+ //检索出猪圈状态为开放的所有批次
|
|
|
+ List<DivideCircle> closedList = divideCircleMapper.selectList(new LambdaQueryWrapper<DivideCircle>().eq(DivideCircle::getStatusFlag, "closed"));
|
|
|
+ //过滤掉所有状态是closed的批次(保留状态是opened的批次以及还未分圈的批次)
|
|
|
+// list = entranceBatchMapper.selectEntranceBatchList1(entranceBatch).stream().filter(item1 -> openList.stream()
|
|
|
+// .anyMatch(item2 -> item2.getAnimalCertNo().equals(item1.getAnimalCertNo())))
|
|
|
+// .collect(Collectors.toList());
|
|
|
+ list = entranceBatchMapper.selectEntranceBatchList1(entranceBatch).stream()
|
|
|
+ .filter(item1 -> closedList.stream()
|
|
|
+ .noneMatch(item2 -> item2.getAnimalCertNo().equals(item1.getAnimalCertNo())))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ }else {
|
|
|
+ //如果输入参数不带时间,就按普通分页查询进行处理
|
|
|
+ list = entranceBatchMapper.selectEntranceBatchList1(entranceBatch);
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 校验检疫证号是否唯一
|
|
|
*
|