Quellcode durchsuchen

1、解决处理报告只生成一次,改成可重复生成,覆盖;2、解决问题数为0,导出处理报告异常问题;

tags/v1.0.0^2
wanjing vor 1 Jahr
Ursprung
Commit
97f0cc24da
2 geänderte Dateien mit 36 neuen und 31 gelöschten Zeilen
  1. +23
    -17
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/export/ExportInspectionHandleReportService.java
  2. +13
    -14
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/query/QueryInspectionHandleReportService.java

+ 23
- 17
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/export/ExportInspectionHandleReportService.java Datei anzeigen

@@ -1,5 +1,6 @@
package com.tuoheng.admin.service.report.export;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -18,6 +19,7 @@ import com.tuoheng.admin.service.report.query.GetInspectionFileStatusList;
import com.tuoheng.admin.utils.DownloadUtil;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.common.core.config.UploadFileConfig;
import com.tuoheng.common.core.utils.FileUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
@@ -68,17 +70,6 @@ public class ExportInspectionHandleReportService {
//查询报告
Report report = (Report) result.getData();

// 查询问题清单
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(new LambdaQueryWrapper<InspectionFile>()
.eq(InspectionFile::getTenantId, tenantId)
.in(InspectionFile::getStatus, GetInspectionFileStatusList.getStatusList())
.eq(InspectionFile::getInspectionId, report.getInspectionId()));

// 查询问题处理结果
List<String> inspectionFileIdList = inspectionFileList.stream().map(o -> o.getId()).collect(Collectors.toList());
List<InspectionFileHandle> inspectionFileHandleList = inspectionFileHandleMapper.selectList(new LambdaQueryWrapper<InspectionFileHandle>()
.in(InspectionFileHandle::getInspectionFileId, inspectionFileIdList));

String filename = report.getReportCode() + "CL.doc";
String filePath = UploadFileConfig.uploadFolder + "/doc/" + filename;
File fd = new File(UploadFileConfig.uploadFolder + "/doc");
@@ -91,12 +82,27 @@ public class ExportInspectionHandleReportService {
String areaName = "江苏省泰州市海陵区";
String titleName = areaName + "城管巡检处理报告";
File f = new File(filePath);
if (!f.exists() || f.length() < 1000) {
result = generateReportWordService.buildWord(filePath, titleName, report, inspectionFileList, inspectionFileHandleList);
if (0 != result.getCode()) {
log.info("导出巡检处理报告业务:生成word失败:{}", result.getMsg());
return result;
}
if (f.exists()) {
FileUtils.deleteFile(filePath);
}

// 查询问题清单
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(new LambdaQueryWrapper<InspectionFile>()
.eq(InspectionFile::getTenantId, tenantId)
.in(InspectionFile::getStatus, GetInspectionFileStatusList.getStatusList())
.eq(InspectionFile::getInspectionId, report.getInspectionId()));
// 查询问题处理结果
List<String> inspectionFileIdList = inspectionFileList.stream().map(o -> o.getId()).collect(Collectors.toList());
List<InspectionFileHandle> inspectionFileHandleList = null;
if (CollectionUtil.isNotEmpty(inspectionFileIdList)) {
inspectionFileHandleList = inspectionFileHandleMapper.selectList(new LambdaQueryWrapper<InspectionFileHandle>()
.in(InspectionFileHandle::getInspectionFileId, inspectionFileIdList));
}

result = generateReportWordService.buildWord(filePath, titleName, report, inspectionFileList, inspectionFileHandleList);
if (0 != result.getCode()) {
log.info("导出巡检处理报告业务:生成word失败:{}", result.getMsg());
return result;
}

// 下载

+ 13
- 14
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/report/query/QueryInspectionHandleReportService.java Datei anzeigen

@@ -6,8 +6,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.conver.InspectionFileConverMapper;
import com.tuoheng.admin.conver.ReportConverMapper;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.InspectionFileStatusEnum;
import com.tuoheng.admin.enums.InspectionTypeEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.code.report.QueryInspectionReportCodeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.utils.CurrentUserUtil;
@@ -44,7 +44,7 @@ public class QueryInspectionHandleReportService {
private UserMapper userMapper;

@Autowired
private DeptMapper deptMapper;
private DeptMapper deptMapper;

@Autowired
private ReportMapper reportMapper;
@@ -88,7 +88,7 @@ public class QueryInspectionHandleReportService {
Report report = reportMapper.selectOne(new LambdaQueryWrapper<Report>()
.eq(Report::getTenantId, tenantId)
.eq(Report::getId, id)
.eq(Report::getMark, 1));
.eq(Report::getMark, MarkEnum.VALID.getCode());
if (null == report) {
return JsonResult.error(QueryInspectionReportCodeEnum.REPORT_IS_NOT_EXIST.getCode(), QueryInspectionReportCodeEnum.REPORT_IS_NOT_EXIST.getMsg());
}
@@ -104,9 +104,9 @@ public class QueryInspectionHandleReportService {
private InspectionReportVo buildInspectionReportVo(Report report) {
InspectionReportVo inspectionReportVo = ReportConverMapper.INSTANCE.fromReportToInspectionReportVo(report);
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(new LambdaQueryWrapper<InspectionFile>()
.eq(InspectionFile::getInspectionId, report.getInspectionId())
.in(InspectionFile::getStatus, GetInspectionFileStatusList.getStatusList())
.eq(InspectionFile::getMark, 1));
.eq(InspectionFile::getInspectionId, report.getInspectionId())
.in(InspectionFile::getStatus, GetInspectionFileStatusList.getStatusList())
.eq(InspectionFile::getMark, MarkEnum.VALID.getCode()));

List<InspectionFileReportVo> inspectionFileHandleVoList = InspectionFileConverMapper.INSTANCE.fromInspectionFileListToInspectionFileHandleVoList(inspectionFileList);

@@ -142,9 +142,9 @@ public class QueryInspectionHandleReportService {
inspectionFileReportVo.setInspectionFileHandleReportVo(inspectionFileHandleReportVo);
}
}
}else {
} else {
//如果没有处理的问题,添加图片url域名
inspectionFileHandleVoList =this.getImageUrl(inspectionFileHandleVoList);
inspectionFileHandleVoList = this.getImageUrl(inspectionFileHandleVoList);
}

String deptName = this.getDeptName(report.getDeptId());
@@ -165,7 +165,6 @@ public class QueryInspectionHandleReportService {
inspectionFileReportVo.setFileImage(CommonConfig.imageURL + inspectionFileReportVo.getFileImage());
inspectionFileReportVo.setFileThumbnail(CommonConfig.imageURL + inspectionFileReportVo.getFileThumbnail());
inspectionFileReportVo.setFileOriginal(CommonConfig.imageURL + inspectionFileReportVo.getFileOriginal());

}
return inspectionFileHandleVoList;
}
@@ -176,7 +175,7 @@ public class QueryInspectionHandleReportService {
if (!CollectionUtil.isEmpty(inspectionFileIdList)) {
inspectionFileHandleList = inspectionFileHandleMapper.selectList(Wrappers.<InspectionFileHandle>lambdaQuery()
.in(InspectionFileHandle::getInspectionFileId, inspectionFileIdList)
.eq(InspectionFileHandle::getMark, 1));
.eq(InspectionFileHandle::getMark, MarkEnum.VALID.getCode());

}
if (CollectionUtil.isEmpty(inspectionFileIdList)) {
@@ -209,7 +208,7 @@ public class QueryInspectionHandleReportService {
}
List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>()
.in(User::getId, userIdList)
.eq(User::getMark, 1));
.eq(User::getMark, MarkEnum.VALID.getCode());
Map<String, User> userMap = userList.stream().collect(Collectors.toMap(User::getId, Function.identity()));
return userMap;
}
@@ -223,7 +222,7 @@ public class QueryInspectionHandleReportService {
}
Dept dept = deptMapper.selectOne(new LambdaQueryWrapper<Dept>()
.eq(Dept::getId, deptId)
.eq(Dept::getMark, 1));
.eq(Dept::getMark, MarkEnum.VALID.getCode()));
if (null != dept) {
return dept.getName();
}
@@ -233,7 +232,7 @@ public class QueryInspectionHandleReportService {
private List<InspectionResultVo> buildInspectionResult(Report report) {
List<InspectionResultVo> inspectionResultVoList = new ArrayList<>();
List<QuestionType> questionTypeList = questionTypeMapper.selectList(new LambdaQueryWrapper<QuestionType>()
.eq(QuestionType::getMark, 1));
.eq(QuestionType::getMark, MarkEnum.VALID.getCode());
QuestionType questionType;
InspectionResultVo inspectionResultVo;
for (int i = 0; i < questionTypeList.size(); i++) {
@@ -252,7 +251,7 @@ public class QueryInspectionHandleReportService {
.eq(InspectionFile::getInspectionId, inspectionId)
.in(InspectionFile::getStatus, GetInspectionFileStatusList.getStatusList())
.eq(InspectionFile::getQuestionCode, questionCode)
.eq(InspectionFile::getMark, 1));
.eq(InspectionFile::getMark, MarkEnum.VALID.getCode());
return count;
}


Laden…
Abbrechen
Speichern