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; @@ -7,12 +7,12 @@ import org.slf4j.helpers.MessageFormatter;
7 */ 7 */
8 public enum ShareOrdersKeyEnum { 8 public enum ShareOrdersKeyEnum {
9 9
10 - ORDER_LIST("unions:share:orderList:","type:{}:status:{}:page:{}:limit:{}",3600,"订单列表"),  
11 - ORDER_INFO("unions:share:orderInfo:","key:{}:orderCode:{}",3600,"订单详情"),  
12 - USER_SETTLEMENT("unions:share:userSettlement:","type:{}",3600,"用户提现未提现总计"),  
13 - SETTLEMENT_LIST("unions:share:settlementList:","key:{}:page:{}:limit:{}",3600,"提现列表"),  
14 - UNION_TYPE("unions:share:unionType:","key:{}",3600,"用户登录时获取对应的渠道号"),  
15 - RECENTLY_ORDER_LIMIT_TEN("unions:share:recentlyOrderLimitTen:","key:{}",3600,"用户前台获取个人推广近期订单(10个)"); 10 + ORDER_LIST("yh:unions:share:orderList:","type:{}:status:{}:page:{}:limit:{}",600,"订单列表"),
  11 + ORDER_INFO("yh:unions:share:orderInfo:","key:{}:orderCode:{}",600,"订单详情"),
  12 + USER_SETTLEMENT("yh:unions:share:userSettlement:","type:{}",600,"用户提现未提现总计"),
  13 + SETTLEMENT_LIST("yh:unions:share:settlementList:","key:{}:page:{}:limit:{}",600,"提现列表"),
  14 + UNION_TYPE("yh:unions:share:unionType:","key:{}",600,"用户登录时获取对应的渠道号"),
  15 + RECENTLY_ORDER_LIMIT_TEN("yh:unions:share:recentlyOrderLimitTen:","key:{}",600,"用户前台获取个人推广近期订单(10个)");
16 16
17 17
18 private String preKey; 18 private String preKey;
@@ -182,7 +182,7 @@ public class RedisHashCache { @@ -182,7 +182,7 @@ public class RedisHashCache {
182 this.hashOperations.put(redisKeyBuilder, hashKey, v); 182 this.hashOperations.put(redisKeyBuilder, hashKey, v);
183 this.yHRedisTemplate.longExpire(redisKeyBuilder, timeout, unit); 183 this.yHRedisTemplate.longExpire(redisKeyBuilder, timeout, unit);
184 } catch (Exception e) { 184 } catch (Exception e) {
185 - logger.warn("RedisHashCache get failed!!! cacheKey is: {},obj is: {},hashkey is {},value is {}", cacheKey,obj, hashKey,value); 185 + logger.warn("RedisHashCache put failed!!! cacheKey is: {},obj is: {},hashkey is {},value is {}", cacheKey,obj, hashKey,value);
186 } 186 }
187 } 187 }
188 188
@@ -83,6 +83,7 @@ @@ -83,6 +83,7 @@
83 <value>/UnionShareRest/queryOderDetail</value> 83 <value>/UnionShareRest/queryOderDetail</value>
84 <value>/UnionShareRest/querySettlementRecord</value> 84 <value>/UnionShareRest/querySettlementRecord</value>
85 <value>/UnionShareRest/queryOrderList</value> 85 <value>/UnionShareRest/queryOrderList</value>
  86 + <value>/UnionShareRest/queryUnionShareOrders</value>
