package com.uas.finance.controller;

import com.uas.finance.model.Receipt;
import com.uas.finance.service.ReceiptService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 发票控制层
 * created by shicr on 2018/1/27
 **/
@RequestMapping("/receipt")
@RestController
public class ReceiptController {

    private final static Logger logger = LoggerFactory.getLogger(ReceiptController.class);

    @Autowired
    private ReceiptService service;

    /**
     * 基础发票保存
     *
     * @param receiptList
     * @return
     */
    @RequestMapping(value = "/save", method = RequestMethod.POST)
    public List<Receipt> save(@RequestBody List<Receipt> receiptList) {
        logger.info("保存发票信息", "success");
        List<Receipt> receipts = service.save(receiptList);
        return receipts;
    }
}
