Commit 2765e8d9 by guojuxing

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

parent a169ce63
......@@ -6,6 +6,7 @@ import com.gic.auth.service.UserApiService;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.config.Config;
import com.gic.enterprise.constant.Constants;
import com.gic.enterprise.constant.PayTypeEnum;
import com.gic.enterprise.constant.billing.AutoRechargeEnum;
import com.gic.enterprise.constant.billing.AutoRechargeRedisConstant;
import com.gic.enterprise.dto.*;
......@@ -48,6 +49,8 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
private UserApiService userApiService;
@Autowired
private Config config;
@Autowired
private BillingOrderApiService billingOrderApiService;
@Override
public ServiceResponse<BillingAccountDTO> getByEnterpriseId(Integer enterpriseId) {
......@@ -163,6 +166,18 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
//进行自动扣款
account.setAccountBalance(account.getAccountBalance() - money);
billingAccountService.updateBillingAccount(account);
//生成订单
BillingOrderDTO orderDTO = new BillingOrderDTO();
orderDTO.setEnterpriseId(enterpriseId);
orderDTO.setOrderContent(smsPackageDTO.getSmsPackageName());
orderDTO.setTotalFee(money);
orderDTO.setTotalFeePaid(money);
orderDTO.setPayType(PayTypeEnum.BALANCE_PAY.getCode());
SmsPackageOrderItemDTO itemDTO = new SmsPackageOrderItemDTO();
ServiceResponse<Integer> orderResponse = this.billingOrderApiService.saveSmsOrderBuyNow(orderDTO, itemDTO);
//订购短信套餐包
this.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