Commit 1bea042e by chongfu.liang

Merge branch 'feature/20200513_1.9.25_订单对接券码字段修改'

# Conflicts:
#	assortment-ordercenter-sdk/pom.xml
parents cdb539d5 12acba05
...@@ -220,7 +220,7 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService { ...@@ -220,7 +220,7 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
CouponRequest couponVerificationRequest = orderSdkAdapter.convert2CouponVerificationRequest(orderBean, accounts); CouponRequest couponVerificationRequest = orderSdkAdapter.convert2CouponVerificationRequest(orderBean, accounts);
if (couponVerificationRequest!=null){ if (couponVerificationRequest!=null){
// 核销券新增参数:组织机构 // 核销券新增参数:组织机构
couponVerificationRequest.setChannel_ids(this.getOrgIds(orderBean.getCompanyId(), orderBean.getShopId())); couponVerificationRequest.setChannel_codes(this.getOrgIds(orderBean.getCompanyId(), orderBean.getShopId()));
BaseResponse<CouponRedeemResponse> couponRedeemResponseBaseResponse = offlineCouponSdkService.couponRedeem(couponVerificationRequest, ""); BaseResponse<CouponRedeemResponse> couponRedeemResponseBaseResponse = offlineCouponSdkService.couponRedeem(couponVerificationRequest, "");
if (!ObjectUtils.equals(RESPONSE_SUCCESS_STR, couponRedeemResponseBaseResponse.getCode())) { if (!ObjectUtils.equals(RESPONSE_SUCCESS_STR, couponRedeemResponseBaseResponse.getCode())) {
//TODO 失败取消订单,异步冲正库存 //TODO 失败取消订单,异步冲正库存
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
<dependency> <dependency>
<groupId>com.freemud.application.service.sdk</groupId> <groupId>com.freemud.application.service.sdk</groupId>
<artifactId>couponcenter-sdk</artifactId> <artifactId>couponcenter-sdk</artifactId>
<version>1.8.14.RELEASE</version> <version>1.8.15.RELEASE</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
......
...@@ -28,6 +28,7 @@ import com.freemud.application.sdk.api.productcenter.response.valid.ValiadShopPr ...@@ -28,6 +28,7 @@ import com.freemud.application.sdk.api.productcenter.response.valid.ValiadShopPr
import com.freemud.application.sdk.api.productcenter.service.MenuService; import com.freemud.application.sdk.api.productcenter.service.MenuService;
import com.freemud.application.sdk.api.productcenter.service.ProductService; import com.freemud.application.sdk.api.productcenter.service.ProductService;
import com.freemud.application.sdk.api.storecenter.request.vo.GetOrgTreeListRequest; import com.freemud.application.sdk.api.storecenter.request.vo.GetOrgTreeListRequest;
import com.freemud.application.sdk.api.storecenter.response.vo.GetOrgTreeListResponse;
import com.freemud.application.sdk.api.storecenter.service.StoreCenterService; import com.freemud.application.sdk.api.storecenter.service.StoreCenterService;
import com.freemud.sdk.api.assortment.shoppingcart.adapter.ShoppingCartAdapter; import com.freemud.sdk.api.assortment.shoppingcart.adapter.ShoppingCartAdapter;
import com.freemud.sdk.api.assortment.shoppingcart.constant.*; import com.freemud.sdk.api.assortment.shoppingcart.constant.*;
...@@ -409,7 +410,7 @@ public interface ShoppingCartBaseService { ...@@ -409,7 +410,7 @@ public interface ShoppingCartBaseService {
couponDetailRequest.setMerchantId(partnerId); couponDetailRequest.setMerchantId(partnerId);
couponDetailRequest.setPartnerId(partnerId); couponDetailRequest.setPartnerId(partnerId);
// 券码新增参数:组织机构 // 券码新增参数:组织机构
couponDetailRequest.setChannelIdList(this.getOrgIds(partnerId, storeId)); couponDetailRequest.setChannelCodeList(this.getOrgIds(partnerId, storeId));
OnlineCouponSdkService onlineCouponSdkService = SDKCommonBaseContextWare.getBean(OnlineCouponSdkService.class); OnlineCouponSdkService onlineCouponSdkService = SDKCommonBaseContextWare.getBean(OnlineCouponSdkService.class);
com.freemud.application.sdk.api.base.BaseResponse<CouponDetailResponse> couponDetailResponse = onlineCouponSdkService.allDetail(couponDetailRequest, appKey, trackingNo); com.freemud.application.sdk.api.base.BaseResponse<CouponDetailResponse> couponDetailResponse = onlineCouponSdkService.allDetail(couponDetailRequest, appKey, trackingNo);
if (couponDetailResponse == null || !CartResponseConstant.SUCCESS.getCode().equals(couponDetailResponse.getCode()) || couponDetailResponse.getData() == null || CollectionUtils.isEmpty(couponDetailResponse.getData().getDetails())) { if (couponDetailResponse == null || !CartResponseConstant.SUCCESS.getCode().equals(couponDetailResponse.getCode()) || couponDetailResponse.getData() == null || CollectionUtils.isEmpty(couponDetailResponse.getData().getDetails())) {
...@@ -493,6 +494,7 @@ public interface ShoppingCartBaseService { ...@@ -493,6 +494,7 @@ public interface ShoppingCartBaseService {
couponDetailRequest.setMerchantId(couponAvailableReqVo.getMerchantId()); couponDetailRequest.setMerchantId(couponAvailableReqVo.getMerchantId());
couponDetailRequest.setStoreId(couponAvailableReqVo.getStoreId()); couponDetailRequest.setStoreId(couponAvailableReqVo.getStoreId());
couponDetailRequest.setCodes(couponAvailableReqVo.getCouponCodes()); couponDetailRequest.setCodes(couponAvailableReqVo.getCouponCodes());
couponDetailRequest.setChannelCodeList(this.getOrgCodes(couponAvailableReqVo.getPartnerId(), couponAvailableReqVo.getStoreId()));
return couponDetailRequest; return couponDetailRequest;
} }
...@@ -867,5 +869,27 @@ public interface ShoppingCartBaseService { ...@@ -867,5 +869,27 @@ public interface ShoppingCartBaseService {
} }
return Collections.EMPTY_LIST; return Collections.EMPTY_LIST;
} }
/**
* 查询门店服务 - 获取组织code集合
*
* @param partnerId
* @param storeCode
* @return
*/
default List<String> getOrgCodes(String partnerId, String storeCode) {
GetOrgTreeListRequest request = new GetOrgTreeListRequest();
request.setPartnerId(partnerId);
request.setStoreCode(storeCode);
StoreCenterService storeCenterService = SDKCommonBaseContextWare.getBean(StoreCenterService.class);
com.freemud.application.sdk.api.base.BaseResponse<GetOrgTreeListResponse> orgList = storeCenterService.getOrgTreeList(request, LogThreadLocal.getTrackingNo());
if (orgList != null && CartResponseConstant.SUCCESS.getCode().equals(orgList.getCode())) {
List<GetOrgTreeListResponse.OrgList> orgResponseList = orgList.getData().getOrgList();
if (CollectionUtils.isEmpty(orgResponseList)){
return null;
}
return orgResponseList.stream().map(org -> org.getOrganizationCode()).collect(Collectors.toList());
}
return null;
}
} }
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<dependency> <dependency>
<artifactId>couponcenter-sdk</artifactId> <artifactId>couponcenter-sdk</artifactId>
<groupId>com.freemud.application.service.sdk</groupId> <groupId>com.freemud.application.service.sdk</groupId>
<version>1.8.14.RELEASE</version> <version>1.10.4-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.freemud</groupId> <groupId>cn.freemud</groupId>
......
...@@ -27,5 +27,6 @@ public class CouponCodeBaseDto { ...@@ -27,5 +27,6 @@ public class CouponCodeBaseDto {
// 组织机构ID,(String 类型的集合) // 组织机构ID,(String 类型的集合)
private String[] channel_ids; private String[] channel_ids;
private String[] channel_codes;
} }
...@@ -98,7 +98,7 @@ public class CouponActivityServiceImpl implements CouponActivityService { ...@@ -98,7 +98,7 @@ public class CouponActivityServiceImpl implements CouponActivityService {
|| OrderAccountType.DISCOUNT_COUPON.getCode().equals(accountBean.getType())) { || OrderAccountType.DISCOUNT_COUPON.getCode().equals(accountBean.getType())) {
CouponCodeVerificationDto couponCodeVerificationDto = couponAdapter.convert2CouponCodeVerificationDto(activityChannelEnum, accountBean.getAccountId(), orderBean.getOid(), orderBean.getCompanyId(), orderBean.getShopId(), orderBean.getUserId(), products, accountBean.getPrice().intValue()); CouponCodeVerificationDto couponCodeVerificationDto = couponAdapter.convert2CouponCodeVerificationDto(activityChannelEnum, accountBean.getAccountId(), orderBean.getOid(), orderBean.getCompanyId(), orderBean.getShopId(), orderBean.getUserId(), products, accountBean.getPrice().intValue());
// 核销券新增参数:组织机构ID // 核销券新增参数:组织机构ID
couponCodeVerificationDto.setChannel_ids(storeService.getOrgIdsArr(orderBean.getCompanyId(), orderBean.getShopId())); couponCodeVerificationDto.setChannel_codes(storeService.getOrgIdsArr(orderBean.getCompanyId(), orderBean.getShopId()));
try { try {
//71.券核销 //71.券核销
CouponCodeResponseDto couponCodeResponseDto = couponOfflineClient.verification(couponCodeVerificationDto); CouponCodeResponseDto couponCodeResponseDto = couponOfflineClient.verification(couponCodeVerificationDto);
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<dependency> <dependency>
<groupId>com.freemud.application.service.sdk</groupId> <groupId>com.freemud.application.service.sdk</groupId>
<artifactId>couponcenter-sdk</artifactId> <artifactId>couponcenter-sdk</artifactId>
<version>1.8.14.RELEASE</version> <version>1.8.15.RELEASE</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.freemud</groupId> <groupId>cn.freemud</groupId>
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
<dependency> <dependency>
<groupId>com.freemud.card.sdk</groupId> <groupId>com.freemud.card.sdk</groupId>
<artifactId>freemud-card-sdk</artifactId> <artifactId>freemud-card-sdk</artifactId>
<version>2.4.17-RELEASE</version> <version>2.4.18-RELEASE</version>
</dependency> </dependency>
<dependency> <dependency>
......
...@@ -6,11 +6,14 @@ import com.freemud.application.sdk.api.base.BaseResponse; ...@@ -6,11 +6,14 @@ import com.freemud.application.sdk.api.base.BaseResponse;
import com.freemud.application.sdk.api.log.ApiLog; import com.freemud.application.sdk.api.log.ApiLog;
import com.freemud.application.sdk.api.log.LogThreadLocal; import com.freemud.application.sdk.api.log.LogThreadLocal;
import com.freemud.application.sdk.api.storecenter.request.vo.GetOrgTreeListRequest; import com.freemud.application.sdk.api.storecenter.request.vo.GetOrgTreeListRequest;
import com.freemud.application.sdk.api.storecenter.response.vo.GetOrgTreeListResponse;
import com.freemud.application.sdk.api.storecenter.service.StoreCenterService; import com.freemud.application.sdk.api.storecenter.service.StoreCenterService;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* All rights Reserved, Designed By www.freemud.cn * All rights Reserved, Designed By www.freemud.cn
...@@ -45,6 +48,29 @@ public interface CommonService { ...@@ -45,6 +48,29 @@ public interface CommonService {
return null; return null;
} }
/**
* 查询门店服务 - 获取组织code集合
*
* @param partnerId
* @param storeCode
* @return
*/
default List<String> getOrgCodes(String partnerId, String storeCode) {
GetOrgTreeListRequest request = new GetOrgTreeListRequest();
request.setPartnerId(partnerId);
request.setStoreCode(storeCode);
StoreCenterService storeCenterService = SpringBeanUtil.getBean(StoreCenterService.class);
BaseResponse<GetOrgTreeListResponse> orgList = storeCenterService.getOrgTreeList(request, LogThreadLocal.getTrackingNo());
if (orgList != null && ResponseCodeConstant.RESPONSE_SUCCESS_STR.equals(orgList.getCode())) {
List<GetOrgTreeListResponse.OrgList> orgResponseList = orgList.getData().getOrgList();
if (CollectionUtils.isEmpty(orgResponseList)){
return null;
}
return orgResponseList.stream().map(org -> org.getOrganizationCode()).collect(Collectors.toList());
}
return null;
}
default String getOrgIdsAsString(String partnerId, String storeCode) { default String getOrgIdsAsString(String partnerId, String storeCode) {
List<String> orgIdList = this.getOrgIds(partnerId, storeCode); List<String> orgIdList = this.getOrgIds(partnerId, storeCode);
return CollectionUtils.isNotEmpty(orgIdList) ? Joiner.on(",").join(orgIdList) : ""; return CollectionUtils.isNotEmpty(orgIdList) ? Joiner.on(",").join(orgIdList) : "";
......
...@@ -237,7 +237,7 @@ public class CouponServiceImpl implements CouponService { ...@@ -237,7 +237,7 @@ public class CouponServiceImpl implements CouponService {
map.put(Finals.ACTION, "code.allDetails"); map.put(Finals.ACTION, "code.allDetails");
// 券码接口新增参数:组织机构(多个用英文逗号分离) // 券码接口新增参数:组织机构(多个用英文逗号分离)
String channelIds = commonService.getOrgIdsAsString(requestVo.getPartnerId(), requestVo.getStoreId()); String channelIds = commonService.getOrgIdsAsString(requestVo.getPartnerId(), requestVo.getStoreId());
map.put(Finals.CHANNEL_ID_LIST, channelIds); map.put(Finals.CHANNEL_CODE_LIST, channelIds);
String appSecret = getAppSecret(requestVo.getPartnerId()); String appSecret = getAppSecret(requestVo.getPartnerId());
String sign = SignUtil.createMD5Sign(map, appSecret); String sign = SignUtil.createMD5Sign(map, appSecret);
map.put(Finals.SIGN, sign); map.put(Finals.SIGN, sign);
...@@ -413,7 +413,7 @@ public class CouponServiceImpl implements CouponService { ...@@ -413,7 +413,7 @@ public class CouponServiceImpl implements CouponService {
Long totalAmount = createProductRequest(cartGoods, productList); Long totalAmount = createProductRequest(cartGoods, productList);
couponAvailableReqVo.setTotalAmount(Integer.valueOf(totalAmount + "")); couponAvailableReqVo.setTotalAmount(Integer.valueOf(totalAmount + ""));
couponAvailableReqVo.setProductList(productList); couponAvailableReqVo.setProductList(productList);
couponAvailableReqVo.setChannelIdList(commonService.getOrgIds(partnerId, storeId)); couponAvailableReqVo.setChannelCodeList(commonService.getOrgCodes(partnerId, storeId));
// 构建计算SDK // 构建计算SDK
List<CouponStateVo> couponStateList = Lists.newArrayList(); List<CouponStateVo> couponStateList = Lists.newArrayList();
for (int j = 0; j <= count; j++) { for (int j = 0; j <= count; j++) {
...@@ -809,7 +809,7 @@ public class CouponServiceImpl implements CouponService { ...@@ -809,7 +809,7 @@ public class CouponServiceImpl implements CouponService {
Long totalAmount = 0L; Long totalAmount = 0L;
couponAvailableReqVo.setTotalAmount(Integer.valueOf(totalAmount + "")); couponAvailableReqVo.setTotalAmount(Integer.valueOf(totalAmount + ""));
couponAvailableReqVo.setProductList(productList); couponAvailableReqVo.setProductList(productList);
couponAvailableReqVo.setChannelIdList(commonService.getOrgIds(partnerId, storeId)); couponAvailableReqVo.setChannelCodeList(commonService.getOrgCodes(partnerId, storeId));
// 构建计算SDK // 构建计算SDK
List<CouponStateVo> couponStateList = Lists.newArrayList(); List<CouponStateVo> couponStateList = Lists.newArrayList();
for (int j = 0; j <= count; j++) { for (int j = 0; j <= count; j++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment