Commit fc86b9de authored by wang yecheng's avatar wang yecheng

方案评价-失衡 -空放-一版

parent f56fcf7a
...@@ -75,6 +75,55 @@ public class EvaluationInfoController { ...@@ -75,6 +75,55 @@ public class EvaluationInfoController {
return jsonViewObject; 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;
}
} }
...@@ -10,4 +10,8 @@ public interface EvaluationInfoService extends IService<CrossDataHistPO> { ...@@ -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> 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> 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, ...@@ -208,4 +208,166 @@ public class EvaluationInfoServiceImpl extends ServiceImpl<CrossDataHistMapper,
return jsonObject; 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;
}
} }
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