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
cf04ed03
Commit
cf04ed03
authored
Jul 01, 2021
by
黄兆良
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/qa' into qa
parents
f1f0041a
adcc64e3
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
172 additions
and
132 deletions
+172
-132
assortment-ordercenter-sdk/pom.xml
+2
-2
assortment-ordercenter-sdk/readme.md
+3
-2
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapter.java
+1
-0
call-back-service/pom.xml
+3
-6
order-application-service/pom.xml
+3
-3
order-application-service/src/main/java/cn/freemud/service/coupon/impl/PlatformCouponRelationServiceImpl.java
+89
-13
order-application-service/src/main/java/cn/freemud/service/impl/OrderServiceImpl.java
+3
-3
order-application-service/src/main/java/cn/freemud/service/job/PrometheusSchedulerCustomJob.java
+3
-1
order-management/pom.xml
+1
-1
ordercenter-sdk/pom.xml
+1
-1
ordercenter-sdk/readme.md
+3
-2
shopping-cart-application-service/pom.xml
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/controller/ShoppingCartController.java
+15
-28
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+41
-68
shopping-cart-application-service/src/main/java/cn/freemud/service/job/PrometheusSchedulerCustomJob.java
+3
-1
No files found.
assortment-ordercenter-sdk/pom.xml
View file @
cf04ed03
...
...
@@ -10,7 +10,7 @@
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
assortment-ordercenter-sdk
</artifactId>
<version>
1.9.4-SNAPSHOT
</version>
<version>
2.1.76-RELEASE
</version>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
...
...
@@ -38,7 +38,7 @@
<dependency>
<groupId>
cn.freemud
</groupId>
<artifactId>
ordercenter-sdk
</artifactId>
<version>
1.
4.0-SNAPSHOT
</version>
<version>
1.
3.63.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.freemud.application.service.sdk
</groupId>
...
...
assortment-ordercenter-sdk/readme.md
View file @
cf04ed03
...
...
@@ -150,4 +150,5 @@
| 2.1.72-RELEASE | 券码所券 | 张跃 | 2021-06-21|
| 2.1.73-RELEASE | 预计送达时间逻辑添加 | 周晓航 | 2021-06-24|
| 2.1.74-RELEASE | 麦咖啡p7v2 | xukang | 2021-06-24|
| 2.1.75-RELEASE | 集点活动改造 | 张志恒 | 2021-06-28|
\ No newline at end of file
| 2.1.75-RELEASE | 集点活动改造 | 张志恒 | 2021-06-28|
| 2.1.76-RELEASE | 开放平台取消订单调用oms| 张志恒 | 2021-07-01|
\ No newline at end of file
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapter.java
View file @
cf04ed03
...
...
@@ -3651,6 +3651,7 @@ public class OrderSdkAdapter {
// 订单号 替换成唯一序号
couponLockRequest
.
setPartnerId
(
orderBean
.
getCompanyId
());
couponLockRequest
.
setOrderId
(
orderBean
.
getOid
());
//couponLockRequest.setCouponCode(accountBean.getAccountId());
List
<
CouponLockRequest
.
CouponLockInfo
>
infos
=
new
ArrayList
<>();
couponCodes
.
forEach
(
s
->
{
CouponLockRequest
.
CouponLockInfo
info
=
new
CouponLockRequest
.
CouponLockInfo
();
...
...
call-back-service/pom.xml
View file @
cf04ed03
...
...
@@ -94,12 +94,9 @@
</dependency>
<!-- promtheus -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
<dependency>
<groupId>
io.micrometer
</groupId>
<artifactId>
micrometer-registry-prometheus
</artifactId>
<groupId>
com.freemud.springboot
</groupId>
<artifactId>
fm-springboot-start-actuator
</artifactId>
<version>
1.0.14
</version>
</dependency>
<dependency>
<groupId>
com.freemud.nepxion
</groupId>
...
...
order-application-service/pom.xml
View file @
cf04ed03
...
...
@@ -49,12 +49,12 @@
<dependency>
<artifactId>
couponcenter-sdk
</artifactId>
<groupId>
com.freemud.application.service.sdk
</groupId>
<version>
4.1.
2-SNAPSHOT
</version>
<version>
4.1.
3.RELEASE
</version>
</dependency>
<dependency>
<groupId>
cn.freemud
</groupId>
<artifactId>
assortment-ordercenter-sdk
</artifactId>
<version>
1.9.4-SNAPSHOT
</version>
<version>
2.1.76-RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.freemud.application.service.sdk
</groupId>
...
...
@@ -133,7 +133,7 @@
<dependency>
<artifactId>
assortment-data-manager
</artifactId>
<groupId>
com.freemud.sdk.api.assortment
</groupId>
<version>
5.5.
12.SNAPSHOT
</version>
<version>
5.5.
8.RELEASE
</version>
</dependency>
<dependency>
<groupId>
cn.freemud.commons
</groupId>
...
...
order-application-service/src/main/java/cn/freemud/service/coupon/impl/PlatformCouponRelationServiceImpl.java
View file @
cf04ed03
...
...
@@ -20,28 +20,21 @@ import cn.freemud.amqp.MQService;
import
cn.freemud.base.entity.BaseResponse
;
import
cn.freemud.base.util.JsonUtil
;
import
cn.freemud.entities.dto.*
;
import
cn.freemud.entities.vo.CreateOrderVo
;
import
cn.freemud.entities.vo.QueryOrderResponseVo
;
import
cn.freemud.enums.*
;
import
cn.freemud.management.enums.OrderSource
;
import
cn.freemud.service.coupon.CouponRelationFactory
;
import
cn.freemud.service.coupon.CouponRelationService
;
import
cn.freemud.service.impl.StoreServiceImpl
;
import
cn.freemud.service.order.OrderRelationService
;
import
cn.freemud.service.thirdparty.CouponOfflineClient
;
import
cn.freemud.utils.LogUtil
;
import
cn.freemud.utils.PropertyConvertUtil
;
import
cn.freemud.utils.ResponseUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.freemud.application.sdk.api.couponcenter.offline.service.OfflineCouponSdkService
;
import
com.freemud.application.sdk.api.log.ErrorLog
;
import
com.freemud.application.sdk.api.log.LogThreadLocal
;
import
com.freemud.application.sdk.api.log.ThirdPartyLog
;
import
com.freemud.application.sdk.api.service.EmailAlertService
;
import
com.freemud.application.sdk.api.storecenter.response.StoreResponse
;
import
com.freemud.sdk.api.assortment.order.response.order.QueryOrderByIdResponse
;
import
com.google.common.base.Throwables
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -51,7 +44,6 @@ import java.util.ArrayList;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
@Service
(
"platformCouponRelationService"
)
...
...
@@ -76,6 +68,10 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService
@Override
public
BaseResponse
verificationCoupon
(
List
<
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
AccountBean
>
accountList
,
QueryOrdersResponseDto
.
DataBean
.
OrderBean
orderBean
,
CouponReqType
couponReqType
)
{
LogUtil
.
info
(
"fiserhman 券码核销 begin"
,
JSON
.
toJSONString
(
accountList
),
JSON
.
toJSONString
(
orderBean
));
if
(
CollectionUtils
.
isEmpty
(
accountList
))
{
return
ResponseUtil
.
success
();
}
if
(
accountList
.
size
()
>
1
)
{
Integer
code
=
OrderAccountType
.
FREIGHT_COUPON
.
getCode
();
// 运费券 塞进 核销接口里面, 这里真的是贼恶心 逻辑不敢动
...
...
@@ -155,6 +151,9 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService
couponCodeVerificationDto
.
setOrderDiscountAmount
(
Math
.
abs
(
accountBean
.
getPrice
()));
// 核销券新增参数:组织机构ID
couponCodeVerificationDto
.
setChannel_ids
(
storeService
.
getOrgIdsArr
(
orderBean
.
getCompanyId
(),
orderBean
.
getShopId
()));
boolean
ok
=
false
;
Exception
lastException
=
null
;
CouponCodeResponseDto
couponCodeResponseDto
=
null
;
// 设置配送券的 transactions
if
(
couponCodeVerificationTransDto
!=
null
)
{
List
<
CouponCodeVerificationTransDto
>
transactions
=
couponCodeVerificationDto
.
getTransactions
();
...
...
@@ -162,16 +161,13 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService
//只 传递一次, 防止后续开发 多张优惠券使用情况
couponCodeVerificationTransDto
=
null
;
}
boolean
ok
=
false
;
Exception
lastException
=
null
;
CouponCodeResponseDto
couponCodeResponseDto
=
null
;
try
{
//71.券核销
// todo 这循环有啥用-.-
for
(
int
i
=
2
;
i
>=
0
;
i
--)
{
LogUtil
.
info
(
"核销券码开始=="
,
JSON
.
toJSONString
(
couponCodeVerificationDto
),
null
);
couponCodeResponseDto
=
couponOfflineClient
.
verification
(
couponCodeVerificationDto
);
LogUtil
.
info
(
"核销券码返回=="
,
JSON
.
toJSONString
(
couponCodeVerificationDto
),
couponCodeResponseDto
);
LogUtil
.
info
(
"核销券码返回=="
,
JSON
.
toJSONString
(
couponCodeVerificationDto
),
JSON
.
toJSONString
(
couponCodeResponseDto
)
);
ThirdPartyLog
.
infoConvertJson
(
System
.
currentTimeMillis
(),
System
.
currentTimeMillis
(),
"/api"
,
couponCodeVerificationDto
,
couponCodeResponseDto
);
if
(
Objects
.
nonNull
(
couponCodeResponseDto
)
&&
Objects
.
equals
(
couponCodeResponseDto
.
getStatusCode
(),
ResponseResult
.
SUCCESS
.
getCode
()))
{
ok
=
true
;
...
...
@@ -235,4 +231,84 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService
LogUtil
.
error
(
trackingNo
,
"sendMessage COUPON_VERIFICATION error!!! routingKey = order-resource-push-log-routing-key"
,
JSONObject
.
toJSONString
(
dto
),
null
,
e
);
}
}
// @Override
// public BaseResponse verificationCoupon(List<QueryOrdersResponseDto.DataBean.OrderBean.AccountBean> accountList, QueryOrdersResponseDto.DataBean.OrderBean orderBean, CouponReqType couponReqType) {
// for (QueryOrdersResponseDto.DataBean.OrderBean.AccountBean accountBean : accountList) {
// List<CouponCodeVerificationProductDto> products = new ArrayList<>();
// //商品券核销核销参数
// if (OrderAccountType.PRODUCT_COUPON.getCode().equals(accountBean.getType())) {
// for (int i = 0; i < orderBean.getProductList().size(); i++) {
// QueryOrdersResponseDto.DataBean.OrderBean.ProductBean productBean = orderBean.getProductList().get(i);
// String pid = StringUtils.isNotBlank(productBean.getSpecification()) ? productBean.getSpecification() : productBean.getProductId();
// if (!org.springframework.util.CollectionUtils.isEmpty(orderBean.getProductList().get(i).getDiscountList())) {
// List<QueryOrdersResponseDto.DataBean.OrderBean.ProductBean.ProductDiscount> discounts = orderBean.getProductList().get(i).getDiscountList().stream().
// filter(productDiscount -> productDiscount.getDiscountId().equals(accountBean.getAccountId())).collect(Collectors.toList());
// for (QueryOrdersResponseDto.DataBean.OrderBean.ProductBean.ProductDiscount productDiscount : discounts) {
// if (productDiscount.getDiscountType() == null || productDiscount.getDiscountType() == 0) {
// continue;
// }
// CouponCodeVerificationProductDto couponCodeVerificationProductDto = new CouponCodeVerificationProductDto();
// couponCodeVerificationProductDto.setPID(pid);
// couponCodeVerificationProductDto.setConsume_num(productDiscount.getDiscountQty());
// couponCodeVerificationProductDto.setSeq(i + 1);
// products.add(couponCodeVerificationProductDto);
// }
// }
// }
// }
//
// Integer orderType = orderBean.getType();
// //商城单子用NewOrderType
// if(Objects.equals(OrderSource.MALL.getSource(),orderBean.getSource())){
// orderType = orderBean.getNewOrderType();
// }
// ActivityChannelEnum activityChannelEnum = PropertyConvertUtil.orderTypeEnumConvert2ActivityChannel(orderType);
// if (activityChannelEnum == null) {
// activityChannelEnum = ActivityChannelEnum.pickup;
// }
//
// // 核销优惠券 需要一起核销 配送券
// if (OrderAccountType.COUPON.getCode().equals(accountBean.getType())
// || OrderAccountType.PRODUCT_COUPON.getCode().equals(accountBean.getType())
// // 运费券
// || OrderAccountType.FREIGHT_COUPON.getCode().equals(accountBean.getType())
// || OrderAccountType.DISCOUNT_COUPON.getCode().equals(accountBean.getType())) {
//
// CouponCodeVerificationDto couponCodeVerificationDto = couponAdapter.convert2CouponCodeVerificationDto(activityChannelEnum,
// // 这里是活动code
// accountBean.getAccountId(), orderBean.getOid(), orderBean.getCompanyId(),
// orderBean.getShopId(), orderBean.getUserId(), products, accountBean.getPrice().intValue(),couponReqType);
//
// couponCodeVerificationDto.setOrderTotalAmount(orderBean.getOriginalAmount()==null ? 0L: orderBean.getOriginalAmount().longValue());
// couponCodeVerificationDto.setOrderPaymentAmount(orderBean.getAmount());
// couponCodeVerificationDto.setOrderDiscountAmount(orderBean.getOriginalAmount().longValue()-orderBean.getAmount());
// // 核销券新增参数:组织机构ID
// couponCodeVerificationDto.setChannel_codes(storeService.getOrgIdsArr(orderBean.getCompanyId(), orderBean.getShopId()));
// try {
// //71.券核销
// for (int i = 2; i >= 0; i--) {
// LogUtil.info("核销券码开始==", JSON.toJSONString(couponCodeVerificationDto), null);
// CouponCodeResponseDto couponCodeResponseDto = couponOfflineClient.verification(couponCodeVerificationDto);
// LogUtil.info("核销券码返回==", JSON.toJSONString(couponCodeVerificationDto), null);
// ThirdPartyLog.infoConvertJson(System.currentTimeMillis(), System.currentTimeMillis(), "/api", couponCodeVerificationDto, couponCodeResponseDto);
// if (Objects.equals(couponCodeResponseDto.getStatusCode(), ResponseResult.SUCCESS.getCode())) {
// LogUtil.info("CouponReverseServiceImpl", JSON.toJSONString(couponCodeVerificationDto), JSON.toJSONString(couponCodeResponseDto));
// break;
// }
// if (!Objects.equals(couponCodeResponseDto.getStatusCode(), ResponseResult.SUCCESS.getCode())) {
// emailAlertService.sendEmailAlert("核销券码失败", String.format("request:%s \r\nresponse:%s", JSONObject.toJSONString(couponCodeVerificationDto), JSONObject.toJSONString(couponCodeResponseDto)));
// return ResponseUtil.error(ResponseResult.COUPON_VERIFICATION_FAIL);
// }
// }
//
// } catch (Exception ex) {
// emailAlertService.sendEmailAlert("核销券码异常", String.format("request:%s \r\nexception:%s", JSONObject.toJSONString(couponCodeVerificationDto), Throwables.getStackTraceAsString(ex)));
// ErrorLog.printErrorLog("verification_error", "/api", couponCodeVerificationDto, ex);
// return ResponseUtil.error(ResponseResult.COUPON_VERIFICATION_FAIL);
// }
// }
// }
// return ResponseUtil.success();
// }
}
order-application-service/src/main/java/cn/freemud/service/impl/OrderServiceImpl.java
View file @
cf04ed03
...
...
@@ -28,7 +28,9 @@ import cn.freemud.entities.dto.MCCafeDeliveryBaseResponse;
import
cn.freemud.entities.dto.PayAccessResponse
;
import
cn.freemud.entities.dto.*
;
import
cn.freemud.entities.dto.QueryOrdersResponseDto.DataBean.OrderBean
;
import
cn.freemud.entities.dto.activity.*
;
import
cn.freemud.entities.dto.activity.PayGiftCheckAndJoinResponseDto
;
import
cn.freemud.entities.dto.activity.PayGiftCheckAndJoinResponseObj
;
import
cn.freemud.entities.dto.activity.PayGitCheckAndJoinRequestDto
;
import
cn.freemud.entities.dto.delivery.OrderRemindRequestDto
;
import
cn.freemud.entities.dto.delivery.QueryDeliveryAmountResponseDto
;
import
cn.freemud.entities.dto.delivery.QueryLocusRiderTrackDto
;
...
...
@@ -1342,10 +1344,8 @@ public class OrderServiceImpl implements Orderservice {
}
catch
(
Exception
e
){
ApiLog
.
error
(
"error to /promotionActivity/payGiftShareCheckAndJoin "
,
payGitRequestDto
,
e
);
}
}
private
void
orderStatusTracking
(
QueryOrdersResponse
.
DataBean
.
OrderBean
orderBean
,
OrderStatusTrackingInfoDto
orderStatusTrackingInfoByOid
)
{
List
<
OrderStatusTrackingInfoDto
.
OrderStatusTrackingInfo
>
data
=
orderStatusTrackingInfoByOid
.
getData
();
if
(
CollectionUtils
.
isNotEmpty
(
data
))
{
...
...
order-application-service/src/main/java/cn/freemud/service/job/PrometheusSchedulerCustomJob.java
View file @
cf04ed03
...
...
@@ -30,7 +30,7 @@ public class PrometheusSchedulerCustomJob {
* 最大连接池数量
* 最小连接池数量
*/
private
final
AtomicInteger
activeCountGauge
,
maxActiveGauge
,
maxIdleGauge
,
minIdleGauge
;
private
final
AtomicInteger
activeCountGauge
,
maxActiveGauge
,
maxIdleGauge
,
minIdleGauge
,
poolingCountGauge
;
private
final
CachingConnectionFactory
cachingConnectionFactory
;
private
final
DruidDataSource
druidDataSource
;
...
...
@@ -45,6 +45,7 @@ public class PrometheusSchedulerCustomJob {
idleChannelsNotTxHighWaterGauge
=
meterRegistry
.
gauge
(
"rabbitmq_idle_channels_not_tx_high_water"
,
new
AtomicInteger
(
0
));
activeCountGauge
=
meterRegistry
.
gauge
(
"db_active_count"
,
new
AtomicInteger
(
0
));
poolingCountGauge
=
meterRegistry
.
gauge
(
"db_pooling_count"
,
new
AtomicInteger
(
0
));
maxActiveGauge
=
meterRegistry
.
gauge
(
"db_max_active"
,
new
AtomicInteger
(
0
));
maxIdleGauge
=
meterRegistry
.
gauge
(
"db_max_idle"
,
new
AtomicInteger
(
0
));
minIdleGauge
=
meterRegistry
.
gauge
(
"db_min_idle"
,
new
AtomicInteger
(
0
));
...
...
@@ -61,6 +62,7 @@ public class PrometheusSchedulerCustomJob {
idleChannelsNotTxHighWaterGauge
.
set
(
Integer
.
parseInt
(
cacheProperties
.
getOrDefault
(
"idleChannelsNotTxHighWater"
,
0
).
toString
()));
activeCountGauge
.
set
(
druidDataSource
.
getActiveCount
());
poolingCountGauge
.
set
(
druidDataSource
.
getPoolingCount
());
maxActiveGauge
.
set
(
druidDataSource
.
getMaxActive
());
maxIdleGauge
.
set
(
druidDataSource
.
getMaxIdle
());
minIdleGauge
.
set
(
druidDataSource
.
getMinIdle
());
...
...
order-management/pom.xml
View file @
cf04ed03
...
...
@@ -65,7 +65,7 @@
<dependency>
<groupId>
cn.freemud
</groupId>
<artifactId>
assortment-ordercenter-sdk
</artifactId>
<version>
2.1.7
5
-RELEASE
</version>
<version>
2.1.7
6
-RELEASE
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
...
...
ordercenter-sdk/pom.xml
View file @
cf04ed03
...
...
@@ -8,7 +8,7 @@
<version>
1.0.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<version>
1.
4.0-SNAPSHOT
</version>
<version>
1.
3.63.RELEASE
</version>
<artifactId>
ordercenter-sdk
</artifactId>
<dependencies>
...
...
ordercenter-sdk/readme.md
View file @
cf04ed03
...
...
@@ -93,4 +93,5 @@
| 1.3.59.RELEASE | 取餐码迁移至聚合层 | 王航航 | 2021-06-07 |
| 1.3.60.RELEASE | 预计送达时间字段添加 | 周晓航 | 2021-06-24 |
| 1.3.61.RELEASE | 麦咖啡p7v2 | xukang | 2021-06-24 |
| 1.3.62.RELEASE | 集点活动改造 | 张志恒 | 2021-06-28 |
\ No newline at end of file
| 1.3.62.RELEASE | 集点活动改造 | 张志恒 | 2021-06-28 |
| 1.3.63.RELEASE | 开放平台取消订单调用oms | 张志恒 | 2021-07-01 |
\ No newline at end of file
shopping-cart-application-service/pom.xml
View file @
cf04ed03
...
...
@@ -61,7 +61,7 @@
<dependency>
<artifactId>
assortment-data-manager
</artifactId>
<groupId>
com.freemud.sdk.api.assortment
</groupId>
<version>
5.5.15
-SNAPSHOT
</version>
<version>
5.5.15
.RESEALE
</version>
</dependency>
<dependency>
<groupId>
com.freemud.application.service.sdk
</groupId>
...
...
shopping-cart-application-service/src/main/java/cn/freemud/controller/ShoppingCartController.java
View file @
cf04ed03
...
...
@@ -76,7 +76,6 @@ public class ShoppingCartController {
/**
* 从微信卡券向购物车中添加商品
*/
@ApiAnnotation
@PostMapping
(
value
=
"/addGoodsByCard"
)
@LogIgnore
(
logMessage
=
"addGoodsByCard"
)
public
BaseResponse
addGoodsByCard
(
@Validated
@LogParams
@RequestBody
AddGoodsByWeixinCardRequestVo
request
)
{
...
...
@@ -86,7 +85,6 @@ public class ShoppingCartController {
/**
* 向购物车中添加商品
*/
@ApiAnnotation
@IsConvertEN
@PostMapping
(
value
=
"/addGoods"
)
@LogIgnore
(
excludeStatusCodes
=
{
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
},
logMessage
=
"addGoods"
)
...
...
@@ -103,7 +101,6 @@ public class ShoppingCartController {
/**
* 修改购物车中商品数量
*/
@ApiAnnotation
@IsConvertEN
@PostMapping
(
value
=
"/updateGoodsQty"
)
@LogIgnore
(
logMessage
=
"updateGoodsQty"
)
...
...
@@ -120,7 +117,6 @@ public class ShoppingCartController {
/**
* 查询购物车信息
*/
@ApiAnnotation
@IsConvertEN
@PostMapping
(
value
=
"/listCartGoods"
)
@LogIgnore
(
logMessage
=
"listCartGoods"
)
...
...
@@ -143,7 +139,6 @@ public class ShoppingCartController {
* 查询购车信息无配送费
* SVC卡支付check,check购物车金额加配送费小于储值卡金额
*/
@ApiAnnotation
@PostMapping
(
value
=
"/listCartGoodsCheck"
)
@LogIgnore
(
excludeStatusCodes
=
{
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
},
logMessage
=
"listCartGoodsCheck"
)
public
BaseResponse
listCartGoodsCheck
(
@Validated
@LogParams
@RequestBody
ShoppingCartInfoRequestVo
request
)
{
...
...
@@ -166,7 +161,6 @@ public class ShoppingCartController {
/**
* 清空购物车
*/
@ApiAnnotation
@IsConvertEN
@PostMapping
(
value
=
"/clearCartGoods"
)
@LogIgnore
(
logMessage
=
"clearCartGoods"
)
...
...
@@ -188,7 +182,6 @@ public class ShoppingCartController {
* @param getShoppingCartGoodsApportionRequestVo
* @return
*/
@ApiAnnotation
@IsConvertEN
@PostMapping
(
value
=
"/getShoppingCartGoodsApportion"
)
@LogIgnore
(
logMessage
=
"getShoppingCartGoodsApportion"
)
...
...
@@ -246,7 +239,6 @@ public class ShoppingCartController {
/**
* 线下订单查询接口
*/
@ApiAnnotation
@PostMapping
(
value
=
"/getMemberInfo"
)
@LogIgnore
(
excludeStatusCodes
=
{
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
},
logMessage
=
"/getMemberInfo"
)
public
BaseResponse
getMemberInfo
(
@LogParams
@RequestBody
GetMemberInfoRequestDto
request
)
{
...
...
@@ -256,7 +248,6 @@ public class ShoppingCartController {
/**
* 结算页获取是否展示订单那备注配置
*/
@ApiAnnotation
@PostMapping
(
value
=
"/getOpenStoreIappWxappConfig"
)
@LogIgnore
(
excludeStatusCodes
=
{
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
},
logMessage
=
"/getOpenStoreIappWxappConfig"
)
public
BaseResponse
getOpenStoreIappWxappConfig
(
@LogParams
@RequestBody
OpenStoreIappWxappConfigRequestVo
request
)
{
...
...
@@ -266,7 +257,6 @@ public class ShoppingCartController {
/**
* 结算页获取加价购活动商品列表
*/
@ApiAnnotation
@PostMapping
(
value
=
"/premiumExchange"
)
@LogIgnore
(
excludeStatusCodes
=
{
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
},
logMessage
=
"/premiumExchange"
)
public
BaseResponse
premiumExchange
(
@LogParams
@RequestBody
@Validated
PremiumExchangeRequestVo
request
)
{
...
...
@@ -275,7 +265,6 @@ public class ShoppingCartController {
/**
* 券码查询购物车商品信息(平台结算页可用券列表用)
*/
@ApiAnnotation
@PostMapping
(
value
=
"/getCartInfoByUser"
)
@LogIgnore
(
excludeStatusCodes
=
{
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
},
logMessage
=
"/getCartInfoByUser"
)
public
BaseResponse
getCartInfoByUser
(
@LogParams
@RequestBody
@Validated
CouponAvailableRequestVo
request
)
{
...
...
@@ -286,13 +275,27 @@ public class ShoppingCartController {
* 【C端服务端】批量一键加购
* 替换老门店的商品到切换的门店下
*/
@ApiAnnotation
@PostMapping
(
value
=
"/replaceGoodsByShop"
)
@LogIgnore
(
excludeStatusCodes
=
{
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
},
logMessage
=
"/replaceGoodsByShop"
)
public
BaseResponse
replaceGoodsByShop
(
@LogParams
@RequestBody
@Validated
ShopGoodsReplaceVo
request
)
{
return
SDKCommonBaseContextWare
.
getBean
(
ShoppingCartNewServiceImpl
.
class
).
replaceGoodsByShop
(
request
);
}
/**
* 校验 代金券/ 折扣券互斥
* @param couponCodes
* @return
*/
private
BaseResponse
verifyCouponCodes
(
List
<
ShoppingCartInfoRequestVo
.
couponCode
>
couponCodes
){
if
(
CollectionUtils
.
isNotEmpty
(
couponCodes
)
&&
couponCodes
.
size
()
>
1
)
{
long
count
=
couponCodes
.
stream
().
filter
(
c
->
c
.
getCouponType
().
compareTo
(
CouponTypeEnum
.
TYPE_1
.
getCode
())
==
0
||
c
.
getCouponType
().
compareTo
(
CouponTypeEnum
.
TYPE_3
.
getCode
())
==
0
).
count
();
if
(
count
>
2
)
{
return
ResponseUtil
.
error
(
ResponseResult
.
SHOPPING_CART_COUPON_MUTUAL_EXCLUSION
);
}
}
return
null
;
}
@Autowired
private
ShoppingCartBaseServiceImpl
shoppingCartService
;
...
...
@@ -301,7 +304,6 @@ public class ShoppingCartController {
/**
* 测试用,后续删除
*/
@ApiAnnotation
@PostMapping
(
value
=
"/test/putCache"
)
@LogIgnore
(
excludeStatusCodes
=
{
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
},
logMessage
=
"/putCache"
)
public
BaseResponse
putCache
(
@LogParams
@RequestBody
@Validated
PutCacheVo
request
)
{
...
...
@@ -319,19 +321,4 @@ public class ShoppingCartController {
return
new
BaseResponse
(
"1"
,
"100"
,
""
);
}
/**
* 校验 代金券/ 折扣券互斥
* @param couponCodes
* @return
*/
private
BaseResponse
verifyCouponCodes
(
List
<
ShoppingCartInfoRequestVo
.
couponCode
>
couponCodes
){
if
(
CollectionUtils
.
isNotEmpty
(
couponCodes
)
&&
couponCodes
.
size
()
>
1
)
{
long
count
=
couponCodes
.
stream
().
filter
(
c
->
c
.
getCouponType
().
compareTo
(
CouponTypeEnum
.
TYPE_1
.
getCode
())
==
0
||
c
.
getCouponType
().
compareTo
(
CouponTypeEnum
.
TYPE_3
.
getCode
())
==
0
).
count
();
if
(
count
>
2
)
{
return
ResponseUtil
.
error
(
ResponseResult
.
SHOPPING_CART_COUPON_MUTUAL_EXCLUSION
);
}
}
return
null
;
}
}
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
cf04ed03
...
...
@@ -18,8 +18,6 @@ import cn.freemud.adapter.ShoppingCartConvertAdapter;
import
cn.freemud.adapter.StoreItemAdapter
;
import
cn.freemud.base.entity.BaseResponse
;
import
cn.freemud.base.util.DateUtil
;
import
cn.freemud.base.util.JsonUtil
;
import
cn.freemud.constant.ApplicationConstant
;
import
cn.freemud.constant.ResponseCodeConstant
;
import
cn.freemud.constant.ShoppingCartConstant
;
import
cn.freemud.demo.controller.ShoppingCartDemoController
;
...
...
@@ -334,7 +332,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// 获取商品详细信息
List
<
ProductBean
>
productBeanListSpuClass
=
assortmentSdkService
.
getProductsInfo
(
partnerId
,
storeId
,
Collections
.
singletonList
(
spuId2
),
addShoppingCartGoodsRequestVo
.
getMenuType
(),
this
.
shoppingCartBaseService
);
//
LogUtil.info("productBeanListSpuClass", spuId2,JSON.toJSONString(productBeanListSpuClass));
LogUtil
.
info
(
"productBeanListSpuClass"
,
spuId2
,
JSON
.
toJSONString
(
productBeanListSpuClass
));
// 没有查到商品
if
(
productBeanListSpuClass
==
null
||
productBeanListSpuClass
.
isEmpty
()){
...
...
@@ -505,7 +503,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
Long
deliveryAmount
=
calculateDeliveryAmount
(
receiveId
,
partnerId
,
storeId
,
userLoginInfoDto
.
getWxAppid
(),
shoppingCartGoodsResponseVo
,
updateShoppingCartGoodsQtyRequestVo
.
getOrderType
());
ActivityQueryDto
activityQueryDto
=
activityAdapter
.
getActivityQueryDto
(
partnerId
,
storeId
,
userId
,
appId
,
updateShoppingCartGoodsQtyRequestVo
.
getOrderType
());
// 根据商户门店判断是否走新促销
if
(
grayPush
(
partnerId
,
storeId
,
"2"
))
{
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
discountResult
=
null
;
discountResult
=
sharingDiscountService
.
getCalculationSharingDiscountResult
(
menuType
...
...
@@ -591,15 +588,15 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
requestDto
.
setStoreId
(
storeId
);
requestDto
.
setProductIds
(
Collections
.
singletonList
(
Long
.
parseLong
(
cartGoods
.
getGoodsId
())));
GetProductStockResponseDto
availableStocks
=
stockClient
.
getAvailableStocks
(
requestDto
);
if
(
availableStocks
==
null
||
!
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
.
equals
(
availableStocks
.
getCode
(
)))
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_STOCK_NOT_HAVE
);
}
int
stock
=
CollectionUtils
.
isEmpty
(
availableStocks
.
getResult
())
||
availableStocks
.
getResult
().
get
(
0
).
getQty
()
==
null
?
0
:
availableStocks
.
getResult
().
get
(
0
).
getQty
();
if
(
stock
<=
0
)
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_STOCK_NOT_HAVE
);
}
else
if
(
stock
<
qty
)
{
throw
new
BizServiceException
(
ResponseResult
.
SHOPPING_CART_STOCK_NOT_HAVE
,
"仅剩"
+
stock
+
"件库存了"
);
if
(
(
availableStocks
!=
null
)
&&
(
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
.
equals
(
availableStocks
.
getCode
()
)))
{
if
((
CollectionUtils
.
isEmpty
(
availableStocks
.
getResult
()))
||
(
availableStocks
.
getResult
().
get
(
0
).
getQty
()
!=
null
&&
qty
>
availableStocks
.
getResult
().
get
(
0
).
getQty
()))
{
Integer
stock
=
0
;
if
(!
CollectionUtils
.
isEmpty
(
availableStocks
.
getResult
())
&&
(
stock
=
availableStocks
.
getResult
().
get
(
0
).
getQty
())
>
0
)
{
throw
new
BizServiceException
(
ResponseResult
.
SHOPPING_CART_STOCK_NOT_HAVE
,
"仅剩"
+
stock
+
"件库存了"
);
}
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_STOCK_NOT_HAVE
);
}
}
}
...
...
@@ -695,6 +692,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
buildCoupons
(
coupons
,
shoppingCartInfoRequestVo
.
getCouponCodes
());
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
=
shoppingCartInfoRequestVo
.
getSendGoods
();
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoods
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
sendGoodsList
))
{
...
...
@@ -720,10 +718,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
,
sendGoods
,
deliveryAmount
,
null
);
// ApiLog.info("fisherman 新算价 配送费字段数据 01 ",calculationSharingDiscountResult,shoppingCartGoodsResponseVo);
if
(
ApplicationConstant
.
printDebug
){
ApiLog
.
printLog
(
"批量使用优惠券前,oldCoupons,coupons"
,
JSON
.
toJSONString
(
calculationSharingDiscountResult
),
JSON
.
toJSONString
(
shoppingCartGoodsResponseVo
),
null
);
}
sharingCartService
.
distribute
(
calculationSharingDiscountResult
,
cartGoodsList
,
shoppingCartGoodsResponseVo
...
...
@@ -738,10 +732,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
,
shoppingCartInfoRequestVo
.
getFlag
()
,
userId
,
storeId
);
// ApiLog.info("fisherman 新算价 配送费字段数据 02 ",null,shoppingCartGoodsResponseVo);shoppingCartGoodsResponseVo
if
(
ApplicationConstant
.
printDebug
){
ApiLog
.
printLog
(
"fisherman 新算价 配送费字段数据 02 "
,
JSON
.
toJSONString
(
shoppingCartGoodsResponseVo
),
null
,
null
);
}
buildShoppingCartGoodsResponse
(
shoppingCartGoodsResponseVo
,
calculationSharingDiscountResult
,
shoppingCartInfoRequestVo
.
getFlag
(),
partnerId
);
}
else
{
...
...
@@ -824,10 +815,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
// 添加购物车商品总价和加价购商品总价,现在是自己计算,后面需要优化为促销计算, 这段要删除
// ApiLog.info("fisherman 新算价 校验入参券是否可用new ",shoppingCartGoodsResponseVo,shoppingCartInfoRequestVo.getCouponCodes());
if
(
ApplicationConstant
.
printDebug
){
ApiLog
.
printLog
(
"fisherman 新算价 校验入参券是否可用new "
,
JSON
.
toJSONString
(
shoppingCartGoodsResponseVo
),
JSON
.
toJSONString
(
shoppingCartInfoRequestVo
.
getCouponCodes
()),
null
);
}
ApiLog
.
info
(
"校验入参券是否可用"
,
shoppingCartGoodsResponseVo
,
shoppingCartInfoRequestVo
.
getCouponCode
());
// 校验入参券是否可用
if
(!
checkAvailableCoupon
(
shoppingCartGoodsResponseVo
,
shoppingCartInfoRequestVo
.
getCouponCode
())){
return
ResponseUtil
.
error
(
ResponseResult
.
SHOPPING_CART_COUPON_NOT_USE
);
...
...
@@ -910,17 +898,17 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
return
ResponseUtil
.
error
(
ResponseResult
.
PARAMETER_MISSING
);
}
//打包带走外卖
if
(
StringUtils
.
isNotBlank
(
shoppingCartInfoRequestVo
.
getCardCode
())
&&
Objects
.
equals
(
shoppingCartInfoRequestVo
.
getOrderType
(),
2
)
if
(
StringUtils
.
isNotBlank
(
shoppingCartInfoRequestVo
.
getCardCode
())
&&
shoppingCartInfoRequestVo
.
getOrderType
()
==
2
&&
StringUtils
.
isBlank
(
shoppingCartInfoRequestVo
.
getReceiveId
()))
{
return
ResponseUtil
.
error
(
ResponseResult
.
PARAMETER_MISSING
);
}
String
partnerId
=
shoppingCartInfoRequestVo
.
getPartnerId
();
String
storeId
=
shoppingCartInfoRequestVo
.
getShopId
();
// 是否走重构
if
(
SDKCommonBaseContextWare
.
getBean
(
ShoppingCartNewServiceImpl
.
class
).
newShoppingCartGray
(
shoppingCartInfoRequestVo
.
getPartnerId
(),
shoppingCartInfoRequestVo
.
getShopId
())){
Map
requestMap
=
mapperFacade
.
map
(
shoppingCartInfoRequestVo
,
Map
.
class
);
BaseResponse
<
BaseListCartGoodsVO
>
goodsList
=
shoppingCartDemoController
.
listCartGoods
(
requestMap
);
BaseResponse
<
BaseListCartGoodsVO
>
goodsList
=
null
;
goodsList
=
shoppingCartDemoController
.
listCartGoods
(
requestMap
);
if
(
goodsList
==
null
||
!
ResponseResult
.
SUCCESS
.
getCode
().
equals
(
goodsList
.
getCode
()))
{
return
goodsList
;
...
...
@@ -1494,6 +1482,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
activityCalculationDiscountRequestDto
.
setProductChannel
(
BusinessTypeEnum
.
SAAS_DELIVERY
.
getCode
());
}
try
{
ApiLog
.
debug
(
"activityClient discount :{}"
,
JSON
.
toJSONString
(
activityCalculationDiscountRequestDto
));
activityCalculationDiscountResponseDto
=
activityClient
.
calculationDiscount
(
activityCalculationDiscountRequestDto
);
}
catch
(
Exception
ex
)
{
ErrorLog
.
printErrorLog
(
"calculation_discount_error"
,
"/calculation/discount"
,
activityCalculationDiscountRequestDto
,
ex
);
...
...
@@ -1712,12 +1701,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
*/
private
void
updateShoppingCartGoodsDiscount
(
CouponPromotionVO
couponPromotionVO
,
ActivityQueryDto
activityQueryDto
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
,
List
<
CartGoods
>
cartGoodsList
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
,
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
,
UserLoginInfoDto
userLoginInfoDto
,
String
menuType
,
Long
deliveryAmount
)
{
LogUtil
.
info
(
"fisherman 促销活动计算价格 01"
,
JSON
.
toJSONString
(
couponPromotionVO
),
JSON
.
toJSONString
(
activityQueryDto
));
LogUtil
.
info
(
"fisherman 促销活动计算价格 02"
,
JSON
.
toJSONString
(
calculationDiscountResult
),
JSON
.
toJSONString
(
cartGoodsList
));
LogUtil
.
info
(
"fisherman 促销活动计算价格 03"
,
JSON
.
toJSONString
(
shoppingCartGoodsResponseVo
),
JSON
.
toJSONString
(
shoppingCartInfoRequestVo
));
LogUtil
.
info
(
"fisherman 促销活动计算价格 04"
,
JSON
.
toJSONString
(
userLoginInfoDto
),
JSON
.
toJSONString
(
deliveryAmount
));
//默认计算优惠 设置包装费 原价 现价 优惠金额
//默认计算优惠
DefaultPromotionService
defaultPromotionService
=
(
DefaultPromotionService
)
PromotionFactory
.
getPromotionService
(
ShoppingCartPromotionEnum
.
DEFAULT_PROMOTION
);
defaultPromotionService
.
updateShoppingCartGoodsDiscount
(
couponPromotionVO
,
activityQueryDto
,
calculationDiscountResult
,
cartGoodsList
,
shoppingCartGoodsResponseVo
,
userLoginInfoDto
,
shoppingCartInfoRequestVo
);
...
...
@@ -2020,6 +2004,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
private
void
addProductGoods
(
AddShoppingCartGoodsRequestVo
addShoppingCartGoodsRequestVo
,
CartGoods
cartGoods
,
String
spuId2
,
String
userId
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
,
String
spuId
,
List
<
CartGoods
>
allCartGoodsList
,
List
<
ProductBean
>
productBeanListSpuClass
,
CouponProductDto
couponProductDto
,
String
couponCode
,
Integer
todayAvailableTimes
)
{
// 设置商品类型为商品券
if
(
CouponTypeEnum
.
TYPE_4
.
getCode
().
equals
(
couponProductDto
.
getType
()))
{
cartGoods
.
setGoodsType
(
GoodsTypeEnum
.
HG_COUPON_GOODS
.
getGoodsType
());
...
...
@@ -2085,39 +2072,35 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
*/
private
void
queryManyGoodsStocks
(
AddShoppingCartGoodsRequestVo
addShoppingCartGoodsRequestVo
,
List
<
Long
>
productIds
,
List
<
ProductBean
>
productBeanListSpuClass
,
String
skuId
,
Integer
qty
)
{
boolean
isLimit
=
false
;
GetProductStockRequestDto
requestDto
=
new
GetProductStockRequestDto
();
requestDto
.
setChannel
(
BusinessTypeEnum
.
getByType
(
addShoppingCartGoodsRequestVo
.
getMenuType
()).
getCode
());
requestDto
.
setPartnerId
(
addShoppingCartGoodsRequestVo
.
getPartnerId
());
requestDto
.
setStoreId
(
addShoppingCartGoodsRequestVo
.
getShopId
());
requestDto
.
setProductIds
(
productIds
);
GetProductStockResponseDto
availableStocks
=
null
;
if
(
productBeanListSpuClass
.
get
(
0
).
getType
()
==
ProductType
.
NOSPEC
.
getCode
()
&&
productBeanListSpuClass
.
get
(
0
).
getStockLimit
()
==
1
)
{
isLimit
=
true
;
availableStocks
=
stockClient
.
getAvailableStocks
(
requestDto
)
;
}
else
{
for
(
ProductBean
.
SkuProductBean
skuProductBean
:
productBeanListSpuClass
.
get
(
0
).
getSkuList
())
{
if
(
skuId
.
equals
(
skuProductBean
.
getSkuId
())
&&
skuProductBean
.
getStockLimit
()
==
1
)
{
isLimit
=
true
;
availableStocks
=
stockClient
.
getAvailableStocks
(
requestDto
)
;
break
;
}
}
}
// 不限制库存
if
(!
isLimit
){
return
;
}
GetProductStockRequestDto
requestDto
=
new
GetProductStockRequestDto
();
requestDto
.
setChannel
(
BusinessTypeEnum
.
getByType
(
addShoppingCartGoodsRequestVo
.
getMenuType
()).
getCode
());
requestDto
.
setPartnerId
(
addShoppingCartGoodsRequestVo
.
getPartnerId
());
requestDto
.
setStoreId
(
addShoppingCartGoodsRequestVo
.
getShopId
());
requestDto
.
setProductIds
(
productIds
);
GetProductStockResponseDto
availableStocks
=
stockClient
.
getAvailableStocks
(
requestDto
);
if
(
availableStocks
==
null
||
!
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
.
equals
(
availableStocks
.
getCode
()))
{
if
(
availableStocks
!=
null
&&
!
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
.
equals
(
availableStocks
.
getCode
()))
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_STOCK_NOT_HAVE
);
}
int
stock
=
CollectionUtils
.
isEmpty
(
availableStocks
.
getResult
())
||
availableStocks
.
getResult
().
get
(
0
).
getQty
()
==
null
?
0
:
availableStocks
.
getResult
().
get
(
0
).
getQty
();
if
(
stock
<=
0
)
{
if
(
availableStocks
!=
null
&&
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
.
equals
(
availableStocks
.
getCode
())
&&
(
CollectionUtils
.
isEmpty
(
availableStocks
.
getResult
())
||
availableStocks
.
getResult
().
get
(
0
).
getQty
()
==
null
||
availableStocks
.
getResult
().
get
(
0
).
getQty
()
<
qty
))
{
Integer
stock
=
0
;
if
(!
CollectionUtils
.
isEmpty
(
availableStocks
.
getResult
())
&&
(
stock
=
availableStocks
.
getResult
().
get
(
0
).
getQty
())
>
0
)
{
throw
new
BizServiceException
(
ResponseResult
.
SHOPPING_CART_STOCK_NOT_HAVE
,
"仅剩"
+
stock
+
"件库存了"
);
}
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_STOCK_NOT_HAVE
);
}
else
if
(
stock
<
qty
)
{
throw
new
BizServiceException
(
ResponseResult
.
SHOPPING_CART_STOCK_NOT_HAVE
,
"仅剩"
+
stock
+
"件库存了"
);
}
}
/**
...
...
@@ -2482,10 +2465,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
if
(
StringUtils
.
isBlank
(
receiveId
)
&&
!
Objects
.
equals
(
orderType
,
CreateOrderType
.
TAKE_OUT
.
getCode
()))
{
return
deliveryAmount
;
}
// ApiLog.debug("获取配送配逻辑 tackingNo:{},storeDeliveryUseOld:{},receiveId:{},partnerId:{},storeId:{}", LogThreadLocal.getTrackingNo(), storeDeliveryUseOld, receiveId, partnerId, storeId);
if
(
ApplicationConstant
.
printDebug
){
ApiLog
.
printLog
(
"获取配送配逻辑 tackingNo:{},storeDeliveryUseOld:{},receiveId:{},partnerId:{},storeId:{}"
,
LogThreadLocal
.
getTrackingNo
(),
JSON
.
toJSONString
(
storeDeliveryUseOld
),
"receiveId:"
+
receiveId
+
",partnerId:"
+
partnerId
+
",storeId:"
+
storeId
);
}
ApiLog
.
debug
(
"获取配送配逻辑 tackingNo:{},storeDeliveryUseOld:{},receiveId:{},partnerId:{},storeId:{}"
,
LogThreadLocal
.
getTrackingNo
(),
storeDeliveryUseOld
,
receiveId
,
partnerId
,
storeId
);
if
(
storeDeliveryUseOld
)
{
deliveryAmount
=
Long
.
parseLong
(
getDeliveryAmount
(
receiveId
,
partnerId
,
storeId
).
toString
());
shoppingCartGoodsResponseVo
.
setDeliveryFeeZeroReason
(
0
);
...
...
@@ -2506,10 +2486,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// }
// return sessionUserInfo.getResult();
AssortmentCustomerInfoVo
customerInfoVo
=
customerInfoManager
.
getCustomerInfoByObject
(
sessionId
);
if
(
customerInfoVo
==
null
)
throw
new
ServiceException
(
ResponseResult
.
NOT_LOGIN
);
if
(
customerInfoVo
==
null
)
throw
new
ServiceException
(
ResponseResult
.
NOT_LOGIN
);
;
String
jsonObject
=
JSON
.
toJSONString
(
customerInfoVo
);
CustomerInfoVo
customerInfoVo1
=
JSON
.
parseObject
(
jsonObject
,
CustomerInfoVo
.
class
);
LogUtil
.
debug
(
"customerInfoVo"
,
sessionId
,
customerInfoVo
);
// BeanUtil.convertBean(customerInfoVo,customerInfoVo1);
return
customerInfoVo1
;
}
...
...
@@ -2835,10 +2814,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
List
<
ShoppingCartInfoRequestVo
.
couponCode
>
coupons
){
// ApiLog.info("批量使用优惠券前,oldCoupons,coupons",oldCoupons,coupons);
if
(
ApplicationConstant
.
printDebug
){
ApiLog
.
printLog
(
"批量使用优惠券前,oldCoupons,coupons"
,
JSON
.
toJSONString
(
oldCoupons
),
JSON
.
toJSONString
(
coupons
),
null
);
}
ApiLog
.
info
(
"批量使用优惠券前,oldCoupons,coupons"
,
oldCoupons
,
coupons
);
for
(
int
i
=
0
;
i
<
oldCoupons
.
size
()
;
i
++){
CalculationSharingDiscountRequestDto
.
CalculationDiscountCoupon
oldCoupon
=
oldCoupons
.
get
(
i
);
...
...
@@ -2864,10 +2840,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
}
// ApiLog.info("批量使用优惠券后,oldCoupons,coupons",oldCoupons,coupons);
if
(
ApplicationConstant
.
printDebug
){
ApiLog
.
printLog
(
"批量使用优惠券后,oldCoupons,coupons"
,
JSON
.
toJSONString
(
oldCoupons
),
JSON
.
toJSONString
(
coupons
),
null
);
}
ApiLog
.
info
(
"批量使用优惠券后,oldCoupons,coupons"
,
oldCoupons
,
coupons
);
return
oldCoupons
;
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/job/PrometheusSchedulerCustomJob.java
View file @
cf04ed03
...
...
@@ -30,7 +30,7 @@ public class PrometheusSchedulerCustomJob {
* 最大连接池数量
* 最小连接池数量
*/
private
final
AtomicInteger
activeCountGauge
,
maxActiveGauge
,
maxIdleGauge
,
minIdleGauge
;
private
final
AtomicInteger
activeCountGauge
,
maxActiveGauge
,
maxIdleGauge
,
minIdleGauge
,
poolingCountGauge
;
private
final
CachingConnectionFactory
cachingConnectionFactory
;
private
final
DruidDataSource
druidDataSource
;
...
...
@@ -45,6 +45,7 @@ public class PrometheusSchedulerCustomJob {
idleChannelsNotTxHighWaterGauge
=
meterRegistry
.
gauge
(
"rabbitmq_idle_channels_not_tx_high_water"
,
new
AtomicInteger
(
0
));
activeCountGauge
=
meterRegistry
.
gauge
(
"db_active_count"
,
new
AtomicInteger
(
0
));
poolingCountGauge
=
meterRegistry
.
gauge
(
"db_pooling_count"
,
new
AtomicInteger
(
0
));
maxActiveGauge
=
meterRegistry
.
gauge
(
"db_max_active"
,
new
AtomicInteger
(
0
));
maxIdleGauge
=
meterRegistry
.
gauge
(
"db_max_idle"
,
new
AtomicInteger
(
0
));
minIdleGauge
=
meterRegistry
.
gauge
(
"db_min_idle"
,
new
AtomicInteger
(
0
));
...
...
@@ -61,6 +62,7 @@ public class PrometheusSchedulerCustomJob {
idleChannelsNotTxHighWaterGauge
.
set
(
Integer
.
parseInt
(
cacheProperties
.
getOrDefault
(
"idleChannelsNotTxHighWater"
,
0
).
toString
()));
activeCountGauge
.
set
(
druidDataSource
.
getActiveCount
());
poolingCountGauge
.
set
(
druidDataSource
.
getPoolingCount
());
maxActiveGauge
.
set
(
druidDataSource
.
getMaxActive
());
maxIdleGauge
.
set
(
druidDataSource
.
getMaxIdle
());
minIdleGauge
.
set
(
druidDataSource
.
getMinIdle
());
...
...
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