去掉文件只读页面下载监控方法|去掉画布导出手册下载监控方法|增加报告生成器下载监听方法|处理报告生成器获取错误文件id导致手册生成失败问题
This commit is contained in:
		
							parent
							
								
									870bcac328
								
							
						
					
					
						commit
						6d41e99643
					
				
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -2607,30 +2607,6 @@ public class CoEPALController { | ||||
|  			return PALRepositoryQueryAPIManager.getInstance().createOutputReportZd(wsId, me.getUID(), teamId, fileId); | ||||
| 		} | ||||
| 
 | ||||
| 
 | ||||
| 		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||||
| 		String nowDate=sdf.format(new Date()); | ||||
| 		// 调用App | ||||
| 		String sourceAppId = "com.awspaas.user.apps.browsing_data"; | ||||
| 		// aslp服务地址 | ||||
| 		String aslp = "aslp://com.awspaas.user.apps.browsing_data/RecordDownloadAlsp"; | ||||
| 		// 参数定义列表 | ||||
| 		Map alspparams = new HashMap<String, Object>(); | ||||
| 		alspparams.put("sid", me.getSessionId()); | ||||
| 		alspparams.put("uid", me.getUID()); | ||||
| 		alspparams.put("username", me.getUserName()); | ||||
| 		alspparams.put("modelId", fileId); | ||||
| 		alspparams.put("modelName", model.getName()); | ||||
| 		alspparams.put("downloadTime", nowDate); | ||||
| 		alspparams.put("fileName", model.getName()); | ||||
| 		alspparams.put("downloadType", "doc"); | ||||
| 		alspparams.put("recordSource", "PAL画布-导出手册"); | ||||
| 		alspparams.put("downloadsource", "PAL画布"); | ||||
| 		AppAPI appAPI = SDK.getAppAPI(); | ||||
| 		//根据上传的文件进行更新相关的excel或者ppt | ||||
| 		ResponseObject alsp_ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, alspparams); | ||||
| 
 | ||||
| 
 | ||||
| 		return PALRepositoryQueryAPIManager.getInstance().createOutputReportPr(wsId, me.getUID(), teamId, fileId); | ||||
| 	} | ||||
| 
 | ||||
