package com.xhpc.order.controller;

import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.order.service.IXhpcStatisticsService;
import io.swagger.annotations.Api;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.*;

/**
 * @author yuyang
 * @date 2021/8/31 16:20
 * @Version 1.0
 */
@RestController
@RequestMapping("/statistics")
@Api(value = "统计接口", tags = "统计接口")
public class XhpcStatisticsController extends BaseController {

    @Autowired
    private IXhpcStatisticsService xhpcStatisticsService;
    /**
     * 小时统计
     * @param chargingStationIds         电站id集合
     * @param internetUserId      流量方id
     * @param operatorId          运营商id
     * @param startTime           订单开始时间
     * @param endTime             订单结束时间
     * @param userId              用户id
     * @param type             1 平台 2 运营商 3流量方
     * @return
     */
    @GetMapping("/getTimeIntervalPage")
    public TableDataInfo getTimeIntervalPage(HttpServletRequest request,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId,String chargingStationIds, Long internetUserId, Long operatorId, String startTime, String endTime,Long userId,Integer type)
    {
        List<Map<String, Object>> list = xhpcStatisticsService.getTimeIntervalPage(request,tenantId,chargingStationId,chargingPileId,terminalId,chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type);
        return getDataTable(list);
    }

    /**
     * 日期统计
     * @param chargingStationIds         电站id集合
     * @param internetUserId      流量方id
     * @param operatorId          运营商id
     * @param startTime           订单开始时间
     * @param endTime             订单结束时间
     * @param userId              用户id
     * @param type             1 平台 2 运营商 3流量方
     * @return
     */
    @GetMapping("/getDateIntervalPage")
    public TableDataInfo getDateIntervalPage(HttpServletRequest request,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId,String chargingStationIds,Long internetUserId, Long operatorId,String startTime, String endTime,Long userId, Integer type, String beginStartTime, String beginEndTime)
    {
        List<Map<String, Object>> list = xhpcStatisticsService.getDateIntervalPage(request,tenantId,chargingStationId,chargingPileId,terminalId,chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type,beginStartTime,beginEndTime);
        return getDataTable(list);
    }
    /**
     * 电站统计
     * @param chargingStationIds  电站集合
     * @param operatorIds       运营商集合
     * @param internetUserId      流量方id
     * @param operatorId          运营商id
     * @param startTime           订单开始时间
     * @param endTime             订单结束时间
     * @param userId              用户id
     * @param type             1 平台 2 运营商 3流量方
     * @return
     */
    @GetMapping("/getStationIntervalPage")
    public TableDataInfo getStationIntervalPage(HttpServletRequest request,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId,String chargingStationIds,String operatorIds,Long internetUserId, Long operatorId,String startTime, String endTime, Long userId, Integer type, String beginStartTime, String beginEndTime)
    {
        List<Map<String, Object>> list = xhpcStatisticsService.getStationIntervalPage(request,tenantId,chargingStationId,chargingPileId,terminalId,chargingStationIds,operatorIds,internetUserId,operatorId,startTime,endTime,userId,type,beginStartTime,beginEndTime);
        return getDataTable(list);
    }

    /**
     * 运营商统计
     * @param operatorIds        运营商集合
     * @param operatorId          运营商id
     * @param startTime           订单开始时间
     * @param endTime             订单结束时间
     * @param userId              用户id
     * @param type             1 平台 2 运营商 3流量方
     * @return
     */
    @GetMapping("/getOperatorIntervalPage")
    public TableDataInfo getOperatorIntervalPage(HttpServletRequest request,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId,String operatorIds, Long operatorId,String startTime, String endTime, Long userId,Integer type, String beginStartTime, String beginEndTime)
    {
        List<Map<String, Object>> list = xhpcStatisticsService.getOperatorIntervalPage(request,tenantId,chargingStationId,chargingPileId,terminalId,operatorIds,operatorId,startTime,endTime,userId,type,beginStartTime,beginEndTime);
        return getDataTable(list);
    }

