Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 70d8886d
authored
Oct 13, 2023
by
刘鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 日期范围限制实现变更
1 parent
61fdd5fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
project-order/src/main/java/com/dituhui/pea/order/controller/PeaApiController.java
project-order/src/main/java/com/dituhui/pea/order/controller/PeaApiController.java
View file @
70d8886
package
com
.
dituhui
.
pea
.
order
.
controller
;
import
cn.hutool.core.date.LocalDateTimeUtil
;
import
com.dituhui.pea.common.BusinessException
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.dto.OrganizationTreeDTO
;
...
...
@@ -28,6 +29,7 @@ import org.springframework.web.bind.annotation.RestController;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.time.Duration
;
import
java.time.Period
;
import
java.util.Date
;
...
...
@@ -109,12 +111,14 @@ public class PeaApiController {
@PostMapping
(
"/capacity/query"
)
public
Result
<
CapacityQueryDTO
.
Result
>
capacityQuery
(
@Validated
@RequestBody
CapacityQueryDTO
.
Request
reqDTO
)
{
//查询日期起止参数限制为一月
Period
between
=
Period
.
between
(
DateUtil
.
fromDate
(
reqDTO
.
getBeginDate
()).
toLocalDate
(),
DateUtil
.
fromDate
(
reqDTO
.
getEndDate
()).
toLocalDate
(
));
if
(
between
.
getMonths
()
>
1
)
{
Duration
between
=
LocalDateTimeUtil
.
between
(
DateUtil
.
fromDate
(
reqDTO
.
getBeginDate
()),
DateUtil
.
fromDate
(
reqDTO
.
getEndDate
()
));
if
(
between
.
toDays
()>
3
1
)
{
throw
new
BusinessException
(
"查询日期起止参数限制为一月"
);
}
CapacityQueryDTO
.
Result
result
=
new
CapacityQueryDTO
.
Result
();
return
Result
.
success
(
result
);
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment