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 ff17835d
authored
Jul 17, 2023
by
丁伟峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日志补充、suborder_id字段补充
1 parent
8bc77898
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderCreateServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderCreateServiceImpl.java
View file @
ff17835
...
...
@@ -36,6 +36,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
java.time.LocalDateTime
;
import
java.time.LocalTime
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.UUID
;
...
...
@@ -168,30 +169,35 @@ public class OrderCreateServiceImpl implements OrderCreateService {
commonService
.
addOrderEvent
(
orderId
,
""
,
req
.
getSource
(),
"API"
,
"创建订单"
,
"创建订单"
,
""
);
// 指派检查,简单处理,遇到第一个可以指派的就停止检查
tryVirtualAppointment
(
req
,
entity
,
orderId
,
teamId
);
tryVirtualAppointment
(
req
,
entity
,
teamId
);
return
Result
.
success
(
null
);
}
private
void
tryVirtualAppointment
(
OrderCreateReqDTO
req
,
OrderRequestEntity
entity
,
String
orderId
,
String
teamId
)
{
private
void
tryVirtualAppointment
(
OrderCreateReqDTO
req
,
OrderRequestEntity
entity
,
String
teamId
)
{
try
{
List
<
String
>
engineerCodes
=
engineerUtils
.
getEngineersByLevel
(
"team"
,
teamId
).
stream
()
.
map
(
EngineerInfoEntity:
:
getEngineerCode
).
collect
(
Collectors
.
toList
());
List
<
String
>
matchEngineerCodes
=
engineerSkillDao
.
findAllByBrandAndTypeAndSkillAndEngineerCodeIn
(
req
.
getBrand
(),
req
.
getType
(),
req
.
getSkill
(),
engineerCodes
).
stream
()
.
map
(
EngineerSkillEntity:
:
getEngineerCode
).
collect
(
Collectors
.
toList
());
String
assignEngineerCode
=
null
;
OrderAssignCheck
.
Result
checkResult
=
null
;
log
.
info
(
"=== 准备调用指派,候选的技术员列表: {}"
,
matchEngineerCodes
);
for
(
String
engineerCode
:
matchEngineerCodes
)
{
OrderAssignCheck
.
Result
checkResult
=
orderAssignCheck
.
orderAssignCheck
(
entity
.
getOrderId
(),
engineerCode
);
checkResult
=
orderAssignCheck
.
orderAssignCheck
(
entity
.
getOrderId
(),
engineerCode
);
log
.
info
(
"orderAssignCheck ===> orderId[{}]engineerCode[{}] ==> result[{}]"
,
entity
.
getOrderId
(),
engineerCode
,
checkResult
);
if
(
checkResult
.
getCanAssign
())
{
assignEngineerCode
=
engineerCode
;
break
;
}
}
log
.
info
(
"=== 指派尝试调用完成,选定的技术员 ==> {}, {}"
,
assignEngineerCode
,
checkResult
);
// 虚拟指派登记
if
(
StringUtils
.
isNotBlank
(
assignEngineerCode
))
{
OrderAppointmentEntity
oa
=
new
OrderAppointmentEntity
();
oa
.
setDt
(
entity
.
getDt
());
oa
.
setOrderId
(
entity
.
getOrderId
());
oa
.
setSuborderId
(
newSuborderId
(
entity
.
getOrderId
()));
oa
.
setMainSub
(
true
);
// 总是主单
oa
.
setIsWorkshop
(
false
);
oa
.
setEngineerCode
(
assignEngineerCode
);
...
...
@@ -213,12 +219,15 @@ public class OrderCreateServiceImpl implements OrderCreateService {
oa
.
setUpdateTime
(
LocalDateTime
.
now
());
orderAppointmentDao
.
save
(
oa
);
// 登记
commonService
.
addOrderEvent
(
orderId
,
""
,
req
.
getSource
(),
"API"
,
"虚拟指派"
,
"虚拟指派"
,
""
);
commonService
.
addOrderEvent
(
entity
.
getOrderId
()
,
""
,
req
.
getSource
(),
"API"
,
"虚拟指派"
,
"虚拟指派"
,
""
);
}
log
.
info
(
"==== 已经完成虚拟指派 ===="
);
}
catch
(
Exception
e
)
{
log
.
error
(
"虚拟指派错误: {}"
,
e
.
getMessage
());
}
}
private
String
newSuborderId
(
String
orderId
)
{
return
String
.
format
(
"%s_%s"
,
orderId
,
DateUtils
.
formatDateTime
(
LocalDateTime
.
now
(),
"yyyyMMddHHmmss"
));
}
}
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