|
|
@@ -1,5 +1,8 @@
|
|
1
|
1
|
package com.ruoyi.wisdomarbitrate.service.sendrecord.impl;
|
|
2
|
2
|
|
|
|
3
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
4
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
5
|
+import cn.hutool.core.util.StrUtil;
|
|
3
|
6
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
4
|
7
|
import com.ruoyi.common.utils.EmailOutUtil;
|
|
5
|
8
|
import com.ruoyi.system.domain.entity.shortmessage.MsSendMailHistoryRecord;
|
|
|
@@ -14,10 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
14
|
17
|
import org.springframework.stereotype.Service;
|
|
15
|
18
|
|
|
16
|
19
|
import java.io.File;
|
|
17
|
|
-import java.util.Date;
|
|
18
|
|
-import java.util.HashMap;
|
|
19
|
|
-import java.util.List;
|
|
20
|
|
-import java.util.Map;
|
|
|
20
|
+import java.util.*;
|
|
|
21
|
+import java.util.function.Function;
|
|
|
22
|
+import java.util.stream.Collectors;
|
|
21
|
23
|
|
|
22
|
24
|
@Service
|
|
23
|
25
|
public class SendMailRecordServiceImpl implements ISendMailRecordService {
|
|
|
@@ -28,6 +30,31 @@ public class SendMailRecordServiceImpl implements ISendMailRecordService {
|
|
28
|
30
|
@Override
|
|
29
|
31
|
public List<SendMailRecord> selectSendMailRecordList(SendMailRecord sendMailRecord) {
|
|
30
|
32
|
List<SendMailRecord> records = sendMailRecordMapper.selectSendMailRecord(sendMailRecord);
|
|
|
33
|
+ if(CollectionUtil.isNotEmpty(records)){
|
|
|
34
|
+ Map<Long, String> recordmap = records.stream().filter(record -> StrUtil.isNotEmpty(record.getFileIds())).collect(Collectors.toMap(SendMailRecord::getId, SendMailRecord::getFileIds, (k1, k2) -> k2));
|
|
|
35
|
+ List<String> fileIds = new ArrayList<>(recordmap.values());
|
|
|
36
|
+ if(CollectionUtil.isNotEmpty(fileIds)){
|
|
|
37
|
+ List<MsCaseAttach> caseAttaches= msCaseAttachMapper.selectByIds(fileIds);
|
|
|
38
|
+ if(CollectionUtil.isNotEmpty(caseAttaches)){
|
|
|
39
|
+ Map<Long, MsCaseAttach> attachMap = caseAttaches.stream().collect(Collectors.toMap(MsCaseAttach::getAnnexId, Function.identity(), (k1, k2) -> k2));
|
|
|
40
|
+ for (SendMailRecord record : records) {
|
|
|
41
|
+ List<MsCaseAttach> msCaseAttaches = new ArrayList<>();
|
|
|
42
|
+ if(recordmap.containsKey(record.getId())){
|
|
|
43
|
+ String fileIdStr = recordmap.get(record.getId());
|
|
|
44
|
+ if(ObjectUtil.isNotNull(fileIdStr) ) {
|
|
|
45
|
+ String[] splitFileId = fileIdStr.split(",");
|
|
|
46
|
+ for (String fileId : splitFileId) {
|
|
|
47
|
+ if (ObjectUtil.isNotNull(fileId) && attachMap.containsKey(Long.parseLong(fileId))) {
|
|
|
48
|
+ msCaseAttaches.add(attachMap.get(Long.parseLong(fileId)));
|
|
|
49
|
+ }
|
|
|
50
|
+ }
|
|
|
51
|
+ record.setCaseAttachList(msCaseAttaches);
|
|
|
52
|
+ }
|
|
|
53
|
+ }
|
|
|
54
|
+ }
|
|
|
55
|
+ }
|
|
|
56
|
+ }
|
|
|
57
|
+ }
|
|
31
|
58
|
return records;
|
|
32
|
59
|
}
|
|
33
|
60
|
|
|
|
@@ -50,6 +77,13 @@ public class SendMailRecordServiceImpl implements ISendMailRecordService {
|
|
50
|
77
|
msSendMailHistoryRecord.setId(null);
|
|
51
|
78
|
msSendMailHistoryRecordMapper.insertSelective(msSendMailHistoryRecord);
|
|
52
|
79
|
sendMailRecord.setUpdateTime(new Date());
|
|
|
80
|
+ if(CollectionUtil.isNotEmpty(sendMailRecord.getCaseAttachList())){
|
|
|
81
|
+ List<Long> fileIdList = sendMailRecord.getCaseAttachList().stream().map(MsCaseAttach::getAnnexId).collect(Collectors.toList());
|
|
|
82
|
+ if(CollectionUtil.isNotEmpty(fileIdList)){
|
|
|
83
|
+ String fileIdStr = StrUtil.join(",", fileIdList);
|
|
|
84
|
+ sendMailRecord.setFileIds(fileIdStr);
|
|
|
85
|
+ }
|
|
|
86
|
+ }
|
|
53
|
87
|
sendMailRecordMapper.updateSendMailRecord(sendMailRecord);
|
|
54
|
88
|
return AjaxResult.success("编辑成功");
|
|
55
|
89
|
} else {
|