浏览代码

新增微信小程序模块,并且修改内容

jin 6 月之前
父节点
当前提交
97d5f79d7a

二进制
01viridbb4ovgodt65ae3g3334.png


二进制
iPhone-16-Pro-Max-concept-728x410.jpg


+ 23 - 3
pom.xml

@@ -3,7 +3,7 @@
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 	<modelVersion>4.0.0</modelVersion>
-	
+
     <groupId>com.ruoyi</groupId>
     <artifactId>ruoyi</artifactId>
     <version>3.8.8</version>
@@ -11,7 +11,7 @@
     <name>ruoyi</name>
     <url>http://www.ruoyi.vip</url>
     <description>若依管理系统</description>
-    
+
     <properties>
         <ruoyi.version>3.8.8</ruoyi.version>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -37,6 +37,8 @@
         <springdoc.version>2.6.0</springdoc.version>
         <lombok.version>1.18.34</lombok.version>
         <thumbnailator.vaersion>0.4.20</thumbnailator.vaersion>
+        <weixin-java-pay.version>3.3.0</weixin-java-pay.version>
+        <weixin-java-miniapp.version>3.3.0</weixin-java-miniapp.version>
     </properties>
 
     <!-- 依赖声明 -->
@@ -188,6 +190,13 @@
                 <version>${ruoyi.version}</version>
             </dependency>
 
+            <!-- 通用工具-->
+            <dependency>
+                <groupId>com.ruoyi</groupId>
+                <artifactId>ruoyi-wx</artifactId>
+                <version>${ruoyi.version}</version>
+            </dependency>
+
             <dependency>
                 <groupId>commons-net</groupId>
                 <artifactId>commons-net</artifactId>
@@ -204,7 +213,17 @@
                 <artifactId>thumbnailator</artifactId>
                 <version>${thumbnailator.vaersion}</version>
             </dependency>
+            <dependency>
+                <groupId>com.github.binarywang</groupId>
+                <artifactId>weixin-java-pay</artifactId>
+                <version>${weixin-java-pay.version}</version>
+            </dependency>
 
+            <dependency>
+                <groupId>com.github.binarywang</groupId>
+                <artifactId>weixin-java-miniapp</artifactId>
+                <version>${weixin-java-miniapp.version}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 
@@ -215,6 +234,7 @@
         <module>ruoyi-quartz</module>
         <module>ruoyi-generator</module>
         <module>ruoyi-common</module>
+        <module>ruoyi-wx</module>
     </modules>
     <packaging>pom</packaging>
 
@@ -264,4 +284,4 @@
         </pluginRepository>
     </pluginRepositories>
 
-</project>
+</project>

+ 12 - 7
ruoyi-admin/pom.xml

@@ -59,6 +59,11 @@
             <artifactId>thumbnailator</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>com.ruoyi</groupId>
+            <artifactId>ruoyi-wx</artifactId>
+        </dependency>
+
     </dependencies>
 
     <build>
@@ -78,17 +83,17 @@
                     </execution>
                 </executions>
             </plugin>
-            <plugin>   
-                <groupId>org.apache.maven.plugins</groupId>   
-                <artifactId>maven-war-plugin</artifactId>   
-                <version>3.1.0</version>   
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-war-plugin</artifactId>
+                <version>3.1.0</version>
                 <configuration>
                     <failOnMissingWebXml>false</failOnMissingWebXml>
                     <warName>${project.artifactId}</warName>
-                </configuration>   
-           </plugin>   
+                </configuration>
+           </plugin>
         </plugins>
         <finalName>${project.artifactId}</finalName>
     </build>
 
-</project>
+</project>

+ 2 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java

