use of com.tony.billing.entity.TagCostRef 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;
}
Aggregations