소스 검색

财务-报告作废归档修改

wangqiang 2 년 전
부모
커밋
e4a56cedce

+ 2 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/projectReport/mapper/CwProjectReportMapper.java

@@ -129,4 +129,6 @@ public interface CwProjectReportMapper extends BaseMapper<CwProjectReport> {
     List<ReviewUser> getReviewByS(String parentId);
 
     List<WorkAttachmentDto> findDtos(@Param("id") String id);
+
+    CwProjectReport getByNewLineId(String reportId);
 }

+ 3 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/projectReport/mapper/xml/CwProjectReportMapper.xml

@@ -455,4 +455,7 @@
 			del_flag = 0
 			AND attachment_id = #{id}
     </select>
+    <select id="getByNewLineId" resultType="com.jeeplus.test.cw.projectReport.domain.CwProjectReport">
+        select * from cw_project_report where id = #{reportId}
+    </select>
 </mapper>

+ 2 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/reportCancellApply/mapper/ReportCancellApplyMapper.java

@@ -36,4 +36,6 @@ public interface ReportCancellApplyMapper extends BaseMapper<ReportCancellApply>
      * @return
      */
     IPage<ReportInfoDto> findList(Page<ReportInfoDto> page, @Param(Constants.WRAPPER) QueryWrapper<ReportInfoDto> queryWrapper);
+
+    ReportCancellApply selectByArchivedId(String id);
 }

+ 6 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/reportCancellApply/mapper/xml/ReportCancellApplyMapper.xml

@@ -88,4 +88,10 @@
         on a.id = cw_ar.archive_id
         ${ew.customSqlSegment}
     </select>
+    <select id="selectByArchivedId"
+            resultType="com.jeeplus.test.cw.reportCancellApply.domain.ReportCancellApply">
+        select a.* from cw_project_report_cancell_apply a
+        left join cw_project_report_cancell_apply_archived b on a.id = b.archive_id
+        where b.id = #{id}
+    </select>
 </mapper>

+ 2 - 2
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/reportCancellApplyArchived/domain/CwProjectReportApplyArchive.java

@@ -82,8 +82,8 @@ public class CwProjectReportApplyArchive extends BaseEntity {
     /**
      * 状态
      */
-    @Query(tableColumn = "cw_pa.status",type = QueryType.EQ)
-    private String status;
+    @Query(tableColumn = "cw_pa.apply_file_type",type = QueryType.EQ)
+    private String applyFileType;
 
     /**
      * 档案号

+ 13 - 2
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/reportCancellApplyArchived/mapper/ReportCancellApplyArchivedMapper.java

@@ -38,8 +38,6 @@ public interface ReportCancellApplyArchivedMapper extends BaseMapper<CwProjectRe
 
     ApplyArchiveReportDTO queryById(@Param("id") String id);
 
-    ApplyArchiveReportDTO queryById2(@Param("id") String id);
-
     CwProjectReportApplyArchive selectByApplyId(String id);
 
     /**
@@ -77,4 +75,17 @@ public interface ReportCancellApplyArchivedMapper extends BaseMapper<CwProjectRe
     ApplyArchiveReportDTO queryByArchivedId(String id);
 
     void updateStatusByArchiveId(@Param("status")String status, @Param("id")String archiveId);
+
+    /**
+     * 获取新增行id
+     * @param id
+     * @return
+     */
+    String getNewLineId(String id);
+
+    String getBfId(String newLineId);
+
+    CwProjectReportApplyArchive getInfoByBFID(String bfId);
+
+    CwProjectRecordsDTO getProjectByNewLineId(String reportNewLineId);
 }

+ 24 - 73
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/reportCancellApplyArchived/mapper/xml/ReportCancellApplyArchivedMapper.xml

@@ -18,7 +18,7 @@
         cw_pa.audit_date,
         cw_pa.proc_ins_id,
         cw_pa.process_definition_id,
-        cw_pa.status,
+        cw_pa.apply_file_type,
         cw_pa.file_number,
         cw_pa.report_id,
         cw_pa.report_remarks,
@@ -41,10 +41,10 @@
         update cw_project_report_cancell_apply set apply_file_type = #{status} where id = #{id}
     </update>
     <update id="updateCancellArchiveType">
