| 
														
															@@ -1,5 +1,6 @@ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 package com.fs.course.service.impl; 
														 | 
														
														 | 
														
															 package com.fs.course.service.impl; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import cn.binarywang.wx.miniapp.api.WxMaService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import cn.hutool.json.JSONUtil; 
														 | 
														
														 | 
														
															 import cn.hutool.json.JSONUtil; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.alibaba.fastjson.JSON; 
														 | 
														
														 | 
														
															 import com.alibaba.fastjson.JSON; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.alibaba.fastjson.JSONObject; 
														 | 
														
														 | 
														
															 import com.alibaba.fastjson.JSONObject; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -10,6 +11,7 @@ import com.fs.common.utils.StringUtils; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.common.utils.date.DateUtil; 
														 | 
														
														 | 
														
															 import com.fs.common.utils.date.DateUtil; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.company.mapper.CompanyUserMapper; 
														 | 
														
														 | 
														
															 import com.fs.company.mapper.CompanyUserMapper; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.config.cloud.CloudHostProper; 
														 | 
														
														 | 
														
															 import com.fs.config.cloud.CloudHostProper; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.fs.core.config.WxMaConfiguration; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.course.config.CourseConfig; 
														 | 
														
														 | 
														
															 import com.fs.course.config.CourseConfig; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.course.domain.*; 
														 | 
														
														 | 
														
															 import com.fs.course.domain.*; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.course.mapper.FsCourseDomainNameMapper; 
														 | 
														
														 | 
														
															 import com.fs.course.mapper.FsCourseDomainNameMapper; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -20,6 +22,8 @@ import com.fs.course.param.FsCourseLinkCreateParam; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.course.param.FsCourseLinkRoomParam; 
														 | 
														
														 | 
														
															 import com.fs.course.param.FsCourseLinkRoomParam; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.course.service.IFsCourseLinkService; 
														 | 
														
														 | 
														
															 import com.fs.course.service.IFsCourseLinkService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.course.service.IFsUserCourseService; 
														 | 
														
														 | 
														
															 import com.fs.course.service.IFsUserCourseService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.fs.his.config.FsSysConfig; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.fs.his.utils.ConfigUtil; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.qw.domain.QwGroupChat; 
														 | 
														
														 | 
														
															 import com.fs.qw.domain.QwGroupChat; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.qw.domain.QwGroupChatUser; 
														 | 
														
														 | 
														
															 import com.fs.qw.domain.QwGroupChatUser; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.qw.domain.QwUser; 
														 | 
														
														 | 
														
															 import com.fs.qw.domain.QwUser; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -32,13 +36,26 @@ import com.fs.system.service.ISysConfigService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.voice.utils.StringUtil; 
														 | 
														
														 | 
														
															 import com.fs.voice.utils.StringUtil; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import lombok.Synchronized; 
														 | 
														
														 | 
														
															 import lombok.Synchronized; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import lombok.extern.slf4j.Slf4j; 
														 | 
														
														 | 
														
															 import lombok.extern.slf4j.Slf4j; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import me.chanjar.weixin.common.error.WxErrorException; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import me.chanjar.weixin.mp.api.WxMpService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import org.apache.http.HttpEntity; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import org.apache.http.client.ClientProtocolException; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import org.apache.http.client.methods.HttpPost; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import org.apache.http.entity.StringEntity; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import org.apache.http.impl.client.CloseableHttpClient; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import org.apache.http.impl.client.HttpClients; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import org.apache.http.util.EntityUtils; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.springframework.beans.BeanUtils; 
														 | 
														
														 | 
														
															 import org.springframework.beans.BeanUtils; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.springframework.beans.factory.annotation.Autowired; 
														 | 
														
														 | 
														
															 import org.springframework.beans.factory.annotation.Autowired; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.springframework.stereotype.Service; 
														 | 
														
														 | 
														
															 import org.springframework.stereotype.Service; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.springframework.transaction.annotation.Transactional; 
														 | 
														
														 | 
														
															 import org.springframework.transaction.annotation.Transactional; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import java.io.IOException; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import java.io.UnsupportedEncodingException; 
														 | 
														
														 | 
														
															 import java.io.UnsupportedEncodingException; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import java.net.URLDecoder; 
														 | 
														
														 | 
														
															 import java.net.URLDecoder; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import java.net.URLEncoder; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import java.nio.charset.StandardCharsets; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import java.time.LocalDate; 
														 | 
														
														 | 
														
															 import java.time.LocalDate; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import java.time.LocalDateTime; 
														 | 
														
														 | 
														
															 import java.time.LocalDateTime; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import java.time.ZoneId; 
														 | 
														
														 | 
														
															 import java.time.ZoneId; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -661,4 +678,149 @@ public class FsCourseLinkServiceImpl implements IFsCourseLinkService 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    /** 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     * 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     * 生成跳转微信小程序的链接 base 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     * 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     * @param appid 微信appid 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     * @param path  跳转页面路径 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     * @param query 需要传参的String 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     * @return 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     */ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public String getWxAppLink(String appid, String path, String query) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        StringBuilder wxAppLink = new StringBuilder("weixin://dl/business/?"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        try { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            wxAppLink.append("appid=").append(appid); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            wxAppLink.append("&path=").append(path); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            String encodedQuery =  URLEncoder.encode(URLEncoder.encode(query, StandardCharsets.UTF_8.toString())); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            wxAppLink.append("&query=").append(encodedQuery); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//            wxAppLink.append("&env_version=trial"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//            if(StringUtils.isNotBlank(envVersion)){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                wxAppLink.append("&env_version=").append(envVersion); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//            } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } catch (UnsupportedEncodingException e) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            log.error("生成跳转微信小程序的链接失败" + e.getMessage()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            return "生成失败"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return wxAppLink.toString(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @Override 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public String testGetAppLink() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        String pageLink = "/pages_course/video.html?course\\u003d{\\\"companyId\\\":100,\\\"companyUserId\\\":2020,\\\"corpId\\\":\\\"ww51717e2b71d5e2d3\\\",\\\"courseId\\\":63,\\\"link\\\":\\\"1943203055923101696\\\",\\\"linkType\\\":3,\\\"qwExternalId\\\":20812637,\\\"qwUserId\\\":\\\"9112\\\",\\\"videoId\\\":400}"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        String miniprogramAppid = "wx76cb55db092a41ae"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if (StringUtils.isNotBlank(pageLink)) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            //解析pageLink 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            String[] split = pageLink.split("\\?"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if (split.length == 2 && split[0].length() > 0 && split[1].length() > 0) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                //处理页面路径 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                String pageUrl =split[0]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                if(pageUrl.startsWith("/")){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    pageUrl = pageUrl.substring(1); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                if(pageUrl.contains(".html")){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    pageUrl = pageUrl.replace(".html", ""); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                //处理参数 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                String query = split[1]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                query = query.replace("\\u003d", "="); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                String wxAppLink = getWxAppLink(miniprogramAppid, pageUrl, query); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                return wxAppLink; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            } else { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                return "页面链接错误,获取失败"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return pageLink; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    /** 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     * 获取跳转微信小程序的链接地址 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     * @param linkStr 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     * @return 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     */ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @Override 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public String getGotoWxAppLink(String linkStr) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//        CloseableHttpClient client = null; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//        try { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//            client = HttpClients.createDefault(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//            String[] split = linkStr.split("\\?"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//            if (split.length == 2 && split[0].length() > 0 && split[1].length() > 0) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                //处理页面路径 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                String pageUrl = split[0]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                if (pageUrl.startsWith("/")) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                    pageUrl = pageUrl.substring(1); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                //处理参数 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                String query = split[1]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                String json = configService.selectConfigByKey("course.config"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                CourseConfig config = JSON.parseObject(json, CourseConfig.class); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                String miniprogramAppid = config.getMiniprogramAppid(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                if (StringUtils.isBlank(miniprogramAppid)) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                    return "未配置点播小程序id"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                if(StringUtils.isBlank(code)){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                    return "参数错误,请传入code"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                //获取微信token 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                final WxMaService wxService = WxMaConfiguration.getMaService("wx76cb55db092a41ae"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                String token = wxService.getAccessToken(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                HttpPost httpPost = new HttpPost("https://api.weixin.qq.com/wxa/generate_urllink?access_token=" + token); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                JSONObject bodyObj = new JSONObject(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                bodyObj.put("path", pageUrl); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                bodyObj.put("query", query); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                log.info("微信小程序请求参数打印:{}", bodyObj.toJSONString()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                StringEntity entity = new StringEntity(bodyObj.toJSONString(),"UTF-8"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                httpPost.setEntity(entity); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                httpPost.setHeader("Content-type", "application/json"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                HttpEntity response = client.execute(httpPost).getEntity(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                String responseString = EntityUtils.toString(response); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                log.info("微信小程序接口响应数据:{}", responseString); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                JSONObject jsonObject = JSONObject.parseObject(responseString); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                if(null != jsonObject && !jsonObject.isEmpty() && jsonObject.containsKey("url_link")){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                    return jsonObject.getString("url_link"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//            } else { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                return "页面链接错误,获取失败"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//            } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+// 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//        } catch (WxErrorException e) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//            throw new RuntimeException(e); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//        } catch (ClientProtocolException e) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//            throw new RuntimeException(e); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//        } catch (IOException e) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//            throw new RuntimeException(e); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//        } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        String json = configService.selectConfigByKey("course.config"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        CourseConfig config = JSON.parseObject(json, CourseConfig.class); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        String miniprogramAppid = config.getMiniprogramAppid(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if (StringUtils.isBlank(miniprogramAppid)) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    return "未配置点播小程序id"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//        String envVersion = "trial"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//        String envVersion = version; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if (StringUtils.isNotBlank(linkStr)) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            //解析pageLink 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            String[] split = linkStr.split("\\?"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if (split.length == 2 && split[0].length() > 0 && split[1].length() > 0) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                //处理页面路径 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                String pageUrl =split[0]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                if(pageUrl.startsWith("/")){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    pageUrl = pageUrl.substring(1); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                //处理参数 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                String query = split[1]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+//                query = query.replace("\\u003d", "="); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                String wxAppLink = getWxAppLink(miniprogramAppid, pageUrl, query); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                return wxAppLink; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            } else { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                return "页面链接错误,获取失败"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return ""; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 |