|  |  |  | @ -3,6 +3,7 @@ package com.glxp.api.service.collect; | 
			
		
	
		
			
				
					|  |  |  |  | import cn.hutool.core.collection.CollUtil; | 
			
		
	
		
			
				
					|  |  |  |  | import cn.hutool.core.date.DateUtil; | 
			
		
	
		
			
				
					|  |  |  |  | import cn.hutool.core.io.FileUtil; | 
			
		
	
		
			
				
					|  |  |  |  | import cn.hutool.core.thread.ThreadUtil; | 
			
		
	
		
			
				
					|  |  |  |  | import cn.hutool.core.util.StrUtil; | 
			
		
	
		
			
				
					|  |  |  |  | import cn.hutool.core.util.XmlUtil; | 
			
		
	
		
			
				
					|  |  |  |  | import com.alibaba.fastjson.JSONObject; | 
			
		
	
	
		
			
				
					|  |  |  | @ -350,28 +351,55 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     IoCodeTempDao ioCodeTempDao; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     public void threadUpdateIoCodeTempEntity(IoCodeTempEntity codeTempEntity){ | 
			
		
	
		
			
				
					|  |  |  |  |         String parentCode = codeTempEntity.getCode(); | 
			
		
	
		
			
				
					|  |  |  |  |         List<IoCodeTempEntity> ioCodeTempEntities = ioCodeTempDao.selectList(new LambdaQueryWrapper<IoCodeTempEntity>().eq(IoCodeTempEntity::getCode, parentCode)); | 
			
		
	
		
			
				
					|  |  |  |  |     public void threadUpdateIoCodeTempEntity(String parentCode){ | 
			
		
	
		
			
				
					|  |  |  |  |     List<IoCodeTempEntity> ioCodeTempEntities = ioCodeTempDao.selectList(new LambdaQueryWrapper<IoCodeTempEntity>().eq(IoCodeTempEntity::getCode, parentCode)); | 
			
		
	
		
			
				
					|  |  |  |  |         if (CollUtil.isNotEmpty(ioCodeTempEntities)){ | 
			
		
	
		
			
				
					|  |  |  |  |             if (this.batchExist(parentCode)){ | 
			
		
	
		
			
				
					|  |  |  |  |                 //打上匹配到了药品关联关系的标记
 | 
			
		
	
		
			
				
					|  |  |  |  |                 for (int i = 0; i < ioCodeTempEntities.size(); i++) { | 
			
		
	
		
			
				
					|  |  |  |  |                     IoCodeTempEntity ioCodeTempEntity = ioCodeTempEntities.get(i); | 
			
		
	
		
			
				
					|  |  |  |  |                     ioCodeTempEntity.setDrugLink(1); | 
			
		
	
		
			
				
					|  |  |  |  |                     ioCodeTempDao.updateById(ioCodeTempEntity); | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             }else { | 
			
		
	
		
			
				
					|  |  |  |  |                 //打上匹配不到了药品关联关系的标记
 | 
			
		
	
		
			
				
					|  |  |  |  |                 for (int i = 0; i < ioCodeTempEntities.size(); i++) { | 
			
		
	
		
			
				
					|  |  |  |  |                     IoCodeTempEntity ioCodeTempEntity = ioCodeTempEntities.get(i); | 
			
		
	
		
			
				
					|  |  |  |  |                     ioCodeTempEntity.setDrugLink(0); | 
			
		
	
		
			
				
					|  |  |  |  |                     ioCodeTempDao.updateById(ioCodeTempEntity); | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |         //1、排除掉层级是1的
 | 
			
		
	
		
			
				
					|  |  |  |  |         UdiEntity udi = FilterUdiUtils.getUdi(parentCode); | 
			
		
	
		
			
				
					|  |  |  |  |         String udi1 = udi.getUdi(); | 
			
		
	
		
			
				
					|  |  |  |  |         ProductInfoEntity byNameCode = productInfoService.findByNameCode(udi1); | 
			
		
	
		
			
				
					|  |  |  |  |         List<RelCodeBatch> navList = this.list(new LambdaQueryWrapper<RelCodeBatch>() | 
			
		
	
		
			
				
					|  |  |  |  |                 .eq(RelCodeBatch::getParentCode, parentCode)); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         if ( (byNameCode != null && "1".equals(byNameCode.getPackLevel())) | 
			
		
	
		
			
				
					|  |  |  |  |                 || (CollUtil.isNotEmpty(navList)) | 
			
		
	
		
			
				
					|  |  |  |  |         ){ | 
			
		
	
		
			
				
					|  |  |  |  |             //打上匹配到了药品关联关系的标记
 | 
			
		
	
		
			
				
					|  |  |  |  |             for (int i = 0; i < ioCodeTempEntities.size(); i++) { | 
			
		
	
		
			
				
					|  |  |  |  |                 IoCodeTempEntity ioCodeTempEntity = ioCodeTempEntities.get(i); | 
			
		
	
		
			
				
					|  |  |  |  |                 ioCodeTempEntity.setDrugLink(1); | 
			
		
	
		
			
				
					|  |  |  |  |                 ioCodeTempDao.updateById(ioCodeTempEntity); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         }else { | 
			
		
	
		
			
				
					|  |  |  |  |             ThreadUtil.execAsync(() -> { | 
			
		
	
		
			
				
					|  |  |  |  |                 asynThreadUpdateIoCodeTempEntity(parentCode,ioCodeTempEntities); | 
			
		
	
		
			
				
					|  |  |  |  |             }); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     public void asynThreadUpdateIoCodeTempEntity(String parentCode,List<IoCodeTempEntity> ioCodeTempEntities){ | 
			
		
	
		
			
				
					|  |  |  |  |         if (this.batchExist(parentCode)){ | 
			
		
	
		
			
				
					|  |  |  |  |             //打上匹配到了药品关联关系的标记
 | 
			
		
	
		
			
				
					|  |  |  |  |             for (int i = 0; i < ioCodeTempEntities.size(); i++) { | 
			
		
	
		
			
				
					|  |  |  |  |                 IoCodeTempEntity ioCodeTempEntity = ioCodeTempEntities.get(i); | 
			
		
	
		
			
				
					|  |  |  |  |                 ioCodeTempEntity.setDrugLink(1); | 
			
		
	
		
			
				
					|  |  |  |  |                 ioCodeTempDao.updateById(ioCodeTempEntity); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |         }else { | 
			
		
	
		
			
				
					|  |  |  |  |             //打上匹配不到了药品关联关系的标记
 | 
			
		
	
		
			
				
					|  |  |  |  |             for (int i = 0; i < ioCodeTempEntities.size(); i++) { | 
			
		
	
		
			
				
					|  |  |  |  |                 IoCodeTempEntity ioCodeTempEntity = ioCodeTempEntities.get(i); | 
			
		
	
		
			
				
					|  |  |  |  |                 ioCodeTempEntity.setDrugLink(0); | 
			
		
	
		
			
				
					|  |  |  |  |                 ioCodeTempDao.updateById(ioCodeTempEntity); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
	
		
			
				
					|  |  |  | 
 |