diff --git a/src/main/java/com/qs/serve/modules/bms/controller/my/BmsChannelMyController.java b/src/main/java/com/qs/serve/modules/bms/controller/my/BmsChannelMyController.java index 18eb9b18..9fdee8a4 100644 --- a/src/main/java/com/qs/serve/modules/bms/controller/my/BmsChannelMyController.java +++ b/src/main/java/com/qs/serve/modules/bms/controller/my/BmsChannelMyController.java @@ -55,6 +55,12 @@ public class BmsChannelMyController { public R> getPage(BmsChannel param){ PageUtil.startPage(); List list = bmsChannelService.selectChannelList(param, Arrays.asList(AuthContextUtils.getSysUserId()),null); + list.forEach(a->{ + BmsSupplierChannel searchSupplierChannel = new BmsSupplierChannel(); + searchSupplierChannel.setChannelId(a.getId()); + List 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 list = bmsChannelService.selectChannelList(param, userIds,null); + list.forEach(a->{ + BmsSupplierChannel searchSupplierChannel = new BmsSupplierChannel(); + searchSupplierChannel.setChannelId(a.getId()); + List bmsSupplierChannelList = bmsSupplierChannelService.selectSupplierChannelList(searchSupplierChannel); + a.setSupplierNames(bmsSupplierChannelList.stream().map(b->b.getSupplierName()).collect(Collectors.toList())); + }); return R.byPageHelperList(list); } diff --git a/src/main/java/com/qs/serve/modules/bms/controller/my/BmsChannelPointMyController.java b/src/main/java/com/qs/serve/modules/bms/controller/my/BmsChannelPointMyController.java index 63a93dfe..dee76be1 100644 --- a/src/main/java/com/qs/serve/modules/bms/controller/my/BmsChannelPointMyController.java +++ b/src/main/java/com/qs/serve/modules/bms/controller/my/BmsChannelPointMyController.java @@ -75,6 +75,43 @@ public class BmsChannelPointMyController { return R.byEmptyList(); } List list = bmsChannelPointService.selectChannelPointMyList(param, Arrays.asList(AuthContextUtils.getSysUserId())); + + List 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 region2List = new ArrayList<>(); + if(bizRegionIds.size()>0){ + LambdaQueryWrapper region2LambdaQueryWrapper = new LambdaQueryWrapper<>(); + region2LambdaQueryWrapper.in(BmsRegion2::getId,bizRegionIds); + region2List = bmsRegion2Service.list(region2LambdaQueryWrapper); + } + Map 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 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 bmsSupplierChannelList = bmsSupplierChannelService.selectSupplierChannelList(searchSupplierChannel); + channelPoint.setSupplierNames(bmsSupplierChannelList.stream().map(b->b.getSupplierName()).collect(Collectors.toList())); + } return R.byPageList(count,pageList); }