提交 d7d12576 作者: xiaowang

租赁订单

上级 9f520a47
...@@ -151,41 +151,73 @@ public class LeaseOrderServiceImpl implements LeaseOrderService { ...@@ -151,41 +151,73 @@ public class LeaseOrderServiceImpl implements LeaseOrderService {
BigDecimal salaryAmount = BigDecimal.ZERO; BigDecimal salaryAmount = BigDecimal.ZERO;
Integer statusCode = null; Integer statusCode = null;
// 获取用户钱包信息 // 获取用户钱包信息
ResultBody<PayWalletDTO> payResInfo = userAppApi.getCurrentUserPayWalletInfo(currentAccount.getToken()); if (param.getDeductSalaryAmount().equals(1) || param.getDeductShareAmount().equals(1)) {
if (!payResInfo.getCode().equals(ResultEnum.SUCCESS.getResultCode()) || payResInfo.getResult() == null) { ResultBody<PayWalletDTO> payResInfo = userAppApi.getCurrentUserPayWalletInfo(currentAccount.getToken());
return payResInfo; if (!payResInfo.getCode().equals(ResultEnum.SUCCESS.getResultCode()) || payResInfo.getResult() == null) {
} return payResInfo;
PayWalletDTO payWalletDTO = payResInfo.getResult();
if (param.getDeductShareAmount().equals(1)) {
if (otherAmount.compareTo(payWalletDTO.getCashAmt()) >= 0) {
// 抵扣云享金小于等于订单总额时,直接使用云享金
shareAmount = payWalletDTO.getCashAmt();
} else {
// 余额超过订单金额时,订单总额使用余额支付
shareAmount = otherAmount;
} }
} PayWalletDTO payWalletDTO = payResInfo.getResult();
otherAmount = otherAmount.subtract(shareAmount); // 先使用云享金来扣减押金
// 支付完成 if (param.getDeductShareAmount().equals(1)) {
if (otherAmount.compareTo(BigDecimal.ZERO) == 0) { if (otherCashPledge.compareTo(payWalletDTO.getCashAmt()) >= 0) {
statusCode = LeaseOrderStatus.PAID.getCode(); // 不够抵扣押金
} else { shareCashPledge = payWalletDTO.getCashAmt();
if (param.getDeductSalaryAmount().equals(1)) {
if (otherAmount.compareTo(payWalletDTO.getSalaryAmt()) >= 0) {
// 抵扣余额小于等于订单总额时,直接使用余额
salaryAmount = payWalletDTO.getSalaryAmt();
} else { } else {
// 余额超过订单金额时,订单总额使用余额支付 // 够抵扣押金
salaryAmount = otherAmount; shareCashPledge = otherCashPledge;
} }
otherCashPledge = otherCashPledge.subtract(shareCashPledge);
if (otherCashPledge.compareTo(BigDecimal.ZERO) == 0) {
otherAmount = otherAmount.subtract(shareCashPledge);
} else {
if (param.getDeductSalaryAmount().equals(1)) {
if (otherCashPledge.compareTo(payWalletDTO.getSalaryAmt()) >= 0) {
salaryCashPledge = payWalletDTO.getSalaryAmt();
} else {
salaryCashPledge = otherCashPledge;
}
otherCashPledge = otherCashPledge.subtract(salaryCashPledge);
if (otherCashPledge.compareTo(BigDecimal.ZERO) == 0) {
otherAmount = otherAmount.subtract(salaryCashPledge.add(shareCashPledge));
}
}
}
} }
otherAmount = otherAmount.subtract(salaryAmount); // 抵扣完后当押金为0的时候 继续抵扣其余金额
if (otherAmount.compareTo(BigDecimal.ZERO) == 0) { if (otherCashPledge.compareTo(BigDecimal.ZERO) == 0) {
statusCode = LeaseOrderStatus.PAID.getCode(); if (param.getDeductShareAmount().equals(1)) {
if (otherAmount.compareTo(payWalletDTO.getCashAmt().subtract(shareCashPledge)) >= 0) {
// 抵扣云享金小于等于订单总额时,直接使用云享金
shareAmount = payWalletDTO.getCashAmt().subtract(shareCashPledge);
} else {
// 余额超过订单金额时,订单总额使用余额支付
shareAmount = otherAmount;
}
}
otherAmount = otherAmount.subtract(shareAmount);
// 支付完成
if (otherAmount.compareTo(BigDecimal.ZERO) == 0) {
statusCode = LeaseOrderStatus.PAID.getCode();
} else {
if (param.getDeductSalaryAmount().equals(1)) {
if (otherAmount.compareTo(payWalletDTO.getSalaryAmt().subtract(salaryCashPledge)) >= 0) {
// 抵扣余额小于等于订单总额时,直接使用余额
salaryAmount = payWalletDTO.getSalaryAmt().subtract(salaryCashPledge);
} else {
// 余额超过订单金额时,订单总额使用余额支付
salaryAmount = otherAmount;
}
}
otherAmount = otherAmount.subtract(salaryAmount);
if (otherAmount.compareTo(BigDecimal.ZERO) == 0) {
statusCode = LeaseOrderStatus.PAID.getCode();
}
}
} }
// 抵扣余额
uavOrderService.deductWallet(shareAmount.add(shareCashPledge), salaryAmount.add(salaryCashPledge), currentAccount);
} }
// 抵扣余额
uavOrderService.deductWallet(shareAmount, salaryAmount, currentAccount);
// 获取商品主图 // 获取商品主图
String url = null; String url = null;
for (GoodsResourcesVO goodsResourcesVO : leaseGoodsVO.getResourcesList()) { for (GoodsResourcesVO goodsResourcesVO : leaseGoodsVO.getResourcesList()) {
...@@ -212,6 +244,8 @@ public class LeaseOrderServiceImpl implements LeaseOrderService { ...@@ -212,6 +244,8 @@ public class LeaseOrderServiceImpl implements LeaseOrderService {
} }
leaseOrderDO.setSalaryAmount(salaryAmount); leaseOrderDO.setSalaryAmount(salaryAmount);
leaseOrderDO.setSku(param.getSku()); leaseOrderDO.setSku(param.getSku());
leaseOrderDO.setSalaryCashPledge(salaryCashPledge);
leaseOrderDO.setShareCashPledge(shareCashPledge);
leaseOrderDO.setShareAmount(shareAmount); leaseOrderDO.setShareAmount(shareAmount);
leaseOrderDO.setOtherAmount(otherAmount); leaseOrderDO.setOtherAmount(otherAmount);
leaseOrderDO.setUserAddressId(param.getUserAddressId()); leaseOrderDO.setUserAddressId(param.getUserAddressId());
......
...@@ -90,14 +90,14 @@ public class UavOrderServiceImpl implements UavOrderService { ...@@ -90,14 +90,14 @@ public class UavOrderServiceImpl implements UavOrderService {
@Transactional @Transactional
public ResultBody addOrder(AddUavOrderVO param, BaseAccountDTO currentAccount) { public ResultBody addOrder(AddUavOrderVO param, BaseAccountDTO currentAccount) {
log.info("user:{},addOrder param:{}", currentAccount.getUserAccountId(), param); log.info("user:{},addOrder param:{}", currentAccount.getUserAccountId(), param);
if (CollectionUtils.isEmpty(param.getSkuVOS())){ if (CollectionUtils.isEmpty(param.getSkuVOS())) {
return ResultBody.error("至少选择一个规格!"); return ResultBody.error("至少选择一个规格!");
} }
MallGoodsVO mallGoodsVO = null; MallGoodsVO mallGoodsVO = null;
try { try {
mallGoodsVO = pmsClient.mallGoodsDetails(param.getMallGoodsId()); mallGoodsVO = pmsClient.mallGoodsDetails(param.getMallGoodsId());
// 检验商品是否在卖 // 检验商品是否在卖
if (mallGoodsVO == null || !mallGoodsVO.getShelfStatus().equals(1)){ if (mallGoodsVO == null || !mallGoodsVO.getShelfStatus().equals(1)) {
return ResultBody.error("商品已下架"); return ResultBody.error("商品已下架");
} }
// 找到对应的规格 // 找到对应的规格
...@@ -111,11 +111,11 @@ public class UavOrderServiceImpl implements UavOrderService { ...@@ -111,11 +111,11 @@ public class UavOrderServiceImpl implements UavOrderService {
break; break;
} }
} }
if (!flag){ if (!flag) {
return ResultBody.error("选择规格不存在"); return ResultBody.error("选择规格不存在");
} }
} }
}catch (Exception e){ } catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
e.printStackTrace(); e.printStackTrace();
} }
...@@ -133,31 +133,31 @@ public class UavOrderServiceImpl implements UavOrderService { ...@@ -133,31 +133,31 @@ public class UavOrderServiceImpl implements UavOrderService {
BigDecimal salaryAmount = BigDecimal.ZERO; BigDecimal salaryAmount = BigDecimal.ZERO;
Integer statusCode = null; Integer statusCode = null;
// 正常订单可以抵扣云享金和余额、意向订单不能扣 // 正常订单可以抵扣云享金和余额、意向订单不能扣
if (param.getOrderType().equals(UavOrderType.PAY.getCode())){ if (param.getOrderType().equals(UavOrderType.PAY.getCode())) {
ResultBody<PayWalletDTO> payResInfo = userAppApi.getCurrentUserPayWalletInfo(currentAccount.getToken()); ResultBody<PayWalletDTO> payResInfo = userAppApi.getCurrentUserPayWalletInfo(currentAccount.getToken());
if (!payResInfo.getCode().equals(ResultEnum.SUCCESS.getResultCode()) || payResInfo.getResult() == null){ if (!payResInfo.getCode().equals(ResultEnum.SUCCESS.getResultCode()) || payResInfo.getResult() == null) {
return payResInfo; return payResInfo;
} }
PayWalletDTO payWalletDTO = payResInfo.getResult(); PayWalletDTO payWalletDTO = payResInfo.getResult();
if (param.getDeductShareAmount().equals(1)){ if (param.getDeductShareAmount().equals(1)) {
if (otherAmount.compareTo(payWalletDTO.getCashAmt()) >= 0) { if (otherAmount.compareTo(payWalletDTO.getCashAmt()) >= 0) {
// 抵扣云享金小于等于订单总额时,直接使用云享金 // 抵扣云享金小于等于订单总额时,直接使用云享金
shareAmount = payWalletDTO.getCashAmt(); shareAmount = payWalletDTO.getCashAmt();
}else { } else {
// 余额超过订单金额时,订单总额使用余额支付 // 余额超过订单金额时,订单总额使用余额支付
shareAmount = otherAmount; shareAmount = otherAmount;
} }
} }
otherAmount = otherAmount.subtract(shareAmount); otherAmount = otherAmount.subtract(shareAmount);
// 支付完成 // 支付完成
if (otherAmount.compareTo(BigDecimal.ZERO) == 0 ){ if (otherAmount.compareTo(BigDecimal.ZERO) == 0) {
statusCode = UavOrderStatus.WAITING_DELIVER_GOODS.getCode(); statusCode = UavOrderStatus.WAITING_DELIVER_GOODS.getCode();
}else { } else {
if (param.getDeductSalaryAmount().equals(1)){ if (param.getDeductSalaryAmount().equals(1)) {
if (otherAmount.compareTo(payWalletDTO.getSalaryAmt()) >= 0) { if (otherAmount.compareTo(payWalletDTO.getSalaryAmt()) >= 0) {
// 抵扣余额小于等于订单总额时,直接使用余额 // 抵扣余额小于等于订单总额时,直接使用余额
salaryAmount = payWalletDTO.getSalaryAmt(); salaryAmount = payWalletDTO.getSalaryAmt();
}else { } else {
// 余额超过订单金额时,订单总额使用余额支付 // 余额超过订单金额时,订单总额使用余额支付
salaryAmount = otherAmount; salaryAmount = otherAmount;
} }
...@@ -175,9 +175,9 @@ public class UavOrderServiceImpl implements UavOrderService { ...@@ -175,9 +175,9 @@ public class UavOrderServiceImpl implements UavOrderService {
uavOrderDO.setOrderNo(orderNo); uavOrderDO.setOrderNo(orderNo);
uavOrderDO.setOrderTotalAmount(orderTotalAmount); uavOrderDO.setOrderTotalAmount(orderTotalAmount);
uavOrderDO.setOrderType(param.getOrderType()); uavOrderDO.setOrderType(param.getOrderType());
if (param.getOrderType().equals(UavOrderType.PAY.getCode())){ if (param.getOrderType().equals(UavOrderType.PAY.getCode())) {
uavOrderDO.setStatusCode(otherAmount.compareTo(BigDecimal.ZERO) > 0 ? UavOrderStatus.PAYING.getCode() : statusCode); uavOrderDO.setStatusCode(otherAmount.compareTo(BigDecimal.ZERO) > 0 ? UavOrderStatus.PAYING.getCode() : statusCode);
}else { } else {
uavOrderDO.setStatusCode(UavOrderStatus.CONFIRM.getCode()); uavOrderDO.setStatusCode(UavOrderStatus.CONFIRM.getCode());
} }
uavOrderDO.setUserAccountId(currentAccount.getUserAccountId()); uavOrderDO.setUserAccountId(currentAccount.getUserAccountId());
...@@ -228,7 +228,7 @@ public class UavOrderServiceImpl implements UavOrderService { ...@@ -228,7 +228,7 @@ public class UavOrderServiceImpl implements UavOrderService {
List<UavOrderPayDTO> collect = payDOS.stream().map(UavOrderPayDO::buildUavOrderPayDTO).collect(Collectors.toList()); List<UavOrderPayDTO> collect = payDOS.stream().map(UavOrderPayDO::buildUavOrderPayDTO).collect(Collectors.toList());
uavOrderDTO.setPayDTOList(collect); uavOrderDTO.setPayDTOList(collect);
} }
List<UavOrderSkuDO> skuDOS =uavOrderDao.listUavOrderSkuDO(id); List<UavOrderSkuDO> skuDOS = uavOrderDao.listUavOrderSkuDO(id);
if (CollectionUtils.isNotEmpty(skuDOS)) { if (CollectionUtils.isNotEmpty(skuDOS)) {
List<UavOrderSkuDTO> uavOrderSkuDTOS = skuDOS.stream().map(UavOrderSkuDO::buildUavOrderSkuDTO).collect(Collectors.toList()); List<UavOrderSkuDTO> uavOrderSkuDTOS = skuDOS.stream().map(UavOrderSkuDO::buildUavOrderSkuDTO).collect(Collectors.toList());
uavOrderDTO.setSkuDTOList(uavOrderSkuDTOS); uavOrderDTO.setSkuDTOList(uavOrderSkuDTOS);
...@@ -286,7 +286,7 @@ public class UavOrderServiceImpl implements UavOrderService { ...@@ -286,7 +286,7 @@ public class UavOrderServiceImpl implements UavOrderService {
payUavWalletVO.setOrderStatus(1400); payUavWalletVO.setOrderStatus(1400);
payUavWalletVO.setUserAccountId(uavOrderDO.getUserAccountId()); payUavWalletVO.setUserAccountId(uavOrderDO.getUserAccountId());
ResultBody resultBody = userAppApi.feignPayUavWallet(payUavWalletVO, token); ResultBody resultBody = userAppApi.feignPayUavWallet(payUavWalletVO, token);
if (!resultBody.getCode().equals(ResultEnum.SUCCESS.getResultCode())){ if (!resultBody.getCode().equals(ResultEnum.SUCCESS.getResultCode())) {
return resultBody; return resultBody;
} }
} }
...@@ -310,7 +310,7 @@ public class UavOrderServiceImpl implements UavOrderService { ...@@ -310,7 +310,7 @@ public class UavOrderServiceImpl implements UavOrderService {
@Override @Override
public ResultBody list(UavOrderQO uavOrderQO, BaseAccountDTO currentAccount) { public ResultBody list(UavOrderQO uavOrderQO, BaseAccountDTO currentAccount) {
if (!currentAccount.getRoleInfo().getSuperAdmin().equals(1)){ if (!currentAccount.getRoleInfo().getSuperAdmin().equals(1)) {
uavOrderQO.setThirdBackUserAccountId(currentAccount.getUserAccountId()); uavOrderQO.setThirdBackUserAccountId(currentAccount.getUserAccountId());
uavOrderQO.setOrderType(UavOrderType.PAY.getCode()); uavOrderQO.setOrderType(UavOrderType.PAY.getCode());
} }
...@@ -474,7 +474,7 @@ public class UavOrderServiceImpl implements UavOrderService { ...@@ -474,7 +474,7 @@ public class UavOrderServiceImpl implements UavOrderService {
} }
@Transactional @Transactional
public void updateUavOrderStatus(Integer id, UavOrderStatus uavOrderStatus){ public void updateUavOrderStatus(Integer id, UavOrderStatus uavOrderStatus) {
uavOrderDao.updateUavOrderStatus(id, uavOrderStatus.getNextCode()); uavOrderDao.updateUavOrderStatus(id, uavOrderStatus.getNextCode());
} }
...@@ -515,7 +515,7 @@ public class UavOrderServiceImpl implements UavOrderService { ...@@ -515,7 +515,7 @@ public class UavOrderServiceImpl implements UavOrderService {
UavOrderPayDO beforeUavOrderPayDO = uavOrderDao.getUavOrderPayById(uavOrderPayVO.getId()); UavOrderPayDO beforeUavOrderPayDO = uavOrderDao.getUavOrderPayById(uavOrderPayVO.getId());
// 一个订单可能会多次上传付款凭证,因此单独审核 // 一个订单可能会多次上传付款凭证,因此单独审核
UavOrderDO uavOrderDO = uavOrderDao.detail(beforeUavOrderPayDO.getUavOrderId()); UavOrderDO uavOrderDO = uavOrderDao.detail(beforeUavOrderPayDO.getUavOrderId());
if (uavOrderPayVO.getCheckStatus().equals(1)){ if (uavOrderPayVO.getCheckStatus().equals(1)) {
// 第一次审核通过,则要把订单状态改为待发货;意向订单还要生成采购订单 // 第一次审核通过,则要把订单状态改为待发货;意向订单还要生成采购订单
if (uavOrderDO.getStatusCode().equals(UavOrderStatus.FINISH_PAYING.getCode())) { if (uavOrderDO.getStatusCode().equals(UavOrderStatus.FINISH_PAYING.getCode())) {
this.updateUavOrderStatus(beforeUavOrderPayDO.getUavOrderId(), UavOrderStatus.FINISH_PAYING); this.updateUavOrderStatus(beforeUavOrderPayDO.getUavOrderId(), UavOrderStatus.FINISH_PAYING);
...@@ -529,7 +529,7 @@ public class UavOrderServiceImpl implements UavOrderService { ...@@ -529,7 +529,7 @@ public class UavOrderServiceImpl implements UavOrderService {
uavPurchaseOrderDO.setStatusCode(UavOrderStatus.CONFIRM.getCode()); uavPurchaseOrderDO.setStatusCode(UavOrderStatus.CONFIRM.getCode());
uavPODao.addPurchaseOrder(uavPurchaseOrderDO); uavPODao.addPurchaseOrder(uavPurchaseOrderDO);
} }
}else { } else {
if (uavOrderDO.getStatusCode().equals(UavOrderStatus.FINISH_PAYING.getCode())) { if (uavOrderDO.getStatusCode().equals(UavOrderStatus.FINISH_PAYING.getCode())) {
// 第一次未通过,需要走回上一步 // 第一次未通过,需要走回上一步
this.updateUavOrderStatus(beforeUavOrderPayDO.getUavOrderId(), UavOrderStatus.SIGN); this.updateUavOrderStatus(beforeUavOrderPayDO.getUavOrderId(), UavOrderStatus.SIGN);
...@@ -543,9 +543,9 @@ public class UavOrderServiceImpl implements UavOrderService { ...@@ -543,9 +543,9 @@ public class UavOrderServiceImpl implements UavOrderService {
@Transactional @Transactional
@Override @Override
public void payUavOrder(TopUpOrderVO topUpOrderVO) { public void payUavOrder(TopUpOrderVO topUpOrderVO) {
if (topUpOrderVO.getOrderNo().startsWith("m")){ if (topUpOrderVO.getOrderNo().startsWith("m")) {
payMultiUavOrder(topUpOrderVO); payMultiUavOrder(topUpOrderVO);
}else { } else {
paySingleUavOrder(topUpOrderVO); paySingleUavOrder(topUpOrderVO);
} }
} }
...@@ -609,7 +609,7 @@ public class UavOrderServiceImpl implements UavOrderService { ...@@ -609,7 +609,7 @@ public class UavOrderServiceImpl implements UavOrderService {
if (uavOrderDO.getOrderType().equals(UavOrderType.SIGN.getCode())) { if (uavOrderDO.getOrderType().equals(UavOrderType.SIGN.getCode())) {
ResultBody<PayWalletDTO> payResInfo = userAppApi.getPayWalletInfo(uavOrderDO.getUserAccountId(), currentAccount.getToken()); ResultBody<PayWalletDTO> payResInfo = userAppApi.getPayWalletInfo(uavOrderDO.getUserAccountId(), currentAccount.getToken());
PayWalletDTO payWalletDTO = payResInfo.getResult(); PayWalletDTO payWalletDTO = payResInfo.getResult();
if (!payResInfo.getCode().equals(ResultEnum.SUCCESS.getResultCode()) || payWalletDTO == null){ if (!payResInfo.getCode().equals(ResultEnum.SUCCESS.getResultCode()) || payWalletDTO == null) {
return payResInfo; return payResInfo;
} }
// 要扣除的云享金 // 要扣除的云享金
...@@ -621,11 +621,11 @@ public class UavOrderServiceImpl implements UavOrderService { ...@@ -621,11 +621,11 @@ public class UavOrderServiceImpl implements UavOrderService {
// 根据订单总额确认扣除多少云享金 // 根据订单总额确认扣除多少云享金
if (uavOrderVO.getOrderTotalAmount().compareTo(payWalletDTO.getCashAmt()) >= 0) { if (uavOrderVO.getOrderTotalAmount().compareTo(payWalletDTO.getCashAmt()) >= 0) {
shareAmount = payWalletDTO.getCashAmt(); shareAmount = payWalletDTO.getCashAmt();
}else { } else {
shareAmount = uavOrderVO.getOrderTotalAmount(); shareAmount = uavOrderVO.getOrderTotalAmount();
} }
// 抵扣 // 抵扣
if (shareAmount.compareTo(BigDecimal.ZERO) > 0 ) { if (shareAmount.compareTo(BigDecimal.ZERO) > 0) {
PayUavWalletVO payUavWalletVO = new PayUavWalletVO(); PayUavWalletVO payUavWalletVO = new PayUavWalletVO();
payUavWalletVO.setUserAccountId(uavOrderDO.getUserAccountId()); payUavWalletVO.setUserAccountId(uavOrderDO.getUserAccountId());
payUavWalletVO.setCashAmount(shareAmount); payUavWalletVO.setCashAmount(shareAmount);
...@@ -634,7 +634,7 @@ public class UavOrderServiceImpl implements UavOrderService { ...@@ -634,7 +634,7 @@ public class UavOrderServiceImpl implements UavOrderService {
payUavWalletVO.setOrderStatus(100); payUavWalletVO.setOrderStatus(100);
payUavWalletVO.setRemark("商城确认订单抵扣"); payUavWalletVO.setRemark("商城确认订单抵扣");
ResultBody resultBody = userAppApi.feignPayUavWallet(payUavWalletVO, currentAccount.getToken()); ResultBody resultBody = userAppApi.feignPayUavWallet(payUavWalletVO, currentAccount.getToken());
if (!resultBody.getCode().equals(ResultEnum.SUCCESS.getResultCode())){ if (!resultBody.getCode().equals(ResultEnum.SUCCESS.getResultCode())) {
return resultBody; return resultBody;
} }
} }
...@@ -736,17 +736,17 @@ public class UavOrderServiceImpl implements UavOrderService { ...@@ -736,17 +736,17 @@ public class UavOrderServiceImpl implements UavOrderService {
return ResultBody.error(uavCartDTO.getTradeName() + " 已下架,请重新选择"); return ResultBody.error(uavCartDTO.getTradeName() + " 已下架,请重新选择");
} }
} }
}else { } else {
return ResultBody.error("所选规格无效"); return ResultBody.error("所选规格无效");
} }
otherAmount = otherAmount.add(orderAmount); otherAmount = otherAmount.add(orderAmount);
// 正常订单可以抵扣云享金和余额、意向订单不能扣 // 正常订单可以抵扣云享金和余额、意向订单不能扣
if (orderByCartQO.getOrderType().equals(UavOrderType.PAY.getCode())){ if (orderByCartQO.getOrderType().equals(UavOrderType.PAY.getCode())) {
// 抵扣云享金 // 抵扣云享金
if (companyDTO.getDeductShareAmount().equals(1) && payWalletDTO.getCashAmt().compareTo(BigDecimal.ZERO) > 0) { if (companyDTO.getDeductShareAmount().equals(1) && payWalletDTO.getCashAmt().compareTo(BigDecimal.ZERO) > 0) {
if (payWalletDTO.getCashAmt().compareTo(otherAmount) > 0) { if (payWalletDTO.getCashAmt().compareTo(otherAmount) > 0) {
shareAmount = shareAmount.add(otherAmount); shareAmount = shareAmount.add(otherAmount);
}else { } else {
shareAmount = shareAmount.add(payWalletDTO.getCashAmt()); shareAmount = shareAmount.add(payWalletDTO.getCashAmt());
} }
otherAmount = otherAmount.subtract(shareAmount); otherAmount = otherAmount.subtract(shareAmount);
...@@ -758,7 +758,7 @@ public class UavOrderServiceImpl implements UavOrderService { ...@@ -758,7 +758,7 @@ public class UavOrderServiceImpl implements UavOrderService {
&& otherAmount.compareTo(BigDecimal.ZERO) > 0) { && otherAmount.compareTo(BigDecimal.ZERO) > 0) {
if (otherAmount.compareTo(payWalletDTO.getSalaryAmt()) > 0) { if (otherAmount.compareTo(payWalletDTO.getSalaryAmt()) > 0) {
salaryAmount = salaryAmount.add(payWalletDTO.getSalaryAmt()); salaryAmount = salaryAmount.add(payWalletDTO.getSalaryAmt());
}else { } else {
salaryAmount = salaryAmount.add(otherAmount); salaryAmount = salaryAmount.add(otherAmount);
} }
otherAmount = otherAmount.subtract(salaryAmount); otherAmount = otherAmount.subtract(salaryAmount);
...@@ -767,10 +767,10 @@ public class UavOrderServiceImpl implements UavOrderService { ...@@ -767,10 +767,10 @@ public class UavOrderServiceImpl implements UavOrderService {
} }
if (otherAmount.compareTo(BigDecimal.ZERO) == 0) { if (otherAmount.compareTo(BigDecimal.ZERO) == 0) {
statusCode = UavOrderStatus.WAITING_DELIVER_GOODS.getCode(); statusCode = UavOrderStatus.WAITING_DELIVER_GOODS.getCode();
}else { } else {
statusCode = UavOrderStatus.PAYING.getCode(); statusCode = UavOrderStatus.PAYING.getCode();
} }
}else { } else {
statusCode = UavOrderStatus.CONFIRM.getCode(); statusCode = UavOrderStatus.CONFIRM.getCode();
} }
// 设置订单状态 // 设置订单状态
...@@ -859,7 +859,7 @@ public class UavOrderServiceImpl implements UavOrderService { ...@@ -859,7 +859,7 @@ public class UavOrderServiceImpl implements UavOrderService {
if (allShareAmount.compareTo(BigDecimal.ZERO) > 0 || allSalaryAmount.compareTo(BigDecimal.ZERO) > 0) { if (allShareAmount.compareTo(BigDecimal.ZERO) > 0 || allSalaryAmount.compareTo(BigDecimal.ZERO) > 0) {
ResultBody resultBody = userAppApi.feignPayUavWallet(payUavWalletVO, currentAccount.getToken()); ResultBody resultBody = userAppApi.feignPayUavWallet(payUavWalletVO, currentAccount.getToken());
if (!resultBody.getCode().equals(ResultEnum.SUCCESS.getResultCode())) { if (!resultBody.getCode().equals(ResultEnum.SUCCESS.getResultCode())) {
ResultBody.error("余额抵扣失败!"); return ResultBody.error("余额抵扣失败!");
} }
} }
return ResultBody.success(); return ResultBody.success();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论