Commit e752778d authored by duanruiming's avatar duanruiming

Merge remote-tracking branch 'origin/master'

parents 7277f132 d728164e
......@@ -73,6 +73,18 @@ public interface AnalysisProblemCrossDayMapper extends BaseMapper<AnalysisProble
* @param
*/
List<CrossPoint> findAreaPoint();
/**
* 查询表t_base_area_info信息
* @param
*/
List<AnalysisProblemCrossDay> checkData();
/**
* 新增表t_analysis_problem_cross_day信息
* @param
*/
Integer insertAnalysisProblemCrossDay();
}
......@@ -41,6 +41,19 @@ public interface AnalysisProblemGreenDayMapper extends BaseMapper<AnalysisProble
* @param analysisProblemGreenDay
*/
Integer addAnalysisProblemGreenDay(AnalysisProblemGreenDay analysisProblemGreenDay);
/**
* 新增表t_analysis_problem_green_day信息
* @param
*/
Integer insertAnalysisProblemGreenDay();
/**
* 根据条件查询表t_analysis_problem_green_day信息
* @param
*/
List<AnalysisProblemGreenDay> checkData();
}
package net.wanji.opt.task;
import lombok.extern.slf4j.Slf4j;
import net.wanji.opt.dao.mapper.judgeanalysis.AnalysisProblemCrossDayMapper;
import net.wanji.opt.dao.mapper.judgeanalysis.AnalysisProblemGreenDayMapper;
import net.wanji.opt.entity.judgeanalysis.AnalysisProblemCrossDay;
import net.wanji.opt.entity.judgeanalysis.AnalysisProblemGreenDay;
import net.wanji.opt.servicev2.judgeanalysis.impl.AnalysisProblemCrossDayServiceImpl;
import net.wanji.opt.servicev2.judgeanalysis.impl.AnalysisProblemGreenDayServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.List;
@Component
@Configurable
@EnableScheduling
@Slf4j
@Profile("!dev")
public class AnalysisProblemDayTask {
@Autowired
private AnalysisProblemCrossDayServiceImpl analysisProblemCrossDayServiceImpl;
@Autowired
private AnalysisProblemCrossDayMapper analysisProblemCrossDayMapper;
@Autowired
private AnalysisProblemGreenDayMapper analysisProblemGreenDayMapper;
@Autowired
private AnalysisProblemGreenDayServiceImpl nalysisProblemGreenDayServiceImpl;
@Scheduled(cron = "0 15 0 ? * *")
@PostConstruct
public void task(){
//执行检查路口id是否还有area_id没赋值的数据
analysisProblemCrossDayServiceImpl.updateCrossAreaIdByCondition();
//执行检查绿波id是否还有area_id没赋值的数据
nalysisProblemGreenDayServiceImpl.updateGreenAreaIdByCondition();
//检查昨日数据是否有统计
List<AnalysisProblemCrossDay> list = analysisProblemCrossDayMapper.checkData();
if(list.isEmpty())
{
analysisProblemCrossDayMapper.insertAnalysisProblemCrossDay();
}
//检查昨日数据是否有统计
List<AnalysisProblemGreenDay> list1 = analysisProblemGreenDayMapper.checkData();
if(list1.isEmpty())
{
analysisProblemGreenDayMapper.insertAnalysisProblemGreenDay();
}
}
}
......@@ -201,4 +201,22 @@
id=#{id}
</update>
<!-- 新增表t_analysis_problem_cross_day信息 -->
<insert id="insertAnalysisProblemCrossDay">
insert into t_analysis_problem_cross_day (id,cross_id,area_id,event_category,event_type,event_number,event_total_time,dt,insert_time)
select UUID(), a.cross_id, b.area_id,a.category,a.type,count(1) as event_number , sum( TIMESTAMPDIFF(SECOND, a.start_time , a.end_time) ) as duration ,
DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y%m%d') as dt , now()
from t_event_info a
left join t_base_cross_info b on a.cross_id = b.id
where DATE_FORMAT(a.start_time,'%Y-%m-%d') = DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y-%m-%d') and a.type in (701,702,703)
group by a.cross_id, b.area_id,a.category,a.type
</insert>
<!-- 根据条件查询表t_analysis_problem_cross_day信息 -->
<select id="checkData" resultMap="AnalysisProblemCrossDayMap">
SELECT dt
FROM t_analysis_problem_cross_day
WHERE dt = DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y%m%d')
</select>
</mapper>
......@@ -163,4 +163,23 @@
,#{insertTime}
)
</insert>
<!-- 新增表t_analysis_problem_green_day信息 -->
<insert id="insertAnalysisProblemGreenDay">
insert into t_analysis_problem_green_day (id,green_id,area_id,event_category,event_type,event_number,event_total_time,dt,insert_time)
select UUID(), a.green_id, b.area_id,a.category,a.type,count(1) as event_number , sum( TIMESTAMPDIFF(SECOND, a.start_time , a.end_time) ) as duration ,
DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y%m%d') as dt , now()
from t_event_info a
left join t_greenwave_info b on a.green_id = b.id
where DATE_FORMAT(a.start_time,'%Y-%m-%d') = DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y-%m-%d') and a.type in (705,706,707) and a.green_id != ''
group by a.cross_id, b.area_id,a.category,a.type
</insert>
<!-- 根据条件查询表t_analysis_problem_green_day信息 -->
<select id="checkData" resultMap="AnalysisProblemGreenDayMap">
SELECT dt
FROM t_analysis_problem_green_day
WHERE dt = DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y%m%d')
</select>
</mapper>
......@@ -69,8 +69,8 @@ public class CodeGeneratorMyBatis1 {
// 全局配置
GlobalConfig gc = new GlobalConfig();
String projectPath = "./signal-optimize-service";
// String projectPath = "./wj-gernerator/output";
// String projectPath = "./signal-optimize-service";
String projectPath = "./wj-gernerator/output";
gc.setOutputDir(projectPath+"/src/main/java");
gc.setAuthor(AUTHOR);
......@@ -144,6 +144,8 @@ public class CodeGeneratorMyBatis1 {
templateConfig.setServiceImpl("templates/mybatis1/providerImpl.java");
templateConfig.setController("templates/mybatis1/restServer.java");
//使默认的xml目录不再生成,使用自定义的resource/mapper输出目录
templateConfig.setXml(null);
mpg.setTemplate(templateConfig);
......@@ -168,10 +170,10 @@ public class CodeGeneratorMyBatis1 {
strategy.setFieldPrefix("t_","s_","dt_","i_","bs_");
strategy.setTablePrefix("t_");
mpg.setStrategy(strategy);
mpg.setTemplateEngine(new FreemarkerTemplateEngine());
mpg.execute();
System.out.println("MyBatis Plus Code Generator Finished!!");
......
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