-        update cw_project_report_cancell_apply set apply_file_type = #{status} where id = #{id}
+        update cw_project_report_cancell_apply_archived set apply_file_type = #{status} where id = #{id}
     </update>
     <update id="updateStatusByArchiveId">
-        update cw_project_report_cancell_apply_archived set status = #{status} where archive_id = #{id}
+        update cw_project_report_cancell_apply set apply_file_type = #{status} where id = #{id}
     </update>
     <delete id="deleteFileInfo">
         delete from work_attachment where attachment_id = #{attachmentId}
@@ -109,17 +109,17 @@
 		b.report_no
 		from cw_project_report_cancell_apply cw_a
 		left join cw_project_report_cancell_apply_archived cw_pa on cw_a.id = cw_pa.archive_id
-		left join sys_user su on su.id = cw_pa.create_by and su.del_flag = '0'
+		left join sys_user su on su.id = cw_pa.create_by
 		left join(
 		select
 		<include refid="prnl_column"></include>
 		from cw_project_report_new_line cw_prnl
 		left join cw_project_report cw_pr on cw_pr.id = cw_prnl.report_id
-		left join sys_user su on su.id = cw_prnl.create_by and su.del_flag = '0'
-		left join sys_user su1 on su1.id = cw_pr.signature_annotator1 and su1.del_flag = '0'
-		left join sys_user su2 on su2.id = cw_pr.signature_annotator2 and su2.del_flag = '0'
+		left join sys_user su on su.id = cw_prnl.create_by
+		left join sys_user su1 on su1.id = cw_pr.signature_annotator1
+		left join sys_user su2 on su2.id = cw_pr.signature_annotator2
 		) b on b.report_id = cw_pa.report_id
-		where cw_a.del_flag = '0' and cw_a.id = #{id}
+		where cw_a.id = #{id}
 	</select>
     <select id="selectByApplyId"
             resultType="com.jeeplus.test.cw.reportCancellApplyArchived.domain.CwProjectReportApplyArchive">
@@ -227,70 +227,21 @@
         ) b on b.report_id = cw_pa.report_id
         where cw_pa.del_flag = '0' and cw_pa.id = #{id}
     </select>
