Commit 77618169 by 程裕兵

feat:rebind mini appid

parent 5e6c6271
......@@ -34,9 +34,11 @@ import com.jiejing.paycenter.api.merchant.vo.AuthSubChannelVO;
import com.jiejing.paycenter.api.merchant.vo.ConfigSubChannelVO;
import com.jiejing.paycenter.api.merchant.vo.MerchantVO;
import com.jiejing.paycenter.api.merchant.vo.SubChannelAuthVO;
import com.jiejing.paycenter.api.merchant.vo.SubChannelConfigVO;
import com.jiejing.paycenter.common.enums.common.OpenStateEnums;
import com.jiejing.paycenter.common.enums.merchant.ResourceTypeEnums;
import com.jiejing.paycenter.common.enums.merchant.SubChannelAuthTypeEnums;
import com.jiejing.paycenter.common.enums.merchant.SubChannelConfigTypeEnums;
import com.jiejing.paycenter.common.enums.merchant.SubChannelEnums;
import com.jiejing.paycenter.common.event.MerchantEvent;
import com.jiejing.paycenter.common.model.ResourceInfo;
......@@ -190,8 +192,8 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
if (null == relation) {
throw new BizException(FinanceErrorEnums.MERCHANT_NOT_OPEN);
}
ConfigSubChannelVO vo = merchantRpcService.bindAppIdWxXcxOffline(channel, IdWorker.getIdStr(),
relation.getMerchantId(), appId);
ConfigSubChannelVO vo = merchantRpcService.bindAppIdWxXcxOffline(channel, relation.getMerchantId(),
appId);
return StudioMerchantBindXcxAppIdVO.builder().state(vo.getState()).failMessage(vo.getFailMessage())
.build();
......@@ -243,15 +245,31 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
if (OpenStateEnums.SUCCESS == applyToModify.getOpenState()) {
// 所有子通道全部开通成功
// 1. 绑定场馆
// 1. 配置场馆小程序appId
PartyToMerchant relation = getRelation(apply.getStudioId());
if (null != relation) {
this.rebindMiniAppId(relation.getMerchantId(), event.getMerchantId());
}
// 2. 绑定场馆
this.bind(apply.getStudioId(), event.getMerchantId());
// 2. 绑定品牌
// 3. 绑定品牌
brandMerchantService.bind(apply.getBrandId(), event.getMerchantId());
}
}
private void rebindMiniAppId(Long oldMerchantId, Long newMerchantId) {
MerchantVO merchant = merchantRpcService.getByMerchantId(oldMerchantId);
merchant.getSubChannelConfigs().stream()
.filter(e -> SubChannelConfigTypeEnums.WX_XCX_OFFLINE.name().equals(e.getConfigType()))
.forEach(
config -> merchantRpcService.bindAppIdWxXcxOffline(merchant.getChannelNo(), newMerchantId,
config.getAppId()));
}
private Map<ResourceTypeEnums, ResourceInfo> upload(ApplyStudioMerchantParams params) {
Map<ResourceTypeEnums, ResourceInfo> resourceMap = MerchantConvert.convertResourceMap(
......
......@@ -56,10 +56,9 @@ public class MerchantRpcService {
return result.getResult();
}
public ConfigSubChannelVO bindAppIdWxXcxOffline(String channelNo, String applyNo, Long merchantId,
String appId) {
public ConfigSubChannelVO bindAppIdWxXcxOffline(String channelNo, Long merchantId, String appId) {
JsonResult<ConfigSubChannelVO> result = merchantApi.configSubChannel(ConfigSubChannelRequest.builder()
.applyNo(applyNo)
.applyNo(IdWorker.getIdStr())
.appId(appId)
.merchantId(merchantId)
.channelNo(channelNo)
......@@ -67,7 +66,8 @@ public class MerchantRpcService {
.configType(SubChannelConfigTypeEnums.WX_XCX_OFFLINE)
.build());
if (!result.getSuccess()) {
return ConfigSubChannelVO.builder().state(OpenStateEnums.FAIL.name()).failMessage(result.getMessage()).build();
return ConfigSubChannelVO.builder().state(OpenStateEnums.FAIL.name()).failMessage(result.getMessage())
.build();
}
return result.getResult();
}
......
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