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 {
private Byte status;
private String settlementStatus;
private Integer updateTime;
public Integer getId() {
... ... @@ -85,6 +87,14 @@ public class UnionShareSettlement {
this.status = status;
}
public String getSettlementStatus() {
return settlementStatus;
}
public void setSettlementStatus(String settlementStatus) {
this.settlementStatus = settlementStatus;
}
public Integer getUpdateTime() {
return updateTime;
}
... ... @@ -104,6 +114,7 @@ public class UnionShareSettlement {
", settlementTimeStr='" + settlementTimeStr + '\'' +
", promoteUid=" + promoteUid +
", status=" + status +
", settlementStatus='" + settlementStatus + '\'' +
", updateTime=" + updateTime +
'}';
}
... ...
... ... @@ -290,31 +290,31 @@
from union_share_orders
where promote_uid = #{params.uid,jdbcType=INTEGER}
<if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 0">
AND status != 100
AND status != 100
</if>
<if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 1">
AND status = 10
AND status = 10
</if>
<if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 2">
AND status = 20
AND status IN (20,30)
</if>
<if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 3">
AND status IN (30,40)
AND status = 40
</if>
<if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 0">
AND status IN (10,20,30,40)
AND status IN (10,20,30,40)
</if>
<if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 1">
AND status = 10
AND status = 10
</if>
<if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 2">
AND status = 20
AND status IN (20,30)
</if>
<if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 3">
AND status IN (30,40)
AND status = 40
</if>
<if test="params.tab1 != null and params.tab1 == 3">
AND status IN (91,92,93)
AND status IN (91,92,93)
</if>
order by order_time desc
limit #{params.start,jdbcType=INTEGER}, #{params.size,jdbcType=INTEGER}
... ... @@ -332,10 +332,10 @@
AND status = 10
</if>
<if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 2">
AND status = 20
AND status IN (20,30)
</if>
<if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 3">
AND status IN (30,40)
AND status = 40
</if>
<if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 0">
AND status IN (10,20,30,40)
... ... @@ -344,10 +344,10 @@
AND status = 10
</if>
<if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 2">
AND status = 20
AND status IN (20,30)
</if>
<if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 3">
AND status IN (30,40)
AND status = 40
</if>
<if test="params.tab1 != null and params.tab1 == 3">
AND status IN (91,92,93)
... ...
... ... @@ -34,7 +34,7 @@ public class UnionSettleUpdateConsumer implements YhConsumer {
unionShareService.updateSettlementStatus(bo);
} catch (Exception e) {
logger.warn("UnionSettleUpdateConsumer,handleMessage fail! obj is {}, e {}",o,e.getMessage());
logger.warn("UnionSettleUpdateConsumer,handleMessage fail! obj is {}, e {}",o,e);
}
}
}
\ No newline at end of file
... ...
... ... @@ -272,7 +272,11 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
for (UnionShareOrders unionShareOrders : unionShareOrdersList){
unionShareOrders.setOrderTimeStr(DateUtils.int2DateStr(unionShareOrders.getOrderTime(), DateUtils.POINT_FOMARTPATTER));
unionShareOrders.setLastOrderAmountStr(df1.format(unionShareOrders.getLastOrderAmount()));
unionShareOrders.setAmountStr("+"+df1.format(unionShareOrders.getAmount()));
if (Integer.valueOf(unionShareOrders.getStatus()) > 90){
unionShareOrders.setAmountStr("+0");
}else {
unionShareOrders.setAmountStr("+"+df1.format(unionShareOrders.getAmount()));
}
}
}
}
... ... @@ -305,13 +309,46 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
shareOrderBo.setIsNew(unionShareOrders.getIsNew().toString());
shareOrderBo.setProductList(shareOrdersProductBoList);
shareOrderBo.setOrderTimeStr(DateUtils.int2DateStr(shareOrderBo.getOrderTime(),DateUtils.DEFAULT_FOMARTPATTER));
shareOrderBo.setAmountStr("¥"+df1.format(shareOrderBo.getAmount()));
if(Integer.valueOf(shareOrderBo.getStatus()) > 90){
shareOrderBo.setAmountStr("¥0");
}else {
shareOrderBo.setAmountStr("¥"+df1.format(shareOrderBo.getAmount()));
}
shareOrderBo.setLastOrderAmountStr("¥"+df1.format(shareOrderBo.getLastOrderAmount()));
//处理订单状态
dealWithOrderStatus(shareOrderBo);
//设置缓存
addToRedis(ShareOrdersKeyEnum.ORDER_INFO,uid,shareOrderBo,key, orderCode);
return shareOrderBo;
}
private void dealWithOrderStatus(ShareOrderBo shareOrderBo) {
//10.待确认 20.待提现 30.提现中 40.提现成功 91.订单取消 92.订单退货 93.订单换货 100.不可结算
switch (Integer.valueOf(shareOrderBo.getStatus())){
case 10:
shareOrderBo.setOrderStatus("待确认");
break;
case 20:
shareOrderBo.setOrderStatus("待提现");
break;
case 30:
shareOrderBo.setOrderStatus("提现中");
break;
case 40:
shareOrderBo.setOrderStatus("提现成功");
break;
case 91:
shareOrderBo.setOrderStatus("订单取消");
break;
case 92:
shareOrderBo.setOrderStatus("订单退换货");
break;
default:
shareOrderBo.setOrderStatus("不可结算");
break;
}
}
@Override
public PageResponseBO<UnionShareSettlement> querySettlementRecord(UnionShareOrderReqBO unionShareOrderReqBO) {
//先从缓存获取
... ... @@ -338,6 +375,11 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
for (UnionShareSettlement unionShareSettlement : unionShareSettlementList){
unionShareSettlement.setSettlementAmountStr("+"+df1.format(unionShareSettlement.getSettlementAmount()));
unionShareSettlement.setSettlementTimeStr(DateUtils.int2DateStr(unionShareSettlement.getSettlementTime(), DateUtils.POINT_FOMARTPATTER));
if (unionShareSettlement.getStatus() == 1){
unionShareSettlement.setSettlementStatus("结算中");
}else if (unionShareSettlement.getStatus() == 2){
unionShareSettlement.setSettlementStatus("已结算");
}
}
}
response.setSize(unionShareOrderReqBO.getSize());
... ... @@ -465,17 +507,17 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
//计算返利金额
//是否为新用户(1-新用户,2-老用户)
double rebatesRatio;
String rebatesRatio;
if ("Y".equals(bo.getIsNew())) {
rebatesRatio=configReader.getDouble(NEW_USER_REBATES_RATIO_KEY, 10);
rebatesRatio=configReader.getString(NEW_USER_REBATES_RATIO_KEY, "10");
insertReq.setIsNew((byte)1);
}else {
rebatesRatio=configReader.getDouble(OLD_USER_REBATES_RATIO_KEY, 3);
rebatesRatio=configReader.getString(OLD_USER_REBATES_RATIO_KEY, "3");
insertReq.setIsNew((byte)2);
}
//返利金额计算小数位两位后舍弃
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());
insertReq.setAmount((bo.getLastOrderAmount().multiply(new BigDecimal(rebatesRatio).divide(new BigDecimal(100)))).setScale(2,BigDecimal.ROUND_DOWN));
logger.info("insertOrder,orderCode is {},orderAmount is {},rebatesRatio is {},rebates is {}",bo.getOrderCode(),bo.getLastOrderAmount(),rebatesRatio,insertReq.getAmount());
unionShareOrdersMapper.insertSelective(insertReq);
//新增订单商品信息
... ... @@ -744,7 +786,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
unionShareOrdersMapper.updateStatusByCode(bo.getSettlementCode(), ShareOrdersStatusEnum.SETTLE.getCode(), ShareOrdersStatusEnum.HAS_SETTLE.getCode(), updateReq.getUpdateTime());
//清缓存
clearShareOrderRedis(bo.getPromoteUid());
clearShareOrderRedis(unionShareSettlement.getPromoteUid());
}
//存入redis,注意param的顺序
... ...
union.newUserRebatesRatio=10
union.oldUserRebatesRatio=3
union.shareId = 1106
union.cps.ImageUrl = http://img10.static.yhbimg.com/article/2018/05/18/14/017112c48a4af09fdf161356b4b12f7059.png
\ No newline at end of file
union.cps.ImageUrl = http://img10.static.yhbimg.com/article/2018/05/23/16/017c0037ac8304c204686f5045c5eb9769.jpeg
\ No newline at end of file
... ...
... ... @@ -376,10 +376,10 @@
<appender-ref ref="PINYOU_MATCH"/>
</logger>
<logger name="cps_mq" level="INFO" additivity="false">
<logger name="cps_mq" level="INFO" additivity="true">
<appender-ref ref="CPS_MQ"/>
</logger>
<logger name="cps_settlement" level="INFO" additivity="false">
<logger name="cps_settlement" level="INFO" additivity="true">
<appender-ref ref="CPS_SETTLEMENT"/>
</logger>
</configuration>
\ No newline at end of file
... ...