From 83ba69d69dcf76ff0aa5fc0ec0eb22b1a6d9e212 Mon Sep 17 00:00:00 2001 From: xinyb <574600396@qq.com> Date: 星期三, 30 十一月 2022 09:03:34 +0800 Subject: [PATCH] 附件次数查看功能 --- src/com/yc/service/upload/AttachmentOaImpl.java | 10 +- WebRoot/js/index/funcLink.js | 44 ++++------ src/com/yc/action/upload/AttachmentOA.java | 53 +++++++------ src/com/yc/service/upload/AttachmentPermissionImpl.java | 4 src/com/yc/entity/attachment/AttachmentOAParam.java | 3 WebRoot/js/bootstrap/fileinput/js/fileinput.js | 96 ++++++++++++++--------- 6 files changed, 114 insertions(+), 96 deletions(-) diff --git a/WebRoot/js/bootstrap/fileinput/js/fileinput.js b/WebRoot/js/bootstrap/fileinput/js/fileinput.js index e7839cf..a79cce7 100644 --- a/WebRoot/js/bootstrap/fileinput/js/fileinput.js +++ b/WebRoot/js/bootstrap/fileinput/js/fileinput.js @@ -2894,7 +2894,8 @@ sourceEvent: e, previewId: $modal.data('previewId'), modal: $modal, - viewerIndex:self.viewerIndex//鍥剧墖瀹氫綅鐢� xin 2022-9-30 15:11:58 + viewerIndex:self.viewerIndex,//鍥剧墖瀹氫綅鐢� xin 2022-9-30 15:11:58 + NumberofSummary:self.NumberofSummary }; }; $modal.on(event + '.bs.modal', function (e) { @@ -3067,7 +3068,7 @@ $btnTogh = $modal.find('.btn-kv-toggleheader'), dir = navigate === 'prev' ? 'Left' : 'Right', slideIn = 'slideIn' + dir, slideOut = 'slideOut' + dir, parsed, zoomData = $frame.data('zoom'), $search = $modal.find('.btn-kv-search'),$left = $modal.find('.btn-kv-left'),$right = $modal.find('.btn-kv-right'), - thumbsData = self.getFrames().toArray(); + thumbsData = self.getFrames().toArray(),NumberofSummary=self.NumberofSummary; if (zoomData) { zoomData = decodeURIComponent(zoomData); parsed = $zoomPreview.html().replace(self.zoomPlaceholder, '').setTokens({zoomData: zoomData}); @@ -3101,43 +3102,19 @@ } } body = body + '</ul>'; - }else{ - let json={}; - json.type = 'view'; - let image = $frame.data('key') || ''; - let i = image.split(";"); - if (i.length == 2) { - json.unid = i[0]; - json.seq = i[1]; - } - $.ajax({ - url: '/attachmentOa/getAllowOa.do', - type: 'POST', - data: JSON.stringify(json), - dataType: 'json', - contentType: 'application/json', - success: function (res) { - if (res != null && res.code == 0) { - let data = res.data; - $modal.find('.kv-zoom-caption').html(data.fileName); - $modal.find('.kv-zoom-caption').attr('title',data.fileName); - $modal.find('.viewsNumber').html(data.totaViewNums); - $modal.find('.downNumber').html(data.totaDownNums); - } else { - // modal.find('.kv-zoom-caption').html(''); - // modal.find('.kv-zoom-caption').attr('title',''); - $modal.find('.viewsNumber').html(0); - $modal.find('.downNumber').html(0); - } - // top.layer.closeAll(); - }, error: function (xmlHttpRequest, textStatus, errorThrown) { - layui.layer.alert(xmlHttpRequest.responseText); - } - }) } - //鏄剧ず娆℃暟 xin 2022-9-28 16:56:55锛堟殏鏃舵敞閲婏級 - // $modal.find('.viewsNumber').html(viewsNumber); - // $modal.find('.downNumber').html(downNumber); + if(NumberofSummary){ + let seq = $frame.data('key') || ''; + seq = seq.split(';')[1]; + for (let s = 0; s < NumberofSummary.length; s++) { + if (seq == NumberofSummary[s].seq) { + //鏄剧ず娆℃暟 xin 2022-9-28 16:56:55锛堟殏鏃舵敞閲婏級 + $modal.find('.viewsNumber').html(NumberofSummary[s].totaViewNums); + $modal.find('.downNumber').html(NumberofSummary[s].totaDownNums); + break; + } + } + } //鏍囬澶暱锛岄檺鍒舵樉绀�25涓� xin 2022-9-28 15:45:48 if(cap.length > 30){ logTitle=cap.substring(0,30)+'...'; @@ -3275,6 +3252,7 @@ } $h.initModal($modal); $h.setHtml($modal, self._getModalContent()); + self._zoomNumPreview();//鏇存柊娆℃暟 self._setZoomContent($frame); $modal.data({backdrop: false, fileinputPluginId: self.$element.attr('id')}); $modal.find('.kv-zoom-body').css('height', self.zoomModalHeight); @@ -3282,6 +3260,48 @@ self._initZoomButtons(); self._resizeZoomDialog(false);//鐩存帴鎵撳紑澶у浘 }, + _zoomNumPreview:function(){ + var self = this, thumbsData = self.getFrames().toArray(); + if (thumbsData) {//鏇存柊鎵撳紑鐨勯檮浠舵鏁� + let json = {}; + json.type = 'view'; + json.seqArray=[] + for(let t=0;t<thumbsData.length;t++){ + let image = $(thumbsData[t]).data('key') || ''; + let i = image.split(";"); + if (i.length == 2) { + json.unid = i[0]; + json.seqArray.push(i[1]); + } + } + $.ajax({ + url: '/attachmentOa/getAllowOa.do', + type: 'POST', + data: JSON.stringify(json), + dataType: 'json', + async: false, + contentType: 'application/json', + success: function (res) { + if (res != null && res.code == 0) { + self.NumberofSummary=res.data; + // $modal.find('.kv-zoom-caption').html(data.fileName); + // $modal.find('.kv-zoom-caption').attr('title',data.fileName); + // $modal.find('.viewsNumber').html(data.totaViewNums); + // $modal.find('.downNumber').html(data.totaDownNums); + } else { + self.NumberofSummary=null; + // modal.find('.kv-zoom-caption').html(''); + // modal.find('.kv-zoom-caption').attr('title',''); + // $modal.find('.viewsNumber').html(0); + // $modal.find('.downNumber').html(0); + } + // top.layer.closeAll(); + }, error: function (xmlHttpRequest, textStatus, errorThrown) { + layui.layer.alert(xmlHttpRequest.responseText); + } + }) + } + }, _zoomPreview: function ($btn) { var self = this, $frame; if (!$btn.length) { diff --git a/WebRoot/js/index/funcLink.js b/WebRoot/js/index/funcLink.js index 36def45..cf66aaa 100644 --- a/WebRoot/js/index/funcLink.js +++ b/WebRoot/js/index/funcLink.js @@ -100,6 +100,7 @@ e: $('#' + id + '_up'), id:$('#'+id), name:id, + NumberofSummary:[],//鏇存柊娆℃暟闆嗗悎 option: {//灞炴�� uploadUrl: '#', // String锛岀敤浜庝笂浼犲鐞嗘搷浣滅殑URL锛堥�氬父鏄熀浜嶢jax鐨勫鐞嗭級 uploadIdEvnt:$('#'+id), @@ -303,6 +304,7 @@ } }).on('filezoomshown', function(event, params) { //姝や簨浠跺湪妯℃�佸鐢ㄦ埛鍙鍚庤Е鍙戯紙灏嗙瓑寰� CSS 杞崲瀹屾垚锛� + Event.NumberofSummary=params.NumberofSummary||[]; Event.imageEvent(params); }).on('filezoomprev', function(event, params) { //浜嬩欢鍦ㄧ缉鏀鹃瑙堟ā寮忎笅锛屽綋鐐瑰嚮涓婁竴涓鑸寜閽煡鐪嬩笂涓�涓枃浠舵椂瑙﹀彂锛堜篃鍦ㄧ缉鏀炬ā寮忎笅鎸変笅閿洏宸︾澶存椂瑙﹀彂锛� @@ -335,40 +337,30 @@ isFileInputImage = null; } },imageAjax:function (modal,isfile) { - let j = {}; - j.type = 'view'; + let seq = 0; + let number = this.NumberofSummary; let image = isfile.image.currentSrc; let i = image.split("/"); i = i[i.length - 1]; let p = i.split('@p@'); if (p.length == 2) { - j.unid = p[0]; - j.seq = p[1].split('.')[0]; + seq = p[1].split('.')[0]; } - $.ajax({ - url: '/attachmentOa/getAllowOa.do', - type: 'POST', - data: JSON.stringify(j), - dataType: 'json', - contentType: 'application/json', - success: function (res) { - if (res != null && res.code == 0) { - let data = res.data; - modal.find('.kv-zoom-caption').html(data.fileName); - modal.find('.kv-zoom-caption').attr('title',data.fileName); - modal.find('.viewsNumber').html(data.totaViewNums); - modal.find('.downNumber').html(data.totaDownNums); - } else { - // modal.find('.kv-zoom-caption').html(''); - // modal.find('.kv-zoom-caption').attr('title',''); - modal.find('.viewsNumber').html(0); - modal.find('.downNumber').html(0); + if (number.length > 0) { + for (let s = 0; s < number.length; s++) { + if (seq == number[s].seq) { + if(number[s].state==-1){//娌℃湁鏌ョ湅娆℃暟鍚庨殣钘� + modal.find('.viewer-canvas').find('img').hide(); + modal.find('.viewer-canvas').html('<div style="visibility: visible;font-size: 30px;padding-top: 100px">'+number[s].describe+'</div>'); + } + modal.find('.kv-zoom-caption').html(number[s].fileName); + modal.find('.kv-zoom-caption').attr('title', number[s].fileName); + modal.find('.viewsNumber').html(number[s].totaViewNums); + modal.find('.downNumber').html(number[s].totaDownNums); + break; } - // top.layer.closeAll(); - }, error: function (xmlHttpRequest, textStatus, errorThrown) { - layui.layer.alert(xmlHttpRequest.responseText); } - }) + } } } return o; diff --git a/src/com/yc/action/upload/AttachmentOA.java b/src/com/yc/action/upload/AttachmentOA.java index bc200d0..c7549ab 100644 --- a/src/com/yc/action/upload/AttachmentOA.java +++ b/src/com/yc/action/upload/AttachmentOA.java @@ -209,7 +209,7 @@ public BackMsg getAttachmentAllow(@RequestBody AttachmentOAParam param, HttpServletRequest request) { BackMsg msg = new BackMsg(); try { - if (StringUtils.isBlank(param.getUnid()) || param.getSeq() == null || param.getSeq() == 0) { + if (StringUtils.isBlank(param.getUnid()) || param.getSeqArray().size() < 1) { msg.setFail("闄勪欢鐨勫弬鏁颁俊鎭笉鑳戒负绌�"); return msg; } @@ -218,25 +218,30 @@ } String dbId = (String) request.getSession().getAttribute(SessionKey.DATA_BASE_ID); SpObserver.setDBtoInstance("_" + dbId); - String memo = attachmentOaIfc.getAttachmentAllow(param); - if (StringUtils.isBlank(memo)) { - msg.setFail("鑾峰彇涓嶅埌闄勪欢鏇存柊鍐呭"); - return msg; + List<Map<String, Object>> list = new ArrayList<>(); + for (Integer seq : param.getSeqArray()) { + param.setSeq(seq); + String memo = attachmentOaIfc.getAttachmentAllow(param); + if (StringUtils.isBlank(memo)) { + continue; + } + String[] info = memo.split(";"); + if (info.length == 10) { + Map<String, Object> map = new HashMap<>(); + map.put("describe", info[0]); + map.put("state", info[1]); + map.put("viewNums", info[2]); + map.put("downNums", info[3]); + map.put("updateNums", info[4]); + map.put("totaViewNums", info[5]); + map.put("totaDownNums", info[6]); + map.put("totaUpdateNums", info[7]); + map.put("fileName", info[8]); + map.put("seq",info[9]); + list.add(map); + } } - String[] info = memo.split(";"); - if (info.length == 9) { - Map<String, Object> map = new HashMap<>(); - map.put("describe", info[0]); - map.put("state", info[1]); - map.put("viewNums", info[2]); - map.put("downNums", info[3]); - map.put("updateNums",info[4]); - map.put("totaViewNums", info[5]); - map.put("totaDownNums", info[6]); - map.put("totaUpdateNums", info[7]); - map.put("fileName", info[8]); - msg.setOk(map); - } + msg.setOk(list); } catch (Exception e) { msg.setFail(e.getCause() != null ? e.getCause().getMessage() : e.getMessage()); } finally { @@ -310,12 +315,12 @@ oaEntity.setHasUpdate(DBHelper.getValueInt(map1, "hasUpdate") == 1 ? true : false); oaEntity.setHasAuthor(DBHelper.getValueInt(map1, "hasAuthor") == 1 ? true : false); String star = DBHelper.getValue(map1, "startDate"); - oaEntity.setStartDate(StringUtils.isBlank(star) ? null : star.substring(0,19)); + oaEntity.setStartDate(StringUtils.isBlank(star) ? null : star.substring(0, 19)); String end = DBHelper.getValue(map1, "endDate"); - oaEntity.setEndDate(StringUtils.isBlank(end) ? null : end.substring(0,19)); - String dateFlag=DBHelper.getValue(map1,"dateFlag"); - if(StringUtils.isBlank(dateFlag)){ - dateFlag="2"; + oaEntity.setEndDate(StringUtils.isBlank(end) ? null : end.substring(0, 19)); + String dateFlag = DBHelper.getValue(map1, "dateFlag"); + if (StringUtils.isBlank(dateFlag)) { + dateFlag = "2"; } oaEntity.setDateFlag(Integer.parseInt(dateFlag)); oaEntity.setAllowViewNums(DBHelper.getValueInt(map1, "allowViewNums")); diff --git a/src/com/yc/entity/attachment/AttachmentOAParam.java b/src/com/yc/entity/attachment/AttachmentOAParam.java index 9e84a94..c738946 100644 --- a/src/com/yc/entity/attachment/AttachmentOAParam.java +++ b/src/com/yc/entity/attachment/AttachmentOAParam.java @@ -12,7 +12,8 @@ private String unid; private Integer seq; - private String type; + private List<Integer> seqArray; + private String type = "view"; private String userCode; private List<AttachmentOaEntity> oaEntities; diff --git a/src/com/yc/service/upload/AttachmentOaImpl.java b/src/com/yc/service/upload/AttachmentOaImpl.java index 08c1e9e..256d3e1 100644 --- a/src/com/yc/service/upload/AttachmentOaImpl.java +++ b/src/com/yc/service/upload/AttachmentOaImpl.java @@ -210,7 +210,7 @@ " begin\n" + " if @type='view'\n" + " begin\n" + - " if @authorCode <> @userCode and @allowViewNums <> 0 and @allowViewNums - @viewNums < 1 \n" + + " if @authorCode <> @userCode and @allowViewNums <> 0 and @allowViewNums <= @viewNums \n" + " begin\n" + "\t\t\t\t\t set @cont=0\n" + "\t\t\t\t\t set @memo='浣犲湪姝ら檮浠跺厑璁告煡鐪嬬殑娆℃暟宸茬粡鐢ㄥ畬;-1'\n" + @@ -225,7 +225,7 @@ " end\n" + " else if @type='down'\n" + " begin\n" + - " if @authorCode <> @userCode and @allowDownNums <> 0 and @allowDownNums - @downNums < 1 \n" + + " if @authorCode <> @userCode and @allowDownNums <> 0 and @allowDownNums <= @downNums \n" + " begin\n" + "\t\t\t\t\t set @cont=0\n" + "\t\t\t\t\t set @memo='浣犲湪姝ら檮浠跺厑璁镐笅杞界殑娆℃暟宸茬粡鐢ㄥ畬;-1'\n" + @@ -241,7 +241,7 @@ " end\n" + " else if @type='update'\n" + "\t begin\n" + - "\t\t if @authorCode <> @userCode and @allowUpdateNums <> 0 and @allowDownNums - @updateNums < 1 \n" + + "\t\t if @authorCode <> @userCode and @allowUpdateNums <> 0 and @allowDownNums <= @updateNums \n" + " begin\n" + "\t\t\t\t\t set @cont=0\n" + "\t\t\t\t\t set @memo='浣犲湪姝ら檮浠跺厑璁告洿鏂扮殑娆℃暟宸茬粡鐢ㄥ畬;-1'\n" + @@ -256,7 +256,7 @@ "\t end\n" + " else\n" + " begin\n" + - " set @memo='閿欒鎿嶄綔绫诲瀷;-1;0;0;0;0;0;0;'''\n" + + " set @memo='閿欒鎿嶄綔绫诲瀷;-1;0;0;0;0;0;0;'';0'\n" + " end \n" + " end\n" + "else\n" + @@ -307,7 +307,7 @@ "\t end\n" + " end\n" + " end\n" + - " set @memo=@memo+';'+convert (varchar(20),@totaViewnums)+';'+convert (varchar(20),@totaDownNums)+';'+convert (varchar(20),@totaUpdateNums)+';'+@fileName\n" + + " set @memo=@memo+';'+convert (varchar(20),@totaViewnums)+';'+convert (varchar(20),@totaDownNums)+';'+convert (varchar(20),@totaUpdateNums)+';'+@fileName+';'+convert(varchar(20),@seq)\n" + " end\n" + "select @memo as memo"; return jdbcTemplate.queryForObject(sql,String.class); diff --git a/src/com/yc/service/upload/AttachmentPermissionImpl.java b/src/com/yc/service/upload/AttachmentPermissionImpl.java index b447922..17953d5 100644 --- a/src/com/yc/service/upload/AttachmentPermissionImpl.java +++ b/src/com/yc/service/upload/AttachmentPermissionImpl.java @@ -70,7 +70,7 @@ + " where unid= @unid and seq = @seq and ISNULL(usercode,'')= @usercode ) \n " + " begin \n" + " select unid,seq,UserCode,UserName,HasView,HasDownload, \n" - + " HasDelete,HasUpdate,StartDate,EndDate,DateFlag,AllowDownnums,AllowViewNums, \n" + + " HasDelete,HasUpdate,StartDate,EndDate,DateFlag,AllowDownnums,AllowViewNums,viewnums,downnums, \n" + " @AllowMaxFileSize as AllowMaxFileSize,@AllowFileTypes as AllowFileTypes,AllowUpdateNums,@AuthorAllowDelete as AuthorAllowDelete,@AuthorAllowUpdate as AuthorAllowUpdate \n" + " from _sys_AttachmentPermission \n" + " where unid= @unid and seq = @seq and usercode= @usercode ; \n" @@ -80,7 +80,7 @@ + " 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,'9999-12-31',120) as StartDate,convert(datetime,'9999-12-31',120) as EndDate,\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, \n" + " @AllowMaxFileSize as AllowMaxFileSize,@AllowFileTypes as AllowFileTypes,@AuthorAllowDelete as AuthorAllowDelete,@AuthorAllowUpdate as AuthorAllowUpdate \n" + " return ; \n" -- Gitblit v1.8.0