|
@@ -10,6 +10,7 @@ import com.yoho.activity.dal.CutDownPriceUserHelpMapper; |
|
@@ -10,6 +10,7 @@ import com.yoho.activity.dal.CutDownPriceUserHelpMapper; |
10
|
import com.yoho.activity.dal.CutDownPriceUserRecordMapper;
|
10
|
import com.yoho.activity.dal.CutDownPriceUserRecordMapper;
|
11
|
import com.yoho.activity.dal.model.CutDownPriceProductHelpUser;
|
11
|
import com.yoho.activity.dal.model.CutDownPriceProductHelpUser;
|
12
|
import com.yoho.activity.dal.model.CutDownPriceUserRecord;
|
12
|
import com.yoho.activity.dal.model.CutDownPriceUserRecord;
|
|
|
13
|
+import com.yoho.activity.queue.constant.CutPriceConstant;
|
13
|
import com.yoho.activity.queue.service.ICutDownPriceActivityService;
|
14
|
import com.yoho.activity.queue.service.ICutDownPriceActivityService;
|
14
|
import com.yoho.activity.queue.service.ICutDownPriceProductService;
|
15
|
import com.yoho.activity.queue.service.ICutDownPriceProductService;
|
15
|
import com.yoho.activity.queue.service.ICutDownPriceService;
|
16
|
import com.yoho.activity.queue.service.ICutDownPriceService;
|
|
@@ -45,6 +46,7 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService { |
|
@@ -45,6 +46,7 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService { |
45
|
private static Logger logger = LoggerFactory.getLogger(CutDownPriceServiceImpl.class);
|
46
|
private static Logger logger = LoggerFactory.getLogger(CutDownPriceServiceImpl.class);
|
46
|
private static final Integer SYSTEM_HELP_ID = 0;
|
47
|
private static final Integer SYSTEM_HELP_ID = 0;
|
47
|
private static final Integer MAX_HELP_COUNT = 3;
|
48
|
private static final Integer MAX_HELP_COUNT = 3;
|
|
|
49
|
+
|
48
|
private static final String SYSTEM_HELP_NAME = "有货";
|
50
|
private static final String SYSTEM_HELP_NAME = "有货";
|
49
|
private static final String SYSTEM_HELP_IMAGE = "https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTKic2dZ7ib6p1PJJXFpYl95ibRyvSKCib3icUiaStlRN6PWmcRZjzPn4w4moEk2xhUxpYbibuPtBNPJBMeqQ/132";
|
51
|
private static final String SYSTEM_HELP_IMAGE = "https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTKic2dZ7ib6p1PJJXFpYl95ibRyvSKCib3icUiaStlRN6PWmcRZjzPn4w4moEk2xhUxpYbibuPtBNPJBMeqQ/132";
|
50
|
@Autowired
|
52
|
@Autowired
|
|
@@ -218,6 +220,8 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService { |
|
@@ -218,6 +220,8 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService { |
218
|
PageResponseBo<CutDownPriceActivityProductBo> cacheResult = getFromRedis(CacheKeyEnum.CUTDOWN_PRICE_MYPRODUCTLIST_INFO, uid,
|
220
|
PageResponseBo<CutDownPriceActivityProductBo> cacheResult = getFromRedis(CacheKeyEnum.CUTDOWN_PRICE_MYPRODUCTLIST_INFO, uid,
|
219
|
PageResponseBo.class, String.valueOf(request.getPage()), String.valueOf(request.getSize()));
|
221
|
PageResponseBo.class, String.valueOf(request.getPage()), String.valueOf(request.getSize()));
|
220
|
if (cacheResult != null) {
|
222
|
if (cacheResult != null) {
|
|
|
223
|
+ // 赋值当前时间
|
|
|
224
|
+ buildCurrentTime(cacheResult);
|
221
|
return cacheResult;
|
225
|
return cacheResult;
|
222
|
}
|
226
|
}
|
223
|
// 查询我的砍价列表
|
227
|
// 查询我的砍价列表
|
|
@@ -543,6 +547,24 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService { |
|
@@ -543,6 +547,24 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService { |
543
|
List<CutDownPriceProductHelpUserBo> helpUserBos = getCutDownPriceProductHelpUserBo(record.getUserId(), record.getActivityId(), record.getProductSkn(), helpUserBoList);
|
547
|
List<CutDownPriceProductHelpUserBo> helpUserBos = getCutDownPriceProductHelpUserBo(record.getUserId(), record.getActivityId(), record.getProductSkn(), helpUserBoList);
|
544
|
CutDownPriceActivityProductBo cutDownPriceActivityProductBo = buildCutDownPriceActivityProductBo(activityBo, cutDownPriceProductBo, helpUserBos, productBoArray);
|
548
|
CutDownPriceActivityProductBo cutDownPriceActivityProductBo = buildCutDownPriceActivityProductBo(activityBo, cutDownPriceProductBo, helpUserBos, productBoArray);
|
545
|
cutDownPriceActivityProductBo.setCreateTime(record.getCreateTime());
|
549
|
cutDownPriceActivityProductBo.setCreateTime(record.getCreateTime());
|
|
|
550
|
+ cutDownPriceActivityProductBo.setCutTime(record.getCutTime());
|
|
|
551
|
+
|
|
|
552
|
+ if(DateUtils.getCurrentTimeSecond()>activityBo.getEndTime()){
|
|
|
553
|
+ // 活动已结束
|
|
|
554
|
+ cutDownPriceActivityProductBo.setCutStatus(CutPriceConstant.CUT_STATUS_END);
|
|
|
555
|
+ }else{
|
|
|
556
|
+ // 活动进行中
|
|
|
557
|
+ if(helpUserBos.size()>cutDownPriceProductBo.getJoinNum()){
|
|
|
558
|
+ // 砍价已成功
|
|
|
559
|
+ cutDownPriceActivityProductBo.setCutStatus(CutPriceConstant.CUT_STATUS_SUCCESS);
|
|
|
560
|
+ }else if(DateUtils.getCurrentTimeSecond()-record.getCreateTime()>24*3600){
|
|
|
561
|
+ // 未成功,发起已超过24小时,已失效
|
|
|
562
|
+ cutDownPriceActivityProductBo.setCutStatus(CutPriceConstant.CUT_STATUS_EXPIRE);
|
|
|
563
|
+ }else{
|
|
|
564
|
+ // 未成功,发起24小时内,砍价中
|
|
|
565
|
+ cutDownPriceActivityProductBo.setCutStatus(CutPriceConstant.CUT_STATUS_ONGOING);
|
|
|
566
|
+ }
|
|
|
567
|
+ }
|
546
|
list.add(cutDownPriceActivityProductBo);
|
568
|
list.add(cutDownPriceActivityProductBo);
|
547
|
}
|
569
|
}
|
548
|
return list;
|
570
|
return list;
|
|
@@ -572,6 +594,15 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService { |
|
@@ -572,6 +594,15 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService { |
572
|
return cutDownPriceProductBo;
|
594
|
return cutDownPriceProductBo;
|
573
|
}
|
595
|
}
|
574
|
|
596
|
|
|
|
597
|
+ private void buildCurrentTime(PageResponseBo<CutDownPriceActivityProductBo> cacheResult) {
|
|
|
598
|
+ List<CutDownPriceActivityProductBo> productList = cacheResult.getList();
|
|
|
599
|
+ if(CollectionUtils.isNotEmpty(productList)){
|
|
|
600
|
+ for(CutDownPriceActivityProductBo bo : productList){
|
|
|
601
|
+ bo.setCurrentTime(DateUtils.getCurrentTimeSecond());
|
|
|
602
|
+ }
|
|
|
603
|
+ }
|
|
|
604
|
+ }
|
|
|
605
|
+
|
575
|
|
606
|
|
576
|
public <T> T getFromRedis(CacheKeyEnum keyEnum, Integer uid, Class<T> clazz, String... param) {
|
607
|
public <T> T getFromRedis(CacheKeyEnum keyEnum, Integer uid, Class<T> clazz, String... param) {
|
577
|
return redisHashCache.get(keyEnum.getCacheKey(), uid, keyEnum.getHashKey(param), clazz);
|
608
|
return redisHashCache.get(keyEnum.getCacheKey(), uid, keyEnum.getHashKey(param), clazz);
|