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 63415388
authored
Nov 14, 2023
by
huangjinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:订单插单优化
1 parent
fc6b7a75
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
10 deletions
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/OrderInfoServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/DispatchServiceImpl.java
View file @
6341538
...
...
@@ -298,6 +298,8 @@ public class DispatchServiceImpl implements DispatchService {
public
Result
<?>
dispatchOrderConfirm
(
String
engineerCode
,
String
date
,
List
<
String
>
orderIds
)
throws
BusinessException
{
// 派工台确认派单
LocalDate
localDate
=
TimeUtils
.
IsoDate2LocalDate
(
date
);
List
<
String
>
successList
=
new
ArrayList
<>();
List
<
String
>
errorList
=
new
ArrayList
<>();
EngineerInfoEntity
engineer
=
engineerInfoDao
.
getByEngineerCode
(
engineerCode
);
if
(
engineer
==
null
)
{
...
...
@@ -320,13 +322,12 @@ public class DispatchServiceImpl implements DispatchService {
}
SkillInfoEntity
skill
=
skillInfoDao
.
getByBrandAndTypeAndSkill
(
CommonUtil
.
fixBrand
(
entity
.
getBrand
()),
entity
.
getType
(),
entity
.
getSkill
());
List
<
OrderInfoEntity
>
engineerOrders
=
orderInfoDao
.
findByDtAndEngineerCode
(
localDate
,
engineer
.
getEngineerCode
());
if
(
CollectionUtils
.
isNotEmpty
(
engineerOrders
))
{
Result
<
OrderInfoEntity
>
entityResult
=
orderInfoService
.
insterEngineerOrders
(
engineerOrders
,
entity
,
skill
,
byTeamId
,
engineer
);
if
(!
entityResult
.
getCode
().
equals
(
ResultEnum
.
SUCCESS
.
getCode
()))
{
return
Result
.
failed
(
"当前工程师无法预约合适时间"
);
// return Result.failed("当前工程师无法预约合适时间");
errorList
.
add
(
entity
.
getOrderId
());
}
entity
=
entityResult
.
getResult
();
}
entity
.
setTakeTime
(
skill
.
getTakeTime
());
entity
.
setEngineerCode
(
engineer
.
getEngineerCode
());
entity
.
setEngineerName
(
engineer
.
getName
());
...
...
@@ -341,8 +342,16 @@ public class DispatchServiceImpl implements DispatchService {
commonService
.
addOrderEvent
(
entity
.
getOrderId
(),
""
,
"PEA"
,
"PEA"
,
OrderEventEnum
.
reassignment
.
getEvent
(),
String
.
format
(
OrderEventEnum
.
reassignment
.
getMsg
(),
engineer
.
getName
()
+
"-"
+
(
ObjectUtil
.
isNotNull
(
byTeamId
)
?
byTeamId
.
getTeamName
()
:
""
)),
""
,
LocalDateTime
.
now
());
successList
.
add
(
entity
.
getOrderId
());
}
List
<
String
>
resultList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
successList
))
{
resultList
.
add
(
String
.
format
(
"%s订单指派(改派)成功"
,
String
.
join
(
","
,
successList
)));
}
if
(
CollectionUtils
.
isNotEmpty
(
errorList
))
{
resultList
.
add
(
String
.
format
(
"%s订单指派(改派)失败,当前工程师无法预约合适时间"
,
String
.
join
(
","
,
errorList
)));
}
return
Result
.
success
(
null
);
return
Result
.
success
(
CollectionUtils
.
isNotEmpty
(
resultList
)
?
String
.
join
(
","
,
resultList
)
:
null
);
}
@Override
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderAssignImpl.java
View file @
6341538
...
...
@@ -164,13 +164,11 @@ public class OrderAssignImpl implements OrderAssign {
SkillInfoEntity
skill
=
skillInfoDao
.
getByBrandAndTypeAndSkill
(
CommonUtil
.
fixBrand
(
entity
.
getBrand
()),
entity
.
getType
(),
entity
.
getSkill
());
//判断工程师订单当日工单时间安排
List
<
OrderInfoEntity
>
engineerOrders
=
orderInfoDao
.
findByDtAndEngineerCode
(
entity
.
getDt
(),
engineer
.
getEngineerCode
());
if
(
CollectionUtils
.
isNotEmpty
(
engineerOrders
))
{
Result
<
OrderInfoEntity
>
entityResult
=
orderInfoService
.
insterEngineerOrders
(
engineerOrders
,
entity
,
skill
,
byTeamId
,
engineer
);
if
(!
entityResult
.
getCode
().
equals
(
ResultEnum
.
SUCCESS
.
getCode
()))
{
return
Result
.
failed
(
"当前工程师工单已满"
);
}
entity
=
entityResult
.
getResult
();
}
entity
.
setEngineerCode
(
engineer
.
getEngineerCode
());
entity
.
setEngineerName
(
engineer
.
getName
());
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderInfoServiceImpl.java
View file @
6341538
...
...
@@ -442,15 +442,26 @@ public class OrderInfoServiceImpl implements OrderInfoService {
@Transactional
@Override
public
Result
<
OrderInfoEntity
>
insterEngineerOrders
(
List
<
OrderInfoEntity
>
engineerOrders
,
OrderInfoEntity
insertOrder
,
SkillInfoEntity
skillInfo
,
OrgTeamEntity
orgTeam
,
EngineerInfoEntity
engineer
)
{
int
takeTime
=
skillInfo
.
getTakeTime
();
// 获取客户期望时间段
LocalDateTime
start
=
insertOrder
.
getExpectTimeBegin
();
LocalDateTime
end
=
insertOrder
.
getExpectTimeEnd
();
// 没有单直接返回
// 获取团队工作起止时间
String
[]
teamWorkStartTime
=
orgTeam
.
getWorkOn
().
split
(
":"
);
String
[]
teamWorkEndTime
=
orgTeam
.
getWorkOff
().
split
(
":"
);
LocalDateTime
startTeam
=
insertOrder
.
getDt
().
atTime
(
Integer
.
parseInt
(
teamWorkStartTime
[
0
]),
Integer
.
parseInt
(
teamWorkStartTime
[
1
]),
0
);
LocalDateTime
endTeam
=
insertOrder
.
getDt
().
atTime
(
Integer
.
parseInt
(
teamWorkEndTime
[
0
]),
Integer
.
parseInt
(
teamWorkEndTime
[
1
]),
0
);
// 获取客户期望时间段
LocalDateTime
start
=
insertOrder
.
getExpectTimeBegin
();
LocalDateTime
end
=
insertOrder
.
getExpectTimeEnd
();
if
(
CollectionUtils
.
isEmpty
(
engineerOrders
))
{
// 特殊时间不插单
if
(
LocalDateTime
.
now
().
isBefore
(
startTeam
)
||
LocalDateTime
.
now
().
isAfter
(
endTeam
)
||
end
.
isAfter
(
endTeam
)
||
end
.
isBefore
(
startTeam
))
{
return
Result
.
failed
(
insertOrder
);
}
insertOrder
.
setTakeTime
(
skillInfo
.
getTakeTime
());
insertOrder
.
setPlanStartTime
(
insertOrder
.
getExpectTimeBegin
());
insertOrder
.
setPlanEndTime
(
insertOrder
.
getExpectTimeBegin
().
plusMinutes
(
skillInfo
.
getTakeTime
()));
return
Result
.
success
(
insertOrder
);
}
int
takeTime
=
skillInfo
.
getTakeTime
();
// 计算最早派工和最晚派工时间
LocalDateTime
workStartTime
=
start
.
isAfter
(
startTeam
)
?
start
:
startTeam
;
LocalDateTime
workEndTime
=
end
.
isBefore
(
endTeam
)
?
end
:
endTeam
;
...
...
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