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 2d6ff345
authored
Jun 14, 2023
by
wangli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
1 parent
a10a207d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
2 deletions
project-order/src/main/java/com/alibaba/cloud/integration/order/service/impl/DispatchServiceImpl.java
project-order/src/main/java/com/alibaba/cloud/integration/order/service/impl/DispatchServiceImpl.java
View file @
2d6ff34
...
...
@@ -41,6 +41,9 @@ public class DispatchServiceImpl implements DispatchService {
@Autowired
private
ProductCategoryMPDao
productCategoryMPDao
;
@Autowired
private
CapacityEngineerStatMPDao
capacityEngineerStatMPDao
;
@Transactional
@Override
public
Result
<?>
getDispatchOrderList
(
String
levelType
,
List
<
String
>
levelIds
,
String
date
,
String
groupTagId
)
{
...
...
@@ -106,6 +109,9 @@ public class DispatchServiceImpl implements DispatchService {
// 获取技术员已指派单列表
Map
<
String
,
List
<
OrderAppointment
>>
engineerOrders
=
this
.
queryEngineerOrders
(
engineerCodes
,
date
);
// 获取技术员的容量
HashMap
<
String
,
CapacityEngineerStat
>
engineerCap
=
this
.
queryCapacityEngineerStat
(
engineerCodes
,
date
);
// 获取订单ID
Set
<
String
>
orderIds
=
new
HashSet
<>();
for
(
String
k
:
engineerOrders
.
keySet
())
{
...
...
@@ -155,13 +161,26 @@ public class DispatchServiceImpl implements DispatchService {
items
.
add
(
item
);
}
// 获取容量
int
capUsed
=
0
;
int
capTotal
=
0
;
String
capacityStatus
=
"less"
;
CapacityEngineerStat
cap
=
engineerCap
.
get
(
e
.
getEngineerCode
());
if
(
cap
!=
null
)
{
capUsed
=
cap
.
getCapUsed
();
capTotal
=
cap
.
getCapTotal
();
if
(
capTotal
>
0
&&
(
float
)
capUsed
/
capTotal
<
0.8
)
{
capacityStatus
=
"normal"
;
}
}
DispatchEngineerOrderListResp
.
EngineerInfo
eg
=
new
DispatchEngineerOrderListResp
.
EngineerInfo
();
eg
.
setOrders
(
items
);
eg
.
setEngineerCode
(
e
.
getEngineerCode
());
eg
.
setEngineerName
(
e
.
getName
());
eg
.
setCapacity
(
""
);
eg
.
setCapacityStatus
(
""
);
eg
.
setCertificate
(
e
.
getCredentials
());
eg
.
setCapacity
(
String
.
format
(
"%d/%d"
,
capUsed
,
capTotal
));
eg
.
setCapacityStatus
(
capacityStatus
);
egs
.
add
(
eg
);
}
...
...
@@ -245,6 +264,19 @@ public class DispatchServiceImpl implements DispatchService {
return
map
;
}
private
HashMap
<
String
,
CapacityEngineerStat
>
queryCapacityEngineerStat
(
List
<
String
>
engineerCodes
,
String
date
)
{
LambdaQueryWrapper
<
CapacityEngineerStat
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
eq
(
CapacityEngineerStat:
:
getWorkDay
,
date
);
lqw
.
in
(
CapacityEngineerStat:
:
getEngineerCode
,
engineerCodes
);
List
<
CapacityEngineerStat
>
records
=
capacityEngineerStatMPDao
.
selectList
(
lqw
);
HashMap
<
String
,
CapacityEngineerStat
>
map
=
new
HashMap
<>();
for
(
CapacityEngineerStat
r
:
records
)
{
map
.
put
(
r
.
getEngineerCode
(),
r
);
}
return
map
;
}
public
Timestamp
getTimestampFromDate
(
String
date
,
String
time
)
{
return
Timestamp
.
valueOf
(
date
+
" "
+
time
);
}
...
...
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