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 40064b6c
authored
Nov 15, 2023
by
刘鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(改派推荐工程师): 改派推荐工程师距离为不限制时不做距离过滤
1 parent
822072a4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
14 deletions
project-order/src/main/java/com/dituhui/pea/order/dto/param/RecommendEngineersReq.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderAssignImpl.java
project-order/src/main/java/com/dituhui/pea/order/dto/param/RecommendEngineersReq.java
View file @
40064b6
...
...
@@ -14,7 +14,7 @@ public class RecommendEngineersReq {
*/
private
String
key
;
/**
* 距离范围(单位:KM), 不传
默认10.0 KM
* 距离范围(单位:KM), 不传
改值为:不限
*/
private
Double
distance
;
/**
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderAssignImpl.java
View file @
40064b6
...
...
@@ -64,6 +64,7 @@ import java.math.BigDecimal;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.HashSet
;
...
...
@@ -321,13 +322,13 @@ public class OrderAssignImpl implements OrderAssign {
SkillInfoEntity
skill
=
skillInfoDao
.
getByBrandAndTypeAndSkill
(
order
.
getBrand
(),
order
.
getType
(),
order
.
getSkill
());
if
(
skill
==
null
)
{
log
.
info
(
"skill_info表没有匹配到技能配置:{}-{}-{}"
,
order
.
getBrand
(),
order
.
getY
(),
order
.
getSkill
());
return
new
ArrayList
<>
();
return
Collections
.
emptyList
();
}
Set
<
String
>
engineerCodes3
=
engineerSkillGroupDao
.
findBySkillGroupCode
(
skill
.
getSkillGroupCode
()).
stream
().
map
(
EngineerSkillGroupEntity:
:
getEngineerCode
).
collect
(
Collectors
.
toSet
());
if
(
engineerCodes3
.
isEmpty
())
{
log
.
info
(
"没有匹配到技能相匹配的技术员:{}-{}-{}"
,
order
.
getBrand
(),
order
.
getType
(),
order
.
getSkill
());
return
new
ArrayList
<>
();
return
Collections
.
emptyList
();
}
engineerCodes1
.
retainAll
(
engineerCodes3
);
if
(
engineerCodes1
.
isEmpty
())
{
...
...
@@ -338,20 +339,20 @@ public class OrderAssignImpl implements OrderAssign {
// 获取工程师位置(准实时位置)并进行距离判定, distance如果为空值 默认10KM
double
orderLongitude
=
Double
.
parseDouble
(
order
.
getX
());
double
orderLatitude
=
Double
.
parseDouble
(
order
.
getY
());
if
(
Objects
.
isNull
(
distance
))
{
distance
=
10.0
D
;
if
(
Objects
.
nonNull
(
distance
))
{
final
BigDecimal
finalDistance
=
BigDecimal
.
valueOf
(
distance
);
return
engineerCodes1
.
stream
()
.
filter
(
engineerCode
->
{
Location
location
=
engineerDateLocation
(
engineerCode
);
BigDecimal
orderAndEngineerDistance
=
BigDecimal
.
valueOf
(
Stapial4jUtil
.
getDistance
(
location
.
getLongitude
(),
location
.
getLatitude
(),
orderLongitude
,
orderLatitude
));
return
orderAndEngineerDistance
.
compareTo
(
finalDistance
)
<=
0
;
}).
collect
(
Collectors
.
toList
());
}
final
BigDecimal
finalDistance
=
BigDecimal
.
valueOf
(
distance
);
return
engineerCodes1
.
stream
()
.
filter
(
engineerCode
->
{
Location
location
=
engineerDateLocation
(
engineerCode
);
BigDecimal
orderAndEngineerDistance
=
BigDecimal
.
valueOf
(
Stapial4jUtil
.
getDistance
(
location
.
getLongitude
(),
location
.
getLatitude
(),
orderLongitude
,
orderLatitude
));
return
orderAndEngineerDistance
.
compareTo
(
finalDistance
)
<=
0
;
}).
collect
(
Collectors
.
toList
());
return
new
ArrayList
<>(
engineerCodes1
);
}
private
Location
engineerDateLocation
(
String
engineerCode
)
{
...
...
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