public void getAllAudioFileIds(long trainingGroundId, long deviceId, FlowContext flowContext) { try { long userId = flowContext.getUserId(); LogDebug.log("getAllAudioFileIds trainingGroundId:" + trainingGroundId + " deviceId:" + deviceId); UserIdType userIdType = GM.me.checkUserId(userId); if (userIdType == UserIdType.CAR_USER || userIdType == UserIdType.ERROR_USERID) { return; }

    List<AudioAndRegular> audioAndRegularList = new ArrayList<>();
    long regularId = trainingGroundId != 0 ? GM.me.getTrainingGroundDataById(trainingGroundId).getRegularId() : 0;
    if (regularId != 0) {
        // 该训练场绑定了规则
        audioAndRegularList.addAll(getAudioAndRegularListByRegularId(regularId));
    } else {
        // 该训练场没有绑定规则,去查询基站绑定规则
        DeviceEntity deviceEntity = GM.me.getBaseDeviceById(deviceId);
        long baseRegularId = deviceEntity != null ? deviceEntity.getRegularId() : 0;
        if (baseRegularId != 0) {
            // 该基站绑定了规则
            audioAndRegularList.addAll(getAudioAndRegularListByRegularId(baseRegularId));
        } else {
            // 基站和训练场都没有绑定规则
        }
    }
    
    BroadcastContext broadcastContext = BrokerClientHelper.getBroadcastContext();
    CmdInfo cmdInfo = CmdInfo.getCmdInfo(UserInfoCmd.cmd, UserInfoCmd.getAllAudioFileIds);
    broadcastContext.broadcast(cmdInfo, audioAndRegularList, userId);
} catch (Exception ignored) {
}

}

private List getAudioAndRegularListByRegularId(long regularId) { List specificRegularList = GM.me.getSpecificRegularListByRegularId(regularId); List audioAndRegularList = new ArrayList<>(); for (SpecificRegular specificRegular : specificRegularList) { if (specificRegular.getAudioFileId() != 0) { AudioAndRegular audioAndRegular = new AudioAndRegular(); audioAndRegular.setAudioFileId(specificRegular.getAudioFileId()); audioAndRegularList.add(audioAndRegular); } } return audioAndRegularList;


原文地址: http://www.cveoy.top/t/topic/iq3f 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录