无关风月
2 天以前 951b06c1aaa8cc4c83f9e4b4ba9fae066fd84941
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TInspectorController.java
@@ -127,9 +127,11 @@
                query.setLocationIds(collect);
                return R.ok(new PageInfo<>());
            }else{
                collect = collect.stream().filter(query.getLocationIds()::contains).collect(Collectors.toList());
                if (collect.isEmpty()){
                    return R.ok(new PageInfo<>());
                if (query.getLocationIds()!=null){
                    collect = collect.stream().filter(query.getLocationIds()::contains).collect(Collectors.toList());
                    if (collect.isEmpty()){
                        return R.ok(new PageInfo<>());
                    }
                }
                query.setLocationIds(collect);
            }
@@ -137,7 +139,7 @@
        return R.ok(inspectorService.pageList(query));
    }
    @Log(title = "督察记录导出", businessType = BusinessType.EXPORT)
    @Log(title = "督察记录导出", businessType = BusinessType.OTHER)
    @ApiOperation(value = "督察记录导出")
    @PostMapping(value = "/exportExcel")
    public void exportExcel(@RequestBody InsepectorListQuery query) {
@@ -258,7 +260,6 @@
    public R<Boolean> audit(@RequestBody TInspectorAuditDTO dto) {
        TTaskAuditDTO tTaskAuditDTO = new TTaskAuditDTO();
        BeanUtils.copyProperties(dto, tTaskAuditDTO);
        dto.setAuditTime(LocalDateTime.now());
        TTask task = taskCleanerService.getById(dto.getTaskId());
        TLocation location = locationService.getById(task.getLocationId());
        TNotice tNotice = new TNotice();
@@ -268,57 +269,26 @@
        tNotice.setStatus(1);
        tNotice.setDataId(task.getId());
        tNotice.setNoticeSetType(noticeSet.getNoticeType());
        if (dto.getAuditStatus()==2){
            tTaskAuditDTO.setHandleType(3);
            // 将任务修改为待整改
            task.setStatus(4);
            taskCleanerService.updateById(task);
            // 增加消息
            tNotice.setNoticeType(1);
            tNotice.setNoticeContent("【"+location.getLocationName()+"】任务不合格,请重新上传!");
        }else{
            tTaskAuditDTO.setHandleType(2);
            // 如果是初次审核就通过 将状态设置为已完成
            List<TTaskDetail> list = tTaskDetailService.lambdaQuery().eq(TTaskDetail::getTaskId, dto.getTaskId()).list();
            if (list.isEmpty()){
                if (dto.getClearStatus()==1){
                    task.setStatus(6);
                    dto.setStatus(4);
                    taskCleanerService.updateById(task);
                }else{
                    dto.setStatus(2);
                    task.setStatus(4);
                    taskCleanerService.updateById(task);
// 增加消息
                    tNotice.setNoticeType(1);
                    tNotice.setNoticeContent("【"+location.getLocationName()+"】任务不合格,请重新上传!");
                }
        if (dto.getAuditStatus()==1){
            if (dto.getClearStatus()==2){
                tTaskAuditDTO.setHandleType(3);
                dto.setStatus(2);
                // 增加消息
                tNotice.setNoticeType(1);
                tNotice.setNoticeContent("【"+location.getLocationName()+"】督察任务不合格,请重新上传!");
                noticeService.save(tNotice);
            }else{
                if (dto.getClearStatus()==1){
                if (dto.getAuditTime()!=null){
                    dto.setStatus(3);
                    task.setStatus(5);
                    taskCleanerService.updateById(task);
                    // 增加消息
                    tNotice.setNoticeType(2);
                    tNotice.setNoticeContent("【"+location.getLocationName()+"】任务已通过");
                }else{
                    dto.setStatus(2);
                    task.setStatus(4);
                    taskCleanerService.updateById(task);
                    // 增加消息
                    tNotice.setNoticeType(1);
                    tNotice.setNoticeContent("【"+location.getLocationName()+"】任务不合格,请重新上传!");
                    dto.setStatus(4);
                }
            }
        }
        noticeService.save(tNotice);
        dto.setAuditTime(LocalDateTime.now());
        dto.setAuditPerson(tokenService.getLoginUser().getUserId()+"");
        inspectorService.updateById(dto);
        tTaskDetailService.save(tTaskAuditDTO);
        return R.ok();
    }
}