package com.dsk.cscec.controller;


import com.dsk.common.annotation.RepeatSubmit;
import com.dsk.common.core.controller.BaseController;
import com.dsk.common.core.domain.R;
import com.dsk.cscec.domain.CbQuantitySummaryActual;
import com.dsk.cscec.domain.bo.CbProjectBaseBo;
import com.dsk.cscec.domain.bo.CbQuantitySummaryListBo;
import com.dsk.cscec.domain.vo.CbQuantitySummaryListVo;
import com.dsk.cscec.service.ICbQuantitySummaryService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 成本-工料汇总基本表(CbQuantitySummary)表控制层
 *
 * @author lcl
 * @since 2024-02-05 11:06:56
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/cb/quantity/summary")
public class CbQuantitySummaryController extends BaseController {

    private final ICbQuantitySummaryService baseService;

    /**
     * 工料汇总科目树
     *
     * @return
     */
    @GetMapping(value = "/subjectTree")
    public R<List<Map<String, Object>>> subjectTree(CbProjectBaseBo bo) {
        return R.ok(baseService.subjectTree(bo));
    }

    /**
     * 已记录月份集合
     */
    @GetMapping(value = "/monthList")
    public R<List<String>> monthList(CbQuantitySummaryListBo bo) {
        return R.ok(baseService.monthList(bo));
    }

    /**
     * 科目月份列表
     */
    @GetMapping(value = "/subjectList")
    public R<List<CbQuantitySummaryListVo>> subjectList(CbQuantitySummaryListBo bo) {
        return R.ok(baseService.subjectList(bo));
    }

    /**
     * 实体工程材料-单位换算提示
     */
    @GetMapping(value = "/conversionNotice")
    public R conversionNotice(CbQuantitySummaryListBo bo) {
        baseService.conversionNotice(bo);
        return R.ok();
    }

    /**
     * 更新月成本信息
     */
    @PutMapping(value = "/updateActual")
    @RepeatSubmit
    public R<Void> updateActual(@RequestBody List<CbQuantitySummaryActual> list) {
        baseService.updateActual(list);
        return R.ok();
    }

    /**
     * 数据推送
     */
    @PutMapping(value = "/pushData")
    @RepeatSubmit
    public R<Void> pushData(@RequestBody CbQuantitySummaryActual bo) {
        baseService.pushData(bo);
        return R.ok();
    }

}