    /**
     * 流量方统计
     * @param internetUserIds   流量方集合
     * @param internetUserId      流量方id
     * @param startTime           订单开始时间
     * @param endTime             订单结束时间
     * @param userId              用户id
     * @param type             1 平台 2 运营商 3流量方
     * @return
     */
    @GetMapping("/getInternetUserIntervalPage")
    public TableDataInfo getInternetUserIntervalPage(HttpServletRequest request,String internetUserIds,Long internetUserId,String startTime, String endTime, Long userId,Integer type, String beginStartTime, String beginEndTime)
    {
        startPage();
        List<Map<String, Object>> list = xhpcStatisticsService.getInternetUserIntervalPage(request,internetUserIds,internetUserId,startTime,endTime,userId,type,beginStartTime,beginEndTime);
        return getDataTable(list);
    }


    /**
     * 终端统计
     * @param chargingStationId  电站集合
     * @param terminalId        终端集合
     * @param operatorId          运营商id
     * @param startTime           订单开始时间
     * @param endTime             订单结束时间
     * @param userId              用户id
     * @param type             1 平台 2 运营商 3流量方
     * @return
     */
    @GetMapping("/getTerminalIntervalPage")
    public TableDataInfo getTerminalIntervalPage(HttpServletRequest request,String tenantId,Long chargingStationId,String terminalId,Long operatorId,String startTime, String endTime,Long userId,Integer type, String beginStartTime, String beginEndTime)
    {
        List<Map<String, Object>> list = xhpcStatisticsService.getTerminalIntervalPage(request,tenantId,chargingStationId,terminalId,operatorId,startTime,endTime,userId,type,beginStartTime,beginEndTime);
        return getDataTable(list);
    }

    /**
     * 电站列表
     * @param operatorId      运营商id
     * @param userId          用户id
     * @param type            1 平台 2 运营商 3流量方
     * @return
     */
    @GetMapping("/getChargingStationList")
    public AjaxResult getChargingStationList(HttpServletRequest request,String tenantId,Long operatorId,Long userId,Integer type)
    {

        return xhpcStatisticsService.getChargingStationList(request,tenantId,operatorId, userId, type);
    }

    /**
     *
     * @param request
     * @param tenantId
     * @param chargingStationId
     * @param operatorId
     * @param userId
     * @param type
     * @param display   0 桩名称带有场站 1 桩名称后不带名称
     * @return
     */
    @GetMapping("/getChargingPileList")
    public AjaxResult getChargingPileList(HttpServletRequest request,String tenantId,Long chargingStationId,Long operatorId, Long userId,Integer type,Integer display)
    {

        return xhpcStatisticsService.getChargingPileList(request,tenantId,chargingStationId,operatorId, userId, type,display);
    }


    /**
     * 运营商列表
     * @param operatorId      运营商id
     * @param userId          用户id
     * @param type            1 平台 2 运营商 3流量方
     * @return
     */
    @GetMapping("/getOperatorList")
    public AjaxResult getOperatorList(HttpServletRequest request,Long operatorId, Long userId,Integer type,String tenantId)
    {
        return xhpcStatisticsService.getOperatorList(request,operatorId, userId, type,tenantId);
    }

    /**
     * 租户列表
     * @return
     */
    @GetMapping("/getTenantList")
    public AjaxResult getTenantList()
    {
        return xhpcStatisticsService.getTenantList();
    }


    /**
     * 流量方列表
     * @param internetUserId  流量方id
     * @param userId          用户id
     * @param type            1 平台 2 运营商 3流量方
     * @return
     */
    @GetMapping("/getInternetUserIList")
    public AjaxResult getInternetUserIList(HttpServletRequest request,Long internetUserId, Long userId,Integer type)
    {
        return xhpcStatisticsService.getInternetUserIList(request,internetUserId, userId, type);
    }

    /**
     * 终端列表
     * @param chargingStationId  电站id
     * @param userId          用户id
     * @param type            1 平台 2 运营商 3流量方
     * @return
     */
    @GetMapping("/getTerminalList")
    public AjaxResult getTerminalList(HttpServletRequest request,String tenantId,Long operatorId,Long chargingStationId,Long chargingPileId,Long userId, Integer type) {

        return xhpcStatisticsService.getTerminalList(request,tenantId,operatorId,chargingStationId,chargingPileId, userId, type);
    }

