Преглед на файлове

外部单位-文件上传预览及下载

sangwenwei преди 9 месеца
родител
ревизия
1f8ba21213

+ 6 - 0
src/main/java/com/jeeplus/modules/act/web/ActTaskController.java

@@ -237,6 +237,12 @@ public class ActTaskController extends BaseController {
 							}else if(r==null&&"wjbc".equals(role.getEnname())){
 								a.setRoleName("提资需求补充人");
 								a.setAssigneeName(user.getName());
+								Date updateDate = activityProcess.getUpdateDate();
+								Calendar calendar = Calendar.getInstance();
+								calendar.setTime(updateDate);
+								calendar.add(Calendar.SECOND, 10); // 增加10秒
+								Date newDate = calendar.getTime();
+								activityProcess.setUpdateDate(newDate);
 							}else if(r==null&&"yjfk".equals(role.getEnname())){
 								a.setRoleName("意见反馈人");
 								a.setAssigneeName(user.getName());

+ 8 - 0
src/main/java/com/jeeplus/modules/externalUnit/entity/ExternalUnitProjectRecords.java

@@ -49,9 +49,17 @@ public class ExternalUnitProjectRecords extends DataEntity<ExternalUnitProjectRe
      */
     private String fileName; //文件名
     private String fileSubmiter; //上传人
+    private String fileSubmiterName; //上传人
     private Date fileBeginDate;
     private Date fileEndDate;
 
+    public String getFileSubmiterName() {
+        return fileSubmiterName;
+    }
+
+    public void setFileSubmiterName(String fileSubmiterName) {
+        this.fileSubmiterName = fileSubmiterName;
+    }
 
     public String getFileName() {
         return fileName;

+ 1 - 0
src/main/java/com/jeeplus/modules/externalUnit/service/ExternalUnitCapitalDemandService.java

@@ -96,6 +96,7 @@ public class ExternalUnitCapitalDemandService extends CrudService<ExternalUnitCa
             workClientAttachment.setAttachmentFlag("160");
             workClientAttachment.setDivIdType("_exterProcess");
             List<WorkClientAttachment> attachmentList = workattachmentService.getAttachmentList(workClientAttachment);
+            workattachmentService.clientAttachmentManageOnUrl(attachmentList);
             capitalDemand.setWorkAttachments(attachmentList);
         }
         return capitalDemand;

+ 1 - 0
src/main/java/com/jeeplus/modules/externalUnit/service/ExternalUnitFeedbackService.java

@@ -90,6 +90,7 @@ public class ExternalUnitFeedbackService extends CrudService<ExternalUnitFeedbac
             workClientAttachment.setAttachmentFlag("160");
             workClientAttachment.setDivIdType("_exterFeedback");
             List<WorkClientAttachment> attachmentList = workattachmentService.getAttachmentList(workClientAttachment);
+            workattachmentService.clientAttachmentManageOnUrl(attachmentList);
             capitalDemand.setWorkAttachments(attachmentList);
             //审核人
             ArrayList<String> strings = new ArrayList<>();

+ 6 - 2
src/main/java/com/jeeplus/modules/externalUnit/service/ExternalUnitProjectRecordsService.java

@@ -176,6 +176,7 @@ public class ExternalUnitProjectRecordsService extends CrudService<ExternalUnitP
         workClientAttachment.setProjectId(projectRecords.getId());
         workClientAttachment.setAttachmentFlag("160");
         workClientAttachment.setAttachmentUser(projectRecords.getFileSubmiter());
+        workClientAttachment.setAttachmentUserName(projectRecords.getFileSubmiterName());
         workClientAttachment.setAttachmentName(projectRecords.getFileName());
         workClientAttachment.setBeginDate(projectRecords.getFileBeginDate());
         workClientAttachment.setEndDate(projectRecords.getFileEndDate());
@@ -183,7 +184,10 @@ public class ExternalUnitProjectRecordsService extends CrudService<ExternalUnitP
         page.setCount(count);
         page.setCountFlag(false);
         workClientAttachment.setPage(page);
-        List<WorkClientAttachment> attachmentList = workClientAttachmentDao.getFileList(workClientAttachment);
+        List<WorkClientAttachment> attachmentList = workattachmentService.getAttachmentListExter(workClientAttachment);
+
+        workattachmentService.clientAttachmentManageOnUrl(attachmentList);
+
         page.setList(attachmentList);
 
         return page;
@@ -198,7 +202,7 @@ public class ExternalUnitProjectRecordsService extends CrudService<ExternalUnitP
         workClientAttachment.setAttachmentId(projectRecords.getId());
         workClientAttachment.setAttachmentFlag("160");
         workClientAttachment.setDivIdType("_exterNoProcess");
-        List<WorkClientAttachment> attachmentList = workattachmentService.getAttachmentList(workClientAttachment);
+        List<WorkClientAttachment> attachmentList = workattachmentService.getAttachmentListExter(workClientAttachment);
         projectRecords.setWorkAttachments(attachmentList);
     }
 

