Bladeren bron

正式服时间

wangqifan 3 jaren geleden
bovenliggende
commit
0e07a5e9bc

+ 3 - 4
src/main/java/com/izouma/nineth/service/TradeAuctionOrderService.java

@@ -176,10 +176,9 @@ public class TradeAuctionOrderService {
                 tradeAuction.setCurrentPrice(tradeAuctionOrder.getPrice());
                 tradeAuction.setCurrentOwner(tradeAuctionOrder.getNickname());
                 tradeAuction.setCurrentOwnerId(tradeAuctionOrder.getUserId());
-                tradeAuction.setCurrentStartTime(LocalDateTime.now().plusMinutes(1));
+                tradeAuction.setCurrentStartTime(tradeAuction.getCurrentStartTime().plusDays(1));
                 tradeAuction
-                        .setCurrentEndTime(tradeAuction.getCurrentStartTime().plusMinutes(tradeAuction.getMinutes())
-                                .plusMinutes(10));
+                        .setCurrentEndTime(tradeAuction.getCurrentEndTime().plusDays(1));
                 tradeAuction.setFixedPrice(tradeAuctionOrder.getPrice().multiply(BigDecimal.valueOf(150))
                         .divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP));
                 tradeAuction.setStatus(TradeAuctionStatus.WAITING);
@@ -193,7 +192,7 @@ public class TradeAuctionOrderService {
             tradeAuctionOrder.setStatus(AuctionOrderStatus.AIR_DROP);
         }
         tradeAuction.setLastCommission(tradeAuctionOrder.getServiceCharge());
-        tradeAuctionOrder.setCurrentEndTime(LocalDateTime.now().plusMinutes(tradeAuction.getMinutes()).plusDays(1));
+        tradeAuctionOrder.setCurrentEndTime(tradeAuction.getCurrentEndTime());
         tradeAuctionOrder.setCurrentPrice(tradeAuctionOrder.getPrice());
         tradeAuction.setStock(0L);
         tradeAuction.setSale(tradeAuction.getSale() + 1);

+ 7 - 5
src/main/java/com/izouma/nineth/service/TradeAuctionService.java

@@ -25,6 +25,7 @@ import org.springframework.stereotype.Service;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.security.PrivateKey;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.List;
@@ -54,7 +55,8 @@ public class TradeAuctionService {
             ObjUtils.merge(orig, record);
             return tradeAuctionRepo.save(orig);
         }
-        record.setCurrentEndTime(record.getStartTime().plusMinutes(10));
+        record.setStartTime(LocalDate.now().atTime(11, 0));
+        record.setCurrentEndTime(record.getStartTime().plusHours(24));
         record.setIncreasePer(6);
         record.setRoyalties(10);
         record.setCurrentStartTime(record.getStartTime());
