【修复bug】172(搜索结果未包含结束日期当天的数据)
This commit is contained in:
parent
2c7ab5cfa5
commit
a80905ecb4
|
|
@ -660,4 +660,19 @@ public class DateUtils extends PropertyEditorSupport {
|
|||
String result = sdf.format(Date.parse(str));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 在给定的日期上增加指定的时间单位数量。
|
||||
*
|
||||
* @param date 初始日期,操作的基础日期。
|
||||
* @param field 时间单位,例如Calendar.YEAR, Calendar.MONTH, Calendar.DAY_OF_MONTH等。
|
||||
* @param amount 要增加的数量,可以为负数以表示减少。
|
||||
* @return 返回操作后的新日期。
|
||||
*/
|
||||
public static Date add(Date date, int field, int amount) {
|
||||
Calendar cal = getCalendar();
|
||||
cal.setTime(date);
|
||||
cal.add(field, amount);
|
||||
return cal.getTime();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.nflg.product;
|
||||
|
||||
import com.nflg.product.util.DateUtils;
|
||||
import org.junit.Test;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* @author 曹鹏飞
|
||||
* @date 2024-03-04 14:07:45
|
||||
*/
|
||||
public class DateTimeTest {
|
||||
|
||||
@Test
|
||||
public void test1() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(2024, 2, 4);
|
||||
Date date1 = calendar.getTime();
|
||||
Date d1 = DateUtils.add(date1, Calendar.DAY_OF_MONTH, 1);
|
||||
System.out.println("d1: " + DateUtils.date2Str(d1, DateUtils.date_sdf.get()));
|
||||
calendar.set(2024, 2, 5);
|
||||
Date d2 = calendar.getTime();
|
||||
System.out.println("d2: " + DateUtils.date2Str(d2, DateUtils.date_sdf.get()));
|
||||
assertEquals(d1, d2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test2() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(2024, Calendar.FEBRUARY, 29);
|
||||
Date date1 = calendar.getTime();
|
||||
Date d1 = DateUtils.add(date1, Calendar.DAY_OF_MONTH, 1);
|
||||
System.out.println("d1: " + DateUtils.date2Str(d1, DateUtils.date_sdf.get()));
|
||||
calendar.set(2024, Calendar.MARCH, 1);
|
||||
Date d2 = calendar.getTime();
|
||||
System.out.println("d2: " + DateUtils.date2Str(d2, DateUtils.date_sdf.get()));
|
||||
assertEquals(d1, d2);
|
||||
}
|
||||
}
|
||||
|
|
@ -13,12 +13,11 @@ import com.nflg.product.bomnew.pojo.entity.BomNewMbomParentEntity;
|
|||
import com.nflg.product.bomnew.pojo.query.BomNewMbomParentQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO;
|
||||
import com.nflg.product.bomnew.service.domain.MBom.IndexListTree;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -60,7 +59,7 @@ public class BomNewMbomParentService extends ServiceImpl<BomNewMbomParentMapper,
|
|||
if (StrUtil.isNotBlank(query.getMaterialNo()) || StrUtil.isNotBlank(query.getDrawingNo())) {
|
||||
page = this.getBaseMapper().indexListPage(new Page<>(query.getPage(), query.getPageSize()), query);
|
||||
if (CollectionUtil.isNotEmpty(page.getRecords())) {
|
||||
List<BomNewMbomMiddleVO> indexList = page.getRecords().stream().collect(Collectors.toList());
|
||||
List<BomNewMbomMiddleVO> indexList = new ArrayList<>(page.getRecords());
|
||||
|
||||
page.getRecords().clear();
|
||||
for (BomNewMbomMiddleVO item :
|
||||
|
|
|
|||
|
|
@ -10,39 +10,25 @@ import cn.hutool.core.util.RandomUtil;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.util.TypeUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.mzt.logapi.context.LogRecordContext;
|
||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
import com.nflg.product.base.core.vo.PageVO;
|
||||
import com.nflg.product.bomnew.constant.BomConstant;
|
||||
import com.nflg.product.bomnew.constant.EBomConstant;
|
||||
import com.nflg.product.bomnew.constant.OptionalBomConstant;
|
||||
import com.nflg.product.bomnew.mapper.master.OptionalMbomMaterialMapper;
|
||||
|
||||
import com.nflg.product.bomnew.pojo.dto.OptionalMbomMaterialAddDTO;
|
||||
import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO;
|
||||
import com.nflg.product.bomnew.pojo.dto.sap.impart2.T1DTO;
|
||||
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.OptionalEbomConfigEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.OptionalMbomMaterialEntity;
|
||||
|
||||
import com.nflg.product.bomnew.pojo.query.BomNewEbomMaterialQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.OptionalMbomMaterialListQuery;
|
||||
|
||||
import com.nflg.product.bomnew.pojo.query.OptionalMbomMaterialQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.OptionalMbomMaterialListVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.OptionalMbomMaterialVO;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import nflg.product.common.constant.STATE;
|
||||
import nflg.product.common.vo.ResultVO;
|
||||
|
|
@ -51,7 +37,6 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -73,7 +58,7 @@ public class OptionalMbomMaterialService extends ServiceImpl<OptionalMbomMateria
|
|||
if (StrUtil.isNotBlank(query.getMaterialNo()) || StrUtil.isNotBlank(query.getDrawingNo())) {
|
||||
page = this.getBaseMapper().indexListPage(new Page<>(query.getPage(), query.getPageSize()), query);
|
||||
if (CollectionUtil.isNotEmpty(page.getRecords())) {
|
||||
List<OptionalMbomMaterialListVO> indexList = page.getRecords().stream().collect(Collectors.toList());
|
||||
List<OptionalMbomMaterialListVO> indexList = new ArrayList<>(page.getRecords());
|
||||
page.getRecords().clear();
|
||||
|
||||
for(OptionalMbomMaterialListVO item :
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import com.nflg.product.bomnew.constant.EBomSourceEnum;
|
|||
import com.nflg.product.bomnew.constant.EbomEditStatusEnum;
|
||||
import com.nflg.product.bomnew.constant.ProjectTypeInputTypeEnum;
|
||||
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
|
||||
import com.nflg.product.bomnew.pojo.dto.AddMaterialMainDTO;
|
||||
import com.nflg.product.bomnew.pojo.dto.AddVirtrualMaterialDTO;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||
|
|
@ -23,8 +22,6 @@ import com.nflg.product.bomnew.service.MaterialService;
|
|||
import com.nflg.product.bomnew.util.VersionUtil;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import org.apache.catalina.authenticator.jaspic.CallbackHandlerImpl;
|
||||
import sun.security.krb5.internal.PAData;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@
|
|||
|
||||
<if test="query.status!=null and query.status==1">
|
||||
<if test="query.startDate!=null and query.startDate!='' and query.endDate!=null and query.endDate!=''">
|
||||
<![CDATA[ and created_time >= #{query.startDate} and created_time <=#{query.endDate}]]>
|
||||
<![CDATA[ and created_time between #{query.startDate} and DATE_ADD(#{query.endDate}, INTERVAL 1 DAY) ]]>
|
||||
</if>
|
||||
</if>
|
||||
|
||||
|
|
@ -88,7 +88,7 @@
|
|||
|
||||
<if test="query.status!=null and query.status==3">
|
||||
<if test="query.startDate!=null and query.startDate!='' and query.endDate!=null and query.endDate!=''">
|
||||
<![CDATA[ and sysn_sap_time >= #{query.startDate} and sysn_sap_time <=#{query.endDate}]]>
|
||||
<![CDATA[ and sysn_sap_time between #{query.startDate} and DATE_ADD(#{query.endDate}, INTERVAL 1 DAY) ]]>
|
||||
</if>
|
||||
</if>
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
|
||||
|
||||
<if test="query.startDate!= null and query.startDate!= '' and query.endDate != null and query.endDate!= '' ">
|
||||
<![CDATA[and t1.created_time >= #{query.startDate} and t1.created_time <= #{query.endDate} ]]>
|
||||
<![CDATA[and t1.created_time between #{query.startDate} and DATE_ADD(#{query.endDate}, INTERVAL 1 DAY) ]]>
|
||||
</if>
|
||||
|
||||
order by t1.created_time desc
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
</if>
|
||||
|
||||
<if test="query.startDate != null and query.startDate != '' and query.endDate != null and query.endDate != ''">
|
||||
<![CDATA[ and created_time >= #{query.startDate} and created_time <= #{query.endDate}]]>
|
||||
<![CDATA[ and created_time between #{query.startDate} and DATE_ADD(#{query.endDate}, INTERVAL 1 DAY) ]]>
|
||||
</if>
|
||||
|
||||
<if test="query.realName != null and query.realName != ''">
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ row_id,parent_row_id,level_row_id,material_no,material_name,material_desc,drawin
|
|||
</if>
|
||||
|
||||
<if test="query.startDate != null and query.startDate != '' and query.endDate != null and query.endDate != null">
|
||||
<![CDATA[ and t1.created_time >= #{query.startDate} and t1.created_time <= #{query.endDate}]]>
|
||||
<![CDATA[ and t1.created_time between #{query.startDate} and DATE_ADD(#{query.endDate}, INTERVAL 1 DAY) ]]>
|
||||
</if>
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue