功能:完善门店能力与用户安全配置

This commit is contained in:
xiaowang
2026-05-18 10:04:57 +08:00
parent 4563dd2538
commit 3797938616
356 changed files with 24983 additions and 1858 deletions
@@ -91,11 +91,22 @@ public class AuthInterceptor implements HandlerInterceptor {
if (!canAccessShop) {
String message = currentShopId == null || currentShopId <= 0
? "当前登录未选择可用店铺,请重新登录"
: "当前登录店铺已停用或账号已失去该店铺访问权限";
: (userShopBindingSupport.isShopEnabledIgnoringAuthorization(currentShopId)
&& userShopBindingSupport.isShopAuthorizationExpired(currentShopId)
? "店铺已被冻结"
: "当前登录店铺已停用或账号已失去该店铺访问权限");
writeJsonResponse(response, HttpServletResponse.SC_UNAUTHORIZED, message);
return false;
}
if (adminPath
&& !Integer.valueOf(4).equals(currentUser.getType())
&& userShopBindingSupport.isShopAuthorizationExpired(currentShopId)
&& !isExpiredAdminAllowedPath(path)) {
writeJsonResponse(response, HttpServletResponse.SC_FORBIDDEN, "授权已到期,请联系管理员");
return false;
}
if (requiresSignature(request)) {
try {
requestSignatureService.validateRequest(request, token, userId);
@@ -142,6 +153,14 @@ public class AuthInterceptor implements HandlerInterceptor {
return path.startsWith("/admin/") || path.startsWith("/order/admin/");
}
private boolean isExpiredAdminAllowedPath(String path) {
return path.startsWith("/admin/auth/")
|| path.equals("/admin/user/info")
|| path.equals("/permission/list/user/current")
|| path.equals("/api/permission/list/user/current")
|| path.startsWith("/admin/shops/");
}
private void writeJsonResponse(HttpServletResponse response, int status, String message) throws Exception {
response.setStatus(status);
response.setContentType("application/json;charset=UTF-8");
@@ -0,0 +1,17 @@
package com.xiaowang.yuminailcore.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Data
@Configuration
@ConfigurationProperties(prefix = "yuminail.security.login-lock")
public class LoginLockProperties {
private int maxFailures = 5;
private long windowSeconds = 600;
private long lockSeconds = 900;
}
@@ -14,10 +14,16 @@ public class RateLimitProperties {
private LimitRule login = new LimitRule(10, 60);
private LimitRule register = new LimitRule(5, 300);
private LimitRule sendCode = new LimitRule(5, 60);
private LimitRule resetPassword = new LimitRule(5, 600);
private LimitRule wechatMiniLogin = new LimitRule(10, 60);
private LimitRule agreementRead = new LimitRule(60, 60);
private LimitRule authenticatedWrite = new LimitRule(80, 60);
private LimitRule orderCreate = new LimitRule(10, 60);
@@ -0,0 +1,26 @@
package com.xiaowang.yuminailcore.config;
import org.springframework.stereotype.Component;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@Component
public class SecurityHeadersFilter implements Filter {
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
if (response instanceof HttpServletResponse httpResponse) {
httpResponse.setHeader("X-Content-Type-Options", "nosniff");
httpResponse.setHeader("X-Frame-Options", "DENY");
httpResponse.setHeader("Referrer-Policy", "strict-origin-when-cross-origin");
httpResponse.setHeader("Content-Security-Policy", "default-src 'self'; img-src 'self' data: blob: http: https:; style-src 'self' 'unsafe-inline'; script-src 'self'; connect-src 'self' http: https:");
}
chain.doFilter(request, response);
}
}
@@ -0,0 +1,23 @@
package com.xiaowang.yuminailcore.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import java.util.ArrayList;
import java.util.List;
@Data
@Configuration
@ConfigurationProperties(prefix = "yuminail.security.upload")
public class UploadSecurityProperties {
private long maxSize = 10 * 1024 * 1024;
private List<String> allowedMimeTypes = new ArrayList<>(List.of(
"image/jpeg",
"image/png",
"image/webp",
"image/gif"
));
}
@@ -30,6 +30,10 @@ public class WebMvcConfig implements WebMvcConfigurer {
"/user/phone-login",
"/user/wechat-mini/**",
"/user/reset-password-by-phone",
"/legal-agreement/current",
"/legal-agreement/current/**",
"/api/legal-agreement/current",
"/api/legal-agreement/current/**",
"/product/get/**",
"/product/list/**",
"/comment/list/product/**",
@@ -6,6 +6,7 @@ import com.xiaowang.yuminailcore.dto.LoginRequestDTO;
import com.xiaowang.yuminailcore.dto.RefreshTokenRequestDTO;
import com.xiaowang.yuminailcore.dto.SwitchShopRequestDTO;
import com.xiaowang.yuminailcore.service.UserService;
import com.xiaowang.yuminailcore.service.SecurityAuditLogService;
import com.xiaowang.yuminailcore.support.security.RequestThrottleService;
import com.xiaowang.yuminailcore.support.security.OperationGuardStrategy;
import com.xiaowang.yuminailcore.utils.AccountValidationUtils;
@@ -20,26 +21,64 @@ import javax.servlet.http.HttpServletRequest;
@RestController
@RequestMapping("/admin/auth")
@RequiredArgsConstructor
/**
* AdminAuthController exposes HTTP endpoints. Start here to learn the request path, parameter names, and which service method is called.
* Beginner guide: follow the call chain Controller -> Service -> ServiceImpl -> Mapper/support class.
*/
public class AdminAuthController {
/**
* Variable `userService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final UserService userService;
/**
* Variable `requestThrottleService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final RequestThrottleService requestThrottleService;
private final SecurityAuditLogService securityAuditLogService;
@PostMapping("/login")
@OperationGuard(action = "admin-login", ttlSeconds = 8, message = "登录处理中,请勿重复提交")
/**
* Run the login flow.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param loginRequestDTO parameter `loginRequestDTO` supplied by the caller
* @return Result<LoginResponseVO> result consumed by the caller or returned to the frontend
*/
public Result<LoginResponseVO> login(HttpServletRequest request, @Valid @RequestBody LoginRequestDTO loginRequestDTO) {
requestThrottleService.checkLogin(request, loginRequestDTO.getAccount());
LoginResponseVO loginResponseVO = userService.adminLogin(loginRequestDTO);
return Result.success(loginResponseVO);
try {
LoginResponseVO loginResponseVO = userService.adminLogin(loginRequestDTO);
requestThrottleService.clearLoginFailure(request, loginRequestDTO.getAccount());
securityAuditLogService.record(loginResponseVO.getUserInfo().getId(), loginRequestDTO.getAccount(), "ADMIN_LOGIN", "SUCCESS", null, request);
return Result.success(loginResponseVO);
} catch (RuntimeException exception) {
requestThrottleService.recordLoginFailure(request, loginRequestDTO.getAccount());
securityAuditLogService.record(null, loginRequestDTO.getAccount(), "ADMIN_LOGIN", "FAIL", exception.getMessage(), request);
throw exception;
}
}
@GetMapping("/login-shops/{account}")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param account parameter `account` supplied by the caller
* @return Result<LoginShopSelectionVO> result consumed by the caller or returned to the frontend
*/
public Result<LoginShopSelectionVO> getLoginShops(@PathVariable String account) {
return Result.success(userService.getAdminLoginShopSelection(AccountValidationUtils.requireValidAccount(account)));
}
@PostMapping("/switch-shop")
@OperationGuard(action = "admin-switch-shop", ttlSeconds = 10, message = "门店切换中,请勿重复操作")
/**
* Run business method `switchShop`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param switchShopRequestDTO parameter `switchShopRequestDTO` supplied by the caller
* @return Result<LoginResponseVO> result consumed by the caller or returned to the frontend
*/
public Result<LoginResponseVO> switchShop(HttpServletRequest request, @RequestBody SwitchShopRequestDTO switchShopRequestDTO) {
Long userId = (Long) request.getAttribute("userId");
return Result.success(userService.switchAdminShop(userId, switchShopRequestDTO.getShopId(), (String) request.getAttribute("sessionId")));
@@ -47,16 +86,33 @@ public class AdminAuthController {
@PostMapping("/logout")
@OperationGuard(action = "admin-logout", strategy = OperationGuardStrategy.NOOP_IF_DUPLICATE, ttlSeconds = 5)
/**
* Run business method `logout`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> logout(HttpServletRequest request) {
return Result.success(userService.logout((String) request.getAttribute("sessionId")));
}
@PostMapping("/refresh")
/**
* Run business method `refreshToken`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param refreshTokenRequestDTO parameter `refreshTokenRequestDTO` supplied by the caller
* @return Result<LoginResponseVO> result consumed by the caller or returned to the frontend
*/
public Result<LoginResponseVO> refreshToken(@RequestBody RefreshTokenRequestDTO refreshTokenRequestDTO) {
LoginResponseVO loginResponseVO = userService.refreshToken(refreshTokenRequestDTO.getRefreshToken());
if (loginResponseVO.getUserInfo() == null
|| loginResponseVO.getUserInfo().getType() == null
|| loginResponseVO.getUserInfo().getType() < 2) {
/**
* Run business method `RuntimeException`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return throw new result consumed by the caller or returned to the frontend
*/
throw new RuntimeException("您没有后台管理权限");
}
return Result.success(loginResponseVO);
@@ -20,9 +20,18 @@ import java.util.List;
@RestController
@RequestMapping("/admin/comment")
@RequiredArgsConstructor
/**
* AdminCommentController exposes HTTP endpoints. Start here to learn the request path, parameter names, and which service method is called.
* Beginner guide: follow the call chain Controller -> Service -> ServiceImpl -> Mapper/support class.
*/
public class AdminCommentController {
/**
* Variable `commentService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final CommentService commentService;
/**
* Variable `adminScopeHelper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final AdminScopeHelper adminScopeHelper;
@GetMapping("/list")
@@ -41,6 +50,13 @@ public class AdminCommentController {
@DeleteMapping("/delete/{id}")
@RequirePermission("comment:delete")
/**
* Delete, revoke, or logically remove a record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> deleteComment(HttpServletRequest request, @PathVariable Long id) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
Long managedShopId = adminScopeHelper.resolveShopScope(currentUser, null);
@@ -25,9 +25,17 @@ import java.util.stream.Collectors;
@RequestMapping("/admin/coupon")
@RequiredArgsConstructor
public class AdminCouponController {
/**
* Variable `couponService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final CouponService couponService;
/**
* Variable `userService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final UserService userService;
/**
* Variable `adminScopeHelper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final AdminScopeHelper adminScopeHelper;
/**
@@ -0,0 +1,73 @@
package com.xiaowang.yuminailcore.controller;
import com.xiaowang.yuminailcore.annotation.OperationGuard;
import com.xiaowang.yuminailcore.annotation.RequirePermission;
import com.xiaowang.yuminailcore.common.Result;
import com.xiaowang.yuminailcore.dto.LegalAgreementDTO;
import com.xiaowang.yuminailcore.entity.UserDO;
import com.xiaowang.yuminailcore.service.LegalAgreementService;
import com.xiaowang.yuminailcore.service.SecurityAuditLogService;
import com.xiaowang.yuminailcore.support.AdminScopeHelper;
import com.xiaowang.yuminailcore.vo.LegalAgreementVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping("/admin/legal-agreement")
public class AdminLegalAgreementController {
private final LegalAgreementService legalAgreementService;
private final AdminScopeHelper adminScopeHelper;
private final SecurityAuditLogService securityAuditLogService;
@GetMapping("/list")
@RequirePermission("legal_agreement:manage")
public Result<List<LegalAgreementVO>> list(HttpServletRequest request) {
return Result.success(legalAgreementService.listAdminAgreements(adminScopeHelper.getCurrentUser(request)));
}
@PostMapping("/create")
@RequirePermission("legal_agreement:manage")
@OperationGuard(action = "admin-legal-agreement-create", ttlSeconds = 8, message = "协议保存处理中,请勿重复提交")
public Result<Long> create(HttpServletRequest request, @Valid @RequestBody LegalAgreementDTO dto) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
Long id = legalAgreementService.createAgreement(currentUser, dto);
securityAuditLogService.record(currentUser.getId(), currentUser.getAccount(), "LEGAL_AGREEMENT_CREATE", "SUCCESS", dto.getAgreementType(), request);
return Result.success(id);
}
@PutMapping("/{id}")
@RequirePermission("legal_agreement:manage")
@OperationGuard(action = "admin-legal-agreement-update", ttlSeconds = 8, message = "协议保存处理中,请勿重复提交")
public Result<Boolean> update(HttpServletRequest request, @PathVariable Long id, @Valid @RequestBody LegalAgreementDTO dto) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
Boolean result = legalAgreementService.updateAgreement(currentUser, id, dto);
securityAuditLogService.record(currentUser.getId(), currentUser.getAccount(), "LEGAL_AGREEMENT_UPDATE", "SUCCESS", String.valueOf(id), request);
return Result.success(result);
}
@PutMapping("/{id}/publish")
@RequirePermission("legal_agreement:manage")
@OperationGuard(action = "admin-legal-agreement-publish", ttlSeconds = 8, message = "协议发布处理中,请勿重复提交")
public Result<Boolean> publish(HttpServletRequest request, @PathVariable Long id) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
Boolean result = legalAgreementService.publishAgreement(currentUser, id);
securityAuditLogService.record(currentUser.getId(), currentUser.getAccount(), "LEGAL_AGREEMENT_PUBLISH", "SUCCESS", String.valueOf(id), request);
return Result.success(result);
}
@PutMapping("/{id}/disable")
@RequirePermission("legal_agreement:manage")
@OperationGuard(action = "admin-legal-agreement-disable", ttlSeconds = 8, message = "协议停用处理中,请勿重复提交")
public Result<Boolean> disable(HttpServletRequest request, @PathVariable Long id) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
Boolean result = legalAgreementService.disableAgreement(currentUser, id);
securityAuditLogService.record(currentUser.getId(), currentUser.getAccount(), "LEGAL_AGREEMENT_DISABLE", "SUCCESS", String.valueOf(id), request);
return Result.success(result);
}
}
@@ -21,17 +21,32 @@ import java.util.List;
@RestController
@RequestMapping("/admin/nail-artist")
@RequiredArgsConstructor
/**
* AdminNailArtistController exposes HTTP endpoints. Start here to learn the request path, parameter names, and which service method is called.
* Beginner guide: follow the call chain Controller -> Service -> ServiceImpl -> Mapper/support class.
*/
public class AdminNailArtistController {
private static final String USER_NOT_FOUND_MESSAGE = "用户信息不存在";
private static final String VIEW_SCOPE_MESSAGE = "当前登录店铺无权查看该美甲师,请切换到所属店铺后重试";
private static final String EDIT_SCOPE_MESSAGE = "当前登录店铺无权编辑该美甲师,请切换到所属店铺后重试";
/**
* Variable `nailArtistInfoService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final NailArtistInfoService nailArtistInfoService;
/**
* Variable `adminScopeHelper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final AdminScopeHelper adminScopeHelper;
@RequirePermission("nail_artist:view")
@GetMapping("/list")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<List<NailArtistInfoDTO>> result consumed by the caller or returned to the frontend
*/
public Result<List<NailArtistInfoDTO>> getAllNailArtists(HttpServletRequest request) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
if (currentUser == null) {
@@ -52,6 +67,13 @@ public class AdminNailArtistController {
@RequirePermission("nail_artist:view")
@GetMapping("/get/{userId}")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param userId parameter `userId` supplied by the caller
* @param request parameter `request` supplied by the caller
* @return Result<NailArtistInfoDTO> result consumed by the caller or returned to the frontend
*/
public Result<NailArtistInfoDTO> getNailArtistInfo(@PathVariable Long userId, HttpServletRequest request) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
if (currentUser == null) {
@@ -77,6 +99,13 @@ public class AdminNailArtistController {
@RequirePermission("nail_artist:edit")
@PostMapping("/save")
@OperationGuard(action = "admin-nail-artist-save", ttlSeconds = 10, message = "保存处理中,请勿重复提交")
/**
* Save submitted data.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param nailArtistInfoDTO parameter `nailArtistInfoDTO` supplied by the caller
* @param request parameter `request` supplied by the caller
* @return Result<NailArtistInfoDTO> result consumed by the caller or returned to the frontend
*/
public Result<NailArtistInfoDTO> saveNailArtistInfo(@RequestBody NailArtistInfoDTO nailArtistInfoDTO, HttpServletRequest request) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
if (currentUser == null) {
@@ -21,8 +21,13 @@ import java.util.List;
@RequestMapping("/admin/order")
@RequiredArgsConstructor
public class AdminOrderController {
/**
* Variable `orderService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final OrderService orderService;
/**
* Variable `adminScopeHelper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final AdminScopeHelper adminScopeHelper;
/**
@@ -87,6 +92,11 @@ public class AdminOrderController {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
if (Integer.valueOf(3).equals(currentUser.getType())) {
if (!Integer.valueOf(2).equals(status)) {
/**
* Run business method `RuntimeException`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return throw new result consumed by the caller or returned to the frontend
*/
throw new RuntimeException("美甲师只能完成属于自己的订单");
}
orderService.completeArtistOrder(id, currentUser.getId());
@@ -19,15 +19,34 @@ import java.util.List;
@RestController
@RequestMapping("/admin/permission")
@RequiredArgsConstructor
/**
* AdminPermissionController exposes HTTP endpoints. Start here to learn the request path, parameter names, and which service method is called.
* Beginner guide: follow the call chain Controller -> Service -> ServiceImpl -> Mapper/support class.
*/
public class AdminPermissionController {
/**
* Variable `permissionService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final PermissionService permissionService;
/**
* Variable `userService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final UserService userService;
/**
* Variable `adminScopeHelper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final AdminScopeHelper adminScopeHelper;
@PostMapping("/create")
@RequirePermission("permission:create")
@OperationGuard(action = "admin-permission-create", ttlSeconds = 10, message = "保存处理中,请勿重复提交")
/**
* Create a new record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param permissionDTO parameter `permissionDTO` supplied by the caller
* @return Result<Long> result consumed by the caller or returned to the frontend
*/
public Result<Long> createPermission(HttpServletRequest request, @RequestBody PermissionDTO permissionDTO) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
adminScopeHelper.requirePlatformAdmin(currentUser, "只有平台管理员可以维护权限定义");
@@ -38,6 +57,14 @@ public class AdminPermissionController {
@PutMapping("/update/{id}")
@RequirePermission("permission:edit")
@OperationGuard(action = "admin-permission-update", ttlSeconds = 10, message = "保存处理中,请勿重复提交")
/**
* Update an existing record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @param permissionDTO parameter `permissionDTO` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> updatePermission(HttpServletRequest request, @PathVariable Long id, @RequestBody PermissionDTO permissionDTO) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
adminScopeHelper.requirePlatformAdmin(currentUser, "只有平台管理员可以维护权限定义");
@@ -48,6 +75,13 @@ public class AdminPermissionController {
@DeleteMapping("/delete/{id}")
@RequirePermission("permission:delete")
@OperationGuard(action = "admin-permission-delete", ttlSeconds = 10, message = "操作处理中,请勿重复提交")
/**
* Delete, revoke, or logically remove a record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> deletePermission(HttpServletRequest request, @PathVariable Long id) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
adminScopeHelper.requirePlatformAdmin(currentUser, "只有平台管理员可以维护权限定义");
@@ -57,6 +91,12 @@ public class AdminPermissionController {
@GetMapping("/get/{id}")
@RequirePermission("permission:view")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param id parameter `id` supplied by the caller
* @return Result<PermissionVO> result consumed by the caller or returned to the frontend
*/
public Result<PermissionVO> getPermissionById(@PathVariable Long id) {
PermissionVO permissionVO = permissionService.getPermissionById(id);
return Result.success(permissionVO);
@@ -64,6 +104,11 @@ public class AdminPermissionController {
@GetMapping("/list/all")
@RequirePermission("permission:view")
/**
* List records for the current query or current user scope.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return Result<List<PermissionVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<PermissionVO>> listAllPermissions() {
List<PermissionVO> permissionVOs = permissionService.listAllPermissions();
return Result.success(permissionVOs);
@@ -71,6 +116,12 @@ public class AdminPermissionController {
@GetMapping("/list/group/{permissionGroup}")
@RequirePermission("permission:view")
/**
* List records for the current query or current user scope.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param permissionGroup parameter `permissionGroup` supplied by the caller
* @return Result<List<PermissionVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<PermissionVO>> listPermissionsByGroup(@PathVariable String permissionGroup) {
List<PermissionVO> permissionVOs = permissionService.listPermissionsByGroup(permissionGroup);
return Result.success(permissionVOs);
@@ -78,11 +129,23 @@ public class AdminPermissionController {
@GetMapping("/user/{userId}")
@RequirePermission("permission:view")
/**
* List records for the current query or current user scope.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param userId parameter `userId` supplied by the caller
* @return Result<List<PermissionVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<PermissionVO>> listUserPermissions(HttpServletRequest request, @PathVariable Long userId) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
if (!adminScopeHelper.isPlatformAdmin(currentUser)) {
UserDO targetUser = userService.getById(userId);
if (targetUser == null) {
/**
* Run business method `RuntimeException`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return throw new result consumed by the caller or returned to the frontend
*/
throw new RuntimeException("目标用户不存在");
}
adminScopeHelper.ensureUserAccessibleInCurrentShop(currentUser, userId, "无权查看其他店铺用户权限");
@@ -93,6 +156,13 @@ public class AdminPermissionController {
@GetMapping("/assignable/{userId}")
@RequirePermission("permission:assign")
/**
* List records for the current query or current user scope.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param userId parameter `userId` supplied by the caller
* @return Result<List<Long>> result consumed by the caller or returned to the frontend
*/
public Result<List<Long>> listAssignablePermissionIds(HttpServletRequest request, @PathVariable Long userId) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
if (!adminScopeHelper.isPlatformAdmin(currentUser)) {
@@ -103,6 +173,12 @@ public class AdminPermissionController {
}
@GetMapping("/user/current")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<List<PermissionVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<PermissionVO>> getCurrentUserPermissions(HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
userService.syncManagedPermissions(userId);
@@ -18,9 +18,18 @@ import java.util.List;
@RestController
@RequestMapping("/admin/product")
@RequiredArgsConstructor
/**
* AdminProductController exposes HTTP endpoints. Start here to learn the request path, parameter names, and which service method is called.
* Beginner guide: follow the call chain Controller -> Service -> ServiceImpl -> Mapper/support class.
*/
public class AdminProductController {
/**
* Variable `productService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final ProductService productService;
/**
* Variable `adminScopeHelper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final AdminScopeHelper adminScopeHelper;
@GetMapping("/list")
@@ -41,6 +50,13 @@ public class AdminProductController {
@PostMapping("/create")
@RequirePermission("product:create")
@OperationGuard(action = "admin-product-create", ttlSeconds = 10, message = "保存处理中,请勿重复提交")
/**
* Create a new record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param productDTO parameter `productDTO` supplied by the caller
* @return Result<Long> result consumed by the caller or returned to the frontend
*/
public Result<Long> createProduct(HttpServletRequest request, @RequestBody ProductDTO productDTO) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
productDTO.setShopId(adminScopeHelper.resolveShopScope(currentUser, productDTO.getShopId()));
@@ -51,6 +67,14 @@ public class AdminProductController {
@PutMapping("/update/{id}")
@RequirePermission("product:edit")
@OperationGuard(action = "admin-product-update", ttlSeconds = 10, message = "保存处理中,请勿重复提交")
/**
* Update an existing record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @param productDTO parameter `productDTO` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> updateProduct(HttpServletRequest request, @PathVariable Long id, @RequestBody ProductDTO productDTO) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
ProductVO productVO = productService.getProductById(id);
@@ -67,6 +91,13 @@ public class AdminProductController {
@DeleteMapping("/delete/{id}")
@RequirePermission("product:delete")
@OperationGuard(action = "admin-product-delete", ttlSeconds = 10, message = "操作处理中,请勿重复提交")
/**
* Delete, revoke, or logically remove a record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> deleteProduct(HttpServletRequest request, @PathVariable Long id) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
ProductVO productVO = productService.getProductById(id);
@@ -80,6 +111,12 @@ public class AdminProductController {
@GetMapping("/list/all")
@RequirePermission("product:view")
/**
* List records for the current query or current user scope.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<List<ProductVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<ProductVO>> listAllProducts(HttpServletRequest request) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
Long shopId = adminScopeHelper.resolveShopScope(currentUser, null);
@@ -19,9 +19,18 @@ import java.util.List;
@RestController
@RequestMapping("/admin/shops")
@RequiredArgsConstructor
/**
* AdminShopController exposes HTTP endpoints. Start here to learn the request path, parameter names, and which service method is called.
* Beginner guide: follow the call chain Controller -> Service -> ServiceImpl -> Mapper/support class.
*/
public class AdminShopController {
/**
* Variable `shopService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final ShopService shopService;
/**
* Variable `adminScopeHelper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final AdminScopeHelper adminScopeHelper;
@GetMapping("/list")
@@ -42,6 +51,13 @@ public class AdminShopController {
@PostMapping("/create")
@RequirePermission("shop:create")
@OperationGuard(action = "admin-shop-create", ttlSeconds = 10, message = "保存处理中,请勿重复提交")
/**
* Create a new record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param shopDTO parameter `shopDTO` supplied by the caller
* @return Result<Long> result consumed by the caller or returned to the frontend
*/
public Result<Long> createShop(HttpServletRequest request, @RequestBody ShopDTO shopDTO) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
adminScopeHelper.requirePlatformAdmin(currentUser, "只有平台管理员可以创建店铺");
@@ -52,6 +68,14 @@ public class AdminShopController {
@PutMapping("/update/{id}")
@RequirePermission("shop:edit")
@OperationGuard(action = "admin-shop-update", ttlSeconds = 10, message = "保存处理中,请勿重复提交")
/**
* Update an existing record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @param shopDTO parameter `shopDTO` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> updateShop(HttpServletRequest request, @PathVariable Long id, @RequestBody ShopDTO shopDTO) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
ShopVO shopVO = shopService.getShopById(id);
@@ -59,6 +83,9 @@ public class AdminShopController {
return Result.success(false);
}
adminScopeHelper.ensureShopAccessible(currentUser, shopVO.getId(), "无权编辑其他店铺信息");
if (!adminScopeHelper.isPlatformAdmin(currentUser)) {
shopDTO.setAuthorizationExpireTime(shopVO.getAuthorizationExpireTime());
}
boolean success = shopService.updateShop(id, shopDTO);
return Result.success(success);
}
@@ -66,6 +93,13 @@ public class AdminShopController {
@DeleteMapping("/delete/{id}")
@RequirePermission("shop:delete")
@OperationGuard(action = "admin-shop-delete", ttlSeconds = 10, message = "操作处理中,请勿重复提交")
/**
* Delete, revoke, or logically remove a record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> deleteShop(HttpServletRequest request, @PathVariable Long id) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
adminScopeHelper.requirePlatformAdmin(currentUser, "只有平台管理员可以删除店铺");
@@ -76,6 +110,14 @@ public class AdminShopController {
@PutMapping("/status/{id}")
@RequirePermission("shop:edit")
@OperationGuard(action = "admin-shop-status", ttlSeconds = 10, message = "操作处理中,请勿重复提交")
/**
* Update an existing record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @param statusRequest parameter `statusRequest` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> updateShopStatus(HttpServletRequest request, @PathVariable Long id, @RequestBody StatusRequest statusRequest) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
adminScopeHelper.requirePlatformAdmin(currentUser, "只有平台管理员可以启停店铺");
@@ -85,6 +127,12 @@ public class AdminShopController {
@GetMapping("/list/all")
@RequirePermission("shop:view")
/**
* List records for the current query or current user scope.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<List<ShopVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<ShopVO>> listAllShops(HttpServletRequest request) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
List<ShopVO> shops;
@@ -99,6 +147,13 @@ public class AdminShopController {
@GetMapping("/{id}")
@RequirePermission("shop:view")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @return Result<ShopVO> result consumed by the caller or returned to the frontend
*/
public Result<ShopVO> getShop(HttpServletRequest request, @PathVariable Long id) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
adminScopeHelper.ensureShopAccessible(currentUser, id, "无权查看其他店铺信息");
@@ -0,0 +1,182 @@
package com.xiaowang.yuminailcore.controller;
import com.xiaowang.yuminailcore.annotation.RequirePermission;
import com.xiaowang.yuminailcore.common.Result;
import com.xiaowang.yuminailcore.dto.InviteCodeDTO;
import com.xiaowang.yuminailcore.dto.ShopRoleDTO;
import com.xiaowang.yuminailcore.entity.UserDO;
import com.xiaowang.yuminailcore.service.PermissionService;
import com.xiaowang.yuminailcore.service.ShopRoleService;
import com.xiaowang.yuminailcore.support.AdminScopeHelper;
import com.xiaowang.yuminailcore.vo.InviteCodeVO;
import com.xiaowang.yuminailcore.vo.PermissionVO;
import com.xiaowang.yuminailcore.vo.ShopRoleVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;
@RestController
@RequestMapping("/admin/shop-role")
@RequiredArgsConstructor
/**
* AdminShopRoleController exposes HTTP endpoints. Start here to learn the request path, parameter names, and which service method is called.
* Beginner guide: follow the call chain Controller -> Service -> ServiceImpl -> Mapper/support class.
*/
public class AdminShopRoleController {
/**
* Variable `shopRoleService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final ShopRoleService shopRoleService;
/**
* Variable `permissionService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final PermissionService permissionService;
/**
* Variable `adminScopeHelper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final AdminScopeHelper adminScopeHelper;
@GetMapping("/list")
@RequirePermission("role:view")
// 店铺角色是“只在本店生效”的角色,不是全局后台角色;
// 所以这里要先按当前登录人的店铺范围裁剪,再返回列表。
public Result<List<ShopRoleVO>> list(HttpServletRequest request, @RequestParam(required = false) Long shopId) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(shopRoleService.listRoles(currentUser, shopId));
}
@PostMapping("/create")
@RequirePermission("role:create")
/**
* Create a new record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param dto parameter `dto` supplied by the caller
* @return Result<Long> result consumed by the caller or returned to the frontend
*/
public Result<Long> create(HttpServletRequest request, @Valid @RequestBody ShopRoleDTO dto) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(shopRoleService.createRole(currentUser, dto));
}
@PutMapping("/{id}")
@RequirePermission("role:edit")
/**
* Update an existing record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @param dto parameter `dto` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> update(HttpServletRequest request, @PathVariable Long id, @RequestBody ShopRoleDTO dto) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(shopRoleService.updateRole(currentUser, id, dto));
}
@DeleteMapping("/{id}")
@RequirePermission("role:delete")
/**
* Delete, revoke, or logically remove a record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> delete(HttpServletRequest request, @PathVariable Long id) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(shopRoleService.deleteRole(currentUser, id));
}
@PostMapping("/{id}/permissions")
@RequirePermission("role:edit")
/**
* Run business method `assignPermissions`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @param permissionIds parameter `permissionIds` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> assignPermissions(HttpServletRequest request, @PathVariable Long id, @RequestBody List<Long> permissionIds) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(shopRoleService.assignPermissions(currentUser, id, permissionIds));
}
@PostMapping("/{id}/users")
@RequirePermission("role:edit")
/**
* Run business method `assignUsers`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @param userIds parameter `userIds` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> assignUsers(HttpServletRequest request, @PathVariable Long id, @RequestBody List<Long> userIds) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(shopRoleService.assignUsers(currentUser, id, userIds));
}
@GetMapping("/permission-options")
@RequirePermission("role:view")
/**
* Run business method `permissionOptions`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return Result<List<PermissionVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<PermissionVO>> permissionOptions() {
return Result.success(permissionService.listAllPermissions());
}
@GetMapping("/invite-code/list")
@RequirePermission("user:relation:view")
public Result<List<InviteCodeVO>> listInviteCodes(HttpServletRequest request, @RequestParam(required = false) Long shopId) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(shopRoleService.listInviteCodes(currentUser, shopId));
}
@PostMapping("/invite-code/create")
@RequirePermission("user:relation:edit")
/**
* Create a new record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param dto parameter `dto` supplied by the caller
* @return Result<Long> result consumed by the caller or returned to the frontend
*/
public Result<Long> createInviteCode(HttpServletRequest request, @Valid @RequestBody InviteCodeDTO dto) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(shopRoleService.createInviteCode(currentUser, dto));
}
@PutMapping("/invite-code/{id}/status")
@RequirePermission("user:relation:edit")
/**
* Update an existing record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @param status parameter `status` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> updateInviteCodeStatus(HttpServletRequest request, @PathVariable Long id, @RequestParam Integer status) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(shopRoleService.updateInviteCodeStatus(currentUser, id, status));
}
@GetMapping("/invite-code/resolve")
// 注册页输入邀请码时调用这个接口,用来提前展示“会归属到谁、哪个店”。
/**
* Run business method `resolve`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param code parameter `code` supplied by the caller
* @return Result<InviteCodeVO> result consumed by the caller or returned to the frontend
*/
public Result<InviteCodeVO> resolve(@RequestParam String code) {
return Result.success(shopRoleService.resolveInviteCode(code));
}
}
@@ -21,8 +21,13 @@ import java.util.List;
@RequestMapping("/admin/tag")
@RequiredArgsConstructor
public class AdminTagController {
/**
* Variable `tagService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final TagService tagService;
/**
* Variable `adminScopeHelper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final AdminScopeHelper adminScopeHelper;
/**
@@ -6,13 +6,18 @@ import com.xiaowang.yuminailcore.common.Result;
import com.xiaowang.yuminailcore.dto.AdminUserBalanceChangeDTO;
import com.xiaowang.yuminailcore.dto.AdminUserVipOverrideDTO;
import com.xiaowang.yuminailcore.dto.UserDTO;
import com.xiaowang.yuminailcore.dto.UserRelationUpdateDTO;
import com.xiaowang.yuminailcore.entity.UserDO;
import com.xiaowang.yuminailcore.service.UserAssetService;
import com.xiaowang.yuminailcore.service.UserService;
import com.xiaowang.yuminailcore.service.ShopRoleService;
import com.xiaowang.yuminailcore.support.AdminScopeHelper;
import com.xiaowang.yuminailcore.support.BookableArtistSupport;
import com.xiaowang.yuminailcore.vo.BalanceChangeDetailVO;
import com.xiaowang.yuminailcore.vo.PageResultVO;
import com.xiaowang.yuminailcore.vo.UserStatisticsVO;
import com.xiaowang.yuminailcore.vo.UserAssetVO;
import com.xiaowang.yuminailcore.vo.UserRelationVO;
import com.xiaowang.yuminailcore.vo.UserVO;
import lombok.Data;
import lombok.RequiredArgsConstructor;
@@ -26,11 +31,31 @@ import java.util.stream.Collectors;
@RestController
@RequestMapping("/admin/user")
@RequiredArgsConstructor
/**
* AdminUserController exposes HTTP endpoints. Start here to learn the request path, parameter names, and which service method is called.
* Beginner guide: follow the call chain Controller -> Service -> ServiceImpl -> Mapper/support class.
*/
public class AdminUserController {
/**
* Variable `userService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final UserService userService;
/**
* Variable `userAssetService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final UserAssetService userAssetService;
/**
* Variable `shopRoleService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final ShopRoleService shopRoleService;
/**
* Variable `adminScopeHelper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final AdminScopeHelper adminScopeHelper;
/**
* Variable `bookableArtistSupport`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final BookableArtistSupport bookableArtistSupport;
@GetMapping("/list")
@RequirePermission("user:view")
@@ -40,17 +65,87 @@ public class AdminUserController {
@RequestParam(defaultValue = "10") Integer size,
@RequestParam(required = false) String keyword,
@RequestParam(required = false) Long shopId,
@RequestParam(required = false) Integer type
@RequestParam(required = false) Integer type,
@RequestParam(required = false) Long roleId,
@RequestParam(required = false) Long parentUserId,
@RequestParam(required = false) String sourceType,
@RequestParam(required = false) Integer status,
@RequestParam(required = false) String vipLevel,
@RequestParam(required = false) String createdFrom,
@RequestParam(required = false) String createdTo,
@RequestParam(required = false) Boolean hasPhone,
@RequestParam(required = false) Boolean hasOrder
) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
shopId = adminScopeHelper.resolveShopScope(currentUser, shopId);
PageResultVO<UserVO> result = userService.pageUsers(page, size, keyword, shopId, type);
PageResultVO<UserVO> result = userService.pageUsers(page, size, keyword, shopId, type, roleId, parentUserId, sourceType, status, vipLevel, createdFrom, createdTo, hasPhone, hasOrder);
return Result.success(result);
}
@GetMapping("/statistics")
@RequirePermission("user:view")
public Result<UserStatisticsVO> statisticsUsers(HttpServletRequest request,
@RequestParam(required = false) String keyword,
@RequestParam(required = false) Long shopId,
@RequestParam(required = false) Integer type,
@RequestParam(required = false) Long roleId,
@RequestParam(required = false) Long parentUserId,
@RequestParam(required = false) String sourceType,
@RequestParam(required = false) Integer status,
@RequestParam(required = false) String vipLevel,
@RequestParam(required = false) String createdFrom,
@RequestParam(required = false) String createdTo,
@RequestParam(required = false) Boolean hasPhone,
@RequestParam(required = false) Boolean hasOrder) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
shopId = adminScopeHelper.resolveShopScope(currentUser, shopId);
return Result.success(userService.statisticsUsers(keyword, shopId, type, roleId, parentUserId, sourceType, status, vipLevel, createdFrom, createdTo, hasPhone, hasOrder));
}
@GetMapping("/relation/me")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<UserRelationVO> result consumed by the caller or returned to the frontend
*/
public Result<UserRelationVO> getMyRelation(HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
return Result.success(userService.getCurrentUserRelation(userId));
}
@GetMapping("/relation/options")
@RequirePermission("user:relation:view")
public Result<List<UserRelationVO>> relationOptions(HttpServletRequest request, @RequestParam(required = false) Long shopId) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(shopRoleService.listRelationOptions(currentUser, shopId));
}
@PutMapping("/{id}/relation")
@RequirePermission("user:relation:edit")
/**
* Update an existing record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @param dto parameter `dto` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> updateRelation(HttpServletRequest request, @PathVariable Long id, @RequestBody UserRelationUpdateDTO dto) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(shopRoleService.updateUserRelation(currentUser, id, dto));
}
@PostMapping("/create")
@RequirePermission("user:create")
@OperationGuard(action = "admin-user-create", ttlSeconds = 10, message = "保存处理中,请勿重复提交")
/**
* Create a new record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param userDTO parameter `userDTO` supplied by the caller
* @return Result<Long> result consumed by the caller or returned to the frontend
*/
public Result<Long> createUser(HttpServletRequest request, @Valid @RequestBody UserDTO userDTO) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
adminScopeHelper.ensureAssignableUserType(currentUser, userDTO.getType());
@@ -66,6 +161,14 @@ public class AdminUserController {
@PutMapping("/update/{id}")
@RequirePermission("user:edit")
@OperationGuard(action = "admin-user-update", ttlSeconds = 10, message = "保存处理中,请勿重复提交")
/**
* Update an existing record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @param userDTO parameter `userDTO` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> updateUser(HttpServletRequest request, @PathVariable Long id, @Valid @RequestBody UserDTO userDTO) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
UserVO targetUser = userService.getUserById(id);
@@ -87,6 +190,14 @@ public class AdminUserController {
@PutMapping("/status/{id}")
@RequirePermission("user:disable")
@OperationGuard(action = "admin-user-status", ttlSeconds = 10, message = "操作处理中,请勿重复提交")
/**
* Update an existing record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param httpRequest parameter `httpRequest` supplied by the caller
* @param id parameter `id` supplied by the caller
* @param request parameter `request` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> updateUserStatus(HttpServletRequest httpRequest, @PathVariable Long id, @RequestBody StatusRequest request) {
UserDO currentUser = adminScopeHelper.getCurrentUser(httpRequest);
adminScopeHelper.requirePlatformAdmin(currentUser, "仅系统管理员可以停用用户");
@@ -96,6 +207,11 @@ public class AdminUserController {
}
adminScopeHelper.ensureUserAccessibleInCurrentShop(currentUser, id, "无权变更其他店铺用户状态");
if (Integer.valueOf(4).equals(targetUser.getType())) {
/**
* Run business method `RuntimeException`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return throw new result consumed by the caller or returned to the frontend
*/
throw new RuntimeException("管理员账号不允许停用");
}
boolean success = userService.updateUserStatus(id, request.getStatus());
@@ -105,6 +221,13 @@ public class AdminUserController {
@PostMapping("/reset-password/{userId}")
@RequirePermission("user:reset_password")
@OperationGuard(action = "admin-user-reset-password", ttlSeconds = 10, message = "操作处理中,请勿重复提交")
/**
* Run business method `resetPassword`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param userId parameter `userId` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> resetPassword(HttpServletRequest request, @PathVariable Long userId) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
UserVO targetUser = userService.getUserById(userId);
@@ -120,6 +243,13 @@ public class AdminUserController {
@DeleteMapping("/delete/{id}")
@RequirePermission("user:delete")
@OperationGuard(action = "admin-user-delete", ttlSeconds = 10, message = "操作处理中,请勿重复提交")
/**
* Delete, revoke, or logically remove a record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> deleteUser(HttpServletRequest request, @PathVariable Long id) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
adminScopeHelper.requirePlatformAdmin(currentUser, "仅系统管理员可以删除用户");
@@ -128,6 +258,11 @@ public class AdminUserController {
return Result.success(false);
}
if (Integer.valueOf(4).equals(targetUser.getType())) {
/**
* Run business method `RuntimeException`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return throw new result consumed by the caller or returned to the frontend
*/
throw new RuntimeException("管理员账号不允许删除");
}
boolean success = userService.deleteUser(id);
@@ -137,6 +272,13 @@ public class AdminUserController {
@PutMapping("/unbind/{id}")
@RequirePermission("user:unbind")
@OperationGuard(action = "admin-user-unbind", ttlSeconds = 10, message = "操作处理中,请勿重复提交")
/**
* Run business method `unbindUser`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> unbindUser(HttpServletRequest request, @PathVariable Long id) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
UserVO targetUser = userService.getUserById(id);
@@ -146,6 +288,11 @@ public class AdminUserController {
adminScopeHelper.ensureUserAccessibleInCurrentShop(currentUser, id, "无权解绑其他店铺用户");
adminScopeHelper.ensureAssignableUserType(currentUser, targetUser.getType());
if (Integer.valueOf(4).equals(targetUser.getType())) {
/**
* Run business method `RuntimeException`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return throw new result consumed by the caller or returned to the frontend
*/
throw new RuntimeException("管理员账号不允许解绑");
}
boolean success = userService.unbindUserInShopWithOperator(id, currentUser.getShopId(), currentUser.getType());
@@ -154,6 +301,13 @@ public class AdminUserController {
@GetMapping("/{id}/asset")
@RequirePermission("user:balance:view")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @return Result<UserAssetVO> result consumed by the caller or returned to the frontend
*/
public Result<UserAssetVO> getUserAsset(HttpServletRequest request, @PathVariable Long id) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
UserVO targetUser = requireAccessibleUser(currentUser, id, "无权查看其他店铺用户资产");
@@ -163,6 +317,13 @@ public class AdminUserController {
@GetMapping("/{id}/balance/history")
@RequirePermission("user:balance:view")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @return Result<List<BalanceChangeDetailVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<BalanceChangeDetailVO>> getUserBalanceHistory(HttpServletRequest request, @PathVariable Long id) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
UserVO targetUser = requireAccessibleUser(currentUser, id, "无权查看其他店铺用户余额流水");
@@ -201,6 +362,13 @@ public class AdminUserController {
@PostMapping("/{id}/vip/recalculate")
@RequirePermission("user:vip:manage")
@OperationGuard(action = "admin-user-vip-recalculate", ttlSeconds = 15, message = "操作处理中,请勿重复提交")
/**
* Run business method `recalculateUserVip`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @return Result<UserAssetVO> result consumed by the caller or returned to the frontend
*/
public Result<UserAssetVO> recalculateUserVip(HttpServletRequest request, @PathVariable Long id) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
UserVO targetUser = requireAccessibleUser(currentUser, id, "无权重算其他店铺用户 VIP");
@@ -209,6 +377,12 @@ public class AdminUserController {
}
@GetMapping("/info")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<UserVO> result consumed by the caller or returned to the frontend
*/
public Result<UserVO> getUserInfo(HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
UserVO userVO = userService.getUserById(userId);
@@ -239,8 +413,12 @@ public class AdminUserController {
public Result<List<UserVO>> listArtists(HttpServletRequest request, @RequestParam(required = false) Long shopId) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
shopId = adminScopeHelper.resolveShopScope(currentUser, shopId);
final Long resolvedScopeShopId = shopId;
List<UserVO> artists = userService.listAllUsers().stream()
.filter(user -> Integer.valueOf(2).equals(user.getType()) || Integer.valueOf(3).equals(user.getType()))
.filter(user -> bookableArtistSupport.isValidBookableArtist(resolvedScopeShopId, user.getId()))
.collect(Collectors.toList());
// 用户类型 3 表示美甲师
List<UserVO> artists = userService.listUsersByType(3);
// 如果指定了店铺ID,则过滤该店铺的美甲师
if (shopId != null) {
final Long resolvedShopId = shopId;
@@ -251,9 +429,22 @@ public class AdminUserController {
return Result.success(artists);
}
/**
* Run business method `requireAccessibleUser`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param currentUser parameter `currentUser` supplied by the caller
* @param userId parameter `userId` supplied by the caller
* @param message parameter `message` supplied by the caller
* @return private UserVO result consumed by the caller or returned to the frontend
*/
private UserVO requireAccessibleUser(UserDO currentUser, Long userId, String message) {
UserVO targetUser = userService.getUserById(userId);
if (targetUser == null) {
/**
* Run business method `RuntimeException`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return throw new result consumed by the caller or returned to the frontend
*/
throw new RuntimeException("目标用户不存在");
}
adminScopeHelper.ensureUserAccessibleInCurrentShop(currentUser, userId, message);
@@ -0,0 +1,119 @@
package com.xiaowang.yuminailcore.controller;
import com.xiaowang.yuminailcore.annotation.OperationGuard;
import com.xiaowang.yuminailcore.annotation.RequirePermission;
import com.xiaowang.yuminailcore.common.Result;
import com.xiaowang.yuminailcore.dto.AnnouncementCreateDTO;
import com.xiaowang.yuminailcore.entity.UserDO;
import com.xiaowang.yuminailcore.service.AnnouncementService;
import com.xiaowang.yuminailcore.support.AdminScopeHelper;
import com.xiaowang.yuminailcore.vo.AnnouncementVO;
import com.xiaowang.yuminailcore.vo.MessageTargetOptionsVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping({"/announcement", "/api/announcement"})
/**
* AnnouncementController exposes HTTP endpoints. Start here to learn the request path, parameter names, and which service method is called.
* Beginner guide: follow the call chain Controller -> Service -> ServiceImpl -> Mapper/support class.
*/
public class AnnouncementController {
/**
* Variable `announcementService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final AnnouncementService announcementService;
/**
* Variable `adminScopeHelper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final AdminScopeHelper adminScopeHelper;
@PostMapping("/admin/create")
@RequirePermission("announcement:create")
@OperationGuard(action = "announcement-create", ttlSeconds = 8, message = "公告发布处理中,请勿重复提交")
// 后台发布公告时,targetType 决定“全平台 / 指定店铺 / 指定用户”的范围。
// 前端只需要按 target-options 返回值组装表单即可。
/**
* Run business method `publish`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param dto parameter `dto` supplied by the caller
* @return Result<Long> result consumed by the caller or returned to the frontend
*/
public Result<Long> publish(HttpServletRequest request, @Valid @RequestBody AnnouncementCreateDTO dto) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(announcementService.publishAnnouncement(currentUser, dto));
}
@GetMapping("/admin/list")
@RequirePermission("announcement:view")
/**
* List records for the current query or current user scope.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<List<AnnouncementVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<AnnouncementVO>> listAdmin(HttpServletRequest request) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(announcementService.listAdminAnnouncements(currentUser));
}
@GetMapping("/admin/{id}")
@RequirePermission("announcement:view")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @return Result<AnnouncementVO> result consumed by the caller or returned to the frontend
*/
public Result<AnnouncementVO> getAdmin(HttpServletRequest request, @PathVariable Long id) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(announcementService.getAdminAnnouncement(currentUser, id));
}
@PutMapping("/admin/{id}/revoke")
@RequirePermission("announcement:delete")
@OperationGuard(action = "announcement-revoke", ttlSeconds = 8, message = "公告撤回处理中,请勿重复操作")
/**
* Run business method `revoke`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> revoke(HttpServletRequest request, @PathVariable Long id) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(announcementService.revokeAnnouncement(currentUser, id));
}
@GetMapping("/admin/target-options")
@RequirePermission("announcement:create")
/**
* Run business method `targetOptions`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<MessageTargetOptionsVO> result consumed by the caller or returned to the frontend
*/
public Result<MessageTargetOptionsVO> targetOptions(HttpServletRequest request) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(announcementService.listTargetOptions(currentUser));
}
@GetMapping("/my/list")
/**
* List records for the current query or current user scope.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<List<AnnouncementVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<AnnouncementVO>> listMy(HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
return Result.success(announcementService.listMyAnnouncements(userId));
}
}
@@ -20,7 +20,9 @@ import java.util.List;
@RequestMapping({"/balance-change-detail", "/api/balance-change-detail"})
@RequiredArgsConstructor
public class BalanceChangeDetailController {
/**
* Variable `balanceChangeDetailService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final BalanceChangeDetailService balanceChangeDetailService;
/**
@@ -20,7 +20,9 @@ import java.util.List;
@RequestMapping({"/balance", "/api/balance"})
@RequiredArgsConstructor
public class BalanceController {
/**
* Variable `balanceService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final BalanceService balanceService;
/**
@@ -14,6 +14,10 @@ import java.util.List;
@RestController
@RequestMapping("/cart")
/**
* CartController exposes HTTP endpoints. Start here to learn the request path, parameter names, and which service method is called.
* Beginner guide: follow the call chain Controller -> Service -> ServiceImpl -> Mapper/support class.
*/
public class CartController {
@Resource
@@ -21,6 +25,13 @@ public class CartController {
@PostMapping("/add")
@OperationGuard(action = "cart-add", ttlSeconds = 10, message = "购物车处理中,请勿重复操作")
/**
* Add a new record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param cartDTO parameter `cartDTO` supplied by the caller
* @param request parameter `request` supplied by the caller
* @return Result<Void> result consumed by the caller or returned to the frontend
*/
public Result<Void> addToCart(@RequestBody CartDTO cartDTO, HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
cartService.addToCart(userId, cartDTO);
@@ -29,6 +40,13 @@ public class CartController {
@DeleteMapping("/remove/{productId}")
@OperationGuard(action = "cart-remove", strategy = OperationGuardStrategy.NOOP_IF_DUPLICATE, ttlSeconds = 10)
/**
* Remove a record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param productId parameter `productId` supplied by the caller
* @param request parameter `request` supplied by the caller
* @return Result<Void> result consumed by the caller or returned to the frontend
*/
public Result<Void> removeFromCart(@PathVariable Long productId, HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
cartService.removeFromCart(userId, productId);
@@ -37,6 +55,13 @@ public class CartController {
@PostMapping("/batch-remove")
@OperationGuard(action = "cart-batch-remove", strategy = OperationGuardStrategy.NOOP_IF_DUPLICATE, ttlSeconds = 10)
/**
* Run business method `batchRemoveFromCart`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param cartItemIds parameter `cartItemIds` supplied by the caller
* @param request parameter `request` supplied by the caller
* @return Result<Void> result consumed by the caller or returned to the frontend
*/
public Result<Void> batchRemoveFromCart(@RequestBody List<Long> cartItemIds, HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
cartService.batchRemoveFromCart(userId, cartItemIds);
@@ -45,6 +70,13 @@ public class CartController {
@PutMapping("/update")
@OperationGuard(action = "cart-update", ttlSeconds = 10, message = "购物车处理中,请勿重复操作")
/**
* Update an existing record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param cartDTO parameter `cartDTO` supplied by the caller
* @param request parameter `request` supplied by the caller
* @return Result<Void> result consumed by the caller or returned to the frontend
*/
public Result<Void> updateCartQuantity(@RequestBody CartDTO cartDTO, HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
cartService.updateCartQuantity(userId, cartDTO);
@@ -52,6 +84,12 @@ public class CartController {
}
@GetMapping("/list")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<List<CartVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<CartVO>> getCartList(HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
List<CartVO> cartList = cartService.getCartList(userId);
@@ -60,6 +98,12 @@ public class CartController {
@DeleteMapping("/clear")
@OperationGuard(action = "cart-clear", strategy = OperationGuardStrategy.NOOP_IF_DUPLICATE, ttlSeconds = 10)
/**
* Run business method `clearCart`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<Void> result consumed by the caller or returned to the frontend
*/
public Result<Void> clearCart(HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
cartService.clearCart(userId);
@@ -21,7 +21,9 @@ import java.util.List;
@RequestMapping({"/comment", "/api/comment"})
@RequiredArgsConstructor
public class CommentController {
/**
* Variable `commentService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final CommentService commentService;
/**
@@ -0,0 +1,66 @@
package com.xiaowang.yuminailcore.controller;
import com.xiaowang.yuminailcore.common.Result;
import com.xiaowang.yuminailcore.service.ContactInfoService;
import com.xiaowang.yuminailcore.vo.ContactInfoVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@RestController
@RequiredArgsConstructor
@RequestMapping({"/contact-info", "/api/contact-info"})
/**
* ContactInfoController exposes HTTP endpoints. Start here to learn the request path, parameter names, and which service method is called.
* Beginner guide: follow the call chain Controller -> Service -> ServiceImpl -> Mapper/support class.
*/
public class ContactInfoController {
/**
* Variable `contactInfoService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final ContactInfoService contactInfoService;
@GetMapping("/shop/{shopId}/manager")
/**
* Run business method `shopManager`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param shopId parameter `shopId` supplied by the caller
* @return Result<ContactInfoVO> result consumed by the caller or returned to the frontend
*/
public Result<ContactInfoVO> shopManager(HttpServletRequest request, @PathVariable Long shopId) {
Long userId = (Long) request.getAttribute("userId");
return Result.success(contactInfoService.getShopManagerContact(userId, shopId));
}
@GetMapping("/product/{productId}/artist/{artistId}")
/**
* Run business method `productArtist`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param productId parameter `productId` supplied by the caller
* @param artistId parameter `artistId` supplied by the caller
* @return Result<ContactInfoVO> result consumed by the caller or returned to the frontend
*/
public Result<ContactInfoVO> productArtist(HttpServletRequest request, @PathVariable Long productId, @PathVariable Long artistId) {
Long userId = (Long) request.getAttribute("userId");
return Result.success(contactInfoService.getProductArtistContact(userId, productId, artistId));
}
@GetMapping("/order/{orderId}/artist")
public Result<ContactInfoVO> orderArtist(HttpServletRequest request, @PathVariable Long orderId, @RequestParam(required = false) Long artistId) {
Long userId = (Long) request.getAttribute("userId");
return Result.success(contactInfoService.getOrderArtistContact(userId, orderId, artistId));
}
@GetMapping("/platform")
/**
* Run business method `platform`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return Result<ContactInfoVO> result consumed by the caller or returned to the frontend
*/
public Result<ContactInfoVO> platform() {
return Result.success(contactInfoService.getPlatformContact());
}
}
@@ -24,9 +24,17 @@ import java.util.List;
@RequestMapping("/coupon")
@RequiredArgsConstructor
public class CouponController {
/**
* Variable `couponService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final CouponService couponService;
/**
* Variable `userService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final UserService userService;
/**
* Variable `adminScopeHelper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final AdminScopeHelper adminScopeHelper;
/**
@@ -38,21 +38,60 @@ import java.util.stream.Collectors;
@RestController
@RequestMapping("/admin/dashboard")
@RequiredArgsConstructor
/**
* DashboardController exposes HTTP endpoints. Start here to learn the request path, parameter names, and which service method is called.
* Beginner guide: follow the call chain Controller -> Service -> ServiceImpl -> Mapper/support class.
*/
public class DashboardController {
/**
* Variable `userMapper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final UserMapper userMapper;
/**
* Variable `productMapper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final ProductMapper productMapper;
/**
* Variable `shopMapper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final ShopMapper shopMapper;
/**
* Variable `commentMapper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final CommentMapper commentMapper;
/**
* Variable `orderMapper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final OrderMapper orderMapper;
/**
* Variable `orderItemMapper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final OrderItemMapper orderItemMapper;
/**
* Variable `adminScopeHelper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final AdminScopeHelper adminScopeHelper;
/**
* Variable `userShopBindingSupport`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final UserShopBindingSupport userShopBindingSupport;
/**
* Variable `multiLevelCacheService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final MultiLevelCacheService multiLevelCacheService;
/**
* Variable `appCacheProperties`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final AppCacheProperties appCacheProperties;
@GetMapping("/stats")
@RequirePermission("dashboard:view")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<DashboardStatsVO> result consumed by the caller or returned to the frontend
*/
public Result<DashboardStatsVO> getDashboardStats(HttpServletRequest request) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
Long shopIdScope = resolveShopScope(currentUser);
@@ -69,6 +108,13 @@ public class DashboardController {
return Result.success(stats);
}
/**
* Run business method `buildDashboardStats`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param currentUser parameter `currentUser` supplied by the caller
* @param shopIdScope parameter `shopIdScope` supplied by the caller
* @return private DashboardStatsVO result consumed by the caller or returned to the frontend
*/
private DashboardStatsVO buildDashboardStats(UserDO currentUser, Long shopIdScope) {
DashboardStatsVO stats = new DashboardStatsVO();
@@ -110,6 +156,12 @@ public class DashboardController {
return stats;
}
/**
* Run business method `resolveShopScope`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param currentUser parameter `currentUser` supplied by the caller
* @return private Long result consumed by the caller or returned to the frontend
*/
private Long resolveShopScope(UserDO currentUser) {
if (currentUser == null || currentUser.getType() == 4) {
return null;
@@ -117,6 +169,12 @@ public class DashboardController {
return currentUser.getShopId();
}
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param shopId parameter `shopId` supplied by the caller
* @return private Long result consumed by the caller or returned to the frontend
*/
private Long getTodayOrders(Long shopId) {
// 获取今天的开始时间
LocalDateTime todayStart = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0).withNano(0);
@@ -133,6 +191,12 @@ public class DashboardController {
}
}
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param shopId parameter `shopId` supplied by the caller
* @return private List<HotProductVO> result consumed by the caller or returned to the frontend
*/
private List<HotProductVO> getHotProducts(Long shopId) {
// 通过订单商品表统计每个商品的订单数量,按订单数量排序
// 使用SQL查询获取商品及其订单数量
@@ -180,6 +244,12 @@ public class DashboardController {
return hotProducts;
}
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param shopId parameter `shopId` supplied by the caller
* @return private List<RecentActivityVO> result consumed by the caller or returned to the frontend
*/
private List<RecentActivityVO> getRecentActivities(Long shopId) {
List<RecentActivityVO> activities = new ArrayList<>();
@@ -20,7 +20,9 @@ import java.util.List;
@RequestMapping({"/effect-diagram", "/api/effect-diagram"})
@RequiredArgsConstructor
public class EffectDiagramController {
/**
* Variable `effectDiagramService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final EffectDiagramService effectDiagramService;
/**
@@ -19,9 +19,17 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/file")
@RequiredArgsConstructor
public class FrontendFileController {
/**
* Variable `objectStorageFileService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final ObjectStorageFileService objectStorageFileService;
/**
* Variable `minioService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final MinioService minioService;
/**
* Variable `objectStorageUrlSupport`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final ObjectStorageUrlSupport objectStorageUrlSupport;
/**
@@ -27,10 +27,21 @@ import java.util.Map;
@RequestMapping("/health")
@RequiredArgsConstructor
public class HealthController {
/**
* Variable `dataSource`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final DataSource dataSource;
/**
* Variable `stringRedisTemplate`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final StringRedisTemplate stringRedisTemplate;
/**
* Variable `discoveryClient`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final DiscoveryClient discoveryClient;
/**
* Variable `environment`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final Environment environment;
/**
@@ -42,6 +53,11 @@ public class HealthController {
}
@GetMapping("/diagnostics")
/**
* Run business method `diagnostics`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return Result<Map<String, Object>> result consumed by the caller or returned to the frontend
*/
public Result<Map<String, Object>> diagnostics() {
Map<String, Object> diagnostics = new LinkedHashMap<>();
diagnostics.put("service", environment.getProperty("spring.application.name", "yumi-nail-core"));
@@ -52,6 +68,11 @@ public class HealthController {
return Result.success(diagnostics);
}
/**
* Run business method `checkDatabase`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return private Map<String, Object> result consumed by the caller or returned to the frontend
*/
private Map<String, Object> checkDatabase() {
Map<String, Object> result = new LinkedHashMap<>();
try (Connection connection = dataSource.getConnection()) {
@@ -65,6 +86,11 @@ public class HealthController {
return result;
}
/**
* Run business method `checkRedis`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return private Map<String, Object> result consumed by the caller or returned to the frontend
*/
private Map<String, Object> checkRedis() {
Map<String, Object> result = new LinkedHashMap<>();
try (RedisConnection connection = stringRedisTemplate.getConnectionFactory().getConnection()) {
@@ -77,6 +103,11 @@ public class HealthController {
return result;
}
/**
* Run business method `checkDiscovery`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return private Map<String, Object> result consumed by the caller or returned to the frontend
*/
private Map<String, Object> checkDiscovery() {
Map<String, Object> result = new LinkedHashMap<>();
try {
@@ -0,0 +1,95 @@
package com.xiaowang.yuminailcore.controller;
import com.xiaowang.yuminailcore.annotation.OperationGuard;
import com.xiaowang.yuminailcore.annotation.RequirePermission;
import com.xiaowang.yuminailcore.common.Result;
import com.xiaowang.yuminailcore.dto.LegalAgreementDTO;
import com.xiaowang.yuminailcore.entity.UserDO;
import com.xiaowang.yuminailcore.service.LegalAgreementService;
import com.xiaowang.yuminailcore.service.SecurityAuditLogService;
import com.xiaowang.yuminailcore.support.AdminScopeHelper;
import com.xiaowang.yuminailcore.support.security.RequestThrottleService;
import com.xiaowang.yuminailcore.vo.LegalAgreementVO;
import com.xiaowang.yuminailcore.vo.UserAgreementConsentVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping({"/legal-agreement", "/api/legal-agreement"})
public class LegalAgreementController {
private final LegalAgreementService legalAgreementService;
private final AdminScopeHelper adminScopeHelper;
private final SecurityAuditLogService securityAuditLogService;
private final RequestThrottleService requestThrottleService;
@GetMapping("/current")
public Result<List<LegalAgreementVO>> listCurrent(HttpServletRequest request) {
requestThrottleService.checkAgreementRead(request, "ALL");
return Result.success(legalAgreementService.listCurrentAgreements());
}
@GetMapping("/current/{type}")
public Result<LegalAgreementVO> getCurrent(HttpServletRequest request, @PathVariable String type) {
requestThrottleService.checkAgreementRead(request, type);
return Result.success(legalAgreementService.getCurrentAgreement(type));
}
@GetMapping("/admin/list")
@RequirePermission("legal_agreement:manage")
public Result<List<LegalAgreementVO>> listAdmin(HttpServletRequest request) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(legalAgreementService.listAdminAgreements(currentUser));
}
@PostMapping("/admin/create")
@RequirePermission("legal_agreement:manage")
@OperationGuard(action = "legal-agreement-create", ttlSeconds = 8, message = "协议保存处理中,请勿重复提交")
public Result<Long> create(HttpServletRequest request, @Valid @RequestBody LegalAgreementDTO dto) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
Long id = legalAgreementService.createAgreement(currentUser, dto);
securityAuditLogService.record(currentUser.getId(), currentUser.getAccount(), "LEGAL_AGREEMENT_CREATE", "SUCCESS", dto.getAgreementType(), request);
return Result.success(id);
}
@PutMapping("/admin/{id}")
@RequirePermission("legal_agreement:manage")
@OperationGuard(action = "legal-agreement-update", ttlSeconds = 8, message = "协议保存处理中,请勿重复提交")
public Result<Boolean> update(HttpServletRequest request, @PathVariable Long id, @Valid @RequestBody LegalAgreementDTO dto) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
Boolean result = legalAgreementService.updateAgreement(currentUser, id, dto);
securityAuditLogService.record(currentUser.getId(), currentUser.getAccount(), "LEGAL_AGREEMENT_UPDATE", "SUCCESS", String.valueOf(id), request);
return Result.success(result);
}
@PutMapping("/admin/{id}/publish")
@RequirePermission("legal_agreement:manage")
@OperationGuard(action = "legal-agreement-publish", ttlSeconds = 8, message = "协议发布处理中,请勿重复提交")
public Result<Boolean> publish(HttpServletRequest request, @PathVariable Long id) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
Boolean result = legalAgreementService.publishAgreement(currentUser, id);
securityAuditLogService.record(currentUser.getId(), currentUser.getAccount(), "LEGAL_AGREEMENT_PUBLISH", "SUCCESS", String.valueOf(id), request);
return Result.success(result);
}
@PutMapping("/admin/{id}/disable")
@RequirePermission("legal_agreement:manage")
@OperationGuard(action = "legal-agreement-disable", ttlSeconds = 8, message = "协议停用处理中,请勿重复提交")
public Result<Boolean> disable(HttpServletRequest request, @PathVariable Long id) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
Boolean result = legalAgreementService.disableAgreement(currentUser, id);
securityAuditLogService.record(currentUser.getId(), currentUser.getAccount(), "LEGAL_AGREEMENT_DISABLE", "SUCCESS", String.valueOf(id), request);
return Result.success(result);
}
@GetMapping("/user/agreement-consent/me")
public Result<UserAgreementConsentVO> getMyConsent(HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
return Result.success(legalAgreementService.getMyConsent(userId));
}
}
@@ -20,7 +20,9 @@ import java.util.List;
@RequestMapping({"/login-identity", "/api/login-identity"})
@RequiredArgsConstructor
public class LoginIdentityController {
/**
* Variable `loginIdentityService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final LoginIdentityService loginIdentityService;
/**
@@ -0,0 +1,110 @@
package com.xiaowang.yuminailcore.controller;
import com.xiaowang.yuminailcore.annotation.OperationGuard;
import com.xiaowang.yuminailcore.annotation.RequirePermission;
import com.xiaowang.yuminailcore.common.Result;
import com.xiaowang.yuminailcore.dto.MessageHubPushConfigDTO;
import com.xiaowang.yuminailcore.dto.MessageHubPushTestDTO;
import com.xiaowang.yuminailcore.entity.UserDO;
import com.xiaowang.yuminailcore.service.MessageHubPushConfigService;
import com.xiaowang.yuminailcore.support.AdminScopeHelper;
import com.xiaowang.yuminailcore.vo.MessageHubPushConfigVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping({"/messagehub-push-config", "/api/messagehub-push-config"})
/**
* MessageHubPushConfigController exposes HTTP endpoints. Start here to learn the request path, parameter names, and which service method is called.
* Beginner guide: follow the call chain Controller -> Service -> ServiceImpl -> Mapper/support class.
*/
public class MessageHubPushConfigController {
/**
* Variable `configService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final MessageHubPushConfigService configService;
/**
* Variable `adminScopeHelper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final AdminScopeHelper adminScopeHelper;
@GetMapping("/admin/list")
@RequirePermission("messagehub:config:manage")
/**
* List records for the current query or current user scope.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<List<MessageHubPushConfigVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<MessageHubPushConfigVO>> list(HttpServletRequest request) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(configService.listConfigs(currentUser));
}
@PostMapping("/admin/create")
@RequirePermission("messagehub:config:manage")
@OperationGuard(action = "messagehub-push-config-create", ttlSeconds = 8, message = "配置保存处理中,请勿重复提交")
/**
* Create a new record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param dto parameter `dto` supplied by the caller
* @return Result<Long> result consumed by the caller or returned to the frontend
*/
public Result<Long> create(HttpServletRequest request, @Valid @RequestBody MessageHubPushConfigDTO dto) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(configService.createConfig(currentUser, dto));
}
@PutMapping("/admin/{id}")
@RequirePermission("messagehub:config:manage")
@OperationGuard(action = "messagehub-push-config-update", ttlSeconds = 8, message = "配置保存处理中,请勿重复提交")
/**
* Update an existing record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @param dto parameter `dto` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> update(HttpServletRequest request, @PathVariable Long id, @Valid @RequestBody MessageHubPushConfigDTO dto) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(configService.updateConfig(currentUser, id, dto));
}
@PutMapping("/admin/{id}/status")
@RequirePermission("messagehub:config:manage")
/**
* Change the enabled/status flag of one record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @param enabled parameter `enabled` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> updateStatus(HttpServletRequest request, @PathVariable Long id, @RequestParam Integer enabled) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(configService.updateStatus(currentUser, id, enabled));
}
@PostMapping("/admin/{id}/test")
@RequirePermission("messagehub:config:manage")
@OperationGuard(action = "messagehub-push-config-test", ttlSeconds = 8, message = "测试投递处理中,请勿重复提交")
/**
* Run a test call without changing normal business data.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @param dto parameter `dto` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> test(HttpServletRequest request, @PathVariable Long id, @Valid @RequestBody MessageHubPushTestDTO dto) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(configService.testConfig(currentUser, id, dto));
}
}
@@ -11,6 +11,7 @@ import com.xiaowang.yuminailcore.service.ObjectStorageFileService;
import com.xiaowang.yuminailcore.support.ObjectStorageUrlSupport;
import com.xiaowang.yuminailcore.support.id.TimeOrderedSnowflakeIdGenerator;
import com.xiaowang.yuminailcore.support.security.OperationGuardStrategy;
import com.xiaowang.yuminailcore.support.security.UploadSecurityValidator;
import com.xiaowang.yuminailcore.vo.ChunkUploadSessionVO;
import com.xiaowang.yuminailcore.vo.ObjectStorageFileVO;
import lombok.RequiredArgsConstructor;
@@ -39,18 +40,34 @@ import java.util.List;
@RequiredArgsConstructor
@Validated
public class ObjectStorageFileController {
/**
* Variable `objectStorageFileService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final ObjectStorageFileService objectStorageFileService;
/**
* Variable `minioService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final MinioService minioService;
/**
* Variable `chunkUploadService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final ChunkUploadService chunkUploadService;
/**
* Variable `objectStorageUrlSupport`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final ObjectStorageUrlSupport objectStorageUrlSupport;
/**
* Variable `snowflakeIdGenerator`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final TimeOrderedSnowflakeIdGenerator snowflakeIdGenerator;
private final UploadSecurityValidator uploadSecurityValidator;
@PostMapping("/upload/init")
@OperationGuard(action = "admin-upload-init", ttlSeconds = 10, message = "上传处理中,请勿重复操作")
public Result<ChunkUploadSessionVO> initChunkUpload(HttpServletRequest request,
@Valid @RequestBody ChunkUploadInitRequestDTO requestDTO) {
Long userId = (Long) request.getAttribute("userId");
uploadSecurityValidator.validateMetadata(requestDTO.getFileName(), requestDTO.getContentType(), requestDTO.getFileSize());
return Result.success(chunkUploadService.initAdminObjectStorageUpload(userId, requestDTO));
}
@@ -62,6 +79,7 @@ public class ObjectStorageFileController {
@RequestParam("totalChunks") Integer totalChunks,
@RequestParam("chunk") MultipartFile chunkFile) {
Long userId = (Long) request.getAttribute("userId");
uploadSecurityValidator.validate(chunkFile);
chunkUploadService.uploadAdminObjectStorageChunk(userId, uploadId, chunkIndex, totalChunks, chunkFile);
return Result.success(true);
}
@@ -101,6 +119,13 @@ public class ObjectStorageFileController {
@DeleteMapping("/upload/{uploadId}")
@OperationGuard(action = "admin-upload-cancel", ttlSeconds = 30, message = "上传处理中,请勿重复操作")
/**
* Run business method `cancelChunkUpload`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param uploadId parameter `uploadId` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> cancelChunkUpload(HttpServletRequest request, @PathVariable String uploadId) {
Long userId = (Long) request.getAttribute("userId");
chunkUploadService.clearAdminObjectStorageUpload(userId, uploadId);
@@ -114,6 +139,7 @@ public class ObjectStorageFileController {
@OperationGuard(action = "admin-upload-direct", ttlSeconds = 30, message = "上传处理中,请勿重复操作")
public Result<ObjectStorageFileVO> uploadFile(@RequestParam("file") MultipartFile file) {
try {
uploadSecurityValidator.validate(file);
String originalFilename = file.getOriginalFilename();
String fileExtension = originalFilename.substring(originalFilename.lastIndexOf("."));
String objectName = snowflakeIdGenerator.nextIdString() + fileExtension;
@@ -160,6 +186,12 @@ public class ObjectStorageFileController {
@PostMapping("/create")
@OperationGuard(action = "admin-file-create", ttlSeconds = 10, message = "保存处理中,请勿重复提交")
/**
* Create a new record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param objectStorageFileDTO parameter `objectStorageFileDTO` supplied by the caller
* @return Result<Long> result consumed by the caller or returned to the frontend
*/
public Result<Long> createObjectStorageFile(@RequestBody ObjectStorageFileDTO objectStorageFileDTO) {
Long id = objectStorageFileService.createObjectStorageFile(objectStorageFileDTO);
return Result.success(id);
@@ -175,24 +207,47 @@ public class ObjectStorageFileController {
@DeleteMapping("/delete/{id}")
@OperationGuard(action = "admin-file-delete", ttlSeconds = 10, message = "操作处理中,请勿重复提交")
/**
* Delete, revoke, or logically remove a record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param id parameter `id` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> deleteObjectStorageFile(@PathVariable Long id) {
boolean success = objectStorageFileService.deleteObjectStorageFile(id);
return Result.success(success);
}
@GetMapping("/get/{id}")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param id parameter `id` supplied by the caller
* @return Result<ObjectStorageFileVO> result consumed by the caller or returned to the frontend
*/
public Result<ObjectStorageFileVO> getObjectStorageFileById(@PathVariable Long id) {
ObjectStorageFileVO objectStorageFileVO = objectStorageFileService.getObjectStorageFileById(id);
return Result.success(objectStorageFileVO);
}
@GetMapping("/list/all")
/**
* List records for the current query or current user scope.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return Result<List<ObjectStorageFileVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<ObjectStorageFileVO>> listAllObjectStorageFiles() {
List<ObjectStorageFileVO> objectStorageFileVOs = objectStorageFileService.listAllObjectStorageFiles();
return Result.success(objectStorageFileVOs);
}
@GetMapping("/list/status/{status}")
/**
* List records for the current query or current user scope.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param status parameter `status` supplied by the caller
* @return Result<List<ObjectStorageFileVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<ObjectStorageFileVO>> listObjectStorageFilesByStatus(@PathVariable Integer status) {
List<ObjectStorageFileVO> objectStorageFileVOs = objectStorageFileService.listObjectStorageFilesByStatus(status);
return Result.success(objectStorageFileVOs);
@@ -8,14 +8,20 @@ import com.xiaowang.yuminailcore.service.OrderService;
import com.xiaowang.yuminailcore.service.UserService;
import com.xiaowang.yuminailcore.vo.OrderVO;
import com.xiaowang.yuminailcore.vo.UserVO;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.time.LocalDate;
import java.util.List;
@RestController
@RequestMapping("/order")
/**
* OrderController exposes HTTP endpoints. Start here to learn the request path, parameter names, and which service method is called.
* Beginner guide: follow the call chain Controller -> Service -> ServiceImpl -> Mapper/support class.
*/
public class OrderController {
@Resource
@@ -26,6 +32,13 @@ public class OrderController {
@PostMapping("/create")
@OperationGuard(action = "order-create", ttlSeconds = 15, message = "订单正在提交中,请勿重复点击")
/**
* Create a new record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param orderDTO parameter `orderDTO` supplied by the caller
* @param request parameter `request` supplied by the caller
* @return Result<OrderVO> result consumed by the caller or returned to the frontend
*/
public Result<OrderVO> createOrder(@RequestBody OrderDTO orderDTO, HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
OrderVO orderVO = orderService.createOrder(userId, orderDTO);
@@ -33,6 +46,12 @@ public class OrderController {
}
@GetMapping("/list")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<List<OrderVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<OrderVO>> getOrderList(HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
List<OrderVO> orderList = orderService.getOrderList(userId);
@@ -40,6 +59,13 @@ public class OrderController {
}
@GetMapping("/detail/{orderId}")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param orderId parameter `orderId` supplied by the caller
* @param request parameter `request` supplied by the caller
* @return Result<OrderVO> result consumed by the caller or returned to the frontend
*/
public Result<OrderVO> getOrderDetail(@PathVariable Long orderId, HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
OrderVO orderVO = orderService.getOrderDetail(orderId, userId);
@@ -48,6 +74,13 @@ public class OrderController {
@PutMapping("/cancel/{orderId}")
@OperationGuard(action = "order-cancel", ttlSeconds = 15, message = "操作进行中,请勿重复点击")
/**
* Run business method `cancelOrder`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param orderId parameter `orderId` supplied by the caller
* @param request parameter `request` supplied by the caller
* @return Result<Void> result consumed by the caller or returned to the frontend
*/
public Result<Void> cancelOrder(@PathVariable Long orderId, HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
orderService.cancelOrder(orderId, userId);
@@ -57,6 +90,12 @@ public class OrderController {
// 后台管理接口
@RequirePermission("order:view")
@GetMapping("/admin/list")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<List<OrderVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<OrderVO>> getAllOrders(HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
Integer userType = (Integer) request.getAttribute("userType");
@@ -69,6 +108,11 @@ public class OrderController {
if (!Integer.valueOf(4).equals(userType) && !Integer.valueOf(3).equals(userType)) {
UserVO currentUser = userService.getUserById(userId);
if (currentUser == null || currentUser.getShopId() == null) {
/**
* Run business method `RuntimeException`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return throw new result consumed by the caller or returned to the frontend
*/
throw new RuntimeException("当前账号未绑定店铺");
}
orderList = orderList.stream()
@@ -81,11 +125,24 @@ public class OrderController {
@RequirePermission("order:process")
@PutMapping("/admin/process/{orderId}")
@OperationGuard(action = "admin-order-process", ttlSeconds = 15, message = "操作处理中,请勿重复提交")
/**
* Run business method `processOrder`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param orderId parameter `orderId` supplied by the caller
* @param status parameter `status` supplied by the caller
* @param request parameter `request` supplied by the caller
* @return Result<Void> result consumed by the caller or returned to the frontend
*/
public Result<Void> processOrder(@PathVariable Long orderId, @RequestParam Integer status, HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
Integer userType = (Integer) request.getAttribute("userType");
if (Integer.valueOf(3).equals(userType)) {
if (!Integer.valueOf(2).equals(status)) {
/**
* Run business method `RuntimeException`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return throw new result consumed by the caller or returned to the frontend
*/
throw new RuntimeException("美甲师只能完成属于自己的订单");
}
orderService.completeArtistOrder(orderId, userId);
@@ -94,6 +151,11 @@ public class OrderController {
if (!Integer.valueOf(4).equals(userType)) {
UserVO currentUser = userService.getUserById(userId);
if (currentUser == null || currentUser.getShopId() == null) {
/**
* Run business method `RuntimeException`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return throw new result consumed by the caller or returned to the frontend
*/
throw new RuntimeException("当前账号未绑定店铺");
}
OrderVO orderVO = orderService.getAllOrders().stream()
@@ -101,6 +163,11 @@ public class OrderController {
.findFirst()
.orElse(null);
if (orderVO == null || !currentUser.getShopId().equals(orderVO.getShopId())) {
/**
* Run business method `RuntimeException`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return throw new result consumed by the caller or returned to the frontend
*/
throw new RuntimeException("无权处理其他店铺订单");
}
}
@@ -111,23 +178,70 @@ public class OrderController {
// 美甲师查看自己的订单
@RequirePermission("order:view")
@GetMapping("/artist/list")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<List<OrderVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<OrderVO>> getArtistOrders(HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
Integer userType = (Integer) request.getAttribute("userType");
if (!Integer.valueOf(3).equals(userType)) {
if (!Integer.valueOf(3).equals(userType) && !Integer.valueOf(2).equals(userType)) {
/**
* Run business method `RuntimeException`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return throw new result consumed by the caller or returned to the frontend
*/
throw new RuntimeException("仅美甲师可查看自己的订单");
}
List<OrderVO> orderList = orderService.getOrdersByArtistId(userId);
List<OrderVO> orderList = orderService.getArtistWorkbenchOrders(userId);
return Result.success(orderList);
}
@RequirePermission("order:view")
@GetMapping("/artist/calendar/recent")
// 调用示例:GET /order/artist/calendar/recent?days=7
// 只返回当前登录美甲师/参与制作店长自己的预约,前端不用再做二次过滤。
public Result<?> getArtistCalendarRecent(@RequestParam(value = "days", required = false) Integer days,
HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
Integer userType = (Integer) request.getAttribute("userType");
return Result.success(orderService.getArtistCalendarRecent(userId, userType, days));
}
@RequirePermission("order:view")
@GetMapping("/artist/calendar/day")
// 调用示例:GET /order/artist/calendar/day?date=2026-05-17
// date 使用 yyyy-MM-dd,适合日历点选某一天后拉取详情。
public Result<?> getArtistCalendarDay(@RequestParam("date")
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
LocalDate date,
HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
Integer userType = (Integer) request.getAttribute("userType");
return Result.success(orderService.getArtistCalendarDay(userId, userType, date));
}
@RequirePermission("order:process")
@PutMapping("/artist/complete/{orderId}")
@OperationGuard(action = "artist-order-complete", ttlSeconds = 15, message = "操作处理中,请勿重复提交")
/**
* Complete a business action.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param orderId parameter `orderId` supplied by the caller
* @param request parameter `request` supplied by the caller
* @return Result<Void> result consumed by the caller or returned to the frontend
*/
public Result<Void> completeArtistOrder(@PathVariable Long orderId, HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
Integer userType = (Integer) request.getAttribute("userType");
if (!Integer.valueOf(3).equals(userType)) {
if (!Integer.valueOf(3).equals(userType) && !Integer.valueOf(2).equals(userType)) {
/**
* Run business method `RuntimeException`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return throw new result consumed by the caller or returned to the frontend
*/
throw new RuntimeException("仅美甲师可完成自己的订单");
}
orderService.completeArtistOrder(orderId, userId);
@@ -26,9 +26,17 @@ import java.util.List;
@RequestMapping({"/permission", "/api/permission"})
@RequiredArgsConstructor
public class PermissionController {
/**
* Variable `permissionService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final PermissionService permissionService;
/**
* Variable `userService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final UserService userService;
/**
* Variable `adminScopeHelper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final AdminScopeHelper adminScopeHelper;
/**
@@ -128,6 +136,11 @@ public class PermissionController {
if (!adminScopeHelper.isPlatformAdmin(currentUser)) {
UserDO targetUser = userService.getById(userId);
if (targetUser == null) {
/**
* Run business method `RuntimeException`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return throw new result consumed by the caller or returned to the frontend
*/
throw new RuntimeException("目标用户不存在");
}
adminScopeHelper.ensureUserAccessibleInCurrentShop(currentUser, userId, "无权查看其他店铺用户权限");
@@ -149,6 +162,11 @@ public class PermissionController {
if (!adminScopeHelper.isPlatformAdmin(currentUser)) {
UserDO targetUser = userService.getById(userPermissionDTO.getUserId());
if (targetUser == null) {
/**
* Run business method `RuntimeException`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return throw new result consumed by the caller or returned to the frontend
*/
throw new RuntimeException("目标用户不存在");
}
adminScopeHelper.ensureUserAccessibleInCurrentShop(currentUser, userPermissionDTO.getUserId(), "无权给其他店铺用户分配权限");
@@ -17,13 +17,29 @@ import java.util.List;
@RestController
@RequestMapping("/product")
@RequiredArgsConstructor
/**
* ProductController exposes HTTP endpoints. Start here to learn the request path, parameter names, and which service method is called.
* Beginner guide: follow the call chain Controller -> Service -> ServiceImpl -> Mapper/support class.
*/
public class ProductController {
/**
* Variable `productService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final ProductService productService;
/**
* Variable `adminScopeHelper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final AdminScopeHelper adminScopeHelper;
@PostMapping("/create")
@RequirePermission("product:create")
/**
* Create a new record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param productDTO parameter `productDTO` supplied by the caller
* @return Result<Long> result consumed by the caller or returned to the frontend
*/
public Result<Long> createProduct(HttpServletRequest request, @RequestBody ProductDTO productDTO) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
productDTO.setShopId(adminScopeHelper.resolveShopScope(currentUser, productDTO.getShopId()));
@@ -33,6 +49,14 @@ public class ProductController {
@PutMapping("/update/{id}")
@RequirePermission("product:edit")
/**
* Update an existing record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @param productDTO parameter `productDTO` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> updateProduct(HttpServletRequest request, @PathVariable Long id, @RequestBody ProductDTO productDTO) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
ProductVO productVO = productService.getProductById(id);
@@ -48,6 +72,13 @@ public class ProductController {
@DeleteMapping("/delete/{id}")
@RequirePermission("product:delete")
/**
* Delete, revoke, or logically remove a record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> deleteProduct(HttpServletRequest request, @PathVariable Long id) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
ProductVO productVO = productService.getProductById(id);
@@ -60,24 +91,47 @@ public class ProductController {
}
@GetMapping("/get/{id}")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param id parameter `id` supplied by the caller
* @return Result<ProductVO> result consumed by the caller or returned to the frontend
*/
public Result<ProductVO> getProductById(@PathVariable Long id) {
ProductVO productVO = productService.getProductById(id);
return Result.success(productVO);
}
@GetMapping("/list/all")
/**
* List records for the current query or current user scope.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return Result<List<ProductVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<ProductVO>> listAllProducts() {
List<ProductVO> productVOs = productService.listAllProducts();
return Result.success(productVOs);
}
@GetMapping("/list/shop/{shopId}")
/**
* List records for the current query or current user scope.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param shopId parameter `shopId` supplied by the caller
* @return Result<List<ProductVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<ProductVO>> listProductsByShopId(@PathVariable Long shopId) {
List<ProductVO> productVOs = productService.listProductsByShopId(shopId);
return Result.success(productVOs);
}
@GetMapping("/list/tag/{tag}")
/**
* List records for the current query or current user scope.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param tag parameter `tag` supplied by the caller
* @return Result<List<ProductVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<ProductVO>> listProductsByTag(@PathVariable String tag) {
List<ProductVO> productVOs = productService.listProductsByTag(tag);
return Result.success(productVOs);
@@ -17,7 +17,9 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping("/product-like")
@RequiredArgsConstructor
public class ProductLikeController {
/**
* Variable `productLikeService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final ProductLikeService productLikeService;
/**
@@ -19,13 +19,29 @@ import java.util.stream.Collectors;
@RestController
@RequestMapping("/shop")
@RequiredArgsConstructor
/**
* ShopController exposes HTTP endpoints. Start here to learn the request path, parameter names, and which service method is called.
* Beginner guide: follow the call chain Controller -> Service -> ServiceImpl -> Mapper/support class.
*/
public class ShopController {
/**
* Variable `shopService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final ShopService shopService;
/**
* Variable `adminScopeHelper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final AdminScopeHelper adminScopeHelper;
@PostMapping("/create")
@RequirePermission("shop:create")
/**
* Create a new record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param shopDTO parameter `shopDTO` supplied by the caller
* @return Result<Long> result consumed by the caller or returned to the frontend
*/
public Result<Long> createShop(HttpServletRequest request, @RequestBody ShopDTO shopDTO) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
adminScopeHelper.requirePlatformAdmin(currentUser, "鍙湁骞冲彴绠$悊鍛樺彲浠ュ垱寤哄簵閾?");
@@ -35,6 +51,14 @@ public class ShopController {
@PutMapping("/update/{id}")
@RequirePermission("shop:edit")
/**
* Update an existing record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @param shopDTO parameter `shopDTO` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> updateShop(HttpServletRequest request, @PathVariable Long id, @RequestBody ShopDTO shopDTO) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
ShopVO shopVO = shopService.getShopById(id);
@@ -42,12 +66,22 @@ public class ShopController {
return Result.success(false);
}
adminScopeHelper.ensureShopAccessible(currentUser, shopVO.getId(), "无权编辑其他店铺信息");
if (!adminScopeHelper.isPlatformAdmin(currentUser)) {
shopDTO.setAuthorizationExpireTime(shopVO.getAuthorizationExpireTime());
}
boolean success = shopService.updateShop(id, shopDTO);
return Result.success(success);
}
@DeleteMapping("/delete/{id}")
@RequirePermission("shop:delete")
/**
* Delete, revoke, or logically remove a record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> deleteShop(HttpServletRequest request, @PathVariable Long id) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
adminScopeHelper.requirePlatformAdmin(currentUser, "鍙湁骞冲彴绠$悊鍛樺彲浠ュ垹闄ゅ簵閾?");
@@ -57,6 +91,14 @@ public class ShopController {
@PutMapping("/status/{id}")
@RequirePermission("shop:edit")
/**
* Update an existing record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @param statusRequest parameter `statusRequest` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> updateShopStatus(HttpServletRequest request, @PathVariable Long id, @RequestBody StatusRequest statusRequest) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
adminScopeHelper.requirePlatformAdmin(currentUser, "只有平台管理员可以启停店铺");
@@ -65,6 +107,12 @@ public class ShopController {
}
@GetMapping("/get/{id}")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param id parameter `id` supplied by the caller
* @return Result<ShopVO> result consumed by the caller or returned to the frontend
*/
public Result<ShopVO> getShopById(@PathVariable Long id) {
ShopVO shopVO = shopService.getShopById(id);
return Result.success(shopVO);
@@ -72,6 +120,12 @@ public class ShopController {
@GetMapping("/list/all")
@RequirePermission("shop:view")
/**
* List records for the current query or current user scope.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<List<ShopVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<ShopVO>> listAllShops(HttpServletRequest request) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
List<ShopVO> shopVOs;
@@ -85,12 +139,23 @@ public class ShopController {
}
@GetMapping("/list/shopName/{shopName}")
/**
* List records for the current query or current user scope.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param shopName parameter `shopName` supplied by the caller
* @return Result<List<ShopVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<ShopVO>> listShopsByShopName(@PathVariable String shopName) {
List<ShopVO> shopVOs = shopService.listShopsByShopName(shopName);
return Result.success(shopVOs);
}
@GetMapping("/list/simple")
/**
* List records for the current query or current user scope.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return Result<List<ShopSimpleVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<ShopSimpleVO>> listShopsSimple() {
List<ShopVO> shopVOs = shopService.listAllShops();
List<ShopSimpleVO> simpleVOs = shopVOs.stream()
@@ -100,6 +165,11 @@ public class ShopController {
}
@GetMapping("/list/public")
/**
* List records for the current query or current user scope.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return Result<List<ShopVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<ShopVO>> listPublicShops() {
return Result.success(shopService.listAllShops());
}
@@ -0,0 +1,181 @@
package com.xiaowang.yuminailcore.controller;
import com.xiaowang.yuminailcore.annotation.OperationGuard;
import com.xiaowang.yuminailcore.annotation.RequirePermission;
import com.xiaowang.yuminailcore.common.Result;
import com.xiaowang.yuminailcore.dto.SystemMessageCreateDTO;
import com.xiaowang.yuminailcore.entity.UserDO;
import com.xiaowang.yuminailcore.service.SystemMessageService;
import com.xiaowang.yuminailcore.support.AdminScopeHelper;
import com.xiaowang.yuminailcore.vo.MessageTargetOptionsVO;
import com.xiaowang.yuminailcore.vo.MessageUnreadCountVO;
import com.xiaowang.yuminailcore.vo.SystemMessageVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping({"/system-message", "/api/system-message"})
/**
* SystemMessageController exposes HTTP endpoints. Start here to learn the request path, parameter names, and which service method is called.
* Beginner guide: follow the call chain Controller -> Service -> ServiceImpl -> Mapper/support class.
*/
public class SystemMessageController {
/**
* Variable `systemMessageService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final SystemMessageService systemMessageService;
/**
* Variable `adminScopeHelper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final AdminScopeHelper adminScopeHelper;
@PostMapping("/admin/create")
@RequirePermission("message:create")
@OperationGuard(action = "system-message-create", ttlSeconds = 8, message = "消息发布处理中,请勿重复提交")
/**
* Run business method `publish`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param dto parameter `dto` supplied by the caller
* @return Result<Long> result consumed by the caller or returned to the frontend
*/
public Result<Long> publish(HttpServletRequest request, @Valid @RequestBody SystemMessageCreateDTO dto) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(systemMessageService.publishMessage(currentUser, dto));
}
@GetMapping("/admin/list")
@RequirePermission("message:view")
/**
* List records for the current query or current user scope.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<List<SystemMessageVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<SystemMessageVO>> listAdminMessages(HttpServletRequest request) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(systemMessageService.listAdminMessages(currentUser));
}
@GetMapping("/admin/{id}")
@RequirePermission("message:view")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @return Result<SystemMessageVO> result consumed by the caller or returned to the frontend
*/
public Result<SystemMessageVO> getAdminMessage(HttpServletRequest request, @PathVariable Long id) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(systemMessageService.getAdminMessage(currentUser, id));
}
@PutMapping("/admin/{id}/revoke")
@RequirePermission("message:delete")
@OperationGuard(action = "system-message-revoke", ttlSeconds = 8, message = "消息撤回处理中,请勿重复操作")
/**
* Run business method `revoke`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> revoke(HttpServletRequest request, @PathVariable Long id) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(systemMessageService.revokeMessage(currentUser, id));
}
@GetMapping("/admin/target-options")
@RequirePermission("message:create")
/**
* List records for the current query or current user scope.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<MessageTargetOptionsVO> result consumed by the caller or returned to the frontend
*/
public Result<MessageTargetOptionsVO> listTargetOptions(HttpServletRequest request) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(systemMessageService.listTargetOptions(currentUser));
}
@GetMapping("/my/list")
/**
* List records for the current query or current user scope.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<List<SystemMessageVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<SystemMessageVO>> listMyMessages(HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
return Result.success(systemMessageService.listMyMessages(userId));
}
@GetMapping("/my/popup")
/**
* List records for the current query or current user scope.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<List<SystemMessageVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<SystemMessageVO>> listMyPopupMessages(HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
return Result.success(systemMessageService.listMyPopupMessages(userId));
}
@GetMapping("/my/unread-count")
/**
* Run business method `countMyUnreadMessages`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<MessageUnreadCountVO> result consumed by the caller or returned to the frontend
*/
public Result<MessageUnreadCountVO> countMyUnreadMessages(HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
return Result.success(new MessageUnreadCountVO(systemMessageService.countMyUnreadMessages(userId)));
}
@GetMapping("/my/{id}")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @return Result<SystemMessageVO> result consumed by the caller or returned to the frontend
*/
public Result<SystemMessageVO> getMyMessage(HttpServletRequest request, @PathVariable Long id) {
Long userId = (Long) request.getAttribute("userId");
return Result.success(systemMessageService.getMyMessage(userId, id));
}
@PutMapping("/my/{id}/popup-shown")
/**
* Mark user state such as read or popup shown.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> markPopupShown(HttpServletRequest request, @PathVariable Long id) {
Long userId = (Long) request.getAttribute("userId");
return Result.success(systemMessageService.markPopupShown(userId, id));
}
@PutMapping("/my/{id}/read")
/**
* Mark user state such as read or popup shown.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> markRead(HttpServletRequest request, @PathVariable Long id) {
Long userId = (Long) request.getAttribute("userId");
return Result.success(systemMessageService.markRead(userId, id));
}
}
@@ -0,0 +1,52 @@
package com.xiaowang.yuminailcore.controller;
import com.xiaowang.yuminailcore.annotation.OperationGuard;
import com.xiaowang.yuminailcore.annotation.RequirePermission;
import com.xiaowang.yuminailcore.common.Result;
import com.xiaowang.yuminailcore.dto.SystemParameterConfigDTO;
import com.xiaowang.yuminailcore.entity.UserDO;
import com.xiaowang.yuminailcore.service.SystemParameterConfigService;
import com.xiaowang.yuminailcore.support.AdminScopeHelper;
import com.xiaowang.yuminailcore.vo.SystemParameterConfigVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequiredArgsConstructor
@RequestMapping({"/system-parameter-config", "/api/system-parameter-config"})
public class SystemParameterConfigController {
private final SystemParameterConfigService configService;
private final AdminScopeHelper adminScopeHelper;
@GetMapping("/admin/list")
@RequirePermission("messagehub:config:manage")
public Result<List<SystemParameterConfigVO>> list(HttpServletRequest request,
@RequestParam(required = false) String configGroup) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(configService.listConfigs(currentUser, configGroup));
}
@PostMapping("/admin/save")
@RequirePermission("messagehub:config:manage")
@OperationGuard(action = "system-parameter-config-save", ttlSeconds = 8, message = "系统参数保存处理中,请勿重复提交")
public Result<Boolean> save(HttpServletRequest request, @Valid @RequestBody SystemParameterConfigDTO dto) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(configService.saveConfig(currentUser, dto));
}
@GetMapping("/admin/tencent-map")
@RequirePermission("messagehub:config:manage")
public Result<Map<String, String>> getTencentMapKey(HttpServletRequest request) {
adminScopeHelper.getCurrentUser(request);
Map<String, String> result = new HashMap<>();
result.put("key", configService.getEnabledValue("MAP", "TENCENT_MAP_KEY"));
return Result.success(result);
}
}
@@ -24,8 +24,13 @@ import java.util.List;
@RequestMapping("/tag")
@RequiredArgsConstructor
public class TagController {
/**
* Variable `tagService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final TagService tagService;
/**
* Variable `adminScopeHelper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final AdminScopeHelper adminScopeHelper;
/**
@@ -11,12 +11,20 @@ import com.xiaowang.yuminailcore.support.AdminScopeHelper;
import com.xiaowang.yuminailcore.vo.ChunkUploadSessionVO;
import com.xiaowang.yuminailcore.vo.LoginShopSelectionVO;
import com.xiaowang.yuminailcore.vo.LoginResponseVO;
import com.xiaowang.yuminailcore.vo.BalanceChangeDetailVO;
import com.xiaowang.yuminailcore.vo.UserAssetVO;
import com.xiaowang.yuminailcore.vo.UserRelationVO;
import com.xiaowang.yuminailcore.vo.UserVO;
import com.xiaowang.yuminailcore.vo.InviteCodeVO;
import com.xiaowang.yuminailcore.vo.WechatMiniLoginResultVO;
import com.xiaowang.yuminailcore.service.MinioService;
import com.xiaowang.yuminailcore.service.UserAssetService;
import com.xiaowang.yuminailcore.service.UserService;
import com.xiaowang.yuminailcore.service.ShopRoleService;
import com.xiaowang.yuminailcore.service.VerificationCodeService;
import com.xiaowang.yuminailcore.service.WechatMiniAuthService;
import com.xiaowang.yuminailcore.service.LegalAgreementService;
import com.xiaowang.yuminailcore.service.SecurityAuditLogService;
import com.xiaowang.yuminailcore.support.id.TimeOrderedSnowflakeIdGenerator;
import com.xiaowang.yuminailcore.support.ObjectStorageUrlSupport;
import com.xiaowang.yuminailcore.support.security.RequestThrottleService;
@@ -44,17 +52,56 @@ import java.util.stream.Collectors;
@RequestMapping("/user")
@RequiredArgsConstructor
public class UserController {
/**
* Variable `userService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final UserService userService;
/**
* Variable `userAssetService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final UserAssetService userAssetService;
/**
* Variable `minioService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final MinioService minioService;
/**
* Variable `chunkUploadService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final ChunkUploadService chunkUploadService;
/**
* Variable `verificationCodeService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final VerificationCodeService verificationCodeService;
/**
* Variable `userMapper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final UserMapper userMapper;
/**
* Variable `adminScopeHelper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final AdminScopeHelper adminScopeHelper;
/**
* Variable `shopRoleService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final ShopRoleService shopRoleService;
/**
* Variable `snowflakeIdGenerator`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final TimeOrderedSnowflakeIdGenerator snowflakeIdGenerator;
/**
* Variable `wechatMiniAuthService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final WechatMiniAuthService wechatMiniAuthService;
/**
* Variable `objectStorageUrlSupport`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final ObjectStorageUrlSupport objectStorageUrlSupport;
/**
* Variable `requestThrottleService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final RequestThrottleService requestThrottleService;
private final LegalAgreementService legalAgreementService;
private final SecurityAuditLogService securityAuditLogService;
/**
* 创建用户
@@ -115,6 +162,11 @@ public class UserController {
adminScopeHelper.requirePlatformAdmin(currentUser, "仅系统管理员可以删除用户");
UserVO targetUser = requireAccessibleUser(currentUser, id, "无权删除其他店铺用户");
if (Integer.valueOf(4).equals(targetUser.getType())) {
/**
* Run business method `RuntimeException`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return throw new result consumed by the caller or returned to the frontend
*/
throw new RuntimeException("管理员账号不允许删除");
}
boolean success = userService.deleteUser(id);
@@ -124,17 +176,53 @@ public class UserController {
@PutMapping("/unbind/{id}")
@RequirePermission("user:unbind")
@OperationGuard(action = "admin-user-unbind", ttlSeconds = 10, message = "操作进行中,请勿重复点击")
/**
* Run business method `unbindUser`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> unbindUser(HttpServletRequest request, @PathVariable Long id) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
UserVO targetUser = requireAccessibleUser(currentUser, id, "无权解绑其他店铺用户");
adminScopeHelper.ensureAssignableUserType(currentUser, targetUser.getType());
if (Integer.valueOf(4).equals(targetUser.getType())) {
/**
* Run business method `RuntimeException`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return throw new result consumed by the caller or returned to the frontend
*/
throw new RuntimeException("管理员账号不允许解绑");
}
boolean success = userService.unbindUserInShopWithOperator(id, currentUser.getShopId(), currentUser.getType());
return Result.success(success);
}
@GetMapping("/asset/me")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<UserAssetVO> result consumed by the caller or returned to the frontend
*/
public Result<UserAssetVO> getMyAsset(HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
return Result.success(userAssetService.getUserAsset(userId));
}
@GetMapping("/balance/history/me")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<List<BalanceChangeDetailVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<BalanceChangeDetailVO>> getMyBalanceHistory(HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
return Result.success(userAssetService.listBalanceHistory(userId));
}
/**
* 根据ID查询用户
*
@@ -188,6 +276,11 @@ public class UserController {
@GetMapping("/list/type/{type}")
public Result<List<UserVO>> listUsersByType(@PathVariable Integer type) {
if (!Integer.valueOf(3).equals(type)) {
/**
* Run business method `RuntimeException`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return throw new result consumed by the caller or returned to the frontend
*/
throw new RuntimeException("仅支持查询可预约的美甲师列表");
}
List<UserVO> userVOs = userService.listUsersByType(type).stream()
@@ -215,6 +308,12 @@ public class UserController {
}
@GetMapping("/check/account/{account}")
/**
* Run business method `checkAccountAvailability`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param account parameter `account` supplied by the caller
* @return Result<AvailabilityVO> result consumed by the caller or returned to the frontend
*/
public Result<AvailabilityVO> checkAccountAvailability(@PathVariable String account) {
String normalizedAccount = AccountValidationUtils.requireValidAccount(account);
UserDO userDO = userMapper.selectOne(
@@ -227,6 +326,12 @@ public class UserController {
}
@GetMapping("/check/login-account/{account}")
/**
* Run business method `checkLoginAccountAvailability`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param account parameter `account` supplied by the caller
* @return Result<LoginAccountAvailabilityVO> result consumed by the caller or returned to the frontend
*/
public Result<LoginAccountAvailabilityVO> checkLoginAccountAvailability(@PathVariable String account) {
String normalizedAccount = AccountValidationUtils.requireValidAccount(account);
UserDO userDO = userMapper.selectOne(
@@ -244,16 +349,34 @@ public class UserController {
}
@GetMapping("/check/login-shops/account/{account}")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param account parameter `account` supplied by the caller
* @return Result<LoginShopSelectionVO> result consumed by the caller or returned to the frontend
*/
public Result<LoginShopSelectionVO> getLoginShopsByAccount(@PathVariable String account) {
return Result.success(userService.getLoginShopSelectionByAccount(AccountValidationUtils.requireValidAccount(account)));
}
@GetMapping("/check/login-shops/phone/{phone}")
/**
* Load data by the supplied parameter.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param phone parameter `phone` supplied by the caller
* @return Result<LoginShopSelectionVO> result consumed by the caller or returned to the frontend
*/
public Result<LoginShopSelectionVO> getLoginShopsByPhone(@PathVariable String phone) {
return Result.success(userService.getLoginShopSelectionByPhone(phone));
}
@GetMapping("/check/phone/{phone}")
/**
* Run business method `checkPhoneAvailability`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param phone parameter `phone` supplied by the caller
* @return Result<AvailabilityVO> result consumed by the caller or returned to the frontend
*/
public Result<AvailabilityVO> checkPhoneAvailability(@PathVariable String phone) {
UserDO userDO = userMapper.selectOne(
com.baomidou.mybatisplus.core.toolkit.Wrappers.lambdaQuery(UserDO.class)
@@ -275,8 +398,18 @@ public class UserController {
@OperationGuard(action = "user-login", ttlSeconds = 8, message = "登录处理中,请勿重复提交")
public Result<LoginResponseVO> login(HttpServletRequest request, @Valid @RequestBody LoginRequestDTO loginRequestDTO) {
requestThrottleService.checkLogin(request, loginRequestDTO.getAccount());
LoginResponseVO loginResponseVO = userService.login(loginRequestDTO);
return Result.success(loginResponseVO);
legalAgreementService.requireAccepted(loginRequestDTO);
try {
LoginResponseVO loginResponseVO = userService.login(loginRequestDTO);
legalAgreementService.recordConsent(loginResponseVO.getUserInfo().getId(), loginRequestDTO, "USER_PASSWORD_LOGIN", request);
requestThrottleService.clearLoginFailure(request, loginRequestDTO.getAccount());
securityAuditLogService.record(loginResponseVO.getUserInfo().getId(), loginRequestDTO.getAccount(), "USER_LOGIN", "SUCCESS", null, request);
return Result.success(loginResponseVO);
} catch (RuntimeException exception) {
requestThrottleService.recordLoginFailure(request, loginRequestDTO.getAccount());
securityAuditLogService.record(null, loginRequestDTO.getAccount(), "USER_LOGIN", "FAIL", exception.getMessage(), request);
throw exception;
}
}
/**
@@ -289,30 +422,73 @@ public class UserController {
@OperationGuard(action = "user-phone-login", ttlSeconds = 8, message = "登录处理中,请勿重复提交")
public Result<LoginResponseVO> phoneLogin(HttpServletRequest request, @RequestBody PhoneLoginRequestDTO phoneLoginRequestDTO) {
requestThrottleService.checkLogin(request, phoneLoginRequestDTO.getPhone());
LoginResponseVO loginResponseVO = userService.phoneLogin(phoneLoginRequestDTO);
return Result.success(loginResponseVO);
legalAgreementService.requireAccepted(phoneLoginRequestDTO);
try {
LoginResponseVO loginResponseVO = userService.phoneLogin(phoneLoginRequestDTO);
legalAgreementService.recordConsent(loginResponseVO.getUserInfo().getId(), phoneLoginRequestDTO, "USER_PHONE_LOGIN", request);
requestThrottleService.clearLoginFailure(request, phoneLoginRequestDTO.getPhone());
securityAuditLogService.record(loginResponseVO.getUserInfo().getId(), phoneLoginRequestDTO.getPhone(), "USER_PHONE_LOGIN", "SUCCESS", null, request);
return Result.success(loginResponseVO);
} catch (RuntimeException exception) {
requestThrottleService.recordLoginFailure(request, phoneLoginRequestDTO.getPhone());
securityAuditLogService.record(null, phoneLoginRequestDTO.getPhone(), "USER_PHONE_LOGIN", "FAIL", exception.getMessage(), request);
throw exception;
}
}
@PostMapping("/wechat-mini/auto-login")
@OperationGuard(action = "wechat-mini-auto-login", ttlSeconds = 8, message = "登录处理中,请勿重复提交")
/**
* Run business method `wechatMiniAutoLogin`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param requestDTO parameter `requestDTO` supplied by the caller
* @return Result<WechatMiniLoginResultVO> result consumed by the caller or returned to the frontend
*/
public Result<WechatMiniLoginResultVO> wechatMiniAutoLogin(@Valid @RequestBody WechatMiniAutoLoginRequestDTO requestDTO) {
return Result.success(wechatMiniAuthService.autoLogin(requestDTO));
}
@PostMapping("/wechat-mini/phone-login")
@OperationGuard(action = "wechat-mini-phone-login", ttlSeconds = 8, message = "登录处理中,请勿重复提交")
public Result<WechatMiniLoginResultVO> wechatMiniPhoneLogin(@Valid @RequestBody WechatMiniPhoneLoginRequestDTO requestDTO) {
return Result.success(wechatMiniAuthService.phoneLogin(requestDTO));
/**
* Run business method `wechatMiniPhoneLogin`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param requestDTO parameter `requestDTO` supplied by the caller
* @return Result<WechatMiniLoginResultVO> result consumed by the caller or returned to the frontend
*/
public Result<WechatMiniLoginResultVO> wechatMiniPhoneLogin(HttpServletRequest request, @Valid @RequestBody WechatMiniPhoneLoginRequestDTO requestDTO) {
requestThrottleService.checkWechatMiniLogin(request, "wechat-mini-phone");
legalAgreementService.requireAccepted(requestDTO);
WechatMiniLoginResultVO result = wechatMiniAuthService.phoneLogin(requestDTO);
recordWechatConsentIfLoggedIn(result, requestDTO, "WECHAT_MINI_PHONE_LOGIN", request);
return Result.success(result);
}
@PostMapping("/wechat-mini/confirm-login")
@OperationGuard(action = "wechat-mini-confirm-login", ttlSeconds = 8, message = "登录处理中,请勿重复提交")
public Result<WechatMiniLoginResultVO> confirmWechatMiniLogin(@Valid @RequestBody WechatMiniConfirmLoginRequestDTO requestDTO) {
return Result.success(wechatMiniAuthService.confirmLogin(requestDTO));
/**
* Run business method `confirmWechatMiniLogin`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param requestDTO parameter `requestDTO` supplied by the caller
* @return Result<WechatMiniLoginResultVO> result consumed by the caller or returned to the frontend
*/
public Result<WechatMiniLoginResultVO> confirmWechatMiniLogin(HttpServletRequest request, @Valid @RequestBody WechatMiniConfirmLoginRequestDTO requestDTO) {
requestThrottleService.checkWechatMiniLogin(request, requestDTO.getTicket());
legalAgreementService.requireAccepted(requestDTO);
WechatMiniLoginResultVO result = wechatMiniAuthService.confirmLogin(requestDTO);
recordWechatConsentIfLoggedIn(result, requestDTO, "WECHAT_MINI_CONFIRM_LOGIN", request);
return Result.success(result);
}
@PostMapping("/switch-shop")
@OperationGuard(action = "user-switch-shop", ttlSeconds = 10, message = "门店切换中,请勿重复操作")
/**
* Run business method `switchShop`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param switchShopRequestDTO parameter `switchShopRequestDTO` supplied by the caller
* @return Result<LoginResponseVO> result consumed by the caller or returned to the frontend
*/
public Result<LoginResponseVO> switchShop(HttpServletRequest request, @RequestBody SwitchShopRequestDTO switchShopRequestDTO) {
Long userId = (Long) request.getAttribute("userId");
return Result.success(userService.switchShop(userId, switchShopRequestDTO.getShopId(), (String) request.getAttribute("sessionId")));
@@ -326,9 +502,49 @@ public class UserController {
*/
@PostMapping("/register")
@OperationGuard(action = "user-register", ttlSeconds = 8, message = "登录处理中,请勿重复提交")
public Result<Boolean> register(@Valid @RequestBody RegisterRequestDTO registerRequestDTO) {
boolean success = userService.register(registerRequestDTO);
return Result.success(success);
public Result<Boolean> register(HttpServletRequest request, @Valid @RequestBody RegisterRequestDTO registerRequestDTO) {
requestThrottleService.checkRegister(request, registerRequestDTO.getAccount());
legalAgreementService.requireAccepted(registerRequestDTO);
try {
boolean success = userService.register(registerRequestDTO);
UserDO userDO = userMapper.selectOne(
com.baomidou.mybatisplus.core.toolkit.Wrappers.lambdaQuery(UserDO.class)
.eq(UserDO::getAccount, AccountValidationUtils.requireValidAccount(registerRequestDTO.getAccount()))
.eq(UserDO::getIsDelete, 0)
.last("limit 1")
);
if (userDO != null) {
legalAgreementService.recordConsent(userDO.getId(), registerRequestDTO, "USER_REGISTER", request);
securityAuditLogService.record(userDO.getId(), userDO.getAccount(), "USER_REGISTER", "SUCCESS", null, request);
}
return Result.success(success);
} catch (RuntimeException exception) {
securityAuditLogService.record(null, registerRequestDTO.getAccount(), "USER_REGISTER", "FAIL", exception.getMessage(), request);
throw exception;
}
}
@GetMapping("/relation/me")
/**
* Run business method `relationMe`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<UserRelationVO> result consumed by the caller or returned to the frontend
*/
public Result<UserRelationVO> relationMe(HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
return Result.success(userService.getCurrentUserRelation(userId));
}
@GetMapping("/invite-code/resolve")
/**
* Run business method `resolveInviteCode`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param code parameter `code` supplied by the caller
* @return Result<InviteCodeVO> result consumed by the caller or returned to the frontend
*/
public Result<InviteCodeVO> resolveInviteCode(@RequestParam String code) {
return Result.success(shopRoleService.resolveInviteCode(code));
}
/**
@@ -342,9 +558,15 @@ public class UserController {
public Result<Boolean> sendVerificationCode(HttpServletRequest request, @RequestBody SendVerificationCodeRequestDTO sendVerificationCodeRequestDTO) {
requestThrottleService.checkSendCode(request, sendVerificationCodeRequestDTO.getPhone());
if (!verificationCodeService.canResend(sendVerificationCodeRequestDTO.getPhone())) {
/**
* Run business method `RuntimeException`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param 1 parameter `1` supplied by the caller
* @return throw new result consumed by the caller or returned to the frontend
*/
throw new RuntimeException("验证码发送过于频繁,请1分钟后再试");
}
verificationCodeService.sendVerificationCode(sendVerificationCodeRequestDTO.getPhone());
verificationCodeService.sendVerificationCode(sendVerificationCodeRequestDTO.getPhone(), sendVerificationCodeRequestDTO.getSceneCode());
return Result.success(true);
}
@@ -359,6 +581,7 @@ public class UserController {
public Result<Boolean> resetPasswordByPhone(HttpServletRequest request, @RequestBody ResetPasswordRequestDTO resetPasswordRequestDTO) {
requestThrottleService.checkResetPassword(request, resetPasswordRequestDTO.getPhone());
boolean success = userService.resetPasswordByPhone(resetPasswordRequestDTO);
securityAuditLogService.record(null, resetPasswordRequestDTO.getPhone(), "RESET_PASSWORD_BY_PHONE", success ? "SUCCESS" : "FAIL", null, request);
return Result.success(success);
}
@@ -386,6 +609,22 @@ public class UserController {
return Result.success(success);
}
@GetMapping("/agreement-consent/me")
public Result<com.xiaowang.yuminailcore.vo.UserAgreementConsentVO> getMyAgreementConsent(HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
return Result.success(legalAgreementService.getMyConsent(userId));
}
private void recordWechatConsentIfLoggedIn(WechatMiniLoginResultVO result,
com.xiaowang.yuminailcore.dto.AgreementAwareRequest dto,
String entry,
HttpServletRequest request) {
if (result != null && result.getUserInfo() != null) {
legalAgreementService.recordConsent(result.getUserInfo().getId(), dto, entry, request);
securityAuditLogService.record(result.getUserInfo().getId(), null, entry, "SUCCESS", null, request);
}
}
/**
* 获取当前用户信息
*
@@ -467,6 +706,13 @@ public class UserController {
@PostMapping("/upload-avatar/complete")
@OperationGuard(action = "user-avatar-upload-complete", ttlSeconds = 30, message = "上传处理中,请勿重复操作")
/**
* Complete a business action.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param requestDTO parameter `requestDTO` supplied by the caller
* @return Result<String> result consumed by the caller or returned to the frontend
*/
public Result<String> completeAvatarUpload(HttpServletRequest request, @Valid @RequestBody ChunkUploadCompleteRequestDTO requestDTO) {
Long userId = (Long) request.getAttribute("userId");
try (ChunkUploadService.PreparedUploadFile preparedUploadFile =
@@ -488,6 +734,13 @@ public class UserController {
@DeleteMapping("/upload-avatar/{uploadId}")
@OperationGuard(action = "user-avatar-upload-cancel", ttlSeconds = 30, message = "上传处理中,请勿重复操作")
/**
* Run business method `cancelAvatarUpload`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param uploadId parameter `uploadId` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> cancelAvatarUpload(HttpServletRequest request, @PathVariable String uploadId) {
Long userId = (Long) request.getAttribute("userId");
chunkUploadService.clearUserAvatarUpload(userId, uploadId);
@@ -524,6 +777,13 @@ public class UserController {
@OperationGuard(action = "admin-user-reset-password", ttlSeconds = 10, message = "操作进行中,请勿重复点击")
public Result<Boolean> resetPassword(HttpServletRequest request, @PathVariable Long userId) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
/**
* Run business method `requireAccessibleUser`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param currentUser parameter `currentUser` supplied by the caller
* @param userId parameter `userId` supplied by the caller
* @return result consumed by the caller or returned to the frontend
*/
requireAccessibleUser(currentUser, userId, "无权重置其他店铺用户密码");
Long currentUserId = (Long) request.getAttribute("userId");
boolean success = userService.resetPassword(userId, currentUserId);
@@ -586,15 +846,34 @@ public class UserController {
return Result.success(success);
}
/**
* Run business method `requireAccessibleUser`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param currentUser parameter `currentUser` supplied by the caller
* @param userId parameter `userId` supplied by the caller
* @param message parameter `message` supplied by the caller
* @return private UserVO result consumed by the caller or returned to the frontend
*/
private UserVO requireAccessibleUser(UserDO currentUser, Long userId, String message) {
UserVO targetUser = userService.getUserById(userId);
if (targetUser == null) {
/**
* Run business method `RuntimeException`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @return throw new result consumed by the caller or returned to the frontend
*/
throw new RuntimeException("目标用户不存在");
}
adminScopeHelper.ensureUserAccessibleInCurrentShop(currentUser, userId, message);
return targetUser;
}
/**
* Run business method `sanitizePublicArtist`.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param userVO parameter `userVO` supplied by the caller
* @return private UserVO result consumed by the caller or returned to the frontend
*/
private UserVO sanitizePublicArtist(UserVO userVO) {
UserVO sanitized = new UserVO();
sanitized.setId(userVO.getId());
@@ -619,14 +898,29 @@ public class UserController {
@Data
public static class AvailabilityVO {
/**
* Variable `available`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final boolean available;
/**
* Variable `message`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final String message;
}
@Data
public static class LoginAccountAvailabilityVO {
/**
* Variable `exists`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final boolean exists;
/**
* Variable `nickname`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final String nickname;
/**
* Variable `message`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final String message;
}
}
@@ -20,7 +20,9 @@ import java.util.List;
@RequestMapping({"/vip-benefit", "/api/vip-benefit"})
@RequiredArgsConstructor
public class VipBenefitController {
/**
* Variable `vipBenefitService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final VipBenefitService vipBenefitService;
/**
@@ -20,7 +20,9 @@ import java.util.List;
@RequestMapping({"/vip-info", "/api/vip-info"})
@RequiredArgsConstructor
public class VipInfoController {
/**
* Variable `vipInfoService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final VipInfoService vipInfoService;
/**
@@ -0,0 +1,99 @@
package com.xiaowang.yuminailcore.controller;
import com.xiaowang.yuminailcore.annotation.OperationGuard;
import com.xiaowang.yuminailcore.annotation.RequirePermission;
import com.xiaowang.yuminailcore.common.Result;
import com.xiaowang.yuminailcore.dto.VipRechargePlanDTO;
import com.xiaowang.yuminailcore.entity.UserDO;
import com.xiaowang.yuminailcore.service.VipRechargePlanService;
import com.xiaowang.yuminailcore.support.AdminScopeHelper;
import com.xiaowang.yuminailcore.vo.VipRechargePlanVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping({"/vip-recharge-plan", "/api/vip-recharge-plan"})
/**
* VipRechargePlanController exposes HTTP endpoints. Start here to learn the request path, parameter names, and which service method is called.
* Beginner guide: follow the call chain Controller -> Service -> ServiceImpl -> Mapper/support class.
*/
public class VipRechargePlanController {
/**
* Variable `vipRechargePlanService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final VipRechargePlanService vipRechargePlanService;
/**
* Variable `adminScopeHelper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls.
*/
private final AdminScopeHelper adminScopeHelper;
@GetMapping("/admin/list")
@RequirePermission("user:vip:manage")
public Result<List<VipRechargePlanVO>> listAdmin(HttpServletRequest request, @RequestParam(required = false) Long shopId) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(vipRechargePlanService.listAdminPlans(currentUser, shopId));
}
@PostMapping("/admin/create")
@RequirePermission("user:vip:manage")
@OperationGuard(action = "vip-recharge-plan-create", ttlSeconds = 8, message = "充值档位保存处理中,请勿重复提交")
/**
* Create a new record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param dto parameter `dto` supplied by the caller
* @return Result<Long> result consumed by the caller or returned to the frontend
*/
public Result<Long> create(HttpServletRequest request, @Valid @RequestBody VipRechargePlanDTO dto) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(vipRechargePlanService.createPlan(currentUser, dto));
}
@PutMapping("/admin/{id}")
@RequirePermission("user:vip:manage")
@OperationGuard(action = "vip-recharge-plan-update", ttlSeconds = 8, message = "充值档位保存处理中,请勿重复提交")
/**
* Update an existing record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @param dto parameter `dto` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> update(HttpServletRequest request, @PathVariable Long id, @Valid @RequestBody VipRechargePlanDTO dto) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(vipRechargePlanService.updatePlan(currentUser, id, dto));
}
@PutMapping("/admin/{id}/status")
@RequirePermission("user:vip:manage")
/**
* Change the enabled/status flag of one record.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @param id parameter `id` supplied by the caller
* @param status parameter `status` supplied by the caller
* @return Result<Boolean> result consumed by the caller or returned to the frontend
*/
public Result<Boolean> updateStatus(HttpServletRequest request, @PathVariable Long id, @RequestParam Integer status) {
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
return Result.success(vipRechargePlanService.updateStatus(currentUser, id, status));
}
@GetMapping("/my/list")
/**
* List records for the current query or current user scope.
* Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result.
* @param request parameter `request` supplied by the caller
* @return Result<List<VipRechargePlanVO>> result consumed by the caller or returned to the frontend
*/
public Result<List<VipRechargePlanVO>> listMy(HttpServletRequest request) {
Long userId = (Long) request.getAttribute("userId");
return Result.success(vipRechargePlanService.listMyPlans(userId));
}
}
@@ -13,6 +13,10 @@ import java.util.Map;
@RestController
@RequestMapping("/wishlist")
/**
* WishlistController exposes HTTP endpoints. Start here to learn the request path, parameter names, and which service method is called.
* Beginner guide: follow the call chain Controller -> Service -> ServiceImpl -> Mapper/support class.
*/
public class WishlistController {
@Autowired
@@ -5,15 +5,34 @@ import lombok.Data;
import java.math.BigDecimal;
@Data
/**
* AdminUserBalanceChangeDTO is a request DTO. Controllers receive it from JSON body or query parameters and pass it into services.
* Field and parameter names are kept consistent with the frontend/API payload to make tracing easier.
*/
public class AdminUserBalanceChangeDTO {
/**
* Field `amount` (BigDecimal): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private BigDecimal amount;
/**
* Field `changeScene` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String changeScene;
/**
* Field `relatedOrderId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long relatedOrderId;
/**
* Field `externalOrderNo` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String externalOrderNo;
/**
* Field `remark` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String remark;
}
@@ -3,9 +3,19 @@ package com.xiaowang.yuminailcore.dto;
import lombok.Data;
@Data
/**
* AdminUserVipOverrideDTO is a request DTO. Controllers receive it from JSON body or query parameters and pass it into services.
* Field and parameter names are kept consistent with the frontend/API payload to make tracing easier.
*/
public class AdminUserVipOverrideDTO {
/**
* Field `vipLevel` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String vipLevel;
/**
* Field `remark` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String remark;
}
@@ -0,0 +1,12 @@
package com.xiaowang.yuminailcore.dto;
import java.util.Map;
public interface AgreementAwareRequest {
Boolean getAgreementAccepted();
Map<String, String> getAgreementVersions();
String getClientType();
}
@@ -0,0 +1,50 @@
package com.xiaowang.yuminailcore.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.List;
@Data
/**
* AnnouncementCreateDTO is a request DTO. Controllers receive it from JSON body or query parameters and pass it into services.
* Field and parameter names are kept consistent with the frontend/API payload to make tracing easier.
*/
public class AnnouncementCreateDTO {
@NotBlank(message = "公告标题不能为空")
@Size(max = 100, message = "公告标题不能超过100个字符")
/**
* Field `title` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String title;
@NotBlank(message = "公告内容不能为空")
@Size(max = 1000, message = "公告内容不能超过1000个字符")
/**
* Field `content` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String content;
@NotBlank(message = "公告范围不能为空")
/**
* Field `targetType` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String targetType;
/**
* Field `shopIds` (List<Long>): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private List<Long> shopIds;
/**
* Field `userIds` (List<Long>): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private List<Long> userIds;
/**
* Field `sortOrder` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer sortOrder = 0;
}
@@ -34,13 +34,37 @@ public class BalanceChangeDetailDTO {
* 变动后的当前余额
*/
private BigDecimal currentBalance;
/**
* Field `beforeBalance` (BigDecimal): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private BigDecimal beforeBalance;
/**
* Field `afterBalance` (BigDecimal): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private BigDecimal afterBalance;
/**
* Field `changeScene` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String changeScene;
/**
* Field `relatedOrderId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long relatedOrderId;
/**
* Field `relatedOrderNo` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String relatedOrderNo;
/**
* Field `externalOrderNo` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String externalOrderNo;
/**
* Field `operatorId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long operatorId;
/**
* Field `remark` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String remark;
/**
@@ -24,6 +24,12 @@ public class BalanceDTO {
* 当前余额
*/
private BigDecimal amount;
/**
* Field `totalRechargeAmount` (BigDecimal): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private BigDecimal totalRechargeAmount;
/**
* Field `lastRechargeTime` (LocalDateTime): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private LocalDateTime lastRechargeTime;
}
@@ -11,5 +11,8 @@ import javax.validation.constraints.NotBlank;
public class ChunkUploadCompleteRequestDTO {
@NotBlank(message = "上传标识不能为空")
/**
* Field `uploadId` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String uploadId;
}
@@ -13,18 +13,33 @@ import javax.validation.constraints.NotNull;
public class ChunkUploadInitRequestDTO {
@NotBlank(message = "文件名不能为空")
/**
* Field `fileName` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String fileName;
@NotNull(message = "文件大小不能为空")
@Min(value = 1, message = "文件大小不合法")
/**
* Field `fileSize` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long fileSize;
@NotBlank(message = "文件类型不能为空")
/**
* Field `contentType` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String contentType;
@NotBlank(message = "文件指纹不能为空")
/**
* Field `fileFingerprint` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String fileFingerprint;
@NotBlank(message = "上传场景不能为空")
/**
* Field `scene` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String scene;
}
@@ -61,8 +61,17 @@ public class CouponDTO {
* 所属店铺ID
*/
private Long shopId;
/**
* Field `couponScene` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String couponScene;
/**
* Field `requiredVipLevel` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String requiredVipLevel;
/**
* Field `autoMatch` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer autoMatch;
/**
@@ -0,0 +1,41 @@
package com.xiaowang.yuminailcore.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.time.LocalDateTime;
@Data
/**
* InviteCodeDTO is a request DTO. Controllers receive it from JSON body or query parameters and pass it into services.
* Field and parameter names are kept consistent with the frontend/API payload to make tracing easier.
*/
public class InviteCodeDTO {
/**
* Field `shopId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long shopId;
/**
* Field `ownerUserId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long ownerUserId;
@NotBlank(message = "邀请码不能为空")
/**
* Field `inviteCode` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String inviteCode;
/**
* Field `status` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer status;
/**
* Field `useCount` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer useCount;
/**
* Field `expireTime` (LocalDateTime): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private LocalDateTime expireTime;
}
@@ -0,0 +1,24 @@
package com.xiaowang.yuminailcore.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
@Data
public class LegalAgreementDTO {
@NotBlank(message = "协议类型不能为空")
private String agreementType;
@NotBlank(message = "协议标题不能为空")
@Size(max = 100, message = "协议标题不能超过100个字符")
private String title;
@NotBlank(message = "协议版本不能为空")
@Size(max = 40, message = "协议版本不能超过40个字符")
private String version;
@NotBlank(message = "协议内容不能为空")
private String content;
}
@@ -6,6 +6,7 @@ import lombok.Setter;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.util.Map;
/**
* 登录请求 DTO
@@ -16,7 +17,7 @@ import javax.validation.constraints.Pattern;
*/
@Getter
@Setter
public class LoginRequestDTO {
public class LoginRequestDTO implements AgreementAwareRequest {
/**
* 账号
@@ -39,4 +40,10 @@ public class LoginRequestDTO {
* 店铺ID
*/
private Long shopId;
private Boolean agreementAccepted;
private Map<String, String> agreementVersions;
private String clientType;
}
@@ -0,0 +1,85 @@
package com.xiaowang.yuminailcore.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
@Data
/**
* MessageHubPushConfigDTO is a request DTO. Controllers receive it from JSON body or query parameters and pass it into services.
* Field and parameter names are kept consistent with the frontend/API payload to make tracing easier.
*/
public class MessageHubPushConfigDTO {
@NotBlank(message = "场景编码不能为空")
@Size(max = 80, message = "场景编码不能超过80个字符")
/**
* Field `sceneCode` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String sceneCode;
@NotBlank(message = "场景名称不能为空")
@Size(max = 100, message = "场景名称不能超过100个字符")
/**
* Field `sceneName` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String sceneName;
@NotBlank(message = "消息平台不能为空")
@Size(max = 20, message = "消息平台不能超过20个字符")
/**
* Field `platform` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String platform = "SMS";
@NotBlank(message = "消息类型不能为空")
@Size(max = 30, message = "消息类型不能超过30个字符")
/**
* Field `msgType` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String msgType = "VERIFICATION";
@NotBlank(message = "队列名称不能为空")
@Size(max = 100, message = "队列名称不能超过100个字符")
/**
* Field `queueName` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String queueName;
@NotBlank(message = "来源系统不能为空")
@Size(max = 80, message = "来源系统不能超过80个字符")
/**
* Field `sourceSystem` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String sourceSystem;
@NotBlank(message = "模板编码不能为空")
@Size(max = 100, message = "模板编码不能超过100个字符")
/**
* Field `templateCode` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String templateCode;
/**
* Field `channelId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long channelId;
@Size(max = 30, message = "发送方式不能超过30个字符")
/**
* Field `sendMethod` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String sendMethod;
/**
* Field `enabled` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer enabled = 1;
@Size(max = 255, message = "备注不能超过255个字符")
/**
* Field `remark` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String remark;
}
@@ -0,0 +1,21 @@
package com.xiaowang.yuminailcore.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
@Data
/**
* MessageHubPushTestDTO is a request DTO. Controllers receive it from JSON body or query parameters and pass it into services.
* Field and parameter names are kept consistent with the frontend/API payload to make tracing easier.
*/
public class MessageHubPushTestDTO {
@NotBlank(message = "手机号不能为空")
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
/**
* Field `phone` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String phone;
}
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalTime;
/**
* 美甲师信息DTO
@@ -47,6 +48,31 @@ public class NailArtistInfoDTO {
* 状态:1-营业中,0-休息中
*/
private Integer status;
/**
* Field `participateProduction` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer participateProduction;
/**
* Field `workStartTime` (LocalTime): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private LocalTime workStartTime;
/**
* Field `workEndTime` (LocalTime): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private LocalTime workEndTime;
/**
* Field `userType` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer userType;
/**
* Field `userTypeName` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String userTypeName;
/**
* 作品集商品ID集合,多个ID以逗号分隔
@@ -18,6 +18,9 @@ public class OrderDTO {
* 优惠券ID
*/
private Long couponId;
/**
* Field `couponSourceType` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String couponSourceType;
/**
@@ -3,6 +3,7 @@ package com.xiaowang.yuminailcore.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.util.Map;
/**
* 手机号验证码登录请求 DTO
@@ -11,15 +12,30 @@ import javax.validation.constraints.Pattern;
* @date 2026-03-03
*/
@Data
public class PhoneLoginRequestDTO {
public class PhoneLoginRequestDTO implements AgreementAwareRequest {
@NotBlank(message = "手机号不能为空")
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
/**
* Field `phone` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String phone;
@NotBlank(message = "验证码不能为空")
@Pattern(regexp = "^\\d{6}$", message = "验证码必须是6位数字")
/**
* Field `verificationCode` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String verificationCode;
/**
* Field `shopId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long shopId;
}
private Boolean agreementAccepted;
private Map<String, String> agreementVersions;
private String clientType;
}
@@ -4,6 +4,7 @@ import com.xiaowang.yuminailcore.utils.AccountValidationUtils;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.util.Map;
/**
* 注册请求 DTO
@@ -12,24 +13,53 @@ import javax.validation.constraints.Pattern;
* @date 2026-02-14
*/
@Data
public class RegisterRequestDTO {
public class RegisterRequestDTO implements AgreementAwareRequest {
@NotBlank(message = "账号不能为空")
@Pattern(regexp = AccountValidationUtils.ACCOUNT_REGEX, message = "账号只能包含字母和数字")
/**
* Field `account` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String account;
@NotBlank(message = "密码不能为空")
/**
* Field `password` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String password;
/**
* Field `nickname` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String nickname;
/**
* Field `shopId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long shopId;
/**
* Field `inviteCode` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String inviteCode;
@NotBlank(message = "手机号不能为空")
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
/**
* Field `phone` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String phone;
@NotBlank(message = "验证码不能为空")
@Pattern(regexp = "^\\d{6}$", message = "验证码必须是6位数字")
/**
* Field `verificationCode` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String verificationCode;
private Boolean agreementAccepted;
private Map<String, String> agreementVersions;
private String clientType;
}
@@ -1,19 +1,25 @@
package com.xiaowang.yuminailcore.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
/**
* 发送验证码请求 DTO
*
* @author xiaowang
* @date 2026-03-03
* 发送验证码请求 DTO。
*/
@Data
public class SendVerificationCodeRequestDTO {
@NotBlank(message = "手机号不能为空")
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
/**
* Field `phone` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String phone;
}
/**
* 业务场景编码,用来选择 YumiNail 投递 MessageHub 时的配置。
*/
private String sceneCode;
}
@@ -2,6 +2,9 @@ package com.xiaowang.yuminailcore.dto;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 店铺信息表 DTO
* 用于店铺信息的传输
@@ -27,6 +30,12 @@ public class ShopDTO {
*/
private String address;
private String mapProvider;
private BigDecimal longitude;
private BigDecimal latitude;
/**
* 店铺营业时间
*/
@@ -46,4 +55,9 @@ public class ShopDTO {
* 店铺状态:1-启用,0-停用
*/
private Integer status;
/**
* 店铺授权有效期;为空表示长期有效。
*/
private LocalDateTime authorizationExpireTime;
}
@@ -0,0 +1,45 @@
package com.xiaowang.yuminailcore.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.util.List;
@Data
/**
* ShopRoleDTO is a request DTO. Controllers receive it from JSON body or query parameters and pass it into services.
* Field and parameter names are kept consistent with the frontend/API payload to make tracing easier.
*/
public class ShopRoleDTO {
/**
* Field `shopId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long shopId;
@NotBlank(message = "角色名不能为空")
/**
* Field `roleName` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String roleName;
/**
* Field `status` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer status;
/**
* Field `remark` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String remark;
/**
* Field `sortOrder` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer sortOrder;
/**
* Field `permissionIds` (List<Long>): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private List<Long> permissionIds;
/**
* Field `userIds` (List<Long>): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private List<Long> userIds;
}
@@ -3,7 +3,14 @@ package com.xiaowang.yuminailcore.dto;
import lombok.Data;
@Data
/**
* SwitchShopRequestDTO is a request DTO. Controllers receive it from JSON body or query parameters and pass it into services.
* Field and parameter names are kept consistent with the frontend/API payload to make tracing easier.
*/
public class SwitchShopRequestDTO {
/**
* Field `shopId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long shopId;
}
@@ -0,0 +1,51 @@
package com.xiaowang.yuminailcore.dto;
import lombok.Data;
import javax.validation.constraints.Size;
import java.util.List;
@Data
/**
* SystemMessageCreateDTO is a request DTO. Controllers receive it from JSON body or query parameters and pass it into services.
* Field and parameter names are kept consistent with the frontend/API payload to make tracing easier.
*/
public class SystemMessageCreateDTO {
@Size(max = 100, message = "消息标题不能超过100个字符")
/**
* Field `title` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String title;
@Size(max = 2000, message = "消息内容不能超过2000个字符")
/**
* Field `content` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String content;
/**
* Field `targetType` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String targetType;
/**
* Field `imageFileId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long imageFileId;
/**
* Field `shopIds` (List<Long>): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private List<Long> shopIds;
/**
* Field `userIds` (List<Long>): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private List<Long> userIds;
/**
* Field `popupEnabled` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer popupEnabled = 1;
}
@@ -0,0 +1,30 @@
package com.xiaowang.yuminailcore.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
@Data
public class SystemParameterConfigDTO {
@NotBlank(message = "配置分组不能为空")
@Size(max = 50, message = "配置分组不能超过50个字符")
private String configGroup;
@NotBlank(message = "配置键不能为空")
@Size(max = 100, message = "配置键不能超过100个字符")
private String configKey;
@NotBlank(message = "配置名称不能为空")
@Size(max = 100, message = "配置名称不能超过100个字符")
private String configName;
@Size(max = 1000, message = "配置值不能超过1000个字符")
private String configValue;
private Integer enabled = 1;
@Size(max = 255, message = "备注不能超过255个字符")
private String remark;
}
@@ -0,0 +1,27 @@
package com.xiaowang.yuminailcore.dto;
import lombok.Data;
@Data
/**
* UserRelationUpdateDTO is a request DTO. Controllers receive it from JSON body or query parameters and pass it into services.
* Field and parameter names are kept consistent with the frontend/API payload to make tracing easier.
*/
public class UserRelationUpdateDTO {
/**
* Field `shopId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long shopId;
/**
* Field `parentUserId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long parentUserId;
/**
* Field `parentRoleType` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer parentRoleType;
/**
* Field `sourceType` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String sourceType;
}
@@ -23,7 +23,16 @@ public class VipBenefitDTO {
* 所需VIP等级
*/
private String requiredVipLevel;
/**
* Field `levelRank` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer levelRank;
/**
* Field `rechargeThreshold` (BigDecimal): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private BigDecimal rechargeThreshold;
/**
* Field `status` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer status;
}
@@ -14,6 +14,9 @@ import java.time.LocalDateTime;
@Data
public class VipInfoDTO {
/**
* Field `userId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long userId;
/**
@@ -40,5 +43,8 @@ public class VipInfoDTO {
* 关联VIP权益信息表主键
*/
private Long benefitId;
/**
* Field `manualOverride` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer manualOverride;
}
@@ -0,0 +1,66 @@
package com.xiaowang.yuminailcore.dto;
import lombok.Data;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
@Data
/**
* VipRechargePlanDTO is a request DTO. Controllers receive it from JSON body or query parameters and pass it into services.
* Field and parameter names are kept consistent with the frontend/API payload to make tracing easier.
*/
public class VipRechargePlanDTO {
/**
* Field `shopId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long shopId;
@NotBlank(message = "充值档位标题不能为空")
@Size(max = 100, message = "充值档位标题不能超过100个字符")
/**
* Field `title` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String title;
@NotNull(message = "充值金额不能为空")
@DecimalMin(value = "0.01", message = "充值金额必须大于0")
/**
* Field `rechargeAmount` (BigDecimal): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private BigDecimal rechargeAmount;
@NotNull(message = "赠送金额不能为空")
@DecimalMin(value = "0.00", message = "赠送金额不能小于0")
/**
* Field `giftAmount` (BigDecimal): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private BigDecimal giftAmount;
@NotBlank(message = "VIP等级不能为空")
@Size(max = 20, message = "VIP等级不能超过20个字符")
/**
* Field `vipLevel` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String vipLevel;
@Size(max = 255, message = "说明不能超过255个字符")
/**
* Field `description` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String description;
/**
* Field `sortOrder` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer sortOrder = 0;
/**
* Field `status` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer status = 1;
}
@@ -11,7 +11,13 @@ import javax.validation.constraints.NotBlank;
public class WechatMiniAutoLoginRequestDTO {
@NotBlank(message = "微信登录凭证不能为空")
/**
* Field `wxCode` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String wxCode;
/**
* Field `preferredShopId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long preferredShopId;
}
@@ -4,16 +4,29 @@ import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Map;
/**
* 微信小程序补选店铺后确认登录请求。
*/
@Data
public class WechatMiniConfirmLoginRequestDTO {
public class WechatMiniConfirmLoginRequestDTO implements AgreementAwareRequest {
@NotBlank(message = "登录票据不能为空")
/**
* Field `ticket` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String ticket;
@NotNull(message = "店铺不能为空")
/**
* Field `shopId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long shopId;
private Boolean agreementAccepted;
private Map<String, String> agreementVersions;
private String clientType;
}
@@ -3,18 +3,34 @@ package com.xiaowang.yuminailcore.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.util.Map;
/**
* 微信小程序手机号一键登录请求。
*/
@Data
public class WechatMiniPhoneLoginRequestDTO {
public class WechatMiniPhoneLoginRequestDTO implements AgreementAwareRequest {
@NotBlank(message = "微信登录凭证不能为空")
/**
* Field `wxCode` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String wxCode;
@NotBlank(message = "手机号授权凭证不能为空")
/**
* Field `phoneCode` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String phoneCode;
/**
* Field `preferredShopId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long preferredShopId;
private Boolean agreementAccepted;
private Map<String, String> agreementVersions;
private String clientType;
}
@@ -0,0 +1,86 @@
package com.xiaowang.yuminailcore.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_announcement")
/**
* AnnouncementDO maps to a database table row. Mapper classes persist and query this object.
* Field and parameter names are kept consistent with the frontend/API payload to make tracing easier.
*/
public class AnnouncementDO extends BaseEntity {
@TableField("title")
/**
* Field `title` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String title;
@TableField("content")
/**
* Field `content` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String content;
@TableField("publisher_id")
/**
* Field `publisherId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long publisherId;
@TableField("publisher_name")
/**
* Field `publisherName` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String publisherName;
@TableField("publisher_type")
/**
* Field `publisherType` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer publisherType;
@TableField("target_type")
/**
* Field `targetType` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String targetType;
@TableField("target_ids")
/**
* Field `targetIds` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String targetIds;
@TableField("status")
/**
* Field `status` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer status;
@TableField("sort_order")
/**
* Field `sortOrder` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer sortOrder;
@TableField("publish_time")
/**
* Field `publishTime` (LocalDateTime): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private LocalDateTime publishTime;
@TableField("is_delete")
@TableLogic
/**
* Field `isDelete` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer isDelete;
}
@@ -21,6 +21,9 @@ import java.time.LocalDateTime;
public class BalanceChangeDetailDO {
@TableId(type = IdType.ASSIGN_ID)
/**
* Field `id` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long id;
/**
@@ -54,26 +57,50 @@ public class BalanceChangeDetailDO {
private BigDecimal beforeBalance;
@TableField("after_balance")
/**
* Field `afterBalance` (BigDecimal): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private BigDecimal afterBalance;
@TableField("change_scene")
/**
* Field `changeScene` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String changeScene;
@TableField("related_order_id")
/**
* Field `relatedOrderId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long relatedOrderId;
@TableField("related_order_no")
/**
* Field `relatedOrderNo` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String relatedOrderNo;
@TableField("external_order_no")
/**
* Field `externalOrderNo` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String externalOrderNo;
@TableField("operator_id")
/**
* Field `operatorId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long operatorId;
@TableField("remark")
/**
* Field `remark` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String remark;
@TableField("change_time")
/**
* Field `changeTime` (LocalDateTime): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private LocalDateTime changeTime;
}
@@ -39,8 +39,14 @@ public class BalanceDO extends BaseEntity {
private BigDecimal totalRechargeAmount;
@TableField("last_recharge_time")
/**
* Field `lastRechargeTime` (LocalDateTime): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private LocalDateTime lastRechargeTime;
@TableField("last_update_time")
/**
* Field `lastUpdateTime` (LocalDateTime): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private LocalDateTime lastUpdateTime;
}
@@ -7,11 +7,33 @@ import java.time.LocalDateTime;
@Data
@TableName("t_cart")
/**
* CartDO maps to a database table row. Mapper classes persist and query this object.
* Field and parameter names are kept consistent with the frontend/API payload to make tracing easier.
*/
public class CartDO extends BaseEntity {
/**
* Field `userId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long userId;
/**
* Field `productId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long productId;
/**
* Field `quantity` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer quantity;
/**
* Field `createTime` (LocalDateTime): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private LocalDateTime createTime;
/**
* Field `updateTime` (LocalDateTime): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private LocalDateTime updateTime;
/**
* Field `isDelete` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer isDelete;
}
@@ -77,10 +77,19 @@ public class CouponDO extends BaseEntity {
*/
private Long shopId;
/**
* Field `couponScene` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String couponScene;
/**
* Field `requiredVipLevel` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String requiredVipLevel;
/**
* Field `autoMatch` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer autoMatch;
/**
@@ -0,0 +1,37 @@
package com.xiaowang.yuminailcore.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
@Getter
@Setter
@TableName("t_legal_agreement")
public class LegalAgreementDO extends BaseEntity {
@TableField("agreement_type")
private String agreementType;
@TableField("title")
private String title;
@TableField("version")
private String version;
@TableField("content")
private String content;
@TableField("status")
private Integer status;
@TableField("effective_time")
private LocalDateTime effectiveTime;
@TableField("is_delete")
@TableLogic
private Integer isDelete;
}
@@ -0,0 +1,92 @@
package com.xiaowang.yuminailcore.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* YumiNail 调用 MessageHub 的场景级配置。
*
* <p>这里不保存 Spug、阿里云等供应商密钥;这些真实通道仍由 MessageHub 自己管理。
* 本表只描述 YumiNail 在某个业务功能里投递 MessageHub 时要携带的参数。</p>
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_messagehub_push_config")
public class MessageHubPushConfigDO extends BaseEntity {
@TableField("scene_code")
/**
* Field `sceneCode` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String sceneCode;
@TableField("scene_name")
/**
* Field `sceneName` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String sceneName;
@TableField("platform")
/**
* Field `platform` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String platform;
@TableField("msg_type")
/**
* Field `msgType` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String msgType;
@TableField("queue_name")
/**
* Field `queueName` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String queueName;
@TableField("source_system")
/**
* Field `sourceSystem` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String sourceSystem;
@TableField("template_code")
/**
* Field `templateCode` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String templateCode;
@TableField("channel_id")
/**
* Field `channelId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long channelId;
@TableField("send_method")
/**
* Field `sendMethod` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String sendMethod;
@TableField("enabled")
/**
* Field `enabled` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer enabled;
@TableField("remark")
/**
* Field `remark` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String remark;
@TableField("is_delete")
@TableLogic
/**
* Field `isDelete` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer isDelete;
}
@@ -7,6 +7,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.time.LocalTime;
/**
* 美甲师信息实体类
@@ -44,6 +45,24 @@ public class NailArtistInfoDO extends BaseEntity {
* 状态:1-营业中,0-休息中
*/
private Integer status;
@TableField("participate_production")
/**
* Field `participateProduction` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer participateProduction;
@TableField("work_start_time")
/**
* Field `workStartTime` (LocalTime): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private LocalTime workStartTime;
@TableField("work_end_time")
/**
* Field `workEndTime` (LocalTime): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private LocalTime workEndTime;
/**
* 作品集商品ID集合,多个ID以逗号分隔
@@ -8,17 +8,57 @@ import java.time.LocalDateTime;
@Data
@TableName("t_order")
/**
* OrderDO maps to a database table row. Mapper classes persist and query this object.
* Field and parameter names are kept consistent with the frontend/API payload to make tracing easier.
*/
public class OrderDO extends BaseEntity {
/**
* Field `orderNo` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String orderNo;
/**
* Field `userId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long userId;
/**
* Field `shopId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long shopId;
/**
* Field `totalAmount` (BigDecimal): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private BigDecimal totalAmount;
/**
* Field `actualAmount` (BigDecimal): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private BigDecimal actualAmount;
/**
* Field `couponId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long couponId;
/**
* Field `userCouponId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long userCouponId;
/**
* Field `couponSourceType` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String couponSourceType;
/**
* Field `status` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer status;
/**
* Field `createTime` (LocalDateTime): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private LocalDateTime createTime;
/**
* Field `updateTime` (LocalDateTime): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private LocalDateTime updateTime;
/**
* Field `isDelete` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer isDelete;
}
@@ -9,17 +9,48 @@ import java.time.LocalDateTime;
@Data
@TableName("t_order_item")
/**
* OrderItemDO maps to a database table row. Mapper classes persist and query this object.
* Field and parameter names are kept consistent with the frontend/API payload to make tracing easier.
*/
public class OrderItemDO extends BaseEntity {
/**
* Field `orderId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long orderId;
/**
* Field `productId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long productId;
/**
* Field `quantity` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer quantity;
/**
* Field `price` (BigDecimal): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private BigDecimal price;
/**
* Field `artistId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long artistId;
@TableField("appointment_time")
/**
* Field `appointmentTime` (LocalDateTime): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private LocalDateTime appointmentTime;
/**
* Field `createTime` (LocalDateTime): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private LocalDateTime createTime;
/**
* Field `updateTime` (LocalDateTime): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private LocalDateTime updateTime;
/**
* Field `isDelete` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer isDelete;
}
@@ -0,0 +1,38 @@
package com.xiaowang.yuminailcore.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
@Getter
@Setter
@TableName("t_security_audit_log")
public class SecurityAuditLogDO extends BaseEntity {
@TableField("user_id")
private Long userId;
@TableField("account")
private String account;
@TableField("action")
private String action;
@TableField("result")
private String result;
@TableField("reason")
private String reason;
@TableField("ip_address")
private String ipAddress;
@TableField("device_id")
private String deviceId;
@TableField("operate_time")
private LocalDateTime operateTime;
}
@@ -8,6 +8,9 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 店铺信息表 DO
* 对应数据库表 t_shop
@@ -44,6 +47,15 @@ public class ShopDO extends BaseEntity {
@TableField("address")
private String address;
@TableField("map_provider")
private String mapProvider;
@TableField("longitude")
private BigDecimal longitude;
@TableField("latitude")
private BigDecimal latitude;
/**
* 店铺营业时间
*/
@@ -68,6 +80,12 @@ public class ShopDO extends BaseEntity {
@TableField("status")
private Integer status;
/**
* 店铺授权有效期;为空表示长期有效。
*/
@TableField("authorization_expire_time")
private LocalDateTime authorizationExpireTime;
/**
* 逻辑删除:0-未删,1-已删
*/
@@ -0,0 +1,60 @@
package com.xiaowang.yuminailcore.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_shop_role")
/**
* ShopRoleDO maps to a database table row. Mapper classes persist and query this object.
* Field and parameter names are kept consistent with the frontend/API payload to make tracing easier.
*/
public class ShopRoleDO extends BaseEntity {
@TableField("shop_id")
/**
* Field `shopId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long shopId;
@TableField("role_name")
/**
* Field `roleName` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String roleName;
@TableField("creator_id")
/**
* Field `creatorId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long creatorId;
@TableField("status")
/**
* Field `status` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer status;
@TableField("remark")
/**
* Field `remark` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String remark;
@TableField("sort_order")
/**
* Field `sortOrder` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer sortOrder;
@TableField("is_delete")
@TableLogic
/**
* Field `isDelete` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer isDelete;
}
@@ -0,0 +1,36 @@
package com.xiaowang.yuminailcore.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_shop_role_permission")
/**
* ShopRolePermissionDO maps to a database table row. Mapper classes persist and query this object.
* Field and parameter names are kept consistent with the frontend/API payload to make tracing easier.
*/
public class ShopRolePermissionDO extends BaseEntity {
@TableField("role_id")
/**
* Field `roleId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long roleId;
@TableField("permission_id")
/**
* Field `permissionId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long permissionId;
@TableField("is_delete")
@TableLogic
/**
* Field `isDelete` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer isDelete;
}
@@ -0,0 +1,92 @@
package com.xiaowang.yuminailcore.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
@Getter
@Setter
@TableName("t_system_message")
/**
* SystemMessageDO maps to a database table row. Mapper classes persist and query this object.
* Field and parameter names are kept consistent with the frontend/API payload to make tracing easier.
*/
public class SystemMessageDO extends BaseEntity {
@TableField("title")
/**
* Field `title` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String title;
@TableField("content")
/**
* Field `content` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String content;
@TableField("image_file_id")
/**
* Field `imageFileId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long imageFileId;
@TableField("publisher_id")
/**
* Field `publisherId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long publisherId;
@TableField("publisher_name")
/**
* Field `publisherName` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String publisherName;
@TableField("publisher_type")
/**
* Field `publisherType` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer publisherType;
@TableField("target_type")
/**
* Field `targetType` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String targetType;
@TableField("target_ids")
/**
* Field `targetIds` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String targetIds;
@TableField("popup_enabled")
/**
* Field `popupEnabled` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer popupEnabled;
@TableField("status")
/**
* Field `status` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer status;
@TableField("publish_time")
/**
* Field `publishTime` (LocalDateTime): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private LocalDateTime publishTime;
@TableField("is_delete")
@TableLogic
/**
* Field `isDelete` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer isDelete;
}
@@ -0,0 +1,62 @@
package com.xiaowang.yuminailcore.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
@Getter
@Setter
@TableName("t_system_message_user_state")
/**
* SystemMessageUserStateDO maps to a database table row. Mapper classes persist and query this object.
* Field and parameter names are kept consistent with the frontend/API payload to make tracing easier.
*/
public class SystemMessageUserStateDO extends BaseEntity {
@TableField("message_id")
/**
* Field `messageId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long messageId;
@TableField("user_id")
/**
* Field `userId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long userId;
@TableField("popup_shown")
/**
* Field `popupShown` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer popupShown;
@TableField("read_status")
/**
* Field `readStatus` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer readStatus;
@TableField("popup_time")
/**
* Field `popupTime` (LocalDateTime): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private LocalDateTime popupTime;
@TableField("read_time")
/**
* Field `readTime` (LocalDateTime): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private LocalDateTime readTime;
@TableField("is_delete")
@TableLogic
/**
* Field `isDelete` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer isDelete;
}
@@ -0,0 +1,35 @@
package com.xiaowang.yuminailcore.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_system_parameter_config")
public class SystemParameterConfigDO extends BaseEntity {
@TableField("config_group")
private String configGroup;
@TableField("config_key")
private String configKey;
@TableField("config_name")
private String configName;
@TableField("config_value")
private String configValue;
@TableField("enabled")
private Integer enabled;
@TableField("remark")
private String remark;
@TableField("is_delete")
@TableLogic
private Integer isDelete;
}
@@ -0,0 +1,38 @@
package com.xiaowang.yuminailcore.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
@Getter
@Setter
@TableName("t_user_agreement_consent")
public class UserAgreementConsentDO extends BaseEntity {
@TableField("user_id")
private Long userId;
@TableField("agreement_type")
private String agreementType;
@TableField("version")
private String version;
@TableField("entry")
private String entry;
@TableField("client_type")
private String clientType;
@TableField("ip_address")
private String ipAddress;
@TableField("device_id")
private String deviceId;
@TableField("consent_time")
private LocalDateTime consentTime;
}
@@ -0,0 +1,62 @@
package com.xiaowang.yuminailcore.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_user_invite_code")
/**
* UserInviteCodeDO maps to a database table row. Mapper classes persist and query this object.
* Field and parameter names are kept consistent with the frontend/API payload to make tracing easier.
*/
public class UserInviteCodeDO extends BaseEntity {
@TableField("invite_code")
/**
* Field `inviteCode` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String inviteCode;
@TableField("owner_user_id")
/**
* Field `ownerUserId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long ownerUserId;
@TableField("shop_id")
/**
* Field `shopId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long shopId;
@TableField("status")
/**
* Field `status` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer status;
@TableField("use_count")
/**
* Field `useCount` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer useCount;
@TableField("expire_time")
/**
* Field `expireTime` (LocalDateTime): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private LocalDateTime expireTime;
@TableField("is_delete")
@TableLogic
/**
* Field `isDelete` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer isDelete;
}
@@ -0,0 +1,60 @@
package com.xiaowang.yuminailcore.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_user_relation")
/**
* UserRelationDO maps to a database table row. Mapper classes persist and query this object.
* Field and parameter names are kept consistent with the frontend/API payload to make tracing easier.
*/
public class UserRelationDO extends BaseEntity {
@TableField("user_id")
/**
* Field `userId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long userId;
@TableField("shop_id")
/**
* Field `shopId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long shopId;
@TableField("parent_user_id")
/**
* Field `parentUserId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long parentUserId;
@TableField("parent_role_type")
/**
* Field `parentRoleType` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer parentRoleType;
@TableField("source_type")
/**
* Field `sourceType` (String): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private String sourceType;
@TableField("creator_id")
/**
* Field `creatorId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long creatorId;
@TableField("is_delete")
@TableLogic
/**
* Field `isDelete` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer isDelete;
}
@@ -17,12 +17,21 @@ import lombok.Setter;
public class UserShopBindingDO extends BaseEntity {
@TableId(type = IdType.ASSIGN_ID)
/**
* Field `id` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long id;
@TableField("user_id")
/**
* Field `userId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long userId;
@TableField("shop_id")
/**
* Field `shopId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long shopId;
/**
@@ -33,5 +42,8 @@ public class UserShopBindingDO extends BaseEntity {
@TableField("is_delete")
@TableLogic
/**
* Field `isDelete` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer isDelete;
}
@@ -0,0 +1,48 @@
package com.xiaowang.yuminailcore.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_user_shop_role")
/**
* UserShopRoleDO maps to a database table row. Mapper classes persist and query this object.
* Field and parameter names are kept consistent with the frontend/API payload to make tracing easier.
*/
public class UserShopRoleDO extends BaseEntity {
@TableField("user_id")
/**
* Field `userId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long userId;
@TableField("shop_id")
/**
* Field `shopId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long shopId;
@TableField("role_id")
/**
* Field `roleId` (Long): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Long roleId;
@TableField("status")
/**
* Field `status` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer status;
@TableField("is_delete")
@TableLogic
/**
* Field `isDelete` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer isDelete;
}
@@ -30,11 +30,20 @@ public class VipBenefitDO extends BaseEntity {
private String requiredVipLevel;
@TableField("level_rank")
/**
* Field `levelRank` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer levelRank;
@TableField("recharge_threshold")
/**
* Field `rechargeThreshold` (java.math.BigDecimal): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private java.math.BigDecimal rechargeThreshold;
@TableField("status")
/**
* Field `status` (Integer): data variable carried by this DTO/VO/entity. Check controller/service usage to see when it is filled.
*/
private Integer status;
}

Some files were not shown because too many files have changed in this diff Show More