限制演示用户和配置不被删除

This commit is contained in:
季圣华
2021-04-25 22:18:17 +08:00
parent dc7d15c310
commit b35243f2f4
4 changed files with 30 additions and 2 deletions

View File

@@ -40,6 +40,8 @@ public class SystemConfigService {
@Resource
private LogService logService;
private static final String TEST_USER = "jsh";
public SystemConfig getSystemConfig(long id)throws Exception {
SystemConfig result=null;
try{
@@ -136,7 +138,11 @@ public class SystemConfigService {
String [] idArray=ids.split(",");
int result=0;
try{
result=systemConfigMapperEx.batchDeleteSystemConfigByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
if(userService.checkIsTestUser()) {
result=-1;
} else {
result = systemConfigMapperEx.batchDeleteSystemConfigByIds(new Date(), userInfo == null ? null : userInfo.getId(), idArray);
}
}catch(Exception e){
JshException.writeFail(logger, e);
}

View File

@@ -257,6 +257,12 @@ public class UserService {
sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
List<User> list = getUserListByIds(ids);
for(User user: list){
if(user.getLoginName().equals(TEST_USER)){
logger.error("异常码[{}],异常提示[{}],参数,ids:[{}]",
ExceptionConstants.USER_LIMIT_DELETE_CODE,ExceptionConstants.USER_LIMIT_DELETE_MSG,ids);
throw new BusinessRunTimeException(ExceptionConstants.USER_LIMIT_DELETE_CODE,
ExceptionConstants.USER_LIMIT_DELETE_MSG);
}
sb.append("[").append(user.getLoginName()).append("]");
}
logService.insertLog("用户", sb.toString(),
@@ -531,6 +537,12 @@ public class UserService {
throw new BusinessRunTimeException(ExceptionConstants.USER_NAME_LIMIT_USE_CODE,
ExceptionConstants.USER_NAME_LIMIT_USE_MSG);
} else {
if(ue.getLoginName().equals(TEST_USER)){
logger.error("异常码[{}],异常提示[{}],参数,obj:[{}]",
ExceptionConstants.USER_LIMIT_UPDATE_CODE,ExceptionConstants.USER_LIMIT_UPDATE_MSG, TEST_USER);
throw new BusinessRunTimeException(ExceptionConstants.USER_LIMIT_UPDATE_CODE,
ExceptionConstants.USER_LIMIT_UPDATE_MSG);
}
logService.insertLog("用户",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(ue.getId()).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());