Browse Source

Merge remote-tracking branch 'origin/develop' into develop

develop
wangsixiang 5 months ago
parent
commit
507d1f59f7
  1. 20
      zc-business/src/main/java/com/zc/business/controller/DcTimingOfTrafficConditionsController.java
  2. 2
      zc-business/src/main/java/com/zc/business/domain/DcEvent.java

20
zc-business/src/main/java/com/zc/business/controller/DcTimingOfTrafficConditionsController.java

@ -11,6 +11,8 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
/**
*路况信息 每小时入一次库
@ -24,13 +26,27 @@ public class DcTimingOfTrafficConditionsController {
// 调用服务层方法,获取当前交通指标数据
@Scheduled(cron = "0 0 * * * *")
//@Scheduled(cron = "0 0/1 * * * ?")
public void getTheCurrentCongestedSection() throws HttpException, IOException {
// 调用服务层方法,获取当前交通指标数据
JSONArray jsonArray = dcTrafficStatisticsService.getTheCurrentCongestedSection();
//插入 数据库
DcRoadConditionInformation dcRoadConditionInformation =new DcRoadConditionInformation();
dcRoadConditionInformation.setOtherConfig(jsonArray.toJSONString());
dcRoadConditionInformationService.insertDcRoadConditionInformation(dcRoadConditionInformation);
DcRoadConditionInformation dcRoadConditionInformation1 = dcRoadConditionInformationService.selectlistTime().get(0);
Date createTime = dcRoadConditionInformation1.getCreateTime();
Calendar createTimeCalendar = Calendar.getInstance();
createTimeCalendar.setTime(createTime);
// 获取 createTime 的小时
int createHour = createTimeCalendar.get(Calendar.HOUR_OF_DAY);
// 获取当前时间的小时
Calendar currentCalendar = Calendar.getInstance();
int currentHour = currentCalendar.get(Calendar.HOUR_OF_DAY);
if (createHour != currentHour) {
dcRoadConditionInformationService.insertDcRoadConditionInformation(dcRoadConditionInformation);
}
}
// 将获取到的交通指标数据封装为成功的结果并返回
}
}

2
zc-business/src/main/java/com/zc/business/domain/DcEvent.java

@ -58,7 +58,7 @@ public class DcEvent {
* 2-
* 3-
*/
@Excel(name = "方向")
@Excel(name = "方向", readConverterExp = "1=菏泽方向,3=济南方向")
//@Excel(name = "方向")
@ApiModelProperty("方向")
private String direction;

Loading…
Cancel
Save