|
@@ -493,23 +493,19 @@ public class WeComHistoryDataJob {
|
|
|
if (CollectionUtils.isEmpty(attachmentIds) || CollectionUtils.isEmpty(sendMsgResultIds)) {
|
|
|
return;
|
|
|
}
|
|
|
+ List<AttachmentWithMsgResult> list = new ArrayList<>();
|
|
|
for (Long attachmentId : attachmentIds) {
|
|
|
for (Long sendMsgResultId : sendMsgResultIds) {
|
|
|
- AttachmentWithMsgResultExample example = new AttachmentWithMsgResultExample();
|
|
|
- example.createCriteria().andAttachmentIdEqualTo(attachmentId).andMsgResultIdEqualTo(sendMsgResultId);
|
|
|
- long l = attachmentWithMsgResultMapper.countByExample(example);
|
|
|
- if (l == 0) {
|
|
|
- try {
|
|
|
- AttachmentWithMsgResult attachmentWithMsgResult = new AttachmentWithMsgResult();
|
|
|
- attachmentWithMsgResult.setAttachmentId(attachmentId);
|
|
|
- attachmentWithMsgResult.setMsgResultId(sendMsgResultId);
|
|
|
- attachmentWithMsgResultMapper.insertSelective(attachmentWithMsgResult);
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("insert error", e);
|
|
|
- }
|
|
|
- }
|
|
|
+ AttachmentWithMsgResult attachmentWithMsgResult = new AttachmentWithMsgResult();
|
|
|
+ attachmentWithMsgResult.setAttachmentId(attachmentId);
|
|
|
+ attachmentWithMsgResult.setMsgResultId(sendMsgResultId);
|
|
|
+ list.add(attachmentWithMsgResult);
|
|
|
}
|
|
|
}
|
|
|
+ List<List<AttachmentWithMsgResult>> partition = Lists.partition(list, 2000);
|
|
|
+ for (List<AttachmentWithMsgResult> AttachmentWithMsgResults : partition) {
|
|
|
+ attachmentWithMsgResultMapper.insertList(AttachmentWithMsgResults);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private String getGroupMsgList(Long startTime, Long endTime, String cursor, Long corpId) throws IOException {
|