From c3248741474ebce4b32ff8c6b638f839a3e03223 Mon Sep 17 00:00:00 2001 From: pengwei Date: Wed, 13 Aug 2025 15:04:12 +0800 Subject: [PATCH] =?UTF-8?q?fit:1=E3=80=81=E6=A1=88=E4=BB=B6=E6=A0=B8?= =?UTF-8?q?=E6=9F=A5=20=E5=8F=B0=E8=B4=A6=E5=AF=BC=E5=85=A5=E6=89=8B?= =?UTF-8?q?=E6=9C=BA=E5=8F=B7=E6=B2=A1=E6=95=B0=E6=8D=AE=EF=BC=8C=E5=B1=9E?= =?UTF-8?q?=E5=AE=9E=E6=83=85=E5=86=B5=E6=97=A0=E6=B3=95=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=20=20=20=20=202=E3=80=81=E6=A1=88=E4=BB=B6=E6=A0=B8=E6=9F=A5?= =?UTF-8?q?=20=E6=97=A0=E6=B6=89=E4=BC=81=E6=B6=89=E5=86=BB=E5=AF=BC?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/DataCaseVerifController.java | 30 +++++++++++++++++++ .../service/DataCaseVerifService.java | 1 + 2 files changed, 31 insertions(+) diff --git a/src/main/java/com/biutag/supervision/controller/data/DataCaseVerifController.java b/src/main/java/com/biutag/supervision/controller/data/DataCaseVerifController.java index 222cb42..fb3221a 100644 --- a/src/main/java/com/biutag/supervision/controller/data/DataCaseVerifController.java +++ b/src/main/java/com/biutag/supervision/controller/data/DataCaseVerifController.java @@ -7,12 +7,15 @@ import com.alibaba.excel.ExcelReader; import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.read.listener.ReadListener; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.biutag.supervision.constants.enums.DepartLevelEnum; import com.biutag.supervision.pojo.Result; import com.biutag.supervision.pojo.dto.DataCaseVerifDistribute; import com.biutag.supervision.pojo.dto.DataCaseVerifImportDto; +import com.biutag.supervision.pojo.dto.DataPetitionComplaintReplenishDto; import com.biutag.supervision.pojo.entity.DataCaseVerif; +import com.biutag.supervision.pojo.entity.DataPetitionComplaint; import com.biutag.supervision.pojo.entity.Negative; import com.biutag.supervision.pojo.entity.SupDepart; import com.biutag.supervision.pojo.param.DataCaseVerifQueryParam; @@ -103,6 +106,33 @@ public class DataCaseVerifController { return Result.success(list); } + + @PostMapping("importExcelInvolvedIssue") + public Result importExcelInvolvedIssue(@RequestPart("file")MultipartFile file) throws IOException{ + log.info("文件导入中------------------------------"); + String fileNameType = FileUtil.extName(file.getOriginalFilename()); + if (!"xls".equals(fileNameType) && !"xlsx".equals(fileNameType)) { + throw new RuntimeException("仅支持 xls/xlsx 格式文件的导入"); + } + EasyExcel.read(file.getInputStream(), DataPetitionComplaintReplenishDto.class,new ReadListener(){ + @Override + public void invoke(DataPetitionComplaintReplenishDto dto, AnalysisContext analysisContext) { + LambdaUpdateWrapper updateWrapper =new LambdaUpdateWrapper() + .set(DataCaseVerif::getInvolvedIssue,dto.getInvolvedIssue()) + .eq(DataCaseVerif::getOriginId,dto.getOriginId()); + if(StrUtil.isNotEmpty(dto.getOriginId()) && StrUtil.isNotEmpty(dto.getInvolvedIssue())){ + dataCaseVerifService.update(updateWrapper); + } + + } + @Override + public void doAfterAllAnalysed(AnalysisContext analysisContext) { + } + }).sheet(0).headRowNumber(1).doRead(); + return Result.success(); + } + + @PostMapping("{dataUpdateMethod}") public Result add(@RequestBody List body, @PathVariable String dataUpdateMethod) { if (body.isEmpty()) { diff --git a/src/main/java/com/biutag/supervision/service/DataCaseVerifService.java b/src/main/java/com/biutag/supervision/service/DataCaseVerifService.java index e057d86..2c4e681 100644 --- a/src/main/java/com/biutag/supervision/service/DataCaseVerifService.java +++ b/src/main/java/com/biutag/supervision/service/DataCaseVerifService.java @@ -64,6 +64,7 @@ public class DataCaseVerifService extends ServiceImpl