|
@@ -74,6 +74,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
@@ -74,6 +74,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
74
|
private String SETTLEMENT_TOPIC = "front.union.shareSettleAdd";
|
74
|
private String SETTLEMENT_TOPIC = "front.union.shareSettleAdd";
|
75
|
private String NEW_USER_REBATES_RATIO_KEY = "union.newUserRebatesRatio";
|
75
|
private String NEW_USER_REBATES_RATIO_KEY = "union.newUserRebatesRatio";
|
76
|
private String OLD_USER_REBATES_RATIO_KEY = "union.oldUserRebatesRatio";
|
76
|
private String OLD_USER_REBATES_RATIO_KEY = "union.oldUserRebatesRatio";
|
|
|
77
|
+ private String UNION_SHAREID = "union.shareId";
|
|
|
78
|
+ private String UNION_URL = "union.url";
|
77
|
|
79
|
|
78
|
/**
|
80
|
/**
|
79
|
* 获取用户可提现金额、已提现金额、是否可以提现
|
81
|
* 获取用户可提现金额、已提现金额、是否可以提现
|
|
@@ -229,7 +231,9 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
@@ -229,7 +231,9 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
229
|
//获取数据库
|
231
|
//获取数据库
|
230
|
UnionShareUser unionShareUser = unionShareUserMapper.selectByUid(uid);
|
232
|
UnionShareUser unionShareUser = unionShareUserMapper.selectByUid(uid);
|
231
|
//设置返回文案
|
233
|
//设置返回文案
|
232
|
- unionShareUser.setNote("邀请新客购买返点" + configReader.getDouble(NEW_USER_REBATES_RATIO_KEY, 0.1) + ",老客" + configReader.getDouble(OLD_USER_REBATES_RATIO_KEY, 0.03));
|
234
|
+ unionShareUser.setNote("邀请新客购买返点"+configReader.getDouble(NEW_USER_REBATES_RATIO_KEY, 0.1)+",老客"+configReader.getDouble(OLD_USER_REBATES_RATIO_KEY, 0.03));
|
|
|
235
|
+ unionShareUser.setShareId(configReader.getString(UNION_SHAREID, ""));
|
|
|
236
|
+ unionShareUser.setUrl(configReader.getString(UNION_URL, ""));
|
233
|
//设置缓存
|
237
|
//设置缓存
|
234
|
addToRedis(ShareOrdersKeyEnum.UNION_TYPE, uid, unionShareUser, key);
|
238
|
addToRedis(ShareOrdersKeyEnum.UNION_TYPE, uid, unionShareUser, key);
|
235
|
return unionShareUser;
|
239
|
return unionShareUser;
|
|
@@ -242,12 +246,30 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
@@ -242,12 +246,30 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
242
|
*/
|
246
|
*/
|
243
|
@Override
|
247
|
@Override
|
244
|
public UnionShareOrders queryRecentlyOrderLimitTen(int uid) {
|
248
|
public UnionShareOrders queryRecentlyOrderLimitTen(int uid) {
|
|
|
249
|
+ //先从缓存获取
|
|
|
250
|
+ String key = "recentlyOrderLimitTen";
|
|
|
251
|
+ UnionShareOrders cacheResult = getFromRedis(ShareOrdersKeyEnum.RECENTLY_ORDER_LIMIT_TEN, uid, UnionShareOrders.class, key);
|
|
|
252
|
+ if (cacheResult != null) {
|
|
|
253
|
+ logger.info("UnionShareServiceImpl :: queryRecentlyOrderLimitTen get redis cache ,uid is {},cacheResult is {}",uid,cacheResult);
|
|
|
254
|
+ return cacheResult;
|
|
|
255
|
+ }
|
|
|
256
|
+ //获取数据库
|
245
|
UnionShareOrders unionShareOrders = unionShareOrdersMapper.selectRecentlyOrderLimitTen(uid);
|
257
|
UnionShareOrders unionShareOrders = unionShareOrdersMapper.selectRecentlyOrderLimitTen(uid);
|
|
|
258
|
+ //设置缓存
|
|
|
259
|
+ addToRedis(ShareOrdersKeyEnum.RECENTLY_ORDER_LIMIT_TEN,uid,unionShareOrders,key);
|
246
|
return unionShareOrders;
|
260
|
return unionShareOrders;
|
247
|
}
|
261
|
}
|
248
|
|
262
|
|
249
|
@Override
|
263
|
@Override
|
250
|
- public ShareOrderBo queryOrderDetail(String orderCode) {
|
264
|
+ public ShareOrderBo queryOrderDetail(Integer uid, String orderCode) {
|
|
|
265
|
+ //先从缓存获取
|
|
|
266
|
+ String key = "orderDetail";
|
|
|
267
|
+ ShareOrderBo cacheResult = getFromRedis(ShareOrdersKeyEnum.ORDER_INFO, uid, ShareOrderBo.class, key, orderCode);
|
|
|
268
|
+ if (cacheResult != null) {
|
|
|
269
|
+ logger.info("UnionShareServiceImpl :: queryOrderDetail get redis cache ,uid is {},cacheResult is {}",uid,cacheResult);
|
|
|
270
|
+ return cacheResult;
|
|
|
271
|
+ }
|
|
|
272
|
+ //数据库获取数据
|
251
|
UnionShareOrders unionShareOrders = unionShareOrdersMapper.selectByCode(orderCode);
|
273
|
UnionShareOrders unionShareOrders = unionShareOrdersMapper.selectByCode(orderCode);
|
252
|
if (null == unionShareOrders){
|
274
|
if (null == unionShareOrders){
|
253
|
return null;
|
275
|
return null;
|
|
@@ -258,12 +280,27 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
@@ -258,12 +280,27 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
258
|
shareOrderBo = convert.convertFrom(unionShareOrders,shareOrderBo,ShareOrderBo.class);
|
280
|
shareOrderBo = convert.convertFrom(unionShareOrders,shareOrderBo,ShareOrderBo.class);
|
259
|
shareOrderBo.setIsNew(unionShareOrders.getIsNew().toString());
|
281
|
shareOrderBo.setIsNew(unionShareOrders.getIsNew().toString());
|
260
|
shareOrderBo.setProductList(shareOrdersProductBoList);
|
282
|
shareOrderBo.setProductList(shareOrdersProductBoList);
|
|
|
283
|
+ //设置缓存
|
|
|
284
|
+ addToRedis(ShareOrdersKeyEnum.ORDER_INFO,uid,unionShareOrders,key, orderCode);
|
261
|
return shareOrderBo;
|
285
|
return shareOrderBo;
|
262
|
}
|
286
|
}
|
263
|
|
287
|
|
264
|
@Override
|
288
|
@Override
|
265
|
- public List<UnionShareSettlement> querySettlementRecord(int uid, Integer start, Integer size) {
|
|
|
266
|
- List<UnionShareSettlement> unionShareSettlement = unionShareSettlementMapper.selectSettlementRecordByUid(uid, start, size);
|
289
|
+ public List<UnionShareSettlement> querySettlementRecord(UnionShareOrderReqBO unionShareOrderReqBO) {
|
|
|
290
|
+ //先从缓存获取
|
|
|
291
|
+ String key = "orderDetail";
|
|
|
292
|
+ UnionShareSettlementListBO cacheResult = getFromRedis(ShareOrdersKeyEnum.SETTLEMENT_LIST, unionShareOrderReqBO.getUid(),
|
|
|
293
|
+ UnionShareSettlementListBO.class, key, String.valueOf(unionShareOrderReqBO.getPage()), String.valueOf(unionShareOrderReqBO.getSize()));
|
|
|
294
|
+ if (cacheResult != null) {
|
|
|
295
|
+ logger.info("UnionShareServiceImpl :: queryOrderDetail get redis cache ,uid is {},cacheResult is {}",unionShareOrderReqBO.getUid(),cacheResult);
|
|
|
296
|
+ return cacheResult.getList();
|
|
|
297
|
+ }
|
|
|
298
|
+ List<UnionShareSettlement> unionShareSettlement = unionShareSettlementMapper.selectSettlementRecordByUid(unionShareOrderReqBO.getUid(),
|
|
|
299
|
+ unionShareOrderReqBO.getPage()*unionShareOrderReqBO.getSize(), unionShareOrderReqBO.getSize());
|
|
|
300
|
+ //设置缓存
|
|
|
301
|
+ UnionShareSettlementListBO unionShareSettlementListBO = new UnionShareSettlementListBO();
|
|
|
302
|
+ unionShareSettlementListBO.setList(unionShareSettlement);
|
|
|
303
|
+ addToRedis(ShareOrdersKeyEnum.ORDER_INFO,unionShareOrderReqBO.getUid(),unionShareSettlementListBO,key, String.valueOf(unionShareOrderReqBO.getPage()), String.valueOf(unionShareOrderReqBO.getSize()));
|
267
|
return unionShareSettlement;
|
304
|
return unionShareSettlement;
|
268
|
}
|
305
|
}
|
269
|
|
306
|
|