Commit 16ded966 by 程裕兵

feat:bind appId

parent f29e7e9b
......@@ -3,6 +3,7 @@ package com.jiejing.fitness.finance.api.merchant;
import com.jiejing.common.model.JsonResult;
import com.jiejing.common.model.PageVO;
import com.jiejing.fitness.finance.api.merchant.request.ApplyBrandMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.BindBrandMerchantXcxAppIdRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantApplyRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.PageBrandMerchantApplyRequest;
......@@ -39,4 +40,8 @@ public interface BrandMerchantApi {
@PostMapping(value = "/private/brandMerchant/pageApply")
JsonResult<PageVO<BrandMerchantApplyVO>> pageApply(PageBrandMerchantApplyRequest request);
@ApiOperation(value = "绑定微信小程序appId", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/bindXcxAppId")
JsonResult<Void> bindXcxAppId(BindBrandMerchantXcxAppIdRequest request);
}
......@@ -3,6 +3,7 @@ package com.jiejing.fitness.finance.api.merchant;
import com.jiejing.common.model.JsonResult;
import com.jiejing.common.model.PageVO;
import com.jiejing.fitness.finance.api.merchant.request.ApplyBrandMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.BindBrandMerchantXcxAppIdRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantApplyRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.PageBrandMerchantApplyRequest;
......@@ -40,6 +41,11 @@ public class BrandMerchantApiFallback implements FallbackFactory<BrandMerchantAp
public JsonResult<PageVO<BrandMerchantApplyVO>> pageApply(PageBrandMerchantApplyRequest request) {
return JsonResult.rpcError();
}
@Override
public JsonResult<Void> bindXcxAppId(BindBrandMerchantXcxAppIdRequest request) {
return JsonResult.rpcError();
}
};
}
}
package com.jiejing.fitness.finance.api.merchant.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author chengyubing
* @since 2024/2/26 13:58
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "品牌商户绑定小程序appId")
public class BindBrandMerchantXcxAppIdRequest {
@ApiModelProperty(value = "品牌ID", required = true)
@NotNull(message = "品牌ID不能为空")
private Long brandId;
@ApiModelProperty(value = "小程序appId", required = true)
@NotNull(message = "小程序appId不能为空")
private String appId;
}
package com.jiejing.fitness.finance.api.merchant.vo;
import com.jiejing.paycenter.common.enums.common.OpenStateEnums;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author chengyubing
* @since 2024/2/26 14:37
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "品牌商户绑定小程序AppIdVO")
public class BrandMerchantBindXcxAppIdVO {
@ApiModelProperty("绑定状态")
private OpenStateEnums state;
@ApiModelProperty("失败原因")
private String failMessage;
}
......@@ -4,6 +4,7 @@ import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
import com.jiejing.common.config.idgen.EnableLeaseIdWorker;
import com.jiejing.filecenter.api.common.event.ResourceEvent;
import com.jiejing.paycenter.common.event.MerchantEvent;
import com.jiejing.paycenter.common.event.MerchantSubChannelConfigEvent;
import com.jiejing.paycenter.common.event.PayEvent;
import com.xiaomai.event.annotation.EnableEventBinding;
import lombok.extern.slf4j.Slf4j;
......@@ -26,6 +27,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableEventBinding(listenerClass = {
PayEvent.class,
MerchantEvent.class,
MerchantSubChannelConfigEvent.class,
ResourceEvent.class
})
@EnableFeignClients(basePackages = {
......
......@@ -5,6 +5,7 @@ import com.jiejing.common.model.PageVO;
import com.jiejing.common.utils.convert.BeanUtil;
import com.jiejing.fitness.finance.api.merchant.BrandMerchantApi;
import com.jiejing.fitness.finance.api.merchant.request.ApplyBrandMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.BindBrandMerchantXcxAppIdRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantApplyRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.PageBrandMerchantApplyRequest;
......@@ -62,4 +63,12 @@ public class BrandMerchantController implements BrandMerchantApi {
return JsonResult.success(brandMerchantService.pageApply(params));
}
@ApiOperation(value = "绑定微信小程序appId", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/bindXcxAppId")
@Override
public JsonResult<Void> bindXcxAppId(@RequestBody @Valid BindBrandMerchantXcxAppIdRequest request) {
brandMerchantService.bindXcxAppId(request.getBrandId(), request.getAppId());
return JsonResult.success();
}
}
/*
* Copyright © 2024 Hangzhou Jiejing Technology Co., Ltd. All rights reserved.
*
* The copyright of the company's program code belongs to Hangzhou Jiejing Technology Co., Ltd. No one can illegally copy it without the explicit permission of this website.
* Official website: www.xiaomai5.com
*
*
*
* Copyright © 2024 杭州杰竞科技有限公司 版权所有.
*
* 本公司程序代码的版权归杭州杰竞科技有限公司所有,未经本网站的明确许可,任何人不得非法复制。
* 官网: www.xiaomai5.com
*/
package com.jiejing.fitness.finance.repository.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.jiejing.paycenter.common.enums.common.OpenStateEnums;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* <p>
* 品牌商户绑定微信appId申请表
* </p>
*
* @author chengyubing, created on 2024-02-26
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
public class BrandBindWxAppIdApply implements Serializable {
private static final long serialVersionUID = -9166678474448013070L;
/**
* 备注: 主键 是否允许为null: NO
*/
@TableId(value = "id", type = IdType.ID_WORKER)
private Long id;
/**
* 备注: 品牌ID 是否允许为null: YES
*/
private Long brandId;
/**
* 备注: 商户ID 是否允许为null: YES
*/
private Long merchantId;
/**
* 备注: appID 是否允许为null: YES
*/
private String appId;
/**
* 备注: 申请单号 是否允许为null: YES
*/
private String applyNo;
/**
* 备注: 申请状态 是否允许为null: YES
*/
private OpenStateEnums state;
/**
* 失败原因
*/
private String failMessage;
/**
* 备注: 创建时间 是否允许为null: YES
*/
private Date createTime;
/**
* 备注: 更新时间 是否允许为null: YES
*/
private Date updateTime;
public static final String ID = "id";
public static final String BRAND_ID = "brand_id";
public static final String MERCHANT_ID = "merchant_id";
public static final String APP_ID = "app_id";
public static final String APPLY_NO = "apply_no";
public static final String STATE = "state";
public static final String FAIL_MESSAGE = "fail_message";
public static final String CREATE_TIME = "create_time";
public static final String UPDATE_TIME = "update_time";
}
/*
* Copyright © 2024 Hangzhou Jiejing Technology Co., Ltd. All rights reserved.
*
* The copyright of the company's program code belongs to Hangzhou Jiejing Technology Co., Ltd. No one can illegally copy it without the explicit permission of this website.
* Official website: www.xiaomai5.com
*
*
*
* Copyright © 2024 杭州杰竞科技有限公司 版权所有.
*
* 本公司程序代码的版权归杭州杰竞科技有限公司所有,未经本网站的明确许可,任何人不得非法复制。
* 官网: www.xiaomai5.com
*/
package com.jiejing.fitness.finance.repository.mapper;
import com.jiejing.fitness.finance.repository.entity.BrandBindWxAppIdApply;
import com.jiejing.mbp.inject.XBaseMapper;
import org.apache.ibatis.annotations.Param;
/**
* <p>
* 品牌商户绑定微信appId申请表 Mapper 接口
* </p>
*
* @author chengyubing, created on 2024-02-26
*/
public interface BrandBindWxAppIdApplyMapper extends XBaseMapper<BrandBindWxAppIdApply> {
BrandBindWxAppIdApply selectLatestSuccess(@Param("merchantId") Long merchantId,
@Param("appId") String appId);
BrandBindWxAppIdApply selectLatestOne(@Param("merchantId") Long merchantId,
@Param("appId") String appId);
}
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright © 2024 Hangzhou Jiejing Technology Co., Ltd. All rights reserved.
~
~ The copyright of the company's program code belongs to Hangzhou Jiejing Technology Co., Ltd. No one can illegally copy it without the explicit permission of this website.
~ Official website: www.xiaomai5.com
~
~
~
~ Copyright © 2024 杭州杰竞科技有限公司 版权所有.
~
~ 本公司程序代码的版权归杭州杰竞科技有限公司所有,未经本网站的明确许可,任何人不得非法复制。
~ 官网: www.xiaomai5.com
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jiejing.fitness.finance.repository.mapper.BrandBindWxAppIdApplyMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, brand_id, merchant_id, app_id, apply_no, state, fail_message, create_time, update_time
</sql>
<select id="selectLatestSuccess"
resultType="com.jiejing.fitness.finance.repository.entity.BrandBindWxAppIdApply">
select *
from brand_bind_wx_app_id_apply
where merchant_id = #{merchantId}
and app_id = #{appId}
and state = 'S'
order by id desc
limit 1;
</select>
<select id="selectLatestOne"
resultType="com.jiejing.fitness.finance.repository.entity.BrandBindWxAppIdApply">
select *
from brand_bind_wx_app_id_apply
where merchant_id = #{merchantId}
and app_id = #{appId}
order by id desc
limit 1;
</select>
</mapper>
/*
* Copyright © 2024 Hangzhou Jiejing Technology Co., Ltd. All rights reserved.
*
* The copyright of the company's program code belongs to Hangzhou Jiejing Technology Co., Ltd. No one can illegally copy it without the explicit permission of this website.
* Official website: www.xiaomai5.com
*
*
*
* Copyright © 2024 杭州杰竞科技有限公司 版权所有.
*
* 本公司程序代码的版权归杭州杰竞科技有限公司所有,未经本网站的明确许可,任何人不得非法复制。
* 官网: www.xiaomai5.com
*/
package com.jiejing.fitness.finance.repository.service;
import com.jiejing.fitness.finance.repository.entity.BrandBindWxAppIdApply;
import com.jiejing.fitness.finance.repository.mapper.BrandBindWxAppIdApplyMapper;
import com.jiejing.mbp.MapperRepoService;
import org.springframework.stereotype.Service;
/**
* <p>
* 品牌商户绑定微信appId申请表 服务实现类
* </p>
*
* @author chengyubing, created on 2024-02-26
*/
@Service
public class BrandBindWxAppIdApplyRpService extends
MapperRepoService<Long, BrandBindWxAppIdApply, BrandBindWxAppIdApplyMapper> {
public BrandBindWxAppIdApply getLatestSuccessByMerchantIdAndAppId(Long merchantId, String appId) {
return this.baseMapper.selectLatestSuccess(merchantId, appId);
}
public BrandBindWxAppIdApply getLatestByMerchantIdAndAppId(Long merchantId, String appId) {
return this.baseMapper.selectLatestOne(merchantId, appId);
}
}
......@@ -53,7 +53,8 @@ public class GeneratorServiceEntity {
private String[] tableNames = {
// "brand_merchant_apply",
// "brand_to_merchant",
"global_config"
// "global_config",
"brand_bind_wx_app_id_apply"
};
/**
......
......@@ -15,6 +15,7 @@ public enum FinanceErrorEnums implements BaseBizError {
*/
PARAMS_ERROR("【参数错误】${message}"),
THIRD_ERROR("【三方异常】${message}"),
BIZ_ERROR("【业务错误】${message}"),
NOT_EXIST("数据不存在"),
NOT_SUPPORT_METHOD("不支持的方法"),
NOT_SUPPORT_TYPE("不支持的类型"),
......
......@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSON;
import com.jiejing.fitness.finance.api.enums.MerchantTypeEnums;
import com.jiejing.fitness.finance.service.merchant.BrandMerchantService;
import com.jiejing.paycenter.common.event.MerchantEvent;
import com.jiejing.paycenter.common.event.MerchantSubChannelConfigEvent;
import com.xiaomai.event.annotation.EventHandler;
import java.util.ArrayList;
import java.util.Optional;
......@@ -44,8 +45,21 @@ public class ListenerService {
break;
}
} catch (Exception e) {
log.error("merchant event callback process fail {}", JSON.toJSONString(event));
log.error("merchant event callback process fail {}", JSON.toJSONString(event), e);
}
}
@EventHandler(value = MerchantSubChannelConfigEvent.class, binder = "biz-kafka", maxAttempts = MAX_RETRY)
public void handleMerchantSubChannelConfigEvent(MerchantSubChannelConfigEvent event,
@Header(DELIVERY_ATTEMPT) int retryNum) {
try {
log.info("start process merchant sub channel config event {}, {}, {}", event.getApplyNo(),
event.getMerchantId());
brandMerchantService.bindXcxAppIdCallback(event);
} catch (Exception e) {
log.info("merchant sub channel config event callback process fail {}", JSON.toJSONString(event), e);
}
}
}
......@@ -2,10 +2,12 @@ package com.jiejing.fitness.finance.service.merchant;
import com.jiejing.common.model.PageVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantBindXcxAppIdVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO;
import com.jiejing.fitness.finance.service.merchant.params.ApplyBrandMerchantParams;
import com.jiejing.fitness.finance.service.merchant.params.PageBrandMerchantApplyParams;
import com.jiejing.paycenter.common.event.MerchantEvent;
import com.jiejing.paycenter.common.event.MerchantSubChannelConfigEvent;
/**
* 品牌商户服务
......@@ -53,5 +55,28 @@ public interface BrandMerchantService {
*/
PageVO<BrandMerchantApplyVO> pageApply(PageBrandMerchantApplyParams params);
/**
* 绑定小程序AppId
*
* @param brandId 品牌Id
* @param appId appId
*/
void bindXcxAppId(Long brandId, String appId);
/**
* 绑定小程序AppId结果
*
* @param brandId 品牌ID
* @param appId 小程序appId
* @return 结果
*/
BrandMerchantBindXcxAppIdVO checkBindXcxAppId(Long brandId, String appId);
/**
* 绑定小程序AppId回调
*
* @param event 事件
*/
void bindXcxAppIdCallback(MerchantSubChannelConfigEvent event);
}
......@@ -3,6 +3,7 @@ package com.jiejing.fitness.finance.service.merchant.convert;
import static com.jiejing.paycenter.common.enums.merchant.ResourceTypeEnums.*;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.jiejing.common.utils.convert.BeanUtil;
import com.jiejing.common.utils.crypt.AesUtil;
import com.jiejing.filecenter.api.resource.vo.ResourceInfoVO;
......@@ -14,7 +15,9 @@ import com.jiejing.fitness.finance.api.merchant.model.BrandLegalInfo;
import com.jiejing.fitness.finance.api.merchant.model.BrandLicenseInfo;
import com.jiejing.fitness.finance.api.merchant.model.BrandResourceInfo;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantBindXcxAppIdVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO;
import com.jiejing.fitness.finance.repository.entity.BrandBindWxAppIdApply;
import com.jiejing.fitness.finance.repository.entity.BrandMerchantApply;
import com.jiejing.fitness.finance.repository.entity.BrandToMerchant;
import com.jiejing.fitness.finance.service.merchant.params.ApplyBrandMerchantParams;
......@@ -30,6 +33,7 @@ import com.jiejing.paycenter.common.enums.merchant.SceneTypeEnums;
import com.jiejing.paycenter.common.enums.merchant.SubChannelAuthTypeEnums;
import com.jiejing.paycenter.common.enums.merchant.SubChannelOpenTypeEnums;
import com.jiejing.paycenter.common.event.MerchantEvent;
import com.jiejing.paycenter.common.event.MerchantSubChannelConfigEvent;
import com.jiejing.paycenter.common.model.Address;
import com.jiejing.paycenter.common.model.BankCard;
import com.jiejing.paycenter.common.model.BusinessInfo;
......@@ -469,4 +473,33 @@ public class MerchantConvert {
.map(MerchantConvert::convertApply)
.collect(Collectors.toList());
}
public static BrandBindWxAppIdApply convertBrandBindWxAppIdApply(BrandToMerchant relation, String appId) {
Long id = IdWorker.getId();
return BrandBindWxAppIdApply.builder()
.id(id)
.applyNo(id.toString())
.brandId(relation.getBrandId())
.merchantId(relation.getMerchantId())
.appId(appId)
.state(OpenStateEnums.INIT)
.createTime(new Date())
.updateTime(new Date())
.build();
}
public static BrandMerchantBindXcxAppIdVO convertBrandBindWxAppIdApply(BrandBindWxAppIdApply apply) {
return BrandMerchantBindXcxAppIdVO.builder().state(apply.getState()).failMessage(apply.getFailMessage())
.build();
}
public static BrandBindWxAppIdApply convertBrandBindWxAppIdApply(BrandBindWxAppIdApply apply,
OpenStateEnums state, String failMessage) {
return BrandBindWxAppIdApply.builder()
.id(apply.getId())
.state(state)
.failMessage(failMessage)
.updateTime(new Date())
.build();
}
}
package com.jiejing.fitness.finance.service.merchant.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.jiejing.common.exception.BizException;
import com.jiejing.common.model.PageVO;
import com.jiejing.common.utils.convert.BeanUtil;
import com.jiejing.filecenter.api.resource.vo.ResourceInfoVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantBindXcxAppIdVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO;
import com.jiejing.fitness.finance.repository.entity.BrandBindWxAppIdApply;
import com.jiejing.fitness.finance.repository.entity.BrandMerchantApply;
import com.jiejing.fitness.finance.repository.entity.BrandToMerchant;
import com.jiejing.fitness.finance.repository.entity.GlobalConfig;
import com.jiejing.fitness.finance.repository.query.PageBrandMerchantApplyQuery;
import com.jiejing.fitness.finance.repository.service.BrandBindWxAppIdApplyRpService;
import com.jiejing.fitness.finance.repository.service.BrandMerchantApplyRpService;
import com.jiejing.fitness.finance.repository.service.BrandToMerchantRpService;
import com.jiejing.fitness.finance.repository.service.GlobalConfigRpService;
......@@ -25,16 +29,20 @@ import com.jiejing.fitness.finance.service.rpc.MerchantRpcService;
import com.jiejing.fitness.finance.service.rpc.ResourceRpcService;
import com.jiejing.fitness.finance.service.rpc.StudioRpcService;
import com.jiejing.paycenter.api.merchant.request.ApplyMerchantRequest;
import com.jiejing.paycenter.api.merchant.vo.ConfigSubChannelVO;
import com.jiejing.paycenter.api.merchant.vo.MerchantVO;
import com.jiejing.paycenter.common.enums.common.OpenStateEnums;
import com.jiejing.paycenter.common.enums.merchant.ResourceTypeEnums;
import com.jiejing.paycenter.common.event.MerchantEvent;
import com.jiejing.paycenter.common.event.MerchantSubChannelConfigEvent;
import com.jiejing.paycenter.common.model.ResourceInfo;
import com.jiejing.paycenter.common.model.SubChannelConfigInfo;
import com.jiejing.paycenter.common.model.SubChannelInfo;
import com.jiejing.studio.api.studio.vo.StudioVO;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
......@@ -74,6 +82,9 @@ public class BrandMerchantServiceImpl implements BrandMerchantService {
private BrandToMerchantRpService brandToMerchantRpService;
@Resource
private BrandBindWxAppIdApplyRpService brandBindWxAppIdApplyRpService;
@Resource
private GlobalConfigRpService globalConfigRpService;
......@@ -146,6 +157,45 @@ public class BrandMerchantServiceImpl implements BrandMerchantService {
return PageVO.convert(page, MerchantConvert.convertApplyList(page.getContent()));
}
@Override
public void bindXcxAppId(Long brandId, String appId) {
BrandToMerchant relation = brandToMerchantRpService.getByBrandId(brandId);
BrandBindWxAppIdApply latest = brandBindWxAppIdApplyRpService.getLatestSuccessByMerchantIdAndAppId(
relation.getMerchantId(), appId);
if (null != latest) {
throw new BizException(FinanceErrorEnums.BIZ_ERROR,
new JSONObject().fluentPut("message", "appId已绑定"));
}
BrandBindWxAppIdApply apply = MerchantConvert.convertBrandBindWxAppIdApply(relation, appId);
brandBindWxAppIdApplyRpService.insert(apply);
ConfigSubChannelVO vo = merchantRpcService.bindAppIdWxXcxOffline(channel, apply.getApplyNo(),
relation.getMerchantId(), appId);
BrandBindWxAppIdApply toModify = MerchantConvert.convertBrandBindWxAppIdApply(apply, vo.getState(),
vo.getFailMessage());
brandBindWxAppIdApplyRpService.updateById(toModify);
}
@Override
public BrandMerchantBindXcxAppIdVO checkBindXcxAppId(Long brandId, String appId) {
BrandToMerchant relation = brandToMerchantRpService.getByBrandId(brandId);
BrandBindWxAppIdApply latest = brandBindWxAppIdApplyRpService.getLatestByMerchantIdAndAppId(
relation.getMerchantId(), appId);
return MerchantConvert.convertBrandBindWxAppIdApply(latest);
}
@Override
public void bindXcxAppIdCallback(MerchantSubChannelConfigEvent event) {
BrandBindWxAppIdApply apply = brandBindWxAppIdApplyRpService.getById(Long.parseLong(event.getApplyNo()))
.orElse(null);
if (null == apply) {
return;
}
BrandBindWxAppIdApply toModify = MerchantConvert.convertBrandBindWxAppIdApply(apply, event.getState(),
event.getFailMessage());
brandBindWxAppIdApplyRpService.updateById(toModify);
}
private void doOpenMerchantSuccess(MerchantEvent event) {
BrandMerchantApply apply = brandMerchantApplyRpService.getByIdForUpdate(
Long.parseLong(event.getApplyNo())).orElseThrow(() -> new BizException(FinanceErrorEnums.NOT_EXIST));
......
package com.jiejing.fitness.finance.service.rpc;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.jiejing.common.model.JsonResult;
import com.jiejing.paycenter.api.merchant.MerchantApi;
import com.jiejing.paycenter.api.merchant.MerchantQueryApi;
import com.jiejing.paycenter.api.merchant.request.ApplyMerchantRequest;
import com.jiejing.paycenter.api.merchant.request.ConfigSubChannelRequest;
import com.jiejing.paycenter.api.merchant.request.GetMerchantByIdRequest;
import com.jiejing.paycenter.api.merchant.request.UploadRequest;
import com.jiejing.paycenter.api.merchant.vo.ApplyMerchantResultVO;
import com.jiejing.paycenter.api.merchant.vo.ConfigSubChannelVO;
import com.jiejing.paycenter.api.merchant.vo.MerchantVO;
import com.jiejing.paycenter.api.merchant.vo.UploadVO;
import com.jiejing.paycenter.common.enums.common.OpenStateEnums;
import com.jiejing.paycenter.common.enums.merchant.SubChannelConfigTypeEnums;
import com.jiejing.paycenter.common.enums.merchant.SubChannelEnums;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
......@@ -45,4 +51,21 @@ public class MerchantRpcService {
result.assertSuccess();
return result.getResult();
}
public ConfigSubChannelVO bindAppIdWxXcxOffline(String channelNo, String applyNo, Long merchantId,
String appId) {
JsonResult<ConfigSubChannelVO> result = merchantApi.configSubChannel(ConfigSubChannelRequest.builder()
.applyNo(applyNo)
.appId(appId)
.merchantId(merchantId)
.channelNo(channelNo)
.subChannel(SubChannelEnums.WX)
.configType(SubChannelConfigTypeEnums.WX_XCX_OFFLINE)
.build());
if (!result.getSuccess()) {
return ConfigSubChannelVO.builder().state(OpenStateEnums.FAIL).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