|
@@ -38,17 +38,24 @@ public class GrowthTaskService {
|
|
|
/**
|
|
/**
|
|
|
* Get task list with user's progress for today (daily) or all-time (newbie).
|
|
* Get task list with user's progress for today (daily) or all-time (newbie).
|
|
|
*/
|
|
*/
|
|
|
- public List<Map<String, Object>> getTaskList(Long userId, String type) {
|
|
|
|
|
- if (type == null || type.isEmpty()) {
|
|
|
|
|
- type = "DAILY";
|
|
|
|
|
- }
|
|
|
|
|
|
|
+public List<Map<String, Object>> getTaskList(Long userId, Map<String, String> params) {
|
|
|
|
|
+ String type = params != null ? params.getOrDefault("type", "DAILY") : "DAILY";
|
|
|
|
|
+ String dimension = params != null ? params.get("dimension") : null;
|
|
|
|
|
|
|
|
- List<GrowthTask> tasks = growthTaskMapper.selectList(
|
|
|
|
|
- new LambdaQueryWrapper<GrowthTask>()
|
|
|
|
|
- .eq(GrowthTask::getType, type)
|
|
|
|
|
- .eq(GrowthTask::getEnabled, 1)
|
|
|
|
|
- .orderByAsc(GrowthTask::getSortOrder)
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ if (type == null || type.isEmpty()) {
|
|
|
|
|
+ type = "DAILY";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ LambdaQueryWrapper<GrowthTask> queryWrapper = new LambdaQueryWrapper<GrowthTask>()
|
|
|
|
|
+ .eq(GrowthTask::getType, type)
|
|
|
|
|
+ .eq(GrowthTask::getEnabled, 1)
|
|
|
|
|
+ .orderByAsc(GrowthTask::getSortOrder);
|
|
|
|
|
+
|
|
|
|
|
+ if (dimension != null && !dimension.isEmpty()) {
|
|
|
|
|
+ queryWrapper.eq(GrowthTask::getDimension, dimension);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ List<GrowthTask> tasks = growthTaskMapper.selectList(queryWrapper);
|
|
|
|
|
|
|
|
String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
|
|
String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
|
|
|
|
|
|
|
@@ -62,9 +69,10 @@ public class GrowthTaskService {
|
|
|
item.put("rewardPoints", task.getRewardPoints());
|
|
item.put("rewardPoints", task.getRewardPoints());
|
|
|
item.put("rewardEnergy", task.getRewardEnergy());
|
|
item.put("rewardEnergy", task.getRewardEnergy());
|
|
|
item.put("targetValue", task.getTargetValue());
|
|
item.put("targetValue", task.getTargetValue());
|
|
|
- item.put("taskKey", task.getTaskKey());
|
|
|
|
|
|
|
+item.put("taskKey", task.getTaskKey());
|
|
|
|
|
+item.put("dimension", task.getDimension());
|
|
|
|
|
|
|
|
- // Find user's log for this task
|
|
|
|
|
|
|
+// Find user's log for this task
|
|
|
LambdaQueryWrapper<GrowthTaskLog> logWrapper = new LambdaQueryWrapper<GrowthTaskLog>()
|
|
LambdaQueryWrapper<GrowthTaskLog> logWrapper = new LambdaQueryWrapper<GrowthTaskLog>()
|
|
|
.eq(GrowthTaskLog::getUserId, userId)
|
|
.eq(GrowthTaskLog::getUserId, userId)
|
|
|
.eq(GrowthTaskLog::getTaskId, task.getId());
|
|
.eq(GrowthTaskLog::getTaskId, task.getId());
|