|
@@ -1,6 +1,7 @@
|
|
|
package com.etotem.cfc.service;
|
|
package com.etotem.cfc.service;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.etotem.cfc.dto.RecommendItemVO;
|
|
import com.etotem.cfc.dto.RecommendItemVO;
|
|
|
import com.etotem.cfc.dto.RecommendRequestDTO;
|
|
import com.etotem.cfc.dto.RecommendRequestDTO;
|
|
|
import com.etotem.cfc.entity.*;
|
|
import com.etotem.cfc.entity.*;
|
|
@@ -131,8 +132,9 @@ public class ContentRecommendService {
|
|
|
Set<Long> readArticleIds = new HashSet<>();
|
|
Set<Long> readArticleIds = new HashSet<>();
|
|
|
if (childId != null) {
|
|
if (childId != null) {
|
|
|
List<ArticleReadingRecord> records = articleReadingRecordMapper.selectList(
|
|
List<ArticleReadingRecord> records = articleReadingRecordMapper.selectList(
|
|
|
- new LambdaQueryWrapper<ArticleReadingRecord>()
|
|
|
|
|
- .eq(ArticleReadingRecord::getChildId, childId));
|
|
|
|
|
|
|
+ new QueryWrapper<ArticleReadingRecord>()
|
|
|
|
|
+ .eq("child_id", childId)
|
|
|
|
|
+ .select("DISTINCT article_id"));
|
|
|
for (ArticleReadingRecord r : records) {
|
|
for (ArticleReadingRecord r : records) {
|
|
|
if (r.getArticleId() != null) readArticleIds.add(r.getArticleId());
|
|
if (r.getArticleId() != null) readArticleIds.add(r.getArticleId());
|
|
|
}
|
|
}
|
|
@@ -190,9 +192,10 @@ public class ContentRecommendService {
|
|
|
// 获取已存在的任务(用于去重)
|
|
// 获取已存在的任务(用于去重)
|
|
|
Set<Long> articleSourceIds = new HashSet<>();
|
|
Set<Long> articleSourceIds = new HashSet<>();
|
|
|
List<Task> existingTasks = taskMapper.selectList(
|
|
List<Task> existingTasks = taskMapper.selectList(
|
|
|
- new LambdaQueryWrapper<Task>()
|
|
|
|
|
- .eq(Task::getChildId, childId)
|
|
|
|
|
- .in(Task::getStatus, "pending", "completed"));
|
|
|
|
|
|
|
+ new QueryWrapper<Task>()
|
|
|
|
|
+ .eq("child_id", childId)
|
|
|
|
|
+ .in("status", "pending", "completed")
|
|
|
|
|
+ .select("id", "source_type", "source_id"));
|
|
|
for (Task t : existingTasks) {
|
|
for (Task t : existingTasks) {
|
|
|
if ("article".equals(t.getSourceType()) && t.getSourceId() != null) {
|
|
if ("article".equals(t.getSourceType()) && t.getSourceId() != null) {
|
|
|
articleSourceIds.add(t.getSourceId());
|
|
articleSourceIds.add(t.getSourceId());
|
|
@@ -467,12 +470,12 @@ public class ContentRecommendService {
|
|
|
/** 获取家庭已购商品ID */
|
|
/** 获取家庭已购商品ID */
|
|
|
private Set<Long> getPurchasedProductIds(Long familyId, Long userId) {
|
|
private Set<Long> getPurchasedProductIds(Long familyId, Long userId) {
|
|
|
Set<Long> ids = new HashSet<>();
|
|
Set<Long> ids = new HashSet<>();
|
|
|
- LambdaQueryWrapper<ProductOrder> wrapper = new LambdaQueryWrapper<ProductOrder>()
|
|
|
|
|
- .eq(ProductOrder::getStatus, "paid");
|
|
|
|
|
|
|
+ QueryWrapper<ProductOrder> wrapper = new QueryWrapper<ProductOrder>()
|
|
|
|
|
+ .eq("status", "paid");
|
|
|
if (familyId != null) {
|
|
if (familyId != null) {
|
|
|
- wrapper.eq(ProductOrder::getFamilyId, familyId);
|
|
|
|
|
|
|
+ wrapper.eq("family_id", familyId);
|
|
|
} else if (userId != null) {
|
|
} else if (userId != null) {
|
|
|
- wrapper.eq(ProductOrder::getBuyerId, userId);
|
|
|
|
|
|
|
+ wrapper.eq("buyer_id", userId);
|
|
|
} else {
|
|
} else {
|
|
|
return ids;
|
|
return ids;
|
|
|
}
|
|
}
|
|
@@ -495,16 +498,18 @@ public class ContentRecommendService {
|
|
|
}
|
|
}
|
|
|
if (!memberUserIds.isEmpty()) {
|
|
if (!memberUserIds.isEmpty()) {
|
|
|
List<ActivityRegistration> regs = activityRegistrationMapper.selectList(
|
|
List<ActivityRegistration> regs = activityRegistrationMapper.selectList(
|
|
|
- new LambdaQueryWrapper<ActivityRegistration>()
|
|
|
|
|
- .in(ActivityRegistration::getUserId, memberUserIds));
|
|
|
|
|
|
|
+ new QueryWrapper<ActivityRegistration>()
|
|
|
|
|
+ .in("user_id", memberUserIds)
|
|
|
|
|
+ .select("distinct activity_id"));
|
|
|
for (ActivityRegistration r : regs) {
|
|
for (ActivityRegistration r : regs) {
|
|
|
ids.add(r.getActivityId());
|
|
ids.add(r.getActivityId());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
} else if (userId != null) {
|
|
} else if (userId != null) {
|
|
|
List<ActivityRegistration> regs = activityRegistrationMapper.selectList(
|
|
List<ActivityRegistration> regs = activityRegistrationMapper.selectList(
|
|
|
- new LambdaQueryWrapper<ActivityRegistration>()
|
|
|
|
|
- .eq(ActivityRegistration::getUserId, userId));
|
|
|
|
|
|
|
+ new QueryWrapper<ActivityRegistration>()
|
|
|
|
|
+ .eq("user_id", userId)
|
|
|
|
|
+ .select("distinct activity_id"));
|
|
|
for (ActivityRegistration r : regs) {
|
|
for (ActivityRegistration r : regs) {
|
|
|
ids.add(r.getActivityId());
|
|
ids.add(r.getActivityId());
|
|
|
}
|
|
}
|