| | |
| | | package com.whyc.service; |
| | | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.ProjectArchiveManageMapper; |
| | | import com.whyc.mapper.ProjectManageMapper; |
| | | import com.whyc.mapper.TestPlanMapper; |
| | | import com.whyc.pojo.ProjectArchiveExperiment; |
| | | import com.whyc.pojo.ProjectArchiveManage; |
| | | import com.whyc.pojo.ProjectManage; |
| | | import com.whyc.pojo.TestPlan; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | @Resource |
| | | private ProjectManageMapper projectManageMapper; |
| | | |
| | | |
| | | public Response searchDocumentation(ProjectArchiveManage pam) { |
| | | |
| | | Response<Object> response = new Response<>(); |
| | |
| | | for (int i = 0; i < list.size(); i++) { |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | ProjectArchiveManage projectArchiveManage = list.get(i); |
| | | map.put("文件名",projectArchiveManage.getProDocumentName()); |
| | | map.put("文件路径",projectArchiveManage.getProFilePath()); |
| | | map.put("name",projectArchiveManage.getProDocumentName()); |
| | | map.put("url",projectArchiveManage.getProFilePath()); |
| | | list1.add(map); |
| | | } |
| | | response.setMsg(1,"查询成功"); |
| | |
| | | |
| | | public Response delDocumentation(ProjectArchiveManage pam) { |
| | | Response<Object> response = new Response<>(); |
| | | boolean bl; |
| | | try { |
| | | projectArchiveManageMapper.delDocumentation(pam); |
| | | bl = projectArchiveManageMapper.delDocumentation(pam) > 0; |
| | | File file = new File(pam.getProFilePath()); |
| | | if (file.exists()){ |
| | | if (file.exists()) { |
| | | File absoluteFile = file.getAbsoluteFile(); |
| | | String name = absoluteFile.getName(); |
| | | file.delete(); |
| | | HashMap<Object, Object> map = new HashMap<>(); |
| | | map.put("name", name); |
| | | map.put("url", pam.getProFilePath()); |
| | | response.setData(map); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return response.setMsg(0,"删除失败"); |
| | | return response.setMsg(0, "删除失败"); |
| | | } |
| | | response.setMsg(1,"删除成功"); |
| | | if (bl) { |
| | | response.setMsg(1, "删除成功"); |
| | | } else { |
| | | response.setMsg(0, "删除失败"); |
| | | } |
| | | |
| | | return response; |
| | | } |
| | | |
| | |
| | | return response; |
| | | } |
| | | |
| | | public Response searchArchiveByCondition(ProjectManage projectManage) { |
| | | Response<Object> response = new Response<>(); |
| | | /** |
| | | * 项目归档管理-条件查询 |
| | | * |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @param projectManage |
| | | * @return |
| | | */ |
| | | public Response<PageInfo<ProjectManage>> searchArchiveByCondition(int pageNum, int pageSize, ProjectManage projectManage) { |
| | | |
| | | try { |
| | | List<ProjectManage> lists = projectManageMapper.searchArchiveByCondition(projectManage); |
| | | PageHelper.startPage(pageNum, pageSize); |
| | | List<ProjectManage> lists = projectManageMapper.searchArchiveByCondition(projectManage); |
| | | PageInfo<ProjectManage> projectManagePageInfo = new PageInfo<>(lists); |
| | | return new Response<PageInfo<ProjectManage>>().set(1, projectManagePageInfo); |
| | | |
| | | response.setMsg(1,"查询成功"); |
| | | response.setData(lists); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return response.setMsg(0,"查询失败"); |
| | | } |
| | | return response; |
| | | } |
| | | |
| | | /** |
| | |
| | | for (int i = 0; i < lists.size(); i++) { |
| | | ProjectArchiveManage pam = lists.get(i); |
| | | HashMap<Object, Object> map = new HashMap<>(); |
| | | map.put("文档名称",pam.getProDocumentName()); |
| | | map.put("文档格式",pam.getProDocumentFormat()); |
| | | map.put("fileName",pam.getProDocumentName()); |
| | | map.put("documentFormat",pam.getProDocumentFormat()); |
| | | Date proArchiveDate = pam.getProArchiveDate(); |
| | | String format = ""; |
| | | if (null != proArchiveDate) { |
| | | format = new SimpleDateFormat("yyyy-MM-dd").format(proArchiveDate); |
| | | } |
| | | map.put("归档日期", format); |
| | | map.put("下载地址",pam.getProFilePath()); |
| | | map.put("archiveDate", format); |
| | | map.put("url",pam.getProFilePath()); |
| | | last.add(map); |
| | | } |
| | | } |
| | |
| | | * @param pam |
| | | * @return |
| | | */ |
| | | @Deprecated |
| | | public Response searchArchiveExperimentData(ProjectArchiveManage pam) { |
| | | Response<Object> response = new Response<>(); |
| | | List<ProjectArchiveExperiment> lists = projectArchiveManageMapper.searchArchiveExperimentData(pam); |
| | |
| | | for (int i = 0; i < lists.size(); i++) { |
| | | ProjectArchiveExperiment pae = lists.get(i); |
| | | HashMap<Object, Object> map = new HashMap<>(); |
| | | map.put("试验名称", pae.getProName2()); |
| | | map.put("testName", pae.getProName2()); |
| | | Date proUploadDate = pae.getProUploadDate(); |
| | | String format1 = null; |
| | | if (null != proUploadDate) { |
| | | format1 = new SimpleDateFormat("yyyy-MM-dd").format(proUploadDate); |
| | | } |
| | | map.put("上传日期", format1); |
| | | map.put("uploadDate", format1); |
| | | Date proArchiveDate = pae.getProArchiveDate(); |
| | | String format = null; |
| | | if (null != proArchiveDate) { |
| | | format = new SimpleDateFormat("yyyy-MM-dd").format(proArchiveDate); |
| | | } |
| | | map.put("归档日期", format); |
| | | map.put("archiveDate", format); |
| | | // map.put("下载地址",pam.getProFilePath()); |
| | | last.add(map); |
| | | } |
| | |
| | | for (int i = 0; i < lists.size(); i++) { |
| | | ProjectArchiveManage pam = lists.get(i); |
| | | HashMap<Object, Object> map = new HashMap<>(); |
| | | map.put("成果名称", pam.getAchievementName()); |
| | | map.put("成果类型",pam.getAchievementType()); |
| | | map.put("achievementName", pam.getAchievementName()); |
| | | map.put("achievementType",pam.getAchievementType()); |
| | | Date gainDate = pam.getGainDate(); |
| | | String str1 = null; |
| | | if(null!=gainDate){ |
| | | str1 = new SimpleDateFormat("yyyy-MM-dd").format(gainDate); |
| | | } |
| | | map.put("取得/发表日期",str1); |
| | | map.put("publishedDate",str1); |
| | | |
| | | Date proArchiveDate = pam.getProArchiveDate(); |
| | | String str2 = null; |
| | | if(null!=proArchiveDate){ |
| | | str2 = new SimpleDateFormat("yyyy-MM-dd").format(proArchiveDate); |
| | | } |
| | | map.put("归档日期",str2); |
| | | map.put("archiveDate",str2); |
| | | last.add(map); |
| | | } |
| | | } |
| | |
| | | } |
| | | return response; |
| | | } |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private TestPlanMapper testPlanMapper; |
| | | /** |
| | | * 项目归档管理-试验数据管理 |
| | | * @param proNameCode |
| | | * @return |
| | | */ |
| | | public Response searchArchiveExperimentData(String proNameCode) { |
| | | Response<Object> response = new Response<>(); |
| | | try { |
| | | TestPlan testPlan = new TestPlan(); |
| | | testPlan.setProId(proNameCode); |
| | | List<TestPlan> lists = testPlanMapper.searchArchiveExperimentData(testPlan); |
| | | response.setMsg(1, "查询成功"); |
| | | response.setData(lists); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return response.setMsg(0, "查询失败"); |
| | | } |
| | | return response; |
| | | } |
| | | } |