|
@@ -866,8 +866,31 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
packetParam.setUser(user);
|
|
|
}
|
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(config.getIsNegative())&&config.getIsNegative() == 1) {
|
|
|
+ return processRedPacket(config, packetParam, param, amount, log);
|
|
|
+ }
|
|
|
//2025.7.11 红包金额为0的时候
|
|
|
if (amount.compareTo(BigDecimal.ZERO)>0){
|
|
|
+
|
|
|
+ Company company = companyMapper.selectCompanyByIdForUpdate(param.getCompanyId());
|
|
|
+ BigDecimal money = company.getMoney();
|
|
|
+ BigDecimal subtract = money.subtract(amount);
|
|
|
+ if (subtract.compareTo(BigDecimal.ZERO)<0){
|
|
|
+ FsCourseRedPacketLog redPacketLog = new FsCourseRedPacketLog();
|
|
|
+ redPacketLog.setCourseId(param.getCourseId());
|
|
|
+ redPacketLog.setCompanyId(param.getCompanyId());
|
|
|
+ redPacketLog.setUserId(param.getUserId());
|
|
|
+ redPacketLog.setVideoId(param.getVideoId());
|
|
|
+ redPacketLog.setStatus(2);
|
|
|
+ redPacketLog.setQwUserId(param.getQwUserId() != null ? param.getQwUserId() : null);
|
|
|
+ redPacketLog.setCompanyUserId(param.getCompanyUserId());
|
|
|
+ redPacketLog.setCreateTime(new Date());
|
|
|
+ redPacketLog.setAmount(amount);
|
|
|
+ redPacketLog.setWatchLogId(log.getLogId() != null ? log.getLogId() : null);
|
|
|
+ redPacketLog.setPeriodId(param.getPeriodId());
|
|
|
+ redPacketLogMapper.insertFsCourseRedPacketLog(redPacketLog);
|
|
|
+ return R.error("销售公司余额不足");
|
|
|
+ }
|
|
|
// 发送红包
|
|
|
R sendRedPacket = paymentService.sendRedPacket(packetParam);
|
|
|
if (sendRedPacket.get("code").equals(200)) {
|