@ -75,6 +75,7 @@ import javax.servlet.http.HttpServletResponse; 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  java.awt.image.BufferedImage ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  java.io.* ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  java.math.BigDecimal ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  java.math.RoundingMode ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  java.security.Principal ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  java.time.LocalDate ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  java.time.LocalDateTime ;  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -451,9 +452,9 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    / * *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  构造鉴定事项确认书的数据   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  caseEvent   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  entrustment   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  materialList   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  caseEvent  案件信息    
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  entrustment  委托信息    
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  materialList  委托检材列表信息    
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  isAccepted    - 1  未受理 , 0  1  受理之后的状态   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @return   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * /   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -548,7 +549,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    / * *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  分别求分析样是多少份 , 留存样是多少份   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  materialList   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  materialList  检材列表    
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  flag   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @return   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * /   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -561,11 +562,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//			}else {
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//				return false;
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//			}
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( item . getSample1Quantity ( )  ! =  null  & &  item . getSample1Quantity ( ) . compareTo ( BigDecimal . ZERO )  >  0 )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                return  true ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }  else  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                return  false ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return  item . getSample1Quantity ( )  ! =  null  & &  item . getSample1Quantity ( ) . compareTo ( BigDecimal . ZERO )  >  0 ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        } ) . collect ( Collectors . toList ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        List < EntrustmentIdentificationMaterial >  rtList  =  materialList . stream ( ) . filter ( item  - >  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//			if(item.getSample2RepeatWeigh()!=null&&item.getSample2RepeatWeigh().compareTo(BigDecimal.ZERO)>0)
  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -574,11 +571,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//			}else {
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//				return false;
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//			}
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( item . getSample2Quantity ( )  ! =  null  & &  item . getSample2Quantity ( ) . compareTo ( BigDecimal . ZERO )  >  0 )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                return  true ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }  else  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                return  false ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return  item . getSample2Quantity ( )  ! =  null  & &  item . getSample2Quantity ( ) . compareTo ( BigDecimal . ZERO )  >  0 ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        } ) . collect ( Collectors . toList ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( flag . equals ( "A" ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return  anList ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -605,9 +598,9 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    / * *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  构造封装质量   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  materialList   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  flag   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @return   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  materialList  检材列表    
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  flag  A  分析样  R  留存样  其他  分析 + 留存    
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @return  构造封装质量    
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * /   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    private  BigDecimal  getAllMaterialMount ( List < EntrustmentIdentificationMaterial >  materialList ,  String  flag )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        BigDecimal  mount1  =  new  BigDecimal ( 0 ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -676,16 +669,16 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // 根据 totalSampleMass 大小来决定保留的小数位数
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( totalSampleMass . compareTo ( new  BigDecimal ( 100 ) )  > =  0 )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            // 如果 totalSampleMass 大于 100,保留 1 位小数
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            eg . setTotalSampleDes ( totalSampleMass . setScale ( 1 ,  BigDecimal . ROUND_ HALF_UP)  +  item . getUnit ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            eg . setTotalSampleDes ( totalSampleMass . setScale ( 1 ,  RoundingMode . HALF_UP )  +  item . getUnit ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }  else  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            // 否则保留 2 位小数
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            eg . setTotalSampleDes ( totalSampleMass . setScale ( 2 ,  BigDecimal . ROUND_ HALF_UP)  +  item . getUnit ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            eg . setTotalSampleDes ( totalSampleMass . setScale ( 2 ,  RoundingMode . HALF_UP )  +  item . getUnit ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        return  eg ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    private  BigDecimal  calculateTotalSampleMass ( EntrustmentIdentificationMaterial  item ,  MaterialListForBookVo  eg )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        BigDecimal  totalSampleMass  =  BigDecimal . ZERO  ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        BigDecimal  totalSampleMass ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //因为现在有的检材可以不用复称,例如送来的一支电子烟,所以我们用送检的数量与单位进行描述即可
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( item . getSample1RepeatWeigh ( )  = =  null  | |  item . getSample1RepeatWeigh ( ) . compareTo ( BigDecimal . ZERO )  = =  0 )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            eg . setAnalysisSampleDes ( item . getSample1Quantity ( )  +  item . getUnit ( ) ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -727,8 +720,8 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    / * *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  构建检材描述和鉴定要求   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  materialList   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @return   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  materialList  检材列表    
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @return  构建检材描述和鉴定要求的字符串    
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * /   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    @Override   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  String  buildMaterialDes ( List < EntrustmentIdentificationMaterial >  materialList )  {   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -756,11 +749,8 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    @Override   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  String  buildIdentfyReq ( List < EntrustmentIdentificationMaterial >  materialList )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Map < String ,  List < EntrustmentIdentificationMaterial > >  retGroup  =  materialList . stream ( ) . collect ( Collectors . groupingBy ( item  - >  item . getAnalysisOption ( )  +  "_"  +  getDrugNameMsg ( item . getCandidateDrugs ( ) ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        List < String >  desList  =  new  ArrayList < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        StringBuffer  retSb  =  new  StringBuffer ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        retGroup . forEach ( ( k ,  v )  - >  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            retSb . append ( getNameDesStr ( v ) ) . append ( "," ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        } ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        retGroup . forEach ( ( k ,  v )  - >  retSb . append ( getNameDesStr ( v ) ) . append ( "," ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        retSb . delete ( retSb . length ( )  -  1 ,  retSb . length ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        return  retSb . toString ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    }   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -815,7 +805,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    //对分析项目+目标物的组合进行排序,优先描述小的
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    private  List < Map . Entry < String ,  List < EntrustmentIdentificationMaterial > > >  orderAnalysisOptionAndDrug ( Map < String ,  List < EntrustmentIdentificationMaterial > >  targetMapData )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        List < Map . Entry < String ,  List < EntrustmentIdentificationMaterial > > >  retList  =   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                new  ArrayList < Map . Entry < String ,  List < EntrustmentIdentificationMaterial > > > ( targetMapData . entrySet ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                new  ArrayList < > ( targetMapData . entrySet ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Collections . sort ( retList ,  new  Comparator < Map . Entry < String ,  List < EntrustmentIdentificationMaterial > > > ( )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            @Override   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            public  int  compare ( Map . Entry < String ,  List < EntrustmentIdentificationMaterial > >  o1 ,   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -843,7 +833,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    private  String  getDrugNameMsg ( List < DrugLite >  drugLites )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        StringBuilder  sb  =  new  StringBuilder ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        for  ( DrugLite  lite  :  drugLites )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            DrugLite  drugLite  =  ( DrugLite )  JSONObject . toJavaObject ( JSONObject . parseObject ( JSONObject . toJSONString ( lite ) ) ,  DrugLite . class ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            DrugLite  drugLite  =  JSONObject . toJavaObject ( JSONObject . parseObject ( JSONObject . toJSONString ( lite ) ) ,  DrugLite . class ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            sb . append ( drugLite . getName ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        return  sb . toString ( ) ;   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -854,18 +844,16 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //对 xx号,xx号检材中的xx1、xx2进行 xx 分析,
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //对1号、2号检材中的海洛因、甲基苯丙胺进行定量分析
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // 1.定性,2.定量 3.定性定量 4.关联性性 5.其他
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        StringBuff er  sbMaterialName  =  new  StringBuff er ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        StringBuild er  sbMaterialName  =  new  StringBuild er ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        StringBuffer  sbDrugDes  =  new  StringBuffer ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        StringBuff er  sbAnalysisDes  =  new  StringBuff er ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        StringBuild er  sbAnalysisDes  =  new  StringBuild er ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        int  executeCount  =  0 ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        for  ( EntrustmentIdentificationMaterial  materialObj  :  targetList )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            sbMaterialName . append ( materialObj . getShortNameDes ( ) ) . append ( "," ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            //只执行一次且执行一次
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( executeCount  = =  0 )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                List < DrugLite >  drugLiteList  =  DrugLiteConvert . convertDirtyLiteByJSON ( materialObj . getCandidateDrugs ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                drugLiteList . forEach ( item  - >  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    sbDrugDes . append ( item . getName ( ) ) . append ( "、" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                } ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                drugLiteList . forEach ( item  - >  sbDrugDes . append ( item . getName ( ) ) . append ( "、" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                sbDrugDes . delete ( sbDrugDes . length ( )  -  1 ,  sbDrugDes . length ( ) ) ; //删除多余的连接号
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                sbAnalysisDes . append ( AnalysisOptionEnums . fromCode ( materialObj . getAnalysisOption ( ) ) . getChineseName ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -883,9 +871,9 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //对 xx号,xx号检材中的xx1、xx2进行 xx 分析,
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //对1号、2号检材中的海洛因、甲基苯丙胺进行定量分析
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // 1.定性,2.定量 3.定性定量 4.关联性性 5.其他
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        StringBuff er  sbMaterialName  =  new  StringBuff er ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        StringBuild er  sbMaterialName  =  new  StringBuild er ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        StringBuffer  sbDrugDes  =  new  StringBuffer ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        StringBuff er  sbAnalysisDes  =  new  StringBuff er ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        StringBuild er  sbAnalysisDes  =  new  StringBuild er ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        int  executeCount  =  0 ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        for  ( EntrustmentIdentificationMaterial  materialObj  :  targetList )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            sbMaterialName . append ( materialObj . getOrderNo1 ( ) ) . append ( "," ) ;   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -893,9 +881,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( executeCount  = =  0 )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//                String drugToString = JSONArray.toJSONString(materialObj.getCandidateDrugs());
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                List < DrugLite >  drugLiteList  =  DrugLiteConvert . convertDirtyLiteByJSON ( materialObj . getCandidateDrugs ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                drugLiteList . forEach ( item  - >  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    sbDrugDes . append ( item . getName ( ) ) . append ( "、" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                } ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                drugLiteList . forEach ( item  - >  sbDrugDes . append ( item . getName ( ) ) . append ( "、" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                sbDrugDes . delete ( sbDrugDes . length ( )  -  1 ,  sbDrugDes . length ( ) ) ; //删除多余的连接号
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                sbAnalysisDes . append ( AnalysisOptionEnums . fromCode ( materialObj . getAnalysisOption ( ) ) . getChineseName ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -922,18 +908,16 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        targetList . forEach ( item  - >  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            String  drugToString  =  JSONArray . toJSONString ( item . getCandidateDrugs ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            List < DrugLite >  drugLiteList  =  JSONArray . parseArray ( drugToString ,  DrugLite . class ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            drugLiteList . forEach ( drugLite  - >  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                allDrugLite . add ( drugLite ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            } ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            allDrugLite . addAll ( drugLiteList ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        } ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        retList  =  allDrugLite . stream ( ) . filter ( distinctKey ( i  - >  i . getName ( ) ) ) . collect ( Collectors . toList ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        retList  =  allDrugLite . stream ( ) . filter ( distinctKey ( DrugLite : : getName ) ) . collect ( Collectors . toList ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        return  retList ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    / * *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  获取文书名称   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  entrustId   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  entrustId  委托id    
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  whatBook   entrust - 委托书   identItemBook - 鉴定事项确认书   identfyBook - 鉴定书   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  docType    该参数只有用于委托书上   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @return   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -975,8 +959,8 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    / * *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  检验完成   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  entrustId   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @return   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  entrustId  委托id    
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @return  返回检验是否完成标识    
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * /   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    @Override   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  boolean  testsFinish ( String  entrustId )  {   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1008,11 +992,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  Boolean  checkDeliverPhoto ( String  entrustId )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        String  path  =  OSSDirectoryConstants . DOCUMENT_ACCEPT_DIRECTORY  +  "/"  +  entrustId  +  "/"  +  OSSDirectoryConstants . DOCUMENT_ACCEPT_DIRECTORY_DELIVER ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        List < String >  fileList  =  ossFile . fileList ( path ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( fileList . size ( )  >  0 )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return  true ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }  else  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return  false ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        return  ! fileList . isEmpty ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    @Override   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1048,7 +1028,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        log . info ( "本次检材数量:{} 条" ,  saveToTransObj . size ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        R  r  =  remoteSampleService . enterSample ( saveToTransObj ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        log . info ( "更新委托的状态:{} 条" ,  historyEntrustList . size ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        thi s. updateBatchById ( historyEntrustList ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        super  . updateBatchById ( historyEntrustList ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        return  true ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    }   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1080,9 +1060,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        } ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( noWeighMaterialList . size ( )  >  0 )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return  true ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }  else  return  false ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        return  ! noWeighMaterialList . isEmpty ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    //
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1109,7 +1087,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            log . info ( "共计更新案件案情简要信息{}条" ,  caseUpdateList . size ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            log . info ( "共计更新送检人电话信息{}条" ,  entrustUpdateList . size ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            caseEventService . updateBatchById ( caseUpdateList ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            thi s. updateBatchById ( entrustUpdateList ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            super  . updateBatchById ( entrustUpdateList ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( flag . equals ( "1" ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            thirdMaterialList . forEach ( item  - >  {   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1176,7 +1154,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            throw  new  RuntimeException ( "委托已经提交, 不能再进行修改" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        System . out . println ( String .  format  ( "保存委托, entrust.getCandidateDrugs()=%s" ,  entrust . getCandidateDrugs ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        System . out . printf ( "保存委托, entrust.getCandidateDrugs()=%s%n " ,  entrust . getCandidateDrugs ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //-- 更新送检员表的信息
   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -1200,7 +1178,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //-------------------
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // 更新数据库表数据
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //-------------------
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        UpdateWrapper < Entrustment >  updateWrapper  =  new  UpdateWrapper < Entrustment > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        UpdateWrapper < Entrustment >  updateWrapper  =  new  UpdateWrapper < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        updateWrapper . eq ( "id" ,  entrust . getId ( ) ) ;         // 查询条件是 id 相等
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        updateWrapper . set ( "client_org_id" ,  entrust . getClientOrgId ( ) ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1270,7 +1248,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            // 检验目的(药品筛选清单)定义在委托上
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            // 我们复制一份到检材上, 以后可以从检材带入到实验室的样本中
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            UpdateWrapper < EntrustmentIdentificationMaterial >  imUpdateWrapper  =  new  UpdateWrapper < EntrustmentIdentificationMaterial > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            UpdateWrapper < EntrustmentIdentificationMaterial >  imUpdateWrapper  =  new  UpdateWrapper < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            imUpdateWrapper . eq ( "entrustment_id" ,  entrustment . getId ( ) ) ;         // 查询条件是 entrustment_id 相等
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            imUpdateWrapper . set ( "candidate_drugs" ,  entrustment . getCandidateDrugs ( ) ,  "typeHandler=com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            entrustmentIdentificationMaterialService . update ( null ,  imUpdateWrapper ) ;   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -1282,7 +1260,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  Entrustment  bizSubmitter_Apply ( Entrustment  entrust ,  DLPUser  dlpUser )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Entrustment  result ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        String  oldUserId  =  SecurityUtils . getCurrentUserId ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        System . out . println ( String .  format  ( "Old user id=%s" ,  oldUserId ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        System . out . printf ( "Old user id=%s%n " ,  oldUserId ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // 检查委托原来的状态
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Entrustment  entrustment  =  this . getById ( entrust . getId ( ) ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1310,13 +1288,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( ! StrUtil . equalsIgnoreCase ( "1" ,  AppStartupRunner . getCfg ( CommonConstants . DLP_CODE_ENTRUSTMENT_CLIENT_CHOICE_CHECKERS ) ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//                List<SysUser> users = this.taskAvailableUserList_Check();
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                List < SysUser >  users  =  commonFeignService . remoteGetUsersByPermission ( CommonConstants . ORG_TREE_ROOT_ID ,  CollUtil . newArrayList ( "EntrustmentCheck" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                String  candidateUser  =  "" ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                for  ( SysUser  u  :  users )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    if  ( candidateUser . length ( )  >  0 )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        candidateUser  + =  "," ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    candidateUser  + =  u . getUserId ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                String  candidateUser  =  users . stream ( ) . map ( SysUser : : getUserId ) . collect ( Collectors . joining ( "," ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                entrustment . setCheckCandidateUser ( candidateUser ) ;        // 不使用用户提交的候选人名单
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }  else  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                if  ( StrUtil . isBlank ( entrust . getCheckCandidateUser ( ) ) )  {   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -1332,7 +1304,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            entrustment . setStatus ( ProcessFlowMapper . getNextStatus ( entrustment . getStatus ( ) ,  1 ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            List < UpdateInfo >  pis  =  entrustment . getProcessInfo ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( pis  = =  null )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                pis  =  new  ArrayList < UpdateInfo > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                pis  =  new  ArrayList < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            UpdateInfo  pi  =  new  UpdateInfo ( dlpUser . getId ( ) ,   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    dlpUser . getName ( ) ,   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1374,7 +1346,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            List < EntrustmentIdentificationMaterial >  materialList  =  entrustmentIdentificationMaterialService . list ( Wrappers . < EntrustmentIdentificationMaterial > query ( )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    . eq ( "entrustment_id" ,  entrustment . getId ( ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    . orderByAsc ( "create_time" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( materialList  = =  null  | |  materialList . size ( )  = =  0  )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( CollUtil . isEmpty ( materialList ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                throw  new  CheckedException ( "请至少添加一个检材后再提交!" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( StrUtil . isBlank ( entrust . getEntrustRequirement ( ) ) )  {   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1402,7 +1374,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            throw  new  RuntimeException ( String . format ( "委托不在待审核状态, 审核任务认领人: %s" ,  entrustment . getCheckClaimUser ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        String  checkCandidateUsers [ ]   =  entrustment . getCheckCandidateUser ( ) . split ( "," ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        String [ ]  checkCandidateUsers   =  entrustment . getCheckCandidateUser ( ) . split ( "," ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        boolean  currentUserIsCandidate  =  false ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        for  ( String  candidateUser  :  checkCandidateUsers )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( candidateUser . equals ( dlpUser . getId ( ) ) )  {   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1430,7 +1402,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //-------------------
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // 更新数据库表数据
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //-------------------
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        UpdateWrapper < Entrustment >  updateWrapper  =  new  UpdateWrapper < Entrustment > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        UpdateWrapper < Entrustment >  updateWrapper  =  new  UpdateWrapper < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        updateWrapper . eq ( "id" ,  entrustment . getId ( ) ) ;         // 查询条件是 id 相等
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        updateWrapper . set ( "check_claim_user" ,  entrustment . getCheckClaimUser ( ) ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1502,13 +1474,8 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( ! StrUtil . equalsIgnoreCase ( "1" ,  AppStartupRunner . getCfg ( CommonConstants . DLP_CODE_ENTRUSTMENT_CHECKER_CHOICE_APPROVERS ) ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//            List<SysUser> users = this.taskAvailableUserList_Approve();
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            List < SysUser >  users  =  commonFeignService . remoteGetUsersByPermission ( CommonConstants . ORG_TREE_ROOT_ID ,  CollUtil . newArrayList ( "EntrustmentApprove" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            String  candidateUser  =  "" ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            for  ( SysUser  u  :  users )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                if  ( candidateUser . length ( )  >  0 )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    candidateUser  + =  "," ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                candidateUser  + =  u . getUserId ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            String  candidateUser  =  users . stream ( ) . map ( SysUser : : getUserId ) . collect ( Collectors . joining ( "," ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            entrustment . setApproveCandidateUser ( candidateUser ) ;        // 不使用用户提交的候选人名单
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }  else  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( StrUtil . isBlank ( entrust . getApproveCandidateUser ( ) ) )  {   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1563,7 +1530,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        List < UpdateInfo >  pis  =  entrustment . getProcessInfo ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( pis  = =  null )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            pis  =  new  ArrayList < UpdateInfo > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            pis  =  new  ArrayList < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( opCode  = =  1 )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            UpdateInfo  pi  =  new  UpdateInfo ( dlpUser . getId ( ) ,   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -1586,7 +1553,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//        entrustment.setProcessInfo(pis);
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        UpdateWrapper < Entrustment >  updateWrapper  =  new  UpdateWrapper < Entrustment > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        UpdateWrapper < Entrustment >  updateWrapper  =  new  UpdateWrapper < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        updateWrapper . eq ( "id" ,  entrustment . getId ( ) ) ;         // 查询条件是 id 相等
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        updateWrapper . set ( "destructive_analysis" ,  entrust . getDestructiveAnalysis ( ) ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1656,7 +1623,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            throw  new  RuntimeException ( String . format ( "委托不在待审批状态, 审批任务认领人: %s" ,  entrustment . getApproveClaimUser ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        String  approveCandidateUsers [ ]   =  StringUtils . isNotBlank ( entrustment . getApproveCandidateUser ( ) )  ?  entrustment . getApproveCandidateUser ( ) . split ( "," )  :  new  String [ ] { } ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        String [ ]  approveCandidateUsers   =  StringUtils . isNotBlank ( entrustment . getApproveCandidateUser ( ) )  ?  entrustment . getApproveCandidateUser ( ) . split ( "," )  :  new  String [ ] { } ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        boolean  currentUserIsCandidate  =  false ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        for  ( String  candidateUser  :  approveCandidateUsers )  {   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1683,7 +1650,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //-------------------
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // 更新数据库表数据
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //-------------------
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        UpdateWrapper < Entrustment >  updateWrapper  =  new  UpdateWrapper < Entrustment > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        UpdateWrapper < Entrustment >  updateWrapper  =  new  UpdateWrapper < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        updateWrapper . eq ( "id" ,  entrustment . getId ( ) ) ;         // 查询条件是 id 相等
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        updateWrapper . set ( "approve_claim_user" ,  entrustment . getApproveClaimUser ( ) ) ;   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -1708,7 +1675,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  Entrustment  bizApprover_Apply ( Entrustment  entrust ,  Integer  opCode ,  DLPUser  dlpUser )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( opCode  = =  null )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            throw  new  RuntimeException ( String . format ( "审批必须提供 opCode" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            throw  new  RuntimeException ( "审批必须提供 opCode" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//        if (StrUtil.isBlank(entrust.getApproveComments())) {
  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1748,7 +1715,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // 审批任务已经提交了, 转到新的环节
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        int  newStatus  =  - 1  ;      // 新的状态(环节)
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        int  newStatus ;      // 新的状态(环节)
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            newStatus  =  ProcessFlowMapper . getNextStatus ( entrustment . getStatus ( ) ,  opCode ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( newStatus  = =  EntrustmentStatusConstants . ENTRUSTMENT_STATUS_CREATED . getStatus ( ) )  {   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1784,9 +1751,9 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // 从数据库表中取出保存的委托对象, 后续的操作我们以此为准
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //entrustment = entrustmentService.getById(entrust.getId());
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( entrustment  = =  null )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            throw  new  RuntimeException ( String . format ( "没有找到 id 为 %s 的委托" ,  entrust . getId ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//        if (entrustment == null) {
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//            throw new RuntimeException(String.format("没有找到 id 为 %s 的委托", entrust.getId()));
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//        }
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //第三方系统审批---------------------------------------------开始
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //需要判断是第三方系统的数据才可以做第三方的同步
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        try  {   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1822,11 +1789,11 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    @Override   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  Entrustment  bizConfirm_Apply ( Entrustment  entrust ,  Integer  opCode ,  DLPUser  dlpUser )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( opCode  = =  null )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            throw  new  RuntimeException ( String . format ( "送检确认必须提供 opCode" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            throw  new  RuntimeException ( "送检确认必须提供 opCode" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( StrUtil . isBlank ( entrust . getDeliverConfirmComments ( ) ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            throw  new  RuntimeException ( String . format ( "必须提供送检确认意见" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            throw  new  RuntimeException ( "必须提供送检确认意见" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // 检查委托原来的状态
   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1869,7 +1836,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        entrustment . setPreviousStatus ( entrustment . getStatus ( ) ) ;        // 可能是从其他环节转过来的, 一旦提交, 保存上一个状态
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        entrustment . setStatus ( newStatus ) ;            // 新的状态(环节), 可能会是审批或提交前
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        UpdateWrapper < Entrustment >  updateWrapper  =  new  UpdateWrapper < Entrustment > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        UpdateWrapper < Entrustment >  updateWrapper  =  new  UpdateWrapper < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        updateWrapper . eq ( "id" ,  entrustment . getId ( ) ) ;         // 查询条件是 id 相等
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        updateWrapper . set ( "deliver_confirm_user" ,  entrustment . getDeliverConfirmUser ( ) ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -1948,11 +1915,11 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    / * *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  设置送检信息   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  entrustment   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  entrustment  委托信息    
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @return   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * /   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    private  static  UpdateWrapper < Entrustment >  getEntrustDeliverUpdateWrapper ( Entrustment  entrustment )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        UpdateWrapper < Entrustment >  updateWrapper  =  new  UpdateWrapper < Entrustment > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        UpdateWrapper < Entrustment >  updateWrapper  =  new  UpdateWrapper < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        updateWrapper . eq ( "id" ,  entrustment . getId ( ) ) ;         // 查询条件是 id 相等
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // updateWrapper.set("deliverer1_user_id", entrustment.getDeliverer1UserId());
   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -1978,7 +1945,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  Entrustment  bizDeliver_Apply ( Entrustment  entrust ,  Integer  opCode ,  DLPUser  dlpUser )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( opCode  = =  null )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            throw  new  RuntimeException ( String . format ( "送检操作必须提供 opCode" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            throw  new  RuntimeException ( "送检操作必须提供 opCode" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // 检查委托原来的状态
   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -2005,7 +1972,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        List < UpdateInfo >  pis  =  entrustment . getProcessInfo ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( pis  = =  null )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            pis  =  new  ArrayList < UpdateInfo > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            pis  =  new  ArrayList < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        UpdateInfo  pi  =  new  UpdateInfo ( dlpUser . getId ( ) ,   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -2021,7 +1988,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        entrustment . setPreviousStatus ( entrustment . getStatus ( ) ) ;        // 可能是从其他环节转过来的, 一旦提交, 保存上一个状态
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        entrustment . setStatus ( newStatus ) ;            // 新的状态(环节), 可能会是受理
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        UpdateWrapper < Entrustment >  updateWrapper  =  new  UpdateWrapper < Entrustment > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        UpdateWrapper < Entrustment >  updateWrapper  =  new  UpdateWrapper < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        updateWrapper . eq ( "id" ,  entrustment . getId ( ) ) ;         // 查询条件是 id 相等
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -2067,7 +2034,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//            ossFile.fileGet(pdfFilePath, httpServletResponse.getOutputStream());
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//            httpServletResponse.setContentType(new MimetypesFileTypeMap().getContentType(entrustmentLetterFileName));
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }  catch  ( Exception  e )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            System . out . println ( String .  format  ( "minioFile objectExist() Exception. %s" ,  e . getLocalizedMessage ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            System . out . printf ( "minioFile objectExist() Exception. %s%n " ,  e . getLocalizedMessage ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            e . printStackTrace ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        return  null ;   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -2076,8 +2043,8 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    / * *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  获取委托vo类 , 并验证数据是否合法   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  id   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  dlpUser   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  id  委托id    
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  dlpUser  当前用户    
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @return   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * /   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    private  EntrustmentVO  getEntrustmentVOAndVaildData ( String  id ,  DLPUser  dlpUser )  {   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -2101,7 +2068,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    / * *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  生成鉴定委托书   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @return   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @return  是否生成成功    
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * /   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    private  boolean  GenerateEntrustmentLetterPDF ( EntrustmentVO  ev )  throws  Exception  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        System . out . println ( "bizGenerateEntrustmentWord................." ) ;   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -2113,7 +2080,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Map < String ,  Object >  dm  =  ClassUtils . objectToMap ( ev ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( ev . getEntrustmentTime ( )  = =  null )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            ev . setEntrustmentTime ( LocalDateTime . now ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            UpdateWrapper < Entrustment >  updateWrapper  =  new  UpdateWrapper < Entrustment > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            UpdateWrapper < Entrustment >  updateWrapper  =  new  UpdateWrapper < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            updateWrapper . eq ( "id" ,  ev . getId ( ) ) ;         // 查询条件是 id 相等
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            updateWrapper . set ( "entrustment_time" ,  ev . getEntrustmentTime ( ) ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -2173,9 +2140,9 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        for  ( EntrustmentIdentificationMaterial  entrustmentIdentificationMaterial  :  materialList )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            BigDecimal  quantity  =  entrustmentIdentificationMaterial . getQuantity ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( quantity . compareTo ( compareNumber )  > =  0 )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                entrustmentIdentificationMaterial . setQuantity ( quantity . setScale ( 1 ,  BigDecimal . ROUND_ HALF_UP) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                entrustmentIdentificationMaterial . setQuantity ( quantity . setScale ( 1 ,  RoundingMode . HALF_UP ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }  else  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                entrustmentIdentificationMaterial . setQuantity ( quantity . setScale ( 2 ,  BigDecimal . ROUND_ HALF_UP) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                entrustmentIdentificationMaterial . setQuantity ( quantity . setScale ( 2 ,  RoundingMode . HALF_UP ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        dm . put ( "materialList" ,  materialList ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -2216,12 +2183,12 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        boolean  fileSave  =  ossFile . fileSave ( OSSDirectoryConstants . DOCUMENT_ENTRUSTMENT_DIRECTORY  +  "/"  +  ev . getId ( )  +  "/"  +  entrustmentLetterFileName  +  ".docx" ,  fisWord ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        fosWord . close ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        fisWord . close ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        System . out . println ( String . format ( "转换为 Word 结束" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        System . out . println ( "转换为 Word 结束" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        return  fileSave ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  boolean  auditEntrustDataOfThirdSys ( String  userFlag ,  String  entrustId ,  String  dataPath ,  String  result ,  String  reMark )  throws  Exception  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  boolean  auditEntrustDataOfThirdSys ( String  userFlag ,  String  entrustId ,  String  dataPath ,  String  result ,  String  reMark )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        EntrustOfThirdSys  entrustOfThirdSys  =  synchronizeDataService . getThirdSysEntrustByMainId ( entrustId ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( entrustOfThirdSys  = =  null )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            throw  new  RuntimeException ( String . format ( "没有找到 id 为 %s 的委托" ,  entrustId ) ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -2272,7 +2239,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // 更新数据库表数据
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //-------------------
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        UpdateWrapper < Entrustment >  updateWrapper  =  new  UpdateWrapper < Entrustment > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        UpdateWrapper < Entrustment >  updateWrapper  =  new  UpdateWrapper < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        updateWrapper . eq ( "id" ,  entrustment . getId ( ) ) ;         // 查询条件是 id 相等
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        updateWrapper . set ( "destructive_analysis" ,  entrust . getDestructiveAnalysis ( ) ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -2304,11 +2271,11 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // 20250114 贵阳禁毒需求,受理编号在提交审核时就生成
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//        String newEntrustAcceptNo = "";
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( opCode  = =  null )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            throw  new  RuntimeException ( String . format ( "受理必须提供 opCode" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            throw  new  RuntimeException ( "受理必须提供 opCode" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( StrUtil . isBlank ( entrust . getAcceptComments ( ) ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            throw  new  RuntimeException ( String . format ( "必须提供受理意见" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            throw  new  RuntimeException ( "必须提供受理意见" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // 检查委托原来的状态
   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -2336,7 +2303,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            //检查检材是否复秤,不复秤不能受理
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            boolean  b  =  this . checkRepeatWeigh ( entrustment ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( b )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                throw  new  RuntimeException ( String . format ( "有未复秤的样本,请给样本复秤" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                throw  new  RuntimeException ( "有未复秤的样本,请给样本复秤" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            // 如果是确认受理, 需要检材全部都确认受理
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            // 检查检材的受理状态
   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -2426,7 +2393,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        List < UpdateInfo >  pis  =  entrustment . getProcessInfo ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( pis  = =  null )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            pis  =  new  ArrayList < UpdateInfo > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            pis  =  new  ArrayList < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( opCode  = =  1 )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            UpdateInfo  pi  =  new  UpdateInfo ( dlpUser . getId ( ) ,   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -2477,27 +2444,25 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    boolean  ret  =  acceptThirdSysEntrust ( "/api/identify/entrust/{entrustId}/accept" ,  entrustment ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    if  ( ret )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        log . info ( "大数据平台受理成功 {}" ,  entrustment . getId ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        if  ( opCode  >  0 )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            List < EntrustmentIdentificationMaterial >  imList  =  entrustmentIdentificationMaterialService . list ( Wrappers . < EntrustmentIdentificationMaterial > query ( )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                    . eq ( "entrustment_id" ,  entrustment . getId ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            List < Sample >  newSampleList  =  new  ArrayList < Sample > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            for  ( EntrustmentIdentificationMaterial  im  :  imList )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                List < Sample >  oldSampleList  =  sampleService . createSample ( im ,  entrustment . getClientOrgId ( ) ,  dlpUser . getId ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                for  ( Sample  oldSamObj  :  oldSampleList )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                    Sample  newSamObj  =  new  Sample ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                    BeanUtils . copyProperties ( oldSamObj ,  newSamObj ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                    newSampleList . add ( newSamObj ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        List < EntrustmentIdentificationMaterial >  imList  =  entrustmentIdentificationMaterialService . list ( Wrappers . < EntrustmentIdentificationMaterial > query ( )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                . eq ( "entrustment_id" ,  entrustment . getId ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        List < Sample >  newSampleList  =  new  ArrayList < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        for  ( EntrustmentIdentificationMaterial  im  :  imList )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            List < Sample >  oldSampleList  =  sampleService . createSample ( im ,  entrustment . getClientOrgId ( ) ,  dlpUser . getId ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            for  ( Sample  oldSamObj  :  oldSampleList )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                Sample  newSamObj  =  new  Sample ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                BeanUtils . copyProperties ( oldSamObj ,  newSamObj ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                                newSampleList . add ( newSamObj ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            System . out . println ( "-------------准备写入远程检材系统的数据量为:"  +  newSampleList . size ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            //调用流转系统的接口,并将数据写过去
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            remoteSampleService . enterSample ( newSampleList ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        System . out . println ( "-------------准备写入远程检材系统的数据量为:"  +  newSampleList . size ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        //调用流转系统的接口,并将数据写过去
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        remoteSampleService . enterSample ( newSampleList ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    }  else  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        isSuccess  =  false ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        log . info ( "大数据平台受理失败 {}" ,  entrustment . getId ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        throw  new  RuntimeException ( String . format ( "同步受理信息至大数据平台失败,此次受理失败,请从大数据平台重新受理,然后将在本系统已受理页面将委托同步!" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        throw  new  RuntimeException ( "同步受理信息至大数据平台失败,此次受理失败,请从大数据平台重新受理,然后将在本系统已受理页面将委托同步!" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                }  else  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    System . out . println ( "不支持的受理类型参数" ) ;   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -2505,7 +2470,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }  else  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                List < EntrustmentIdentificationMaterial >  imList  =  entrustmentIdentificationMaterialService . list ( Wrappers . < EntrustmentIdentificationMaterial > query ( )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        . eq ( "entrustment_id" ,  entrustment . getId ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                List < Sample >  newSampleList  =  new  ArrayList < Sample > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                List < Sample >  newSampleList  =  new  ArrayList < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                for  ( EntrustmentIdentificationMaterial  im  :  imList )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    List < Sample >  oldSampleList  =  sampleService . createSample ( im ,  entrustment . getClientOrgId ( ) ,  dlpUser . getId ( ) ) ;   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -2526,7 +2491,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//            throw new RuntimeException("同步大数据平台受理出错,此次受理失败");
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( ! isSuccess )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            throw  new  RuntimeException ( String . format ( "同步受理信息至大数据平台失败,此次受理失败,请从大数据平台重新受理,然后将在本系统已受理页面将委托同步!" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            throw  new  RuntimeException ( "同步受理信息至大数据平台失败,此次受理失败,请从大数据平台重新受理,然后将在本系统已受理页面将委托同步!" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        return  entrustment ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    }   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -2584,7 +2549,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // 转换临时目录中的 word 文档为 PDF
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        String  pdfFilePath  =  OSSDirectoryConstants . IDENTIFY_BOOK_DIRECTORY  +  "/"  +  ev . getId ( )  +  "/"  +  identifyItemsConfirmLetterFileName  +  ".pdf" ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        String  wordFilePath  =  OSSDirectoryConstants . IDENTIFY_BOOK_DIRECTORY  +  "/"  +  ev . getId ( )  +  "/"  +  identifyItemsConfirmLetterFileName  +  ".docx" ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        String  downFile  =  ""  ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        String  downFile ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //判断是要获取PDF还是word
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( pdfOrWord . equals ( "1" ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            downFile  =  wordFilePath ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -2611,7 +2576,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }  catch  ( Exception  e )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            System . out . println ( String .  format  ( "minioFile objectExist() Exception. %s" ,  e . getLocalizedMessage ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            System . out . printf ( "minioFile objectExist() Exception. %s%n " ,  e . getLocalizedMessage ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            e . printStackTrace ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            throw  new  RuntimeException ( e . getMessage ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -2630,7 +2595,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( ev . getEntrustmentTime ( )  = =  null )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                ev . setEntrustmentTime ( LocalDateTime . now ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                UpdateWrapper < Entrustment >  updateWrapper  =  new  UpdateWrapper < Entrustment > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                UpdateWrapper < Entrustment >  updateWrapper  =  new  UpdateWrapper < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                updateWrapper . eq ( "id" ,  ev . getId ( ) ) ;         // 查询条件是 id 相等
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                updateWrapper . set ( "entrustment_time" ,  ev . getEntrustmentTime ( ) ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -2708,7 +2673,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            isPDF . close ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            System . out . println ( String . format ( "转换为 PDF 结束" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            System . out . println ( "转换为 PDF 结束" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }  catch  ( Exception  e )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            e . printStackTrace ( ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -2735,7 +2700,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        entrustment . setPreviousStatus ( EntrustmentStatusConstants . ENTRUSTMENT_STATUS_CREATED . getStatus ( ) ) ;    // 老的状态也为待提交
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        List < UpdateInfo >  pis  =  entrustment . getProcessInfo ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( pis  = =  null )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            pis  =  new  ArrayList < UpdateInfo > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            pis  =  new  ArrayList < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        UpdateInfo  pi  =  new  UpdateInfo ( dlpUser . getId ( ) ,   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                dlpUser . getName ( ) ,   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -2762,12 +2727,12 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( ! StrUtil . equalsIgnoreCase ( dlpUser . getOrgId ( ) ,  entrustment . getClientOrgId ( ) ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return  R . failed ( String . format ( "这个委托的委托单位不是你的所属单位, 你无权删除!" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return  R . failed ( "这个委托的委托单位不是你的所属单位, 你无权删除!" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( entrustment . getStatus ( )  ! =  EntrustmentStatusConstants . ENTRUSTMENT_STATUS_CREATED . getStatus ( )  | |   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                entrustment . getPreviousStatus ( )  ! =  EntrustmentStatusConstants . ENTRUSTMENT_STATUS_CREATED . getStatus ( ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return  R . failed ( String . format ( "这个委托已被提交过, 不能删除!" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return  R . failed ( "这个委托已被提交过, 不能删除!" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -2790,8 +2755,8 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    @Override   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  R  uploadAttachmentObj_Base64 ( String  entrustmentId ,  JSONObject  jsonParam )  throws  Exception  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        System . out . println ( String .  format  ( "uploadPhotoObj: entrustmentId=%s jsonParam.size()=%d" ,  entrustmentId ,  jsonParam . size ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  R  uploadAttachmentObj_Base64 ( String  entrustmentId ,  JSONObject  jsonParam )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        System . out . printf ( "uploadPhotoObj: entrustmentId=%s jsonParam.size()=%d%n " ,  entrustmentId ,  jsonParam . size ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Entrustment  entrustment  =  this . getById ( entrustmentId ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( entrustment  ! =  null )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -2801,7 +2766,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                try  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    String  suffix  =  image . substring ( 11 ,  image . indexOf ( ";" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    String  fileName  =  DateUtil . format ( new  Date ( ) ,  "yyyyMMddHHmmss" )  +  "."  +  suffix ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    System . out . println ( String .  format  ( "fileName=[%s]" ,  fileName ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    System . out . printf ( "fileName=[%s]%n " ,  fileName ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    //去掉头信息
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    String  imgBase64  =  image . substring ( image . indexOf ( "," )  +  1 ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -2845,7 +2810,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                //String fileName = DateUtil.format(new Date(), "yyyyMMddHHmmss") + "-"+(picCount+1)+"." + suffix;
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                String  fileName  =  IdWorker . get32UUID ( )  +  "."  +  suffix ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                System . out . println ( String .  format  ( "fileName=[%s]" ,  fileName ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                System . out . printf ( "fileName=[%s]%n " ,  fileName ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                //去掉头信息
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                String  imgBase64  =  image . substring ( image . indexOf ( "," )  +  1 ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                byte [ ]  decoded  =  org . apache . commons . codec . binary . Base64 . decodeBase64 ( imgBase64 ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -2872,7 +2837,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    @Override   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  R  uploadAcceptAttachmentObj_Base64 ( String  entrustmentId ,  JSONObject  jsonParam )  throws  Exception  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        System . out . println ( String .  format  ( "uploadPhotoObj: entrustmentId=%s jsonParam.size()=%d" ,  entrustmentId ,  jsonParam . size ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        System . out . printf ( "uploadPhotoObj: entrustmentId=%s jsonParam.size()=%d%n " ,  entrustmentId ,  jsonParam . size ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Entrustment  entrustment  =  this . getById ( entrustmentId ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( entrustment  ! =  null )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -2882,7 +2847,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                try  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    String  suffix  =  image . substring ( 11 ,  image . indexOf ( ";" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    String  fileName  =  DateUtil . format ( new  Date ( ) ,  "yyyyMMddHHmmss" )  +  "."  +  suffix ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    System . out . println ( String .  format  ( "fileName=[%s]" ,  fileName ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    System . out . printf ( "fileName=[%s]%n " ,  fileName ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    //去掉头信息
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    String  imgBase64  =  image . substring ( image . indexOf ( "," )  +  1 ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -2934,7 +2899,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return  R . ok ( commonFeignService . remoteGetUsersByPermission ( entrustment . getClientOrgId ( ) ,  CollUtil . newArrayList ( "EntrustmentConfirm" ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }  else  if  ( entrustment . getStatus ( )  = =  EntrustmentStatusConstants . ENTRUSTMENT_STATUS_WAITING_CONFIRM . getStatus ( ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            // 在确认者手中: 已审批, 待确认
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            List < SysUser >  users  =  new  ArrayList < SysUser > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            List < SysUser >  users  =  new  ArrayList < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            SysUser  submitter  =  remoteUserService . innerGetById ( entrustment . getSubmitter ( ) ) . getData ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            users . add ( submitter ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return  R . ok ( users ) ;   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -2955,9 +2920,9 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        String  orgId  =  dlpUser . getOrgId ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Integer  entrustmentIdentificationMaterialQuantity  =  0 ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Integer  acceptanceIdentificationMaterialQuantity  =  0  ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Integer  sewageJobIdentificationMaterialQuantity  =  0  ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Integer  hairJobIdentificationMaterialQuantity  =  0  ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Integer  acceptanceIdentificationMaterialQuantity ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Integer  sewageJobIdentificationMaterialQuantity ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Integer  hairJobIdentificationMaterialQuantity ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //查询这个账户(机构)下的所有委托中的所有已受理检材的数量
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        List < Entrustment >  entrustmentList  =  this . list ( new  LambdaQueryWrapper < Entrustment > ( ) . eq ( Entrustment : : getClientOrgId ,  orgId ) ) ;   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -3020,7 +2985,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            // 如果没有提供案件编码, 生成一个
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( ( caseEvent . getHappenTime ( )  ! =  null )  & &  ( StrUtil . isNotBlank ( caseEvent . getCaseOwnOrgId ( ) ) ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                SysOrg  caseOwnOrg  =  null  ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                SysOrg  caseOwnOrg ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                R  r  =  remoteOrgService . getById ( caseEvent . getCaseOwnOrgId ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                if  ( r . getCode ( )  = =  CommonConstants . SUCCESS )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    caseOwnOrg  =  ( SysOrg )  r . getData ( ) ;   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -3040,7 +3005,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        entrustmentDTO . setPreviousStatus ( EntrustmentStatusConstants . ENTRUSTMENT_STATUS_CREATED . getStatus ( ) ) ;    // 老的状态也为待提交
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        List < UpdateInfo >  pis  =  entrustmentDTO . getProcessInfo ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( pis  = =  null )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            pis  =  new  ArrayList < UpdateInfo > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            pis  =  new  ArrayList < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        UpdateInfo  pi  =  new  UpdateInfo ( dlpUser . getId ( ) ,   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                dlpUser . getName ( ) ,   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -3258,7 +3223,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    / * *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  获得委托的小红点标记   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @return   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @return  获得委托的小红点标记    
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * /   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    @Override   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  List < MarkersVO >  getMarkersForEntrustment ( )  {   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -3303,7 +3268,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        markersVOS . add ( new  MarkersVO ( EntrustMarkConstants . CASE_ACCEPT ,  entrustmentList2 . size ( ) ,  "待受理 (大数据平台)" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        markersVOS . add ( new  MarkersVO ( EntrustMarkConstants . CASE_ACCEPT ,  entrustmentList3 . size ( ) ,  String . format ( "已受理 (%s)" ,  EntrustMarkConstants . PUBLIC_SECURITY_BUREAU ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        markersVOS . add ( new  MarkersVO ( EntrustMarkConstants . CASE_ACCEPT ,  entrustmentList4 . size ( ) ,  "已受理 (大数据平台)" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        markersVOS . add ( new  MarkersVO ( EntrustMarkConstants . CASE_ACCEPT ,  this . list ( Wrapp ers . < E ntrustment> lambdaQuery ( ) . inSql ( Entrustment : : getId ,  "SE LECT entrust_ id FROM b_entru st_material_checkout_result" ) ) . size ( ) ,  "检测结果" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        markersVOS . add ( new  MarkersVO ( EntrustMarkConstants . CASE_ACCEPT ,  entrustmentList3  . size ( ) ,  "检测结果" ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        markersVOS . add ( new  MarkersVO ( EntrustMarkConstants . REVIEW_OR_APPROVAL ,   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                this . list ( new  LambdaQueryWrapper < Entrustment > ( )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        . in ( Entrustment : : getStatus ,  integers1 )   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -3347,7 +3312,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            List < EntrustmentIdentificationMaterial >  entrustmentIdentificationMaterialList  =  entrustmentIdentificationMaterialService . list ( Wrappers . < EntrustmentIdentificationMaterial > lambdaQuery ( )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    . eq ( EntrustmentIdentificationMaterial : : getEntrustmentId ,  entrustment . getId ( ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    . orderByAsc ( EntrustmentIdentificationMaterial : : getAcceptNo ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( entrustmentIdentificationMaterialList . size ( )  >  0 )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( ! entrustmentIdentificationMaterialList . isEmpty ( ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                if  ( entrustmentIdentificationMaterialList . size ( )  >  18 )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    int  remainder  =  entrustmentIdentificationMaterialList . size ( )  %  18 ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    if  ( remainder  ! =  0 )  {   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -3381,10 +3346,9 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  打印样本档案   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @param  entrustmentId   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @throws  Exception   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * /   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    @Override   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  void  printSampleFile ( String  entrustmentId )  throws  Exception  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  void  printSampleFile ( String  entrustmentId )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    / * *   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -3410,7 +3374,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                list . add ( item ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        } ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        return  thi s. updateBatchById ( list ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        return  super  . updateBatchById ( list ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    / * *   
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -3422,7 +3386,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  @return   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * /   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    @Override   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  IPage  getEntrustmentAndMaterial ( Page  page ,  Integer  status ,  String  keywords )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  IPage < EntrustmentVO >   getEntrustmentAndMaterial ( Page  page ,  Integer  status ,  String  keywords )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        IPage < EntrustmentVO >  voPage  =  this . getEntrustmentVOPage ( page ,  Wrappers . < Entrustment > query ( )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                . and ( StrUtil . isNotBlank ( keywords ) ,  wrapper  - >  wrapper   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        . like ( "e.entrustment_no" ,  keywords )   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -3456,9 +3420,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  boolean  isMaterialPhoto ( String  entrustmentId )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        String  path  =  "document/accept"  +  "/"  +  entrustmentId  +  "/materialPhoto" ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        List < String >  fileName  =  ossFile . fileList ( path ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( fileName . size ( )  >  0 )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return  true ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }  else  return  false ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        return  ! fileName . isEmpty ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    / * *   
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -3569,7 +3531,7 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                . orderByDesc ( Entrustment : : getCreateTime ) ) ;  // 按创建时间降序排列
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        // 如果查询结果不为空且至少有一个条目
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( list  ! =  null  & &  list . size ( )  >  0 )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( CollUtil . isNotEmpty ( list ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            Entrustment  entrustment  =  list . get ( 0 ) ;  // 获取最新的一条记录
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            List < Deliverer >  deliverers  =  new  ArrayList < > ( ) ;  // 创建一个列表来保存配送员信息