| | |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.manager.iot.frame.FrameBuilder; |
| | | import com.sandu.ximon.admin.manager.iot.frame.IRequestFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.A5Frame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.request.AirDataReqInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.response.A5LightBrightnessRespInnerFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.dto.CommonFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.dto.WrapResponseCommonFrame; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.AtmoFunctionCode; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.enums.A5OrderEnum; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.mainboard.MainBoardInvokeSyncService; |
| | | import com.sandu.ximon.admin.service.AirDataService; |
| | | import com.sandu.ximon.dao.bo.AirDataBo; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static jodd.util.ThreadUtil.sleep; |
| | | |
| | | /** |
| | | * 大气数据 |
| | |
| | | |
| | | @PostMapping("/updateAirEquipmentInfo") |
| | | public ResponseVO<Object> updataAirEquipmentInfo(@RequestBody List<String> listMac) { |
| | | AirDataReqInnerFrame airDataReqInnerFrame = new AirDataReqInnerFrame(); |
| | | A5Frame a5Frame = new A5Frame(A5OrderEnum.REQUEST_ATMOSPHERE_DATA.getCode(), airDataReqInnerFrame); |
| | | |
| | | IRequestFrame build = FrameBuilder.builderA5().innerFrame(new AirDataReqInnerFrame()) |
| | | .orderType(AtmoFunctionCode.QueryHeartBeat.getCode()).build(); |
| | | // WrapResponseCommonFrame<A5AtmosphereHeartbeatReportInnerFrame> wrapResponseCommonFrame = |
| | | // MainBoardInvokeSyncService.getInstance().sendRRPC(listMac.get(0), a5Frame, A5AtmosphereHeartbeatReportInnerFrame.class); |
| | | |
| | | WrapResponseCommonFrame<A5LightBrightnessRespInnerFrame> a5LightBrightnessRespInnerFrameWrapResponseCommonFrame = |
| | | MainBoardInvokeSyncService.getInstance().sendRRPC(listMac.get(0), build, A5LightBrightnessRespInnerFrame.class); |
| | | List<String> success = new ArrayList<>(); |
| | | List<String> failed = new ArrayList<>(); |
| | | |
| | | return ResponseUtil.success(a5LightBrightnessRespInnerFrameWrapResponseCommonFrame); |
| | | for (String macStr : listMac) { |
| | | |
| | | try { |
| | | CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(macStr, a5Frame); |
| | | if (commonFrame != null) { |
| | | success.add(macStr); |
| | | } else { |
| | | failed.add(macStr); |
| | | } |
| | | } catch (Exception e) { |
| | | failed.add(macStr); |
| | | } |
| | | System.out.println(System.currentTimeMillis()); |
| | | } |
| | | Map<String, List> resultMap = new HashMap<>(); |
| | | resultMap.put("success", success); |
| | | resultMap.put("failed", failed); |
| | | |
| | | // System.out.println("commonFrame"+commonFrame); |
| | | // System.out.println(wrapResponseCommonFrame); |
| | | |
| | | // A5AtmosphereHeartbeatReportInnerFrame heartbeatReportInnerFrame = new A5AtmosphereHeartbeatReportInnerFrame().transformFrame(wrapResponseCommonFrame.getPayload()); |
| | | |
| | | // System.out.println(heartbeatReportInnerFrame); |
| | | // return ResponseUtil.success(a5LightBrightnessRespInnerFrameWrapResponseCommonFrame); |
| | | return ResponseUtil.success(resultMap); |
| | | } |
| | | |
| | | } |