| | |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.common.util.SpringContextHolder; |
| | | import com.sandu.ximon.admin.manager.iot.frame.A5Frame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5AtmosphereHeartBeatTimeReportInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5AtmosphereOperationReportInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5AtmosphereQueryVersionReportInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.request.AtmosphereQueryHeartBeatTimeReqInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.request.AtmosphereQueryVersionReqInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.request.AtmosphereRebootReqInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.request.AtmosphereSetHeartBeatTimeReqInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.dto.CommonFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.A5OrderEnum; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.AtmoFunctionCode; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.mainboard.MainBoardInvokeSyncService; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.utils.RedisUtils; |
| | | import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils; |
| | | import com.sandu.ximon.admin.utils.StringUtil; |
| | | import com.sandu.ximon.dao.bo.AirEquipmentNongGengBo; |
| | | import com.sandu.ximon.dao.domain.AirEquipment; |
| | | import com.sandu.ximon.dao.domain.AirEquipmentNongGeng; |
| | | import com.sandu.ximon.dao.mapper.AirEquipmentNongGengMapper; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | // } else { |
| | | // airEquipmentBos = airEquipmentNongGengMapper.listAirEquipmentByIds(keyword, SecurityUtils.getUserId()); |
| | | // } |
| | | |
| | | if (SecurityUtils.getClientId() == null) { |
| | | airEquipmentBos = airEquipmentNongGengMapper.listAirEquipmentByIds(keyword, null); |
| | | } else { |
| | | airEquipmentBos = airEquipmentNongGengMapper.listAirEquipmentByIds(keyword, SecurityUtils.getUserId()); |
| | | } |
| | | |
| | | return null; |
| | | // return airEquipmentBos; |
| | |
| | | } |
| | | return one; |
| | | } |
| | | |
| | | /** |
| | | * 设置大气设备心跳包间隔时间 |
| | | * |
| | | * @param mac |
| | | * @param time |
| | | */ |
| | | public String setHeartBeatTime(String mac, Integer time) { |
| | | if (StringUtil.strIsNullOrEmpty(mac)) { |
| | | throw new BusinessException("灯杆mac参数错误!"); |
| | | } |
| | | if (time == null) { |
| | | throw new BusinessException("心跳包间隔时间不能为空!"); |
| | | } |
| | | |
| | | if (time < 30) { |
| | | throw new BusinessException("心跳包间隔时间不能少于30s!"); |
| | | } |
| | | AirEquipmentNongGeng airEquipmentNongGeng = SpringContextHolder.getBean(AirEquipmentNongGengService.class). |
| | | getOne(Wrappers.lambdaQuery(AirEquipmentNongGeng.class).eq(AirEquipmentNongGeng::getMac, mac).last("limit 1")); |
| | | if (airEquipmentNongGeng == null) { |
| | | throw new BusinessException("大气设备不存在!"); |
| | | } |
| | | |
| | | AtmosphereSetHeartBeatTimeReqInnerFrame atmosphereSetHeartBeatTimeReqInnerFrame = new AtmosphereSetHeartBeatTimeReqInnerFrame(time); |
| | | A5Frame a5Frame = new A5Frame(A5OrderEnum.REQUEST_ATMOSPHERE_DATA.getCode(), atmosphereSetHeartBeatTimeReqInnerFrame); |
| | | System.out.println(a5Frame + " --------a5Frame"); |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(mac, a5Frame); |
| | | System.out.println(commonFrame + " -----------commonFrame"); |
| | | |
| | | A5AtmosphereOperationReportInnerFrame a5AtmosphereOperationReportInnerFrame |
| | | = new A5AtmosphereOperationReportInnerFrame().transformFrame(commonFrame.getPayload()); |
| | | if (a5AtmosphereOperationReportInnerFrame != null && a5AtmosphereOperationReportInnerFrame.isValidate()) { |
| | | return a5AtmosphereOperationReportInnerFrame.getState(); |
| | | } else { |
| | | throw new BusinessException("数据校验异常!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询大气设备心跳包时间 |
| | | */ |
| | | public String QueryHeartBeatTime(String mac) { |
| | | if (StringUtil.strIsNullOrEmpty(mac)) { |
| | | throw new BusinessException("灯杆mac参数错误!"); |
| | | } |
| | | AirEquipmentNongGeng airEquipmentNongGeng = SpringContextHolder.getBean(AirEquipmentNongGengService.class). |
| | | getOne(Wrappers.lambdaQuery(AirEquipmentNongGeng.class).eq(AirEquipmentNongGeng::getMac, mac).last("limit 1")); |
| | | if (airEquipmentNongGeng == null) { |
| | | throw new BusinessException("大气设备不存在!"); |
| | | } |
| | | |
| | | AtmosphereQueryHeartBeatTimeReqInnerFrame atmosphereQueryHeartBeatTimeReqInnerFrame = new AtmosphereQueryHeartBeatTimeReqInnerFrame(); |
| | | A5Frame a5Frame = new A5Frame(A5OrderEnum.REQUEST_ATMOSPHERE_DATA.getCode(), atmosphereQueryHeartBeatTimeReqInnerFrame); |
| | | System.out.println(a5Frame + " --------a5Frame"); |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(mac, a5Frame); |
| | | System.out.println(commonFrame + " -----------commonFrame"); |
| | | |
| | | A5AtmosphereHeartBeatTimeReportInnerFrame a5AtmosphereHeartBeatTimeReportInnerFrame |
| | | = new A5AtmosphereHeartBeatTimeReportInnerFrame().transformFrame(commonFrame.getPayload()); |
| | | |
| | | if (a5AtmosphereHeartBeatTimeReportInnerFrame != null && a5AtmosphereHeartBeatTimeReportInnerFrame.isValidate()) { |
| | | return "该大气设备心跳包间隔时间为:" + a5AtmosphereHeartBeatTimeReportInnerFrame.getIntervalTime() + "s"; |
| | | } else { |
| | | throw new BusinessException("数据校验异常!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询软硬件版本 |
| | | * |
| | | * @param mac |
| | | * @return |
| | | */ |
| | | public String QueryVersion(String mac) { |
| | | if (StringUtil.strIsNullOrEmpty(mac)) { |
| | | throw new BusinessException("灯杆mac参数错误!"); |
| | | } |
| | | AirEquipmentNongGeng airEquipmentNongGeng = SpringContextHolder.getBean(AirEquipmentNongGengService.class). |
| | | getOne(Wrappers.lambdaQuery(AirEquipmentNongGeng.class).eq(AirEquipmentNongGeng::getMac, mac).last("limit 1")); |
| | | if (airEquipmentNongGeng == null) { |
| | | throw new BusinessException("大气设备不存在!"); |
| | | } |
| | | |
| | | AtmosphereQueryVersionReqInnerFrame atmosphereQueryVersionReqInnerFrame = new AtmosphereQueryVersionReqInnerFrame(); |
| | | A5Frame a5Frame = new A5Frame(A5OrderEnum.REQUEST_ATMOSPHERE_DATA.getCode(), atmosphereQueryVersionReqInnerFrame); |
| | | System.out.println(a5Frame + " --------a5Frame"); |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(mac, a5Frame); |
| | | System.out.println(commonFrame + " -----------commonFrame"); |
| | | |
| | | A5AtmosphereQueryVersionReportInnerFrame a5AtmosphereQueryVersionReportInnerFrame = |
| | | new A5AtmosphereQueryVersionReportInnerFrame().transformFrame(commonFrame.getPayload()); |
| | | if (a5AtmosphereQueryVersionReportInnerFrame != null && a5AtmosphereQueryVersionReportInnerFrame.isValidate()) { |
| | | return a5AtmosphereQueryVersionReportInnerFrame.getVersion(); |
| | | } else { |
| | | throw new BusinessException("数据校验异常!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 软重启 |
| | | * |
| | | * @param mac |
| | | * @return |
| | | */ |
| | | public String Reboot(String mac) { |
| | | if (StringUtil.strIsNullOrEmpty(mac)) { |
| | | throw new BusinessException("灯杆mac参数错误!"); |
| | | } |
| | | |
| | | AirEquipmentNongGeng airEquipmentNongGeng = SpringContextHolder.getBean(AirEquipmentNongGengService.class). |
| | | getOne(Wrappers.lambdaQuery(AirEquipmentNongGeng.class).eq(AirEquipmentNongGeng::getMac, mac).last("limit 1")); |
| | | if (airEquipmentNongGeng == null) { |
| | | throw new BusinessException("大气设备不存在!"); |
| | | } |
| | | |
| | | AtmosphereRebootReqInnerFrame atmosphereRebootReqInnerFrame = new AtmosphereRebootReqInnerFrame(); |
| | | A5Frame a5Frame = new A5Frame(A5OrderEnum.REQUEST_ATMOSPHERE_DATA.getCode(), atmosphereRebootReqInnerFrame); |
| | | System.out.println(a5Frame + " --------a5Frame"); |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(mac, a5Frame); |
| | | System.out.println(commonFrame + " -----------commonFrame"); |
| | | |
| | | A5AtmosphereOperationReportInnerFrame a5AtmosphereOperationReportInnerFrame = |
| | | new A5AtmosphereOperationReportInnerFrame().transformFrame(commonFrame.getPayload()); |
| | | |
| | | if (a5AtmosphereOperationReportInnerFrame != null && a5AtmosphereOperationReportInnerFrame.isValidate()) { |
| | | return a5AtmosphereOperationReportInnerFrame.getState(); |
| | | } else { |
| | | throw new BusinessException("数据校验异常!"); |
| | | } |
| | | } |
| | | |
| | | } |