Commit 5d213664 authored by zhoushiguang's avatar zhoushiguang

耗时输出

parent a471a291
package net.wanji.opt.servicev2.judgeanalysis.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import net.wanji.opt.dao.mapper.judgeanalysis.AnalysisProblemAndStrategyDayMapper;
import net.wanji.opt.entity.judgeanalysis.AnalysisProblemAndStrategyDay;
import net.wanji.opt.servicev2.judgeanalysis.AnalysisProblemAndStrategyDayService;
import org.springframework.stereotype.Service;
import org.springframework.util.StopWatch;
import javax.annotation.Resource;
import java.time.LocalDate;
......@@ -21,12 +23,15 @@ import java.util.List;
* @since 2025-03-20
*/
@Service
@Slf4j
public class AnalysisProblemAndStrategyDayImpl extends ServiceImpl<AnalysisProblemAndStrategyDayMapper, AnalysisProblemAndStrategyDay> implements AnalysisProblemAndStrategyDayService {
@Resource
private AnalysisProblemAndStrategyDayMapper analysisProblemAndStrategyDayMapper;
public void selectCountByType() {
StopWatch stopWatch = new StopWatch("事件优化时长计算监控");
stopWatch.start();
//查询路口事件数据
List<AnalysisProblemAndStrategyDay> crossEvenList = analysisProblemAndStrategyDayMapper.selectCrossEvent();
if (crossEvenList.size() > 0) {
......@@ -74,6 +79,9 @@ public class AnalysisProblemAndStrategyDayImpl extends ServiceImpl<AnalysisProbl
analysisProblemAndStrategyDayMapper.insertProblemAndStrategy(vo);
}
}
stopWatch.stop();
log.info("事件优化记录优化耗时:{}ms",stopWatch.getTotalTimeMillis());
}
}
......@@ -22,7 +22,11 @@ public class AnalysisProblemAndStrategyDayTask {
private AnalysisProblemAndStrategyDayService analysisProblemAndStrategyDayService;
@Scheduled(cron = "0 15 1 * * ?")
public void task(){
analysisProblemAndStrategyDayService.selectCountByType();
public void task() {
try {
analysisProblemAndStrategyDayService.selectCountByType();
} catch (Exception e) {
log.error("获取事件优化记录异常", e);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment