Browse Source

渠道 和网点查询

v1.0
15989082884@163.com 2 years ago
parent
commit
c25d98e806
  1. 12
      src/main/java/com/qs/serve/modules/bms/controller/my/BmsChannelMyController.java
  2. 44
      src/main/java/com/qs/serve/modules/bms/controller/my/BmsChannelPointMyController.java

12
src/main/java/com/qs/serve/modules/bms/controller/my/BmsChannelMyController.java

@ -55,6 +55,12 @@ public class BmsChannelMyController {
public R<PageVo<BmsChannel>> getPage(BmsChannel param){
PageUtil.startPage();
List<BmsChannel> list = bmsChannelService.selectChannelList(param, Arrays.asList(AuthContextUtils.getSysUserId()),null);
list.forEach(a->{
BmsSupplierChannel searchSupplierChannel = new BmsSupplierChannel();
searchSupplierChannel.setChannelId(a.getId());
List<BmsSupplierChannel> bmsSupplierChannelList = bmsSupplierChannelService.selectSupplierChannelList(searchSupplierChannel);
a.setSupplierNames(bmsSupplierChannelList.stream().map(b->b.getSupplierName()).collect(Collectors.toList()));
});
return R.byPageHelperList(list);
}
@ -73,6 +79,12 @@ public class BmsChannelMyController {
}
PageUtil.startPage();
List<BmsChannel> list = bmsChannelService.selectChannelList(param, userIds,null);
list.forEach(a->{
BmsSupplierChannel searchSupplierChannel = new BmsSupplierChannel();
searchSupplierChannel.setChannelId(a.getId());
List<BmsSupplierChannel> bmsSupplierChannelList = bmsSupplierChannelService.selectSupplierChannelList(searchSupplierChannel);
a.setSupplierNames(bmsSupplierChannelList.stream().map(b->b.getSupplierName()).collect(Collectors.toList()));
});
return R.byPageHelperList(list);
}

44
src/main/java/com/qs/serve/modules/bms/controller/my/BmsChannelPointMyController.java

@ -75,6 +75,43 @@ public class BmsChannelPointMyController {
return R.byEmptyList();
}
List<BmsChannelPoint> list = bmsChannelPointService.selectChannelPointMyList(param, Arrays.asList(AuthContextUtils.getSysUserId()));
List<String> bizRegionIds = new ArrayList<>();
bizRegionIds.addAll(list.stream().filter(a->a.getBizRegionId()!=null).map(a->a.getBizRegionId()).collect(Collectors.toList()));
bizRegionIds = bizRegionIds.stream().distinct().collect(Collectors.toList());
List<BmsRegion2> region2List = new ArrayList<>();
if(bizRegionIds.size()>0){
LambdaQueryWrapper<BmsRegion2> region2LambdaQueryWrapper = new LambdaQueryWrapper<>();
region2LambdaQueryWrapper.in(BmsRegion2::getId,bizRegionIds);
region2List = bmsRegion2Service.list(region2LambdaQueryWrapper);
}
Map<String,BmsRegion2> idToBizRegion = region2List.stream().collect(Collectors.toMap(BmsRegion2::getId, a->a));
for (BmsChannelPoint channelPoint : list) {
if(StringUtils.hasText(channelPoint.getBizRegionPath())){
String[] bizRegions = channelPoint.getBizRegionPath().split("_");
if(bizRegions.length>0){
channelPoint.setBizRegionName(bizRegions[bizRegions.length-1]);
}
BmsRegion2 region2 = idToBizRegion.get(channelPoint.getBizRegionId());
if(region2!=null){
channelPoint.setBizRegionCode(region2.getCode());
}
}
if(StringUtils.hasText(channelPoint.getSaleRegionPath())){
String[] regions = channelPoint.getSaleRegionPath().split("_");
if(regions.length>0){
channelPoint.setSaleRegionName(regions[regions.length-1]);
}
}
BmsSupplierChannel searchSupplierChannel = new BmsSupplierChannel();
searchSupplierChannel.setChannelId(channelPoint.getChannelId());
List<BmsSupplierChannel> bmsSupplierChannelList = bmsSupplierChannelService.selectSupplierChannelList(searchSupplierChannel);
channelPoint.setSupplierNames(bmsSupplierChannelList.stream().map(b->b.getSupplierName()).collect(Collectors.toList()));
}
return R.byPageList(count,list);
}
@ -122,6 +159,13 @@ public class BmsChannelPointMyController {
channelPoint.setSaleRegionName(regions[regions.length-1]);
}
}
BmsSupplierChannel searchSupplierChannel = new BmsSupplierChannel();
searchSupplierChannel.setChannelId(channelPoint.getChannelId());
List<BmsSupplierChannel> bmsSupplierChannelList = bmsSupplierChannelService.selectSupplierChannelList(searchSupplierChannel);
channelPoint.setSupplierNames(bmsSupplierChannelList.stream().map(b->b.getSupplierName()).collect(Collectors.toList()));
}
return R.byPageList(count,pageList);
}

Loading…
Cancel
Save