    /**
     * 订单来源地方，权限划分
     * @param userId              用户id
     * @param type                1 平台 2 运营商 3流量方
     * @return
     */
    @GetMapping("/getSourceList")
    public AjaxResult getSourceList(HttpServletRequest request, Long userId,  Integer type) {
        return xhpcStatisticsService.getSourceList(request,userId, type);
    }

    /**
     * 订单来源（第三方、支付宝、微信、运营商），权限划分
     * @param internetUserIds     订单来源集合
     * @return
     */
    @GetMapping("/getSumSourceList")
    public TableDataInfo getSumSourceList(HttpServletRequest request,String tenantId,Long operatorId,Long chargingStationId,Long chargingPileId,Long terminalId,String startTime, String endTime, String internetUserIds, String chargingStationIds, String beginStartTime, String beginEndTime) {
        startPage();
        List<Map<String, Object>> list = xhpcStatisticsService.getSumSourceList(request,tenantId,operatorId,chargingStationId,chargingPileId,terminalId,startTime,endTime,internetUserIds,chargingStationIds,beginStartTime,beginEndTime);
        return getDataTable(list);
    }

    /**
     * 机构统计
     * @param chargingStationIds         电站id集合
     * @param internetUserId      流量方id
     * @param operatorId          运营商id
     * @param startTime           订单开始时间
     * @param endTime             订单结束时间
     * @param userId              用户id
     * @param type             1 平台 2 运营商 3流量方
     * @param source           订单来源（0 C端用户 1 流量方用户 2社区用户 3B端用户）
     * @return
     */
    @GetMapping("/getMechanismPage")
    public TableDataInfo getMechanismPage(HttpServletRequest request,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId,String chargingStationIds,Long internetUserId, Long operatorId,String startTime, String endTime, Long userId,Integer type,Integer source)
    {
        List<Map<String, Object>> list = xhpcStatisticsService.getMechanismPage(request,tenantId,chargingStationId,chargingPileId,terminalId,chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type,source);
        return getDataTable(list);
    }

    // -------- 导出数据 ------------


    /**
     * 小时统计导出
     * @param chargingStationIds         电站id集合
     * @param internetUserId      流量方id
     * @param operatorId          运营商id
     * @param startTime           订单开始时间
     * @param endTime             订单结束时间
     * @param userId              用户id
     * @param type             1 平台 2 运营商 3流量方
     * @return
     */
    @PostMapping("/timeInterval/export")
    public void timeIntervalExport(HttpServletRequest request,HttpServletResponse response,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId, String chargingStationIds,Long internetUserId, Long operatorId,String startTime, String endTime,Long userId,Integer type) throws IOException {
        xhpcStatisticsService.timeIntervalExport(request,response,tenantId,chargingStationId,chargingPileId,terminalId, chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type);
    }

    /**
     * 日期统计导出
     * @param chargingStationIds         电站id集合
     * @param internetUserId      流量方id
     * @param operatorId          运营商id
     * @param startTime           订单开始时间
     * @param endTime             订单结束时间
     * @param userId              用户id
     * @param type             1 平台 2 运营商 3流量方
     * @return
     */
    @PostMapping("/dateInterval/export")
    public void dateIntervalExport(HttpServletRequest request,HttpServletResponse response,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId, String chargingStationIds,Long internetUserId, Long operatorId,String startTime, String endTime,Long userId,Integer type, String beginStartTime, String beginEndTime) throws IOException {
        xhpcStatisticsService.dateIntervalExport(request,response,tenantId,chargingStationId,chargingPileId,terminalId, chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type,beginStartTime,beginEndTime);
    }
    /**
     * 电站统计导出
     * @param chargingStationIds  电站集合
     * @param operatorIds       运营商集合
     * @param internetUserId      流量方id
     * @param operatorId          运营商id
     * @param startTime           订单开始时间
     * @param endTime             订单结束时间
     * @param userId              用户id
     * @param type             1 平台 2 运营商 3流量方
     * @return
     */
    @PostMapping("/stationInterval/export")
    public void stationIntervalExport(HttpServletRequest request,HttpServletResponse response,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId, String chargingStationIds,String operatorIds,Long internetUserId, Long operatorId,String startTime, String endTime,Long userId,Integer type, String beginStartTime, String beginEndTime) throws IOException {
        xhpcStatisticsService.stationIntervalExport(request,response,tenantId,chargingStationId,chargingPileId,terminalId, chargingStationIds,operatorIds,internetUserId,operatorId,startTime,endTime,userId,type,beginStartTime,beginEndTime);
    }

