package com.ruoyi.ibs.grid.controller;

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

import com.ruoyi.ibs.grid.domain.entity.GridShapeCountLingshou;
import com.ruoyi.ibs.grid.domain.entity.GridShapeCustGongsi;
import com.ruoyi.ibs.grid.domain.entity.GridShapeCustLingshou;
import com.ruoyi.ibs.grid.domain.entity.GridVirtualCustGongsi;
import com.ruoyi.ibs.grid.domain.entity.GridVirtualCustLingshou;
import org.springframework.security.access.prepost.PreAuthorize;
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.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.ibs.grid.domain.entity.GridShapeCountGongsi;
import com.ruoyi.ibs.grid.service.IGridShapeCountService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 自定义地图网格汇总统计Controller
 * 
 * @author ruoyi
 * @date 2025-05-06
 */
@RestController
@RequestMapping("/system/gridShapeCount")
public class GridShapeCountController extends BaseController
{
    @Autowired
    private IGridShapeCountService gridShapeCountService;

    /**
     * 查询自定义地图网格汇总统计_公司列表
     */
//    @PreAuthorize("@ss.hasPermi('system::list')")
    @GetMapping("/gsList")
    public TableDataInfo gsList(String shapeType ,String shapeName, String gridName,String dt)
    {
        startPage();
        List<GridShapeCountGongsi> list = gridShapeCountService.selectGridShapeCountGongsiList(shapeType,shapeName, gridName,dt);
        return getDataTable(list);
    }

    /**
     * 查询自定义地图网格汇总统计_零售列表
     */
    @GetMapping("/lsList")
    public TableDataInfo lsList(String shapeType ,String shapeName, String gridName,String dt)
    {
        startPage();
        List<GridShapeCountLingshou> list = gridShapeCountService.selectGridShapeCountLingshouList(shapeType,shapeName, gridName,dt);
        return getDataTable(list);
    }

    @GetMapping("/gsCustList")
    public TableDataInfo gsCustList(String shapeId ,String custName, String custIdc,String dt)
    {
        startPage();
        List<GridShapeCustGongsi> list = gridShapeCountService.selectGridShapeCountgsCustList(shapeId, custName, custIdc,dt);
        return getDataTable(list);
    }

    @GetMapping("/lsCustList")
    public TableDataInfo lsCustList(String shapeId ,String custName, String custIdc,String dt)
    {
        startPage();
        List<GridShapeCustLingshou> list = gridShapeCountService.selectGridShapeCountlsCustList(shapeId, custName, custIdc,dt);
        return getDataTable(list);
    }
//
//    /**
//     * 导出自定义地图网格汇总统计_公司列表
//     */
////    @PreAuthorize("@ss.hasPermi('system::export')")
//    @Log(title = "自定义地图网格汇总统计_公司", businessType = BusinessType.EXPORT)
//    @PostMapping("/gsExport")
//    public void gsExport(HttpServletResponse response, String shapeType ,String shapeName, String gridName)
//    {
//        List<GridShapeCountGongsi> list = gridShapeCountService.selectGridShapeCountGongsiList(shapeType,shapeName, gridName);
//        ExcelUtil<GridShapeCountGongsi> util = new ExcelUtil<GridShapeCountGongsi>(GridShapeCountGongsi.class);
//        util.exportExcel(response, list, "自定义地图网格汇总统计_公司数据");
//    }
//
//    @Log(title = "自定义地图网格汇总统计_零售", businessType = BusinessType.EXPORT)
//    @PostMapping("/lsExport")
//    public void lsExport(HttpServletResponse response, String shapeType ,String shapeName, String gridName)
//    {
//        List<GridShapeCountLingshou> list = gridShapeCountService.selectGridShapeCountLingshouList(shapeType,shapeName, gridName);
//        ExcelUtil<GridShapeCountLingshou> util = new ExcelUtil<GridShapeCountLingshou>(GridShapeCountLingshou.class);
//        util.exportExcel(response, list, "自定义地图网格汇总统计_公司数据");
//    }
//
//    @Log(title = "导出公司网格明细数据")
//    @PostMapping("/gsmxExport")
//    public void exportGsmx(HttpServletResponse response, String shapeId ,String custName, String custIdc) {
//        try {
//            ExcelUtil<GridShapeCustGongsi> util = new ExcelUtil<>(GridShapeCustGongsi.class);
//            util.exportExcel(response, gridShapeCountService.selectGridShapeCountgsCustList(shapeId, custName, custIdc), "公司网格客户明细汇总");
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//    }
//
//    @Log(title = "导出零售网格明细数据")
//    @PostMapping("/lsmxExport")
//    public void exportLsmx(HttpServletResponse response, String shapeId ,String custName, String custIdc) {
//        try {
//            ExcelUtil<GridShapeCustLingshou> util = new ExcelUtil<>(GridShapeCustLingshou.class);
//            util.exportExcel(response, gridShapeCountService.selectGridShapeCountlsCustList(shapeId, custName, custIdc), "零售网格客户明细汇总");
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//    }

}
