|  | @@ -112,6 +112,9 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
 | 
	
		
			
				|  |  |      @Resource
 | 
	
		
			
				|  |  |      private CwSignatureAnnotatorMapper cwSignatureAnnotatorMapper;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Resource
 | 
	
		
			
				|  |  | +    private CwProjectReportNumberApplyMapper applyMapper;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 保存项目以及其他相关信息
 | 
	
	
		
			
				|  | @@ -134,6 +137,27 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 保存项目以及其他相关信息
 | 
	
		
			
				|  |  | +     * @param reportData
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     * @throws Exception
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    public String saveForm2(CwProjectReportData reportData) throws Exception{
 | 
	
		
			
				|  |  | +        if (StringUtils.isNotEmpty(reportData.getId())){
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            CwProjectReport report = reportMapper.getById(reportData.getId());
 | 
	
		
			
				|  |  | +            if (report != null){
 | 
	
		
			
				|  |  | +                reportData.setCreateBy(reportData.getCreateBy());
 | 
	
		
			
				|  |  | +                reportData.setProcInsReview(report.getProcInsReview());
 | 
	
		
			
				|  |  | +                reportData.setReviewStatus(report.getReviewStatus());
 | 
	
		
			
				|  |  | +                return update2(reportData);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return null;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 合同登记修改
 | 
	
		
			
				|  |  |       */
 | 
	
	
		
			
				|  | @@ -190,6 +214,92 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
 | 
	
		
			
				|  |  |          return report.getId();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 合同登记修改
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  | +    public String update2(CwProjectReportData reportData) throws Exception{
 | 
	
		
			
				|  |  | +        //获取当前登录人信息
 | 
	
		
			
				|  |  | +        UserDTO userDTO = SpringUtil.getBean ( IUserApi.class ).getByToken(TokenProvider.getCurrentToken ( ));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        CwProjectReport report = new CwProjectReport();
 | 
	
		
			
				|  |  | +        BeanUtils.copyProperties(reportData, report);
 | 
	
		
			
				|  |  | +        report.setUpdateById(userDTO.getId());
 | 
	
		
			
				|  |  | +        report.setUpdateTime(new Date());
 | 
	
		
			
				|  |  | +        reportMapper.updateCwProjectReportDataById(report);
 | 
	
		
			
				|  |  | +        //修改新增行数据
 | 
	
		
			
				|  |  | +        CwProjectInfoData infoData = infoMapper.selectInfoByReportId(report.getId());
 | 
	
		
			
				|  |  | +        infoData.setServedUnitName(report.getServedUnitName());
 | 
	
		
			
				|  |  | +        infoData.setReportDate(report.getReportDate());
 | 
	
		
			
				|  |  | +        infoData.setReportType(report.getReportType());
 | 
	
		
			
				|  |  | +        infoData.setOpinionType(report.getOpinionType());
 | 
	
		
			
				|  |  | +        infoData.setSealType(report.getSealType());
 | 
	
		
			
				|  |  | +        infoData.setServedUnitId(report.getServedUnitId());
 | 
	
		
			
				|  |  | +        infoData.setUpdateById(userDTO.getId());
 | 
	
		
			
				|  |  | +//        infoData.setUpdateById(UserUtils.getCurrentUserDTO().getId());
 | 
	
		
			
				|  |  | +        infoData.setUpdateTime(new Date());
 | 
	
		
			
				|  |  | +        infoMapper.updateCwProjectInfoDataById(infoData);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        //对上传的文件数据进行持久化操作
 | 
	
		
			
				|  |  | +//        List<WorkAttachmentInfo> cwFileInfoList3 = report.getCwFileInfoList3();
 | 
	
		
			
				|  |  | +//        if (CollectionUtils.isNotEmpty(cwFileInfoList3)) {
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//            Map<String,String> map = new HashMap<>();
 | 
	
		
			
				|  |  | +//            String fileList = JSON.toJSONString((cwFileInfoList3));
 | 
	
		
			
				|  |  | +//            String attachmentId = report.getId();
 | 
	
		
			
				|  |  | +//            String attachmentFlag = "cwReportNumberApply";
 | 
	
		
			
				|  |  | +//            map.put("fileList",fileList);
 | 
	
		
			
				|  |  | +//            map.put("attachmentId",attachmentId);
 | 
	
		
			
				|  |  | +//            map.put("attachmentFlag",attachmentFlag);
 | 
	
		
			
				|  |  | +//            map.put("currentToken",TokenProvider.getCurrentToken ( ));
 | 
	
		
			
				|  |  | +//            SpringUtil.getBean ( IWorkAttachmentApi.class ).saveOrUpdateFileList(map);
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        //对上传的附件进行持久化操作
 | 
	
		
			
				|  |  | +        List<WorkAttachmentInfo> fileInfoList3 = new ArrayList<>();
 | 
	
		
			
				|  |  | +        if ( null !=report.getCwFileInfoList3()){
 | 
	
		
			
				|  |  | +            fileInfoList3 = report.getCwFileInfoList3();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        SpringUtil.getBean ( IWorkAttachmentApi.class ).deleteByAttachmentId(report.getId());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        AtomicInteger j2 = new AtomicInteger(1);
 | 
	
		
			
				|  |  | +        if (fileInfoList3 != null){
 | 
	
		
			
				|  |  | +            fileInfoList3.forEach(item -> {
 | 
	
		
			
				|  |  | +                WorkAttachmentInfo i = new WorkAttachmentInfo();
 | 
	
		
			
				|  |  | +                //包含了url、size、name
 | 
	
		
			
				|  |  | +                i.setId(UUID.randomUUID().toString().replace("-", ""));
 | 
	
		
			
				|  |  | +                i.setCreateTime(new Date());
 | 
	
		
			
				|  |  | +                i.setUpdateTime(new Date());
 | 
	
		
			
				|  |  | +                i.setCreateById(userDTO.getId());
 | 
	
		
			
				|  |  | +                i.setUpdateById(userDTO.getId());
 | 
	
		
			
				|  |  | +                i.setDelFlag(0);
 | 
	
		
			
				|  |  | +                i.setUrl(item.getUrl());
 | 
	
		
			
				|  |  | +                //文件类型处理
 | 
	
		
			
				|  |  | +                List<String> strings = Arrays.asList(item.getName().split("\\."));
 | 
	
		
			
				|  |  | +                if (CollectionUtils.isNotEmpty(strings)) {
 | 
	
		
			
				|  |  | +                    i.setType(strings.get(1));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                i.setAttachmentId(report.getId());
 | 
	
		
			
				|  |  | +                i.setAttachmentName(item.getName());
 | 
	
		
			
				|  |  | +                i.setAttachmentFlag("cw_project_report_number_apply");
 | 
	
		
			
				|  |  | +                i.setFileSize(item.getSize());
 | 
	
		
			
				|  |  | +                i.setSort(j2.get());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                Map<String,String> map = new HashMap<>();
 | 
	
		
			
				|  |  | +                String workAttachment = JSON.toJSONString((i));
 | 
	
		
			
				|  |  | +                String userDTOInfo = JSON.toJSONString((userDTO));
 | 
	
		
			
				|  |  | +                map.put("workAttachment",workAttachment);
 | 
	
		
			
				|  |  | +                map.put("userDTO",userDTOInfo);
 | 
	
		
			
				|  |  | +                SpringUtil.getBean ( IWorkAttachmentApi.class ).insertWorkAttachment(map);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return report.getId();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      public void updateSignatureInfo(CwProjectReportData projectReportData){
 | 
	
		
			
				|  |  |          reportMapper.updateSignatureInfo(projectReportData);
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -932,6 +1042,349 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
 | 
	
		
			
				|  |  |          return reportData;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    public CwProjectReportData queryById2(String id) {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        CwProjectReportData reportData = reportMapper.queryById(id);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        //将新增行数据查询出来放入到cwProjectInfoList中
 | 
	
		
			
				|  |  | +        CwProjectInfoData cwProjectInfoData = infoMapper.selectByReportId(id);
 | 
	
		
			
				|  |  | +        if (null != cwProjectInfoData){
 | 
	
		
			
				|  |  | +            reportData.setServedUnitName(cwProjectInfoData.getServedUnitName());
 | 
	
		
			
				|  |  | +            reportData.setServedUnitId(cwProjectInfoData.getServedUnitId());
 | 
	
		
			
				|  |  | +            reportData.setReportDate(cwProjectInfoData.getReportDate());
 | 
	
		
			
				|  |  | +            reportData.setReportType(cwProjectInfoData.getReportType());
 | 
	
		
			
				|  |  | +            reportData.setReportNumber(cwProjectInfoData.getReportNumber());
 | 
	
		
			
				|  |  | +            reportData.setReportNo(cwProjectInfoData.getReportNo());
 | 
	
		
			
				|  |  | +            reportData.setSealType(cwProjectInfoData.getSealType());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +//        List<CwProjectInfoData> infoData = new ArrayList<>();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        List<ProjectReportWorkAttachmentDTO> dtoList = new ArrayList<>();
 | 
	
		
			
				|  |  | +        List<ProjectReportWorkAttachmentDTO> signatureList = new ArrayList<>();
 | 
	
		
			
				|  |  | +        if ( null != reportData){
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            List<ProjectReportWorkAttachmentDTO> dtos = attachmentMapper.selectByInfoId(reportData.getId());
 | 
	
		
			
				|  |  | +            if (null != dtos){
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                Iterator<ProjectReportWorkAttachmentDTO> it = dtos.iterator();
 | 
	
		
			
				|  |  | +                while(it.hasNext()){
 | 
	
		
			
				|  |  | +                    ProjectReportWorkAttachmentDTO d = it.next();
 | 
	
		
			
				|  |  | +                    //根据id查出cw_project_report_file文件表的其他信息
 | 
	
		
			
				|  |  | +                    //未签章附件
 | 
	
		
			
				|  |  | +                    CwProjectReportFile file = attachmentMapper.selectInfoByFileId(d.getId(),"0");
 | 
	
		
			
				|  |  | +                    if (null != file) {
 | 
	
		
			
				|  |  | +                        d.setFileType(file.getFileType());
 | 
	
		
			
				|  |  | +                        d.setSealType(file.getSealType());
 | 
	
		
			
				|  |  | +                        d.setSealedFile(file.getSealedFile());
 | 
	
		
			
				|  |  | +                        d.setSealUser(file.getSealUser());
 | 
	
		
			
				|  |  | +                        d.setSealDate(file.getSealDate());
 | 
	
		
			
				|  |  | +                        d.setRemarks(file.getRemarks());
 | 
	
		
			
				|  |  | +                        UserDTO userDTO = new UserDTO();
 | 
	
		
			
				|  |  | +                        //根据创建人id查出创建人名称
 | 
	
		
			
				|  |  | +                        String name = reportMapper.getUserNameById(file.getCreateById());
 | 
	
		
			
				|  |  | +                        userDTO.setId(file.getCreateById());
 | 
	
		
			
				|  |  | +                        userDTO.setName(name);
 | 
	
		
			
				|  |  | +                        d.setCreateBy(userDTO);
 | 
	
		
			
				|  |  | +                        d.setCreateTime(file.getCreateTime());
 | 
	
		
			
				|  |  | +                        dtoList.add(d);
 | 
	
		
			
				|  |  | +                        it.remove();
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    //已签章附件
 | 
	
		
			
				|  |  | +                    CwProjectReportFile signatureFile = attachmentMapper.selectInfoByFileId(d.getId(),"1");
 | 
	
		
			
				|  |  | +                    if (null != signatureFile){
 | 
	
		
			
				|  |  | +                        d.setFileType(signatureFile.getFileType());
 | 
	
		
			
				|  |  | +                        d.setSealType(signatureFile.getSealType());
 | 
	
		
			
				|  |  | +                        d.setSealedFile(signatureFile.getSealedFile());
 | 
	
		
			
				|  |  | +                        d.setSealUser(signatureFile.getSealUser());
 | 
	
		
			
				|  |  | +                        d.setSealDate(signatureFile.getSealDate());
 | 
	
		
			
				|  |  | +                        d.setRemarks(signatureFile.getRemarks());
 | 
	
		
			
				|  |  | +                        UserDTO userDTO2 = new UserDTO();
 | 
	
		
			
				|  |  | +                        //根据创建人id查出创建人名称
 | 
	
		
			
				|  |  | +                        String name2 = reportMapper.getUserNameById(signatureFile.getCreateById());
 | 
	
		
			
				|  |  | +                        userDTO2.setId(signatureFile.getCreateById());
 | 
	
		
			
				|  |  | +                        userDTO2.setName(name2);
 | 
	
		
			
				|  |  | +                        d.setCreateBy(userDTO2);
 | 
	
		
			
				|  |  | +                        d.setCreateTime(signatureFile.getCreateTime());
 | 
	
		
			
				|  |  | +                        signatureList.add(d);
 | 
	
		
			
				|  |  | +                        it.remove();
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                reportData.setCwFileInfoList(dtoList);
 | 
	
		
			
				|  |  | +                reportData.setSignatureFileList(signatureList);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            //将附件信息查出
 | 
	
		
			
				|  |  | +            // 查询附件信息
 | 
	
		
			
				|  |  | +            List<WorkAttachmentInfo> fileInfo2 = reportMapper.findDtos(id);
 | 
	
		
			
				|  |  | +            List<WorkAttachmentInfo> reportFileList = Lists.newArrayList();
 | 
	
		
			
				|  |  | +            if(CollectionUtils.isNotEmpty(dtos) && CollectionUtils.isNotEmpty(fileInfo2)){
 | 
	
		
			
				|  |  | +                for (ProjectReportWorkAttachmentDTO dto : dtos) {
 | 
	
		
			
				|  |  | +                    for (WorkAttachmentInfo workAttachmentDto : fileInfo2) {
 | 
	
		
			
				|  |  | +                        if(dto.getId().equals(workAttachmentDto.getId())){
 | 
	
		
			
				|  |  | +                            reportFileList.add(workAttachmentDto);
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            if (CollectionUtils.isNotEmpty(dtos)) {
 | 
	
		
			
				|  |  | +                for (WorkAttachmentInfo i : reportFileList) {
 | 
	
		
			
				|  |  | +                    i.setCreateBy(SpringUtil.getBean ( IUserApi.class ).getById(i.getBy()));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            reportData.setCwFileInfoList3(reportFileList);
 | 
	
		
			
				|  |  | +            //设置历史报告列表
 | 
	
		
			
				|  |  | +            //根据项目id查出所有的信息
 | 
	
		
			
				|  |  | +            List<CwProjectReportData> byProjectList = reportMapper.getByProjectId(reportData.getProjectId());
 | 
	
		
			
				|  |  | +            List<CwProjectInfoData> dataInfoList = new ArrayList<>();
 | 
	
		
			
				|  |  | +            if (null != byProjectList) {
 | 
	
		
			
				|  |  | +                CwProjectReportData finalReportData1 = reportData;
 | 
	
		
			
				|  |  | +                byProjectList.forEach(pro->{
 | 
	
		
			
				|  |  | +                    //根据reportid查出新增行数据
 | 
	
		
			
				|  |  | +                    CwProjectInfoData infoData = infoMapper.getByReportId(pro.getId());
 | 
	
		
			
				|  |  | +                    //根据reportid查出所有的附件信息
 | 
	
		
			
				|  |  | +                    List<ProjectReportWorkAttachmentDTO> fileList = new ArrayList<>();
 | 
	
		
			
				|  |  | +                    List<ProjectReportWorkAttachmentDTO> cwFileInfoList = attachmentMapper.selectByInfoIdAndNewLineId(finalReportData1.getId());
 | 
	
		
			
				|  |  | +                    //历史的附件信息是否是查改reportid对应的所有附件
 | 
	
		
			
				|  |  | +                    if (null != cwFileInfoList){
 | 
	
		
			
				|  |  | +                        cwFileInfoList.forEach(fi->{
 | 
	
		
			
				|  |  | +                            //未签章附件
 | 
	
		
			
				|  |  | +                            CwProjectReportFile file = attachmentMapper.selectInfoByFileId(fi.getId(),"0");
 | 
	
		
			
				|  |  | +                            if (null != file) {
 | 
	
		
			
				|  |  | +                                fi.setFileType(file.getFileType());
 | 
	
		
			
				|  |  | +                                fi.setSealType(file.getSealType());
 | 
	
		
			
				|  |  | +                                fi.setSealedFile(file.getSealedFile());
 | 
	
		
			
				|  |  | +                                fi.setSealUser(file.getSealUser());
 | 
	
		
			
				|  |  | +                                fi.setSealDate(file.getSealDate());
 | 
	
		
			
				|  |  | +                                fi.setRemarks(file.getRemarks());
 | 
	
		
			
				|  |  | +                                UserDTO userDTO = new UserDTO();
 | 
	
		
			
				|  |  | +                                //根据创建人id查出创建人名称
 | 
	
		
			
				|  |  | +                                String name = reportMapper.getUserNameById(file.getCreateById());
 | 
	
		
			
				|  |  | +                                userDTO.setId(file.getCreateById());
 | 
	
		
			
				|  |  | +                                userDTO.setName(name);
 | 
	
		
			
				|  |  | +                                fi.setCreateBy(userDTO);
 | 
	
		
			
				|  |  | +                                fi.setCreateTime(file.getCreateTime());
 | 
	
		
			
				|  |  | +                                fileList.add(fi);
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                        });
 | 
	
		
			
				|  |  | +                        //设置附件信息
 | 
	
		
			
				|  |  | +                        infoData.setCwFileInfoList(fileList);
 | 
	
		
			
				|  |  | +                        if (pro.getStatus().equals("5")) {
 | 
	
		
			
				|  |  | +                            infoData.setDocumentStatus("已完成");
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        dataInfoList.add(infoData);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                });
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            reportData.setCwWorkClientContactDTOList(dataInfoList);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            //将复核数据查出来
 | 
	
		
			
				|  |  | +            CwProjectReview review = reviewMapper.selectByReportId(reportData.getId());
 | 
	
		
			
				|  |  | +            if ( null != review) {
 | 
	
		
			
				|  |  | +                reportData.setReviewStatus(review.getReviewStatus());
 | 
	
		
			
				|  |  | +                reportData.setAllPrintNum(review.getAllPrintNum());
 | 
	
		
			
				|  |  | +                reportData.setIssueNum(review.getIssueNum());
 | 
	
		
			
				|  |  | +                reportData.setPlaceOnFileNum(review.getPlaceOnFileNum());
 | 
	
		
			
				|  |  | +                reportData.setPrintedBy(review.getPrintedBy());
 | 
	
		
			
				|  |  | +                reportData.setCheckAutograph(review.getCheckAutograph());
 | 
	
		
			
				|  |  | +                reportData.setReportTitleType(review.getReportTitleType());
 | 
	
		
			
				|  |  | +                reportData.setNeedUpdate1(review.getNeedUpdate1());
 | 
	
		
			
				|  |  | +                reportData.setNeedUpdate2(review.getNeedUpdate2());
 | 
	
		
			
				|  |  | +                reportData.setNeedUpdate3(review.getNeedUpdate3());
 | 
	
		
			
				|  |  | +                reportData.setRemark1(review.getRemark1());
 | 
	
		
			
				|  |  | +                reportData.setRemark2(review.getRemark2());
 | 
	
		
			
				|  |  | +                reportData.setRemark3(review.getRemark3());
 | 
	
		
			
				|  |  | +                reportData.setComputerNo(review.getComputerNo());
 | 
	
		
			
				|  |  | +                reportData.setReportReviewNo(review.getReportReviewNo());
 | 
	
		
			
				|  |  | +                reportData.setReviewBy(review.getReviewBy());
 | 
	
		
			
				|  |  | +                //将一级复核等填入数据查出
 | 
	
		
			
				|  |  | +                List<CwProofreadDetail> details = detailMapper.findByReportInfoId(review.getId());
 | 
	
		
			
				|  |  | +                if (null != details) {
 | 
	
		
			
				|  |  | +                    reportData.setDetails(details);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            //根据报告类型查询下一节点用户
 | 
	
		
			
				|  |  | +            List<ReviewUser> stringList = new ArrayList<>();
 | 
	
		
			
				|  |  | +            //如果是苏州分部,这里写死
 | 
	
		
			
				|  |  | +            String officeId = reportMapper.getCorrelationOfficeIdByName("苏州分公司");
 | 
	
		
			
				|  |  | +            if (StringUtils.isNotBlank(officeId) && officeId.contains(reportData.getOfficeId())){
 | 
	
		
			
				|  |  | +                stringList = reportMapper.getReviewByPost("质控-苏州分部");
 | 
	
		
			
				|  |  | +            }else if (reportData.getReportType().equals("1")) {
 | 
	
		
			
				|  |  | +                stringList = reportMapper.getReviewByPost("质控-财务-苏兴会基字");
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                stringList = reportMapper.getReviewByPost("质控-财务-非苏兴会基字");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            reportData.setReviewBys(stringList);
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            //传来的是  报告号申请表 的id
 | 
	
		
			
				|  |  | +            CwProjectReportNumberApply review = applyMapper.selectById(id);
 | 
	
		
			
				|  |  | +            if (null != review) {
 | 
	
		
			
				|  |  | +                reportData = reportMapper.queryById(review.getReportId());
 | 
	
		
			
				|  |  | +                if ( null != reportData){
 | 
	
		
			
				|  |  | +                    List<ProjectReportWorkAttachmentDTO> dtos = attachmentMapper.selectByInfoId(reportData.getId());
 | 
	
		
			
				|  |  | +                    if (null != dtos){
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                        Iterator<ProjectReportWorkAttachmentDTO> it = dtos.iterator();
 | 
	
		
			
				|  |  | +                        while(it.hasNext()){
 | 
	
		
			
				|  |  | +                            ProjectReportWorkAttachmentDTO d = it.next();
 | 
	
		
			
				|  |  | +                            //根据id查出cw_project_report_file文件表的其他信息
 | 
	
		
			
				|  |  | +                            //未签章附件
 | 
	
		
			
				|  |  | +                            CwProjectReportFile file = attachmentMapper.selectInfoByFileId(d.getId(),"0");
 | 
	
		
			
				|  |  | +                            if (null != file) {
 | 
	
		
			
				|  |  | +                                d.setFileType(file.getFileType());
 | 
	
		
			
				|  |  | +                                d.setSealType(file.getSealType());
 | 
	
		
			
				|  |  | +                                d.setSealedFile(file.getSealedFile());
 | 
	
		
			
				|  |  | +                                d.setSealUser(file.getSealUser());
 | 
	
		
			
				|  |  | +                                d.setSealDate(file.getSealDate());
 | 
	
		
			
				|  |  | +                                d.setRemarks(file.getRemarks());
 | 
	
		
			
				|  |  | +                                UserDTO userDTO = new UserDTO();
 | 
	
		
			
				|  |  | +                                //根据创建人id查出创建人名称
 | 
	
		
			
				|  |  | +                                String name = reportMapper.getUserNameById(file.getCreateById());
 | 
	
		
			
				|  |  | +                                userDTO.setId(file.getCreateById());
 | 
	
		
			
				|  |  | +                                userDTO.setName(name);
 | 
	
		
			
				|  |  | +                                d.setCreateBy(userDTO);
 | 
	
		
			
				|  |  | +                                d.setCreateTime(file.getCreateTime());
 | 
	
		
			
				|  |  | +                                dtoList.add(d);
 | 
	
		
			
				|  |  | +                                it.remove();
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                            //已签章附件
 | 
	
		
			
				|  |  | +                            CwProjectReportFile signatureFile = attachmentMapper.selectInfoByFileId(d.getId(),"1");
 | 
	
		
			
				|  |  | +                            if (null != signatureFile){
 | 
	
		
			
				|  |  | +                                d.setFileType(signatureFile.getFileType());
 | 
	
		
			
				|  |  | +                                d.setSealType(signatureFile.getSealType());
 | 
	
		
			
				|  |  | +                                d.setSealedFile(signatureFile.getSealedFile());
 | 
	
		
			
				|  |  | +                                d.setSealUser(signatureFile.getSealUser());
 | 
	
		
			
				|  |  | +                                d.setSealDate(signatureFile.getSealDate());
 | 
	
		
			
				|  |  | +                                d.setRemarks(signatureFile.getRemarks());
 | 
	
		
			
				|  |  | +                                UserDTO userDTO2 = new UserDTO();
 | 
	
		
			
				|  |  | +                                //根据创建人id查出创建人名称
 | 
	
		
			
				|  |  | +                                String name2 = reportMapper.getUserNameById(signatureFile.getCreateById());
 | 
	
		
			
				|  |  | +                                userDTO2.setId(signatureFile.getCreateById());
 | 
	
		
			
				|  |  | +                                userDTO2.setName(name2);
 | 
	
		
			
				|  |  | +                                d.setCreateBy(userDTO2);
 | 
	
		
			
				|  |  | +                                d.setCreateTime(signatureFile.getCreateTime());
 | 
	
		
			
				|  |  | +                                signatureList.add(d);
 | 
	
		
			
				|  |  | +                                it.remove();
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        reportData.setCwFileInfoList(dtoList);
 | 
	
		
			
				|  |  | +                        reportData.setSignatureFileList(signatureList);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    //将附件信息查出
 | 
	
		
			
				|  |  | +                    // 查询附件信息
 | 
	
		
			
				|  |  | +                    List<WorkAttachmentInfo> fileInfo2 = reportMapper.findDtos(reportData.getId());
 | 
	
		
			
				|  |  | +                    List<WorkAttachmentInfo> reportFileList = Lists.newArrayList();
 | 
	
		
			
				|  |  | +                    if(CollectionUtils.isNotEmpty(dtos) && CollectionUtils.isNotEmpty(fileInfo2)){
 | 
	
		
			
				|  |  | +                        for (ProjectReportWorkAttachmentDTO dto : dtos) {
 | 
	
		
			
				|  |  | +                            for (WorkAttachmentInfo workAttachmentDto : fileInfo2) {
 | 
	
		
			
				|  |  | +                                if(dto.getId().equals(workAttachmentDto.getId())){
 | 
	
		
			
				|  |  | +                                    reportFileList.add(workAttachmentDto);
 | 
	
		
			
				|  |  | +                                }
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    if (CollectionUtils.isNotEmpty(dtos)) {
 | 
	
		
			
				|  |  | +                        for (WorkAttachmentInfo i : reportFileList) {
 | 
	
		
			
				|  |  | +                            i.setCreateBy(SpringUtil.getBean ( IUserApi.class ).getById(i.getBy()));
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    reportData.setCwFileInfoList3(reportFileList);
 | 
	
		
			
				|  |  | +                    //设置历史报告列表
 | 
	
		
			
				|  |  | +                    //根据项目id查出所有的信息
 | 
	
		
			
				|  |  | +                    List<CwProjectReportData> byProjectList = reportMapper.getByProjectId(reportData.getProjectId());
 | 
	
		
			
				|  |  | +                    List<CwProjectInfoData> dataInfoList = new ArrayList<>();
 | 
	
		
			
				|  |  | +                    if (null != byProjectList) {
 | 
	
		
			
				|  |  | +                        CwProjectReportData finalReportData = reportData;
 | 
	
		
			
				|  |  | +                        byProjectList.forEach(pro->{
 | 
	
		
			
				|  |  | +                            //根据reportid查出新增行数据
 | 
	
		
			
				|  |  | +                            CwProjectInfoData infoData = infoMapper.getByReportId(pro.getId());
 | 
	
		
			
				|  |  | +                            //根据reportid查出所有的附件信息
 | 
	
		
			
				|  |  | +                            List<ProjectReportWorkAttachmentDTO> fileList = new ArrayList<>();
 | 
	
		
			
				|  |  | +                            List<ProjectReportWorkAttachmentDTO> cwFileInfoList = attachmentMapper.selectByInfoIdAndNewLineId(finalReportData.getId());
 | 
	
		
			
				|  |  | +                            //历史的附件信息是否是查改reportid对应的所有附件
 | 
	
		
			
				|  |  | +                            if (null != cwFileInfoList){
 | 
	
		
			
				|  |  | +                                cwFileInfoList.forEach(fi->{
 | 
	
		
			
				|  |  | +                                    //未签章附件
 | 
	
		
			
				|  |  | +                                    CwProjectReportFile file = attachmentMapper.selectInfoByFileId(fi.getId(),"0");
 | 
	
		
			
				|  |  | +                                    if (null != file) {
 | 
	
		
			
				|  |  | +                                        fi.setFileType(file.getFileType());
 | 
	
		
			
				|  |  | +                                        fi.setSealType(file.getSealType());
 | 
	
		
			
				|  |  | +                                        fi.setSealedFile(file.getSealedFile());
 | 
	
		
			
				|  |  | +                                        fi.setSealUser(file.getSealUser());
 | 
	
		
			
				|  |  | +                                        fi.setSealDate(file.getSealDate());
 | 
	
		
			
				|  |  | +                                        fi.setRemarks(file.getRemarks());
 | 
	
		
			
				|  |  | +                                        UserDTO userDTO = new UserDTO();
 | 
	
		
			
				|  |  | +                                        //根据创建人id查出创建人名称
 | 
	
		
			
				|  |  | +                                        String name = reportMapper.getUserNameById(file.getCreateById());
 | 
	
		
			
				|  |  | +                                        userDTO.setId(file.getCreateById());
 | 
	
		
			
				|  |  | +                                        userDTO.setName(name);
 | 
	
		
			
				|  |  | +                                        fi.setCreateBy(userDTO);
 | 
	
		
			
				|  |  | +                                        fi.setCreateTime(file.getCreateTime());
 | 
	
		
			
				|  |  | +                                        fileList.add(fi);
 | 
	
		
			
				|  |  | +                                    }
 | 
	
		
			
				|  |  | +                                });
 | 
	
		
			
				|  |  | +                                //设置附件信息
 | 
	
		
			
				|  |  | +                                infoData.setCwFileInfoList(fileList);
 | 
	
		
			
				|  |  | +                                if (pro.getStatus().equals("5")) {
 | 
	
		
			
				|  |  | +                                    infoData.setDocumentStatus("已完成");
 | 
	
		
			
				|  |  | +                                }
 | 
	
		
			
				|  |  | +                                dataInfoList.add(infoData);
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                        });
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    reportData.setCwWorkClientContactDTOList(dataInfoList);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    //将复核数据查出来
 | 
	
		
			
				|  |  | +                    //设置下一节点审核人信息
 | 
	
		
			
				|  |  | +                    CwProjectReview projectReview = reviewMapper.selectByReportId(reportData.getId());
 | 
	
		
			
				|  |  | +                    reportData.setReviewBy(projectReview.getReviewBy());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    //将一级复核等填入数据查出
 | 
	
		
			
				|  |  | +                    List<CwProofreadDetail> details = detailMapper.findByReportInfoId(review.getId());
 | 
	
		
			
				|  |  | +                    if (null != details) {
 | 
	
		
			
				|  |  | +                        reportData.setDetails(details);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    //根据报告类型查询下一节点用户
 | 
	
		
			
				|  |  | +                    List<ReviewUser> stringList = new ArrayList<>();
 | 
	
		
			
				|  |  | +                    //如果是苏州分部,这里写死
 | 
	
		
			
				|  |  | +                    String officeId = reportMapper.getCorrelationOfficeIdByName("苏州分公司");
 | 
	
		
			
				|  |  | +                    if (StringUtils.isNotBlank(officeId) && officeId.contains(reportData.getOfficeId())){
 | 
	
		
			
				|  |  | +                        stringList = reportMapper.getReviewByPost("质控-苏州分部");
 | 
	
		
			
				|  |  | +                    }else if (reportData.getReportType().equals("1")) {
 | 
	
		
			
				|  |  | +                        stringList = reportMapper.getReviewByPost("质控-财务-苏兴会基字");
 | 
	
		
			
				|  |  | +                    } else {
 | 
	
		
			
				|  |  | +                        stringList = reportMapper.getReviewByPost("质控-财务-非苏兴会基字");
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    reportData.setReviewBys(stringList);
 | 
	
		
			
				|  |  | +                    //将新增行数据查询出来放入到cwProjectInfoList中
 | 
	
		
			
				|  |  | +                    cwProjectInfoData = infoMapper.selectByReportId(reportData.getId());
 | 
	
		
			
				|  |  | +                    if (null != cwProjectInfoData){
 | 
	
		
			
				|  |  | +                        reportData.setServedUnitName(cwProjectInfoData.getServedUnitName());
 | 
	
		
			
				|  |  | +                        reportData.setServedUnitId(cwProjectInfoData.getServedUnitId());
 | 
	
		
			
				|  |  | +                        reportData.setReportDate(cwProjectInfoData.getReportDate());
 | 
	
		
			
				|  |  | +                        reportData.setReportType(cwProjectInfoData.getReportType());
 | 
	
		
			
				|  |  | +                        reportData.setReportNumber(cwProjectInfoData.getReportNumber());
 | 
	
		
			
				|  |  | +                        reportData.setReportNo(cwProjectInfoData.getReportNo());
 | 
	
		
			
				|  |  | +                        reportData.setSealType(cwProjectInfoData.getSealType());
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        CwSignatureAnnotator cwSignatureAnnotator=cwSignatureAnnotatorMapper.getSigById(id);
 | 
	
		
			
				|  |  | +        if (ObjectUtil.isNotEmpty(cwSignatureAnnotator)){
 | 
	
		
			
				|  |  | +            reportData.setProcInsSigId(cwSignatureAnnotator.getProcInsId());
 | 
	
		
			
				|  |  | +            reportData.setSigReason(cwSignatureAnnotator.getReason());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return reportData;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      public Map getAuditInfoMap(HttpServletResponse response, String id) {
 | 
	
		
			
				|  |  |  
 |