|
@@ -493,13 +493,18 @@ public class WeComHistoryDataJob {
|
|
|
}
|
|
|
for (Long attachmentId : attachmentIds) {
|
|
|
for (Long sendMsgResultId : sendMsgResultIds) {
|
|
|
- try {
|
|
|
- AttachmentWithMsgResult attachmentWithMsgResult = new AttachmentWithMsgResult();
|
|
|
- attachmentWithMsgResult.setAttachmentId(attachmentId);
|
|
|
- attachmentWithMsgResult.setMsgResultId(sendMsgResultId);
|
|
|
- attachmentWithMsgResultMapper.insertSelective(attachmentWithMsgResult);
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("insert error", e);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|