Переглянути джерело

Merge remote-tracking branch 'origin/master'

user7 4 роки тому
батько
коміт
d03fb927ef

+ 17 - 0
src/main/java/com/jeeplus/modules/projectType/dao/ProjectResultsFileTemplateDao.java

@@ -5,6 +5,7 @@ import com.jeeplus.common.persistence.annotation.MyBatisDao;
 import com.jeeplus.modules.projectType.entity.ProjectTemplateType;
 import com.jeeplus.modules.projectType.entity.ProjectType;
 import com.jeeplus.modules.projectcontentinfo.entity.ProjectBasedData;
+import com.jeeplus.modules.projectcontentinfo.entity.ProjectContentTreeData;
 import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportTreeData;
 import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
 import org.apache.ibatis.annotations.Param;
@@ -73,4 +74,20 @@ public interface ProjectResultsFileTemplateDao  extends CrudDao<ProjectTemplateT
     List<WorkClientAttachment> getAttachmentByProjectTypeId(String attachmentId);
 
 
+    /**
+     * 根据父节点查询对应的附件信息
+     * @param typeId
+     * @return
+     */
+    List<WorkClientAttachment> getWorkClientAttachmentList(String typeId);
+
+
+    /**
+     * 根据类型获取对应的附件信息和基本信息
+     * @param typeId
+     * @return
+     */
+    List<ProjectContentTreeData> getTemplateForm(String typeId);
+
+
 }

+ 13 - 4
src/main/java/com/jeeplus/modules/projectType/service/ProjectResultsFileTemplateService.java

@@ -5,9 +5,8 @@ import com.jeeplus.common.service.CrudService;
 import com.jeeplus.common.utils.StringUtils;
 import com.jeeplus.modules.projectType.dao.ProjectResultsFileTemplateDao;
 import com.jeeplus.modules.projectType.entity.ProjectTemplateType;
-import com.jeeplus.modules.projectcontentinfo.entity.ProjectBasedData;
+import com.jeeplus.modules.projectcontentinfo.entity.ProjectContentTreeData;
 import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportTreeData;
-import com.jeeplus.modules.projectrecord.entity.ProjectRecords;
 import com.jeeplus.modules.sys.utils.UserUtils;
 import com.jeeplus.modules.workclientinfo.dao.WorkClientAttachmentDao;
 import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
@@ -132,7 +131,17 @@ public class ProjectResultsFileTemplateService  extends CrudService<ProjectResul
         return dao.getProjectType();
     }
 
-    public List<ProjectBasedData> getAccrdingDataList(String typeId){
-        return dao.getAccrdingDataList(typeId);
+
+    @Transactional(readOnly = false)
+    public List<WorkClientAttachment> getWorkClientAttachmentList(String typeId) {
+
+        return dao.getWorkClientAttachmentList(typeId);
+    }
+
+
+    @Transactional(readOnly = false)
+    public List<ProjectContentTreeData> getTemplateForm(String typeId) {
+        return dao.getTemplateForm(typeId);
     }
+
 }

+ 28 - 0
src/main/java/com/jeeplus/modules/projectcontentinfo/entity/ProjectContentTreeData.java

