|
@ -84,66 +84,66 @@ public class AuditController { |
|
|
userMapper.update(user); |
|
|
userMapper.update(user); |
|
|
} |
|
|
} |
|
|
// 充值驳回 |
|
|
// 充值驳回 |
|
|
if (audit.getStatus() == 2 && audit.getRechargeId() != null) { |
|
|
|
|
|
// 获取 detail1 对象 |
|
|
|
|
|
Detail detail1 = detailMapper.selectByDetailId(audit.getDetailId()); |
|
|
|
|
|
if (detail1 == null) { |
|
|
|
|
|
throw new RuntimeException("驳回失败!未找到对应的 Detail 信息,audit.getDetailId() = " + audit.getDetailId()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 获取金币数据 |
|
|
|
|
|
BigDecimal rechargeCoin1 = detail1.getRechargeCoin(); |
|
|
|
|
|
BigDecimal taskCoin1 = detail1.getTaskCoin(); |
|
|
|
|
|
BigDecimal freeCoin1 = detail1.getFreeCoin(); |
|
|
|
|
|
|
|
|
|
|
|
// 获取 user1 对象 |
|
|
|
|
|
User user1 = userMapper.selectByJwcode(detail1.getJwcode()); |
|
|
|
|
|
if (user1 == null) { |
|
|
|
|
|
throw new RuntimeException("驳回失败!未找到对应的用户信息,detail1.getJwcode() = " + detail1.getJwcode()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 检查并更新用户金币 |
|
|
|
|
|
if (rechargeCoin1 != null) { |
|
|
|
|
|
if (user1.getBuyJb().compareTo(rechargeCoin1) < 0) { |
|
|
|
|
|
throw new RuntimeException("驳回失败!该用户剩余 BuyJb 金币不足扣除数量!"); |
|
|
|
|
|
} else { |
|
|
|
|
|
user1.setBuyJb(user1.getBuyJb().subtract(rechargeCoin1)); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (taskCoin1 != null) { |
|
|
|
|
|
if (user1.getCoreJb().compareTo(taskCoin1) < 0) { |
|
|
|
|
|
throw new RuntimeException("驳回失败!该用户剩余 CoreJb 金币不足扣除数量!"); |
|
|
|
|
|
} else { |
|
|
|
|
|
user1.setCoreJb(user1.getCoreJb().subtract(taskCoin1)); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 判断当前月份 |
|
|
|
|
|
LocalDate now1 = LocalDate.now(); |
|
|
|
|
|
Month currentMonth1 = now1.getMonth(); |
|
|
|
|
|
|
|
|
|
|
|
// 检查 free6 或 free12 的金币是否足够 |
|
|
|
|
|
if (freeCoin1 != null) { |
|
|
|
|
|
if (currentMonth1.getValue() <= 6) { |
|
|
|
|
|
if (user1.getFree6().compareTo(freeCoin1) < 0) { |
|
|
|
|
|
throw new RuntimeException("驳回失败!该用户剩余 free6 金币不足扣除数量!"); |
|
|
|
|
|
} else { |
|
|
|
|
|
user1.setFree6(user1.getFree6().subtract(freeCoin1)); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
if (user1.getFree12().compareTo(freeCoin1) < 0) { |
|
|
|
|
|
throw new RuntimeException("驳回失败!该用户剩余 free12 金币不足扣除数量!"); |
|
|
|
|
|
} else { |
|
|
|
|
|
user1.setFree12(user1.getFree12().subtract(freeCoin1)); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 更新用户信息到数据库 |
|
|
|
|
|
userMapper.update(user1); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// if (audit.getStatus() == 2 && audit.getRechargeId() != null) { |
|
|
|
|
|
// // 获取 detail1 对象 |
|
|
|
|
|
// Detail detail1 = detailMapper.selectByDetailId(audit.getDetailId()); |
|
|
|
|
|
// if (detail1 == null) { |
|
|
|
|
|
// throw new RuntimeException("驳回失败!未找到对应的 Detail 信息,audit.getDetailId() = " + audit.getDetailId()); |
|
|
|
|
|
// } |
|
|
|
|
|
// |
|
|
|
|
|
// // 获取金币数据 |
|
|
|
|
|
// BigDecimal rechargeCoin1 = detail1.getRechargeCoin(); |
|
|
|
|
|
// BigDecimal taskCoin1 = detail1.getTaskCoin(); |
|
|
|
|
|
// BigDecimal freeCoin1 = detail1.getFreeCoin(); |
|
|
|
|
|
// |
|
|
|
|
|
// // 获取 user1 对象 |
|
|
|
|
|
// User user1 = userMapper.selectByJwcode(detail1.getJwcode()); |
|
|
|
|
|
// if (user1 == null) { |
|
|
|
|
|
// throw new RuntimeException("驳回失败!未找到对应的用户信息,detail1.getJwcode() = " + detail1.getJwcode()); |
|
|
|
|
|
// } |
|
|
|
|
|
// |
|
|
|
|
|
// // 检查并更新用户金币 |
|
|
|
|
|
// if (rechargeCoin1 != null) { |
|
|
|
|
|
// if (user1.getBuyJb().compareTo(rechargeCoin1) < 0) { |
|
|
|
|
|
// throw new RuntimeException("驳回失败!该用户剩余 BuyJb 金币不足扣除数量!"); |
|
|
|
|
|
// } else { |
|
|
|
|
|
// user1.setBuyJb(user1.getBuyJb().subtract(rechargeCoin1)); |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// |
|
|
|
|
|
// if (taskCoin1 != null) { |
|
|
|
|
|
// if (user1.getCoreJb().compareTo(taskCoin1) < 0) { |
|
|
|
|
|
// throw new RuntimeException("驳回失败!该用户剩余 CoreJb 金币不足扣除数量!"); |
|
|
|
|
|
// } else { |
|
|
|
|
|
// user1.setCoreJb(user1.getCoreJb().subtract(taskCoin1)); |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// |
|
|
|
|
|
// |
|
|
|
|
|
// // 判断当前月份 |
|
|
|
|
|
// LocalDate now1 = LocalDate.now(); |
|
|
|
|
|
// Month currentMonth1 = now1.getMonth(); |
|
|
|
|
|
// |
|
|
|
|
|
// // 检查 free6 或 free12 的金币是否足够 |
|
|
|
|
|
// if (freeCoin1 != null) { |
|
|
|
|
|
// if (currentMonth1.getValue() <= 6) { |
|
|
|
|
|
// if (user1.getFree6().compareTo(freeCoin1) < 0) { |
|
|
|
|
|
// throw new RuntimeException("驳回失败!该用户剩余 free6 金币不足扣除数量!"); |
|
|
|
|
|
// } else { |
|
|
|
|
|
// user1.setFree6(user1.getFree6().subtract(freeCoin1)); |
|
|
|
|
|
// } |
|
|
|
|
|
// } else { |
|
|
|
|
|
// if (user1.getFree12().compareTo(freeCoin1) < 0) { |
|
|
|
|
|
// throw new RuntimeException("驳回失败!该用户剩余 free12 金币不足扣除数量!"); |
|
|
|
|
|
// } else { |
|
|
|
|
|
// user1.setFree12(user1.getFree12().subtract(freeCoin1)); |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// |
|
|
|
|
|
// // 更新用户信息到数据库 |
|
|
|
|
|
// userMapper.update(user1); |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
return Result.success(); |
|
|
return Result.success(); |
|
|
|
|
|
|
|
|