diff --git a/laws-modules/src/main/java/com/jero/modules/laws/standard/service/impl/LawsEnterpriseStandardServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/laws/standard/service/impl/LawsEnterpriseStandardServiceImpl.java index a6f1c444..0fe4ff69 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/standard/service/impl/LawsEnterpriseStandardServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/standard/service/impl/LawsEnterpriseStandardServiceImpl.java @@ -3,6 +3,7 @@ package com.jero.modules.laws.standard.service.impl; import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.jero.common.api.CommonAPI; import com.jero.common.api.vo.ResultCommon; @@ -199,12 +200,12 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl dtoList) { try { // 设置导出参数 - ExportParams exportParams = new ExportParams(null, "有问题的老法规"); // 可以为标题添加更多的配置 + ExportParams exportParams = new ExportParams(null, "ProblemOldStandard.xls"); // 可以为标题添加更多的配置 Workbook workbook = ExcelExportUtil.exportExcel(exportParams, OldSystemImportDTO.class, dtoList); // 设置响应头和内容类型 response.setContentType("application/vnd.ms-excel"); - response.setHeader("Content-Disposition", "attachment; filename=有问题的老法规.xls"); + response.setHeader("Content-Disposition", "attachment; filename=ProblemOldStandard.xls"); // 写出到响应流 workbook.write(response.getOutputStream()); @@ -448,6 +449,10 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl wrapper = new LambdaUpdateWrapper<>(); + wrapper.eq(OSSFile::getStandardId, existingEntity.getId()); + ossFileService.remove(wrapper); // 代替 lawsReplacedStandardService.removeRelation(existingEntity.getStandardNumber(), 1); } @@ -471,9 +476,12 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl ossFiles = standardNumberToFileMap.get(entity.getStandardNumber()); + if (ossFiles != null && !ossFiles.isEmpty()) { + OSSFile ossFile = ossFiles.get(0); + ossFile.setStandardId(standardId); + ossFileService.save(ossFile); + } } log.info("老法规企标覆盖导入完成"); // 获取当前时间戳(毫秒)