You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.6 KiB
37 lines
1.6 KiB
10 months ago
|
package com.zc.business.controller;
|
||
|
|
||
|
import com.alibaba.fastjson.JSONArray;
|
||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||
|
import com.zc.business.domain.DcRoadConditionInformation;
|
||
|
import com.zc.business.service.IDcRoadConditionInformationService;
|
||
|
import com.zc.business.service.IDcTrafficStatisticsService;
|
||
|
import com.zc.common.core.httpclient.exception.HttpException;
|
||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||
|
import org.springframework.stereotype.Component;
|
||
|
|
||
|
import java.io.IOException;
|
||
|
|
||
|
/**
|
||
|
*路况信息 每小时入一次库
|
||
|
*/
|
||
|
@Component
|
||
|
public class DcTimingOfTrafficConditionsController {
|
||
|
@Autowired
|
||
|
private IDcTrafficStatisticsService dcTrafficStatisticsService;
|
||
|
@Autowired
|
||
|
private IDcRoadConditionInformationService dcRoadConditionInformationService;
|
||
|
|
||
|
// 调用服务层方法,获取当前交通指标数据
|
||
|
@Scheduled(cron = "0 0 * * * *")
|
||
|
public void getTheCurrentCongestedSection() throws HttpException, IOException {
|
||
|
// 调用服务层方法,获取当前交通指标数据
|
||
|
JSONArray jsonArray = dcTrafficStatisticsService.getTheCurrentCongestedSection();
|
||
|
//插入 数据库
|
||
|
DcRoadConditionInformation dcRoadConditionInformation =new DcRoadConditionInformation();
|
||
|
dcRoadConditionInformation.setOtherConfig(jsonArray.toJSONString());
|
||
|
dcRoadConditionInformationService.insertDcRoadConditionInformation(dcRoadConditionInformation);
|
||
|
// 将获取到的交通指标数据封装为成功的结果并返回
|
||
|
}
|
||
|
}
|