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 12cafb4f
authored
Jul 25, 2023
by
丁伟峰
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
2 parents
bab426df
fc17f03a
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
95 additions
and
82 deletions
project-dispatch/src/main/java/com/dituhui/pea/dispatch/dao/DispatchOrderRepository.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/ExtractServiceImpl.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/SolveServiceImpl.java
project-dispatch/src/test/java/com/dituhui/pea/dispatch/SolveServiceTest.java
project-order/src/main/java/com/dituhui/pea/order/common/OrderAssignCheck.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/DispatchServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderAssignImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderServiceDetailImpl.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/dao/DispatchOrderRepository.java
View file @
12cafb4
...
...
@@ -15,9 +15,9 @@ public interface DispatchOrderRepository extends CrudRepository<DispatchOrder, L
List
<
DispatchOrder
>
findNotAssigned
(
String
groupId
,
String
batchNo
);
// 查看算法指派成功
且
非confirm状态的
@Query
(
"from DispatchOrder where groupId=?1 and batchNo=?2 and status !='CONFIRM'
and ( engineerCode is not null and engineerCode!='')
"
)
List
<
DispatchOrder
>
findA
ssigned
(
String
groupId
,
String
batchNo
);
// 查看算法指派成功
(也有抹掉技术员、时间情况),
非confirm状态的
@Query
(
"from DispatchOrder where groupId=?1 and batchNo=?2 and status !='CONFIRM' "
)
List
<
DispatchOrder
>
findA
llWithoutConfirm
(
String
groupId
,
String
batchNo
);
Optional
<
DispatchOrder
>
findByGroupIdAndBatchNoAndOrderIdAndDt
(
String
groupId
,
String
batchNo
,
String
orderId
,
String
dt
);
}
\ No newline at end of file
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/ExtractServiceImpl.java
View file @
12cafb4
...
...
@@ -5,9 +5,10 @@ import cn.hutool.core.date.DateUtil;
import
com.dituhui.pea.dispatch.dao.*
;
import
com.dituhui.pea.dispatch.entity.*
;
import
com.dituhui.pea.dispatch.service.ExtractService
;
import
c
om.mysql.cj.util.StringUtils
;
import
c
n.hutool.core.util.StrUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.aspectj.weaver.ast.Or
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Service
;
...
...
@@ -73,7 +74,7 @@ public class ExtractServiceImpl implements ExtractService {
Map
<
String
,
EngineerInfo
>
engineerInfoMap
=
engineerInfoRepo
.
findByGroupId
(
groupId
).
stream
().
collect
(
Collectors
.
toMap
(
EngineerInfo:
:
getEngineerCode
,
y
->
y
));
List
<
DispatchOrder
>
dispatchOrderList
=
dispatchOrderRepo
.
findA
ssigned
(
groupId
,
batchNo
);
List
<
DispatchOrder
>
dispatchOrderList
=
dispatchOrderRepo
.
findA
llWithoutConfirm
(
groupId
,
batchNo
);
log
.
info
(
"算法结果更新到工单, step1-开始处理, groupId:{}, batchNo:{}, order-size:{}"
,
groupId
,
batchNo
,
dispatchOrderList
.
size
());
...
...
@@ -81,8 +82,9 @@ public class ExtractServiceImpl implements ExtractService {
dispatchOrderList
.
forEach
(
dispatchOrder
->
{
int
idx
=
atomicInteger
.
getAndIncrement
();
String
orderId
=
dispatchOrder
.
getOrderId
();
String
engCode
=
dispatchOrder
.
getEngineerCode
();
String
dt
=
dispatchOrder
.
getDt
();
String
engCode
=
dispatchOrder
.
getEngineerCode
();
log
.
info
(
"算法结果更新到工单, step1.1-loop, {}/{}, groupId:{}, batchNo:{}, orderId:{}, dt:{}, engCode:{}"
,
idx
,
dispatchOrderList
.
size
(),
groupId
,
batchNo
,
orderId
,
dt
,
engCode
);
...
...
@@ -99,52 +101,66 @@ public class ExtractServiceImpl implements ExtractService {
if
(!(
"OPEN"
.
equals
(
orderInfo
.
getBeanStatus
())
&&
Set
.
of
(
"AUTO_NOW"
,
"AUTO_BATCH"
).
contains
(
orderInfo
.
getAppointmentMethod
())
&&
Set
.
of
(
"INIT"
,
"VIRTUAL"
,
"PRE"
).
contains
(
orderInfo
.
getAppointmentStatus
())
&&
"NORMAL"
.
equals
(
orderInfo
.
getOrderStatus
())
&&
"INIT"
.
equals
(
orderInfo
.
getServiceStatus
())
"NORMAL"
.
equals
(
orderInfo
.
getOrderStatus
())
&&
"INIT"
.
equals
(
orderInfo
.
getServiceStatus
())))
{
))
{
log
.
warn
(
"算法结果更新到工单, step1.1-loop, 工单状态异常, groupId:{}, batchNo:{}, orderId:{}, bean-status:{}, appointment-status:{}, order-status:{}, service-status:{}"
,
groupId
,
batchNo
,
orderId
,
orderInfo
.
getBeanStatus
(),
orderInfo
.
getAppointmentStatus
(),
orderInfo
.
getOrderStatus
(),
orderInfo
.
getServiceStatus
());
return
;
}
EngineerInfo
engineerInfo
=
engineerInfoMap
.
get
(
engCode
);
if
(
engineerInfo
==
null
)
{
log
.
warn
(
"算法结果更新到工单, step1.1-loop, 未找到技术员, groupId:{}, batchNo:{}, engCode:{}"
,
groupId
,
batchNo
,
engCode
);
return
;
}
String
engName
=
engineerInfo
.
getName
();
String
phone
=
engineerInfo
.
getPhone
();
/*int age = 0;
if (!StringUtils.isNullOrEmpty(engineerInfo.getBirth())) {
DateTime birthDate = DateUtil.parse(engineerInfo.getBirth(), "yyyy-MM-dd");
age = DateUtil.age(birthDate.toJdkDate(), DateUtil.date());
}*/
orderInfo
.
setEngineerCode
(
engCode
);
orderInfo
.
setEngineerName
(
engName
);
orderInfo
.
setEngineerPhone
(
phone
);
orderInfo
.
setPlanStartTime
(
dispatchOrder
.
getTimeBegin
());
orderInfo
.
setPlanEndTime
(
dispatchOrder
.
getTimeEnd
());
orderInfo
.
setArriveElapsed
(
dispatchOrder
.
getPathTime
());
orderInfo
.
setArriveDistance
(
dispatchOrder
.
getPathDistance
());
orderInfo
.
setAppointmentStatus
(
isConfirm
?
"CONFIRM"
:
"PRE"
);
orderInfo
.
setUpdateTime
(
LocalDateTime
.
now
());
orderInfoRepo
.
save
(
orderInfo
);
OrderLog
orderLog
=
new
OrderLog
().
setOrderId
(
orderId
).
setSuborderId
(
orderInfo
.
getSubId
()).
setSource
(
"PEA-DISPATCH"
).
setOperator
(
"DISPATCH"
)
.
setContent
(
String
.
format
(
"批量自动指派:<%s,%s>"
,
engCode
,
engName
)).
setContentOld
(
""
)
.
setMemo
(
"批量自动指派"
).
setCreateTime
(
LocalDateTime
.
now
()).
setUpdateTime
(
LocalDateTime
.
now
());
orderLogRepo
.
save
(
orderLog
);
if
(
isConfirm
)
{
OrderEvent
orderEvent
=
new
OrderEvent
().
setOrderId
(
orderId
).
setSuborderId
(
orderInfo
.
getSubId
()).
setHappen
(
LocalDateTime
.
now
())
.
setEvent
(
"批量自动指派"
).
setOperator
(
"DISPATCH"
).
setOperatorName
(
"算法批量指派"
).
setSource
(
"PEA-DISPATCH"
)
.
setDescription
(
String
.
format
(
"批量自动指派:<%s,%s>"
,
engCode
,
engName
)).
setMemo
(
""
)
.
setCreateTime
(
LocalDateTime
.
now
()).
setUpdateTime
(
LocalDateTime
.
now
());
orderEventRepo
.
save
(
orderEvent
);
// 未分配技术员时,清理原分配的信息
if
(!
StrUtil
.
isEmpty
(
engCode
))
{
EngineerInfo
engineerInfo
=
engineerInfoMap
.
get
(
engCode
);
if
(
engineerInfo
==
null
)
{
log
.
warn
(
"算法结果更新到工单, step1.1-loop, 未找到技术员, groupId:{}, batchNo:{}, engCode:{}"
,
groupId
,
batchNo
,
engCode
);
return
;
}
String
engName
=
engineerInfo
.
getName
();
String
phone
=
engineerInfo
.
getPhone
();
/*int age = 0;
if (!StringUtils.isNullOrEmpty(engineerInfo.getBirth())) {
DateTime birthDate = DateUtil.parse(engineerInfo.getBirth(), "yyyy-MM-dd");
age = DateUtil.age(birthDate.toJdkDate(), DateUtil.date());
}*/
orderInfo
.
setEngineerCode
(
engCode
);
orderInfo
.
setEngineerName
(
engName
);
orderInfo
.
setEngineerPhone
(
phone
);
orderInfo
.
setPlanStartTime
(
dispatchOrder
.
getTimeBegin
());
orderInfo
.
setPlanEndTime
(
dispatchOrder
.
getTimeEnd
());
orderInfo
.
setArriveElapsed
(
dispatchOrder
.
getPathTime
());
orderInfo
.
setArriveDistance
(
dispatchOrder
.
getPathDistance
());
orderInfo
.
setAppointmentStatus
(
isConfirm
?
"CONFIRM"
:
"PRE"
);
orderInfo
.
setUpdateTime
(
LocalDateTime
.
now
());
orderInfoRepo
.
save
(
orderInfo
);
if
(
isConfirm
)
{
OrderEvent
orderEvent
=
new
OrderEvent
().
setOrderId
(
orderId
).
setSuborderId
(
orderInfo
.
getSubId
()).
setHappen
(
LocalDateTime
.
now
())
.
setEvent
(
"批量自动指派"
).
setOperator
(
"DISPATCH"
).
setOperatorName
(
"算法批量指派"
).
setSource
(
"PEA-DISPATCH"
)
.
setDescription
(
String
.
format
(
"批量自动指派:<%s,%s>"
,
engCode
,
engName
)).
setMemo
(
""
)
.
setCreateTime
(
LocalDateTime
.
now
()).
setUpdateTime
(
LocalDateTime
.
now
());
orderEventRepo
.
save
(
orderEvent
);
}
OrderLog
orderLog
=
new
OrderLog
().
setOrderId
(
orderId
).
setSuborderId
(
orderInfo
.
getSubId
()).
setSource
(
"PEA-DISPATCH"
).
setOperator
(
"DISPATCH"
)
.
setContent
(
String
.
format
(
"批量自动指派:<%s,%s>"
,
engCode
,
engName
)).
setContentOld
(
""
)
.
setMemo
(
"批量自动指派"
).
setCreateTime
(
LocalDateTime
.
now
()).
setUpdateTime
(
LocalDateTime
.
now
());
orderLogRepo
.
save
(
orderLog
);
}
else
{
log
.
warn
(
"算法结果更新到工单, step1.2-loop, 未能分配到技术员, groupId:{}, batchNo:{}, orderId:{}, dt:{}"
,
groupId
,
batchNo
,
orderId
,
dt
);
orderInfo
.
setEngineerCode
(
""
);
orderInfo
.
setEngineerName
(
""
);
orderInfo
.
setEngineerPhone
(
""
);
orderInfo
.
setPlanStartTime
(
null
);
orderInfo
.
setPlanEndTime
(
null
);
orderInfo
.
setArriveElapsed
(
0
);
orderInfo
.
setArriveDistance
(
0
);
orderInfo
.
setAppointmentStatus
(
"INIT"
);
orderInfo
.
setUpdateTime
(
LocalDateTime
.
now
());
orderInfoRepo
.
save
(
orderInfo
);
}
});
...
...
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/SolveServiceImpl.java
View file @
12cafb4
...
...
@@ -137,7 +137,7 @@ public class SolveServiceImpl implements SolveService {
customerList
.
add
(
customer
);
});
log
.
info
(
"组织问题对象, customer-list, groupId:{}, batchNo:{}, customer-list:{}"
,
groupId
,
batchNo
,
customerList
);
log
.
info
(
"组织问题对象, customer-list, groupId:{}, batchNo:{}, customer-list:{}"
,
groupId
,
batchNo
,
customerList
.
size
()
);
// depotlist 技术员中收点列表
ArrayList
<
Depot
>
depotList
=
new
ArrayList
<
Depot
>();
...
...
@@ -166,7 +166,6 @@ public class SolveServiceImpl implements SolveService {
log
.
info
(
"组织问题对象, depotList-list, groupId:{}, batchNo:{}, depotList-list:{}"
,
groupId
,
batchNo
,
depotList
.
size
());
log
.
info
(
"组织问题对象, technician-list, groupId:{}, batchNo:{}, technician-list:{}"
,
groupId
,
batchNo
,
technicianList
.
size
());
log
.
info
(
"组织问题对象, technician-list, groupId:{}, batchNo:{}, customer-list:{}"
,
groupId
,
batchNo
,
customerList
.
size
());
//locationlist
List
<
Location
>
locationList
=
Stream
.
concat
(
depotList
.
stream
().
map
(
Depot:
:
getLocation
),
customerList
.
stream
().
map
(
Customer:
:
getLocation
)).
collect
(
Collectors
.
toList
());
...
...
project-dispatch/src/test/java/com/dituhui/pea/dispatch/SolveServiceTest.java
View file @
12cafb4
...
...
@@ -54,7 +54,7 @@ class SolveServiceTest {
SolverConfig
solverConfig
=
new
SolverConfig
().
withSolutionClass
(
DispatchSolution
.
class
);
solverConfig
.
withEntityClassList
(
Arrays
.
asList
(
Technician
.
class
,
Customer
.
class
));
// 这里不能漏掉,否则约束不生效
solverConfig
.
withConstraintProviderClass
(
DispatchConstraintProvider
.
class
);
solverConfig
.
withTerminationSpentLimit
(
Duration
.
ofSeconds
(
2
0
));
solverConfig
.
withTerminationSpentLimit
(
Duration
.
ofSeconds
(
1
0
));
solverFactory
=
SolverFactory
.
create
(
solverConfig
);
...
...
project-order/src/main/java/com/dituhui/pea/order/common/OrderAssignCheck.java
View file @
12cafb4
package
com
.
dituhui
.
pea
.
order
.
common
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.entity.*
;
import
lombok.Data
;
...
...
@@ -21,11 +22,6 @@ import java.util.stream.Collectors;
@Component
@Slf4j
public
class
OrderAssignCheck
{
@Autowired
OrderRequestMPDao
orderRequestMPDao
;
@Autowired
OrderAppointmentMPDao
orderAppointmentMPDao
;
@Autowired
SkillInfoMPDao
skillInfoMPDao
;
...
...
@@ -39,6 +35,9 @@ public class OrderAssignCheck {
@Autowired
OrgGroupMPDao
orgGroupMPDao
;
@Autowired
OrderInfoMPDao
orderInfoMPDao
;
@Data
public
class
Result
{
private
Boolean
canAssign
;
...
...
@@ -63,7 +62,7 @@ public class OrderAssignCheck {
public
Result
orderAssignCheck
(
String
orderId
,
String
engineerCode
)
{
log
.
info
(
"begin orderAssignCheck:orderId={}, engineerCode={}"
,
orderId
,
engineerCode
);
Order
Request
order
=
orderRequest
MPDao
.
getByOrderId
(
orderId
);
Order
Info
order
=
orderInfo
MPDao
.
getByOrderId
(
orderId
);
double
curX
=
Double
.
parseDouble
(
order
.
getX
());
double
curY
=
Double
.
parseDouble
(
order
.
getY
());
...
...
@@ -142,33 +141,22 @@ public class OrderAssignCheck {
private
List
<
OrderSegment
>
getEngineerOrderSegments
(
String
engineerCode
,
LocalDate
dt
)
{
List
<
OrderSegment
>
orderSegments
=
new
ArrayList
<>();
List
<
OrderAppointment
>
appointments
=
orderAppointmentMPDao
.
selectByEngineerCodeAndDt
(
engineerCode
,
dt
);
List
<
String
>
orderIds
=
new
ArrayList
<>();
for
(
OrderAppointment
o:
appointments
)
{
// 过滤掉已经取消的订单
if
(
o
.
getStatus
().
equals
(
"NOT_ASSIGNED"
)
||
o
.
getStatus
().
equals
(
"CANCELED"
))
{
continue
;
}
orderIds
.
add
(
o
.
getOrderId
());
}
if
(
orderIds
.
isEmpty
()){
LambdaQueryWrapper
<
OrderInfo
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
eq
(
OrderInfo:
:
getDt
,
dt
);
lqw
.
eq
(
OrderInfo:
:
getEngineerCode
,
engineerCode
);
lqw
.
eq
(
OrderInfo:
:
getOrderStatus
,
"NORMAL"
);
lqw
.
in
(
OrderInfo:
:
getAppointmentStatus
,
List
.
of
(
"PRE"
,
"CONFIRM"
));
List
<
OrderInfo
>
appointments
=
orderInfoMPDao
.
selectList
(
lqw
);
if
(
appointments
.
isEmpty
()){
return
orderSegments
;
}
Map
<
String
,
List
<
OrderAppointment
>>
m
=
appointments
.
stream
().
collect
(
Collectors
.
groupingBy
(
OrderAppointment:
:
getOrderId
));
List
<
OrderRequest
>
orderRequests
=
orderRequestMPDao
.
selectByOrderIds
(
orderIds
);
for
(
OrderRequest
o:
orderRequests
)
{
List
<
OrderAppointment
>
tmp
=
m
.
getOrDefault
(
o
.
getOrderId
(),
new
ArrayList
<>());
if
(
tmp
.
isEmpty
())
{
continue
;
}
OrderAppointment
oa
=
tmp
.
get
(
0
);
for
(
OrderInfo
o:
appointments
)
{
OrderSegment
seg
=
new
OrderSegment
();
seg
.
setOrderId
(
o
.
getOrderId
());
seg
.
setX
(
Double
.
parseDouble
(
o
.
getX
()));
seg
.
setY
(
Double
.
parseDouble
(
o
.
getY
()));
seg
.
setStart
(
this
.
timestamp2Point
(
o
a
.
getExpect
StartTime
()));
seg
.
setEnd
(
this
.
timestamp2Point
(
o
a
.
getExpect
EndTime
()));
seg
.
setStart
(
this
.
timestamp2Point
(
o
.
getPlan
StartTime
()));
seg
.
setEnd
(
this
.
timestamp2Point
(
o
.
getPlan
EndTime
()));
orderSegments
.
add
(
seg
);
}
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/DispatchServiceImpl.java
View file @
12cafb4
...
...
@@ -302,11 +302,11 @@ public class DispatchServiceImpl implements DispatchService {
private
List
<
OrderInfo
>
queryOrders
(
DispatchOrderListReq
reqDTO
)
{
// 获取服务单列表
LambdaQueryWrapper
<
OrderInfo
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
eq
(
OrderInfo:
:
getAppointmentStatus
,
"NOT_ASSIGNED"
);
// 明确未派工订单
lqw
.
eq
(
OrderInfo:
:
getDt
,
TimeUtils
.
IsoDate2LocalDate
(
reqDTO
.
getDate
()));
lqw
.
eq
(
OrderInfo:
:
getAppointmentStatus
,
"INIT"
);
// 明确未派工订单
lqw
.
eq
(
reqDTO
.
getLevelType
().
equals
(
"cluster"
),
OrderInfo:
:
getOrgClusterId
,
reqDTO
.
getLevelValue
());
lqw
.
eq
(
reqDTO
.
getLevelType
().
equals
(
"branch"
),
OrderInfo:
:
getOrgBranchId
,
reqDTO
.
getLevelValue
());
lqw
.
eq
(
reqDTO
.
getLevelType
().
equals
(
"group"
),
OrderInfo:
:
getOrgGroupId
,
reqDTO
.
getLevelValue
());
lqw
.
eq
(
OrderInfo:
:
getDt
,
TimeUtils
.
IsoDate2LocalDate
(
reqDTO
.
getDate
()));
//筛选项
lqw
.
eq
(
StringUtils
.
isNotEmpty
(
reqDTO
.
getPhone
()),
OrderInfo:
:
getPhone
,
reqDTO
.
getPhone
());
lqw
.
eq
(
StringUtils
.
isNotEmpty
(
reqDTO
.
getOrderId
()),
OrderInfo:
:
getOrderId
,
reqDTO
.
getOrderId
());
...
...
@@ -362,6 +362,7 @@ public class DispatchServiceImpl implements DispatchService {
LambdaQueryWrapper
<
OrderInfo
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
eq
(
OrderInfo:
:
getDt
,
date
);
lqw
.
in
(
OrderInfo:
:
getAppointmentStatus
,
List
.
of
(
"VIRTUAL"
,
"PRE"
,
"CONFIRM"
));
lqw
.
in
(
OrderInfo:
:
getEngineerCode
,
engineerCodes
);
lqw
.
orderByAsc
(
OrderInfo:
:
getEngineerCode
);
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderAssignImpl.java
View file @
12cafb4
...
...
@@ -149,7 +149,7 @@ public class OrderAssignImpl implements OrderAssign {
Timestamp
planStartTime
=
Timestamp
.
valueOf
(
result
.
getStart
());
Timestamp
planEndTime
=
Timestamp
.
valueOf
(
result
.
getEnd
());
// 更新order_
request
表状态
// 更新order_
info
表状态
LambdaUpdateWrapper
<
OrderInfo
>
wrapper
=
new
LambdaUpdateWrapper
<>();
wrapper
.
set
(
OrderInfo:
:
getAppointmentStatus
,
"CONFIRM"
);
wrapper
.
set
(
OrderInfo:
:
getAppointmentMethod
,
"MANUAL"
);
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderServiceDetailImpl.java
View file @
12cafb4
...
...
@@ -3,6 +3,7 @@ package com.dituhui.pea.order.service.impl;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.dituhui.pea.common.BusinessException
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.common.ListUtils
;
import
com.dituhui.pea.order.common.TimeUtils
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dto.*
;
...
...
@@ -127,11 +128,18 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
Comparator
<
OrderInfo
>
dtDesc
=
Comparator
.
comparing
(
OrderInfo:
:
getDt
).
reversed
();
List
<
OrderInfo
>
results
=
orders
.
stream
().
sorted
(
dtDesc
).
collect
(
Collectors
.
toList
());
LocalDate
lastDt
=
results
.
get
(
0
).
getDt
();
LocalDate
lastDt
=
results
.
get
(
0
).
getDt
();
//最新预约
List
<
OrderAppointmentListResp
.
OrderAppointment
>
items
=
new
ArrayList
<>();
for
(
OrderInfo
o
:
results
)
{
EngineerInfo
eg
=
egInfo
.
getOrDefault
(
o
.
getEngineerCode
(),
null
);
if
(
eg
==
null
)
{
log
.
warn
(
"未获得工程师{}基础信息, 订单:{}"
,
o
.
getEngineerCode
(),
o
.
getOrderId
());
continue
;
}
String
skill
=
egSkill
.
getOrDefault
(
o
.
getEngineerCode
(),
null
);
if
(
skill
==
null
)
{
log
.
warn
(
"未获得工程师{}基础技能, 订单:{}"
,
o
.
getEngineerCode
(),
o
.
getOrderId
());
}
// 获取工程师姓名
String
engineerName
=
(
eg
!=
null
)
?
eg
.
getName
()
:
o
.
getEngineerCode
();
...
...
@@ -146,7 +154,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
item
.
setTitle
(
title
);
item
.
setEngineerCode
(
o
.
getEngineerCode
());
item
.
setExpectTime
(
TimeUtils
.
IsoTimestamp2DateTime
(
o
.
getExpectTimeBegin
()));
item
.
setTimelines
(
this
.
packOrderTimeline
(
timelines
.
get
(
o
.
getSubId
()
)));
item
.
setTimelines
(
this
.
packOrderTimeline
(
timelines
.
get
OrDefault
(
o
.
getSubId
(),
null
)));
item
.
setItems
(
this
.
packEngineerItems
(
eg
,
skill
,
groups
.
get
(
eg
.
getGroupId
())));
items
.
add
(
item
);
...
...
@@ -365,7 +373,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
private
List
<
KV
>
packOrderTimeline
(
List
<
OrderTimeline
>
timelines
)
{
List
<
KV
>
items
=
new
ArrayList
<>();
if
(
timelines
==
null
)
{
if
(
ListUtils
.
isEmpty
(
timelines
))
{
return
items
;
}
for
(
OrderTimeline
o
:
timelines
)
{
...
...
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