jintao.geng hace 1 mes
padre
commit
d3453e8574

+ 7 - 0
lot/src/main/java/cn/hobbystocks/auc/service/impl/AuctionServiceImpl.java

@@ -58,6 +58,9 @@ public class AuctionServiceImpl extends ServiceImpl<AuctionMapper,Auction> imple
     @Override
     public List<Auction> selectAuctionList(Auction auction) {
         IPage<Auction> page=new Page<>(auction.getPageNum(),auction.getPageSize());
+        List<Auction> auctions = getBaseMapper().selectAuctionList(page, auction);
+        // 过滤掉时间已结束的拍品
+        auctions.removeIf(po -> System.currentTimeMillis() > po.getEndTime().getTime());
         return getBaseMapper().selectAuctionList(page,auction);
     }
 
@@ -148,6 +151,10 @@ public class AuctionServiceImpl extends ServiceImpl<AuctionMapper,Auction> imple
 
     @Override
     public List<Auction> selectBannerList() {
+        List<Auction> auctions = getBaseMapper().selectAucBannerList();
+        // 过滤掉时间已结束(如拍卖会id:5)时间未开始(如拍卖会id:4)
+        auctions.removeIf(auction -> System.currentTimeMillis() > auction.getEndTime().getTime()
+            || System.currentTimeMillis() < auction.getStartTime().getTime());
         return getBaseMapper().selectAucBannerList();
     }
 }

+ 1 - 1
lot/src/main/resources/mapper/AuctionMapper.xml

@@ -191,7 +191,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <select id="selectAucBannerList" resultType="cn.hobbystocks.auc.domain.Auction">
-        select id,name,banner,imgs,description,start_time startTime,status from auction
+        select id,name,banner,imgs,description,start_time startTime,end_time endTime,status from auction
         where pub_status=1 order by sort desc
     </select>
 </mapper>