Commit 82589d5f by guojuxing

品牌添加共享标志

parent 92ec26dc
...@@ -53,6 +53,7 @@ public class StoreBrandController { ...@@ -53,6 +53,7 @@ public class StoreBrandController {
.collect(Collectors.toList()); .collect(Collectors.toList());
Map<Integer, String> enterpriseMap = new HashMap<>(); Map<Integer, String> enterpriseMap = new HashMap<>();
Map<Integer, Integer> brandIdMap = new HashMap<>();
ServiceResponse<List<StoreBrandDTO>> brandResponse = storeBrandApiService.listAllStoreBrandInfoByIds(brandIdList); ServiceResponse<List<StoreBrandDTO>> brandResponse = storeBrandApiService.listAllStoreBrandInfoByIds(brandIdList);
if (brandResponse.isSuccess() && CollectionUtils.isNotEmpty(brandResponse.getResult())) { if (brandResponse.isSuccess() && CollectionUtils.isNotEmpty(brandResponse.getResult())) {
...@@ -61,6 +62,9 @@ public class StoreBrandController { ...@@ -61,6 +62,9 @@ public class StoreBrandController {
.filter(e -> Objects.equals(e.getType(), 1)) .filter(e -> Objects.equals(e.getType(), 1))
.mapToInt(e -> e.getEnterpriseId()).boxed() .mapToInt(e -> e.getEnterpriseId()).boxed()
.collect(Collectors.toList()); .collect(Collectors.toList());
brandIdMap = brandList.stream().filter(e -> Objects.equals(e.getType(), 1))
.collect(Collectors.toMap(e -> e.getStoreBrandId(), e -> e.getEnterpriseId()));
ServiceResponse<List<EnterpriseDTO>> enterpriseResponse = enterpriseApiService.listEnterpriseByIds(enterpriseIdList); ServiceResponse<List<EnterpriseDTO>> enterpriseResponse = enterpriseApiService.listEnterpriseByIds(enterpriseIdList);
if (enterpriseResponse.isSuccess()) { if (enterpriseResponse.isSuccess()) {
enterpriseMap = enterpriseResponse.getResult().stream().collect(Collectors.toMap(e -> e.getEnterpriseId(), e -> e.getEnterpriseName())); enterpriseMap = enterpriseResponse.getResult().stream().collect(Collectors.toMap(e -> e.getEnterpriseId(), e -> e.getEnterpriseName()));
...@@ -68,6 +72,7 @@ public class StoreBrandController { ...@@ -68,6 +72,7 @@ public class StoreBrandController {
} }
Map<Integer, String> finalEnterpriseMap = enterpriseMap; Map<Integer, String> finalEnterpriseMap = enterpriseMap;
Map<Integer, Integer> finalBrandIdMap = brandIdMap;
voList = list.stream() voList = list.stream()
.map(e -> { .map(e -> {
StoreWidgetInterfaceShareVO vo = new StoreWidgetInterfaceShareVO(); StoreWidgetInterfaceShareVO vo = new StoreWidgetInterfaceShareVO();
...@@ -75,7 +80,8 @@ public class StoreBrandController { ...@@ -75,7 +80,8 @@ public class StoreBrandController {
vo.setValue(e.getStoreBrandId().toString()); vo.setValue(e.getStoreBrandId().toString());
//共享类型 //共享类型
if (Objects.equals(e.getType(), 2)) { if (Objects.equals(e.getType(), 2)) {
vo.setEnterpriseName(finalEnterpriseMap.get(e.getEnterpriseId())); Integer tempEnterpriseId = finalBrandIdMap.get(e.getStoreBrandId());
vo.setEnterpriseName(finalEnterpriseMap.get(tempEnterpriseId));
} }
return vo; return vo;
}) })
......
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