刘帅
2026-09-20 a3bfafde009c644c21ee8c9971b436f4cd7481f1
cloud-server-account/src/main/java/com/dsh/account/controller/AppUserController.java
@@ -39,6 +39,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestHeader;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -243,6 +244,46 @@
    public TAppUser queryAppUser1(@RequestBody Integer appUserId) {
        TAppUser appUser = appUserService.getById(appUserId);
        return appUser;
    }
    /**
     * Internal-only data source for the management sensitive-data query.  The
     * caller is authenticated and authorised by the management service; its
     * Feign interceptor adds the header that permits the response to remain
     * unmasked for that single request.
     */
    @PostMapping("/internal/sensitive/app-user/{id}")
    public Map<String, Object> sensitiveAppUser(@PathVariable("id") Integer id,
                                                @RequestHeader(value = "X-Internal-Sensitive-Access", required = false) String access) {
        if (!"true".equalsIgnoreCase(access)) {
            throw new IllegalStateException("Sensitive data access is restricted to the management service");
        }
        TAppUser user = appUserService.getById(id);
        if (user == null) return null;
        Map<String, Object> result = new java.util.HashMap<String, Object>();
        result.put("id", user.getId());
        result.put("name", user.getName());
        result.put("phone", user.getPhone());
        result.put("idCard", user.getIdCard());
        return result;
    }
    /**
     * Internal data source used when an APP booking submits its displayed,
     * masked phone number.  Limit the response to the single field needed for
     * that booking; callers must use the internal sensitive-data header.
     */
    @PostMapping("/internal/sensitive/site-booking/app-user/{id}/phone")
    public Map<String, Object> siteBookingPhone(@PathVariable("id") Integer id,
                                                @RequestHeader(value = "X-Internal-Sensitive-Access", required = false) String access) {
        if (!"true".equalsIgnoreCase(access)) {
            throw new IllegalStateException("Sensitive data access is restricted to site booking");
        }
        TAppUser user = appUserService.getById(id);
        if (user == null) return null;
        Map<String, Object> result = new java.util.HashMap<String, Object>();
        result.put("phone", user.getPhone());
        return result;
    }
    /**
@@ -842,6 +883,10 @@
    public void updateAppUser(@RequestBody TAppUser appUser) {
        try {
            TAppUser appUser1 = appUserService.getById(appUser.getId());
            // A management edit form may contain the displayed masked value.
            // Never persist that display value over the original identifier.
            if (appUser.getPhone() != null && appUser.getPhone().contains("*")) appUser.setPhone(appUser1.getPhone());
            if (appUser.getIdCard() != null && appUser.getIdCard().contains("*")) appUser.setIdCard(appUser1.getIdCard());
            appUserService.updateById(appUser);
            if (appUser.getIntegral().compareTo(appUser1.getIntegral()) != 0) {
                UserIntegralChanges userIntegralChanges = new UserIntegralChanges();