    /**
     * 运营商统计导出
     * @param operatorIds        运营商集合
     * @param operatorId          运营商id
     * @param startTime           订单开始时间
     * @param endTime             订单结束时间
     * @param userId              用户id
     * @param type             1 平台 2 运营商 3流量方
     * @return
     */
    @PostMapping("/operatorInterval/export")
    public void operatorIntervalExport(HttpServletRequest request,HttpServletResponse response,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId, String operatorIds, Long operatorId,String startTime, String endTime,Long userId,Integer type, String beginStartTime, String beginEndTime) throws IOException {
        xhpcStatisticsService.operatorIntervalExport(request,response,tenantId,chargingStationId,chargingPileId,terminalId, operatorIds,operatorId,startTime,endTime,userId,type,beginStartTime,beginEndTime);
    }

    /**
     * 订单来源统计导出
     * @return
     */
    @PostMapping("/internetUserInterval/export")
    public void internetUserIntervalExport(HttpServletRequest request,HttpServletResponse response,String tenantId,Long operatorId,Long chargingStationId,Long chargingPileId,Long terminalId, String startTime, String endTime,String internetUserIds, String chargingStationIds, String beginStartTime, String beginEndTime) throws IOException {
        xhpcStatisticsService.getSumSourceListExport(request,response,tenantId,operatorId,chargingStationId,chargingPileId,terminalId, startTime,endTime,internetUserIds,chargingStationIds,beginStartTime,beginEndTime);
    }


    /**
     * 终端统计
     * @param chargingStationId  电站集合
     * @param terminalId        终端集合
     * @param operatorId          运营商id
     * @param startTime           订单开始时间
     * @param endTime             订单结束时间
     * @param userId              用户id
     * @param type             1 平台 2 运营商 3流量方
     * @return
     */
    @PostMapping("/terminalInterval/export")
    public void terminalIntervalExport(HttpServletRequest request,HttpServletResponse response,String tenantId, Long chargingStationId,String terminalId,Long operatorId,String startTime, String endTime,Long userId,Integer type, String beginStartTime, String beginEndTime) throws IOException {
        xhpcStatisticsService.terminalIntervalExport(request,response,tenantId, chargingStationId,terminalId,operatorId,startTime,endTime,userId,type,beginStartTime,beginEndTime);
    }

    /**
     * 机构导出
     * @param chargingStationIds         电站id集合
     * @param internetUserId      流量方id
     * @param operatorId          运营商id
     * @param startTime           订单开始时间
     * @param endTime             订单结束时间
     * @param userId              用户id
     * @param type             1 平台 2 运营商 3流量方
     * @param source           订单来源（0 C端用户 1 流量方用户 2社区用户 3B端用户）
     * @return
     */
    @PostMapping("/getMechanismPage/export")
    public void getMechanismExport(HttpServletRequest request,HttpServletResponse response,String tenantId,Long chargingStationId,Long chargingPileId,Long terminalId,String chargingStationIds,Long internetUserId, Long operatorId,String startTime, String endTime,Long userId,Integer type,@RequestParam("source")Integer source)throws IOException
    {
        xhpcStatisticsService.getMechanismExport(request,response,tenantId,chargingStationId,chargingPileId,terminalId,chargingStationIds,internetUserId,operatorId,startTime,endTime,userId,type,source);
    }



    //-------------------------------------------------首页------------------------------------------------------------

