|
|
@@ -3,6 +3,8 @@ package com.etotem.cfc.controller;
|
|
|
import com.etotem.cfc.common.Result;
|
|
|
import com.etotem.cfc.dto.FamilyEarningsSummaryDTO;
|
|
|
import com.etotem.cfc.entity.FamilyEarningsRecord;
|
|
|
+import com.etotem.cfc.entity.User;
|
|
|
+import com.etotem.cfc.mapper.UserMapper;
|
|
|
import com.etotem.cfc.service.FamilyEarningsService;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestAttribute;
|
|
|
@@ -21,6 +23,9 @@ public class FamilyEarningsController {
|
|
|
@Resource
|
|
|
private FamilyEarningsService familyEarningsService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private UserMapper userMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 获取家庭收益总览
|
|
|
*/
|
|
|
@@ -115,17 +120,17 @@ public class FamilyEarningsController {
|
|
|
* 获取用户的家庭ID
|
|
|
*/
|
|
|
private Long getFamilyId(Long userId) {
|
|
|
- // 通过userId查询familyId
|
|
|
- // 实际项目中需要实现这个方法
|
|
|
- return 1L; // 示例值,需要替换为实际查询逻辑
|
|
|
+ if (userId == null) return null;
|
|
|
+ User user = userMapper.selectById(userId);
|
|
|
+ return user != null ? user.getFamilyId() : null;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 检查用户是否是家庭管理员
|
|
|
*/
|
|
|
private boolean isFamilyAdmin(Long userId) {
|
|
|
- // 通过userId查询用户信息,检查isFamilyAdmin字段
|
|
|
- // 实际项目中需要实现这个方法
|
|
|
- return true; // 示例值,需要替换为实际查询逻辑
|
|
|
+ if (userId == null) return false;
|
|
|
+ User user = userMapper.selectById(userId);
|
|
|
+ return user != null && user.getIsFamilyAdmin() != null && user.getIsFamilyAdmin();
|
|
|
}
|
|
|
}
|