|
|
@@ -10,6 +10,7 @@ import com.etotem.cfc.mapper.GrowthTaskLogMapper;
|
|
|
import com.etotem.cfc.mapper.GrowthTaskMapper;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Propagation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
@@ -106,9 +107,14 @@ item.put("dimension", task.getDimension());
|
|
|
|
|
|
/**
|
|
|
* Update progress for a task. Auto-marks completed when progress >= targetValue.
|
|
|
+ * Uses REQUIRES_NEW so failures never mark the caller transaction rollback-only.
|
|
|
*/
|
|
|
- @Transactional
|
|
|
+ @Transactional(propagation = Propagation.REQUIRES_NEW)
|
|
|
public void updateProgress(Long userId, String taskKey, int increment) {
|
|
|
+ if (userId == null) {
|
|
|
+ // 未绑定登录账号的家庭成员(如仅建档的孩子)无成长任务进度
|
|
|
+ return;
|
|
|
+ }
|
|
|
GrowthTask task = growthTaskMapper.selectOne(
|
|
|
new LambdaQueryWrapper<GrowthTask>()
|
|
|
.eq(GrowthTask::getTaskKey, taskKey)
|