|
|
@@ -273,7 +273,17 @@ public class BaseSafetyToolServiceImpl implements IBaseSafetyToolService {
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public int replaceTool(BaseSafetyTool baseSafetyTool) {
|
|
|
+ public AjaxResult replaceTool(BaseSafetyTool baseSafetyTool) {
|
|
|
+
|
|
|
+ //校验安全工具有效编码唯一
|
|
|
+ BaseSafetyTool validate = new BaseSafetyTool();
|
|
|
+ validate.setToolCode(baseSafetyTool.getToolCode());
|
|
|
+ validate.setState(ToolStateEnum.NORMAL.getCode());
|
|
|
+ List<BaseSafetyTool> list = getList(validate);
|
|
|
+ if(list.size() > 0){
|
|
|
+ return new AjaxResult(AjaxResult.Type.WARN, "工具编号已存在");
|
|
|
+ }
|
|
|
+
|
|
|
Long toolId = baseSafetyTool.getToolId();
|
|
|
//插入新的安全工具
|
|
|
baseSafetyTool.setCreateTime(new Date());
|
|
|
@@ -290,8 +300,9 @@ public class BaseSafetyToolServiceImpl implements IBaseSafetyToolService {
|
|
|
temp.setTestResult(ToolStateEnum.SCRAP.getCode());
|
|
|
temp.setScrapUser(SecurityUtils.getUserIdString());
|
|
|
temp.setReplaceToolId(baseSafetyTool.getToolId());
|
|
|
+ safetyToolMapper.update(temp);
|
|
|
|
|
|
- return safetyToolMapper.update(temp);
|
|
|
+ return AjaxResult.success();
|
|
|
}
|
|
|
|
|
|
/**
|