|
|
@@ -36,9 +36,6 @@ public class UnlockGateService {
|
|
|
@Resource
|
|
|
private FiveDimensionSelfCheckMapper selfCheckMapper;
|
|
|
|
|
|
- @Resource
|
|
|
- private FiveDimensionScoreMapper fiveDimensionScoreMapper;
|
|
|
-
|
|
|
@Resource
|
|
|
private MicroActionRecordMapper microActionRecordMapper;
|
|
|
|
|
|
@@ -148,37 +145,18 @@ public class UnlockGateService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 家庭级判据:family 内任一成员做过五维自检,或任一维度能量值有值(>0),即解锁首页能量沙盘。
|
|
|
- * 放宽自改进前的"须做完五维自检":做过任一测评/上传报告/完成任务,只要任一经落库为
|
|
|
- * five_dimension_score 的能量维度 >0,即可展示沙盘。
|
|
|
+ * 家庭级判据:family 内任一成员完成健康自检问卷(health_status)即解锁首页能量沙盘。
|
|
|
+ * 严格模式:未完成健康自检问卷的家庭一律锁定沙盘。
|
|
|
*/
|
|
|
public boolean hasFamilySelfCheck(Long familyId) {
|
|
|
if (familyId == null) return false;
|
|
|
- // 来源1:五维自检记录(five_dimension_self_checks)
|
|
|
- List<User> familyUsers = userMapper.selectList(
|
|
|
- new LambdaQueryWrapper<User>().eq(User::getFamilyId, familyId));
|
|
|
- if (!familyUsers.isEmpty()) {
|
|
|
- List<Long> userIds = familyUsers.stream().map(User::getId).collect(Collectors.toList());
|
|
|
- long selfCheckCount = selfCheckMapper.selectCount(
|
|
|
- new LambdaQueryWrapper<FiveDimensionSelfCheck>().in(FiveDimensionSelfCheck::getUserId, userIds));
|
|
|
- if (selfCheckCount >= 1) return true;
|
|
|
- }
|
|
|
- // 来源2:任一维度能量快照 >0(five_dimension_score)
|
|
|
- long scoreCount = fiveDimensionScoreMapper.selectCount(
|
|
|
- new LambdaQueryWrapper<FiveDimensionScore>()
|
|
|
- .eq(FiveDimensionScore::getFamilyId, familyId)
|
|
|
- .gt(FiveDimensionScore::getScore, 0));
|
|
|
- if (scoreCount >= 1) return true;
|
|
|
- // 来源3:健康自检问卷(health_status)——任一家庭成员完成问卷即解锁
|
|
|
List<FamilyMember> familyMembers = familyMemberMapper.selectList(
|
|
|
new LambdaQueryWrapper<FamilyMember>().eq(FamilyMember::getFamilyId, familyId));
|
|
|
- if (!familyMembers.isEmpty()) {
|
|
|
- List<Long> memberIds = familyMembers.stream().map(FamilyMember::getId).collect(Collectors.toList());
|
|
|
- long healthCount = healthStatusMapper.selectCount(
|
|
|
- new LambdaQueryWrapper<HealthStatus>().in(HealthStatus::getMemberId, memberIds));
|
|
|
- if (healthCount >= 1) return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
+ if (familyMembers.isEmpty()) return false;
|
|
|
+ List<Long> memberIds = familyMembers.stream().map(FamilyMember::getId).collect(Collectors.toList());
|
|
|
+ long healthCount = healthStatusMapper.selectCount(
|
|
|
+ new LambdaQueryWrapper<HealthStatus>().in(HealthStatus::getMemberId, memberIds));
|
|
|
+ return healthCount >= 1;
|
|
|
}
|
|
|
|
|
|
// ========== 当前锁定关卡 ==========
|