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 b61c4907
authored
May 19, 2023
by
wangli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善获取工程师姓名列表
1 parent
aa92e818
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
8 deletions
project-order/src/main/java/com/alibaba/cloud/integration/order/service/impl/OrderServiceListServiceImpl.java
project-order/src/main/java/com/alibaba/cloud/integration/order/service/impl/OrderServiceListServiceImpl.java
View file @
b61c490
package
com
.
alibaba
.
cloud
.
integration
.
order
.
service
.
impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.alibaba.cloud.integration.common.BusinessException
;
import
com.alibaba.cloud.integration.common.Result
;
import
com.alibaba.cloud.integration.order.dao.OrderAppointmentDao
;
import
com.alibaba.cloud.integration.order.dao.OrderRequestDao
;
import
com.alibaba.cloud.integration.order.dto.OrderServiceList
;
import
com.alibaba.cloud.integration.order.dto.OrderServiceListResp
;
import
com.alibaba.cloud.integration.order.entity.Order
;
import
com.alibaba.cloud.integration.order.entity.OrderAppointment
;
import
com.alibaba.cloud.integration.order.entity.OrderRequest
;
import
com.alibaba.cloud.integration.order.entity.OrderTimeline
;
import
com.alibaba.cloud.integration.order.service.OrderServiceListService
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.antlr.v4.runtime.atn.SemanticContext
;
import
org.apache.logging.log4j.util.Strings
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -59,7 +63,7 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
orderIds
.
add
(
r
.
getOrderId
());
}
// 获取工程师姓名列表
HashMap
<
String
,
List
<
String
>>
engineerNames
=
this
.
GetEngineerNames
(
this
.
GetOrderAppointment
(
orderIds
));
HashMap
<
String
,
List
<
String
>>
engineerNames
=
this
.
getEngineerNames
(
this
.
GetOrderAppointments
(
orderIds
));
List
<
String
>
names
;
List
<
OrderServiceList
>
content
=
new
ArrayList
<>();
...
...
@@ -97,21 +101,34 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
}
public
List
<
OrderAppointment
>
GetOrderAppointment
(
List
<
String
>
orderIds
)
{
public
List
<
OrderAppointment
>
GetOrderAppointment
s
(
List
<
String
>
orderIds
)
{
// 获取指派单列表
if
(
CollectionUtil
.
isEmpty
(
orderIds
))
{
return
new
ArrayList
<
OrderAppointment
>();
}
LambdaQueryWrapper
<
OrderAppointment
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
in
(
OrderAppointment:
:
getOrderId
,
orderIds
);
return
orderAppointmentDao
.
selectList
(
lqw
);
}
public
HashMap
<
String
,
List
<
String
>>
GetEngineerNames
(
List
<
OrderAppointment
>
orders
){
return
null
;
public
HashMap
<
String
,
List
<
String
>>
getEngineerNames
(
List
<
OrderAppointment
>
orders
){
// 获取orderId最新订单对应的工程师姓名列表
HashMap
<
String
,
List
<
String
>>
enginnerNames
=
new
HashMap
<>();
Map
<
String
,
List
<
OrderAppointment
>>
g
=
this
.
groupOrderAppointments
(
orders
);
for
(
String
orderId:
g
.
keySet
())
{
List
<
String
>
names
=
new
ArrayList
<>();
for
(
OrderAppointment
o:
g
.
get
(
orderId
))
{
names
.
add
(
o
.
getEngineerName
());
}
enginnerNames
.
put
(
orderId
,
names
);
}
return
enginnerNames
;
}
public
HashMap
<
String
,
List
<
String
>>
GetOrderAppointments
(
List
<
OrderAppointment
>
orders
){
// 获取指派单工人姓名
HashMap
<
String
,
List
<
String
>>
map
=
new
HashMap
<>();
public
Map
<
String
,
List
<
OrderAppointment
>>
groupOrderAppointments
(
List
<
OrderAppointment
>
orders
){
// 获取orderId对应的最新的subOrderId的订单列表
// 根据orderId+subOrderId降序排序
Comparator
<
OrderAppointment
>
byOrderIdDesc
=
Comparator
.
comparing
(
OrderAppointment:
:
getOrderId
,
String
.
CASE_INSENSITIVE_ORDER
).
reversed
();
...
...
@@ -119,7 +136,22 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
Comparator
<
OrderAppointment
>
comp
=
byOrderIdDesc
.
thenComparing
(
bySuborderIdDesc
);
List
<
OrderAppointment
>
results
=
orders
.
stream
().
sorted
(
comp
).
collect
(
Collectors
.
toList
());
return
map
;
//获取orderId对应的最新的subOrderId的订单列表
String
orderId
=
""
;
String
subOrderId
=
""
;
List
<
OrderAppointment
>
items
=
new
ArrayList
<>();
for
(
OrderAppointment
o:
results
)
{
if
(
orderId
!=
o
.
getOrderId
())
{
orderId
=
o
.
getOrderId
();
subOrderId
=
o
.
getSuborderId
();
items
.
add
(
o
);
continue
;
}
if
(
subOrderId
==
o
.
getSuborderId
())
{
items
.
add
(
o
);
}
}
return
items
.
stream
().
collect
(
Collectors
.
groupingBy
(
OrderAppointment:
:
getOrderId
));
}
private
Integer
getEngNum
(
List
<
String
>
names
){
...
...
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