|
@@ -231,6 +231,8 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
ConfigUtil configUtil;
|
|
ConfigUtil configUtil;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private FsUserCoursePeriodCompanyMapper periodCompanyMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1254,9 +1256,9 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
BigDecimal amount = BigDecimal.ZERO;
|
|
BigDecimal amount = BigDecimal.ZERO;
|
|
|
FsUserCourseVideoRedPackage redPackage = fsUserCourseVideoRedPackageMapper.selectRedPacketByCompanyId(param.getVideoId(), param.getCompanyId(), param.getPeriodId());
|
|
FsUserCourseVideoRedPackage redPackage = fsUserCourseVideoRedPackageMapper.selectRedPacketByCompanyId(param.getVideoId(), param.getCompanyId(), param.getPeriodId());
|
|
|
|
|
|
|
|
- if (redPackage != null) {
|
|
|
|
|
|
|
+ if (redPackage != null && redPackage.getRedPacketMoney() != null) {
|
|
|
amount = redPackage.getRedPacketMoney();
|
|
amount = redPackage.getRedPacketMoney();
|
|
|
- } else if (video != null) {
|
|
|
|
|
|
|
+ } else if (video != null && video.getRedPacketMoney() != null) {
|
|
|
amount = video.getRedPacketMoney();
|
|
amount = video.getRedPacketMoney();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1314,8 +1316,12 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
packetParam.setUser(user);
|
|
packetParam.setUser(user);
|
|
|
|
|
|
|
|
logger.info("红包金额 {},红包商户号 {}",amount,packetParam);
|
|
logger.info("红包金额 {},红包商户号 {}",amount,packetParam);
|
|
|
|
|
+
|
|
|
|
|
+ // 获取红包开关
|
|
|
|
|
+ boolean openRedPacket = getRedPacketState(log.getCompanyId());
|
|
|
|
|
+
|
|
|
//2025.6.19 红包金额为0的时候
|
|
//2025.6.19 红包金额为0的时候
|
|
|
- if (amount.compareTo(BigDecimal.ZERO)>0){
|
|
|
|
|
|
|
+ if (openRedPacket && amount.compareTo(BigDecimal.ZERO)>0){
|
|
|
// 发送红包
|
|
// 发送红包
|
|
|
return sendRedPacketRewardToUser(param, log, config, packetParam, amount);
|
|
return sendRedPacketRewardToUser(param, log, config, packetParam, amount);
|
|
|
} else {
|
|
} else {
|
|
@@ -1482,8 +1488,11 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
|
|
|
|
|
logger.info("红包金额 {},红包商户号 {}",amount,packetParam);
|
|
logger.info("红包金额 {},红包商户号 {}",amount,packetParam);
|
|
|
|
|
|
|
|
|
|
+ // 获取红包开关
|
|
|
|
|
+ boolean openRedPacket = getRedPacketState(log.getCompanyId(), log.getPeriodId());
|
|
|
|
|
+
|
|
|
//2025.6.19 红包金额为0的时候
|
|
//2025.6.19 红包金额为0的时候
|
|
|
- if (amount.compareTo(BigDecimal.ZERO)>0){
|
|
|
|
|
|
|
+ if (openRedPacket && amount.compareTo(BigDecimal.ZERO)>0){
|
|
|
|
|
|
|
|
Company company = companyMapper.selectCompanyById(param.getCompanyId());
|
|
Company company = companyMapper.selectCompanyById(param.getCompanyId());
|
|
|
BigDecimal money = company.getMoney();
|
|
BigDecimal money = company.getMoney();
|
|
@@ -1555,6 +1564,29 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取红包开关
|
|
|
|
|
+ */
|
|
|
|
|
+ private boolean getRedPacketState(Long companyId) {
|
|
|
|
|
+ Company company = companyMapper.selectCompanyById(companyId);
|
|
|
|
|
+
|
|
|
|
|
+ // 公司开关
|
|
|
|
|
+ return company.getOpenRedPacket() == 1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取红包开关
|
|
|
|
|
+ */
|
|
|
|
|
+ private boolean getRedPacketState(Long companyId, Long periodId) {
|
|
|
|
|
+ Company company = companyMapper.selectCompanyById(companyId);
|
|
|
|
|
+
|
|
|
|
|
+ FsUserCoursePeriodCompany coursePeriodCompany = periodCompanyMapper.selectByPeriodIdAndCompanyId(periodId, companyId);
|
|
|
|
|
+ boolean periodRedPacketState = coursePeriodCompany == null || coursePeriodCompany.getOpenRedPacket() == 1;
|
|
|
|
|
+
|
|
|
|
|
+ // 公司开关和营期开关
|
|
|
|
|
+ return company.getOpenRedPacket() == 1 && periodRedPacketState;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 直接发送奖励
|
|
* 直接发送奖励
|
|
|
*
|
|
*
|