Browse Source

添加查询的限制 前一天和当前最大的时间比较取最小的

master
rui_li 1 month ago
parent
commit
6b591af2e6
  1. 16
      src/main/java/com/spring/ifs/bean/BaseSearchBean.java

16
src/main/java/com/spring/ifs/bean/BaseSearchBean.java

@ -19,10 +19,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
/** /**
* @description: 基础查询的实现类 * @description: 基础查询的实现类
@ -253,13 +252,20 @@ public class BaseSearchBean {
public List<PartIfsInventory> getInventoryParts(Server srv, BaseSearchData inData) throws APException { public List<PartIfsInventory> getInventoryParts(Server srv, BaseSearchData inData) throws APException {
//查询的参数 //查询的参数
String ifsRowVersion = inData.getIfsRowVersion(); String ifsRowVersion = inData.getIfsRowVersion();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
logger.info("库存件查询的请求参数:"+ifsRowVersion); logger.info("库存件查询的请求参数:"+ifsRowVersion);
LocalDateTime ifsTimeRevision = LocalDateTime.parse(ifsRowVersion, formatter);
//获取一天前的时间
LocalDateTime localDateTime = LocalDateTime.now().minusDays(1);
LocalDateTime minTime = localDateTime.isBefore(ifsTimeRevision) ? localDateTime : ifsTimeRevision;
String ifsRowVersionSearch = minTime.format(formatter);
logger.info("库存件查询的请求参数:"+ifsRowVersionSearch);
List<PartIfsInventory> resultList = new ArrayList<>(); List<PartIfsInventory> resultList = new ArrayList<>();
int pageSize = 200; int pageSize = 200;
//迭代查询 //迭代查询
for(int i = 0; i < 10; i++){ for(int i = 0; i < 10; i++){
int startIndex = i * pageSize; int startIndex = i * pageSize;
List<PartIfsInventory> tempList = BaseSearchApi.getInventoryParts(srv, ifsRowVersion, startIndex, pageSize);
List<PartIfsInventory> tempList = BaseSearchApi.getInventoryParts(srv, ifsRowVersionSearch, startIndex, pageSize);
//判断查询是否结束 //判断查询是否结束
if(tempList.size() > 0) { if(tempList.size() > 0) {
resultList.addAll(tempList); resultList.addAll(tempList);

Loading…
Cancel
Save