Commit 8d2ee4e2 by 程裕兵

feat:list auth sub channel merchant nos

parent 58b4d297
......@@ -7,6 +7,7 @@ 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 java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
......@@ -48,4 +49,7 @@ public class StudioMerchantAuthSubChannelVO {
@ApiModelProperty(value = "失败原因")
private String failMessage;
@ApiModelProperty(value = "子商户号")
private List<String> merchantNos;
}
......@@ -33,6 +33,7 @@ import com.jiejing.fitness.finance.service.rpc.MessageRpcService;
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.common.enums.merchant.SubChannelOpenTypeEnums;
import com.jiejing.paycenter.common.model.vo.AuthSubChannelVO;
import com.jiejing.paycenter.common.model.vo.ConfigSubChannelVO;
import com.jiejing.paycenter.common.model.vo.MerchantVO;
......@@ -44,6 +45,7 @@ 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.request.ResourceInfo;
import com.jiejing.paycenter.common.model.vo.SubChannelVO;
import com.jiejing.studio.api.studio.vo.StudioVO;
import java.util.ArrayList;
import java.util.List;
......@@ -271,8 +273,28 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
MerchantVO merchant = merchantRpcService.getByMerchantId(relation.getMerchantId());
List<SubChannelAuthVO> auths = merchant.getSubChannelAuths();
return Optional.ofNullable(auths).orElse(new ArrayList<>(1)).stream()
.map(e -> BeanUtil.map(e, StudioMerchantAuthSubChannelVO.class)).collect(Collectors.toList());
List<SubChannelVO> subChannels = Optional.ofNullable(merchant.getSubChannels()).orElse(new ArrayList<>());
return Optional.ofNullable(auths).orElse(new ArrayList<>(1))
.stream()
.map(e -> {
StudioMerchantAuthSubChannelVO vo = BeanUtil.map(e, StudioMerchantAuthSubChannelVO.class);
switch (SubChannelAuthTypeEnums.getByCode(vo.getAuthType())) {
case ALI_OFFLINE:
vo.setMerchantNos(subChannels.stream().filter(
ele -> SubChannelOpenTypeEnums.ALI_OFFLINE == SubChannelOpenTypeEnums.getByCode(
ele.getOpenType())).findFirst().orElse(new SubChannelVO()).getMerchantNos());
break;
case WX_OFFLINE:
vo.setMerchantNos(subChannels.stream().filter(
ele -> SubChannelOpenTypeEnums.WX_GZH_OFFLINE == SubChannelOpenTypeEnums.getByCode(
ele.getOpenType())).findFirst().orElse(new SubChannelVO()).getMerchantNos());
break;
default:
break;
}
return vo;
})
.collect(Collectors.toList());
}
@Override
......
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