Commit b127d739 by 程裕兵

feat:brand merchant

parent 4bf3d76d
......@@ -58,6 +58,7 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import org.apache.commons.lang3.tuple.Pair;
/**
* @author chengyubing
......@@ -552,10 +553,16 @@ public class MerchantConvert {
}
public static List<BrandMerchantVO> convertBrandMerchantList(Long brandId, List<MerchantVO> merchants,
SubChannelInfoDTO dto, Map<Long, List<StudioVO>> studioMap, Map<Long, StudioMerchantApply> applyMap) {
List<PartyToMerchant> studioRelations, SubChannelInfoDTO dto, Map<Long, StudioVO> studioMap,
Map<Long, StudioMerchantApply> applyMap) {
Map<Long, List<Pair<Long, Long>>> merchantMap = studioRelations.stream()
.map(e -> Pair.of(e.getMerchantId(), e.getPartyId()))
.collect(Collectors.groupingBy(Pair::getLeft));
return merchants.stream().map(e -> {
List<String> studioNames = studioMap.getOrDefault(brandId, new ArrayList<>()).stream()
.map(StudioVO::getName).collect(Collectors.toList());
List<String> studioNames = merchantMap.getOrDefault(e.getId(), new ArrayList<>()).stream()
.filter(pair -> null != studioMap.get(pair.getRight()))
.map(pair -> studioMap.get(pair.getRight()).getName())
.collect(Collectors.toList());
return convertBrandMerchant(brandId, studioNames, e, dto, applyMap.get(e.getId()));
}).sorted((o1, o2) -> o2.getFinishTime().compareTo(o1.getFinishTime())).collect(Collectors.toList());
}
......
......@@ -84,9 +84,9 @@ public class BrandMerchantServiceImpl implements BrandMerchantService {
merchantIds, PartyTypeEnum.STUDIO);
List<Long> studioIds = studioRelations.stream().map(PartyToMerchant::getPartyId)
.collect(Collectors.toList());
Map<Long, List<StudioVO>> studioMap = studioRpcService.mapStudioByBrandId(studioIds);
Map<Long, StudioVO> studioMap = studioRpcService.mapStudio(studioIds);
List<MerchantVO> merchants = merchantRpcService.listByIds(merchantIds);
return MerchantConvert.convertBrandMerchantList(brandId, merchants,
return MerchantConvert.convertBrandMerchantList(brandId, merchants, studioRelations,
configService.getDefaultBrandSubChannelInfo(), studioMap, applyMap);
}
......
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