ソースを参照

优化发售信息内容

goods20 5 ヶ月 前
コミット
8835c0b3fc

+ 3 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/controller/RecSaleInfoController.java

@@ -1,6 +1,8 @@
 package com.ruoyi.framework.recovery.controller;
 
 import java.util.List;
+
+import com.ruoyi.framework.recovery.domain.dto.RecSaleInfoDto;
 import jakarta.servlet.http.HttpServletResponse;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -75,7 +77,7 @@ public class RecSaleInfoController extends BaseController
     @PreAuthorize("@ss.hasPermi('recovery:info:add')")
     @Log(title = "发售信息详情", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody RecSaleInfo recSaleInfo)
+    public AjaxResult add(@RequestBody RecSaleInfoDto recSaleInfo)
     {
         return toAjax(recSaleInfoService.insertRecSaleInfo(recSaleInfo));
     }

+ 17 - 30
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/controller/WxUserLotteryController.java

@@ -1,36 +1,29 @@
 package com.ruoyi.framework.recovery.controller;
 
-import java.util.List;
-import jakarta.servlet.http.HttpServletResponse;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.recovery.domain.WxUserLottery;
 import com.ruoyi.framework.recovery.service.IWxUserLotteryService;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.common.core.page.TableDataInfo;
+import jakarta.servlet.http.HttpServletResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
 
 /**
  * 微信中奖记录Controller
- * 
+ *
  * @author jin
  * @date 2024-12-17
  */
 @RestController
 @RequestMapping("/recovery/user/lottery")
