2021与蓝度共同重构项目,服务端
fix
zhanzhiqin
2022-10-14 798e9d217439543b61cb095131f9bed1c0264dc6
fix
已修改2个文件
268 ■■■■ 文件已修改
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/AirEquipmentNongGengController.java 82 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/AirEquipmentNongGengService.java 186 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/AirEquipmentNongGengController.java
@@ -70,45 +70,45 @@
        return ResponseUtil.success(airEquipmentNongGengService.setHeartBeatTime(mac, time));
    }
    /**
     * 查询大气设备心跳包时间
     *
     * @return
     */
    @GetMapping("/QueryHeartBeatTime")
    public ResponseVO<Object> QueryHeartBeatTime(@RequestParam(value = "mac", required = false) String mac) {
        if (!permissionConfig.check(MenuEnum.AIR_HEARTBEATTIME.getCode())) {
            return ResponseUtil.fail("缺少对应用户权限");
        }
        return ResponseUtil.success(airEquipmentNongGengService.QueryHeartBeatTime(mac));
    }
    /**
     * 查询软硬件版本
     *
     * @param mac
     * @return
     */
    @GetMapping("/QueryVersion")
    public ResponseVO<Object> QueryVersion(@RequestParam(value = "mac", required = false) String mac) {
        if (!permissionConfig.check(MenuEnum.AIR_QUERYVERSION.getCode())) {
            return ResponseUtil.fail("缺少对应用户权限");
        }
        return ResponseUtil.success(airEquipmentNongGengService.QueryVersion(mac));
    }
    /**
     * 软重启
     *
     * @param mac
     * @return
     */
    @GetMapping("/Reboot")
    public ResponseVO<Object> Reboot(@RequestParam(value = "mac", required = false) String mac) {
        if (!permissionConfig.check(MenuEnum.AIR_REBOOT.getCode())) {
            return ResponseUtil.fail("缺少对应用户权限");
        }
        return ResponseUtil.success(airEquipmentNongGengService.Reboot(mac));
    }
//    /**
//     * 查询大气设备心跳包时间
//     *
//     * @return
//     */
//    @GetMapping("/QueryHeartBeatTime")
//    public ResponseVO<Object> QueryHeartBeatTime(@RequestParam(value = "mac", required = false) String mac) {
//        if (!permissionConfig.check(MenuEnum.AIR_HEARTBEATTIME.getCode())) {
//            return ResponseUtil.fail("缺少对应用户权限");
//        }
//        return ResponseUtil.success(airEquipmentNongGengService.QueryHeartBeatTime(mac));
//    }
//
//
//    /**
//     * 查询软硬件版本
//     *
//     * @param mac
//     * @return
//     */
//    @GetMapping("/QueryVersion")
//    public ResponseVO<Object> QueryVersion(@RequestParam(value = "mac", required = false) String mac) {
//        if (!permissionConfig.check(MenuEnum.AIR_QUERYVERSION.getCode())) {
//            return ResponseUtil.fail("缺少对应用户权限");
//        }
//        return ResponseUtil.success(airEquipmentNongGengService.QueryVersion(mac));
//    }
//
//    /**
//     * 软重启
//     *
//     * @param mac
//     * @return
//     */
//    @GetMapping("/Reboot")
//    public ResponseVO<Object> Reboot(@RequestParam(value = "mac", required = false) String mac) {
//        if (!permissionConfig.check(MenuEnum.AIR_REBOOT.getCode())) {
//            return ResponseUtil.fail("缺少对应用户权限");
//        }
//        return ResponseUtil.success(airEquipmentNongGengService.Reboot(mac));
//    }
}
ximon-admin/src/main/java/com/sandu/ximon/admin/service/AirEquipmentNongGengService.java
@@ -183,98 +183,98 @@
            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("数据校验异常!");
        }
    }
//
//    /**
//     * 查询大气设备心跳包时间
//     */
//    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("数据校验异常!");
//        }
//    }
}