Pārlūkot izejas kodu

feat(task): CreateTaskDTO支持source_type/is_daily_progress/target_value透传

E2E Test Bot 2 nedēļas atpakaļ
vecāks
revīzija
5592fea2dd

+ 7 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/CreateTaskDTO.java

@@ -72,9 +72,15 @@ public class CreateTaskDTO {
     // TASK-SYS-248: 最短持续秒数(专注/游戏类,未达标不计完成)
     private Integer minDurationSeconds;
 
-    // 来源类型: self/assigned/plan/health_plan/training_plan/onboarding/ai/template/article/activity/purchase
+// 来源类型: self/assigned/plan/health_plan/training_plan/onboarding/ai/template/article/activity/purchase
     private String sourceType;
 
     // 来源ID(如 training_plans.id / task_plan_instances.id)
     private Long sourceId;
+
+    // 统一任务系统: 1=每日进度型任务(无deadline,每日重置)
+    private Integer isDailyProgress;
+
+    // 统一任务系统: 进度目标值(is_daily_progress=1时有效)
+    private Integer targetValue;
 }

+ 8 - 1
cfc-backend/src/main/java/com/etotem/cfc/service/TaskService.java

@@ -287,8 +287,15 @@ task.setReviewByCategory(dto.getReviewByCategory() != null ? dto.getReviewByCate
         task.setStartCount(0);
         task.setMinDurationSeconds(dto.getMinDurationSeconds() != null ? dto.getMinDurationSeconds() : 0);
 
-        task.setSourceType(dto.getSourceType());
+task.setSourceType(dto.getSourceType() != null ? dto.getSourceType() : "self");
         task.setSourceId(dto.getSourceId());
+        task.setIsDailyProgress(dto.getIsDailyProgress() != null ? dto.getIsDailyProgress() : 0);
+        task.setTargetValue(dto.getTargetValue());
+
+        // 进度型任务无 deadline(原 growth_task DAILY:每日重置,无截止时间)
+        if (task.getIsDailyProgress() != null && task.getIsDailyProgress() == 1) {
+            task.setDeadline(null);
+        }
 
         return task;
     }