bug:关单失败需要回滚
This commit is contained in:
parent
ee87f5918f
commit
42a9850cca
|
@ -258,6 +258,7 @@ public class PayBillServiceImpl implements PayBillService
|
||||||
throw new ServiceException("当前交易已成功,无法关闭");
|
throw new ServiceException("当前交易已成功,无法关闭");
|
||||||
} else {
|
} else {
|
||||||
log.error("关闭支付订单失败: payNo = {} 原因:{}", bill.getPayNo(), e.getMessage());
|
log.error("关闭支付订单失败: payNo = {} 原因:{}", bill.getPayNo(), e.getMessage());
|
||||||
|
throw new ServiceException("关闭支付订单失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -264,11 +264,11 @@ public class UserServiceImpl implements UserService
|
||||||
|
|
||||||
// 更新用户余额
|
// 更新用户余额
|
||||||
int updateCount = smUserMapper.subtractBalance(userId, amount, check, user.getBalance());
|
int updateCount = smUserMapper.subtractBalance(userId, amount, check, user.getBalance());
|
||||||
ServiceUtil.assertion(updateCount != 1, "减少用户余额失败,请重试");
|
ServiceUtil.assertion(updateCount != 1, "减少ID为%s的用户余额%s元失败,请重试", userId, amount);
|
||||||
|
|
||||||
// 余额变动记录
|
// 余额变动记录
|
||||||
int record = recordBalanceService.record(userId, user.getBalance(), amount.negate(), reason, bstType, bstId);
|
int record = recordBalanceService.record(userId, user.getBalance(), amount.negate(), reason, bstType, bstId);
|
||||||
ServiceUtil.assertion(record != 1, "用户余额变动记录失败");
|
ServiceUtil.assertion(record != 1, "记录ID为%s的用户余额变动记录%s元失败", userId, amount);
|
||||||
|
|
||||||
return updateCount;
|
return updateCount;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
@ -68,6 +69,7 @@ import io.swagger.annotations.ApiParam;
|
||||||
@Api(tags = "充值/提现记录")
|
@Api(tags = "充值/提现记录")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/app/bill")
|
@RequestMapping("/app/bill")
|
||||||
|
@Slf4j
|
||||||
public class AppTransactionBillController extends BaseController
|
public class AppTransactionBillController extends BaseController
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
Loading…
Reference in New Issue
Block a user