Authored by csgyoho

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

@@ -19,6 +19,8 @@ public class UnionShareSettlement { @@ -19,6 +19,8 @@ public class UnionShareSettlement {
19 19
20 private Byte status; 20 private Byte status;
21 21
  22 + private String settlementStatus;
  23 +
22 private Integer updateTime; 24 private Integer updateTime;
23 25
24 public Integer getId() { 26 public Integer getId() {
@@ -85,6 +87,14 @@ public class UnionShareSettlement { @@ -85,6 +87,14 @@ public class UnionShareSettlement {
85 this.status = status; 87 this.status = status;
86 } 88 }
87 89
  90 + public String getSettlementStatus() {
  91 + return settlementStatus;
  92 + }
  93 +
  94 + public void setSettlementStatus(String settlementStatus) {
  95 + this.settlementStatus = settlementStatus;
  96 + }
  97 +
88 public Integer getUpdateTime() { 98 public Integer getUpdateTime() {
89 return updateTime; 99 return updateTime;
90 } 100 }
@@ -104,6 +114,7 @@ public class UnionShareSettlement { @@ -104,6 +114,7 @@ public class UnionShareSettlement {
104 ", settlementTimeStr='" + settlementTimeStr + '\'' + 114 ", settlementTimeStr='" + settlementTimeStr + '\'' +
105 ", promoteUid=" + promoteUid + 115 ", promoteUid=" + promoteUid +
106 ", status=" + status + 116 ", status=" + status +
  117 + ", settlementStatus='" + settlementStatus + '\'' +
107 ", updateTime=" + updateTime + 118 ", updateTime=" + updateTime +
108 '}'; 119 '}';
109 } 120 }
@@ -290,31 +290,31 @@ @@ -290,31 +290,31 @@
290 from union_share_orders 290 from union_share_orders
291 where promote_uid = #{params.uid,jdbcType=INTEGER} 291 where promote_uid = #{params.uid,jdbcType=INTEGER}
292 <if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 0"> 292 <if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 0">
293 - AND status != 100 293 + AND status != 100
294 </if> 294 </if>
295 <if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 1"> 295 <if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 1">
296 - AND status = 10 296 + AND status = 10
297 </if> 297 </if>
298 <if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 2"> 298 <if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 2">
299 - AND status = 20 299 + AND status IN (20,30)
300 </if> 300 </if>
301 <if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 3"> 301 <if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 3">
302 - AND status IN (30,40) 302 + AND status = 40
303 </if> 303 </if>
304 <if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 0"> 304 <if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 0">
305 - AND status IN (10,20,30,40) 305 + AND status IN (10,20,30,40)
306 </if> 306 </if>
307 <if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 1"> 307 <if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 1">
308 - AND status = 10 308 + AND status = 10
309 </if> 309 </if>
310 <if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 2"> 310 <if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 2">
311 - AND status = 20 311 + AND status IN (20,30)
312 </if> 312 </if>
313 <if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 3"> 313 <if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 3">
314 - AND status IN (30,40) 314 + AND status = 40
315 </if> 315 </if>
316 <if test="params.tab1 != null and params.tab1 == 3"> 316 <if test="params.tab1 != null and params.tab1 == 3">
317 - AND status IN (91,92,93) 317 + AND status IN (91,92,93)
318 </if> 318 </if>
319 order by order_time desc 319 order by order_time desc
320 limit #{params.start,jdbcType=INTEGER}, #{params.size,jdbcType=INTEGER} 320 limit #{params.start,jdbcType=INTEGER}, #{params.size,jdbcType=INTEGER}
@@ -332,10 +332,10 @@ @@ -332,10 +332,10 @@
332 AND status = 10 332 AND status = 10
333 </if> 333 </if>
334 <if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 2"> 334 <if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 2">
335 - AND status = 20 335 + AND status IN (20,30)
336 </if> 336 </if>
337 <if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 3"> 337 <if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 3">
338 - AND status IN (30,40) 338 + AND status = 40
339 </if> 339 </if>
340 <if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 0"> 340 <if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 0">
341 AND status IN (10,20,30,40) 341 AND status IN (10,20,30,40)
@@ -344,10 +344,10 @@ @@ -344,10 +344,10 @@
344 AND status = 10 344 AND status = 10
345 </if> 345 </if>
346 <if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 2"> 346 <if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 2">
347 - AND status = 20 347 + AND status IN (20,30)
348 </if> 348 </if>
349 <if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 3"> 349 <if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 3">
350 - AND status IN (30,40) 350 + AND status = 40
351 </if> 351 </if>
352 <if test="params.tab1 != null and params.tab1 == 3"> 352 <if test="params.tab1 != null and params.tab1 == 3">
353 AND status IN (91,92,93) 353 AND status IN (91,92,93)
@@ -34,7 +34,7 @@ public class UnionSettleUpdateConsumer implements YhConsumer { @@ -34,7 +34,7 @@ public class UnionSettleUpdateConsumer implements YhConsumer {
34 unionShareService.updateSettlementStatus(bo); 34 unionShareService.updateSettlementStatus(bo);
35 35
36 } catch (Exception e) { 36 } catch (Exception e) {
37 - logger.warn("UnionSettleUpdateConsumer,handleMessage fail! obj is {}, e {}",o,e.getMessage()); 37 + logger.warn("UnionSettleUpdateConsumer,handleMessage fail! obj is {}, e {}",o,e);
38 } 38 }
39 } 39 }
40 } 40 }
@@ -272,7 +272,11 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -272,7 +272,11 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
272 for (UnionShareOrders unionShareOrders : unionShareOrdersList){ 272 for (UnionShareOrders unionShareOrders : unionShareOrdersList){
273 unionShareOrders.setOrderTimeStr(DateUtils.int2DateStr(unionShareOrders.getOrderTime(), DateUtils.POINT_FOMARTPATTER)); 273 unionShareOrders.setOrderTimeStr(DateUtils.int2DateStr(unionShareOrders.getOrderTime(), DateUtils.POINT_FOMARTPATTER));
274 unionShareOrders.setLastOrderAmountStr(df1.format(unionShareOrders.getLastOrderAmount())); 274 unionShareOrders.setLastOrderAmountStr(df1.format(unionShareOrders.getLastOrderAmount()));
275 - unionShareOrders.setAmountStr("+"+df1.format(unionShareOrders.getAmount())); 275 + if (Integer.valueOf(unionShareOrders.getStatus()) > 90){
  276 + unionShareOrders.setAmountStr("+0");
  277 + }else {
  278 + unionShareOrders.setAmountStr("+"+df1.format(unionShareOrders.getAmount()));
  279 + }
276 } 280 }
277 } 281 }
278 } 282 }
@@ -305,13 +309,46 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -305,13 +309,46 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
305 shareOrderBo.setIsNew(unionShareOrders.getIsNew().toString()); 309 shareOrderBo.setIsNew(unionShareOrders.getIsNew().toString());
306 shareOrderBo.setProductList(shareOrdersProductBoList); 310 shareOrderBo.setProductList(shareOrdersProductBoList);
307 shareOrderBo.setOrderTimeStr(DateUtils.int2DateStr(shareOrderBo.getOrderTime(),DateUtils.DEFAULT_FOMARTPATTER)); 311 shareOrderBo.setOrderTimeStr(DateUtils.int2DateStr(shareOrderBo.getOrderTime(),DateUtils.DEFAULT_FOMARTPATTER));
308 - shareOrderBo.setAmountStr("¥"+df1.format(shareOrderBo.getAmount())); 312 + if(Integer.valueOf(shareOrderBo.getStatus()) > 90){
  313 + shareOrderBo.setAmountStr("¥0");
  314 + }else {
  315 + shareOrderBo.setAmountStr("¥"+df1.format(shareOrderBo.getAmount()));
  316 + }
