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
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
7 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 {
double
[]
location
=
this
.
getEngineerDepartureLocation
(
engineerCode
);
double
preX
=
location
[
0
];
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
);
Pair
p
=
this
.
getDistanceAndDuration
(
pre
.
getX
(),
pre
.
getY
(),
curX
,
curY
);
...
...
@@ -110,6 +119,15 @@ public class OrderAssignCheck {
double
[]
location
=
this
.
getEngineerDepartureLocation
(
engineerCode
);
double
preX
=
location
[
0
];
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
cur
=
new
OrderSegment
(-
1
,
-
1
,
curX
,
curY
,
takeTime
,
-
1
,
-
1
);
...
...
@@ -254,6 +272,9 @@ public class OrderAssignCheck {
//从org_group中获取
EngineerInfoEntity
e
=
engineerInfoDao
.
getByEngineerCode
(
engineerCode
);
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
())};
}
...
...
project-order/src/main/java/com/dituhui/pea/order/service/OrderInfoService.java
View file @
25bf4a8
...
...
@@ -77,10 +77,10 @@ public interface OrderInfoService {
*
* @param source 原订单
* @param target 改动后订单
* @param
happened 变动发生
时间
* @param
rescheduled 工单计划
时间
* @param reason 改约原因
* @param operator 操作人
* @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 {
return
Result
.
failed
(
StatusCodeEnum
.
ORDER_FINISHED
);
}
final
OrderInfoEntity
sourceOrder
=
new
OrderInfoEntity
();
BeanUtils
.
copyProperties
(
sourceO
rder
,
sourceOrder
);
BeanUtils
.
copyProperties
(
o
rder
,
sourceOrder
);
OrgTeamEntity
orgTeam
=
orgTeamDao
.
getByTeamId
(
order
.
getOrgTeamId
());
// 判断cutoff
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 {
@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"
))
{
return
true
;
}
...
...
@@ -502,13 +502,15 @@ public class OrderInfoServiceImpl implements OrderInfoService {
rescheduled
.
setInitiatorOfRescheduling
(
operator
);
rescheduled
.
setReasonForRescheduling
(
OrderReschedulingReason
.
getReason
(
reason
));
rescheduled
.
setRescheduledDate
(
happened
.
getTime
(
));
rescheduled
.
setRescheduledDate
(
DateUtil
.
toMilliseconds
(
target
.
getPlanStartTime
()
));
rescheduled
.
setRequireApprove
(
Boolean
.
FALSE
);
if
(
StringUtils
.
isNotBlank
(
target
.
getEngineerCode
()))
{
String
engineerCode
=
target
.
getEngineerCode
();
EngineerInfoEntity
byEngineerCode
=
engineerInfoDao
.
getByEngineerCode
(
engineerCode
);
rescheduled
.
setExecutorWorkNo
(
byEngineerCode
.
getCosmosId
());
rescheduled
.
setOrgUnitId
(
byEngineerCode
.
getGroupId
());
}
if
(
StringUtils
.
isNotBlank
(
target
.
getEngineerCodeSub
()))
{
EngineerInfoEntity
code
=
engineerInfoDao
.
getByEngineerCode
(
target
.
getEngineerCodeSub
());
rescheduled
.
setAssistantWorkNo
(
code
.
getCosmosId
());
...
...
@@ -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
())))
{
rescheduled
.
setReassignment
(
Boolean
.
TRUE
);
}
else
{
...
...
@@ -649,6 +651,8 @@ public class OrderInfoServiceImpl implements OrderInfoService {
continue
;
}
OrderInfoEntity
nestOrder
=
orderInfoDao
.
getByOrderId
(
orderSegment
.
getOrderId
());
final
OrderInfoEntity
sourceOrder
=
new
OrderInfoEntity
();
BeanUtils
.
copyProperties
(
nestOrder
,
sourceOrder
);
if
(
orderSegment
.
getIsSub
())
{
nestOrder
.
setSubPlanStartTime
(
nestOrder
.
getSubPlanStartTime
().
plusMinutes
(
moveTime
));
nestOrder
.
setSubPlanEndTime
(
nestOrder
.
getSubPlanEndTime
().
plusMinutes
(
moveTime
));
...
...
@@ -656,6 +660,13 @@ public class OrderInfoServiceImpl implements OrderInfoService {
nestOrder
.
setPlanStartTime
(
nestOrder
.
getPlanStartTime
().
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
);
continue
;
}
...
...
@@ -694,6 +705,8 @@ public class OrderInfoServiceImpl implements OrderInfoService {
}
OrderInfoEntity
nestOrder
=
orderInfoDao
.
getByOrderId
(
nestOrderSegment
.
getOrderId
());
final
OrderInfoEntity
sourceOrder
=
new
OrderInfoEntity
();
BeanUtils
.
copyProperties
(
nestOrder
,
sourceOrder
);
nestOrder
.
setArriveElapsed
(
roadTime
);
nestOrder
.
setArriveDistance
(
BigDecimal
.
valueOf
(
distanceDTO
.
getDis
()).
intValue
());
if
(
orderSegment
.
getStart
().
plusMinutes
(
takeTime
+
roadTime
).
compareTo
(
nestOrder
.
getPlanStartTime
())
>
0
)
{
...
...
@@ -705,6 +718,13 @@ public class OrderInfoServiceImpl implements OrderInfoService {
isMove
=
true
;
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
);
return
Result
.
success
(
insertOrder
);
}
...
...
@@ -769,6 +789,8 @@ public class OrderInfoServiceImpl implements OrderInfoService {
}
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
();
if
(
orderSegment
.
getIsSub
())
{
nestOrder
=
handleSubOrder
(
nestOrder
,
nestOrder
.
getPlanStartTime
().
plusMinutes
(
minutes
),
roadTime
,
BigDecimal
.
valueOf
(
distanceDTO
.
getDis
()).
intValue
());
...
...
@@ -778,6 +800,13 @@ public class OrderInfoServiceImpl implements OrderInfoService {
nestOrder
.
setPlanStartTime
(
nestOrder
.
getPlanStartTime
().
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
);
//下一单为待插入订单且为最后一单直接返回
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 {
public
static
Integer
isSpecial
(
LocalTime
expectBegin
,
LocalTime
expectEnd
,
String
strOn
,
String
strOff
)
{
LocalTime
workOn
=
LocalTime
.
parse
(
strOn
+
":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
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