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 04a30973
authored
Nov 15, 2023
by
刘鑫
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
https://gitlab.dituhui.com/bsh/project/project
into develop
2 parents
3bf5db3f
978f483f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
22 deletions
project-order/src/main/java/com/dituhui/pea/order/dto/OrderServiceListReq.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/OrderServiceListServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/dto/OrderServiceListReq.java
View file @
04a3097
...
@@ -13,10 +13,12 @@ public class OrderServiceListReq {
...
@@ -13,10 +13,12 @@ public class OrderServiceListReq {
private
String
levelType
;
private
String
levelType
;
@NotNull
@NotNull
private
String
levelValue
;
private
String
levelValue
;
// @NotNull
// private String startDate;
// @NotNull
// private String endDate;
@NotNull
@NotNull
private
String
startDate
;
private
String
date
;
@NotNull
private
String
endDate
;
@NotNull
@NotNull
private
long
page
;
private
long
page
;
@NotNull
@NotNull
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderInfoServiceImpl.java
View file @
04a3097
...
@@ -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
;
}
}
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderServiceListServiceImpl.java
View file @
04a3097
...
@@ -44,15 +44,11 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
...
@@ -44,15 +44,11 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
//分页
//分页
Page
<
OrderInfo
>
pg
=
new
Page
(
reqDTO
.
getPage
(),
reqDTO
.
getSize
());
Page
<
OrderInfo
>
pg
=
new
Page
(
reqDTO
.
getPage
(),
reqDTO
.
getSize
());
LocalDate
startDate
=
TimeUtils
.
IsoDate2LocalDate
(
reqDTO
.
getStartDate
());
LocalDate
endDate
=
TimeUtils
.
IsoDate2LocalDate
(
reqDTO
.
getEndDate
());
LambdaQueryWrapper
<
OrderInfo
>
lqw
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
OrderInfo
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
eq
(
reqDTO
.
getLevelType
().
equals
(
"cluster"
),
OrderInfo:
:
getOrgClusterId
,
reqDTO
.
getLevelValue
());
lqw
.
eq
(
reqDTO
.
getLevelType
().
equals
(
"cluster"
),
OrderInfo:
:
getOrgClusterId
,
reqDTO
.
getLevelValue
());
lqw
.
eq
(
reqDTO
.
getLevelType
().
equals
(
"branch"
),
OrderInfo:
:
getOrgBranchId
,
reqDTO
.
getLevelValue
());
lqw
.
eq
(
reqDTO
.
getLevelType
().
equals
(
"branch"
),
OrderInfo:
:
getOrgBranchId
,
reqDTO
.
getLevelValue
());
lqw
.
eq
(
reqDTO
.
getLevelType
().
equals
(
"group"
),
OrderInfo:
:
getOrgGroupId
,
reqDTO
.
getLevelValue
());
lqw
.
eq
(
reqDTO
.
getLevelType
().
equals
(
"group"
),
OrderInfo:
:
getOrgGroupId
,
reqDTO
.
getLevelValue
());
lqw
.
ge
(
OrderInfo:
:
getDt
,
startDate
);
//预约开始日期
lqw
.
eq
(
OrderInfo:
:
getDt
,
reqDTO
.
getDate
());
//预约开始日期
lqw
.
le
(
OrderInfo:
:
getDt
,
endDate
);
//预约开始日期
//筛选项
//筛选项
if
(
StringUtils
.
isNotBlank
(
reqDTO
.
getOrderId
()))
{
if
(
StringUtils
.
isNotBlank
(
reqDTO
.
getOrderId
()))
{
lqw
.
in
(
StringUtils
.
isNotEmpty
(
reqDTO
.
getOrderId
()),
OrderInfo:
:
getOrderId
,
reqDTO
.
getOrderId
().
split
(
","
));
lqw
.
in
(
StringUtils
.
isNotEmpty
(
reqDTO
.
getOrderId
()),
OrderInfo:
:
getOrderId
,
reqDTO
.
getOrderId
().
split
(
","
));
...
...
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