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 227dd733
authored
Jul 24, 2023
by
wangli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改,更改表为order_info表
1 parent
3c9980d8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
70 deletions
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderAssignImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderAssignImpl.java
View file @
227dd73
...
@@ -30,10 +30,7 @@ import java.util.stream.Collectors;
...
@@ -30,10 +30,7 @@ import java.util.stream.Collectors;
public
class
OrderAssignImpl
implements
OrderAssign
{
public
class
OrderAssignImpl
implements
OrderAssign
{
@Autowired
@Autowired
private
OrderRequestMPDao
orderRequestMPDao
;
private
OrderInfoMPDao
orderInfoMPDao
;
@Autowired
private
OrderAppointmentMPDao
orderAppointmentMPDao
;
@Autowired
@Autowired
private
EngineerInfoMPDao
engineerInfoMPDao
;
private
EngineerInfoMPDao
engineerInfoMPDao
;
...
@@ -63,7 +60,7 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -63,7 +60,7 @@ public class OrderAssignImpl implements OrderAssign {
@Override
@Override
public
Result
<?>
getOrderAssignRecommendEngineers
(
String
orderId
,
String
key
,
String
distance
,
String
recommend
)
{
public
Result
<?>
getOrderAssignRecommendEngineers
(
String
orderId
,
String
key
,
String
distance
,
String
recommend
)
{
// 服务单指派-推荐技术员列表
// 服务单指派-推荐技术员列表
Order
Request
order
=
orderRequest
MPDao
.
getByOrderId
(
orderId
);
Order
Info
order
=
orderInfo
MPDao
.
getByOrderId
(
orderId
);
if
(
order
==
null
)
{
if
(
order
==
null
)
{
throw
new
BusinessException
(
"订单不存在"
);
throw
new
BusinessException
(
"订单不存在"
);
}
}
...
@@ -84,13 +81,13 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -84,13 +81,13 @@ public class OrderAssignImpl implements OrderAssign {
}
}
// 获取已技术员已指派订单列表
// 获取已技术员已指派订单列表
List
<
Order
Appointment
>
orderAppointments
=
orderAppointmentMPDao
.
selectByEngineerCodeAndDt
(
engineer
.
getEngineerCode
(),
order
.
getDt
()
);
List
<
Order
Info
>
orderAppointments
=
orderInfoMPDao
.
selectByEngineerCodeAndDtAndAppointmentStatus
(
engineer
.
getEngineerCode
(),
order
.
getDt
(),
"CONFIRM"
);
// 获取订单tips
// 获取订单tips
HashMap
<
String
,
List
<
LabelValueDTO
>>
orderTips
=
new
HashMap
<>();
HashMap
<
String
,
List
<
LabelValueDTO
>>
orderTips
=
new
HashMap
<>();
List
<
String
>
orderIds
=
orderAppointments
.
stream
().
map
(
Order
Appointment
:
:
getOrderId
).
collect
(
Collectors
.
toList
());
List
<
String
>
orderIds
=
orderAppointments
.
stream
().
map
(
Order
Info
:
:
getOrderId
).
collect
(
Collectors
.
toList
());
if
(!
orderIds
.
isEmpty
())
{
if
(!
orderIds
.
isEmpty
())
{
List
<
Order
Request
>
orders
=
orderRequestMPDao
.
selectByOrderIds
(
orderIds
);
List
<
Order
Info
>
orders
=
orderInfoMPDao
.
selectByDtAndOrderIds
(
TimeUtils
.
IsoDate2LocalDate
(
date
),
orderIds
);
orderTips
=
this
.
packOrderTips
(
orders
);
orderTips
=
this
.
packOrderTips
(
orders
);
}
}
...
@@ -126,7 +123,8 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -126,7 +123,8 @@ public class OrderAssignImpl implements OrderAssign {
@Override
@Override
public
Result
<?>
orderAssign
(
String
orderId
,
String
engineerCode
)
throws
BusinessException
{
public
Result
<?>
orderAssign
(
String
orderId
,
String
engineerCode
)
throws
BusinessException
{
// 服务单指派-指派提交
// 服务单指派-指派提交
OrderRequest
order
=
orderRequestMPDao
.
getByOrderId
(
orderId
);
OrderInfo
order
=
orderInfoMPDao
.
getByOrderId
(
orderId
);
if
(
order
==
null
)
{
if
(
order
==
null
)
{
throw
new
BusinessException
(
"订单不存在"
);
throw
new
BusinessException
(
"订单不存在"
);
}
}
...
@@ -134,7 +132,7 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -134,7 +132,7 @@ public class OrderAssignImpl implements OrderAssign {
EngineerInfo
engineer
=
engineerInfoMPDao
.
getByEngineerCode
(
engineerCode
);
EngineerInfo
engineer
=
engineerInfoMPDao
.
getByEngineerCode
(
engineerCode
);
boolean
record
=
false
;
boolean
record
=
false
;
Order
Appointment
op
=
orderAppointment
MPDao
.
getByOrderIdAndDt
(
orderId
,
order
.
getDt
());
Order
Info
op
=
orderInfo
MPDao
.
getByOrderIdAndDt
(
orderId
,
order
.
getDt
());
if
(
op
!=
null
)
{
if
(
op
!=
null
)
{
record
=
true
;
record
=
true
;
}
}
...
@@ -148,39 +146,17 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -148,39 +146,17 @@ public class OrderAssignImpl implements OrderAssign {
if
(!
result
.
getCanAssign
())
{
if
(!
result
.
getCanAssign
())
{
throw
new
BusinessException
(
"指派失败, 未能找到合适的时间段, 请选择其他技术员"
);
throw
new
BusinessException
(
"指派失败, 未能找到合适的时间段, 请选择其他技术员"
);
}
}
Timestamp
expectStartTime
=
Timestamp
.
valueOf
(
result
.
getStart
());
Timestamp
planStartTime
=
Timestamp
.
valueOf
(
result
.
getStart
());
Timestamp
expectEndTime
=
Timestamp
.
valueOf
(
result
.
getEnd
());
Timestamp
planEndTime
=
Timestamp
.
valueOf
(
result
.
getEnd
());
// 更新或插入指派单
if
(!
record
)
{
op
=
new
OrderAppointment
();
}
op
.
setOrderId
(
orderId
);
op
.
setSuborderId
(
Long
.
toString
(
System
.
currentTimeMillis
()));
op
.
setMainSub
(
1
);
op
.
setEngineerCode
(
engineerCode
);
op
.
setEngineerName
(
engineer
.
getName
());
op
.
setEngineerAge
(
0
);
op
.
setEngineerPhone
(
engineer
.
getPhone
());
op
.
setIsWorkshop
(
0
);
op
.
setDt
(
order
.
getDt
());
op
.
setExpectStartTime
(
expectStartTime
);
op
.
setExpectEndTime
(
expectEndTime
);
op
.
setPreStatus
(
"CONFIRM"
);
op
.
setStatus
(
"ASSIGNED"
);
if
(!
record
)
{
orderAppointmentMPDao
.
insert
(
op
);
}
else
{
orderAppointmentMPDao
.
updateById
(
op
);
}
// 更新order_request表状态
// 更新order_request表状态
LambdaUpdateWrapper
<
OrderRequest
>
wrapper
=
new
LambdaUpdateWrapper
<>();
LambdaUpdateWrapper
<
OrderInfo
>
wrapper
=
new
LambdaUpdateWrapper
<>();
wrapper
.
set
(
OrderRequest:
:
getAppointmentStatus
,
"ASSIGNED"
);
wrapper
.
set
(
OrderInfo:
:
getAppointmentStatus
,
"CONFIRM"
);
wrapper
.
set
(
OrderRequest:
:
getAppointmentMethod
,
"MANUAL"
);
wrapper
.
set
(
OrderInfo:
:
getAppointmentMethod
,
"MANUAL"
);
wrapper
.
eq
(
OrderRequest:
:
getOrderId
,
orderId
);
wrapper
.
set
(
OrderInfo:
:
getPlanStartTime
,
planStartTime
);
orderRequestMPDao
.
update
(
null
,
wrapper
);
wrapper
.
set
(
OrderInfo:
:
getPlanEndTime
,
planEndTime
);
wrapper
.
eq
(
OrderInfo:
:
getOrderId
,
orderId
);
orderInfoMPDao
.
update
(
null
,
wrapper
);
// 工单变更登记
// 工单变更登记
commonService
.
addOrderEvent
(
orderId
,
""
,
"PEA-WEB"
,
"API"
,
"工单指派"
,
"工单指派"
,
""
);
commonService
.
addOrderEvent
(
orderId
,
""
,
"PEA-WEB"
,
"API"
,
"工单指派"
,
"工单指派"
,
""
);
...
@@ -190,20 +166,16 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -190,20 +166,16 @@ public class OrderAssignImpl implements OrderAssign {
@Override
@Override
public
Result
<?>
orderRevokeAssign
(
String
orderId
)
throws
BusinessException
{
public
Result
<?>
orderRevokeAssign
(
String
orderId
)
throws
BusinessException
{
OrderRequest
order
=
orderRequestMPDao
.
getByOrderId
(
orderId
);
// 放回工单池
OrderInfo
order
=
orderInfoMPDao
.
getByOrderId
(
orderId
);
if
(
order
==
null
)
{
if
(
order
==
null
)
{
throw
new
BusinessException
(
"订单不存在"
);
throw
new
BusinessException
(
"订单不存在"
);
}
}
// 更新order_request表为未指派
// 更新order_request表为未指派
order
.
setAppointmentStatus
(
"NOT_ASSIGNED"
);
order
.
setAppointmentStatus
(
"INIT"
);
orderRequestMPDao
.
updateById
(
order
);
orderInfoMPDao
.
updateById
(
order
);
// 更新order_appointment表为未指派
LambdaUpdateWrapper
<
OrderAppointment
>
appWrapper
=
new
LambdaUpdateWrapper
<>();
appWrapper
.
set
(
OrderAppointment:
:
getStatus
,
"NOT_ASSIGNED"
)
.
eq
(
OrderAppointment:
:
getOrderId
,
orderId
).
eq
(
OrderAppointment:
:
getDt
,
order
.
getDt
());
orderAppointmentMPDao
.
update
(
null
,
appWrapper
);
// 登记事件
// 登记事件
OrderEvent
oe
=
new
OrderEvent
();
OrderEvent
oe
=
new
OrderEvent
();
...
@@ -225,7 +197,8 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -225,7 +197,8 @@ public class OrderAssignImpl implements OrderAssign {
@Override
@Override
public
Result
<?>
orderReschedule
(
String
orderId
,
LocalDateTime
expectBegin
,
LocalDateTime
expectEnd
,
String
expectDesc
)
throws
BusinessException
{
public
Result
<?>
orderReschedule
(
String
orderId
,
LocalDateTime
expectBegin
,
LocalDateTime
expectEnd
,
String
expectDesc
)
throws
BusinessException
{
// 工单改约接口(当前同放回工单池处理)
// 工单改约接口(当前同放回工单池处理)
OrderRequest
order
=
orderRequestMPDao
.
getByOrderId
(
orderId
);
OrderInfo
order
=
orderInfoMPDao
.
getByOrderId
(
orderId
);
if
(
order
==
null
)
{
if
(
order
==
null
)
{
throw
new
BusinessException
(
"订单不存在"
);
throw
new
BusinessException
(
"订单不存在"
);
}
}
...
@@ -239,18 +212,12 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -239,18 +212,12 @@ public class OrderAssignImpl implements OrderAssign {
LocalDate
originDate
=
order
.
getDt
();
// 改约前的日期
LocalDate
originDate
=
order
.
getDt
();
// 改约前的日期
// 更新order_request表为未指派
// 更新order_request表为未指派
order
.
setAppointmentStatus
(
"
NOT_ASSIGNED
"
);
order
.
setAppointmentStatus
(
"
INIT
"
);
order
.
setDt
(
expectBegin
.
toLocalDate
());
order
.
setDt
(
expectBegin
.
toLocalDate
());
order
.
setExpectTimeBegin
(
Timestamp
.
valueOf
(
expectBegin
));
order
.
setExpectTimeBegin
(
Timestamp
.
valueOf
(
expectBegin
));
order
.
setExpectTimeEnd
(
Timestamp
.
valueOf
(
expectEnd
));
order
.
setExpectTimeEnd
(
Timestamp
.
valueOf
(
expectEnd
));
order
.
setExpectTimeDesc
(
expectDesc
);
order
.
setExpectTimeDesc
(
expectDesc
);
orderRequestMPDao
.
updateById
(
order
);
orderInfoMPDao
.
updateById
(
order
);
// 更新order_appointment表为未指派
LambdaUpdateWrapper
<
OrderAppointment
>
appWrapper
=
new
LambdaUpdateWrapper
<>();
appWrapper
.
set
(
OrderAppointment:
:
getStatus
,
"RESCHEDULED"
)
.
eq
(
OrderAppointment:
:
getOrderId
,
orderId
).
eq
(
OrderAppointment:
:
getDt
,
originDate
);
orderAppointmentMPDao
.
update
(
null
,
appWrapper
);
// 登记事件
// 登记事件
OrderEvent
oe
=
new
OrderEvent
();
OrderEvent
oe
=
new
OrderEvent
();
...
@@ -269,7 +236,7 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -269,7 +236,7 @@ public class OrderAssignImpl implements OrderAssign {
return
Result
.
success
(
null
);
return
Result
.
success
(
null
);
}
}
private
List
<
String
>
searchEngineerCodes
(
Order
Request
order
,
String
distance
,
String
key
,
String
recommend
)
{
private
List
<
String
>
searchEngineerCodes
(
Order
Info
order
,
String
distance
,
String
key
,
String
recommend
)
{
Set
<
String
>
engineerCodes1
=
this
.
searchEngineerByRecommend
(
order
,
recommend
);
Set
<
String
>
engineerCodes1
=
this
.
searchEngineerByRecommend
(
order
,
recommend
);
if
(
engineerCodes1
.
isEmpty
())
{
if
(
engineerCodes1
.
isEmpty
())
{
log
.
info
(
"recommend:{}筛选条件未找到技术员"
,
recommend
);
log
.
info
(
"recommend:{}筛选条件未找到技术员"
,
recommend
);
...
@@ -316,7 +283,7 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -316,7 +283,7 @@ public class OrderAssignImpl implements OrderAssign {
return
new
ArrayList
<>(
engineerCodes1
);
return
new
ArrayList
<>(
engineerCodes1
);
}
}
private
Set
<
String
>
searchEngineerByRecommend
(
Order
Request
order
,
String
recommend
)
{
private
Set
<
String
>
searchEngineerByRecommend
(
Order
Info
order
,
String
recommend
)
{
if
(
StringUtils
.
isNotEmpty
(
recommend
)
&&
recommend
.
equals
(
"team"
))
{
if
(
StringUtils
.
isNotEmpty
(
recommend
)
&&
recommend
.
equals
(
"team"
))
{
return
orgTeamEngineerMPDao
.
selectByTeamId
(
order
.
getOrgTeamId
()).
stream
().
map
(
OrgTeamEngineer:
:
getEngineerCode
).
collect
(
Collectors
.
toSet
());
return
orgTeamEngineerMPDao
.
selectByTeamId
(
order
.
getOrgTeamId
()).
stream
().
map
(
OrgTeamEngineer:
:
getEngineerCode
).
collect
(
Collectors
.
toSet
());
}
}
...
@@ -355,18 +322,17 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -355,18 +322,17 @@ public class OrderAssignImpl implements OrderAssign {
return
engineerInfoMPDao
.
selectList
(
lqw
).
stream
().
map
(
EngineerInfo:
:
getEngineerCode
).
collect
(
Collectors
.
toSet
());
return
engineerInfoMPDao
.
selectList
(
lqw
).
stream
().
map
(
EngineerInfo:
:
getEngineerCode
).
collect
(
Collectors
.
toSet
());
}
}
private
List
<
TimeLineDTO
>
packTimelines
(
List
<
Order
Appointment
>
orders
,
HashMap
<
String
,
List
<
LabelValueDTO
>>
orderTips
)
{
private
List
<
TimeLineDTO
>
packTimelines
(
List
<
Order
Info
>
orders
,
HashMap
<
String
,
List
<
LabelValueDTO
>>
orderTips
)
{
List
<
LabelValueDTO
>
empty
=
new
ArrayList
<>();
List
<
LabelValueDTO
>
empty
=
new
ArrayList
<>();
List
<
TimeLineDTO
>
items
=
new
ArrayList
<>();
List
<
TimeLineDTO
>
items
=
new
ArrayList
<>();
for
(
Order
Appointment
order
:
orders
)
{
for
(
Order
Info
order
:
orders
)
{
TimeLineDTO
item
=
new
TimeLineDTO
();
TimeLineDTO
item
=
new
TimeLineDTO
();
item
.
setOrderId
(
order
.
getOrderId
());
item
.
setOrderId
(
order
.
getOrderId
());
item
.
setPreStatus
(
order
.
getPreStatus
());
item
.
setAppointmentStatus
(
order
.
getAppointmentStatus
());
item
.
setAppointmentStatus
(
order
.
getStatus
());
item
.
setStartTime
(
TimeUtils
.
IsoTimestamp2DateTime
(
order
.
getPlanStartTime
()));
item
.
setStartTime
(
TimeUtils
.
IsoTimestamp2DateTime
(
order
.
getExpectStartTime
()));
item
.
setEndTime
(
TimeUtils
.
IsoTimestamp2DateTime
(
order
.
getPlanEndTime
()));
item
.
setEndTime
(
TimeUtils
.
IsoTimestamp2DateTime
(
order
.
getExpectEndTime
()));
item
.
setTips
(
orderTips
.
getOrDefault
(
order
.
getOrderId
(),
empty
));
item
.
setTips
(
orderTips
.
getOrDefault
(
order
.
getOrderId
(),
empty
));
items
.
add
(
item
);
items
.
add
(
item
);
...
@@ -374,12 +340,12 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -374,12 +340,12 @@ public class OrderAssignImpl implements OrderAssign {
return
items
;
return
items
;
}
}
private
HashMap
<
String
,
List
<
LabelValueDTO
>>
packOrderTips
(
List
<
Order
Request
>
orders
)
{
private
HashMap
<
String
,
List
<
LabelValueDTO
>>
packOrderTips
(
List
<
Order
Info
>
orders
)
{
return
orders
.
stream
().
collect
(
Collectors
.
toMap
(
return
orders
.
stream
().
collect
(
Collectors
.
toMap
(
Order
Request
:
:
getOrderId
,
this
::
packOrderTip
,
(
l1
,
l2
)
->
l1
,
HashMap:
:
new
));
Order
Info
:
:
getOrderId
,
this
::
packOrderTip
,
(
l1
,
l2
)
->
l1
,
HashMap:
:
new
));
}
}
private
List
<
LabelValueDTO
>
packOrderTip
(
Order
Request
order
)
{
private
List
<
LabelValueDTO
>
packOrderTip
(
Order
Info
order
)
{
// pack订单tips
// pack订单tips
List
<
LabelValueDTO
>
items
=
new
ArrayList
<>();
List
<
LabelValueDTO
>
items
=
new
ArrayList
<>();
items
.
add
(
new
LabelValueDTO
(
"类型/品牌"
,
String
.
format
(
"%s %s %s"
,
order
.
getSkill
(),
order
.
getType
(),
order
.
getBrand
())));
items
.
add
(
new
LabelValueDTO
(
"类型/品牌"
,
String
.
format
(
"%s %s %s"
,
order
.
getSkill
(),
order
.
getType
(),
order
.
getBrand
())));
...
...
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