package com.rongwei.savecheck.controller;


import com.rongwei.safecommon.fegin.WFFeginClient;
import com.rongwei.sfcommon.sys.service.RiskJobService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
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;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("risk")
@Slf4j
public class RiskJobController {
    @Autowired
    private RiskJobService riskJobService;


    @PostMapping("/formExcelExport")
    public void formExcelExport(@RequestBody Map<String, String> params, HttpServletResponse response) throws Exception {
        log.info("开始导出");
        try{
            String id = params.get("id");
            String jobtype = params.get("jobtype");
            String  tenantid = params.get("tenantid");
            String  processinstid = params.get("processinstid");

            if(StringUtils.isNoneBlank(processinstid)) {
                riskJobService.riskJobExport2(id, jobtype, tenantid, processinstid, response);
            }else {
                riskJobService.riskJobExport2(id, jobtype, tenantid, response);
            }
        } catch (Exception e) {
            log.error("导出失败", e);
        }
    }




}
