| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.ximon.dao.domain.AirData; |
| | | import com.sandu.ximon.dao.domain.ForHelp; |
| | | import com.sandu.ximon.admin.manager.iot.frame.A5Frame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.*; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.request.*; |
| | | 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.mainboard.MainBoardInvokeSyncService; |
| | | import com.sandu.ximon.dao.domain.LightPoleHeeling; |
| | | import com.sandu.ximon.dao.mapper.LightPoleHeelingMapper; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | List<LightPoleHeeling> forHelpList = list(wrapper); |
| | | return forHelpList; |
| | | } |
| | | |
| | | /** |
| | | * 灯杆倾斜心跳包 |
| | | * |
| | | * @param deviceName |
| | | */ |
| | | public A5LightPoleHeelingHeartbeatReportInnerFrame.HeartBeatDataPackage LightPoleHeelingHeartbeatPackage(String deviceName) { |
| | | LightPoleHeelingHeartbeatPackageReqInnerFrame lightPoleHeelingHeartbeatPackageReqInnerFrame = new LightPoleHeelingHeartbeatPackageReqInnerFrame(); |
| | | |
| | | A5Frame a5Frame = new A5Frame(A5OrderEnum.REQUEST_POLE_MONITOR_DATA.getCode(), lightPoleHeelingHeartbeatPackageReqInnerFrame); |
| | | System.out.println(a5Frame + " -----a5Frame"); |
| | | |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(deviceName, a5Frame); |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | |
| | | |
| | | A5LightPoleHeelingHeartbeatReportInnerFrame heartbeatReportInnerFrame |
| | | = new A5LightPoleHeelingHeartbeatReportInnerFrame().transformFrame(commonFrame.getPayload()); |
| | | if (heartbeatReportInnerFrame.isValidate()) { |
| | | return heartbeatReportInnerFrame.getHeartBeatDataPackage(); |
| | | } else { |
| | | throw new BusinessException("数据校验错误,请重新请求"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询心跳包间隔时间 |
| | | * |
| | | * @param deviceName |
| | | */ |
| | | public String QueryIntervalTime(String deviceName) { |
| | | LightPoleHeelingQueryIntervalTimeReqInnerFrame queryIntervalTimeReqInnerFrame |
| | | = new LightPoleHeelingQueryIntervalTimeReqInnerFrame(); |
| | | |
| | | A5Frame a5Frame = new A5Frame(A5OrderEnum.REQUEST_POLE_MONITOR_DATA.getCode(), queryIntervalTimeReqInnerFrame); |
| | | System.out.println(a5Frame + " -----a5Frame"); |
| | | |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(deviceName, a5Frame); |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | |
| | | |
| | | A5LightPoleHeelingQueryReportInnerFrame queryReportInnerFrame = new A5LightPoleHeelingQueryReportInnerFrame().transformFrame(commonFrame.getPayload()); |
| | | if (queryReportInnerFrame.isValidate()) { |
| | | return queryReportInnerFrame.getIntervalTime(); |
| | | } else { |
| | | throw new BusinessException("数据校验错误,请重新请求"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 软重启 |
| | | * |
| | | * @param deviceName |
| | | */ |
| | | public String RestartLightPoleHeeling(String deviceName) { |
| | | LightPoleHeelingRestartReqInnerFrame restartReqInnerFrame |
| | | = new LightPoleHeelingRestartReqInnerFrame(); |
| | | |
| | | A5Frame a5Frame = new A5Frame(A5OrderEnum.REQUEST_POLE_MONITOR_DATA.getCode(), restartReqInnerFrame); |
| | | System.out.println(a5Frame + " -----a5Frame"); |
| | | |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(deviceName, a5Frame); |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | |
| | | |
| | | A5LightPoleHeelingOperationReportInnerFrame operationReportInnerFrame |
| | | = new A5LightPoleHeelingOperationReportInnerFrame().transformFrame(commonFrame.getPayload()); |
| | | if (operationReportInnerFrame.isValidate()) { |
| | | return operationReportInnerFrame.getState(); |
| | | } else { |
| | | throw new BusinessException("数据校验错误,请重新请求"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置心跳包间隔时间(秒) |
| | | * |
| | | * @param devicesName |
| | | * @param setTime |
| | | * @return |
| | | */ |
| | | public String SetHeartbeatPacketTime(String devicesName, int setTime) { |
| | | if (setTime <= 0) { |
| | | throw new BusinessException("设置的心跳包间隔时间错误!"); |
| | | } |
| | | LightPoleHeelingSetHeartbeatPacketTimeReqInnerFrame setHeartbeatPacketTimeReqInnerFrame = |
| | | new LightPoleHeelingSetHeartbeatPacketTimeReqInnerFrame(setTime); |
| | | |
| | | A5Frame a5Frame = new A5Frame(A5OrderEnum.REQUEST_C3_DATA.getCode(), setHeartbeatPacketTimeReqInnerFrame); |
| | | System.out.println(a5Frame + " -----a5Frame"); |
| | | |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(devicesName, a5Frame); |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | |
| | | A5LightPoleHeelingOperationReportInnerFrame operationReportInnerFrame |
| | | = new A5LightPoleHeelingOperationReportInnerFrame().transformFrame(commonFrame.getPayload()); |
| | | if (operationReportInnerFrame.isValidate()) { |
| | | return operationReportInnerFrame.getState(); |
| | | } else { |
| | | throw new BusinessException("数据校验错误,请重新请求"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置传感器为初始状态 |
| | | * |
| | | * @return |
| | | */ |
| | | public String SetSensorState(String devicesName) { |
| | | LightPoleHeelingSetSensorStateReqInnerFrame setSensorStateReqInnerFrame = |
| | | new LightPoleHeelingSetSensorStateReqInnerFrame(); |
| | | |
| | | A5Frame a5Frame = new A5Frame(A5OrderEnum.REQUEST_C3_DATA.getCode(), setSensorStateReqInnerFrame); |
| | | System.out.println(a5Frame + " -----a5Frame"); |
| | | |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(devicesName, a5Frame); |
| | | System.out.println(commonFrame + " -----commonFrame"); |
| | | |
| | | A5LightPoleHeelingOperationReportInnerFrame operationReportInnerFrame |
| | | = new A5LightPoleHeelingOperationReportInnerFrame().transformFrame(commonFrame.getPayload()); |
| | | if (operationReportInnerFrame.isValidate()) { |
| | | return operationReportInnerFrame.getState(); |
| | | } else { |
| | | throw new BusinessException("数据校验错误,请重新请求"); |
| | | } |
| | | } |
| | | } |