提交 0edd5af3 作者: zhenjie

商城订单优化

上级 8aa668f9
......@@ -53,7 +53,7 @@ public interface UserAppApi {
* @param userAccountId
* @return
*/
@RequestMapping(value = "/userapp/user-account/feignGetUserSimpleInfo", method = RequestMethod.GET)
@RequestMapping(value = "/user-account/feignGetUserSimpleInfo", method = RequestMethod.GET)
public UserAccountSimpleDTO feignGetUserSimpleInfo(@RequestParam Integer userAccountId, @RequestHeader("token") String token);
}
......@@ -125,49 +125,51 @@ public class UavOrderServiceImpl implements UavOrderService {
// 校验云享金、钱包余额是否足够抵扣
BigDecimal shareAmount = BigDecimal.ZERO;
BigDecimal salaryAmount = BigDecimal.ZERO;
ResultBody<PayWalletDTO> payResInfo = userAppApi.getCurrentUserPayWalletInfo(currentAccount.getToken());
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;
}
}
otherAmount = otherAmount.subtract(shareAmount);
Integer statusCode = null;
// 支付完成
if (otherAmount.compareTo(BigDecimal.ZERO) == 0 ){
statusCode = UavOrderStatus.WAITING_DELIVER_GOODS.getCode();
}else {
if (param.getDeductSalaryAmount().equals(1)){
if (otherAmount.compareTo(payWalletDTO.getSalaryAmt()) >= 0) {
// 抵扣余额小于等于订单总额时,直接使用余额
salaryAmount = payWalletDTO.getSalaryAmt();
// 正常订单可以抵扣云享金和余额、意向订单不能扣
if (param.getOrderType().equals(UavOrderType.PAY.getCode())){
ResultBody<PayWalletDTO> payResInfo = userAppApi.getCurrentUserPayWalletInfo(currentAccount.getToken());
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 {
// 余额超过订单金额时,订单总额使用余额支付
salaryAmount = otherAmount;
shareAmount = otherAmount;
}
}
otherAmount = otherAmount.subtract(salaryAmount);
if (otherAmount.compareTo(BigDecimal.ZERO) == 0) {
otherAmount = otherAmount.subtract(shareAmount);
// 支付完成
if (otherAmount.compareTo(BigDecimal.ZERO) == 0 ){
statusCode = UavOrderStatus.WAITING_DELIVER_GOODS.getCode();
}else {
if (param.getDeductSalaryAmount().equals(1)){
if (otherAmount.compareTo(payWalletDTO.getSalaryAmt()) >= 0) {
// 抵扣余额小于等于订单总额时,直接使用余额
salaryAmount = payWalletDTO.getSalaryAmt();
}else {
// 余额超过订单金额时,订单总额使用余额支付
salaryAmount = otherAmount;
}
}
otherAmount = otherAmount.subtract(salaryAmount);
if (otherAmount.compareTo(BigDecimal.ZERO) == 0) {
statusCode = UavOrderStatus.WAITING_DELIVER_GOODS.getCode();
}
}
PayUavWalletVO payUavWalletVO = new PayUavWalletVO();
payUavWalletVO.setCashAmount(shareAmount);
payUavWalletVO.setSalaryAmount(salaryAmount);
payUavWalletVO.setOrderStatus(100);
payUavWalletVO.setUserAccountId(currentAccount.getUserAccountId());
ResultBody resultBody = userAppApi.feignPayUavWallet(payUavWalletVO, currentAccount.getToken());
if (!resultBody.getCode().equals(ResultEnum.SUCCESS.getResultCode())){
return resultBody;
}
}
PayUavWalletVO payUavWalletVO = new PayUavWalletVO();
payUavWalletVO.setCashAmount(shareAmount);
payUavWalletVO.setSalaryAmount(salaryAmount);
payUavWalletVO.setOrderStatus(100);
payUavWalletVO.setUserAccountId(currentAccount.getUserAccountId());
ResultBody resultBody = userAppApi.feignPayUavWallet(payUavWalletVO, currentAccount.getToken());
if (!resultBody.getCode().equals(ResultEnum.SUCCESS.getResultCode())){
return resultBody;
}
// 添加总订单表
UavOrderDO uavOrderDO = new UavOrderDO();
......
......@@ -177,7 +177,7 @@
select count(*) from uav_order
where 1 = 1
<if test="keyword != null">
and order_no = #{orderNo}
and order_no = #{keyword}
</if>
<if test="uid != null">
and user_account_id = #{uid}
......@@ -205,7 +205,7 @@
uav_order uo
where 1 = 1
<if test="keyword != null">
and uo.order_no = #{orderNo}
and uo.order_no = #{keyword}
</if>
<if test="uid != null">
and uo.user_account_id = #{uid}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论