|
@@ -1,7 +1,10 @@
|
|
|
package com.tzld.longarticle.recommend.server.service;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.tzld.longarticle.recommend.server.mapper.aigc.AigcBaseMapper;
|
|
|
import com.tzld.longarticle.recommend.server.model.dto.NotPublishPlan;
|
|
|
+import com.tzld.longarticle.recommend.server.model.entity.aigc.PublishAccount;
|
|
|
import com.tzld.longarticle.recommend.server.util.DateUtils;
|
|
|
import com.tzld.longarticle.recommend.server.util.feishu.FeishuMessageSender;
|
|
|
import com.xxl.job.core.biz.model.ReturnT;
|
|
@@ -12,7 +15,9 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.time.LocalTime;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
@Slf4j
|
|
@@ -44,12 +49,19 @@ public class XxlJobService {
|
|
|
}
|
|
|
|
|
|
private void sendFeishuPublishPlanNotPushWarn(NotPublishPlan publishPlan) {
|
|
|
+ Long todayStart = DateUtils.getTodayStart();
|
|
|
+ List<PublishAccount> publishAccounts = aigcBaseMapper.getPublishAccounts(publishPlan.getPlanId(), todayStart);
|
|
|
+ List<String> accountNames = new ArrayList<>();
|
|
|
+ if (CollectionUtil.isNotEmpty(publishAccounts)) {
|
|
|
+ accountNames = publishAccounts.stream().map(PublishAccount::getName).collect(Collectors.toList());
|
|
|
+ }
|
|
|
FeishuMessageSender.sendWebHookMessage("07026a9f-43f5-448b-ba40-a8d71bd6e634",
|
|
|
"发布计划超1H未发送完成\n"
|
|
|
+ "发布计划ID: " + publishPlan.getPlanId() + "\n"
|
|
|
+ "发布计划名称: " + publishPlan.getPlanName() + "\n"
|
|
|
+ "预计数量: " + publishPlan.getExpectCount() + "\n"
|
|
|
+ "实际数量: " + publishPlan.getPublishCount() + "\n"
|
|
|
+ + "发送失败账号: " + JSONObject.toJSONString(accountNames) + "\n"
|
|
|
+ "发布计划失败原因: " + publishPlan.getErrorMsg() + "\n"
|
|
|
+ "发布时间: " + publishPlan.getPublishPushTime() + "\n"
|
|
|
+ "<at user_id=\"all\">所有人</at> ");
|