|
@@ -27,10 +27,7 @@ import com.tzld.longarticle.recommend.server.model.entity.longArticle.DatastatSc
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.longArticle.DatastatSortStrategy;
|
|
|
import com.tzld.longarticle.recommend.server.model.param.MiniprogramTaskParam;
|
|
|
import com.tzld.longarticle.recommend.server.model.param.PublishContentParam;
|
|
|
-import com.tzld.longarticle.recommend.server.model.vo.FirstContentScoreExport;
|
|
|
-import com.tzld.longarticle.recommend.server.model.vo.IntermediateIndicatorsExport;
|
|
|
-import com.tzld.longarticle.recommend.server.model.vo.NewSortStrategyExport;
|
|
|
-import com.tzld.longarticle.recommend.server.model.vo.ProducePlanAuditExport;
|
|
|
+import com.tzld.longarticle.recommend.server.model.vo.*;
|
|
|
import com.tzld.longarticle.recommend.server.model.vo.aigc.ProduceAuditLayoutContentObjVO;
|
|
|
import com.tzld.longarticle.recommend.server.repository.aigc.*;
|
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.AccountAvgInfoRepository;
|
|
@@ -98,14 +95,15 @@ public class DataDashboardService {
|
|
|
|
|
|
@ApolloJsonValue("${export.account.ghId:[]}")
|
|
|
private static List<String> ghIdList;
|
|
|
- private static final String sheetToken = "M0pLs3uF6hfL0htn2dMcB9eFn8e";
|
|
|
+ private static final String dailyDetailSheetToken = "M0pLs3uF6hfL0htn2dMcB9eFn8e";
|
|
|
+ private static final String dailySafeSheetToken = "Xoass3ZGYhi9BVtZDoMclGFpnYe";
|
|
|
|
|
|
public void export(String beginDate, String endDate) {
|
|
|
List<String> dateStrList = DateUtils.getBeforeDays(beginDate, endDate, 5);
|
|
|
// 滚动删除,仅保留最近14天内容
|
|
|
List<String> delDateStrList = DateUtils.getBeforeDays(null, null, 14);
|
|
|
exportFeishuNewSortStrategy(dateStrList, ArticleTypeEnum.QUNFA.getVal(), StatusEnum.ZERO.getCode(),
|
|
|
- sheetToken, "7d4e12", delDateStrList);
|
|
|
+ dailyDetailSheetToken, "7d4e12", delDateStrList);
|
|
|
}
|
|
|
|
|
|
@XxlJob("scheduledExport")
|
|
@@ -114,21 +112,21 @@ public class DataDashboardService {
|
|
|
// 滚动删除,仅保留最近14天内容
|
|
|
List<String> delDateStrList = DateUtils.getBeforeDays(null, null, 14);
|
|
|
exportFeishuNewSortStrategy(dateStrList, ArticleTypeEnum.QUNFA.getVal(), StatusEnum.ZERO.getCode(),
|
|
|
- sheetToken, "7d4e12", delDateStrList);
|
|
|
+ dailyDetailSheetToken, "7d4e12", delDateStrList);
|
|
|
return ReturnT.SUCCESS;
|
|
|
}
|
|
|
|
|
|
public void exportWuXianLiu(String beginDate, String endDate) {
|
|
|
List<String> dateStrList = DateUtils.getBeforeDays(beginDate, endDate, 5);
|
|
|
exportFeishuNewSortStrategy(dateStrList, ArticleTypeEnum.WUXIANLIU.getVal(), StatusEnum.ONE.getCode(),
|
|
|
- sheetToken, "Ucycvw", null);
|
|
|
+ dailyDetailSheetToken, "Ucycvw", null);
|
|
|
}
|
|
|
|
|
|
@XxlJob("scheduledExportWuXianLiu")
|
|
|
public ReturnT<String> scheduledExportWuXianLiu(String param) {
|
|
|
List<String> dateStrList = DateUtils.getBeforeDays(null, null, 5);
|
|
|
exportFeishuNewSortStrategy(dateStrList, ArticleTypeEnum.WUXIANLIU.getVal(), StatusEnum.ONE.getCode(),
|
|
|
- sheetToken, "Ucycvw", null);
|
|
|
+ dailyDetailSheetToken, "Ucycvw", null);
|
|
|
return ReturnT.SUCCESS;
|
|
|
}
|
|
|
|
|
@@ -837,7 +835,7 @@ public class DataDashboardService {
|
|
|
HttpEntity<Object> queryEntity = new HttpEntity<>(httpHeaders);
|
|
|
ResponseEntity<String> queryResponseEntity = restTemplate.exchange(
|
|
|
String.format("https://open.feishu.cn/open-apis/sheets/v2/spreadsheets/%s/values/%s!A"
|
|
|
- + startRowIndex + ":A", sheetToken, sheetId),
|
|
|
+ + startRowIndex + ":A", dailyDetailSheetToken, sheetId),
|
|
|
HttpMethod.GET, queryEntity, String.class);
|
|
|
JSONArray values = JSON.parseObject(queryResponseEntity.getBody())
|
|
|
.getJSONObject("data")
|
|
@@ -874,7 +872,7 @@ public class DataDashboardService {
|
|
|
" }\n" +
|
|
|
"}", sheetId, deleteStartRow, deleteStartRow + Math.min(4000, delCount - delNum + startRowIndex) - 1),
|
|
|
httpHeaders);
|
|
|
- ResponseEntity<String> response = restTemplate.exchange(String.format("https://open.feishu.cn/open-apis/sheets/v2/spreadsheets/%s/dimension_range", sheetToken),
|
|
|
+ ResponseEntity<String> response = restTemplate.exchange(String.format("https://open.feishu.cn/open-apis/sheets/v2/spreadsheets/%s/dimension_range", dailyDetailSheetToken),
|
|
|
HttpMethod.DELETE, deleteEntity, String.class);
|
|
|
JSONObject responseJSON = JSONObject.parseObject(response.getBody());
|
|
|
if (0 != responseJSON.getInteger("code")) {
|
|
@@ -888,13 +886,13 @@ public class DataDashboardService {
|
|
|
@XxlJob("scheduleExportIntermediateIndicators")
|
|
|
public ReturnT<String> scheduleIntermediateIndicatorsExport(String param) {
|
|
|
List<String> dateStrList = DateUtils.getBeforeDays(null, null, 3);
|
|
|
- exportFeishuIntermediateIndicators(dateStrList, sheetToken, "OuaLWV");
|
|
|
+ exportFeishuIntermediateIndicators(dateStrList, dailyDetailSheetToken, "OuaLWV");
|
|
|
return ReturnT.SUCCESS;
|
|
|
}
|
|
|
|
|
|
public void intermediateIndicatorsExport(String beginDate, String endDate) {
|
|
|
List<String> dateStrList = DateUtils.getBeforeDays(beginDate, endDate, 3);
|
|
|
- exportFeishuIntermediateIndicators(dateStrList, sheetToken, "OuaLWV");
|
|
|
+ exportFeishuIntermediateIndicators(dateStrList, dailyDetailSheetToken, "OuaLWV");
|
|
|
}
|
|
|
|
|
|
private void exportFeishuIntermediateIndicators(List<String> dateStrList, String sheetToken, String sheetId) {
|
|
@@ -1538,13 +1536,13 @@ public class DataDashboardService {
|
|
|
@XxlJob("scheduleExportFirstContentScore")
|
|
|
public ReturnT<String> scheduleExportFirstContentScore(String param) {
|
|
|
List<String> dateStrList = DateUtils.getBeforeDays(null, null, 3);
|
|
|
- exportFeishuFirstContentScore(dateStrList, sheetToken, "XBFd16");
|
|
|
+ exportFeishuFirstContentScore(dateStrList, dailyDetailSheetToken, "XBFd16");
|
|
|
return ReturnT.SUCCESS;
|
|
|
}
|
|
|
|
|
|
public void firstContentScoreExport(String beginDate, String endDate) {
|
|
|
List<String> dateStrList = DateUtils.getBeforeDays(beginDate, endDate, 3);
|
|
|
- exportFeishuFirstContentScore(dateStrList, sheetToken, "XBFd16");
|
|
|
+ exportFeishuFirstContentScore(dateStrList, dailyDetailSheetToken, "XBFd16");
|
|
|
}
|
|
|
|
|
|
private void exportFeishuFirstContentScore(List<String> dateStrList, String sheetToken, String sheetId) {
|
|
@@ -1749,7 +1747,7 @@ public class DataDashboardService {
|
|
|
List<ProducePlanAuditExport> exportList = new ArrayList<>();
|
|
|
dateStrList = Lists.reverse(dateStrList);
|
|
|
for (String dateStr : dateStrList) {
|
|
|
- Map<String, ProducePlanAuditExport> yesterdayMap = getOldProducePlanAuditExport(dateStr, sheetToken, "28RgAZ");
|
|
|
+ Map<String, ProducePlanAuditExport> yesterdayMap = getOldProducePlanAuditExport(dateStr, dailyDetailSheetToken, "28RgAZ");
|
|
|
exportList.addAll(buildProducePlanAuditExport(dateStr, yesterdayMap));
|
|
|
}
|
|
|
if (CollectionUtil.isEmpty(exportList)) {
|
|
@@ -1774,7 +1772,7 @@ public class DataDashboardService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- doSendFeishuSheet(dateStrList, sheetToken, "28RgAZ", rowNum, rows,
|
|
|
+ doSendFeishuSheet(dateStrList, dailyDetailSheetToken, "28RgAZ", rowNum, rows,
|
|
|
2, null, null);
|
|
|
}
|
|
|
|
|
@@ -1884,4 +1882,71 @@ public class DataDashboardService {
|
|
|
return exportList;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @XxlJob("dailySafeScoreExport")
|
|
|
+ public ReturnT<String> dailySafeScoreExportJob(String param) {
|
|
|
+ List<String> dateStrList = DateUtils.getBeforeDays(null, null, 3);
|
|
|
+ dailySafeScore(dateStrList);
|
|
|
+ return ReturnT.SUCCESS;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void dailySafeScore(String dateStr) {
|
|
|
+ List<String> dateStrList = DateUtils.getBeforeDays(dateStr, null, 3);
|
|
|
+ if (!StringUtils.hasText(dateStr)) {
|
|
|
+ dateStrList = DateUtils.getBeforeDays(null, null, 3);
|
|
|
+ }
|
|
|
+ dailySafeScore(dateStrList);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void dailySafeScore(List<String> dateStrList) {
|
|
|
+ List<ProduceSafeScoreExport> exportList = getProduceSafeScoreExport(dateStrList.get(0));
|
|
|
+ if (CollectionUtil.isEmpty(exportList)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ int rowNum = exportList.size();
|
|
|
+ List<List<Object>> rows = new ArrayList<>();
|
|
|
+ Field[] fields = ProduceSafeScoreExport.class.getDeclaredFields();
|
|
|
+ for (ProduceSafeScoreExport datum : exportList) {
|
|
|
+ List<Object> rowDatas = new ArrayList<>();
|
|
|
+ rows.add(rowDatas);
|
|
|
+
|
|
|
+ for (Field field : fields) {
|
|
|
+ field.setAccessible(true);
|
|
|
+ try {
|
|
|
+ rowDatas.add(field.get(datum));
|
|
|
+ } catch (IllegalAccessException e) {
|
|
|
+ log.error("获取值出错:{}", field.getName());
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ doSendFeishuSheet(dateStrList, dailySafeSheetToken, "9fc2e8", rowNum, rows,
|
|
|
+ 2, null, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<ProduceSafeScoreExport> getProduceSafeScoreExport(String dateStr) {
|
|
|
+ List<ProduceSafeScoreExport> result = new ArrayList<>();
|
|
|
+ Long startTimeStamp = DateUtils.getStartOfDay(dateStr, "yyyyMMdd") * 1000;
|
|
|
+ Long endTimeStamp = DateUtils.getTodayStart();
|
|
|
+ List<ProduceTaskAtom> list = aigcBaseMapper.getProduceScoreGreaterThan(startTimeStamp, endTimeStamp);
|
|
|
+ Set<String> titles = new HashSet<>();
|
|
|
+ for (ProduceTaskAtom produceTaskAtom : list) {
|
|
|
+ if (titles.contains(produceTaskAtom.getInput())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ ProduceSafeScoreExport res = new ProduceSafeScoreExport();
|
|
|
+ res.setProduceContentId(produceTaskAtom.getPlanExeId());
|
|
|
+ res.setScore(produceTaskAtom.getOutput());
|
|
|
+ res.setDateStr(DateUtils.getDateString(produceTaskAtom.getCreateTimestamp()));
|
|
|
+ String title = JSONObject.parseObject(produceTaskAtom.getInput()).getJSONArray("refDataList")
|
|
|
+ .getJSONObject(0).getString("dataValue");
|
|
|
+ res.setTitle(title);
|
|
|
+ titles.add(title);
|
|
|
+ result.add(res);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
}
|