|
|
@@ -35,6 +35,7 @@ import com.fs.core.config.TenantConfigContext;
|
|
|
import com.fs.course.config.CourseConfig;
|
|
|
import com.fs.course.config.RandomRedPacketConfig;
|
|
|
import com.fs.course.config.RandomRedPacketRule;
|
|
|
+import com.fs.course.config.RedPacketConfig;
|
|
|
import com.fs.course.domain.*;
|
|
|
import com.fs.course.dto.CoursePackageDTO;
|
|
|
import com.fs.course.mapper.*;
|
|
|
@@ -83,6 +84,8 @@ import com.fs.sop.mapper.SopUserLogsInfoMapper;
|
|
|
import com.fs.sop.service.ISopUserLogsInfoService;
|
|
|
import com.fs.system.mapper.SysDictDataMapper;
|
|
|
import com.fs.system.service.ISysConfigService;
|
|
|
+import com.fs.tenant.domain.TenantInfo;
|
|
|
+import com.fs.tenant.service.TenantInfoService;
|
|
|
import com.fs.voice.utils.StringUtil;
|
|
|
import com.github.binarywang.wxpay.bean.transfer.TransferBillsResult;
|
|
|
import com.volcengine.service.vod.IVodService;
|
|
|
@@ -128,6 +131,8 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
@Autowired
|
|
|
private ISysConfigService sysConfigService;
|
|
|
@Autowired
|
|
|
+ private TenantInfoService tenantInfoService;
|
|
|
+ @Autowired
|
|
|
private OpenIMService openIMService;
|
|
|
@Autowired
|
|
|
private CompanyCompanyFsuserMapper companyCompanyFsuserMapper;
|
|
|
@@ -1172,8 +1177,21 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取当前租户的公司名称
|
|
|
+ * @return 租户名称,如果未获取到则返回null
|
|
|
+ */
|
|
|
+ private String getCurrentTenantCompanyName() {
|
|
|
+ Long tenantId = com.fs.wxcid.utils.TenantHelper.getTenantId();
|
|
|
+ if (tenantId == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ TenantInfo tenantInfo = tenantInfoService.getById(tenantId);
|
|
|
+ return tenantInfo != null ? tenantInfo.getTenantName() : null;
|
|
|
+ }
|
|
|
+
|
|
|
private R addCustomerService(String qwUserById,String msg){
|
|
|
- if ("济南联志健康".equals(sysConfigService.getProjectConfig().getCloudHost().getCompanyName())){
|
|
|
+ if ("济南联志健康".equals(getCurrentTenantCompanyName())){
|
|
|
return R.error(400,msg).put("qrcode", "");
|
|
|
}
|
|
|
String json = configService.selectConfigByKey("course.config");
|
|
|
@@ -1675,40 +1693,19 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
amount = redPackage.getRedPacketMoney();
|
|
|
} else if (video != null) {
|
|
|
amount = video.getRedPacketMoney();
|
|
|
- //是否开启了随机红包
|
|
|
- String json = configService.selectConfigByKey("randomRedpacket:config");
|
|
|
- if (StringUtils.isNotBlank(json)) {
|
|
|
- RandomRedPacketConfig randomRedPacket = JSONUtil.toBean(json, RandomRedPacketConfig.class);
|
|
|
- //是否开启拼手气红包
|
|
|
- if (null != randomRedPacket && randomRedPacket.getEnableRandomRedpacket()) {
|
|
|
- BigDecimal randomMoney = BigDecimal.ZERO;
|
|
|
- //优先读取课程配置随机红包规则
|
|
|
- String randomRedPacketRules = video.getRandomRedPacketRules();
|
|
|
- if (StringUtils.isNotBlank(randomRedPacketRules)) {
|
|
|
- JSONArray array = JSONObject.parseArray(randomRedPacketRules);
|
|
|
- List<RandomRedPacketRule> rules = new ArrayList<>();
|
|
|
- for (Object o : array) {
|
|
|
- rules.add(JSONObject.toJavaObject((JSONObject) o, RandomRedPacketRule.class));
|
|
|
- }
|
|
|
- randomMoney = getRandomMoneyByRules(rules);
|
|
|
- }
|
|
|
- //如果课程没有配置 读取后台默认随机规则
|
|
|
- else {
|
|
|
- randomMoney = getRandomMoneyByRules(randomRedPacket.getRules());
|
|
|
- }
|
|
|
- //兼容拼手气红包报错情况的发放红包情况
|
|
|
- if (BigDecimal.ZERO.compareTo(randomMoney) < 0) {
|
|
|
- amount = randomMoney;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
// 准备发送红包参数
|
|
|
WxSendRedPacketParam packetParam = new WxSendRedPacketParam();
|
|
|
+ String json = redisCache.getCacheObject("sys_config:redPacket.config.new");
|
|
|
|
|
|
+ RedPacketConfig config1 = JSONUtil.toBean(json, RedPacketConfig.class);
|
|
|
+ // 判断配置是否为空,为空则提示绑定商户号
|
|
|
+ if (config1 == null) {
|
|
|
+ throw new RuntimeException("请先绑定商户号后再进行操作");
|
|
|
+ }
|
|
|
//判断是否走服务号openId发红包
|
|
|
- if (config.getMiniAppAuthType() == 2 && user.getMpOpenId() != null && !sysConfigService.getProjectConfig().getIsNewWxMerchant()) {
|
|
|
+ if (config.getMiniAppAuthType() == 2 && user.getMpOpenId() != null && config1.getIsNew()!=1) {
|
|
|
packetParam.setOpenId(user.getMpOpenId());
|
|
|
} else {
|
|
|
//查询是否绑定小程序
|
|
|
@@ -2614,7 +2611,7 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
}
|
|
|
|
|
|
if (userCompanyUser.getStatus() == 2) {
|
|
|
- if ("福本源".equals(sysConfigService.getProjectConfig().getCloudHost().getCompanyName())) {
|
|
|
+ if ("福本源".equals(getCurrentTenantCompanyName())) {
|
|
|
return ResponseResult.fail(ExceptionCodeEnum.SERVICE_UNAVAILABLE.getCode(), ExceptionCodeEnum.SERVICE_UNAVAILABLE.getDescription());
|
|
|
} else {
|
|
|
return ResponseResult.fail(ExceptionCodeEnum.USER_BLACKLISTED.getCode(), ExceptionCodeEnum.USER_BLACKLISTED.getDescription());
|