use of com.tony.billing.entity.TagInfo in project BillingDubbo by TonyJiangWJ.
the class TagInfoController method putCostTag.
/**
* 添加账单标签
*
* @param request
* @return
*/
@RequestMapping(value = "/cost/tag/put")
public BaseResponse putCostTag(@ModelAttribute("request") @Validated CostTagPutRequest request) {
BaseResponse response = new BaseResponse();
try {
CostRecord costRecord = costRecordService.findByTradeNo(request.getTradeNo(), request.getUserId());
TagInfo tagInfo = tagInfoService.getTagInfoById(request.getTagId());
if (costRecord != null && tagInfo != null) {
TagCostRef ref = new TagCostRef();
ref.setCostId(costRecord.getId());
ref.setTagId(tagInfo.getId());
if (tagInfoService.insertTagCostRef(ref) > 0) {
ResponseUtil.success(response);
} else {
ResponseUtil.error(response);
}
} else {
ResponseUtil.paramError(response);
}
} catch (Exception e) {
logger.error("/cost/tag/put error", e);
ResponseUtil.sysError(response);
}
return response;
}
use of com.tony.billing.entity.TagInfo in project BillingDubbo by TonyJiangWJ.
the class TagInfoController method putTag.
/**
* 添加标签
*
* @param request
* @return
*/
@RequestMapping(value = "/tag/put")
public BaseResponse putTag(@ModelAttribute("request") @Validated TagInfoPutRequest request) {
BaseResponse response = new BaseResponse();
try {
TagInfo tagInfo = new TagInfo();
tagInfo.setTagName(request.getTagName());
tagInfo.setUserId(request.getUserId());
if (tagInfoService.putTagInfo(tagInfo) > 0) {
ResponseUtil.success(response);
} else {
ResponseUtil.error(response);
}
} catch (Exception e) {
logger.error("/tag/put error", e);
ResponseUtil.sysError(response);
}
return response;
}
use of com.tony.billing.entity.TagInfo in project BillingDubbo by TonyJiangWJ.
the class TagInfoController method listBudgetAssignableTags.
@RequestMapping("/budget/tag/assignable/list")
public TagInfoListResponse listBudgetAssignableTags(@Validated @ModelAttribute("request") BudgetTagAssignableListRequest request) {
List<TagInfo> tagInfos = tagInfoService.listAssignableTagsByBudgetId(request.getBudgetId());
TagInfoListResponse response = new TagInfoListResponse();
response.setTagInfoList(new TagInfoToDtoListSupplier(tagInfos).get());
if (CollectionUtils.isEmpty(tagInfos)) {
return ResponseUtil.dataNotExisting(response);
}
return ResponseUtil.success(response);
}
use of com.tony.billing.entity.TagInfo 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;
}
}
use of com.tony.billing.entity.TagInfo 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;
}
Aggregations