bug:关单失败需要回滚

This commit is contained in:
磷叶 2025-01-27 15:45:36 +08:00
parent ee87f5918f
commit 42a9850cca
3 changed files with 5 additions and 2 deletions

View File

@ -258,6 +258,7 @@ public class PayBillServiceImpl implements PayBillService
throw new ServiceException("当前交易已成功,无法关闭");
} else {
log.error("关闭支付订单失败: payNo = {} 原因:{}", bill.getPayNo(), e.getMessage());
throw new ServiceException("关闭支付订单失败");
}
}
}

View File

@ -264,11 +264,11 @@ public class UserServiceImpl implements UserService
// 更新用户余额
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);
ServiceUtil.assertion(record != 1, "用户余额变动记录失败");
ServiceUtil.assertion(record != 1, "记录ID为%s的用户余额变动记录%s元失败", userId, amount);
return updateCount;
}

View File

@ -7,6 +7,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
@ -68,6 +69,7 @@ import io.swagger.annotations.ApiParam;
@Api(tags = "充值/提现记录")
@RestController
@RequestMapping("/app/bill")
@Slf4j
public class AppTransactionBillController extends BaseController
{
@Autowired