日期校验问题
This commit is contained in:
@@ -1,18 +1,4 @@
|
|||||||
/*
|
|
||||||
* Copyright 2019-2020 Zheng Jie
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package cn.ysk.cashier.controller.order;
|
package cn.ysk.cashier.controller.order;
|
||||||
|
|
||||||
import cn.ysk.cashier.annotation.Log;
|
import cn.ysk.cashier.annotation.Log;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import lombok.Data;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import cn.ysk.cashier.annotation.Query;
|
import cn.ysk.cashier.annotation.Query;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
@@ -74,4 +75,8 @@ public class TbOrderInfoQueryCriteria{
|
|||||||
private String tableName;
|
private String tableName;
|
||||||
|
|
||||||
private String productName;
|
private String productName;
|
||||||
|
|
||||||
|
public void setProductName(String productName) {
|
||||||
|
if(StringUtils.isNotBlank(productName)) this.productName = productName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,6 +103,9 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
|||||||
Date startTime, endTime;
|
Date startTime, endTime;
|
||||||
DateTime offsetMonth = cn.hutool.core.date.DateUtil.offsetMonth(new Date(), 3);
|
DateTime offsetMonth = cn.hutool.core.date.DateUtil.offsetMonth(new Date(), 3);
|
||||||
if (criteria.getCreatedAt() != null && criteria.getCreatedAt().size() == 2) {
|
if (criteria.getCreatedAt() != null && criteria.getCreatedAt().size() == 2) {
|
||||||
|
if (criteria.getCreatedAt().get(0) < System.currentTimeMillis() - 1000 * 60 * 60 * 24 * 90L) {
|
||||||
|
throw new BadRequestException("查询时间范围不能超过三个月");
|
||||||
|
}
|
||||||
Long startLong = criteria.getCreatedAt().get(0);
|
Long startLong = criteria.getCreatedAt().get(0);
|
||||||
Long endLong = criteria.getCreatedAt().get(1);
|
Long endLong = criteria.getCreatedAt().get(1);
|
||||||
|
|
||||||
@@ -110,9 +113,9 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
|||||||
endTime = new Date(endLong);
|
endTime = new Date(endLong);
|
||||||
|
|
||||||
// 如果开始时间小于三个月前,不查询
|
// 如果开始时间小于三个月前,不查询
|
||||||
if (startTime.before(offsetMonth)) {
|
// if (startTime.before(offsetMonth)) {
|
||||||
throw new BadRequestException("查询时间范围不能超过三个月");
|
// throw new BadRequestException("查询时间范围不能超过三个月");
|
||||||
}
|
// }
|
||||||
} else {
|
} else {
|
||||||
startTime = offsetMonth;
|
startTime = offsetMonth;
|
||||||
endTime = new Date();
|
endTime = new Date();
|
||||||
|
|||||||
Reference in New Issue
Block a user