Commit 09c5fc13 authored by zhouleilei's avatar zhouleilei

Merge remote-tracking branch 'origin/master'

parents cdb29710 0e2b705d
...@@ -159,7 +159,7 @@ public class GreenwaveHistRestServer { ...@@ -159,7 +159,7 @@ public class GreenwaveHistRestServer {
@ApiOperation(httpMethod="GET",value="绿波路口方向级->分粒度指标趋势", notes="") @ApiOperation(httpMethod="GET",value="绿波路口方向级->分粒度指标趋势", notes="")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口ID", required = true, dataType = "String",defaultValue = "13MOD0B5SI0"), @ApiImplicitParam(name = "crossId", value = "路口ID", required = true, dataType = "String",defaultValue = "13MOD0B5SI0"),
@ApiImplicitParam(name = "groupType", value = "时间粒度类型 1:15分钟粒度 2:30分钟粒度 3:小时粒度", required = true, dataType = "Integer",defaultValue = "1"), @ApiImplicitParam(name = "groupType", value = "时间粒度类型 0:5分钟粒度 1:15分钟粒度 2:30分钟粒度 3:小时粒度", required = true, dataType = "Integer",defaultValue = "1"),
@ApiImplicitParam(name = "startTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = false, dataType = "String",defaultValue = "2024-12-04 00:00:00"), @ApiImplicitParam(name = "startTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = false, dataType = "String",defaultValue = "2024-12-04 00:00:00"),
@ApiImplicitParam(name = "endTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = false, dataType = "String",defaultValue = "2024-12-05 00:00:00") @ApiImplicitParam(name = "endTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = false, dataType = "String",defaultValue = "2024-12-05 00:00:00")
}) })
......
...@@ -13,6 +13,7 @@ import net.wanji.opt.dto.strategy.AddOrUpdateSceneDTO; ...@@ -13,6 +13,7 @@ import net.wanji.opt.dto.strategy.AddOrUpdateSceneDTO;
import net.wanji.opt.service.CrossIndexService; import net.wanji.opt.service.CrossIndexService;
import net.wanji.opt.vo.AIOptResultVO; import net.wanji.opt.vo.AIOptResultVO;
import net.wanji.opt.vo.CrossOptResult; import net.wanji.opt.vo.CrossOptResult;
import net.wanji.opt.vo.crossStatusCountVO;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -101,4 +102,20 @@ public class CrossIndexController { ...@@ -101,4 +102,20 @@ public class CrossIndexController {
return JsonViewObject.newInstance().success(results); return JsonViewObject.newInstance().success(results);
} }
@ApiOperation(value = "问题诊断", notes = "优化监测-问题诊断", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/crossStatusCount")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AddOrUpdateSceneDTO.class),
})
public JsonViewObject crossStatusCount(String crossId) {
crossStatusCountVO result = new crossStatusCountVO();
try {
result = crossIndexService.crossStatusCount(crossId);
} catch (Exception e) {
JsonViewObject.newInstance().fail("优化监测-问题诊断");
}
return JsonViewObject.newInstance().success(result);
}
} }
...@@ -6,6 +6,7 @@ import net.wanji.databus.po.CrossDirDataRealtimePO; ...@@ -6,6 +6,7 @@ import net.wanji.databus.po.CrossDirDataRealtimePO;
import net.wanji.databus.po.TBaseCrossInfo; import net.wanji.databus.po.TBaseCrossInfo;
import net.wanji.opt.vo.AIOptResultVO; import net.wanji.opt.vo.AIOptResultVO;
import net.wanji.opt.vo.CrossOptResult; import net.wanji.opt.vo.CrossOptResult;
import net.wanji.opt.vo.crossStatusCountVO;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -24,4 +25,6 @@ public interface CrossIndexService { ...@@ -24,4 +25,6 @@ public interface CrossIndexService {
List<CrossOptResult> crossOptResultList(CrossIdBO crossIdBO) throws Exception; List<CrossOptResult> crossOptResultList(CrossIdBO crossIdBO) throws Exception;
List<AIOptResultVO> crossAIList(); List<AIOptResultVO> crossAIList();
crossStatusCountVO crossStatusCount(String crossId);
} }
...@@ -18,6 +18,7 @@ import net.wanji.opt.service.CrossIndexService; ...@@ -18,6 +18,7 @@ import net.wanji.opt.service.CrossIndexService;
import net.wanji.opt.synthesis.pojo.StrategyCrossResultEntity; import net.wanji.opt.synthesis.pojo.StrategyCrossResultEntity;
import net.wanji.opt.vo.AIOptResultVO; import net.wanji.opt.vo.AIOptResultVO;
import net.wanji.opt.vo.CrossOptResult; import net.wanji.opt.vo.CrossOptResult;
import net.wanji.opt.vo.crossStatusCountVO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -138,4 +139,33 @@ public class CrossIndexServiceImpl implements CrossIndexService { ...@@ -138,4 +139,33 @@ public class CrossIndexServiceImpl implements CrossIndexService {
Collections.sort(results, Comparator.comparingInt(AIOptResultVO::getOptStatus)); Collections.sort(results, Comparator.comparingInt(AIOptResultVO::getOptStatus));
return results; return results;
} }
@Override
public crossStatusCountVO crossStatusCount(String crossId) {
LocalDate currentDate = LocalDate.now();
LocalTime startTime = LocalTime.MIDNIGHT;
LocalDateTime startOfDay = LocalDateTime.of(currentDate, startTime);
LambdaQueryWrapper<StrategyCrossResultEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StrategyCrossResultEntity::getCrossId, crossId);
queryWrapper.ge(StrategyCrossResultEntity::getIssueTime, startOfDay);
List<StrategyCrossResultEntity> list = strategyCrossResultMapper.selectList(queryWrapper);
crossStatusCountVO crossStatusCountVO = new crossStatusCountVO();
if (!CollectionUtils.isEmpty(list)) {
Map<Integer, List<StrategyCrossResultEntity>> listMap = list.stream().collect(Collectors.groupingBy(StrategyCrossResultEntity::getCurrentAlgo));
for (Map.Entry<Integer, List<StrategyCrossResultEntity>> entry : listMap.entrySet()) {
Integer currentAlgo = entry.getKey();
List<StrategyCrossResultEntity> value = entry.getValue();
if (Objects.equals(currentAlgo, CrossOptStrategyEnum.ONE.getCode())) {
crossStatusCountVO.setPhaseEmptyCount(value.size());
}
if (Objects.equals(currentAlgo, CrossOptStrategyEnum.TWO.getCode())) {
crossStatusCountVO.setUnbalanceCount(value.size());
}
if (Objects.equals(currentAlgo, CrossOptStrategyEnum.THREE.getCode())) {
crossStatusCountVO.setOverFlowCount(value.size());
}
}
}
return crossStatusCountVO;
}
} }
...@@ -169,7 +169,7 @@ public class RunningEvaluateServiceImpl implements RunningEvaluateService { ...@@ -169,7 +169,7 @@ public class RunningEvaluateServiceImpl implements RunningEvaluateService {
total += ServiceLevelEnum.getByType(key).getVal() * entry1.getValue().size(); total += ServiceLevelEnum.getByType(key).getVal() * entry1.getValue().size();
} }
int avgService = (int) Math.round(total/crossDataHistPOList.size()); int avgService = (int) Math.round(total/crossDataHistPOList.size());
String serviceLevel = ServiceLevelEnum.getByVal(avgService).getType(); String serviceLevel = ServiceLevelEnum.getByVal(avgService)==null?"A":ServiceLevelEnum.getByVal(avgService).getType();
vo.setServiceLevel(serviceLevel); vo.setServiceLevel(serviceLevel);
......
package net.wanji.opt.vo;
import lombok.Data;
/**
* @author duanruiming
* @date 2024/12/11 22:50
*/
@Data
public class crossStatusCountVO {
private int overFlowCount;
private int unbalanceCount;
private int phaseEmptyCount;
private int congestionCount;
}
...@@ -111,6 +111,7 @@ ...@@ -111,6 +111,7 @@
( (
SELECT start_time, SELECT start_time,
(case (case
when #{groupType}=0 then CEIL(UNIX_TIMESTAMP(DATE_ADD(t.start_time,INTERVAL 5 MINUTE)))
when #{groupType}=1 then CEIL(UNIX_TIMESTAMP(DATE_ADD(t.start_time,INTERVAL 5 MINUTE)) / 900) when #{groupType}=1 then CEIL(UNIX_TIMESTAMP(DATE_ADD(t.start_time,INTERVAL 5 MINUTE)) / 900)
when #{groupType}=2 then CEIL(UNIX_TIMESTAMP(DATE_ADD(t.start_time,INTERVAL 5 MINUTE)) / 1800) when #{groupType}=2 then CEIL(UNIX_TIMESTAMP(DATE_ADD(t.start_time,INTERVAL 5 MINUTE)) / 1800)
when #{groupType}=3 then CEIL(UNIX_TIMESTAMP(DATE_ADD(t.start_time,INTERVAL 5 MINUTE)) / 3600) when #{groupType}=3 then CEIL(UNIX_TIMESTAMP(DATE_ADD(t.start_time,INTERVAL 5 MINUTE)) / 3600)
......
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