ソースを参照

Merge branch 'dev'

# Conflicts:
#	src/main/java/com/izouma/nineth/service/AssetService.java
xiongzhu 3 年 前
コミット
e3e263a38b

+ 7 - 1
src/main/java/com/izouma/nineth/service/AssetService.java

@@ -28,6 +28,7 @@ import org.springframework.data.domain.Pageable;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.temporal.ChronoUnit;
 import java.util.*;
@@ -105,6 +106,10 @@ public class AssetService {
 
     public void publicShow(Long id) {
         Asset asset = assetRepo.findById(id).orElseThrow(new BusinessException("无记录"));
+        if (asset.getName().contains("鬼卒-")
+                && LocalDate.now().equals(LocalDate.of(2022,3,22))) {
+            throw new BusinessException("此藏品当前无法上架");
+        }
         if (!asset.getUserId().equals(SecurityUtils.getAuthenticatedUser().getId())) {
             throw new BusinessException("此藏品不属于你");
         }
@@ -149,7 +154,8 @@ public class AssetService {
 
     public void consignment(Long id, BigDecimal price) {
         Asset asset = assetRepo.findById(id).orElseThrow(new BusinessException("无记录"));
-        if (asset.getName().contains("鬼卒-")) {
+        if (asset.getName().contains("鬼卒-")
+                && LocalDate.now().equals(LocalDate.of(2022, 3, 22))) {
             throw new BusinessException("此藏品当前无法上架");
         }
         if (!asset.getUserId().equals(SecurityUtils.getAuthenticatedUser().getId())) {

+ 5 - 0
src/main/java/com/izouma/nineth/service/GiftOrderService.java

@@ -45,6 +45,7 @@ import org.springframework.ui.Model;
 import javax.transaction.Transactional;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.Arrays;
@@ -74,6 +75,10 @@ public class GiftOrderService {
     @Transactional
     public GiftOrder gift(Long userId, Long assetId, Long toUserId) {
         Asset asset = assetRepo.findById(assetId).orElseThrow(new BusinessException("资产不存在"));
+        if (asset.getName().contains("鬼卒-")
+                && LocalDate.now().equals(LocalDate.of(2022,3,22))) {
+            throw new BusinessException("此藏品当前无法上架");
+        }
         if (!asset.getUserId().equals(userId)) {
             throw new BusinessException("无权限");
         }