添加超级管理编辑权限,不校验状态

This commit is contained in:
dengchun
2025-05-11 22:10:51 +08:00
parent 2c421cabc1
commit 3a0412f3a5

View File

@@ -82,6 +82,9 @@ public class ExperimentController extends JeecgController<Experiment, IExperimen
@Autowired @Autowired
private SysDataSourceController sysDataSourceController; private SysDataSourceController sysDataSourceController;
private static final String ADMIN_NAME = "admin";
/** /**
* 分页列表查询 * 分页列表查询
* *
@@ -214,6 +217,11 @@ public class ExperimentController extends JeecgController<Experiment, IExperimen
@RequiresPermissions("database:experiment:edit") @RequiresPermissions("database:experiment:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody Experiment experiment, HttpServletRequest request) { public Result<String> edit(@RequestBody Experiment experiment, HttpServletRequest request) {
String username = JwtUtil.getUserNameByToken(request);
SysUser userByName = userService.getUserByName(username);
// 超级管理不用判断状态和修改状态,只修改数据。 20250511 邓春
if (!ADMIN_NAME.equals(userByName)) {
Experiment dbExp = experimentService.getById(experiment.getId()); Experiment dbExp = experimentService.getById(experiment.getId());
if (StringUtils.equals(dbExp.getStatus(), ExperimentStatus.COMPLETED) || StringUtils.equals(dbExp.getStatus(), if (StringUtils.equals(dbExp.getStatus(), ExperimentStatus.COMPLETED) || StringUtils.equals(dbExp.getStatus(),
ExperimentStatus.REVIEWED)) { ExperimentStatus.REVIEWED)) {
@@ -225,6 +233,8 @@ public class ExperimentController extends JeecgController<Experiment, IExperimen
experiment.setStatus(dbExp.getStatus()); experiment.setStatus(dbExp.getStatus());
} }
experiment.setIndexNo(dbExp.getIndexNo()); experiment.setIndexNo(dbExp.getIndexNo());
}
List<ExperimentSampleInfo> sampleInfoList = experiment.getSampleInfoList(); List<ExperimentSampleInfo> sampleInfoList = experiment.getSampleInfoList();
List<ExperimentIrradiationBoard> irradiationBoardList = experiment.getIrradiationBoardList(); List<ExperimentIrradiationBoard> irradiationBoardList = experiment.getIrradiationBoardList();
List<ExperimentDeviationCondition> deviationConditionList = experiment.getDeviationConditionList(); List<ExperimentDeviationCondition> deviationConditionList = experiment.getDeviationConditionList();
@@ -248,8 +258,6 @@ public class ExperimentController extends JeecgController<Experiment, IExperimen
ExperimentLog experimentLog = new ExperimentLog(); ExperimentLog experimentLog = new ExperimentLog();
experimentLog.setExperimentId(experiment.getId()); experimentLog.setExperimentId(experiment.getId());
experimentLog.setLogContent("修改实验信息"); experimentLog.setLogContent("修改实验信息");
String username = JwtUtil.getUserNameByToken(request);
SysUser userByName = userService.getUserByName(username);
experimentLog.setCreateBy(userByName.getRealname()); experimentLog.setCreateBy(userByName.getRealname());
experimentLogService.save(experimentLog); experimentLogService.save(experimentLog);
return Result.OK("编辑成功!"); return Result.OK("编辑成功!");