| | |
| | | System.err.println("支付数据" + tPayHuimin); |
| | | payHuiminService.save(tPayHuimin); |
| | | if (userCoupon != null) { |
| | | userCoupon.setStatus(2); |
| | | userCouponService.updateById(userCoupon); |
| | | // t_user_coupon 以 userId 分片;updateById 会把 userId 放入 SET, |
| | | // ShardingSphere 会拒绝更新分片键。只更新状态,并在 WHERE 中带上 userId。 |
| | | boolean couponUpdated = userCouponService.lambdaUpdate() |
| | | .set(UserCoupon::getStatus, 2) |
| | | .eq(UserCoupon::getId, userCoupon.getId()) |
| | | .eq(UserCoupon::getUserId, uid) |
| | | .eq(UserCoupon::getStatus, 1) |
| | | .update(); |
| | | if (!couponUpdated) { |
| | | return ResultUtil.error("优惠券已被使用"); |
| | | } |
| | | } |
| | | BigDecimal bigDecimal = new BigDecimal(studentIds.split(",").length); |
| | | if (tPayHuimin.getSalesMoney().compareTo(BigDecimal.ZERO)==0){ |