From 8961170de80a173998d1bc790eab819b56d75f33 Mon Sep 17 00:00:00 2001
From: xinyb <574600396@qq.com>
Date: 星期四, 08 十二月 2022 10:12:49 +0800
Subject: [PATCH] 附件权限显示问题

---
 WebRoot/js/index/funcLink.js                            |   30 +++++++++++++++++++-----------
 src/com/yc/service/upload/AttachmentPermissionImpl.java |   30 +++++++++++++++++-------------
 2 files changed, 36 insertions(+), 24 deletions(-)

diff --git a/WebRoot/js/index/funcLink.js b/WebRoot/js/index/funcLink.js
index 38cbf23..877463e 100644
--- a/WebRoot/js/index/funcLink.js
+++ b/WebRoot/js/index/funcLink.js
@@ -480,19 +480,27 @@
                         jsons[i].unid + "@p@" + jsons[i].seq, jsons[i].domain, jsons[i].dbid,
                         false, 60, 60, jsons[i].orgFileType);
                     //鏂囦欢鏄剧ず淇℃伅
-                    let title = '鏂囦欢鍚�: ' + jsons[i].originalFileName +
-                        ' \n绫诲瀷: ' + jsons[i].fileType +
-                        ' \n澶у皬: ' + jsons[i].fileSizeStr +
-                        ' \n涓婁紶鑰�: ' + jsons[i].authorName +
-                        ' \n涓婁紶鏃堕棿: ' + jsons[i].uploadTimeStr +
-                        ' \n\n鎬绘煡鐪嬫鏁�: ' + jsons[i].totalViewNums +
-                        ' \n鎬讳笅杞芥鏁�: ' + jsons[i].totalDownNums;
+                    let title = '鏂囦欢鍚嶏細' + jsons[i].originalFileName +
+                        ' \n绫诲瀷锛�' + jsons[i].fileType +
+                        ' \n澶у皬锛�' + jsons[i].fileSizeStr +
+                        ' \n涓婁紶鑰咃細' + jsons[i].authorName +
+                        ' \n涓婁紶鏃堕棿锛�' + jsons[i].uploadTimeStr +
+                        ' \n\n鎬绘煡鐪嬫鏁帮細' + jsons[i].totalViewNums +
+                        ' \n鎬讳笅杞芥鏁帮細' + jsons[i].totalDownNums;
                         if(jsons[i].hasPermission){
                             title += ' \n\n涓婁紶鑰呫��' + jsons[i].authorName + '銆戞巿鏉冩偍锛�'
-                            title += ' \n鍏佽鏌ョ湅娆℃暟: ' + jsons[i].allowViewNums +
-                                ' \n鎮ㄥ凡鏌ョ湅: ' + jsons[i].viewNums + '\n';
-                            title += ' \n鍏佽涓嬭浇娆℃暟: ' + jsons[i].allowDownNums +
-                                ' \n鎮ㄥ凡涓嬭浇: ' + jsons[i].downNums;
+                            title += ' \n鍏佽鏌ョ湅娆℃暟锛�' + jsons[i].allowViewNums +
+                                ' \n鎮ㄥ凡鏌ョ湅锛�' + jsons[i].viewNums + '\n';
+                            title += ' \n鍏佽涓嬭浇娆℃暟锛�' + jsons[i].allowDownNums +
+                                ' \n鎮ㄥ凡涓嬭浇锛�' + jsons[i].downNums;
+                            let msg="鏃犳椂闂撮檺鍒�"
+                            if(jsons[i].dateFlag==0){
+                                msg="鍏佽璁块棶锛�"+jsons[i].startTime.split(" ")[1]+" ~ "+jsons[i].endTime.split(" ")[1];
+                            }
+                            if(jsons[i].dateFlag==1){
+                                msg="鍏佽璁块棶锛�"+jsons[i].startTime+" ~ "+jsons[i].endTime;
+                            }
+                            title +='\n\n'+msg;
                         }
                     //涓嬭浇鍦板潃
                     let Down = jsons[i].domain + "/attachment/downLoadAttachment.do?filePath=" +
diff --git a/src/com/yc/service/upload/AttachmentPermissionImpl.java b/src/com/yc/service/upload/AttachmentPermissionImpl.java
index 08fdfab..6f5c61b 100644
--- a/src/com/yc/service/upload/AttachmentPermissionImpl.java
+++ b/src/com/yc/service/upload/AttachmentPermissionImpl.java
@@ -48,22 +48,23 @@
 				+ " declare @unid varchar(100) ,@seq int ,@usercode varchar(50) \n"
 				+ " declare @formid int,@headflag int,@fieldid varchar(50),@AllowMaxFileSize int,@AllowFileTypes varchar(200) ; \n"
 				+ " declare @AuthorAllowDelete varchar(50),@AuthorAllowUpdate varchar(50);  \n"
