Commit 518485c7 by guojuxing

短信套餐包续订定时器添加:订购逻辑

parent acc5e9ac
......@@ -50,8 +50,8 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
private UserApiService userApiService;
@Autowired
private Config config;
// @Autowired
// private BillingOrderApiService billingOrderApiService;
@Autowired
private BillingOrderApiService billingOrderApiService;
@Override
public ServiceResponse<BillingAccountDTO> getByEnterpriseId(Integer enterpriseId) {
......@@ -165,9 +165,9 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
Integer preNumber = (Integer) resultMap.get(AutoRechargeRedisConstant.PRE_NUMBER_MAP_KEY);
if (preNumber > getSmsBalanceNumber(enterpriseId)) {
//进行自动扣款
account.setAccountBalance(account.getAccountBalance() - money);
billingAccountService.updateBillingAccount(account);
//生成订单
// account.setAccountBalance(account.getAccountBalance() - money);
// billingAccountService.updateBillingAccount(account);
//生成订单 支付
BillingOrderDTO orderDTO = new BillingOrderDTO();
orderDTO.setEnterpriseId(enterpriseId);
orderDTO.setOrderContent(smsPackageDTO.getSmsPackageName());
......@@ -175,20 +175,20 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
orderDTO.setTotalFeePaid(money);
orderDTO.setPayType(PayTypeEnum.BALANCE_PAY.getCode());
SmsPackageOrderItemDTO itemDTO = new SmsPackageOrderItemDTO();
itemDTO.setBuyCount(smsPackageDTO.getItemCount());
itemDTO.setBuyCount(1);
itemDTO.setCode(smsPackageDTO.getSmsPackageCode());
itemDTO.setCost(smsPackageDTO.getItemFee());
// itemDTO.setPackageLength(qo.getPackageHours());
itemDTO.setPackageLength(12);
itemDTO.setSmsAmount(smsPackageDTO.getItemCount());
for(PackageHoursEnum packageHoursEnum : PackageHoursEnum.values()){
if(packageHoursEnum.getCode() == itemDTO.getPackageLength()){
itemDTO.setPackageHours(packageHoursEnum.getMessage());
}
}
// ServiceResponse<Integer> orderResponse = this.billingOrderApiService.saveSmsOrderBuyNow(orderDTO, itemDTO);
ServiceResponse<Integer> orderResponse = billingOrderApiService.saveSmsOrderBuyNow(orderDTO, itemDTO);
//订购短信套餐包
// this.billingOrderApiService.
// paySmsPackageOrder(enterpriseId, orderResponse.getResult(), PayTypeEnum.BALANCE_PAY.getCode(), null);
billingOrderApiService.
paySmsPackageOrder(enterpriseId, orderResponse.getResult(), PayTypeEnum.BALANCE_PAY.getCode(), null);
}
}
} else {
......
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