Search in sources :

Example 56 with ErrorCode2

use of com.akaxin.common.constant.ErrorCode2 in project openzaly by akaxincom.

the class HttpGroupService method delete.

/**
 * 删除群组
 *
 * @param command
 * @return
 */
public CommandResponse delete(Command command) {
    CommandResponse commandResponse = new CommandResponse();
    ErrorCode2 errCode = ErrorCode2.ERROR;
    try {
        HaiGroupDeleteProto.HaiGroupDeleteRequest request = HaiGroupDeleteProto.HaiGroupDeleteRequest.parseFrom(command.getParams());
        String groupId = request.getGroupId();
        LogUtils.requestDebugLog(logger, command, request.toString());
        if (StringUtils.isNotBlank(groupId)) {
            if (UserGroupDao.getInstance().deleteGroup(groupId)) {
                errCode = ErrorCode2.SUCCESS;
            }
        } else {
            errCode = ErrorCode2.ERROR_PARAMETER;
        }
    } catch (Exception e) {
        errCode = ErrorCode2.ERROR_SYSTEMERROR;
        LogUtils.requestErrorLog(logger, command, e);
    }
    return commandResponse.setErrCode2(errCode);
}
Also used : ErrorCode2(com.akaxin.common.constant.ErrorCode2) HaiGroupDeleteProto(com.akaxin.proto.plugin.HaiGroupDeleteProto) CommandResponse(com.akaxin.common.command.CommandResponse)

Example 57 with ErrorCode2

use of com.akaxin.common.constant.ErrorCode2 in project openzaly by akaxincom.

the class HttpGroupService method removeMember.

/**
 * 删除群成员
 *
 * @param command
 * @return
 */
public CommandResponse removeMember(Command command) {
    CommandResponse commandResponse = new CommandResponse();
    ErrorCode2 errCode = ErrorCode2.ERROR;
    try {
        HaiGroupRemoveMemberProto.HaiGroupRemoveMemberRequest request = HaiGroupRemoveMemberProto.HaiGroupRemoveMemberRequest.parseFrom(command.getParams());
        String groupId = request.getGroupId();
        ProtocolStringList deleteMemberIds = request.getGroupMemberList();
        LogUtils.requestDebugLog(logger, command, request.toString());
        if (StringUtils.isNotBlank(groupId)) {
            if (UserGroupDao.getInstance().deleteGroupMember(groupId, deleteMemberIds)) {
                errCode = ErrorCode2.SUCCESS;
            }
        } else {
            errCode = ErrorCode2.ERROR_PARAMETER;
        }
    } catch (Exception e) {
        errCode = ErrorCode2.ERROR_SYSTEMERROR;
        LogUtils.requestErrorLog(logger, command, e);
    }
    return commandResponse.setErrCode2(errCode);
}
Also used : ErrorCode2(com.akaxin.common.constant.ErrorCode2) HaiGroupRemoveMemberProto(com.akaxin.proto.plugin.HaiGroupRemoveMemberProto) CommandResponse(com.akaxin.common.command.CommandResponse) ProtocolStringList(com.google.protobuf.ProtocolStringList)

Example 58 with ErrorCode2

use of com.akaxin.common.constant.ErrorCode2 in project openzaly by akaxincom.

the class HttpPluginService method delete.

/**
 * 删除扩展,直接从数据库中删除数据
 *
 * @param command
 * @return
 */
public CommandResponse delete(Command command) {
    CommandResponse commandResponse = new CommandResponse();
    ErrorCode2 errorCode = ErrorCode2.ERROR;
    try {
        HaiPluginDeleteProto.HaiPluginDeleteRequest request = HaiPluginDeleteProto.HaiPluginDeleteRequest.parseFrom(command.getParams());
        String pluginId = request.getPluginId();
        LogUtils.requestDebugLog(logger, command, request.toString());
        if (StringUtils.isNotBlank(pluginId)) {
            if (SitePluginDao.getInstance().deletePlugin(Integer.valueOf(pluginId))) {
                errorCode = ErrorCode2.SUCCESS;
            }
        } else {
            errorCode = ErrorCode2.ERROR_PARAMETER;
        }
    } catch (Exception e) {
        errorCode = ErrorCode2.ERROR_SYSTEMERROR;
        LogUtils.requestErrorLog(logger, command, e);
    }
    return commandResponse.setErrCode2(errorCode);
}
Also used : ErrorCode2(com.akaxin.common.constant.ErrorCode2) CommandResponse(com.akaxin.common.command.CommandResponse) HaiPluginDeleteProto(com.akaxin.proto.plugin.HaiPluginDeleteProto)

Example 59 with ErrorCode2

use of com.akaxin.common.constant.ErrorCode2 in project openzaly by akaxincom.

the class HttpPluginService method profile.

/**
 * 获取扩展的信息
 *
 * @param command
 * @return
 */
