Browse Source

properties set null

hr~ 1 month ago
parent
commit
0c598ee632

+ 7 - 5
bid/src/main/java/cn/hobbystocks/auc/task/BidTask.java

@@ -7,22 +7,21 @@ import cn.hobbystocks.auc.common.core.redis.Locker;
 import cn.hobbystocks.auc.common.core.redis.RedisCache;
 import cn.hobbystocks.auc.common.user.UserUtils;
 import cn.hobbystocks.auc.common.utils.CloneUtils;
-import cn.hobbystocks.auc.common.utils.DateUtils;
 import cn.hobbystocks.auc.domain.*;
 import cn.hobbystocks.auc.handle.RuleHandlerHolder;
 import cn.hobbystocks.auc.handle.context.Live;
-import cn.hobbystocks.auc.mapper.*;
+import cn.hobbystocks.auc.mapper.BidMapper;
+import cn.hobbystocks.auc.mapper.BidRecordMapper;
+import cn.hobbystocks.auc.mapper.LotMapper;
 import cn.hobbystocks.auc.service.DepositOrderService;
 import cn.hobbystocks.auc.service.IAuctionService;
 import cn.hobbystocks.auc.service.ILotService;
 import cn.hobbystocks.auc.service.IOrderService;
-import cn.hobbystocks.auc.vo.OrderVO;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.google.common.collect.Lists;
 import io.micrometer.core.instrument.util.NamedThreadFactory;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.Strings;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Scheduled;
@@ -31,7 +30,10 @@ import org.springframework.util.CollectionUtils;
 
 import javax.annotation.PostConstruct;
 import java.util.*;
-import java.util.concurrent.*;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
 
 @Component
 @Slf4j

+ 13 - 11
lot/src/main/java/cn/hobbystocks/auc/common/utils/CloneUtils.java

@@ -1,5 +1,6 @@
 package cn.hobbystocks.auc.common.utils;
 
+import cn.hutool.core.util.ObjectUtil;
 import lombok.extern.slf4j.Slf4j;
 
 import java.io.ByteArrayInputStream;
@@ -12,17 +13,18 @@ public class CloneUtils {
 
 
      public static <T> T clone(T obj) {
-         try {
-             ByteArrayOutputStream bos = new ByteArrayOutputStream();
-             ObjectOutputStream oos = new ObjectOutputStream(bos);
-             oos.writeObject(obj);
-             ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
-             ObjectInputStream ois = new ObjectInputStream(bis);
-             return (T) ois.readObject();
-         }catch (Exception e) {
-             log.error("clone error", e);
-             return null;
-         }
+//         try {
+//             ByteArrayOutputStream bos = new ByteArrayOutputStream();
+//             ObjectOutputStream oos = new ObjectOutputStream(bos);
+//             oos.writeObject(obj);
+//             ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
+//             ObjectInputStream ois = new ObjectInputStream(bis);
+//             return (T) ois.readObject();
+//         }catch (Exception e) {
+//             log.error("clone error", e);
+//             return null;
+//         }
+         return ObjectUtil.clone(obj);
     }
 
 }

+ 2 - 0
lot/src/main/java/cn/hobbystocks/auc/service/impl/LotServiceImpl.java

@@ -481,6 +481,8 @@ public class LotServiceImpl extends ServiceImpl<LotMapper,Lot> implements ILotSe
             redisCache.setList(String.format(Constants.REDIS_MAP_AUC_LOT_BID_TEMPLATE, live.getLot().getId()), dataList);
             changeEvent.setBid(liveContext.getDbBid());
         }
+        Lot lot = live.getLot();
+        lot.setProperties(null);
         if (liveContext.isLiveUpdate()) {
             if (Constants.LOT_STATUS_SOLD.equals(live.getLot().getStatus()) ||
                     Constants.LOT_STATUS_PASS.equals(live.getLot().getStatus())) {