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 25bf4a87
authored
Dec 06, 2023
by
huangjinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:1:特殊时间判断
2:推荐工程师空位置处理 3:放回工单池推送 4:bean消息推送优化
1 parent
ca328e5f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
15 deletions
project-order/src/main/java/com/dituhui/pea/order/common/OrderAssignCheck.java
project-order/src/main/java/com/dituhui/pea/order/service/OrderInfoService.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/utils/CommonUtil.java
project-order/src/main/java/com/dituhui/pea/order/common/OrderAssignCheck.java
View file @
25bf4a8
...
@@ -83,6 +83,15 @@ public class OrderAssignCheck {
...
@@ -83,6 +83,15 @@ public class OrderAssignCheck {
double
[]
location
=
this
.
getEngineerDepartureLocation
(
engineerCode
);
double
[]
location
=
this
.
getEngineerDepartureLocation
(
engineerCode
);
double
preX
=
location
[
0
];
double
preX
=
location
[
0
];
double
preY
=
location
[
1
];
double
preY
=
location
[
1
];
if
(
preX
==
0
||
preY
==
0
)
{
// 当前节点信息
OrderNode
curOrder
=
new
OrderNode
();
curOrder
.
setOrderId
(
orderId
);
curOrder
.
setArriveElapsed
(
0
);
curOrder
.
setArriveDistance
(
0
);
curOrder
.
setTakeTime
(
takeTime
);
return
new
Result
(
index
,
true
,
true
,
orderId
,
""
,
0
,
0
,
curOrder
,
null
,
null
);
}
OrderSegment
pre
=
new
OrderSegment
(
480
,
480
,
preX
,
preY
,
0
,
0
,
0
);
OrderSegment
pre
=
new
OrderSegment
(
480
,
480
,
preX
,
preY
,
0
,
0
,
0
);
Pair
p
=
this
.
getDistanceAndDuration
(
pre
.
getX
(),
pre
.
getY
(),
curX
,
curY
);
Pair
p
=
this
.
getDistanceAndDuration
(
pre
.
getX
(),
pre
.
getY
(),
curX
,
curY
);
...
@@ -110,6 +119,15 @@ public class OrderAssignCheck {
...
@@ -110,6 +119,15 @@ public class OrderAssignCheck {
double
[]
location
=
this
.
getEngineerDepartureLocation
(
engineerCode
);
double
[]
location
=
this
.
getEngineerDepartureLocation
(
engineerCode
);
double
preX
=
location
[
0
];
double
preX
=
location
[
0
];
double
preY
=
location
[
1
];
double
preY
=
location
[
1
];
if
(
preX
==
0
||
preY
==
0
)
{
// 当前节点信息
OrderNode
curOrder
=
new
OrderNode
();
curOrder
.
setOrderId
(
orderId
);
curOrder
.
setArriveElapsed
(
0
);
curOrder
.
setArriveDistance
(
0
);
curOrder
.
setTakeTime
(
takeTime
);
return
new
Result
(
index
,
true
,
true
,
orderId
,
""
,
0
,
0
,
curOrder
,
null
,
null
);
}
OrderSegment
pre
=
new
OrderSegment
(
480
,
480
,
preX
,
preY
,
0
,
0
,
0
);
OrderSegment
pre
=
new
OrderSegment
(
480
,
480
,
preX
,
preY
,
0
,
0
,
0
);
OrderSegment
cur
=
new
OrderSegment
(-
1
,
-
1
,
curX
,
curY
,
takeTime
,
-
1
,
-
1
);
OrderSegment
cur
=
new
OrderSegment
(-
1
,
-
1
,
curX
,
curY
,
takeTime
,
-
1
,
-
1
);
...
@@ -254,6 +272,9 @@ public class OrderAssignCheck {
...
@@ -254,6 +272,9 @@ public class OrderAssignCheck {
//从org_group中获取
//从org_group中获取
EngineerInfoEntity
e
=
engineerInfoDao
.
getByEngineerCode
(
engineerCode
);
EngineerInfoEntity
e
=
engineerInfoDao
.
getByEngineerCode
(
engineerCode
);
OrgGroupEntity
g
=
orgGroupDao
.
getByGroupId
(
e
.
getGroupId
());
OrgGroupEntity
g
=
orgGroupDao
.
getByGroupId
(
e
.
getGroupId
());
if
(
StringUtils
.
isBlank
(
g
.
getX
())
||
StringUtils
.
isBlank
(
g
.
getY
()))
{
return
new
double
[]{
Double
.
parseDouble
(
"0"
),
Double
.
parseDouble
(
"0"
)};
}
return
new
double
[]{
Double
.
parseDouble
(
g
.
getX
()),
Double
.
parseDouble
(
g
.
getY
())};
return
new
double
[]{
Double
.
parseDouble
(
g
.
getX
()),
Double
.
parseDouble
(
g
.
getY
())};
}
}
...
...
project-order/src/main/java/com/dituhui/pea/order/service/OrderInfoService.java
View file @
25bf4a8
...
@@ -75,12 +75,12 @@ public interface OrderInfoService {
...
@@ -75,12 +75,12 @@ public interface OrderInfoService {
/**
/**
* 派工消息通知bean
* 派工消息通知bean
*
*
* @param source 原订单
* @param source
原订单
* @param target 改动后订单
* @param target
改动后订单
* @param
happened 变动发生
时间
* @param
rescheduled 工单计划
时间
* @param reason 改约原因
* @param reason
改约原因
* @param operator 操作人
* @param operator
操作人
* @return
* @return
*/
*/
Boolean
rescheduled
(
OrderInfoEntity
source
,
OrderInfoEntity
target
,
Date
happen
ed
,
String
reason
,
String
operator
);
Boolean
rescheduled
(
OrderInfoEntity
source
,
OrderInfoEntity
target
,
Date
reschedul
ed
,
String
reason
,
String
operator
);
}
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderAssignImpl.java
View file @
25bf4a8
...
@@ -275,7 +275,7 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -275,7 +275,7 @@ public class OrderAssignImpl implements OrderAssign {
return
Result
.
failed
(
StatusCodeEnum
.
ORDER_FINISHED
);
return
Result
.
failed
(
StatusCodeEnum
.
ORDER_FINISHED
);
}
}
final
OrderInfoEntity
sourceOrder
=
new
OrderInfoEntity
();
final
OrderInfoEntity
sourceOrder
=
new
OrderInfoEntity
();
BeanUtils
.
copyProperties
(
sourceO
rder
,
sourceOrder
);
BeanUtils
.
copyProperties
(
o
rder
,
sourceOrder
);
OrgTeamEntity
orgTeam
=
orgTeamDao
.
getByTeamId
(
order
.
getOrgTeamId
());
OrgTeamEntity
orgTeam
=
orgTeamDao
.
getByTeamId
(
order
.
getOrgTeamId
());
// 判断cutoff
// 判断cutoff
Integer
cutoff
=
CommonUtil
.
isCutoff
(
order
.
getExpectTimeBegin
(),
orgTeam
.
getWorkOff
());
Integer
cutoff
=
CommonUtil
.
isCutoff
(
order
.
getExpectTimeBegin
(),
orgTeam
.
getWorkOff
());
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderInfoServiceImpl.java
View file @
25bf4a8
...
@@ -493,7 +493,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -493,7 +493,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
@Override
@Override
public
Boolean
rescheduled
(
OrderInfoEntity
source
,
OrderInfoEntity
target
,
Date
happened
,
String
reason
,
String
operator
)
{
public
Boolean
rescheduled
(
OrderInfoEntity
source
,
OrderInfoEntity
target
,
Date
rescheduledDate
,
String
reason
,
String
operator
)
{
if
(
source
.
getOrderId
().
startsWith
(
"peatest"
)
||
Objects
.
equals
(
operator
,
"BEAN"
))
{
if
(
source
.
getOrderId
().
startsWith
(
"peatest"
)
||
Objects
.
equals
(
operator
,
"BEAN"
))
{
return
true
;
return
true
;
}
}
...
@@ -502,13 +502,15 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -502,13 +502,15 @@ public class OrderInfoServiceImpl implements OrderInfoService {
rescheduled
.
setInitiatorOfRescheduling
(
operator
);
rescheduled
.
setInitiatorOfRescheduling
(
operator
);
rescheduled
.
setReasonForRescheduling
(
OrderReschedulingReason
.
getReason
(
reason
));
rescheduled
.
setReasonForRescheduling
(
OrderReschedulingReason
.
getReason
(
reason
));
rescheduled
.
setRescheduledDate
(
happened
.
getTime
(
));
rescheduled
.
setRescheduledDate
(
DateUtil
.
toMilliseconds
(
target
.
getPlanStartTime
()
));
rescheduled
.
setRequireApprove
(
Boolean
.
FALSE
);
rescheduled
.
setRequireApprove
(
Boolean
.
FALSE
);
String
engineerCode
=
target
.
getEngineerCode
();
if
(
StringUtils
.
isNotBlank
(
target
.
getEngineerCode
()))
{
EngineerInfoEntity
byEngineerCode
=
engineerInfoDao
.
getByEngineerCode
(
engineerCode
);
String
engineerCode
=
target
.
getEngineerCode
();
rescheduled
.
setExecutorWorkNo
(
byEngineerCode
.
getCosmosId
());
EngineerInfoEntity
byEngineerCode
=
engineerInfoDao
.
getByEngineerCode
(
engineerCode
);
rescheduled
.
setOrgUnitId
(
byEngineerCode
.
getGroupId
());
rescheduled
.
setExecutorWorkNo
(
byEngineerCode
.
getCosmosId
());
rescheduled
.
setOrgUnitId
(
byEngineerCode
.
getGroupId
());
}
if
(
StringUtils
.
isNotBlank
(
target
.
getEngineerCodeSub
()))
{
if
(
StringUtils
.
isNotBlank
(
target
.
getEngineerCodeSub
()))
{
EngineerInfoEntity
code
=
engineerInfoDao
.
getByEngineerCode
(
target
.
getEngineerCodeSub
());
EngineerInfoEntity
code
=
engineerInfoDao
.
getByEngineerCode
(
target
.
getEngineerCodeSub
());
rescheduled
.
setAssistantWorkNo
(
code
.
getCosmosId
());
rescheduled
.
setAssistantWorkNo
(
code
.
getCosmosId
());
...
@@ -516,7 +518,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -516,7 +518,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
}
}
//判断是否是改派
//判断是否是改派
if
((
StringUtils
.
isNotBlank
(
target
.
getEngineerCode
())
&&
!
Objects
.
equals
(
engineerCode
,
source
.
getEngineerCode
()))
||
if
((
StringUtils
.
isNotBlank
(
target
.
getEngineerCode
())
&&
!
Objects
.
equals
(
target
.
getEngineerCode
()
,
source
.
getEngineerCode
()))
||
(
StringUtils
.
isNotBlank
(
target
.
getEngineerCodeSub
())
&&
!
Objects
.
equals
(
target
.
getEngineerCodeSub
(),
source
.
getEngineerCodeSub
())))
{
(
StringUtils
.
isNotBlank
(
target
.
getEngineerCodeSub
())
&&
!
Objects
.
equals
(
target
.
getEngineerCodeSub
(),
source
.
getEngineerCodeSub
())))
{
rescheduled
.
setReassignment
(
Boolean
.
TRUE
);
rescheduled
.
setReassignment
(
Boolean
.
TRUE
);
}
else
{
}
else
{
...
@@ -649,6 +651,8 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -649,6 +651,8 @@ public class OrderInfoServiceImpl implements OrderInfoService {
continue
;
continue
;
}
}
OrderInfoEntity
nestOrder
=
orderInfoDao
.
getByOrderId
(
orderSegment
.
getOrderId
());
OrderInfoEntity
nestOrder
=
orderInfoDao
.
getByOrderId
(
orderSegment
.
getOrderId
());
final
OrderInfoEntity
sourceOrder
=
new
OrderInfoEntity
();
BeanUtils
.
copyProperties
(
nestOrder
,
sourceOrder
);
if
(
orderSegment
.
getIsSub
())
{
if
(
orderSegment
.
getIsSub
())
{
nestOrder
.
setSubPlanStartTime
(
nestOrder
.
getSubPlanStartTime
().
plusMinutes
(
moveTime
));
nestOrder
.
setSubPlanStartTime
(
nestOrder
.
getSubPlanStartTime
().
plusMinutes
(
moveTime
));
nestOrder
.
setSubPlanEndTime
(
nestOrder
.
getSubPlanEndTime
().
plusMinutes
(
moveTime
));
nestOrder
.
setSubPlanEndTime
(
nestOrder
.
getSubPlanEndTime
().
plusMinutes
(
moveTime
));
...
@@ -656,6 +660,13 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -656,6 +660,13 @@ public class OrderInfoServiceImpl implements OrderInfoService {
nestOrder
.
setPlanStartTime
(
nestOrder
.
getPlanStartTime
().
plusMinutes
(
moveTime
));
nestOrder
.
setPlanStartTime
(
nestOrder
.
getPlanStartTime
().
plusMinutes
(
moveTime
));
nestOrder
.
setPlanEndTime
(
nestOrder
.
getPlanEndTime
().
plusMinutes
(
moveTime
));
nestOrder
.
setPlanEndTime
(
nestOrder
.
getPlanEndTime
().
plusMinutes
(
moveTime
));
}
}
//回调改约
Boolean
boo
=
this
.
rescheduled
(
sourceOrder
,
nestOrder
,
new
Date
(),
""
,
"PEA"
);
log
.
info
(
"[insterEngineerOrders] orderId:{}, 通知bean结果: {}"
,
nestOrder
.
getOrderId
(),
boo
);
if
(!
boo
)
{
log
.
info
(
"[insterEngineerOrders] orderId:{}, 服务工单变更结果通知BEAN失败"
,
nestOrder
.
getOrderId
());
throw
new
BusinessException
(
"服务工单变更结果通知BEAN失败"
);
}
orderInfoDao
.
save
(
nestOrder
);
orderInfoDao
.
save
(
nestOrder
);
continue
;
continue
;
}
}
...
@@ -694,6 +705,8 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -694,6 +705,8 @@ public class OrderInfoServiceImpl implements OrderInfoService {
}
}
OrderInfoEntity
nestOrder
=
orderInfoDao
.
getByOrderId
(
nestOrderSegment
.
getOrderId
());
OrderInfoEntity
nestOrder
=
orderInfoDao
.
getByOrderId
(
nestOrderSegment
.
getOrderId
());
final
OrderInfoEntity
sourceOrder
=
new
OrderInfoEntity
();
BeanUtils
.
copyProperties
(
nestOrder
,
sourceOrder
);
nestOrder
.
setArriveElapsed
(
roadTime
);
nestOrder
.
setArriveElapsed
(
roadTime
);
nestOrder
.
setArriveDistance
(
BigDecimal
.
valueOf
(
distanceDTO
.
getDis
()).
intValue
());
nestOrder
.
setArriveDistance
(
BigDecimal
.
valueOf
(
distanceDTO
.
getDis
()).
intValue
());
if
(
orderSegment
.
getStart
().
plusMinutes
(
takeTime
+
roadTime
).
compareTo
(
nestOrder
.
getPlanStartTime
())
>
0
)
{
if
(
orderSegment
.
getStart
().
plusMinutes
(
takeTime
+
roadTime
).
compareTo
(
nestOrder
.
getPlanStartTime
())
>
0
)
{
...
@@ -705,6 +718,13 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -705,6 +718,13 @@ public class OrderInfoServiceImpl implements OrderInfoService {
isMove
=
true
;
isMove
=
true
;
continue
;
continue
;
}
}
//回调改约
Boolean
boo
=
this
.
rescheduled
(
sourceOrder
,
nestOrder
,
new
Date
(),
""
,
"PEA"
);
log
.
info
(
"[insterEngineerOrders] orderId:{}, 通知bean结果: {}"
,
nestOrder
.
getOrderId
(),
boo
);
if
(!
boo
)
{
log
.
info
(
"[insterEngineerOrders] orderId:{}, 服务工单变更结果通知BEAN失败"
,
nestOrder
.
getOrderId
());
throw
new
BusinessException
(
"服务工单变更结果通知BEAN失败"
);
}
orderInfoDao
.
save
(
nestOrder
);
orderInfoDao
.
save
(
nestOrder
);
return
Result
.
success
(
insertOrder
);
return
Result
.
success
(
insertOrder
);
}
}
...
@@ -769,6 +789,8 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -769,6 +789,8 @@ public class OrderInfoServiceImpl implements OrderInfoService {
}
}
OrderInfoEntity
nestOrder
=
orderInfoDao
.
getByOrderId
(
orderSegment
.
getOrderId
());
OrderInfoEntity
nestOrder
=
orderInfoDao
.
getByOrderId
(
orderSegment
.
getOrderId
());
final
OrderInfoEntity
sourceOrder
=
new
OrderInfoEntity
();
BeanUtils
.
copyProperties
(
nestOrder
,
sourceOrder
);
long
minutes
=
Duration
.
between
(
nestOrder
.
getPlanStartTime
(),
planStartTime
.
plusMinutes
(
takeTime
+
roadTime
)).
toMinutes
();
long
minutes
=
Duration
.
between
(
nestOrder
.
getPlanStartTime
(),
planStartTime
.
plusMinutes
(
takeTime
+
roadTime
)).
toMinutes
();
if
(
orderSegment
.
getIsSub
())
{
if
(
orderSegment
.
getIsSub
())
{
nestOrder
=
handleSubOrder
(
nestOrder
,
nestOrder
.
getPlanStartTime
().
plusMinutes
(
minutes
),
roadTime
,
BigDecimal
.
valueOf
(
distanceDTO
.
getDis
()).
intValue
());
nestOrder
=
handleSubOrder
(
nestOrder
,
nestOrder
.
getPlanStartTime
().
plusMinutes
(
minutes
),
roadTime
,
BigDecimal
.
valueOf
(
distanceDTO
.
getDis
()).
intValue
());
...
@@ -778,6 +800,13 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -778,6 +800,13 @@ public class OrderInfoServiceImpl implements OrderInfoService {
nestOrder
.
setPlanStartTime
(
nestOrder
.
getPlanStartTime
().
plusMinutes
(
minutes
));
nestOrder
.
setPlanStartTime
(
nestOrder
.
getPlanStartTime
().
plusMinutes
(
minutes
));
nestOrder
.
setPlanEndTime
(
nestOrder
.
getPlanEndTime
().
plusMinutes
(
minutes
));
nestOrder
.
setPlanEndTime
(
nestOrder
.
getPlanEndTime
().
plusMinutes
(
minutes
));
}
}
//回调改约
Boolean
boo
=
this
.
rescheduled
(
sourceOrder
,
nestOrder
,
new
Date
(),
""
,
"PEA"
);
log
.
info
(
"[insterEngineerOrders] orderId:{}, 通知bean结果: {}"
,
nestOrder
.
getOrderId
(),
boo
);
if
(!
boo
)
{
log
.
info
(
"[insterEngineerOrders] orderId:{}, 服务工单变更结果通知BEAN失败"
,
nestOrder
.
getOrderId
());
throw
new
BusinessException
(
"服务工单变更结果通知BEAN失败"
);
}
orderInfoDao
.
save
(
nestOrder
);
orderInfoDao
.
save
(
nestOrder
);
//下一单为待插入订单且为最后一单直接返回
//下一单为待插入订单且为最后一单直接返回
if
(
i
==
orderSegments
.
size
()
-
2
)
{
if
(
i
==
orderSegments
.
size
()
-
2
)
{
...
...
project-order/src/main/java/com/dituhui/pea/order/utils/CommonUtil.java
View file @
25bf4a8
...
@@ -78,7 +78,8 @@ public class CommonUtil {
...
@@ -78,7 +78,8 @@ public class CommonUtil {
public
static
Integer
isSpecial
(
LocalTime
expectBegin
,
LocalTime
expectEnd
,
String
strOn
,
String
strOff
)
{
public
static
Integer
isSpecial
(
LocalTime
expectBegin
,
LocalTime
expectEnd
,
String
strOn
,
String
strOff
)
{
LocalTime
workOn
=
LocalTime
.
parse
(
strOn
+
":00"
,
DateUtil
.
TIME_FORMATTER
);
LocalTime
workOn
=
LocalTime
.
parse
(
strOn
+
":00"
,
DateUtil
.
TIME_FORMATTER
);
LocalTime
workOff
=
LocalTime
.
parse
(
strOff
+
":00"
,
DateUtil
.
TIME_FORMATTER
);
LocalTime
workOff
=
LocalTime
.
parse
(
strOff
+
":00"
,
DateUtil
.
TIME_FORMATTER
);
if
(
expectBegin
.
isBefore
(
workOn
)
||
expectBegin
.
isAfter
(
workOff
)
||
expectEnd
.
isAfter
(
workOff
)
||
expectEnd
.
isBefore
(
workOn
))
{
// if (expectBegin.isBefore(workOn) || expectBegin.isAfter(workOff) || expectEnd.isAfter(workOff) || expectEnd.isBefore(workOn)) {
if
(
expectBegin
.
isAfter
(
workOff
)
||
expectEnd
.
isBefore
(
workOn
))
{
return
1
;
return
1
;
}
}
return
0
;
return
0
;
...
...
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