    /**
     * 今日订单量
     */
    @GetMapping("/getToday")
    public AjaxResult getToday(Long operatorId,Long chargingStationId,Long chargingPileId,Integer type)
    {
        return AjaxResult.success(xhpcStatisticsService.getToday(operatorId,chargingStationId,chargingPileId,type));
    }


    @GetMapping("/getOrderElectricityQuantity")
    public AjaxResult getOrderElectricityQuantity(Long operatorId,Long chargingStationId,Long chargingPileId,Integer type)
    {
        return AjaxResult.success(xhpcStatisticsService.getOrderElectricityQuantity(operatorId,chargingStationId,chargingPileId,type));
    }

    @GetMapping("/getTodayRrevenue")
    public AjaxResult getTodayRrevenue(Long operatorId,Long chargingStationId,Long chargingPileId,Integer type)
    {
        return AjaxResult.success(xhpcStatisticsService.getTodayRrevenue(operatorId,chargingStationId,chargingPileId,type));
    }

    /**
     * 今日电枪实时状态
     */
    @GetMapping("/getTodayTerminal")
    public AjaxResult getTodayTerminal(Long operatorId,Long chargingStationId,Long chargingPileId)
    {
        return AjaxResult.success(xhpcStatisticsService.getTodayTerminal(operatorId,chargingStationId,chargingPileId));
    }

    /**
     * 充电数据
     * @param type       1 近30天 2上个月 3本月 4.近12月
     */
    @GetMapping("/getDateOrder")
    public AjaxResult getDateOrder(Long operatorId,Long chargingStationId,Long chargingPileId,Integer type,String startTime,String endTime)
    {
        return AjaxResult.success(xhpcStatisticsService.getDateOrder(1,operatorId,chargingStationId,chargingPileId,type,startTime,endTime));
    }

    /**
     * 创建订单量
     * @param type       1 近30天 2上个月 3本月 4.近12月
     */
    @GetMapping("/getDateOrderCount")
    public AjaxResult getDateOrderCount(Long operatorId,Long chargingStationId,Long chargingPileId,Integer type,String startTime,String endTime)
    {
        return AjaxResult.success(xhpcStatisticsService.getDateOrder(2,operatorId,chargingStationId,chargingPileId,type,startTime,endTime));
    }


    //-----------------------------------------运维统计------------------------------------------------------------


    /**
     * 空订单统计
     */
    @GetMapping("/getEmptyOrder")
    public AjaxResult getEmptyOrder(Long chargingStationId,@RequestParam(value = "startTime")String startTime,@RequestParam(value = "endTime")String endTime)
    {
        return AjaxResult.success(xhpcStatisticsService.getEmptyOrder(chargingStationId,startTime,endTime));
    }

    /**
     * 异常订单量列表统计
     * @param type       1 近30天 2上个月 3本月 4.近12月
     */
    @GetMapping("/getWorkHistoryOrderList")
    public AjaxResult getWorkHistoryOrderList(Long operatorId,Long chargingStationId,Long chargingPileId,Long terminalId,String stopReason,@RequestParam(value = "startTime", required = true)String startTime,@RequestParam(value = "endTime", required = true)String endTime,Integer type){
        return AjaxResult.success(xhpcStatisticsService.getWorkHistoryOrderList(operatorId,chargingStationId,chargingPileId,terminalId,stopReason,startTime,endTime,type));
    }

    /**
     * 工单类型统计
     * @return
     */
    @GetMapping("/getWorkOrderNumber")
    public AjaxResult getWorkOrderNumber(){
        return AjaxResult.success(xhpcStatisticsService.getWorkOrderNumber());
    }

    @GetMapping("/getChargeOrderFaultPage")
    public TableDataInfo getChargeOrderFaultPage(HttpServletRequest request,Long chargingStationId,String serialNumber,String startTime, String endTime)
    {
        startPage();
        List<Map<String, Object>> list = xhpcStatisticsService.getChargeOrderFaultPage(request,chargingStationId,serialNumber,startTime,endTime);
        return getDataTable(list);
    }

    @PostMapping("/getChargeOrderFaultPage/export")
    public void getChargeOrderFaultPageExport(HttpServletRequest request,HttpServletResponse response,Long chargingStationId,String serialNumber,String startTime, String endTime)throws IOException
    {
        xhpcStatisticsService.getChargeOrderFaultPageExport(request,response,chargingStationId,serialNumber,startTime,endTime);
    }