-    <select id="queryById2"
-            resultType="com.jeeplus.test.cw.reportCancellApplyArchived.service.dto.ApplyArchiveReportDTO">
-        SELECT
-        a.id,
-        a.create_by as createById,
-        a.create_date,
-        a.update_by,
-        a.update_date,
-        a.del_flag,
-        a.remarks,
-        a.status,
-        a.document_no,
-        a.project_report_number,
-        a.project_id,
-        a.office_id,
-        a.signature_type,
-        a.signature_annotator1,
-        a.signature_annotator2,
-        a.signature_contract_id,
-        a.proc_ins_id,
-        a.process_definition_id,
-        b.project_number as projectNumber,
-        b.project_name as projectName,
-        c.name as departmentName,
-        d.name as userName,
-        a.create_date,
-        a.audit_fees,
-        e.name as projectMasterName,
-        a.real_create,
-        a.business_type,
-        a.audit_business_type,
-        a.register_address,
-        a.business_location,
-        a.security_business,
-        cw_prs1.proc_ins_id as proc_ins_id1,
-        cw_prs1.process_definition_id as process_definition_id1,
-        cw_prs1.status as status1,
-        cw_prs1.id as sid1,
-        cw_prs2.proc_ins_id as proc_ins_id2,
-        cw_prs2.process_definition_id as process_definition_id2,
-        cw_prs2.status as status2,
-        cw_prs2.id as sid2,
-        cw_prs3.proc_ins_id as proc_ins_ids3,
-        cw_prs3.process_definition_id as process_definition_id3,
-        cw_prs3.status as status3,
-        cw_prs3.id as sid3,
-        new_line.served_unit_id as servedUnitId,
-        new_line.report_date as reportDate,
-        new_line.report_type as reportType,
-        new_line.report_number as reportNumber,
-        new_line.report_no as reportNo,
-        new_line.opinion_type as opinionType,
-        new_line.seal_type as sealType,
-        cw_re.proc_ins_id as procInsId3
-        FROM cw_project_report a
-        left join cw_project_records b on a.project_id = b.id
-        LEFT JOIN sys_office c on a.office_id = c.id
-        LEFT JOIN sys_user d on a.create_by = d.id
-        LEFT JOIN sys_user e on b.project_master_id = e.id
-        LEFT JOIN cw_project_report_signature cw_prs1 on cw_prs1.report_id = a.id and cw_prs1.type = '1' and cw_prs1.del_flag = '0'
-        LEFT JOIN cw_project_report_signature cw_prs2 on cw_prs2.report_id = a.id and cw_prs2.type = '2' and cw_prs2.del_flag = '0'
-        LEFT JOIN cw_project_report_signature cw_prs3 on cw_prs3.report_id = a.id and cw_prs3.type = '3' and cw_prs3.del_flag = '0'
-        left join cw_project_report_new_line new_line on a.id = new_line.report_id
-        left join cw_project_report_review cw_re on a.id = cw_re.report_id and cw_re.del_flag = '0'
-        where a.id = #{id}
+
+    <select id="getNewLineId" resultType="java.lang.String">
+        select id from cw_project_report_new_line where report_id = #{id}
+    </select>
+    <select id="getBfId" resultType="java.lang.String">
+        select id from cw_project_report_cancell_apply where report_new_line_id = #{newLineId}
+    </select>
+    <select id="getInfoByBFID"
+            resultType="com.jeeplus.test.cw.reportCancellApplyArchived.domain.CwProjectReportApplyArchive">
+        select * from cw_project_report_cancell_apply_archived where archive_id = #{bfId}
+    </select>
+    <select id="getProjectByNewLineId" resultType="com.jeeplus.test.cw.projectRecords.service.dto.CwProjectRecordsDTO">
+        select cw.* from cw_project_records cw
+        left join cw_project_report cw_p on cw.id = cw_p.project_id
+        left join cw_project_report_new_line cw_n on cw_p.id = cw_n.report_id
+        where cw_n.id = #{reportNewLineId}
     </select>
 </mapper>

+ 110 - 127
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/reportCancellApplyArchived/service/ReportCancellApplyArchivedService.java

@@ -12,6 +12,7 @@ import com.jeeplus.sys.utils.StringUtils;
 import com.jeeplus.sys.utils.UserUtils;
 import com.jeeplus.test.cw.projectRecords.service.dto.CwProjectRecordsDTO;
 import com.jeeplus.test.cw.projectReport.domain.CwProjectInfoData;
+import com.jeeplus.test.cw.projectReport.domain.CwProjectReport;
 import com.jeeplus.test.cw.projectReport.domain.CwProjectReportData;
 import com.jeeplus.test.cw.projectReport.mapper.CwProjectInfoMapper;
 import com.jeeplus.test.cw.projectReport.mapper.CwProjectReportMapper;
@@ -28,6 +29,7 @@ import com.jeeplus.test.oss.domain.WorkAttachment;
 import com.jeeplus.test.oss.mapper.OssServiceMapper;
 import com.jeeplus.test.oss.service.OssService;
 import com.jeeplus.test.workContract.service.dto.WorkAttachmentDto;
+import liquibase.pro.packaged.A;
 import org.flowable.editor.language.json.converter.util.CollectionUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
