Commit d917369d authored by liuyiguang's avatar liuyiguang

解决批量发送部分数据重复问题

parent c2cc1782
...@@ -275,7 +275,9 @@ public class MobPushService { ...@@ -275,7 +275,9 @@ public class MobPushService {
// 将消息体进行拆分 // 将消息体进行拆分
for (int i = 0; i < formCount; i++) { for (int i = 0; i < formCount; i++) {
MultiInformForm subForm = new MultiInformForm(); MultiInformForm subForm = new MultiInformForm();
BeanUtils.copyProperties(form, subForm); subForm.setPushType(form.getPushType());
subForm.setEquipmentType(form.getEquipmentType());
subForm.setUrl(form.getUrl());
// 当前子推送任务内的消息体 // 当前子推送任务内的消息体
// List<MultiMsgDTO> subMsgList = new ArrayList<>(); // List<MultiMsgDTO> subMsgList = new ArrayList<>();
...@@ -284,6 +286,10 @@ public class MobPushService { ...@@ -284,6 +286,10 @@ public class MobPushService {
// 不再对原集合操作,避免出现java.util.ConcurrentModificationException异常 // 不再对原集合操作,避免出现java.util.ConcurrentModificationException异常
if (subMsgList.size() == 0) { if (subMsgList.size() == 0) {
subForm.setMsgList(new ArrayList<>(Collections.singletonList(msgList.get(msgList.size() - 1)))); subForm.setMsgList(new ArrayList<>(Collections.singletonList(msgList.get(msgList.size() - 1))));
} else {
ArrayList<MultiMsgDTO> enableOperateList = new ArrayList<>(subMsgList);
enableOperateList.add(msgList.get(msgList.size() - 1));
subForm.setMsgList(enableOperateList);
} }
} else { } else {
List<MultiMsgDTO> subMsgList = msgList.subList(MAX_ITEM_SIZE * i, (MAX_ITEM_SIZE * i) + MAX_ITEM_SIZE); List<MultiMsgDTO> subMsgList = msgList.subList(MAX_ITEM_SIZE * i, (MAX_ITEM_SIZE * i) + MAX_ITEM_SIZE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment