|
@@ -197,33 +197,32 @@ public class WeComHistoryDataJob {
|
|
if (groupMsg.getLong("create_time") != null) {
|
|
if (groupMsg.getLong("create_time") != null) {
|
|
createTime = groupMsg.getLong("create_time") * 1000;
|
|
createTime = groupMsg.getLong("create_time") * 1000;
|
|
}
|
|
}
|
|
- if (CollectionUtils.isEmpty(attachments)) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
List<MiniprogramRecord> miniprogramRecordList = new ArrayList<>();
|
|
List<MiniprogramRecord> miniprogramRecordList = new ArrayList<>();
|
|
List<MessageAttachment> messageAttachmentList = new ArrayList<>();
|
|
List<MessageAttachment> messageAttachmentList = new ArrayList<>();
|
|
- for (int j = 0; j < attachments.size(); j++) {
|
|
|
|
- JSONObject miniprogram = attachments.getJSONObject(j).getJSONObject("miniprogram");
|
|
|
|
- if (miniprogram == null) {
|
|
|
|
- continue;
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(attachments)) {
|
|
|
|
+ for (int j = 0; j < attachments.size(); j++) {
|
|
|
|
+ JSONObject miniprogram = attachments.getJSONObject(j).getJSONObject("miniprogram");
|
|
|
|
+ if (miniprogram == null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ MiniprogramRecord miniprogramRecord = new MiniprogramRecord();
|
|
|
|
+ MessageAttachment messageAttachment = new MessageAttachment();
|
|
|
|
+ String title = miniprogram.getString("title");
|
|
|
|
+ String appid = miniprogram.getString("appid");
|
|
|
|
+ String page = miniprogram.getString("page");
|
|
|
|
+ Long videoId = MessageUtil.getVideoId(page);
|
|
|
|
+
|
|
|
|
+ miniprogramRecord.setVideoId(videoId);
|
|
|
|
+ miniprogramRecord.setAttachmentIdx(j + 1);
|
|
|
|
+ miniprogramRecordList.add(miniprogramRecord);
|
|
|
|
+
|
|
|
|
+ messageAttachment.setAppid(appid);
|
|
|
|
+ messageAttachment.setPage(page);
|
|
|
|
+ messageAttachment.setTitle(title);
|
|
|
|
+ messageAttachment.setMiniprogramVideoId(videoId);
|
|
|
|
+ messageAttachment.setType(MessageAttachmentTypeEnum.MINI_PROGRAM.getType());
|
|
|
|
+ messageAttachmentList.add(messageAttachment);
|
|
}
|
|
}
|
|
- MiniprogramRecord miniprogramRecord = new MiniprogramRecord();
|
|
|
|
- MessageAttachment messageAttachment = new MessageAttachment();
|
|
|
|
- String title = miniprogram.getString("title");
|
|
|
|
- String appid = miniprogram.getString("appid");
|
|
|
|
- String page = miniprogram.getString("page");
|
|
|
|
- Long videoId = MessageUtil.getVideoId(page);
|
|
|
|
-
|
|
|
|
- miniprogramRecord.setVideoId(videoId);
|
|
|
|
- miniprogramRecord.setAttachmentIdx(j + 1);
|
|
|
|
- miniprogramRecordList.add(miniprogramRecord);
|
|
|
|
-
|
|
|
|
- messageAttachment.setAppid(appid);
|
|
|
|
- messageAttachment.setPage(page);
|
|
|
|
- messageAttachment.setTitle(title);
|
|
|
|
- messageAttachment.setMiniprogramVideoId(videoId);
|
|
|
|
- messageAttachment.setType(MessageAttachmentTypeEnum.MINI_PROGRAM.getType());
|
|
|
|
- messageAttachmentList.add(messageAttachment);
|
|
|
|
}
|
|
}
|
|
List<String> carrierIdList = selectGroupMsgTask(msgId, corpId);
|
|
List<String> carrierIdList = selectGroupMsgTask(msgId, corpId);
|
|
if (CollectionUtils.isEmpty(carrierIdList)) {
|
|
if (CollectionUtils.isEmpty(carrierIdList)) {
|
|
@@ -247,10 +246,12 @@ public class WeComHistoryDataJob {
|
|
if (CollectionUtils.isEmpty(externalUsers)) {
|
|
if (CollectionUtils.isEmpty(externalUsers)) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- for (MessageAttachment messageAttachment : messageAttachmentList) {
|
|
|
|
- messageAttachment.setStaffId(staffList.get(0).getId());
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(messageAttachmentList)) {
|
|
|
|
+ for (MessageAttachment messageAttachment : messageAttachmentList) {
|
|
|
|
+ messageAttachment.setStaffId(staffList.get(0).getId());
|
|
|
|
+ }
|
|
|
|
+ messageAttachmentService.addMiniProgram(messageAttachmentList, createTime);
|
|
}
|
|
}
|
|
- messageAttachmentService.addMiniProgram(messageAttachmentList, createTime);
|
|
|
|
insertHistoryMessageList(msgId, staffList.get(0), externalUsers, miniprogramRecordList, createTime, corpId, startTime, endTime);
|
|
insertHistoryMessageList(msgId, staffList.get(0), externalUsers, miniprogramRecordList, createTime, corpId, startTime, endTime);
|
|
}
|
|
}
|
|
}
|
|
}
|