2 Commit-ok af01466089 ... 7a42f9b1bb

Szerző SHA1 Üzenet Dátum
  zx 7a42f9b1bb Merge remote-tracking branch 'origin/master' 3 hete
  zx a76e54420a add 3 hete

+ 64 - 61
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -1026,25 +1026,25 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
         //2025.6.19 红包金额为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("销售公司余额不足");
-            }
+//            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)) {
@@ -1075,17 +1075,18 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
                 // 更新观看记录的奖励类型
                 log.setRewardType(config.getRewardType());
                 courseWatchLogMapper.updateFsCourseWatchLog(log);
-                company.setMoney(subtract);
-                companyMapper.updateCompany(company);
-
-                CompanyMoneyLogs logs=new CompanyMoneyLogs();
-                logs.setCompanyId(company.getCompanyId());
-                logs.setRemark("扣除红包金额");
-                logs.setMoney(amount.multiply(new BigDecimal(-1)));
-                logs.setLogsType(15);
-                logs.setBalance(company.getMoney());
-                logs.setCreateTime(new Date());
-                moneyLogsMapper.insertCompanyMoneyLogs(logs);
+//
+//                company.setMoney(subtract);
+//                companyMapper.updateCompany(company);
+//
+//                CompanyMoneyLogs logs=new CompanyMoneyLogs();
+//                logs.setCompanyId(company.getCompanyId());
+//                logs.setRemark("扣除红包金额");
+//                logs.setMoney(amount.multiply(new BigDecimal(-1)));
+//                logs.setLogsType(15);
+//                logs.setBalance(company.getMoney());
+//                logs.setCreateTime(new Date());
+//                moneyLogsMapper.insertCompanyMoneyLogs(logs);
 
                 return sendRedPacket;
             } else {
@@ -1209,26 +1210,26 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
         //2025.6.19 红包金额为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(0);
-                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());
-                redPacketLog.setAppId(param.getAppId());
-                redPacketLogMapper.insertFsCourseRedPacketLog(redPacketLog);
-                return R.error("销售公司余额不足");
-            }
+//            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(0);
+//                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());
+//                redPacketLog.setAppId(param.getAppId());
+//                redPacketLogMapper.insertFsCourseRedPacketLog(redPacketLog);
+//                return R.error("余额不足请稍等");
+//            }
             // 发送红包
             R sendRedPacket = paymentService.sendRedPacket(packetParam);
             if (sendRedPacket.get("code").equals(200)) {
@@ -1260,17 +1261,19 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
                 // 更新观看记录的奖励类型
                 log.setRewardType(config.getRewardType());
                 courseWatchLogMapper.updateFsCourseWatchLog(log);
-                company.setMoney(subtract);
-                companyMapper.updateCompany(company);
-
-                CompanyMoneyLogs logs=new CompanyMoneyLogs();
-                logs.setCompanyId(company.getCompanyId());
-                logs.setRemark("扣除红包金额");
-                logs.setMoney(amount.multiply(new BigDecimal(-1)));
-                logs.setLogsType(15);
-                logs.setBalance(company.getMoney());
-                logs.setCreateTime(new Date());
-                moneyLogsMapper.insertCompanyMoneyLogs(logs);
+
+
+//                company.setMoney(subtract);
+//                companyMapper.updateCompany(company);
+//
+//                CompanyMoneyLogs logs=new CompanyMoneyLogs();
+//                logs.setCompanyId(company.getCompanyId());
+//                logs.setRemark("扣除红包金额");
+//                logs.setMoney(amount.multiply(new BigDecimal(-1)));
+//                logs.setLogsType(15);
+//                logs.setBalance(company.getMoney());
+//                logs.setCreateTime(new Date());
+//                moneyLogsMapper.insertCompanyMoneyLogs(logs);
 
                 return sendRedPacket;
             } else {