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 631ecbab
authored
Nov 13, 2023
by
刘鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(上门里程预估): 上门里程预估添加距离计算以及动态匹配工作队
1 parent
7de5cbdd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
6 deletions
project-order/src/main/java/com/dituhui/pea/order/service/impl/PeaOuterAPIServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/PeaOuterAPIServiceImpl.java
View file @
631ecba
package
com
.
dituhui
.
pea
.
order
.
service
.
impl
;
import
com.dituhui.pea.common.BusinessException
;
import
com.dituhui.pea.enums.StatusCodeEnum
;
import
com.dituhui.pea.order.common.SaasUtils
;
import
com.dituhui.pea.order.common.Stapial4jUtil
;
import
com.dituhui.pea.order.common.jackson.DateUtil
;
import
com.dituhui.pea.order.dao.EngineerSkillGroupDao
;
import
com.dituhui.pea.order.dao.MapBlockInfoDao
;
import
com.dituhui.pea.order.dao.OrderInfoDao
;
import
com.dituhui.pea.order.dao.OrgGroupDao
;
import
com.dituhui.pea.order.dao.SkillGroupDao
;
import
com.dituhui.pea.order.dto.param.EstimateDTO
;
import
com.dituhui.pea.order.dto.param.Location
;
import
com.dituhui.pea.order.dto.param.Order
;
import
com.dituhui.pea.order.dto.param.OrderDTO
;
import
com.dituhui.pea.order.entity.EngineerSkillGroupEntity
;
import
com.dituhui.pea.order.entity.MapBlockInfoEntity
;
import
com.dituhui.pea.order.entity.OrderInfoEntity
;
import
com.dituhui.pea.order.entity.OrgGroupEntity
;
import
com.dituhui.pea.order.entity.SkillGroupEntity
;
import
com.dituhui.pea.order.service.PeaOuterAPIService
;
import
com.dituhui.pea.pojo.fendan.FendanDTO
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
...
...
@@ -47,11 +50,35 @@ public class PeaOuterAPIServiceImpl implements PeaOuterAPIService {
private
final
OrgGroupDao
orgGroupDao
;
private
final
OrderInfoDao
orderInfoDao
;
private
final
EngineerSkillGroupDao
engineerSkillGroupDao
;
private
final
SaasUtils
saasUtils
;
private
final
MapBlockInfoDao
mapBlockInfoDao
;
@Override
public
EstimateDTO
.
VisitResult
estimateVisitService
(
String
brand
,
String
productType
,
String
serviceType
,
Location
clientLocation
)
{
//TODO 走分单逻辑获取对应的工作队信息
String
teamId
=
"team_suzhou_001"
;
//1:根据经纬度分单获取面
FendanDTO
fendanDTO
=
new
FendanDTO
();
final
String
addressLongLat
=
clientLocation
.
getLongitude
()
+
","
+
clientLocation
.
getLatitude
();
fendanDTO
.
setXy
(
addressLongLat
);
List
<
SaasUtils
.
BlockInfo
>
blockInfoList
=
saasUtils
.
queryBlocksByXy
(
fendanDTO
);
if
(
blockInfoList
.
isEmpty
())
{
throw
new
BusinessException
(
StatusCodeEnum
.
FENDAN_AREA_UNMATCHED
.
getDesc
());
}
//2:根据查询出区划匹配分站信息
List
<
String
>
blockIds
=
blockInfoList
.
stream
().
map
(
SaasUtils
.
BlockInfo
::
getBlockId
).
distinct
().
collect
(
Collectors
.
toList
());
Set
<
MapBlockInfoEntity
>
mapBlockInBlockIdsList
=
new
HashSet
<>();
//区划所在范围所有工作队
for
(
String
blockId
:
blockIds
)
{
List
<
MapBlockInfoEntity
>
mapBlockInfoEntities
=
mapBlockInfoDao
.
findByAreaIdsLike
(
"%"
+
blockId
+
"%"
);
mapBlockInBlockIdsList
.
addAll
(
mapBlockInfoEntities
);
}
//分站、网点ID
List
<
String
>
teamIdList
=
mapBlockInBlockIdsList
.
stream
().
map
(
MapBlockInfoEntity:
:
getTeamId
).
distinct
()
.
collect
(
Collectors
.
toList
());
//走分单逻辑获取对应的工作队信息
final
String
teamId
=
teamIdList
.
get
(
0
);
OrgGroupEntity
orgGroupEntity
=
orgGroupDao
.
queryGroupByTeam
(
teamId
);
//获取分站出站点(仓库点)
Location
outboundLocation
=
new
Location
();
...
...
@@ -64,8 +91,10 @@ public class PeaOuterAPIServiceImpl implements PeaOuterAPIService {
visitResult
.
setGroupName
(
orgGroupEntity
.
getGroupName
());
visitResult
.
setGroupLocation
(
outboundLocation
);
visitResult
.
setDestination
(
clientLocation
);
//TODO 里程估计调用
visitResult
.
setDistance
(
0
);
// 里程估计调用
double
distance
=
Stapial4jUtil
.
getDistance
(
outboundLocation
.
getLongitude
(),
outboundLocation
.
getLatitude
(),
clientLocation
.
getLongitude
(),
clientLocation
.
getLatitude
())
*
1000
;
visitResult
.
setDistance
((
int
)
distance
);
return
visitResult
;
...
...
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