|
|
@@ -10,9 +10,11 @@ import com.mokamrp.privates.mapper.pangu.FosterwxCashScheduleTaskListMapper;
|
|
|
import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashAccountSchedule;
|
|
|
import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList;
|
|
|
import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashTaskList;
|
|
|
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashWorkwxTaskList;
|
|
|
import com.mokamrp.privates.service.pangu.FosterwxCashAccountScheduleService;
|
|
|
import com.mokamrp.privates.service.pangu.FosterwxCashScheduleTaskListService;
|
|
|
import com.mokamrp.privates.service.pangu.FosterwxCashTaskTemplateService;
|
|
|
+import com.mokamrp.privates.service.pangu.FosterwxCashWorkwxTaskCatalogService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -43,6 +45,9 @@ public class FosterwxCashAccountScheduleServiceImpl extends ServiceImpl<Fosterwx
|
|
|
@Autowired
|
|
|
public FosterwxCashScheduleTaskListService fosterwxCashScheduleTaskListService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ public FosterwxCashWorkwxTaskCatalogService fosterwxCashWorkwxTaskCatalogService;
|
|
|
+
|
|
|
/**
|
|
|
* 获取数据列表 支持分页
|
|
|
* @param handle
|
|
|
@@ -106,61 +111,14 @@ public class FosterwxCashAccountScheduleServiceImpl extends ServiceImpl<Fosterwx
|
|
|
// 该接口由立即生成和任务链接生成失败后两种调用方式 因此 在生成任务之前要删除旧任务
|
|
|
fosterwxCashScheduleTaskListMapper.delete(new LambdaQueryWrapper<FosterwxCashScheduleTaskList>().eq(FosterwxCashScheduleTaskList::getScheduleId, id));
|
|
|
|
|
|
- // 根据任务模板id获取任务模板详情
|
|
|
- ResHandle<List<FosterwxCashTaskList>> resHandle = fosterwxCashTaskTemplateService.getTaskByTemplateId(fosterwxCashAccountSchedule.getTemplateId());
|
|
|
-
|
|
|
List<FosterwxCashScheduleTaskList> newsList = new ArrayList<>();
|
|
|
- resHandle.getList().forEach(fosterwxCashTaskList -> {
|
|
|
- // 创建任务
|
|
|
- FosterwxCashScheduleTaskList fosterwxCashScheduleTaskList = new FosterwxCashScheduleTaskList();
|
|
|
- fosterwxCashScheduleTaskList.setScheduleId(fosterwxCashAccountSchedule.getId());
|
|
|
- fosterwxCashScheduleTaskList.setTemplateId(fosterwxCashAccountSchedule.getTemplateId());
|
|
|
- fosterwxCashScheduleTaskList.setTaskId(fosterwxCashTaskList.getId());
|
|
|
- fosterwxCashScheduleTaskList.setGroupId(fosterwxCashAccountSchedule.getGroupId());
|
|
|
- fosterwxCashScheduleTaskList.setTaskType(fosterwxCashTaskList.getTaskType());
|
|
|
- fosterwxCashScheduleTaskList.setRemark(fosterwxCashTaskList.getRemark());
|
|
|
- fosterwxCashScheduleTaskList.setTaskContent("");
|
|
|
- fosterwxCashScheduleTaskList.setGhId("");
|
|
|
- // 任务类型为链接是直接赋值
|
|
|
- if (4 == fosterwxCashTaskList.getTaskType()) {
|
|
|
- fosterwxCashScheduleTaskList.setSendUrl(fosterwxCashTaskList.getUrl());
|
|
|
- fosterwxCashScheduleTaskList.setStatus(4);
|
|
|
- fosterwxCashScheduleTaskList.setErrInfo("");
|
|
|
- } else {
|
|
|
- fosterwxCashScheduleTaskList.setSendUrl("");
|
|
|
- fosterwxCashScheduleTaskList.setStatus(1);
|
|
|
- fosterwxCashScheduleTaskList.setErrInfo("");
|
|
|
- }
|
|
|
-
|
|
|
- fosterwxCashScheduleTaskList.setSendTime(LocalDateTime.of(fosterwxCashAccountSchedule.getScheduleDate(), fosterwxCashTaskList.getSendAt()));
|
|
|
- fosterwxCashScheduleTaskList.setCreateUid(fosterwxCashAccountSchedule.getCreateUid());
|
|
|
- fosterwxCashScheduleTaskList.setCreateUser(fosterwxCashAccountSchedule.getCreateUser());
|
|
|
- fosterwxCashScheduleTaskList.setUpdateUid(fosterwxCashAccountSchedule.getCreateUid());
|
|
|
- fosterwxCashScheduleTaskList.setCreateAt(LocalDateTime.now());
|
|
|
- fosterwxCashScheduleTaskList.setUpdateAt(LocalDateTime.now());
|
|
|
-
|
|
|
- fosterwxCashScheduleTaskListMapper.insert(fosterwxCashScheduleTaskList);
|
|
|
-
|
|
|
- // 小程序和链接的任务不需要发送到typer
|
|
|
- switch (fosterwxCashTaskList.getTaskType()) {
|
|
|
- case 1:
|
|
|
- // 发文-小程序
|
|
|
- fosterwxCashScheduleTaskListService.editBoxUrl(fosterwxCashScheduleTaskList, fosterwxCashTaskList);
|
|
|
- case 2:
|
|
|
- newsList.add(fosterwxCashScheduleTaskList);
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- // 小程序本地生成
|
|
|
- fosterwxCashScheduleTaskListService.editBoxUrl(fosterwxCashScheduleTaskList, fosterwxCashTaskList);
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- // 任务类型为链接是 不需要操作
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
-
|
|
|
- }
|
|
|
- });
|
|
|
+ if (fosterwxCashAccountSchedule.getType() == 1) {
|
|
|
+ // 创建个微任务
|
|
|
+ newsList = createFosterwxTaskList(fosterwxCashAccountSchedule);
|
|
|
+ } else {
|
|
|
+ // 创建企微任务
|
|
|
+ newsList = createFosterwxWorkTaskList(fosterwxCashAccountSchedule);
|
|
|
+ }
|
|
|
|
|
|
// 任务列表创建完成后 账号排期状态设置成正常
|
|
|
fosterwxCashAccountSchedule.setStatus(1);
|
|
|
@@ -171,4 +129,139 @@ public class FosterwxCashAccountScheduleServiceImpl extends ServiceImpl<Fosterwx
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建企微任务
|
|
|
+ * @since: 1.18.1
|
|
|
+ * @param: [fosterwxCashAccountSchedule]
|
|
|
+ * @return: java.util.List<com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList>
|
|
|
+ * @author: lqc
|
|
|
+ * @date: 2021/10/25
|
|
|
+ */
|
|
|
+ private List<FosterwxCashScheduleTaskList> createFosterwxWorkTaskList(FosterwxCashAccountSchedule fosterwxCashAccountSchedule) {
|
|
|
+ // 根据任务模板id获取任务模板详情
|
|
|
+ List<FosterwxCashWorkwxTaskList> resHandle = fosterwxCashWorkwxTaskCatalogService.getTaskByTemplateId(fosterwxCashAccountSchedule.getTemplateId());
|
|
|
+
|
|
|
+ List<FosterwxCashScheduleTaskList> newsList = new ArrayList<>();
|
|
|
+ resHandle.forEach(fosterwxCashWorkwxTaskList -> {
|
|
|
+ // 创建任务
|
|
|
+ FosterwxCashScheduleTaskList fosterwxCashScheduleTaskList = new FosterwxCashScheduleTaskList();
|
|
|
+ fosterwxCashScheduleTaskList.setScheduleId(fosterwxCashAccountSchedule.getId());
|
|
|
+ fosterwxCashScheduleTaskList.setTemplateId(fosterwxCashAccountSchedule.getTemplateId());
|
|
|
+ fosterwxCashScheduleTaskList.setTaskId(fosterwxCashWorkwxTaskList.getCatalogId());
|
|
|
+ fosterwxCashScheduleTaskList.setChildTaskId(fosterwxCashWorkwxTaskList.getId());
|
|
|
+ fosterwxCashScheduleTaskList.setGroupId(fosterwxCashAccountSchedule.getGroupId());
|
|
|
+ fosterwxCashScheduleTaskList.setTaskType(fosterwxCashWorkwxTaskList.getTaskType());
|
|
|
+ fosterwxCashScheduleTaskList.setRemark(fosterwxCashWorkwxTaskList.getRemark());
|
|
|
+ fosterwxCashScheduleTaskList.setTaskContent("");
|
|
|
+ fosterwxCashScheduleTaskList.setGhId("");
|
|
|
+ // 任务类型为链接是直接赋值
|
|
|
+ if (4 == fosterwxCashWorkwxTaskList.getTaskType()) {
|
|
|
+ fosterwxCashScheduleTaskList.setSendUrl(fosterwxCashWorkwxTaskList.getUrl());
|
|
|
+ fosterwxCashScheduleTaskList.setStatus(4);
|
|
|
+ fosterwxCashScheduleTaskList.setErrInfo("");
|
|
|
+ } else {
|
|
|
+ fosterwxCashScheduleTaskList.setSendUrl("");
|
|
|
+ fosterwxCashScheduleTaskList.setStatus(1);
|
|
|
+ fosterwxCashScheduleTaskList.setErrInfo("");
|
|
|
+ }
|
|
|
+
|
|
|
+ fosterwxCashScheduleTaskList.setSendTime(LocalDateTime.of(fosterwxCashAccountSchedule.getScheduleDate(), fosterwxCashWorkwxTaskList.getSendAt()));
|
|
|
+ fosterwxCashScheduleTaskList.setCreateUid(fosterwxCashAccountSchedule.getCreateUid());
|
|
|
+ fosterwxCashScheduleTaskList.setCreateUser(fosterwxCashAccountSchedule.getCreateUser());
|
|
|
+ fosterwxCashScheduleTaskList.setUpdateUid(fosterwxCashAccountSchedule.getCreateUid());
|
|
|
+ fosterwxCashScheduleTaskList.setCreateAt(LocalDateTime.now());
|
|
|
+ fosterwxCashScheduleTaskList.setUpdateAt(LocalDateTime.now());
|
|
|
+
|
|
|
+ fosterwxCashScheduleTaskListMapper.insert(fosterwxCashScheduleTaskList);
|
|
|
+
|
|
|
+ // 小程序和链接的任务不需要发送到typer
|
|
|
+ switch (fosterwxCashWorkwxTaskList.getTaskType()) {
|
|
|
+ case 1:
|
|
|
+ // 发文-小程序
|
|
|
+ fosterwxCashScheduleTaskListService.editWorkBoxUrl(fosterwxCashScheduleTaskList, fosterwxCashWorkwxTaskList);
|
|
|
+ case 2:
|
|
|
+ newsList.add(fosterwxCashScheduleTaskList);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ // 小程序本地生成
|
|
|
+ fosterwxCashScheduleTaskListService.editWorkBoxUrl(fosterwxCashScheduleTaskList, fosterwxCashWorkwxTaskList);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ // 任务类型为链接是 不需要操作
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return newsList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建个微任务
|
|
|
+ * @since: 1.18.1
|
|
|
+ * @param: [fosterwxCashAccountSchedule]
|
|
|
+ * @return: java.util.List<com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList>
|
|
|
+ * @author: lqc
|
|
|
+ * @date: 2021/10/25
|
|
|
+ */
|
|
|
+ private List<FosterwxCashScheduleTaskList> createFosterwxTaskList(FosterwxCashAccountSchedule fosterwxCashAccountSchedule) {
|
|
|
+ // 根据任务模板id获取任务模板详情
|
|
|
+ ResHandle<List<FosterwxCashTaskList>> resHandle = fosterwxCashTaskTemplateService.getTaskByTemplateId(fosterwxCashAccountSchedule.getTemplateId());
|
|
|
+
|
|
|
+ List<FosterwxCashScheduleTaskList> newsList = new ArrayList<>();
|
|
|
+ resHandle.getList().forEach(fosterwxCashTaskList -> {
|
|
|
+ // 创建任务
|
|
|
+ FosterwxCashScheduleTaskList fosterwxCashScheduleTaskList = new FosterwxCashScheduleTaskList();
|
|
|
+ fosterwxCashScheduleTaskList.setScheduleId(fosterwxCashAccountSchedule.getId());
|
|
|
+ fosterwxCashScheduleTaskList.setTemplateId(fosterwxCashAccountSchedule.getTemplateId());
|
|
|
+ fosterwxCashScheduleTaskList.setTaskId(fosterwxCashTaskList.getId());
|
|
|
+ fosterwxCashScheduleTaskList.setGroupId(fosterwxCashAccountSchedule.getGroupId());
|
|
|
+ fosterwxCashScheduleTaskList.setTaskType(fosterwxCashTaskList.getTaskType());
|
|
|
+ fosterwxCashScheduleTaskList.setRemark(fosterwxCashTaskList.getRemark());
|
|
|
+ fosterwxCashScheduleTaskList.setTaskContent("");
|
|
|
+ fosterwxCashScheduleTaskList.setGhId("");
|
|
|
+ // 任务类型为链接是直接赋值
|
|
|
+ if (4 == fosterwxCashTaskList.getTaskType()) {
|
|
|
+ fosterwxCashScheduleTaskList.setSendUrl(fosterwxCashTaskList.getUrl());
|
|
|
+ fosterwxCashScheduleTaskList.setStatus(4);
|
|
|
+ fosterwxCashScheduleTaskList.setErrInfo("");
|
|
|
+ } else {
|
|
|
+ fosterwxCashScheduleTaskList.setSendUrl("");
|
|
|
+ fosterwxCashScheduleTaskList.setStatus(1);
|
|
|
+ fosterwxCashScheduleTaskList.setErrInfo("");
|
|
|
+ }
|
|
|
+
|
|
|
+ fosterwxCashScheduleTaskList.setSendTime(LocalDateTime.of(fosterwxCashAccountSchedule.getScheduleDate(), fosterwxCashTaskList.getSendAt()));
|
|
|
+ fosterwxCashScheduleTaskList.setCreateUid(fosterwxCashAccountSchedule.getCreateUid());
|
|
|
+ fosterwxCashScheduleTaskList.setCreateUser(fosterwxCashAccountSchedule.getCreateUser());
|
|
|
+ fosterwxCashScheduleTaskList.setUpdateUid(fosterwxCashAccountSchedule.getCreateUid());
|
|
|
+ fosterwxCashScheduleTaskList.setCreateAt(LocalDateTime.now());
|
|
|
+ fosterwxCashScheduleTaskList.setUpdateAt(LocalDateTime.now());
|
|
|
+
|
|
|
+ fosterwxCashScheduleTaskListMapper.insert(fosterwxCashScheduleTaskList);
|
|
|
+
|
|
|
+ // 小程序和链接的任务不需要发送到typer
|
|
|
+ switch (fosterwxCashTaskList.getTaskType()) {
|
|
|
+ case 1:
|
|
|
+ // 发文-小程序
|
|
|
+ fosterwxCashScheduleTaskListService.editBoxUrl(fosterwxCashScheduleTaskList, fosterwxCashTaskList);
|
|
|
+ case 2:
|
|
|
+ newsList.add(fosterwxCashScheduleTaskList);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ // 小程序本地生成
|
|
|
+ fosterwxCashScheduleTaskListService.editBoxUrl(fosterwxCashScheduleTaskList, fosterwxCashTaskList);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ // 任务类型为链接是 不需要操作
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return newsList;
|
|
|
+ }
|
|
|
}
|