...
|
...
|
@@ -74,6 +74,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
private String SETTLEMENT_TOPIC = "front.union.shareSettleAdd";
|
|
|
private String NEW_USER_REBATES_RATIO_KEY = "union.newUserRebatesRatio";
|
|
|
private String OLD_USER_REBATES_RATIO_KEY = "union.oldUserRebatesRatio";
|
|
|
private String UNION_SHAREID = "union.shareId";
|
|
|
private String UNION_URL = "union.url";
|
|
|
|
|
|
/**
|
|
|
* 获取用户可提现金额、已提现金额、是否可以提现
|
...
|
...
|
@@ -229,7 +231,9 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
//获取数据库
|
|
|
UnionShareUser unionShareUser = unionShareUserMapper.selectByUid(uid);
|
|
|
//设置返回文案
|
|
|
unionShareUser.setNote("邀请新客购买返点" + configReader.getDouble(NEW_USER_REBATES_RATIO_KEY, 0.1) + ",老客" + configReader.getDouble(OLD_USER_REBATES_RATIO_KEY, 0.03));
|
|
|
unionShareUser.setNote("邀请新客购买返点"+configReader.getDouble(NEW_USER_REBATES_RATIO_KEY, 0.1)+",老客"+configReader.getDouble(OLD_USER_REBATES_RATIO_KEY, 0.03));
|
|
|
unionShareUser.setShareId(configReader.getString(UNION_SHAREID, ""));
|
|
|
unionShareUser.setUrl(configReader.getString(UNION_URL, ""));
|
|
|
//设置缓存
|
|
|
addToRedis(ShareOrdersKeyEnum.UNION_TYPE, uid, unionShareUser, key);
|
|
|
return unionShareUser;
|
...
|
...
|
@@ -242,12 +246,30 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
*/
|
|
|
@Override
|
|
|
public UnionShareOrders queryRecentlyOrderLimitTen(int uid) {
|
|
|
//先从缓存获取
|
|
|
String key = "recentlyOrderLimitTen";
|
|
|
UnionShareOrders cacheResult = getFromRedis(ShareOrdersKeyEnum.RECENTLY_ORDER_LIMIT_TEN, uid, UnionShareOrders.class, key);
|
|
|
if (cacheResult != null) {
|
|
|
logger.info("UnionShareServiceImpl :: queryRecentlyOrderLimitTen get redis cache ,uid is {},cacheResult is {}",uid,cacheResult);
|
|
|
return cacheResult;
|
|
|
}
|
|
|
//获取数据库
|
|
|
UnionShareOrders unionShareOrders = unionShareOrdersMapper.selectRecentlyOrderLimitTen(uid);
|
|
|
//设置缓存
|
|
|
addToRedis(ShareOrdersKeyEnum.RECENTLY_ORDER_LIMIT_TEN,uid,unionShareOrders,key);
|
|
|
return unionShareOrders;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public ShareOrderBo queryOrderDetail(String orderCode) {
|
|
|
public ShareOrderBo queryOrderDetail(Integer uid, String orderCode) {
|
|
|
//先从缓存获取
|
|
|
String key = "orderDetail";
|
|
|
ShareOrderBo cacheResult = getFromRedis(ShareOrdersKeyEnum.ORDER_INFO, uid, ShareOrderBo.class, key, orderCode);
|
|
|
if (cacheResult != null) {
|
|
|
logger.info("UnionShareServiceImpl :: queryOrderDetail get redis cache ,uid is {},cacheResult is {}",uid,cacheResult);
|
|
|
return cacheResult;
|
|
|
}
|
|
|
//数据库获取数据
|
|
|
UnionShareOrders unionShareOrders = unionShareOrdersMapper.selectByCode(orderCode);
|
|
|
if (null == unionShareOrders){
|
|
|
return null;
|
...
|
...
|
@@ -258,12 +280,27 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
shareOrderBo = convert.convertFrom(unionShareOrders,shareOrderBo,ShareOrderBo.class);
|
|
|
shareOrderBo.setIsNew(unionShareOrders.getIsNew().toString());
|
|
|
shareOrderBo.setProductList(shareOrdersProductBoList);
|
|
|
//设置缓存
|
|
|
addToRedis(ShareOrdersKeyEnum.ORDER_INFO,uid,unionShareOrders,key, orderCode);
|
|
|
return shareOrderBo;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<UnionShareSettlement> querySettlementRecord(int uid, Integer start, Integer size) {
|
|
|
List<UnionShareSettlement> unionShareSettlement = unionShareSettlementMapper.selectSettlementRecordByUid(uid, start, size);
|
|
|
public List<UnionShareSettlement> querySettlementRecord(UnionShareOrderReqBO unionShareOrderReqBO) {
|
|
|
//先从缓存获取
|
|
|
String key = "orderDetail";
|
|
|
UnionShareSettlementListBO cacheResult = getFromRedis(ShareOrdersKeyEnum.SETTLEMENT_LIST, unionShareOrderReqBO.getUid(),
|
|
|
UnionShareSettlementListBO.class, key, String.valueOf(unionShareOrderReqBO.getPage()), String.valueOf(unionShareOrderReqBO.getSize()));
|
|
|
if (cacheResult != null) {
|
|
|
logger.info("UnionShareServiceImpl :: queryOrderDetail get redis cache ,uid is {},cacheResult is {}",unionShareOrderReqBO.getUid(),cacheResult);
|
|
|
return cacheResult.getList();
|
|
|
}
|
|
|
List<UnionShareSettlement> unionShareSettlement = unionShareSettlementMapper.selectSettlementRecordByUid(unionShareOrderReqBO.getUid(),
|
|
|
unionShareOrderReqBO.getPage()*unionShareOrderReqBO.getSize(), unionShareOrderReqBO.getSize());
|
|
|
//设置缓存
|
|
|
UnionShareSettlementListBO unionShareSettlementListBO = new UnionShareSettlementListBO();
|
|
|
unionShareSettlementListBO.setList(unionShareSettlement);
|
|
|
addToRedis(ShareOrdersKeyEnum.ORDER_INFO,unionShareOrderReqBO.getUid(),unionShareSettlementListBO,key, String.valueOf(unionShareOrderReqBO.getPage()), String.valueOf(unionShareOrderReqBO.getSize()));
|
|
|
return unionShareSettlement;
|
|
|
}
|
|
|
|
...
|
...
|
|