From 73483e7b0c439284d4c007b232e3acc81d820be7 Mon Sep 17 00:00:00 2001 From: xiaowang Date: Sun, 31 May 2026 18:36:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=9A=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=20YumiNail=20=E7=94=A8=E6=88=B7=E7=AB=AF=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 2 +- CLAUDE.md | 2 +- .../controller/CommentController.java | 46 +- .../controller/NailArtistController.java | 5 + .../xiaowang/yuminailcore/dto/CommentDTO.java | 12 + .../yuminailcore/entity/CommentDO.java | 12 + .../service/impl/CommentServiceImpl.java | 82 ++ .../impl/NailArtistInfoServiceImpl.java | 53 +- .../service/impl/ProductServiceImpl.java | 19 + .../service/impl/ShopServiceImpl.java | 61 +- .../xiaowang/yuminailcore/vo/CommentVO.java | 15 + .../xiaowang/yuminailcore/vo/ProductVO.java | 5 + .../yuminailcore/vo/ShopTrustProfileVO.java | 12 + .../src/main/resources/files/YumiNail.sql | 2 + YumiNail-Frontend/src/App.vue | 5 +- YumiNail-Frontend/src/api/comment.ts | 30 +- YumiNail-Frontend/src/api/nail-artist.ts | 23 + YumiNail-Frontend/src/api/product.ts | 1 + YumiNail-Frontend/src/api/shop.ts | 2 + .../src/components/BottomNav.vue | 14 +- .../src/components/SystemMessageCard.vue | 4 +- YumiNail-Frontend/src/router/index.ts | 6 + YumiNail-Frontend/src/style.css | 31 +- YumiNail-Frontend/src/styles/admin-mobile.css | 4 +- .../src/utils/comment-review.test.ts | 16 + YumiNail-Frontend/src/utils/comment-review.ts | 12 + .../src/views/AfterSaleApplyView.vue | 2 +- .../src/views/AfterSalesView.vue | 2 +- .../src/views/ArtistListView.vue | 340 +++++ .../src/views/ArtistProfileView.vue | 781 +++++++---- YumiNail-Frontend/src/views/AuthView.vue | 78 +- YumiNail-Frontend/src/views/CartView.vue | 1161 +++++++++++++---- YumiNail-Frontend/src/views/HelpView.vue | 2 +- YumiNail-Frontend/src/views/HomeView.vue | 122 +- YumiNail-Frontend/src/views/NotFoundView.vue | 73 +- .../src/views/NotificationsView.vue | 4 +- .../src/views/OrderDetailView.vue | 4 +- YumiNail-Frontend/src/views/OrderView.vue | 890 +++++++++---- .../src/views/ProductDetailView.vue | 914 +++++++++++-- .../src/views/ProductListView.vue | 225 ++-- YumiNail-Frontend/src/views/ProfileView.vue | 47 +- .../src/views/ServiceProgressView.vue | 2 +- .../src/views/ShopDetailView.vue | 1132 ++++++++++++++-- YumiNail-Frontend/src/views/VipCenterView.vue | 1063 ++++++++++++--- .../src/views/admin/AdminLayout.vue | 9 +- .../src/views/admin/AdminLoginView.vue | 2 +- docx/~$YumiNail页面重构功能清单.xlsx | Bin 165 -> 0 bytes scripts/sql/init/YumiNail.sql | 2 + .../20260531_comment_ratings_images.sql | 28 + 49 files changed, 6053 insertions(+), 1306 deletions(-) create mode 100644 YumiNail-Frontend/src/utils/comment-review.test.ts create mode 100644 YumiNail-Frontend/src/utils/comment-review.ts create mode 100644 YumiNail-Frontend/src/views/ArtistListView.vue delete mode 100644 docx/~$YumiNail页面重构功能清单.xlsx create mode 100644 scripts/sql/migrations/20260531_comment_ratings_images.sql diff --git a/AGENTS.md b/AGENTS.md index 47ee5054..fcafeba6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,7 +1,7 @@ # GitNexus — Code Intelligence -This project is indexed by GitNexus as **xiaowang** (14285 symbols, 29539 relationships, 300 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely. +This project is indexed by GitNexus as **xiaowang** (15795 symbols, 31793 relationships, 300 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely. > If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first. diff --git a/CLAUDE.md b/CLAUDE.md index 7cc60c88..e392f45b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,7 +1,7 @@ # GitNexus — Code Intelligence -This project is indexed by GitNexus as **xiaowang** (14285 symbols, 29539 relationships, 300 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely. +This project is indexed by GitNexus as **xiaowang** (15795 symbols, 31793 relationships, 300 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely. > If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first. diff --git a/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/controller/CommentController.java b/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/controller/CommentController.java index 59e46782..57b65f8a 100644 --- a/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/controller/CommentController.java +++ b/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/controller/CommentController.java @@ -1,11 +1,19 @@ package com.xiaowang.yuminailcore.controller; +import com.xiaowang.yuminailcore.annotation.OperationGuard; import com.xiaowang.yuminailcore.common.Result; import com.xiaowang.yuminailcore.dto.CommentDTO; -import com.xiaowang.yuminailcore.vo.CommentVO; +import com.xiaowang.yuminailcore.dto.ObjectStorageFileDTO; import com.xiaowang.yuminailcore.service.CommentService; +import com.xiaowang.yuminailcore.service.MinioService; +import com.xiaowang.yuminailcore.service.ObjectStorageFileService; +import com.xiaowang.yuminailcore.support.id.TimeOrderedSnowflakeIdGenerator; +import com.xiaowang.yuminailcore.support.security.UploadSecurityValidator; +import com.xiaowang.yuminailcore.vo.CommentVO; +import com.xiaowang.yuminailcore.vo.ObjectStorageFileVO; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import java.util.List; @@ -25,6 +33,10 @@ public class CommentController { * Variable `commentService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls. */ private final CommentService commentService; + private final ObjectStorageFileService objectStorageFileService; + private final MinioService minioService; + private final TimeOrderedSnowflakeIdGenerator snowflakeIdGenerator; + private final UploadSecurityValidator uploadSecurityValidator; /** * 创建评论 @@ -39,6 +51,38 @@ public class CommentController { return Result.success(id); } + @PostMapping("/upload-image") + @OperationGuard(action = "comment-image-upload", ttlSeconds = 15, message = "图片正在上传中,请勿重复操作") + public Result uploadCommentImage(HttpServletRequest request, @RequestParam("file") MultipartFile file) { + Long userId = (Long) request.getAttribute("userId"); + if (userId == null) { + return Result.error("请先登录后再上传评价图片"); + } + try { + uploadSecurityValidator.validate(file); + String originalFilename = file.getOriginalFilename(); + if (originalFilename == null || originalFilename.isEmpty()) { + originalFilename = "comment-image"; + } + String fileExtension = originalFilename == null || !originalFilename.contains(".") + ? "" + : originalFilename.substring(originalFilename.lastIndexOf(".")); + String objectName = snowflakeIdGenerator.nextIdString() + fileExtension; + String fileUrl = minioService.uploadFile(file, objectName); + + ObjectStorageFileDTO dto = new ObjectStorageFileDTO(); + dto.setFileName(originalFilename); + dto.setFileUrl(fileUrl); + dto.setStatus(1); + + Long fileId = objectStorageFileService.createObjectStorageFile(dto); + return Result.success(objectStorageFileService.getObjectStorageFileById(fileId)); + } catch (Exception e) { + e.printStackTrace(); + return Result.error("评价图片上传失败: " + e.getMessage()); + } + } + /** * 更新评论 * diff --git a/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/controller/NailArtistController.java b/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/controller/NailArtistController.java index 67246b92..a6f50896 100644 --- a/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/controller/NailArtistController.java +++ b/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/controller/NailArtistController.java @@ -36,6 +36,11 @@ public class NailArtistController { List nailArtistInfoDTOList = nailArtistInfoService.getAllAvailableNailArtists(); return Result.success(nailArtistInfoDTOList); } + + @GetMapping("/list/shop/{shopId}") + public Result> listByShopId(@PathVariable Long shopId) { + return Result.success(nailArtistInfoService.getByShopId(shopId)); + } /** * 根据用户ID获取美甲师信息(前台使用) diff --git a/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/dto/CommentDTO.java b/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/dto/CommentDTO.java index f1664d72..6564e496 100644 --- a/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/dto/CommentDTO.java +++ b/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/dto/CommentDTO.java @@ -2,6 +2,8 @@ package com.xiaowang.yuminailcore.dto; import lombok.Data; +import java.util.List; + /** * 用户评论信息表 DTO * 用于评论信息的传输 @@ -36,4 +38,14 @@ public class CommentDTO { * 父级评论ID(0表示为根评论) */ private Long parentCommentId; + + /** + * 评论评分:1-5星,根评论使用 + */ + private Integer ratingScore; + + /** + * 评论图片文件ID集合,根评论使用 + */ + private List imageFileIds; } diff --git a/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/entity/CommentDO.java b/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/entity/CommentDO.java index 881f177a..c95da40b 100644 --- a/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/entity/CommentDO.java +++ b/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/entity/CommentDO.java @@ -47,6 +47,18 @@ public class CommentDO extends BaseEntity { @TableField("parent_comment_id") private Long parentCommentId; + /** + * 评论评分:1-5星 + */ + @TableField("rating_score") + private Integer ratingScore; + + /** + * 评论图片文件ID集合,多个ID以逗号分隔 + */ + @TableField("image_file_ids") + private String imageFileIds; + /** * 评论点赞数 */ diff --git a/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/service/impl/CommentServiceImpl.java b/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/service/impl/CommentServiceImpl.java index 3cd74a35..efe591b8 100644 --- a/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/service/impl/CommentServiceImpl.java +++ b/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/service/impl/CommentServiceImpl.java @@ -12,7 +12,11 @@ import com.xiaowang.yuminailcore.mapper.ProductMapper; import com.xiaowang.yuminailcore.mapper.ShopMapper; import com.xiaowang.yuminailcore.mapper.UserMapper; import com.xiaowang.yuminailcore.service.CommentService; +import com.xiaowang.yuminailcore.service.MinioService; +import com.xiaowang.yuminailcore.service.ObjectStorageFileService; +import com.xiaowang.yuminailcore.support.ObjectStorageUrlSupport; import com.xiaowang.yuminailcore.vo.CommentVO; +import com.xiaowang.yuminailcore.vo.ObjectStorageFileVO; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; @@ -21,6 +25,7 @@ import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -51,6 +56,9 @@ public class CommentServiceImpl extends ServiceImpl im * Variable `productMapper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls. */ private final ProductMapper productMapper; + private final ObjectStorageFileService objectStorageFileService; + private final MinioService minioService; + private final ObjectStorageUrlSupport objectStorageUrlSupport; @Override /** @@ -137,11 +145,16 @@ public class CommentServiceImpl extends ServiceImpl im } } CommentDO commentDO = new CommentDO(); + boolean rootComment = parentCommentId == null; commentDO.setUserId(currentUserId); commentDO.setShopId(shopId); commentDO.setProductId(productId); commentDO.setCommentContent(content); commentDO.setParentCommentId(parentCommentId); + if (rootComment) { + commentDO.setRatingScore(normalizeRatingScore(commentDTO.getRatingScore())); + commentDO.setImageFileIds(joinImageFileIds(commentDTO.getImageFileIds())); + } commentDO.setLikeCount(0); commentDO.setIsDelete(0); commentMapper.insert(commentDO); @@ -410,6 +423,10 @@ public class CommentServiceImpl extends ServiceImpl im commentVO.setCommentContent(commentDO.getCommentContent()); commentVO.setParentCommentId(commentDO.getParentCommentId()); commentVO.setLikeCount(commentDO.getLikeCount()); + commentVO.setRatingScore(commentDO.getRatingScore()); + List imageFileIds = parseImageFileIds(commentDO.getImageFileIds()); + commentVO.setImageFileIds(imageFileIds); + commentVO.setImageUrls(resolveImageUrls(imageFileIds)); commentVO.setCreateTime(commentDO.getCreateTime()); commentVO.setUpdateTime(commentDO.getUpdateTime()); /** @@ -492,6 +509,71 @@ public class CommentServiceImpl extends ServiceImpl im } } + private Integer normalizeRatingScore(Integer ratingScore) { + if (ratingScore == null) { + return 5; + } + return Math.max(1, Math.min(5, ratingScore)); + } + + private String joinImageFileIds(List imageFileIds) { + if (imageFileIds == null || imageFileIds.isEmpty()) { + return null; + } + return imageFileIds.stream() + .filter(id -> id != null && id > 0) + .distinct() + .limit(6) + .map(String::valueOf) + .collect(Collectors.joining(",")); + } + + private List parseImageFileIds(String imageFileIds) { + List result = new ArrayList<>(); + if (!StringUtils.hasText(imageFileIds)) { + return result; + } + for (String token : imageFileIds.split(",")) { + if (!StringUtils.hasText(token)) { + continue; + } + try { + Long id = Long.valueOf(token.trim()); + if (id > 0) { + result.add(id); + } + } catch (NumberFormatException ignored) { + // Ignore malformed legacy tokens. + } + } + return new ArrayList<>(new LinkedHashSet<>(result)); + } + + private List resolveImageUrls(List imageFileIds) { + if (imageFileIds == null || imageFileIds.isEmpty()) { + return new ArrayList<>(); + } + Map fileMap = objectStorageFileService.getObjectStorageFileMapByIds(new LinkedHashSet<>(imageFileIds)); + List urls = new ArrayList<>(); + for (Long imageFileId : imageFileIds) { + ObjectStorageFileVO fileVO = fileMap.get(imageFileId); + if (fileVO == null || !StringUtils.hasText(fileVO.getFileUrl())) { + continue; + } + String objectName = objectStorageUrlSupport.extractObjectName(fileVO.getFileUrl()); + if (!StringUtils.hasText(objectName)) { + urls.add(fileVO.getFileUrl()); + continue; + } + try { + urls.add(minioService.getPresignedUrl(objectName, 60)); + } catch (Exception ignored) { + urls.add(fileVO.getFileUrl()); + } + } + return urls; + } + /** * Run business method `activeQuery`. * Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result. diff --git a/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/service/impl/NailArtistInfoServiceImpl.java b/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/service/impl/NailArtistInfoServiceImpl.java index be4b737e..4159107d 100644 --- a/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/service/impl/NailArtistInfoServiceImpl.java +++ b/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/service/impl/NailArtistInfoServiceImpl.java @@ -156,17 +156,21 @@ public class NailArtistInfoServiceImpl extends ServiceImpl users = userMapper.selectList(new LambdaQueryWrapper() .in(UserDO::getId, serviceUserIds) - .in(UserDO::getType, List.of(2, 3)) - .eq(UserDO::getIsDelete, 0)); + .eq(UserDO::getType, 3) + .eq(UserDO::getStatus, 1) + .eq(UserDO::getIsDelete, 0) + .orderByAsc(UserDO::getCreateTime) + .orderByAsc(UserDO::getId)); List result = new ArrayList<>(); ShopDO shop = shopMapper.selectById(shopId); for (UserDO user : users) { NailArtistInfoDTO dto = getByUserId(user.getId()); - if (dto != null && isVisibleServiceUser(dto)) { - dto.setShopId(shopId); - dto.setShopName(shop == null ? null : shop.getShopName()); - result.add(dto); + if (dto == null) { + dto = buildFallbackArtistInfo(user); } + dto.setShopId(shopId); + dto.setShopName(shop == null ? null : shop.getShopName()); + result.add(dto); } return result; } @@ -418,6 +422,32 @@ public class NailArtistInfoServiceImpl extends ServiceImpl shopOptions = userShopBindingSupport.listShopOptionsByUserId(user.getId(), true, true); + if (!shopOptions.isEmpty()) { + ShopSimpleVO primaryShop = shopOptions.get(0); + dto.setShopId(primaryShop.getId()); + dto.setShopName(primaryShop.getShopName()); + } else if (user.getShopId() != null && user.getShopId() > 0) { + ShopDO shop = shopMapper.selectById(user.getShopId()); + if (shop != null) { + dto.setShopId(shop.getId()); + dto.setShopName(shop.getShopName()); + } + } + return dto; + } + /** * Run business method `isVisibleServiceUser`. * Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result. @@ -463,10 +493,17 @@ public class NailArtistInfoServiceImpl extends ServiceImpl im * Usage: reference this field from the owning layer and pass validated inputs before reading or updating related state. */ private static final int MAX_PUBLIC_PAGE_SIZE = 30; + private static final Pattern DURATION_PATTERN = Pattern.compile("(\\d+)"); + private static final long DEFAULT_SERVICE_DURATION_MINUTES = 60L; /** * Variable `productMapper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls. */ @@ -451,6 +455,7 @@ public class ProductServiceImpl extends ServiceImpl im productVO.setLikeCount(productDO.getLikeCount()); productVO.setCollectCount(productDO.getCollectCount()); productVO.setApproximateDuration(productDO.getApproximateDuration()); + productVO.setServiceDurationMinutes(resolveServiceDurationMinutes(productDO.getApproximateDuration())); String validBookableArtists = bookableArtistSupport.filterValidBookableArtists(productDO.getShopId(), productDO.getBookableArtists()); productVO.setBookableArtists(productDO.getBookableArtists()); productVO.setAvailableBookableArtistCount(countBookableArtists(validBookableArtists)); @@ -489,6 +494,20 @@ public class ProductServiceImpl extends ServiceImpl im return productVO; } + private long resolveServiceDurationMinutes(String approximateDuration) { + if (!StringUtils.hasText(approximateDuration)) { + return DEFAULT_SERVICE_DURATION_MINUTES; + } + Matcher matcher = DURATION_PATTERN.matcher(approximateDuration); + if (matcher.find()) { + try { + return Math.max(1L, Long.parseLong(matcher.group(1))); + } catch (NumberFormatException ignored) { + } + } + return DEFAULT_SERVICE_DURATION_MINUTES; + } + /** * Run business method `buildEnrichmentContext`. * Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result. diff --git a/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/service/impl/ShopServiceImpl.java b/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/service/impl/ShopServiceImpl.java index 073e0c83..753acfd5 100644 --- a/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/service/impl/ShopServiceImpl.java +++ b/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/service/impl/ShopServiceImpl.java @@ -23,8 +23,10 @@ import com.xiaowang.yuminailcore.mapper.TagMapper; import com.xiaowang.yuminailcore.mapper.UserCouponMapper; import com.xiaowang.yuminailcore.service.CouponService; import com.xiaowang.yuminailcore.service.MapService; +import com.xiaowang.yuminailcore.service.NailArtistInfoService; import com.xiaowang.yuminailcore.service.ObjectStorageFileService; import com.xiaowang.yuminailcore.service.ShopService; +import com.xiaowang.yuminailcore.support.ObjectStorageUrlSupport; import com.xiaowang.yuminailcore.support.ShopThemeSupport; import com.xiaowang.yuminailcore.support.UserShopBindingSupport; import com.xiaowang.yuminailcore.support.cache.MultiLevelCacheService; @@ -81,6 +83,7 @@ public class ShopServiceImpl extends ServiceImpl implements * Usage: reference this field from the owning layer and pass validated inputs before reading or updating related state. */ private static final String DISABLED_SHOP_ARCHIVED_MESSAGE = "停用店铺已封存,仅允许重新启用"; + private static final Set FEATURED_PRODUCT_TAG_NAMES = Set.of("特色作品", "热门"); /** * Variable `shopMapper`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls. */ @@ -117,10 +120,15 @@ public class ShopServiceImpl extends ServiceImpl implements * Variable `objectStorageFileService`: Spring-injected collaborator used by this class to resolve public image URLs for trust cards. */ private final ObjectStorageFileService objectStorageFileService; + /** + * Variable `objectStorageUrlSupport`: converts stored object URLs into frontend-accessible signed URLs. + */ + private final ObjectStorageUrlSupport objectStorageUrlSupport; /** * Variable `userShopBindingSupport`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls. */ private final UserShopBindingSupport userShopBindingSupport; + private final NailArtistInfoService nailArtistInfoService; /** * Variable `multiLevelCacheService`: Spring-injected collaborator used by this class to finish database access, validation, or downstream calls. */ @@ -292,6 +300,7 @@ public class ShopServiceImpl extends ServiceImpl implements } long productCount = countActiveProducts(id); + long artistCount = countShopArtists(id); List featuredProducts = listFeaturedProducts(id); List recentReviews = listSubmittedReviews(id, 3); BigDecimal averageRating = calculateAverageRating(id); @@ -317,6 +326,7 @@ public class ShopServiceImpl extends ServiceImpl implements ShopTrustProfileVO.Stats stats = new ShopTrustProfileVO.Stats(); stats.setProductCount(productCount); + stats.setArtistCount(artistCount); stats.setReviewCount(reviewCount); stats.setAverageRating(averageRating); stats.setRecentReviewCount(recentReviews.size()); @@ -453,14 +463,23 @@ public class ShopServiceImpl extends ServiceImpl implements return count == null ? 0L : count; } + private long countShopArtists(Long shopId) { + return nailArtistInfoService.getByShopId(shopId).size(); + } + /** * Purpose: listFeaturedProducts returns representative active products for shop detail trust cards. * Usage: render at most three products and navigate to product detail when tapped. */ private List listFeaturedProducts(Long shopId) { + Set featuredTagTokens = findFeaturedProductTagTokens(shopId); + if (featuredTagTokens.isEmpty()) { + return Collections.emptyList(); + } return productMapper.selectList(Wrappers.lambdaQuery(ProductDO.class) .eq(ProductDO::getShopId, shopId) .eq(ProductDO::getIsDelete, 0) + .and(wrapper -> applyProductTagTokenConditions(wrapper, featuredTagTokens)) .orderByDesc(ProductDO::getCollectCount) .orderByDesc(ProductDO::getLikeCount) .orderByDesc(ProductDO::getCreateTime) @@ -470,6 +489,45 @@ public class ShopServiceImpl extends ServiceImpl implements .collect(Collectors.toList()); } + private Set findFeaturedProductTagTokens(Long shopId) { + Set tokens = new LinkedHashSet<>(FEATURED_PRODUCT_TAG_NAMES); + List tags = tagMapper.selectList(Wrappers.lambdaQuery(TagDO.class) + .eq(TagDO::getIsDelete, 0) + .and(wrapper -> wrapper.eq(TagDO::getShopId, shopId) + .or() + .isNull(TagDO::getShopId) + .or() + .eq(TagDO::getShopId, 0L)) + .and(wrapper -> wrapper.in(TagDO::getTagName, FEATURED_PRODUCT_TAG_NAMES) + .or() + .in(TagDO::getDisplayName, FEATURED_PRODUCT_TAG_NAMES))); + tags.stream() + .map(TagDO::getId) + .filter(Objects::nonNull) + .map(String::valueOf) + .forEach(tokens::add); + return tokens.stream() + .filter(StringUtils::hasText) + .collect(Collectors.toCollection(LinkedHashSet::new)); + } + + private void applyProductTagTokenConditions(LambdaQueryWrapper wrapper, Set tagTokens) { + boolean appended = false; + for (String tagToken : tagTokens) { + if (!StringUtils.hasText(tagToken)) { + continue; + } + if (appended) { + wrapper.or(); + } + wrapper.apply("FIND_IN_SET({0}, REPLACE(tags, ';', ','))", tagToken); + appended = true; + } + if (!appended) { + wrapper.apply("1 = 0"); + } + } + /** * Purpose: listSubmittedReviews loads privacy-safe submitted review rows for the shop. * Usage: only status=1 reviews should feed public trust display. @@ -538,6 +596,7 @@ public class ShopServiceImpl extends ServiceImpl implements featured.setAvailableBookableArtistCount(artistCount); featured.setBookingHint(artistCount > 0 ? artistCount + " 位美甲师可预约" : "到店后由门店安排美甲师"); featured.setImageUrl(resolveFirstImageUrl(product.getImageFileIds(), fileMap)); + featured.setImageFileIds(product.getImageFileIds()); return featured; } @@ -634,7 +693,7 @@ public class ShopServiceImpl extends ServiceImpl implements for (Long fileId : fileIds) { ObjectStorageFileVO file = fileMap.get(fileId); if (file != null && StringUtils.hasText(file.getFileUrl())) { - urls.add(file.getFileUrl()); + urls.add(objectStorageUrlSupport.toAccessibleUrl(file.getFileUrl())); } } return urls; diff --git a/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/vo/CommentVO.java b/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/vo/CommentVO.java index d9393c32..cb7a0c52 100644 --- a/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/vo/CommentVO.java +++ b/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/vo/CommentVO.java @@ -70,6 +70,21 @@ public class CommentVO { */ private Integer likeCount; + /** + * 评论评分:1-5星 + */ + private Integer ratingScore; + + /** + * 评论图片文件ID集合 + */ + private List imageFileIds; + + /** + * 评论图片展示链接 + */ + private List imageUrls; + /** * 评论创建时间 */ diff --git a/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/vo/ProductVO.java b/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/vo/ProductVO.java index 6d6248e7..bdb20c5b 100644 --- a/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/vo/ProductVO.java +++ b/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/vo/ProductVO.java @@ -97,6 +97,11 @@ public class ProductVO { */ private String approximateDuration; + /** + * 实际用于预约排期计算的服务时长(分钟) + */ + private Long serviceDurationMinutes; + /** * 可预约的美甲师ID集合,多个ID以逗号分隔 */ diff --git a/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/vo/ShopTrustProfileVO.java b/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/vo/ShopTrustProfileVO.java index b7ad3208..5aa00e1d 100644 --- a/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/vo/ShopTrustProfileVO.java +++ b/YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/vo/ShopTrustProfileVO.java @@ -115,6 +115,12 @@ public class ShopTrustProfileVO { */ private Long productCount = 0L; + /** + * Purpose: artistCount is the number of active nail artist users bound to this shop. + * Usage: render as the staff confidence signal on shop detail pages. + */ + private Long artistCount = 0L; + /** * Purpose: recentReviewCount is the number of review cards included in this response. * Usage: clients use it for section labels and empty states. @@ -146,6 +152,12 @@ public class ShopTrustProfileVO { */ private String imageUrl; + /** + * Purpose: imageFileIds provides product image file ids for clients that need signed image URLs. + * Usage: clients may resolve the first id into a stable thumbnail URL. + */ + private String imageFileIds; + /** * Purpose: price carries the current product price. * Usage: show it as a current quote, not as historical order price. diff --git a/YumiNail-Core/src/main/resources/files/YumiNail.sql b/YumiNail-Core/src/main/resources/files/YumiNail.sql index 906d175f..a681f942 100644 --- a/YumiNail-Core/src/main/resources/files/YumiNail.sql +++ b/YumiNail-Core/src/main/resources/files/YumiNail.sql @@ -85,6 +85,8 @@ create table t_comment product_id bigint unsigned default 0 null comment '关联商品表主键(0表示非商品评论)', comment_content text not null comment '评论内容', parent_comment_id bigint unsigned default 0 null comment '父级评论ID(0表示为根评论)', + rating_score tinyint unsigned default 5 null comment '评论评分:1-5星', + image_file_ids text null comment '评论图片文件ID集合,多个ID以逗号分隔', like_count int unsigned default 0 null comment '评论点赞数', create_time datetime default CURRENT_TIMESTAMP not null comment '评论创建时间', update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '评论更新时间', diff --git a/YumiNail-Frontend/src/App.vue b/YumiNail-Frontend/src/App.vue index 4f0d7874..9ecb3415 100644 --- a/YumiNail-Frontend/src/App.vue +++ b/YumiNail-Frontend/src/App.vue @@ -78,6 +78,7 @@ const adminThemeRefreshOptions = { mode: 'admin' as const } const customerThemeRefreshOptions = { mode: 'customer' as const } const isAdminShell = computed(() => route.path.startsWith('/admin') || route.matched.some(r => r.meta.isAdmin)) +const bottomNavRouteNames = new Set(['home', 'products', 'cart', 'profile']) /** isHiddenNav is a reactive state variable used by the template and event handlers. */ const isHiddenNav = computed(() => { @@ -85,11 +86,11 @@ const isHiddenNav = computed(() => { return true } - if (route.path === '/' || isAdminShell.value) { + if (isAdminShell.value) { return true } - return route.matched.some(r => r.meta.hideNav) || route.matched.some(r => r.meta.isAdmin) + return !bottomNavRouteNames.has(String(route.name || '')) }) /** diff --git a/YumiNail-Frontend/src/api/comment.ts b/YumiNail-Frontend/src/api/comment.ts index db8e3e06..436e95a8 100644 --- a/YumiNail-Frontend/src/api/comment.ts +++ b/YumiNail-Frontend/src/api/comment.ts @@ -21,11 +21,30 @@ export interface CommentVO { parentCommentId?: IdType parentCommentContent?: string likeCount?: number + ratingScore?: number + imageFileIds?: IdType[] + imageUrls?: string[] createTime?: string updateTime?: string replies?: CommentVO[] } +export interface CommentCreateRequest { + productId: IdType + shopId?: IdType | null + parentCommentId?: IdType | null + commentContent: string + ratingScore?: number + imageFileIds?: IdType[] +} + +export interface CommentImageFileVO { + id: IdType + fileName?: string + fileUrl?: string + createTime?: string +} + /** * commentApi groups all API calls for this page domain. * Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script. @@ -44,9 +63,18 @@ export const commentApi = { * Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller. * @param data: { productId: IdType; shopId?: IdType | null; parentCommentId?: IdType | null; commentContent: string } caller-supplied value for `data: { productId: IdType; shopId?: IdType | null; parentCommentId?: IdType | null; commentContent: string }` */ - create: (data: { productId: IdType; shopId?: IdType | null; parentCommentId?: IdType | null; commentContent: string }) => { + create: (data: CommentCreateRequest) => { return api.post('/comment/create', data) as unknown as Promise }, + uploadImage: (file: File) => { + const formData = new FormData() + formData.append('file', file) + return api.post('/comment/upload-image', formData, { + headers: { + 'Content-Type': 'multipart/form-data' + } + }) as unknown as Promise + }, /** * `delete` API call. Use this method from the page script to invoke the backend endpoint tied to this feature. * Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller. diff --git a/YumiNail-Frontend/src/api/nail-artist.ts b/YumiNail-Frontend/src/api/nail-artist.ts index 633248fe..b45a06ef 100644 --- a/YumiNail-Frontend/src/api/nail-artist.ts +++ b/YumiNail-Frontend/src/api/nail-artist.ts @@ -36,6 +36,26 @@ export interface NailArtistReviewVO { submittedAt?: string } +export interface NailArtistListItemVO { + id?: IdType + userId?: IdType + identity?: string + experience?: number + skills?: string + rating?: number | string + status?: number + participateProduction?: number + workStartTime?: string + workEndTime?: string + userType?: number + userTypeName?: string + portfolio?: string + nickname?: string + shopId?: IdType + shopName?: string + signature?: string +} + export interface NailArtistProfileVO { artistId: IdType artistName?: string @@ -65,5 +85,8 @@ export const nailArtistApi = { }, listReviews: async (artistId: IdType): Promise => { return await api.get(`/nail-artist/${artistId}/reviews`) as unknown as NailArtistReviewVO[] + }, + listByShopId: async (shopId: IdType): Promise => { + return await api.get(`/nail-artist/list/shop/${shopId}`) as unknown as NailArtistListItemVO[] } } diff --git a/YumiNail-Frontend/src/api/product.ts b/YumiNail-Frontend/src/api/product.ts index 1deca5d6..292db2ac 100644 --- a/YumiNail-Frontend/src/api/product.ts +++ b/YumiNail-Frontend/src/api/product.ts @@ -24,6 +24,7 @@ export interface ProductVO { price: number estimatedTime: number approximateDuration?: string + serviceDurationMinutes?: number bookableArtists?: string availableBookableArtistCount?: number bookableArtistRestricted?: boolean diff --git a/YumiNail-Frontend/src/api/shop.ts b/YumiNail-Frontend/src/api/shop.ts index 0dfdba49..6d99ad2c 100644 --- a/YumiNail-Frontend/src/api/shop.ts +++ b/YumiNail-Frontend/src/api/shop.ts @@ -65,6 +65,7 @@ export interface ShopTrustProfileVO { averageRating?: number reviewCount?: number productCount?: number + artistCount?: number recentReviewCount?: number } environmentImages?: string[] @@ -72,6 +73,7 @@ export interface ShopTrustProfileVO { id: IdType title?: string imageUrl?: string + imageFileIds?: string price?: number likeCount?: number collectCount?: number diff --git a/YumiNail-Frontend/src/components/BottomNav.vue b/YumiNail-Frontend/src/components/BottomNav.vue index e39a68db..75b76ccc 100644 --- a/YumiNail-Frontend/src/components/BottomNav.vue +++ b/YumiNail-Frontend/src/components/BottomNav.vue @@ -4,7 +4,7 @@