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 c707d5a6
authored
Nov 21, 2023
by
刘鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(ID1003988): 增加工程师各类型位置
1 parent
83887b88
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
138 additions
and
24 deletions
project-order/src/main/java/com/dituhui/pea/order/dto/OrderAssignRecommendResp.java
project-order/src/main/java/com/dituhui/pea/order/dto/param/BaseLocation.java
project-order/src/main/java/com/dituhui/pea/order/dto/param/TLocation.java
project-order/src/main/java/com/dituhui/pea/order/enums/LocationType.java
project-order/src/main/java/com/dituhui/pea/order/service/EngineerBusinessService.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerBusinessServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderAssignImpl.java
project-order/src/main/java/com/dituhui/pea/order/dto/OrderAssignRecommendResp.java
View file @
c707d5a
package
com
.
dituhui
.
pea
.
order
.
dto
;
package
com
.
dituhui
.
pea
.
order
.
dto
;
import
com.dituhui.pea.order.dto.param.TLocation
;
import
com.dituhui.pea.order.enums.TestimonialsEngineerTag
;
import
com.dituhui.pea.order.enums.TestimonialsEngineerTag
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -19,6 +20,10 @@ public class OrderAssignRecommendResp {
...
@@ -19,6 +20,10 @@ public class OrderAssignRecommendResp {
* 工程师标签
* 工程师标签
*/
*/
private
TestimonialsEngineerTag
distanceDesc
;
private
TestimonialsEngineerTag
distanceDesc
;
/**
* 不同类型的坐标点
*/
private
List
<
TLocation
>
locations
;
private
String
timeDesc
;
private
String
timeDesc
;
private
String
desc
;
private
String
desc
;
private
String
startTime
;
private
String
startTime
;
...
...
project-order/src/main/java/com/dituhui/pea/order/dto/param/BaseLocation.java
View file @
c707d5a
...
@@ -12,11 +12,11 @@ public class BaseLocation {
...
@@ -12,11 +12,11 @@ public class BaseLocation {
* 地址纬度
* 地址纬度
*/
*/
@NotNull
(
message
=
"地址纬度必填"
)
@NotNull
(
message
=
"地址纬度必填"
)
pr
ivate
Double
latitude
;
pr
otected
Double
latitude
;
/**
/**
* 地址经度
* 地址经度
*/
*/
@NotNull
(
message
=
"地址经度必填"
)
@NotNull
(
message
=
"地址经度必填"
)
pr
ivate
Double
longitude
;
pr
otected
Double
longitude
;
}
}
project-order/src/main/java/com/dituhui/pea/order/dto/param/TLocation.java
0 → 100644
View file @
c707d5a
package
com
.
dituhui
.
pea
.
order
.
dto
.
param
;
import
com.dituhui.pea.order.enums.LocationType
;
import
lombok.EqualsAndHashCode
;
import
lombok.Getter
;
import
lombok.Setter
;
/**
* 带类型的坐标
*/
@Setter
@Getter
@EqualsAndHashCode
(
callSuper
=
false
)
public
class
TLocation
extends
BaseLocation
{
/**
* 坐标类型--绑定工程师使用
*/
protected
LocationType
locationType
;
/**
* 详细地址, xx路xx号等信息
*/
protected
String
address
;
}
project-order/src/main/java/com/dituhui/pea/order/enums/LocationType.java
0 → 100644
View file @
c707d5a
package
com
.
dituhui
.
pea
.
order
.
enums
;
/**
* 工程师坐标类型
*/
public
enum
LocationType
{
/**
* 准实时
*/
QUASI_REALTIME
,
/**
* 常规
*/
GENERAL
,
/**
* 上一单
*/
PREVIOUS_ORDER
,
/**
* 下一单
*/
NEXT_ORDER
;
}
project-order/src/main/java/com/dituhui/pea/order/service/EngineerBusinessService.java
View file @
c707d5a
package
com
.
dituhui
.
pea
.
order
.
service
;
package
com
.
dituhui
.
pea
.
order
.
service
;
import
com.dituhui.pea.order.dto.EngineerBusinessDTO
;
import
com.dituhui.pea.order.dto.EngineerBusinessDTO
;
import
com.dituhui.pea.order.dto.param.TLocation
;
import
java.util.List
;
import
java.util.List
;
...
@@ -14,4 +15,11 @@ public interface EngineerBusinessService {
...
@@ -14,4 +15,11 @@ public interface EngineerBusinessService {
void
updateEngineerCenter
(
EngineerBusinessDTO
.
EngineerCenterUpdateReqDTO
centerReq
);
void
updateEngineerCenter
(
EngineerBusinessDTO
.
EngineerCenterUpdateReqDTO
centerReq
);
List
<
EngineerBusinessDTO
.
Blocks
>
getBlocks
(
EngineerBusinessDTO
.
Request
engineerReq
);
List
<
EngineerBusinessDTO
.
Blocks
>
getBlocks
(
EngineerBusinessDTO
.
Request
engineerReq
);
/**
* 获取工程师出发位置
* @param engineerCode 工程师编号
* @return 工程师出发位置
*/
TLocation
engineerDepartLocation
(
String
engineerCode
);
}
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerBusinessServiceImpl.java
View file @
c707d5a
...
@@ -2,7 +2,9 @@ package com.dituhui.pea.order.service.impl;
...
@@ -2,7 +2,9 @@ package com.dituhui.pea.order.service.impl;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dto.EngineerBusinessDTO
;
import
com.dituhui.pea.order.dto.EngineerBusinessDTO
;
import
com.dituhui.pea.order.dto.param.TLocation
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.enums.LocationType
;
import
com.dituhui.pea.order.service.EngineerBusinessService
;
import
com.dituhui.pea.order.service.EngineerBusinessService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -128,4 +130,15 @@ public class EngineerBusinessServiceImpl implements EngineerBusinessService {
...
@@ -128,4 +130,15 @@ public class EngineerBusinessServiceImpl implements EngineerBusinessService {
return
block
;
return
block
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
}
}
@Override
public
TLocation
engineerDepartLocation
(
String
engineerCode
)
{
EngineerBusinessEntity
byEngineerCode
=
engineerBusinessDao
.
getByEngineerCode
(
engineerCode
);
TLocation
location
=
new
TLocation
();
location
.
setAddress
(
byEngineerCode
.
getAddress
());
location
.
setLongitude
(
StringUtils
.
isNotBlank
(
byEngineerCode
.
getX
())
?
Double
.
parseDouble
(
byEngineerCode
.
getX
())
:
0.0
);
location
.
setLatitude
(
StringUtils
.
isNotBlank
(
byEngineerCode
.
getY
())
?
Double
.
parseDouble
(
byEngineerCode
.
getY
())
:
0.0
);
location
.
setLocationType
(
LocationType
.
GENERAL
);
return
location
;
}
}
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderAssignImpl.java
View file @
c707d5a
...
@@ -10,7 +10,6 @@ import com.dituhui.pea.order.common.OrderAssignCheck;
...
@@ -10,7 +10,6 @@ import com.dituhui.pea.order.common.OrderAssignCheck;
import
com.dituhui.pea.order.common.Stapial4jUtil
;
import
com.dituhui.pea.order.common.Stapial4jUtil
;
import
com.dituhui.pea.order.common.TimeUtils
;
import
com.dituhui.pea.order.common.TimeUtils
;
import
com.dituhui.pea.order.common.jackson.DateUtil
;
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.EngineerInfoDao
;
import
com.dituhui.pea.order.dao.EngineerSkillGroupDao
;
import
com.dituhui.pea.order.dao.EngineerSkillGroupDao
;
import
com.dituhui.pea.order.dao.OrderInfoDao
;
import
com.dituhui.pea.order.dao.OrderInfoDao
;
...
@@ -23,9 +22,8 @@ import com.dituhui.pea.order.dto.OrderAssignRecommendResp;
...
@@ -23,9 +22,8 @@ import com.dituhui.pea.order.dto.OrderAssignRecommendResp;
import
com.dituhui.pea.order.dto.OrderAssignReq
;
import
com.dituhui.pea.order.dto.OrderAssignReq
;
import
com.dituhui.pea.order.dto.OrderReschedule
;
import
com.dituhui.pea.order.dto.OrderReschedule
;
import
com.dituhui.pea.order.dto.TimeLineDTO
;
import
com.dituhui.pea.order.dto.TimeLineDTO
;
import
com.dituhui.pea.order.dto.param.Location
;
import
com.dituhui.pea.order.dto.param.RecommendEngineersReq
;
import
com.dituhui.pea.order.dto.param.RecommendEngineersReq
;
import
com.dituhui.pea.order.
entity.EngineerBusinessEntity
;
import
com.dituhui.pea.order.
dto.param.TLocation
;
import
com.dituhui.pea.order.entity.EngineerInfoEntity
;
import
com.dituhui.pea.order.entity.EngineerInfoEntity
;
import
com.dituhui.pea.order.entity.EngineerSkillGroupEntity
;
import
com.dituhui.pea.order.entity.EngineerSkillGroupEntity
;
import
com.dituhui.pea.order.entity.OrderInfoEntity
;
import
com.dituhui.pea.order.entity.OrderInfoEntity
;
...
@@ -33,12 +31,14 @@ import com.dituhui.pea.order.entity.OrgTeamEngineerEntity;
...
@@ -33,12 +31,14 @@ import com.dituhui.pea.order.entity.OrgTeamEngineerEntity;
import
com.dituhui.pea.order.entity.OrgTeamEntity
;
import
com.dituhui.pea.order.entity.OrgTeamEntity
;
import
com.dituhui.pea.order.entity.SkillInfoEntity
;
import
com.dituhui.pea.order.entity.SkillInfoEntity
;
import
com.dituhui.pea.order.enums.AppointmentMethodEnum
;
import
com.dituhui.pea.order.enums.AppointmentMethodEnum
;
import
com.dituhui.pea.order.enums.LocationType
;
import
com.dituhui.pea.order.enums.OrderEventEnum
;
import
com.dituhui.pea.order.enums.OrderEventEnum
;
import
com.dituhui.pea.order.enums.OrderFlowEnum
;
import
com.dituhui.pea.order.enums.OrderFlowEnum
;
import
com.dituhui.pea.order.enums.OrderStatusEnum
;
import
com.dituhui.pea.order.enums.OrderStatusEnum
;
import
com.dituhui.pea.order.enums.ServiceStatusEnum
;
import
com.dituhui.pea.order.enums.ServiceStatusEnum
;
import
com.dituhui.pea.order.enums.TestimonialsEngineerTag
;
import
com.dituhui.pea.order.enums.TestimonialsEngineerTag
;
import
com.dituhui.pea.order.service.CommonService
;
import
com.dituhui.pea.order.service.CommonService
;
import
com.dituhui.pea.order.service.EngineerBusinessService
;
import
com.dituhui.pea.order.service.EngineerCalendarService
;
import
com.dituhui.pea.order.service.EngineerCalendarService
;
import
com.dituhui.pea.order.service.MsgService
;
import
com.dituhui.pea.order.service.MsgService
;
import
com.dituhui.pea.order.service.OrderAssign
;
import
com.dituhui.pea.order.service.OrderAssign
;
...
@@ -117,9 +117,8 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -117,9 +117,8 @@ public class OrderAssignImpl implements OrderAssign {
@Autowired
@Autowired
private
IUser
userService
;
private
IUser
userService
;
@Autowired
@Autowired
private
EngineerBusiness
Dao
engineerBusinessDao
;
private
EngineerBusiness
Service
engineerBusinessService
;
@Autowired
@Autowired
private
EngineerCalendarService
engineerCalendarService
;
private
EngineerCalendarService
engineerCalendarService
;
...
@@ -179,6 +178,7 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -179,6 +178,7 @@ public class OrderAssignImpl implements OrderAssign {
//标签判定
//标签判定
//判定当前工程师是否在队内, 否则判定是否在10KM内, 否则
//判定当前工程师是否在队内, 否则判定是否在10KM内, 否则
TempEngineer
tempEngineer
=
engineerDistanceMap
.
get
(
engineerCode
);
TempEngineer
tempEngineer
=
engineerDistanceMap
.
get
(
engineerCode
);
item
.
setLocations
(
tempEngineer
.
getLocations
());
if
(
Objects
.
nonNull
(
orgTeamEngineerDao
.
findByTeamIdAndEngineerCode
(
orgTeamId
,
engineerCode
)))
{
if
(
Objects
.
nonNull
(
orgTeamEngineerDao
.
findByTeamIdAndEngineerCode
(
orgTeamId
,
engineerCode
)))
{
engineerTag
=
TestimonialsEngineerTag
.
TEAM
;
engineerTag
=
TestimonialsEngineerTag
.
TEAM
;
}
else
if
(
tempEngineer
.
getDistance
().
compareTo
(
judgeDistance
)
<=
0
)
{
}
else
if
(
tempEngineer
.
getDistance
().
compareTo
(
judgeDistance
)
<=
0
)
{
...
@@ -370,11 +370,13 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -370,11 +370,13 @@ public class OrderAssignImpl implements OrderAssign {
//均计算距离
//均计算距离
List
<
TempEngineer
>
result
=
engineerCodes1
.
stream
()
List
<
TempEngineer
>
result
=
engineerCodes1
.
stream
()
.
map
(
engineerCode
->
{
.
map
(
engineerCode
->
{
Location
location
=
engineerDateLocation
(
engineerCode
);
List
<
TLocation
>
tLocations
=
engineerDateLocation
(
engineerCode
);
TLocation
location
=
tLocations
.
stream
().
filter
(
t
->
Objects
.
equals
(
t
.
getLocationType
(),
LocationType
.
QUASI_REALTIME
))
.
findFirst
().
get
();
BigDecimal
orderAndEngineerDistance
=
BigDecimal
.
valueOf
(
Stapial4jUtil
.
getDistance
(
location
.
getLongitude
(),
location
.
getLatitude
(),
BigDecimal
orderAndEngineerDistance
=
BigDecimal
.
valueOf
(
Stapial4jUtil
.
getDistance
(
location
.
getLongitude
(),
location
.
getLatitude
(),
orderLongitude
,
orderLatitude
));
orderLongitude
,
orderLatitude
));
return
new
TempEngineer
(
engineerCode
,
orderAndEngineerDistance
);
return
new
TempEngineer
(
engineerCode
,
orderAndEngineerDistance
,
tLocations
);
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
// 距离过滤
// 距离过滤
if
(
Objects
.
nonNull
(
distance
))
{
if
(
Objects
.
nonNull
(
distance
))
{
...
@@ -397,28 +399,36 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -397,28 +399,36 @@ public class OrderAssignImpl implements OrderAssign {
* 距离 (KM)
* 距离 (KM)
*/
*/
private
BigDecimal
distance
;
private
BigDecimal
distance
;
/**
* 不同类型坐标
*/
private
List
<
TLocation
>
locations
;
}
}
private
L
ocation
engineerDateLocation
(
String
engineerCode
)
{
private
L
ist
<
TLocation
>
engineerDateLocation
(
String
engineerCode
)
{
final
LocalDate
currentDate
=
LocalDate
.
now
();
final
LocalDate
currentDate
=
LocalDate
.
now
();
List
<
OrderInfoEntity
>
engineerDateOrderList
=
orderInfoDao
.
getEngineerDateOrder
(
engineerCode
,
DateUtils
.
formatDate
(
currentDate
));
List
<
OrderInfoEntity
>
engineerDateOrderList
=
orderInfoDao
.
getEngineerDateOrder
(
engineerCode
,
DateUtils
.
formatDate
(
currentDate
));
Set
<
String
>
ss
=
Set
.
of
(
"CANCELED"
,
"RESCHEDULED"
);
Set
<
String
>
ss
=
Set
.
of
(
"CANCELED"
,
"RESCHEDULED"
);
engineerDateOrderList
=
engineerDateOrderList
.
stream
()
engineerDateOrderList
=
engineerDateOrderList
.
stream
()
.
filter
(
e
->
!
ss
.
contains
(
e
.
getOrderStatus
()))
.
filter
(
e
->
!
ss
.
contains
(
e
.
getOrderStatus
()))
.
sorted
(
Comparator
.
comparing
(
OrderInfoEntity:
:
getPlanStartTime
))
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
Location
location
=
new
Location
();
TLocation
quasiRealTimeLocation
=
new
TLocation
();
quasiRealTimeLocation
.
setLocationType
(
LocationType
.
QUASI_REALTIME
);
//查询工程师已开始的工单
//查询工程师已开始的工单
Optional
<
OrderInfoEntity
>
startedOrder
=
engineerDateOrderList
.
stream
()
Optional
<
OrderInfoEntity
>
startedOrder
=
engineerDateOrderList
.
stream
()
.
filter
(
e
->
Objects
.
equals
(
"STARTED"
,
e
.
getServiceStatus
()))
.
filter
(
e
->
Objects
.
equals
(
"STARTED"
,
e
.
getServiceStatus
()))
.
max
(
Comparator
.
comparing
(
OrderInfoEntity:
:
getPlanStartTime
));
.
max
(
Comparator
.
comparing
(
OrderInfoEntity:
:
getPlanStartTime
));
OrderInfoEntity
currentOrder
=
null
;
if
(
startedOrder
.
isPresent
())
{
if
(
startedOrder
.
isPresent
())
{
OrderInfoEntity
startedOrderInfo
=
startedOrder
.
get
();
OrderInfoEntity
startedOrderInfo
=
startedOrder
.
get
();
l
ocation
.
setAddress
(
startedOrderInfo
.
getAddress
());
quasiRealTimeL
ocation
.
setAddress
(
startedOrderInfo
.
getAddress
());
l
ocation
.
setLongitude
(
Double
.
parseDouble
(
startedOrderInfo
.
getX
()));
quasiRealTimeL
ocation
.
setLongitude
(
Double
.
parseDouble
(
startedOrderInfo
.
getX
()));
l
ocation
.
setLatitude
(
Double
.
parseDouble
(
startedOrderInfo
.
getY
()));
quasiRealTimeL
ocation
.
setLatitude
(
Double
.
parseDouble
(
startedOrderInfo
.
getY
()));
return
location
;
currentOrder
=
startedOrderInfo
;
}
}
//如果没有已开始的工单 查询 最后一个已完成工单
//如果没有已开始的工单 查询 最后一个已完成工单
...
@@ -426,20 +436,50 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -426,20 +436,50 @@ public class OrderAssignImpl implements OrderAssign {
.
filter
(
e
->
Objects
.
equals
(
"FINISHED"
,
e
.
getServiceStatus
()))
.
filter
(
e
->
Objects
.
equals
(
"FINISHED"
,
e
.
getServiceStatus
()))
.
max
(
Comparator
.
comparing
(
OrderInfoEntity:
:
getActualEndTime
));
.
max
(
Comparator
.
comparing
(
OrderInfoEntity:
:
getActualEndTime
));
ArrayList
<
TLocation
>
resultLocationList
=
new
ArrayList
<>();
TLocation
generalLocation
=
engineerBusinessService
.
engineerDepartLocation
(
engineerCode
);
//常规位置, 出发地
resultLocationList
.
add
(
generalLocation
);
if
(
finishedOrder
.
isPresent
())
{
if
(
finishedOrder
.
isPresent
())
{
OrderInfoEntity
finishedOrderInfo
=
finishedOrder
.
get
();
OrderInfoEntity
finishedOrderInfo
=
finishedOrder
.
get
();
location
.
setAddress
(
finishedOrderInfo
.
getAddress
());
quasiRealTimeLocation
.
setAddress
(
finishedOrderInfo
.
getAddress
());
location
.
setLongitude
(
Double
.
parseDouble
(
finishedOrderInfo
.
getX
()));
quasiRealTimeLocation
.
setLongitude
(
Double
.
parseDouble
(
finishedOrderInfo
.
getX
()));
location
.
setLatitude
(
Double
.
parseDouble
(
finishedOrderInfo
.
getY
()));
quasiRealTimeLocation
.
setLatitude
(
Double
.
parseDouble
(
finishedOrderInfo
.
getY
()));
currentOrder
=
finishedOrderInfo
;
}
else
{
}
else
{
// 如果都没有, 则获取工程师出发地址
quasiRealTimeLocation
.
setAddress
(
generalLocation
.
getAddress
());
EngineerBusinessEntity
byEngineerCode
=
engineerBusinessDao
.
getByEngineerCode
(
engineerCode
);
quasiRealTimeLocation
.
setLongitude
(
generalLocation
.
getLongitude
());
location
.
setAddress
(
byEngineerCode
.
getAddress
());
quasiRealTimeLocation
.
setLatitude
(
generalLocation
.
getLatitude
());
location
.
setLongitude
(
StringUtils
.
isNotBlank
(
byEngineerCode
.
getX
())
?
Double
.
parseDouble
(
byEngineerCode
.
getX
())
:
0.0
);
}
location
.
setLatitude
(
StringUtils
.
isNotBlank
(
byEngineerCode
.
getY
())
?
Double
.
parseDouble
(
byEngineerCode
.
getY
())
:
0.0
);
//准实时位置
resultLocationList
.
add
(
quasiRealTimeLocation
);
//
if
(
Objects
.
nonNull
(
currentOrder
))
{
int
i
=
engineerDateOrderList
.
indexOf
(
currentOrder
);
//上一单
if
(
i
>
0
)
{
OrderInfoEntity
order
=
engineerDateOrderList
.
get
(
i
-
1
);
TLocation
pre
=
new
TLocation
();
pre
.
setLocationType
(
LocationType
.
PREVIOUS_ORDER
);
pre
.
setAddress
(
order
.
getAddress
());
pre
.
setLongitude
(
Double
.
parseDouble
(
order
.
getX
()));
pre
.
setLatitude
(
Double
.
parseDouble
(
order
.
getY
()));
resultLocationList
.
add
(
pre
);
}
//下一单
if
(
i
<
engineerDateOrderList
.
size
()
-
1
)
{
OrderInfoEntity
order
=
engineerDateOrderList
.
get
(
i
+
1
);
TLocation
next
=
new
TLocation
();
next
.
setLocationType
(
LocationType
.
NEXT_ORDER
);
next
.
setAddress
(
order
.
getAddress
());
next
.
setLongitude
(
Double
.
parseDouble
(
order
.
getX
()));
next
.
setLatitude
(
Double
.
parseDouble
(
order
.
getY
()));
resultLocationList
.
add
(
next
);
}
}
}
return
location
;
return
resultLocationList
;
}
}
...
...
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