package com.ywt.mg.web.controllers.enterprise;

import com.ywt.mg.core.MGRight;
import com.ywt.mg.core.MGRightTypeDef;
import com.ywt.mg.params.enterprise.marketting.BatchDownloadFilesRequest;
import com.ywt.mg.services.enterprise.ApplyProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

@RestController("/enterprise/marketApply")
@RequestMapping({"/enterprise/marketApply"})
@MGRight
@Api(description = "企业后台审核任务列表")
public class MarketApplyController {

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

    @Autowired
    private ApplyProjectService applyProjectService;

    @ApiOperation(value = "批量下载")
    @RequestMapping({"/batchDownloadFiles"})
    @MGRight(menuCode = {"/batchDownloadFiles"}, type = MGRightTypeDef.Menu | MGRightTypeDef.Logined)
    void getProjectDetail(@Validated BatchDownloadFilesRequest request, HttpServletResponse response) {
        applyProjectService.batchDownloadFiles(request, response);
    }


    @ApiOperation(value = "生成pdf")
    @RequestMapping({"/createPDF"})
    @MGRight(menuCode = {"/createPDF"}, type = MGRightTypeDef.Menu | MGRightTypeDef.Logined)
    void createPDF(@RequestBody BatchDownloadFilesRequest request) {
        applyProjectService.createPDF(request);
    }

}
