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 b10f663e
authored
Nov 07, 2023
by
刘鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pref: 界面改约容量查询接口变更 支持时间段, 半天容量
1 parent
df98b302
Hide 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 @
b10f663
...
@@ -257,10 +257,13 @@ public class CapacityUtils {
...
@@ -257,10 +257,13 @@ public class CapacityUtils {
long
remain
=
collect
.
stream
().
mapToLong
(
CapacityEngineerSliceUsedEntity:
:
getCapLeft
).
sum
();
long
remain
=
collect
.
stream
().
mapToLong
(
CapacityEngineerSliceUsedEntity:
:
getCapLeft
).
sum
();
segment
.
setRemain
(
remain
);
segment
.
setRemain
(
remain
);
segment
.
setStatus
(
totalTakeTime
<=
maxDuration
?
1
:
0
);
segment
.
setStatus
(
totalTakeTime
<=
maxDuration
?
1
:
0
);
long
totalCapacity
=
collect
.
stream
().
mapToLong
(
CapacityEngineerSliceUsedEntity:
:
getCapTotal
).
sum
();
segment
.
setTotalCapacity
(
totalCapacity
);
}
else
{
}
else
{
segment
.
setMaxDuration
(
0
);
segment
.
setMaxDuration
(
0
);
segment
.
setRemain
(
0
);
segment
.
setRemain
(
0
);
segment
.
setStatus
(
0
);
segment
.
setStatus
(
0
);
segment
.
setTotalCapacity
(
0
);
}
}
return
segment
;
return
segment
;
}
}
...
...
project-order/src/main/java/com/dituhui/pea/order/controller/OrderCreateController.java
View file @
b10f663
...
@@ -2,16 +2,24 @@ package com.dituhui.pea.order.controller;
...
@@ -2,16 +2,24 @@ package com.dituhui.pea.order.controller;
import
com.dituhui.pea.common.BusinessException
;
import
com.dituhui.pea.common.BusinessException
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.dto.OrderCreateReqDTO
;
import
com.dituhui.pea.order.dto.param.CapacityQueryDTO
;
import
com.dituhui.pea.order.dto.CapacityOrderQueryDTO
;
import
com.dituhui.pea.order.dto.param.OrderDTO
;
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.CapacityQueryService
;
import
com.dituhui.pea.order.service.OrderCreateService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
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
@RestController
@RequestMapping
(
"/pea-order"
)
@RequestMapping
(
"/pea-order"
)
public
class
OrderCreateController
{
public
class
OrderCreateController
{
...
@@ -44,14 +52,18 @@ public class OrderCreateController {
...
@@ -44,14 +52,18 @@ public class OrderCreateController {
return
res
;
return
res
;
}
}
/**
* 改约容量查询
*
* @param reqDTO 查询参数
* @return 返回日期范围内的容量信息
*/
@PostMapping
(
"/order/service/capacity/query"
)
@PostMapping
(
"/order/service/capacity/query"
)
public
Result
<?>
capacityQuery
(
@Validated
@RequestBody
CapacityOrderQueryDTO
.
Request
reqDTO
)
{
public
Result
<
CapacityQueryDTO
.
Result
>
capacityQuery
(
@Validated
@RequestBody
CapacityQueryDTO
.
Request
reqDTO
)
{
Result
<?>
res
=
null
;
//查询日期起止参数限制为一月
try
{
LocalDate
startDate
=
reqDTO
.
getBeginDate
().
toInstant
().
atZone
(
ZoneId
.
of
(
"+8"
)).
toLocalDate
();
res
=
capacityQueryService
.
queryMatchCapacityData
(
reqDTO
);
LocalDate
endDate
=
reqDTO
.
getEndDate
().
toInstant
().
atZone
(
ZoneId
.
of
(
"+8"
)).
toLocalDate
();
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
return
capacityQueryService
.
matchCapacityData
(
reqDTO
,
reqDTO
.
getServices
(),
reqDTO
.
getLocation
(),
startDate
,
endDate
);
}
return
res
;
}
}
}
}
project-order/src/main/java/com/dituhui/pea/order/dto/param/CapacityQueryDTO.java
View file @
b10f663
...
@@ -165,6 +165,11 @@ public class CapacityQueryDTO {
...
@@ -165,6 +165,11 @@ public class CapacityQueryDTO {
* 剩余容量
* 剩余容量
*/
*/
private
long
remain
;
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