优化代码提交
This commit is contained in:
parent
e0cc6d6e60
commit
a78a384df4
@ -430,10 +430,6 @@ public class TsTaskServiceImpl extends ServiceImpl<TsTaskMapper, TsTask> impleme
|
||||
}
|
||||
}
|
||||
|
||||
// 备用方案(不使用第三方库)
|
||||
private static boolean isNotEmpty(String value) {
|
||||
return value != null && !value.trim().isEmpty();
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 修改试验数据管理-试验任务管理
|
||||
@ -473,34 +469,28 @@ public class TsTaskServiceImpl extends ServiceImpl<TsTaskMapper, TsTask> impleme
|
||||
AbstractBaseFileService<?> fileService = storageSourceContext.getByStorageKey(newFolderRequest.getStorageKey());
|
||||
boolean flag = fileService.newFolder(newFolderRequest.getPath(), newFolderRequest.getName());
|
||||
if (flag) {
|
||||
String taskName = buildTaskName(tsTask);
|
||||
tsTask.setTaskName(taskName);
|
||||
int valueUpdate = tsTaskMapper.updateById(tsTask);
|
||||
if (valueUpdate == 1) {
|
||||
value = true;
|
||||
} else {
|
||||
value = false;
|
||||
}
|
||||
value = true;
|
||||
value = updateTsTaskWithNewName(tsTask);
|
||||
} else {
|
||||
LOGGER.error("节点新增成功,但是本地专项文件夹创建失败");
|
||||
value = false;
|
||||
}
|
||||
} else {
|
||||
|
||||
String taskName = buildTaskName(tsTask);
|
||||
tsTask.setTaskName(taskName);
|
||||
int valueUpdate = tsTaskMapper.updateById(tsTask);
|
||||
if (valueUpdate == 1) {
|
||||
value = true;
|
||||
} else {
|
||||
value = false;
|
||||
}
|
||||
|
||||
value = updateTsTaskWithNewName(tsTask);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private boolean updateTsTaskWithNewName(TsTask tsTask) {
|
||||
String taskName = buildTaskName(tsTask);
|
||||
tsTask.setTaskName(taskName);
|
||||
int rowsUpdated = tsTaskMapper.updateById(tsTask);
|
||||
boolean success = rowsUpdated == 1;
|
||||
if (!success) {
|
||||
LOGGER.error("更新试验任务失败,影响行数: {}", rowsUpdated);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 批量删除试验数据管理-试验任务管理
|
||||
* 参数说明 ids 试验数据管理id数组
|
||||
|
@ -307,7 +307,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
||||
***********************************/
|
||||
@Override
|
||||
public boolean updateSdproject(Project project) throws IOException {
|
||||
Boolean value = true;
|
||||
Boolean success = true;
|
||||
if (project.getProjectTime() == null || project.getProjectTime().equals("")) {
|
||||
project.setProjectTime(null);
|
||||
}
|
||||
@ -338,26 +338,20 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
||||
AbstractBaseFileService<?> fileService = storageSourceContext.getByStorageKey(newFolderRequest.getStorageKey());
|
||||
boolean flag = fileService.newFolder(newFolderRequest.getPath(), newFolderRequest.getName());
|
||||
if (flag) {
|
||||
int valueUpdate = projectMapper.updateById(project);
|
||||
if (valueUpdate == 1) {
|
||||
value = true;
|
||||
} else {
|
||||
value = false;
|
||||
}
|
||||
value = true;
|
||||
success = updateProjectAndSetResult(project);
|
||||
} else {
|
||||
LOGGER.error("节点新增成功,但是本地专项文件夹创建失败");
|
||||
value = false;
|
||||
success = false;
|
||||
}
|
||||
}else {
|
||||
int valueUpdate = projectMapper.updateById(project);
|
||||
if (valueUpdate == 1) {
|
||||
value = true;
|
||||
} else {
|
||||
value = false;
|
||||
}
|
||||
success = updateProjectAndSetResult(project);
|
||||
}
|
||||
return value;
|
||||
return success;
|
||||
}
|
||||
|
||||
private boolean updateProjectAndSetResult(Project project) {
|
||||
int rowsUpdated = projectMapper.updateById(project);
|
||||
return rowsUpdated == 1;
|
||||
}
|
||||
|
||||
public static String syncData(String frontEndJson, String dbJson) throws IOException {
|
||||
|
@ -358,25 +358,37 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
@Override
|
||||
public boolean resetPassword(String id) throws Exception {
|
||||
boolean isOk = false;
|
||||
//根据当前用户id 查询角色表的级别 currentUser.getUser() 获取当前用户id
|
||||
String level = sysUserMapper.getMaxLevel(id);
|
||||
//判断是否获取级别
|
||||
if (StrUtil.isNotEmpty(level)) {
|
||||
//判断当前用户级别 管理员及以上权限
|
||||
if (Integer.parseInt(level) <= 2) {
|
||||
UpdateWrapper<SysUser> updateWrapper = new UpdateWrapper<>();
|
||||
//根据id 修改密码,密码修改时间,最近修改者,最近修改日期 将密码修改为 123456
|
||||
String cryptPassword = passwordEncoder.encode("123456");
|
||||
updateWrapper.eq("id", id).set("password", cryptPassword).set(
|
||||
"pwdresettime",
|
||||
new Timestamp(System.currentTimeMillis())).set(
|
||||
"lastmodifydate",
|
||||
new Timestamp(System.currentTimeMillis())).set(
|
||||
"lastmodifier", getUsername());
|
||||
//是否修改成功
|
||||
isOk = this.update(updateWrapper);
|
||||
}
|
||||
}
|
||||
UpdateWrapper<SysUser> updateWrapper = new UpdateWrapper<>();
|
||||
//根据id 修改密码,密码修改时间,最近修改者,最近修改日期 将密码修改为 123456
|
||||
String cryptPassword = passwordEncoder.encode("123456");
|
||||
updateWrapper.eq("id", id).set("password", cryptPassword).set(
|
||||
"pwdresettime",
|
||||
new Timestamp(System.currentTimeMillis())).set(
|
||||
"lastmodifydate",
|
||||
new Timestamp(System.currentTimeMillis())).set(
|
||||
"lastmodifier", getUsername());
|
||||
//是否修改成功
|
||||
isOk = this.update(updateWrapper);
|
||||
|
||||
// //根据当前用户id 查询角色表的级别 currentUser.getUser() 获取当前用户id
|
||||
// String level = sysUserMapper.getMaxLevel(id);
|
||||
// //判断是否获取级别
|
||||
// if (StrUtil.isNotEmpty(level)) {
|
||||
// //判断当前用户级别 管理员及以上权限
|
||||
// if (Integer.parseInt(level) <= 2) {
|
||||
// UpdateWrapper<SysUser> updateWrapper = new UpdateWrapper<>();
|
||||
// //根据id 修改密码,密码修改时间,最近修改者,最近修改日期 将密码修改为 123456
|
||||
// String cryptPassword = passwordEncoder.encode("123456");
|
||||
// updateWrapper.eq("id", id).set("password", cryptPassword).set(
|
||||
// "pwdresettime",
|
||||
// new Timestamp(System.currentTimeMillis())).set(
|
||||
// "lastmodifydate",
|
||||
// new Timestamp(System.currentTimeMillis())).set(
|
||||
// "lastmodifier", getUsername());
|
||||
// //是否修改成功
|
||||
// isOk = this.update(updateWrapper);
|
||||
// }
|
||||
// }
|
||||
return isOk;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user