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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations