| 
					
				 | 
			
			
				@@ -6,18 +6,32 @@ import com.fs.common.core.domain.AjaxResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.common.core.domain.R; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.common.core.page.TableDataInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.common.enums.BusinessType; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.common.exception.CustomException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.common.utils.ServletUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.common.utils.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.common.utils.poi.ExcelUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.core.security.LoginUser; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.core.web.service.TokenService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.course.param.FsCourseListBySidebarParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.course.service.IFsUserCourseService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.course.service.IFsUserCourseVideoService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.course.vo.FsCourseListBySidebarVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.course.vo.FsCourseVideoListBySidebarVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.qw.domain.QwExternalContact; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.qw.domain.QwExternalContactInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.qw.domain.QwMsg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.qw.domain.QwUser; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.qw.param.QwMsgSendParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.qw.param.QwSessionParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.qw.service.IQwExternalContactInfoService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.qw.service.IQwExternalContactService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.qw.service.IQwMsgService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.qw.service.IQwUserService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.qw.vo.QwContactListVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.qw.vo.QwMessageListVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.statis.dto.WatchCourseStatisticsDTO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.statis.param.WatchCourseStatisticsParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.statis.service.IStatisticsService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.github.pagehelper.PageHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.github.pagehelper.PageInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import io.swagger.annotations.Api; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -44,6 +58,18 @@ public class QwMsgController extends BaseController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private IQwMsgService qwMsgService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private TokenService tokenService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private IQwExternalContactInfoService qwExternalContactInfoService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private IQwExternalContactService qwExternalContactService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private IQwUserService qwUserService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private IStatisticsService statisticsService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private IFsUserCourseService fsUserCourseService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private IFsUserCourseVideoService fsUserCourseVideoService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 查询企微聊天记录列表 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -160,4 +186,81 @@ public class QwMsgController extends BaseController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         QwContactListVO data = qwMsgService.selectQwSessionBycId(param.getConversationId(),param.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return R.ok().put("data",data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @GetMapping("/getQwExternalContactDetails") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R getQwExternalContactDetails(@RequestParam(value = "qwExternalContactId") Long qwExternalContactId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok().put("data", qwExternalContactService.getQwExternalContactDetailsById(qwExternalContactId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @GetMapping("/getQwUserInfo") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ApiOperation("获取企微用户信息") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R getQwUserInfo(@RequestParam(value = "qwExternalContactId") Long qwExternalContactId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(qwExternalContactId == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new CustomException("企微外部联系人id不能为空!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        QwExternalContactInfo contactInfo = qwExternalContactInfoService.selectQwExternalContactInfoByExternalContactId(qwExternalContactId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (contactInfo==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            contactInfo = new QwExternalContactInfo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            contactInfo.setExternalContactId(qwExternalContactId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            qwExternalContactInfoService.insertQwExternalContactInfo(contactInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok().put("moreInfo",contactInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @PostMapping("/updateQwUserInfo") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ApiOperation("更新企微用户信息") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R updateQwUserInfo(@RequestBody QwExternalContactInfo qwExternalContactInfo){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(qwExternalContactInfo.getExternalContactId() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new CustomException("企微外部联系人id不能为空!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        qwExternalContactInfoService.updateQwExternalContactInfoByExternalContactId(qwExternalContactInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @PostMapping("/course/watch") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ApiOperation("查询看课记录") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R queryCourseWatchStatistics(@RequestBody WatchCourseStatisticsParam param) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(param.getQwExternalContactId() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new CustomException("外部联系人id为空!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WatchCourseStatisticsDTO watchCourseStatisticsDTO = statisticsService.queryWatchCourse(param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok().put("data",watchCourseStatisticsDTO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @PostMapping("/getFsCourseListBySidebar") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ApiOperation("获取视频课程下拉列表 侧边栏") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R getFsCourseListBySidebar(@RequestBody FsCourseListBySidebarParam param) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        QwExternalContact externalContact = qwExternalContactService.getById(param.getExtId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        QwUser qwUser = qwUserService.selectQwUserById(externalContact.getQwUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (qwUser == null || qwUser.getCompanyId() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return R.error("员工未绑定 销售公司 或 未获取到员工信息,请重试!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        param.setCompanyId(qwUser.getCompanyId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        PageHelper.startPage(param.getPageNum(), param.getPageSize()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<FsCourseListBySidebarVO> fsCourseListBySidebar = fsUserCourseService.getFsCourseListBySidebar(param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        PageInfo<FsCourseListBySidebarVO> result = new PageInfo<>(fsCourseListBySidebar); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok().put("data", result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @PostMapping("/getFsCourseVideoListBySidebar") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ApiOperation("获取视频课程的课节下拉列表 侧边栏") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R getFsCourseVideoListBySidebar(@RequestBody FsCourseListBySidebarParam param) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (param.getCourseId()==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return R.error("课程id不能为空"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        PageHelper.startPage(param.getPageNum(), param.getPageSize()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<FsCourseVideoListBySidebarVO> videoListBySidebar = fsUserCourseVideoService.getFsCourseVideoListBySidebar(param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        PageInfo<FsCourseVideoListBySidebarVO> result = new PageInfo<>(videoListBySidebar); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok().put("data", result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |