刘帅
2026-09-21 86ce1aaf6819a6d62cfba4233219fa4661aacbff
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/system/SensitiveDataController.java
@@ -1,12 +1,19 @@
package com.dsh.guns.modular.system.controller.system;
import com.dsh.course.feignClient.account.AppUserClient;
import com.dsh.course.feignClient.account.CoachClient;
import com.dsh.course.feignClient.account.RefereeClient;
import com.dsh.course.feignClient.account.model.CoachSerchVO;
import com.dsh.course.feignClient.account.model.RefereeList;
import com.dsh.guns.config.UserExt;
import com.dsh.guns.core.common.exception.BizExceptionEnum;
import com.dsh.guns.core.exception.GunsException;
import com.dsh.guns.modular.system.audit.ManagementAuditWriter;
import com.dsh.guns.modular.system.model.SiteBooking;
import com.dsh.guns.modular.system.model.TOperator;
import com.dsh.guns.modular.system.model.CoachQuery;
import com.dsh.guns.modular.system.service.ISiteBookingService;
import com.dsh.guns.modular.system.service.TOperatorService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -17,6 +24,7 @@
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@@ -28,6 +36,9 @@
    @Resource private ManagementAuditWriter auditWriter;
    @Resource private IUserService userService;
    @Resource private ISiteBookingService siteBookingService;
    @Resource private CoachClient coachClient;
    @Resource private RefereeClient refereeClient;
    @Resource private TOperatorService operatorService;
    @GetMapping("/app-user/{id}")
    public Map<String, Object> appUser(@PathVariable Integer id) {
@@ -81,6 +92,67 @@
        return result;
    }
    @GetMapping("/coach/{id}")
    public Map<String, Object> coach(@PathVariable Integer id) {
        assertAdmin();
        // 与教练管理页 /tCoach/list 使用同一个查询入口,确保返回字段和数据权限一致。
        CoachQuery query = new CoachQuery();
        query.setId(id);
        List<CoachSerchVO> coaches = coachClient.listAll(query);
        CoachSerchVO coach = coaches == null || coaches.isEmpty() ? null : coaches.get(0);
        Map<String, Object> result = null;
        if (coach != null) {
            result = new HashMap<String, Object>();
            result.put("id", coach.getId());
            result.put("name", coach.getName());
            result.put("phone", coach.getPhone());
            result.put("idCard", coach.getIdcard());
        }
        writeAudit("coach", id, coach == null ? null : coach.getName(), result == null ? "NOT_FOUND" : "SUCCESS");
        return result;
    }
    @GetMapping("/referee/{id}")
    public Map<String, Object> referee(@PathVariable Integer id) {
        assertAdmin();
        // 使用裁判管理页 /referee/listAll 对应的列表查询接口精确查询该裁判。
        RefereeList query = new RefereeList();
        query.setId(id);
        query.setOffset(0);
        query.setLimit(1);
        Map<String, Object> listResult = refereeClient.getRefereeList(query);
        List<Map<String, Object>> referees = listResult == null ? null
                : (List<Map<String, Object>>) listResult.get("rows");
        Map<String, Object> referee = referees == null || referees.isEmpty() ? null : referees.get(0);
        Map<String, Object> result = null;
        if (referee != null) {
            result = new HashMap<String, Object>();
            result.put("id", referee.get("id"));
            result.put("name", referee.get("name"));
            result.put("phone", referee.get("phone"));
        }
        writeAudit("referee", id, referee == null ? null : String.valueOf(referee.get("name")),
                result == null ? "NOT_FOUND" : "SUCCESS");
        return result;
    }
    @GetMapping("/operator/{id}")
    public Map<String, Object> operator(@PathVariable Integer id) {
        assertAdmin();
        TOperator operator = operatorService.getById(id);
        User employee = operator == null ? null : userService.getById(operator.getUserId());
        Map<String, Object> result = null;
        if (employee != null) {
            result = new HashMap<String, Object>();
            result.put("id", employee.getId());
            result.put("name", employee.getName());
            result.put("phone", employee.getPhone());
            result.put("idCard", employee.getIdCard());
        }
        writeAudit("operator", id, operator == null ? null : operator.getName(), result == null ? "NOT_FOUND" : "SUCCESS");
        return result;
    }
    private void assertAdmin() {
        if (UserExt.getUser() == null || !"admin".equalsIgnoreCase(UserExt.getUser().getAccount())) {
            throw new GunsException(BizExceptionEnum.NO_PERMITION);