+ 11 - 0
src/main/java/com/jeeplus/modules/externalUnit/web/ExternalUnitProjectRecordsController.java

@@ -220,6 +220,17 @@ public class ExternalUnitProjectRecordsController extends BaseController {
             externalUnitProjectRecords = unitProjectRecordsService.get(projectRecords.getId());
             model.addAttribute("projectRecords",externalUnitProjectRecords);
         }
+        //进行查询之后进行任何操作,返回还是查询之后的数据页面
+        if (StringUtils.isNotBlank(externalUnitProjectRecords.getToflag())){
+            request.getSession().removeAttribute("searchProjectRecord");
+            ExternalUnitProjectRecords search=externalUnitProjectRecords;
+            request.getSession().setAttribute("searchProjectRecord",search);
+        }else{
+            if (request.getSession().getAttribute("searchProjectRecord")!=null){
+                externalUnitProjectRecords= (ExternalUnitProjectRecords) request.getSession().getAttribute("searchProjectRecord");
+                model.addAttribute("searchProjectRecord", externalUnitProjectRecords);
+            }
+        }
         Page<WorkClientAttachment> page = unitProjectRecordsService.getProjectFile(new Page<WorkClientAttachment>(request, response),projectRecords);
 
         model.addAttribute("page", page);

+ 57 - 0
src/main/java/com/jeeplus/modules/sys/service/WorkattachmentService.java

