| | |
| | | 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; |
| | |
| | | public TAppUser queryAppUser1(@RequestBody Integer appUserId) { |
| | | TAppUser appUser = appUserService.getById(appUserId); |
| | | return appUser; |
| | | } |
| | | |
| | | /** |
| | | * 仅供管理端敏感信息查询使用的内部数据接口。 |
| | | * 调用方由管理服务完成认证和授权;其 Feign 拦截器会添加请求头, |
| | | * 以允许本次响应不进行脱敏。 |
| | | */ |
| | | @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; |
| | | } |
| | | |
| | | /** |
| | | * APP 订场提交页面展示的脱敏手机号时使用的内部数据接口。 |
| | | * 仅返回该预约所需的手机号字段;调用方必须携带内部敏感数据访问请求头。 |
| | | */ |
| | | @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; |
| | | } |
| | | |
| | | /** |
| | |
| | | public void updateAppUser(@RequestBody TAppUser appUser) { |
| | | try { |
| | | TAppUser appUser1 = appUserService.getById(appUser.getId()); |
| | | // 管理端编辑表单可能携带页面展示的脱敏值。 |
| | | // 不得使用该展示值覆盖原始证件或联系方式。 |
| | | 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(); |