public CommandResponse profile(Command command) {
    CommandResponse commandResponse = new CommandResponse();
    ErrorCode2 errorCode = ErrorCode2.ERROR;
    try {
        HaiPluginProfileProto.HaiPluginProfileRequest request = HaiPluginProfileProto.HaiPluginProfileRequest.parseFrom(command.getParams());
        String pluginId = request.getPluginId();
        LogUtils.requestDebugLog(logger, command, request.toString());
        PluginBean bean = SitePluginDao.getInstance().getPluginProfile(Integer.valueOf(pluginId));
        if (bean != null) {
            HaiPluginProfileProto.HaiPluginProfileResponse response = HaiPluginProfileProto.HaiPluginProfileResponse.newBuilder().setPlugin(getPluginProfile(bean)).build();
            commandResponse.setParams(response.toByteArray());
            errorCode = ErrorCode2.SUCCESS;
        }
    } catch (Exception e) {
        errorCode = ErrorCode2.ERROR_SYSTEMERROR;
        LogUtils.requestErrorLog(logger, command, e);
    }
    return commandResponse.setErrCode2(errorCode);
}
Also used : ErrorCode2(com.akaxin.common.constant.ErrorCode2) HaiPluginProfileProto(com.akaxin.proto.plugin.HaiPluginProfileProto) CommandResponse(com.akaxin.common.command.CommandResponse) PluginBean(com.akaxin.site.storage.bean.PluginBean)

Example 60 with ErrorCode2

use of com.akaxin.common.constant.ErrorCode2 in project openzaly by akaxincom.

the class HttpPluginService method update.

/**
 * 更新扩展的信息
 *
 * @param command
 * @return
 */
public CommandResponse update(Command command) {
    CommandResponse commandResponse = new CommandResponse();
    ErrorCode2 errorCode = ErrorCode2.ERROR;
    try {
        HaiPluginUpdateProto.HaiPluginUpdateRequest request = HaiPluginUpdateProto.HaiPluginUpdateRequest.parseFrom(command.getParams());
        LogUtils.requestDebugLog(logger, command, request.toString());
        PluginBean bean = new PluginBean();
        bean.setId(Integer.valueOf(request.getPlugin().getId()));
        bean.setName(request.getPlugin().getName());
        bean.setIcon(request.getPlugin().getIcon());
        bean.setUrlPage(request.getPlugin().getUrlPage());
        bean.setApiUrl(request.getPlugin().getApiUrl());
        bean.setAuthKey(request.getPlugin().getAuthKey());
        bean.setAllowedIp(request.getPlugin().getAllowedIp());
        bean.setSort(request.getPlugin().getOrder());
        bean.setPosition(request.getPlugin().getPositionValue());
        bean.setPermissionStatus(request.getPlugin().getPermissionStatusValue());
        if (SitePluginDao.getInstance().updatePlugin(bean)) {
            errorCode = ErrorCode2.SUCCESS;
        }
    } catch (Exception e) {
        errorCode = ErrorCode2.ERROR_SYSTEMERROR;
        LogUtils.requestErrorLog(logger, command, e);
    }
    return commandResponse.setErrCode2(errorCode);
}
Also used : ErrorCode2(com.akaxin.common.constant.ErrorCode2) HaiPluginUpdateProto(com.akaxin.proto.plugin.HaiPluginUpdateProto) CommandResponse(com.akaxin.common.command.CommandResponse) PluginBean(com.akaxin.site.storage.bean.PluginBean)

Aggregations

CommandResponse (com.akaxin.common.command.CommandResponse)68 ErrorCode2 (com.akaxin.common.constant.ErrorCode2)68 UserProto (com.akaxin.proto.core.UserProto)12 PluginBean (com.akaxin.site.storage.bean.PluginBean)7 GroupProto (com.akaxin.proto.core.GroupProto)6 GroupProfileBean (com.akaxin.site.storage.bean.GroupProfileBean)6 SimpleUserBean (com.akaxin.site.storage.bean.SimpleUserBean)6 UserProfileBean (com.akaxin.site.storage.bean.UserProfileBean)6 UserDeviceBean (com.akaxin.site.storage.bean.UserDeviceBean)5 ByteString (com.google.protobuf.ByteString)5 DeviceProto (com.akaxin.proto.core.DeviceProto)4 ProtocolStringList (com.google.protobuf.ProtocolStringList)4 ConfigProto (com.akaxin.proto.core.ConfigProto)3 GroupMemberBean (com.akaxin.site.storage.bean.GroupMemberBean)3 UserGroupBean (com.akaxin.site.storage.bean.UserGroupBean)3 FileProto (com.akaxin.proto.core.FileProto)2 HaiSiteUpdateConfigProto (com.akaxin.proto.plugin.HaiSiteUpdateConfigProto)2 ApiFriendSettingProto (com.akaxin.proto.site.ApiFriendSettingProto)2 ApiGroupUpdateSettingProto (com.akaxin.proto.site.ApiGroupUpdateSettingProto)2 User2Notice (com.akaxin.site.business.impl.notice.User2Notice)2