Authored by csgyoho

Merge branch 'dev_180508_联盟红人推广' of http://git.yoho.cn/yoho30/yohobuy-union into dev_180508_联盟红人推广

... ... @@ -7,12 +7,12 @@ import org.slf4j.helpers.MessageFormatter;
*/
public enum ShareOrdersKeyEnum {
ORDER_LIST("unions:share:orderList:","type:{}:status:{}:page:{}:limit:{}",3600,"订单列表"),
ORDER_INFO("unions:share:orderInfo:","key:{}:orderCode:{}",3600,"订单详情"),
USER_SETTLEMENT("unions:share:userSettlement:","type:{}",3600,"用户提现未提现总计"),
SETTLEMENT_LIST("unions:share:settlementList:","key:{}:page:{}:limit:{}",3600,"提现列表"),
UNION_TYPE("unions:share:unionType:","key:{}",3600,"用户登录时获取对应的渠道号"),
RECENTLY_ORDER_LIMIT_TEN("unions:share:recentlyOrderLimitTen:","key:{}",3600,"用户前台获取个人推广近期订单(10个)");
ORDER_LIST("yh:unions:share:orderList:","type:{}:status:{}:page:{}:limit:{}",600,"订单列表"),
ORDER_INFO("yh:unions:share:orderInfo:","key:{}:orderCode:{}",600,"订单详情"),
USER_SETTLEMENT("yh:unions:share:userSettlement:","type:{}",600,"用户提现未提现总计"),
SETTLEMENT_LIST("yh:unions:share:settlementList:","key:{}:page:{}:limit:{}",600,"提现列表"),
UNION_TYPE("yh:unions:share:unionType:","key:{}",600,"用户登录时获取对应的渠道号"),
RECENTLY_ORDER_LIMIT_TEN("yh:unions:share:recentlyOrderLimitTen:","key:{}",600,"用户前台获取个人推广近期订单(10个)");
private String preKey;
... ...
... ... @@ -182,7 +182,7 @@ public class RedisHashCache {
this.hashOperations.put(redisKeyBuilder, hashKey, v);
this.yHRedisTemplate.longExpire(redisKeyBuilder, timeout, unit);
} catch (Exception e) {
logger.warn("RedisHashCache get failed!!! cacheKey is: {},obj is: {},hashkey is {},value is {}", cacheKey,obj, hashKey,value);
logger.warn("RedisHashCache put failed!!! cacheKey is: {},obj is: {},hashkey is {},value is {}", cacheKey,obj, hashKey,value);
}
}
... ...
... ... @@ -83,6 +83,7 @@
<value>/UnionShareRest/queryOderDetail</value>
<value>/UnionShareRest/querySettlementRecord</value>
<value>/UnionShareRest/queryOrderList</value>
<value>/UnionShareRest/queryUnionShareOrders</value>
</list>
</property>
... ...
... ... @@ -142,4 +142,24 @@ public class UnionShareOrders {
public void setAmountStr(String amountStr) {
this.amountStr = amountStr;
}
@Override
public String toString() {
return "UnionShareOrders{" +
"id=" + id +
", orderCode='" + orderCode + '\'' +
", settlementCode='" + settlementCode + '\'' +
", promoteUid=" + promoteUid +
", status='" + status + '\'' +
", lastOrderAmount=" + lastOrderAmount +
", lastOrderAmountStr='" + lastOrderAmountStr + '\'' +
", orderTime=" + orderTime +
", orderTimeStr='" + orderTimeStr + '\'' +
", isNew=" + isNew +
", amount=" + amount +
", amountStr='" + amountStr + '\'' +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}
\ No newline at end of file
... ...
... ... @@ -72,4 +72,17 @@ public class UnionShareOrdersProduct {
public void setNum(Byte num) {
this.num = num;
}
@Override
public String toString() {
return "UnionShareOrdersProduct{" +
"id=" + id +
", productSkn=" + productSkn +
", orderCode='" + orderCode + '\'' +
", productName='" + productName + '\'' +
", image='" + image + '\'' +
", price=" + price +
", num=" + num +
'}';
}
}
\ No newline at end of file
... ...
... ... @@ -92,4 +92,19 @@ public class UnionShareSettlement {
public void setUpdateTime(Integer updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "UnionShareSettlement{" +
"id=" + id +
", settlementCode='" + settlementCode + '\'' +
", settlementAmount=" + settlementAmount +
", settlementAmountStr='" + settlementAmountStr + '\'' +
", settlementTime=" + settlementTime +
", settlementTimeStr='" + settlementTimeStr + '\'' +
", promoteUid=" + promoteUid +
", status=" + status +
", updateTime=" + updateTime +
'}';
}
}
\ No newline at end of file
... ...
... ... @@ -9,9 +9,7 @@ public class UnionShareUser {
private Integer updateTime;
private String note;
private String url;
private String imageUrl;
private String shareId;
... ... @@ -47,20 +45,12 @@ public class UnionShareUser {
this.updateTime = updateTime;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
public String getImageUrl() {
return imageUrl;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public String getShareId() {
... ... @@ -70,4 +60,16 @@ public class UnionShareUser {
public void setShareId(String shareId) {
this.shareId = shareId;
}
@Override
public String toString() {
return "UnionShareUser{" +
"id=" + id +
", uid=" + uid +
", unionType='" + unionType + '\'' +
", updateTime=" + updateTime +
", imageUrl='" + imageUrl + '\'' +
", shareId='" + shareId + '\'' +
'}';
}
}
\ No newline at end of file
... ...
... ... @@ -71,7 +71,7 @@ public class UnionShareRest {
@RequestMapping("/queryUnionTypeByUid")
@ResponseBody
public UnionResponse queryUnionTypeByUid(@RequestBody int uid){
log.info("UnionShareRest :: queryUnionTypeByUid uid is{}", uid);
log.info("UnionShareRest :: queryUnionTypeByUid uid is {}", uid);
UnionShareUser unionShareUser = unionShareService.queryUnionTypeByUid(uid);
return new UnionResponse(200, "queryUnionTypeByUid success",unionShareUser);
}
... ... @@ -85,7 +85,7 @@ public class UnionShareRest {
@RequestMapping("/queryRecentlyOrderLimitTen")
@ResponseBody
public UnionResponse queryRecentlyOrderLimitTen(@RequestBody int uid){
log.info("UnionShareRest :: queryRecentlyOrderLimitTen uid is{}", uid);
log.info("UnionShareRest :: queryRecentlyOrderLimitTen uid is {}", uid);
List<UnionShareOrders> unionShareOrdersList = unionShareService.queryRecentlyOrderLimitTen(uid);
return new UnionResponse(200, "queryRecentlyOrderLimitTen success",unionShareOrdersList);
}
... ... @@ -99,7 +99,7 @@ public class UnionShareRest {
@RequestMapping("/queryOderDetail")
@ResponseBody
public UnionResponse queryOderDetail(@RequestBody UnionShareOrderReqBO unionShareOrderReqBO){
log.info("UnionShareRest :: queryOderDetail unionShareOrderReqBO is{}", unionShareOrderReqBO);
log.info("UnionShareRest :: queryOderDetail unionShareOrderReqBO is {}", unionShareOrderReqBO);
if (null == unionShareOrderReqBO || null == unionShareOrderReqBO.getUid() || null == unionShareOrderReqBO.getOrderCode()){
return new UnionResponse(400, "querySettlementRecord uid or orderCode is null");
}
... ... @@ -134,7 +134,7 @@ public class UnionShareRest {
@RequestMapping("/queryOrderList")
@ResponseBody
public UnionResponse queryOrderList(@RequestBody UnionShareOrderReqBO unionShareOrderReqBO){
log.info("UnionShareRest :: queryOrderList unionShareOrderReqBO is{}", unionShareOrderReqBO);
log.info("UnionShareRest :: queryOrderList unionShareOrderReqBO is {}", unionShareOrderReqBO);
if (null == unionShareOrderReqBO || null == unionShareOrderReqBO.getUid()){
return new UnionResponse(400, "queryOrderList params is null");
}
... ...
... ... @@ -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);
... ...
union.newUserRebatesRatio=0.1
union.oldUserRebatesRatio=0.03
union.newUserRebatesRatio=10
union.oldUserRebatesRatio=3
union.shareId = 1
union.url = http://img10.static.yhbimg.com/article/2018/05/18/14/017112c48a4af09fdf161356b4b12f7059.png
\ No newline at end of file
... ...