package com.siwei.rsmonitoring.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

import com.siwei.common.core.utils.StringUtils;
import com.siwei.rsmonitoring.domain.TDkjbxxHgxRecord;
import com.siwei.rsmonitoring.domain.vo.TDkjbxxHgxRecordSplitVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.siwei.common.log.annotation.Log;
import com.siwei.common.log.enums.BusinessType;
import com.siwei.common.security.annotation.RequiresPermissions;
import com.siwei.rsmonitoring.domain.TDkjbxxHgx;
import com.siwei.rsmonitoring.service.ITDkjbxxHgxService;
import com.siwei.common.core.web.controller.BaseController;
import com.siwei.common.core.web.domain.AjaxResult;
import com.siwei.common.core.utils.poi.ExcelUtil;
import com.siwei.common.core.web.page.TableDataInfo;

/**
 * 地块基本信息合规性判定Controller
 *
 * @author siwei
 * @date 2025-02-10
 */
@RestController
@RequestMapping("/dkjbxx/hgx")
public class TDkjbxxHgxController extends BaseController {
    @Autowired
    private ITDkjbxxHgxService tDkjbxxHgxService;

    /**
     * 获取地块基本信息合规性判定详细信息
     */
//    @RequiresPermissions("rsmonitoring:hgx:query")
    @GetMapping(value = "/info")
    public AjaxResult getInfo(String dkid, String auditflowStep, String auditflowId) {
        return success(tDkjbxxHgxService.selectTDkjbxxHgxInfo(dkid, auditflowStep, auditflowId));
    }


    /**
     * 新增地块基本信息合规性判定
     */
//    @RequiresPermissions("rsmonitoring:hgx:add")
//    @Log(title = "地块基本信息合规性判定", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TDkjbxxHgxRecord tDkjbxxHgxRecord) {
        return toAjax(tDkjbxxHgxService.addTDkjbxxHgx(tDkjbxxHgxRecord));
    }


    @PostMapping("/split")
    public AjaxResult split(@RequestBody TDkjbxxHgxRecordSplitVo tDkjbxxHgxRecordSplitVo) {
        if (null == tDkjbxxHgxRecordSplitVo || StringUtils.isEmpty(tDkjbxxHgxRecordSplitVo.getPath()) || StringUtils.isEmpty(tDkjbxxHgxRecordSplitVo.getDkbh())) {
            return error("参数缺失");
        }
        return success(tDkjbxxHgxService.splitTDkjbxxHgx(tDkjbxxHgxRecordSplitVo));
    }


}
