package com.yeejoin.amos.boot.module.tzs.biz.controller;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.feign.AmosFeignService;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorBaseInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorListDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorMaintenanceInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorNewDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorTestInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorWlInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.EsElevatorDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import com.yeejoin.amos.boot.module.tzs.api.entity.MaintainInfo;
import com.yeejoin.amos.boot.module.tzs.api.entity.TestInfo;
import com.yeejoin.amos.boot.module.tzs.api.service.IElevatorRelationService;
import com.yeejoin.amos.boot.module.tzs.api.service.IElevatorService;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.ESElevatorServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.ElevatorServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.MaintainInfoServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.TestInfoServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
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.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;

import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * 电梯Api
 *
 * @author tb
 * @date 2021-06-01
 */
@RestController
@Api(tags = "电梯Api")
@RequestMapping(value = "/elevator")
public class ElevatorController extends BaseController {

    private final Logger logger = LoggerFactory.getLogger(ElevatorController.class);

    @Autowired
    IElevatorService iElevatorService;

    @Autowired
    ElevatorServiceImpl elevatorService;

    @Autowired
    private AmosFeignService amosFeignService;

    @Autowired
    private MaintainInfoServiceImpl maintainInfoService;
	 @Autowired
	private EquipFeignClient equipFeignClient;
    @Autowired
    private TestInfoServiceImpl testInfoService;

    @Autowired
    ESElevatorServiceImpl esElevatorService;

    @Autowired
    private EmqKeeper emqKeeper;

    @Value("${mqtt.topic.elevator.push}")
    private String elevatorpushTopic;

    @Autowired
    private IElevatorRelationService elevatorRelationService;

    /**
     * 新增电梯
     *
     * @param elevatorDto 新增参数
     * @return 返回结果
     */
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @RequestMapping(value = "/save", method = RequestMethod.POST)
    @ApiOperation(httpMethod = "POST", value = "新增电梯", notes = "新增电梯")
    public ResponseModel<com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorDto> saveElevator(@RequestBody com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorDto elevatorDto) {
        return ResponseHelper.buildResponse(elevatorService.saveElevator(elevatorDto));
    }

    /**
     * 根据id批量删除
     *
     * @param idList id
     * @return 返回结果
     */
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
    @ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
    public ResponseModel<Boolean> deleteById(@RequestParam String idList) {
        return ResponseHelper.buildResponse(elevatorService.deleteBatchBySeq(idList));
    }

    /**
     * 修改电梯
     *
     * @param elevatorDto 修改参数
     * @return 返回结果
     */
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @RequestMapping(value = "/updateById", method = RequestMethod.PUT)
    @ApiOperation(httpMethod = "PUT", value = "修改电梯", notes = "修改电梯")
    public ResponseModel<com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorDto> updateByIdElevator(@RequestBody com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorDto elevatorDto) {
        return ResponseHelper.buildResponse(elevatorService.updateElevator(elevatorDto));
    }


    /**
     * 根据sequenceNbr查询
     *
     * @param sequenceNbr sequenceNbr
     * @return 返回结果
     */
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @RequestMapping(value = "/{sequenceNbr}", method = RequestMethod.GET)
    @ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
    public ResponseModel<com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorDto> selectById(@PathVariable Long sequenceNbr) {
        return ResponseHelper.buildResponse(elevatorService.selectBySeq(sequenceNbr));
    }

