From 681b1630451a8bdaff50b6c8be56f373631401f2 Mon Sep 17 00:00:00 2001
From: wangfukang <15630117759@163.com>
Date: Thu, 12 Nov 2026 15:07:20 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=97=B6=E9=97=B4=E8=8C=83?=
=?UTF-8?q?=E5=9B=B4=E5=86=85=E5=BD=93=E5=89=8D=E5=BA=97=E9=93=BA=E7=9A=84?=
=?UTF-8?q?=E4=BA=A4=E6=98=93=E8=AE=B0=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
hiver-admin/test-output/test-report.html | 16 +++----
.../config/security/WebSecurityConfig.java | 17 +++++++
.../mall/controller/ProductController.java | 16 +++++--
.../main/resources/mapper/ProductMapper.xml | 48 ++++++++++++-------
4 files changed, 67 insertions(+), 30 deletions(-)
diff --git a/hiver-admin/test-output/test-report.html b/hiver-admin/test-output/test-report.html
index 42996aa..8de7454 100644
--- a/hiver-admin/test-output/test-report.html
+++ b/hiver-admin/test-output/test-report.html
@@ -35,7 +35,7 @@
Hiver
-三月 10, 2026 17:20:14
+十一月 10, 2026 10:12:06
@@ -84,7 +84,7 @@
passTest
-
17:20:14 下午 / 0.016 secs
+
10:12:07 上午 / 0.015 secs
@@ -92,9 +92,9 @@
#test-id=1
passTest
-
03.10.2026 17:20:14
-
03.10.2026 17:20:14
-
0.016 secs
+
11.10.2026 10:12:07
+
11.10.2026 10:12:07
+
0.015 secs
@@ -104,7 +104,7 @@
| Pass |
- 17:20:14 |
+ 10:12:07 |
Test passed
|
@@ -128,13 +128,13 @@
Started
-
三月 10, 2026 17:20:14
+
十一月 10, 2026 10:12:06
Ended
-
三月 10, 2026 17:20:14
+
十一月 10, 2026 10:12:07
diff --git a/hiver-core/src/main/java/cc/hiver/core/config/security/WebSecurityConfig.java b/hiver-core/src/main/java/cc/hiver/core/config/security/WebSecurityConfig.java
index e58803a..f4fe198 100644
--- a/hiver-core/src/main/java/cc/hiver/core/config/security/WebSecurityConfig.java
+++ b/hiver-core/src/main/java/cc/hiver/core/config/security/WebSecurityConfig.java
@@ -13,12 +13,16 @@ import cc.hiver.core.config.security.validate.ImageValidateFilter;
import cc.hiver.core.config.security.validate.SmsValidateFilter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
import org.springframework.security.config.http.SessionCreationPolicy;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.access.intercept.FilterSecurityInterceptor;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
@@ -62,6 +66,19 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private SecurityUtil securityUtil;
+ @Autowired
+ private UserDetailsServiceImpl userDetailsService;
+
+ @Bean
+ public PasswordEncoder passwordEncoder() {
+ return new BCryptPasswordEncoder();
+ }
+
+ @Override
+ protected void configure(AuthenticationManagerBuilder auth) throws Exception {
+ auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder());
+ }
+
@Override
protected void configure(HttpSecurity http) throws Exception {
ExpressionUrlAuthorizationConfigurer
.ExpressionInterceptUrlRegistry registry = http
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductController.java
index cd6c3f0..f6ee0a8 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductController.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductController.java
@@ -28,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
+import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -391,11 +392,18 @@ public class ProductController {
@RequestMapping(value = "/getByUserIdAndProductIds", method = RequestMethod.POST)
@ApiOperation("鎵归噺鑾峰彇瀹㈡埛鏈�杩戣喘涔扮殑鍟嗗搧浠锋牸鍙婃暟閲�")
public Result getByUserIdAndProductIds(String userId, String productIds) {
- String[] ids = {};
- if(StringUtils.isNotEmpty(productIds)){
- ids = productIds.split(",");
+ List idList = new ArrayList<>();
+ if (StringUtils.isNotEmpty(productIds)) {
+ for (String id : productIds.split(",")) {
+ if (StringUtils.isNotBlank(id) && !idList.contains(id.trim())) {
+ idList.add(id.trim());
+ }
+ }
+ }
+ if (StringUtils.isEmpty(userId) || idList.isEmpty()) {
+ return new ResultUtil>().setData(new ArrayList<>());
}
- final List byProductSn = productService.getByUserIdAndProductIds(userId, ids);
+ final List byProductSn = productService.getByUserIdAndProductIds(userId, idList.toArray(new String[0]));
if (byProductSn != null) {
return new ResultUtil>().setData(byProductSn);
} else {
diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml
index a27783f..4343ba6 100644
--- a/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml
+++ b/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml
@@ -760,6 +760,7 @@
t_sale t
LEFT JOIN t_sale_detail s ON t.id = s.sale_id
WHERE
+ t.status = 4 and
s.product_id = #{productId,jdbcType=VARCHAR}
AND t.user_id = #{userId,jdbcType=VARCHAR}
group by s.product_id,s.sale_id,s.discount_amount
@@ -769,24 +770,35 @@