...
|
...
|
@@ -272,10 +272,14 @@ 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()));
|
|
|
if (Integer.valueOf(unionShareOrders.getStatus()) > 90){
|
|
|
unionShareOrders.setAmountStr("+0");
|
|
|
}else {
|
|
|
unionShareOrders.setAmountStr("+"+df1.format(unionShareOrders.getAmount()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public ShareOrderBo queryOrderDetail(Integer uid, String orderCode) {
|
...
|
...
|
@@ -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));
|
|
|
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的顺序
|
...
|
...
|
|