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 45d166f7
authored
Jun 13, 2023
by
wangli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
实现工单太技术员订单列表
1 parent
e0a75f38
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
21 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 @
45d166f
...
...
@@ -2,6 +2,7 @@ package com.alibaba.cloud.integration.order.service.impl;
import
com.alibaba.cloud.integration.common.Result
;
import
com.alibaba.cloud.integration.order.dao.*
;
import
com.alibaba.cloud.integration.order.dto.DispatchEngineerOrderListResp
;
import
com.alibaba.cloud.integration.order.dto.DispatchOrderListResp
;
import
com.alibaba.cloud.integration.order.entity.*
;
import
com.alibaba.cloud.integration.order.service.DispatchService
;
...
...
@@ -12,10 +13,7 @@ import org.springframework.transaction.annotation.Transactional;
import
java.sql.Timestamp
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
interface
GroupTag
{
...
...
@@ -91,6 +89,10 @@ public class DispatchServiceImpl implements DispatchService {
@Transactional
@Override
public
Result
<?>
getDispatchEngineerOrderList
(
String
levelType
,
List
<
String
>
levelIds
,
String
date
)
{
// 获取技能耗时
HashMap
<
String
,
Integer
>
skillTakeTime
=
this
.
querySkillTakeTime
();
// 获取groupIds
List
<
String
>
groupIds
=
this
.
queryOrgGroupIds
(
levelType
,
levelIds
);
...
...
@@ -100,17 +102,57 @@ public class DispatchServiceImpl implements DispatchService {
// 获取engineerCodes
List
<
String
>
engineerCodes
=
engineers
.
stream
().
map
(
EngineerInfo:
:
getEngineerCode
).
collect
(
Collectors
.
toList
());
// 获取技术员订单ID列表
HashMap
<
String
,
List
<
String
>>
engineerOrders
=
this
.
queryEngineerOrderId
s
(
engineerCodes
,
date
);
// 获取技术员订单ID列表
HashMap<engineerCode, List<orderId>>
Map
<
String
,
List
<
OrderAppointment
>>
engineerOrders
=
this
.
queryEngineerOrder
s
(
engineerCodes
,
date
);
// 获取订单列表
List
<
String
>
orderIds
=
new
ArrayList
<>();
// 获取订单ID
Set
<
String
>
orderIds
=
new
HashSet
<>();
for
(
String
k:
engineerOrders
.
keySet
()){
for
(
OrderAppointment
o:
engineerOrders
.
get
(
k
))
{
orderIds
.
add
(
o
.
getOrderId
());
}
}
// 获取订单列表
List
<
OrderRequest
>
orders
=
this
.
queryOrderRequestByOrderIds
(
orderIds
);
Map
<
String
,
List
<
OrderRequest
>>
orders
=
this
.
queryOrderRequestByOrderIds
(
new
ArrayList
<>(
orderIds
)).
stream
().
collect
(
Collectors
.
groupingBy
(
OrderRequest:
:
getOrderId
));
List
<
DispatchEngineerOrderListResp
.
EngineerInfo
>
egs
=
new
ArrayList
<>();
for
(
EngineerInfo
e
:
engineers
)
{
DispatchEngineerOrderListResp
.
EngineerInfo
eg
=
new
DispatchEngineerOrderListResp
.
EngineerInfo
();
eg
.
setEngineerCode
(
e
.
getEngineerCode
());
eg
.
setEngineerName
(
e
.
getName
());
eg
.
setCapacity
(
""
);
eg
.
setCapacityStatus
(
""
);
eg
.
setCertificate
(
e
.
getCredentials
());
List
<
DispatchEngineerOrderListResp
.
OrderInfo
>
items
=
new
ArrayList
<>();
for
(
OrderAppointment
r:
engineerOrders
.
get
(
e
.
getEngineerCode
()))
{
DispatchEngineerOrderListResp
.
OrderInfo
item
=
new
DispatchEngineerOrderListResp
.
OrderInfo
();
// 获取订单信息
OrderRequest
o
=
orders
.
get
(
r
.
getEngineerCode
()).
get
(
0
);
item
.
setOrderId
(
r
.
getOrderId
());
item
.
setCategory
(
String
.
format
(
"%s-%s"
,
o
.
getType
(),
o
.
getBrand
()));
item
.
setSkill
(
o
.
getSkill
());
item
.
setRemark
(
o
.
getApplyNote
());
item
.
setCustomerName
(
o
.
getName
());
item
.
setOrderStatus
(
r
.
getStatus
());
// 预约单状态
item
.
setOrderStatusDesc
(
r
.
getStatus
());
// 预约单状态描述, TODO
String
description
=
String
.
format
(
"%s:%s%s-%s\n%s:%s"
,
o
.
getOrderId
(),
o
.
getSkill
(),
o
.
getType
(),
o
.
getBrand
(),
o
.
getName
(),
o
.
getAddress
());
item
.
setDescription
(
description
);
String
key
=
String
.
format
(
"%s%s%s"
,
o
.
getBrand
(),
o
.
getType
(),
o
.
getSkill
());
item
.
setDuration
(
skillTakeTime
.
getOrDefault
(
key
,
30
));
String
time
=
this
.
timestamp2Datetime
(
o
.
getExpectTimeBegin
(),
"HH:mm"
);
String
timeSlot
=
this
.
parseTimeSlot
(
o
.
getExpectTimeBegin
());
item
.
setIntentionTime
(
String
.
format
(
"%s/%s"
,
time
,
timeSlot
));
items
.
add
(
item
);
}
}
return
null
;
...
...
@@ -147,10 +189,10 @@ public class DispatchServiceImpl implements DispatchService {
return
orderRequestMPDao
.
selectList
(
lqw
);
}
private
HashMap
<
String
,
List
<
String
>>
queryEngineerOrderId
s
(
List
<
String
>
engineerCodes
,
String
date
)
{
private
Map
<
String
,
List
<
OrderAppointment
>>
queryEngineerOrder
s
(
List
<
String
>
engineerCodes
,
String
date
)
{
// 获取工程师服务单列表
HashMap
<
String
,
List
<
String
>>
map
=
new
HashMap
<>();
Map
<
String
,
List
<
OrderAppointment
>>
map
=
new
HashMap
<>();
LambdaQueryWrapper
<
OrderAppointment
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
in
(
OrderAppointment:
:
getEngineerCode
,
engineerCodes
);
...
...
@@ -158,17 +200,12 @@ public class DispatchServiceImpl implements DispatchService {
lqw
.
le
(
OrderAppointment:
:
getExpectTime
,
this
.
getTimestampFromDate
(
date
,
"23:59:59"
));
lqw
.
select
(
OrderAppointment:
:
getEngineerCode
,
OrderAppointment:
:
getOrderId
);
lqw
.
orderByAsc
(
OrderAppointment:
:
getEngineerCode
);
lqw
.
orderByAsc
(
OrderAppointment:
:
getExpectTime
);
List
<
OrderAppointment
>
records
=
orderAppointmentMPDao
.
selectList
(
lqw
);
Map
<
String
,
List
<
OrderAppointment
>>
gg
=
records
.
stream
().
collect
(
Collectors
.
groupingBy
(
OrderAppointment:
:
getEngineerCode
));
return
records
.
stream
().
collect
(
Collectors
.
groupingBy
(
OrderAppointment:
:
getEngineerCode
));
for
(
String
engineerCode
:
gg
.
keySet
())
{
List
<
String
>
orderIds
=
new
ArrayList
<>();
for
(
OrderAppointment
o
:
gg
.
get
(
engineerCode
))
{
orderIds
.
add
(
o
.
getOrderId
());
}
map
.
put
(
engineerCode
,
orderIds
);
}
return
map
;
}
private
List
<
EngineerInfo
>
queryEngineers
(
List
<
String
>
groupIds
)
{
...
...
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