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 e282a8a6
authored
Nov 17, 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
287b5e76
1f8e5855
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
87 additions
and
22 deletions
project-order/src/main/java/com/dituhui/pea/order/enums/OrderPeaTagsEnum.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/DispatchServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerCalendarServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerGanttServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderCreateServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderInfoServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/enums/OrderPeaTagsEnum.java
View file @
e282a8a
...
...
@@ -5,6 +5,7 @@ public enum OrderPeaTagsEnum {
special
(
"特殊时段"
),
cutoff
(
"当日加单"
),
multipleOrders
(
"一家多台"
),
transcend
(
"超派"
),
urgent
(
"紧急"
);
private
String
tag
;
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/DispatchServiceImpl.java
View file @
e282a8a
...
...
@@ -145,7 +145,6 @@ public class DispatchServiceImpl implements DispatchService {
@Override
public
Result
<?>
getDispatchEngineerOrderList
(
DispatchEngineerOrderListReq
reqDTO
)
throws
BusinessException
{
// 派工台技术员预约单列表
LocalDate
date
=
TimeUtils
.
IsoDate2LocalDate
(
reqDTO
.
getDate
());
// 获取技能信息
...
...
@@ -182,6 +181,7 @@ public class DispatchServiceImpl implements DispatchService {
skillGroupCodes
.
add
(
skill
.
getSkillGroupCode
());
}
engineerCodes
=
engineerInfoDao
.
findByEngineerCodesBySkillCodes
(
engineerCodes
,
skillGroupCodes
);
engineerCodes
=
handleEngineerLeave
(
engineerCodes
,
date
);
}
// 获取技术员已指派单列表
...
...
@@ -232,6 +232,38 @@ public class DispatchServiceImpl implements DispatchService {
return
Result
.
success
(
res
);
}
/**
* 过滤请假工程师
*
* @param engineerCodes
* @param targetDate
* @return
*/
private
List
<
String
>
handleEngineerLeave
(
List
<
String
>
engineerCodes
,
LocalDate
targetDate
)
{
List
engineerCodes2
=
new
ArrayList
();
for
(
String
engineerCode
:
engineerCodes
)
{
//获取工作队休息时间, 判定目标时间是否在工作队休息日中
Set
<
OrgTeamEntity
>
teams
=
orgTeamDao
.
selectTeamByEngineerCode
(
engineerCode
);
if
(!
org
.
springframework
.
util
.
CollectionUtils
.
isEmpty
(
teams
))
{
List
<
String
>
teamCommonWorkdaysOfWeek
=
teams
.
stream
()
.
map
(
team
->
Arrays
.
asList
(
team
.
getWorkdays
().
split
(
","
)))
.
flatMap
(
Collection:
:
stream
)
.
distinct
()
.
collect
(
Collectors
.
toList
());
// 求多个工作队的公共空闲时间
final
int
dayOfWeek
=
targetDate
.
getDayOfWeek
().
getValue
();
List
<
String
>
commonLeisureDayOfWeek
=
EngineerCalendarServiceImpl
.
ALL_WORK_DAY_OF_WEEK
.
stream
().
filter
(
day
->
teamCommonWorkdaysOfWeek
.
stream
().
noneMatch
(
tDay
->
Objects
.
equals
(
day
,
tDay
)))
.
collect
(
Collectors
.
toList
());
if
(!
commonLeisureDayOfWeek
.
contains
(
String
.
valueOf
(
dayOfWeek
)))
{
engineerCodes2
.
add
(
engineerCode
);
}
//求所有事程时间与工作队休息时间的并集
}
}
return
engineerCodes2
;
}
private
void
addOrderToItems
(
OrderInfoEntity
o
,
List
<
DispatchEngineerOrderListResp
.
OrderInfo
>
items
,
HashMap
<
String
,
SkillInfoEntity
>
skillInfo
,
boolean
isContinue
)
{
DispatchEngineerOrderListResp
.
OrderInfo
item
=
new
DispatchEngineerOrderListResp
.
OrderInfo
();
item
.
setOrderId
(
o
.
getOrderId
());
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerCalendarServiceImpl.java
View file @
e282a8a
...
...
@@ -93,7 +93,7 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
@Autowired
private
IUser
user
;
p
rivate
final
static
List
<
String
>
ALL_WORK_DAY_OF_WEEK
=
List
.
of
(
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
,
"7"
);
p
ublic
final
static
List
<
String
>
ALL_WORK_DAY_OF_WEEK
=
List
.
of
(
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
,
"7"
);
@Override
public
Result
<?>
getEngineersCalendar
(
EngineerCalendarDTO
.
Request
req
)
{
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerGanttServiceImpl.java
View file @
e282a8a
...
...
@@ -10,6 +10,7 @@ import com.dituhui.pea.order.dto.EngineersGanttDTO;
import
com.dituhui.pea.order.dto.LabelValueDTO
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.enums.OrderFlowEnum
;
import
com.dituhui.pea.order.enums.OrderPeaTagsEnum
;
import
com.dituhui.pea.order.enums.ServiceStatusEnum
;
import
com.dituhui.pea.order.service.EngineerGanttService
;
import
com.google.common.collect.Sets
;
...
...
@@ -19,6 +20,8 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.*
;
...
...
@@ -100,22 +103,23 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
if
(!
order
.
getAppointmentStatus
().
equals
(
OrderFlowEnum
.
CONFIRM
.
name
()))
{
slot
.
setBorderStyle
(
"dashed"
);
// 未确认的指派,统一加上虚框
}
slots
.
add
(
slot
);
if
(
order
.
getArriveElapsed
()
>
0
)
{
// 有在途时长先计算在途时间
if
(
order
.
getArriveElapsed
()
>
0
&&
order
.
getArriveDistance
()
>
0
)
{
// 有在途,起止时间,分别是订单的开始时间减去在途时间、订单的开始时间
slot
=
new
EngineersGanttDTO
.
Slot
();
EngineersGanttDTO
.
Slot
slot2
=
new
EngineersGanttDTO
.
Slot
();
if
(
checkOrderIsFinish
(
order
.
getServiceStatus
()))
{
slot
.
setBtime
(
getHourMinute
(
order
.
getActualStartTime
(),
-
order
.
getArriveElapsed
()));
slot
.
setEtime
(
getHourMinute
(
order
.
getActualStartTime
()));
slot
2
.
setBtime
(
getHourMinute
(
order
.
getActualStartTime
(),
-
order
.
getArriveElapsed
()));
slot
2
.
setEtime
(
getHourMinute
(
order
.
getActualStartTime
()));
}
else
{
slot
.
setBtime
(
getHourMinute
(
order
.
getPlanStartTime
(),
-
order
.
getArriveElapsed
()));
slot
.
setEtime
(
getHourMinute
(
order
.
getPlanStartTime
()));
slot
2
.
setBtime
(
getHourMinute
(
order
.
getPlanStartTime
(),
-
order
.
getArriveElapsed
()));
slot
2
.
setEtime
(
getHourMinute
(
order
.
getPlanStartTime
()));
}
slot
.
setShapeSize
(
"mini"
);
slot
.
setBgColor
(
getColor
(
"ONWAY"
));
slot
.
setTooltip
(
getOnwayTips
(
order
));
slots
.
add
(
slot
);
slot
2
.
setShapeSize
(
"mini"
);
slot
2
.
setBgColor
(
getColor
(
"ONWAY"
));
slot
2
.
setTooltip
(
getOnwayTips
(
order
));
slots
.
add
(
slot
2
);
}
slots
.
add
(
slot
);
slots
.
sort
(
Comparator
.
comparing
(
EngineersGanttDTO
.
Slot
::
getBtime
));
mapEngineers
.
put
(
order
.
getEngineerCode
(),
slots
);
}
...
...
@@ -211,7 +215,7 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
btime
=
getHourMinute
(
order
.
getPlanStartTime
(),
-
order
.
getArriveElapsed
());
etime
=
getHourMinute
(
order
.
getPlanStartTime
());
}
tips
.
add
(
new
LabelValueDTO
().
setLabel
(
"在途路程"
).
setValue
(
String
.
format
(
"%s公里(千米)"
,
order
.
getArriveDistance
(
))));
tips
.
add
(
new
LabelValueDTO
().
setLabel
(
"在途路程"
).
setValue
(
String
.
format
(
"%s公里(千米)"
,
BigDecimal
.
valueOf
(
order
.
getArriveDistance
()).
divide
(
BigDecimal
.
valueOf
(
1000
),
2
,
RoundingMode
.
HALF_UP
))));
tips
.
add
(
new
LabelValueDTO
().
setLabel
(
"在途时间"
).
setValue
(
String
.
format
(
"%s-%s"
,
btime
,
etime
)));
tips
.
add
(
new
LabelValueDTO
().
setLabel
(
"在途耗时"
).
setValue
(
String
.
format
(
"%s分钟"
,
order
.
getArriveElapsed
())));
return
tips
;
...
...
@@ -223,7 +227,7 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
tips
.
add
(
new
LabelValueDTO
().
setLabel
(
"工单号码"
).
setValue
(
order
.
getOrderId
()));
tips
.
add
(
new
LabelValueDTO
().
setLabel
(
"品牌/类型/技能"
).
setValue
(
String
.
format
(
"%s/%s/%s"
,
order
.
getBrand
(),
order
.
getType
(),
order
.
getSkill
())));
tips
.
add
(
new
LabelValueDTO
().
setLabel
(
"电话/地址"
).
setValue
(
String
.
format
(
"%s %s\n %s"
,
order
.
getName
(),
order
.
getPhone
(),
order
.
getAddress
())));
tips
.
add
(
new
LabelValueDTO
().
setLabel
(
"标签"
).
setValue
(
order
.
getTags
(
)));
tips
.
add
(
new
LabelValueDTO
().
setLabel
(
"标签"
).
setValue
(
getTags
(
order
)));
tips
.
add
(
new
LabelValueDTO
().
setLabel
(
"耗时"
).
setValue
(
String
.
format
(
"%s分钟"
,
order
.
getTakeTime
())));
tips
.
add
(
new
LabelValueDTO
().
setLabel
(
"期望时间"
).
setValue
(
String
.
format
(
"%s-%s"
,
DateUtils
.
formatDateTime
(
order
.
getExpectTimeBegin
(),
"HH:mm"
),
DateUtils
.
formatDateTime
(
order
.
getExpectTimeEnd
(),
"HH:mm"
))));
...
...
@@ -238,6 +242,29 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
return
tips
;
}
private
String
getTags
(
OrderInfoEntity
order
)
{
List
<
String
>
tagList
=
new
ArrayList
();
if
(
StringUtils
.
isNotBlank
(
order
.
getBeanTags
()))
{
tagList
=
Arrays
.
asList
(
order
.
getBeanTags
().
split
(
","
));
}
if
(
order
.
getIsCutoff
()
==
1
)
{
tagList
.
add
(
OrderPeaTagsEnum
.
cutoff
.
getTag
());
}
if
(
order
.
getIsSpecialTime
()
==
1
)
{
tagList
.
add
(
OrderPeaTagsEnum
.
special
.
getTag
());
}
if
(
order
.
getTranscend
()
==
1
)
{
tagList
.
add
(
OrderPeaTagsEnum
.
transcend
.
getTag
());
}
if
(
order
.
getBeanPriority
().
equals
(
"1"
))
{
tagList
.
add
(
OrderPeaTagsEnum
.
urgent
.
getTag
());
}
if
(
StringUtils
.
isNotBlank
(
order
.
getMultipleOrders
()))
{
tagList
.
add
(
OrderPeaTagsEnum
.
multipleOrders
.
getTag
());
}
return
String
.
join
(
","
,
tagList
);
}
private
boolean
checkOrderIsFinish
(
String
serviceStatus
)
{
String
[]
array
=
{
"FINISHED"
,
"UNFINISHED"
};
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderCreateServiceImpl.java
View file @
e282a8a
...
...
@@ -355,10 +355,12 @@ public class OrderCreateServiceImpl implements OrderCreateService {
// 处理超派
entity
.
setTranscend
(
1
);
}
Integer
special
=
0
;
if
(
fendanResult
.
getCode
().
equals
(
StatusCodeEnum
.
FENDAN_IS_TRANSCEND_AND_SPECIAL
.
getCode
()))
{
// 处理超派和特殊时间
entity
.
setTranscend
(
1
);
entity
.
setIsSpecialTime
(
1
);
special
=
1
;
}
OrgBranchEntity
branchEntity
=
orgBranchDao
.
findByCitycodeListLike
(
"%"
+
adminDistrict
.
getResult
().
getSubNames
().
getCity
()
+
"%"
);
entity
.
setOrgClusterId
(
branchEntity
.
getClusterId
());
...
...
@@ -368,7 +370,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
Integer
cutoff
=
CommonUtil
.
isCutoff
(
entity
.
getExpectTimeBegin
(),
null
);
entity
.
setIsCutoff
(
cutoff
);
//发送通知分部消息
sendMsg
(
branchEntity
.
getBranchId
(),
orderId
,
entity
.
getExpectTimeBegin
().
toLocalDate
(),
tags
,
cutoff
,
0
);
sendMsg
(
branchEntity
.
getBranchId
(),
orderId
,
entity
.
getExpectTimeBegin
().
toLocalDate
(),
tags
,
cutoff
,
special
);
}
else
{
// 根据分单工作队,填写clusterId/branchId/groupId/teamId等
OrgTeamInfo
teamInfo
=
fendanResult
.
getResult
();
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderInfoServiceImpl.java
View file @
e282a8a
...
...
@@ -34,6 +34,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
...
...
@@ -519,7 +520,8 @@ public class OrderInfoServiceImpl implements OrderInfoService {
continue
;
}
DistanceDTO
distanceDTO
=
roadResult
.
getResult
();
int
roadTime
=
distanceDTO
.
getTime
()
/
1000
;
// int roadTime = distanceDTO.getTime() / 60;
int
roadTime
=
BigDecimal
.
valueOf
(
distanceDTO
.
getTime
()).
divide
(
BigDecimal
.
valueOf
(
60
),
0
,
RoundingMode
.
HALF_UP
).
intValue
();
// 先判断第一单开始时间
if
(
i
==
0
&&
orderSegment
.
getStart
().
compareTo
(
workStartTime
.
plusMinutes
(
takeTime
+
roadTime
))
>=
0
)
{
LocalDateTime
planStartTime
=
handleLeaveTime
(
engineerLeaveTimeSlice
,
insertOrder
.
getExpectTimeBegin
(),
insertOrder
.
getExpectTimeEnd
(),
skillInfo
.
getTakeTime
());
...
...
@@ -564,10 +566,11 @@ public class OrderInfoServiceImpl implements OrderInfoService {
if
(!
roadResult
.
getCode
().
equals
(
ResultEnum
.
SUCCESS
.
getCode
()))
{
continue
;
}
if
(
nestOrderSegment
.
getStart
().
minusMinutes
(
roadResult2
.
getResult
().
getTime
()
/
1000
).
compareTo
(
orderSegment
.
getEnd
().
plusMinutes
(
takeTime
+
roadTime
))
>=
0
)
{
// 判断工单开始时间
LocalDateTime
planStartTime
=
insertOrder
.
getExpectTimeBegin
().
compareTo
(
orderSegment
.
getEnd
().
plusMinutes
(
roadTime
))
>=
0
?
insertOrder
.
getExpectTimeBegin
()
:
orderSegment
.
getEnd
().
plusMinutes
(
roadTime
);
int
roadTime2
=
BigDecimal
.
valueOf
(
roadResult2
.
getResult
().
getTime
()).
divide
(
BigDecimal
.
valueOf
(
60
),
0
,
RoundingMode
.
HALF_UP
).
intValue
();
// 判断工单开始时间 todo 计算不准确 if (nestOrderSegment.getStart().minusMinutes(roadTime2).compareTo(planStartTime.plusMinutes(takeTime + roadTime)) >= 0) {
LocalDateTime
planStartTime
=
insertOrder
.
getExpectTimeBegin
().
compareTo
(
orderSegment
.
getEnd
().
plusMinutes
(
roadTime
))
>=
0
?
insertOrder
.
getExpectTimeBegin
()
:
orderSegment
.
getEnd
().
plusMinutes
(
roadTime
);
if
(
nestOrderSegment
.
getStart
().
minusMinutes
(
roadTime2
).
compareTo
(
planStartTime
.
plusMinutes
(
takeTime
+
roadTime
))
>=
0
)
{
planStartTime
=
handleLeaveTime
(
engineerLeaveTimeSlice
,
planStartTime
,
insertOrder
.
getExpectTimeEnd
(),
skillInfo
.
getTakeTime
());
if
(
ObjectUtil
.
isNull
(
planStartTime
))
{
return
Result
.
failed
(
insertOrder
);
...
...
@@ -579,7 +582,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
insertOrder
.
setPlanEndTime
(
planStartTime
.
plusMinutes
(
skillInfo
.
getTakeTime
()));
OrderInfoEntity
nestOrder
=
orderInfoDao
.
getByOrderId
(
nestOrderSegment
.
getOrderId
());
nestOrder
.
setArriveElapsed
(
road
Result2
.
getResult
().
getTime
()
/
1000
);
nestOrder
.
setArriveElapsed
(
road
Time2
);
nestOrder
.
setArriveDistance
(
BigDecimal
.
valueOf
(
roadResult2
.
getResult
().
getDis
()
*
1000
).
intValue
());
orderInfoDao
.
save
(
nestOrder
);
return
Result
.
success
(
insertOrder
);
...
...
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