    /**
     * 工单类型统计
     * @return
     */
    @GetMapping("/getHistoryOrderMassage")
    public AjaxResult getHistoryOrderMassage(Long chargeOrderId){
        return AjaxResult.success(xhpcStatisticsService.getHistoryOrderMassage(chargeOrderId));
    }


    /**
     * 桩离线统计
     */
    @GetMapping("/getChargingPileStatusPage")
    public TableDataInfo getChargingPileStatusPage(HttpServletRequest request,String chargingStationId,String serialNumber,String statusName,String startTime, String endTime)
    {
        List<Map<String, Object>> list = xhpcStatisticsService.getChargingPileStatusPage(request,chargingStationId,serialNumber,statusName,startTime,endTime);
        return getDataTable(list);
    }

    @PostMapping("/getChargingPileStatusPage/export")
    public void getChargingPileStatusPageExport(HttpServletRequest request,HttpServletResponse response,String chargingStationId,String serialNumber,String statusName,String startTime, String endTime)throws IOException
    {
        xhpcStatisticsService.getChargingPileStatusPageExport(request,response,chargingStationId,serialNumber,statusName,startTime,endTime);
    }



    //-----------------------运维小程序----getDataBoard--------------------
    @GetMapping("/getDataBoard")
    public AjaxResult getDataBoard(){
        Map<String,Object> map1 =new HashMap<>();
        map1.put("stationSum",11);
        map1.put("abnormalStation",1);
        map1.put("todayOrder",236);
        map1.put("emptyOrderRate","23.56");
        map1.put("completionRate","75%");
        map1.put("onlineRate","93.5%");
        return AjaxResult.success(map1);
    }

    @GetMapping("/getRealTimeWarning")
    public AjaxResult getRealTimeWarning(){
        List<Map<String,Object>> mapList =new ArrayList<>();

        Map<String,Object> map1 =new HashMap<>();
        map1.put("stationName","小华充电团结平安村充电站");
        map1.put("terminalName","4号桩B枪");
        map1.put("time","2026-2-5 08:35:45");
        map1.put("conent","离线时间超过2小时");
        mapList.add(map1);

        Map<String,Object> map2 =new HashMap<>();
        map2.put("stationName","小华充电团结平安村充电站");
        map2.put("terminalName","3号桩B枪");
        map2.put("time","2026-2-4 08:35:45");
        map2.put("conent","离线时间超过1小时");
        mapList.add(map2);


        return AjaxResult.success(mapList);
    }


    @GetMapping("/getStationList")
    public AjaxResult getStationList() {
        //stationName：场站名称  twoDayOrder：订单量  emptyOrderRate：空订单率
        //    normal：正常  offline：离线  fault：故障 "未知": 3
        List<Map<String, Object>> mapList = new ArrayList<>();

        Map<String, Object> map1 = new HashMap<>();
        map1.put("stationName", "小华充电团结平安村充电站");
        map1.put("stationId",1);
        map1.put("twoDayOrder", "243");
        map1.put("emptyOrderRate", "34.8%");
        map1.put("normal", 7);
        map1.put("offline", 1);
        map1.put("fault", 2);
        map1.put("unknown", 3);
        mapList.add(map1);

        Map<String, Object> map2 = new HashMap<>();
        map2.put("stationName", "小华充电高堆路充电站");
        map2.put("stationId",2);
        map2.put("twoDayOrder", "2430");
        map2.put("emptyOrderRate", "34.8%");
        map2.put("normal", 15);
        map2.put("offline", 1);
        map2.put("fault", 2);
        map2.put("unknown", 3);
        mapList.add(map2);
        return AjaxResult.success(mapList);
    }



