package com.mvc.controller.aiiden;


import com.mvc.model.CorrectMap;
import com.mvc.model.ErrorMap;
import com.mvc.model.TReviewCompareModel;
import com.mvc.service.aiiden.TReviewCompareService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.Map;

@Api(tags = "审核数据对比接口")
@RequestMapping("/TReviewCompareAction")
@Controller
public class TReviewCompareAction {

    @Autowired
    private TReviewCompareService tReviewCompareService;

    @ApiOperation("查询所有审核数据对比")
    @RequestMapping(value = "/findAllTReviewCompare",method = RequestMethod.POST)
    @ResponseBody
    public Map<String,Object> findAllTReviewCompare(@RequestBody TReviewCompareModel model){
        try {
            Map<String,Object> res = tReviewCompareService.findAllTReviewCompare(model);
            Map<String,Object> resMap=new CorrectMap();
            resMap.put("res",res);
            return resMap;
        } catch (Exception e) {
            e.printStackTrace();
            Map<String,Object> resMap=new ErrorMap();
            resMap.put("error",e.getMessage());
            return resMap;
        }
    }

    @ApiOperation("获取是否生成审核比对的状态")
    @RequestMapping(value = "/findTReviewCompareStatus/{taskDate}",method = RequestMethod.GET)
    @ResponseBody
    public Map<String,Object> findTReviewCompareStatus(@PathVariable("taskDate") String taskDate){
        try {
            String res = tReviewCompareService.findTReviewCompareStatus(taskDate);
            Map<String,Object> resMap=new CorrectMap();
            resMap.put("res",res);
            return resMap;
        } catch (Exception e) {
            e.printStackTrace();
            Map<String,Object> resMap=new ErrorMap();
            resMap.put("error",e.getMessage());
            return resMap;
        }
    }

    @ApiOperation("新增审核数据对比")
    @RequestMapping(value = "/saveTReviewCompare",method = RequestMethod.POST)
    @ResponseBody
    public Map<String,Object> saveTReviewCompare(@RequestBody TReviewCompareModel model){
        try {
            TReviewCompareModel resModel= tReviewCompareService.saveTReviewCompare(model);
            Map<String,Object> resMap=new CorrectMap();
            resMap.put("res",resModel);
            return resMap;
        } catch (Exception e) {
            e.printStackTrace();
            Map<String,Object> resMap=new ErrorMap();
            resMap.put("error",e.getMessage());
            return resMap;
        }
    }


    @ApiOperation("删除审核数据对比")
    @RequestMapping(value = "/deleteTReviewCompare/{id}",method = RequestMethod.GET)
    @ResponseBody
    public Map<String,Object> deleteTReviewCompare(@PathVariable("id") int id){
        try {
            int  res= tReviewCompareService.deleteTReviewCompare(id);
            Map<String,Object> resMap=new CorrectMap();
            resMap.put("res",res);
            return resMap;
        } catch (Exception e) {
            e.printStackTrace();
            Map<String,Object> resMap=new ErrorMap();
            resMap.put("error",e.getMessage());
            return resMap;
        }
    }
}
