diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/work/WorkController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/work/WorkController.java index 66e8eea..7ffaf57 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/controller/work/WorkController.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/work/WorkController.java @@ -49,7 +49,9 @@ public class WorkController { @Transactional(rollbackFor = Exception.class) public AjaxResult importExcel(@RequestBody String workVoList) { List data = JSON.parseArray(workVoList, WorkVo.class); - return workService.saveExcelBatch(data) && mailSourceService.saveExcelBatch(data) ? AjaxResult.success() : AjaxResult.failed("导入失败"); + workService.saveExcelBatch(data); + mailSourceService.saveExcelBatch(data); + return AjaxResult.success(); } @NotPower diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/ExcelService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/ExcelService.java index 02ee12f..78d2e53 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/ExcelService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/ExcelService.java @@ -39,11 +39,13 @@ public class ExcelService implements ReadListener { .ge(StrUtil.isNotBlank(mailQuery.getMailTimeStart()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", mailQuery.getMailTimeStart()) .le(StrUtil.isNotBlank(mailQuery.getMailTimeStartEnd()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", mailQuery.getMailTimeStartEnd()); dbDatalist = workMapper.selectList(queryWrapper); - for (WorkVo workVo : excelDatalist) { + for (int i = 0; i < excelDatalist.size(); i++) { + WorkVo workVo = excelDatalist.get(i); for (Work work : dbDatalist) { if (work.getMailId().equals(workVo.getMailId())) { excelDatalist.remove(workVo); - break; + i--; // 减去索引以补偿移除的元素 + break; // 一旦找到匹配并移除,跳出内循环 } } } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/MailSourceService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/MailSourceService.java index 3d48320..19e6aa1 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/MailSourceService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/MailSourceService.java @@ -48,6 +48,9 @@ public class MailSourceService extends ServiceImpl List list = mailSources.stream().map(mail -> { MailSource mail1 = new MailSource(); BeanUtils.copyProperties(mail, mail1); + mail1.setId(mail.getMailId()) + .setState(mail.getMailState()); + return mail1; }).filter(mail -> { QueryWrapper queryWrapper = new QueryWrapper()