Search in sources :

Example 1 with TagCostRef

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;
}
Also used : BaseResponse(com.tony.billing.response.BaseResponse) CostRecord(com.tony.billing.entity.CostRecord) TagInfo(com.tony.billing.entity.TagInfo) TagCostRef(com.tony.billing.entity.TagCostRef) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

CostRecord (com.tony.billing.entity.CostRecord)1 TagCostRef (com.tony.billing.entity.TagCostRef)1 TagInfo (com.tony.billing.entity.TagInfo)1 BaseResponse (com.tony.billing.response.BaseResponse)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1