package com.yeejoin.equipmanage.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.equipmanage.common.utils.*;
import com.yeejoin.equipmanage.common.vo.AlarmDataVO;
import com.yeejoin.equipmanage.common.vo.AlarmEquipMockDataVO;
import com.yeejoin.equipmanage.common.vo.AlarmListDataVO;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificMapper;
import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;

import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author keyong
 * @title: EquipmentAlarmController
 * <pre>
 * @description: 设备告警
 * </pre>
 * @date 2020/12/22 13:54
 */
@RestController
@Api(tags = "设备告警Api")
@RequestMapping(value = "/equipment-alarm", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class EquipmentAlarmController extends AbstractBaseController {

    @Autowired
    IEquipmentSpecificAlarmService iEquipmentSpecificAlarmService;

    @Autowired
    private EquipmentSpecificMapper equipmentSpecificMapper;

    @Value("${equip.enabled}")
   private  Boolean equioEnabled;
    /**
     * 列表列名
     *
     * @return
     */
    @RequestMapping(value = "/column/title", method = RequestMethod.GET)
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @ApiOperation(httpMethod = "GET", value = "列表获取列名", produces = "application/json;charset=UTF-8", notes = "列表获取列名")
    public ResponseModel listColumnName(@RequestParam(value = "alarmType", required = false) String alarmType) {
        List<HashMap<String, Object>> list = iEquipmentSpecificAlarmService.getColumn(alarmType);
        return CommonResponseUtil.success(list);
    }

    /**
     * 设备告警信息导出
     *
     * @return
     */
    @RequestMapping(value = "/downList", method = RequestMethod.GET)
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @ApiOperation(httpMethod = "GET", value = "告警信息导出", notes = "告警信息导出")
    public void downList(HttpServletResponse response, @RequestParam(value = "ids", required = false) List<Long> ids,
                         @RequestParam(value = "alarmType") String alarmType) {
        iEquipmentSpecificAlarmService.handleExport(response, ids, alarmType);
    }

    /**
     * 列表分页查询
     *
     * @return
     */
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @ApiOperation(httpMethod = "GET", value = "列表分页查询", produces = "application/json;charset=UTF-8", notes = "列表分页查询")
    public ResponseModel listPage(@RequestParam(value = "beginDate", required = false) String beginDate,
                                  @RequestParam(value = "endDate", required = false) String endDate,
                                  @RequestParam(value = "warehouseStructureName", required = false) String warehouseStructureName,
                                  @RequestParam(value = "equipCode", required = false) String equipCode,
                                  @RequestParam(value = "handleStatus", required = false) String handleStatus,
                                  @RequestParam(value = "system", required = false) String system,
                                  @RequestParam(value = "systemCode", required = false) String systemCode,
                                  @RequestParam(value = "alarmType", required = false) String alarmType,
                                  @RequestParam(value = "type", required = false) String type,
                                  @RequestParam(value = "buildIds", required = false) List<String> buildIds,
                                  @RequestParam(value = "id", required = false) String id,
                                  @RequestParam(value = "cleanStatus", required = false) String cleanStatus,
                                  @RequestParam(value = "isRemoveShield", required = false) String isRemoveShield,
                                  CommonPageable commonPageable) {
        if (commonPageable.getPageNumber() == 0) {
            commonPageable.setPageNumber(1);
        }
        ReginParams reginParams = getSelectedOrgInfo();
        List<CommonRequest> queryRequests = new ArrayList<>();
        CommonRequest request = new CommonRequest();
        request.setName("beginDate");
        request.setValue(StringUtil.isNotEmpty(beginDate) ? StringUtils.trimToNull(beginDate).substring(0, 10) + " 00:00:00" : null);
        queryRequests.add(request);
        CommonRequest request1 = new CommonRequest();
        request1.setName("endDate");
        request1.setValue(StringUtil.isNotEmpty(endDate) ? StringUtils.trimToNull(endDate).substring(0, 10) + " 23:59:59" : null);
        queryRequests.add(request1);
        CommonRequest request2 = new CommonRequest();
        request2.setName("warehouseStructureName");
        request2.setValue(StringUtil.isNotEmpty(warehouseStructureName) ? StringUtils.trimToNull(warehouseStructureName) : null);
        queryRequests.add(request2);
        CommonRequest request3 = new CommonRequest();
        request3.setName("equipCode");
        request3.setValue(StringUtil.isNotEmpty(equipCode) ? StringUtils.trimToNull(equipCode) : null);
        queryRequests.add(request3);
        CommonRequest request4 = new CommonRequest();
        request4.setName("alarmType");
        request4.setValue(StringUtil.isNotEmpty(alarmType) ? StringUtils.trimToNull(alarmType) : null);
        queryRequests.add(request4);
        CommonRequest request5 = new CommonRequest();
        request5.setName("orgCode");
        request5.setValue(null);
        queryRequests.add(request5);
        CommonRequest request6 = new CommonRequest();
        request6.setName("handleStatus");
        request6.setValue(StringUtil.isNotEmpty(handleStatus) ? StringUtils.trimToNull(handleStatus) : null);
        queryRequests.add(request6);
        CommonRequest request7 = new CommonRequest();
        request7.setName("system");
        request7.setValue(StringUtil.isNotEmpty(system) ? StringUtils.trimToNull(system) : null);
        queryRequests.add(request7);
        CommonRequest request8 = new CommonRequest();
        request8.setName("type");
        request8.setValue(StringUtil.isNotEmpty(type) ? StringUtils.trimToNull(type) : null);
        queryRequests.add(request8);
        CommonRequest request9 = new CommonRequest();
        request9.setName("buildIds");
        request9.setValue(ObjectUtils.isEmpty(buildIds) ? null : buildIds);
        queryRequests.add(request9);
        CommonRequest request10 = new CommonRequest();
        request10.setName("id");
        request10.setValue(StringUtil.isNotEmpty(id) ? StringUtils.trimToNull(id) : null);
        queryRequests.add(request10);
        CommonRequest request11 = new CommonRequest();
        request11.setName("cleanStatus");
        request11.setValue(StringUtil.isNotEmpty(cleanStatus) ? StringUtils.trimToNull(cleanStatus) : null);
        queryRequests.add(request11);
        CommonRequest request12 = new CommonRequest();
        request12.setName("isRemoveShield");
        request12.setValue(StringUtil.isNotEmpty(isRemoveShield) ? StringUtils.trimToNull(isRemoveShield) : null);
        queryRequests.add(request12);
        CommonRequest request14 = new CommonRequest();
        request14.setName("systemCode");
        request14.setValue(StringUtil.isNotEmpty(systemCode) ? StringUtils.trimToNull(systemCode) : null);
        queryRequests.add(request14);
        if (equioEnabled) {
            if (!ValidationUtil.isEmpty(reginParams.getPersonIdentity())) {
                CommonRequest request13 = new CommonRequest();
                request13.setName("bizOrgCode");
                request13.setValue(StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null);
                queryRequests.add(request13);
            }
        }else {
            CommonRequest request13 = new CommonRequest();
            request13.setName("bizOrgCode");
            request13.setValue("");
        }
        CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
        Page<Map<String, Object>> list = iEquipmentSpecificAlarmService.listPage(param);
        return CommonResponseUtil.success(list);
    }

    /**
     * 稳压泵跑马灯消息已读列表分页查询
     *
     * @return
     */
    @RequestMapping(value = "/allList", method = RequestMethod.GET)
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @ApiOperation(httpMethod = "GET", value = "列表分页查询", produces = "application/json;charset=UTF-8", notes = "列表分页查询")
    public ResponseModel allList(@RequestParam(value = "beginDate", required = false) String beginDate,
                                  @RequestParam(value = "endDate", required = false) String endDate,
                                  @RequestParam(value = "warehouseStructureName", required = false) String warehouseStructureName,
                                  @RequestParam(value = "equipCode", required = false) String equipCode,
                                  @RequestParam(value = "handleStatus", required = false) String handleStatus,
                                  @RequestParam(value = "system", required = false) String system,
                                  @RequestParam(value = "alarmType", required = false) String alarmType,
                                  @RequestParam(value = "type", required = false) String type,
                                  @RequestParam(value = "buildIds", required = false) List<String> buildIds,
                                  @RequestParam(value = "id", required = false) String id,
                                  @RequestParam(value = "cleanStatus", required = false) String cleanStatus,
                                  @RequestParam(value = "isRemoveShield", required = false) String isRemoveShield,
                                  CommonPageable commonPageable) {
        if (commonPageable.getPageNumber() == 0) {
            commonPageable.setPageNumber(1);
        }
        ReginParams reginParams = getSelectedOrgInfo();
        List<CommonRequest> queryRequests = new ArrayList<>();
        CommonRequest request = new CommonRequest();
        request.setName("beginDate");
        request.setValue(StringUtil.isNotEmpty(beginDate) ? StringUtils.trimToNull(beginDate).substring(0, 10) + " 00:00:00" : null);
        queryRequests.add(request);
        CommonRequest request1 = new CommonRequest();
        request1.setName("endDate");
        request1.setValue(StringUtil.isNotEmpty(endDate) ? StringUtils.trimToNull(endDate).substring(0, 10) + " 23:59:59" : null);
        queryRequests.add(request1);
        CommonRequest request2 = new CommonRequest();
        request2.setName("warehouseStructureName");
        request2.setValue(StringUtil.isNotEmpty(warehouseStructureName) ? StringUtils.trimToNull(warehouseStructureName) : null);
        queryRequests.add(request2);
        CommonRequest request3 = new CommonRequest();
        request3.setName("equipCode");
        request3.setValue(StringUtil.isNotEmpty(equipCode) ? StringUtils.trimToNull(equipCode) : null);
        queryRequests.add(request3);
        CommonRequest request4 = new CommonRequest();
        request4.setName("alarmType");
        request4.setValue(StringUtil.isNotEmpty(alarmType) ? StringUtils.trimToNull(alarmType) : null);
        queryRequests.add(request4);
        CommonRequest request5 = new CommonRequest();
        request5.setName("orgCode");
        request5.setValue(null);
        queryRequests.add(request5);
        CommonRequest request6 = new CommonRequest();
        request6.setName("handleStatus");
        request6.setValue(StringUtil.isNotEmpty(handleStatus) ? StringUtils.trimToNull(handleStatus) : null);
        queryRequests.add(request6);
        CommonRequest request7 = new CommonRequest();
        request7.setName("system");
        request7.setValue(StringUtil.isNotEmpty(system) ? StringUtils.trimToNull(system) : null);
        queryRequests.add(request7);
        CommonRequest request8 = new CommonRequest();
        request8.setName("type");
        request8.setValue(StringUtil.isNotEmpty(type) ? StringUtils.trimToNull(type) : null);
        queryRequests.add(request8);
        CommonRequest request9 = new CommonRequest();
        request9.setName("buildIds");
        request9.setValue(ObjectUtils.isEmpty(buildIds) ? null : buildIds);
        queryRequests.add(request9);
        CommonRequest request10 = new CommonRequest();
        request10.setName("id");
        request10.setValue(StringUtil.isNotEmpty(id) ? StringUtils.trimToNull(id) : null);
        queryRequests.add(request10);
        CommonRequest request11 = new CommonRequest();
        request11.setName("cleanStatus");
        request11.setValue(StringUtil.isNotEmpty(cleanStatus) ? StringUtils.trimToNull(cleanStatus) : null);
        queryRequests.add(request11);
        CommonRequest request12 = new CommonRequest();
        request12.setName("isRemoveShield");
        request12.setValue(StringUtil.isNotEmpty(isRemoveShield) ? StringUtils.trimToNull(isRemoveShield) : null);
        queryRequests.add(request12);
        if (equioEnabled) {
            if (!ValidationUtil.isEmpty(reginParams.getPersonIdentity())) {
                CommonRequest request13 = new CommonRequest();
                request13.setName("bizOrgCode");
                request13.setValue(StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null);
                queryRequests.add(request13);
            }
        }else {
            CommonRequest request13 = new CommonRequest();
            request13.setName("bizOrgCode");
            request13.setValue("");
        }
        CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
        List<Map<String, Object>> list = iEquipmentSpecificAlarmService.allList(param);
        return CommonResponseUtil.success(list);
    }

    @RequestMapping(value = "/updateReadStatus", method = RequestMethod.GET)
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @ApiOperation(httpMethod = "GET", value = "修改消息已读状态", produces = "application/json;charset=UTF-8", notes = "修改消息已读状态")
    public ResponseModel updateReadStatus(@RequestParam(value = "messageId") String messageId) {
        return CommonResponseUtil.success(iEquipmentSpecificAlarmService.updateReadStatus(messageId));
    }

    /**
     * 通过id获取告警详情
     *
     * @return
     */
    @RequestMapping(value = "/detail/alarm", method = RequestMethod.GET)
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @ApiOperation(httpMethod = "GET", value = "获取告警详情", produces = "application/json;charset=UTF-8", notes = "获取告警详情")
    public ResponseModel alarmDetail(@RequestParam(value = "id") Long id, @RequestParam(value = "alarmType") String alarmType) {
        List<AlarmDataVO> list = iEquipmentSpecificAlarmService.getAlarmDetailById(id, alarmType);
        return CommonResponseUtil.success(list);
    }

    /**
     * 通过id获取设备详情
     *
     * @return
     */
    @RequestMapping(value = "/detail/equipment", method = RequestMethod.GET)
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @ApiOperation(httpMethod = "GET", value = "获取设备详情", produces = "application/json;charset=UTF-8", notes = "获取设备详情")
    public ResponseModel equipmentDetail(@RequestParam(value = "id") Long id, @RequestParam(value = "alarmType") String alarmType) {
        AlarmEquipMockDataVO alarmEquipMockDataVO = iEquipmentSpecificAlarmService.getEquipmentDetailById(id, alarmType);
        return CommonResponseUtil.success(alarmEquipMockDataVO);
    }

    /**
     * 详情
     *
     * @return
     */
    @RequestMapping(value = "/detail", method = RequestMethod.GET)
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @ApiOperation(httpMethod = "GET", value = "获取详情", produces = "application/json;charset=UTF-8", notes = "获取详情")
    public ResponseModel detail(@RequestParam(value = "id") Long id) {
        Map<String, Object> result = iEquipmentSpecificAlarmService.detail(id);
        return CommonResponseUtil.success(result);
    }

    /**
     * 数字换流站警情列表分页查询
     *
     * @return
     */
    @RequestMapping(value = "/lingZhou/list", method = RequestMethod.GET)
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @ApiOperation(httpMethod = "GET", value = "数字换流站列表分页查询", produces = "application/json;charset=UTF-8", notes = "数字换流站列表分页查询")
    public ResponseModel listAlarmsPage(@RequestParam(value = "beginDate", required = false) String beginDate,
                                        @RequestParam(value = "endDate", required = false) String endDate,
                                        @RequestParam(value = "warehouseStructureName", required = false) String warehouseStructureName,
                                        // 此处equipCode指的是equipmentSpecificCode
                                        @RequestParam(value = "equipCode", required = false) String equipCode,
                                        @RequestParam(value = "equipDetailCode", required = false) String equipDetailCode,
                                        @RequestParam(value = "confirmType", required = false) String confirmType,
                                        @RequestParam(value = "alarmType", required = false) String alarmType,
                                        @RequestParam(value = "systemCode", required = false) String systemCode,
                                        @RequestParam(value = "buildId", required = false) String buildId,
                                        @RequestParam(value = "isRemoveShield", required = false) String isRemoveShield,
                                        @RequestParam(value = "id", required = false) String id,
                                        @RequestParam(value = "cleanStatus", required = false) String cleanStatus,
                                        @RequestParam(value = "isRemovedFire", required = false) String isRemovedFire,
                                        @RequestParam(value = "equipmentCode", required = false) String equipmentCode,
                                        @RequestParam(value = "indexTypeCode", required = false) String indexTypeCode,
                                        @RequestParam(value = "specificIndexKey", required = false) String specificIndexKey,
                                        @RequestParam(value = "alarmLogId", required = false) String alarmLogId,
                                        CommonPageable commonPageable) {
        List<CommonRequest> queryRequests = new ArrayList<>();
        ReginParams reginParams = getSelectedOrgInfo();
        CommonRequest request = new CommonRequest();
        request.setName("beginDate");
        request.setValue(StringUtil.isNotEmpty(beginDate) ? StringUtils.trimToNull(beginDate).substring(0, 10) + " 00:00:00" : null);
        queryRequests.add(request);
        CommonRequest request1 = new CommonRequest();
        request1.setName("endDate");
        request1.setValue(StringUtil.isNotEmpty(endDate) ? StringUtils.trimToNull(endDate).substring(0, 10) + " 23:59:59" : null);
        queryRequests.add(request1);
        CommonRequest request2 = new CommonRequest();
        request2.setName("warehouseStructureName");
        request2.setValue(StringUtil.isNotEmpty(warehouseStructureName) ? StringUtils.trimToNull(warehouseStructureName) : null);
        queryRequests.add(request2);
        CommonRequest request3 = new CommonRequest();
        request3.setName("equipCode");
        request3.setValue(StringUtil.isNotEmpty(equipCode) ? StringUtils.trimToNull(equipCode) : null);
        queryRequests.add(request3);
        CommonRequest request6 = new CommonRequest();
        // confirmType: '' 为全部数据 0 为未确认 1为已确认 2未消除 3已消除
        request6.setName("confirmType");
        request6.setValue(StringUtil.isNotEmpty(confirmType) ? StringUtils.trimToNull(confirmType) : null);
        queryRequests.add(request6);
        CommonRequest request4 = new CommonRequest();
        request4.setName("alarmType");
        request4.setValue(StringUtil.isNotEmpty(alarmType) ? StringUtils.trimToNull(alarmType) : null);
        queryRequests.add(request4);

        CommonRequest request5 = new CommonRequest();
        request5.setName("alarmLogId");
        request5.setValue(StringUtil.isNotEmpty(alarmLogId) ? StringUtils.trimToNull(alarmLogId) : null);
        queryRequests.add(request5);

        CommonRequest request8 = new CommonRequest();
        request8.setName("systemCode");
        request8.setValue(StringUtil.isNotEmpty(systemCode) ? StringUtils.trimToNull(systemCode) : null);
        queryRequests.add(request8);
        CommonRequest request9 = new CommonRequest();
        request9.setName("buildId");
        request9.setValue(StringUtil.isNotEmpty(buildId) ? StringUtils.trimToNull(buildId) : null);
        queryRequests.add(request9);
        CommonRequest request10 = new CommonRequest();
        request10.setName("id");
        request10.setValue(StringUtil.isNotEmpty(id) ? StringUtils.trimToNull(id) : null);
        queryRequests.add(request10);
        CommonRequest request11 = new CommonRequest();
        request11.setName("cleanStatus");
        request11.setValue(StringUtil.isNotEmpty(cleanStatus) ? StringUtils.trimToNull(cleanStatus) : null);
        queryRequests.add(request11);
        CommonRequest request12 = new CommonRequest();
        request12.setName("isRemoveShield");
        request12.setValue(StringUtil.isNotEmpty(isRemoveShield) ? StringUtils.trimToNull(isRemoveShield) : null);
        queryRequests.add(request12);
        CommonRequest request13 = new CommonRequest();
        request13.setName("isRemovedFire");
        request13.setValue(StringUtil.isNotEmpty(isRemovedFire) ? StringUtils.trimToNull(isRemovedFire) : null);
        queryRequests.add(request13);
      
        CommonRequest request15 = new CommonRequest();
        request15.setName("equipDetailCode");
        request15.setValue(StringUtil.isNotEmpty(equipDetailCode) ? StringUtils.trimToNull(equipDetailCode) : null);
        queryRequests.add(request15);
        
        CommonRequest request16 = new CommonRequest();
        request16.setName("specificIndexKey");
        request16.setValue(StringUtil.isNotEmpty(specificIndexKey) ? StringUtils.trimToNull(specificIndexKey) : null);
        queryRequests.add(request16);
        
        CommonRequest request17 = new CommonRequest();
        request17.setName("indexTypeCode");
        request17.setValue(StringUtil.isNotEmpty(indexTypeCode) ? StringUtils.trimToNull(indexTypeCode) : null);
        queryRequests.add(request17);
        
        CommonRequest request18 = new CommonRequest();
        request18.setName("equipmentCode");
        request18.setValue(StringUtil.isNotEmpty(equipmentCode) ? StringUtils.trimToNull(equipmentCode) : null);
        queryRequests.add(request18);
      
       
        if (equioEnabled){
            if (!ValidationUtil.isEmpty(reginParams.getPersonIdentity())){
                CommonRequest request14 = new CommonRequest();
                request14.setName("bizOrgCode");
                request14.setValue(StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null );
                queryRequests.add(request14);
            }
        }else {
            CommonRequest request14 = new CommonRequest();
            request14.setName("bizOrgCode");
            request14.setValue("");
        }

            CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);

        org.springframework.data.domain.Page<AlarmListDataVO> list = iEquipmentSpecificAlarmService.listAlarmsPage(param);
        return CommonResponseUtil.success(list);
    }

    @RequestMapping(value = "/info", method = RequestMethod.GET)
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @ApiOperation(httpMethod = "GET", value = "数字换流站根据id获取装备详情", produces = "application/json;charset=UTF-8", notes = "数字换流站根据id获取装备详情")
    public ResponseModel getSpecificInfoById(@RequestParam(value = "id") Long id) {
        Map<String, Object> map = iEquipmentSpecificAlarmService.getSpecificInfoById(id);
        return CommonResponseUtil.success(map);
    }

    @RequestMapping(value = "/infoBySpecCode", method = RequestMethod.GET)
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @ApiOperation(httpMethod = "GET", value = "数字换流站根据code获取装备详情", produces = "application/json;charset=UTF-8", notes = "数字换流站根据id获取装备详情")
    public ResponseModel getSpecificInfoById(@RequestParam(value = "code") String code) {
        Map<String, Object> map = iEquipmentSpecificAlarmService.getSpecificInfoByCode(code);
        return CommonResponseUtil.success(map);
    }

    @RequestMapping(value = "/fireFacilitiesList", method = RequestMethod.GET)
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @ApiOperation(httpMethod = "GET", value = "数字换流站根据code获取装备详情", produces = "application/json;charset=UTF-8", notes = "数字换流站根据id获取装备详情")
    public ResponseModel fireFacilitiesList(@RequestParam(value = "bizOrgCode") String bizOrgCode,
                                            @RequestParam(value = "startTime") String startTime,
                                            @RequestParam(value = "endTime") String endTime) {
        List<Map<String, Object>> list = iEquipmentSpecificAlarmService.fireFacilitiesList(bizOrgCode, startTime, endTime);
        return CommonResponseUtil.success(list);
    }

    @RequestMapping(value = "/dailyMaintenance", method = RequestMethod.GET)
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @ApiOperation(httpMethod = "GET", value = "站端双月报装备统计故障告警信息", produces = "application/json;charset=UTF-8", notes = "数字换流站根据id获取装备详情")
    public ResponseModel dailyMaintenance(@RequestParam(value = "bizOrgCode") String bizOrgCode,
                                            @RequestParam(value = "startTime") String startTime,
                                           @RequestParam(value = "orgCode") String orgCode,
                                            @RequestParam(value = "endTime") String endTime) {
        Map<String, Object> map = iEquipmentSpecificAlarmService.dailyMaintenance(bizOrgCode, orgCode, startTime, endTime);
        return CommonResponseUtil.success(map);
    }

    @RequestMapping(value = "/inspectionMessage", method = RequestMethod.GET)
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @ApiOperation(httpMethod = "GET", value = "站端双月报巡检信息", produces = "application/json;charset=UTF-8", notes = "数字换流站根据id获取装备详情")
    public ResponseModel inspectionMessage(@RequestParam(value = "startTime") String startTime,
                                          @RequestParam(value = "orgCode") String orgCode,
                                          @RequestParam(value = "endTime") String endTime) {
        Map<String, Object> map = iEquipmentSpecificAlarmService.inspectionMessage(orgCode, startTime, endTime);
        return CommonResponseUtil.success(map);
    }

    @RequestMapping(value = "/pressureMessage", method = RequestMethod.GET)
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @ApiOperation(httpMethod = "GET", value = "站端双月报稳压泵打压频次信息", produces = "application/json;charset=UTF-8", notes = "数字换流站根据id获取装备详情")
    public ResponseModel pressureMessage(@RequestParam(value = "startTime") String startTime,
                                           @RequestParam(value = "orgCode") String orgCode,
                                           @RequestParam(value = "endTime") String endTime) {
        Map<String, Object> map = iEquipmentSpecificAlarmService.pressureMessage(orgCode, startTime, endTime);
        return CommonResponseUtil.success(map);
    }

    @RequestMapping(value = "/getAllEquipNum", method = RequestMethod.GET)
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @ApiOperation(httpMethod = "GET", value = "查装备数量", produces = "application/json;charset=UTF-8", notes = "查装备数量")
    public ResponseModel getAllEquipNum(@RequestParam(required = false) String bizOrgCode) {
        return CommonResponseUtil.success(equipmentSpecificMapper.getAllEquipNum(bizOrgCode));
    }
}
