@ -33,43 +33,43 @@ import static org.apache.commons.lang.time.DateUtils.addDays;
* business time utils
* /
public class BusinessTimeUtils {
private BusinessTimeUtils ( ) {
throw new IllegalStateException ( "BusinessTimeUtils class" ) ;
}
/ * *
* get business time in parameters by different command types
*
* @param commandType command type
* @param runTime run time or schedule time
* @return business time
* /
public static Map < String , String > getBusinessTime ( CommandType commandType , Date runTime ) {
Date businessDate = runTime ;
switch ( commandType ) {
case COMPLEMENT_DATA :
break ;
case START_PROCESS :
case START_CURRENT_TASK_PROCESS :
case RECOVER_TOLERANCE_FAULT_PROCESS :
case RECOVER_SUSPENDED_PROCESS :
case START_FAILURE_TASK_PROCESS :
case REPEAT_RUNNING :
case SCHEDULER :
default :
businessDate = addDays ( new Date ( ) , - 1 ) ;
if ( runTime ! = null ) {
/ * *
* If there is a scheduled time , take the scheduling time . Recovery from failed nodes , suspension of recovery , re - run for scheduling
* /
businessDate = addDays ( runTime , - 1 ) ;
}
break ;
}
Date businessCurrentDate = addDays ( businessDate , 1 ) ;
Map < String , String > result = new HashMap < > ( ) ;
result . put ( Constants . PARAMETER_CURRENT_DATE , format ( businessCurrentDate , PARAMETER_FORMAT_DATE ) ) ;
result . put ( Constants . PARAMETER_BUSINESS_DATE , format ( businessDate , PARAMETER_FORMAT_DATE ) ) ;
result . put ( Constants . PARAMETER_DATETIME , format ( businessCurrentDate , PARAMETER_FORMAT_TIME ) ) ;
return result ;
private BusinessTimeUtils ( ) {
throw new IllegalStateException ( "BusinessTimeUtils class" ) ;
}
/ * *
* get business time in parameters by different command types
*
* @param commandType command type
* @param runTime run time or schedule time
* @return business time
* /
public static Map < String , String > getBusinessTime ( CommandType commandType , Date runTime ) {
Date businessDate = runTime ;
switch ( commandType ) {
case COMPLEMENT_DATA :
break ;
case START_PROCESS :
case START_CURRENT_TASK_PROCESS :
case RECOVER_TOLERANCE_FAULT_PROCESS :
case RECOVER_SUSPENDED_PROCESS :
case START_FAILURE_TASK_PROCESS :
case REPEAT_RUNNING :
case SCHEDULER :
default :
businessDate = addDays ( new Date ( ) , - 1 ) ;
if ( runTime ! = null ) {
/ * *
* If there is a scheduled time , take the scheduling time . Recovery from failed nodes , suspension of recovery , re - run for scheduling
* /
businessDate = addDays ( runTime , - 1 ) ;
}
break ;
}
Date businessCurrentDate = addDays ( businessDate , 1 ) ;
Map < String , String > result = new HashMap < > ( ) ;
result . put ( Constants . PARAMETER_CURRENT_DATE , format ( businessCurrentDate , PARAMETER_FORMAT_DATE ) ) ;
result . put ( Constants . PARAMETER_BUSINESS_DATE , format ( businessDate , PARAMETER_FORMAT_DATE ) ) ;
result . put ( Constants . PARAMETER_DATETIME , format ( businessCurrentDate , PARAMETER_FORMAT_TIME ) ) ;
return result ;
}
}