Commit 469d38fe authored by 黄伟铭's avatar 黄伟铭

Merge remote-tracking branch 'origin/master'

parents 010337b7 525a80a9
......@@ -75,6 +75,55 @@ public class EvaluationInfoController {
return jsonViewObject;
}
@ApiOperation(value = "方案评价-失衡", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口ID", required = true, dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "分析时段开始时间", required = false, dataType = "string"),
@ApiImplicitParam(name = "endTime", value = "分析时段截止时间", required = false, dataType = "string"),
@ApiImplicitParam(name = "contrastStartTime", value = "对比时段开始时间", required = false, dataType = "string"),
@ApiImplicitParam(name = "constrastEndTime", value = "对比时段截止时间", required = false, dataType = "string"),
})
@GetMapping(value = "/unbalance")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AreaProblemOverview.class),
})
public JsonViewObject unbalanceEvaluation(String crossId,String startTime, String endTime,String contrastStartTime,String constrastEndTime) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try{
Map<String,Object> resData=evaluationInfoService.unbalanceEvaluation(crossId,startTime,endTime,contrastStartTime,constrastEndTime);
jsonViewObject.success(resData);
}catch (Exception e){
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
@ApiOperation(value = "方案评价-空放", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口ID", required = true, dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "分析时段开始时间", required = false, dataType = "string"),
@ApiImplicitParam(name = "endTime", value = "分析时段截止时间", required = false, dataType = "string"),
@ApiImplicitParam(name = "contrastStartTime", value = "对比时段开始时间", required = false, dataType = "string"),
@ApiImplicitParam(name = "constrastEndTime", value = "对比时段截止时间", required = false, dataType = "string"),
})
@GetMapping(value = "/idle")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AreaProblemOverview.class),
})
public JsonViewObject idleEvaluation(String crossId,String startTime, String endTime,String contrastStartTime,String constrastEndTime) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try{
Map<String,Object> resData=evaluationInfoService.idleEvaluation(crossId,startTime,endTime,contrastStartTime,constrastEndTime);
jsonViewObject.success(resData);
}catch (Exception e){
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
}
......@@ -94,7 +94,7 @@ public class InduceSendServiceImpl implements InduceSendService {
param.setResolutionWidth(deviceInduces.getResolutionWidth().intValue());
param.setResolutionHeight(deviceInduces.getResolutionHeight().intValue());
}
log.info("发送诱导屏诱导屏编号信息:{}", deviceInduces);
log.info("发送屏诱导屏编号信息:{}", deviceInduces);
// 获取图片字节数组
BufferedImage image = null;
try {
......@@ -119,7 +119,7 @@ public class InduceSendServiceImpl implements InduceSendService {
createImageWithText(induceTemplate, image, param.getContents(), true, topLeftX, topLeftY, bottomRightX, bottomRightY);
}
} catch (Exception ex) {
log.error("诱导屏通过模版生成图片异常:{}", ex.getMessage());
log.error("发送上屏通过模版生成图片异常:{}", ex.getMessage());
}
// 测试阶段保存图片到本地
// ImageIO.write(image, "bmp", new File("D:\\tmp\\" + induceTemplate.getFileName()));
......@@ -135,7 +135,7 @@ public class InduceSendServiceImpl implements InduceSendService {
if (Objects.nonNull(greenwaveinduces)) {
greenwaveinduces.setSourceId(PATH + dirName + "/" + fileName);
}
log.info("上传文件至ftp-filePath:{}", param.getFtpPath());
log.info("发送上屏上传文件至ftp-filePath:{}", param.getFtpPath());
induceTemplateService.updateById(induceTemplate);
}
......@@ -171,7 +171,7 @@ public class InduceSendServiceImpl implements InduceSendService {
try {
rabbitTemplate.convertAndSend("", queueName, message);
} catch (Exception e) {
log.error("rabbit发送诱导屏信息失败- queueName:{},message:{}", queueName, message);
log.error("发送上屏rabbit发送诱导屏信息失败- queueName:{},message:{}", queueName, message);
}
}
log.info("mqtt发送信息-topic:{},queueName:{},message:{}", queueName, message);
......@@ -225,6 +225,7 @@ public class InduceSendServiceImpl implements InduceSendService {
log.info("ftp服务器上传文件{}失败", fileName);
return null;
} catch (Exception e) {
log.error("ftp服务连接异常:{}", e);
log.error(e.getMessage());
return null;
} finally {
......
......@@ -10,4 +10,8 @@ public interface EvaluationInfoService extends IService<CrossDataHistPO> {
Map<String,Object> getListEvaluationSummarize(String crossId, String startTime, String endTime, String contrastStartTime, String constrastEndTime);
Map<String, Object> summaryEvaluation(String crossId, String startTime, String endTime, String contrastStartTime, String constrastEndTime);
Map<String, Object> unbalanceEvaluation(String crossId, String startTime, String endTime, String contrastStartTime, String constrastEndTime);
Map<String, Object> idleEvaluation(String crossId, String startTime, String endTime, String contrastStartTime, String constrastEndTime);
}
......@@ -208,4 +208,166 @@ public class EvaluationInfoServiceImpl extends ServiceImpl<CrossDataHistMapper,
return jsonObject;
}
/*失衡702
*
* */
@Override
public Map<String, Object> unbalanceEvaluation(String crossId, String startTime, String endTime, String contrastStartTime, String constrastEndTime) {
//分析时间
List<TEventOptimizeInfo> overFlowList = crossProblemEvaluationMapper.getOverflow(crossId, startTime, endTime);
//对比时间
List<TEventOptimizeInfo> contrastoverFlowList = crossProblemEvaluationMapper.getContrastOverflow(crossId, contrastStartTime, constrastEndTime);
//分析失衡次数
long unbalancecount = overFlowList.stream().filter(event -> "702".equals(event.getEventType())).count();
//对比失衡次数
long contrastunbalancecount = contrastoverFlowList.stream().filter(event -> "702".equals(event.getEventType())).count();
//分析失衡优化次数
long unbalanceTime = overFlowList.stream().filter(event -> "702".equals(event.getEventType()) && "1".equals(event.getOptStatus())).count();
//对比失衡优化次数
long contrastunbalanceTime = contrastoverFlowList.stream().filter(event -> "702".equals(event.getEventType()) && "1".equals(event.getOptStatus())).count();
//分析失衡时长
int fenxiunbalanceTime = overFlowList.stream().filter(event -> "702".equals(event.getEventType())).mapToInt(TEventOptimizeInfo::getDuration).sum();
//对比失衡时长
int duibiunbalanceTime = contrastoverFlowList.stream().filter(event -> "702".equals(event.getEventType())).mapToInt(TEventOptimizeInfo::getDuration).sum();
//计算失衡次数百分比
double unbalanceCishujisuan = calculatePercentage(unbalancecount, contrastunbalancecount);
//计算失衡时长百分比
double unbalancetimejisuan = calculatePercentage(fenxiunbalanceTime, duibiunbalanceTime);
//分析时间路口平均停车次数t_cross_data_hist
List<CrossDataHistPO> analyseList = crossDataHistMapper.getListEvaluationanalyse(crossId, startTime, endTime);
//比较时间的数据路口平均停车次数t_cross_data_hist
List<CrossDataHistPO> contrastList = crossDataHistMapper.getListEvaluationcontrast(crossId, contrastStartTime, constrastEndTime);
//失衡分析时间的stop_times路口平均停车次数
Double unbalanceStopTimes = 0.0;
for (CrossDataHistPO analyselist : analyseList) {
if (analyselist == null) {
continue; // 跳过空元素
}
unbalanceStopTimes = analyselist.getStopTimes();
}
//失衡对比的时间stop_times路口平均停车次数
Double conTrastUnbalanceStopTimes = 0.0;
for (CrossDataHistPO contrastlist : contrastList) {
if (contrastlist == null) {
continue; // 跳过空元素
}
conTrastUnbalanceStopTimes = contrastlist.getStopTimes();
}
//失衡的平均停车次数计算
double unbalanceStopTimesjisuan = calculatePercentage(unbalanceStopTimes, conTrastUnbalanceStopTimes);
JSONObject jsonObject = new JSONObject();
//分析失衡次数
jsonObject.put("unbalancecount", unbalancecount);
//分析失衡优化次数
jsonObject.put("unbalanceTime", unbalanceTime);
//对比失衡次数
jsonObject.put("ontrastunbalancecount", contrastunbalancecount);
//对比的失衡的优化次数
jsonObject.put("contrastunbalanceTime", contrastunbalanceTime);
//失衡次数分析对比计算
jsonObject.put("unbalanceCishucalculate", unbalanceCishujisuan+ "%");
//失衡时长分析对比计算
jsonObject.put("unbalancetimecalculate", unbalancetimejisuan+ "%");
//失衡平均停车次数
jsonObject.put("unbalanceStopTimescalculate", unbalanceStopTimesjisuan+ "%");
return jsonObject;
}
/*
* 空放701
* */
@Override
public Map<String, Object> idleEvaluation(String crossId, String startTime, String endTime, String contrastStartTime, String constrastEndTime) {
//分析时间
List<TEventOptimizeInfo> overFlowList = crossProblemEvaluationMapper.getOverflow(crossId, startTime, endTime);
//对比时间
List<TEventOptimizeInfo> contrastoverFlowList = crossProblemEvaluationMapper.getContrastOverflow(crossId, contrastStartTime, constrastEndTime);
//分析时间空放次数
long dileCount = overFlowList.stream().filter(evet -> "701".equals(evet.getEventType())).count();
//对比时间空放次数
long contrastDileCount = contrastoverFlowList.stream().filter(event -> "701".equals(event.getEventType())).count();
//分析时间空放优化次数
long dileTime = overFlowList.stream().filter(event -> "701".equals(event.getEventType()) && "1".equals(event.getOptStatus())).count();
//对比时间空放优化次数
long contrastDileTime = contrastoverFlowList.stream().filter(event -> "701".equals(event.getEventType()) && "1".equals(event.getOptStatus())).count();
//分析空放时长
int fenxiDileTime = overFlowList.stream().filter(event -> "701".equals(event.getEventType())).mapToInt(TEventOptimizeInfo::getDuration).sum();
//对比空放时长
int duibiDileTime = contrastoverFlowList.stream().filter(event -> "701".equals(event.getEventType())).mapToInt(TEventOptimizeInfo::getDuration).sum();
//计算空放次数百分比
double dileCishujisuan = calculatePercentage(dileCount, contrastDileCount);
//计算空放时长百分比
double dileTimejisuan = calculatePercentage(fenxiDileTime, duibiDileTime);
//分析时间路口平均速度t_cross_data_hist
List<CrossDataHistPO> analyseList = crossDataHistMapper.getListEvaluationanalyse(crossId, startTime, endTime);
//比较时间的数据路口平均速度t_cross_data_hist
List<CrossDataHistPO> contrastList = crossDataHistMapper.getListEvaluationcontrast(crossId, contrastStartTime, constrastEndTime);
//空放分析时间的Speed路口平均速度
Double dileSpeed = 0.0;
for (CrossDataHistPO analyselist : analyseList) {
if (analyselist == null) {
continue; // 跳过空元素
}
dileSpeed = analyselist.getSpeed();
}
//空放对比的时间平均速度
Double conTrastDileSpeed = 0.0;
for (CrossDataHistPO contrastlist : contrastList) {
if (contrastlist == null) {
continue; // 跳过空元素
}
conTrastDileSpeed = contrastlist.getSpeed();
}
//空放的平均速度
double dileSpeedjisuan = calculatePercentage(dileSpeed, conTrastDileSpeed);
JSONObject jsonObject = new JSONObject();
//分析时间空放次数
jsonObject.put("dileCount", dileCount);
//分析时间空放优化次数
jsonObject.put("dileTime", dileTime);
//对比时间空放的次数
jsonObject.put("contrastDileCount", contrastDileCount);
//对比的空放的优化次数
jsonObject.put("contrastDileTime", contrastDileTime);
//空放次数分析对比计算
jsonObject.put("dileCishucalculate", dileCishujisuan+ "%");
//空放时长分析对比计算
jsonObject.put("dileTimecalculate", dileTimejisuan+ "%");
//空放评价速度对比计算
jsonObject.put("dileSpeedcalculate", dileSpeedjisuan+ "%");
return jsonObject;
}
}
......@@ -152,6 +152,7 @@ public class InducesMonitorTask {
System.out.println("当前时间在范围内: " + LocalTime.now());
//System.out.println("绿波路口--->"+greenwaveInfoPO.getId()+"=="+o.getCrossId());
flag.set(true);
log.info("当前诱导屏在策略执行时间内flag=true内容:{}", greenwaveInfoPO.getId());
strategyId.set(p.getDailyPlanId());
}
}
......@@ -167,6 +168,7 @@ public class InducesMonitorTask {
//如果在绿波时段内,未上屏,则获取固定配时绿波信息
if (flag.get()) {
List<StrategyGreenOptHistEntity> strategyGreenOptHistEntitiesList = strategyGreenOptHistMapper.selectByGreenId(String.valueOf(greenwaveInfoPO.getId())).stream().distinct().collect(Collectors.toList());
log.info("当前诱导屏在策略执行时间内,下发的绿波列表:{}", strategyGreenOptHistEntitiesList);
if (Objects.nonNull(strategyGreenOptHistEntitiesList)) {
for (StrategyGreenOptHistEntity greenOptHistEntity : strategyGreenOptHistEntitiesList) {
Integer controlMethod = greenOptHistEntity.getControlMethod();
......@@ -248,6 +250,7 @@ public class InducesMonitorTask {
}
induceSendService.send(messageParam);
Thread.sleep(10000);
log.info("发送上屏信息成功,上屏内容:{}", messageParam);
}
}
greenwaveInducesHist.setStatus(1);
......@@ -333,7 +336,7 @@ public class InducesMonitorTask {
messageParam.setFlg(2);
messageParam.setType("TFMH");
induceSendService.send(messageParam);
log.info("当前绿波:{}, 诱导屏编号:{}, 下屏成功", greenId, equipCode);
log.info("当前绿波:{}, 诱导屏编号:{},当前绿波结束时间:{}, 下屏成功", greenId, equipCode, endTime);
Thread.sleep(500);
}
}
......
......@@ -163,7 +163,7 @@
cross_id,avg(speed) as speed,
avg(delay_time) as delay_time,
avg(queue_length) as queue_length,start_time,
sum(flow) as flow
sum(flow) as flow,avg(stop_times) as stop_times
FROM t_cross_data_hist
WHERE
1=1
......@@ -171,7 +171,7 @@
AND cross_id=#{crossId}
</if>
<if test="startTime!=null and startTime!='' and endTime!='' and endTime!=null">
AND start_time>=#{startTime} and start_time &lt;=#{endTime}
AND start_time>=#{startTime} and start_time &lt;=#{endTime}
</if>
</select>
......@@ -180,7 +180,7 @@
cross_id,avg(speed) as speed,
avg(delay_time) as delay_time,
avg(queue_length) as queue_length,start_time,
sum(flow) as flow
sum(flow) as flow,avg(stop_times) as stop_times
FROM t_cross_data_hist
WHERE
1=1
......
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