修改推荐人数

This commit is contained in:
Guava
2023-07-19 20:05:29 +08:00
parent bb015edcbe
commit 4060caef49
3 changed files with 10 additions and 3 deletions

View File

@@ -72,10 +72,11 @@ public class CasesRecommendApi extends ApiBaseController {
PageList<CasesRecommend> page = iCasesRecommendService.page(casesRecommendVo.getPageIndex(), casesRecommendVo.getPageSize(), casesRecommendVo); PageList<CasesRecommend> page = iCasesRecommendService.page(casesRecommendVo.getPageIndex(), casesRecommendVo.getPageSize(), casesRecommendVo);
// 组装查看率 // 组装查看率
page.getList().forEach(it -> { page.getList().forEach(it -> {
List<CasesRecommendPushRecord> recordList = iCasesRecommendPushRecordService.findReadByRecommendId(it.getId()); List<CasesRecommendPushRecord> recordList = iCasesRecommendPushRecordService.findAllByRecommendId(it.getId());
if (CollectionUtil.isNotEmpty(recordList)) { if (CollectionUtil.isNotEmpty(recordList)) {
List<CasesRecommendPushRecord> collect = recordList.stream().filter(casesRecommendPushRecord -> casesRecommendPushRecord.getReadFlag().equals(1)).collect(Collectors.toList());
// 查看率:查看率=案例查看人数(各案例查看人数之合)/(当条推荐记录包含的案例 × 用户数) // 查看率:查看率=案例查看人数(各案例查看人数之合)/(当条推荐记录包含的案例 × 用户数)
it.setViewRate(String.valueOf(recordList.size() * 100 / recordList.size()).concat("%")); it.setViewRate(String.valueOf(collect.size() * 100 / recordList.size()).concat("%"));
} }
}); });

View File

@@ -64,7 +64,7 @@ public class AsyncSendCasesRecommendService {
} }
//修改为推送中 //修改为推送中
updateProcessStatus(casesRecommend.getId(), CasesPushStatusEnum.PUSH_ING.getStatus()); updateProcessStatus(casesRecommend.getId(), CasesPushStatusEnum.PUSH_ING.getStatus());
List<String> caseIds = casesRecommendPushRecords.stream().map(CasesRecommendPushRecord::getCaseId).collect(Collectors.toList()); List<String> caseIds = casesRecommendPushRecords.stream().map(CasesRecommendPushRecord::getCaseId).distinct().collect(Collectors.toList());
if (caseIds.size() > 1) { if (caseIds.size() > 1) {
sendMixCaseRecommend(casesRecommendPushRecords); sendMixCaseRecommend(casesRecommendPushRecords);
} else { } else {

View File

@@ -38,6 +38,12 @@ public class CasesRecommendLaunchImportServiceImpl implements ICasesRecommendLau
if (CollectionUtil.isEmpty(dataList) || dataList.size() < 1) { if (CollectionUtil.isEmpty(dataList) || dataList.size() < 1) {
throw new RuntimeException("导入数据为空"); throw new RuntimeException("导入数据为空");
} }
if (dataList.size() == 1) {
String caseTitle = dataList.get(0).get(0).toString();
if (!"标题".equals(caseTitle)) {
throw new RuntimeException("导入模版错误");
}
}
int totalNum = dataList.size() - 1; int totalNum = dataList.size() - 1;
int successNum = 0; int successNum = 0;
int failNum = 0; int failNum = 0;