Commit 7f2eb0c8 by 程裕兵

feat:auth

parent 38f8acf6
...@@ -2,12 +2,14 @@ package com.jiejing.fitness.finance.api.merchant; ...@@ -2,12 +2,14 @@ package com.jiejing.fitness.finance.api.merchant;
import com.jiejing.common.model.JsonResult; import com.jiejing.common.model.JsonResult;
import com.jiejing.common.model.PageVO; import com.jiejing.common.model.PageVO;
import com.jiejing.fitness.finance.api.merchant.request.ApplyBrandMerchantRequest; import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantApplyRequest;
import com.jiejing.fitness.finance.api.merchant.request.BindBrandMerchantXcxAppIdRequest; import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantAuthSubChannelRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantApplyRequest; import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantBindXcxAppIdRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantRequest; import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantGetApplyRequest;
import com.jiejing.fitness.finance.api.merchant.request.PageBrandMerchantApplyRequest; import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantGetRequest;
import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantPageApplyRequest;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO; import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantAuthSubChannelVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantBindXcxAppIdVO; import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantBindXcxAppIdVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO; import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -27,26 +29,30 @@ public interface BrandMerchantApi { ...@@ -27,26 +29,30 @@ public interface BrandMerchantApi {
@ApiOperation(value = "品牌入驻商户", tags = {TAG}) @ApiOperation(value = "品牌入驻商户", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/apply") @PostMapping(value = "/private/brandMerchant/apply")
JsonResult<Void> apply(ApplyBrandMerchantRequest request); JsonResult<Void> apply(BrandMerchantApplyRequest request);
@ApiOperation(value = "查询品牌当前绑定的商户", tags = {TAG}) @ApiOperation(value = "查询品牌当前绑定的商户", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/get") @PostMapping(value = "/private/brandMerchant/get")
JsonResult<BrandMerchantVO> get(GetBrandMerchantRequest request); JsonResult<BrandMerchantVO> get(BrandMerchantGetRequest request);
@ApiOperation(value = "查询品牌进件申请记录", tags = {TAG}) @ApiOperation(value = "查询品牌进件申请记录", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/getApply") @PostMapping(value = "/private/brandMerchant/getApply")
JsonResult<BrandMerchantApplyVO> getApply(GetBrandMerchantApplyRequest request); JsonResult<BrandMerchantApplyVO> getApply(BrandMerchantGetApplyRequest request);
@ApiOperation(value = "分页查询品牌进件申请记录", tags = {TAG}) @ApiOperation(value = "分页查询品牌进件申请记录", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/pageApply") @PostMapping(value = "/private/brandMerchant/pageApply")
JsonResult<PageVO<BrandMerchantApplyVO>> pageApply(PageBrandMerchantApplyRequest request); JsonResult<PageVO<BrandMerchantApplyVO>> pageApply(BrandMerchantPageApplyRequest request);
@ApiOperation(value = "绑定微信小程序appId", tags = {TAG}) @ApiOperation(value = "绑定微信小程序appId", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/bindXcxAppId") @PostMapping(value = "/private/brandMerchant/bindXcxAppId")
JsonResult<BrandMerchantBindXcxAppIdVO> bindXcxAppId(BindBrandMerchantXcxAppIdRequest request); JsonResult<BrandMerchantBindXcxAppIdVO> bindXcxAppId(BrandMerchantBindXcxAppIdRequest request);
@ApiOperation(value = "校验微信小程序appId绑定结果", tags = {TAG}) @ApiOperation(value = "校验微信小程序appId绑定结果", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/checkBindXcxAppId") @PostMapping(value = "/private/brandMerchant/checkBindXcxAppId")
JsonResult<BrandMerchantBindXcxAppIdVO> checkBindXcxAppId(BindBrandMerchantXcxAppIdRequest request); JsonResult<BrandMerchantBindXcxAppIdVO> checkBindXcxAppId(BrandMerchantBindXcxAppIdRequest request);
@ApiOperation(value = "授权子渠道", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/authSubChannel")
JsonResult<BrandMerchantAuthSubChannelVO> authSubChannel(BrandMerchantAuthSubChannelRequest request);
} }
...@@ -2,12 +2,14 @@ package com.jiejing.fitness.finance.api.merchant; ...@@ -2,12 +2,14 @@ package com.jiejing.fitness.finance.api.merchant;
import com.jiejing.common.model.JsonResult; import com.jiejing.common.model.JsonResult;
import com.jiejing.common.model.PageVO; import com.jiejing.common.model.PageVO;
import com.jiejing.fitness.finance.api.merchant.request.ApplyBrandMerchantRequest; import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantApplyRequest;
import com.jiejing.fitness.finance.api.merchant.request.BindBrandMerchantXcxAppIdRequest; import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantAuthSubChannelRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantApplyRequest; import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantBindXcxAppIdRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantRequest; import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantGetApplyRequest;
import com.jiejing.fitness.finance.api.merchant.request.PageBrandMerchantApplyRequest; import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantGetRequest;
import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantPageApplyRequest;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO; import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantAuthSubChannelVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantBindXcxAppIdVO; import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantBindXcxAppIdVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO; import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO;
import feign.hystrix.FallbackFactory; import feign.hystrix.FallbackFactory;
...@@ -24,33 +26,39 @@ public class BrandMerchantApiFallback implements FallbackFactory<BrandMerchantAp ...@@ -24,33 +26,39 @@ public class BrandMerchantApiFallback implements FallbackFactory<BrandMerchantAp
public BrandMerchantApi create(Throwable throwable) { public BrandMerchantApi create(Throwable throwable) {
return new BrandMerchantApi() { return new BrandMerchantApi() {
@Override @Override
public JsonResult<Void> apply(ApplyBrandMerchantRequest request) { public JsonResult<Void> apply(BrandMerchantApplyRequest request) {
return JsonResult.rpcError(); return JsonResult.rpcError();
} }
@Override @Override
public JsonResult<BrandMerchantVO> get(GetBrandMerchantRequest request) { public JsonResult<BrandMerchantVO> get(BrandMerchantGetRequest request) {
return JsonResult.rpcError(); return JsonResult.rpcError();
} }
@Override @Override
public JsonResult<BrandMerchantApplyVO> getApply(GetBrandMerchantApplyRequest request) { public JsonResult<BrandMerchantApplyVO> getApply(BrandMerchantGetApplyRequest request) {
return JsonResult.rpcError(); return JsonResult.rpcError();
} }
@Override @Override
public JsonResult<PageVO<BrandMerchantApplyVO>> pageApply(PageBrandMerchantApplyRequest request) { public JsonResult<PageVO<BrandMerchantApplyVO>> pageApply(BrandMerchantPageApplyRequest request) {
return JsonResult.rpcError(); return JsonResult.rpcError();
} }
@Override @Override
public JsonResult<BrandMerchantBindXcxAppIdVO> bindXcxAppId(BindBrandMerchantXcxAppIdRequest request) { public JsonResult<BrandMerchantBindXcxAppIdVO> bindXcxAppId(BrandMerchantBindXcxAppIdRequest request) {
return JsonResult.rpcError(); return JsonResult.rpcError();
} }
@Override @Override
public JsonResult<BrandMerchantBindXcxAppIdVO> checkBindXcxAppId( public JsonResult<BrandMerchantBindXcxAppIdVO> checkBindXcxAppId(
BindBrandMerchantXcxAppIdRequest request) { BrandMerchantBindXcxAppIdRequest request) {
return JsonResult.rpcError();
}
@Override
public JsonResult<BrandMerchantAuthSubChannelVO> authSubChannel(
BrandMerchantAuthSubChannelRequest request) {
return JsonResult.rpcError(); return JsonResult.rpcError();
} }
}; };
......
...@@ -27,7 +27,7 @@ import lombok.NoArgsConstructor; ...@@ -27,7 +27,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@ApiModel(description = "申请品牌商户请求信息") @ApiModel(description = "申请品牌商户请求信息")
public class ApplyBrandMerchantRequest { public class BrandMerchantApplyRequest {
@ApiModelProperty(value = "场馆ID", required = true) @ApiModelProperty(value = "场馆ID", required = true)
@NotNull(message = "场馆ID不能为空") @NotNull(message = "场馆ID不能为空")
......
package com.jiejing.fitness.finance.api.merchant.request;
import com.jiejing.paycenter.common.enums.merchant.SubChannelAuthTypeEnums;
import com.jiejing.paycenter.common.enums.merchant.SubChannelEnums;
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 = "品牌商户授权子渠道")
public class BrandMerchantAuthSubChannelRequest {
@ApiModelProperty(value = "品牌ID", required = true)
@NotNull(message = "品牌ID不能为空")
private Long brandId;
@ApiModelProperty(value = "子渠道", required = true)
@NotNull(message = "子渠道不能为空")
private SubChannelEnums subChannel;
@ApiModelProperty(value = "子渠道认证类型", required = true)
@NotNull(message = "子渠道认证类型不能为空")
private SubChannelAuthTypeEnums authType;
}
...@@ -17,7 +17,7 @@ import lombok.NoArgsConstructor; ...@@ -17,7 +17,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@ApiModel(description = "品牌商户绑定小程序appId") @ApiModel(description = "品牌商户绑定小程序appId")
public class BindBrandMerchantXcxAppIdRequest { public class BrandMerchantBindXcxAppIdRequest {
@ApiModelProperty(value = "品牌ID", required = true) @ApiModelProperty(value = "品牌ID", required = true)
@NotNull(message = "品牌ID不能为空") @NotNull(message = "品牌ID不能为空")
......
...@@ -19,7 +19,7 @@ import lombok.NoArgsConstructor; ...@@ -19,7 +19,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@ApiModel(description = "申请品牌商户记录请求信息") @ApiModel(description = "申请品牌商户记录请求信息")
public class GetBrandMerchantApplyRequest { public class BrandMerchantGetApplyRequest {
@ApiModelProperty(value = "申请ID", required = true) @ApiModelProperty(value = "申请ID", required = true)
@NotNull(message = "申请ID不能为空") @NotNull(message = "申请ID不能为空")
......
...@@ -19,7 +19,7 @@ import lombok.NoArgsConstructor; ...@@ -19,7 +19,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@ApiModel(description = "申请品牌商户请求信息") @ApiModel(description = "申请品牌商户请求信息")
public class GetBrandMerchantRequest { public class BrandMerchantGetRequest {
@ApiModelProperty(value = "品牌ID", required = true) @ApiModelProperty(value = "品牌ID", required = true)
@NotNull(message = "品牌ID不能为空") @NotNull(message = "品牌ID不能为空")
......
...@@ -20,7 +20,7 @@ import lombok.NoArgsConstructor; ...@@ -20,7 +20,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@ApiModel(description = "分页查询申请品牌商户请求信息Request") @ApiModel(description = "分页查询申请品牌商户请求信息Request")
public class PageBrandMerchantApplyRequest { public class BrandMerchantPageApplyRequest {
@ApiModelProperty(value = "商户简称") @ApiModelProperty(value = "商户简称")
private String shortName; private String shortName;
......
package com.jiejing.fitness.finance.api.merchant.vo;
import com.jiejing.paycenter.common.enums.common.OpenStateEnums;
import com.jiejing.paycenter.common.enums.merchant.AuthPhaseEnums;
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 = "品牌商户认证子渠道VO")
public class BrandMerchantAuthSubChannelVO {
@ApiModelProperty(value = "申请单")
private String applyNo;
@ApiModelProperty(value = "授权状态")
private OpenStateEnums state;
@ApiModelProperty(value = "认证阶段")
private AuthPhaseEnums authPhase;
@ApiModelProperty(value = "授权二维码")
private String authQrCode;
@ApiModelProperty(value = "失败原因")
private String failMessage;
}
...@@ -4,12 +4,14 @@ import com.jiejing.common.model.JsonResult; ...@@ -4,12 +4,14 @@ import com.jiejing.common.model.JsonResult;
import com.jiejing.common.model.PageVO; import com.jiejing.common.model.PageVO;
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.BrandMerchantApplyRequest;
import com.jiejing.fitness.finance.api.merchant.request.BindBrandMerchantXcxAppIdRequest; import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantAuthSubChannelRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantApplyRequest; import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantBindXcxAppIdRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantRequest; import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantGetApplyRequest;
import com.jiejing.fitness.finance.api.merchant.request.PageBrandMerchantApplyRequest; import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantGetRequest;
import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantPageApplyRequest;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO; import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantAuthSubChannelVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantBindXcxAppIdVO; import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantBindXcxAppIdVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO; 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;
...@@ -35,7 +37,7 @@ public class BrandMerchantController implements BrandMerchantApi { ...@@ -35,7 +37,7 @@ public class BrandMerchantController implements BrandMerchantApi {
@ApiOperation(value = "品牌入驻商户", tags = {TAG}) @ApiOperation(value = "品牌入驻商户", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/apply") @PostMapping(value = "/private/brandMerchant/apply")
@Override @Override
public JsonResult<Void> apply(@RequestBody @Valid ApplyBrandMerchantRequest request) { public JsonResult<Void> apply(@RequestBody @Valid BrandMerchantApplyRequest request) {
ApplyBrandMerchantParams params = BeanUtil.map(request, ApplyBrandMerchantParams.class); ApplyBrandMerchantParams params = BeanUtil.map(request, ApplyBrandMerchantParams.class);
brandMerchantService.apply(params); brandMerchantService.apply(params);
return JsonResult.success(); return JsonResult.success();
...@@ -44,14 +46,14 @@ public class BrandMerchantController implements BrandMerchantApi { ...@@ -44,14 +46,14 @@ public class BrandMerchantController implements BrandMerchantApi {
@ApiOperation(value = "查询品牌当前绑定的商户", tags = {TAG}) @ApiOperation(value = "查询品牌当前绑定的商户", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/get") @PostMapping(value = "/private/brandMerchant/get")
@Override @Override
public JsonResult<BrandMerchantVO> get(@RequestBody @Valid GetBrandMerchantRequest request) { public JsonResult<BrandMerchantVO> get(@RequestBody @Valid BrandMerchantGetRequest request) {
return JsonResult.success(brandMerchantService.getMerchant(request.getBrandId())); return JsonResult.success(brandMerchantService.getMerchant(request.getBrandId()));
} }
@ApiOperation(value = "查询品牌进件申请记录", tags = {TAG}) @ApiOperation(value = "查询品牌进件申请记录", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/getApply") @PostMapping(value = "/private/brandMerchant/getApply")
@Override @Override
public JsonResult<BrandMerchantApplyVO> getApply(@RequestBody @Valid GetBrandMerchantApplyRequest request) { public JsonResult<BrandMerchantApplyVO> getApply(@RequestBody @Valid BrandMerchantGetApplyRequest request) {
return JsonResult.success(brandMerchantService.getApply(request.getId())); return JsonResult.success(brandMerchantService.getApply(request.getId()));
} }
...@@ -59,7 +61,7 @@ public class BrandMerchantController implements BrandMerchantApi { ...@@ -59,7 +61,7 @@ public class BrandMerchantController implements BrandMerchantApi {
@PostMapping(value = "/private/brandMerchant/pageApply") @PostMapping(value = "/private/brandMerchant/pageApply")
@Override @Override
public JsonResult<PageVO<BrandMerchantApplyVO>> pageApply( public JsonResult<PageVO<BrandMerchantApplyVO>> pageApply(
@RequestBody @Valid PageBrandMerchantApplyRequest request) { @RequestBody @Valid BrandMerchantPageApplyRequest request) {
PageBrandMerchantApplyParams params = BeanUtil.map(request, PageBrandMerchantApplyParams.class); PageBrandMerchantApplyParams params = BeanUtil.map(request, PageBrandMerchantApplyParams.class);
return JsonResult.success(brandMerchantService.pageApply(params)); return JsonResult.success(brandMerchantService.pageApply(params));
} }
...@@ -68,7 +70,7 @@ public class BrandMerchantController implements BrandMerchantApi { ...@@ -68,7 +70,7 @@ public class BrandMerchantController implements BrandMerchantApi {
@PostMapping(value = "/private/brandMerchant/bindXcxAppId") @PostMapping(value = "/private/brandMerchant/bindXcxAppId")
@Override @Override
public JsonResult<BrandMerchantBindXcxAppIdVO> bindXcxAppId( public JsonResult<BrandMerchantBindXcxAppIdVO> bindXcxAppId(
@RequestBody @Valid BindBrandMerchantXcxAppIdRequest request) { @RequestBody @Valid BrandMerchantBindXcxAppIdRequest request) {
return JsonResult.success(brandMerchantService.bindXcxAppId(request.getBrandId(), request.getAppId())); return JsonResult.success(brandMerchantService.bindXcxAppId(request.getBrandId(), request.getAppId()));
} }
...@@ -76,9 +78,19 @@ public class BrandMerchantController implements BrandMerchantApi { ...@@ -76,9 +78,19 @@ public class BrandMerchantController implements BrandMerchantApi {
@PostMapping(value = "/private/brandMerchant/checkBindXcxAppId") @PostMapping(value = "/private/brandMerchant/checkBindXcxAppId")
@Override @Override
public JsonResult<BrandMerchantBindXcxAppIdVO> checkBindXcxAppId( public JsonResult<BrandMerchantBindXcxAppIdVO> checkBindXcxAppId(
@RequestBody @Valid BindBrandMerchantXcxAppIdRequest request) { @RequestBody @Valid BrandMerchantBindXcxAppIdRequest request) {
return JsonResult.success( return JsonResult.success(
brandMerchantService.checkBindXcxAppId(request.getBrandId(), request.getAppId())); brandMerchantService.checkBindXcxAppId(request.getBrandId(), request.getAppId()));
} }
@ApiOperation(value = "授权子渠道", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/authSubChannel")
@Override
public JsonResult<BrandMerchantAuthSubChannelVO> authSubChannel(
@RequestBody @Valid BrandMerchantAuthSubChannelRequest request) {
return JsonResult.success(
brandMerchantService.authSubChannel(request.getBrandId(), request.getSubChannel(),
request.getAuthType()));
}
} }
...@@ -2,10 +2,13 @@ package com.jiejing.fitness.finance.service.merchant; ...@@ -2,10 +2,13 @@ package com.jiejing.fitness.finance.service.merchant;
import com.jiejing.common.model.PageVO; import com.jiejing.common.model.PageVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO; import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantAuthSubChannelVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantBindXcxAppIdVO; import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantBindXcxAppIdVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO; 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.fitness.finance.service.merchant.params.PageBrandMerchantApplyParams;
import com.jiejing.paycenter.common.enums.merchant.SubChannelAuthTypeEnums;
import com.jiejing.paycenter.common.enums.merchant.SubChannelEnums;
import com.jiejing.paycenter.common.event.MerchantEvent; import com.jiejing.paycenter.common.event.MerchantEvent;
import com.jiejing.paycenter.common.event.MerchantSubChannelConfigEvent; import com.jiejing.paycenter.common.event.MerchantSubChannelConfigEvent;
...@@ -80,4 +83,15 @@ public interface BrandMerchantService { ...@@ -80,4 +83,15 @@ public interface BrandMerchantService {
*/ */
void bindXcxAppIdCallback(MerchantSubChannelConfigEvent event); void bindXcxAppIdCallback(MerchantSubChannelConfigEvent event);
/**
* 授权子渠道
*
* @param brandId 品牌ID
* @param subChannel 子渠道
* @param authType 授权类型
* @return 结果
*/
BrandMerchantAuthSubChannelVO authSubChannel(Long brandId, SubChannelEnums subChannel,
SubChannelAuthTypeEnums authType);
} }
...@@ -8,6 +8,7 @@ import com.jiejing.common.model.PageVO; ...@@ -8,6 +8,7 @@ import com.jiejing.common.model.PageVO;
import com.jiejing.common.utils.convert.BeanUtil; import com.jiejing.common.utils.convert.BeanUtil;
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.BrandMerchantApplyVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantAuthSubChannelVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantBindXcxAppIdVO; import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantBindXcxAppIdVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO; import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO;
import com.jiejing.fitness.finance.repository.entity.BrandBindWxAppIdApply; import com.jiejing.fitness.finance.repository.entity.BrandBindWxAppIdApply;
...@@ -29,10 +30,13 @@ import com.jiejing.fitness.finance.service.rpc.MerchantRpcService; ...@@ -29,10 +30,13 @@ 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.AuthSubChannelVO;
import com.jiejing.paycenter.api.merchant.vo.ConfigSubChannelVO; import com.jiejing.paycenter.api.merchant.vo.ConfigSubChannelVO;
import com.jiejing.paycenter.api.merchant.vo.MerchantVO; 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.enums.merchant.SubChannelAuthTypeEnums;
import com.jiejing.paycenter.common.enums.merchant.SubChannelEnums;
import com.jiejing.paycenter.common.event.MerchantEvent; import com.jiejing.paycenter.common.event.MerchantEvent;
import com.jiejing.paycenter.common.event.MerchantSubChannelConfigEvent; import com.jiejing.paycenter.common.event.MerchantSubChannelConfigEvent;
import com.jiejing.paycenter.common.model.ResourceInfo; import com.jiejing.paycenter.common.model.ResourceInfo;
...@@ -199,6 +203,16 @@ public class BrandMerchantServiceImpl implements BrandMerchantService { ...@@ -199,6 +203,16 @@ public class BrandMerchantServiceImpl implements BrandMerchantService {
brandBindWxAppIdApplyRpService.updateById(toModify); brandBindWxAppIdApplyRpService.updateById(toModify);
} }
@Override
public BrandMerchantAuthSubChannelVO authSubChannel(Long brandId, SubChannelEnums subChannel,
SubChannelAuthTypeEnums authType) {
BrandToMerchant relation = brandToMerchantRpService.getByBrandId(brandId);
AuthSubChannelVO vo = merchantRpcService.authSubChannel(channel, relation.getMerchantId(), subChannel,
authType);
return BeanUtil.map(vo, BrandMerchantAuthSubChannelVO.class);
}
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));
......
...@@ -5,14 +5,18 @@ import com.jiejing.common.model.JsonResult; ...@@ -5,14 +5,18 @@ 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.MerchantQueryApi;
import com.jiejing.paycenter.api.merchant.request.ApplyMerchantRequest; import com.jiejing.paycenter.api.merchant.request.ApplyMerchantRequest;
import com.jiejing.paycenter.api.merchant.request.AuthSubChannelRequest;
import com.jiejing.paycenter.api.merchant.request.ConfigSubChannelRequest; import com.jiejing.paycenter.api.merchant.request.ConfigSubChannelRequest;
import com.jiejing.paycenter.api.merchant.request.GetMerchantByIdRequest; 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.AuthSubChannelVO;
import com.jiejing.paycenter.api.merchant.vo.ConfigSubChannelVO; import com.jiejing.paycenter.api.merchant.vo.ConfigSubChannelVO;
import com.jiejing.paycenter.api.merchant.vo.MerchantVO; 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 com.jiejing.paycenter.common.enums.common.OpenStateEnums; import com.jiejing.paycenter.common.enums.common.OpenStateEnums;
import com.jiejing.paycenter.common.enums.merchant.AuthPhaseEnums;
import com.jiejing.paycenter.common.enums.merchant.SubChannelAuthTypeEnums;
import com.jiejing.paycenter.common.enums.merchant.SubChannelConfigTypeEnums; import com.jiejing.paycenter.common.enums.merchant.SubChannelConfigTypeEnums;
import com.jiejing.paycenter.common.enums.merchant.SubChannelEnums; import com.jiejing.paycenter.common.enums.merchant.SubChannelEnums;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -68,4 +72,20 @@ public class MerchantRpcService { ...@@ -68,4 +72,20 @@ public class MerchantRpcService {
return result.getResult(); return result.getResult();
} }
public AuthSubChannelVO authSubChannel(String channel, Long merchantId, SubChannelEnums subChannel,
SubChannelAuthTypeEnums authType) {
JsonResult<AuthSubChannelVO> result = merchantApi.authSubChannel(AuthSubChannelRequest.builder()
.channelNo(channel)
.merchantId(merchantId)
.subChannel(subChannel)
.authType(authType)
.build());
if (!result.getSuccess()) {
return AuthSubChannelVO.builder()
.state(OpenStateEnums.FAIL)
.authPhase(AuthPhaseEnums.APPLY_COMMIT_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