diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/order/controller/front/OrderController.java b/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/order/controller/front/OrderController.java index 6f4b3663..397a57e2 100644 --- a/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/order/controller/front/OrderController.java +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/order/controller/front/OrderController.java @@ -3,7 +3,6 @@ package com.xiaowang.jayucloud.salon.core.modules.order.controller.front; import com.xiaowang.jayucloud.salon.core.annotation.OperationGuard; import com.xiaowang.jayucloud.salon.core.annotation.RequirePermission; import com.xiaowang.jayucloud.salon.core.common.Result; -import com.xiaowang.jayucloud.salon.core.modules.order.dto.CheckoutPreviewDTO; import com.xiaowang.jayucloud.salon.core.modules.order.dto.OrderDTO; import com.xiaowang.jayucloud.salon.core.modules.order.dto.OrderArtistChangeRejectDTO; import com.xiaowang.jayucloud.salon.core.modules.order.dto.OrderArtistChangeRequestDTO; @@ -14,7 +13,6 @@ import com.xiaowang.jayucloud.salon.core.modules.order.service.OrderService; import com.xiaowang.jayucloud.salon.core.modules.user.service.UserService; import com.xiaowang.jayucloud.salon.core.modules.security.support.SecurityAuditActions; import com.xiaowang.jayucloud.salon.core.modules.security.support.SecurityAuditSupport; -import com.xiaowang.jayucloud.salon.core.modules.order.vo.CheckoutPreviewVO; import com.xiaowang.jayucloud.salon.core.modules.order.vo.OrderArtistChangeOptionsVO; import com.xiaowang.jayucloud.salon.core.modules.order.vo.OrderArtistChangeRequestVO; import com.xiaowang.jayucloud.salon.core.modules.order.vo.OrderArtistReviewVO; @@ -73,12 +71,6 @@ public class OrderController { return Result.success(orderVO); } - @PostMapping("/checkout-preview") - public Result checkoutPreview(@RequestBody CheckoutPreviewDTO checkoutPreviewDTO, HttpServletRequest request) { - Long userId = (Long) request.getAttribute("userId"); - return Result.success(orderService.checkoutPreview(userId, checkoutPreviewDTO)); - } - @GetMapping("/list") /** * Load data by the supplied parameter. diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/order/service/OrderService.java b/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/order/service/OrderService.java index 228bf9fe..06bae02c 100644 --- a/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/order/service/OrderService.java +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/order/service/OrderService.java @@ -1,14 +1,12 @@ package com.xiaowang.jayucloud.salon.core.modules.order.service; import com.xiaowang.jayucloud.salon.core.modules.order.dto.OrderDTO; -import com.xiaowang.jayucloud.salon.core.modules.order.dto.CheckoutPreviewDTO; import com.xiaowang.jayucloud.salon.core.modules.order.dto.OrderArtistChangeRejectDTO; import com.xiaowang.jayucloud.salon.core.modules.order.dto.OrderArtistChangeRequestDTO; import com.xiaowang.jayucloud.salon.core.modules.order.dto.OrderArtistReviewSubmitDTO; import com.xiaowang.jayucloud.salon.core.modules.order.dto.OrderQuoteReplyDTO; import com.xiaowang.jayucloud.salon.core.modules.order.dto.OrderQuoteSubmitDTO; import com.xiaowang.jayucloud.salon.core.modules.artist.vo.ArtistCalendarAppointmentVO; -import com.xiaowang.jayucloud.salon.core.modules.order.vo.CheckoutPreviewVO; import com.xiaowang.jayucloud.salon.core.modules.order.vo.OrderArtistChangeOptionsVO; import com.xiaowang.jayucloud.salon.core.modules.order.vo.OrderArtistChangeRequestVO; import com.xiaowang.jayucloud.salon.core.modules.order.vo.OrderArtistReviewVO; @@ -31,11 +29,6 @@ public interface OrderService { */ OrderVO createOrder(Long userId, OrderDTO orderDTO); - /** - * Preview checkout pricing and coupon explanations without creating an order. - */ - CheckoutPreviewVO checkoutPreview(Long userId, CheckoutPreviewDTO checkoutPreviewDTO); - /** * 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. diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/order/service/impl/OrderServiceImpl.java b/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/order/service/impl/OrderServiceImpl.java index 83a6a7e0..3590454c 100644 --- a/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/order/service/impl/OrderServiceImpl.java +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/order/service/impl/OrderServiceImpl.java @@ -3,8 +3,8 @@ package com.xiaowang.jayucloud.salon.core.modules.order.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.xiaowang.jayucloud.salon.core.common.BusinessException; -import com.xiaowang.jayucloud.salon.core.modules.order.dto.CheckoutPreviewDTO; import com.xiaowang.jayucloud.salon.core.modules.order.dto.OrderDTO; +import com.xiaowang.jayucloud.salon.core.modules.order.dto.CheckoutPreviewDTO; import com.xiaowang.jayucloud.salon.core.modules.order.dto.OrderArtistChangeRejectDTO; import com.xiaowang.jayucloud.salon.core.modules.order.dto.OrderArtistChangeRequestDTO; import com.xiaowang.jayucloud.salon.core.modules.order.dto.OrderArtistReviewSubmitDTO; @@ -55,10 +55,10 @@ import com.xiaowang.jayucloud.salon.core.modules.order.support.OrderStatus; import com.xiaowang.jayucloud.salon.core.support.id.TimeOrderedSnowflakeIdGenerator; import com.xiaowang.jayucloud.salon.core.modules.shop.support.UserShopBindingSupport; import com.xiaowang.jayucloud.salon.core.modules.artist.vo.ArtistCalendarAppointmentVO; -import com.xiaowang.jayucloud.salon.core.modules.order.vo.CheckoutCouponPreviewVO; -import com.xiaowang.jayucloud.salon.core.modules.order.vo.CheckoutPreviewVO; import com.xiaowang.jayucloud.salon.core.modules.order.vo.CheckoutPreviewVO.CheckoutIssueVO; import com.xiaowang.jayucloud.salon.core.modules.order.vo.OrderArtistChangeOptionsVO; +import com.xiaowang.jayucloud.salon.core.modules.order.vo.CheckoutCouponPreviewVO; +import com.xiaowang.jayucloud.salon.core.modules.order.vo.CheckoutPreviewVO; import com.xiaowang.jayucloud.salon.core.modules.order.vo.OrderArtistChangeRequestVO; import com.xiaowang.jayucloud.salon.core.modules.order.vo.OrderArtistReviewVO; import com.xiaowang.jayucloud.salon.core.modules.order.vo.OrderItemVO; @@ -543,53 +543,6 @@ public class OrderServiceImpl implements OrderService { } } - @Override - public CheckoutPreviewVO checkoutPreview(Long userId, CheckoutPreviewDTO checkoutPreviewDTO) { - OrderDTO orderDTO = toOrderDTO(checkoutPreviewDTO); - CheckoutPricingContext pricingContext = buildCheckoutPricingContext(userId, orderDTO); - List bookingIssues = collectCheckoutBookingIssues(userId, orderDTO); - List availableCouponOptions = couponService.getAvailableCoupons( - userId, - pricingContext.getProductTagNames(), - pricingContext.getTotalAmount().doubleValue(), - pricingContext.getShopId() - ); - if (availableCouponOptions == null) { - availableCouponOptions = List.of(); - } - - List availableCoupons = availableCouponOptions.stream() - .map(coupon -> buildAvailableCouponPreview(coupon, pricingContext.getTotalAmount())) - .sorted(Comparator.comparing(CheckoutCouponPreviewVO::getDiscountAmount, Comparator.nullsLast(BigDecimal::compareTo)).reversed() - .thenComparing(CheckoutCouponPreviewVO::getEndTime, Comparator.nullsLast(LocalDateTime::compareTo))) - .toList(); - - CheckoutCouponPreviewVO bestCoupon = findBestCouponPreview(availableCoupons); - if (bestCoupon != null) { - bestCoupon.setBest(true); - } - - CheckoutCouponPreviewVO selectedCoupon = resolvePreviewSelectedCoupon(checkoutPreviewDTO, availableCoupons, bestCoupon); - BigDecimal savedAmount = selectedCoupon == null ? BigDecimal.ZERO : safeAmount(selectedCoupon.getDiscountAmount()); - BigDecimal payableAmount = pricingContext.getTotalAmount().subtract(savedAmount); - if (payableAmount.compareTo(BigDecimal.ZERO) < 0) { - payableAmount = BigDecimal.ZERO; - } - - CheckoutPreviewVO preview = new CheckoutPreviewVO(); - preview.setSubtotalAmount(scaleMoney(pricingContext.getTotalAmount())); - preview.setSavedAmount(scaleMoney(savedAmount)); - preview.setPayableAmount(scaleMoney(payableAmount)); - preview.setBestCoupon(bestCoupon); - preview.setAvailableCoupons(availableCoupons); - preview.setUnavailableCoupons(buildUnavailableCouponPreviews(availableCoupons, pricingContext)); - preview.setBookingAvailable(bookingIssues.isEmpty()); - preview.setBookingIssues(bookingIssues); - preview.setVipTip(buildVipTip(userId, pricingContext.getTotalAmount(), availableCoupons)); - preview.setSummaryText(buildCheckoutSummaryText(preview)); - return preview; - } - /** * 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. @@ -849,63 +802,6 @@ public class OrderServiceImpl implements OrderService { return buildOrderVO(order); } - private OrderDTO toOrderDTO(CheckoutPreviewDTO checkoutPreviewDTO) { - OrderDTO orderDTO = new OrderDTO(); - if (checkoutPreviewDTO == null) { - return orderDTO; - } - orderDTO.setCouponId(checkoutPreviewDTO.getCouponId()); - orderDTO.setCouponSourceType(checkoutPreviewDTO.getCouponSourceType()); - orderDTO.setRemark(checkoutPreviewDTO.getRemark()); - orderDTO.setItems(checkoutPreviewDTO.getItems()); - return orderDTO; - } - - private CheckoutPricingContext buildCheckoutPricingContext(Long userId, OrderDTO orderDTO) { - if (orderDTO == null || orderDTO.getItems() == null || orderDTO.getItems().isEmpty()) { - throw new RuntimeException("订单项不能为空"); - } - - List orderItemDTOs = orderDTO.getItems(); - Map requestedQuantityByProductId = buildRequestedQuantityMap(orderItemDTOs); - BigDecimal totalAmount = BigDecimal.ZERO; - Set selectedTagNames = new LinkedHashSet<>(); - Long shopId = null; - - for (OrderItemDTO orderItemDTO : orderItemDTOs) { - validateOrderQuantity(orderItemDTO.getQuantity()); - ProductDO product = productMapper.selectById(orderItemDTO.getProductId()); - if (product == null || Integer.valueOf(1).equals(product.getIsDelete())) { - throw new RuntimeException("商品不存在或已下架"); - } - - CartDO cartItem = cartMapper.selectByUserIdAndProductId(userId, product.getId()); - Integer requestedQuantity = requestedQuantityByProductId.get(product.getId()); - if (cartItem == null || Integer.valueOf(1).equals(cartItem.getIsDelete())) { - throw new RuntimeException("请先将商品加入购物车后再结算"); - } - if (cartItem.getQuantity() == null || requestedQuantity == null || cartItem.getQuantity() < requestedQuantity) { - throw new RuntimeException("购物车中的商品数量已变化,请刷新后重试"); - } - - if (shopId == null) { - shopId = product.getShopId(); - validateUserCanCreateOrderInShop(userId, shopId); - } else if (!shopId.equals(product.getShopId())) { - throw new RuntimeException("跨店铺商品请分开下单"); - } - - collectPreviewTagNames(selectedTagNames, product.getTags()); - BigDecimal price = product.getPrice() == null ? BigDecimal.ZERO : product.getPrice(); - totalAmount = totalAmount.add(price.multiply(BigDecimal.valueOf(orderItemDTO.getQuantity()))); - } - - if (totalAmount.compareTo(BigDecimal.ZERO) == 0) { - throw new RuntimeException("订单金额无效"); - } - return new CheckoutPricingContext(totalAmount, shopId, String.join(",", selectedTagNames)); - } - private List collectCheckoutBookingIssues(Long userId, OrderDTO orderDTO) { List issues = new ArrayList<>(); if (orderDTO == null || orderDTO.getItems() == null || orderDTO.getItems().isEmpty()) { diff --git a/JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/user/controller/front/UserControllerPhonePrivacyTest.java b/JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/user/controller/front/UserControllerPhonePrivacyTest.java index 3154a160..56ec4f1a 100644 --- a/JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/user/controller/front/UserControllerPhonePrivacyTest.java +++ b/JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/user/controller/front/UserControllerPhonePrivacyTest.java @@ -13,7 +13,6 @@ import com.xiaowang.jayucloud.salon.core.modules.security.support.AdminScopeHelp import com.xiaowang.jayucloud.salon.core.modules.system.service.LegalAgreementService; import com.xiaowang.jayucloud.salon.core.modules.user.entity.UserDO; import com.xiaowang.jayucloud.salon.core.modules.user.mapper.UserMapper; -import com.xiaowang.jayucloud.salon.core.modules.user.service.UserAssetService; import com.xiaowang.jayucloud.salon.core.modules.user.service.UserService; import com.xiaowang.jayucloud.salon.core.modules.user.vo.UserVO; import com.xiaowang.jayucloud.salon.core.support.id.TimeOrderedSnowflakeIdGenerator; @@ -39,7 +38,7 @@ class UserControllerPhonePrivacyTest { profile.setShopBusinessExpired(false); profile.setShopBusinessRemainingDays(66); when(userService.getCurrentUserInfo()).thenReturn(profile); - UserController controller = new UserController(userService, mock(UserAssetService.class), + UserController controller = new UserController(userService, mock(PrimaryObjectStorageService.class), mock(ChunkUploadService.class), mock(VerificationCodeService.class), mock(UserMapper.class), mock(AdminScopeHelper.class), mock(ShopRoleService.class), mock(TimeOrderedSnowflakeIdGenerator.class), @@ -57,7 +56,6 @@ class UserControllerPhonePrivacyTest { @Test void sendsPasswordCodeToVerifiedPhoneFromCurrentAccount() { UserService userService = mock(UserService.class); - UserAssetService userAssetService = mock(UserAssetService.class); PrimaryObjectStorageService primaryObjectStorageService = mock(PrimaryObjectStorageService.class); ChunkUploadService chunkUploadService = mock(ChunkUploadService.class); VerificationCodeService verificationCodeService = mock(VerificationCodeService.class); @@ -71,7 +69,7 @@ class UserControllerPhonePrivacyTest { LegalAgreementService legalAgreementService = mock(LegalAgreementService.class); AccountClosureService accountClosureService = mock(AccountClosureService.class); SecurityAuditLogService securityAuditLogService = mock(SecurityAuditLogService.class); - UserController controller = new UserController(userService, userAssetService, primaryObjectStorageService, + UserController controller = new UserController(userService, primaryObjectStorageService, chunkUploadService, verificationCodeService, userMapper, adminScopeHelper, shopRoleService, idGenerator, wechatMiniAuthService, objectStorageUrlSupport, requestThrottleService, legalAgreementService, accountClosureService, securityAuditLogService); @@ -96,7 +94,7 @@ class UserControllerPhonePrivacyTest { @Test void rejectsPasswordCodeRequestWithoutAuthenticatedUser() { - UserController controller = new UserController(mock(UserService.class), mock(UserAssetService.class), + UserController controller = new UserController(mock(UserService.class), mock(PrimaryObjectStorageService.class), mock(ChunkUploadService.class), mock(VerificationCodeService.class), mock(UserMapper.class), mock(AdminScopeHelper.class), mock(ShopRoleService.class), mock(TimeOrderedSnowflakeIdGenerator.class), diff --git a/JC-Salon-Frontend/src/api/order.ts b/JC-Salon-Frontend/src/api/order.ts index a7e79582..d6592caa 100644 --- a/JC-Salon-Frontend/src/api/order.ts +++ b/JC-Salon-Frontend/src/api/order.ts @@ -21,74 +21,11 @@ export interface OrderItem { * Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow. */ export interface CreateOrderRequest { - couponId?: IdType - couponSourceType?: string remark?: string clientRequestId?: string items: OrderItem[] } -export type CheckoutPreviewRequest = CreateOrderRequest - -export interface CheckoutCouponPreview { - id: IdType - couponId?: IdType - userCouponId?: IdType - sourceType?: string - couponName: string - couponType: number - couponTypeName?: string - discountValue?: number - minAmount?: number - reduceAmount?: number - discountAmount?: number - available?: boolean - best?: boolean - vipAuto?: boolean - displayText?: string - savingText?: string - unavailableReason?: string - startTime?: string - endTime?: string -} - -export interface CheckoutIssue { - code: string - message: string - itemId?: IdType - productId?: IdType - productTitle?: string -} - -export interface CheckoutPreview { - subtotalAmount: number - savedAmount: number - payableAmount: number - bestCoupon?: CheckoutCouponPreview - availableCoupons: CheckoutCouponPreview[] - unavailableCoupons: CheckoutCouponPreview[] - bookingAvailable?: boolean - bookingIssues?: CheckoutIssue[] - vipTip?: string - summaryText?: string -} - -export interface PaymentOrderVO { - id: IdType - payNo?: string - orderId: IdType - orderNo?: string - userId?: IdType - shopId?: IdType - channel?: string - status?: string - payAmount?: number - paidAmount?: number - payTime?: string - expireTime?: string - remark?: string -} - export interface OrderQuoteItem { orderItemId: IdType quotedPrice?: number @@ -147,14 +84,6 @@ export interface PageResult { size: number } -export interface GrowthSummaryVO { - userId?: IdType - growthValue?: number - levelName?: string - appointmentCount?: number - reviewCount?: number -} - export const afterSaleApi = { apply: async (data: AfterSaleApplyRequest): Promise => { return await api.post('/after-sale/apply', data) as unknown as AfterSaleVO @@ -164,12 +93,6 @@ export const afterSaleApi = { } } -export const growthApi = { - getSummary: async (): Promise => { - return await api.get('/growth/summary') as unknown as GrowthSummaryVO - } -} - /** * Purpose: ArtistCalendarAppointment supports order.ts by holding or executing the artist calendar appointment page or API role. * Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow. @@ -329,10 +252,6 @@ export const orderApi = { return api.post('/order/create', data) }, - checkoutPreview: async (data: CheckoutPreviewRequest): Promise => { - return await api.post('/order/checkout-preview', data) as unknown as CheckoutPreview - }, - replyQuote: async (orderId: IdType, data?: OrderQuoteReplyRequest): Promise => { return await api.post(`/order/${orderId}/quote/reply`, data || {}) as unknown as any }, diff --git a/JC-Salon-Frontend/src/style.css b/JC-Salon-Frontend/src/style.css index 62afd5e6..58b5be10 100644 --- a/JC-Salon-Frontend/src/style.css +++ b/JC-Salon-Frontend/src/style.css @@ -155,7 +155,7 @@ body { } .app-container--phone-shell :where(.nav-button, .icon-btn, .back-btn, .jayucloud-salon-icon-button) :where(.anticon), -.app-container--phone-shell :where(.header, .shop-topbar, .detail-header, .artist-topbar, .artist-list-topbar, .auth-topbar, .not-found-topbar, .cart-topbar, .vip-header) :where(.ant-btn .anticon, button .anticon), +.app-container--phone-shell :where(.header, .shop-topbar, .detail-header, .artist-topbar, .artist-list-topbar, .auth-topbar, .not-found-topbar) :where(.ant-btn .anticon, button .anticon), .app-container--admin :where(.mobile-icon-btn, .mobile-avatar-btn) :where(.anticon) { font-size: 21px !important; line-height: 1; diff --git a/JC-Salon-Frontend/src/utils/buy-now.test.ts b/JC-Salon-Frontend/src/utils/buy-now.test.ts deleted file mode 100644 index 0a6f7937..00000000 --- a/JC-Salon-Frontend/src/utils/buy-now.test.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { describe, expect, it } from 'vitest' - -import { BUY_NOW_MODE, getBuyNowProductIdFromQuery, isBuyNowCartItem } from './buy-now' - -describe('buy-now checkout mode', () => { - it('reads the target product id only when cart query is in buyNow mode', () => { - expect(getBuyNowProductIdFromQuery({ mode: BUY_NOW_MODE, productId: '1001' })).toBe('1001') - expect(getBuyNowProductIdFromQuery({ mode: 'cart', productId: '1001' })).toBe('') - }) - - it('uses the first query value when vue-router provides array values', () => { - expect(getBuyNowProductIdFromQuery({ mode: [BUY_NOW_MODE], productId: ['2002', '3003'] })).toBe('2002') - }) - - it('matches numeric and string product ids for cart selection', () => { - expect(isBuyNowCartItem(1001, '1001')).toBe(true) - expect(isBuyNowCartItem('1002', '1001')).toBe(false) - }) -}) diff --git a/JC-Salon-Frontend/src/utils/buy-now.ts b/JC-Salon-Frontend/src/utils/buy-now.ts deleted file mode 100644 index 1a3bbd2e..00000000 --- a/JC-Salon-Frontend/src/utils/buy-now.ts +++ /dev/null @@ -1,15 +0,0 @@ -export const BUY_NOW_MODE = 'buyNow' - -type QueryValue = string | string[] | null | undefined - -const firstQueryValue = (value: QueryValue) => Array.isArray(value) ? value[0] : value - -export const getBuyNowProductIdFromQuery = (query: Record) => { - const mode = firstQueryValue(query.mode as QueryValue) - const productId = firstQueryValue(query.productId as QueryValue) - return mode === BUY_NOW_MODE && productId ? String(productId) : '' -} - -export const isBuyNowCartItem = (itemProductId: unknown, buyNowProductId: string) => { - return Boolean(buyNowProductId) && String(itemProductId || '') === String(buyNowProductId) -} diff --git a/JC-Salon-Frontend/src/utils/request-signature.test.ts b/JC-Salon-Frontend/src/utils/request-signature.test.ts index 98bc65ee..1073cefd 100644 --- a/JC-Salon-Frontend/src/utils/request-signature.test.ts +++ b/JC-Salon-Frontend/src/utils/request-signature.test.ts @@ -21,7 +21,7 @@ describe('request signature', () => { const config = { method: 'post', baseURL: '/api', - url: '/order/checkout-preview', + url: '/order/42/quote/reply', headers: { 'Content-Type': 'application/json' }, @@ -36,7 +36,7 @@ describe('request signature', () => { const payloadHash = createHash('sha256').update(JSON.stringify({ items: [] })).digest('hex') const canonical = [ 'POST', - '/order/checkout-preview', + '/order/42/quote/reply', '1700000000000', '1700000000000-fallback-id', payloadHash diff --git a/JC-Salon-Frontend/tests/api/vnext-api-contracts.test.ts b/JC-Salon-Frontend/tests/api/vnext-api-contracts.test.ts index 27de897e..1eeaee70 100644 --- a/JC-Salon-Frontend/tests/api/vnext-api-contracts.test.ts +++ b/JC-Salon-Frontend/tests/api/vnext-api-contracts.test.ts @@ -15,14 +15,12 @@ import adminApi, { adminAfterSaleApi, adminArtistScheduleApi, adminAuthApi, - adminCampaignApi, adminDashboardApi, adminInventoryApi, - adminPaymentApi, adminWorkbenchRegistrationApi } from '../../src/api/admin' import api from '../../src/api' -import { afterSaleApi, growthApi } from '../../src/api/order' +import { afterSaleApi } from '../../src/api/order' type CapturedRequest = { method?: string @@ -85,12 +83,10 @@ describe('vNext API contracts', () => { await adminArtistScheduleApi.listSchedules({ artistId: 9, startDate: '2026-06-01', endDate: '2026-06-07' }) await adminArtistScheduleApi.saveSchedule({ artistId: 9, workDate: '2026-06-01', startTime: '09:00', endTime: '18:00' }) - await adminPaymentApi.manualConfirmOrder(42, 'cash verified') await adminAfterSaleApi.listAfterSales({ status: 'APPLIED', page: 1, size: 20 }) await adminAfterSaleApi.approveAfterSale(5, { auditReason: 'approved' }) await adminInventoryApi.saveItem({ itemName: 'Base Gel', category: 'gel', unit: 'bottle', stockQuantity: 12 }) await adminInventoryApi.adjustStock(7, { changeType: 'IN', changeQuantity: 3, remark: 'restock' }) - await adminCampaignApi.saveCampaign({ title: 'Summer Set', scene: 'HOME', status: 1 }) await adminDashboardApi.getOverview({ date: '2026-10-25', days: 7 }) await adminAuthApi.changePassword({ currentPassword: 'OldPass1!', newPassword: 'FreshPass2!' }) await adminWorkbenchRegistrationApi.list() @@ -100,12 +96,10 @@ describe('vNext API contracts', () => { expect(requests).toEqual([ { method: 'get', url: '/artist-schedule/list', params: { artistId: 9, startDate: '2026-06-01', endDate: '2026-06-07' }, data: undefined }, { method: 'post', url: '/artist-schedule/save', params: undefined, data: { artistId: 9, workDate: '2026-06-01', startTime: '09:00', endTime: '18:00' } }, - { method: 'post', url: '/payment/order/42/manual-confirm', params: { remark: 'cash verified' }, data: undefined }, { method: 'get', url: '/after-sale/list', params: { status: 'APPLIED', page: 1, size: 20 }, data: undefined }, { method: 'put', url: '/after-sale/5/approve', params: undefined, data: { auditReason: 'approved' } }, { method: 'post', url: '/inventory/save', params: undefined, data: { itemName: 'Base Gel', category: 'gel', unit: 'bottle', stockQuantity: 12 } }, { method: 'post', url: '/inventory/7/adjust', params: undefined, data: { changeType: 'IN', changeQuantity: 3, remark: 'restock' } }, - { method: 'post', url: '/campaign/save', params: undefined, data: { title: 'Summer Set', scene: 'HOME', status: 1 } }, { method: 'get', url: '/dashboard/overview', params: { date: '2026-10-25', days: 7 }, data: undefined }, { method: 'post', url: '/auth/password', params: undefined, data: { currentPassword: 'OldPass1!', newPassword: 'FreshPass2!' } }, { method: 'get', url: '/user/workbench/registration/list', params: undefined, data: undefined }, @@ -120,12 +114,10 @@ describe('vNext API contracts', () => { await afterSaleApi.apply({ orderId: 42, type: 'REFUND', reason: 'schedule changed', refundAmount: 88 }) await afterSaleApi.listMy({ page: 1, size: 5 }) - await growthApi.getSummary() expect(requests).toEqual([ { method: 'post', url: '/after-sale/apply', params: undefined, data: { orderId: 42, type: 'REFUND', reason: 'schedule changed', refundAmount: 88 } }, - { method: 'get', url: '/after-sale/my', params: { page: 1, size: 5 }, data: undefined }, - { method: 'get', url: '/growth/summary', params: undefined, data: undefined } + { method: 'get', url: '/after-sale/my', params: { page: 1, size: 5 }, data: undefined } ]) }) }) diff --git a/docs/scripts/Salon SIT上线整改与旧接口清理记录_20261101.md b/docs/scripts/Salon SIT上线整改与旧接口清理记录_20261101.md new file mode 100644 index 00000000..f3f4dd92 --- /dev/null +++ b/docs/scripts/Salon SIT上线整改与旧接口清理记录_20261101.md @@ -0,0 +1,46 @@ +# Salon SIT 上线整改与旧接口清理记录 + +更新时间:2026-11-01 + +## 范围 + +本次变更以 `dev` 工作区为基准,仅处理 `JC-Salon-*` 和 Salon 配置源,不修改 ArtList,不合并或推送 SIT,不连接实际 Nacos、数据库、微信后台、阿里云或对象存储。 + +## 已完成的代码整改 + +- 删除 Salon 余额、余额流水、模拟支付、手工确认支付、手工退款、购物车、优惠券、VIP、收藏、点赞、成长值和营销活动的 Controller、Gateway 路由、前端页面、API 封装及后台导航入口。 +- 删除旧的订单结算预览 HTTP 接口 `POST /order/checkout-preview`,并移除 Salon 前端对应的结算预览 API 和契约测试调用。 +- 删除 Salon 未被业务引用的 `buy-now` 购物车辅助文件和测试;ArtList 同名文件不变。 +- 清理 Salon 前端旧购物车/VIP 顶栏样式选择器。 +- 保留预约、补录、订单记录、服务进度、评价、改派、售后查询、客户、员工、门店、款式、库存、内容审核和经营驾驶舱能力。 +- 保留订单金额、支付状态、退款状态、优惠券快照等历史字段,以及冻结初始化 SQL 中的历史表和字段;本次不清库、不删表、不新增回退 SQL。 +- 保留订单创建内部兼容校验和历史数据映射。它们目前不是 Salon 前端入口,且预约与订单记录仍共享订单模型,贸然删除会破坏预约链路。 +- 删除 DEV、SIT、PROD Salon Gateway 白名单中的后台注册和后台门店选择入口。小程序侧的登录、注册和门店业务入口不受影响。 + +## 安全基线 + +- Gateway/Core 源码不再提供默认 JWT 密钥和默认 Nacos 密码,缺少部署密钥时启动失败。 +- CORS 使用显式来源;DEV 仅保留本地开发来源,SIT 仅允许 `https://sit.salon.yunail.art`。 +- 内容审核配置保持 DEV Mock、SIT/PROD fail-closed 约定;未配置真实微信审核时不会放行内容。 +- 迁移配置保持关闭自动 baseline、关闭 clean、校验已应用迁移和禁止 out-of-order。 + +## 验证结果 + +- Salon 前端单元测试:27 个测试文件、85 个测试通过;生产构建已通过。 +- Salon Core Maven 测试:93 个测试通过;干净编译已通过。 +- Salon Gateway Maven 编译:已通过;微信小程序 2 个测试通过,74 个 JavaScript 文件语法检查通过。 +- GitNexus 索引落后当前 HEAD 3 个提交;已对待删除的旧接口/辅助符号执行影响分析,并结合全仓文本引用确认。旧 `buy-now` 的高风险提示来自 ArtList 与 Salon 同名文件混合索引,实际 Salon 文件仅被其自身测试引用,ArtList 文件未改动。 + +## SIT 外部验收前置条件 + +以下项目不在本次代码提交中,未完成前不能宣称 SIT 已正式验收或可真实运营: + +1. 阿里云1 SSH、DNS、Nginx、WireGuard 回源和 Certbot 自动续签;包括 `sit.salon.yunail.art` 与 `sit.minio.yunail.art` 的公网 TLS/SAN、健康检查和 MinIO 9001 未暴露验证。 +2. SIT `flyway_schema_history` 只读核验:版本、checksum、失败迁移和非预期手工迁移。 +3. 微信内容审核真实 Provider:AppID、回调 HTTPS 地址、Token、EncodingAESKey、图片短时访问地址、签名解密和幂等回调。 +4. MinIO、七牛云、阿里云 OSS 三副本上传、签名读取、过期拒绝、失败重试和测试文件清理;以及 RabbitMQ SIT vhost、交换机、队列可用性。 +5. 数据库、Redis、RabbitMQ、MinIO、七牛云、OSS、Nacos 和 JWT 凭据轮换;新密钥不得写入仓库或工作流日志。 + +## 发布边界 + +本记录只说明当前 dev 工作区的代码整改和静态验证,不代表 SIT 已上线。合并、发布、数据库检查和外部依赖验收由负责人按现有 `dev -> sit -> prod` 流程执行。 diff --git a/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/gateway.yaml b/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/gateway.yaml index ad811e1b..bcdbc297 100644 --- a/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/gateway.yaml +++ b/nacos/namespaces/dev/jayucloud-salon/DEFAULT_GROUP/gateway.yaml @@ -134,14 +134,10 @@ jayucloud-salon: - /api/health/** - /api/error - /api/admin/auth/login - - /api/admin/auth/login-shops/** - /api/admin/auth/refresh - - /api/admin/auth/register - /admin/auth/login - - /admin/auth/login-shops/** - /admin/auth/refresh - /admin/api/auth/login - - /admin/api/auth/login-shops/** - /admin/api/auth/refresh slow-request: enabled: true diff --git a/nacos/namespaces/prod/jayucloud-salon/DEFAULT_GROUP/gateway.yaml b/nacos/namespaces/prod/jayucloud-salon/DEFAULT_GROUP/gateway.yaml index 65ccde93..7e59e31a 100644 --- a/nacos/namespaces/prod/jayucloud-salon/DEFAULT_GROUP/gateway.yaml +++ b/nacos/namespaces/prod/jayucloud-salon/DEFAULT_GROUP/gateway.yaml @@ -128,14 +128,10 @@ jayucloud-salon: - /api/health/** - /api/error - /api/admin/auth/login - - /api/admin/auth/login-shops/** - /api/admin/auth/refresh - - /api/admin/auth/register - /admin/auth/login - - /admin/auth/login-shops/** - /admin/auth/refresh - /admin/api/auth/login - - /admin/api/auth/login-shops/** - /admin/api/auth/refresh slow-request: enabled: true diff --git a/nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/gateway.yaml b/nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/gateway.yaml index 3c459e34..955e4ac6 100644 --- a/nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/gateway.yaml +++ b/nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/gateway.yaml @@ -128,14 +128,10 @@ jayucloud-salon: - /api/health/** - /api/error - /api/admin/auth/login - - /api/admin/auth/login-shops/** - /api/admin/auth/refresh - - /api/admin/auth/register - /admin/auth/login - - /admin/auth/login-shops/** - /admin/auth/refresh - /admin/api/auth/login - - /admin/api/auth/login-shops/** - /admin/api/auth/refresh slow-request: enabled: true