| 
					
				 | 
			
			
				@@ -42,6 +42,7 @@ import com.fs.qwApi.param.QwAddContactWayParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.qwApi.service.QwApiService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.sop.mapper.QwSopLogsMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.sop.mapper.SopUserLogsInfoMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.sop.service.ISopUserLogsInfoService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.system.service.ISysConfigService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.github.binarywang.wxpay.bean.transfer.TransferBillsResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import lombok.extern.slf4j.Slf4j; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -86,6 +87,11 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private FsCourseQuestionBankMapper courseQuestionBankMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private FsCourseWatchLogMapper courseWatchLogMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private ISopUserLogsInfoService iSopUserLogsInfoService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private FsCourseLinkMapper fsCourseLinkMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private QwExternalContactMapper qwExternalContactMapper; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -429,13 +435,31 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return R.error("链接过期"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Long qwExternalId = param.getQwExternalId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FsCourseWatchLog log=new FsCourseWatchLog(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        FsCourseWatchLog log = courseWatchLogMapper.getWatchCourseVideoByExt(param.getQwExternalId(), param.getVideoId(),param.getQwUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (log==null ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return addCustomerService(param.getQwUserId(),msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //如果是官方的则查真正的外部联系人id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (param.getLinkType()!=null&¶m.getLinkType()==5) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log = courseWatchLogMapper.selectFsCourseWatchLogByCourseSopIdAndVideoId(param.getUserId(), param.getVideoId(), param.getQwUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (log == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return addCustomerService(param.getQwUserId(), msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                qwExternalId=log.getQwExternalContactId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log = courseWatchLogMapper.getWatchCourseVideoByExt(qwExternalId, param.getVideoId(),param.getQwUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (log==null ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return addCustomerService(param.getQwUserId(),msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        FsCourseWatchLog log = courseWatchLogMapper.getWatchCourseVideoByExt(param.getQwExternalId(), param.getVideoId(),param.getQwUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        if (log==null ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            return addCustomerService(param.getQwUserId(),msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //查询是否有添加客服 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         QwExternalContact externalContact = qwExternalContactMapper.selectQwExternalContactById(param.getQwExternalId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -465,6 +489,16 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             log.setUpdateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             courseWatchLogMapper.updateFsCourseWatchLog(log); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            iSopUserLogsInfoService.updateSopUserInfoByExternalId(qwExternalId,param.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (param.getLinkType()!=null&¶m.getLinkType()==5){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                FsCourseLink fsCourseLink = fsCourseLinkMapper.selectExpireLinkByQwExternalId(param.getQwUserId(), param.getVideoId(), qwExternalId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return R.error(566,"官方群发通用链接").put("courseLink",fsCourseLink); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return R.ok(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }else { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -473,6 +507,9 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             contact.setId(param.getQwExternalId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             contact.setFsUserId(param.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             qwExternalContactMapper.updateQwExternalContact(contact); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            iSopUserLogsInfoService.updateSopUserInfoByExternalId(qwExternalId,param.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             FsUser user = new FsUser(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             user.setUserId(param.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             user.setIsAddQw(1); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -492,6 +529,12 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             log.setUpdateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             courseWatchLogMapper.updateFsCourseWatchLog(log); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (param.getLinkType()!=null&¶m.getLinkType()==5){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                FsCourseLink fsCourseLink = fsCourseLinkMapper.selectExpireLinkByQwExternalId(param.getQwUserId(), param.getVideoId(), qwExternalId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return R.error(566,"官方群发通用链接").put("courseLink",fsCourseLink); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return R.ok(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 |