    /**
     * 列表分页查询
     *
     * @param pageNum     当前页
     * @param pageSize    每页大小
     * @param elevatorDto 查询参数
     * @return 返回结果
     */
    @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
    public ResponseModel<IPage<ElevatorDto>> listPage(String pageNum, String pageSize, com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorDto elevatorDto) {
        Elevator elevator = BeanDtoVoUtils.convert(elevatorDto, Elevator.class);
        Page<Elevator> pageBean;
        QueryWrapper<Elevator> elevatorQueryWrapper = new QueryWrapper<>();
        Class<? extends Elevator> aClass = elevator.getClass();
        Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
            try {
                field.setAccessible(true);
                Object o = field.get(elevator);
                if (o != null) {
                    Class<?> type = field.getType();
                    String name = NameUtils.camel2Underline(field.getName());
                    if (type.equals(Integer.class)) {
                        Integer fileValue = (Integer) o;
                        elevatorQueryWrapper.eq(name, fileValue);
                    } else if (type.equals(Long.class)) {
                        Long fileValue = (Long) o;
                        elevatorQueryWrapper.eq(name, fileValue);
                    } else if (type.equals(String.class)) {
                        String fileValue = (String) o;
                        elevatorQueryWrapper.eq(name, fileValue);
                    } else {
                        String fileValue = (String) o;
                        elevatorQueryWrapper.eq(name, fileValue);
                    }
                }
            } catch (Exception e) {
                logger.error(e.getMessage());
            }
        });
        IPage<Elevator> page;
        if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
            pageBean = new Page<>(0, Long.MAX_VALUE);
        } else {
            pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
        }
        page = iElevatorService.page(pageBean, elevatorQueryWrapper);
        IPage<ElevatorDto> elevatorVoIPage = BeanDtoVoUtils.elevatorIPageDto(page);
        return ResponseHelper.buildResponse(elevatorVoIPage);
    }


    /**
     * 相似电梯模糊查询
     *
     * @param elevatorNewDto 查询参数
     * @return 返回结果
     */
    @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
    @RequestMapping(value = "/page/similar", method = RequestMethod.POST)
    @ApiOperation(httpMethod = "POST", value = "相似电梯模糊查询", notes = "相似电梯模糊查询")
    public ResponseModel<List<ElevatorDto>> similar(@RequestBody ElevatorNewDto elevatorNewDto) {
        Elevator elevator = BeanDtoVoUtils.convert(elevatorNewDto.getElevatorDto(), Elevator.class);
        QueryWrapper<Elevator> elevatorQueryWrapper = new QueryWrapper<>();
        Class<? extends Elevator> aClass = elevator.getClass();
        Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
            try {
                field.setAccessible(true);
                Object o = field.get(elevator);
                if (o != null) {
                    String name = NameUtils.camel2Underline(field.getName());
                    if ("rescue_code".equalsIgnoreCase(name)) {
                        Integer fileValue = (Integer) o;
                        elevatorQueryWrapper.like(name, fileValue);
                    } else if ("city".equalsIgnoreCase(name) || "district".equalsIgnoreCase(name)) {
                        String fileValue = (String) o;
                        elevatorQueryWrapper.eq(name, fileValue);
                    } else {
                        String fileValue = (String) o;
                        elevatorQueryWrapper.like(name, fileValue);
                    }
                }
            } catch (Exception e) {
                logger.error(e.getMessage());
            }
        });
       List<Elevator> elevators =  iElevatorService.list(elevatorQueryWrapper);
       List<ElevatorDto> elevatorDtoList = new ArrayList<>();
        for (Elevator ele : elevators ) {
            ElevatorDto eleDto = BeanDtoVoUtils.convertElevatorToDto(ele,false);
            elevatorDtoList.add(eleDto);
        }
        return ResponseHelper.buildResponse(elevatorDtoList);
    }

    /**
     * 分页查询电梯信息
     *
     * @param pageNum     当前页
     * @param pageSize    每页大小
     * @param elevatorDto 查询参数
     * @return 查询结果
     */
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @RequestMapping(value = "/query_elevator_list", method = RequestMethod.GET)
    @ApiOperation(httpMethod = "GET", value = "分页查询电梯信息", notes = "分页查询电梯信息")
    public ResponseModel<IPage<ElevatorDto>> queryElevatorList(String pageNum, String pageSize,
                                                               com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorDto elevatorDto) {
        Elevator elevator = BeanDtoVoUtils.convert(elevatorDto, Elevator.class);
        Page<Elevator> pageBean;
        QueryWrapper<Elevator> elevatorQueryWrapper = new QueryWrapper<>();
        Class<? extends Elevator> aClass = elevator.getClass();
        Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
            try {
                field.setAccessible(true);
                Object o = field.get(elevator);
                if (o != null) {
                    String name = NameUtils.camel2Underline(field.getName());
                    if ("rescue_code".equalsIgnoreCase(name)) {
                        Integer fileValue = (Integer) o;
                        elevatorQueryWrapper.like(name, fileValue);
                    } else if ("city".equalsIgnoreCase(name) || "district".equalsIgnoreCase(name)) {
                        String fileValue = (String) o;
                        elevatorQueryWrapper.eq(name, fileValue);
                    } else {
                        String fileValue = (String) o;
                        elevatorQueryWrapper.like(name, fileValue);
                    }
                }
            } catch (Exception e) {
                logger.error(e.getMessage());
            }
        });
        IPage<Elevator> page;
        if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
            pageBean = new Page<>(0, Long.MAX_VALUE);
        } else {
            pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
        }
        page = iElevatorService.page(pageBean, elevatorQueryWrapper);
        IPage<ElevatorDto> elevatorDtoIPage = BeanDtoVoUtils.elevatorIPageDto(page);
        return ResponseHelper.buildResponse(elevatorDtoIPage);
    }


    /**
     * 获取电梯使用单位
     * @return
     */
    @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
    @RequestMapping(value = "/usesiteCategory", method = RequestMethod.GET)
    @ApiOperation(httpMethod = "GET", value = "获取电梯使用单位", notes = "获取电梯使用单位")
    public ResponseModel<List<DictionarieValueModel>> selectUsesiteCategory() {
        List<DictionarieValueModel>  elevatorUseSiteCategory = null;
        try {
            elevatorUseSiteCategory = amosFeignService.listDictionaryByDictCode("ELEVATOR_USE_SITE_CATEGORY");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ResponseHelper.buildResponse(elevatorUseSiteCategory);
    }

    /**
     * 根据电梯id或电梯救援识别码获取电梯信息
     * @return
     */
    @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
    @RequestMapping(value = "/getElevatorInfo", method = RequestMethod.GET)
    @ApiOperation(httpMethod = "GET", value = "根据电梯id或电梯救援识别码获取电梯信息", notes = "根据电梯id或电梯救援识别码获取电梯信息")
    public ResponseModel<ElevatorInfoDto> getElevatorInfo(Long sequenceNbr,String rescueCode, String openId) {

        if(StringUtils.isBlank(rescueCode) && sequenceNbr == null && StringUtils.isBlank(openId)) {
            throw new BadRequest("参数错误");
        }
        Elevator elevator;
        ElevatorInfoDto elevatorInfoDto = new ElevatorInfoDto();
        if(null != sequenceNbr) {
            ElevatorBaseInfoDto baseInfoDto = new ElevatorBaseInfoDto();
            elevator = elevatorService.getById(sequenceNbr);
            Bean.toPo(elevator,baseInfoDto);
            elevatorInfoDto.setElevatorBaseInfoDto(baseInfoDto);
        } else  {
            QueryWrapper<Elevator> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("rescue_code",rescueCode);
            elevator = elevatorService.getOne(queryWrapper);
            if(null == elevator) {
                throw new BadRequest("电梯应急救援码错误");
            }
            ElevatorBaseInfoDto baseInfoDto = new ElevatorBaseInfoDto();
            Bean.toPo(elevator,baseInfoDto);
            elevatorInfoDto.setElevatorBaseInfoDto(baseInfoDto);
        }

        QueryWrapper<MaintainInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("enevator_id", null == sequenceNbr ? elevator.getSequenceNbr() : String.valueOf(sequenceNbr));
        MaintainInfo maintainInfo =   maintainInfoService.getOne(queryWrapper);
        if(null != maintainInfo) {
            ElevatorMaintenanceInfoDto elevatorMaintenanceInfoDto = new ElevatorMaintenanceInfoDto();
            Bean.toPo(maintainInfo,elevatorMaintenanceInfoDto);
            elevatorInfoDto.setElevatorMaintenanceInfoDto(elevatorMaintenanceInfoDto);
        }

        QueryWrapper<TestInfo> queryWrapper1 = new QueryWrapper<>();
        queryWrapper1.eq("enevator_id", null == sequenceNbr ? elevator.getSequenceNbr() : String.valueOf(sequenceNbr));
        TestInfo testInfo =   testInfoService.getOne(queryWrapper1);
        if(null != testInfo) {
            ElevatorTestInfoDto elevatorTestInfoDto = new ElevatorTestInfoDto();
            Bean.toPo(testInfo,elevatorTestInfoDto);
            elevatorInfoDto.setElevatorTestInfoDto(elevatorTestInfoDto);
        }
        if(elevator != null) {
            elevatorInfoDto.setHasFocus(elevatorRelationService.hasFocusElevator(openId, elevator.getSequenceNbr()));
        }

        return ResponseHelper.buildResponse(elevatorInfoDto);
    }

    /**
               * 视频列表分页查询
     *
     * @return
     */

    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @RequestMapping(value = "/getVideo", method = RequestMethod.GET)
    @ApiOperation(httpMethod = "GET", value = "分页获取视频", notes = "分页获取视频")
    public ResponseModel<Object> getVideo(Integer current, Integer size)throws Exception {
      ResponseModel<Page<Map<String, Object>>> data=  equipFeignClient.pageVideo(current,size,null,null,null);
      return ResponseHelper.buildResponse(data!=null?data.getResult():null);
    }

    /**
     *
     * @return
     */
    @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
    @RequestMapping(value = "/init", method = RequestMethod.GET)
    @ApiOperation(httpMethod = "GET", value = "电梯信息放入es", notes = "电梯信息放入es")
    public void init(Integer num) {
        IPage<Elevator> elevatorPage = new Page<>();
        Integer count =  elevatorService.count();

        for(int i = 0; i <= (ValidationUtil.isEmpty(num) ? count%500 : num); ++i  ) {
            elevatorPage.setCurrent(i);
            elevatorPage.setSize(500);
            elevatorPage =  elevatorService.page(elevatorPage);
            for (Elevator el:elevatorPage.getRecords()
                 ) {
                esElevatorService.saveEsElevatorToES(el);
            }
        }
    }


    /**
     * ES查询电梯信息
     *
     * @param elevatorDto 查询参数
     * @return 查询结果
     */
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @RequestMapping(value = "/query_elevator_list_es", method = RequestMethod.POST)
    @ApiOperation(httpMethod = "POST", value = "ES查询电梯信息", notes = "ES查询电梯信息")
    public ResponseModel<List<EsElevatorDto>> queryElevatorListEs(
            @RequestBody EsElevatorDto elevatorDto){
        List<EsElevatorDto>  page = esElevatorService.queryByKeys(elevatorDto);
        return ResponseHelper.buildResponse(page);
    }

    /**
     * 根据sequenceNbr查询
     *
     * @param sequenceNbr sequenceNbr
     * @return 返回结果
     */
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @RequestMapping(value = "/pushInfo/{sequenceNbr}", method = RequestMethod.GET)
    @ApiOperation(httpMethod = "GET", value = "根据电梯id 给主屏推送电梯信息", notes = "根据电梯id 给主屏推送电梯信息")
    public ResponseModel<Boolean> pushElevatorInfo(@PathVariable Long sequenceNbr) {

        ElevatorDto elevator = elevatorService.selectBySeq(sequenceNbr);
        AgencyUserModel user =getUserInfo();
        // 推送经纬度 人员姓名 电话 警情id
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("userId",user.getUserId());
        jsonObject.put("elevatorId",elevator.getSequenceNbr());
        jsonObject.put("rescueCode",elevator.getRescueCode());
        jsonObject.put("registerCode",elevator.getRegisterCode());
        jsonObject.put("address",elevator.getAddress());
        jsonObject.put("useUnit",elevator.getUseUnit());
        jsonObject.put("useStatus",elevator.getUseStatus());
        jsonObject.put("useSiteCategory",elevator.getUseSiteCategory());
        jsonObject.put("city",elevator.getCity());
        jsonObject.put("district",elevator.getDistrict());
        try {
            emqKeeper.getMqttClient().publish(elevatorpushTopic, jsonObject.toString().getBytes("UTF-8"), 1, false);
        } catch (MqttException e) {
            logger.error("mqtt发送失败" +jsonObject );
        } catch (UnsupportedEncodingException e) {
            logger.error("mqtt发送失败" +jsonObject );
        }
        return ResponseHelper.buildResponse(true);
    }



    /**
     * 查询电梯物联信息
     *
     * @param elevatorDto 查询参数
     * @return 查询结果
     */
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @RequestMapping(value = "/query_elevator_list_wl", method = RequestMethod.GET)
    @ApiOperation(httpMethod = "GET", value = "查询电梯信息", notes = "查询电梯信息")
    public ResponseModel<IPage<ElevatorWlInfoDto>> queryElevatorList(
            ElevatorWlInfoDto elevatorDto){
        IPage<ElevatorWlInfoDto> iPage = new Page<>();
        iPage.setCurrent((elevatorDto.getPage()-1)*elevatorDto.getSize());
        iPage.setSize(elevatorDto.getSize());
        iPage.setRecords( elevatorService.queryElevatorList(elevatorDto));
        iPage.setTotal(elevatorService.queryElevatorListCount());
        return ResponseHelper.buildResponse(iPage);
    }

    /**
     * 查询电梯物联信息详情
     *
     * @param elevatorDto 查询参数
     * @return 查询结果
     */
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @RequestMapping(value = "/query_elevator_list_wl_details", method = RequestMethod.POST)
    @ApiOperation(httpMethod = "POST", value = "查询电梯信息", notes = "查询电梯信息")
    public ResponseModel<ElevatorWlInfoDto> queryElevato(
            @RequestBody ElevatorWlInfoDto elevatorDto){
        if(null == elevatorDto.getSequenceNbr()) {
            throw new BadRequest("参数错误");
        }
        List<ElevatorWlInfoDto>  page = elevatorService.queryElevatorListDetails(elevatorDto);
        if(page.size()>0) {
            return ResponseHelper.buildResponse(page.get(0));
        }
        return ResponseHelper.buildResponse(null);
    }

    /**
     * 关注电梯
     * @param elevatorId
     * @param openId
     * @return
     */
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @RequestMapping(value = "/focusElevator/{elevatorId}/{openId}", method = RequestMethod.GET)
    @ApiOperation(httpMethod = "GET", value = "关注电梯", notes = "关注电梯")
    public ResponseModel<Boolean> focusElevator(@PathVariable String elevatorId, @PathVariable String openId){
        return ResponseHelper.buildResponse(elevatorRelationService.focusElevator(openId,elevatorId));
    }

    /**
     * 取消关注电梯
     * @param elevatorId
     * @param openId
     * @return
     */
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @RequestMapping(value = "/cancelFocusElevator/{elevatorId}/{openId}", method = RequestMethod.GET)
    @ApiOperation(httpMethod = "GET", value = "取消关注电梯", notes = "取消关注电梯")
    public ResponseModel<Boolean> cancelFocusElevator(@PathVariable String elevatorId, @PathVariable String openId){
        return ResponseHelper.buildResponse(elevatorRelationService.cancelFocusElevator(openId,elevatorId));
    }

    /**
     * 获取关注电梯列表
     * @param openId
     * @return
     */
    @TycloudOperation(ApiLevel = UserType.AGENCY)
    @RequestMapping(value = "/getMyFocusElevator/{openId}", method = RequestMethod.GET)
    @ApiOperation(httpMethod = "GET", value = "获取关注电梯列表", notes = "获取关注电梯列表")
    public ResponseModel<List<ElevatorListDto>> cancelFocusElevator(@PathVariable String openId){
        return ResponseHelper.buildResponse(elevatorRelationService.getMyFocusElevator(openId));
    }

}

