@ -35,103 +35,106 @@ import java.util.*;
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					@Slf4j  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					@Service  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					@RequiredArgsConstructor  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					public  class  AlarmHandleFlowServiceImpl  extends  BaseServiceImpl < AlarmHandleFlowMapper ,  AlarmHandleFlowEntity >  implements  AlarmHandleFlowService {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					public  class  AlarmHandleFlowServiceImpl  extends  BaseServiceImpl < AlarmHandleFlowMapper ,  AlarmHandleFlowEntity >  implements  AlarmHandleFlowService   {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 private  final  IMessageClient  messageClient ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     private  final  IMessageClient  messageClient ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 private  final  ISysClient  sysClient ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     private  final  ISysClient  sysClient ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 private  final  IFlowClient  processClient ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 @Autowired  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						private    AlarmHandleMapper  alarmHandleMapper ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     private  final  IFlowClient  processClient ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     @Autowired  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    private   AlarmHandleMapper  alarmHandleMapper ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 private  final  IFdpDiagnoseClient  iFdpDiagnoseClient ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     private  final  IFdpDiagnoseClient  iFdpDiagnoseClient ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						@Override   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						public  R  listenAndUpdate ( ProcessWorkFlowResponse  processWorkFlowResponse )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							long  taskId ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							AlarmHandleFlowEntity  alarmHandleFlowEntity ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							log . info ( "消缺消息开始转换" + processWorkFlowResponse ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							try  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								Map < String ,  Object >  variables  =  ( Map < String ,  Object > )  processWorkFlowResponse . getVariables ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								//现象缺陷全表更新
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								alarmHandleFlowEntity =  JSONObject . parseObject ( JSONObject . toJSONString ( variables ) ,  new  TypeReference < AlarmHandleFlowEntity > ( ) { } ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}  catch  ( Exception  e )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								log . info ( "消息转换失败:" + e . getMessage ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								return  R . fail ( "消息转换失败" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							taskId = alarmHandleFlowEntity . getId ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							//设置当前环节+当前环节处理人
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							if  ( StringUtils . isNotEmpty ( processWorkFlowResponse . getNextStepOperator ( ) ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								alarmHandleFlowEntity . setCurrentOperator ( processWorkFlowResponse . getTaskName ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								alarmHandleFlowEntity . setCurrentLinkHandler ( processWorkFlowResponse . getNextStepOperator ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							} else  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								alarmHandleFlowEntity . setCurrentOperator ( "流程结束" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								alarmHandleFlowEntity . setCurrentLinkHandler ( "" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								// 预警
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								if ( AlarmHandleConstant . EARLY_WARNING . equals ( alarmHandleFlowEntity . getAlarmType ( ) ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									Map < String ,  Object >  map = new  HashMap < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									map . put ( "uuid" , alarmHandleFlowEntity . getAlarmId ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									map . put ( "result" , alarmHandleFlowEntity . getHandleWay ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									if  ( 1l = = alarmHandleFlowEntity . getHandleWay ( ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										//处理发现误报,修改对应状态
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										map . put ( "result_info" , alarmHandleFlowEntity . getDealDesc ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										alarmHandleMapper . update ( null , Wrappers . < AlarmHandleEntity > lambdaUpdate ( )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												. set ( AlarmHandleEntity : : getHandleWay ,  alarmHandleFlowEntity . getHandleWay ( ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												. set ( AlarmHandleEntity : : getFalseAlarmDesc ,  alarmHandleFlowEntity . getDealDesc ( ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												. eq ( AlarmHandleEntity : : getAlarmId ,  alarmHandleFlowEntity . getAlarmId ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    @Override   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  R  listenAndUpdate ( ProcessWorkFlowResponse  processWorkFlowResponse )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        long  taskId ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        AlarmHandleFlowEntity  alarmHandleFlowEntity ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        log . info ( "消缺消息开始转换"  +  processWorkFlowResponse ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        try  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            Map < String ,  Object >  variables  =  ( Map < String ,  Object > )  processWorkFlowResponse . getVariables ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            //现象缺陷全表更新
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            alarmHandleFlowEntity  =  JSONObject . parseObject ( JSONObject . toJSONString ( variables ) ,  new  TypeReference < AlarmHandleFlowEntity > ( )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            } ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }  catch  ( Exception  e )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            log . info ( "消息转换失败:"  +  e . getMessage ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            return  R . fail ( "消息转换失败" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        taskId  =  alarmHandleFlowEntity . getId ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //设置当前环节+当前环节处理人
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( StringUtils . isNotEmpty ( processWorkFlowResponse . getNextStepOperator ( ) ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            alarmHandleFlowEntity . setCurrentOperator ( processWorkFlowResponse . getTaskName ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            alarmHandleFlowEntity . setCurrentLinkHandler ( processWorkFlowResponse . getNextStepOperator ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }  else  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            alarmHandleFlowEntity . setCurrentOperator ( "流程结束" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            alarmHandleFlowEntity . setCurrentLinkHandler ( "" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( 1l  = =  alarmHandleFlowEntity . getHandleWay ( ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                //如果是误诊,把处理结果复制到误报原因
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                alarmHandleFlowEntity . setFalseAlarmDesc ( alarmHandleFlowEntity . getDealDesc ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                alarmHandleMapper . update ( null ,  Wrappers . < AlarmHandleEntity > lambdaUpdate ( )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        . set ( AlarmHandleEntity : : getHandleWay ,  alarmHandleFlowEntity . getHandleWay ( ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        . set ( AlarmHandleEntity : : getFalseAlarmDesc ,  alarmHandleFlowEntity . getDealDesc ( ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        . eq ( AlarmHandleEntity : : getAlarmId ,  alarmHandleFlowEntity . getAlarmId ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }  else  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                //流程结束把告警状态修改为结束
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                alarmHandleFlowEntity . setHandleWay ( 6L ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                //设置处理完成
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                alarmHandleMapper . update ( null ,  Wrappers . < AlarmHandleEntity > lambdaUpdate ( )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        . set ( AlarmHandleEntity : : getHandleWay ,  6l )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        . set ( AlarmHandleEntity : : getFalseAlarmDesc ,  alarmHandleFlowEntity . getDealDesc ( ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                        . eq ( AlarmHandleEntity : : getAlarmId ,  alarmHandleFlowEntity . getAlarmId ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            // 预警,调用fdp
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            if  ( AlarmHandleConstant . EARLY_WARNING . equals ( alarmHandleFlowEntity . getAlarmType ( ) ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                Map < String ,  Object >  map  =  new  HashMap < > ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                map . put ( "uuid" ,  alarmHandleFlowEntity . getAlarmId ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                map . put ( "result" ,  alarmHandleFlowEntity . getHandleWay ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                map . put ( "result_info" ,  alarmHandleFlowEntity . getDealDesc ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                //流程结束后才,调用fdp修改状态的接口
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                R  r  =  iFdpDiagnoseClient . setFaultStatusInfo ( map ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                if  ( ! r . isSuccess ( ) )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    throw  new  ServiceException ( "修改告警状态异常,请稍后重试!" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									} else  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										//设置处理完成
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										alarmHandleMapper . update ( null , Wrappers . < AlarmHandleEntity > lambdaUpdate ( )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												. set ( AlarmHandleEntity : : getHandleWay ,  6l )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												. set ( AlarmHandleEntity : : getFalseAlarmDesc ,  alarmHandleFlowEntity . getDealDesc ( ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												. eq ( AlarmHandleEntity : : getAlarmId ,  alarmHandleFlowEntity . getAlarmId ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										map . put ( "result_info" , alarmHandleFlowEntity . getDealDesc ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									//流程结束后才,调用fdp修改状态的接口
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									R  r  =  iFdpDiagnoseClient . setFaultStatusInfo ( map ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									if  ( ! r . isSuccess ( ) ) {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										throw  new  ServiceException ( "修改告警状态异常,请稍后重试!" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							this . updateById ( alarmHandleFlowEntity ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							//推送消息中心相关消息
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							sendMessage ( processWorkFlowResponse ,  alarmHandleFlowEntity , taskId ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							log . info ( "消缺消息转换结束" + processWorkFlowResponse ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							return  R . success ( "消息保存成功" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						}   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        this . updateById ( alarmHandleFlowEntity ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //推送消息中心相关消息
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        sendMessage ( processWorkFlowResponse ,  alarmHandleFlowEntity ,  taskId ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        log . info ( "消缺消息转换结束"  +  processWorkFlowResponse ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        return  R . success ( "消息保存成功" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    }   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 private  void  sendMessage ( ProcessWorkFlowResponse  processWorkFlowResponse ,  AlarmHandleFlowEntity  alarmHandleFlowEntity , Long  taskId )  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							 //推送消息
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							 if  ( processWorkFlowResponse . getTaskId ( )  ! =  null )  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								 BusinessMessageDTO  message  =  new  BusinessMessageDTO ( ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								 message . setBusinessClassify ( "system" ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								 message . setBusinessKey ( MessageConstants . BusinessClassifyEnum . WARNING . getKey ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								 message . setSubject ( MessageConstants . BusinessClassifyEnum . WARNING . getDescription ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								 message . setTaskId ( Optional . ofNullable ( taskId ) . orElse ( System . currentTimeMillis ( ) ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								 message . setTenantId ( "200000" ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								 String  countent  =  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
										 "您的告警处理流程待审批!告警内容:" . concat ( Optional . ofNullable ( alarmHandleFlowEntity . getAlarmContent ( ) ) . orElse ( "" ) )  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												 . concat ( ",审批环节:" )  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
												 . concat ( processWorkFlowResponse . getTaskName ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								 message . setContent ( countent ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								 message . setDeptId ( alarmHandleFlowEntity . getCreateDept ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								 R < String >  deptName  =  sysClient . getDeptName ( alarmHandleFlowEntity . getCreateDept ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								 if  ( deptName . isSuccess ( ) )  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									 message . setDeptName ( deptName . getData ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								 }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								 String  userIds  =  processWorkFlowResponse . getUserId ( ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								 if  ( StringUtils . isBlank ( userIds ) )  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									 log . error ( "推送的消息不能为空哦,{}" ,  userIds ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
									 return ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								 }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								 message . setUserIds ( userIds ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								 message . setCreateUser ( alarmHandleFlowEntity . getCreateUser ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
								 messageClient . sendAppAndWsMsgByUsers ( message ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
							 }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
						 }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    private  void  sendMessage ( ProcessWorkFlowResponse  processWorkFlowResponse ,  AlarmHandleFlowEntity  alarmHandleFlowEntity ,  Long  taskId )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        //推送消息
   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        if  ( processWorkFlowResponse . getTaskId ( )  ! =  null )  {   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            BusinessMessageDTO  message  =  new  BusinessMessageDTO ( ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            message . setBusinessClassify ( "system" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            message . setBusinessKey ( MessageConstants . BusinessClassifyEnum . WARNING . getKey ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            message . setSubject ( MessageConstants . BusinessClassifyEnum . WARNING . getDescription ( ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            message . setTaskId ( Optional . ofNullable ( taskId ) . orElse ( System . currentTimeMillis ( ) ) ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            message . setTenantId ( "200000" ) ;   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					            String  countent  =   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    "您的告警处理流程待审批!告警内容:" . concat ( Optional . ofNullable ( alarmHandleFlowEntity . getAlarmContent ( ) ) . orElse ( "" ) )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                            . concat ( ",审批环节:" )   
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                             . concat ( processWorkFlowResponse . getTaskName ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					             message . setContent ( countent ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					             message . setDeptId ( alarmHandleFlowEntity . getCreateDept ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					             R < String >  deptName  =  sysClient . getDeptName ( alarmHandleFlowEntity . getCreateDept ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					             if  ( deptName . isSuccess ( ) )  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                 message . setDeptName ( deptName . getData ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					             }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					             String  userIds  =  processWorkFlowResponse . getUserId ( ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					             if  ( StringUtils . isBlank ( userIds ) )  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                 log . error ( "推送的消息不能为空哦,{}" ,  userIds ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                 return ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					             }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					             message . setUserIds ( userIds ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					             message . setCreateUser ( alarmHandleFlowEntity . getCreateUser ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					             messageClient . sendAppAndWsMsgByUsers ( message ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					         }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					}