use of com.tony.billing.dto.CostRecordDTO in project BillingDubbo by TonyJiangWJ.
the class CostRecordController method formatModelList.
private List<CostRecordDTO> formatModelList(List<CostRecord> list, boolean showTags) {
if (!CollectionUtils.isEmpty(list)) {
List<CostRecordDTO> models = new ArrayList<>();
CostRecordDTO model;
List<TagInfo> tagInfos;
for (CostRecord entity : list) {
model = new CostRecordDTO();
model.setId(entity.getId());
model.setCreateTime(entity.getCostCreateTime());
model.setGoodsName(entity.getGoodsName());
model.setInOutType(entity.getInOutType());
model.setIsDeleted(entity.getIsDeleted());
model.setMoney(MoneyUtil.fen2Yuan(entity.getMoney()));
model.setLocation(entity.getLocation());
model.setOrderStatus(entity.getOrderStatus());
model.setOrderType(entity.getOrderType());
model.setTradeNo(entity.getTradeNo());
model.setTarget(entity.getTarget());
model.setMemo(entity.getMemo());
model.setIsHidden(entity.getIsHidden());
if (showTags) {
tagInfos = tagInfoService.listTagInfoByTradeNo(entity.getTradeNo());
if (!CollectionUtils.isEmpty(tagInfos)) {
model.setTags(tagInfos.stream().map(TagInfo::getTagName).collect(Collectors.toList()));
}
}
models.add(model);
}
return models;
} else {
return null;
}
}
Aggregations