From bcc676cbf904490900b2603c6dfb0f5cf21e9c4f Mon Sep 17 00:00:00 2001
From: shinnosuke <tantao@1hoper.com>
Date: 星期一, 10 八月 2026 16:27:54 +0800
Subject: [PATCH] fix(portal): 商品列表展示人才权益价
---
talent-card-server/src/main/java/com/talentcard/server/business/portal/PortalService.java | 16 ++++++++++++++--
rencaika/services/portal.uts | 6 ++++--
talent-card-server/src/main/java/com/talentcard/server/business/portal/PortalController.java | 3 ++-
rencaika/pages/merchant/merchant.uvue | 2 +-
4 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/rencaika/pages/merchant/merchant.uvue b/rencaika/pages/merchant/merchant.uvue
index 66373ab..9e9d6ea 100644
--- a/rencaika/pages/merchant/merchant.uvue
+++ b/rencaika/pages/merchant/merchant.uvue
@@ -518,7 +518,7 @@
return
}
if (isApiConfigured() && /^\d+$/.test(merchantId.value) && !isMedicalMerchant.value && !isTransportMerchant.value) {
- getProducts(merchantId.value, 1, 20, (data: any) => {
+ getProducts(merchantId.value, talentId.value, 1, 20, (data: any) => {
const records: any[] = data != null && data.records instanceof Array ? data.records as any[] : []
const remotePackages: any[] = []
for (let index = 0; index < records.length; index++) {
diff --git a/rencaika/services/portal.uts b/rencaika/services/portal.uts
index 95db5ae..705f0b5 100644
--- a/rencaika/services/portal.uts
+++ b/rencaika/services/portal.uts
@@ -107,8 +107,10 @@
return request<any>({ path: getApiEndpoint('appMerchantDetail') + encodeURIComponent(merchantId), method: 'GET', skipAuth: true }, onSuccess, onError)
}
-export const getProducts = (merchantId: string, page: number, size: number, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
- return request<any>({ path: getApiEndpoint('appProducts'), method: 'GET', skipAuth: true, data: { merchantId: merchantId, page: page, size: size } }, onSuccess, onError)
+export const getProducts = (merchantId: string, talentId: string, page: number, size: number, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
+ const data: any = { merchantId: merchantId, page: page, size: size }
+ if (talentId != '') data.talentId = Number(talentId)
+ return request<any>({ path: getApiEndpoint('appProducts'), method: 'GET', skipAuth: true, data: data }, onSuccess, onError)
}
export const getProductDetail = (productId: string, talentId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
diff --git a/talent-card-server/src/main/java/com/talentcard/server/business/portal/PortalController.java b/talent-card-server/src/main/java/com/talentcard/server/business/portal/PortalController.java
index a31f311..2550f4e 100644
--- a/talent-card-server/src/main/java/com/talentcard/server/business/portal/PortalController.java
+++ b/talent-card-server/src/main/java/com/talentcard/server/business/portal/PortalController.java
@@ -178,10 +178,11 @@
public ApiResponse<PageResult<Map<String, Object>>> products(
@RequestParam(required = false) Long merchantId,
@RequestParam(required = false) String type,
+ @RequestParam(required = false) Long talentId,
@RequestParam(defaultValue = "1") int page,
@RequestParam(defaultValue = "10") int size
) {
- return ApiResponse.success(portalService.products(merchantId, type, page, size));
+ return ApiResponse.success(portalService.products(merchantId, type, talentId, page, size));
}
@GetMapping("/products/{id}")
diff --git a/talent-card-server/src/main/java/com/talentcard/server/business/portal/PortalService.java b/talent-card-server/src/main/java/com/talentcard/server/business/portal/PortalService.java
index 17025f0..b1fa8c8 100644
--- a/talent-card-server/src/main/java/com/talentcard/server/business/portal/PortalService.java
+++ b/talent-card-server/src/main/java/com/talentcard/server/business/portal/PortalService.java
@@ -755,7 +755,7 @@
}
@Transactional(readOnly = true)
- public PageResult<Map<String, Object>> products(Long merchantId, String type, int page, int size) {
+ public PageResult<Map<String, Object>> products(Long merchantId, String type, Long talentId, int page, int size) {
StringBuilder sql = new StringBuilder("""
select id, merchant_id, product_no, product_type, product_name, subtitle, cover_url,
original_price, sale_price, subsidy_amount, stock, sales_count, benefit_desc
@@ -779,7 +779,19 @@
args.add(type);
}
sql.append(" order by sort_no desc, id desc");
- return page(sql.toString(), countSql.toString(), page, size, args.toArray());
+ PageResult<Map<String, Object>> result = page(sql.toString(), countSql.toString(), page, size, args.toArray());
+ List<Map<String, Object>> records = result.records().stream().map(product -> {
+ Map<String, Object> item = new LinkedHashMap<>(product);
+ BigDecimal originalPrice = decimal(item.get("originalPrice"));
+ if (originalPrice.signum() <= 0) originalPrice = decimal(item.get("salePrice"));
+ BigDecimal personalizedPrice = personalizedProductPrice(item, talentId);
+ item.put("originalPrice", originalPrice);
+ item.put("salePrice", personalizedPrice);
+ item.put("personalized", talentId != null && personalizedPrice.compareTo(decimal(product.get("salePrice"))) != 0);
+ item.put("discountText", discountText(personalizedPrice, originalPrice));
+ return item;
+ }).toList();
+ return new PageResult<>(records, result.page(), result.size(), result.total());
}
private Map<String, Object> orderCouponProduct(Long merchantId, Long productId, String orderId) {
--
Gitblit v1.7.1