@@ -21,6 +21,10 @@ public class ProjectContentTreeData {
 
     private String loginId;//登陆者id
     private String createId;//创建者id
+    private String url;//下载链接
+    private Integer count;//总数
+
+    private String contentName;
 
     public String getId() {
         return id;
@@ -110,4 +114,28 @@ public class ProjectContentTreeData {
     public void setNum(String num) {
         this.num = num;
     }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public Integer getCount() {
+        return count;
+    }
+
+    public void setCount(Integer count) {
+        this.count = count;
+    }
+
+    public String getContentName() {
+        return contentName;
+    }
+
+    public void setContentName(String contentName) {
+        this.contentName = contentName;
+    }
 }

+ 25 - 0
src/main/java/com/jeeplus/modules/projectreportnum/web/ProjectReportNumController.java

@@ -11,6 +11,7 @@ import com.jeeplus.common.utils.*;
 import com.jeeplus.common.utils.excel.ExportExcel;
 import com.jeeplus.common.utils.excel.ImportExcel;
 import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.projectType.service.ProjectResultsFileTemplateService;
 import com.jeeplus.modules.projectcontentinfo.dao.ProjectReportDataDao;
 import com.jeeplus.modules.projectcontentinfo.entity.ProjectContentTreeData;
 import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportData;
@@ -24,6 +25,7 @@ import com.jeeplus.modules.sys.entity.MainDict;
 import com.jeeplus.modules.sys.entity.MainDictDetail;
 import com.jeeplus.modules.sys.utils.UserUtils;
 import com.jeeplus.modules.tools.utils.TwoDimensionCode;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
 import com.jeeplus.modules.workcontent.entity.WorkContentType;
 import freemarker.template.Configuration;
 import freemarker.template.Template;
@@ -54,6 +56,8 @@ public class ProjectReportNumController extends BaseController {
 	private ProjectReportDataDao projectReportDataDao;
 	@Autowired
     private ProjectRecordsService projectRecordsService;
+	@Autowired
+    private ProjectResultsFileTemplateService projectResultsFileTemplateService;
 
 
 	@RequestMapping(value = "skipMethod")
@@ -106,6 +110,15 @@ public class ProjectReportNumController extends BaseController {
 					if(treeData.getPid().equals("0")){
 						listNum.add(treeData);
 					}else{
+						String typeId = treeData.getNum().split("-")[1];
+						List<WorkClientAttachment> workClientAttachmentList = projectResultsFileTemplateService.getWorkClientAttachmentList(typeId);
+						if(null != workClientAttachmentList){
+							for (WorkClientAttachment workClientAttachment: workClientAttachmentList) {
+								treeData.setUrl(workClientAttachment.getUrl());
+							}
+							treeData.setCount(workClientAttachmentList.size());
+							treeData.setType(typeId);
+						}
 						listNum.add(treeData);
 					}
 				}
@@ -244,6 +257,18 @@ public class ProjectReportNumController extends BaseController {
 		return view;
 	}
 
+	/**
+	 * 跳转到选择下载页面
+	 */
+	@RequestMapping(value = "skipTemplateForm")
+	public String skipTemplateForm(ProjectContentTreeData treeData,Model model, HttpServletRequest request) {
+		List<ProjectContentTreeData> projectContentTreeDataList = projectResultsFileTemplateService.getTemplateForm(treeData.getType());
+		model.addAttribute("contentName",projectContentTreeDataList.get(0).getContentName());
+		model.addAttribute("num",treeData.getNum());
+		model.addAttribute("projectContentTreeData",projectContentTreeDataList);
+		return "modules/projectreportnum/projectTemplateFileForm";
+	}
+
 
 	/**
 	 * 保存记录

+ 30 - 0
src/main/resources/mappings/modules/projectType/ProjectResultsFileTemplateDao.xml

@@ -205,4 +205,34 @@
         where attachment_id = #{attachmentId}
 	</select>
 
+	<select id="getWorkClientAttachmentList" resultType="WorkClientAttachment">
+		select
+		a.id AS "id",
+        a.create_by AS "createBy.id",
+        a.create_date AS "createDate",
+        a.update_by AS "updateBy.id",
+        a.update_date AS "updateDate",
+        a.remarks AS "remarks",
+        a.del_flag AS "delFlag",
+        a.url AS "url",
+        a.type AS "type",
+        a.attachment_id AS "attachmentId",
+        a.attachment_user AS "attachmentUser",
+        a.attachment_name AS "attachmentName",
+        a.attachment_flag AS "attachmentFlag",
+        a.company_id AS "companyId"
+        from work_attachment a
+        where attachment_id in(
+			select b.id from project_template_type b where b.parent_id = #{parentId})
+	</select>
+
+	<select id="getTemplateForm" resultType="com.jeeplus.modules.projectcontentinfo.entity.ProjectContentTreeData">
+		select a.id as id,a.type_name as name,ap.type_name as contentName,b.url as url
+		from project_template_type a
+		left join work_attachment b on b. attachment_id = a.id
+		left join project_template_type ap on ap.type_id =a.parent_id
+		where a.parent_id = #{parentId}
+
+	</select>
+
 </mapper>

+ 17 - 3
src/main/webapp/webpage/modules/projectreportnum/projectReportNumList.jsp

@@ -128,9 +128,23 @@
 					"<a href=\"javascript:void(0)\" onclick=\"reportNumOnStage('阶段报告号新增','${ctx}/projectreportnum/projectReportNum/getProjectReportNumStageForm?num="+d.num+"&reportType=${reportType}&projectId=${projectId}&parentId="+d.id+"','70%', '50%');\" class=\"op-btn op-btn-edit\"><i class=\"fa fa-edit\"></i> 添加阶段报告号</a>"
 				].join('');
 			}else{
-				return[
-					"<a href=\"${ctx}/projectreportnum/projectReportNum/download?number=" +encodeURIComponent(encodeURIComponent( d.num ))+ "\"    class=\"op-btn op-btn-edit layui-bg-orange\"><i class=\"fa fa-edit\"></i> 生成报告模板</a>"
-				].join('');
+				if(d.count ==1){
+					return[
+						"<a href=\"${ctx}/workfullmanage/workFullManage/downLoadAttach?file=" +encodeURIComponent(encodeURIComponent( d.url ))+ "\"    class=\"op-btn op-btn-edit layui-bg-orange\"><i class=\"fa fa-edit\"></i> 生成报告模板</a>"
+						/*"<a href=\"${ctx}/projectreportnum/projectReportNum/download?number=" +encodeURIComponent(encodeURIComponent( d.num ))+ "\"    class=\"op-btn op-btn-edit layui-bg-orange\"><i class=\"fa fa-edit\"></i> 生成报告模板</a>"*/
+					].join('');
+				}else
+				if(d.count >1){
+					return[
+						"<a href=\"javascript:void(0)\" onclick=\"reportNumOnStage('选择报告模板','${ctx}/projectreportnum/projectReportNum/skipTemplateForm?num="+d.num+"&type="+d.type+"','80%', '80%');\" class=\"op-btn op-btn-edit layui-bg-orange\"><i class=\"fa fa-edit\"></i> 生成报告模板</a>"
+						/*"<a href=\"${ctx}/projectreportnum/projectReportNum/download?number=" +encodeURIComponent(encodeURIComponent( d.num ))+ "\"    class=\"op-btn op-btn-edit layui-bg-orange\"><i class=\"fa fa-edit\"></i> 生成报告模板</a>"*/
+					].join('');
+				}
+				else{
+					return[
+
+					].join('');
+				}
 			}
 		}
 	});

