use of com.tony.billing.dto.TagInfoDTO in project BillingDubbo by TonyJiangWJ.
the class TagInfoController method listTag.
/**
* 列出所有标签
*
* @param request
* @return
*/
@RequestMapping(value = "/tag/list")
public TagInfoListResponse listTag(@ModelAttribute("request") BaseRequest request) {
TagInfoListResponse response = new TagInfoListResponse();
TagInfo tagInfo = new TagInfo();
tagInfo.setUserId(request.getUserId());
List<TagInfo> tagInfos = tagInfoService.listTagInfo(tagInfo);
if (!CollectionUtils.isEmpty(tagInfos)) {
response.setTagInfoList(tagInfos.parallelStream().map(tag -> {
TagInfoDTO model = new TagInfoDTO();
model.setTagName(tag.getTagName());
model.setTagId(tag.getId());
model.setUsageCount(tagInfoService.countTagUsage(tag.getId(), request.getUserId()));
return model;
}).sorted(Comparator.comparing(TagInfoDTO::getUsageCount).reversed()).collect(Collectors.toList()));
}
ResponseUtil.success(response);
return response;
}
use of com.tony.billing.dto.TagInfoDTO 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;
}
use of com.tony.billing.dto.TagInfoDTO in project BillingDubbo by TonyJiangWJ.
the class CostRecordController method formatDetailModel.
private CostRecordDetailDTO formatDetailModel(CostRecord record) {
CostRecordDetailDTO model = new CostRecordDetailDTO();
model.setId(record.getId());
model.setVersion(record.getVersion());
model.setCreateTime(record.getCostCreateTime());
model.setGoodsName(record.getGoodsName());
model.setInOutType(record.getInOutType());
model.setIsDeleted(record.getIsDeleted());
model.setLocation(record.getLocation());
model.setMemo(record.getMemo());
model.setMoney(MoneyUtil.fen2Yuan(record.getMoney()));
model.setModifyTime(record.getCostModifyTime());
model.setOrderNo(record.getOrderNo());
model.setOrderStatus(record.getOrderStatus());
model.setOrderType(record.getOrderType());
model.setPaidTime(record.getPaidTime());
model.setRefundMoney(MoneyUtil.fen2Yuan(record.getRefundMoney()));
model.setServiceCost(MoneyUtil.fen2Yuan(record.getServiceCost()));
model.setTarget(record.getTarget());
model.setTradeNo(record.getTradeNo());
model.setTradeStatus(record.getTradeStatus());
model.setIsHidden(record.getIsHidden());
List<TagInfo> tagInfos = tagInfoService.listTagInfoByTradeNo(record.getTradeNo());
if (!CollectionUtils.isEmpty(tagInfos)) {
model.setTagInfos(tagInfos.stream().map(tagInfo -> {
TagInfoDTO tagInfoDTO = new TagInfoDTO();
tagInfoDTO.setTagId(tagInfo.getId());
tagInfoDTO.setTagName(tagInfo.getTagName());
return tagInfoDTO;
}).collect(Collectors.toList()));
}
return model;
}
use of com.tony.billing.dto.TagInfoDTO 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);
}
}
Aggregations