Commit d50393e9 by liyanlin

fix

parent f78738f8
......@@ -235,7 +235,7 @@ public class MallOrderPayServiceImpl implements MallOrderPayService {
.orderId(mallOrder.getId())
.orderStatus(mallOrder.getStatus())
.brandId(mallOrder.getBrandId())
.type(3) //商城订单
.type(7) //商城订单
.build();
customerBalanceService.consumer(consumerCmd);
......
......@@ -26,10 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
@Service
@Slf4j
......@@ -76,6 +73,21 @@ public class CustomerBalanceServiceImpl extends ServiceImpl<CustomerBalanceMappe
if (customerBalance.getBalance() < cmd.getAmount()) {
throw new RRException(ErrorCode.CS_2002);
}
//这笔记录来自于哪里:1:充值,2:首次充值,-1:订单扣款.3:充送 4-余额迁入5-余额迁出6-次卡扣款7-商城扣款
switch (cmd.getType()){
case -1:
if(!customerBalance.getServePayAtBalance())
throw new RRException(ErrorCode.ER_2009);
break;
case 6:
if(!customerBalance.getTimesCardPayAtBalance())
throw new RRException(ErrorCode.ER_2009);
break;
case 7:
if(!customerBalance.getProductPayAtBalance())
throw new RRException(ErrorCode.ER_2009);
break;
}
//余额支付
CustomerBalanceRecord record = CustomerBalanceRecord
......
......@@ -52,4 +52,13 @@ public class DiscountConfig implements Serializable {
@ApiModelProperty("商城产品是否按现价打折,DACP discount at current price")
private Boolean productDacp;
@ApiModelProperty("服务是否可用余额支付")
private Boolean servePayAtBalance;
@ApiModelProperty("产品是否可用余额支付")
private Boolean productPayAtBalance;
@ApiModelProperty("次卡是否可用余额支付")
private Boolean timesCardPayAtBalance;
}
......@@ -75,6 +75,15 @@ public class CustomerBalance implements Serializable {
@ApiModelProperty("商城产品是否按现价打折,DACP discount at current price")
private Boolean productDacp;
@ApiModelProperty("服务是否可用余额支付")
private Boolean servePayAtBalance;
@ApiModelProperty("产品是否可用余额支付")
private Boolean productPayAtBalance;
@ApiModelProperty("次卡是否可用余额支付")
private Boolean timesCardPayAtBalance;
public CustomerBalance(Integer customerId,
Integer balance,
Date firstChargeTime,
......@@ -95,6 +104,9 @@ public class CustomerBalance implements Serializable {
this.totalBestow = totalBestow;
this.level = level;
this.setDiscount(discountRate);
this.servePayAtBalance = false;
this.productPayAtBalance = false;
this.timesCardPayAtBalance = false;
}
public CustomerBalance() {
......@@ -110,6 +122,9 @@ public class CustomerBalance implements Serializable {
this.currentDiscount = discountRate.multiply(new BigDecimal("10"));
this.serveDacp = config.getServeDacp();
this.productDacp = config.getProductDacp();
this.servePayAtBalance = config.getServePayAtBalance();
this.productPayAtBalance = config.getProductPayAtBalance();
this.timesCardPayAtBalance = config.getTimesCardPayAtBalance();
}
/**
......@@ -136,6 +151,9 @@ public class CustomerBalance implements Serializable {
.version(1)
.updateTime(new Date())
.brandId(brandId)
.servePayAtBalance(false)
.productPayAtBalance(false)
.timesCardPayAtBalance(false)
.build();
customerBalance.setDiscount(new BigDecimal("1"));
return customerBalance;
......
......@@ -23,6 +23,8 @@ public enum ErrorCode {
ER_2007(2007, "代理余额不足"),
ER_2008(2008, "代理商不明确"),
ER_2009(2009, "不可使用余额支付")
;
private Integer code;
......
......@@ -28,6 +28,6 @@ public class ConsumerCommand {
@ApiModelProperty("品牌ID")
private Integer brandId;
@ApiModelProperty("这笔记录来自于哪里:1:充值,2:首次充值,-1:订单扣款.3:充送 4-余额迁入5-余额迁出6-次卡扣款")
@ApiModelProperty("这笔记录来自于哪里:1:充值,2:首次充值,-1:订单扣款.3:充送 4-余额迁入5-余额迁出6-次卡扣款7-商城扣款")
private Integer type = -1;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment