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
979aefb4
Commit
979aefb4
authored
Mar 18, 2021
by
chongfu.liang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
34fe552d
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
77 additions
and
3 deletions
+77
-3
shopping-cart-application-service/src/main/java/cn/freemud/demo/entities/dto/goods/add/list/BaseListCartGoodsVO.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/demo/service/impl/AbstractListCartGoodsService.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/demo/service/impl/DeliveryService.java
+30
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/delivery/DeliveryService.java
+2
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/delivery/impl/FixDeliveryServiceImpl.java
+13
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/delivery/impl/GradDeliveryServiceImpl.java
+30
-0
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/demo/entities/dto/goods/add/list/BaseListCartGoodsVO.java
View file @
979aefb4
...
@@ -36,7 +36,7 @@ public class BaseListCartGoodsVO {
...
@@ -36,7 +36,7 @@ public class BaseListCartGoodsVO {
*/
*/
private
List
<
CartGoods
.
CartGoodsExtra
>
extra
;
private
List
<
CartGoods
.
CartGoodsExtra
>
extra
;
private
String
version
;
private
Integer
version
;
/**
/**
* 1.6.0 版本增加 节点ID
* 1.6.0 版本增加 节点ID
...
...
shopping-cart-application-service/src/main/java/cn/freemud/demo/service/impl/AbstractListCartGoodsService.java
View file @
979aefb4
...
@@ -404,7 +404,7 @@ public class AbstractListCartGoodsService implements ListCartGoodsService {
...
@@ -404,7 +404,7 @@ public class AbstractListCartGoodsService implements ListCartGoodsService {
}
}
}
}
setToastMsgIfNotExist
(
shoppingCartGoodsBO
,
setMessageBO
.
getToastMsg
());
setToastMsgIfNotExist
(
shoppingCartGoodsBO
,
setMessageBO
.
getToastMsg
());
shoppingCartGoodsBO
.
setVersion
(
2
);
return
shoppingCartGoodsBO
;
return
shoppingCartGoodsBO
;
}
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/demo/service/impl/DeliveryService.java
View file @
979aefb4
...
@@ -9,8 +9,10 @@ import cn.freemud.demo.entities.bo.store.StoreInfoBO;
...
@@ -9,8 +9,10 @@ import cn.freemud.demo.entities.bo.store.StoreInfoBO;
import
cn.freemud.demo.manager.customer.CustomerManager
;
import
cn.freemud.demo.manager.customer.CustomerManager
;
import
cn.freemud.demo.manager.store.StoreManager
;
import
cn.freemud.demo.manager.store.StoreManager
;
import
cn.freemud.entities.dto.StoreDeliveryInfoDto
;
import
cn.freemud.entities.dto.StoreDeliveryInfoDto
;
import
cn.freemud.entities.vo.ShoppingCartGoodsResponseVo
;
import
cn.freemud.enums.CreateOrderType
;
import
cn.freemud.enums.CreateOrderType
;
import
cn.freemud.enums.ScopeConfigType
;
import
cn.freemud.enums.ScopeConfigType
;
import
cn.freemud.service.delivery.DeliveryFactory
;
import
cn.freemud.utils.WebUtil
;
import
cn.freemud.utils.WebUtil
;
import
com.freemud.application.sdk.api.log.LogThreadLocal
;
import
com.freemud.application.sdk.api.log.LogThreadLocal
;
import
com.freemud.application.sdk.api.storecenter.request.StoreInfoRequest
;
import
com.freemud.application.sdk.api.storecenter.request.StoreInfoRequest
;
...
@@ -18,6 +20,7 @@ import com.google.common.collect.Lists;
...
@@ -18,6 +20,7 @@ import com.google.common.collect.Lists;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.awt.geom.Point2D
;
import
java.awt.geom.Point2D
;
...
@@ -36,6 +39,13 @@ public class DeliveryService {
...
@@ -36,6 +39,13 @@ public class DeliveryService {
@Autowired
@Autowired
private
StoreManager
storeManager
;
private
StoreManager
storeManager
;
@Autowired
private
DeliveryFactory
deliveryFactory
;
// 配送费逻辑是否使用旧的
@Value
(
"${store.delivery.use.old:true}"
)
private
boolean
storeDeliveryUseOld
;
public
Long
calculateDeliveryAmount
(
String
receiveId
,
String
partnerId
,
String
storeId
,
Integer
orderType
,
ManagerServiceBO
managerServiceBO
)
{
public
Long
calculateDeliveryAmount
(
String
receiveId
,
String
partnerId
,
String
storeId
,
Integer
orderType
,
ManagerServiceBO
managerServiceBO
)
{
Long
deliveryAmount
=
0L
;
Long
deliveryAmount
=
0L
;
// 如果订单的收获地址为空,且订单是外卖单,返回运费
// 如果订单的收获地址为空,且订单是外卖单,返回运费
...
@@ -43,8 +53,11 @@ public class DeliveryService {
...
@@ -43,8 +53,11 @@ public class DeliveryService {
if
(
StringUtils
.
isBlank
(
receiveId
)
&&
!
Objects
.
equals
(
orderType
,
CreateOrderType
.
TAKE_OUT
.
getCode
()))
{
if
(
StringUtils
.
isBlank
(
receiveId
)
&&
!
Objects
.
equals
(
orderType
,
CreateOrderType
.
TAKE_OUT
.
getCode
()))
{
return
deliveryAmount
;
return
deliveryAmount
;
}
}
if
(
storeDeliveryUseOld
)
{
deliveryAmount
=
Long
.
parseLong
(
getDeliveryAmount
(
receiveId
,
partnerId
,
storeId
,
managerServiceBO
).
toString
());
deliveryAmount
=
Long
.
parseLong
(
getDeliveryAmount
(
receiveId
,
partnerId
,
storeId
,
managerServiceBO
).
toString
());
// shoppingCartGoodsResponseVo.setDeliveryFeeZeroReason(0);
}
else
{
deliveryAmount
=
getNewDeliveryAmount
(
receiveId
,
partnerId
,
storeId
,
orderType
);
}
return
deliveryAmount
;
return
deliveryAmount
;
}
}
...
@@ -98,6 +111,22 @@ public class DeliveryService {
...
@@ -98,6 +111,22 @@ public class DeliveryService {
return
amount
;
return
amount
;
}
}
private
Long
getNewDeliveryAmount
(
String
receiveId
,
String
partnerId
,
String
storeId
,
Integer
orderType
)
{
//String trackingNo = LogThreadLocal.getTrackingNo();
Long
amount
=
0L
;
// 如果订单的收获地址为空,且订单是外卖单,返回运费
// 主要是为了兼容coco不传收获地址,需要获取固定运费的情况
if
(
StringUtils
.
isBlank
(
receiveId
)
&&
!
Objects
.
equals
(
orderType
,
CreateOrderType
.
TAKE_OUT
.
getCode
()))
{
return
amount
;
}
cn
.
freemud
.
service
.
delivery
.
DeliveryService
deliveryService
=
deliveryFactory
.
getCalculateDeliveryAmount
(
orderType
,
receiveId
);
amount
=
deliveryService
.
calculateDeliveryAmount
(
receiveId
,
partnerId
,
storeId
);
return
amount
;
}
/**
/**
* 获取配送范围内集合
* 获取配送范围内集合
*/
*/
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/delivery/DeliveryService.java
View file @
979aefb4
...
@@ -26,4 +26,6 @@ public interface DeliveryService {
...
@@ -26,4 +26,6 @@ public interface DeliveryService {
* @return
* @return
*/
*/
Long
calculateDeliveryAmount
(
String
receiveId
,
String
partnerId
,
String
storeId
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
);
Long
calculateDeliveryAmount
(
String
receiveId
,
String
partnerId
,
String
storeId
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
);
Long
calculateDeliveryAmount
(
String
receiveId
,
String
partnerId
,
String
storeId
);
}
}
shopping-cart-application-service/src/main/java/cn/freemud/service/delivery/impl/FixDeliveryServiceImpl.java
View file @
979aefb4
...
@@ -55,4 +55,17 @@ public class FixDeliveryServiceImpl extends AbstractDeliveryServiceImpl implemen
...
@@ -55,4 +55,17 @@ public class FixDeliveryServiceImpl extends AbstractDeliveryServiceImpl implemen
return
new
Double
(
storeResponse
.
getBizVO
().
getDeliveryPrice
()
*
100
).
longValue
();
return
new
Double
(
storeResponse
.
getBizVO
().
getDeliveryPrice
()
*
100
).
longValue
();
}
}
@Override
public
Long
calculateDeliveryAmount
(
String
receiveId
,
String
partnerId
,
String
storeId
)
{
String
trackingNo
=
LogThreadLocal
.
getTrackingNo
();
// 获取门店信息,查询基础配送费用
StoreInfoRequest
storeInfoRequest
=
new
StoreInfoRequest
(
partnerId
,
storeId
,
null
);
StoreResponse
storeResponse
=
storeCenterService
.
getStoreInfo
(
storeInfoRequest
,
trackingNo
);
if
(
storeResponse
==
null
||
storeResponse
.
getBizVO
()
==
null
)
{
throw
new
ServiceException
(
ResponseResult
.
STORE_NOT_FOUND
);
}
return
new
Double
(
storeResponse
.
getBizVO
().
getDeliveryPrice
()
*
100
).
longValue
();
}
}
}
shopping-cart-application-service/src/main/java/cn/freemud/service/delivery/impl/GradDeliveryServiceImpl.java
View file @
979aefb4
...
@@ -66,4 +66,34 @@ public class GradDeliveryServiceImpl extends AbstractDeliveryServiceImpl impleme
...
@@ -66,4 +66,34 @@ public class GradDeliveryServiceImpl extends AbstractDeliveryServiceImpl impleme
return
queryDeliverDetailResponse
.
getData
().
getDeliveryAmount
();
return
queryDeliverDetailResponse
.
getData
().
getDeliveryAmount
();
}
}
@Override
public
Long
calculateDeliveryAmount
(
String
receiveId
,
String
partnerId
,
String
storeId
)
{
String
trackingNo
=
LogThreadLocal
.
getTrackingNo
();
QueryReceiveAddressRequest
queryReceive
=
new
QueryReceiveAddressRequest
(
receiveId
,
partnerId
);
//查询会员收获地址经纬度
com
.
freemud
.
application
.
sdk
.
api
.
base
.
BaseResponse
<
QueryReceiveAddressResponse
>
queryReceiveAddressResponse
=
memberCenterService
.
queryReceiveAddressById
(
queryReceive
,
trackingNo
);
if
(!
ResponseResult
.
SUCCESS
.
getCode
().
equals
(
queryReceiveAddressResponse
.
getCode
())
||
queryReceiveAddressResponse
.
getData
()
==
null
)
{
throw
new
ServiceException
(
ResponseResult
.
USER_GETRECEIVEADDRESS_ERROR
);
}
// 查询运费详情
QueryDeliveryRequest
queryDeliveryRequest
=
new
QueryDeliveryRequest
();
queryDeliveryRequest
.
setPartnerId
(
partnerId
);
queryDeliveryRequest
.
setStoreCode
(
storeId
);
queryDeliveryRequest
.
setUserLatitude
(
queryReceiveAddressResponse
.
getData
().
getLatitude
());
queryDeliveryRequest
.
setUserLongitude
(
queryReceiveAddressResponse
.
getData
().
getLongitude
());
com
.
freemud
.
application
.
sdk
.
api
.
base
.
BaseResponse
<
QueryDeliverDetailResponse
>
queryDeliverDetailResponse
=
storeCenterService
.
queryDeliverDetail
(
queryDeliveryRequest
,
trackingNo
);
if
(
queryDeliverDetailResponse
==
null
||
!
ResponseResult
.
SUCCESS
.
getCode
().
equals
(
queryDeliverDetailResponse
.
getCode
())
||
queryDeliverDetailResponse
.
getData
()
==
null
)
{
throw
new
ServiceException
(
ResponseResult
.
STORE_ITEM_NOT_DELIVERY
);
}
if
(
queryDeliverDetailResponse
.
getData
().
getDeliveryAmount
()
==
null
)
{
throw
new
ServiceException
(
ResponseResult
.
STORE_DELIVERY_AMOUNT_ERROR
);
}
return
queryDeliverDetailResponse
.
getData
().
getDeliveryAmount
();
}
}
}
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