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 bc31c720
authored
Jul 28, 2023
by
chamberone
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
https://zhangguoping@gitlab.dituhui.com/bsh/project/pr…
…oject.git into develop
2 parents
4a0a8788
0811b007
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
25 deletions
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerTimelineServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerTimelineServiceImpl.java
View file @
bc31c72
...
...
@@ -21,18 +21,12 @@ import java.util.stream.Stream;
public
class
EngineerTimelineServiceImpl
implements
EngineerTimelineService
{
@Autowired
private
EngineerTimelineMPDao
engineerTimelineMPDao
;
@Autowired
private
OrderAppointmentMPDao
orderAppointmentMPDao
;
private
OrderInfoMPDao
orderInfoMPDao
;
@Autowired
private
EngineerInfoMPDao
engineerInfoMPDao
;
@Autowired
private
OrderRequestMPDao
orderRequestMPDao
;
@Autowired
private
WarehouseInfoMPDao
warehouseInfoMPDao
;
@Autowired
...
...
@@ -51,14 +45,14 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
EngineerInfo
engineerInfo
=
engineerInfoMPDao
.
getByEngineerCode
(
engineerCode
);
// 获取工程师date日的订单数据
List
<
Order
Appointment
>
orders
=
orderAppointmentMPDao
.
selectByEngineerCodeAndDt
(
engineerCode
,
localDate
);
List
<
Order
Info
>
orders
=
this
.
selectEngineerOrders
(
engineerCode
,
localDate
);
// 获取工程师已完成的timeline数据
List
<
String
>
orderIds
=
orders
.
stream
().
map
(
Order
Appointment
:
:
getOrderId
).
collect
(
Collectors
.
toList
());
List
<
String
>
orderIds
=
orders
.
stream
().
map
(
Order
Info
:
:
getOrderId
).
collect
(
Collectors
.
toList
());
List
<
OrderEvent
>
timelines
=
this
.
engineerTimelines
(
orderIds
,
date
);
// 获取客户地址
HashMap
<
String
,
String
>
orderLocations
=
this
.
orderRequestsLocation
(
order
Id
s
);
HashMap
<
String
,
String
>
orderLocations
=
this
.
orderRequestsLocation
(
orders
);
// 获取配送站地址
String
branchId
=
this
.
getEngineerBranchId
(
engineerCode
);
...
...
@@ -73,6 +67,15 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
return
Result
.
success
(
res
);
}
private
List
<
OrderInfo
>
selectEngineerOrders
(
String
engineerCode
,
LocalDate
dt
){
LambdaQueryWrapper
<
OrderInfo
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
eq
(
OrderInfo:
:
getDt
,
dt
);
lqw
.
eq
(
OrderInfo:
:
getEngineerCode
,
engineerCode
);
lqw
.
ne
(
OrderInfo:
:
getAppointmentStatus
,
"INIT"
);
lqw
.
ne
(
OrderInfo:
:
getOrderStatus
,
"CANCEL"
);
return
orderInfoMPDao
.
selectList
(
lqw
);
}
private
List
<
OrderEvent
>
engineerTimelines
(
List
<
String
>
orderIds
,
String
date
){
// 获取工程师timeline
List
<
String
>
events
=
Stream
.
of
(
"分站取还配件"
,
"已出发"
,
"加单"
).
collect
(
Collectors
.
toList
());
...
...
@@ -84,13 +87,10 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
return
orderEventMPDao
.
selectList
(
lqw
);
}
private
HashMap
<
String
,
String
>
orderRequestsLocation
(
List
<
String
>
orderId
s
)
{
private
HashMap
<
String
,
String
>
orderRequestsLocation
(
List
<
OrderInfo
>
order
s
)
{
// 获取客户地址location
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
LambdaQueryWrapper
<
OrderRequest
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
in
(
OrderRequest:
:
getOrderId
,
orderIds
);
List
<
OrderRequest
>
orders
=
orderRequestMPDao
.
selectList
(
lqw
);
for
(
OrderRequest
o:
orders
){
for
(
OrderInfo
o:
orders
){
map
.
put
(
o
.
getOrderId
(),
String
.
format
(
"%s,%s"
,
o
.
getX
(),
o
.
getY
()));
}
return
map
;
...
...
@@ -122,7 +122,7 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
}
private
List
<
EngineerTimelineResp
.
DynamicItem
>
packItems
(
List
<
OrderEvent
>
timelines
,
List
<
Order
Appointment
>
orders
,
HashMap
<
String
,
String
>
locations
,
String
warehouseLocation
)
{
private
List
<
EngineerTimelineResp
.
DynamicItem
>
packItems
(
List
<
OrderEvent
>
timelines
,
List
<
Order
Info
>
orders
,
HashMap
<
String
,
String
>
locations
,
String
warehouseLocation
)
{
int
index
=
0
;
String
order_id
,
title
,
type
,
text
,
location
;
...
...
@@ -143,11 +143,7 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
type
=
"other"
;
location
=
locations
.
get
(
t
.
getOrderId
());
}
else
{
index
+=
1
;
title
=
String
.
format
(
"第%d单出发"
,
index
);
text
=
String
.
format
(
"%d"
,
index
);
type
=
"order"
;
location
=
locations
.
get
(
t
.
getOrderId
());
continue
;
}
item
.
setTitle
(
title
);
item
.
setTime
(
TimeUtils
.
IsoTimestamp2DateTime
(
t
.
getHappen
()));
...
...
@@ -161,15 +157,16 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
s
.
add
(
t
.
getOrderId
()
+
t
.
getSuborderId
());
}
for
(
OrderAppointment
o:
orders
){
order_id
=
o
.
getOrderId
()
+
o
.
getSuborderId
();
List
<
OrderInfo
>
records
=
orders
.
stream
().
sorted
(
Comparator
.
comparing
(
OrderInfo:
:
getPlanStartTime
)).
collect
(
Collectors
.
toList
());
for
(
OrderInfo
o:
records
){
order_id
=
o
.
getOrderId
()
+
o
.
getSubId
();
if
(
s
.
contains
(
order_id
))
{
continue
;
}
index
+=
1
;
EngineerTimelineResp
.
DynamicItem
item
=
new
EngineerTimelineResp
.
DynamicItem
();
item
.
setTitle
(
String
.
format
(
"第%d单出发"
,
index
));
item
.
setTime
(
TimeUtils
.
IsoTimestamp2DateTime
(
o
.
get
Expect
StartTime
()));
item
.
setTime
(
TimeUtils
.
IsoTimestamp2DateTime
(
o
.
get
Plan
StartTime
()));
item
.
setStatus
(
0
);
item
.
setText
(
String
.
format
(
"%d"
,
index
));
item
.
setLocation
(
locations
.
get
(
o
.
getOrderId
()));
...
...
@@ -179,4 +176,4 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
// 根据items的time升序排序
return
items
.
stream
().
sorted
(
Comparator
.
comparing
(
EngineerTimelineResp
.
DynamicItem
::
getTime
)).
collect
(
Collectors
.
toList
());
}
}
}
\ No newline at end of file
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