...
|
...
|
@@ -245,12 +245,12 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
}
|
|
|
//获取数据库
|
|
|
UnionShareUser unionShareUser = unionShareUserMapper.selectByUid(uid);
|
|
|
if (null == unionShareUser){
|
|
|
return unionShareUser;
|
|
|
}
|
|
|
//设置返回文案
|
|
|
if (null != unionShareUser){
|
|
|
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, ""));
|
|
|
}
|
|
|
unionShareUser.setImageUrl(configReader.getString(UNION_URL, ""));
|
|
|
//设置缓存
|
|
|
addToRedis(ShareOrdersKeyEnum.UNION_TYPE, uid, unionShareUser, key);
|
|
|
return unionShareUser;
|
...
|
...
|
@@ -267,7 +267,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
String key = "recentlyOrderLimitTen";
|
|
|
UnionShareOrdersListBO cacheResult = getFromRedis(ShareOrdersKeyEnum.RECENTLY_ORDER_LIMIT_TEN, uid, UnionShareOrdersListBO.class, key);
|
|
|
if (cacheResult != null) {
|
|
|
logger.info("UnionShareServiceImpl :: queryRecentlyOrderLimitTen get redis cache ,uid is {},cacheResult is {}",uid,cacheResult);
|
|
|
logger.debug("UnionShareServiceImpl :: queryRecentlyOrderLimitTen get redis cache ,uid is {},cacheResult is {}",uid,cacheResult);
|
|
|
return cacheResult.getList();
|
|
|
}
|
|
|
//获取数据库
|
...
|
...
|
@@ -298,7 +298,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
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);
|
|
|
logger.debug("UnionShareServiceImpl :: queryOrderDetail get redis cache ,uid is {},cacheResult is {}",uid,cacheResult);
|
|
|
return cacheResult;
|
|
|
}
|
|
|
//数据库获取数据
|
...
|
...
|
@@ -334,7 +334,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
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 :: querySettlementRecord get redis cache ,uid is {},cacheResult is {}",unionShareOrderReqBO.getUid(),cacheResult);
|
|
|
logger.debug("UnionShareServiceImpl :: querySettlementRecord get redis cache ,uid is {},cacheResult is {}",unionShareOrderReqBO.getUid(),cacheResult);
|
|
|
return cacheResult.getList();
|
|
|
}
|
|
|
//数据库获取
|
...
|
...
|
@@ -360,7 +360,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
UnionShareOrdersListBO cacheResult = getFromRedis(ShareOrdersKeyEnum.ORDER_LIST, unionShareOrderReqBO.getUid(),UnionShareOrdersListBO.class, unionShareOrderReqBO.getTab1().toString(),
|
|
|
unionShareOrderReqBO.getTab2().toString(), String.valueOf(unionShareOrderReqBO.getPage()), String.valueOf(unionShareOrderReqBO.getSize()));
|
|
|
if (cacheResult != null) {
|
|
|
logger.info("UnionShareServiceImpl :: queryOrderList get redis cache ,uid is {},cacheResult is {}",unionShareOrderReqBO.getUid(),cacheResult);
|
|
|
logger.debug("UnionShareServiceImpl :: queryOrderList get redis cache ,uid is {},cacheResult is {}",unionShareOrderReqBO.getUid(),cacheResult);
|
|
|
return cacheResult.getList();
|
|
|
}
|
|
|
//数据库获取
|
...
|
...
|
@@ -452,14 +452,14 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
//是否为新用户(1-新用户,2-老用户)
|
|
|
double rebatesRatio;
|
|
|
if ("Y".equals(bo.getIsNew())) {
|
|
|
rebatesRatio=configReader.getDouble(NEW_USER_REBATES_RATIO_KEY, 0.1);
|
|
|
rebatesRatio=configReader.getDouble(NEW_USER_REBATES_RATIO_KEY, 10);
|
|
|
insertReq.setIsNew((byte)1);
|
|
|
}else {
|
|
|
rebatesRatio=configReader.getDouble(OLD_USER_REBATES_RATIO_KEY, 0.03);
|
|
|
rebatesRatio=configReader.getDouble(OLD_USER_REBATES_RATIO_KEY, 3);
|
|
|
insertReq.setIsNew((byte)2);
|
|
|
}
|
|
|
//返利金额计算小数位两位后舍弃
|
|
|
insertReq.setAmount((bo.getLastOrderAmount().multiply(new BigDecimal(rebatesRatio))).setScale(2,BigDecimal.ROUND_DOWN));
|
|
|
insertReq.setAmount((bo.getLastOrderAmount().multiply(new BigDecimal(rebatesRatio*0.01))).setScale(2,BigDecimal.ROUND_DOWN));
|
|
|
logger.info("insertOrder,orderCode is {},rebatesRatio is {},rebates is {}",bo.getOrderCode(),rebatesRatio,insertReq.getAmount());
|
|
|
|
|
|
unionShareOrdersMapper.insertSelective(insertReq);
|
...
|
...
|
|