|
|
|
@@ -448,6 +448,61 @@ public class WxUserStructureController extends BaseController { |
|
|
|
return new ResultData(page); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("获取用户所有渠道") |
|
|
|
@GetMapping("/findUserStructureByChannel") |
|
|
|
public ResultData findUserStructureByChannel(@ModelAttribute WxCUser wxCUser) { |
|
|
|
|
|
|
|
List<WxUserChannel> channelStructureList = new ArrayList<>(); |
|
|
|
List<WxUserChannel> senceStructureList = new ArrayList<>(); |
|
|
|
|
|
|
|
List<WxUserChannel> channels = wxUserChannelService.findDistinctChannel(); |
|
|
|
for (WxUserChannel w : channels) { |
|
|
|
WxUserChannel c = new WxUserChannel(); |
|
|
|
c.setChannelName(w.getChannelName()); |
|
|
|
PageInfo<WxUserChannel> page = wxUserChannelService.listAsPage(c, 1, 1000); |
|
|
|
if (page.getSize() > 0) { |
|
|
|
List<String> sceneList = new ArrayList<>(); |
|
|
|
for (WxUserChannel uc : page.getList()) { |
|
|
|
List<String> scene = new ArrayList<>(); |
|
|
|
scene.add(uc.getSceneAddress()); |
|
|
|
wxCUser.setSceneList(scene); |
|
|
|
WxUserChannel senceStructure = new WxUserChannel(); |
|
|
|
senceStructure.setDescription(uc.getDescription()); |
|
|
|
senceStructure.setCount(wxCUserService.countByChannel(wxCUser)); |
|
|
|
senceStructureList.add(senceStructure); |
|
|
|
sceneList.add(uc.getSceneAddress()); |
|
|
|
} |
|
|
|
|
|
|
|
wxCUser.setSceneList(sceneList); |
|
|
|
WxUserChannel channelStructure = new WxUserChannel(); |
|
|
|
channelStructure.setChannelName(w.getChannelName()); |
|
|
|
channelStructure.setCount(wxCUserService.countByChannel(wxCUser)); |
|
|
|
channelStructureList.add(channelStructure); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
HashMap result = new HashMap(); |
|
|
|
Collections.sort(senceStructureList, new Comparator<WxUserChannel>() { |
|
|
|
@Override |
|
|
|
public int compare(WxUserChannel c1, WxUserChannel c2) { |
|
|
|
long diff = c1.getCount() - c2.getCount(); |
|
|
|
if (diff > 0) { |
|
|
|
return -1; |
|
|
|
} |
|
|
|
else if (diff < 0) { |
|
|
|
return 1; |
|
|
|
} |
|
|
|
return 0; |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
result.put("channelList",channelStructureList); |
|
|
|
result.put("senceList",senceStructureList.subList(0,10)); |
|
|
|
return new ResultData(result); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("获取用户所有渠道") |
|
|
|
@GetMapping("/findAllUserChannel") |
|
|
|
public ResultData findAllUserChannel() { |
|
|
|
|