|  | @@ -1,25 +1,73 @@
 | 
	
		
			
				|  |  |  package org.jeecg.modules.quartz.job;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import org.jeecg.modules.viewClockIn.entity.bdClockinMonth;
 | 
	
		
			
				|  |  | +import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | +import org.jeecg.common.util.DateUtils;
 | 
	
		
			
				|  |  | +import org.jeecg.modules.system.util.DateUtils2;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.viewClockIn.service.IbdClockinMonthService;
 | 
	
		
			
				|  |  |  import org.quartz.Job;
 | 
	
		
			
				|  |  |  import org.quartz.JobExecutionContext;
 | 
	
		
			
				|  |  |  import org.quartz.JobExecutionException;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import java.util.List;
 | 
	
		
			
				|  |  | +import java.text.ParseException;
 | 
	
		
			
				|  |  | +import java.util.Date;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  public class ReportIntoU8Job implements Job {
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private IbdClockinMonthService bdClockinMonthService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    private static String[] parsePatterns = {"yyyy-MM-dd","yyyy年MM月dd日",
 | 
	
		
			
				|  |  | +            "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy/MM/dd",
 | 
	
		
			
				|  |  | +            "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyyMMdd"};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 若参数变量名修改 QuartzJobController中也需对应修改
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    private String parameter;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public void setParameter(String parameter) {
 | 
	
		
			
				|  |  | +        this.parameter = parameter;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        bdClockinMonthService.reportIntoU8Job("2021-12");
 | 
	
		
			
				|  |  | +        if(StringUtils.isEmpty(this.parameter)){
 | 
	
		
			
				|  |  | +//            bdClockinMonthService.reportIntoU8Job(DateUtils.getNYTime());
 | 
	
		
			
				|  |  | +            System.out.println("==========获取当前月份============"+DateUtils.getNYTime());
 | 
	
		
			
				|  |  | +        }else{
 | 
	
		
			
				|  |  | +            if(getStrError(this.parameter)){
 | 
	
		
			
				|  |  | +//                bdClockinMonthService.reportIntoU8Job(this.parameter);
 | 
	
		
			
				|  |  | +                System.out.println("==========获取参数月份============"+this.parameter);
 | 
	
		
			
				|  |  | +            }else{
 | 
	
		
			
				|  |  | +                System.out.println("==========参数填写有误 例:2021-12 ============"+this.parameter);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public static boolean getStrError(String str){
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            String[] stList = str.split("-");
 | 
	
		
			
				|  |  | +            if(stList.length != 2){
 | 
	
		
			
				|  |  | +                return false;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if(Integer.valueOf(stList[0]) > 2030 || Integer.valueOf(stList[0]) < 2000){
 | 
	
		
			
				|  |  | +                return false;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if(Integer.valueOf(stList[1]) > 12 || Integer.valueOf(stList[1]) < 1){
 | 
	
		
			
				|  |  | +                return false;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        System.out.println("======================");
 | 
	
		
			
				|  |  | -        System.out.println("======================");
 | 
	
		
			
				|  |  | +        } catch (Exception e) {
 | 
	
		
			
				|  |  | +            return false;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return true;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  }
 |