package com.ruoyi.web.controller.fgw;

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


import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.system.domain.vo.JdapVo;
import com.ruoyi.system.domain.vo.SbxmVo;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.fgw.FgwJdap;
import com.ruoyi.system.service.fgw.IFgwJdapService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 发改委_节点安排Controller
 * 
 * @author ruoyi
 * @date 2023-04-11
 */
@RestController
@RequestMapping("/fgw/jdap")
public class FgwJdapController extends BaseController
{
    @Autowired
    private IFgwJdapService fgwJdapService;

    /**
     * 查询发改委_节点安排列表
     */
    @PreAuthorize("@ss.hasPermi('fgw:jdap:list')")
    @GetMapping("/list")
    public TableDataInfo list(FgwJdap fgwJdap)
    {
        startPage();
        List<FgwJdap> list = fgwJdapService.selectFgwJdapList(fgwJdap);
        return getDataTable(list);
    }

    /**
     * 导出发改委_节点安排列表
     */
    @PreAuthorize("@ss.hasPermi('fgw:jdap:export')")
    @Log(title = "发改委_节点安排", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, FgwJdap fgwJdap)
    {
        List<FgwJdap> list = fgwJdapService.selectFgwJdapList(fgwJdap);
        ExcelUtil<FgwJdap> util = new ExcelUtil<FgwJdap>(FgwJdap.class);
        util.exportExcel(response, list, "发改委_节点安排数据");
    }

    /**
     * 获取发改委_节点安排详细信息
     */
    @PreAuthorize("@ss.hasPermi('fgw:jdap:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(fgwJdapService.selectFgwJdapById(id));
    }

    /**
     * 新增发改委_节点安排
     */
    @PreAuthorize("@ss.hasPermi('fgw:jdap:add')")
    @Log(title = "发改委_节点安排", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JdapVo jdapVo)
    {
        return fgwJdapService.insertFgwJdap(jdapVo);
    }

    /**
     * 修改发改委_节点安排
     */
    //@PreAuthorize("@ss.hasPermi('fgw:jdap:edit')")
    @Log(title = "发改委_节点安排", businessType = BusinessType.UPDATE)
    @PostMapping("/put")
    public AjaxResult edit(@RequestBody FgwJdap fgwJdap)
    {
        return fgwJdapService.updateFgwJdap(fgwJdap);
    }

    /**
     * 审核发改委_节点安排
     */
    @PreAuthorize("@ss.hasPermi('fgw:jdap:jdsh')")
    @Log(title = "发改委_节点安排_jdsh", businessType = BusinessType.UPDATE)
    @GetMapping("/jdsh")
    public AjaxResult jdsh(String ids,String shyj,String shjg)
    {
        return toAjax(fgwJdapService.jdsh(ids,shyj,shjg));
    }

    /**
     * 发改委_节点安排_催报
     */
    @PreAuthorize("@ss.hasPermi('fgw:jdap:jdcb')")
    @Log(title = "发改委_节点安排_jdsh", businessType = BusinessType.UPDATE)
    @GetMapping("/cb/{id}")
    public AjaxResult cb(@PathVariable Long id)
    {
        return fgwJdapService.cb(id);
    }

    /**
     * 发改委_项目详情附件_催报
     * id 项目id
     * time 催办时限
     * name 附件类型名称
     */
    @PreAuthorize("@ss.hasPermi('fgw:xmxq:fjcb')")
    @GetMapping("/fj/cb")
    public AjaxResult fjcb(Long id,String time,String name)
    {
        return fgwJdapService.fjcb(id,time,name);
    }


    /**
     * 发改委_首页_催报
     * idList 项目idlist
     */
    @PreAuthorize("@ss.hasPermi('fgw:sytj:sycb')")
    @PostMapping("/sycb")
    public AjaxResult sycb(@RequestBody SbxmVo sbxmVo)
    {
        List<Long> idList = sbxmVo.getIdList();
        return fgwJdapService.sycb(idList);
    }

    /**
     * 删除发改委_节点安排
     */
    //@PreAuthorize("@ss.hasPermi('fgw:jdap:remove')")
    @Log(title = "发改委_节点安排", businessType = BusinessType.DELETE)
	@GetMapping("/delete/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(fgwJdapService.deleteFgwJdapByIds(ids));
    }
}