+ 106 - 0
src/main/webapp/webpage/modules/projectreportnum/projectTemplateFileForm.jsp

@@ -0,0 +1,106 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<html>
+<head>
+	<title>添加阶段报告</title>
+	<meta name="decorator" content="default"/>
+	<script type="text/javascript">
+
+		function doSubmit(){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
+		   var stageId=$("#stageId").val();
+		   if(stageId==null||stageId==""){
+               top.layer.msg('阶段信息不能为空!', {icon: 0});
+               return false;
+		   }
+			//$("#inputForm").submit();
+		  return true;
+		}
+        var validateForm;
+		$(document).ready(function() {
+		    if( $("#id").val()!=null&& $("#id").val()!=''){
+                $("#detailKey").attr("readonly",true);
+			}
+			validateForm = $("#inputFormAdd").validate({
+				submitHandler: function(form){
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function(error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+
+            $("#typeName").blur(function(){
+                var typeName = $(this).val();
+				if("achievement_type" == typeName || "supporting_document_data_type" == typeName){
+                    $("#achievementParentIdDiv").show();
+                }else{
+                    $("#achievementParentIdDiv").hide();
+                }
+            })
+
+            $("#typeName").blur(function(){
+                var reviewStandard = $(this).val();
+                if("reviewStandard" == reviewStandard){
+                    $("#reviewStandardParentIdDiv").show();
+                }else{
+                    $("#reviewStandardParentIdDiv").hide();
+                }
+            })
+		});
+	</script>
+</head>
+<body>
+<div class="single-form">
+	<div class="container view-form">
+		<form:form id="inputForm" modelAttribute="projectContentTreeData" action="${ctx}/projectreportnum/projectReportNum/saveReportNumOnStage" method="post" class="form-horizontal">
+			<input type="hidden" id="parentId" name="parentId" value="${reportNum.parentId}">
+			<input type="hidden" id="projectId" name="projectId" value="${reportNum.projectId}">
+		<sys:message content="${message}"/>
+			<div class="form-group layui-row first">
+				<div class="form-group-label"><h2>下载报告模板</h2></div>
+				<div class="layui-item layui-col-sm6"  style="width:50%">
+					<label class="layui-form-label double-line">阶段报告前缀:</label>
+					<div class="layui-input-block">
+						<input htmlEscape="false" name="num" readonly="true" class="form-control layui-input" value="${num}"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6"  style="width:50%">
+					<label class="layui-form-label">阶段:</label>
+					<div class="layui-input-block">
+						<input htmlEscape="false" name="num" readonly="true" class="form-control layui-input" value="${num}"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6"  style="width:50%">
+					<label class="layui-form-label">工作内容:</label>
+					<div class="layui-input-block">
+						<input htmlEscape="false" name="contentName" readonly="true" class="form-control layui-input" value="${contentName}"/>
+					</div>
+				</div>
+			</div>
+			<div class="form-group layui-row first">
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label"><span class="require-item">*</span>模板信息:</label>
+					<div class="layui-input-block">
+						<select name="url" class="form-control editable-select layui-input">
+							<option value=""></option>
+							<c:forEach items="${projectContentTreeData}" var="content">
+								<option value="${content.url}">
+										${content.name }
+								</option>
+							</c:forEach>
+						</select>
+					</div>
+				</div>
+			</div>
+		</form:form>
+	</div>
+</div>
+</body>
+</html>