-public class WxUserLotteryController extends BaseController
-{
+public class WxUserLotteryController extends BaseController {
     @Autowired
     private IWxUserLotteryService wxUserLotteryService;
 
@@ -39,8 +32,7 @@ public class WxUserLotteryController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('recovery:lottery:list')")
     @GetMapping("/list")
-    public TableDataInfo list(WxUserLottery wxUserLottery)
-    {
+    public TableDataInfo list(WxUserLottery wxUserLottery) {
         startPage();
         List<WxUserLottery> list = wxUserLotteryService.selectWxUserLotteryList(wxUserLottery);
         return getDataTable(list);
@@ -52,8 +44,7 @@ public class WxUserLotteryController extends BaseController
     @PreAuthorize("@ss.hasPermi('recovery:lottery:export')")
     @Log(title = "微信中奖记录", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, WxUserLottery wxUserLottery)
-    {
+    public void export(HttpServletResponse response, WxUserLottery wxUserLottery) {
         List<WxUserLottery> list = wxUserLotteryService.selectWxUserLotteryList(wxUserLottery);
         ExcelUtil<WxUserLottery> util = new ExcelUtil<WxUserLottery>(WxUserLottery.class);
         util.exportExcel(response, list, "微信中奖记录数据");
@@ -64,8 +55,7 @@ public class WxUserLotteryController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('recovery:lottery:query')")
     @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
         return success(wxUserLotteryService.selectWxUserLotteryById(id));
     }
 
@@ -75,8 +65,7 @@ public class WxUserLotteryController extends BaseController
     @PreAuthorize("@ss.hasPermi('recovery:lottery:add')")
     @Log(title = "微信中奖记录", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody WxUserLottery wxUserLottery)
-    {
+    public AjaxResult add(@RequestBody WxUserLottery wxUserLottery) {
         return toAjax(wxUserLotteryService.insertWxUserLottery(wxUserLottery));
     }
 
@@ -86,8 +75,7 @@ public class WxUserLotteryController extends BaseController
     @PreAuthorize("@ss.hasPermi('recovery:lottery:edit')")
     @Log(title = "微信中奖记录", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody WxUserLottery wxUserLottery)
-    {
+    public AjaxResult edit(@RequestBody WxUserLottery wxUserLottery) {
         return toAjax(wxUserLotteryService.updateWxUserLottery(wxUserLottery));
     }
 
@@ -96,9 +84,8 @@ public class WxUserLotteryController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('recovery:lottery:remove')")
     @Log(title = "微信中奖记录", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(wxUserLotteryService.deleteWxUserLotteryByIds(ids));
     }
 }

+ 43 - 12
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/RecSaleInfo.java

@@ -39,8 +39,22 @@ public class RecSaleInfo extends BaseEntity
     @Excel(name = "货号")
     private String catalog;
 
+    /**
+     * 活动图片
+     */
     private String images;
 
+    /**
+     * 活动开始时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date eventStartTime;
+
+    /**
+     * 活动结束时间
+     */
+    private Date endTimeOfActivity;
+
     /** 创建时间 */
     @JsonFormat(pattern = "yyyy-MM-dd")
     @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
@@ -131,19 +145,36 @@ public class RecSaleInfo extends BaseEntity
         this.images = images;
     }
 
+    public Date getEventStartTime() {
+        return eventStartTime;
+    }
+
+    public void setEventStartTime(Date eventStartTime) {
+        this.eventStartTime = eventStartTime;
+    }
+
+    public Date getEndTimeOfActivity() {
+        return endTimeOfActivity;
+    }
+
+    public void setEndTimeOfActivity(Date endTimeOfActivity) {
+        this.endTimeOfActivity = endTimeOfActivity;
+    }
+
     @Override
     public String toString() {
-        final StringBuffer sb = new StringBuffer("RecSaleInfo{");
-        sb.append("id=").append(id);
-        sb.append(", saleName='").append(saleName).append('\'');
-        sb.append(", salePrice='").append(salePrice).append('\'');
-        sb.append(", market='").append(market).append('\'');
-        sb.append(", storeId='").append(storeId).append('\'');
-        sb.append(", catalog='").append(catalog).append('\'');
-        sb.append(", images='").append(images).append('\'');
-        sb.append(", createDate=").append(createDate);
-        sb.append(", updateDate=").append(updateDate);
-        sb.append('}');
-        return sb.toString();
+        return "RecSaleInfo{" +
+                "id=" + id +
+                ", saleName='" + saleName + '\'' +
+                ", salePrice='" + salePrice + '\'' +
+                ", market='" + market + '\'' +
+                ", storeId='" + storeId + '\'' +
+                ", catalog='" + catalog + '\'' +
+                ", images='" + images + '\'' +
+                ", eventStartTime=" + eventStartTime +
+                ", endTimeOfActivity=" + endTimeOfActivity +
+                ", createDate=" + createDate +
+                ", updateDate=" + updateDate +
+                '}';
     }
 }

+ 157 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/dto/RecSaleInfoDto.java

@@ -0,0 +1,157 @@
+package com.ruoyi.framework.recovery.domain.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+
+import java.util.Date;
+
+public class RecSaleInfoDto {
+
+    /** 发售名称 */
+    @Excel(name = "发售名称")
+    private String saleName;
+
+    /** 发售价格 */
+    @Excel(name = "发售价格")
+    private String salePrice;
+
+    /** 市场价格 */
+    @Excel(name = "市场价格")
+    private String market;
+
+    /** 门店id */
+    @Excel(name = "门店id")
+    private String storeId;
+
+    @Excel(name = "货号")
+    private String catalog;
+
+    /**
+     * 活动图片
+     */
+    private String images;
+
+    /**
+     * 活动时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date activityTime;
+
+    /**
+     * 活动持续时长
+     */
+    private Integer durationOfTheActivity;
+
+    /** 创建时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date createDate;
+
+    /** 更新时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date updateDate;
+
+    public void setSaleName(String saleName)
+    {
+        this.saleName = saleName;
+    }
+
+    public String getSaleName()
+    {
+        return saleName;
+    }
+    public void setSalePrice(String salePrice)
+    {
+        this.salePrice = salePrice;
+    }
+
+    public String getSalePrice()
+    {
+        return salePrice;
+    }
+    public void setMarket(String market)
+    {
+        this.market = market;
+    }
+
+    public String getMarket()
+    {
+        return market;
+    }
+
+    public String getStoreId() {
+        return storeId;
+    }
+
+    public void setStoreId(String storeId) {
+        this.storeId = storeId;
+    }
+
+    public void setCreateDate(Date createDate)
+    {
+        this.createDate = createDate;
+    }
+
+    public Date getCreateDate()
+    {
+        return createDate;
+    }
+    public void setUpdateDate(Date updateDate)
+    {
+        this.updateDate = updateDate;
+    }
+
+    public Date getUpdateDate()
+    {
+        return updateDate;
+    }
+
+    public String getCatalog() {
+        return catalog;
+    }
+
+    public void setCatalog(String catalog) {
+        this.catalog = catalog;
+    }
+
+    public String getImages() {
+        return images;
+    }
+
+    public void setImages(String images) {
+        this.images = images;
+    }
+
+    public Date getActivityTime() {
+        return activityTime;
+    }
+
+    public void setActivityTime(Date activityTime) {
+        this.activityTime = activityTime;
+    }
+
+    public Integer getDurationOfTheActivity() {
+        return durationOfTheActivity;
+    }
+
+    public void setDurationOfTheActivity(Integer durationOfTheActivity) {
+        this.durationOfTheActivity = durationOfTheActivity;
+    }
+
+    @Override
+    public String toString() {
+        return "RecSaleInfoDto{" +
+                "saleName='" + saleName + '\'' +
+                ", salePrice='" + salePrice + '\'' +
+                ", market='" + market + '\'' +
+                ", storeId='" + storeId + '\'' +
+                ", catalog='" + catalog + '\'' +
+                ", images='" + images + '\'' +
+                ", activityTime=" + activityTime +
+                ", durationOfTheActivity='" + durationOfTheActivity + '\'' +
+                ", createDate=" + createDate +
+                ", updateDate=" + updateDate +
+                '}';
+    }
+}

+ 11 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/mapper/RecSaleInfoMapper.java

@@ -1,7 +1,9 @@
 package com.ruoyi.framework.recovery.mapper;
 
+import java.util.Date;
 import java.util.List;
 import com.ruoyi.framework.recovery.domain.RecSaleInfo;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 发售信息详情Mapper接口
@@ -58,4 +60,13 @@ public interface RecSaleInfoMapper
      * @return 结果
      */
     public int deleteRecSaleInfoByIds(Long[] ids);
+
+    /**
+     * 查询这两天创建的和活动为这两天的
+     *
+     * @param startTime 开始时间
+     * @param endTime 结束时间
+     * @return 结果集
+     */
+    List<RecSaleInfo> selectRecSaleInfoByTime(@Param("start") Date startTime, @Param("end") Date endTime);
 }

+ 13 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/IRecSaleInfoService.java

@@ -1,7 +1,10 @@
 package com.ruoyi.framework.recovery.service;
 
+import java.util.Date;
 import java.util.List;
 import com.ruoyi.framework.recovery.domain.RecSaleInfo;
+import com.ruoyi.framework.recovery.domain.dto.RecSaleInfoDto;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 发售信息详情Service接口
@@ -33,7 +36,7 @@ public interface IRecSaleInfoService
      * @param recSaleInfo 发售信息详情
      * @return 结果
      */
-    public int insertRecSaleInfo(RecSaleInfo recSaleInfo);
+    public int insertRecSaleInfo(RecSaleInfoDto recSaleInfo);
 
     /**
      * 修改发售信息详情
@@ -58,4 +61,13 @@ public interface IRecSaleInfoService
      * @return 结果
      */
     public int deleteRecSaleInfoById(Long id);
+
+    /**
+     * 查询这两天创建的和活动为这两天的
+     *
+     * @param startTime 开始时间
+     * @param endTime 结束时间
+     * @return 结果集
+     */
+    List<RecSaleInfo> selectRecSaleInfoByTime(Date startTime, Date endTime);
 }

+ 26 - 15
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/service/impl/RecSaleInfoServiceImpl.java

@@ -2,6 +2,11 @@ package com.ruoyi.framework.recovery.service.impl;
 
 import java.util.Date;
 import java.util.List;
+
+import cn.hutool.core.date.DateField;
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
+import com.ruoyi.framework.recovery.domain.dto.RecSaleInfoDto;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.framework.recovery.mapper.RecSaleInfoMapper;
@@ -15,8 +20,7 @@ import com.ruoyi.framework.recovery.service.IRecSaleInfoService;
  * @date 2024-11-18
  */
 @Service
-public class RecSaleInfoServiceImpl implements IRecSaleInfoService
-{
+public class RecSaleInfoServiceImpl implements IRecSaleInfoService {
     @Autowired
     private RecSaleInfoMapper recSaleInfoMapper;
 
@@ -27,8 +31,7 @@ public class RecSaleInfoServiceImpl implements IRecSaleInfoService
      * @return 发售信息详情
      */
     @Override
-    public RecSaleInfo selectRecSaleInfoById(Long id)
-    {
+    public RecSaleInfo selectRecSaleInfoById(Long id) {
         return recSaleInfoMapper.selectRecSaleInfoById(id);
     }
 
@@ -39,20 +42,26 @@ public class RecSaleInfoServiceImpl implements IRecSaleInfoService
      * @return 发售信息详情
      */
     @Override
-    public List<RecSaleInfo> selectRecSaleInfoList(RecSaleInfo recSaleInfo)
-    {
+    public List<RecSaleInfo> selectRecSaleInfoList(RecSaleInfo recSaleInfo) {
         return recSaleInfoMapper.selectRecSaleInfoList(recSaleInfo);
     }
 
     /**
      * 新增发售信息详情
      *
-     * @param recSaleInfo 发售信息详情
+     * @param dto 发售信息详情
      * @return 结果
      */
     @Override
-    public int insertRecSaleInfo(RecSaleInfo recSaleInfo)
-    {
+    public int insertRecSaleInfo(RecSaleInfoDto dto) {
+        RecSaleInfo recSaleInfo = new RecSaleInfo();
+        Date activityTime = dto.getActivityTime();
+        if (null == dto.getDurationOfTheActivity()) {
+            dto.setDurationOfTheActivity(1);
+        }
+        DateTime endTime = DateUtil.offsetDay(activityTime, dto.getDurationOfTheActivity());
+        recSaleInfo.setEventStartTime(activityTime);
+        recSaleInfo.setEndTimeOfActivity(endTime);
         recSaleInfo.setCreateDate(new Date());
         return recSaleInfoMapper.insertRecSaleInfo(recSaleInfo);
     }
@@ -64,8 +73,7 @@ public class RecSaleInfoServiceImpl implements IRecSaleInfoService
      * @return 结果
      */
     @Override
-    public int updateRecSaleInfo(RecSaleInfo recSaleInfo)
-    {
+    public int updateRecSaleInfo(RecSaleInfo recSaleInfo) {
         return recSaleInfoMapper.updateRecSaleInfo(recSaleInfo);
     }
 
@@ -76,8 +84,7 @@ public class RecSaleInfoServiceImpl implements IRecSaleInfoService
      * @return 结果
      */
     @Override
-    public int deleteRecSaleInfoByIds(Long[] ids)
-    {
+    public int deleteRecSaleInfoByIds(Long[] ids) {
         return recSaleInfoMapper.deleteRecSaleInfoByIds(ids);
     }
 
@@ -88,8 +95,12 @@ public class RecSaleInfoServiceImpl implements IRecSaleInfoService
      * @return 结果
      */
     @Override
-    public int deleteRecSaleInfoById(Long id)
-    {
+    public int deleteRecSaleInfoById(Long id) {
         return recSaleInfoMapper.deleteRecSaleInfoById(id);
     }
+
+    @Override
+    public List<RecSaleInfo> selectRecSaleInfoByTime(Date startTime, Date endTime) {
+        return recSaleInfoMapper.selectRecSaleInfoByTime(startTime, endTime);
+    }
 }

+ 18 - 1
ruoyi-system/src/main/resources/mapper/system/RecSaleInfoMapper.xml

@@ -16,10 +16,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateDate"    column="update_date"    />
         <result property="catalog"    column="catalog"    />
         <result property="images"    column="images"    />
+        <result property="eventStartTime"    column="event_start_time"    />
+        <result property="endTimeOfActivity"    column="end_time_of_activity"    />
     </resultMap>
 
     <sql id="selectRecSaleInfoVo">
-        select id, sale_name,catalog, sale_price, market, store_id, create_by, create_date, update_by, update_date, images from rec_sale_info
+        select id, sale_name,catalog, sale_price, market, store_id, create_by, create_date, update_by, update_date,
+            images, event_start_time, end_time_of_activity  from rec_sale_info
     </sql>
 
     <select id="selectRecSaleInfoList" parameterType="RecSaleInfo" resultMap="RecSaleInfoResult">
@@ -33,6 +36,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateDate != null "> and update_date = #{updateDate}</if>
             <if test="catalog != null "> and catalog = #{catalog}</if>
             <if test="images != null "> and images = #{images}</if>
+            <if test="eventStartTime != null "> and event_start_time = #{eventStartTime}</if>
+            <if test="endTimeOfActivity != null "> and end_time_of_activity = #{endTimeOfActivity}</if>
         </where>
     </select>
 
@@ -55,6 +60,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateDate != null">update_date,</if>
             <if test="catalog != null">catalog,</if>
             <if test="images != null">images,</if>
+            <if test="eventStartTime != null">event_start_time,</if>
+            <if test="endTimeOfActivity != null">end_time_of_activity,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">#{id},</if>
@@ -68,6 +75,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateDate != null">#{updateDate},</if>
             <if test="catalog != null">#{catalog},</if>
             <if test="images != null">#{images},</if>
+            <if test="eventStartTime != null">#{eventStartTime},</if>
+            <if test="endTimeOfActivity != null">#{endTimeOfActivity},</if>
          </trim>
     </insert>
 
@@ -84,6 +93,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateDate != null">update_date = #{updateDate},</if>
             <if test="catalog != null">update_date = #{catalog},</if>
             <if test="images != null">images = #{images},</if>
+            <if test="eventStartTime != null">event_start_time = #{eventStartTime},</if>
+            <if test="endTimeOfActivity != null">end_time_of_activity = #{endTimeOfActivity},</if>
         </trim>
         where id = #{id}
     </update>
@@ -98,4 +109,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
+
+    <select id="selectRecSaleInfoByTime" resultType="com.ruoyi.framework.recovery.domain.RecSaleInfo">
+        <include refid="selectRecSaleInfoVo"/>
+        where (create_time between #{start,jdbcType=TIMESTAMP} and #{end,jdbcType=TIMESTAMP})
+        or (event_start_time &lt; #{start,jdbcType=TIMESTAMP} and end_time_of_activity >= #{end,jdbcType=TIMESTAMP})
+    </select>
 </mapper>

+ 0 - 1
ruoyi-wx/src/main/java/com/ruoyi/wx/web/controller/WxLotteryUserController.java

@@ -1,7 +1,6 @@
 package com.ruoyi.wx.web.controller;
 
 import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.framework.recovery.domain.WxLottery;
 import com.ruoyi.wx.web.domain.dto.LotteryDto;
 import com.ruoyi.wx.web.domain.vo.AwardVo;
 import com.ruoyi.wx.web.domain.vo.LotteryVo;

+ 0 - 1
ruoyi-wx/src/main/java/com/ruoyi/wx/web/service/IWxLotteryUserService.java

@@ -1,6 +1,5 @@
 package com.ruoyi.wx.web.service;
 
-import com.ruoyi.framework.recovery.domain.WxLottery;
 import com.ruoyi.wx.web.domain.dto.LotteryDto;
 import com.ruoyi.wx.web.domain.vo.AwardVo;
 import com.ruoyi.wx.web.domain.vo.LotteryVo;

+ 8 - 6
ruoyi-wx/src/main/java/com/ruoyi/wx/web/service/impl/WxHomeServiceImpl.java

@@ -1,5 +1,7 @@
 package com.ruoyi.wx.web.service.impl;
 
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
 import com.ruoyi.common.constant.Constants;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.redis.RedisCache;
@@ -18,10 +20,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.*;
 import java.util.stream.Collectors;
 
@@ -53,8 +52,11 @@ public class WxHomeServiceImpl implements IWxHomeService {
     @Override
     public AjaxResult getIndex() throws ExecutionException, InterruptedException {
         AjaxResult result = new AjaxResult();
-        // 发售信息
-        Callable<List<RecSaleInfo>> saleInfoCallable = () -> recSaleInfoService.selectRecSaleInfoList(new RecSaleInfo());
+        // 查询最近创建的活动并且处于活动期间的内容
+        DateTime dateTime = DateUtil.beginOfDay(new Date());
+        Date startTime = DateUtil.offsetDay(dateTime, -1);
+        Date endTime = DateUtil.offsetDay(dateTime, 1);
+        Callable<List<RecSaleInfo>> saleInfoCallable = () -> recSaleInfoService.selectRecSaleInfoByTime(startTime, endTime);
         // 评论
         Callable<List<RecContent>> contentCallable = () -> recContentService.selectRecContentList(new RecContent());
 

+ 1 - 1
ruoyi-wx/src/main/java/com/ruoyi/wx/web/service/impl/WxLotteryUserServiceImpl.java

@@ -76,7 +76,7 @@ public class WxLotteryUserServiceImpl implements IWxLotteryUserService {
         }
         List<String> lotteryCodes = new ArrayList<>();
         // 构建抽奖记录
-        for (int i = 0 ; i < lotteryDto.getNum() ; i++) {
+        for (int i = 0; i < lotteryDto.getNum(); i++) {
             WxUserLottery info = new WxUserLottery();
             info.setOpenId(wxOpenid);
             String lotteryCode = String.valueOf(System.currentTimeMillis()).substring(7);