jin 4 bulan lalu
induk
melakukan
376a9ea5d1

+ 25 - 13
ruoyi-framework/src/main/java/com/ruoyi/framework/recovery/domain/RecSaleInfo.java

@@ -65,6 +65,8 @@ public class RecSaleInfo extends BaseEntity
     @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date updateDate;
 
+    private Character topUp;
+
     public void setId(Long id)
     {
         this.id = id;
@@ -161,20 +163,30 @@ public class RecSaleInfo extends BaseEntity
         this.endTimeOfActivity = endTimeOfActivity;
     }
 
+    public Character getTopUp() {
+        return topUp;
+    }
+
+    public void setTopUp(Character topUp) {
+        this.topUp = topUp;
+    }
+
     @Override
     public String 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 +
-                '}';
+        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(", eventStartTime=").append(eventStartTime);
+        sb.append(", endTimeOfActivity=").append(endTimeOfActivity);
+        sb.append(", createDate=").append(createDate);
+        sb.append(", updateDate=").append(updateDate);
+        sb.append(", topUp=").append(topUp);
+        sb.append('}');
+        return sb.toString();
     }
 }

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

@@ -18,11 +18,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="images"    column="images"    />
         <result property="eventStartTime"    column="event_start_time"    />
         <result property="endTimeOfActivity"    column="end_time_of_activity"    />
+        <result property="topUp"    column="top_up"    />
     </resultMap>
 
     <sql id="selectRecSaleInfoVo">
         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
+            images, event_start_time, end_time_of_activity, top_up  from rec_sale_info
     </sql>
 
     <select id="selectRecSaleInfoList" parameterType="RecSaleInfo" resultMap="RecSaleInfoResult">
@@ -38,6 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <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>
+            <if test="topUp != null "> and top_up = #{topUp}</if>
         </where>
     </select>
 
@@ -62,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="info.images != null">images,</if>
             <if test="info.eventStartTime != null">event_start_time,</if>
             <if test="info.endTimeOfActivity != null">end_time_of_activity,</if>
+            <if test="info.topUp != null">top_up,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="info.id != null">#{info.id},</if>
@@ -77,6 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="info.images != null">#{info.images},</if>
             <if test="info.eventStartTime != null">#{info.eventStartTime},</if>
             <if test="info.endTimeOfActivity != null">#{info.endTimeOfActivity},</if>
+            <if test="info.topUp != null">#{topUp},</if>
          </trim>
     </insert>
 
@@ -95,6 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <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>
+            <if test="topUp != null">top_up = #{topUp},</if>
         </trim>
         where id = #{id}
     </update>
@@ -114,5 +119,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectRecSaleInfoVo"/>
         where (create_date between #{start,jdbcType=TIMESTAMP} and #{end,jdbcType=TIMESTAMP})
         or (event_start_time &lt; #{start,jdbcType=TIMESTAMP} and end_time_of_activity >= #{end,jdbcType=TIMESTAMP})
+        order by create_date desc
     </select>
 </mapper>

+ 13 - 3
ruoyi-wx/src/main/java/com/ruoyi/wx/web/service/impl/WxHomeServiceImpl.java

@@ -63,10 +63,8 @@ public class WxHomeServiceImpl implements IWxHomeService {
         Callable<List<RecSaleInfo>> saleInfoCallable = () -> recSaleInfoService.selectRecSaleInfoByTime(startTime, endTime);
         // 评论
         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);
         List<RecContent> contents = contentTask.get();
@@ -78,7 +76,19 @@ public class WxHomeServiceImpl implements IWxHomeService {
             }
             redisCache.setCacheMapValue(Constants.THUMBS_UP, "like" + content.getId(), content.getThumbs());
         }
-        result.put("saleInfo", saleInfoTask.get());
+        List<RecSaleInfo> saleInfos = saleInfoTask.get();
+        boolean flag = false;
+        // 若当前没有置顶,则默认第一个为置顶
+        for (RecSaleInfo info : saleInfos) {
+            if ('Y' == info.getTopUp()) {
+                flag = true;
+                break;
+            }
+        }
+        if (!flag) {
+            saleInfos.get(0).setTopUp('Y');
+        }
+        result.put("saleInfo", saleInfos);
         result.put("content", contents);
         result.put("is_lottery", display);
         return result;