@@ -495,6 +495,35 @@ public class WorkattachmentService extends CrudService<WorkattachmentDao, Workat
 	}
 
 	/**
+	 * 获取附件信息
+	 * @param workClientAttachment
+	 * @return
+	 */
+	public List<WorkClientAttachment> getAttachmentListExter(WorkClientAttachment workClientAttachment){
+		List<WorkClientAttachment> list = workClientAttachmentDao.getFileList(workClientAttachment);
+		CollectAccessoryInfo cAInfo = new CollectAccessoryInfo();
+		User loginUser = UserUtils.getUser();
+		if(StringUtils.isNotBlank(loginUser.getId())){
+			cAInfo.setOfficeId(loginUser.getOffice().getId());
+			cAInfo.setCompanyId(loginUser.getCompany().getId());
+			cAInfo.setCreateBy(loginUser);
+		}
+		//遍历附件信息,判定改附件信息是否被收藏
+		for (WorkClientAttachment info: list) {
+			cAInfo.setUrl(info.getUrl());
+			CollectAccessoryInfo collectAccessoryInfo = projectAccessoryDao.getCollectAccessoryInfo1(cAInfo);
+			if(null != collectAccessoryInfo){
+				info.setCollectFlag("1");
+			}else{
+				info.setCollectFlag("0");
+			}
+		}
+		//数据处理
+		workClientAttachmentManage(list);
+		return list;
+	}
+
+	/**
 	 * 项目获取附件信息
 	 * @param workClientAttachment
 	 * @return
@@ -639,6 +668,34 @@ public class WorkattachmentService extends CrudService<WorkattachmentDao, Workat
 		}
 	}
 
+	/**
+	 * 数据处理
+	 * @param list
+	 */
+	public static void workClientAttachmentExter(List<WorkClientAttachment> list){
+		ViewFileUtil viewFileUtil = new ViewFileUtil();
+		// 判断文件存储方式(0:本地服务器存储。1:云端存储)
+		for (WorkClientAttachment info : list) {
+			switch (uploadMode){
+				case "1":
+					info.setTemporaryUrl(bosUrl + info.getUrl());
+					break;
+				case "2":
+					info.setTemporaryUrl(aliyunUrl + info.getUrl());
+					break;
+				default:
+					//获取本地服务器ip和端口号
+					String serverIPAndPort = viewFileUtil.getServerIPAndPort();
+					//创建展示附件访问方法路径
+					//String methodAccessPath = "/a/viewFile/viewFile/getUploadFile?uploadFilePath=";
+					String methodAccessPath = "";
+					String newUrl = serverIPAndPort + methodAccessPath + info.getUrl();
+					//变更新的文件查看地址
+					info.setUrl(newUrl);
+					break;
+			}
+		}
+	}
 
 	/**
 	 * 数据处理

+ 9 - 0
src/main/java/com/jeeplus/modules/workclientinfo/entity/WorkClientAttachment.java

@@ -22,6 +22,7 @@ public class WorkClientAttachment extends DataEntity<WorkClientAttachment> {
 	private String url;		// 附件地址
 	private String type;		// 附件类型
 	private String attachmentUser;		// 上传人
+	private String attachmentUserName;		// 上传人
 	private String attachmentName;		// 文件名
 	private String attachmentId; //外联 客户编号
 	private List<String> attachmentIdList; //外联 客户编号
@@ -40,6 +41,14 @@ public class WorkClientAttachment extends DataEntity<WorkClientAttachment> {
 	private Date beginDate;
 	private Date endDate;
 
+	public String getAttachmentUserName() {
+		return attachmentUserName;
+	}
+
+	public void setAttachmentUserName(String attachmentUserName) {
+		this.attachmentUserName = attachmentUserName;
+	}
+
 	public Date getBeginDate() {
 		return beginDate;
 	}

+ 1 - 1
src/main/resources/mappings/modules/externalUnit/ExternalUnitProjectRecordsDao.xml

@@ -53,7 +53,7 @@
 				AND a.create_date &lt; #{endDate}
 			</if>
 			<if test="(createId != null and createId != '') or (createNameStr != null and createNameStr != '')">
-				AND (a.create_by = #{createId} or su.name = #{createNameStr})
+				AND (a.create_by = #{createId} or su.name LIKE concat('%',#{createNameStr},'%'))
 			</if>
 			<if test="officeId != null and officeId != ''">
 				AND so.id = #{officeId}

+ 5 - 5
src/main/resources/mappings/modules/workclientinfo/WorkClientAttachmentDao.xml

@@ -328,7 +328,7 @@
                 AND a.project_id = #{projectId}
             </if>
             <if test="attachmentFlag != null and attachmentFlag != ''">
-                AND attachment_flag = #{attachmentFlag}
+                AND a.attachment_flag = #{attachmentFlag}
             </if>
             <if test="attachmentName != null and attachmentName != ''">
                 AND a.attachment_name LIKE
@@ -336,14 +336,14 @@
                 <if test="dbName == 'mssql'">'%'+#{attachmentName}+'%'</if>
                 <if test="dbName == 'mysql'">concat('%',#{attachmentName},'%')</if>
             </if>
-            <if test="attachmentUser != null and attachmentUser != ''">
-                AND attachment_user = #{attachmentUser}
+            <if test="(attachmentUser != null and attachmentUser != '') or (attachmentUserName != null and attachmentUserName != '')">
+                AND (a.attachment_user = #{attachmentUser} or createBy.name LIKE concat('%',#{attachmentUserName},'%'))
             </if>
             <if test="divIdType != null and divIdType != ''">
-                AND div_id_type = #{divIdType}
+                AND a.div_id_type = #{divIdType}
             </if>
             <if test="projectId != null and projectId != ''">
-                and project_id = #{projectId}
+                and a.project_id = #{projectId}
             </if>
             <if test="beginDate !=null">
                 AND a.create_date >= #{beginDate}

+ 107 - 11
src/main/webapp/webpage/modules/externalUnit/externalUnitProjectFile.jsp

@@ -14,7 +14,9 @@
 
 	<link href="${ctxStatic}/bootstrap-select-1.12.4/css/bootstrap-select.min.css" rel="stylesheet" />
 	<style>
-
+		.layui-layer-btn1:hover{
+			color: #c2c2c2;
+		}
 		.list-form-tab li.current {
 			background-color: #007BFF; /* 蓝色背景 */
 			color: white; /* 白色字体 */
