package com.mosty.yjzl.third;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mosty.base.model.dto.yjzl.*;
import com.mosty.base.model.dto.yjzl.third.ThirdMyZlSearchDto;
import com.mosty.base.model.dto.yjzl.third.ThirdZlInfoSearchDto;
import com.mosty.base.model.query.yjzl.TbZlxxQuery;
import com.mosty.base.model.vo.yjzl.*;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.base.entity.log.BusinessType;
import com.mosty.common.base.entity.log.Log;
import com.mosty.common.token.JwtSysUser;
import com.mosty.yjzl.service.TbYjzltjService;
import com.mosty.yjzl.service.TbZlxxService;
import com.mosty.yjzl.service.TbZlxxZxjlService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;


@Api(tags = "预警指令第三方服务接口")
@AllArgsConstructor
@RestController
@RequestMapping("/yjThird")
public class YjzlThirdController {

    private final TbZlxxZxjlService tbZlxxZxjlService;
    private final TbZlxxService tbZlxxService;

    @ApiOperation("根据身份证号查询指令统计")
    @GetMapping(value = "/getStatistics")
    public ResponseResult<List<Map<String, Object>>> getStatistics(String sfzh) {
        return ResponseResult.success(this.tbZlxxZxjlService.getStatistics(sfzh));
    }

    @ApiOperation("根据状态查询指令列表")
    @GetMapping(value = "/getPageList")
    public ResponseResult<IPage<TbZlxxZxrVo>> getPageList(ThirdMyZlSearchDto dto) {
        return ResponseResult.success(this.tbZlxxZxjlService.getPageList(dto));
    }

    @ApiOperation("查询指令详情接口")
    @GetMapping(value = "/getInfo")
    public ResponseResult<TbZlxxInfoVo> getInfo(ThirdZlInfoSearchDto dto) {
        return ResponseResult.success(this.tbZlxxZxjlService.getInfo(dto));
    }

    @ApiOperation("查询指令处置流程以及最新记录")
    @GetMapping(value = "/getZxjlList")
    public ResponseResult<List<TbZlxxZxjlVo>> getNewZxjl(NewZxjlSearchDto dto) {
        return ResponseResult.success(this.tbZlxxZxjlService.getNewZxjl(dto));
    }

    @ApiOperation("指令新增--第三方")
    @PostMapping(value = "/addZlxx")
    public ResponseResult<Void> addZlxx(@RequestBody TbZlxxInsertDto dto) {
        this.tbZlxxService.addZlxx(dto);
        return ResponseResult.success();
    }

    @ApiOperation("指令处置流程")
    @PostMapping(value = "/zlHandle")
    public ResponseResult<Void> zlHandleOther(@RequestBody TbZlxxZtChangeDto dto) {
        this.tbZlxxService.zlHandleOther(dto);
        return ResponseResult.success();
    }

    @ApiOperation("添加指令执行记录")
    @PostMapping(value = "/addZxjl")
    public ResponseResult<Void> addZxjlOther(@RequestBody TbZlxxZxjlInsertDto dto) {
        this.tbZlxxService.addZxjlOther(dto);
        return ResponseResult.success();
    }
}
