Search in sources :

Example 1 with TpcMqSubscribeVo

use of com.paascloud.provider.model.vo.TpcMqSubscribeVo in project paascloud-master by paascloud.

the class TpcMqConsumerController method querySubscribeListWithPage.

/**
 * 查询订阅者列表.
 *
 * @param tpcMqConsumer the tpc mq consumer
 *
 * @return the wrapper
 */
@PostMapping(value = "/querySubscribeListWithPage")
@ApiOperation(httpMethod = "POST", value = "查询订阅者列表")
public Wrapper<PageInfo<TpcMqSubscribeVo>> querySubscribeListWithPage(@ApiParam(name = "consumer", value = "Mq消费者") @RequestBody TpcMqConsumer tpcMqConsumer) {
    logger.info("查询Mq订阅列表tpcMqConsumerQuery={}", tpcMqConsumer);
    PageHelper.startPage(tpcMqConsumer.getPageNum(), tpcMqConsumer.getPageSize());
    tpcMqConsumer.setOrderBy("update_time desc");
    List<TpcMqSubscribeVo> list = tpcMqConsumerService.listSubscribeVoWithPage(tpcMqConsumer);
    PageInfo<TpcMqSubscribeVo> pageInfo = new PageInfo<>(list);
    if (PublicUtil.isNotEmpty(list)) {
        Map<Long, TpcMqSubscribeVo> tpcMqSubscribeVoMap = this.trans2Map(list);
        List<Long> subscribeIdList = new ArrayList<>(tpcMqSubscribeVoMap.keySet());
        List<TpcMqSubscribeVo> tagVoList = tpcMqConsumerService.listSubscribeVo(subscribeIdList);
        for (TpcMqSubscribeVo vo : tagVoList) {
            Long subscribeId = vo.getId();
            if (!tpcMqSubscribeVoMap.containsKey(subscribeId)) {
                continue;
            }
            TpcMqSubscribeVo tpcMqSubscribeVo = tpcMqSubscribeVoMap.get(subscribeId);
            tpcMqSubscribeVo.setTagVoList(vo.getTagVoList());
        }
        pageInfo.setList(new ArrayList<>(tpcMqSubscribeVoMap.values()));
    }
    return WrapMapper.ok(pageInfo);
}
Also used : TpcMqSubscribeVo(com.paascloud.provider.model.vo.TpcMqSubscribeVo) PageInfo(com.github.pagehelper.PageInfo) ArrayList(java.util.ArrayList) ApiOperation(io.swagger.annotations.ApiOperation)

Example 2 with TpcMqSubscribeVo

use of com.paascloud.provider.model.vo.TpcMqSubscribeVo in project paascloud-master by paascloud.

the class TpcMqConsumerController method trans2Map.

private Map<Long, TpcMqSubscribeVo> trans2Map(List<TpcMqSubscribeVo> resultDTOS) {
    Map<Long, TpcMqSubscribeVo> resultMap = new TreeMap<>((o1, o2) -> {
        o1 = o1 == null ? 0 : o1;
        o2 = o2 == null ? 0 : o2;
        return o2.compareTo(o1);
    });
    for (TpcMqSubscribeVo resultDTO : resultDTOS) {
        resultMap.put(resultDTO.getId(), resultDTO);
    }
    return resultMap;
}
Also used : TpcMqSubscribeVo(com.paascloud.provider.model.vo.TpcMqSubscribeVo) TreeMap(java.util.TreeMap)

Aggregations

TpcMqSubscribeVo (com.paascloud.provider.model.vo.TpcMqSubscribeVo)2 PageInfo (com.github.pagehelper.PageInfo)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ArrayList (java.util.ArrayList)1 TreeMap (java.util.TreeMap)1