zhongrj
2024-02-05 af785456951642935b9546aae1b9cc4866f4d8f4
Merge remote-tracking branch 'origin/master'
3 files modified
36 ■■■■■ changed files
src/main/java/org/springblade/modules/taskPlaceSelfCheck/controller/TaskPlaceSelfCheckController.java 10 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskPlaceSelfCheck/service/ITaskPlaceSelfCheckService.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskPlaceSelfCheck/service/impl/TaskPlaceSelfCheckServiceImpl.java 24 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/taskPlaceSelfCheck/controller/TaskPlaceSelfCheckController.java
@@ -145,5 +145,15 @@
        return R.status(taskPlaceSelfCheckService.removeBatchByIds(Func.toLongList(ids)));
    }
    /**
     * 消防自查记任务表 修改
     */
    @PostMapping("/updateTaskPlaceSelfCheck")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "更新自查详情接口", notes = "传入taskPlaceSelfCheck")
    public R updateTaskPlaceSelfCheck(@Valid @RequestBody TaskPlaceSelfCheckVO taskPlaceSelfCheck) throws Exception {
        return R.status(taskPlaceSelfCheckService.updateTaskPlaceSelfCheck(taskPlaceSelfCheck));
    }
}
src/main/java/org/springblade/modules/taskPlaceSelfCheck/service/ITaskPlaceSelfCheckService.java
@@ -59,4 +59,6 @@
    Boolean savePlace(TaskPlaceSelfCheckVO taskPlaceSelfCheck) throws Exception;
    Boolean updateTaskPlaceSelfCheck(TaskPlaceSelfCheckVO taskPlaceSelfCheck) throws Exception;
}
src/main/java/org/springblade/modules/taskPlaceSelfCheck/service/impl/TaskPlaceSelfCheckServiceImpl.java
@@ -116,4 +116,28 @@
        return false;
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean updateTaskPlaceSelfCheck(TaskPlaceSelfCheckVO taskPlaceSelfCheck) throws Exception {
        // 1.更新任务表
        ITaskService bean2 = SpringUtils.getBean(ITaskService.class);
        Long aLong = bean2.updateTask(null, null, null, taskPlaceSelfCheck.getReasonFailure(), AuthUtil.getUserId(), taskPlaceSelfCheck.getTaskId(), taskPlaceSelfCheck.getStatus());
        if (aLong <= 0) {
            return false;
        }
        // 2.更新任务详情
        boolean save = updateById(taskPlaceSelfCheck);
        if (save) {
            // 3.更新题目记录
            List<TaskPlaceRecordVO> taskPlaceRecordList = taskPlaceSelfCheck.getTaskPlaceRecordVOList();
            ITaskPlaceRecordService bean = SpringUtil.getBean(ITaskPlaceRecordService.class);
            List<TaskPlaceRecordEntity> collect = taskPlaceRecordList.stream().filter(item -> item.getState().equals(0)).collect(Collectors.toList());
            boolean b = bean.updateBatchById(collect);
            if (b) {
                return b;
            }
            throw new Exception("保存失败!");
        }
        throw new Exception("保存失败!");
    }
}