@@ -155,7 +157,7 @@ public class TradeAuctionService {
         tradeAuctionStatuses.add(TradeAuctionStatus.NOTSTARTED);
         List<TradeAuction> tradeAuctions = tradeAuctionRepo
                 .findByStatusInAndCurrentStartTimeBefore(tradeAuctionStatuses,
-                        LocalDateTime.now().plusMinutes(1));
+                        LocalDateTime.now().plusSeconds(5));
         tradeAuctions.parallelStream().forEach(o -> {
             try {
                 TradeAuction auction = tradeAuctionRepo.findById(o.getId())
@@ -183,7 +185,7 @@ public class TradeAuctionService {
         tradeAuctionStatuses.add(TradeAuctionStatus.ONGOING);
         List<TradeAuction> tradeAuctions = tradeAuctionRepo
                 .findByStatusInAndCurrentEndTimeBefore(tradeAuctionStatuses,
-                        LocalDateTime.now().plusMinutes(1));
+                        LocalDateTime.now().plusSeconds(5));
         tradeAuctions.parallelStream().forEach(o -> {
             try {
                 TradeAuction auction = tradeAuctionRepo.findById(o.getId())
@@ -202,8 +204,8 @@ public class TradeAuctionService {
                 .orElseThrow(new BusinessException("暂无"));
         tradeAuction.setStatus(TradeAuctionStatus.PURCHASED);
         tradeAuction.setPurchasedPrice(tradeAuction.getCurrentPrice());
-        int time = sysConfigService.getInt("auction_cancel_time");
-        tradeAuction.setCurrentEndTime(LocalDateTime.now().plusMinutes(time));
+//        int time = sysConfigService.getInt("auction_cancel_time");
+        tradeAuction.setCurrentEndTime(LocalDateTime.now().plusHours(48));
         tradeAuctionRepo.save(tradeAuction);
         tradeAuctionOrder.setTradeAuctionStatus(tradeAuction.getStatus());
         tradeAuctionOrder.setCurrentPrice(tradeAuctionOrder.getPrice());

+ 19 - 4
src/main/java/com/izouma/nineth/web/CollectionController.java

@@ -9,9 +9,7 @@ import com.izouma.nineth.exception.BusinessException;
 import com.izouma.nineth.repo.CollectionPrivilegeRepo;
 import com.izouma.nineth.repo.CollectionRepo;
 import com.izouma.nineth.repo.NewsRepo;
-import com.izouma.nineth.service.CacheService;
-import com.izouma.nineth.service.CollectionService;
-import com.izouma.nineth.service.LikeService;
+import com.izouma.nineth.service.*;
 import com.izouma.nineth.utils.SecurityUtils;
 import com.izouma.nineth.utils.excel.ExcelUtils;
 import io.swagger.annotations.ApiOperation;
@@ -29,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.util.*;
+import java.util.concurrent.atomic.AtomicReference;
 import java.util.stream.Collectors;
 
 @RestController
@@ -41,6 +40,7 @@ public class CollectionController extends BaseController {
     private NewsRepo                newsRepo;
     private CacheService            cacheService;
     private CollectionPrivilegeRepo collectionPrivilegeRepo;
+    private SysConfigService        sysConfigService;
 
     @PreAuthorize("hasAnyRole('ADMIN','SAAS')")
     @PostMapping("/save")
@@ -124,7 +124,8 @@ public class CollectionController extends BaseController {
     @GetMapping("/myLikes")
     @ApiOperation("我收藏的")
     public List<CollectionDTO> myLikes(@RequestParam(defaultValue = "1") Long companyId) {
-        return collectionService.toDTO(collectionRepo.userLikes(SecurityUtils.getAuthenticatedUser().getId(), companyId));
+        return collectionService
+                .toDTO(collectionRepo.userLikes(SecurityUtils.getAuthenticatedUser().getId(), companyId));
     }
 
     @PreAuthorize("hasAnyRole('ADMIN','SAAS')")
@@ -232,10 +233,24 @@ public class CollectionController extends BaseController {
         pageQuery.getQuery().remove("salable");
         pageQuery.getQuery().put("inPaying", true);
         long transactingNum = collectionService.all(pageQuery).getTotal();
+        Long destroyedAssets = 0L;
+        AtomicReference<Long> total = new AtomicReference<>(0L);
+        destroyedAssets = collectionService.countDestroyAssets(search);
+        total.set(collectionRepo.sumAllByNameLike("%" + search + "%"));
+        List<String> configs = Arrays.asList(sysConfigService.getString("tag_total_config").split(";"));
+        configs.forEach(config -> {
+            List<String> conf = Arrays.asList(config.split(","));
+            if (StringUtils.equals(conf.get(0), search)) {
+                total.set(Long.valueOf(conf.get(1)));
+            }
+        });
+        Long tranferCount = total.get() - destroyedAssets;
         Map<String, String> map = new HashMap<>();
         map.put("onlyShowNum", String.valueOf(onlyShowNum));
         map.put("consignmentNum", String.valueOf(consignmentNum));
         map.put("transactingNum", String.valueOf(transactingNum));
+        map.put("totalNum", String.valueOf(total));
+        map.put("tranferingNum", String.valueOf(tranferCount));
         return map;
     }
 }