86 87
87 </list> 88 </list>
88 </property> 89 </property>
@@ -142,4 +142,24 @@ public class UnionShareOrders { @@ -142,4 +142,24 @@ public class UnionShareOrders {
142 public void setAmountStr(String amountStr) { 142 public void setAmountStr(String amountStr) {
143 this.amountStr = amountStr; 143 this.amountStr = amountStr;
144 } 144 }
  145 +
  146 + @Override
  147 + public String toString() {
  148 + return "UnionShareOrders{" +
  149 + "id=" + id +
  150 + ", orderCode='" + orderCode + '\'' +
  151 + ", settlementCode='" + settlementCode + '\'' +
  152 + ", promoteUid=" + promoteUid +
  153 + ", status='" + status + '\'' +
  154 + ", lastOrderAmount=" + lastOrderAmount +
  155 + ", lastOrderAmountStr='" + lastOrderAmountStr + '\'' +
  156 + ", orderTime=" + orderTime +
  157 + ", orderTimeStr='" + orderTimeStr + '\'' +
  158 + ", isNew=" + isNew +
  159 + ", amount=" + amount +
  160 + ", amountStr='" + amountStr + '\'' +
  161 + ", createTime=" + createTime +
  162 + ", updateTime=" + updateTime +
  163 + '}';
  164 + }
145 } 165 }
@@ -72,4 +72,17 @@ public class UnionShareOrdersProduct { @@ -72,4 +72,17 @@ public class UnionShareOrdersProduct {
72 public void setNum(Byte num) { 72 public void setNum(Byte num) {
73 this.num = num; 73 this.num = num;
74 } 74 }
  75 +
  76 + @Override
  77 + public String toString() {
  78 + return "UnionShareOrdersProduct{" +
  79 + "id=" + id +
  80 + ", productSkn=" + productSkn +
  81 + ", orderCode='" + orderCode + '\'' +
  82 + ", productName='" + productName + '\'' +
  83 + ", image='" + image + '\'' +
  84 + ", price=" + price +
  85 + ", num=" + num +
  86 + '}';
  87 + }
75 } 88 }
@@ -92,4 +92,19 @@ public class UnionShareSettlement { @@ -92,4 +92,19 @@ public class UnionShareSettlement {
92 public void setUpdateTime(Integer updateTime) { 92 public void setUpdateTime(Integer updateTime) {
93 this.updateTime = updateTime; 93 this.updateTime = updateTime;
94 } 94 }
  95 +
  96 + @Override
  97 + public String toString() {
  98 + return "UnionShareSettlement{" +
  99 + "id=" + id +
  100 + ", settlementCode='" + settlementCode + '\'' +
  101 + ", settlementAmount=" + settlementAmount +
  102 + ", settlementAmountStr='" + settlementAmountStr + '\'' +
  103 + ", settlementTime=" + settlementTime +
  104 + ", settlementTimeStr='" + settlementTimeStr + '\'' +
  105 + ", promoteUid=" + promoteUid +
  106 + ", status=" + status +
  107 + ", updateTime=" + updateTime +
  108 + '}';
  109 + }
95 } 110 }
@@ -9,9 +9,7 @@ public class UnionShareUser { @@ -9,9 +9,7 @@ public class UnionShareUser {
9 9
10 private Integer updateTime; 10 private Integer updateTime;
11 11
12 - private String note;  
13 -  
14 - private String url; 12 + private String imageUrl;
15 13
16 private String shareId; 14 private String shareId;
17 15
@@ -47,20 +45,12 @@ public class UnionShareUser { @@ -47,20 +45,12 @@ public class UnionShareUser {
47 this.updateTime = updateTime; 45 this.updateTime = updateTime;
48 } 46 }
49 47
50 - public String getNote() {  
51 - return note;  
52 - }  
53 -  
54 - public void setNote(String note) {  
55 - this.note = note; 48 + public String getImageUrl() {
  49 + return imageUrl;
56 } 50 }
57 51
58 - public String getUrl() {  
59 - return url;  
60 - }  
61 -  
62 - public void setUrl(String url) {  
63 - this.url = url; 52 + public void setImageUrl(String imageUrl) {
  53 + this.imageUrl = imageUrl;
64 } 54 }
65 55
66 public String getShareId() { 56 public String getShareId() {
@@ -70,4 +60,16 @@ public class UnionShareUser { @@ -70,4 +60,16 @@ public class UnionShareUser {
70 public void setShareId(String shareId) { 60 public void setShareId(String shareId) {
71 this.shareId = shareId; 61 this.shareId = shareId;
72 } 62 }
  63 +
  64 + @Override
  65 + public String toString() {
  66 + return "UnionShareUser{" +
  67 + "id=" + id +
  68 + ", uid=" + uid +
  69 + ", unionType='" + unionType + '\'' +
  70 + ", updateTime=" + updateTime +
  71 + ", imageUrl='" + imageUrl + '\'' +
  72 + ", shareId='" + shareId + '\'' +
  73 + '}';
  74 + }
73 } 75 }
@@ -71,7 +71,7 @@ public class UnionShareRest { @@ -71,7 +71,7 @@ public class UnionShareRest {
71 @RequestMapping("/queryUnionTypeByUid") 71 @RequestMapping("/queryUnionTypeByUid")
72 @ResponseBody 72 @ResponseBody
73 public UnionResponse queryUnionTypeByUid(@RequestBody int uid){ 73 public UnionResponse queryUnionTypeByUid(@RequestBody int uid){
74 - log.info("UnionShareRest :: queryUnionTypeByUid uid is{}", uid); 74 + log.info("UnionShareRest :: queryUnionTypeByUid uid is {}", uid);
75 UnionShareUser unionShareUser = unionShareService.queryUnionTypeByUid(uid); 75 UnionShareUser unionShareUser = unionShareService.queryUnionTypeByUid(uid);
76 return new UnionResponse(200, "queryUnionTypeByUid success",unionShareUser); 76 return new UnionResponse(200, "queryUnionTypeByUid success",unionShareUser);
77 } 77 }
@@ -85,7 +85,7 @@ public class UnionShareRest { @@ -85,7 +85,7 @@ public class UnionShareRest {
85 @RequestMapping("/queryRecentlyOrderLimitTen") 85 @RequestMapping("/queryRecentlyOrderLimitTen")
86 @ResponseBody 86 @ResponseBody
87 public UnionResponse queryRecentlyOrderLimitTen(@RequestBody int uid){ 87 public UnionResponse queryRecentlyOrderLimitTen(@RequestBody int uid){
88 - log.info("UnionShareRest :: queryRecentlyOrderLimitTen uid is{}", uid); 88 + log.info("UnionShareRest :: queryRecentlyOrderLimitTen uid is {}", uid);
89 List<UnionShareOrders> unionShareOrdersList = unionShareService.queryRecentlyOrderLimitTen(uid); 89 List<UnionShareOrders> unionShareOrdersList = unionShareService.queryRecentlyOrderLimitTen(uid);
90 return new UnionResponse(200, "queryRecentlyOrderLimitTen success",unionShareOrdersList); 90 return new UnionResponse(200, "queryRecentlyOrderLimitTen success",unionShareOrdersList);
91 } 91 }
@@ -99,7 +99,7 @@ public class UnionShareRest { @@ -99,7 +99,7 @@ public class UnionShareRest {
99 @RequestMapping("/queryOderDetail") 99 @RequestMapping("/queryOderDetail")
100 @ResponseBody 100 @ResponseBody
101 public UnionResponse queryOderDetail(@RequestBody UnionShareOrderReqBO unionShareOrderReqBO){ 101 public UnionResponse queryOderDetail(@RequestBody UnionShareOrderReqBO unionShareOrderReqBO){
102 - log.info("UnionShareRest :: queryOderDetail unionShareOrderReqBO is{}", unionShareOrderReqBO); 102 + log.info("UnionShareRest :: queryOderDetail unionShareOrderReqBO is {}", unionShareOrderReqBO);
103 if (null == unionShareOrderReqBO || null == unionShareOrderReqBO.getUid() || null == unionShareOrderReqBO.getOrderCode()){ 103 if (null == unionShareOrderReqBO || null == unionShareOrderReqBO.getUid() || null == unionShareOrderReqBO.getOrderCode()){
104 return new UnionResponse(400, "querySettlementRecord uid or orderCode is null"); 104 return new UnionResponse(400, "querySettlementRecord uid or orderCode is null");
105 } 105 }
@@ -134,7 +134,7 @@ public class UnionShareRest { @@ -134,7 +134,7 @@ public class UnionShareRest {
134 @RequestMapping("/queryOrderList") 134 @RequestMapping("/queryOrderList")
135 @ResponseBody 135 @ResponseBody
136 public UnionResponse queryOrderList(@RequestBody UnionShareOrderReqBO unionShareOrderReqBO){ 136 public UnionResponse queryOrderList(@RequestBody UnionShareOrderReqBO unionShareOrderReqBO){
137 - log.info("UnionShareRest :: queryOrderList unionShareOrderReqBO is{}", unionShareOrderReqBO); 137 + log.info("UnionShareRest :: queryOrderList unionShareOrderReqBO is {}", unionShareOrderReqBO);
138 if (null == unionShareOrderReqBO || null == unionShareOrderReqBO.getUid()){ 138 if (null == unionShareOrderReqBO || null == unionShareOrderReqBO.getUid()){
139 return new UnionResponse(400, "queryOrderList params is null"); 139 return new UnionResponse(400, "queryOrderList params is null");
140 } 140 }
@@ -245,12 +245,12 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -245,12 +245,12 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
245 } 245 }
246 //获取数据库 246 //获取数据库
247 UnionShareUser unionShareUser = unionShareUserMapper.selectByUid(uid); 247 UnionShareUser unionShareUser = unionShareUserMapper.selectByUid(uid);
248 - //设置返回文案  
249 - if (null != unionShareUser){  
250 - unionShareUser.setNote("邀请新客购买返点"+configReader.getDouble(NEW_USER_REBATES_RATIO_KEY, 0.1)+",老客"+configReader.getDouble(OLD_USER_REBATES_RATIO_KEY, 0.03));  
251 - unionShareUser.setShareId(configReader.getString(UNION_SHAREID, ""));  
252 - unionShareUser.setUrl(configReader.getString(UNION_URL, "")); 248 + if (null == unionShareUser){
  249 + return unionShareUser;
253 } 250 }
  251 + //设置返回文案
  252 + unionShareUser.setShareId(configReader.getString(UNION_SHAREID, ""));
  253 + unionShareUser.setImageUrl(configReader.getString(UNION_URL, ""));
254 //设置缓存 254 //设置缓存
255 addToRedis(ShareOrdersKeyEnum.UNION_TYPE, uid, unionShareUser, key); 255 addToRedis(ShareOrdersKeyEnum.UNION_TYPE, uid, unionShareUser, key);
256 return unionShareUser; 256 return unionShareUser;
@@ -267,7 +267,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -267,7 +267,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
267 String key = "recentlyOrderLimitTen"; 267 String key = "recentlyOrderLimitTen";
268 UnionShareOrdersListBO cacheResult = getFromRedis(ShareOrdersKeyEnum.RECENTLY_ORDER_LIMIT_TEN, uid, UnionShareOrdersListBO.class, key); 268 UnionShareOrdersListBO cacheResult = getFromRedis(ShareOrdersKeyEnum.RECENTLY_ORDER_LIMIT_TEN, uid, UnionShareOrdersListBO.class, key);
269 if (cacheResult != null) { 269 if (cacheResult != null) {
270 - logger.info("UnionShareServiceImpl :: queryRecentlyOrderLimitTen get redis cache ,uid is {},cacheResult is {}",uid,cacheResult); 270 + logger.debug("UnionShareServiceImpl :: queryRecentlyOrderLimitTen get redis cache ,uid is {},cacheResult is {}",uid,cacheResult);
271 return cacheResult.getList(); 271 return cacheResult.getList();
272 } 272 }
273 //获取数据库 273 //获取数据库
@@ -298,7 +298,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -298,7 +298,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
298 String key = "orderDetail"; 298 String key = "orderDetail";
299 ShareOrderBo cacheResult = getFromRedis(ShareOrdersKeyEnum.ORDER_INFO, uid, ShareOrderBo.class, key, orderCode); 299 ShareOrderBo cacheResult = getFromRedis(ShareOrdersKeyEnum.ORDER_INFO, uid, ShareOrderBo.class, key, orderCode);
300 if (cacheResult != null) { 300 if (cacheResult != null) {
301 - logger.info("UnionShareServiceImpl :: queryOrderDetail get redis cache ,uid is {},cacheResult is {}",uid,cacheResult); 301 + logger.debug("UnionShareServiceImpl :: queryOrderDetail get redis cache ,uid is {},cacheResult is {}",uid,cacheResult);
302 return cacheResult; 302 return cacheResult;
303 } 303 }
304 //数据库获取数据 304 //数据库获取数据
@@ -334,7 +334,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -334,7 +334,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
334 UnionShareSettlementListBO cacheResult = getFromRedis(ShareOrdersKeyEnum.SETTLEMENT_LIST, unionShareOrderReqBO.getUid(), 334 UnionShareSettlementListBO cacheResult = getFromRedis(ShareOrdersKeyEnum.SETTLEMENT_LIST, unionShareOrderReqBO.getUid(),
335 UnionShareSettlementListBO.class, key, String.valueOf(unionShareOrderReqBO.getPage()), String.valueOf(unionShareOrderReqBO.getSize())); 335 UnionShareSettlementListBO.class, key, String.valueOf(unionShareOrderReqBO.getPage()), String.valueOf(unionShareOrderReqBO.getSize()));
336 if (cacheResult != null) { 336 if (cacheResult != null) {
337 - logger.info("UnionShareServiceImpl :: querySettlementRecord get redis cache ,uid is {},cacheResult is {}",unionShareOrderReqBO.getUid(),cacheResult); 337 + logger.debug("UnionShareServiceImpl :: querySettlementRecord get redis cache ,uid is {},cacheResult is {}",unionShareOrderReqBO.getUid(),cacheResult);
338 return cacheResult.getList(); 338 return cacheResult.getList();
339 } 339 }
340 //数据库获取 340 //数据库获取
@@ -360,7 +360,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -360,7 +360,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
360 UnionShareOrdersListBO cacheResult = getFromRedis(ShareOrdersKeyEnum.ORDER_LIST, unionShareOrderReqBO.getUid(),UnionShareOrdersListBO.class, unionShareOrderReqBO.getTab1().toString(), 360 UnionShareOrdersListBO cacheResult = getFromRedis(ShareOrdersKeyEnum.ORDER_LIST, unionShareOrderReqBO.getUid(),UnionShareOrdersListBO.class, unionShareOrderReqBO.getTab1().toString(),
361 unionShareOrderReqBO.getTab2().toString(), String.valueOf(unionShareOrderReqBO.getPage()), String.valueOf(unionShareOrderReqBO.getSize())); 361 unionShareOrderReqBO.getTab2().toString(), String.valueOf(unionShareOrderReqBO.getPage()), String.valueOf(unionShareOrderReqBO.getSize()));
362 if (cacheResult != null) { 362 if (cacheResult != null) {
363 - logger.info("UnionShareServiceImpl :: queryOrderList get redis cache ,uid is {},cacheResult is {}",unionShareOrderReqBO.getUid(),cacheResult); 363 + logger.debug("UnionShareServiceImpl :: queryOrderList get redis cache ,uid is {},cacheResult is {}",unionShareOrderReqBO.getUid(),cacheResult);
364 return cacheResult.getList(); 364 return cacheResult.getList();
365 } 365 }
366 //数据库获取 366 //数据库获取
@@ -452,14 +452,14 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -452,14 +452,14 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
452 //是否为新用户(1-新用户,2-老用户) 452 //是否为新用户(1-新用户,2-老用户)
453 double rebatesRatio; 453 double rebatesRatio;
454 if ("Y".equals(bo.getIsNew())) { 454 if ("Y".equals(bo.getIsNew())) {
455 - rebatesRatio=configReader.getDouble(NEW_USER_REBATES_RATIO_KEY, 0.1); 455 + rebatesRatio=configReader.getDouble(NEW_USER_REBATES_RATIO_KEY, 10);
456 insertReq.setIsNew((byte)1); 456 insertReq.setIsNew((byte)1);
457 }else { 457 }else {
458 - rebatesRatio=configReader.getDouble(OLD_USER_REBATES_RATIO_KEY, 0.03); 458 + rebatesRatio=configReader.getDouble(OLD_USER_REBATES_RATIO_KEY, 3);
459 insertReq.setIsNew((byte)2); 459 insertReq.setIsNew((byte)2);
460 } 460 }
461 //返利金额计算小数位两位后舍弃 461 //返利金额计算小数位两位后舍弃
462 - insertReq.setAmount((bo.getLastOrderAmount().multiply(new BigDecimal(rebatesRatio))).setScale(2,BigDecimal.ROUND_DOWN)); 462 + insertReq.setAmount((bo.getLastOrderAmount().multiply(new BigDecimal(rebatesRatio*0.01))).setScale(2,BigDecimal.ROUND_DOWN));
463 logger.info("insertOrder,orderCode is {},rebatesRatio is {},rebates is {}",bo.getOrderCode(),rebatesRatio,insertReq.getAmount()); 463 logger.info("insertOrder,orderCode is {},rebatesRatio is {},rebates is {}",bo.getOrderCode(),rebatesRatio,insertReq.getAmount());
464 464
465 unionShareOrdersMapper.insertSelective(insertReq); 465 unionShareOrdersMapper.insertSelective(insertReq);
1 -union.newUserRebatesRatio=0.1  
2 -union.oldUserRebatesRatio=0.03 1 +union.newUserRebatesRatio=10
  2 +union.oldUserRebatesRatio=3
3 union.shareId = 1 3 union.shareId = 1
4 union.url = http://img10.static.yhbimg.com/article/2018/05/18/14/017112c48a4af09fdf161356b4b12f7059.png 4 union.url = http://img10.static.yhbimg.com/article/2018/05/18/14/017112c48a4af09fdf161356b4b12f7059.png