Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
order-group
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
order-group-application
order-group
Commits
0c84b2f7
Commit
0c84b2f7
authored
Dec 15, 2021
by
查志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配送范围判断fix
parent
8bd8fed8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
shopping-cart-application-service/src/main/java/cn/freemud/service/delivery/impl/GradDeliveryServiceImpl.java
+6
-9
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/delivery/impl/GradDeliveryServiceImpl.java
View file @
0c84b2f7
...
@@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.Objects
;
@Service
(
"gradDeliveryService"
)
@Service
(
"gradDeliveryService"
)
public
class
GradDeliveryServiceImpl
extends
AbstractDeliveryServiceImpl
implements
DeliveryService
{
public
class
GradDeliveryServiceImpl
extends
AbstractDeliveryServiceImpl
implements
DeliveryService
{
...
@@ -141,22 +142,18 @@ public class GradDeliveryServiceImpl extends AbstractDeliveryServiceImpl impleme
...
@@ -141,22 +142,18 @@ public class GradDeliveryServiceImpl extends AbstractDeliveryServiceImpl impleme
Integer
scopeConfig
=
deliveryInfo
.
getScopeConfig
();
Integer
scopeConfig
=
deliveryInfo
.
getScopeConfig
();
// 配送范围绘制方式: 1-自定义 2-半径
// 配送范围绘制方式: 1-自定义 2-半径
if
(
"2"
.
equals
(
scopeConfig
))
{
if
(
Objects
.
equals
(
scopeConfig
,
2
))
{
if
(
deliveryInfo
.
getDeliveryRadius
()
==
null
||
deliveryInfo
.
getDeliveryRadius
()
<=
0
)
{
if
(
deliveryInfo
.
getDeliveryRadius
()
==
null
||
deliveryInfo
.
getDeliveryRadius
()
<=
0
)
{
throw
new
ServiceException
(
ResponseResult
.
STORE_DELIVERY_AMOUNT_ERROR
);
throw
new
ServiceException
(
ResponseResult
.
STORE_DELIVERY_AMOUNT_ERROR
);
}
}
//用户收货地址距离门店距离 单位米
//用户收货地址距离门店距离 单位米
double
distance
=
LocationUtil
.
getDistance
(
Double
.
parseDouble
(
storeInfo
.
getLatitude
()),
Double
.
parseDouble
(
storeInfo
.
getLongitude
()),
double
distance
=
LocationUtil
.
getDistance
(
Double
.
parseDouble
(
storeInfo
.
getLatitude
()),
Double
.
parseDouble
(
storeInfo
.
getLongitude
()),
Double
.
parseDouble
(
userLatitude
),
Double
.
parseDouble
(
userLongitude
));
Double
.
parseDouble
(
userLatitude
),
Double
.
parseDouble
(
userLongitude
));
if
(
distance
>
deliveryInfo
.
getDeliveryRadius
().
doubleValue
())
{
return
false
;
}
}
else
if
(!
LocationUtil
.
gpsIsInclude
(
userLongitude
,
userLatitude
,
storeInfo
.
getDistributionScope
()))
{
// 超出配送范围
return
true
;
}
return
true
;
return
distance
<=
deliveryInfo
.
getDeliveryRadius
().
doubleValue
();
}
else
{
return
LocationUtil
.
gpsIsInclude
(
userLongitude
,
userLatitude
,
storeInfo
.
getDistributionScope
());
}
}
}
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment