|
@@ -1,9 +1,13 @@
|
|
|
package com.etotem.cfc.controller.mind;
|
|
package com.etotem.cfc.controller.mind;
|
|
|
|
|
|
|
|
import com.etotem.cfc.common.Result;
|
|
import com.etotem.cfc.common.Result;
|
|
|
|
|
+import com.etotem.cfc.dto.CompatibilityResultVO;
|
|
|
|
|
+import com.etotem.cfc.dto.FamilyDashboardVO;
|
|
|
import com.etotem.cfc.entity.BaziReadingTemplate;
|
|
import com.etotem.cfc.entity.BaziReadingTemplate;
|
|
|
import com.etotem.cfc.entity.FamilyMemberAttributes;
|
|
import com.etotem.cfc.entity.FamilyMemberAttributes;
|
|
|
import com.etotem.cfc.entity.NumSoulConfig;
|
|
import com.etotem.cfc.entity.NumSoulConfig;
|
|
|
|
|
+import com.etotem.cfc.mapper.FamilyMapper;
|
|
|
|
|
+import com.etotem.cfc.service.CompatibilityService;
|
|
|
import com.etotem.cfc.service.FamilyMemberAttributeService;
|
|
import com.etotem.cfc.service.FamilyMemberAttributeService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
@@ -23,6 +27,12 @@ public class TraditionalMirrorController {
|
|
|
@Resource
|
|
@Resource
|
|
|
private FamilyMemberAttributeService familyMemberAttributeService;
|
|
private FamilyMemberAttributeService familyMemberAttributeService;
|
|
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private CompatibilityService compatibilityService;
|
|
|
|
|
+
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private FamilyMapper familyMapper;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Get traditional culture mirror data for a family member.
|
|
* Get traditional culture mirror data for a family member.
|
|
|
* Returns BaZi (eight characters), wuxing elements, zodiac, life number,
|
|
* Returns BaZi (eight characters), wuxing elements, zodiac, life number,
|
|
@@ -69,6 +79,39 @@ public class TraditionalMirrorController {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Get family dashboard: all members + family wuxing + pairwise summaries + weekly insight
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/family-dashboard")
|
|
|
|
|
+ public Result<?> familyDashboard(@RequestBody Map<String, Object> params) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ Long familyId = Long.valueOf(params.get("familyId").toString());
|
|
|
|
|
+ FamilyDashboardVO dashboard = compatibilityService.getFamilyDashboard(familyId, null, null);
|
|
|
|
|
+ return Result.success(dashboard);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("获取家庭天盘数据失败", e);
|
|
|
|
|
+ return Result.error(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Compute duo compatibility between two family members.
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/compatibility")
|
|
|
|
|
+ public Result<?> compatibility(@RequestBody Map<String, Object> params) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ Long memberId1 = Long.valueOf(params.get("memberId1").toString());
|
|
|
|
|
+ Long memberId2 = Long.valueOf(params.get("memberId2").toString());
|
|
|
|
|
+ String memberType1 = params.containsKey("memberType1") ? params.get("memberType1").toString() : "child";
|
|
|
|
|
+ String memberType2 = params.containsKey("memberType2") ? params.get("memberType2").toString() : "child";
|
|
|
|
|
+ CompatibilityResultVO result = compatibilityService.computeCompatibility(memberId1, memberType1, memberId2, memberType2);
|
|
|
|
|
+ return Result.success(result);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("获取双人合盘数据失败", e);
|
|
|
|
|
+ return Result.error(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@SuppressWarnings("unchecked")
|
|
@SuppressWarnings("unchecked")
|
|
|
private Map<String, Object> parseJsonField(String json) {
|
|
private Map<String, Object> parseJsonField(String json) {
|
|
|
if (json == null || json.isEmpty() || !json.startsWith("{")) {
|
|
if (json == null || json.isEmpty() || !json.startsWith("{")) {
|