Commit 7e334cd7 by 程裕兵

feat:auth sub channel

parent 5addc6ee
......@@ -6,6 +6,7 @@ import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantApplyReques
import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantAuthSubChannelRequest;
import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantBindXcxAppIdRequest;
import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantGetApplyRequest;
import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantGetAuthSubChannelRequest;
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;
......@@ -13,6 +14,7 @@ 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.BrandMerchantVO;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -55,4 +57,9 @@ public interface BrandMerchantApi {
@PostMapping(value = "/private/brandMerchant/authSubChannel")
JsonResult<BrandMerchantAuthSubChannelVO> authSubChannel(BrandMerchantAuthSubChannelRequest request);
@ApiOperation(value = "查询授权子渠道结果", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/listAuthSubChannel")
JsonResult<List<BrandMerchantAuthSubChannelVO>> listAuthSubChannel(
BrandMerchantGetAuthSubChannelRequest request);
}
......@@ -6,6 +6,7 @@ import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantApplyReques
import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantAuthSubChannelRequest;
import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantBindXcxAppIdRequest;
import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantGetApplyRequest;
import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantGetAuthSubChannelRequest;
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;
......@@ -13,6 +14,7 @@ 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.BrandMerchantVO;
import feign.hystrix.FallbackFactory;
import java.util.List;
import org.springframework.stereotype.Component;
/**
......@@ -61,6 +63,12 @@ public class BrandMerchantApiFallback implements FallbackFactory<BrandMerchantAp
BrandMerchantAuthSubChannelRequest request) {
return JsonResult.rpcError();
}
@Override
public JsonResult<List<BrandMerchantAuthSubChannelVO>> listAuthSubChannel(
BrandMerchantGetAuthSubChannelRequest 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 = "品牌商户查看授权子渠道结果")
public class BrandMerchantGetAuthSubChannelRequest {
@ApiModelProperty(value = "品牌ID", required = true)
@NotNull(message = "品牌ID不能为空")
private Long brandId;
}
......@@ -27,10 +27,10 @@ public class BrandMerchantAuthSubChannelVO {
private OpenStateEnums state;
@ApiModelProperty(value = "认证阶段")
private AuthPhaseEnums authPhase;
private AuthPhaseEnums phase;
@ApiModelProperty(value = "授权二维码")
private String authQrCode;
private String qrCode;
@ApiModelProperty(value = "失败原因")
private String failMessage;
......
......@@ -49,7 +49,7 @@ public class TestController {
@PostMapping(value = "/private/test/upload")
public JsonResult<SignatureVO> upload(@RequestParam String url) throws IOException {
GetAuthorityRequest request = new GetAuthorityRequest();
request.setAccessTypeEnum(AccessTypeEnum.PUBLIC);
request.setAccessTypeEnum(AccessTypeEnum.PRIVATE);
request.setBizCode("BRAND_INFO");
request.setTenantId(1L);
request.setTenantType("BRAND");
......
......@@ -8,6 +8,7 @@ import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantApplyReques
import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantAuthSubChannelRequest;
import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantBindXcxAppIdRequest;
import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantGetApplyRequest;
import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantGetAuthSubChannelRequest;
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;
......@@ -18,6 +19,7 @@ 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.PageBrandMerchantApplyParams;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.annotation.Resource;
import javax.validation.Valid;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -93,4 +95,13 @@ public class BrandMerchantController implements BrandMerchantApi {
request.getAuthType()));
}
@ApiOperation(value = "查询授权子渠道结果", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/listAuthSubChannel")
@Override
public JsonResult<List<BrandMerchantAuthSubChannelVO>> listAuthSubChannel(
@RequestBody @Valid BrandMerchantGetAuthSubChannelRequest request) {
return JsonResult.success(brandMerchantService.listAuthSubChannel(request.getBrandId()));
}
}
......@@ -11,6 +11,7 @@ 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.MerchantSubChannelConfigEvent;
import java.util.List;
/**
* 品牌商户服务
......@@ -94,4 +95,12 @@ public interface BrandMerchantService {
BrandMerchantAuthSubChannelVO authSubChannel(Long brandId, SubChannelEnums subChannel,
SubChannelAuthTypeEnums authType);
/**
* 查询授权子渠道结果
*
* @param brandId 品牌ID
* @return 结果
*/
List<BrandMerchantAuthSubChannelVO> listAuthSubChannel(Long brandId);
}
......@@ -40,12 +40,15 @@ import com.jiejing.paycenter.common.enums.merchant.SubChannelEnums;
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.SubChannelAuthInfo;
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.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Resource;
......@@ -213,6 +216,15 @@ public class BrandMerchantServiceImpl implements BrandMerchantService {
return BeanUtil.map(vo, BrandMerchantAuthSubChannelVO.class);
}
@Override
public List<BrandMerchantAuthSubChannelVO> listAuthSubChannel(Long brandId) {
BrandToMerchant relation = brandToMerchantRpService.getByBrandId(brandId);
MerchantVO merchant = merchantRpcService.getByMerchantId(relation.getMerchantId());
List<SubChannelAuthInfo> auths = merchant.getSubChannelAuths();
return Optional.ofNullable(auths).orElse(new ArrayList<>(1)).stream()
.map(e -> BeanUtil.map(e, BrandMerchantAuthSubChannelVO.class)).collect(Collectors.toList());
}
private void doOpenMerchantSuccess(MerchantEvent event) {
BrandMerchantApply apply = brandMerchantApplyRpService.getByIdForUpdate(
Long.parseLong(event.getApplyNo())).orElseThrow(() -> new BizException(FinanceErrorEnums.NOT_EXIST));
......
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