|
@@ -230,6 +230,20 @@ public class RuralProjectRecordsService extends CrudService<RuralProjectRecordsD
|
|
|
* 获取项目附件模板类型
|
|
* 获取项目附件模板类型
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
|
|
+ public static List<MainDictDetail> attachmentTemplatePostList(){
|
|
|
|
|
+ List<MainDictDetail> attachmentTemplateList = Lists.newArrayList();
|
|
|
|
|
+ MainDictDetail detail = new MainDictDetail();
|
|
|
|
|
+ detail.setType("attachment_template_type");
|
|
|
|
|
+ detail.setValue("11");
|
|
|
|
|
+ detail.setLevel("成果文件");
|
|
|
|
|
+ attachmentTemplateList.add(detail);
|
|
|
|
|
+ return attachmentTemplateList;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取项目附件模板类型
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
public static List<MainDictDetail> attachmentTemplateListToCloud(){
|
|
public static List<MainDictDetail> attachmentTemplateListToCloud(){
|
|
|
return DictUtils.getMainDictListById("attachment_template_type");
|
|
return DictUtils.getMainDictListById("attachment_template_type");
|
|
|
}
|
|
}
|
|
@@ -6543,4 +6557,116 @@ public class RuralProjectRecordsService extends CrudService<RuralProjectRecordsD
|
|
|
}
|
|
}
|
|
|
return projectRecords;
|
|
return projectRecords;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据报告号下载项目的成果文件(仅作为api接口使用)
|
|
|
|
|
+ * @param reportNumberList
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public String exportProjectFileByReports(List<ExportProjectFileInfoInfo> reportNumberList){
|
|
|
|
|
+ //设置下载的压缩包名(固定字符+时间戳)
|
|
|
|
|
+ long timeMillis = System.currentTimeMillis();
|
|
|
|
|
+ String fileLocality = "项目附件_"+ timeMillis;
|
|
|
|
|
+ //判定当前系统
|
|
|
|
|
+ String path = null;
|
|
|
|
|
+ if(System.getProperty("os.name").toLowerCase().contains("win")){
|
|
|
|
|
+ path = Global.getConfig("remoteServer.winDirectory");
|
|
|
|
|
+ }else{
|
|
|
|
|
+ path = Global.getConfig("remoteServer.directory");
|
|
|
|
|
+ }
|
|
|
|
|
+ path = path + "/" + fileLocality;
|
|
|
|
|
+ //检查该路径对应的目录是否存在. 如果不存在则创建目录
|
|
|
|
|
+ File dir=new File(path);
|
|
|
|
|
+ if (!dir.exists()) {
|
|
|
|
|
+ dir.mkdirs();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ File resultFile = null;
|
|
|
|
|
+ File file = null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ //查询所有相关的项目信息
|
|
|
|
|
+ List<RuralProjectRecords> recordsList = dao.getInfoByReportList(reportNumberList);
|
|
|
|
|
+
|
|
|
|
|
+ for (RuralProjectRecords records : recordsList) {
|
|
|
|
|
+ ProjectAccessoryRelationInfo relateInfo = new ProjectAccessoryRelationInfo();
|
|
|
|
|
+
|
|
|
|
|
+ //添加项目类型
|
|
|
|
|
+ relateInfo.setAttachmentProjectType(records.getProjectType());
|
|
|
|
|
+ relateInfo.setAttachmentProjectSort(records.getAttachmentProjectSort());
|
|
|
|
|
+
|
|
|
|
|
+ //查看送审金额是否为500w以上金额
|
|
|
|
|
+ //Integer approvalMoney = projectAccessoryRelationService.decideAttachmentProjectApprovalMoney(projectReportData.getReviewFee());
|
|
|
|
|
+ //Integer approvalMoney = 2;
|
|
|
|
|
+ String money=records.getSubmitMoney();
|
|
|
|
|
+ Integer approvalMoney=null;
|
|
|
|
|
+ if(com.jeeplus.common.utils.StringUtils.isBlank(money)){
|
|
|
|
|
+ approvalMoney=1;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ approvalMoney=Integer.parseInt(money);
|
|
|
|
|
+ }
|
|
|
|
|
+ switch (approvalMoney){
|
|
|
|
|
+ case 0:
|
|
|
|
|
+ //金额为0
|
|
|
|
|
+ relateInfo.setAttachmentProjectApprovalMoney(null);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 1:
|
|
|
|
|
+ //500w以下金额状态
|
|
|
|
|
+ relateInfo.setAttachmentProjectApprovalMoney("1");
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 2:
|
|
|
|
|
+ //500w以上金额状态
|
|
|
|
|
+ relateInfo.setAttachmentProjectApprovalMoney("2");
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ //添加报告类型
|
|
|
|
|
+ relateInfo.setRequiredStage(1);
|
|
|
|
|
+ relateInfo.setId(records.getId());
|
|
|
|
|
+ //查询报告文件、依据性文件、其他文件必填列表以及数据
|
|
|
|
|
+ List<MainDictDetail> mainDictDetails = this.attachmentTemplatePostList();
|
|
|
|
|
+ List<ProjectTemplateInfo> projectTemplateList = null;
|
|
|
|
|
+ String downloadPath = path + "/" + records.getProjectReportNumber();
|
|
|
|
|
+ for (MainDictDetail mainDict : mainDictDetails) {
|
|
|
|
|
+ relateInfo.setAttachType(mainDict.getValue());
|
|
|
|
|
+ File dirFile = null;
|
|
|
|
|
+ switch (mainDict.getValue()) {
|
|
|
|
|
+ case "11":
|
|
|
|
|
+ dirFile=new File(downloadPath+"/成果文件");
|
|
|
|
|
+ projectTemplateList = Lists.newArrayList();
|
|
|
|
|
+ projectTemplateList = this.getProjectTemplateList(relateInfo);
|
|
|
|
|
+ this.disposeFileList(projectTemplateList,dirFile.getPath());
|
|
|
|
|
+ break;
|
|
|
|
|
+ /*case "12":
|
|
|
|
|
+ dirFile=new File(downloadPath+"/依据性资料");
|
|
|
|
|
+ projectTemplateList = Lists.newArrayList();
|
|
|
|
|
+ projectTemplateList = this.getProjectTemplateList(relateInfo);
|
|
|
|
|
+ this.disposeFileList(projectTemplateList,dirFile.getPath());
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "13":
|
|
|
|
|
+ dirFile=new File(downloadPath+"/其他文件");
|
|
|
|
|
+ projectTemplateList = Lists.newArrayList();
|
|
|
|
|
+ projectTemplateList = this.getProjectTemplateList(relateInfo);
|
|
|
|
|
+ this.disposeFileList(projectTemplateList,dirFile.getPath());
|
|
|
|
|
+ break;*/
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //处理完之后进行打包压缩并删除之前的文件
|
|
|
|
|
+ ZipCompressUtil zipUtil = new ZipCompressUtil();
|
|
|
|
|
+ resultFile = new File(path);
|
|
|
|
|
+ file = zipUtil.zipCompress(resultFile, true);
|
|
|
|
|
+
|
|
|
|
|
+ }catch (IOException e) {
|
|
|
|
|
+ logger.error("Exception e:"+e);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ throw new RuntimeException(e);
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ //路径是个文件且不为空时删除文件
|
|
|
|
|
+ if(resultFile.isFile()&&resultFile.exists()){
|
|
|
|
|
+ resultFile.delete();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return file.getPath();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|