|  | ||||
| @ -3155,6 +3155,7 @@ public class OutputWordUtil { | ||||
|     public static void mergeMRWord(String filePath, String uuid,JSONObject dataMap) { | ||||
|          Map<String, JSONObject> stringJSONObjectMap = PALRepositoryQueryAPIManager.queryRepositoryAttributeById(uuid); | ||||
|         JSONObject attrJson = stringJSONObjectMap.get("management_requirements_Location"); | ||||
| 
 | ||||
|         String text = attrJson.getString("text"); | ||||
|         if ("不显示管理要求".equals(text)) { | ||||
|             return; | ||||
|  | ||||
| @ -289,153 +289,7 @@ | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
|         //判断如果当前页面有编辑权进行记录操作 | ||||
|         if($('#checkoutTip').css('display') != 'block'){ | ||||
| 
 | ||||
|             // 页面停留时间统计 | ||||
|             class PageStayTimeTracker { | ||||
|                 constructor() { | ||||
|                     this.startTime = null; | ||||
|                     this.lastReportTime = null; | ||||
|                     this.reportInterval = 10000; // 60秒报告一次 | ||||
|                     this.isActive = false; | ||||
|                     this.isPageVisible = true; // 默认页面是可见的 | ||||
|                     this.visibilityBound = false; // 是否已绑定可见性事件 | ||||
|                 } | ||||
| 
 | ||||
| 
 | ||||
|                 // 延迟绑定可见性事件 | ||||
|                 bindVisibilityEvents() { | ||||
|                     if (this.visibilityBound) return; | ||||
| 
 | ||||
|                     document.addEventListener('visibilitychange', this.handleVisibilityChange.bind(this)); | ||||
|                     this.visibilityBound = true; | ||||
| 
 | ||||
|                     // 初始检查页面可见状态 | ||||
|                     this.isPageVisible = !document.hidden; | ||||
|                     if (!this.isPageVisible) { | ||||
|                         this.lastReportTime = new Date(); // 更新最后记录时间 | ||||
|                     } | ||||
|                 } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|                 // 开始跟踪 | ||||
|                 startTracking() { | ||||
|                     if (this.isActive) return; | ||||
| 
 | ||||
|                     this.startTime = new Date(); | ||||
|                     this.lastReportTime = this.startTime; | ||||
|                     this.isActive = true; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|                     // 设置定时器 | ||||
|                     this.intervalId = setInterval(() => { | ||||
|                         if (this.isPageVisible) { | ||||
|                             this.reportStayTime(); | ||||
|                         } | ||||
|                     }, this.reportInterval); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|                     // 页面卸载前发送剩余时间 | ||||
|                     window.addEventListener('beforeunload', this.finalReport.bind(this)); | ||||
| 
 | ||||
| 
 | ||||
|                     // 延迟绑定可见性事件(在用户首次交互后) | ||||
|                     const bindOnInteraction = () => { | ||||
|                         this.bindVisibilityEvents(); | ||||
|                         // 移除所有交互监听器 | ||||
|                         ['click', 'scroll', 'keydown', 'mousemove', 'touchstart'].forEach(event => { | ||||
|                             window.removeEventListener(event, bindOnInteraction); | ||||
|                         }); | ||||
|                     }; | ||||
| 
 | ||||
|                     // 添加多种交互监听 | ||||
|                     ['click', 'scroll', 'keydown', 'mousemove', 'touchstart'].forEach(event => { | ||||
|                         window.addEventListener(event, bindOnInteraction, { once: true }); | ||||
|                     }); | ||||
| 
 | ||||
| 
 | ||||
|                 } | ||||
| 
 | ||||
|                 // 报告停留时间 | ||||
|                 reportStayTime() { | ||||
|                     const now = new Date(); | ||||
|                     const elapsed = now - this.lastReportTime; | ||||
|                     this.totalStayTime += elapsed; | ||||
|                     this.lastReportTime = now; | ||||
| 
 | ||||
|                     this.sendStayTimeToServer(elapsed, true); | ||||
|                 } | ||||
| 
 | ||||
|                 // 最终报告 | ||||
|                 finalReport() { | ||||
|                     if (!this.isActive) return; | ||||
|                     if (this.isPageVisible) { | ||||
|                         const now = new Date(); | ||||
|                         const elapsed = now - this.lastReportTime; | ||||
|                     } | ||||
| 
 | ||||
| 
 | ||||
|                     this.sendStayTimeToServer(elapsed, false); | ||||
|                     this.cleanUp(); | ||||
|                 } | ||||
| 
 | ||||
|                 // 处理页面可见性变化 | ||||
|                 handleVisibilityChange() { | ||||
|                     var now = new Date(); | ||||
|                     if (document.hidden) { | ||||
|                         if (this.isPageVisible) { | ||||
|                             this.isPageVisible = false; | ||||
|                             // 页面不可见,暂停计时 | ||||
|                             const now = new Date(); | ||||
|                             const elapsed = now - this.lastReportTime; | ||||
|                             this.totalStayTime += elapsed; | ||||
|                             this.sendStayTimeToServer(elapsed, false); | ||||
|                             clearInterval(this.intervalId); | ||||
|                         } | ||||
| 
 | ||||
|                     } else { | ||||
|                         // 页面恢复可见 | ||||
|                         if (!this.isPageVisible) { | ||||
|                             this.lastReportTime = now; // 重置最后记录时间 | ||||
|                         } | ||||
|                         this.isPageVisible = true; | ||||
| 
 | ||||
|                     } | ||||
|                 } | ||||
| 
 | ||||
|                 // 发送数据到服务器 | ||||
|                 sendStayTimeToServer(elapsedMs,isActive) { | ||||
|                     $.ajax({ | ||||
|                         type : "POST", | ||||
|                         url : "./w?sid=" + encodeURIComponent($('#sid').val()) + "&cmd=com.awspaas.user.apps.browsing_data.service.insertReadingLog", | ||||
|                         data : "userId="+userId+"&userName="+userName+"&ruuid="+ruuid+"&fileName="+fileName+"&startTime="+new Date(this.startTime).getTime()+"¤tTime="+new Date().getTime()+"&browserId="+browserId+"&isActive="+isActive, | ||||
|                         success : function(msg) { | ||||
|                             if (msg.result == "error") { | ||||
|                                 $.simpleAlert("新增失败", "error"); | ||||
|                             } | ||||
|                         } | ||||
|                     }); | ||||
| 
 | ||||
|                 } | ||||
| 
 | ||||
|                 // 清理资源 | ||||
|                 cleanUp() { | ||||
|                     clearInterval(this.intervalId); | ||||
|                     document.removeEventListener('visibilitychange', this.handleVisibilityChange); | ||||
|                     window.removeEventListener('beforeunload', this.finalReport); | ||||
|                     this.isActive = false; | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             // 使用示例 | ||||
|             const tracker = new PageStayTimeTracker(); | ||||
|             tracker.startTracking(); | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         // 导出流程手册 | ||||
|         function outputProcess() { | ||||
|  | ||||
| @ -454,7 +454,6 @@ function delFileAll(callback) { //删除全部文件 | ||||
| //下载附件
 | ||||
| function downloadFile(url,type) { | ||||
| 	window.location.href = url; | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -267,8 +267,31 @@ var OutputReportWizard = { | ||||
| 				} | ||||
| 				tempArr.push(tempObj); | ||||
| 			} else { | ||||
| 				if(fileTreeArr[index].isParent==false){ | ||||
| 					var params = { | ||||
| 						"modelId": fileTreeArr[index].id, | ||||
| 						"modelName":fileTreeArr[index].name.replace(/(已发布)$/, ''), | ||||
| 						"downloadType": "doc", | ||||
| 						"fileName":fileTreeArr[index].name.replace(/(已发布)$/, ''), | ||||
| 						"recordSource": "报告生成器-手册下载", | ||||
| 						"downloadsource": "报告生成器下载" | ||||
| 					} | ||||
| 					jQuery.ajax({ | ||||
| 						type: "POST", | ||||
| 						url: "./jd?sid=" + encodeURIComponent(sid) + "&cmd=com.awspaas.user.apps.browsing_data.service.downloadRecord", | ||||
| 						data: params, | ||||
| 						success: function(msg) { | ||||
| 							$.simpleAlert("close"); | ||||
| 
 | ||||
| 						}, | ||||
| 						err: function(msg) { | ||||
| 							$.simpleAlert("close"); | ||||
| 						} | ||||
| 					}); | ||||
| 					targetFileId += "," + fileTreeArr[index].id; | ||||
| 				} | ||||
| 
 | ||||
| 			} | ||||
| 		} | ||||
| 		if (tempArr.length > 0) { | ||||
| 			targetFileId = JSON.stringify(tempArr); | ||||
| @ -307,7 +330,6 @@ var OutputReportWizard = { | ||||
| 			data : params, | ||||
| 			type : "post", | ||||
| 			success : function(msg) { | ||||
| 				debugger; | ||||
| 				$.simpleAlert('close'); | ||||
| 				if (msg.result == "ok") { | ||||
| 					OutputReportWizard.isModify = false; | ||||
|  | ||||
| @ -61,7 +61,7 @@ public class DownloadRecordService extends ActionWeb | ||||
|         alspparams.put("recordSource", params.get("recordSource")); | ||||
|         alspparams.put("downloadsource", params.get("downloadsource")); | ||||
|         AppAPI appAPI = SDK.getAppAPI(); | ||||
|         //根据上传的文件进行更新相关的excel或者ppt | ||||
| 
 | ||||
|         ResponseObject alsp_ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, alspparams); | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user