|
|
@@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.mokamrp.privates.entity.ResHandle;
|
|
|
import com.mokamrp.privates.entity.pangu.FosterwxCashScheduleTaskListHandle;
|
|
|
import com.mokamrp.privates.mapper.pangu.FosterwxCashScheduleTaskListMapper;
|
|
|
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashOasBox;
|
|
|
import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList;
|
|
|
+import com.mokamrp.privates.service.pangu.FosterwxCashOasBoxService;
|
|
|
import com.mokamrp.privates.service.pangu.FosterwxCashScheduleTaskListService;
|
|
|
import com.mokamrp.privates.service.pangu.FosterwxCashTaskListService;
|
|
|
import com.mokamrp.privates.utils.pangu.redis.task.TaskRedis;
|
|
|
@@ -14,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -36,6 +39,9 @@ public class FosterwxCashScheduleTaskListServiceImpl extends ServiceImpl<Fosterw
|
|
|
@Autowired
|
|
|
public FosterwxCashTaskListService fosterwxCashTaskListService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ public FosterwxCashOasBoxService fosterwxCashOasBoxService;
|
|
|
+
|
|
|
/**
|
|
|
* 获取数据列表 支持分页
|
|
|
* @param handle
|
|
|
@@ -92,20 +98,46 @@ public class FosterwxCashScheduleTaskListServiceImpl extends ServiceImpl<Fosterw
|
|
|
*/
|
|
|
@Override
|
|
|
public void create(List<FosterwxCashScheduleTaskList> newsList) {
|
|
|
+ if (newsList.isEmpty()) return;
|
|
|
+
|
|
|
+ String ghid = "";
|
|
|
+ FosterwxCashOasBox fosterwxCashOasBox = fosterwxCashOasBoxService.getRandOas(newsList.get(0).getGroupId());
|
|
|
+ if (null != fosterwxCashOasBox) {
|
|
|
+ ghid = fosterwxCashOasBox.getGhId();
|
|
|
+ }
|
|
|
+ int count = 0;
|
|
|
+ List<FosterwxCashScheduleTaskList> tempList = new ArrayList<>();
|
|
|
for (int i = 0; i < newsList.size(); i++) {
|
|
|
+ if (count == 8) {
|
|
|
+ fosterwxCashOasBoxService.addSendTextCnt(ghid);
|
|
|
+
|
|
|
+ taskRedis.createUrlByTyper(JSON.toJSONString(tempList));
|
|
|
+ tempList.clear();
|
|
|
+ fosterwxCashOasBox = fosterwxCashOasBoxService.getRandOas(newsList.get(0).getGroupId());
|
|
|
+ if (null != fosterwxCashOasBox) {
|
|
|
+ ghid = fosterwxCashOasBox.getGhId();
|
|
|
+ }
|
|
|
+ count = 0;
|
|
|
+ }
|
|
|
FosterwxCashScheduleTaskList fosterwxCashScheduleTaskList = newsList.get(i);
|
|
|
+
|
|
|
// 状态
|
|
|
fosterwxCashScheduleTaskList.setStatus(1);
|
|
|
// 失败原因
|
|
|
fosterwxCashScheduleTaskList.setErrInfo("");
|
|
|
- //TODO 传递组id 随机获取ghid
|
|
|
- fosterwxCashScheduleTaskList.setGhId("");
|
|
|
+ // 分配的公众号
|
|
|
+ fosterwxCashScheduleTaskList.setGhId(ghid);
|
|
|
|
|
|
fosterwxCashScheduleTaskListMapper.updateById(fosterwxCashScheduleTaskList);
|
|
|
fosterwxCashScheduleTaskList.setFosterwxCashTaskList(fosterwxCashTaskListService.getById(fosterwxCashScheduleTaskList.getTaskId()));
|
|
|
+ tempList.add(fosterwxCashScheduleTaskList);
|
|
|
+ count++;
|
|
|
+ newsList.remove(i);
|
|
|
+ i--;
|
|
|
}
|
|
|
-
|
|
|
- taskRedis.createUrlByTyper(JSON.toJSONString(newsList));
|
|
|
+ fosterwxCashOasBoxService.addSendTextCnt(ghid);
|
|
|
+ taskRedis.createUrlByTyper(JSON.toJSONString(tempList));
|
|
|
+ tempList.clear();
|
|
|
}
|
|
|
|
|
|
/**
|