|  | @@ -12,6 +12,7 @@ import com.fs.common.core.redis.RedisCache;
 | 
	
		
			
				|  |  |  import com.fs.common.utils.PubFun;
 | 
	
		
			
				|  |  |  import com.fs.common.utils.StringUtils;
 | 
	
		
			
				|  |  |  import com.fs.company.service.ICompanyConfigService;
 | 
	
		
			
				|  |  | +import com.fs.course.config.CourseConfig;
 | 
	
		
			
				|  |  |  import com.fs.course.domain.FsCourseSop;
 | 
	
		
			
				|  |  |  import com.fs.course.domain.FsCourseSopLogs;
 | 
	
		
			
				|  |  |  import com.fs.course.domain.FsCourseWatchLog;
 | 
	
	
		
			
				|  | @@ -92,6 +93,7 @@ import java.util.stream.Stream;
 | 
	
		
			
				|  |  |  public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactMapper, QwExternalContact> implements IQwExternalContactService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      private static final String miniappRealLink = "/pages_course/video.html?course=";
 | 
	
		
			
				|  |  | +    private static final String registerLink = "/registerCourse/pages/index?qwExternalId=";
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private QwExternalContactMapper qwExternalContactMapper;
 | 
	
	
		
			
				|  | @@ -135,6 +137,7 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private FsCourseLinkMapper fsCourseLinkMapper;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      QwAutoTagsMapper qwAutoTagsMapper;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
	
		
			
				|  | @@ -1209,6 +1212,11 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
 | 
	
		
			
				|  |  |          QwContactWay wayId = null;
 | 
	
		
			
				|  |  |          SysConfig sysConfig = sysConfigService.selectConfigByConfigKey("qw.config");
 | 
	
		
			
				|  |  |          QwConfig qwConfig = JSON.parseObject(sysConfig.getConfigValue(), QwConfig.class);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//        String json = sysConfigService.selectConfigByKey("course.config");
 | 
	
		
			
				|  |  | +//        QwConfig qwConfig = JSON.parseObject(json, QwConfig.class);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          //先入客户
 | 
	
		
			
				|  |  |          QwExternalContact qwExternalContact = qwExternalContactMapper.selectQwExternalByExternalIdAndCompanyIdToIdAndFs(externalUserID, userID, corpId);
 | 
	
		
			
				|  |  |          boolean isNewQwExternalContact = qwExternalContact == null ? true : false;
 | 
	
	
		
			
				|  | @@ -2630,6 +2638,10 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
 | 
	
		
			
				|  |  |              return attachments;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        String json = sysConfigService.selectConfigByKey("course.config");
 | 
	
		
			
				|  |  | +        CourseConfig config = JSON.parseObject(json, CourseConfig.class);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          attachments.forEach(att -> {
 | 
	
		
			
				|  |  |              // 生成短链的条件判断
 | 
	
		
			
				|  |  |              if ("link".equals(att.getMsgtype())
 | 
	
	
		
			
				|  | @@ -2637,30 +2649,41 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
 | 
	
		
			
				|  |  |                      && !StringUtil.strIsNullOrEmpty(att.getLink().getVideoId())) {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  try {
 | 
	
		
			
				|  |  | -                    FsCourseLinkCreateParam param = new FsCourseLinkCreateParam();
 | 
	
		
			
				|  |  | -                    param.setVideoId(Long.valueOf(att.getLink().getVideoId()));
 | 
	
		
			
				|  |  | -                    param.setQwUserId(String.valueOf(qwUser.getId()));
 | 
	
		
			
				|  |  | -                    param.setDays(att.getLink().getExpiresDays());
 | 
	
		
			
				|  |  | -                    param.setCorpId(corpId);
 | 
	
		
			
				|  |  | -                    param.setCourseId(Long.valueOf(att.getLink().getCourseId()));
 | 
	
		
			
				|  |  | -                    param.setCompanyUserId(qwUser.getCompanyUserId());
 | 
	
		
			
				|  |  | -                    param.setCompanyId(qwUser.getCompanyId());
 | 
	
		
			
				|  |  | -                    param.setQwExternalId(qwExternalId);
 | 
	
		
			
				|  |  | -                    param.setSendTime(new Date());
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                    // 调用服务生成短链
 | 
	
		
			
				|  |  | -                    R linkUrl = iFsCourseLinkService.createLinkUrlWc(param);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                    if (linkUrl != null && linkUrl.get("url") != null) {
 | 
	
		
			
				|  |  | -                        att.getLink().setUrl(linkUrl.get("url").toString());
 | 
	
		
			
				|  |  | +                    //发课程
 | 
	
		
			
				|  |  | +                    if (att.getLink().getIsFixed()==0){
 | 
	
		
			
				|  |  | +                        FsCourseLinkCreateParam param = new FsCourseLinkCreateParam();
 | 
	
		
			
				|  |  | +                        param.setVideoId(Long.valueOf(att.getLink().getVideoId()));
 | 
	
		
			
				|  |  | +                        param.setQwUserId(String.valueOf(qwUser.getId()));
 | 
	
		
			
				|  |  | +                        param.setDays(att.getLink().getExpiresDays());
 | 
	
		
			
				|  |  | +                        param.setCorpId(corpId);
 | 
	
		
			
				|  |  | +                        param.setCourseId(Long.valueOf(att.getLink().getCourseId()));
 | 
	
		
			
				|  |  | +                        param.setCompanyUserId(qwUser.getCompanyUserId());
 | 
	
		
			
				|  |  | +                        param.setCompanyId(qwUser.getCompanyId());
 | 
	
		
			
				|  |  | +                        param.setQwExternalId(qwExternalId);
 | 
	
		
			
				|  |  | +                        param.setSendTime(new Date());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                        // 调用服务生成短链
 | 
	
		
			
				|  |  | +                        R linkUrl = iFsCourseLinkService.createLinkUrlWc(param);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                        if (linkUrl != null && linkUrl.get("url") != null) {
 | 
	
		
			
				|  |  | +                            att.getLink().setUrl(linkUrl.get("url").toString());
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        //生成观看记录
 | 
	
		
			
				|  |  | +                        addWatchLogIfNeeded(Integer.valueOf(att.getLink().getVideoId()),
 | 
	
		
			
				|  |  | +                                Integer.valueOf(att.getLink().getCourseId()),
 | 
	
		
			
				|  |  | +                                String.valueOf(qwUser.getId()),
 | 
	
		
			
				|  |  | +                                String.valueOf(qwUser.getCompanyUserId()),
 | 
	
		
			
				|  |  | +                                String.valueOf(qwUser.getCompanyId()),
 | 
	
		
			
				|  |  | +                                String.valueOf(qwExternalId));
 | 
	
		
			
				|  |  | +                    }else if (att.getLink().getIsFixed()==1){
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                        if (config != null) {
 | 
	
		
			
				|  |  | +                            att.getLink().setUrl(config.getRegisterDomainName()+registerLink+qwExternalId);
 | 
	
		
			
				|  |  | +                        }else {
 | 
	
		
			
				|  |  | +                            logger.error("企业配置信息为空:发送注册链接失败");
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  | -                    //生成观看记录
 | 
	
		
			
				|  |  | -                    addWatchLogIfNeeded(Integer.valueOf(att.getLink().getVideoId()),
 | 
	
		
			
				|  |  | -                            Integer.valueOf(att.getLink().getCourseId()),
 | 
	
		
			
				|  |  | -                            String.valueOf(qwUser.getId()),
 | 
	
		
			
				|  |  | -                            String.valueOf(qwUser.getCompanyUserId()),
 | 
	
		
			
				|  |  | -                            String.valueOf(qwUser.getCompanyId()),
 | 
	
		
			
				|  |  | -                            String.valueOf(qwExternalId));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  } catch (Exception e) {
 | 
	
		
			
				|  |  |                      logger.error("欢迎语生成短链失败:", e);
 |