@@ -166,6 +168,7 @@
 				<form:form id="searchForm" modelAttribute="externalUnitProjectRecords" action="${ctx}/externalUnit/externalUnit/projectFile?id=${externalUnitProjectRecords.id}" method="post" class="form-inline">
 					<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
 					<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+					<input id="toflag" name="toflag" type="hidden" value="1"/>
 					<table:sortColumn id="orderBy" name="orderBy" value="${page.orderBy}" callback="sortOrRefresh();"/><!-- 支持排序 -->
 					<div class="commonQuery lw6">
 						<div class="layui-item query athird">
@@ -177,7 +180,8 @@
 						<div class="layui-item query athird ">
 							<label class="layui-form-label">提交人:</label>
 							<div class="layui-input-block">
-								<form:input path="fileSubmiter" htmlEscape="false" maxlength="255"  class=" form-control layui-input"/>
+								<sys:inquireselectUserNotReadolny id="create" name="fileSubmiter" value="${externalUnitProjectRecords.fileSubmiter}" labelName="fileSubmiterName" labelValue="${externalUnitProjectRecords.fileSubmiterName}"
+																  title="用户" url="/sys/office/treeDataAll?type=3" cssClass="form-control required layui-input" allowClear="true" notAllowSelectParent="true"/>
 							</div>
 						</div>
 						<div class="layui-item fr">
@@ -220,7 +224,91 @@
 					</div>
 					<div style="clear: both;"></div>
 				</div>
-				<table class="oa-table layui-table" id="contentTable1"></table>
+				<table id="listAttachment" class="table table-bordered table-condensed details">
+					<thead>
+					<tr>
+						<%-- <th>序号</th>--%>
+						<th width="25%">文件名称</th>
+						<th width="25%">文件类型</th>
+						<th width="25%">上传人</th>
+						<th width="25%">上传时间</th>
+						<th width="25%">备注</th>
+						<th width="25%">状态</th>
+						<th width="150px">操作</th>
+					</tr>
+					</thead>
+					<tbody id="file_attachment">
+					<c:forEach items="${page.list}" var = "workClientAttachment" varStatus="status">
+						<tr class="trIdAdds">
+								<%-- <td>${status.index + 1}</td>--%>
+							<c:choose>
+								<c:when test="${workClientAttachment.uploadMode == 2}">
+									<c:choose>
+										<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
+											<td><img src="${workClientAttachment.temporaryUrl}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.temporaryUrl}','90%','90%')" alt="${workClientAttachment.attachmentName}">
+										</c:when>
+										<c:otherwise>
+											<c:choose>
+												<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+													<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.temporaryUrl}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
+												</c:when>
+												<c:otherwise>
+													<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.temporaryUrl}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
+												</c:otherwise>
+											</c:choose>
+										</c:otherwise>
+									</c:choose>
+								</c:when>
+								<c:otherwise>
+									<c:choose>
+										<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
+                                                           or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
+											<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}">
+										</c:when>
+										<c:otherwise>
+											<c:choose>
+												<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+													<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
+												</c:when>
+												<c:otherwise>
+													<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
+												</c:otherwise>
+											</c:choose>
+										</c:otherwise>
+									</c:choose>
+								</c:otherwise>
+							</c:choose>
+							<td>${workClientAttachment.type}</td>
+
+							<td>${workClientAttachment.createBy.name}</td>
+							<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
+							<td>${workClientAttachment.remarks}</td>
+							<td>
+								<c:choose>
+									<c:when test="${workClientAttachment.divIdType == '_exterNoProcess'}">
+										<span>无流程</span>
+									</c:when>
+									<c:otherwise>
+										<a  onclick="openDialogView('流程追踪', '${ctx}/externalUnit/capitalDemand/getDemandProcess?id=${workClientAttachment.attachmentId}','95%','95%')">有流程</a>
+									</c:otherwise>
+								</c:choose>
+							</td>
+							<td class="op-td">
+								<div class="op-btn-box" >
+									<a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent('${workClientAttachment.url}');" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+								</div>
+							</td>
+						</tr>
+					</c:forEach>
+					</tbody>
+				</table>
 
 				<!-- 分页代码 -->
 				<table:page page="${page}"></table:page>
