Search in sources :

Example 1 with CostTagListResponse

use of com.tony.billing.response.taginfo.CostTagListResponse in project BillingDubbo by TonyJiangWJ.

the class TagInfoController method listCostTag.

/**
 * 列出账单赋值的标签
 *
 * @param request
 * @return
 */
@RequestMapping(value = "/cost/tag/list")
public CostTagListResponse listCostTag(@ModelAttribute("request") @Validated CostTagListRequest request) {
    CostTagListResponse response = new CostTagListResponse();
    try {
        List<TagInfo> costTagList = tagInfoService.listTagInfoByTradeNo(request.getTradeNo());
        TagInfoDTO model;
        List<TagInfoDTO> result = new ArrayList<>();
        for (TagInfo entity : costTagList) {
            model = new TagInfoDTO();
            model.setTagName(entity.getTagName());
            model.setTagId(entity.getId());
            result.add(model);
        }
        if (!CollectionUtils.isEmpty(result)) {
            response.setTagInfoModels(result);
            ResponseUtil.success(response);
        } else {
            ResponseUtil.dataNotExisting(response);
        }
    } catch (Exception e) {
        ResponseUtil.sysError(response);
        logger.error("/cost/tag/list error", e);
    }
    return response;
}
Also used : CostTagListResponse(com.tony.billing.response.taginfo.CostTagListResponse) TagInfo(com.tony.billing.entity.TagInfo) ArrayList(java.util.ArrayList) TagInfoDTO(com.tony.billing.dto.TagInfoDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with CostTagListResponse

use of com.tony.billing.response.taginfo.CostTagListResponse in project BillingDubbo by TonyJiangWJ.

the class TagInfoController method getCostsCommunalTags.

@RequestMapping(value = "/cost/tag/communal/list")
public CostTagListResponse getCostsCommunalTags(@ModelAttribute("request") @Validated CommunalTagsRequest request) {
    List<TagInfoDTO> tagInfoDTOS = tagInfoService.listCommonTagInfos(request.getCostIds());
    CostTagListResponse response = new CostTagListResponse();
    if (!CollectionUtils.isEmpty(tagInfoDTOS)) {
        response.setTagInfoModels(tagInfoDTOS);
        return ResponseUtil.success(response);
    } else {
        return ResponseUtil.dataNotExisting(response);
    }
}
Also used : CostTagListResponse(com.tony.billing.response.taginfo.CostTagListResponse) TagInfoDTO(com.tony.billing.dto.TagInfoDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

TagInfoDTO (com.tony.billing.dto.TagInfoDTO)2 CostTagListResponse (com.tony.billing.response.taginfo.CostTagListResponse)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 TagInfo (com.tony.billing.entity.TagInfo)1 ArrayList (java.util.ArrayList)1