-				+ " declare @AuthorCode varchar(50),@UserName varchar(50),@totalViewNums int = 0,@totalDownNums int = 0 ; \n"
+				+ " declare @AuthorCode varchar(50),@UserName varchar(50),@totalViewNums int = 0,@totalDownNums int = 0 ,@totalUpdateNums int = 0 ;\n"
 				+ " declare @readerUserCodes varchar(2000) ,@hasPermission int = 0;\n"
 				+ " select @unid = ? , @seq = ? ,@usercode = ? \n"
 				+ " select @formid = ?,@headflag = ?,@fieldid = ? \n"
 				+ " select @readerUserCodes = ? \n"
 				+ " select @AllowMaxFileSize = fileSize,@AllowFileTypes = FileType,@AuthorAllowDelete = authorallowdelete,@AuthorAllowUpdate = authorallowupdate \n"
 				+ " from _sys_AttachmentParameter where formid=@formid and headflag = @headflag and fieldid=@fieldid \n"
-				+ " select @AuthorCode = AuthorCode,@totalViewNums=viewNums,@totalDownNums=downNums from " + tableName + " where unid = @unid and seq = @seq \n"
+				+ " select @AuthorCode = AuthorCode,@totalViewNums=viewNums,@totalDownNums=downNums,@totalUpdateNums = updateNums from " + tableName + " where unid = @unid and seq = @seq \n"
 				+ " select @UserName  = UserName from _sys_loginuser where usercode = @usercode \n"
 				
 				+ " if isnull(@AuthorCode,'') = isnull(@usercode,'') \n"
 				+ " begin \n"
 				+ "    select @unid as unid,@seq as seq,@usercode as UserCode,@UserName as UserName,1 as HasView,1 as HasDownload, \n" 
 				+ "        1 as HasDelete,1 as HasUpdate,convert(datetime,'1901-01-01',120)  as StartDate,convert(datetime,'9999-12-31',120) as EndDate,\n"
-				+ "        2 as DateFlag,0 as AllowDownnums,0 as AllowViewNums,0 as AllowUpdateNums,@totalViewNums as totalViewNums,@totalDownNums as totalDownNums,  \n"
-				+ "        @AllowMaxFileSize as AllowMaxFileSize,@AllowFileTypes as AllowFileTypes,@AuthorAllowDelete as AuthorAllowDelete,@AuthorAllowUpdate as AuthorAllowUpdate,@hasPermission as hasPermission \n"
+				+ "        2 as DateFlag,0 as AllowDownnums,0 as AllowViewNums,0 as AllowUpdateNums,@hasPermission as hasPermission,\n " +
+				"          0 as viewnums,0 as downnums,@totalViewNums as totalViewNums,@totalDownNums as totalDownNums,@totalUpdateNums as totalUpdateNums, \n"
+				+ "        @AllowMaxFileSize as AllowMaxFileSize,@AllowFileTypes as AllowFileTypes,@AuthorAllowDelete as AuthorAllowDelete,@AuthorAllowUpdate as AuthorAllowUpdate\n"
 				+ "    return ; \n"
 				+ " end \n"
 				+ " if exists(select top 1 1 from _sys_AttachmentPermission  \n"
@@ -71,9 +72,9 @@
 				+ " begin \n"
 				+ "    set @hasPermission = 1 \n"//璁剧疆鏈夋潈闄� xin 2022-12-6 08:45:57
 				+ "    select unid,seq,UserCode,UserName,HasView,HasDownload, \n" 
-				+ "        HasDelete,HasUpdate,StartDate,EndDate,DateFlag,AllowDownnums,AllowViewNums,@hasPermission as hasPermission," +
-				"          viewnums,downnums,@totalViewNums as totalViewNums,@totalDownNums as totalDownNums, \n"
-				+ "        @AllowMaxFileSize as AllowMaxFileSize,@AllowFileTypes as AllowFileTypes,AllowUpdateNums,@AuthorAllowDelete as AuthorAllowDelete,@AuthorAllowUpdate as AuthorAllowUpdate \n"
+				+ "        HasDelete,HasUpdate,StartDate,EndDate,DateFlag,AllowDownnums,AllowViewNums,AllowUpdateNums,@hasPermission as hasPermission,\n" +
+				"          viewnums,downnums,@totalViewNums as totalViewNums,@totalDownNums as totalDownNums,@totalUpdateNums as totalUpdateNums,\n"
+				+ "        @AllowMaxFileSize as AllowMaxFileSize,@AllowFileTypes as AllowFileTypes,@AuthorAllowDelete as AuthorAllowDelete,@AuthorAllowUpdate as AuthorAllowUpdate \n"
 				+ "    from _sys_AttachmentPermission  \n" 
 				+ "    where unid= @unid and seq = @seq and usercode= @usercode ; \n"
 				+ "    return ;"
