|
@@ -2,6 +2,7 @@ package cn.hobbystocks.auc.web;
|
|
|
|
|
|
|
|
import cn.hobbystocks.auc.common.core.controller.BaseController;
|
|
import cn.hobbystocks.auc.common.core.controller.BaseController;
|
|
|
import cn.hobbystocks.auc.common.core.domain.AjaxResult;
|
|
import cn.hobbystocks.auc.common.core.domain.AjaxResult;
|
|
|
|
|
+import cn.hobbystocks.auc.common.constant.Constants;
|
|
|
import cn.hobbystocks.auc.domain.Auction;
|
|
import cn.hobbystocks.auc.domain.Auction;
|
|
|
import cn.hobbystocks.auc.domain.Lot;
|
|
import cn.hobbystocks.auc.domain.Lot;
|
|
|
import cn.hobbystocks.auc.service.IAuctionService;
|
|
import cn.hobbystocks.auc.service.IAuctionService;
|
|
@@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
+import java.util.Comparator;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -48,6 +50,27 @@ public class AuctionController extends BaseController {
|
|
|
Auction dbAuction = auctionService.selectAuctionById(auction.getId());
|
|
Auction dbAuction = auctionService.selectAuctionById(auction.getId());
|
|
|
startPage(auction);
|
|
startPage(auction);
|
|
|
List<Lot> lots = lotService.selectLotListByAucId(auction.getId());
|
|
List<Lot> lots = lotService.selectLotListByAucId(auction.getId());
|
|
|
|
|
+ sortLotsByStatusTier(lots);
|
|
|
return AjaxResult.success().put("auction",dbAuction).put("lotList",lots);
|
|
return AjaxResult.success().put("auction",dbAuction).put("lotList",lots);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private void sortLotsByStatusTier(List<Lot> lots) {
|
|
|
|
|
+ if (lots == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ lots.sort(Comparator.comparingInt(lot -> lotStatusTier(lot.getStatus())));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private int lotStatusTier(String status) {
|
|
|
|
|
+ if (Constants.LOT_STATUS_BIDDING.equals(status) || Constants.LOT_STATUS_STARTING.equals(status)) {
|
|
|
|
|
+ return 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (Constants.LOT_STATUS_WAITING.equals(status)) {
|
|
|
|
|
+ return 2;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (Constants.LOT_STATUS_SOLD.equals(status) || Constants.LOT_STATUS_PASS.equals(status)) {
|
|
|
|
|
+ return 3;
|
|
|
|
|
+ }
|
|
|
|
|
+ return 4;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|