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 39797ca5
authored
Nov 15, 2023
by
huangjinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:插单处理请假时间
1 parent
822072a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
14 deletions
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderInfoServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderInfoServiceImpl.java
View file @
39797ca
...
@@ -460,11 +460,13 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -460,11 +460,13 @@ public class OrderInfoServiceImpl implements OrderInfoService {
LocalDateTime
workStartTime
=
insertOrder
.
getExpectTimeBegin
();
LocalDateTime
workStartTime
=
insertOrder
.
getExpectTimeBegin
();
LocalDateTime
workEndTime
=
insertOrder
.
getExpectTimeEnd
();
LocalDateTime
workEndTime
=
insertOrder
.
getExpectTimeEnd
();
//查询工程师当天出勤时间
//查询工程师当天出勤时间
List
<
OccupyInfoDetail
>
engineerWorkTimeSlice
=
engineerCalendarService
.
timeWindowsSlice
(
engineer
.
getEngineerCode
(),
orgTeam
.
getTeamId
(),
insertOrder
.
getDt
());
// List<OccupyInfoDetail> engineerWorkTimeSlice = engineerCalendarService.timeWindowsSlice(engineer.getEngineerCode(), orgTeam.getTeamId(), insertOrder.getDt());
log
.
info
(
"【engineerWorkTimeSlice】结果------------->{}"
,
JsonUtil
.
toJson
(
engineerWorkTimeSlice
));
//查询工程师当天请假时间
List
<
OccupyInfoDetail
>
engineerLeaveTimeSlice
=
engineerCalendarService
.
getEngineerWorkDayCalendar
(
engineer
.
getEngineerCode
(),
insertOrder
.
getDt
());
log
.
info
(
"【engineerWorkTimeSlice】结果------------->{}"
,
JsonUtil
.
toJson
(
engineerLeaveTimeSlice
));
// 没有单直接返回
// 没有单直接返回
if
(
CollectionUtils
.
isEmpty
(
engineerOrders
))
{
if
(
CollectionUtils
.
isEmpty
(
engineerOrders
))
{
LocalDateTime
planStartTime
=
handle
WorkTime
(
engineerWorkTimeSlice
,
insertOrder
.
getExpectTimeBegin
(),
insertOrder
.
getExpectTimeBegin
().
plusMinutes
(
skillInfo
.
getTakeTime
()
));
LocalDateTime
planStartTime
=
handle
LeaveTime
(
engineerLeaveTimeSlice
,
insertOrder
.
getExpectTimeBegin
(),
insertOrder
.
getExpectTimeEnd
(),
skillInfo
.
getTakeTime
(
));
if
(
ObjectUtil
.
isNull
(
planStartTime
))
{
if
(
ObjectUtil
.
isNull
(
planStartTime
))
{
return
Result
.
failed
(
insertOrder
);
return
Result
.
failed
(
insertOrder
);
}
}
...
@@ -493,7 +495,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -493,7 +495,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
}
}
// 没有单直接返回
// 没有单直接返回
if
(
CollectionUtils
.
isEmpty
(
orderSegments
))
{
if
(
CollectionUtils
.
isEmpty
(
orderSegments
))
{
LocalDateTime
planStartTime
=
handle
WorkTime
(
engineerWorkTimeSlice
,
insertOrder
.
getExpectTimeBegin
(),
insertOrder
.
getExpectTimeBegin
().
plusMinutes
(
skillInfo
.
getTakeTime
()
));
LocalDateTime
planStartTime
=
handle
LeaveTime
(
engineerLeaveTimeSlice
,
insertOrder
.
getExpectTimeBegin
(),
insertOrder
.
getExpectTimeEnd
(),
skillInfo
.
getTakeTime
(
));
if
(
ObjectUtil
.
isNull
(
planStartTime
))
{
if
(
ObjectUtil
.
isNull
(
planStartTime
))
{
return
Result
.
failed
(
insertOrder
);
return
Result
.
failed
(
insertOrder
);
}
}
...
@@ -515,7 +517,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -515,7 +517,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
int
roadTime
=
distanceDTO
.
getTime
()
/
1000
;
int
roadTime
=
distanceDTO
.
getTime
()
/
1000
;
// 先判断第一单开始时间
// 先判断第一单开始时间
if
(
i
==
0
&&
orderSegment
.
getStart
().
compareTo
(
workStartTime
.
plusMinutes
(
takeTime
+
roadTime
))
>=
0
)
{
if
(
i
==
0
&&
orderSegment
.
getStart
().
compareTo
(
workStartTime
.
plusMinutes
(
takeTime
+
roadTime
))
>=
0
)
{
LocalDateTime
planStartTime
=
handle
WorkTime
(
engineerWorkTimeSlice
,
insertOrder
.
getExpectTimeBegin
(),
insertOrder
.
getExpectTimeBegin
().
plusMinutes
(
skillInfo
.
getTakeTime
()
));
LocalDateTime
planStartTime
=
handle
LeaveTime
(
engineerLeaveTimeSlice
,
insertOrder
.
getExpectTimeBegin
(),
insertOrder
.
getExpectTimeEnd
(),
skillInfo
.
getTakeTime
(
));
if
(
ObjectUtil
.
isNull
(
planStartTime
))
{
if
(
ObjectUtil
.
isNull
(
planStartTime
))
{
return
Result
.
failed
(
insertOrder
);
return
Result
.
failed
(
insertOrder
);
}
}
...
@@ -538,11 +540,11 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -538,11 +540,11 @@ public class OrderInfoServiceImpl implements OrderInfoService {
// 判断工单开始时间
// 判断工单开始时间
LocalDateTime
planStartTime
=
insertOrder
.
getExpectTimeBegin
().
compareTo
(
orderSegment
.
getEnd
().
plusMinutes
(
roadTime
))
>=
0
?
LocalDateTime
planStartTime
=
insertOrder
.
getExpectTimeBegin
().
compareTo
(
orderSegment
.
getEnd
().
plusMinutes
(
roadTime
))
>=
0
?
insertOrder
.
getExpectTimeBegin
()
:
orderSegment
.
getEnd
().
plusMinutes
(
roadTime
);
insertOrder
.
getExpectTimeBegin
()
:
orderSegment
.
getEnd
().
plusMinutes
(
roadTime
);
planStartTime
=
handle
WorkTime
(
engineerWorkTimeSlice
,
planStartTime
,
planStartTime
.
plusMinutes
(
skillInfo
.
getTakeTime
()
));
planStartTime
=
handle
LeaveTime
(
engineerLeaveTimeSlice
,
planStartTime
,
insertOrder
.
getExpectTimeEnd
(),
skillInfo
.
getTakeTime
(
));
if
(
ObjectUtil
.
isNull
(
planStartTime
))
{
if
(
ObjectUtil
.
isNull
(
planStartTime
))
{
return
Result
.
failed
(
insertOrder
);
return
Result
.
failed
(
insertOrder
);
}
}
insertOrder
.
setArrive
Distance
(
roadTime
);
insertOrder
.
setArrive
Elapsed
(
roadTime
);
insertOrder
.
setArriveDistance
(
BigDecimal
.
valueOf
(
distanceDTO
.
getDis
()
*
1000
).
intValue
());
insertOrder
.
setArriveDistance
(
BigDecimal
.
valueOf
(
distanceDTO
.
getDis
()
*
1000
).
intValue
());
insertOrder
.
setTakeTime
(
skillInfo
.
getTakeTime
());
insertOrder
.
setTakeTime
(
skillInfo
.
getTakeTime
());
insertOrder
.
setPlanStartTime
(
planStartTime
);
insertOrder
.
setPlanStartTime
(
planStartTime
);
...
@@ -561,19 +563,19 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -561,19 +563,19 @@ public class OrderInfoServiceImpl implements OrderInfoService {
// 判断工单开始时间
// 判断工单开始时间
LocalDateTime
planStartTime
=
insertOrder
.
getExpectTimeBegin
().
compareTo
(
orderSegment
.
getEnd
().
plusMinutes
(
roadTime
))
>=
0
?
LocalDateTime
planStartTime
=
insertOrder
.
getExpectTimeBegin
().
compareTo
(
orderSegment
.
getEnd
().
plusMinutes
(
roadTime
))
>=
0
?
insertOrder
.
getExpectTimeBegin
()
:
orderSegment
.
getEnd
().
plusMinutes
(
roadTime
);
insertOrder
.
getExpectTimeBegin
()
:
orderSegment
.
getEnd
().
plusMinutes
(
roadTime
);
planStartTime
=
handle
WorkTime
(
engineerWorkTimeSlice
,
planStartTime
,
planStartTime
.
plusMinutes
(
skillInfo
.
getTakeTime
()
));
planStartTime
=
handle
LeaveTime
(
engineerLeaveTimeSlice
,
planStartTime
,
insertOrder
.
getExpectTimeEnd
(),
skillInfo
.
getTakeTime
(
));
if
(
ObjectUtil
.
isNull
(
planStartTime
))
{
if
(
ObjectUtil
.
isNull
(
planStartTime
))
{
return
Result
.
failed
(
insertOrder
);
return
Result
.
failed
(
insertOrder
);
}
}
insertOrder
.
setArrive
Distance
(
roadTime
);
insertOrder
.
setArrive
Elapsed
(
roadTime
);
insertOrder
.
setArriveDistance
(
BigDecimal
.
valueOf
(
distanceDTO
.
getDis
()
*
1000
).
intValue
());
insertOrder
.
setArriveDistance
(
BigDecimal
.
valueOf
(
distanceDTO
.
getDis
()
*
1000
).
intValue
());
insertOrder
.
setTakeTime
(
skillInfo
.
getTakeTime
());
insertOrder
.
setTakeTime
(
skillInfo
.
getTakeTime
());
insertOrder
.
setPlanStartTime
(
planStartTime
);
insertOrder
.
setPlanStartTime
(
planStartTime
);
insertOrder
.
setPlanEndTime
(
planStartTime
.
plusMinutes
(
skillInfo
.
getTakeTime
()));
insertOrder
.
setPlanEndTime
(
planStartTime
.
plusMinutes
(
skillInfo
.
getTakeTime
()));
OrderInfoEntity
nestOrder
=
orderInfoDao
.
getByOrderId
(
nestOrderSegment
.
getOrderId
());
OrderInfoEntity
nestOrder
=
orderInfoDao
.
getByOrderId
(
nestOrderSegment
.
getOrderId
());
nestOrder
.
setArrive
Distance
(
roadResult2
.
getResult
().
getTime
()
/
1000
);
nestOrder
.
setArrive
Elapsed
(
roadResult2
.
getResult
().
getTime
()
/
1000
);
nestOrder
.
setArrive
Elapsed
(
BigDecimal
.
valueOf
(
roadResult2
.
getResult
().
getDis
()
*
1000
).
intValue
());
nestOrder
.
setArrive
Distance
(
BigDecimal
.
valueOf
(
roadResult2
.
getResult
().
getDis
()
*
1000
).
intValue
());
orderInfoDao
.
save
(
nestOrder
);
orderInfoDao
.
save
(
nestOrder
);
return
Result
.
success
(
insertOrder
);
return
Result
.
success
(
insertOrder
);
}
}
...
@@ -582,6 +584,32 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -582,6 +584,32 @@ public class OrderInfoServiceImpl implements OrderInfoService {
}
}
/**
/**
* 处理工程师请假时间和工单计划开始时间
*
* @param engineerLeaveTimeSlice
* @param expectTimeBegin
* @param expectTimeEnd
* @return 工单计划开始时间
*/
private
LocalDateTime
handleLeaveTime
(
List
<
OccupyInfoDetail
>
engineerLeaveTimeSlice
,
LocalDateTime
expectTimeBegin
,
LocalDateTime
expectTimeEnd
,
Integer
takeTime
)
{
if
(
CollectionUtils
.
isEmpty
(
engineerLeaveTimeSlice
))
{
return
expectTimeBegin
;
}
for
(
int
i
=
0
;
i
<
engineerLeaveTimeSlice
.
size
();
i
++)
{
OccupyInfoDetail
occupyInfoDetail
=
engineerLeaveTimeSlice
.
get
(
i
);
// 处理请假开始时间
if
(
expectTimeBegin
.
plusMinutes
(
takeTime
).
compareTo
(
occupyInfoDetail
.
getBeginTime
())
<=
0
)
{
return
expectTimeBegin
;
}
if
(
expectTimeEnd
.
compareTo
(
occupyInfoDetail
.
getEndTime
().
plusMinutes
(
takeTime
))
>=
0
)
{
return
expectTimeBegin
.
compareTo
(
occupyInfoDetail
.
getEndTime
())
>=
0
?
expectTimeBegin
:
occupyInfoDetail
.
getEndTime
();
}
return
null
;
}
return
null
;
}
/**
* 处理工程师出勤时间和工单计划开始时间
* 处理工程师出勤时间和工单计划开始时间
*
*
* @param engineerWorkTimeSlice
* @param engineerWorkTimeSlice
...
@@ -589,16 +617,18 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -589,16 +617,18 @@ public class OrderInfoServiceImpl implements OrderInfoService {
* @param expectTimeEnd
* @param expectTimeEnd
* @return 工单计划开始时间
* @return 工单计划开始时间
*/
*/
private
LocalDateTime
handleWorkTime
(
List
<
OccupyInfoDetail
>
engineerWorkTimeSlice
,
LocalDateTime
expectTimeBegin
,
LocalDateTime
expectTimeEnd
)
{
private
LocalDateTime
handleWorkTime
(
List
<
OccupyInfoDetail
>
engineerWorkTimeSlice
,
LocalDateTime
expectTimeBegin
,
LocalDateTime
expectTimeEnd
,
Integer
takeTime
)
{
if
(
CollectionUtils
.
isEmpty
(
engineerWorkTimeSlice
))
{
if
(
CollectionUtils
.
isEmpty
(
engineerWorkTimeSlice
))
{
return
null
;
return
null
;
}
}
for
(
int
i
=
0
;
i
<
engineerWorkTimeSlice
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
engineerWorkTimeSlice
.
size
();
i
++)
{
OccupyInfoDetail
occupyInfoDetail
=
engineerWorkTimeSlice
.
get
(
i
);
OccupyInfoDetail
occupyInfoDetail
=
engineerWorkTimeSlice
.
get
(
i
);
if
(
expectTimeBegin
.
compareTo
(
occupyInfoDetail
.
getBeginTime
())
<
0
||
expectTimeEnd
.
compareTo
(
occupyInfoDetail
.
getEndTime
())
>
0
)
{
LocalDateTime
planStartTime
=
expectTimeBegin
.
compareTo
(
occupyInfoDetail
.
getBeginTime
())
>=
0
?
expectTimeBegin
:
occupyInfoDetail
.
getBeginTime
();
LocalDateTime
planEndTime
=
expectTimeEnd
.
compareTo
(
occupyInfoDetail
.
getEndTime
())
<=
0
?
expectTimeEnd
:
occupyInfoDetail
.
getEndTime
();
if
(
planStartTime
.
plusMinutes
(
takeTime
).
compareTo
(
planEndTime
)
>
0
)
{
continue
;
continue
;
}
}
return
expectTimeBegin
.
compareTo
(
occupyInfoDetail
.
getBeginTime
())
>=
0
?
expectTimeBegin
:
occupyInfoDetail
.
getBeginTime
()
;
return
planStartTime
;
}
}
return
null
;
return
null
;
}
}
...
...
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