@@ -61,8 +61,8 @@ public class CommonController {
      */
     @PostMapping("/upload")
     public AjaxResult uploadFile(@RequestParam(name = "file") MultipartFile file,
-                                 @RequestParam(name = "type") String type,
-                                 @RequestParam(name = "id") Long id) throws Exception {
+                                 @RequestParam(name = "type", required = false) String type,
+                                 @RequestParam(name = "id", required = false) Long id) throws Exception {
         try {
             return commonService.uploadFile(file, type, id);
         } catch (Exception e) {

+ 37 - 40
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

@@ -23,19 +23,18 @@ import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl;
 
 /**
  * spring security配置
- * 
+ *
  * @author ruoyi
  */
 @EnableMethodSecurity(prePostEnabled = true, securedEnabled = true)
 @Configuration
-public class SecurityConfig
-{
+public class SecurityConfig {
     /**
      * 自定义用户认证逻辑
      */
     @Autowired
     private UserDetailsService userDetailsService;
-    
+
     /**
      * 认证失败处理类
      */
@@ -53,7 +52,7 @@ public class SecurityConfig
      */
     @Autowired
     private JwtAuthenticationTokenFilter authenticationTokenFilter;
-    
+
     /**
      * 跨域过滤器
      */
@@ -70,8 +69,7 @@ public class SecurityConfig
      * 身份验证实现
      */
     @Bean
-    public AuthenticationManager authenticationManager()
-    {
+    public AuthenticationManager authenticationManager() {
         DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider();
         daoAuthenticationProvider.setUserDetailsService(userDetailsService);
         daoAuthenticationProvider.setPasswordEncoder(bCryptPasswordEncoder());
@@ -94,46 +92,45 @@ public class SecurityConfig
      * authenticated       |   用户登录后可访问
      */
     @Bean
-    protected SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception
-    {
+    protected SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {
         return httpSecurity
-            // CSRF禁用,因为不使用session
-            .csrf(csrf -> csrf.disable())
-            // 禁用HTTP响应标头
-            .headers((headersCustomizer) -> {
-                headersCustomizer.cacheControl(cache -> cache.disable()).frameOptions(options -> options.sameOrigin());
-            })
-            // 认证失败处理类
-            .exceptionHandling(exception -> exception.authenticationEntryPoint(unauthorizedHandler))
-            // 基于token,所以不需要session
-            .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
-            // 注解标记允许匿名访问的url
-            .authorizeHttpRequests((requests) -> {
-                permitAllUrl.getUrls().forEach(url -> requests.requestMatchers(url).permitAll());
-                // 对于登录login 注册register 验证码captchaImage 允许匿名访问
-                requests.requestMatchers("/login", "/register", "/captchaImage", "/common/**").permitAll()
-                    // 静态资源,可匿名访问
-                    .requestMatchers(HttpMethod.GET, "/", "/*.html", "/**.html", "/**.css", "/**.js", "/profile/**").permitAll()
-                    .requestMatchers("/swagger-ui.html", "/v3/api-docs/**", "/swagger-ui/**", "/druid/**").permitAll()
-                    // 除上面外的所有请求全部需要鉴权认证
-                    .anyRequest().authenticated();
-            })
-            // 添加Logout filter
-            .logout(logout -> logout.logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler))
-            // 添加JWT filter
-            .addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class)
-            // 添加CORS filter
-            .addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class)
-            .addFilterBefore(corsFilter, LogoutFilter.class)
-            .build();
+                // CSRF禁用,因为不使用session
+                .csrf(csrf -> csrf.disable())
+                // 禁用HTTP响应标头
+                .headers((headersCustomizer) -> {
+                    headersCustomizer.cacheControl(cache -> cache.disable()).frameOptions(options -> options.sameOrigin());
+                })
+                // 认证失败处理类
+                .exceptionHandling(exception -> exception.authenticationEntryPoint(unauthorizedHandler))
+                // 基于token,所以不需要session
+                .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
+                // 注解标记允许匿名访问的url
+                .authorizeHttpRequests((requests) -> {
+                    permitAllUrl.getUrls().forEach(url -> requests.requestMatchers(url).permitAll());
+                    // 对于登录login 注册register 验证码captchaImage 允许匿名访问
+                    requests.requestMatchers("/login", "/register", "/captchaImage", "/common/**").permitAll()
+                            // 静态资源,可匿名访问
+                            .requestMatchers(HttpMethod.GET, "/", "/*.html", "/**.html", "/**.css", "/**.js", "/profile/**").permitAll()
+                            .requestMatchers("/swagger-ui.html", "/v3/api-docs/**", "/swagger-ui/**", "/druid/**").permitAll()
+                            .requestMatchers("/wx/**").anonymous()
+                            // 除上面外的所有请求全部需要鉴权认证
+                            .anyRequest().authenticated();
+                })
+                // 添加Logout filter
+                .logout(logout -> logout.logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler))
+                // 添加JWT filter
+                .addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class)
+                // 添加CORS filter
+                .addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class)
+                .addFilterBefore(corsFilter, LogoutFilter.class)
+                .build();
     }
 
     /**
      * 强散列哈希加密实现
      */
     @Bean
-    public BCryptPasswordEncoder bCryptPasswordEncoder()
-    {
+    public BCryptPasswordEncoder bCryptPasswordEncoder() {
         return new BCryptPasswordEncoder();
     }
 }

+ 16 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/RecStores.java

@@ -79,11 +79,17 @@ public class RecStores extends BaseEntity
     @Excel(name = "发售数量")
     private Long saleNum;
 
+    /**
+     * 发售城市id
+     */
+    @Excel(name = "发售城市id")
+    private String cityId;
+
     /**
      * 发售城市
      */
     @Excel(name = "发售城市")
-    private String cityId;
+    private String city;
 
     @Excel(name = "发售门店图片")
     private String images;
@@ -229,6 +235,14 @@ public class RecStores extends BaseEntity
         this.images = images;
     }
 
+    public String getCity() {
+        return city;
+    }
+
+    public void setCity(String city) {
+        this.city = city;
+    }
+
     @Override
     public String toString() {
         final StringBuffer sb = new StringBuffer("RecStores{");
@@ -247,6 +261,7 @@ public class RecStores extends BaseEntity
         sb.append(", notice='").append(notice).append('\'');
         sb.append(", saleNum=").append(saleNum);
         sb.append(", cityId='").append(cityId).append('\'');
+        sb.append(", city='").append(city).append('\'');
         sb.append(", images='").append(images).append('\'');
         sb.append('}');
         return sb.toString();

+ 0 - 2
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/impl/CommonServiceImpl.java

@@ -86,8 +86,6 @@ public class CommonServiceImpl implements ICommonService {
         if (null != id) {
             updateDb(filePath + newFileName, fileThu + newFileName, type, id);
         }
-        // 上传并返回新文件名称
-//        String fileName = FileUploadUtils.upload(filePath, file);
         AjaxResult ajax = AjaxResult.success();
         ajax.put("thuUrl", fileThu + newFileName);
         ajax.put("hdUrl", filePath + newFileName);

+ 10 - 8
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/impl/RecCityServiceImpl.java

@@ -1,5 +1,6 @@
 package com.ruoyi.framework.recovery.service.impl;
 
+import java.util.Date;
 import java.util.List;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -9,19 +10,19 @@ import com.ruoyi.framework.recovery.service.IRecCityService;
 
 /**
  * 城市管理Service业务层处理
- * 
+ *
  * @author jin
  * @date 2024-11-20
  */
 @Service
-public class RecCityServiceImpl implements IRecCityService 
+public class RecCityServiceImpl implements IRecCityService
 {
     @Autowired
     private RecCityMapper recCityMapper;
 
     /**
      * 查询城市管理
-     * 
+     *
      * @param id 城市管理主键
      * @return 城市管理
      */
@@ -33,7 +34,7 @@ public class RecCityServiceImpl implements IRecCityService
 
     /**
      * 查询城市管理列表
-     * 
+     *
      * @param recCity 城市管理
      * @return 城市管理
      */
@@ -45,19 +46,20 @@ public class RecCityServiceImpl implements IRecCityService
 
     /**
      * 新增城市管理
-     * 
+     *
      * @param recCity 城市管理
      * @return 结果
      */
     @Override
     public int insertRecCity(RecCity recCity)
     {
+        recCity.setCreateDate(new Date());
         return recCityMapper.insertRecCity(recCity);
     }
 
     /**
      * 修改城市管理
-     * 
+     *
      * @param recCity 城市管理
      * @return 结果
      */
@@ -69,7 +71,7 @@ public class RecCityServiceImpl implements IRecCityService
 
     /**
      * 批量删除城市管理
-     * 
+     *
      * @param ids 需要删除的城市管理主键
      * @return 结果
      */
@@ -81,7 +83,7 @@ public class RecCityServiceImpl implements IRecCityService
 
     /**
      * 删除城市管理信息
-     * 
+     *
      * @param id 城市管理主键
      * @return 结果
      */

+ 1 - 1
ruoyi-ui/vue.config.js

@@ -36,7 +36,7 @@ module.exports = {
     proxy: {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
-        target: `http://localhost:8080`,
+        target: `http://49.235.117.140:8080`,
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''

+ 37 - 0
ruoyi-wx/pom.xml

@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>ruoyi</artifactId>
+        <groupId>com.ruoyi</groupId>
+        <version>3.8.8</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>ruoyi-wx</artifactId>
+
+    <description>微信小程序</description>
+
+    <dependencies>
+        <!-- 通用工具 -->
+        <dependency>
+            <groupId>com.ruoyi</groupId>
+            <artifactId>ruoyi-common</artifactId>
+        </dependency>
+        <!-- 通用工具 -->
+        <dependency>
+            <groupId>com.ruoyi</groupId>
+            <artifactId>ruoyi-system</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.ruoyi</groupId>
+            <artifactId>ruoyi-framework</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-boot-starter</artifactId>
+            <version>3.0.0</version>
+        </dependency>
+    </dependencies>
+</project>

+ 47 - 0
ruoyi-wx/src/main/java/com/ruoyi/wx/web/controller/WxHomeController.java

@@ -0,0 +1,47 @@
+package com.ruoyi.wx.web.controller;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.utils.ExceptionUtil;
+import com.ruoyi.wx.web.domain.vo.SaleInfoVo;
+import com.ruoyi.wx.web.service.IWxHomeService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+
+/**
+ * 首页服务
+ */
+@RestController
+@RequestMapping("/wx/home")
+@Slf4j
+public class WxHomeController {
+    @Autowired
+    private IWxHomeService wxHomeService;
+
+//    @ApiOperation(value = "查询首页所有信息")
+    @GetMapping("/index")
+    public AjaxResult getIndex() {
+        try {
+            return wxHomeService.getIndex();
+        } catch (InterruptedException | ExecutionException e) {
+            return AjaxResult.error();
+        }
+    }
+
+//    @ApiOperation(value = "发售信息详情", notes = "根据id查询详情内容")
+    @GetMapping("/sale/info/{id}")
+    public AjaxResult getSaleInfo(@PathVariable("id") Long id) {
+        try {
+            List<SaleInfoVo> infoList = wxHomeService.getSaleInfo(id);
+            return AjaxResult.success(infoList);
+        } catch (Exception e) {
+            return AjaxResult.error(ExceptionUtil.getExceptionMessage(e));
+        }
+    }
+}

+ 42 - 0
ruoyi-wx/src/main/java/com/ruoyi/wx/web/domain/vo/RecStoresVo.java

@@ -0,0 +1,42 @@
+package com.ruoyi.wx.web.domain.vo;
+
+import com.ruoyi.framework.recovery.domain.RecStores;
+
+import java.util.List;
+
+public class RecStoresVo {
+    /**
+     * 发售城市
+     */
+    private String city;
+
+    /**
+     * 发售门店详情
+     */
+    private List<RecStores> stores;
+
+    public String getCity() {
+        return city;
+    }
+
+    public void setCity(String city) {
+        this.city = city;
+    }
+
+    public List<RecStores> getStores() {
+        return stores;
+    }
+
+    public void setStores(List<RecStores> stores) {
+        this.stores = stores;
+    }
+
+    @Override
+    public String toString() {
+        final StringBuffer sb = new StringBuffer("RecStoresVo{");
+        sb.append("city='").append(city).append('\'');
+        sb.append(", stores=").append(stores);
+        sb.append('}');
+        return sb.toString();
+    }
+}

+ 98 - 0
ruoyi-wx/src/main/java/com/ruoyi/wx/web/domain/vo/SaleInfoVo.java

@@ -0,0 +1,98 @@
+package com.ruoyi.wx.web.domain.vo;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+//@ApiModel(value = "发售信息详情内容")
+public class SaleInfoVo {
+    /**
+     * 商品id
+     */
+    private Long id;
+
+    /**
+     * 型号
+     */
+    private String model;
+
+    /**
+     * 货号
+     */
+    private String catalog;
+
+    /**
+     * 发售价
+     */
+    private BigDecimal sale;
+
+    /**
+     * 市场价
+     */
+    private BigDecimal market;
+
+    /**
+     * 门店信息
+     */
+    private List<RecStoresVo> stores;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getModel() {
+        return model;
+    }
+
+    public void setModel(String model) {
+        this.model = model;
+    }
+
+    public String getCatalog() {
+        return catalog;
+    }
+
+    public void setCatalog(String catalog) {
+        this.catalog = catalog;
+    }
+
+    public BigDecimal getSale() {
+        return sale;
+    }
+
+    public void setSale(BigDecimal sale) {
+        this.sale = sale;
+    }
+
+    public BigDecimal getMarket() {
+        return market;
+    }
+
+    public void setMarket(BigDecimal market) {
+        this.market = market;
+    }
+
+    public List<RecStoresVo> getStores() {
+        return stores;
+    }
+
+    public void setStores(List<RecStoresVo> stores) {
+        this.stores = stores;
+    }
+
+    @Override
+    public String toString() {
+        final StringBuffer sb = new StringBuffer("SaleInfoVo{");
+        sb.append("id=").append(id);
+        sb.append(", model='").append(model).append('\'');
+        sb.append(", catalog='").append(catalog).append('\'');
+        sb.append(", sale=").append(sale);
+        sb.append(", market=").append(market);
+        sb.append(", stores=").append(stores);
+        sb.append('}');
+        return sb.toString();
+    }
+}

+ 29 - 0
ruoyi-wx/src/main/java/com/ruoyi/wx/web/mapper/WxHomeMapper.java

@@ -0,0 +1,29 @@
+package com.ruoyi.wx.web.mapper;
+
+import com.ruoyi.framework.recovery.domain.RecStores;
+import com.ruoyi.wx.web.domain.vo.RecStoresVo;
+import com.ruoyi.wx.web.domain.vo.SaleInfoVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface WxHomeMapper {
+
+    /**
+     * 根据id集查询所有商品信息
+     *
+     * @param comIds id集合
+     * @return 商品信息
+     */
+    List<SaleInfoVo> selectRecCommodityByIds(@Param("ids") List<Integer> comIds);
+
+    /**
+     * 根据id模糊查询所有发售此商品的门店
+     *
+     * @param comIds ids
+     * @return 模糊查询所有发售此商品的门店
+     */
+    List<RecStores> selectRecStoresByCommondityIds(@Param("ids") List<String> comIds);
+}

+ 24 - 0
ruoyi-wx/src/main/java/com/ruoyi/wx/web/service/IWxHomeService.java

@@ -0,0 +1,24 @@
+package com.ruoyi.wx.web.service;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.wx.web.domain.vo.SaleInfoVo;
+
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+
+public interface IWxHomeService {
+    /**
+     * 获取首页
+     *
+     * @return 首页内容
+     */
+    AjaxResult getIndex() throws ExecutionException, InterruptedException;
+
+    /**
+     * 获取发售信息详情内容
+     *
+     * @param id 发售信息id
+     * @return 详情内容
+     */
+    List<SaleInfoVo> getSaleInfo(Long id);
+}

+ 105 - 0
ruoyi-wx/src/main/java/com/ruoyi/wx/web/service/impl/WxHomeServiceImpl.java

@@ -0,0 +1,105 @@
+package com.ruoyi.wx.web.service.impl;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.framework.recovery.domain.RecCommodity;
+import com.ruoyi.framework.recovery.domain.RecContent;
+import com.ruoyi.framework.recovery.domain.RecSaleInfo;
+import com.ruoyi.framework.recovery.domain.RecStores;
+import com.ruoyi.framework.recovery.mapper.RecCommodityMapper;
+import com.ruoyi.framework.recovery.mapper.RecSaleInfoMapper;
+import com.ruoyi.framework.recovery.service.IRecContentService;
+import com.ruoyi.framework.recovery.service.IRecSaleInfoService;
+import com.ruoyi.wx.web.domain.vo.RecStoresVo;
+import com.ruoyi.wx.web.domain.vo.SaleInfoVo;
+import com.ruoyi.wx.web.mapper.WxHomeMapper;
+import com.ruoyi.wx.web.service.IWxHomeService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.stream.Collectors;
+
+@Service
+public class WxHomeServiceImpl implements IWxHomeService {
+    @Autowired
+    private IRecSaleInfoService recSaleInfoService;
+
+    @Autowired
+    private IRecContentService recContentService;
+
+    @Autowired
+    private RecSaleInfoMapper saleInfoMapper;
+
+    @Autowired
+    private WxHomeMapper wxHomeMapper;
+
+    private final static ArrayBlockingQueue<Runnable> WORK_QUEUE = new ArrayBlockingQueue<>(9);
+
+    private final static RejectedExecutionHandler HANDLER = new ThreadPoolExecutor.CallerRunsPolicy();
+
+    @SuppressWarnings("unused")
+    private static ThreadPoolExecutor executorService = new ThreadPoolExecutor(9, 9, 1000, TimeUnit.MILLISECONDS,
+            WORK_QUEUE, HANDLER);
+
+    @Override
+    public AjaxResult getIndex() throws ExecutionException, InterruptedException {
+        AjaxResult result = new AjaxResult();
+        // 发售信息
+        Callable<List<RecSaleInfo>> saleInfoCallable = () -> recSaleInfoService.selectRecSaleInfoList(new RecSaleInfo());
+        // 评论
+        Callable<List<RecContent>> contentCallable = () -> recContentService.selectRecContentList(new RecContent());
+        // 热门发售
+
+        FutureTask<List<RecSaleInfo>> saleInfoTask = new FutureTask<>(saleInfoCallable);
+        FutureTask<List<RecContent>> contentTask = new FutureTask<>(contentCallable);
+
+        executorService.submit(saleInfoTask);
+        executorService.submit(contentTask);
+        result.put("saleInfo", saleInfoTask.get());
+        result.put("content", contentTask.get());
+        return result;
+    }
+
+    @Override
+    public List<SaleInfoVo> getSaleInfo(Long id) {
+        RecSaleInfo saleInfo = saleInfoMapper.selectRecSaleInfoById(id);
+        // 获取到商品id,并将商品id转换为Integer到数据库中查询
+        List<String> ids = Arrays.asList(saleInfo.getCommodityId().split(","));
+        List<Integer> comIds = ids.stream().map(Integer::parseInt).toList();
+
+        // 获取所有商品内容
+        List<SaleInfoVo> infoVos = wxHomeMapper.selectRecCommodityByIds(comIds);
+        // 根据商品获取所有门店信息
+        List<RecStores> stores = wxHomeMapper.selectRecStoresByCommondityIds(ids);
+        Map<Long, List<RecStores>> storesMap = new ConcurrentHashMap<>();
+        // 根据根据商品id筛选出相应的门店
+        for (SaleInfoVo infoVo : infoVos) {
+            List<RecStores> recStores = new ArrayList<>();
+            for (RecStores store : stores) {
+                if (store.getCommondityId().contains(String.valueOf(infoVo.getId()))) {
+                    recStores.add(store);
+                }
+            }
+            storesMap.put(infoVo.getId(), recStores);
+        }
+        // 拼接门店信息和商品信息
+        for (SaleInfoVo infoVo : infoVos) {
+            for (Map.Entry<Long, List<RecStores>> entry : storesMap.entrySet()) {
+                if (Objects.equals(entry.getKey(), infoVo.getId())) {
+                    Map<String, List<RecStores>> cityMap = entry.getValue().stream().filter(vo -> StringUtils.isNotEmpty(vo.getCity())).collect(Collectors.groupingBy(RecStores::getCity));
+                    List<RecStoresVo> storesVos = new ArrayList<>();
+                    cityMap.forEach((key, value) -> {
+                        RecStoresVo recStoresVo = new RecStoresVo();
+                        recStoresVo.setCity(key);
+                        recStoresVo.setStores(value);
+                        storesVos.add(recStoresVo);
+                    });
+                    infoVo.setStores(storesVos);
+                }
+            }
+        }
+        return infoVos;
+    }
+}

+ 28 - 0
ruoyi-wx/src/main/resources/mapper/web/WxHomeMapper.xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.wx.web.mapper.WxHomeMapper">
+
+    <select id="selectRecCommodityByIds" resultType="com.ruoyi.wx.web.domain.vo.SaleInfoVo">
+        select id, model, catalog, sale, market from rec_commodity
+        where id in
+        <foreach collection="ids" item="item" index="index" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+    </select>
+    <select id="selectRecStoresByCommondityIds" resultType="com.ruoyi.framework.recovery.domain.RecStores">
+        select distinct rs.id as id, rs.stores_name as storesName, rs.sale_type as saleType, rs.sale_time as saleTime,
+                        rs.check_time as checkTime, rs.check_type as checkType, rs.buy_time as buyTime, rs.sale_link as saleLink,
+                        rs.create_by as createBy, rs.create_date as createDate, rs.update_by as updateBy, rs.update_date as updateDate,
+                        rs.commondity_id as commondityId, rs.stores_address as storesAddress, rs.notice as notice, rs.sale_num as saleNum,
+                        rc.city as city, rs.images as images
+        from rec_stores rs
+            left join rec_city rc on rc.id = rs.city_id
+        <where>
+            <foreach collection="ids" item="item" index="index"  open="(" separator="or" close=")">
+                commondity_id LIKE CONCAT('%',#{item},'%')
+            </foreach>
+        </where>
+    </select>
+</mapper>

+ 13 - 0
ruoyi-wx/src/test/java/com/ruoyi/wx/RuoyiWxApplicationTests.java

@@ -0,0 +1,13 @@
+//package com.ruoyi.wx;
+//
+//import org.junit.jupiter.api.Test;
+//import org.springframework.boot.test.context.SpringBootTest;
+//
+//@SpringBootTest
+//class RuoyiWxApplicationTests {
+//
+//    @Test
+//    void contextLoads() {
+//    }
+//
+//}