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 @@