package com.njzscloud.supervisory.dispose.controller;

import com.njzscloud.common.core.utils.R;
import com.njzscloud.supervisory.dispose.pojo.DisposeRecordReportParam;
import com.njzscloud.supervisory.dispose.service.DisposeRecordService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/project_clearance_detail")
@RequiredArgsConstructor
public class ProjectClearanceDetailController {

    private final DisposeRecordService disposeRecordService;

    @PostMapping("/report")
    public R<?> report(@RequestParam(required = false, defaultValue = "0") Integer action, @RequestBody DisposeRecordReportParam disposeRecordReportParam) {
        if (action == 0) {
            Integer action_ = disposeRecordReportParam.getAction();
            action = action_ == null ? 1 : action_;
        }
        disposeRecordService.report(action, disposeRecordReportParam);
        return R.success();
    }
}
