fix: 法规符合性评估库查询问题

This commit is contained in:
2024-09-13 18:21:46 +08:00
parent 8813815bce
commit 6a82b7f86a
@@ -16,6 +16,7 @@ import com.jero.modules.assessmentLibrary.entity.LawsConformityAssessmentLibrary
import com.jero.modules.assessmentLibrary.entity.LawsConformityAssessmentLibraryDetail;
import com.jero.modules.assessmentLibrary.entity.vo.LawsConformityAssessmentLibraryExportVO;
import com.jero.modules.assessmentLibrary.entity.vo.MaterialFile;
import com.jero.modules.assessmentLibrary.entity.vo.UnsatisfiedRequireAttachFile;
import com.jero.modules.assessmentLibrary.mapper.LawsConformityAssessmentLibraryMapper;
import com.jero.modules.assessmentLibrary.service.ILawsConformityAssessmentLibraryService;
import com.jero.modules.laws.enterprise.util.BeanCopyUtils;
@@ -89,7 +90,8 @@ public class LawsConformityAssessmentLibraryServiceImpl extends ServiceImpl<Laws
if (StringUtils.isNotBlank(applicableMarkets)) {
String[] split = applicableMarkets.split(",");
for (String splitStr : split) {
queryWrapper.likeRight("t.country", splitStr);
queryWrapper.likeRight("t.country", splitStr + "-").or()
.apply("FIND_IN_SET({0}, t.country) > 0", splitStr);
}
}
if (StringUtils.isNotBlank(lawsConformityAssessmentLibrary.getSelections())) {
@@ -180,6 +182,7 @@ public class LawsConformityAssessmentLibraryServiceImpl extends ServiceImpl<Laws
});
this.settleDocuments(url, "佐证材料", recordsExport);
this.settleDocuments(url, "辅助说明材料", recordsExport);
// 去除文本的<p>
String regex = "<[^>]*>";
@@ -198,6 +201,7 @@ public class LawsConformityAssessmentLibraryServiceImpl extends ServiceImpl<Laws
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, LawsConformityAssessmentLibraryExportVO.class, recordsExport);
// 生成超链接
generateHyperlink("佐证材料", newRecordsExport, workbook);
generateHyperlinkTwo("辅助说明材料", newRecordsExport, workbook);
// 导出excel
workbook.write(fos);
// 生成并导出zip
@@ -278,6 +282,33 @@ public class LawsConformityAssessmentLibraryServiceImpl extends ServiceImpl<Laws
}
}
private static void generateHyperlinkTwo(String folderName, List<LawsConformityAssessmentLibraryExportVO> vos, Workbook workbook) {
Sheet sheet = workbook.getSheetAt(0);
// 设置字体颜色、下划线
CellStyle cellStyle = workbook.createCellStyle();
Font font = workbook.createFont();
font.setColor(IndexedColors.BLUE.getIndex());
font.setUnderline(Font.U_SINGLE);
cellStyle.setFont(font);
cellStyle.setWrapText(true);
int i = 1;
for (LawsConformityAssessmentLibraryExportVO vo : vos) {
if (!Objects.isNull(vo.getUnsatisfiedRequireAttach()) && !vo.getUnsatisfiedRequireAttachList().isEmpty()) {
for (UnsatisfiedRequireAttachFile materialFile : vo.getUnsatisfiedRequireAttachList()) {
Row row = sheet.getRow(i);
Cell cell = row.getCell(19);
// 构建完整的超链接路径,包括文件夹名称
String hyperlinkPath = folderName + "/" + materialFile.getFileName();
cell.setCellFormula("HYPERLINK(\"" + hyperlinkPath + "\", \"" + materialFile.getFileName() + "\")");
cell.setCellStyle(cellStyle);
i += 1;
}
} else {
i += 1;
}
}
}
private void settleDocuments(String url, String folderName, List<LawsConformityAssessmentLibraryExportVO> excelVos) throws IOException {
// 构建完整的文件夹路径
String directoryPath = url + File.separator + folderName;