REM:
1. 增加用户认证打印日志
2. 增加处置任务管理打印日志
This commit is contained in:
chenlinghy 2020-05-15 17:50:35 +08:00
parent adccc0f09c
commit 4556a2936f
3 changed files with 15 additions and 0 deletions

View File

@ -59,11 +59,18 @@ public class TaskCacheManagerImpl implements TaskCacheManager {
|| taskData.getDisposeIp() == null
|| taskData.getDisposeIp().length() == 0
|| taskData.getId() == -1) {
if(taskData != null){
log.error("Add task error: taskId:{}, devId:{}, disposeIp:{}", taskData.getId(), taskData.getDeviceId(), taskData.getDisposeIp());
}else{
log.error("No Task info detail");
}
return ErrorCode.ERR_INPUTMISS;
}
// 判断任务是否已经存在
if (taskCacheMap.containsKey(taskData.getId())) {
log.error("Task info detail already existed:taskId:{}, devId:{}, disposeIp:{}",
taskData.getId(), taskData.getDeviceId(), taskData.getDisposeIp());
return ErrorCode.ERR_DEVICEEXISTS;
}

View File

@ -59,12 +59,14 @@ public class UserAccountCacheManagerImpl implements UserAccountCacheManager {
String username = getUsernameByToken(token);
if (username == null || username.length() == 0) {
log.error("User {} not logged in", username);
return ErrorCode.ERR_LOGOUT;
} else if ("admin".equals(username)) {
// admin 用户具有操作权限
return ErrorCode.ERR_OK;
}
log.error("User {} not enough permissions", username);
return ErrorCode.ERR_PERMISSION;
}
@ -80,6 +82,7 @@ public class UserAccountCacheManagerImpl implements UserAccountCacheManager {
return userAccountCache.get(token).getUsername();
}
log.error("according to token [{}] not found username {} in cache", token, userAccountCache.get(token).getUsername());
return null;
}

View File

@ -91,12 +91,15 @@ public class UserAccountServiceImpl implements UserAccountService {
if (errTimes == ConstValue.GlobalConfigure.ALLOW_PWD_ERR_TIMES - 1) {
// 提示用户即将锁定账户
log.error("User {} password [{}] error reach the upper limit", username, password);
return MReturnType.<ErrorCode, String>builder().firstParam(ErrorCode.ERR_PASSWORDMORE).build();
} else if (errTimes >= ConstValue.GlobalConfigure.ALLOW_PWD_ERR_TIMES) {
// 锁定账户
userAccountMapper.lockUserAccount(username);
log.error("User {} is locked", username);
return MReturnType.<ErrorCode, String>builder().firstParam(ErrorCode.ERR_USERLOCK).build();
} else {
log.error("User {} password [{}] error", username, password);
return MReturnType.<ErrorCode, String>builder().firstParam(ErrorCode.ERR_PASSWORD).build();
}
}
@ -118,6 +121,7 @@ public class UserAccountServiceImpl implements UserAccountService {
UserAccount loginUser = userAccountMapper.getUserByName(username);
if (loginUser == null) {
log.error("User {} not exists", username);
return ErrorCode.ERR_USERNOTFOUND;
}
@ -143,6 +147,7 @@ public class UserAccountServiceImpl implements UserAccountService {
return userAccountMapper.getUserByName(username);
}
log.error("according to token [{}] not found username {}", token, username);
return null;
}
}