package com.usky.fire.controller.web;


import com.usky.common.core.bean.ApiResult;
import com.usky.common.log.annotation.Log;
import com.usky.common.log.enums.BusinessType;
import com.usky.fire.domain.PostInspect;
import com.usky.fire.service.PostInspectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 查岗信息 前端控制器
 * </p>
 *
 * @author JCB
 * @since 2022-08-24
 */
@RestController
@RequestMapping("/postInspect")
public class PostInspectController {

    @Autowired
    private PostInspectService postInspectService;

    /**
     * 值班查岗-企业版平台查岗功能推送接收
     *
     * @param postInspect
     * @return
     */
    @Log(title = "企业消防值班查岗", businessType = BusinessType.INSERT)
    @PutMapping("postInspectRecept")
    public ApiResult<Void> postInspectRecept(@RequestBody PostInspect postInspect) {
        postInspectService.postInspectRecept(postInspect);
        return ApiResult.success();
    }

    /**
     * 值班查岗-企业版系统查岗功能相关数据查询
     *
     * @return
     */
    @GetMapping("postInspectPlatform")
    public ApiResult<List<PostInspect>> postInspectPlatform() {
        return ApiResult.success(postInspectService.postInspectPlatform());
    }

    /**
     * 值班查岗-企业版系统查岗记录查询接口
     *
     * @return
     */
    @GetMapping("postInspectAnswerRecept")
    public ApiResult<List<PostInspect>> postInspectAnswerRecept() {
        return ApiResult.success(postInspectService.postInspectAnswerRecept());
    }

    /**
     * 值班查岗-企业版系统网页应答数据接收，状态修改接口
     *
     * @param postInspect
     * @return
     */
    @Log(title = "企业消防值班查岗应答", businessType = BusinessType.INSERT)
    @PutMapping("postInspectAnswerUpdate")
    public ApiResult<Void> postInspectAnswerUpdate(@RequestBody PostInspect postInspect) {
        postInspectService.postInspectAnswerUpdate(postInspect);
        return ApiResult.success();
    }


}

