下载日志监控代码提交
This commit is contained in:
parent
def4ea1f53
commit
e98a0d9987
Binary file not shown.
@ -1,6 +1,8 @@
|
|||||||
package com.actionsoft.apps.coe.pal;
|
package com.actionsoft.apps.coe.pal;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -45,6 +47,8 @@ import com.actionsoft.bpms.util.UUIDGener;
|
|||||||
import com.actionsoft.bpms.util.UtilString;
|
import com.actionsoft.bpms.util.UtilString;
|
||||||
import com.actionsoft.exception.ExceptionUtil;
|
import com.actionsoft.exception.ExceptionUtil;
|
||||||
import com.actionsoft.i18n.I18nRes;
|
import com.actionsoft.i18n.I18nRes;
|
||||||
|
import com.actionsoft.sdk.local.SDK;
|
||||||
|
import com.actionsoft.sdk.local.api.AppAPI;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
@ -2601,6 +2605,31 @@ public class CoEPALController {
|
|||||||
} else if ("control.policy".equals(methodId) ||"process.scheme".equals(methodId) || "engineering.standard".equals(methodId)) {
|
} else if ("control.policy".equals(methodId) ||"process.scheme".equals(methodId) || "engineering.standard".equals(methodId)) {
|
||||||
return PALRepositoryQueryAPIManager.getInstance().createOutputReportZd(wsId, me.getUID(), teamId, fileId);
|
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);
|
return PALRepositoryQueryAPIManager.getInstance().createOutputReportPr(wsId, me.getUID(), teamId, fileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -496,7 +496,7 @@ public class UpfileWeb extends ActionWeb {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
long times = System.currentTimeMillis();
|
long times = System.currentTimeMillis();
|
||||||
final String zipName = "批量下载"+ toolbarname + ".zip";
|
final String zipName = "批量下载"+ toolbarname.replace(">", "-")+ ".zip";
|
||||||
String targetDir = AWSServerConf.getProperty("dc.path") + File.separator + "com.actionsoft.apps.coe.pal" + File.separator + "tmp/grouppackage/zip" + times + "/";
|
String targetDir = AWSServerConf.getProperty("dc.path") + File.separator + "com.actionsoft.apps.coe.pal" + File.separator + "tmp/grouppackage/zip" + times + "/";
|
||||||
File targetFileDir = new File(targetDir);
|
File targetFileDir = new File(targetDir);
|
||||||
if (!targetFileDir.exists()) {
|
if (!targetFileDir.exists()) {
|
||||||
@ -637,7 +637,7 @@ public class UpfileWeb extends ActionWeb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UtilFile.zipCompress(targetDir, new File(targetDir + zipName));
|
UtilFile.zipCompress(targetDir, new File(targetDir + zipName.replace(">", "-")));
|
||||||
|
|
||||||
File[] files = targetFileDir.listFiles(new FilenameFilter()
|
File[] files = targetFileDir.listFiles(new FilenameFilter()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -648,6 +648,130 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 用户停留时间追踪器
|
||||||
|
const stayTimeTracker = {
|
||||||
|
totalStayTime: 0, // 总有效停留时间(秒)
|
||||||
|
intervalStartTime: 0, // 当前间隔开始时间戳
|
||||||
|
isActive: true, // 是否处于活跃状态
|
||||||
|
checkInterval: 5000, // 活动检查间隔(毫秒)
|
||||||
|
|
||||||
|
// 初始化
|
||||||
|
init() {
|
||||||
|
this.intervalStartTime = Date.now();
|
||||||
|
|
||||||
|
// 页面可见性变化监听
|
||||||
|
document.addEventListener('visibilitychange', () => {
|
||||||
|
if (document.hidden) {
|
||||||
|
this.pauseTracking();
|
||||||
|
} else {
|
||||||
|
this.resumeTracking();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 用户活动监听(鼠标移动、点击、滚动、键盘等)
|
||||||
|
const activityEvents = ['mousemove', 'click', 'scroll', 'keydown', 'touchstart'];
|
||||||
|
activityEvents.forEach(event => {
|
||||||
|
window.addEventListener(event, this.resetTimer.bind(this), { passive: true });
|
||||||
|
});
|
||||||
|
|
||||||
|
// 开始检查
|
||||||
|
this.startChecking();
|
||||||
|
|
||||||
|
// 页面卸载前保存数据
|
||||||
|
window.addEventListener('beforeunload', this.handleUnload.bind(this));
|
||||||
|
},
|
||||||
|
|
||||||
|
// 开始检查活动状态
|
||||||
|
startChecking() {
|
||||||
|
setInterval(() => {
|
||||||
|
if (!this.isActive) return;
|
||||||
|
|
||||||
|
const currentTime = Date.now();
|
||||||
|
const elapsedSeconds = Math.floor((currentTime - this.intervalStartTime) / 1000);
|
||||||
|
|
||||||
|
// 达到60秒有效间隔
|
||||||
|
if (elapsedSeconds >= 10) {
|
||||||
|
this.totalStayTime += 10;
|
||||||
|
//this.intervalStartTime = currentTime;
|
||||||
|
this.reportStayTime(10,this.intervalStartTime,currentTime,this.isActive);
|
||||||
|
}
|
||||||
|
}, this.checkInterval);
|
||||||
|
},
|
||||||
|
|
||||||
|
// 重置计时器(用户有活动时调用)
|
||||||
|
resetTimer() {
|
||||||
|
if (!this.isActive) {
|
||||||
|
this.resumeTracking();
|
||||||
|
}
|
||||||
|
this.intervalStartTime = Date.now();
|
||||||
|
},
|
||||||
|
|
||||||
|
// 暂停追踪
|
||||||
|
pauseTracking() {
|
||||||
|
this.isActive = false;
|
||||||
|
console.log('停留追踪已暂停');
|
||||||
|
},
|
||||||
|
|
||||||
|
// 恢复追踪
|
||||||
|
resumeTracking() {
|
||||||
|
this.isActive = true;
|
||||||
|
this.intervalStartTime = Date.now();
|
||||||
|
console.log('停留追踪已恢复');
|
||||||
|
},
|
||||||
|
|
||||||
|
// 报告停留时间
|
||||||
|
reportStayTime(duration,intervalStartTime,currentTime,isActive) {
|
||||||
|
console.log(`有效停留时间: ${duration}秒 | 总计: ${this.totalStayTime}秒 ${currentTime} ${intervalStartTime}`);
|
||||||
|
|
||||||
|
// 实际应用中这里发送数据到服务器
|
||||||
|
$.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+"&intervalStartTime="+intervalStartTime+"¤tTime="+currentTime+"&browserId="+browserId+"&isActive="+isActive,
|
||||||
|
success : function(msg) {
|
||||||
|
if (msg.result == "error") {
|
||||||
|
$.simpleAlert("删除失败", "error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
// 发送数据到服务器(使用sendBeacon确保页面关闭时也能发送)
|
||||||
|
sendToServer(duration,intervalStartTime,currentTime,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+"&intervalStartTime="+intervalStartTime+"¤tTime="+currentTime+"&browserId="+browserId+"&isActive="+isActive,
|
||||||
|
success : function(msg) {
|
||||||
|
if (msg.result == "error") {
|
||||||
|
$.simpleAlert("删除失败", "error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
// 页面卸载处理
|
||||||
|
handleUnload() {
|
||||||
|
// 如果有部分停留时间但不足60秒
|
||||||
|
const partialTime = Math.floor((Date.now() - this.intervalStartTime) / 1000);
|
||||||
|
if (partialTime > 0) {
|
||||||
|
console.log(`未完成间隔的停留时间: ${partialTime}秒`);
|
||||||
|
}
|
||||||
|
const currentTime = Date.now();
|
||||||
|
// 发送总停留时间
|
||||||
|
if (this.totalStayTime > 0) {
|
||||||
|
this.sendToServer(this.totalStayTime,this.intervalStartTime,currentTime,false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 启动追踪器
|
||||||
|
stayTimeTracker.init();
|
||||||
|
|
||||||
//初始化封面模板
|
//初始化封面模板
|
||||||
function initCoverTpl(){
|
function initCoverTpl(){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|||||||
@ -285,6 +285,7 @@ function loadFiles() { //加载附件,params参考引用
|
|||||||
$('#selfAccessoryTable').show();
|
$('#selfAccessoryTable').show();
|
||||||
var editable = parent.editable == "0" ? 0 : 1; //editable等于0,页面只读
|
var editable = parent.editable == "0" ? 0 : 1; //editable等于0,页面只读
|
||||||
for (var i = 0; i < list.length; i++) {
|
for (var i = 0; i < list.length; i++) {
|
||||||
|
debugger;
|
||||||
var obj = list[i];
|
var obj = list[i];
|
||||||
var downloadIcon = "";
|
var downloadIcon = "";
|
||||||
var deleteIcon = "";
|
var deleteIcon = "";
|
||||||
@ -292,7 +293,7 @@ function loadFiles() { //加载附件,params参考引用
|
|||||||
deleteIcon = ' <img src="../apps/com.actionsoft.apps.coe.pal/img/icon/pal_delete.png" onclick="delFile(\'' + obj.uuid + '\', \'' + obj.fileName + '\', loadFiles)" awsui-qtip="删除">';
|
deleteIcon = ' <img src="../apps/com.actionsoft.apps.coe.pal/img/icon/pal_delete.png" onclick="delFile(\'' + obj.uuid + '\', \'' + obj.fileName + '\', loadFiles)" awsui-qtip="删除">';
|
||||||
}
|
}
|
||||||
if (obj.download == 1 || obj.createUser == $("#userId").val()) {
|
if (obj.download == 1 || obj.createUser == $("#userId").val()) {
|
||||||
downloadIcon = ' <img src="../apps/com.actionsoft.apps.coe.pal/img/icon/pal_download.png" onclick="downloadFile(\'' + obj.url + '\')" awsui-qtip="下载">';
|
downloadIcon = ' <img src="../apps/com.actionsoft.apps.coe.pal/img/icon/pal_download.png" onclick="downloadFile(\'' + obj.url + '\',\''+obj.type+'\')" awsui-qtip="下载">';
|
||||||
}
|
}
|
||||||
accessoryHtml += '<tr>'
|
accessoryHtml += '<tr>'
|
||||||
+ ' <td><div awsui-qtip="hBordercolor:\'#108ee9\',text:\''+obj.fileName+'\',position:\'bottom\'" class="text_overflow" widthpercent="60" style="max-width: 302px;display: inline-block;">' + obj.fileName ;
|
+ ' <td><div awsui-qtip="hBordercolor:\'#108ee9\',text:\''+obj.fileName+'\',position:\'bottom\'" class="text_overflow" widthpercent="60" style="max-width: 302px;display: inline-block;">' + obj.fileName ;
|
||||||
@ -451,10 +452,46 @@ function delFileAll(callback) { //删除全部文件
|
|||||||
}
|
}
|
||||||
|
|
||||||
//下载附件
|
//下载附件
|
||||||
function downloadFile(url) {
|
function downloadFile(url,type) {
|
||||||
window.location.href = url;
|
window.location.href = url;
|
||||||
|
|
||||||
|
var downloadsource;
|
||||||
|
if(type=='s'){
|
||||||
|
downloadsource="数据属性";
|
||||||
|
}else{
|
||||||
|
downloadsource="文件属性";
|
||||||
|
}
|
||||||
|
var queryString = url.split('?')[1];
|
||||||
|
var params = new URLSearchParams(queryString);
|
||||||
|
var fileName = params.get('fileName');
|
||||||
|
var fileExtension = fileName.substring(fileName.lastIndexOf('.')+1);
|
||||||
|
var subFileName=fileName.substring(0,fileName.lastIndexOf("."));
|
||||||
|
|
||||||
|
var params = {
|
||||||
|
"modelId": pl_uuid,
|
||||||
|
"modelName": parent.fileName,
|
||||||
|
"downloadType": fileExtension,
|
||||||
|
"fileName":subFileName,
|
||||||
|
"recordSource": "PAL画布-下载附件",
|
||||||
|
"fileName":fileName.substring(0,fileName.lastIndexOf(".")),
|
||||||
|
"downloadsource": 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");
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//附件在线预览
|
//附件在线预览
|
||||||
function readFile(uuid) {
|
function readFile(uuid) {
|
||||||
$.simpleAlert("文件正在处理", "loading");
|
$.simpleAlert("文件正在处理", "loading");
|
||||||
|
|||||||
@ -318,7 +318,6 @@ $(function () {
|
|||||||
});
|
});
|
||||||
//导出手册
|
//导出手册
|
||||||
$("#export_file").off("click").on("click", function () {
|
$("#export_file").off("click").on("click", function () {
|
||||||
debugger;
|
|
||||||
menuSelected($(this));
|
menuSelected($(this));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -4403,7 +4403,6 @@ function outputReport() {
|
|||||||
palId: ruuid
|
palId: ruuid
|
||||||
},
|
},
|
||||||
success: function (r) {
|
success: function (r) {
|
||||||
debugger;
|
|
||||||
if (r.result == "ok") {
|
if (r.result == "ok") {
|
||||||
if(r.data.state == true){
|
if(r.data.state == true){
|
||||||
msg+="<br>您好,您的文件已超过"+r.data.maxFileLength+"M,导出时间可能大于3min,请您耐心等待"
|
msg+="<br>您好,您的文件已超过"+r.data.maxFileLength+"M,导出时间可能大于3min,请您耐心等待"
|
||||||
|
|||||||
@ -1761,11 +1761,49 @@ function downloadProcessFile(taskId) {
|
|||||||
success : function(msg) {
|
success : function(msg) {
|
||||||
if (msg.result == "ok") {
|
if (msg.result == "ok") {
|
||||||
window.location.href = msg.data.url;
|
window.location.href = msg.data.url;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var queryString = msg.data.url.split('?')[1];
|
||||||
|
var params = new URLSearchParams(queryString);
|
||||||
|
var fileName = params.get('fileName');
|
||||||
|
var fileExtension = fileName.substring(fileName.lastIndexOf('.')+1);
|
||||||
|
var subFileName=fileName.substring(0,fileName.lastIndexOf("."));
|
||||||
|
|
||||||
|
var params = {
|
||||||
|
"modelId": ruuid ,
|
||||||
|
"modelName": fileName,
|
||||||
|
"downloadType": fileExtension,
|
||||||
|
"fileName":subFileName,
|
||||||
|
"recordSource": "文件阅览-导出手册",
|
||||||
|
"fileName":fileName.substring(0,fileName.lastIndexOf(".")),
|
||||||
|
"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");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
$.simpleAlert("请确认是否已生成流程手册", 'info');
|
$.simpleAlert("请确认是否已生成流程手册", 'info');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1803,9 +1841,35 @@ function downloadZipFile(splitId,toolbarname) {
|
|||||||
success : function(msg) {
|
success : function(msg) {
|
||||||
if (msg.result == "ok") {
|
if (msg.result == "ok") {
|
||||||
window.location.href = msg.data.url;
|
window.location.href = msg.data.url;
|
||||||
|
|
||||||
|
|
||||||
|
//插入下载记录数据
|
||||||
|
var params = {
|
||||||
|
"modelId": ruuid,
|
||||||
|
"modelName":fileName,
|
||||||
|
"splitId": splitId,
|
||||||
|
}
|
||||||
|
jQuery.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "./jd?sid=" + encodeURIComponent(sid) + "&cmd=com.awspaas.user.apps.browsing_data.service.downloadRecordByFileRead",
|
||||||
|
data: params,
|
||||||
|
success: function(msg) {
|
||||||
|
$.simpleAlert("close");
|
||||||
|
|
||||||
|
},
|
||||||
|
err: function(msg) {
|
||||||
|
$.simpleAlert("close");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user