package thyyxxk.webserver.controller.medicalinsurance;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import thyyxxk.webserver.config.auth.PassToken;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.medicalinsurance.download.DwnldPrm;
import thyyxxk.webserver.service.medicalinsurance.SiDownloadService;

import java.io.IOException;
import java.util.Map;

/**
 * @description: 目录下载入口
 * @author: DingJie
 * @create: 2021-06-23 15:31:07
 **/
@RestController
@RequestMapping("/siDownload")
public class SiDownloadController {
    private final SiDownloadService service;

    @Autowired
    public SiDownloadController(SiDownloadService service) {
        this.service = service;
    }

    @PassToken
    @PostMapping("/execute")
    public ResultVo<Map<String, Object>> executeDownload(@RequestBody DwnldPrm prm) {
        return service.executeDownload(prm);
    }

    @PostMapping("/queryFromHis")
    public ResultVo<Map<String, Object>> queryFromHis(@RequestBody DwnldPrm prm) {
        return service.queryFromHis(prm);
    }

    @PassToken
    @GetMapping("/fillPsnPayProp")
    public ResultVo<String> fillPsnPayProp() {
        return service.fillPsnPayProp();
    }

    @PassToken
    @GetMapping("/importDown")
    public void importDown() throws IOException {
        service.importDown();
    }
}
