Commit c14785a2 by 程裕兵

feat:enum error

parent e3f81feb
......@@ -2,6 +2,7 @@ package com.jiejing.fitness.finance.service.merchant.convert;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.jiejing.common.utils.collection.CollectionUtil;
import com.jiejing.common.utils.convert.BeanUtil;
import com.jiejing.common.utils.crypt.AesUtil;
import com.jiejing.filecenter.api.resource.vo.ResourceInfoVO;
......@@ -446,9 +447,12 @@ public class MerchantConvert {
.build();
}
public static StudioMerchantApplyVO convertApply(StudioMerchantApply apply) {
public static StudioMerchantApplyVO convertApply(StudioMerchantApply apply, Map<Long, String> urlMap) {
ApplyStudioMerchantParams info = JSON.parseObject(apply.getMerchantInfo(),
ApplyStudioMerchantParams.class).decrypt(apply.getSalt());
if (CollectionUtil.isNotEmpty(info.getResourceMap()) && CollectionUtil.isNotEmpty(urlMap)) {
info.getResourceMap().values().forEach(e -> e.setUrl(urlMap.get(e.getResourceId())));
}
return StudioMerchantApplyVO.builder()
.id(apply.getId())
.brandId(apply.getBrandId())
......@@ -489,7 +493,7 @@ public class MerchantConvert {
return Optional.ofNullable(applies)
.orElse(new ArrayList<>())
.stream()
.map(MerchantConvert::convertApply)
.map(e -> convertApply(e, null))
.collect(Collectors.toList());
}
......
package com.jiejing.fitness.finance.service.merchant.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.jiejing.common.exception.BizException;
import com.jiejing.common.model.PageVO;
......@@ -7,6 +8,7 @@ import com.jiejing.common.utils.collection.CollectionUtil;
import com.jiejing.common.utils.convert.BeanUtil;
import com.jiejing.filecenter.api.resource.vo.ResourceInfoVO;
import com.jiejing.fitness.enums.finance.PartyTypeEnum;
import com.jiejing.fitness.finance.api.merchant.request.model.BrandResourceInfo;
import com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantApplyVO;
import com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantAuthSubChannelVO;
import com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantBindXcxAppIdVO;
......@@ -179,7 +181,9 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
}
MerchantVO merchant = merchantRpcService.getByMerchantId(relation.getMerchantId());
List<Long> resourceIds = this.getResourceIds(merchant);
Map<Long, String> urlMap = resourceRpcService.getResourceUrlMap(studioId, resourceIds);
StudioMerchantApply apply = studioMerchantApplyRpService.getLatestOneSuccessByMerchantId(
relation.getMerchantId());
Map<Long, String> urlMap = resourceRpcService.getResourceUrlMap(apply.getBrandId(), resourceIds);
return MerchantConvert.convertStudioMerchant(relation, merchant,
configService.getDefaultBrandSubChannelInfo(), urlMap);
}
......@@ -188,7 +192,20 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
public StudioMerchantApplyVO getApply(Long id) {
StudioMerchantApply apply = studioMerchantApplyRpService.getById(id)
.orElseThrow(() -> new BizException(FinanceErrorEnums.NOT_EXIST));
return MerchantConvert.convertApply(apply);
Map<Long, String> urlMap = this.getResouceseUrlMap(apply);
return MerchantConvert.convertApply(apply, urlMap);
}
private Map<Long, String> getResouceseUrlMap(StudioMerchantApply apply) {
List<Long> resourceIds = this.getResourceIds(apply);
return resourceRpcService.getResourceUrlMap(apply.getBrandId(), resourceIds);
}
private List<Long> getResourceIds(StudioMerchantApply apply) {
ApplyStudioMerchantParams info = JSON.parseObject(apply.getMerchantInfo(),
ApplyStudioMerchantParams.class);
return info.getResourceMap().values().stream().map(BrandResourceInfo::getResourceId)
.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