|
@@ -4,18 +4,25 @@
|
|
package com.jeeplus.modules.projectcontentinfo.service;
|
|
package com.jeeplus.modules.projectcontentinfo.service;
|
|
|
|
|
|
import com.google.common.collect.Maps;
|
|
import com.google.common.collect.Maps;
|
|
|
|
+import com.jeeplus.common.bos.BosController;
|
|
|
|
+import com.jeeplus.common.config.Global;
|
|
import com.jeeplus.common.persistence.Page;
|
|
import com.jeeplus.common.persistence.Page;
|
|
import com.jeeplus.common.service.CrudService;
|
|
import com.jeeplus.common.service.CrudService;
|
|
|
|
+import com.jeeplus.common.utils.FreemarkerUtil;
|
|
import com.jeeplus.common.utils.MenuStatusEnum;
|
|
import com.jeeplus.common.utils.MenuStatusEnum;
|
|
|
|
+import com.jeeplus.common.utils.ResponseUtil;
|
|
import com.jeeplus.common.utils.StringUtils;
|
|
import com.jeeplus.common.utils.StringUtils;
|
|
import com.jeeplus.modules.act.entity.Act;
|
|
import com.jeeplus.modules.act.entity.Act;
|
|
import com.jeeplus.modules.act.service.ActTaskService;
|
|
import com.jeeplus.modules.act.service.ActTaskService;
|
|
|
|
+import com.jeeplus.modules.projectAccessory.dao.ProjectTemplateDao;
|
|
|
|
+import com.jeeplus.modules.projectAccessory.entity.ProjectTemplateInfo;
|
|
import com.jeeplus.modules.projectcontentinfo.dao.ProjectReportRecordDao;
|
|
import com.jeeplus.modules.projectcontentinfo.dao.ProjectReportRecordDao;
|
|
import com.jeeplus.modules.projectcontentinfo.entity.ProjectMaterialDefectRecord;
|
|
import com.jeeplus.modules.projectcontentinfo.entity.ProjectMaterialDefectRecord;
|
|
import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportData;
|
|
import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportData;
|
|
import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportRecord;
|
|
import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportRecord;
|
|
import com.jeeplus.modules.ruralprojectrecords.dao.RuralProjectMessageDao;
|
|
import com.jeeplus.modules.ruralprojectrecords.dao.RuralProjectMessageDao;
|
|
import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords;
|
|
import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords;
|
|
|
|
+import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectcontentinfo;
|
|
import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectMessageService;
|
|
import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectMessageService;
|
|
import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectRecordsService;
|
|
import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectRecordsService;
|
|
import com.jeeplus.modules.sys.dao.WorkattachmentDao;
|
|
import com.jeeplus.modules.sys.dao.WorkattachmentDao;
|
|
@@ -24,6 +31,7 @@ import com.jeeplus.modules.sys.entity.User;
|
|
import com.jeeplus.modules.sys.entity.Workattachment;
|
|
import com.jeeplus.modules.sys.entity.Workattachment;
|
|
import com.jeeplus.modules.sys.service.WorkattachmentService;
|
|
import com.jeeplus.modules.sys.service.WorkattachmentService;
|
|
import com.jeeplus.modules.sys.utils.UserUtils;
|
|
import com.jeeplus.modules.sys.utils.UserUtils;
|
|
|
|
+import com.jeeplus.modules.utils.SftpClientUtil;
|
|
import com.jeeplus.modules.workactivity.dao.WorkActivityProcessDao;
|
|
import com.jeeplus.modules.workactivity.dao.WorkActivityProcessDao;
|
|
import com.jeeplus.modules.workactivity.entity.Activity;
|
|
import com.jeeplus.modules.workactivity.entity.Activity;
|
|
import com.jeeplus.modules.workactivity.entity.WorkActivityProcess;
|
|
import com.jeeplus.modules.workactivity.entity.WorkActivityProcess;
|
|
@@ -31,16 +39,27 @@ import com.jeeplus.modules.workactivity.service.ActivityService;
|
|
import com.jeeplus.modules.workactivity.service.WorkActivityProcessService;
|
|
import com.jeeplus.modules.workactivity.service.WorkActivityProcessService;
|
|
import com.jeeplus.modules.workactivitymenu.entity.WorkActivityMenu;
|
|
import com.jeeplus.modules.workactivitymenu.entity.WorkActivityMenu;
|
|
import com.jeeplus.modules.workactivitymenu.service.WorkActivityMenuService;
|
|
import com.jeeplus.modules.workactivitymenu.service.WorkActivityMenuService;
|
|
|
|
+import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
|
|
import com.jeeplus.modules.workprojectnotify.entity.WorkProjectNotify;
|
|
import com.jeeplus.modules.workprojectnotify.entity.WorkProjectNotify;
|
|
import com.jeeplus.modules.workprojectnotify.service.WorkProjectNotifyService;
|
|
import com.jeeplus.modules.workprojectnotify.service.WorkProjectNotifyService;
|
|
import com.jeeplus.modules.workprojectnotify.util.UtilNotify;
|
|
import com.jeeplus.modules.workprojectnotify.util.UtilNotify;
|
|
|
|
+import freemarker.template.Configuration;
|
|
|
|
+import freemarker.template.Template;
|
|
import org.activiti.engine.*;
|
|
import org.activiti.engine.*;
|
|
import org.activiti.engine.runtime.ProcessInstance;
|
|
import org.activiti.engine.runtime.ProcessInstance;
|
|
import org.activiti.engine.task.Task;
|
|
import org.activiti.engine.task.Task;
|
|
|
|
+import org.apache.http.entity.ContentType;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.mock.web.MockMultipartFile;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
+import java.io.File;
|
|
|
|
+import java.io.FileInputStream;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -86,6 +105,8 @@ public class ProjectReportRecordService extends CrudService<ProjectReportRecordD
|
|
@Autowired
|
|
@Autowired
|
|
private RuralProjectRecordsService ruralProjectRecordsService;
|
|
private RuralProjectRecordsService ruralProjectRecordsService;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ private ProjectTemplateDao projectTemplateDao;
|
|
|
|
+ @Autowired
|
|
ProjectReportRecordDao projectReportRecordDao;
|
|
ProjectReportRecordDao projectReportRecordDao;
|
|
public ProjectReportRecord get(String id) {
|
|
public ProjectReportRecord get(String id) {
|
|
ProjectReportRecord projectReportRecord= super.get(id);
|
|
ProjectReportRecord projectReportRecord= super.get(id);
|
|
@@ -601,6 +622,44 @@ public class ProjectReportRecordService extends CrudService<ProjectReportRecordD
|
|
}
|
|
}
|
|
users.add(projectReportRecord.getCreateBy());
|
|
users.add(projectReportRecord.getCreateBy());
|
|
if ("yes".equals(flag)) {
|
|
if ("yes".equals(flag)) {
|
|
|
|
+
|
|
|
|
+ //判定为非全过程项目进行备考表信息处理
|
|
|
|
+ if(!"3".equals(record.getProjectType())){
|
|
|
|
+ //查询其他资料对应附件结构信息
|
|
|
|
+ ProjectTemplateInfo templateInfo = projectTemplateDao.getProjectTemplateInfoByName("其他资料");
|
|
|
|
+ //获取上传阿里云盘文件地址
|
|
|
|
+ String uploadFilePath = downloadReference(reportRecord, record);
|
|
|
|
+ if(StringUtils.isNotBlank(uploadFilePath)){
|
|
|
|
+ //将备考表添加到附件中
|
|
|
|
+ Workattachment workattachment = new Workattachment();
|
|
|
|
+ workattachment.setAttachmentId(templateInfo.getId());
|
|
|
|
+ workattachment.setProjectId(record.getId());
|
|
|
|
+ workattachment.setUrl(uploadFilePath);
|
|
|
|
+ workattachment.setType("doc");
|
|
|
|
+ workattachment.setAttachmentFlag("100");
|
|
|
|
+ workattachment.setAttachmentName("备考表.doc");
|
|
|
|
+ workattachment.setAttachmentUser(UserUtils.getUser().getId());
|
|
|
|
+ workattachmentService.insertOnWorkAttachment(workattachment);
|
|
|
|
+ }
|
|
|
|
+ //生成文件目录
|
|
|
|
+ //获取上传阿里云盘文件地址
|
|
|
|
+ String uploadCatalogueFilePath = downloadCatalogue(record.getId());
|
|
|
|
+
|
|
|
|
+ if(StringUtils.isNotBlank(uploadCatalogueFilePath)){
|
|
|
|
+ //将备考表添加到附件中
|
|
|
|
+ Workattachment workattachment = new Workattachment();
|
|
|
|
+ workattachment.setAttachmentId(templateInfo.getId());
|
|
|
|
+ workattachment.setProjectId(record.getId());
|
|
|
|
+ workattachment.setUrl(uploadCatalogueFilePath);
|
|
|
|
+ workattachment.setType("doc");
|
|
|
|
+ workattachment.setAttachmentFlag("100");
|
|
|
|
+ workattachment.setAttachmentName("文件目录.doc");
|
|
|
|
+ workattachment.setAttachmentUser(UserUtils.getUser().getId());
|
|
|
|
+ workattachment.setCompanyId(UserUtils.getSelectCompany().getId());
|
|
|
|
+ workattachmentService.insertOnWorkAttachment(workattachment);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
ProjectReportData projectReportData =projectReportRecord.getReport();
|
|
ProjectReportData projectReportData =projectReportRecord.getReport();
|
|
projectReportData.setFileStatus("3");
|
|
projectReportData.setFileStatus("3");
|
|
projectReportDataService.updateFileStatus(projectReportData);
|
|
projectReportDataService.updateFileStatus(projectReportData);
|
|
@@ -1205,4 +1264,217 @@ public class ProjectReportRecordService extends CrudService<ProjectReportRecordD
|
|
}
|
|
}
|
|
return "保存审核意见成功!";
|
|
return "保存审核意见成功!";
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 将备考表下载到本地
|
|
|
|
+ * @param projectReportRecord
|
|
|
|
+ */
|
|
|
|
+ public String downloadReference(ProjectReportRecord projectReportRecord, RuralProjectRecords record) {
|
|
|
|
+ Map data = referenceData(projectReportRecord,record);
|
|
|
|
+ //模板对象
|
|
|
|
+ Template template=null;
|
|
|
|
+ //freemaker模板路径
|
|
|
|
+ File path = new File(this.getClass().getResource("/").getPath()+"/freemarker");
|
|
|
|
+ Configuration cfg = new Configuration();
|
|
|
|
+ try {
|
|
|
|
+ cfg.setDirectoryForTemplateLoading(path);
|
|
|
|
+ //选择对应的ftl文件
|
|
|
|
+ template = cfg.getTemplate("reference.ftl","UTF-8");
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ //获取当前时间戳
|
|
|
|
+ long time = new Date().getTime();
|
|
|
|
+ File docFile = new File(time+"备考表.doc");
|
|
|
|
+ FreemarkerUtil.generateFile(data,template,docFile);
|
|
|
|
+ String filePath = ResponseUtil.returnViewResponse(time + "备考表.doc", docFile);
|
|
|
|
+ //本地备考表信息生成file文件
|
|
|
|
+ File file = new File(filePath);
|
|
|
|
+ //File转MultipartFile文件
|
|
|
|
+ SftpClientUtil sftpClientUtil = new SftpClientUtil();
|
|
|
|
+ MultipartFile mFile = sftpClientUtil.transformFile(docFile);
|
|
|
|
+ //文件上传oss
|
|
|
|
+ String uploadPath = null;
|
|
|
|
+ try {
|
|
|
|
+ uploadPath = ResponseUtil.uploadOss(mFile, "reportRecord");
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }finally {
|
|
|
|
+ //删除本地文件
|
|
|
|
+ if (!file.isDirectory()) {
|
|
|
|
+ file.delete();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return uploadPath;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private Map<String,Object> referenceData(ProjectReportRecord projectReportRecord, RuralProjectRecords record){
|
|
|
|
+ //freemarker参数值准备
|
|
|
|
+ Map<String,Object> data = new LinkedHashMap<>();
|
|
|
|
+ //本卷情况说明
|
|
|
|
+ if(StringUtils.isNotBlank(projectReportRecord.getReferenceRemarks())){
|
|
|
|
+ data.put("informationNote",projectReportRecord.getReferenceRemarks());
|
|
|
|
+ }else{
|
|
|
|
+
|
|
|
|
+ data.put("informationNote","");
|
|
|
|
+ }
|
|
|
|
+ //立卷人(项目负责人)
|
|
|
|
+ //查询项目负责人
|
|
|
|
+ if(StringUtils.isNotBlank(record.getProjectMasterId())){
|
|
|
|
+ User masterUser = UserUtils.get(record.getProjectMasterId());
|
|
|
|
+ if(null != masterUser && StringUtils.isNotBlank(masterUser.getName())){
|
|
|
|
+ data.put("projectLeader",masterUser.getName());
|
|
|
|
+ }else{
|
|
|
|
+ data.put("projectLeader","");
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ data.put("projectLeader","");
|
|
|
|
+ }
|
|
|
|
+ //检查人(档案管理员,即当前登陆人)
|
|
|
|
+ if(StringUtils.isNotBlank(UserUtils.getUser().getName())){
|
|
|
|
+ data.put("archivist",UserUtils.getUser().getName());
|
|
|
|
+ }else{
|
|
|
|
+
|
|
|
|
+ data.put("archivist","");
|
|
|
|
+ }
|
|
|
|
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+ String dateString = formatter.format(new Date());
|
|
|
|
+ //立卷时间(审批通过时间,即当前时间)
|
|
|
|
+ data.put("approvalTime",dateString);
|
|
|
|
+ return data;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //生成目录
|
|
|
|
+ public String downloadCatalogue(String projectId) {
|
|
|
|
+ Map data = catalogueData(projectId);
|
|
|
|
+ //模板对象
|
|
|
|
+ Template template=null;
|
|
|
|
+ //freemaker模板路径
|
|
|
|
+ File path = new File(this.getClass().getResource("/").getPath()+"/freemarker");
|
|
|
|
+ Configuration cfg = new Configuration();
|
|
|
|
+ try {
|
|
|
|
+ cfg.setDirectoryForTemplateLoading(path);
|
|
|
|
+ //选择对应的ftl文件
|
|
|
|
+ template = cfg.getTemplate("catalogue.ftl","UTF-8");
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ //获取当前时间戳
|
|
|
|
+ long time = new Date().getTime();
|
|
|
|
+ File docFile = new File(time + "文件目录.doc");
|
|
|
|
+ FreemarkerUtil.generateFile(data,template,docFile);
|
|
|
|
+ String filePath = ResponseUtil.returnViewResponse(time + "文件目录.doc", docFile);
|
|
|
|
+
|
|
|
|
+ //本地备考表信息生成file文件
|
|
|
|
+ File file = new File(filePath);
|
|
|
|
+ //File转MultipartFile文件
|
|
|
|
+ SftpClientUtil sftpClientUtil = new SftpClientUtil();
|
|
|
|
+ MultipartFile mFile = sftpClientUtil.transformFile(docFile);
|
|
|
|
+ //文件上传oss
|
|
|
|
+ String uploadPath = null;
|
|
|
|
+ try {
|
|
|
|
+ uploadPath = ResponseUtil.uploadOss(mFile, "reportRecord");
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }finally {
|
|
|
|
+ //删除本地文件
|
|
|
|
+ if (!file.isDirectory()) {
|
|
|
|
+ file.delete();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return uploadPath;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //获取数据
|
|
|
|
+ private Map<String,Object> catalogueData(String projectId){
|
|
|
|
+ //获取数据
|
|
|
|
+ RuralProjectRecords projectRecords = ruralProjectRecordsService.getQueryProjectUsers(projectId);
|
|
|
|
+ //文件信息获取
|
|
|
|
+ RuralProjectcontentinfo ruralProjectcontentinfo = ruralProjectRecordsService.formAccessory(projectRecords);
|
|
|
|
+ //目录
|
|
|
|
+ List<Map<String,String>> list=new LinkedList<>();
|
|
|
|
+ //序号
|
|
|
|
+ int count=1;
|
|
|
|
+ //成果文件
|
|
|
|
+ if (ruralProjectcontentinfo.getFileAttachmentList().size()>0){
|
|
|
|
+ List<ProjectTemplateInfo> infos=ruralProjectcontentinfo.getFileAttachmentList();
|
|
|
|
+ for (int i=0;i<infos.size();i++){
|
|
|
|
+ if (infos.get(i).getWorkAttachments().size()>0){
|
|
|
|
+ for (WorkClientAttachment attachment:infos.get(i).getWorkAttachments()){
|
|
|
|
+ Map<String,String> map=new HashMap<>();
|
|
|
|
+ map.put("count",count+"");
|
|
|
|
+ map.put("type","成果文件");
|
|
|
|
+ map.put("content",infos.get(i).getAttachName());
|
|
|
|
+ map.put("fileName",attachment.getAttachmentName());
|
|
|
|
+ map.put("remarks","");
|
|
|
|
+ count++;
|
|
|
|
+ list.add(map);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //依据性文件
|
|
|
|
+ if (ruralProjectcontentinfo.getFileGistdataList().size()>0){
|
|
|
|
+ List<ProjectTemplateInfo> infos=ruralProjectcontentinfo.getFileGistdataList();
|
|
|
|
+ for (int i=0;i<infos.size();i++){
|
|
|
|
+ if (infos.get(i).getWorkAttachments().size()>0){
|
|
|
|
+ for (WorkClientAttachment attachment:infos.get(i).getWorkAttachments()){
|
|
|
|
+ Map<String,String> map=new HashMap<>();
|
|
|
|
+ map.put("count",count+"");
|
|
|
|
+ map.put("type","依据文件");
|
|
|
|
+ map.put("content",infos.get(i).getAttachName());
|
|
|
|
+ map.put("fileName",attachment.getAttachmentName());
|
|
|
|
+ map.put("remarks","");
|
|
|
|
+ count++;
|
|
|
|
+ list.add(map);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //其它文件
|
|
|
|
+ if (ruralProjectcontentinfo.getFileGistdataList().size()>0){
|
|
|
|
+ List<ProjectTemplateInfo> infos=ruralProjectcontentinfo.getFileOtherList();
|
|
|
|
+ for (int i=0;i<infos.size();i++){
|
|
|
|
+ if (infos.get(i).getWorkAttachments().size()>0){
|
|
|
|
+ for (WorkClientAttachment attachment:infos.get(i).getWorkAttachments()){
|
|
|
|
+ Map<String,String> map=new HashMap<>();
|
|
|
|
+ map.put("count",count+"");
|
|
|
|
+ map.put("type","其它文件");
|
|
|
|
+ map.put("content",infos.get(i).getAttachName());
|
|
|
|
+ map.put("fileName",attachment.getAttachmentName());
|
|
|
|
+ map.put("remarks","");
|
|
|
|
+ count++;
|
|
|
|
+ list.add(map);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //freemarker参数值准备
|
|
|
|
+ Map<String,Object> data = new LinkedHashMap<>();
|
|
|
|
+ //获取报告
|
|
|
|
+ ProjectReportData projectReportData = projectReportDataService.getReportDataByProjectId(projectRecords.getId());
|
|
|
|
+ if (null!=projectReportData){
|
|
|
|
+ if(StringUtils.isNotBlank(projectReportData.getNumber())){
|
|
|
|
+ data.put("number",projectReportData.getNumber());
|
|
|
|
+ }else{
|
|
|
|
+ data.put("number","");
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ //文号
|
|
|
|
+ data.put("number","");
|
|
|
|
+ }
|
|
|
|
+ data.put("list",list);
|
|
|
|
+ return data;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|