309 shareOrderBo.setLastOrderAmountStr("¥"+df1.format(shareOrderBo.getLastOrderAmount())); 317 shareOrderBo.setLastOrderAmountStr("¥"+df1.format(shareOrderBo.getLastOrderAmount()));
  318 + //处理订单状态
  319 + dealWithOrderStatus(shareOrderBo);
310 //设置缓存 320 //设置缓存
311 addToRedis(ShareOrdersKeyEnum.ORDER_INFO,uid,shareOrderBo,key, orderCode); 321 addToRedis(ShareOrdersKeyEnum.ORDER_INFO,uid,shareOrderBo,key, orderCode);
312 return shareOrderBo; 322 return shareOrderBo;
313 } 323 }
314 324
  325 + private void dealWithOrderStatus(ShareOrderBo shareOrderBo) {
  326 + //10.待确认 20.待提现 30.提现中 40.提现成功 91.订单取消 92.订单退货 93.订单换货 100.不可结算
  327 + switch (Integer.valueOf(shareOrderBo.getStatus())){
  328 + case 10:
  329 + shareOrderBo.setOrderStatus("待确认");
  330 + break;
  331 + case 20:
  332 + shareOrderBo.setOrderStatus("待提现");
  333 + break;
  334 + case 30:
  335 + shareOrderBo.setOrderStatus("提现中");
  336 + break;
  337 + case 40:
  338 + shareOrderBo.setOrderStatus("提现成功");
  339 + break;
  340 + case 91:
  341 + shareOrderBo.setOrderStatus("订单取消");
  342 + break;
  343 + case 92:
  344 + shareOrderBo.setOrderStatus("订单退换货");
  345 + break;
  346 + default:
  347 + shareOrderBo.setOrderStatus("不可结算");
  348 + break;
  349 + }
  350 + }
  351 +
