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 a7aa9448
authored
Jul 24, 2023
by
wangli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改,数据库表转化为OrderInfo表
1 parent
74f7ebe3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
36 deletions
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderServiceDetailImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderServiceDetailImpl.java
View file @
a7aa944
...
@@ -22,10 +22,7 @@ import java.util.stream.Collectors;
...
@@ -22,10 +22,7 @@ import java.util.stream.Collectors;
public
class
OrderServiceDetailImpl
implements
OrderServiceDetail
{
public
class
OrderServiceDetailImpl
implements
OrderServiceDetail
{
@Autowired
@Autowired
private
OrderRequestMPDao
orderRequestMPDao
;
private
OrderInfoMPDao
orderInfoMPDao
;
@Autowired
private
OrderAppointmentMPDao
orderAppointmentMPDao
;
@Autowired
@Autowired
private
EngineerInfoMPDao
engineerInfoMPDao
;
private
EngineerInfoMPDao
engineerInfoMPDao
;
...
@@ -45,11 +42,12 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
...
@@ -45,11 +42,12 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
@Autowired
@Autowired
private
SkillInfoMPDao
skillInfoMPDao
;
private
SkillInfoMPDao
skillInfoMPDao
;
@Transactional
@Transactional
@Override
@Override
public
Result
<?>
getOrderServiceDetail
(
String
orderId
)
{
public
Result
<?>
getOrderServiceDetail
(
String
orderId
)
{
Order
Request
order
=
orderRequest
MPDao
.
getByOrderId
(
orderId
);
Order
Info
order
=
orderInfo
MPDao
.
getByOrderId
(
orderId
);
List
<
KV
>
items
=
this
.
packOrderDetail
(
order
);
List
<
KV
>
items
=
this
.
packOrderDetail
(
order
);
...
@@ -66,8 +64,8 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
...
@@ -66,8 +64,8 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
res
.
setOrderId
(
orderId
);
res
.
setOrderId
(
orderId
);
res
.
setRisk
(
""
);
res
.
setRisk
(
""
);
res
.
setRiskDesc
(
""
);
res
.
setRiskDesc
(
""
);
res
.
setStatusDesc
(
"
打开
"
);
res
.
setStatusDesc
(
"
正常
"
);
res
.
setStatus
(
order
.
getStatus
());
res
.
setStatus
(
order
.
get
Order
Status
());
res
.
setAppointmentStatus
(
order
.
getAppointmentStatus
());
res
.
setAppointmentStatus
(
order
.
getAppointmentStatus
());
res
.
setLocation
(
String
.
format
(
"%s,%s"
,
order
.
getX
(),
order
.
getY
()));
res
.
setLocation
(
String
.
format
(
"%s,%s"
,
order
.
getX
(),
order
.
getY
()));
res
.
setReschedulingParams
(
detail
);
res
.
setReschedulingParams
(
detail
);
...
@@ -94,52 +92,44 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
...
@@ -94,52 +92,44 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
@Transactional
@Transactional
@Override
@Override
public
Result
<?>
getOrderAppointmentList
(
String
orderId
)
throws
BusinessException
{
public
Result
<?>
getOrderAppointmentList
(
String
orderId
)
throws
BusinessException
{
// 获取预约单里列表
// 获取预约单里列表
OrderAppointmentListResp
res
=
new
OrderAppointmentListResp
();
OrderAppointmentListResp
res
=
new
OrderAppointmentListResp
();
OrderRequest
order
=
orderRequestMPDao
.
getByOrderId
(
orderId
);
if
(
order
==
null
){
throw
new
BusinessException
(
"订单不存在"
);
}
LocalDate
curDate
=
order
.
getDt
();
// 查询预约单列表
// 查询预约单列表
List
<
Order
Appointment
>
appoints
=
orderAppointment
MPDao
.
selectByOrderId
(
orderId
);
List
<
Order
Info
>
orders
=
orderInfo
MPDao
.
selectByOrderId
(
orderId
);
if
(
appoint
s
.
isEmpty
())
{
if
(
order
s
.
isEmpty
())
{
// 没有指派单列表,返回
// 没有指派单列表,返回
res
.
setOrderId
(
orderId
);
res
.
setOrderId
(
orderId
);
res
.
setOrders
(
new
ArrayList
<>());
res
.
setOrders
(
new
ArrayList
<>());
return
Result
.
success
(
res
);
return
Result
.
success
(
res
);
}
}
// 工程师ID列表
List
<
String
>
egCodes
=
appoints
.
stream
().
map
(
OrderAppointment:
:
getEngineerCode
).
collect
(
Collectors
.
toList
());
// 获取工程师基础信息列表
// 获取工程师基础信息列表
HashMap
<
String
,
EngineerInfo
>
egInfo
=
this
.
getEngineerInfos
(
egCodes
);
Set
<
String
>
set
=
new
HashSet
<>();
orders
.
stream
().
map
(
OrderInfo:
:
getEngineerCode
).
forEach
(
set:
:
add
);
orders
.
stream
().
map
(
OrderInfo:
:
getEngineerCodeSub
).
forEach
(
set:
:
add
);
List
<
String
>
engineerCodes
=
new
ArrayList
<>(
set
);
HashMap
<
String
,
EngineerInfo
>
egInfo
=
this
.
getEngineerInfos
(
engineerCodes
);
// 获取groupIds 和 group信息
// 获取groupIds 和 group信息
List
<
String
>
groupIds
=
egInfo
.
values
().
stream
().
map
(
EngineerInfo:
:
getGroupId
).
collect
(
Collectors
.
toList
());
List
<
String
>
groupIds
=
egInfo
.
values
().
stream
().
map
(
EngineerInfo:
:
getGroupId
).
collect
(
Collectors
.
toList
());
HashMap
<
String
,
OrgGroup
>
groups
=
this
.
queryOrgGroups
(
groupIds
);
HashMap
<
String
,
OrgGroup
>
groups
=
this
.
queryOrgGroups
(
groupIds
);
// 获取工程师技能列表<engineerCode, skills>
// 获取工程师技能列表<engineerCode, skills>
Map
<
String
,
String
>
egSkill
=
this
.
getEngineerSkills
(
e
g
Codes
);
Map
<
String
,
String
>
egSkill
=
this
.
getEngineerSkills
(
e
ngineer
Codes
);
// 获取subOrder订单timeline
// 获取subOrder订单timeline
Map
<
String
,
List
<
OrderTimeline
>>
timelines
=
this
.
getOrderTimelines
(
orderId
);
Map
<
String
,
List
<
OrderTimeline
>>
timelines
=
this
.
getOrderTimelines
(
orderId
);
// 对指派单列表按照subOrderId降序排序, 获取排序的subOrderId列表, 然后根据subOrderId分组
Comparator
<
OrderInfo
>
dtDesc
=
Comparator
.
comparing
(
OrderInfo:
:
getDt
).
reversed
();
Comparator
<
OrderAppointment
>
sbDesc
=
Comparator
.
comparing
(
OrderAppointment:
:
getSuborderId
,
String
.
CASE_INSENSITIVE_ORDER
).
reversed
();
List
<
OrderInfo
>
results
=
orders
.
stream
().
sorted
(
dtDesc
).
collect
(
Collectors
.
toList
());
List
<
OrderAppointment
>
results
=
appoints
.
stream
().
sorted
(
sbDesc
).
collect
(
Collectors
.
toList
());
String
lastSubOrderId
=
results
.
get
(
0
).
getSuborderId
();
LocalDate
lastDt
=
results
.
get
(
0
).
getDt
();
List
<
OrderAppointmentListResp
.
OrderAppointment
>
items
=
new
ArrayList
<>();
List
<
OrderAppointmentListResp
.
OrderAppointment
>
items
=
new
ArrayList
<>();
for
(
OrderAppointment
o
:
results
)
{
for
(
OrderInfo
o
:
results
)
{
String
subOrderId
=
o
.
getSuborderId
();
EngineerInfo
eg
=
egInfo
.
getOrDefault
(
o
.
getEngineerCode
(),
null
);
EngineerInfo
eg
=
egInfo
.
getOrDefault
(
o
.
getEngineerCode
(),
null
);
String
skill
=
egSkill
.
getOrDefault
(
o
.
getEngineerCode
(),
null
);
String
skill
=
egSkill
.
getOrDefault
(
o
.
getEngineerCode
(),
null
);
...
@@ -148,15 +138,15 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
...
@@ -148,15 +138,15 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
// 获取title
// 获取title
String
title
=
engineerName
;
String
title
=
engineerName
;
if
(
!
lastSubOrderId
.
equals
(
subOrderId
)
||
o
.
getDt
().
isBefore
(
curDate
))
{
if
(
o
.
getDt
().
isBefore
(
lastDt
))
{
title
=
String
.
format
(
"%s_%s"
,
engineerName
,
TimeUtils
.
IsoLocalDate2String
(
o
.
getDt
()));
title
=
String
.
format
(
"%s_%s"
,
engineerName
,
TimeUtils
.
IsoLocalDate2String
(
o
.
getDt
()));
}
}
OrderAppointmentListResp
.
OrderAppointment
item
=
new
OrderAppointmentListResp
.
OrderAppointment
();
OrderAppointmentListResp
.
OrderAppointment
item
=
new
OrderAppointmentListResp
.
OrderAppointment
();
item
.
setTitle
(
title
);
item
.
setTitle
(
title
);
item
.
setEngineerCode
(
o
.
getEngineerCode
());
item
.
setEngineerCode
(
o
.
getEngineerCode
());
item
.
setExpectTime
(
TimeUtils
.
IsoTimestamp2DateTime
(
o
.
getExpect
StartTime
()));
item
.
setExpectTime
(
TimeUtils
.
IsoTimestamp2DateTime
(
o
.
getExpect
TimeBegin
()));
item
.
setTimelines
(
this
.
packOrderTimeline
(
timelines
.
get
(
subOrderId
)));
item
.
setTimelines
(
this
.
packOrderTimeline
(
timelines
.
get
(
o
.
getSubId
()
)));
item
.
setItems
(
this
.
packEngineerItems
(
eg
,
skill
,
groups
.
get
(
eg
.
getGroupId
())));
item
.
setItems
(
this
.
packEngineerItems
(
eg
,
skill
,
groups
.
get
(
eg
.
getGroupId
())));
items
.
add
(
item
);
items
.
add
(
item
);
...
@@ -173,7 +163,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
...
@@ -173,7 +163,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
List
<
String
>
block
=
new
ArrayList
<>();
List
<
String
>
block
=
new
ArrayList
<>();
// 获取订单详情
// 获取订单详情
Order
Request
order
=
orderRequest
MPDao
.
getByOrderId
(
orderId
);
Order
Info
order
=
orderInfo
MPDao
.
getByOrderId
(
orderId
);
OrderTeamBlockResp
res
=
new
OrderTeamBlockResp
();
OrderTeamBlockResp
res
=
new
OrderTeamBlockResp
();
res
.
setOrderId
(
orderId
);
res
.
setOrderId
(
orderId
);
...
@@ -236,7 +226,6 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
...
@@ -236,7 +226,6 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
Comparator
<
EngineerSkillGroup
>
cmp
=
Comparator
.
comparing
(
EngineerSkillGroup:
:
getEngineerCode
);
Comparator
<
EngineerSkillGroup
>
cmp
=
Comparator
.
comparing
(
EngineerSkillGroup:
:
getEngineerCode
);
List
<
EngineerSkillGroup
>
sortedResults
=
rows
.
stream
().
sorted
(
cmp
).
collect
(
Collectors
.
toList
());
List
<
EngineerSkillGroup
>
sortedResults
=
rows
.
stream
().
sorted
(
cmp
).
collect
(
Collectors
.
toList
());
// 根据engineerCode分组
// 根据engineerCode分组
Map
<
String
,
List
<
EngineerSkillGroup
>>
results
=
sortedResults
.
stream
().
collect
(
Collectors
.
groupingBy
(
EngineerSkillGroup:
:
getEngineerCode
));
Map
<
String
,
List
<
EngineerSkillGroup
>>
results
=
sortedResults
.
stream
().
collect
(
Collectors
.
groupingBy
(
EngineerSkillGroup:
:
getEngineerCode
));
...
@@ -339,11 +328,11 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
...
@@ -339,11 +328,11 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
return
items
;
return
items
;
}
}
private
List
<
KV
>
packOrderDetail
(
Order
Request
order
)
{
private
List
<
KV
>
packOrderDetail
(
Order
Info
order
)
{
List
<
KV
>
items
=
new
ArrayList
<>();
List
<
KV
>
items
=
new
ArrayList
<>();
items
.
add
(
this
.
packOrderItem
(
"客户姓名"
,
order
.
getName
()));
items
.
add
(
this
.
packOrderItem
(
"客户姓名"
,
order
.
getName
()));
items
.
add
(
this
.
packOrderItem
(
"客户电话"
,
order
.
getPhone
()));
items
.
add
(
this
.
packOrderItem
(
"客户电话"
,
order
.
getPhone
()));
items
.
add
(
this
.
packOrderItem
(
"客户地址"
,
String
.
format
(
"%s%s%s"
,
order
.
getCity
(),
order
.
getCounty
(),
order
.
getAddress
())));
items
.
add
(
this
.
packOrderItem
(
"客户地址"
,
String
.
format
(
"%s%s%s"
,
order
.
getCity
(),
order
.
getCounty
(),
order
.
getAddress
())));
items
.
add
(
this
.
packOrderItem
(
"品牌"
,
order
.
getBrand
()));
items
.
add
(
this
.
packOrderItem
(
"品牌"
,
order
.
getBrand
()));
items
.
add
(
this
.
packOrderItem
(
"设备"
,
order
.
getType
()));
items
.
add
(
this
.
packOrderItem
(
"设备"
,
order
.
getType
()));
items
.
add
(
this
.
packOrderItem
(
"服务"
,
order
.
getSkill
()));
items
.
add
(
this
.
packOrderItem
(
"服务"
,
order
.
getSkill
()));
...
...
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