@ -1,10 +1,17 @@
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				package   org.dromara.design.service.impl ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   cn.hutool.core.bean.BeanUtil ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   cn.hutool.core.collection.CollUtil ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.baomidou.mybatisplus.core.toolkit.Wrappers ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.baomidou.mybatisplus.extension.plugins.pagination.Page ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.baomidou.mybatisplus.extension.service.impl.ServiceImpl ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   lombok.RequiredArgsConstructor ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   lombok.extern.slf4j.Slf4j ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.cailiaoshebei.domain.BusTotalsupplyplan ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.cailiaoshebei.domain.BusTotalsupplyplanAudit ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.cailiaoshebei.service.IBusTotalsupplyplanAuditService ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.cailiaoshebei.service.IBusTotalsupplyplanService ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.common.core.domain.event.ProcessDeleteEvent ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.common.core.domain.event.ProcessEvent ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.common.core.domain.event.ProcessTaskEvent ; 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -13,30 +20,26 @@ import org.dromara.common.core.exception.ServiceException;
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.common.core.utils.MapstructUtils ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.common.core.utils.StringUtils ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.common.excel.coryUtils.ExcelReader ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.common.mybatis.core.page.TableDataInfo ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.common.mybatis.core.page.PageQuery ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.baomidou.mybatisplus.extension.plugins.pagination.Page ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   com.baomidou.mybatisplus.core.toolkit.Wrappers ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   lombok.RequiredArgsConstructor ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.common.mybatis.core.page.TableDataInfo ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.common.utils.BatchNumberGenerator ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.common.utils.excel.ExcelDynamicReader ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.design.domain.*  ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.design.domain.BusBillofquantities  ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.design.domain.BusBillofquantitiesVersions ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.design.domain.bo.* ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.design.domain.dto.MaterialsAndEquipmentExcelDto ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.design.domain.vo.BusBillofquantitiesMaterialTotalVo ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.design.domain.vo.BusBillofquantitiesVersionsVo ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.design.domain.vo.DetailsMaterialAndEquipmentApprovalRes ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.design.domain.vo.ObtainTheListRes ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.design.mapper.BusBillofquantitiesVersionsMapper ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.design.service.IBusBillofquantitiesService ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.cailiaoshebei.service.IBusTotalsupplyplanAudit Service ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.cailiaoshebei.service.IBusTotalsupplyplanService ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.design.service.IBusBillofquantitiesVersions Service ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.system.domain.vo.SysOssUploadVo ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.system.service.ISysOssService ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.springframework.beans.factory.annotation.Autowired ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.springframework.context.event.EventListener ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.springframework.stereotype.Service ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.design.domain.vo.BusBillofquantitiesVersionsVo ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.design.mapper.BusBillofquantitiesVersionsMapper ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.dromara.design.service.IBusBillofquantitiesVersionsService ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.springframework.transaction.annotation.Transactional ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				import   org.springframework.web.multipart.MultipartFile ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -72,7 +75,7 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     * @return 工程量清单版本 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     */ 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     @Override 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     public   BusBillofquantitiesVersionsVo   queryById ( Long   id ) { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     public   BusBillofquantitiesVersionsVo   queryById ( Long   id )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         return   baseMapper . selectVoById ( id ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -144,7 +147,7 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     /** 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     * 保存前的数据校验 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     */ 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     private   void   validEntityBeforeSave ( BusBillofquantitiesVersions   entity ) { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     private   void   validEntityBeforeSave ( BusBillofquantitiesVersions   entity )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         //TODO 做一些数据校验,如唯一约束 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -157,7 +160,7 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     */ 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     @Override 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     public   Boolean   deleteWithValidByIds ( Collection < Long >   ids ,   Boolean   isValid )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         if ( isValid ) { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         if   ( isValid )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             //TODO 做一些业务上的校验,判断是否需要校验 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         } 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -171,8 +174,8 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     @Transactional ( rollbackFor   =   Exception . class ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     public   Boolean   importExcelFile ( ImportExcelFileReq   bo ,   MultipartFile   file )   throws   Exception   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         //0、创建版本 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         SysOssUploadVo   wordEntity   =   ossService . uploadWithNoSave ( file ,   ossService . minioFileName ( BillOfQuantities , file ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         if ( wordEntity = = null ) { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         SysOssUploadVo   wordEntity   =   ossService . uploadWithNoSave ( file ,   ossService . minioFileName ( BillOfQuantities ,   file ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         if   ( wordEntity   = =   null )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             throw   new   ServiceException ( " 上传文件失败 " ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         String   banBen   =   BatchNumberGenerator . generateBatchNumber ( " GCLBB- " ) ; 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -182,13 +185,13 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             setProjectId ( bo . getProjectId ( ) ) . 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             setExcelFile ( wordEntity . getUrl ( ) ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         if ( insert < = 0 ) { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         if   ( insert   < =   0 )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             throw   new   RuntimeException ( " 创建版本失败 " ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         //1、获取到解析数据 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         ExcelReader . ExcelData   excelData   =   ExcelReader . readExcelFromMultipartFile ( file ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         //走正常的工程清单 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         if ( ! Objects . equals ( bo . getWorkOrderType ( ) ,   " 3 " ) ) { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         if   ( ! Objects . equals ( bo . getWorkOrderType ( ) ,   " 3 " ) )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             // 2. 解析所有工作表,  转换为带父子关系的ExcelMaterial列表  解析所有Sheet数据,  按规则生成sid和pid 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             List < BusBillofquantities >   allMaterials   =   new   ArrayList < > ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             for   ( ExcelReader . SheetData   sheetData   :   excelData . getSheetDataList ( ) )   { 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -199,18 +202,18 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				                 // 存储节点映射:  TreeNode → ExcelMaterial(  用于子节点关联父节点)  
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				                 Map < ExcelReader . TreeNode ,   BusBillofquantities >   nodeMap   =   new   HashMap < > ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				                 // 递归遍历树形结构,  生成sid和pid 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				                 traverseTree ( rootNode ,   nodeMap ,   allMaterials ,   sheetName , banBen ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				                 traverseTree ( rootNode ,   nodeMap ,   allMaterials ,   sheetName ,   banBen ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             // 3. 批量插入数据库 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             for   ( BusBillofquantities   allMaterial   :   allMaterials )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				                 allMaterial . setProjectId ( bo . getProjectId ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             boolean   b   =   busBillofquantitiesService . saveBatch ( allMaterials ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             if ( ! b ) { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             if   ( ! b )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				                 throw   new   RuntimeException ( " 导入失败 " ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             return   true ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         } else { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         }   else   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             // 跳过1行(  表头) ,  读取0到6列(  共7列) ,  映射到ExcelData实体类 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             List < MaterialsAndEquipmentExcelDto >   dataList   =   ExcelDynamicReader . readExcel ( 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				                 file ,            // 上传的文件 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -221,11 +224,11 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             List < BusBillofquantities >   busBillofquantities   =   BeanUtil . copyToList ( dataList ,   BusBillofquantities . class ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             for   ( BusBillofquantities   busBillofquantity   :   busBillofquantities )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				                      busBillofquantity . setProjectId ( bo . getProjectId ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				                      busBillofquantity . setVersions ( banBen ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				                 busBillofquantity . setProjectId ( bo . getProjectId ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				                 busBillofquantity . setVersions ( banBen ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             boolean   b   =   busBillofquantitiesService . saveBatch ( busBillofquantities ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             if ( ! b ) { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             if   ( ! b )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				                 throw   new   RuntimeException ( " 导入失败 " ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             return   true ; 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -241,7 +244,7 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             return   Collections . emptyList ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         // sheet为空表示不走下面的代码 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         if ( StringUtils . isBlank ( bo . getSheet ( ) ) ) { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         if   ( StringUtils . isBlank ( bo . getSheet ( ) ) )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             return   flatList ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         // 2. 构建父子映射:  key=父节点pid,  value=该父节点的所有子节点 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -259,12 +262,12 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         DetailsMaterialAndEquipmentApprovalRes   detailsMaterialAndEquipmentApprovalRes   =   new   DetailsMaterialAndEquipmentApprovalRes ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         //根据版本号获取数据 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         BusBillofquantitiesVersions   busBillofquantitiesVersions   =   baseMapper . selectOne ( new   LambdaQueryWrapper < BusBillofquantitiesVersions > ( ) . eq ( BusBillofquantitiesVersions : : getVersions ,   versions ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         if ( busBillofquantitiesVersions = = null ) { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         if   ( busBillofquantitiesVersions   = =   null )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             throw   new   ServiceException ( " 版本不存在 " ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         //根据版本号获取物资设备清单 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         List < BusBillofquantities >   busBillofquantities   =   busBillofquantitiesService . list ( new   LambdaQueryWrapper < BusBillofquantities > ( ) . eq ( BusBillofquantities : : getVersions ,   versions ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         if ( busBillofquantities = = null ) { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         if   ( busBillofquantities   = =   null )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             throw   new   ServiceException ( " 版本不存在 " ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         detailsMaterialAndEquipmentApprovalRes . setVersions ( busBillofquantitiesVersions . getVersions ( ) ) ; 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -273,9 +276,50 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         return   detailsMaterialAndEquipmentApprovalRes ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     /** 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     * 根据项目 id 获取物资设备清单总数据 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     * 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     * @param projectId 项目id 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     */ 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     @Override 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     public   List < BusBillofquantitiesMaterialTotalVo >   queryMaterialTotalListByProject ( Long   projectId )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         List < BusBillofquantitiesVersions >   billofquantitiesVersionsList   =   this . lambdaQuery ( ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             . eq ( BusBillofquantitiesVersions : : getProjectId ,   projectId ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             . eq ( BusBillofquantitiesVersions : : getWorkOrderType ,   " 3 " ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             . eq ( BusBillofquantitiesVersions : : getStatus ,   BusinessStatusEnum . FINISH . getStatus ( ) ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             . list ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         if   ( CollUtil . isEmpty ( billofquantitiesVersionsList ) )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             return   List . of ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         Set < String >   versions   =   billofquantitiesVersionsList . stream ( ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             . map ( BusBillofquantitiesVersions : : getVersions ) . collect ( Collectors . toSet ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         List < BusBillofquantities >   billofquantitiesList   =   busBillofquantitiesService . lambdaQuery ( ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             . eq ( BusBillofquantities : : getProjectId ,   projectId ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             . in ( BusBillofquantities : : getVersions ,   versions ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             . list ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         if   ( CollUtil . isEmpty ( billofquantitiesList ) )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             return   List . of ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         List < BusBillofquantitiesMaterialTotalVo >   list   =   new   ArrayList < > ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         Map < String ,   List < BusBillofquantities > >   map   =   billofquantitiesList . stream ( ) . collect ( Collectors . groupingBy ( BusBillofquantities : : getName ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         for   ( Map . Entry < String ,   List < BusBillofquantities > >   entry   :   map . entrySet ( ) )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             BusBillofquantitiesMaterialTotalVo   vo   =   new   BusBillofquantitiesMaterialTotalVo ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             String   key   =   entry . getKey ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             List < BusBillofquantities >   value   =   entry . getValue ( ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             vo . setName ( key ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             vo . setSpecification ( value . getFirst ( ) . getSpecification ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             vo . setUnit ( value . getFirst ( ) . getUnit ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             BigDecimal   sum   =   value . stream ( ) . map ( BusBillofquantities : : getQuantity ) . reduce ( BigDecimal . ZERO ,   BigDecimal : : add ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             vo . setQuantity ( sum ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             list . add ( vo ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         return   list ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     /** 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     * 递归构建树形结构 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     * @param parentId 父节点ID(  顶级节点为0)   
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     * 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     * @param parentId  父节点ID(  顶级节点为0)  
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     * @param parentMap 父子映射表(  key=pid,  value=子节点列表) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     * @return 组装好的子树列表 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     */ 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -310,7 +354,7 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         // 跳过空节点(无实际数据的中间节点) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         if   ( currentNode . getData ( ) . isEmpty ( ) )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             for   ( ExcelReader . TreeNode   child   :   currentNode . getChildren ( ) )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				                 traverseTree ( child ,   nodeMap ,   allMaterials ,   sheetName , banBen ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				                 traverseTree ( child ,   nodeMap ,   allMaterials ,   sheetName ,   banBen ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             return ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         } 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -352,7 +396,7 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         // 递归处理子节点 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         for   ( ExcelReader . TreeNode   child   :   currentNode . getChildren ( ) )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             traverseTree ( child ,   nodeMap ,   allMaterials ,   sheetName , banBen ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             traverseTree ( child ,   nodeMap ,   allMaterials ,   sheetName ,   banBen ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -397,7 +441,6 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     @Override 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     public   TableDataInfo < BusBillofquantitiesVersionsVo >   obtainAllVersionNumbers ( ObtainAllVersionNumbersReq   bo ,   PageQuery   pageQuery )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         LambdaQueryWrapper < BusBillofquantitiesVersions >   lqw   =   Wrappers . lambdaQuery ( ) ; 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -407,7 +450,7 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         lqw . orderByDesc ( BusBillofquantitiesVersions : : getCreateTime ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         Page < BusBillofquantitiesVersionsVo >   result   =   baseMapper . selectVoPage ( pageQuery . build ( ) ,   lqw ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         result . getRecords ( ) . forEach ( item   - >   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             System . out . println ( " 1           " + item . getStatus ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             System . out . println ( " 1           "   +   item . getStatus ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         } ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         return   TableDataInfo . build ( result ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     } 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -439,7 +482,7 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     * 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     * @param processEvent 参数 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     */ 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     @org.springframework.context.event. EventListener ( condition   =   " #processEvent.flowCode.endsWith('pickEquipmentList  ') " ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     @EventListener ( condition   =   " #processEvent.flowCode.endsWith('pickEquipmentList') " ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     public   void   processPlansHandler ( ProcessEvent   processEvent )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         log . info ( " 招采清单审核任务执行了{} " ,   processEvent . toString ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         String   id   =   processEvent . getBusinessId ( ) ; 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -459,7 +502,7 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             busTotalsupplyplanAudit . setProjectId ( versions . getProjectId ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             busTotalsupplyplanAudit . setBatchNumber ( num ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             boolean   save   =   busTotalsupplyplanAuditService . save ( busTotalsupplyplanAudit ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             if   ( ! save ) { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             if   ( ! save )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				                 log . info ( " 新增失败 " ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             //1、根据查询数据 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -473,7 +516,7 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				                 busTotalsupplyplan . setId ( null ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             boolean   b   =   busTotalsupplyplanService . saveBatch ( busTotalsupplyplans ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             if   ( ! b ) { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             if   ( ! b )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				                 log . info ( " 新增失败 " ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				             } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -490,7 +533,7 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     * 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     * @param processTaskEvent 参数 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     */ 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     @org.springframework.context.event.EventListener ( condition   =   " #processTaskEvent.flowCode.endsWith('pickEquipmentList  ') " ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     @org.springframework.context.event.EventListener ( condition   =   " #processTaskEvent.flowCode.endsWith('pickEquipmentList') " ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     public   void   processTaskPlansHandler ( ProcessTaskEvent   processTaskEvent )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         log . info ( " 招采清单审核任务创建了{} " ,   processTaskEvent . toString ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     } 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -502,7 +545,7 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     * 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     * @param processDeleteEvent 参数 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     */ 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     @EventListener ( condition   =   " #processDeleteEvent.flowCode.endsWith('pickEquipmentList  ') " ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     @EventListener ( condition   =   " #processDeleteEvent.flowCode.endsWith('pickEquipmentList') " ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     public   void   processDeletePlansHandler ( ProcessDeleteEvent   processDeleteEvent )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         log . info ( " 招采清单计划删除流程事件,技术标准文件审核任务执行了{} " ,   processDeleteEvent . toString ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     } 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -515,7 +558,7 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     * 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     * @param processEvent 参数 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     */ 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     @org.springframework.context.event.EventListener ( condition   =   " #processEvent.flowCode.endsWith('equipmentList   ') " ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     @org.springframework.context.event.EventListener ( condition   =   " #processEvent.flowCode.endsWith('equipmentList') " ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     public   void   processPlansHandlErequipmentList ( ProcessEvent   processEvent )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         log . info ( " 物资设备清单审核任务执行了{} " ,   processEvent . toString ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         String   id   =   processEvent . getBusinessId ( ) ; 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -536,7 +579,7 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     * 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     * @param processTaskEvent 参数 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     */ 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     @org.springframework.context.event. EventListener ( condition   =   " #processTaskEvent.flowCode.endsWith('equipmentList   ') " ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     @EventListener ( condition   =   " #processTaskEvent.flowCode.endsWith('equipmentList') " ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     public   void   processTaskPlansHandlerEquipmentList ( ProcessTaskEvent   processTaskEvent )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         log . info ( " 物资设备清单审核任务创建了{} " ,   processTaskEvent . toString ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     } 
 
			
		 
		
	
	
		
			
				
					
					
						
					 
				
			
			 
			 
			
				@ -548,7 +591,7 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     * 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     * @param processDeleteEvent 参数 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     */ 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     @EventListener ( condition   =   " #processDeleteEvent.flowCode.endsWith('equipmentList   ') " ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     @EventListener ( condition   =   " #processDeleteEvent.flowCode.endsWith('equipmentList') " ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     public   void   processDeletePlansHandlerEquipmentList ( ProcessDeleteEvent   processDeleteEvent )   { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				         log . info ( " 物资设备清单计划删除流程事件,技术标准文件审核任务执行了{} " ,   processDeleteEvent . toString ( ) ) ; 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				     }