Commit 2c4b7468 authored by wangyecheng's avatar wangyecheng

修改方案评价溢出场景空放

parent ac21b3be
......@@ -53,6 +53,8 @@ public class EvaluationInfoController {
@ApiOperation(value = "方案评价-溢出", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiImplicitParams({
@ApiImplicitParam(name = "evenType", value = "事件类型", required = true, dataType = "String"),
@ApiImplicitParam(name = "currentAlgo", value = "事件类型", required = true, dataType = "String"),
@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"),
......@@ -63,10 +65,10 @@ public class EvaluationInfoController {
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AreaProblemOverview.class),
})
public JsonViewObject summaryEvaluation(String crossId,String startTime, String endTime,String contrastStartTime,String constrastEndTime) {
public JsonViewObject summaryEvaluation(String evenType,String currentAlgo,String crossId,String startTime, String endTime,String contrastStartTime,String constrastEndTime) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try{
Map<String,Object> resData=evaluationInfoService.summaryEvaluation(crossId,startTime,endTime,contrastStartTime,constrastEndTime);
Map<String,Object> resData=evaluationInfoService.summaryEvaluation( evenType, currentAlgo,crossId,startTime,endTime,contrastStartTime,constrastEndTime);
jsonViewObject.success(resData);
}catch (Exception e){
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
......@@ -78,6 +80,8 @@ public class EvaluationInfoController {
@ApiOperation(value = "方案评价-失衡", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiImplicitParams({
@ApiImplicitParam(name = "evenType", value = "事件类型", required = true, dataType = "String"),
@ApiImplicitParam(name = "currentAlgo", value = "事件类型", required = true, dataType = "String"),
@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"),
......@@ -88,10 +92,10 @@ public class EvaluationInfoController {
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AreaProblemOverview.class),
})
public JsonViewObject unbalanceEvaluation(String crossId,String startTime, String endTime,String contrastStartTime,String constrastEndTime) {
public JsonViewObject unbalanceEvaluation(String evenType,String currentAlgo,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);
Map<String,Object> resData=evaluationInfoService.unbalanceEvaluation(evenType,currentAlgo,crossId,startTime,endTime,contrastStartTime,constrastEndTime);
jsonViewObject.success(resData);
}catch (Exception e){
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
......@@ -103,6 +107,8 @@ public class EvaluationInfoController {
@ApiOperation(value = "方案评价-空放", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiImplicitParams({
@ApiImplicitParam(name = "evenType", value = "事件类型", required = true, dataType = "String"),
@ApiImplicitParam(name = "currentAlgo", value = "事件类型", required = true, dataType = "String"),
@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"),
......@@ -113,10 +119,10 @@ public class EvaluationInfoController {
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AreaProblemOverview.class),
})
public JsonViewObject idleEvaluation(String crossId,String startTime, String endTime,String contrastStartTime,String constrastEndTime) {
public JsonViewObject idleEvaluation(String evenType,String currentAlgo,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);
Map<String,Object> resData=evaluationInfoService.idleEvaluation(evenType,currentAlgo,crossId,startTime,endTime,contrastStartTime,constrastEndTime);
jsonViewObject.success(resData);
}catch (Exception e){
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
......
......@@ -4,6 +4,8 @@ import net.wanji.common.framework.mapper.BaseInterfaceMapper;
import net.wanji.opt.entity.evaluation.EventInfo;
import net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo;
import net.wanji.opt.entity.judgeanalysis.AnalysisProblemAndStrategyDay;
import net.wanji.opt.po.trend.EventInfoSimplePo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
......@@ -20,8 +22,8 @@ public interface CrossProblemEvaluationMapper {
public List<AnalysisProblemAndStrategyDay> findOVerFlowInfo();
List<TEventOptimizeInfo> getOverflow(String crossId, String startTime, String endTime);
List<EventInfoSimplePo> getOverflow(@Param("evenType") String evenType, @Param("currentAlgo")String currentAlgo, @Param("crossId")String crossId, @Param("startTime")String startTime, @Param("endTime")String endTime);
List<TEventOptimizeInfo> getContrastOverflow(String crossId, String contrastStartTime, String constrastEndTime);
List<EventInfoSimplePo> getContrastOverflow(@Param("evenType")String evenType,@Param("currentAlgo")String currentAlgo,@Param("crossId")String crossId,@Param("contrastStartTime") String contrastStartTime, @Param("constrastEndTime")String constrastEndTime);
}
package net.wanji.opt.po.trend;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
......@@ -64,4 +65,12 @@ public class EventInfoSimplePo implements Serializable {
@ApiModelProperty(value = "纵轴日期 格式:(dd/MM)", notes = "")
private List<String> dataTimeList = new ArrayList<>();
//非数据库字段
//事件发生次数
@TableField(exist = false)
private Long eventCount;
//优化次数
@TableField(exist = false)
private Long optimizecount;
}
\ No newline at end of file
......@@ -9,9 +9,9 @@ import java.util.Map;
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> summaryEvaluation(String evenType,String currentAlgo,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> unbalanceEvaluation(String evenType,String currentAlgo,String crossId, String startTime, String endTime, String contrastStartTime, String constrastEndTime);
Map<String, Object> idleEvaluation(String crossId, String startTime, String endTime, String contrastStartTime, String constrastEndTime);
Map<String, Object> idleEvaluation(String evenType,String currentAlgo,String crossId, String startTime, String endTime, String contrastStartTime, String constrastEndTime);
}
......@@ -10,6 +10,7 @@ import net.wanji.opt.constant.ServiceLevelEnum;
import net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo;
import net.wanji.opt.entity.judgeanalysis.AnalysisProblemAndStrategyDay;
import net.wanji.opt.dao.mapper.evaluation.CrossProblemEvaluationMapper;
import net.wanji.opt.po.trend.EventInfoSimplePo;
import net.wanji.opt.servicev2.evaluation.EvaluationInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -142,34 +143,52 @@ public class EvaluationInfoServiceImpl extends ServiceImpl<CrossDataHistMapper,
return serviceLevel;
}
/*
* 溢出
* */
@Override
public Map<String, Object> summaryEvaluation(String crossId, String startTime, String endTime, String contrastStartTime, String constrastEndTime) {
public Map<String, Object> summaryEvaluation(String evenType,String currentAlgo,String crossId, String startTime, String endTime, String contrastStartTime, String constrastEndTime) {
try {
//分析时间
List<TEventOptimizeInfo> overFlowList = crossProblemEvaluationMapper.getOverflow(crossId, startTime, endTime);
List<EventInfoSimplePo> overFlowList = crossProblemEvaluationMapper.getOverflow(evenType,currentAlgo,crossId, startTime, endTime);
//对比时间
List<TEventOptimizeInfo> contrastoverFlowList = crossProblemEvaluationMapper.getContrastOverflow(crossId, contrastStartTime, constrastEndTime);
//分析溢出次数
long overFlowcount = overFlowList.stream().filter(event -> "703".equals(event.getEventType())).count();
//对比溢出次数
long ontrastoverFlowcount = contrastoverFlowList.stream().filter(event -> "703".equals(event.getEventType())).count();
List<EventInfoSimplePo> contrastoverFlowList = crossProblemEvaluationMapper.getContrastOverflow(evenType,currentAlgo,crossId, contrastStartTime, constrastEndTime);
//分析时间的查询数据集
//分析溢出次数
long overFlowcount=0;
//分析溢出优化次数
long overFlowTime = overFlowList.stream().filter(event -> "703".equals(event.getEventType()) && "1".equals(event.getOptStatus())).count();
//对比溢出优化次数
long contrastoverFlowTime = contrastoverFlowList.stream().filter(event -> "703".equals(event.getEventType()) && "1".equals(event.getOptStatus())).count();
long overFlowTime =0;
//分析溢出时长
int fenxioverflowTime = overFlowList.stream().filter(event -> "703".equals(event.getEventType())).mapToInt(TEventOptimizeInfo::getDuration).sum();
int fenxioverflowTime=0;
for (EventInfoSimplePo fxList:overFlowList){
//分析溢出次数
overFlowcount = fxList.getEventCount();
//分析溢出优化次数
overFlowTime = fxList.getOptimizecount();
fenxioverflowTime=fxList.getDuration();
}
//对比时间的查询数据集
//对比溢出次数
long ontrastoverFlowcount=0;
//对比溢出优化次数
long contrastoverFlowTime=0;
//对比溢出时长
int duibioverflowTime = contrastoverFlowList.stream().filter(event -> "703".equals(event.getEventType())).mapToInt(TEventOptimizeInfo::getDuration).sum();
int duibioverflowTime=0;
for (EventInfoSimplePo fxList:contrastoverFlowList){
//对比溢出次数
ontrastoverFlowcount = fxList.getEventCount();
//对比溢出优化次数
contrastoverFlowTime = fxList.getOptimizecount();
duibioverflowTime=fxList.getDuration();
}
//计算溢出次数百分比
double overFlowCishujisuan = calculatePercentage(overFlowcount, ontrastoverFlowcount);
......@@ -231,31 +250,46 @@ public class EvaluationInfoServiceImpl extends ServiceImpl<CrossDataHistMapper,
*
* */
@Override
public Map<String, Object> unbalanceEvaluation(String crossId, String startTime, String endTime, String contrastStartTime, String constrastEndTime) {
public Map<String, Object> unbalanceEvaluation(String evenType,String currentAlgo,String crossId, String startTime, String endTime, String contrastStartTime, String constrastEndTime) {
try {
//分析时间
List<TEventOptimizeInfo> overFlowList = crossProblemEvaluationMapper.getOverflow(crossId, startTime, endTime);
List<EventInfoSimplePo> overFlowList = crossProblemEvaluationMapper.getOverflow(evenType,currentAlgo,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();
List<EventInfoSimplePo> contrastoverFlowList = crossProblemEvaluationMapper.getContrastOverflow(evenType,currentAlgo,crossId, contrastStartTime, constrastEndTime);
//分析时间结果集
//分析失衡次数
long unbalancecount=0;
//分析失衡优化次数
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();
long unbalanceTime=0;
//分析失衡时长
int fenxiunbalanceTime = overFlowList.stream().filter(event -> "702".equals(event.getEventType())).mapToInt(TEventOptimizeInfo::getDuration).sum();
int fenxiunbalanceTime=0;
for (EventInfoSimplePo fxList:overFlowList){
//分析次数
unbalancecount = fxList.getEventCount();
//分析优化次数
unbalanceTime = fxList.getOptimizecount();
fenxiunbalanceTime=fxList.getDuration();
}
//对比时间结果集
//对比失衡次数
long contrastunbalancecount=0;
//对比失衡优化次数
long contrastunbalanceTime=0;
//对比失衡时长
int duibiunbalanceTime = contrastoverFlowList.stream().filter(event -> "702".equals(event.getEventType())).mapToInt(TEventOptimizeInfo::getDuration).sum();
int duibiunbalanceTime=0;
for (EventInfoSimplePo fxList:contrastoverFlowList){
//对比次数
contrastunbalancecount = fxList.getEventCount();
//对比优化次数
contrastunbalanceTime = fxList.getOptimizecount();
duibiunbalanceTime=fxList.getDuration();
}
//计算失衡次数百分比
double unbalanceCishujisuan = calculatePercentage(unbalancecount, contrastunbalancecount);
......@@ -309,39 +343,54 @@ public class EvaluationInfoServiceImpl extends ServiceImpl<CrossDataHistMapper,
log.error("{} unbalanceEvaluation error", this.getClass().getSimpleName(), e);
throw e;
}
}
/*
* 空放701
* */
@Override
public Map<String, Object> idleEvaluation(String crossId, String startTime, String endTime, String contrastStartTime, String constrastEndTime) {
public Map<String, Object> idleEvaluation(String evenType,String currentAlgo,String crossId, String startTime, String endTime, String contrastStartTime, String constrastEndTime) {
try {
//分析时间
List<TEventOptimizeInfo> overFlowList = crossProblemEvaluationMapper.getOverflow(crossId, startTime, endTime);
List<EventInfoSimplePo> overFlowList = crossProblemEvaluationMapper.getOverflow(evenType,currentAlgo,crossId, startTime, endTime);
//对比时间
List<TEventOptimizeInfo> contrastoverFlowList = crossProblemEvaluationMapper.getContrastOverflow(crossId, contrastStartTime, constrastEndTime);
List<EventInfoSimplePo> contrastoverFlowList = crossProblemEvaluationMapper.getContrastOverflow(evenType,currentAlgo,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 dileCount=0;
//分析时间空放优化次数
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();
long dileTime=0;
//分析空放时长
int fenxiDileTime = overFlowList.stream().filter(event -> "701".equals(event.getEventType())).mapToInt(TEventOptimizeInfo::getDuration).sum();
int fenxiDileTime=0;
for (EventInfoSimplePo fxList:overFlowList){
//分析次数
dileCount = fxList.getEventCount();
//分析优化次数
dileTime = fxList.getOptimizecount();
fenxiDileTime=fxList.getDuration();
}
//对比时间结果集
//对比时间空放次数
long contrastDileCount=0;
//对比时间空放优化次数
long contrastDileTime=0;
//对比空放时长
int duibiDileTime = contrastoverFlowList.stream().filter(event -> "701".equals(event.getEventType())).mapToInt(TEventOptimizeInfo::getDuration).sum();
int duibiDileTime=0;
for (EventInfoSimplePo fxList:contrastoverFlowList){
//对比次数
contrastDileCount = fxList.getEventCount();
//对比优化次数
contrastDileTime = fxList.getOptimizecount();
duibiDileTime=fxList.getDuration();
}
//计算空放次数百分比
double dileCishujisuan = calculatePercentage(dileCount, contrastDileCount);
......@@ -396,5 +445,6 @@ public class EvaluationInfoServiceImpl extends ServiceImpl<CrossDataHistMapper,
throw e;
}
}
}
......@@ -9,36 +9,77 @@
FROM t_event_optimize_info
WHERE 1=1
</select>
<select id="getOverflow" parameterType="net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo" resultType="net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo" >
SELECT
cross_id,duration,opt_status,
event_type,opt_duration
<select id="getOverflow" parameterType="net.wanji.opt.po.trend.EventInfoSimplePo" resultType="net.wanji.opt.po.trend.EventInfoSimplePo" >
SELECT count(*) as event_count,
sum(duration) duration,
count(t2.event_id) as optimizecount
FROM
t_event_optimize_info
(
SELECT t1.cross_id,t1.event_serial_number,t1.type,TIMESTAMPDIFF(SECOND,t1.start_time,t1.end_time) duration from t_event_info t1
Where 1=1
<if test="crossId!=null and crossId!=''">
AND t1.cross_id=#{crossId}
</if>
<if test="startTime!=null and endTime!=null">
AND start_time>=#{startTime} and start_time &lt;=#{endTime}
</if>
<if test="evenType!=null">
AND t1.type=#{evenType}
</if>
) t1
left JOIN
(
SELECT t1.cross_id,t1.event_id from t_strategy_cross_result t1
WHERE
1=1
1=1
<if test="crossId!=null and crossId!=''">
AND cross_id=#{crossId}
AND t1.cross_id=#{crossId}
</if>
<if test="startTime!=null and endTime!=null">
AND issue_time>=#{startTime} and issue_time &lt;=#{endTime}
</if>
<if test="startTime!=null and startTime!='' and endTime!='' and endTime!=null">
AND happen_start_time>=#{startTime} and happen_start_time &lt;=#{endTime}
<if test="currentAlgo!=null">
AND t1.current_algo=#{currentAlgo}
</if>
) t2
on t1.event_serial_number=t2.event_id
GROUP BY t1.cross_id,t1.type
</select>
<select id="getContrastOverflow" parameterType="net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo" resultType="net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo">
SELECT
cross_id,duration,opt_status,
event_type,opt_duration
<select id="getContrastOverflow" parameterType="net.wanji.opt.po.trend.EventInfoSimplePo" resultType="net.wanji.opt.po.trend.EventInfoSimplePo">
SELECT count(*) as event_count,
sum(duration) duration,
count(t2.event_id) as optimizecount
FROM
t_event_optimize_info
(
SELECT t1.cross_id,t1.event_serial_number,t1.type,TIMESTAMPDIFF(SECOND,t1.start_time,t1.end_time) duration from t_event_info t1
Where 1=1
<if test="crossId!=null and crossId!=''">
AND t1.cross_id=#{crossId}
</if>
<if test="contrastStartTime!=null and constrastEndTime!=null">
AND start_time>=#{contrastStartTime} and start_time &lt;=#{constrastEndTime}
</if>
<if test="evenType!=null">
AND t1.type=#{evenType}
</if>
) t1
left JOIN
(
SELECT t1.cross_id,t1.event_id from t_strategy_cross_result t1
WHERE
1=1
<if test="crossId!=null and crossId!=''">
AND cross_id=#{crossId}
AND t1.cross_id=#{crossId}
</if>
<if test="contrastStartTime!=null and contrastStartTime!='' and constrastEndTime!='' and constrastEndTime!=null">
AND happen_start_time>=#{contrastStartTime} and happen_start_time &lt;=#{constrastEndTime}
<if test="contrastStartTime!=null and constrastEndTime!=null">
AND issue_time>=#{contrastStartTime} and issue_time &lt;=#{constrastEndTime}
</if>
<if test="currentAlgo!=null">
AND t1.current_algo=#{currentAlgo}
</if>
) t2
on t1.event_serial_number=t2.event_id
GROUP BY t1.cross_id,t1.type
</select>
......
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