|
@@ -17,8 +17,10 @@ import com.fs.common.utils.DateUtils;
|
|
import com.fs.common.utils.StringUtils;
|
|
import com.fs.common.utils.StringUtils;
|
|
import com.fs.common.utils.date.DateUtil;
|
|
import com.fs.common.utils.date.DateUtil;
|
|
import com.fs.company.domain.Company;
|
|
import com.fs.company.domain.Company;
|
|
|
|
+import com.fs.company.domain.CompanyMoneyLogs;
|
|
import com.fs.company.domain.CompanyUser;
|
|
import com.fs.company.domain.CompanyUser;
|
|
import com.fs.company.mapper.CompanyMapper;
|
|
import com.fs.company.mapper.CompanyMapper;
|
|
|
|
+import com.fs.company.mapper.CompanyMoneyLogsMapper;
|
|
import com.fs.company.mapper.CompanyUserMapper;
|
|
import com.fs.company.mapper.CompanyUserMapper;
|
|
import com.fs.course.config.CourseConfig;
|
|
import com.fs.course.config.CourseConfig;
|
|
import com.fs.course.domain.*;
|
|
import com.fs.course.domain.*;
|
|
@@ -51,6 +53,7 @@ import com.fs.qw.mapper.QwUserMapper;
|
|
import com.fs.qw.service.IQwCompanyService;
|
|
import com.fs.qw.service.IQwCompanyService;
|
|
import com.fs.qw.service.IQwExternalContactService;
|
|
import com.fs.qw.service.IQwExternalContactService;
|
|
import com.fs.qwApi.Result.QwAddContactWayResult;
|
|
import com.fs.qwApi.Result.QwAddContactWayResult;
|
|
|
|
+import com.fs.qwApi.Result.QwGroupChatDetailsResult;
|
|
import com.fs.qwApi.param.QwAddContactWayParam;
|
|
import com.fs.qwApi.param.QwAddContactWayParam;
|
|
import com.fs.qwApi.service.QwApiService;
|
|
import com.fs.qwApi.service.QwApiService;
|
|
import com.fs.repeat.vo.RepeatUploadVo;
|
|
import com.fs.repeat.vo.RepeatUploadVo;
|
|
@@ -59,6 +62,7 @@ import com.fs.sop.mapper.SopUserLogsInfoMapper;
|
|
import com.fs.sop.service.ISopUserLogsInfoService;
|
|
import com.fs.sop.service.ISopUserLogsInfoService;
|
|
import com.fs.system.service.ISysConfigService;
|
|
import com.fs.system.service.ISysConfigService;
|
|
import com.fs.voice.utils.StringUtil;
|
|
import com.fs.voice.utils.StringUtil;
|
|
|
|
+import com.fs.wx.cp.config.WxCpProperties;
|
|
import com.github.binarywang.wxpay.bean.transfer.TransferBillsResult;
|
|
import com.github.binarywang.wxpay.bean.transfer.TransferBillsResult;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
@@ -72,6 +76,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
|
|
+import java.net.SocketTimeoutException;
|
|
import java.time.Instant;
|
|
import java.time.Instant;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
import java.time.ZoneId;
|
|
import java.time.ZoneId;
|
|
@@ -98,7 +103,8 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
private static final String miniappRealLink = "/pages_course/video.html?course=";
|
|
private static final String miniappRealLink = "/pages_course/video.html?course=";
|
|
private static final String REAL_LINK_PREFIX = "/courseH5/pages/course/learning?course=";
|
|
private static final String REAL_LINK_PREFIX = "/courseH5/pages/course/learning?course=";
|
|
private static final String SHORT_LINK_PREFIX = "/courseH5/pages/course/learning?s=";
|
|
private static final String SHORT_LINK_PREFIX = "/courseH5/pages/course/learning?s=";
|
|
-
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private CompanyMoneyLogsMapper moneyLogsMapper;
|
|
@Autowired
|
|
@Autowired
|
|
private FsUserCourseVideoMapper fsUserCourseVideoMapper;
|
|
private FsUserCourseVideoMapper fsUserCourseVideoMapper;
|
|
@Autowired
|
|
@Autowired
|
|
@@ -391,7 +397,6 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- @Transactional
|
|
|
|
public R isAddKf(FsUserCourseVideoAddKfUParam param) {
|
|
public R isAddKf(FsUserCourseVideoAddKfUParam param) {
|
|
logger.info("zyp \n【判断添加客服】:{}",param);
|
|
logger.info("zyp \n【判断添加客服】:{}",param);
|
|
//查询用户
|
|
//查询用户
|
|
@@ -433,35 +438,103 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
}
|
|
}
|
|
|
|
|
|
private R handleRoom(FsUserCourseVideoAddKfUParam param,FsUser user) {
|
|
private R handleRoom(FsUserCourseVideoAddKfUParam param,FsUser user) {
|
|
- //查询客户列表
|
|
|
|
- List<QwExternalContact> contacts = qwExternalContactMapper.selectQwExternalContactListVOByfsUserId(user.getUserId());
|
|
|
|
- if (contacts.isEmpty()){
|
|
|
|
- return R.error("未注册");
|
|
|
|
- }
|
|
|
|
- //找出对应销售匹配的客户
|
|
|
|
- QwExternalContact matchedContact = contacts.stream()
|
|
|
|
- .filter(contact -> contact.getQwUserId().equals(Long.parseLong(param.getQwUserId())))
|
|
|
|
- .findFirst()
|
|
|
|
- .orElse(null);
|
|
|
|
-
|
|
|
|
- if (matchedContact==null){
|
|
|
|
- return R.error("无权限观看,未添加本群主");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- param.setQwExternalId(matchedContact.getId());
|
|
|
|
-// //查询是否有添加客服
|
|
|
|
-// QwExternalContact externalContact = qwExternalContactMapper.selectQwExternalContactById(param.getQwExternalId());
|
|
|
|
-// if (externalContact==null){
|
|
|
|
-// return R.error("客户不存在!");
|
|
|
|
|
|
+// //查询客户列表
|
|
|
|
+// List<QwExternalContact> contacts = qwExternalContactMapper.selectQwExternalContactListVOByfsUserId(user.getUserId());
|
|
|
|
+// if (contacts.isEmpty()){
|
|
|
|
+// return R.error("未注册");
|
|
// }
|
|
// }
|
|
-// if (!externalContact.getQwUserId().equals(param.getUserId())){
|
|
|
|
-// return R.error("无权限观看,添加群主非本群主");
|
|
|
|
|
|
+// //找出对应销售匹配的客户
|
|
|
|
+// QwExternalContact matchedContact = contacts.stream()
|
|
|
|
+// .filter(contact -> contact.getQwUserId().equals(Long.parseLong(param.getQwUserId())))
|
|
|
|
+// .findFirst()
|
|
|
|
+// .orElse(null);
|
|
|
|
+//
|
|
|
|
+// if (matchedContact==null){
|
|
|
|
+// return R.error("无权限观看,未添加本群主");
|
|
// }
|
|
// }
|
|
- FsCourseWatchLog log = courseWatchLogMapper.getWatchCourseVideoByExt(param.getQwExternalId(), param.getVideoId(),param.getQwUserId());
|
|
|
|
- if (log==null){
|
|
|
|
- createWatchLog(param);
|
|
|
|
|
|
+//
|
|
|
|
+// param.setQwExternalId(matchedContact.getId());
|
|
|
|
+//// //查询是否有添加客服
|
|
|
|
+//// QwExternalContact externalContact = qwExternalContactMapper.selectQwExternalContactById(param.getQwExternalId());
|
|
|
|
+//// if (externalContact==null){
|
|
|
|
+//// return R.error("客户不存在!");
|
|
|
|
+//// }
|
|
|
|
+//// if (!externalContact.getQwUserId().equals(param.getUserId())){
|
|
|
|
+//// return R.error("无权限观看,添加群主非本群主");
|
|
|
|
+//// }
|
|
|
|
+// FsCourseWatchLog log = courseWatchLogMapper.getWatchCourseVideoByExt(param.getQwExternalId(), param.getVideoId(),param.getQwUserId());
|
|
|
|
+// if (log==null){
|
|
|
|
+// createWatchLog(param);
|
|
|
|
+// }
|
|
|
|
+// return R.ok().put("qwExternalId",matchedContact.getId());
|
|
|
|
+ FsCourseLink courseLink = courseLinkMapper.selectFsCourseLinkByLink(param.getLink());
|
|
|
|
+ System.out.println("查询的链接参数"+courseLink);
|
|
|
|
+ String msg = "<div style=\"color: red;margin-bottom: 15px;font-weight: bold;\">本课程为群会员独享<br>请长按二维码</div>\n" +
|
|
|
|
+ "\t\t\t\t\t<div style=\"color: #999;font-size: 14px;font-weight: bold;\">添加伴学助手免费领取会员权限</div>";
|
|
|
|
+ System.out.println("企微传参:"+courseLink.getChatId()+"corpId:"+param.getCorpId());
|
|
|
|
+ QwGroupChatDetailsResult result = qwApiService.groupChatDetails(courseLink.getChatId(), param.getCorpId());
|
|
|
|
+ if(result.getErrCode() != 0){
|
|
|
|
+ return R.error("企微接口请求失败,请联系管理员:" +result.getErrMsg());
|
|
|
|
+ }
|
|
|
|
+ List<QwGroupChatDetailsResult.Member> collect = result.getGroupChat().getMemberList().stream().filter(e -> e.getType() == 2).collect(Collectors.toList());
|
|
|
|
+ if(collect.isEmpty()){
|
|
|
|
+ return addCustomerService(param.getQwUserId(),msg);
|
|
}
|
|
}
|
|
- return R.ok().put("qwExternalId",matchedContact.getId());
|
|
|
|
|
|
+ Optional<QwGroupChatDetailsResult.Member> optional = collect.stream().filter(e -> e.getName().equals(user.getNickName()) || e.getName().equals(param.getNickName())).findFirst();
|
|
|
|
+ if(!optional.isPresent()){
|
|
|
|
+ return addCustomerService(param.getQwUserId(),msg);
|
|
|
|
+ }
|
|
|
|
+ QwGroupChatDetailsResult.Member member = optional.get();
|
|
|
|
+ QwExternalContact qwExternalContact = qwExternalContactMapper.selectOne(new QueryWrapper<QwExternalContact>().eq("user_id", result.getGroupChat().getOwner()).eq("external_user_id", member.getUserId()));
|
|
|
|
+ if(qwExternalContact==null){
|
|
|
|
+ return addCustomerService(param.getQwUserId(),msg);
|
|
|
|
+ }
|
|
|
|
+ Long qwExternalId = qwExternalContact.getId();
|
|
|
|
+ log.info("外部联系人数据:{}", qwExternalContact);
|
|
|
|
+// addCompanyCompanyFsUser(param);
|
|
|
|
+ FsCourseWatchLog log = courseWatchLogMapper.getWatchCourseVideoByExt(qwExternalId, param.getVideoId(),param.getQwUserId());
|
|
|
|
+ if (log==null ){
|
|
|
|
+ return addCustomerService(param.getQwUserId(),msg);
|
|
|
|
+ }
|
|
|
|
+ //判断外部联系人有没有绑定userId
|
|
|
|
+ if (qwExternalContact.getFsUserId()!=null){
|
|
|
|
+ //有客户有小程序id 但 登录的小程序id和根据外部联系人id查出来的小程序id不一致
|
|
|
|
+ if (!qwExternalContact.getFsUserId().equals(param.getUserId())) {
|
|
|
|
+ return addCustomerService(param.getQwUserId(),msg);
|
|
|
|
+ }
|
|
|
|
+ List<QwExternalContact> qwExternalContacts = qwExternalContactMapper.selectQwExternalContactByMiniUserId(param.getUserId());
|
|
|
|
+ //匹配客户公司id
|
|
|
|
+ if (qwExternalContacts.stream().noneMatch(contact -> contact.getCorpId().equals(param.getCorpId()))){
|
|
|
|
+ return addCustomerService(param.getQwUserId(),msg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //看课记录中userId为0绑定userId
|
|
|
|
+ if (log.getUserId()==null||log.getUserId().equals(0L) || !log.getUserId().equals(param.getUserId())){
|
|
|
|
+ log.setUserId(param.getUserId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ log.setUpdateTime(new Date());
|
|
|
|
+ courseWatchLogMapper.updateFsCourseWatchLog(log);
|
|
|
|
+
|
|
|
|
+ iSopUserLogsInfoService.updateSopUserInfoByExternalId(qwExternalId,param.getUserId());
|
|
|
|
+ }else {
|
|
|
|
+ //没绑定fsUser直接绑定fsUser
|
|
|
|
+ QwExternalContact contact = new QwExternalContact();
|
|
|
|
+ contact.setId(qwExternalId);
|
|
|
|
+ contact.setFsUserId(param.getUserId());
|
|
|
|
+ qwExternalContactMapper.updateQwExternalContact(contact);
|
|
|
|
+ FsUser fsUser = new FsUser();
|
|
|
|
+ fsUser.setUserId(user.getUserId());
|
|
|
|
+ fsUser.setIsAddQw(1);
|
|
|
|
+ fsUserMapper.updateFsUser(fsUser);
|
|
|
|
+ //绑定上之后 更新观看记录
|
|
|
|
+ //看课记录中userId为0绑定userId
|
|
|
|
+ log.setUserId(param.getUserId());
|
|
|
|
+ log.setUpdateTime(new Date());
|
|
|
|
+ courseWatchLogMapper.updateFsCourseWatchLog(log);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return R.ok().put("qwExternalId", qwExternalContact.getId());
|
|
}
|
|
}
|
|
|
|
|
|
private void createWatchLog(FsUserCourseVideoAddKfUParam param) {
|
|
private void createWatchLog(FsUserCourseVideoAddKfUParam param) {
|
|
@@ -525,7 +598,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
// }
|
|
// }
|
|
|
|
|
|
//查询是否有添加客服
|
|
//查询是否有添加客服
|
|
- QwExternalContact externalContact = qwExternalContactMapper.selectQwExternalContactById(param.getQwExternalId());
|
|
|
|
|
|
+ QwExternalContact externalContact = qwExternalContactMapper.selectQwExternalContactById(qwExternalId);
|
|
|
|
|
|
//用小程序id查询外部联系人
|
|
//用小程序id查询外部联系人
|
|
List<QwExternalContact> qwExternalContacts = qwExternalContactMapper.selectQwExternalContactByMiniUserId(param.getUserId());
|
|
List<QwExternalContact> qwExternalContacts = qwExternalContactMapper.selectQwExternalContactByMiniUserId(param.getUserId());
|
|
@@ -756,21 +829,28 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
FsCourseWatchLog log = new FsCourseWatchLog();
|
|
FsCourseWatchLog log = new FsCourseWatchLog();
|
|
|
|
|
|
// 根据链接类型判断是否已发放奖励
|
|
// 根据链接类型判断是否已发放奖励
|
|
- if (param.getLinkType() != null && param.getLinkType() == 1) {
|
|
|
|
|
|
+ log = courseWatchLogMapper.getWatchCourseVideo(param.getUserId(), param.getVideoId(), param.getQwUserId(), param.getQwExternalId());
|
|
|
|
+ if (log == null) {
|
|
|
|
+ return R.error("无记录");
|
|
|
|
+ }
|
|
|
|
+ if (log.getRewardType() != null) {
|
|
FsCourseRedPacketLog packetLog = redPacketLogMapper.selectFsCourseRedPacketLogByTemporary(param.getVideoId(), param.getUserId());
|
|
FsCourseRedPacketLog packetLog = redPacketLogMapper.selectFsCourseRedPacketLogByTemporary(param.getVideoId(), param.getUserId());
|
|
- if (packetLog != null) {
|
|
|
|
|
|
+ if(packetLog != null && packetLog.getStatus() == 1) {
|
|
return R.error("奖励已发放");
|
|
return R.error("奖励已发放");
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- log = courseWatchLogMapper.getWatchCourseVideo(param.getUserId(), param.getVideoId(), param.getQwUserId(), param.getQwExternalId());
|
|
|
|
- if (log == null) {
|
|
|
|
- return R.error("无记录");
|
|
|
|
|
|
+ if(packetLog != null && packetLog.getStatus() == 0) {
|
|
|
|
+ if(StringUtils.isNotEmpty(packetLog.getResult())){
|
|
|
|
+ R r = JSON.parseObject(packetLog.getResult(), R.class);
|
|
|
|
+ return r;
|
|
|
|
+ } else {
|
|
|
|
+ return R.error("奖励已发放");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if (log.getRewardType() != null) {
|
|
|
|
- return R.error("奖励已发放");
|
|
|
|
|
|
+ if(packetLog != null && packetLog.getStatus() == 2) {
|
|
|
|
+ return R.error("请联系客服补发");
|
|
}
|
|
}
|
|
|
|
+ return R.error("奖励已发放");
|
|
}
|
|
}
|
|
-
|
|
|
|
// 获取视频信息
|
|
// 获取视频信息
|
|
FsUserCourseVideo video = fsUserCourseVideoMapper.selectFsUserCourseVideoByVideoId(param.getVideoId());
|
|
FsUserCourseVideo video = fsUserCourseVideoMapper.selectFsUserCourseVideoByVideoId(param.getVideoId());
|
|
|
|
|
|
@@ -838,18 +918,22 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
*/
|
|
*/
|
|
private R sendRedPacketReward(FsCourseSendRewardUParam param, FsUser user, FsCourseWatchLog log, FsUserCourseVideo video, CourseConfig config) {
|
|
private R sendRedPacketReward(FsCourseSendRewardUParam param, FsUser user, FsCourseWatchLog log, FsUserCourseVideo video, CourseConfig config) {
|
|
// 判断是否属于领取红包时间(会员看课发放红包)
|
|
// 判断是否属于领取红包时间(会员看课发放红包)
|
|
- FsUserCoursePeriodDays periodDays = new FsUserCoursePeriodDays();
|
|
|
|
- periodDays.setVideoId(param.getVideoId());
|
|
|
|
- periodDays.setPeriodId(param.getPeriodId());
|
|
|
|
- //正常情况是只能查询到一条,之前可能存在重复的脏数据,暂使用查询list的方式
|
|
|
|
- List<FsUserCoursePeriodDays> fsUserCoursePeriodDays = fsUserCoursePeriodDaysMapper.selectFsUserCoursePeriodDaysList(periodDays);
|
|
|
|
- if(fsUserCoursePeriodDays != null && !fsUserCoursePeriodDays.isEmpty()){
|
|
|
|
- periodDays = fsUserCoursePeriodDays.get(0);
|
|
|
|
|
|
+ if (param.getPeriodId()!=null && param.getPeriodId()>0) {
|
|
|
|
+ FsUserCoursePeriodDays periodDays = new FsUserCoursePeriodDays();
|
|
|
|
+ periodDays.setVideoId(param.getVideoId());
|
|
|
|
+ periodDays.setPeriodId(param.getPeriodId());
|
|
|
|
+ //正常情况是只能查询到一条,之前可能存在重复的脏数据,暂使用查询list的方式
|
|
|
|
+ List<FsUserCoursePeriodDays> fsUserCoursePeriodDays = fsUserCoursePeriodDaysMapper.selectFsUserCoursePeriodDaysList(periodDays);
|
|
|
|
+ if(fsUserCoursePeriodDays != null && !fsUserCoursePeriodDays.isEmpty()){
|
|
|
|
+ periodDays = fsUserCoursePeriodDays.get(0);
|
|
|
|
+ }
|
|
|
|
+ if(periodDays != null && periodDays.getLastJoinTime() !=null && LocalDateTime.now().isAfter(periodDays.getLastJoinTime())) {
|
|
|
|
+ return R.error(403,"已超过领取红包时间");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- if(periodDays != null && periodDays.getLastJoinTime() !=null && LocalDateTime.now().isAfter(periodDays.getLastJoinTime())) {
|
|
|
|
- return R.error(403,"已超过领取红包时间");
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
// 确定红包金额
|
|
// 确定红包金额
|
|
BigDecimal amount = BigDecimal.ZERO;
|
|
BigDecimal amount = BigDecimal.ZERO;
|
|
@@ -879,6 +963,26 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
System.out.println("红包商户号"+packetParam);
|
|
System.out.println("红包商户号"+packetParam);
|
|
//2025.6.19 红包金额为0的时候
|
|
//2025.6.19 红包金额为0的时候
|
|
if (amount.compareTo(BigDecimal.ZERO)>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);
|
|
R sendRedPacket = paymentService.sendRedPacket(packetParam);
|
|
if (sendRedPacket.get("code").equals(200)) {
|
|
if (sendRedPacket.get("code").equals(200)) {
|
|
@@ -886,6 +990,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
TransferBillsResult transferBillsResult;
|
|
TransferBillsResult transferBillsResult;
|
|
if (sendRedPacket.get("isNew").equals(1)){
|
|
if (sendRedPacket.get("isNew").equals(1)){
|
|
transferBillsResult = (TransferBillsResult)sendRedPacket.get("data");
|
|
transferBillsResult = (TransferBillsResult)sendRedPacket.get("data");
|
|
|
|
+ redPacketLog.setResult(JSON.toJSONString(sendRedPacket));
|
|
redPacketLog.setOutBatchNo(transferBillsResult.getOutBillNo());
|
|
redPacketLog.setOutBatchNo(transferBillsResult.getOutBillNo());
|
|
}else {
|
|
}else {
|
|
redPacketLog.setOutBatchNo(sendRedPacket.get("orderCode").toString());
|
|
redPacketLog.setOutBatchNo(sendRedPacket.get("orderCode").toString());
|
|
@@ -906,10 +1011,20 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
redPacketLogMapper.insertFsCourseRedPacketLog(redPacketLog);
|
|
redPacketLogMapper.insertFsCourseRedPacketLog(redPacketLog);
|
|
|
|
|
|
// 更新观看记录的奖励类型
|
|
// 更新观看记录的奖励类型
|
|
-// if (param.getLinkType() == null || param.getLinkType() == 0) {
|
|
|
|
log.setRewardType(config.getRewardType());
|
|
log.setRewardType(config.getRewardType());
|
|
courseWatchLogMapper.updateFsCourseWatchLog(log);
|
|
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);
|
|
|
|
+
|
|
return sendRedPacket;
|
|
return sendRedPacket;
|
|
} else {
|
|
} else {
|
|
return R.error("奖励发送失败,请联系客服");
|
|
return R.error("奖励发送失败,请联系客服");
|
|
@@ -1121,8 +1236,8 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
|
|
|
// 如果开启了黑名单审核,需要提示
|
|
// 如果开启了黑名单审核,需要提示
|
|
if(fsUser.getStatus() == 0) {
|
|
if(fsUser.getStatus() == 0) {
|
|
-// return ResponseResult.fail(505, "管理开启了会员审核,请等待审核");
|
|
|
|
- return ResponseResult.fail(BizResponseEnum.WAIT_APPROVAL,getCompanyUserQRCode(companyUser));
|
|
|
|
|
|
+ return ResponseResult.fail(505, "请微信联系您的群主~");
|
|
|
|
+// return ResponseResult.fail(BizResponseEnum.WAIT_APPROVAL,getCompanyUserQRCode(companyUser));
|
|
}
|
|
}
|
|
|
|
|
|
//查询看课记录
|
|
//查询看课记录
|
|
@@ -1156,6 +1271,11 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
fsCourseWatchLog.setLogType(1);
|
|
fsCourseWatchLog.setLogType(1);
|
|
fsCourseWatchLog.setProject(courseProject);
|
|
fsCourseWatchLog.setProject(courseProject);
|
|
courseWatchLogMapper.insertFsCourseWatchLog(fsCourseWatchLog);
|
|
courseWatchLogMapper.insertFsCourseWatchLog(fsCourseWatchLog);
|
|
|
|
+
|
|
|
|
+ String redisKey = "h5wxuser:watch:heartbeat:" + param.getUserId() + ":" + param.getVideoId() + ":" + param.getCompanyUserId();
|
|
|
|
+ redisCache.setCacheObject(redisKey, LocalDateTime.now().toString());
|
|
|
|
+ // 设置 Redis 记录的过期时间(例如 5 分钟)
|
|
|
|
+ redisCache.expire(redisKey, 300, TimeUnit.SECONDS);
|
|
}
|
|
}
|
|
|
|
|
|
// 添加会员销售关系表数据
|
|
// 添加会员销售关系表数据
|
|
@@ -1367,6 +1487,9 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
@Override
|
|
@Override
|
|
public void batchSaveVideo(BatchVideoSvae vo) {
|
|
public void batchSaveVideo(BatchVideoSvae vo) {
|
|
List<FsVideoResource> videoResourceList = fsVideoResourceMapper.selectBatchIds(vo.getIds());
|
|
List<FsVideoResource> videoResourceList = fsVideoResourceMapper.selectBatchIds(vo.getIds());
|
|
|
|
+ videoResourceList = videoResourceList.stream()
|
|
|
|
+ .sorted(Comparator.comparing(FsVideoResource::getSort).thenComparing(FsVideoResource::getId))
|
|
|
|
+ .collect(Collectors.toList());
|
|
FsUserCourseVideo param = new FsUserCourseVideo();
|
|
FsUserCourseVideo param = new FsUserCourseVideo();
|
|
param.setCourseId(vo.getCourseId());
|
|
param.setCourseId(vo.getCourseId());
|
|
List<FsUserCourseVideo> videoList = selectFsUserCourseVideoList(param);
|
|
List<FsUserCourseVideo> videoList = selectFsUserCourseVideoList(param);
|