315 @Override 352 @Override
316 public PageResponseBO<UnionShareSettlement> querySettlementRecord(UnionShareOrderReqBO unionShareOrderReqBO) { 353 public PageResponseBO<UnionShareSettlement> querySettlementRecord(UnionShareOrderReqBO unionShareOrderReqBO) {
317 //先从缓存获取 354 //先从缓存获取
@@ -338,6 +375,11 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -338,6 +375,11 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
338 for (UnionShareSettlement unionShareSettlement : unionShareSettlementList){ 375 for (UnionShareSettlement unionShareSettlement : unionShareSettlementList){
339 unionShareSettlement.setSettlementAmountStr("+"+df1.format(unionShareSettlement.getSettlementAmount())); 376 unionShareSettlement.setSettlementAmountStr("+"+df1.format(unionShareSettlement.getSettlementAmount()));
340 unionShareSettlement.setSettlementTimeStr(DateUtils.int2DateStr(unionShareSettlement.getSettlementTime(), DateUtils.POINT_FOMARTPATTER)); 377 unionShareSettlement.setSettlementTimeStr(DateUtils.int2DateStr(unionShareSettlement.getSettlementTime(), DateUtils.POINT_FOMARTPATTER));
  378 + if (unionShareSettlement.getStatus() == 1){
  379 + unionShareSettlement.setSettlementStatus("结算中");
  380 + }else if (unionShareSettlement.getStatus() == 2){
  381 + unionShareSettlement.setSettlementStatus("已结算");
  382 + }
341 } 383 }
342 } 384 }
343 response.setSize(unionShareOrderReqBO.getSize()); 385 response.setSize(unionShareOrderReqBO.getSize());
@@ -465,17 +507,17 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -465,17 +507,17 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
465 507
466 //计算返利金额 508 //计算返利金额
467 //是否为新用户(1-新用户,2-老用户) 509 //是否为新用户(1-新用户,2-老用户)
468 - double rebatesRatio; 510 + String rebatesRatio;
469 if ("Y".equals(bo.getIsNew())) { 511 if ("Y".equals(bo.getIsNew())) {
470 - rebatesRatio=configReader.getDouble(NEW_USER_REBATES_RATIO_KEY, 10); 512 + rebatesRatio=configReader.getString(NEW_USER_REBATES_RATIO_KEY, "10");
471 insertReq.setIsNew((byte)1); 513 insertReq.setIsNew((byte)1);
472 }else { 514 }else {
473 - rebatesRatio=configReader.getDouble(OLD_USER_REBATES_RATIO_KEY, 3); 515 + rebatesRatio=configReader.getString(OLD_USER_REBATES_RATIO_KEY, "3");
474 insertReq.setIsNew((byte)2); 516 insertReq.setIsNew((byte)2);
475 } 517 }
476 //返利金额计算小数位两位后舍弃 518 //返利金额计算小数位两位后舍弃
477 - insertReq.setAmount((bo.getLastOrderAmount().multiply(new BigDecimal(rebatesRatio*0.01))).setScale(2,BigDecimal.ROUND_DOWN));  
478 - logger.info("insertOrder,orderCode is {},rebatesRatio is {},rebates is {}",bo.getOrderCode(),rebatesRatio,insertReq.getAmount()); 519 + insertReq.setAmount((bo.getLastOrderAmount().multiply(new BigDecimal(rebatesRatio).divide(new BigDecimal(100)))).setScale(2,BigDecimal.ROUND_DOWN));
  520 + logger.info("insertOrder,orderCode is {},orderAmount is {},rebatesRatio is {},rebates is {}",bo.getOrderCode(),bo.getLastOrderAmount(),rebatesRatio,insertReq.getAmount());
