package com.weaver.seconddev.chapanda.beisen.controller;


import com.weaver.common.authority.annotation.WeaPermission;
import com.weaver.common.base.entity.result.WeaResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.weaver.seconddev.chapanda.beisen.service.ConversionResignService;
import com.weaver.seconddev.chapanda.beisen.util.CommonUtils;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/***
 * 离职年假转换  POC开发的
 */
@RestController
@RequestMapping("/api/secondev/cbdhr/annual")
public class ConversionResignController {

    private final Logger log = LoggerFactory.getLogger(ConversionResignController.class);

    @Autowired
    ConversionResignService conversionResignService;

    @Autowired
    CommonUtils CommonUtils;

    @WeaPermission(publicPermission = true)
    @GetMapping("/resignConversion")
    public WeaResult<Object> resignConversion(HttpServletRequest request, HttpServletResponse response) throws IOException {
        Map<String,Object> paraMap = CommonUtils.requestToMap(request);
        Map<String,Object> recordMap = conversionResignService.resignConversion(paraMap);
        return WeaResult.success(recordMap);
    }


    @WeaPermission(publicPermission = true)
    @GetMapping("/resignConversion2")
    public WeaResult<Object> resignConversion2(HttpServletRequest request, HttpServletResponse response) throws IOException {
        Map<String,Object> paraMap = CommonUtils.requestToMap(request);
        Map<String,Object> recordMap = conversionResignService.resignConversion2(paraMap);
        return WeaResult.success(recordMap);
    }



    @WeaPermission(publicPermission = true)
    @GetMapping("/test")
    public WeaResult<Object> test(HttpServletRequest request, HttpServletResponse response) throws IOException {
        Map<String, Object> recordMap = new HashMap<String,Object>();
        recordMap.put("test","test");
        return WeaResult.success(recordMap);
    }


}