    @GetMapping("/getInspectionList")
    public AjaxResult getInspectionList(@Param("stationId") Long stationId,String time) {
        //stationName：场站名称  twoDayOrder：订单量  emptyOrderRate：空订单率
        //    normal：正常  offline：离线  fault：故障 "未知": 3
        // 系统自动生成每日巡检项23：50
        List<Map<String, Object>> mapList = new ArrayList<>();

        Map<String, Object> map1 = new HashMap<>();
        map1.put("name", "箱变");
        map1.put("status", 0);
        map1.put("id", "XB");
        mapList.add(map1);

        Map<String, Object> map2 = new HashMap<>();
        map2.put("name", "监控");
        map2.put("status", 1);
        map2.put("id", "JK");
        mapList.add(map2);

        Map<String, Object> map3 = new HashMap<>();
        map3.put("name", "道闸");
        map3.put("status", 1);
        map3.put("id", "DZ");
        mapList.add(map3);

        Map<String, Object> map4 = new HashMap<>();
        map4.put("name", "远程连接");
        map4.put("status", 1);
        map4.put("id", "YC");
        mapList.add(map4);

        Map<String, Object> map5 = new HashMap<>();
        map5.put("name", "1号桩");
        map5.put("status", 1);
        map5.put("id", "1");
        mapList.add(map5);

        Map<String, Object> map6 = new HashMap<>();
        map6.put("name", "2号桩");
        map6.put("status", 0);
        map6.put("id", "2");
        map6.put("errorName", "A枪故障");
        mapList.add(map6);

        Map<String, Object> map7 = new HashMap<>();
        map7.put("name", "3号桩");
        map7.put("status", 0);
        map7.put("id", "3");
        mapList.add(map7);

        Map<String, Object> map8 = new HashMap<>();
        map8.put("name", "4号桩");
        map8.put("status", 0);
        map8.put("id", "4");
        mapList.add(map8);

        Map<String, Object> map9 = new HashMap<>();
        map9.put("name", "5号桩");
        map9.put("status", 0);
        map9.put("id", "5");
        mapList.add(map9);

        Map<String, Object> map10 = new HashMap<>();
        map10.put("name", "6号桩");
        map10.put("status", 3);
        map10.put("id", "6");
        map6.put("errorName", "停用");
        mapList.add(map10);

        Map<String, Object> map11 = new HashMap<>();
        map11.put("name", "7号桩");
        map11.put("status", 0);
        map11.put("id", "7");
        mapList.add(map11);

        Map<String, Object> map12 = new HashMap<>();
        map12.put("name", "8号桩");
        map12.put("status", 0);
        map12.put("id", "8");
        mapList.add(map12);

        Map<String, Object> map13 = new HashMap<>();
        map13.put("name", "9号桩");
        map13.put("status", 0);
        map13.put("id", "9");
        mapList.add(map13);

        Map<String, Object> map14 = new HashMap<>();
        map14.put("name", "10号桩");
        map14.put("status", 0);
        map14.put("id", "10");
        mapList.add(map14);

        return AjaxResult.success(mapList);
    }

    @GetMapping("/getInspectionById")
    public AjaxResult getInspectionById(@Param("stationId") Long stationId,@Param("id") String id) {
        //stationName：场站名称  twoDayOrder：订单量  emptyOrderRate：空订单率
        //    normal：正常  offline：离线  fault：故障 "未知": 3

        if(stationId==1L && id.equals("XB")){
            Map<String, Object> map1 = new HashMap<>();
            map1.put("status", 1);
            map1.put("inspectionImg", "avatar/032dacfa3b87aa4e11e62bbefcd5352.png,avatar/logo.png");
            map1.put("faultImg", "");
            map1.put("faultDescription", "");
            map1.put("maintenanceRecord", "");

            return AjaxResult.success(map1);
        }else if(stationId==1L && id.equals("DZ")){
            Map<String, Object> map1 = new HashMap<>();
            map1.put("status", 2);
            map1.put("inspectionImg", "avatar/032dacfa3b87aa4e11e62bbefcd5352.png,avatar/logo.png");
            map1.put("faultImg", "power/11.png,power/222.jpg,power/333.jpg");
            map1.put("faultDescription", "显示屏损坏");
            map1.put("maintenanceRecord", "已更换显示屏");

            return AjaxResult.success(map1);
        }

        return AjaxResult.success();
    }

}
