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 8d77e4b3
authored
Nov 07, 2023
by
huangjinxin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
2 parents
b2caaad9
ea051d6f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
13 deletions
project-order/src/main/java/com/dituhui/pea/order/common/CapacityUtils.java
project-order/src/main/java/com/dituhui/pea/order/controller/OrderCreateController.java
project-order/src/main/java/com/dituhui/pea/order/dto/param/CapacityQueryDTO.java
project-order/src/main/java/com/dituhui/pea/order/common/CapacityUtils.java
View file @
8d77e4b
...
...
@@ -257,10 +257,13 @@ public class CapacityUtils {
long
remain
=
collect
.
stream
().
mapToLong
(
CapacityEngineerSliceUsedEntity:
:
getCapLeft
).
sum
();
segment
.
setRemain
(
remain
);
segment
.
setStatus
(
totalTakeTime
<=
maxDuration
?
1
:
0
);
long
totalCapacity
=
collect
.
stream
().
mapToLong
(
CapacityEngineerSliceUsedEntity:
:
getCapTotal
).
sum
();
segment
.
setTotalCapacity
(
totalCapacity
);
}
else
{
segment
.
setMaxDuration
(
0
);
segment
.
setRemain
(
0
);
segment
.
setStatus
(
0
);
segment
.
setTotalCapacity
(
0
);
}
return
segment
;
}
...
...
project-order/src/main/java/com/dituhui/pea/order/controller/OrderCreateController.java
View file @
8d77e4b
...
...
@@ -2,16 +2,24 @@ package com.dituhui.pea.order.controller;
import
com.dituhui.pea.common.BusinessException
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.dto.OrderCreateReqDTO
;
import
com.dituhui.pea.order.dto.CapacityOrderQueryDTO
;
import
com.dituhui.pea.order.dto.param.CapacityQueryDTO
;
import
com.dituhui.pea.order.dto.param.OrderDTO
;
import
com.dituhui.pea.order.service.OrderCreateService
;
import
com.dituhui.pea.order.service.CapacityQueryService
;
import
com.dituhui.pea.order.service.OrderCreateService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.time.LocalDate
;
import
java.time.ZoneId
;
/**
* 工单接口
*/
@RestController
@RequestMapping
(
"/pea-order"
)
public
class
OrderCreateController
{
...
...
@@ -44,14 +52,18 @@ public class OrderCreateController {
return
res
;
}
/**
* 改约容量查询
*
* @param reqDTO 查询参数
* @return 返回日期范围内的容量信息
*/
@PostMapping
(
"/order/service/capacity/query"
)
public
Result
<?>
capacityQuery
(
@Validated
@RequestBody
CapacityOrderQueryDTO
.
Request
reqDTO
)
{
Result
<?>
res
=
null
;
try
{
res
=
capacityQueryService
.
queryMatchCapacityData
(
reqDTO
);
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
}
return
res
;
public
Result
<
CapacityQueryDTO
.
Result
>
capacityQuery
(
@Validated
@RequestBody
CapacityQueryDTO
.
Request
reqDTO
)
{
//查询日期起止参数限制为一月
LocalDate
startDate
=
reqDTO
.
getBeginDate
().
toInstant
().
atZone
(
ZoneId
.
of
(
"+8"
)).
toLocalDate
();
LocalDate
endDate
=
reqDTO
.
getEndDate
().
toInstant
().
atZone
(
ZoneId
.
of
(
"+8"
)).
toLocalDate
();
return
capacityQueryService
.
matchCapacityData
(
reqDTO
,
reqDTO
.
getServices
(),
reqDTO
.
getLocation
(),
startDate
,
endDate
);
}
}
project-order/src/main/java/com/dituhui/pea/order/dto/param/CapacityQueryDTO.java
View file @
8d77e4b
...
...
@@ -165,6 +165,11 @@ public class CapacityQueryDTO {
* 剩余容量
*/
private
long
remain
;
/**
* 区间总容量
*/
private
long
totalCapacity
;
}
...
...
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