|
|
@ -54,7 +54,7 @@ public class AuditController { |
|
|
|
|
|
|
|
auditService.edit(audit); |
|
|
|
|
|
|
|
//退款驳回 |
|
|
|
//退款通过 |
|
|
|
if(audit.getStatus() == 1 && audit.getRefundId()!=null){ |
|
|
|
Detail detail = detailMapper.selectByDetailId(audit.getRefundId()); |
|
|
|
BigDecimal rechargeCoin = detail.getRechargeCoin(); |
|
|
@ -75,50 +75,72 @@ public class AuditController { |
|
|
|
user.setFree12(user.getFree12().add(freeCoin)); // 在7月到12月时返回的值 |
|
|
|
} |
|
|
|
|
|
|
|
//充值驳回 |
|
|
|
if(audit.getStatus() == 2 && audit.getRechargeId()!=null){ |
|
|
|
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()); |
|
|
|
user1.setBuyJb(user1.getBuyJb().add(rechargeCoin1)); |
|
|
|
user1.setCoreJb(user1.getCoreJb().add(taskCoin1)); |
|
|
|
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) { |
|
|
|
// 检查是否有足够的free6金币可以扣除 |
|
|
|
if (user1.getFree6().compareTo(freeCoin1) < 0) { |
|
|
|
throw new RuntimeException("驳回失败!该用户剩余金币不足扣除数量!请客服检查!"); |
|
|
|
throw new RuntimeException("驳回失败!该用户剩余 free6 金币不足扣除数量!"); |
|
|
|
} else { |
|
|
|
user1.setFree6(user1.getFree6().subtract(freeCoin1)); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 检查是否有足够的free12金币可以扣除 |
|
|
|
if (user1.getFree12().compareTo(freeCoin1) < 0) { |
|
|
|
throw new RuntimeException("驳回失败!该用户剩余金币不足扣除数量!请客服检查!"); |
|
|
|
throw new RuntimeException("驳回失败!该用户剩余 free12 金币不足扣除数量!"); |
|
|
|
} else { |
|
|
|
user1.setFree12(user1.getFree12().subtract(freeCoin1)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
userMapper.update(user); |
|
|
|
// 更新用户信息到数据库 |
|
|
|
userMapper.update(user1); |
|
|
|
} |
|
|
|
|
|
|
|
return Result.success(); |
|
|
|
// |
|
|
|
// try { |
|
|
|
// auditService.edit(audit); |
|
|
|
// return Result.success(); |
|
|
|
// }catch (Exception e){ |
|
|
|
// log.warn(Arrays.toString(e.getStackTrace())); |
|
|
|
// return Result.error(e.getMessage()); |
|
|
|
// } |
|
|
|
|
|
|
|
} |
|
|
|
@PostMapping |
|
|
|
public Result search(@RequestBody Page page){ |
|
|
|