2021与蓝度共同重构项目,服务端
liuhaonan
2022-01-18 51b53373d150e4107a51fcf502d0598b7d82c455
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightService.java
@@ -131,10 +131,11 @@
        for (LightControlParam param : paramList) {
            A5LightBrightnessReqInnerFrame lightControlFrame = new A5LightBrightnessReqInnerFrame(param.getBrightness());
            A5Frame a5Frame = new A5Frame(A5OrderEnum.REQUEST_LIGHT_DATA.getCode(), lightControlFrame);
            Map<String, Object> map = new HashMap<>();
            try {
                map.put("deviceCode", param.getDeviceCode());
            WrapResponseCommonFrame<A5LightBrightnessRespInnerFrame> frame = MainBoardInvokeSyncService.getInstance()
                    .sendRRPC(param.getDeviceCode(), a5Frame, A5LightBrightnessRespInnerFrame.class);
            Map<String, Object> map = new HashMap<>();
            map.put("deviceCode", param.getDeviceCode());
            if (frame == null) {
                map.put("status", DeviceRespStatusEnums.OTHER_ERROR.getCode());
                resultList.add(map);
@@ -151,6 +152,10 @@
                light.setLightPercent(param.getBrightness());
                update(light, Wrappers.lambdaUpdate(Light.class).eq(Light::getDeviceCode, param.getDeviceCode()));
            }
            }catch (BusinessException e){
                map.put("status", DeviceRespStatusEnums.OTHER_ERROR.getCode());
                resultList.add(map);
            }
        }
        return resultList;