Commit 48429446 by 程裕兵

feat:get merchant

parent a1671aca
...@@ -2,6 +2,8 @@ package com.jiejing.fitness.finance.api.merchant; ...@@ -2,6 +2,8 @@ package com.jiejing.fitness.finance.api.merchant;
import com.jiejing.common.model.JsonResult; import com.jiejing.common.model.JsonResult;
import com.jiejing.fitness.finance.api.merchant.request.ApplyBrandMerchantRequest; import com.jiejing.fitness.finance.api.merchant.request.ApplyBrandMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -21,4 +23,8 @@ public interface BrandMerchantApi { ...@@ -21,4 +23,8 @@ public interface BrandMerchantApi {
@PostMapping(value = "/private/brandMerchant/apply") @PostMapping(value = "/private/brandMerchant/apply")
JsonResult<Void> apply(ApplyBrandMerchantRequest request); JsonResult<Void> apply(ApplyBrandMerchantRequest request);
@ApiOperation(value = "查询品牌当前绑定的商户", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/get")
JsonResult<BrandMerchantVO> get(GetBrandMerchantRequest request);
} }
...@@ -2,6 +2,8 @@ package com.jiejing.fitness.finance.api.merchant; ...@@ -2,6 +2,8 @@ package com.jiejing.fitness.finance.api.merchant;
import com.jiejing.common.model.JsonResult; import com.jiejing.common.model.JsonResult;
import com.jiejing.fitness.finance.api.merchant.request.ApplyBrandMerchantRequest; import com.jiejing.fitness.finance.api.merchant.request.ApplyBrandMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO;
import feign.hystrix.FallbackFactory; import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -19,6 +21,11 @@ public class BrandMerchantApiFallback implements FallbackFactory<BrandMerchantAp ...@@ -19,6 +21,11 @@ public class BrandMerchantApiFallback implements FallbackFactory<BrandMerchantAp
public JsonResult<Void> apply(ApplyBrandMerchantRequest request) { public JsonResult<Void> apply(ApplyBrandMerchantRequest request) {
return JsonResult.rpcError(); return JsonResult.rpcError();
} }
@Override
public JsonResult<BrandMerchantVO> get(GetBrandMerchantRequest 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/20 14:03
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "申请品牌商户请求信息")
public class GetBrandMerchantRequest {
@ApiModelProperty(value = "品牌ID", required = true)
@NotNull(message = "品牌ID不能为空")
private Long brandId;
}
...@@ -45,13 +45,6 @@ public class BrandMerchantVO { ...@@ -45,13 +45,6 @@ public class BrandMerchantVO {
@ApiModelProperty("企业类型") @ApiModelProperty("企业类型")
private CompanyTypeEnums companyType; private CompanyTypeEnums companyType;
@ApiModelProperty("开通状态:I-初始态;P-处理中;S-成功;F-失败 默认值: I")
private OpenStateEnums openState;
@ApiModelProperty("开通失败原因")
private String openFailMessage;
@ApiModelProperty("支付宝开通状态:I-初始态;S-成功;F-失败 默认值: I") @ApiModelProperty("支付宝开通状态:I-初始态;S-成功;F-失败 默认值: I")
private OpenStateEnums aliOpenState; private OpenStateEnums aliOpenState;
......
...@@ -4,6 +4,8 @@ import com.jiejing.common.model.JsonResult; ...@@ -4,6 +4,8 @@ import com.jiejing.common.model.JsonResult;
import com.jiejing.common.utils.convert.BeanUtil; import com.jiejing.common.utils.convert.BeanUtil;
import com.jiejing.fitness.finance.api.merchant.BrandMerchantApi; 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.ApplyBrandMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO;
import com.jiejing.fitness.finance.service.merchant.BrandMerchantService; import com.jiejing.fitness.finance.service.merchant.BrandMerchantService;
import com.jiejing.fitness.finance.service.merchant.params.ApplyBrandMerchantParams; import com.jiejing.fitness.finance.service.merchant.params.ApplyBrandMerchantParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -31,4 +33,12 @@ public class BrandMerchantController implements BrandMerchantApi { ...@@ -31,4 +33,12 @@ public class BrandMerchantController implements BrandMerchantApi {
brandMerchantService.apply(params); brandMerchantService.apply(params);
return JsonResult.success(); return JsonResult.success();
} }
@ApiOperation(value = "查询品牌当前绑定的商户", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/get")
@Override
public JsonResult<BrandMerchantVO> get(@RequestBody @Valid GetBrandMerchantRequest request) {
return JsonResult.success(brandMerchantService.getMerchant(request.getBrandId()));
}
} }
package com.jiejing.fitness.finance.service.merchant; 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.BrandMerchantVO;
import com.jiejing.fitness.finance.service.merchant.params.ApplyBrandMerchantParams; 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.MerchantEvent;
/** /**
...@@ -25,4 +29,21 @@ public interface BrandMerchantService { ...@@ -25,4 +29,21 @@ public interface BrandMerchantService {
*/ */
void callback(MerchantEvent event); void callback(MerchantEvent event);
/**
* 获取品牌当前绑定的商户信息
*
* @param brandId 品牌ID
* @return 商户
*/
BrandMerchantVO getMerchant(Long brandId);
/**
* 分页查询品牌商户申请记录
*
* @param params 请求
* @return 响应
*/
PageVO<BrandMerchantApplyVO> pageApply(PageBrandMerchantApplyParams params);
} }
...@@ -15,12 +15,14 @@ import com.jiejing.fitness.finance.api.merchant.model.BrandBankCardInfo; ...@@ -15,12 +15,14 @@ import com.jiejing.fitness.finance.api.merchant.model.BrandBankCardInfo;
import com.jiejing.fitness.finance.api.merchant.model.BrandLegalInfo; 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.BrandLicenseInfo;
import com.jiejing.fitness.finance.api.merchant.model.BrandResourceInfo; import com.jiejing.fitness.finance.api.merchant.model.BrandResourceInfo;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO;
import com.jiejing.fitness.finance.repository.entity.BrandMerchantApply; import com.jiejing.fitness.finance.repository.entity.BrandMerchantApply;
import com.jiejing.fitness.finance.repository.entity.BrandToMerchant; import com.jiejing.fitness.finance.repository.entity.BrandToMerchant;
import com.jiejing.fitness.finance.service.merchant.params.ApplyBrandMerchantParams; import com.jiejing.fitness.finance.service.merchant.params.ApplyBrandMerchantParams;
import com.jiejing.paycenter.api.merchant.request.ApplyMerchantRequest; import com.jiejing.paycenter.api.merchant.request.ApplyMerchantRequest;
import com.jiejing.paycenter.api.merchant.request.OpenSingleSubChannelRequest; import com.jiejing.paycenter.api.merchant.request.OpenSingleSubChannelRequest;
import com.jiejing.paycenter.api.merchant.request.UploadRequest; import com.jiejing.paycenter.api.merchant.request.UploadRequest;
import com.jiejing.paycenter.api.merchant.vo.MerchantVO;
import com.jiejing.paycenter.common.enums.common.OpenStateEnums; import com.jiejing.paycenter.common.enums.common.OpenStateEnums;
import com.jiejing.paycenter.common.enums.merchant.BusinessTypeEnums; import com.jiejing.paycenter.common.enums.merchant.BusinessTypeEnums;
import com.jiejing.paycenter.common.enums.merchant.LicenseTypeEnums; import com.jiejing.paycenter.common.enums.merchant.LicenseTypeEnums;
...@@ -255,18 +257,42 @@ public class MerchantConvert { ...@@ -255,18 +257,42 @@ public class MerchantConvert {
.build(); .build();
} }
private static BrandLicenseInfo convertLicense(MerchantEvent event) { private static BrandLicenseInfo convertLicense(License license) {
return JSON.parseObject(JSON.toJSONString(event.getLicense()), BrandLicenseInfo.class); return JSON.parseObject(JSON.toJSONString(license), BrandLicenseInfo.class);
} }
private static BrandLegalInfo convertLegal(MerchantEvent event) { private static BrandLegalInfo convertLegal(Legal legal, Contact contact) {
BrandLegalInfo legal = JSON.parseObject(JSON.toJSONString(event.getLegal()), BrandLegalInfo.class); BrandLegalInfo legalInfo = JSON.parseObject(JSON.toJSONString(legal), BrandLegalInfo.class);
legal.setLegalEmail(event.getContact().getContactEmail()); legalInfo.setLegalEmail(contact.getContactEmail());
return legal; return legalInfo;
} }
private static BrandBankCardInfo convertBankCard(MerchantEvent event) { private static BrandBankCardInfo convertBankCard(BankCard bankCard) {
return JSON.parseObject(JSON.toJSONString(event.getBankCard()), BrandBankCardInfo.class); return JSON.parseObject(JSON.toJSONString(bankCard), BrandBankCardInfo.class);
}
private static BrandResourceInfo convertResource(Map<ResourceTypeEnums, ResourceInfo> resourceMap) {
BrandResourceInfo resourceInfo = new BrandResourceInfo();
resourceInfo.setLicensePicId(resourceMap.getOrDefault(LICENSE, new ResourceInfo()).getResourceId());
resourceInfo.setStoreHeaderPicId(
resourceMap.getOrDefault(STORE_HEADER_PIC, new ResourceInfo()).getResourceId());
resourceInfo.setStoreInnerPicId(
resourceMap.getOrDefault(STORE_INNER_PIC, new ResourceInfo()).getResourceId());
resourceInfo.setStoreCashierDescPicId(
resourceMap.getOrDefault(STORE_CASHIER_DESK_PIC, new ResourceInfo()).getResourceId());
resourceInfo.setLegalCertFrontPicId(
resourceMap.getOrDefault(LEGAL_CERT_FRONT, new ResourceInfo()).getResourceId());
resourceInfo.setLegalCertBackPicId(
resourceMap.getOrDefault(LEGAL_CERT_BACK, new ResourceInfo()).getResourceId());
resourceInfo.setBankCardFrontPicId(
resourceMap.getOrDefault(BANK_CARD_FRONT, new ResourceInfo()).getResourceId());
resourceInfo.setBankCardBackPicId(
resourceMap.getOrDefault(BANK_CARD_BACK, new ResourceInfo()).getResourceId());
resourceInfo.setBankCardCertFrontPicId(
resourceMap.getOrDefault(BANK_CARD_CERT_FRONT, new ResourceInfo()).getResourceId());
resourceInfo.setBankCardCertBackPicId(
resourceMap.getOrDefault(BANK_CARD_CERT_BACK, new ResourceInfo()).getResourceId());
return resourceInfo;
} }
private static OpenStateEnums convertWxOfflineAuthState(List<SubChannelAuthInfo> auths) { private static OpenStateEnums convertWxOfflineAuthState(List<SubChannelAuthInfo> auths) {
...@@ -402,4 +428,34 @@ public class MerchantConvert { ...@@ -402,4 +428,34 @@ public class MerchantConvert {
private static ResourceInfo convert(Long id, ResourceTypeEnums type) { private static ResourceInfo convert(Long id, ResourceTypeEnums type) {
return ResourceInfo.builder().resourceId(id).type(type).build(); return ResourceInfo.builder().resourceId(id).type(type).build();
} }
public static BrandMerchantVO convertBrandMerchant(BrandToMerchant relation, MerchantVO merchant) {
Map<PaySceneEnums, SubChannelInfo> channelMap = convertSubChannelMap(merchant.getSubChannels());
SubChannelInfo ali = channelMap.get(PaySceneEnums.ALI_OFFLINE);
SubChannelInfo wxGzhOffline = channelMap.get(PaySceneEnums.WX_GZH_OFFLINE);
OpenStateEnums wxOfflineState = convertWxOfflineState(channelMap);
String wxOfflineFailMessage = convertWxOfflineFailMessage(channelMap);
return BrandMerchantVO.builder()
.brandId(relation.getBrandId())
.channelNo(merchant.getChannelNo())
.merchantId(merchant.getId())
.merchantNo(merchant.getMerchantNo())
.merchantName(merchant.getMerchantName())
.shortName(merchant.getShortName())
.companyType(merchant.getCompanyType())
.aliOpenState(ali.getOpenState())
.aliAuthState(convertAliAuthState(merchant.getSubChannelAuths()))
.aliMerchantNo(JSON.toJSONString(ali.getSubMerchantNos()))
.aliOpenFailMessage(ali.getFailMessage())
.wxOfflineOpenState(wxOfflineState)
.wxOfflineMerchantNo(JSON.toJSONString(wxGzhOffline.getSubMerchantNos()))
.wxOfflineAuthState(convertWxOfflineAuthState(merchant.getSubChannelAuths()))
.wxOfflineOpenFailMessage(wxOfflineFailMessage)
.license(convertLicense(merchant.getLicense()))
.legal(convertLegal(merchant.getLegal(), merchant.getContact()))
.bankCard(convertBankCard(merchant.getBankCard()))
.resource(convertResource(merchant.getResourceMap()))
.build();
}
} }
package com.jiejing.fitness.finance.service.merchant.dto;
import com.jiejing.fitness.finance.api.enums.ApplyTypeEnums;
import com.jiejing.fitness.finance.api.merchant.model.BrandBankCardInfo;
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.paycenter.common.enums.common.OpenStateEnums;
import com.jiejing.paycenter.common.enums.merchant.CompanyTypeEnums;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author chengyubing
* @since 2024/2/22 16:22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "品牌商户申请DTO")
public class BrandMerchantApplyDTO {
@ApiModelProperty("ID")
private Long id;
@ApiModelProperty("品牌ID")
private Long brandId;
@ApiModelProperty("场馆ID")
private Long studioId;
@ApiModelProperty("申请单号")
private String applyNo;
@ApiModelProperty("申请类型:OPEN-进件;RE_OPEN-重进件;")
private ApplyTypeEnums applyType;
@ApiModelProperty("渠道号")
private String channelNo;
@ApiModelProperty("商户ID(pay center提供)")
private Long merchantId;
@ApiModelProperty("三方商户号")
private String merchantNo;
@ApiModelProperty("商户名称")
private String merchantName;
@ApiModelProperty("商户简称")
private String shortName;
@ApiModelProperty("企业类型")
private CompanyTypeEnums companyType;
@ApiModelProperty("开通状态:I-初始态;P-处理中;S-成功;F-失败 默认值: I")
private OpenStateEnums openState;
@ApiModelProperty("开通失败原因")
private String openFailMessage;
@ApiModelProperty("支付宝开通状态:I-初始态;S-成功;F-失败 默认值: I")
private OpenStateEnums aliOpenState;
@ApiModelProperty("支付宝认证状态")
private OpenStateEnums aliAuthState;
@ApiModelProperty("支付宝商户号")
private String aliMerchantNo;
@ApiModelProperty("支付宝开通失败原因")
private String aliOpenFailMessage;
@ApiModelProperty("微信线下通道开通状态:I-初始态;S-成功;F-失败 默认值: I")
private OpenStateEnums wxOfflineOpenState;
@ApiModelProperty("微信线下通道认证状态:I-初始态;S-成功;F-失败 默认值: I")
private OpenStateEnums wxOfflineAuthState;
@ApiModelProperty("微信线下通道商户号")
private String wxOfflineMerchantNo;
@ApiModelProperty("微信线下通道开通失败原因")
private String wxOfflineOpenFailMessage;
@ApiModelProperty("微信线上通道开通状态:I-初始态;S-成功;F-失败 默认值: I")
private OpenStateEnums wxOnlineOpenState;
@ApiModelProperty("微信线上通道认证状态:I-初始态;S-成功;F-失败 默认值: I")
private OpenStateEnums wxOnlineAuthState;
@ApiModelProperty("微信线上通道商户号")
private String wxOnlineMerchantNo;
@ApiModelProperty("微信线下通道开通失败原因")
private String wxOnlineOpenFailMessage;
@ApiModelProperty(value = "营业执照")
private BrandLicenseInfo license;
@ApiModelProperty(value = "法人信息")
private BrandLegalInfo legal;
@ApiModelProperty(value = "结算卡信息")
private BrandBankCardInfo bankCard;
@ApiModelProperty(value = "进件所需资料")
private BrandResourceInfo resource;
@ApiModelProperty("完成时间")
private Date finishTime;
@ApiModelProperty("创建时间")
private Date createTime;
@ApiModelProperty("更新时间")
private Date updateTime;
}
package com.jiejing.fitness.finance.service.merchant.dto;
import com.jiejing.fitness.finance.api.merchant.model.BrandBankCardInfo;
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.paycenter.common.enums.common.OpenStateEnums;
import com.jiejing.paycenter.common.enums.merchant.CompanyTypeEnums;
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/22 16:22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "品牌当前绑定的商户信息DTO")
public class BrandMerchantDTO {
@ApiModelProperty("品牌ID")
private Long brandId;
@ApiModelProperty("渠道号")
private String channelNo;
@ApiModelProperty("商户ID(pay center提供)")
private Long merchantId;
@ApiModelProperty("三方商户号")
private String merchantNo;
@ApiModelProperty("商户名称")
private String merchantName;
@ApiModelProperty("商户简称")
private String shortName;
@ApiModelProperty("企业类型")
private CompanyTypeEnums companyType;
@ApiModelProperty("开通状态:I-初始态;P-处理中;S-成功;F-失败 默认值: I")
private OpenStateEnums openState;
@ApiModelProperty("开通失败原因")
private String openFailMessage;
@ApiModelProperty("支付宝开通状态:I-初始态;S-成功;F-失败 默认值: I")
private OpenStateEnums aliOpenState;
@ApiModelProperty("支付宝认证状态")
private OpenStateEnums aliAuthState;
@ApiModelProperty("支付宝商户号")
private String aliMerchantNo;
@ApiModelProperty("支付宝开通失败原因")
private String aliOpenFailMessage;
@ApiModelProperty("微信线下通道开通状态:I-初始态;S-成功;F-失败 默认值: I")
private OpenStateEnums wxOfflineOpenState;
@ApiModelProperty("微信线下通道认证状态:I-初始态;S-成功;F-失败 默认值: I")
private OpenStateEnums wxOfflineAuthState;
@ApiModelProperty("微信线下通道商户号")
private String wxOfflineMerchantNo;
@ApiModelProperty("微信线下通道开通失败原因")
private String wxOfflineOpenFailMessage;
@ApiModelProperty("微信线上通道开通状态:I-初始态;S-成功;F-失败 默认值: I")
private OpenStateEnums wxOnlineOpenState;
@ApiModelProperty("微信线上通道认证状态:I-初始态;S-成功;F-失败 默认值: I")
private OpenStateEnums wxOnlineAuthState;
@ApiModelProperty("微信线上通道商户号")
private String wxOnlineMerchantNo;
@ApiModelProperty("微信线下通道开通失败原因")
private String wxOnlineOpenFailMessage;
@ApiModelProperty(value = "营业执照")
private BrandLicenseInfo license;
@ApiModelProperty(value = "法人信息")
private BrandLegalInfo legal;
@ApiModelProperty(value = "结算卡信息")
private BrandBankCardInfo bankCard;
@ApiModelProperty(value = "进件所需资料")
private BrandResourceInfo resource;
}
...@@ -2,7 +2,10 @@ package com.jiejing.fitness.finance.service.merchant.impl; ...@@ -2,7 +2,10 @@ package com.jiejing.fitness.finance.service.merchant.impl;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.jiejing.common.exception.BizException; import com.jiejing.common.exception.BizException;
import com.jiejing.common.model.PageVO;
import com.jiejing.filecenter.api.resource.vo.ResourceInfoVO; 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.BrandMerchantVO;
import com.jiejing.fitness.finance.repository.entity.BrandMerchantApply; import com.jiejing.fitness.finance.repository.entity.BrandMerchantApply;
import com.jiejing.fitness.finance.repository.entity.BrandToMerchant; import com.jiejing.fitness.finance.repository.entity.BrandToMerchant;
import com.jiejing.fitness.finance.repository.service.BrandMerchantApplyRpService; import com.jiejing.fitness.finance.repository.service.BrandMerchantApplyRpService;
...@@ -11,10 +14,12 @@ import com.jiejing.fitness.finance.service.enums.FinanceErrorEnums; ...@@ -11,10 +14,12 @@ import com.jiejing.fitness.finance.service.enums.FinanceErrorEnums;
import com.jiejing.fitness.finance.service.merchant.BrandMerchantService; import com.jiejing.fitness.finance.service.merchant.BrandMerchantService;
import com.jiejing.fitness.finance.service.merchant.convert.MerchantConvert; import com.jiejing.fitness.finance.service.merchant.convert.MerchantConvert;
import com.jiejing.fitness.finance.service.merchant.params.ApplyBrandMerchantParams; import com.jiejing.fitness.finance.service.merchant.params.ApplyBrandMerchantParams;
import com.jiejing.fitness.finance.service.merchant.params.PageBrandMerchantApplyParams;
import com.jiejing.fitness.finance.service.rpc.MerchantRpcService; import com.jiejing.fitness.finance.service.rpc.MerchantRpcService;
import com.jiejing.fitness.finance.service.rpc.ResourceRpcService; import com.jiejing.fitness.finance.service.rpc.ResourceRpcService;
import com.jiejing.fitness.finance.service.rpc.StudioRpcService; import com.jiejing.fitness.finance.service.rpc.StudioRpcService;
import com.jiejing.paycenter.api.merchant.request.ApplyMerchantRequest; import com.jiejing.paycenter.api.merchant.request.ApplyMerchantRequest;
import com.jiejing.paycenter.api.merchant.vo.MerchantVO;
import com.jiejing.paycenter.common.enums.common.OpenStateEnums; import com.jiejing.paycenter.common.enums.common.OpenStateEnums;
import com.jiejing.paycenter.common.enums.merchant.ResourceTypeEnums; import com.jiejing.paycenter.common.enums.merchant.ResourceTypeEnums;
import com.jiejing.paycenter.common.event.MerchantEvent; import com.jiejing.paycenter.common.event.MerchantEvent;
...@@ -109,6 +114,18 @@ public class BrandMerchantServiceImpl implements BrandMerchantService { ...@@ -109,6 +114,18 @@ public class BrandMerchantServiceImpl implements BrandMerchantService {
} }
} }
@Override
public BrandMerchantVO getMerchant(Long brandId) {
BrandToMerchant relation = brandToMerchantRpService.getByBrandId(brandId);
MerchantVO merchant = merchantRpcService.getByMerchantId(relation.getMerchantId());
return MerchantConvert.convertBrandMerchant(relation, merchant);
}
@Override
public PageVO<BrandMerchantApplyVO> pageApply(PageBrandMerchantApplyParams params) {
return null;
}
private void doOpenMerchantSuccess(MerchantEvent event) { private void doOpenMerchantSuccess(MerchantEvent event) {
BrandMerchantApply apply = brandMerchantApplyRpService.getByIdForUpdate( BrandMerchantApply apply = brandMerchantApplyRpService.getByIdForUpdate(
Long.parseLong(event.getApplyNo())).orElseThrow(() -> new BizException(FinanceErrorEnums.NOT_EXIST)); Long.parseLong(event.getApplyNo())).orElseThrow(() -> new BizException(FinanceErrorEnums.NOT_EXIST));
......
package com.jiejing.fitness.finance.service.merchant.params;
/**
* @author chengyubing
* @since 2024/2/22 16:38
*/
public class PageBrandMerchantApplyParams {
}
...@@ -2,9 +2,12 @@ package com.jiejing.fitness.finance.service.rpc; ...@@ -2,9 +2,12 @@ package com.jiejing.fitness.finance.service.rpc;
import com.jiejing.common.model.JsonResult; import com.jiejing.common.model.JsonResult;
import com.jiejing.paycenter.api.merchant.MerchantApi; 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.ApplyMerchantRequest;
import com.jiejing.paycenter.api.merchant.request.GetMerchantByIdRequest;
import com.jiejing.paycenter.api.merchant.request.UploadRequest; import com.jiejing.paycenter.api.merchant.request.UploadRequest;
import com.jiejing.paycenter.api.merchant.vo.ApplyMerchantResultVO; import com.jiejing.paycenter.api.merchant.vo.ApplyMerchantResultVO;
import com.jiejing.paycenter.api.merchant.vo.MerchantVO;
import com.jiejing.paycenter.api.merchant.vo.UploadVO; import com.jiejing.paycenter.api.merchant.vo.UploadVO;
import javax.annotation.Resource; import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -21,6 +24,9 @@ public class MerchantRpcService { ...@@ -21,6 +24,9 @@ public class MerchantRpcService {
@Resource @Resource
private MerchantApi merchantApi; private MerchantApi merchantApi;
@Resource
private MerchantQueryApi merchantQueryApi;
public String upload(UploadRequest request) { public String upload(UploadRequest request) {
JsonResult<UploadVO> result = merchantApi.upload(request); JsonResult<UploadVO> result = merchantApi.upload(request);
result.assertSuccess(); result.assertSuccess();
...@@ -33,4 +39,10 @@ public class MerchantRpcService { ...@@ -33,4 +39,10 @@ public class MerchantRpcService {
return result.getResult(); return result.getResult();
} }
public MerchantVO getByMerchantId(Long merchantId) {
GetMerchantByIdRequest request = GetMerchantByIdRequest.builder().merchantId(merchantId).build();
JsonResult<MerchantVO> result = merchantQueryApi.getById(request);
result.assertSuccess();
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