...
|
...
|
@@ -1592,26 +1592,27 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
return activities;
|
|
|
}
|
|
|
|
|
|
//查询进行中的活动
|
|
|
private List<UnionShareOrdersActivity> queryActivity() {
|
|
|
logger.info("queryActivity.");
|
|
|
String activitiesCache = redisValueCache.get(ShareOrdersKeyEnum.ACTIVITY_ING_LIST.getPreKey(), String.class);
|
|
|
//查询某时间为进行中的活动
|
|
|
private List<UnionShareOrdersActivity> queryActivityByDate(int date) {
|
|
|
logger.info("queryActivityByDate.date is {}.",date);
|
|
|
String dateStr=DateUtil.getDateStrBySecond(date, "yyyyMMdd");
|
|
|
String activitiesCache = redisValueCache.get(ShareOrdersKeyEnum.ACTIVITY_ING_LIST.getPreKey()+dateStr, String.class);
|
|
|
List<UnionShareOrdersActivity> activities;
|
|
|
if (activitiesCache != null) {
|
|
|
activities = JSONObject.parseArray(activitiesCache, UnionShareOrdersActivity.class);
|
|
|
if (CollectionUtils.isNotEmpty(activities)) {
|
|
|
logger.info("queryActivity.get chache {}",activities);
|
|
|
logger.info("queryActivityByDate.date is {},dateStr is {},get chache {}",date,dateStr,activities);
|
|
|
return activities;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
activities=unionShareOrdersActivityMapper.selectByDate(DateUtil.getCurrentTimeSecond());
|
|
|
activities=unionShareOrdersActivityMapper.selectByDate(date);
|
|
|
if (CollectionUtils.isEmpty(activities)) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
logger.info("queryActivity.add to redis.value is {}",activities);
|
|
|
redisValueCache.set(ShareOrdersKeyEnum.ACTIVITY_ING_LIST.getPreKey(),activities,ShareOrdersKeyEnum.ACTIVITY_ING_LIST.getCacheTime(),TimeUnit.SECONDS);
|
|
|
logger.info("queryActivityByDate.add to redis.value is {}",activities);
|
|
|
redisValueCache.set(ShareOrdersKeyEnum.ACTIVITY_ING_LIST.getPreKey()+dateStr,activities,ShareOrdersKeyEnum.ACTIVITY_ING_LIST.getCacheTime(),TimeUnit.SECONDS);
|
|
|
return activities;
|
|
|
}
|
|
|
//获取某时间段可参与活动的单数
|
...
|
...
|
@@ -1984,7 +1985,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
unionShareOrdersMapper.insertSelective(insertReq);
|
|
|
//活动返利
|
|
|
try {
|
|
|
List<UnionShareOrdersActivity> activityList = queryActivity();
|
|
|
List<UnionShareOrdersActivity> activityList = queryActivityByDate(bo.getOrderTime());
|
|
|
for (UnionShareOrdersActivity a :activityList ) {
|
|
|
if(participateActivity(insertReq,a)) {
|
|
|
//参加了活动,参加一个加返活动就可以了
|
...
|
...
|
@@ -2252,8 +2253,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
bo.setOrderCodes(orderCodes);
|
|
|
bo.setOrderList(orderList);
|
|
|
bo.setActivities(activityBos);
|
|
|
System.out.println(JsonUtil.objectToJSON(bo));
|
|
|
mqLog.info("relateSettlementAndOrder,send mq {} to erp,uid is {},settlementCode is {},bo is {}", SETTLEMENT_TOPIC, uid, settlementCode, bo);
|
|
|
mqLog.info("relateSettlementAndOrder,send mq {} to erp,uid is {},settlementCode is {},bo is {}", SETTLEMENT_TOPIC, uid, settlementCode, JsonUtil.objectToJSON(bo));
|
|
|
yhProducer.send(SETTLEMENT_TOPIC, bo);
|
|
|
settlementLog.info("relateSettlementAndOrder,send mq {} to erp success,uid is {},settlementCode is {},bo is {}", SETTLEMENT_TOPIC, uid, settlementCode, bo);
|
|
|
return totalAmount;
|
...
|
...
|
|