@@ -81,9 +82,10 @@
 				+ " if exists(select top 1 1 from _sys_AttachmentPermission  \n" 
 				+ "    where unid= @unid and seq = @seq and ISNULL(usercode,'') <> @usercode) \n "
 				+ " begin \n"
-				+ "    select @unid as unid,@seq as seq,@usercode as UserCode,@UserName as UserName,1 as HasView,0 as HasDownload, \n" 
-				+ "        0 as HasDelete,0 as HasUpdate,convert(datetime,'1901-01-01',120) as StartDate,convert(datetime,'9999-12-31',120) as EndDate,\n"
-				+ "        1 as DateFlag,0 as AllowDownnums,0 as AllowViewNums,0 as AllowUpdateNums, @totalViewNums as totalViewNums,@totalDownNums as totalDownNums,@hasPermission as hasPermission, \n"
+				+ "    select @unid as unid,@seq as seq,@usercode as UserCode,@UserName as UserName,1 as HasView,0 as HasDownload, \n"
+				+ "        0 as HasDelete,0 as HasUpdate,convert(datetime,'9999-12-31',120) as StartDate,convert(datetime,'9999-12-31',120) as EndDate,\n"
+				+ "        1 as DateFlag,0 as AllowDownnums,0 as AllowViewNums,0 as AllowUpdateNums, @hasPermission as hasPermission,\n " +
+				"          0 as viewnums,0 as downnums,@totalViewNums as totalViewNums,@totalDownNums as totalDownNums,@totalUpdateNums as totalUpdateNums,\n"
 				+ "        @AllowMaxFileSize as AllowMaxFileSize,@AllowFileTypes as AllowFileTypes,@AuthorAllowDelete as AuthorAllowDelete,@AuthorAllowUpdate as AuthorAllowUpdate \n"
 				+ "    return ;  \n"
 				+ " end \n"
@@ -94,14 +96,16 @@
 				+ " begin \n"
 				+ "    select @unid as unid,@seq as seq,@usercode as UserCode,@UserName as UserName,1 as HasView,1 as HasDownload, \n" 
 				+ "        1 as HasDelete,1 as HasUpdate,convert(datetime,'1901-01-01',120)  as StartDate,convert(datetime,'9999-12-31',120) as EndDate,\n"
-				+ "        2 as DateFlag,0 as AllowDownnums,0 as AllowViewNums,0 as AllowUpdateNums, @totalViewNums as totalViewNums,@totalDownNums as totalDownNums,@hasPermission as hasPermission, \n"
+				+ "        2 as DateFlag,0 as AllowDownnums,0 as AllowViewNums,0 as AllowUpdateNums,@hasPermission as hasPermission,\n " +
+				"          0 as viewnums,0 as downnums,@totalViewNums as totalViewNums,@totalDownNums as totalDownNums,@totalUpdateNums as totalUpdateNums, \n"
 				+ "        @AllowMaxFileSize as AllowMaxFileSize,@AllowFileTypes as AllowFileTypes,@AuthorAllowDelete as AuthorAllowDelete,@AuthorAllowUpdate as AuthorAllowUpdate \n"
 				+ "    return ; \n"				
 				+ " end else \n"
 				+ " begin \n"
 				+ "    select @unid as unid,@seq as seq,@usercode as UserCode,@UserName as UserName,1 as HasView,0 as HasDownload, \n" 
-				+ "        0 as HasDelete,0 as HasUpdate,convert(datetime,'1901-01-01',120) as StartDate,convert(datetime,'9999-12-31',120) as EndDate, \n"
-				+ "        2 as DateFlag,0 as AllowDownnums,0 as AllowViewNums,0 as AllowUpdateNums, @totalViewNums as totalViewNums,@totalDownNums as totalDownNums,@hasPermission as hasPermission, \n"
+				+ "        0 as HasDelete,0 as HasUpdate,convert(datetime,'9999-12-31',120) as StartDate,convert(datetime,'9999-12-31',120) as EndDate, \n"
+				+ "        1 as DateFlag,0 as AllowDownnums,0 as AllowViewNums,0 as AllowUpdateNums, @hasPermission as hasPermission,\n " +
+				"          0 as viewnums,0 as downnums,@totalViewNums as totalViewNums,@totalDownNums as totalDownNums,@totalUpdateNums as totalUpdateNums,  \n"
 				+ "        @AllowMaxFileSize as AllowMaxFileSize,@AllowFileTypes as AllowFileTypes,@AuthorAllowDelete as AuthorAllowDelete,@AuthorAllowUpdate as AuthorAllowUpdate \n"
 				+ "    return ;  \n"
 				+ " end \n";

--
Gitblit v1.8.0