@@ -110,117 +112,88 @@ public class ReportCancellApplyArchivedService extends ServiceImpl<ReportCancell
      */
     public ApplyArchiveReportDTO queryById(String id) {
         //传过来的是报告作废流程表的id
-        ReportCancellApply archive = cancellApplyMapper.selectById(id);
+        ReportCancellApply apply = cancellApplyMapper.selectById(id);
         ApplyArchiveReportDTO reportDTO = new ApplyArchiveReportDTO();
-        if (null != archive) {
-            CwProjectInfoData infoData = infoMapper.getById(archive.getReportNewLineId());
-            if (null != infoData) {
-                reportDTO = applyMapper.queryById2(infoData.getReportId());
-                //查询报告作废归档表的id
-                if (null != reportDTO) {
-                    CwProjectReportApplyArchive applyArchive = applyMapper.selectByArchiveId(id);
-                    if (null != applyArchive) {
-                        List<CwWorkAttachmentArchiveDto> files = applyMapper.selectFileInfoByAttid(applyArchive.getId());
-                        if (null != files) {
-                            files.forEach(fi -> {
-                                UserDTO userDTO = applyMapper.getUserInfo(fi.getUserId());
-                                fi.setCreateBy(userDTO);
-                            });
-                            //附件信息
-                            reportDTO.setWorkAttachmentDtoList(files);
-                            //设置报告册数、底稿册数、档案年度、归档类型、备注
-                            reportDTO.setReportNum(applyArchive.getReportNum());
-                            reportDTO.setPapersNum(applyArchive.getPapersNum());
-                            reportDTO.setYear(applyArchive.getYear());
-                            reportDTO.setNumber(applyArchive.getNumber());
-                            reportDTO.setIsNumber(applyArchive.getIsNumber());
-                            reportDTO.setAuditDate(applyArchive.getAuditDate());
-                            reportDTO.setFileNumber(applyArchive.getFileNumber());
-                            reportDTO.setReportRemarks(applyArchive.getReportRemarks());
-                            reportDTO.setCarchivedType(applyArchive.getCarchivedType());
-                        }
-
-                        //项目信息
-                        //先查出新建行id,根据新建行id查出reportid,根据reportid查出projectId
-//                CwProjectRecordsDTO recordsDTO = applyMapper.selectProjectInfo(reportDTO.getProjectId());
-//                if (null != recordsDTO) {
-//                    reportDTO.setCwProjectRecordsDTO(recordsDTO);
-//                }
-                    }
-                    //项目信息
-                    //先查出新建行id,根据新建行id查出reportid,根据reportid查出projectId
-                    CwProjectRecordsDTO recordsDTO = applyMapper.selectProjectInfo(reportDTO.getProjectId());
-                    if (null != recordsDTO) {
-                        reportDTO.setCwProjectRecordsDTO(recordsDTO);
-                    }
+        if (null != apply) {
+            //根据报告表id查出报废归档信息
+            CwProjectReportApplyArchive applyArchive = applyMapper.getInfoByBFID(apply.getId());
+            if (null != applyArchive) {
+                reportDTO.setReportNum(applyArchive.getReportNum());
+                reportDTO.setPapersNum(applyArchive.getPapersNum());
+                reportDTO.setYear(applyArchive.getYear());
+                reportDTO.setNumber(applyArchive.getNumber());
+                reportDTO.setIsNumber(applyArchive.getIsNumber());
+                reportDTO.setAuditDate(applyArchive.getAuditDate());
+                reportDTO.setFileNumber(applyArchive.getFileNumber());
+                reportDTO.setApplyFileType(applyArchive.getApplyFileType());
+                reportDTO.setReportRemarks(applyArchive.getReportRemarks());
+                reportDTO.setCarchivedType(applyArchive.getCarchivedType());
+                //设置附件
+                List<CwWorkAttachmentArchiveDto> files = applyMapper.selectFileInfoByAttid(applyArchive.getId());
+                if (null != files) {
+                    files.forEach(fi -> {
+                        UserDTO userDTO = applyMapper.getUserInfo(fi.getUserId());
+                        fi.setCreateBy(userDTO);
+                    });
+                    //附件信息
+                    reportDTO.setWorkAttachmentDtoList(files);
                 }
             }
+            //设置项目信息
+            //根据新建行id找到项目id
+            CwProjectRecordsDTO recordsDTO = applyMapper.getProjectByNewLineId(apply.getReportNewLineId());
+            reportDTO.setCwProjectRecordsDTO(recordsDTO);
+            //设置报告文号相关信息
+            //根据新建行找到签字注师信息与报告文号信息
+            CwProjectInfoData byId = infoMapper.getById(apply.getReportNewLineId());
+            CwProjectReport report = reportMapper.getByNewLineId(byId.getReportId());
+            reportDTO.setReportNo(byId.getReportNo());
+            reportDTO.setReportDate(byId.getReportDate());
+            reportDTO.setReportCreateName(byId.getCreateBy());
+            reportDTO.setSignatureAnnotator1Name(report.getSignatureAnnotator1());
+            reportDTO.setSignatureAnnotator2Name(report.getSignatureAnnotator2());
         } else {
-            //传过来的是报废归档表id
-            CwProjectReportApplyArchive applyArchive1 = applyMapper.selectById(id);
-            if ( null != applyArchive1) {
-                archive = cancellApplyMapper.selectById(applyArchive1.getArchiveId());
-                if ( null != archive) {
-                    CwProjectInfoData infoData = infoMapper.getById(archive.getReportNewLineId());
-                    if (null != infoData) {
-                        reportDTO = applyMapper.queryById2(infoData.getReportId());
-                        //查询报告作废归档表的id
-                        if (null != reportDTO) {
-                            CwProjectReportApplyArchive applyArchive = applyMapper.selectByArchiveId(id);
-                            if (null != applyArchive) {
-                                List<CwWorkAttachmentArchiveDto> files = applyMapper.selectFileInfoByAttid(applyArchive.getId());
-                                if (null != files) {
-                                    files.forEach(fi -> {
-                                        UserDTO userDTO = applyMapper.getUserInfo(fi.getUserId());
-                                        fi.setCreateBy(userDTO);
-                                    });
-                                    //附件信息
-                                    reportDTO.setWorkAttachmentDtoList(files);
-                                    //设置报告册数、底稿册数、档案年度、归档类型、备注
-                                    reportDTO.setReportNum(applyArchive.getReportNum());
-                                    reportDTO.setPapersNum(applyArchive.getPapersNum());
-                                    reportDTO.setYear(applyArchive.getYear());
-                                    reportDTO.setNumber(applyArchive.getNumber());
-                                    reportDTO.setIsNumber(applyArchive.getIsNumber());
-                                    reportDTO.setAuditDate(applyArchive.getAuditDate());
-                                    reportDTO.setFileNumber(applyArchive.getFileNumber());
-                                    reportDTO.setReportRemarks(applyArchive.getReportRemarks());
-                                    reportDTO.setCarchivedType(applyArchive.getCarchivedType());
-                                }
-                                //项目信息
-                                //先查出新建行id,根据新建行id查出reportid,根据reportid查出projectId
-//                CwProjectRecordsDTO recordsDTO = applyMapper.selectProjectInfo(reportDTO.getProjectId());
-//                if (null != recordsDTO) {
-//                    reportDTO.setCwProjectRecordsDTO(recordsDTO);
-//                }
-                            }
-                            //项目信息
-                            //先查出新建行id,根据新建行id查出reportid,根据reportid查出projectId
-                            CwProjectRecordsDTO recordsDTO = applyMapper.selectProjectInfo(reportDTO.getProjectId());
-                            if (null != recordsDTO) {
-                                reportDTO.setCwProjectRecordsDTO(recordsDTO);
-                            }
-                        }
+            //传来的是归档的id
+            apply = cancellApplyMapper.selectByArchivedId(id);
+            if (null != apply) {
+                //根据报告表id查出报废归档信息
+                CwProjectReportApplyArchive applyArchive = applyMapper.getInfoByBFID(apply.getId());
+                if (null != applyArchive) {
+                    reportDTO.setReportNum(applyArchive.getReportNum());
+                    reportDTO.setPapersNum(applyArchive.getPapersNum());
+                    reportDTO.setYear(applyArchive.getYear());
+                    reportDTO.setNumber(applyArchive.getNumber());
+                    reportDTO.setIsNumber(applyArchive.getIsNumber());
+                    reportDTO.setAuditDate(applyArchive.getAuditDate());
+                    reportDTO.setFileNumber(applyArchive.getFileNumber());
+                    reportDTO.setApplyFileType(applyArchive.getApplyFileType());
+                    reportDTO.setReportRemarks(applyArchive.getReportRemarks());
+                    reportDTO.setCarchivedType(applyArchive.getCarchivedType());
+                    //设置附件
+                    List<CwWorkAttachmentArchiveDto> files = applyMapper.selectFileInfoByAttid(applyArchive.getId());
+                    if (null != files) {
+                        files.forEach(fi -> {
+                            UserDTO userDTO = applyMapper.getUserInfo(fi.getUserId());
+                            fi.setCreateBy(userDTO);
+                        });
+                        //附件信息
+                        reportDTO.setWorkAttachmentDtoList(files);
                     }
                 }
+                //设置项目信息
+                //根据新建行id找到项目id
+                CwProjectRecordsDTO recordsDTO = applyMapper.getProjectByNewLineId(apply.getReportNewLineId());
+                reportDTO.setCwProjectRecordsDTO(recordsDTO);
+                //设置报告文号相关信息
+                //根据新建行找到签字注师信息与报告文号信息
+                CwProjectInfoData byId = infoMapper.getById(apply.getReportNewLineId());
+                CwProjectReport report = reportMapper.getByNewLineId(byId.getReportId());
+                reportDTO.setReportNo(byId.getReportNo());
+                reportDTO.setReportDate(byId.getReportDate());
+                reportDTO.setReportCreateName(byId.getCreateBy());
+                reportDTO.setSignatureAnnotator1Name(report.getSignatureAnnotator1());
+                reportDTO.setSignatureAnnotator2Name(report.getSignatureAnnotator2());
             }
-            //传过来的是归档的id
-//            reportDTO = applyMapper.queryByArchivedId(id);
-//            CwProjectReportApplyArchive applyArchive = applyMapper.selectByArchiveId(reportDTO.getId());
-//            if (null != applyArchive) {
-//                List<CwWorkAttachmentArchiveDto> files = applyMapper.selectFileInfoByAttid(applyArchive.getId());
-//                if (null != files) {
-//                    files.forEach(fi -> {
-//                        UserDTO userDTO = applyMapper.getUserInfo(fi.getUserId());
-//                        fi.setCreateBy(userDTO);
-//                    });
-//                    reportDTO.setWorkAttachmentDtoList(files);
-//                }
-//                CwProjectRecordsDTO recordsDTO = applyMapper.selectProjectInfo(reportDTO.getProjectId());
-//                if (null != recordsDTO) {
-//                    reportDTO.setCwProjectRecordsDTO(recordsDTO);
-//                }
-//            }
         }
         return reportDTO;
     }
@@ -233,27 +206,19 @@ public class ReportCancellApplyArchivedService extends ServiceImpl<ReportCancell
      * @throws Exception
      */
     public String saveForm(ApplyArchiveReportDTO cwProjectReportArchiveDTO) throws Exception {
-
-        if (StringUtils.isNotEmpty(cwProjectReportArchiveDTO.getId())) {
-            CwProjectReportApplyArchive report = applyMapper.selectByApplyId(cwProjectReportArchiveDTO.getId());
+        //根据报废id来查是否有改数据
+        CwProjectReportApplyArchive report = applyMapper.getInfoByBFID(cwProjectReportArchiveDTO.getId());
+        if (null != report) {
+            report.setCreateBy(cwProjectReportArchiveDTO.getCreateBy().getId());
+            return update(cwProjectReportArchiveDTO, report.getId(),report.getArchiveId(),report.getProcInsId(),report.getProcessDefinitionId());
+        } else {
+            report = applyMapper.selectById(cwProjectReportArchiveDTO.getId());
             if (null != report) {
-                //修改报告作废表的归档状态
-                applyMapper.updateArchiveStyle(cwProjectReportArchiveDTO.getId(), cwProjectReportArchiveDTO.getStatus());
-                report.setCreateBy(cwProjectReportArchiveDTO.getCreateBy().getId());
-                return update(cwProjectReportArchiveDTO, report.getId());
+                return update(cwProjectReportArchiveDTO, report.getId(),report.getArchiveId(),report.getProcInsId(),report.getProcessDefinitionId());
             } else {
-                //传过来的是归档id
-                report = applyMapper.selectById(cwProjectReportArchiveDTO.getId());
-                if (null != report) {
-                    //修改报告作废表的归档状态
-                    applyMapper.updateArchiveStyle(report.getArchiveId(), cwProjectReportArchiveDTO.getStatus());
-                    report.setCreateBy(cwProjectReportArchiveDTO.getCreateBy().getId());
-                    return update(cwProjectReportArchiveDTO, report.getId());
-                }
+                return add(cwProjectReportArchiveDTO);
             }
-
         }
-        return add(cwProjectReportArchiveDTO);
     }
 
     /**
@@ -271,10 +236,15 @@ public class ReportCancellApplyArchivedService extends ServiceImpl<ReportCancell
         applyArchive.setCreateDate(new Date());
         applyArchive.setUpdateBy(userDTO.getId());
         applyArchive.setUpdateDate(new Date());
+        //传过来的是report表的id
+        //根据改id查报废信息
+//        String newLineId = applyMapper.getNewLineId(reportDTO.getId());
+        //根据newLineID查出报废表id
+//        String bfId = applyMapper.getBfId(newLineId);
         applyArchive.setArchiveId(reportDTO.getId());
         applyMapper.insert(applyArchive);
         //修改报告作废表的归档状态
-        applyMapper.updateArchiveStyle(reportDTO.getId(), applyArchive.getStatus());
+        applyMapper.updateArchiveStyle(reportDTO.getId(), applyArchive.getApplyFileType());
         List<CwWorkAttachmentArchiveDto> list = reportDTO.getWorkAttachmentDtoList();
         if (CollectionUtils.isNotEmpty(list)) {
             saveFiles(list, userDTO, id);
@@ -286,7 +256,7 @@ public class ReportCancellApplyArchivedService extends ServiceImpl<ReportCancell
      * 修改
      */
     @Transactional(rollbackFor = Exception.class)
-    public String update(ApplyArchiveReportDTO reportData, String id) throws Exception {
+    public String update(ApplyArchiveReportDTO reportData, String id,String archiveId,String procInsId,String defId) throws Exception {
         //获取当前登录人信息
         UserDTO userDTO = UserUtils.getCurrentUserDTO();
 
@@ -295,8 +265,12 @@ public class ReportCancellApplyArchivedService extends ServiceImpl<ReportCancell
         cwProjectReportArchive.setUpdateBy(userDTO.getId());
         cwProjectReportArchive.setUpdateDate(new Date());
         cwProjectReportArchive.setId(id);
-        cwProjectReportArchive.setArchiveId(reportData.getId());
+        cwProjectReportArchive.setArchiveId(archiveId);
+        cwProjectReportArchive.setProcInsId(procInsId);
+        cwProjectReportArchive.setProcessDefinitionId(defId);
         applyMapper.updateById(cwProjectReportArchive);
+        //修改报告作废表的归档状态
+        applyMapper.updateArchiveStyle(cwProjectReportArchive.getArchiveId(), cwProjectReportArchive.getApplyFileType());
         //对上传的文件数据进行持久化操作
         List<CwWorkAttachmentArchiveDto> list = reportData.getWorkAttachmentDtoList();
         if (CollectionUtils.isNotEmpty(list)) {
@@ -405,9 +379,18 @@ public class ReportCancellApplyArchivedService extends ServiceImpl<ReportCancell
      */
     public String updateStatusById(ApplyArchiveReportDTO cwProjectReportArchiveDTO) {
         CwProjectReportApplyArchive cwProjectReportArchive = new CwProjectReportApplyArchive();
-        //修改报告作废表归档状态
-        applyMapper.updateCancellArchiveType(cwProjectReportArchiveDTO.getStatus(), cwProjectReportArchiveDTO.getId());
-        applyMapper.updateStatusByArchiveId(cwProjectReportArchive.getStatus(), cwProjectReportArchive.getArchiveId());
+        CwProjectReportApplyArchive applyArchive = applyMapper.selectById(cwProjectReportArchiveDTO.getId());
+        if (null != applyArchive){
+            applyMapper.updateCancellArchiveType(cwProjectReportArchiveDTO.getApplyFileType(), cwProjectReportArchiveDTO.getId());
+
+            applyMapper.updateStatusByArchiveId(cwProjectReportArchiveDTO.getApplyFileType(), applyArchive.getArchiveId());
+        } else {
+            applyArchive = applyMapper.getInfoByBFID(cwProjectReportArchiveDTO.getId());
+            applyMapper.updateCancellArchiveType(cwProjectReportArchiveDTO.getApplyFileType(), applyArchive.getId());
+
+            applyMapper.updateStatusByArchiveId(cwProjectReportArchiveDTO.getApplyFileType(), applyArchive.getArchiveId());
+        }
+
         return "操作成功";
     }