@@ -240,7 +328,13 @@
 			,cols: [[
 				// {checkbox: true, fixed: true},
 				{field:'index',align:'center', title: '序号',width:60}
-				,{field:'attachmentName',align:'center', title: '文件名称', minWidth:200}
+				,{field:'attachmentName',align:'center', title: '文件名称', minWidth:200,templet:function(d){
+						var url = d.temporaryUrl;
+						var className = d.attachmentName;
+						var onclick = (d.type === 'pdf') ? "preview('预览','"+url+"','90%','90%',1)" : "preview('预览','"+url+"','90%','90%')";
+						return '<a href="javascript:void(0)" class="attention-info" onclick="' + onclick + '">' + '<span title=' + d.attachmentName + '>' + d.attachmentName + '</span>' + '</a>';
+
+				}}
 				,{field:'type',align:'center', title: '文件类型', minWidth:100}
 				,{field:'createName', align:'center',title: '上传人', minWidth:80}
 				,{field:'createDate',align:'center', title: '上传时间', minWidth:80}
@@ -255,12 +349,13 @@
 
 					}}
 				,{field:'op', align:'center',title: '操作', minWidth:80,templet:function(d){
-					if (d.type == 'pdf')
-						var link = '<a href="' + d.temporaryUrl + '" target="_blank" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>';
-					else
-						var link = '<a href="'+ d.temporaryUrl +'" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>';
-
-						return link;
+						var baseUrl = '${ctx}/workfullmanage/workFullManage/downLoadAttach?file='; // 假设这是服务器端提供的下载基础 URL
+						var fileUrl = encodeURIComponent(d.temporaryUrl); // 使用 d.temporaryUrl 或默认 URL
+						if (d.type === 'pdf') {
+							return '<a href="' + d.temporaryUrl + '" target="_blank" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>';
+						} else {
+							return '<a href="' + baseUrl + fileUrl + '" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>';
+						}
 				}}
 			]]
 			,data: [
@@ -273,7 +368,8 @@
 					,"attachmentName":"${file.attachmentName}"
 					,"attachmentId":"${file.attachmentId}"
 					,"type":"${file.type}"
-					,"temporaryUrl":"${file.url}"
+					,"temporaryUrl":"${file.temporaryUrl}"
+					,"url":"${file.url}"
 					,"createName":"${file.createName}"
 					,"createDate":"<fmt:formatDate value="${file.createDate}" pattern="yyyy-MM-dd"/>"
 					,"status":

+ 1 - 1
src/main/webapp/webpage/modules/externalUnit/externalUnitProjectRecordsList.jsp

@@ -239,7 +239,7 @@
             ,elem: '#contentTable'
             ,page: false
             ,cols: [[
-                {field:'index',align:'center', title: '序号',width:40}
+                {field:'index',align:'center', title: '序号',minWidth:40}
                 ,{field:'name',align:'center', title: '项目名称',minWidth:150,templet:function(d){
                         var xml = "<a class=\"attention-info\" href=\"javascript:void(0);\" onclick=\"openDialogView('查看项目信息', '${ctx}/externalUnit/externalUnit/detail?id=" + d.id +"','95%','95%')\">" +
                             "<span title=" + d.name + ">" + d.name + "</span></a>";

+ 1 - 1
src/main/webapp/webpage/modules/externalUnit/feedbackFormView.jsp

@@ -140,7 +140,7 @@
 			</div>
 			<div class="form-group-label"><h2>文件管理</h2></div>
 			<div class="layui-item nav-btns">
-				<a id="attachment_btn_conciliationRecords" class="nav-btn nav-btn-add" title="上传文件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>
+<%--				<a id="attachment_btn_conciliationRecords" class="nav-btn nav-btn-add" title="上传文件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>--%>
 
 			</div>
 			<div id="addFile_exterFeedback" style="display: none" class="upload-progress">