package com.ningdatech.carapi.industry.controller;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import com.ningdatech.carapi.industry.manage.OperatorAssessmentManage;
import com.ningdatech.carapi.industry.model.dto.OperatorAssessmentDTO;
import com.ningdatech.carapi.industry.model.vo.OperatorScoreDetailVO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 运营商考核系统前端控制器
 *
 * @author CMM
 * @since 2023/01/05 09:13
 */
@RequestMapping("/api/industry/operator-assessment-system")
@Slf4j
@Validated
@RestController
@Api(value = "OperatorAssessmentSystem", tags = "行业管理-运营商考核系统")
@RequiredArgsConstructor
public class OperatorAssessmentSystemController {

    private final OperatorAssessmentManage operatorAssessmentManage;

    @ApiOperation(value = "运营商考核详情",notes = "运营商考核详情")
    @PostMapping("/detail")
    public OperatorScoreDetailVO getOperatorScore(@RequestBody @Valid OperatorAssessmentDTO data){
        return operatorAssessmentManage.getOperatorScore(data);
    }

    @GetMapping("/download")
    @ApiOperation("下载表格")
    public void export(OperatorAssessmentDTO data, HttpServletResponse response) {
       operatorAssessmentManage.exportDocx(response,data);
    }
}
