package com.zcloud.fire.check.web;


import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.jjb.saas.framework.auth.model.SSOUser;
import com.jjb.saas.framework.auth.utils.AuthContext;
import com.zcloud.fire.check.api.FireCheckRecordServiceI;
import com.zcloud.fire.check.dto.*;
import com.zcloud.fire.check.dto.clientobject.CorpCheckStatisticsCO;
import com.zcloud.fire.check.dto.clientobject.CorpStatisticsCO;
import com.zcloud.fire.check.dto.clientobject.FireCheckRecordCO;
import com.zcloud.fire.check.dto.clientobject.FireCheckRecordInfoCO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * web-adapter
 *
 * @Author zhaokai
 * @Date 2025-12-12 11:10:58
 */
@Api(tags = "消防点位检查记录表")
@RequestMapping("/${application.gateway}/fireCheckRecord")
@RestController
@AllArgsConstructor
public class FireCheckRecordController {
    private final FireCheckRecordServiceI fireCheckRecordService;

    @ApiOperation("点位检查记录-检查记录分页")
    @PostMapping("/list")
    public PageResponse<FireCheckRecordCO> page(@RequestBody FireCheckRecordPageQry qry) {
        return fireCheckRecordService.listPage(qry);
    }

    @ApiOperation("检查记录详情")
    @GetMapping("/getInfoById/{id}")
    public SingleResponse<FireCheckRecordInfoCO> getInfoById(@PathVariable("id") Long id) {
        return SingleResponse.of(fireCheckRecordService.getInfoById(id));
    }

    @ApiOperation("删除")
    @GetMapping("/remove/{id}")
    public Response remove(@PathVariable("id") Long id) {
        fireCheckRecordService.remove(id);
        return SingleResponse.buildSuccess();
    }

    @ApiOperation("删除多个")
    @DeleteMapping("/ids")
    public Response removeBatch(@RequestParam Long[] ids) {
        fireCheckRecordService.removeBatch(ids);
        return SingleResponse.buildSuccess();
    }

    @ApiOperation("股份端-分公司消防检查记录")
    @PostMapping("/corpCheckRecordList")
    @PreAuthorize("@pms.hasAnyPermission('fgsxfjcjl')")
    public PageResponse<CorpCheckStatisticsCO> corpCheckRecordList(@RequestBody CorpStatisticsPageQry qry) {
        return fireCheckRecordService.corpCheckRecordList(qry);
    }
  /*  @ApiOperation("和H5扫码点位显示检查记录)")
    @PostMapping("/getCheckRecordPageH5")
    public PageResponse<FireCheckRecordCO> getCheckRecordPageH5(@Validated @RequestBody FireCheckRecordPagePointQry qry) {
        return fireCheckRecordService.getCheckRecordPageH5(qry);
    }*/
    @ApiOperation("和H5扫码点位显示检查记录)")
    @PostMapping("/getCheckRecordPageH5")
    public PageResponse<FireCheckRecordInfoCO> getCheckRecordPageH5(@Validated @RequestBody FireCheckRecordPagePointQry qry) {
        return fireCheckRecordService.getCheckRecordPageH5New(qry);
    }
}

