Răsfoiți Sursa

更新黑名单

wangqifan 3 ani în urmă
părinte
comite
11fe25691f
1 a modificat fișierele cu 37 adăugiri și 36 ștergeri
  1. 37 36
      src/main/java/com/izouma/nineth/service/OrderService.java

+ 37 - 36
src/main/java/com/izouma/nineth/service/OrderService.java

@@ -74,38 +74,38 @@ import java.util.stream.Collectors;
 @Slf4j
 public class OrderService {
 
-    private final OrderRepo orderRepo;
-    private final CollectionRepo collectionRepo;
-    private final UserAddressRepo userAddressRepo;
-    private final UserRepo userRepo;
-    private final Environment env;
-    private final AlipayClient alipayClient;
-    private final AlipayProperties alipayProperties;
-    private final WxPayService wxPayService;
-    private final WxPayProperties wxPayProperties;
-    private final AssetService assetService;
-    private final SysConfigService sysConfigService;
-    private final AssetRepo assetRepo;
-    private final UserCouponRepo userCouponRepo;
-    private final CollectionService collectionService;
-    private final CommissionRecordRepo commissionRecordRepo;
-    private final AdapayProperties adapayProperties;
-    private final GeneralProperties generalProperties;
-    private final RocketMQTemplate rocketMQTemplate;
+    private final OrderRepo                     orderRepo;
+    private final CollectionRepo                collectionRepo;
+    private final UserAddressRepo               userAddressRepo;
+    private final UserRepo                      userRepo;
+    private final Environment                   env;
+    private final AlipayClient                  alipayClient;
+    private final AlipayProperties              alipayProperties;
+    private final WxPayService                  wxPayService;
+    private final WxPayProperties               wxPayProperties;
+    private final AssetService                  assetService;
+    private final SysConfigService              sysConfigService;
+    private final AssetRepo                     assetRepo;
+    private final UserCouponRepo                userCouponRepo;
+    private final CollectionService             collectionService;
+    private final CommissionRecordRepo          commissionRecordRepo;
+    private final AdapayProperties              adapayProperties;
+    private final GeneralProperties             generalProperties;
+    private final RocketMQTemplate              rocketMQTemplate;
     private final RedisTemplate<String, Object> redisTemplate;
-    private final SnowflakeIdWorker snowflakeIdWorker;
-    private final SmsService smsService;
-    private final ErrorOrderRepo errorOrderRepo;
-    private final ShowCollectionRepo showCollectionRepo;
-    private final ShowroomService showroomService;
-    private final CollectionPrivilegeRepo collectionPrivilegeRepo;
-    private final UserBankCardRepo userBankCardRepo;
-    private final CacheService cacheService;
-    private final UserPropertyRepo userPropertyRepo;
-    private final UserBalanceService userBalanceService;
-    private final ProxyManager<String> buckets;
-    private final HeatInfoRepo heatInfoRepo;
-    private final ShowroomRepo showroomRepo;
+    private final SnowflakeIdWorker             snowflakeIdWorker;
+    private final SmsService                    smsService;
+    private final ErrorOrderRepo                errorOrderRepo;
+    private final ShowCollectionRepo            showCollectionRepo;
+    private final ShowroomService               showroomService;
+    private final CollectionPrivilegeRepo       collectionPrivilegeRepo;
+    private final UserBankCardRepo              userBankCardRepo;
+    private final CacheService                  cacheService;
+    private final UserPropertyRepo              userPropertyRepo;
+    private final UserBalanceService            userBalanceService;
+    private final ProxyManager<String>          buckets;
+    private final HeatInfoRepo                  heatInfoRepo;
+    private final ShowroomRepo                  showroomRepo;
 
     public OrderService(OrderRepo orderRepo, CollectionRepo collectionRepo, UserAddressRepo userAddressRepo,
                         UserRepo userRepo, Environment env, AlipayClient alipayClient,
@@ -350,8 +350,8 @@ public class OrderService {
                     .contactName(Optional.ofNullable(userAddress).map(UserAddress::getName).orElse(null))
                     .contactPhone(Optional.ofNullable(userAddress).map(UserAddress::getPhone).orElse(null))
                     .address(Optional.ofNullable(userAddress).map(u ->
-                                    u.getProvinceName() + " " + u.getCityName() + " " + u.getDistrictName() + " " + u
-                                            .getAddress())
+                            u.getProvinceName() + " " + u.getCityName() + " " + u.getDistrictName() + " " + u
+                                    .getAddress())
                             .orElse(null))
                     .status(OrderStatus.NOT_PAID)
                     .assetId(collection.getAssetId())
@@ -749,7 +749,8 @@ public class OrderService {
                 }
 
                 //通过展厅购买加热力值
-                List<HeatInfo> heatInfos = heatInfoRepo.findByUserIdAndOrderIdAndType(order.getUserId(), orderId, HeatType.BUY);
+                List<HeatInfo> heatInfos = heatInfoRepo
+                        .findByUserIdAndOrderIdAndType(order.getUserId(), orderId, HeatType.BUY);
                 if (CollUtil.isNotEmpty(heatInfos)) {
                     HeatInfo heatInfo = heatInfos.get(0);
                     int weight = sysConfigService.getInt("heat_buy_weight");
@@ -1012,10 +1013,10 @@ public class OrderService {
         EasyExcel.write(outputStream, MarketSettlement.class).sheet("sheet").doWrite(settlements);
     }
 
-    @Scheduled(cron = "0 0/10 * * * ?")
+    @Scheduled(cron = "0 0/5 * * * ?")
     public void setBlackList() {
         List<Long> userIds = orderRepo
-                .checkBlackList(LocalDateTime.now(), LocalDateTime.now().minusHours(1));
+                .checkBlackList(LocalDateTime.now(), LocalDateTime.now().plusHours(1));
         userIds.forEach(userId -> {
             redisTemplate.opsForValue().set(RedisKeys.BLACK_LIST + userId, 1, Duration.ofSeconds(60 * 60));
         });