6 changed files with 85 additions and 6 deletions
			
			
		@ -0,0 +1,40 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.scheduled.scheduled; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.hnac.hzims.scheduled.service.startstop.StratStopService; | 
				
			||||||
 | 
					import com.xxl.job.core.biz.model.ReturnT; | 
				
			||||||
 | 
					import com.xxl.job.core.handler.annotation.XxlJob; | 
				
			||||||
 | 
					import lombok.extern.slf4j.Slf4j; | 
				
			||||||
 | 
					import org.springblade.core.tool.utils.DateUtil; | 
				
			||||||
 | 
					import org.springblade.core.tool.utils.Func; | 
				
			||||||
 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||||
 | 
					import org.springframework.stereotype.Component; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Date; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import static com.hnac.hzims.operational.main.constant.ScheduledConstant.THIS_DAY_START_STOP_RECORD; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** | 
				
			||||||
 | 
					 * 开停机定时任务 | 
				
			||||||
 | 
					 * @author ysj | 
				
			||||||
 | 
					 */ | 
				
			||||||
 | 
					@Slf4j | 
				
			||||||
 | 
					@Component | 
				
			||||||
 | 
					public class StartStopScheduledTask { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Autowired | 
				
			||||||
 | 
					    private StratStopService service; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** | 
				
			||||||
 | 
					     * 单日开停机记录 | 
				
			||||||
 | 
					     */ | 
				
			||||||
 | 
					    @XxlJob(THIS_DAY_START_STOP_RECORD) | 
				
			||||||
 | 
					    //@Scheduled(cron = "0/40 * * * * ? ")
 | 
				
			||||||
 | 
					    public ReturnT<String> thisDayStartStopRecord(String param) { | 
				
			||||||
 | 
					        if (Func.isBlank(param)) { | 
				
			||||||
 | 
					            param = DateUtil.format(new Date(), "yyyy-MM"); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        service.thisDayStartStopRecord(param); | 
				
			||||||
 | 
					        return new ReturnT<>("SUCCESS"); | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,9 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.scheduled.service.startstop; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** | 
				
			||||||
 | 
					 * @author ysj | 
				
			||||||
 | 
					 */ | 
				
			||||||
 | 
					public interface StratStopService { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void thisDayStartStopRecord(String param); | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,24 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.scheduled.service.startstop.impl; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.hnac.hzims.scheduled.service.startstop.StratStopService; | 
				
			||||||
 | 
					import lombok.RequiredArgsConstructor; | 
				
			||||||
 | 
					import lombok.extern.slf4j.Slf4j; | 
				
			||||||
 | 
					import org.springframework.stereotype.Service; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** | 
				
			||||||
 | 
					 * @author ysj | 
				
			||||||
 | 
					 */ | 
				
			||||||
 | 
					@Service | 
				
			||||||
 | 
					@RequiredArgsConstructor | 
				
			||||||
 | 
					@Slf4j | 
				
			||||||
 | 
					public class StartStopServiceImpl implements StratStopService { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** | 
				
			||||||
 | 
					     * 单日开停机记录 | 
				
			||||||
 | 
					     * @param param | 
				
			||||||
 | 
					     */ | 
				
			||||||
 | 
					    @Override | 
				
			||||||
 | 
					    public void thisDayStartStopRecord(String param) { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					} | 
				
			||||||
					Loading…
					
					
				
		Reference in new issue