DmpIncomeController.java 1.51 KB
Newer Older
kangxiaoshan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
package common.controller;


import common.model.DmpIncome;
import common.model.User;
import common.service.DmpIncomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import security.annotation.CurrentAccount;
import util.ResultModel;

//DMP 收入管理
@RestController
@RequestMapping("dmp/income")
public class DmpIncomeController {

    @Autowired
    DmpIncomeService dmpIncomeService;


    @GetMapping("/list/bycode")
kangxiaoshan committed
23
    public ResultModel listByContract(String code) {
kangxiaoshan committed
24
        //按合同查询
kangxiaoshan committed
25
        return ResultModel.OK(dmpIncomeService.listByCode(code));
kangxiaoshan committed
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
    }

    @GetMapping("/list/byds")
    public ResultModel listByDs(String start, String end) {
        //按日期范围查询
        return ResultModel.OK(dmpIncomeService.listByDs(start, end));
    }

    @PostMapping("/update")
    public ResultModel updateItem(@RequestBody DmpIncome dmpIncome) {
        //更新数据
        return ResultModel.OK(dmpIncomeService.update(dmpIncome));
    }

    @PostMapping("/delete")
kangxiaoshan committed
41
    public ResultModel deleteItem(@RequestBody DmpIncome dmpIncome) {
kangxiaoshan committed
42
        //删除数据
kangxiaoshan committed
43
        return ResultModel.OK(dmpIncomeService.delete(dmpIncome));
kangxiaoshan committed
44 45 46
    }


kangxiaoshan committed
47 48
    @PostMapping("/upload")
    public ResultModel uploadList(@RequestParam("file") MultipartFile file, @CurrentAccount User loginAccount) {
kangxiaoshan committed
49
        //上传收入数据
kangxiaoshan committed
50
        return dmpIncomeService.uploadFile(file, "dmp", loginAccount);
kangxiaoshan committed
51 52
    }

kangxiaoshan committed
53

kangxiaoshan committed
54
}