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 6d7f4d37
authored
Nov 20, 2023
by
刘鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(工作日历): 修改检查日程时间窗时跳过正在被修改的日程
1 parent
4adf9aaa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
24 deletions
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerCalendarServiceImpl.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/EngineerCalendarServiceImpl.java
View file @
6d7f4d3
...
...
@@ -40,6 +40,7 @@ import lombok.AllArgsConstructor;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.stereotype.Service
;
...
...
@@ -195,7 +196,7 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
if
(
time1
.
isBefore
(
LocalDateTime
.
now
())
||
time2
.
isBefore
(
LocalDateTime
.
now
()))
{
return
Result
.
failed
(
"只能更新未来时间"
);
}
Optional
<
CheckTime
>
checkTimeOptional
=
checkTimesHasOverlap
(
time1
.
toLocalDate
(),
engineerCode
,
time1
,
time2
);
Optional
<
CheckTime
>
checkTimeOptional
=
checkTimesHasOverlap
(
time1
.
toLocalDate
(),
engineerCode
,
time1
,
time2
,
reqDTO
.
getPlanId
()
);
if
(
checkTimeOptional
.
isPresent
())
{
CheckTime
checkTime
=
checkTimeOptional
.
get
();
throw
new
BusinessException
(
"工号为"
+
engineerCode
+
"的工程师在"
...
...
@@ -313,7 +314,7 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
if
(
beginDate
.
isEqual
(
endDate
))
{
LocalDateTime
startTime
=
DateUtils
.
localDateTimeFromStr
(
beginTime
);
LocalDateTime
endTime1
=
DateUtils
.
localDateTimeFromStr
(
endTime
);
Optional
<
CheckTime
>
checkTimeOptional
=
checkTimesHasOverlap
(
endDate
,
engineerCode
,
startTime
,
endTime1
);
Optional
<
CheckTime
>
checkTimeOptional
=
checkTimesHasOverlap
(
endDate
,
engineerCode
,
startTime
,
endTime1
,
""
);
if
(
checkTimeOptional
.
isPresent
())
{
CheckTime
checkTime
=
checkTimeOptional
.
get
();
throw
new
BusinessException
(
"工号为"
+
engineerCode
+
"的工程师在"
...
...
@@ -369,7 +370,7 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
e
.
setEndTime
(
DateUtils
.
localDateTimeFromStr
(
etime
));
}
//校验是否有当天时间段的记录
Optional
<
CheckTime
>
checkTimeOptional
=
checkTimesHasOverlap
(
current
,
engineerCode
,
e
.
getStartTime
(),
e
.
getEndTime
());
Optional
<
CheckTime
>
checkTimeOptional
=
checkTimesHasOverlap
(
current
,
engineerCode
,
e
.
getStartTime
(),
e
.
getEndTime
()
,
""
);
if
(
checkTimeOptional
.
isPresent
())
{
CheckTime
checkTime
=
checkTimeOptional
.
get
();
throw
new
BusinessException
(
"工号为"
+
engineerCode
+
"的工程师在"
...
...
@@ -390,12 +391,18 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
}
private
Optional
<
CheckTime
>
checkTimesHasOverlap
(
LocalDate
date
,
String
engineerCode
,
LocalDateTime
dynaStartTime
,
LocalDateTime
dynaEndTime
)
{
String
engineerCode
,
LocalDateTime
dynaStartTime
,
LocalDateTime
dynaEndTime
,
String
excludePlanId
)
{
//获取指定日期的工作人员日历
List
<
CapacityEngineerCalendarEntity
>
calendar
=
capacityEngineerCalendarDao
.
findCalendarByWorkdayAndEngineerCode
(
DateTimeUtil
.
formatDate
(
date
),
engineerCode
);
if
(
CollectionUtils
.
isEmpty
(
calendar
))
{
return
Optional
.
empty
();
}
if
(
StringUtils
.
isNotBlank
(
excludePlanId
))
{
calendar
=
calendar
.
stream
()
.
filter
(
t
->
!
Objects
.
equals
(
t
.
getPlanId
(),
excludePlanId
))
.
collect
(
Collectors
.
toList
());
}
//进行时间交集检查, 如果有交集返回 true 无则返回
return
calendar
.
stream
()
.
filter
(
t
->
{
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderAssignImpl.java
View file @
6d7f4d3
...
...
@@ -9,12 +9,11 @@ import com.dituhui.pea.order.common.DateUtils;
import
com.dituhui.pea.order.common.OrderAssignCheck
;
import
com.dituhui.pea.order.common.Stapial4jUtil
;
import
com.dituhui.pea.order.common.TimeUtils
;
import
com.dituhui.pea.order.common.jackson.DateUtil
;
import
com.dituhui.pea.order.dao.EngineerBusinessDao
;
import
com.dituhui.pea.order.dao.EngineerInfoDao
;
import
com.dituhui.pea.order.dao.EngineerSkillGroupDao
;
import
com.dituhui.pea.order.dao.OrderInfoDao
;
import
com.dituhui.pea.order.dao.OrgBranchDao
;
import
com.dituhui.pea.order.dao.OrgGroupDao
;
import
com.dituhui.pea.order.dao.OrgTeamDao
;
import
com.dituhui.pea.order.dao.OrgTeamEngineerDao
;
import
com.dituhui.pea.order.dao.SkillInfoDao
;
...
...
@@ -39,9 +38,8 @@ import com.dituhui.pea.order.enums.OrderFlowEnum;
import
com.dituhui.pea.order.enums.OrderStatusEnum
;
import
com.dituhui.pea.order.enums.ServiceStatusEnum
;
import
com.dituhui.pea.order.enums.TestimonialsEngineerTag
;
import
com.dituhui.pea.order.service.CapacityQueryService
;
import
com.dituhui.pea.order.service.CommonService
;
import
com.dituhui.pea.order.service.
Fendan
Service
;
import
com.dituhui.pea.order.service.
EngineerCalendar
Service
;
import
com.dituhui.pea.order.service.MsgService
;
import
com.dituhui.pea.order.service.OrderAssign
;
import
com.dituhui.pea.order.service.OrderInfoService
;
...
...
@@ -114,25 +112,16 @@ public class OrderAssignImpl implements OrderAssign {
private
OrderInfoService
orderInfoService
;
@Autowired
private
OrgGroupDao
orgGroupDao
;
@Autowired
private
FendanService
fendanService
;
@Autowired
private
OrgBranchDao
orgBranchDao
;
@Autowired
private
MsgService
msgService
;
@Autowired
private
CapacityQueryService
capacityQueryService
;
@Autowired
private
IUser
userService
;
@Autowired
private
EngineerBusinessDao
engineerBusinessDao
;
@Autowired
private
EngineerCalendarService
engineerCalendarService
;
@Transactional
@Override
...
...
@@ -144,9 +133,12 @@ public class OrderAssignImpl implements OrderAssign {
}
String
date
=
TimeUtils
.
IsoLocalDate2String
(
order
.
getDt
());
LocalDate
targetDate
=
LocalDate
.
parse
(
date
,
DateUtil
.
DATE_FORMATTER
);
// 获取符合筛选条件的技术员
// 改造本方法 让其支持标签返回
List
<
TempEngineer
>
engineerLocationList
=
this
.
searchEngineerCodes
(
order
,
req
.
getDistance
(),
req
.
getKey
(),
req
.
getRecommend
(),
req
.
getUserId
());
List
<
TempEngineer
>
engineerLocationList
=
this
.
searchEngineerCodes
(
order
,
req
.
getDistance
(),
req
.
getKey
(),
req
.
getRecommend
(),
req
.
getUserId
(),
targetDate
);
List
<
String
>
engineerCodes
=
engineerLocationList
.
stream
().
map
(
TempEngineer:
:
getEngineerCode
).
collect
(
Collectors
.
toList
());
Map
<
String
,
TempEngineer
>
engineerDistanceMap
=
engineerLocationList
.
stream
().
collect
(
Collectors
.
toMap
(
TempEngineer:
:
getEngineerCode
,
...
...
@@ -191,7 +183,7 @@ public class OrderAssignImpl implements OrderAssign {
engineerTag
=
TestimonialsEngineerTag
.
TEAM
;
}
else
if
(
tempEngineer
.
getDistance
().
compareTo
(
judgeDistance
)
<=
0
)
{
engineerTag
=
TestimonialsEngineerTag
.
PERIPHERAL
;
}
else
if
(
req
.
isSearch
())
{
}
else
if
(
req
.
isSearch
())
{
engineerTag
=
TestimonialsEngineerTag
.
SEARCH
;
}
else
{
engineerTag
=
TestimonialsEngineerTag
.
NONE
;
...
...
@@ -323,7 +315,8 @@ public class OrderAssignImpl implements OrderAssign {
return
order
;
}
private
List
<
TempEngineer
>
searchEngineerCodes
(
OrderInfoEntity
order
,
Double
distance
,
String
key
,
String
recommend
,
String
userId
)
{
private
List
<
TempEngineer
>
searchEngineerCodes
(
OrderInfoEntity
order
,
Double
distance
,
String
key
,
String
recommend
,
String
userId
,
LocalDate
targetDate
)
{
Set
<
String
>
engineerCodes1
=
this
.
searchEngineerByRecommend
(
order
,
recommend
,
userId
);
if
(
engineerCodes1
.
isEmpty
())
{
log
.
info
(
"recommend:{}筛选条件未找到技术员"
,
recommend
);
...
...
@@ -364,8 +357,10 @@ public class OrderAssignImpl implements OrderAssign {
double
orderLongitude
=
Double
.
parseDouble
(
order
.
getX
());
double
orderLatitude
=
Double
.
parseDouble
(
order
.
getY
());
//TODO 排除当天已经请假或者休息的人员
//排除当天已经请假或者休息的人员
engineerCodes1
=
engineerCodes1
.
stream
()
.
filter
(
engineerCode
->
!
engineerCalendarService
.
engineerTargetLeave
(
engineerCode
,
targetDate
))
.
collect
(
Collectors
.
toSet
());
//均计算距离
List
<
TempEngineer
>
result
=
engineerCodes1
.
stream
()
...
...
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