|
@@ -72,16 +72,15 @@ import com.fs.qw.domain.*;
|
|
|
import com.fs.qw.domain.QwCompany;
|
|
import com.fs.qw.domain.QwCompany;
|
|
|
import com.fs.qw.domain.QwExternalContact;
|
|
import com.fs.qw.domain.QwExternalContact;
|
|
|
import com.fs.qw.domain.QwUser;
|
|
import com.fs.qw.domain.QwUser;
|
|
|
-import com.fs.qw.mapper.QwExternalContactMapper;
|
|
|
|
|
-import com.fs.qw.mapper.QwGroupChatMapper;
|
|
|
|
|
-import com.fs.qw.mapper.QwGroupChatUserMapper;
|
|
|
|
|
-import com.fs.qw.mapper.QwUserMapper;
|
|
|
|
|
|
|
+import com.fs.qw.mapper.*;
|
|
|
import com.fs.qw.param.FsUserCourseRedPageParam;
|
|
import com.fs.qw.param.FsUserCourseRedPageParam;
|
|
|
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.qw.vo.QwSopCourseFinishTempSetting;
|
|
|
import com.fs.qwApi.Result.QwAddContactWayResult;
|
|
import com.fs.qwApi.Result.QwAddContactWayResult;
|
|
|
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.sop.domain.QwSopLogs;
|
|
|
import com.fs.sop.domain.SopUserLogsInfo;
|
|
import com.fs.sop.domain.SopUserLogsInfo;
|
|
|
import com.fs.sop.mapper.SopUserLogsInfoMapper;
|
|
import com.fs.sop.mapper.SopUserLogsInfoMapper;
|
|
|
import com.fs.sop.service.ISopUserLogsInfoService;
|
|
import com.fs.sop.service.ISopUserLogsInfoService;
|
|
@@ -136,6 +135,10 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private OpenIMService openIMService;
|
|
private OpenIMService openIMService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
|
|
+ private LuckyBagMapper luckyBagMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private LuckyBagCollectRecordMapper luckyBagCollectRecordMapper;
|
|
|
|
|
+ @Autowired
|
|
|
private CompanyCompanyFsuserMapper companyCompanyFsuserMapper;
|
|
private CompanyCompanyFsuserMapper companyCompanyFsuserMapper;
|
|
|
private static final Logger logger = LoggerFactory.getLogger(FsUserCourseVideoServiceImpl.class);
|
|
private static final Logger logger = LoggerFactory.getLogger(FsUserCourseVideoServiceImpl.class);
|
|
|
|
|
|
|
@@ -260,9 +263,6 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IFsCourseLinkService linkService;
|
|
private IFsCourseLinkService linkService;
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private FsDepVideoShowMapper fsDepVideoShowMapper;
|
|
|
|
|
-
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private FsPackageMapper fsPackageMapper;
|
|
private FsPackageMapper fsPackageMapper;
|
|
|
|
|
|
|
@@ -2832,9 +2832,6 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
// 1、获取视频详情、问题详情
|
|
// 1、获取视频详情、问题详情
|
|
|
ResponseResult<FsUserCourseVideoDetailsVO> videoDetails = this.getVideoDetails(param.getVideoId());
|
|
ResponseResult<FsUserCourseVideoDetailsVO> videoDetails = this.getVideoDetails(param.getVideoId());
|
|
|
FsUserCourseVideoDetailsVO courseVideoDetails = videoDetails.getData() != null ? videoDetails.getData() : null;
|
|
FsUserCourseVideoDetailsVO courseVideoDetails = videoDetails.getData() != null ? videoDetails.getData() : null;
|
|
|
- if(courseVideoDetails != null){
|
|
|
|
|
- getGoodsAndShow(param.getVideoId(),courseVideoDetails);
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
//课程logo
|
|
//课程logo
|
|
|
if (param.getPeriodId() != null) {
|
|
if (param.getPeriodId() != null) {
|
|
@@ -2952,44 +2949,6 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
return ResponseResult.ok(vo);
|
|
return ResponseResult.ok(vo);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 小黄车商品和展示
|
|
|
|
|
- */
|
|
|
|
|
- private void getGoodsAndShow(Long videoId, FsUserCourseVideoDetailsVO vo) {
|
|
|
|
|
- String show = fsDepVideoShowMapper.selectFsDepVideoShowByVideoId(videoId, null);
|
|
|
|
|
- vo.setShowTreatment(ObjectUtil.isEmpty(show) ? "1" : show);
|
|
|
|
|
-
|
|
|
|
|
- FsUserCourseVideo courseVideo = fsUserCourseVideoMapper.selectFsUserCourseVideoByVideoId(videoId);
|
|
|
|
|
- String packageJson = courseVideo.getPackageJson();
|
|
|
|
|
- if (StringUtils.isNotEmpty(packageJson)) {
|
|
|
|
|
- List<String> packageIds = new ArrayList<>();
|
|
|
|
|
- ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
|
- JsonNode jsonNode = null;
|
|
|
|
|
- try {
|
|
|
|
|
- jsonNode = objectMapper.readTree(packageJson);
|
|
|
|
|
- } catch (JsonProcessingException e) {
|
|
|
|
|
- throw new RuntimeException(e);
|
|
|
|
|
- }
|
|
|
|
|
- if (jsonNode.isArray()) {
|
|
|
|
|
- for (JsonNode node : jsonNode) {
|
|
|
|
|
- String packageId = node.path("packageId").asText();
|
|
|
|
|
- if (StringUtils.isNotEmpty(packageId)) {
|
|
|
|
|
- packageIds.add(packageId);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- List<FsPackageListVO> fsPackageListVOS = new ArrayList<>();
|
|
|
|
|
- if (!packageIds.isEmpty()) {
|
|
|
|
|
- fsPackageListVOS = fsPackageMapper.selectFsPackagesByIds(packageIds);
|
|
|
|
|
- }else {
|
|
|
|
|
- fsPackageListVOS = new ArrayList<>();
|
|
|
|
|
- }
|
|
|
|
|
- vo.setTreatmentPackage(fsPackageListVOS);
|
|
|
|
|
- }
|
|
|
|
|
- }else {
|
|
|
|
|
- vo.setTreatmentPackage(new ArrayList<>());
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* @Description: 是否看课中断
|
|
* @Description: 是否看课中断
|
|
|
* @Param:
|
|
* @Param:
|
|
@@ -4749,38 +4708,151 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
|
|
|
|
|
return link;
|
|
return link;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
- public R registerQwFsUser(FsUserCourseVideoAddKfUParam param) {
|
|
|
|
|
- logger.info("zyp \n【判断添加客服】:{}", param);
|
|
|
|
|
|
|
+ public List<OptionsVO> selectVideoOptionsByCourseId(Long courseId) {
|
|
|
|
|
+ return fsUserCourseVideoMapper.selectVideoOptionsByCourseId(courseId);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- // 参数校验
|
|
|
|
|
- if (param == null) {
|
|
|
|
|
- return R.error("参数不能为空");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public R createAppFd(LuckyBagCollectRecord param) {
|
|
|
|
|
|
|
|
- // 查询用户
|
|
|
|
|
- FsUser fsUser = fsUserMapper.selectFsUserByUserId(param.getUserId());
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ CompanyUser companyUser = companyUserMapper.selectCompanyUserByCompanyUserId(param.getCompanyUserId());
|
|
|
|
|
+ if (companyUser==null||companyUser.getCompanyId()==null||companyUser.getUserId()==null){
|
|
|
|
|
+ return R.error("员工不存在!");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- // 用户不存在唤起重新授权
|
|
|
|
|
- if (fsUser == null) {
|
|
|
|
|
- return R.error(401, "用户不存在");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ Company company = companyMapper.selectCompanyById(param.getCompanyId());
|
|
|
|
|
+ if (company == null ) {
|
|
|
|
|
+ return R.error().put("msg","企业不存在,请联系管理员");
|
|
|
|
|
+ }
|
|
|
|
|
+ String course = configService.selectConfigByKey("course.config");
|
|
|
|
|
+ CourseConfig config = JSON.parseObject(course, CourseConfig.class);
|
|
|
|
|
+ LocalDateTime sendDateTime = new Date().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
|
|
+ LocalDateTime expireDateTime = sendDateTime.plusDays(config.getVideoLinkExpireDate() - 1);
|
|
|
|
|
+ expireDateTime = expireDateTime.toLocalDate().atTime(23, 59, 59);
|
|
|
|
|
+ Date updateTime = Date.from(expireDateTime.atZone(ZoneId.systemDefault()).toInstant());
|
|
|
|
|
|
|
|
- if (fsUser.getStatus() != null && fsUser.getStatus() == 0) {
|
|
|
|
|
- return R.error("会员被停用,无权限,请联系客服!");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ Long businessId = addLuckyBagCollectRecord(param.getLuckyBagId(),param.getUserId(),updateTime,String.valueOf(param.getCompanyUserId()),String.valueOf(param.getCompanyId()));
|
|
|
|
|
|
|
|
- // 处理群聊逻辑
|
|
|
|
|
- if (param.getChatId() != null) {
|
|
|
|
|
- return handleGroupChatLogic(param,fsUser);
|
|
|
|
|
|
|
+ return R.ok().put("data",businessId);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ return R.error("发放福袋失败!");
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- // 处理普通外部联系人逻辑
|
|
|
|
|
- return handleExternalContactLogic(param, fsUser);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 增加福袋发放记录、领取记录
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param luckyBagId
|
|
|
|
|
+ * @param userId
|
|
|
|
|
+ * @param sendTime
|
|
|
|
|
+ * @param companyUserId
|
|
|
|
|
+ * @param companyId
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ private Long addLuckyBagCollectRecord(Long luckyBagId,
|
|
|
|
|
+ Long userId,
|
|
|
|
|
+ Date sendTime,
|
|
|
|
|
+ String companyUserId,
|
|
|
|
|
+ String companyId) {
|
|
|
|
|
+ try {
|
|
|
|
|
+
|
|
|
|
|
+ if (StringUtils.isEmpty(companyId) || StringUtils.isEmpty(companyUserId)) {
|
|
|
|
|
+ log.warn("公司ID或用户ID为空 [companyId:{}, companyUserId:{}]", companyId, companyUserId);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 验证福袋ID
|
|
|
|
|
+ if (luckyBagId == null) {
|
|
|
|
|
+ log.warn("福袋ID为空");
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 查询福袋信息
|
|
|
|
|
+ LuckyBag luckyBag = luckyBagMapper.selectLuckyBagById(luckyBagId);
|
|
|
|
|
+ if (luckyBag == null) {
|
|
|
|
|
+ log.warn("未找到对应的福袋信息 [luckyBagId:{}]", luckyBagId);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 检查福袋状态
|
|
|
|
|
+ if (luckyBag.getDataStatus() != null && luckyBag.getDataStatus().equals(0)) {
|
|
|
|
|
+ log.warn("福袋被禁用 [luckyBagId:{}]", luckyBagId);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 查询公司信息
|
|
|
|
|
+ Company company = companyMapper.selectCompanyById(Long.valueOf(companyId));
|
|
|
|
|
+ if (company == null) {
|
|
|
|
|
+ log.warn("未找到对应的公司信息 [companyId:{}]", companyId);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ LuckyBagCollectRecord luckyBagCollectRecord = buildLuckyBagRecord(luckyBagId,userId,sendTime,
|
|
|
|
|
+ companyUserId, companyId, company, luckyBag);
|
|
|
|
|
+
|
|
|
|
|
+ // 插入记录并返回ID
|
|
|
|
|
+ int result = luckyBagCollectRecordMapper.insertLuckyBagCollectRecord(luckyBagCollectRecord);
|
|
|
|
|
+ if (result <= 0) {
|
|
|
|
|
+ log.warn("福袋记录插入失败 [luckyBagId:{}]", luckyBagId);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 返回新增记录的ID
|
|
|
|
|
+ Long recordId = luckyBagCollectRecord.getId();
|
|
|
|
|
+ if (recordId == null) {
|
|
|
|
|
+ log.warn("福袋记录插入成功但未返回ID [luckyBagId:{}]", luckyBagId);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ log.info("福袋记录添加成功 [recordId:{}, luckyBagId:{}]", recordId, luckyBagId);
|
|
|
|
|
+ return recordId;
|
|
|
|
|
+
|
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
|
+ log.error("ID转换失败 [companyId:{}, companyUserId:{}]", companyId, companyUserId, e);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("ID:" + (luckyBagId != null ? luckyBagId : "unknown") + "-添加福袋记录失败", e);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- @Override
|
|
|
|
|
- public List<OptionsVO> selectVideoOptionsByCourseId(Long courseId) {
|
|
|
|
|
- return fsUserCourseVideoMapper.selectVideoOptionsByCourseId(courseId);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 构建福袋记录对象
|
|
|
|
|
+ */
|
|
|
|
|
+ private LuckyBagCollectRecord buildLuckyBagRecord(Long luckyBagId,
|
|
|
|
|
+ Long userId,
|
|
|
|
|
+ Date sendTime,
|
|
|
|
|
+ String companyUserId,
|
|
|
|
|
+ String companyId,
|
|
|
|
|
+ Company company,
|
|
|
|
|
+ LuckyBag luckyBag) {
|
|
|
|
|
+ LuckyBagCollectRecord record = new LuckyBagCollectRecord();
|
|
|
|
|
+ record.setLuckyBagId(luckyBagId);
|
|
|
|
|
+ record.setExpiryTime(sendTime);
|
|
|
|
|
+ record.setCollectType("0");
|
|
|
|
|
+ record.setSendTime(new Date());
|
|
|
|
|
+ record.setCompanyId(Long.valueOf(companyId));
|
|
|
|
|
+ record.setUserId(userId);
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(userId)){
|
|
|
|
|
+ FsUser fsUser = fsUserMapper.selectFsUserByUserId(userId);
|
|
|
|
|
+ record.setUserName(ObjectUtil.isNotEmpty(fsUser)?fsUser.getNickName():null);
|
|
|
|
|
+ }
|
|
|
|
|
+ record.setCompanyName(company.getCompanyName());
|
|
|
|
|
+ record.setCompanyUserId(Long.valueOf(companyUserId));
|
|
|
|
|
+
|
|
|
|
|
+ record.setRewardType(2L);
|
|
|
|
|
+
|
|
|
|
|
+ // 设置币种金额
|
|
|
|
|
+ if (luckyBag.getRewardType() != null && luckyBag.getRewardType().equals("1")) {
|
|
|
|
|
+ record.setCoinAmount(luckyBag.getAmount());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return record;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|