|
@@ -49,10 +49,10 @@ import com.fs.his.service.IFsUserService;
|
|
|
import com.fs.his.service.IFsUserWxService;
|
|
|
import com.fs.his.utils.ConfigUtil;
|
|
|
import com.fs.his.vo.OptionsVO;
|
|
|
-import com.fs.qw.domain.QwCompany;
|
|
|
-import com.fs.qw.domain.QwExternalContact;
|
|
|
-import com.fs.qw.domain.QwUser;
|
|
|
+import com.fs.qw.domain.*;
|
|
|
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.service.IQwCompanyService;
|
|
|
import com.fs.qw.service.IQwExternalContactService;
|
|
@@ -60,6 +60,7 @@ import com.fs.qwApi.Result.QwAddContactWayResult;
|
|
|
import com.fs.qwApi.Result.QwGroupChatDetailsResult;
|
|
|
import com.fs.qwApi.param.QwAddContactWayParam;
|
|
|
import com.fs.qwApi.service.QwApiService;
|
|
|
+import com.fs.sop.domain.SopUserLogsInfo;
|
|
|
import com.fs.sop.mapper.QwSopLogsMapper;
|
|
|
import com.fs.sop.mapper.SopUserLogsInfoMapper;
|
|
|
import com.fs.sop.service.ISopUserLogsInfoService;
|
|
@@ -131,6 +132,10 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
@Autowired
|
|
|
private FsUserCourseVideoMapper fsUserCourseVideoMapper;
|
|
|
@Autowired
|
|
|
+ private QwGroupChatMapper qwGroupChatMapper;
|
|
|
+ @Autowired
|
|
|
+ private QwGroupChatUserMapper qwGroupChatUserMapper;
|
|
|
+ @Autowired
|
|
|
private IFsUserService fsUserService;
|
|
|
@Autowired
|
|
|
private FsUserCourseCompanyUserTimeMapper companyUserTimeMapper;
|
|
@@ -509,36 +514,27 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
FsCourseLink courseLink = courseLinkMapper.selectFsCourseLinkByLink(param.getLink());
|
|
|
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>";
|
|
|
- QwGroupChatDetailsResult result = qwApiService.groupChatDetails(courseLink.getChatId(), param.getCorpId());
|
|
|
- log.info("群聊参数:{},链接参数:{}, 企微返回:{}", JSON.toJSONString(param), JSON.toJSONString(courseLink), JSON.toJSONString(result));
|
|
|
- if(result.getErrCode() != 0){
|
|
|
- return R.error("企微接口请求失败,请联系管理员:" +result.getErrMsg());
|
|
|
+ QwGroupChat qwGroupChat = qwGroupChatMapper.selectQwGroupChatByChatId(courseLink.getChatId());
|
|
|
+ if(qwGroupChat == null){
|
|
|
+ return R.error("群参数异常");
|
|
|
+ }
|
|
|
+ SopUserLogsInfo sopUserLogsInfo = new SopUserLogsInfo();
|
|
|
+ sopUserLogsInfo.setChatId(courseLink.getChatId());
|
|
|
+ List<QwGroupChatUser> qwGroupChatUsers = qwGroupChatUserMapper.selectByChatId(sopUserLogsInfo);
|
|
|
+ if(qwGroupChatUsers == null || qwGroupChatUsers.isEmpty()){
|
|
|
+ return R.error("群参数异常");
|
|
|
}
|
|
|
-// List<QwGroupChatDetailsResult.Member> collect = result.getGroupChat().getMemberList().stream().filter(e -> e.getType() == 2).collect(Collectors.toList());
|
|
|
-// if(collect.isEmpty()){
|
|
|
-// return addCustomerService(param.getQwUserId(),msg);
|
|
|
-// }
|
|
|
-// Optional<QwGroupChatDetailsResult.Member> optional = collect.stream().filter(e -> e.getName().equals(fsUser.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())
|
|
|
-// );
|
|
|
QwExternalContact qwExternalContact =
|
|
|
qwExternalContactMapper.selectOne(new QueryWrapper<QwExternalContact>()
|
|
|
- .eq("user_id", result.getGroupChat().getOwner())
|
|
|
+ .eq("user_id", qwGroupChat.getOwner())
|
|
|
.eq("fs_user_id", param.getUserId())
|
|
|
.eq("corp_id", param.getCorpId())
|
|
|
.eq("status",0));
|
|
|
if(qwExternalContact==null){
|
|
|
return addCustomerService(param.getQwUserId(),msg);
|
|
|
}
|
|
|
- log.info("外部联系人数据:{}", qwExternalContact);
|
|
|
- if(result.getGroupChat().getMemberList().stream().noneMatch(e -> e.getUserId().equals(qwExternalContact.getExternalUserId()))){
|
|
|
+ if(qwGroupChatUsers.stream().noneMatch(e -> e.getUserId().equals(qwExternalContact.getExternalUserId()))){
|
|
|
+ log.error("客户不在群:{},里面:{}", qwGroupChat.getChatId(), qwExternalContact.getExternalUserId());
|
|
|
return addCustomerService(param.getQwUserId(),msg);
|
|
|
}
|
|
|
Long qwExternalId = qwExternalContact.getId();
|
|
@@ -565,7 +561,8 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
}
|
|
|
|
|
|
log.setUpdateTime(new Date());
|
|
|
-// fsUserCompanyBindService.bindFsUser(fsUser.getUserId(), qwExternalId, log.getLogId());
|
|
|
+ //重粉逻辑
|
|
|
+ fsUserCompanyBindService.bindFsUser(param.getUserId(), qwExternalId, log.getLogId());
|
|
|
courseWatchLogMapper.updateFsCourseWatchLog(log);
|
|
|
|
|
|
}else {
|
|
@@ -584,7 +581,8 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
log.setUpdateTime(new Date());
|
|
|
courseWatchLogMapper.updateFsCourseWatchLog(log);
|
|
|
}
|
|
|
-// fsUserCompanyBindService.bindFsUser(fsUser.getUserId(), qwExternalId, log.getLogId());
|
|
|
+ //重粉逻辑
|
|
|
+ fsUserCompanyBindService.bindFsUser(param.getUserId(), qwExternalId, log.getLogId());
|
|
|
return R.error(567,"群聊通用链接").put("qwExternalId", qwExternalContact.getId());
|
|
|
}
|
|
|
private R handleRoom(FsUserCourseVideoAddKfUParam param,FsUser user) {
|
|
@@ -787,6 +785,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
|
|
|
iSopUserLogsInfoService.updateSopUserInfoByExternalId(qwExternalId,param.getUserId());
|
|
|
|
|
|
+ //重粉逻辑
|
|
|
fsUserCompanyBindService.bindFsUser(param.getUserId(), qwExternalId, log.getLogId());
|
|
|
|
|
|
|
|
@@ -825,6 +824,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
log.setUpdateTime(new Date());
|
|
|
courseWatchLogMapper.updateFsCourseWatchLog(log);
|
|
|
|
|
|
+ //重粉逻辑
|
|
|
fsUserCompanyBindService.bindFsUser(param.getUserId(), qwExternalId, log.getLogId());
|
|
|
|
|
|
|