Browse Source

信件核对功能实现

dev_ycq
21819 2 years ago
parent
commit
5798cc736c
  1. 4
      mailbox-lan/src/main/java/com/biutag/lan/controller/work/WorkController.java
  2. 6
      mailbox-lan/src/main/java/com/biutag/lan/service/ExcelService.java
  3. 3
      mailbox-lan/src/main/java/com/biutag/lan/service/MailSourceService.java

4
mailbox-lan/src/main/java/com/biutag/lan/controller/work/WorkController.java

@ -49,7 +49,9 @@ public class WorkController {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult<Void> importExcel(@RequestBody String workVoList) { public AjaxResult<Void> importExcel(@RequestBody String workVoList) {
List<WorkVo> data = JSON.parseArray(workVoList, WorkVo.class); List<WorkVo> 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 @NotPower

6
mailbox-lan/src/main/java/com/biutag/lan/service/ExcelService.java

@ -39,11 +39,13 @@ public class ExcelService implements ReadListener<WorkVo> {
.ge(StrUtil.isNotBlank(mailQuery.getMailTimeStart()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", mailQuery.getMailTimeStart()) .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()); .le(StrUtil.isNotBlank(mailQuery.getMailTimeStartEnd()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", mailQuery.getMailTimeStartEnd());
dbDatalist = workMapper.selectList(queryWrapper); 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) { for (Work work : dbDatalist) {
if (work.getMailId().equals(workVo.getMailId())) { if (work.getMailId().equals(workVo.getMailId())) {
excelDatalist.remove(workVo); excelDatalist.remove(workVo);
break; i--; // 减去索引以补偿移除的元素
break; // 一旦找到匹配并移除,跳出内循环
} }
} }
} }

3
mailbox-lan/src/main/java/com/biutag/lan/service/MailSourceService.java

@ -48,6 +48,9 @@ public class MailSourceService extends ServiceImpl<MailSourceMapper, MailSource>
List<MailSource> list = mailSources.stream().map(mail -> { List<MailSource> list = mailSources.stream().map(mail -> {
MailSource mail1 = new MailSource(); MailSource mail1 = new MailSource();
BeanUtils.copyProperties(mail, mail1); BeanUtils.copyProperties(mail, mail1);
mail1.setId(mail.getMailId())
.setState(mail.getMailState());
return mail1; return mail1;
}).filter(mail -> { }).filter(mail -> {
QueryWrapper<MailSource> queryWrapper = new QueryWrapper<MailSource>() QueryWrapper<MailSource> queryWrapper = new QueryWrapper<MailSource>()

Loading…
Cancel
Save