479 521
480 unionShareOrdersMapper.insertSelective(insertReq); 522 unionShareOrdersMapper.insertSelective(insertReq);
481 //新增订单商品信息 523 //新增订单商品信息
@@ -744,7 +786,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -744,7 +786,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
744 unionShareOrdersMapper.updateStatusByCode(bo.getSettlementCode(), ShareOrdersStatusEnum.SETTLE.getCode(), ShareOrdersStatusEnum.HAS_SETTLE.getCode(), updateReq.getUpdateTime()); 786 unionShareOrdersMapper.updateStatusByCode(bo.getSettlementCode(), ShareOrdersStatusEnum.SETTLE.getCode(), ShareOrdersStatusEnum.HAS_SETTLE.getCode(), updateReq.getUpdateTime());
745 787
746 //清缓存 788 //清缓存
747 - clearShareOrderRedis(bo.getPromoteUid()); 789 + clearShareOrderRedis(unionShareSettlement.getPromoteUid());
748 } 790 }
749 791
750 //存入redis,注意param的顺序 792 //存入redis,注意param的顺序
1 union.newUserRebatesRatio=10 1 union.newUserRebatesRatio=10
2 union.oldUserRebatesRatio=3 2 union.oldUserRebatesRatio=3
3 union.shareId = 1106 3 union.shareId = 1106
4 -union.cps.ImageUrl = http://img10.static.yhbimg.com/article/2018/05/18/14/017112c48a4af09fdf161356b4b12f7059.png  
  4 +union.cps.ImageUrl = http://img10.static.yhbimg.com/article/2018/05/23/16/017c0037ac8304c204686f5045c5eb9769.jpeg
@@ -376,10 +376,10 @@ @@ -376,10 +376,10 @@
376 <appender-ref ref="PINYOU_MATCH"/> 376 <appender-ref ref="PINYOU_MATCH"/>
377 </logger> 377 </logger>
378 378
379 - <logger name="cps_mq" level="INFO" additivity="false"> 379 + <logger name="cps_mq" level="INFO" additivity="true">
380 <appender-ref ref="CPS_MQ"/> 380 <appender-ref ref="CPS_MQ"/>
381 </logger> 381 </logger>
382 - <logger name="cps_settlement" level="INFO" additivity="false"> 382 + <logger name="cps_settlement" level="INFO" additivity="true">
383 <appender-ref ref="CPS_SETTLEMENT"/> 383 <appender-ref ref="CPS_SETTLEMENT"/>
384 </logger> 384 </logger>
385 </configuration> 385 </configuration>