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 4e612c11
authored
Nov 09, 2023
by
huangjinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:创单优化
1 parent
ab627f1b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
14 deletions
project-order/src/main/java/com/dituhui/pea/order/enums/OrderEventEnum.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/BeanRemoteServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderCreateServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/utils/CommonUtil.java
project-order/src/main/java/com/dituhui/pea/order/enums/OrderEventEnum.java
0 → 100644
View file @
4e612c1
package
com
.
dituhui
.
pea
.
order
.
enums
;
public
enum
OrderEventEnum
{
// 建单,首次指派,改派,取消,改约,放回工单池
createOrder
(
"建单"
,
"%s通过%s创建服务工单:%s"
),
firstAssignment
(
"首次指派"
,
"通过PEA派工给工程师%s"
),
reassignment
(
"改派"
,
"通过PEA派工给工程师%s"
),
cancel
(
"取消"
,
"%s在线指导解决"
),
recontracting
(
"改约"
,
"工程师%s/%s已改约,改约时间%s,改约原因:%s"
),
backOrderPool
(
"放回工单池"
,
"取消派工"
),
;
private
String
event
;
private
String
msg
;
OrderEventEnum
(
String
event
,
String
msg
)
{
this
.
event
=
event
;
this
.
msg
=
msg
;
}
public
String
getEvent
()
{
return
event
;
}
public
String
getMsg
()
{
return
msg
;
}
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/BeanRemoteServiceImpl.java
View file @
4e612c1
...
...
@@ -161,7 +161,7 @@ public class BeanRemoteServiceImpl {
return
Result
.
failed
(
beanR
.
getMessage
());
}
for
(
Department
department
:
beanR
.
getData
())
{
if
(
StringUtils
.
is
Blank
(
department
.
getBsDeptId
()
))
{
if
(
StringUtils
.
is
NotBlank
(
department
.
getCode
())
&&
department
.
getCode
().
contains
(
"beanTest"
))
{
continue
;
}
log
.
info
(
"处理部门详情---->{}"
,
department
.
getBsDeptId
());
...
...
@@ -193,8 +193,8 @@ public class BeanRemoteServiceImpl {
*/
private
void
disposeChildren
(
Department
departments
,
String
accessToken
,
Boolean
isDisposeData
,
String
parentId
)
{
for
(
Department
department
:
departments
.
getChildren
())
{
if
(
StringUtils
.
is
Blank
(
department
.
getBsDeptId
()
))
{
return
;
if
(
StringUtils
.
is
NotBlank
(
department
.
getCode
())
&&
department
.
getCode
().
contains
(
"beanTest"
))
{
continue
;
}
log
.
info
(
"处理部门详情---->{}"
,
department
.
getBsDeptId
());
if
(!
BeanRegionIdEnum
.
getEnumByRegionId
(
department
.
getBsDeptId
()))
{
...
...
@@ -212,7 +212,7 @@ public class BeanRemoteServiceImpl {
}
disposeChildren
(
department
,
accessToken
,
isDisposeData
,
departments
.
getBsDeptId
());
//大区数据处理完重置
if
(
department
.
getDeptLevel
().
equals
(
BeanOrgLevelEnum
.
REGION
.
getCode
()))
{
if
(
StringUtils
.
isBlank
(
department
.
getDeptLevel
())
||
department
.
getDeptLevel
().
equals
(
BeanOrgLevelEnum
.
REGION
.
getCode
()))
{
isDisposeData
=
false
;
}
}
...
...
@@ -293,15 +293,15 @@ public class BeanRemoteServiceImpl {
groupEntity
.
setWarehouseEnabled
(
data
.
getPeripheralWarehouseEnabled
());
groupEntity
.
setReserveTimeMax
(
data
.
getPartReserveTimeMax
());
//处理clusterId和branchId
OrgBranchEntity
branchEntity
=
branchMap
.
get
(
data
.
get
ParentId
());
OrgBranchEntity
branchEntity
=
branchMap
.
get
(
data
.
get
BelongedBranch
());
if
(
ObjUtil
.
isNull
(
branchEntity
))
{
branchEntity
=
orgBranchDao
.
getByBranchId
(
data
.
get
ParentId
());
branchEntity
=
orgBranchDao
.
getByBranchId
(
data
.
get
BelongedBranch
());
if
(
ObjUtil
.
isNull
(
branchEntity
))
{
return
Result
.
failed
();
}
branchMap
.
put
(
data
.
get
ParentId
(),
branchEntity
);
branchMap
.
put
(
data
.
get
BelongedBranch
(),
branchEntity
);
}
groupEntity
.
setBranchId
(
data
.
get
ParentId
());
groupEntity
.
setBranchId
(
data
.
get
BelongedBranch
());
groupEntity
.
setClusterId
(
branchEntity
.
getClusterId
());
//处理分站外围
if
(
data
.
getDeptType
().
equals
(
BeanOrgLevelEnum
.
PERIPHERY
.
getCode
()))
{
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderCreateServiceImpl.java
View file @
4e612c1
...
...
@@ -29,6 +29,7 @@ import com.dituhui.pea.order.dto.param.OrderDTO;
import
com.dituhui.pea.order.dto.param.OrgTeamInfo
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.enums.AppointmentMethodEnum
;
import
com.dituhui.pea.order.enums.OrderEventEnum
;
import
com.dituhui.pea.order.enums.OrderFlowEnum
;
import
com.dituhui.pea.order.enums.OrderStatusEnum
;
import
com.dituhui.pea.order.service.*
;
...
...
@@ -165,14 +166,17 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity
.
setIsAppointEngineer
(
req
.
getIsAppointEngineer
());
String
appointEngineerCodes
=
CollectionUtils
.
isEmpty
(
req
.
getAppointEngineerCodes
())
?
null
:
String
.
join
(
","
,
req
.
getAppointEngineerCodes
());
entity
.
setAppointEngineerCodes
(
appointEngineerCodes
);
OrgTeamEntity
byTeamId
=
null
;
String
engineerName
=
null
;
if
(
req
.
getIsAppointEngineer
()
==
1
)
{
EngineerInfoEntity
engineerInfo
=
engineerInfoDao
.
getByEngineerCode
(
req
.
getAppointEngineerCodes
().
get
(
0
));
List
<
OrgTeamEngineerEntity
>
orgTeamEngineers
=
orgTeamEngineerDao
.
findByEngineerCode
(
req
.
getAppointEngineerCodes
().
get
(
0
));
if
(
CollectionUtils
.
isEmpty
(
orgTeamEngineers
))
{
return
Result
.
failed
(
StatusCodeEnum
.
FENDAN_TEAM_UNMATCHED
);
}
OrgTeamEntity
byTeamId
=
orgTeamDao
.
getByTeamId
(
orgTeamEngineers
.
get
(
0
).
getTeamId
());
byTeamId
=
orgTeamDao
.
getByTeamId
(
orgTeamEngineers
.
get
(
0
).
getTeamId
());
entity
.
setEngineerCode
(
engineerInfo
.
getEngineerCode
());
engineerName
=
engineerInfo
.
getName
();
entity
.
setEngineerName
(
engineerInfo
.
getName
());
entity
.
setEngineerPhone
(
engineerInfo
.
getPhone
());
entity
.
setEngineerPhone
(
engineerInfo
.
getPhone
());
...
...
@@ -205,6 +209,9 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity
.
setAppointmentMethod
(
AppointmentMethodEnum
.
MANUAL
.
name
());
//发送通知分部消息
sendMsg
(
branchEntity
.
getBranchId
(),
orderId
,
entity
.
getExpectTimeBegin
().
toLocalDate
());
Integer
cutoff
=
CommonUtil
.
isCutoff
(
LocalDateTime
.
now
(),
null
);
entity
.
setIsCutoff
(
cutoff
);
}
else
{
// 根据分单工作队,填写clusterId/branchId/groupId/teamId等
OrgTeamInfo
teamInfo
=
fendanResult
.
getResult
();
...
...
@@ -218,10 +225,13 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity
.
getExpectTimeEnd
().
toLocalTime
(),
teamInfo
.
getWorkOn
(),
teamInfo
.
getWorkOff
());
Integer
cutoff
=
CommonUtil
.
isCutoff
(
LocalDateTime
.
now
(),
teamInfo
.
getWorkOff
());
// 处理cutoff 动态排班结束后创建的当日单和次日单
boolean
isToday
=
DateUtil
.
judgeTimeIsToday
(
entity
.
getExpectTimeBegin
());
boolean
isTomorrow
=
DateUtil
.
judgeTimeIsisTomorrow
(
entity
.
getExpectTimeBegin
());
//次日单自动批量
if
(
isTomorrow
)
{
entity
.
setAppointmentMethod
(
AppointmentMethodEnum
.
AUTO_BATCH
.
name
());
}
// 特殊时间段,当天单,cutoff需要人工处理
if
(
isToday
||
(
isTomorrow
&&
cutoff
==
1
)
||
special
==
1
)
{
if
(
cutoff
==
1
||
special
==
1
)
{
//判断是否在今天cutoff之后
entity
.
setIsCutoff
(
cutoff
);
entity
.
setIsSpecialTime
(
special
);
...
...
@@ -268,10 +278,10 @@ public class OrderCreateServiceImpl implements OrderCreateService {
String
joinTags
=
CollectionUtils
.
isEmpty
(
req
.
getOrderTags
())
?
""
:
String
.
join
(
","
,
req
.
getOrderTags
());
entity
.
setBeanTags
(
joinTags
);
entity
.
setBeanPriority
(
req
.
getPriority
());
if
(
req
.
getPriority
().
equals
(
"1"
)){
if
(
req
.
getPriority
().
equals
(
"1"
))
{
entity
.
setAppointmentMethod
(
AppointmentMethodEnum
.
AUTO_NOW
.
name
());
//发送通知分部消息
sendMsg
(
entity
.
getOrgBranchId
(),
orderId
,
entity
.
getExpectTimeBegin
().
toLocalDate
());
//
sendMsg(entity.getOrgBranchId(), orderId, entity.getExpectTimeBegin().toLocalDate());
}
entity
.
setIsMultiple
(
joinTags
.
contains
(
"重物搬运"
)
?
1
:
0
);
...
...
@@ -281,7 +291,11 @@ public class OrderCreateServiceImpl implements OrderCreateService {
// 记录订单和节点
orderInfoDao
.
save
(
entity
);
commonService
.
addOrderEvent
(
orderId
,
""
,
req
.
getSource
(),
"API"
,
OrderStatusEnum
.
CREATE
.
getDescription
(),
OrderStatusEnum
.
CREATE
.
getDescription
(),
""
);
commonService
.
addOrderEvent
(
orderId
,
""
,
req
.
getSource
(),
"API"
,
OrderEventEnum
.
createOrder
.
getEvent
(),
String
.
format
(
OrderEventEnum
.
createOrder
.
getMsg
(),
req
.
getSource
(),
"BEAN"
,
req
.
getOrderId
()),
""
);
if
(
req
.
getIsAppointEngineer
()
==
1
)
{
commonService
.
addOrderEvent
(
orderId
,
""
,
req
.
getSource
(),
"PEA"
,
OrderEventEnum
.
firstAssignment
.
getEvent
(),
String
.
format
(
OrderEventEnum
.
firstAssignment
.
getMsg
(),
engineerName
+
"-"
+
byTeamId
.
getTeamName
()),
""
);
}
return
Result
.
success
(
null
);
}
...
...
project-order/src/main/java/com/dituhui/pea/order/utils/CommonUtil.java
View file @
4e612c1
...
...
@@ -3,6 +3,7 @@ package com.dituhui.pea.order.utils;
import
cn.hutool.core.util.StrUtil
;
import
com.dituhui.pea.util.DateUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
...
...
@@ -88,6 +89,12 @@ public class CommonUtil {
* @return
*/
public
static
Integer
isCutoff
(
LocalDateTime
localTime
,
String
strOff
)
{
if
(
DateUtil
.
judgeTimeIsToday
(
localTime
))
{
return
1
;
}
if
(
StringUtils
.
isBlank
(
strOff
))
{
return
0
;
}
LocalDateTime
workOff
=
LocalDate
.
now
().
atTime
(
Integer
.
parseInt
(
strOff
.
split
(
":"
)[
0
]),
Integer
.
parseInt
(
strOff
.
split
(
":"
)[
1
]),
0
);
if
(
localTime
.
isAfter
(
workOff
))
{
return
1
;
...
...
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