Commit e872a3e0 authored by zhoushiguang's avatar zhoushiguang

数据计算单独提出模块,避免对接口服务影响

parent 2da4d045
package net.wanji.opt.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.common.annotation.aspect.AspectLog;
import net.wanji.common.enums.BaseEnum;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.bo.CrossIdAndSchemeIdBO;
import net.wanji.databus.bo.CrossIdBO;
import net.wanji.opt.dto.CrossIdAndDirDTO;
import net.wanji.opt.dto.CrossIdAndSchemeIdDTO;
import net.wanji.opt.dto.SaveLaneInfoDTO;
import net.wanji.opt.dto.SendManualDTO;
import net.wanji.opt.dto.strategy.AddOrUpdateSceneDTO;
import net.wanji.opt.service.DiagnoService;
import net.wanji.opt.vo.CrossIdAndLocationVO;
import net.wanji.opt.vo.OptEffectVO;
import net.wanji.opt.vo.SchemeOptVO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import javax.ws.rs.core.MediaType;
import java.util.Date;
import java.util.List;
/**
* 诊断优化
*
* @author Kent HAN
*/
@Api(value = "DiagnoController", description = "诊断优化")
@RequestMapping("/diagno")
@RestController
public class DiagnoController {
private final DiagnoService diagnoService;
public DiagnoController(DiagnoService diagnoService) {
this.diagnoService = diagnoService;
}
@ApiOperation(value = "查询路口当前场景、优化策略、优化方法", notes = "查询路口当前场景、优化策略、优化方法",
response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/queryCrossScene",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AddOrUpdateSceneDTO.class),
})
public JsonViewObject queryCrossScene(@RequestBody CrossIdBO crossIdBO) {
AddOrUpdateSceneDTO addOrUpdateSceneDTO = diagnoService.queryCrossScene(crossIdBO);
return JsonViewObject.newInstance().success(addOrUpdateSceneDTO);
}
@ApiOperation(value = "查询当前路口相邻路口", notes = "查询当前路口相邻路口", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/queryNeighborCross",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossIdAndLocationVO.class),
})
public JsonViewObject queryNeighborCross(@RequestBody CrossIdBO crossIdBO) {
List<CrossIdAndLocationVO> crossIdAndLocationVOList = diagnoService.queryNeighborCross(crossIdBO);
return JsonViewObject.newInstance().success(crossIdAndLocationVOList);
}
@ApiOperation(value = "查询方案优化", notes = "查询方案优化", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/querySchemeOpt",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = SchemeOptVO.class),
})
public JsonViewObject querySchemeOpt(@RequestBody @Valid CrossIdAndSchemeIdBO bo) {
SchemeOptVO schemeOptVO = diagnoService.querySchemeOpt(bo);
return JsonViewObject.newInstance().success(schemeOptVO);
}
@ApiOperation(value = "根据强制方案返回调整时间", notes = "根据强制方案返回调整时间", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/queryOptTime",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = SchemeOptVO.PhaseOptTime.class),
})
public JsonViewObject queryOptTime(@RequestBody CrossIdAndSchemeIdDTO crossIdAndSchemeIdDTO) {
List<SchemeOptVO.PhaseOptTime> phaseOptTimeList = diagnoService.queryOptTime(crossIdAndSchemeIdDTO);
return JsonViewObject.newInstance().success(phaseOptTimeList);
}
@ApiOperation(value = "方案优化对比", notes = "方案优化对比", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/schemeComparison",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = SchemeOptVO.PhaseOptTime.class),
})
public JsonViewObject schemeComparison(@RequestBody CrossIdAndSchemeIdDTO crossIdAndSchemeIdDTO) {
List<SchemeOptVO.PhaseOptTime> phaseOptTimeList = diagnoService.schemeComparison(crossIdAndSchemeIdDTO);
return JsonViewObject.newInstance().success(phaseOptTimeList);
}
@ApiOperation(value = "下发手动干预", notes = "下发手动干预", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/sendManual",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class),
})
public JsonViewObject sendManual(@RequestBody SendManualDTO sendManualDTO) throws Exception {
diagnoService.sendManual(sendManualDTO);
return JsonViewObject.newInstance().success();
}
@ApiOperation(value = "恢复下发", notes = "恢复下发", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/restoreSend",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class),
})
public JsonViewObject restoreSend(@RequestBody CrossIdBO crossIdBO) throws Exception {
diagnoService.restoreSend(crossIdBO);
return JsonViewObject.newInstance().success();
}
@AspectLog(description = "优化效果", operationType = BaseEnum.OperationTypeEnum.QUERY)
@ApiOperation(value = "优化效果", notes = "优化效果", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/optEffect",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = OptEffectVO.class),
})
public JsonViewObject optEffect(@RequestBody CrossIdAndDirDTO crossIdAndDirDTO) {
OptEffectVO optEffectVO = diagnoService.optEffect(crossIdAndDirDTO);
return JsonViewObject.newInstance().success(optEffectVO);
}
@AspectLog(description = "路口信息", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@ApiOperation(value = "路口信息", notes = "路口信息", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/listLaneInfo",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = SaveLaneInfoDTO.class),
})
public JsonViewObject listLaneInfo(@RequestBody @Valid CrossIdBO crossIdBO) {
SaveLaneInfoDTO saveLaneInfoDTO = diagnoService.listLaneInfo(crossIdBO);
return JsonViewObject.newInstance().success(saveLaneInfoDTO);
}
}
\ No newline at end of file
package net.wanji.opt.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.dto.CrossIdAndMinutesDTO;
import net.wanji.opt.service.EvaluateService;
import net.wanji.opt.vo.EvaluateCrossDetailVO;
import net.wanji.opt.vo.EvaluateMetricsVO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.ws.rs.core.MediaType;
/**
* 信号评价
*
* @author Kent HAN
*/
@Api(value = "EvaluateController", description = "信号评价(旧)")
@RequestMapping("/evaluate")
@RestController
public class EvaluateController {
private final EvaluateService evaluateService;
public EvaluateController(EvaluateService evaluateService) {
this.evaluateService = evaluateService;
}
@ApiOperation(value = "路口详情(旧)", notes = "路口详情(旧)", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/evaluateCrossDetail",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = EvaluateCrossDetailVO.class),
})
public JsonViewObject evaluateCrossDetail(@RequestBody CrossIdAndMinutesDTO crossIdAndMinutesDTO) {
EvaluateCrossDetailVO evaluateCrossDetailVO = evaluateService.evaluateCrossDetail(crossIdAndMinutesDTO);
return JsonViewObject.newInstance().success(evaluateCrossDetailVO);
}
@ApiOperation(value = "评价指标(旧)", notes = "评价指标(旧)", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/evaluateMetrics",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = EvaluateMetricsVO.class),
})
public JsonViewObject evaluateMetrics(@RequestBody CrossIdAndMinutesDTO crossIdAndMinutesDTO) {
EvaluateMetricsVO evaluateMetricsVO = evaluateService.evaluateMetrics(crossIdAndMinutesDTO);
return JsonViewObject.newInstance().success(evaluateMetricsVO);
}
}
\ No newline at end of file
package net.wanji.opt.controller;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.exception.DubboProviderException;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.dto.EventInfoTrafficStatusDTO;
import net.wanji.databus.vo.EventInfoTrafficStatusVO;
import net.wanji.opt.entity.EventAlarmInfo;
import net.wanji.opt.po.base.EventStatisticPo;
import net.wanji.opt.service.EventService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
@RestController
@Slf4j
@RequestMapping("/event")
@Api(value="EventController", description="事件相关", tags = "事件相关")
public class EventController {
@Resource
EventService eventService;
@GetMapping("/count")
@ApiOperation(httpMethod="GET",value="事件总次数统计", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口ID", required = true, dataType = "String",defaultValue = "13N8J0B5P10"),
@ApiImplicitParam(name = "eventType", value = "事件类型 701:空放 702:失衡 703:溢出", required = true, dataType = "String",defaultValue = "701"),
@ApiImplicitParam(name = "startTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String",defaultValue = "2025-01-05 00:00:00"),
@ApiImplicitParam(name = "endTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String",defaultValue = "2025-01-05 23:59:59"),
})
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = EventStatisticPo.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
})
public JsonViewObject evaluateCrossDetail(String crossId,String eventType,String startTime,String endTime) {
EventStatisticPo result = null;
try {
result = eventService.findCrossEventCount(crossId,eventType,startTime,endTime );
return JsonViewObject.newInstance().success(result);
} catch (DubboProviderException e) {
e.printStackTrace();
return JsonViewObject.newInstance().fail(e);
}
}
@GetMapping("/distribute")
@ApiOperation(httpMethod="GET",value="空放、失衡、溢出事件分布情况", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口ID", required = true, dataType = "String",defaultValue = "13N8J0B5P10"),
// @ApiImplicitParam(name = "eventType", value = "事件类型 701:空放 702:失衡 703:溢出", required = false, dataType = "String",defaultValue = "701"),
@ApiImplicitParam(name = "startTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String",defaultValue = "2025-01-05 00:00:00"),
@ApiImplicitParam(name = "endTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String",defaultValue = "2025-01-05 23:59:59"),
})
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = EventStatisticPo.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
})
public JsonViewObject distribute(String crossId,String startTime,String endTime) {
try {
List<Map<String,Object>> result = eventService.findEventDistribute(crossId,startTime,endTime );
return JsonViewObject.newInstance().success(result);
} catch (DubboProviderException e) {
e.printStackTrace();
return JsonViewObject.newInstance().fail(e);
}
}
@PostMapping("/trafficStatus")
@ApiOperation(value="路口监测、干线监测-交通状态", notes="")
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = EventStatisticPo.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
})
public JsonViewObject trafficStatus(@RequestBody @Valid EventInfoTrafficStatusDTO eventInfoTrafficStatusDTO) {
try {
EventInfoTrafficStatusVO result = eventService.trafficStatus(eventInfoTrafficStatusDTO );
return JsonViewObject.newInstance().success(result);
} catch (DubboProviderException e) {
e.printStackTrace();
return JsonViewObject.newInstance().fail(e);
}
}
@GetMapping("/getAlarmInfo")
@ApiOperation(hidden = false, value = "实时/历史事件报警获取", notes = "", produces = "application/json")
@ApiImplicitParams({
@ApiImplicitParam(name = "realtimeType", value = "查询类型:1为实时 2为历史", required = false, dataType = "String"),
@ApiImplicitParam(name = "eventType", value = "事件类型,701:空放 702:失衡 703:溢出 705:干线缓行 706:干线拥堵 707:路口拥堵", required = false, dataType = "String"),
@ApiImplicitParam(name = "name", value = "按名称模糊查询", required = false, dataType = "String"),
}
)
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = EventAlarmInfo.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
})
public JsonViewObject list(@RequestParam(defaultValue = "") String realtimeType, @RequestParam(defaultValue = "") String eventType , @RequestParam(defaultValue = "") String name) {
try {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
List<EventAlarmInfo> eventAlarmInfo = eventService.findEventAlarmInfo(realtimeType,eventType,name);
return jsonViewObject.success(eventAlarmInfo);
} catch (Exception e) {
log.error("", e);
return JsonViewObject.newInstance().fail("请求失败");
}
}
@GetMapping("/getCrossCurrentStatus")
@ApiOperation(hidden = false, value = "路口实时状态接口", notes = "", produces = "application/json")
@ApiImplicitParams({
}
)
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = EventAlarmInfo.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
})
public JsonViewObject getCrossNowStatus() {
try {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
List<EventAlarmInfo> eventAlarmInfo = eventService.findNotFinishAlarmInfo();
return jsonViewObject.success(eventAlarmInfo);
} catch (Exception e) {
log.error("", e);
return JsonViewObject.newInstance().fail("请求失败");
}
}
}
\ No newline at end of file
package net.wanji.opt.controller;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.ResponseHeader;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.exception.DubboProviderException;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.AbstractRestServer;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.framework.rest.impl.AbstractRestServerImpl;
import net.wanji.opt.entity.GreenwaveHist;
import net.wanji.opt.po.base.CrossLaneDataHistPoExtend;
import net.wanji.opt.po.trend.GreenwaveCrossTrendPo;
import net.wanji.opt.service.GreenwaveHistProvider;
import net.wanji.opt.vo.GreenWaveRunStateVO;
import net.wanji.opt.vo.GreenwaveCrossMetricsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* <p>
* 绿波历史数据 接口API
* </p>
* @version 1.0
* @author fengyi
* @Date 2024-11-18
*/
@RestController
@Slf4j
@RequestMapping("/greenwave-hist")
@Api(value="GreenwaveHistRestServer", description="绿波历史数据接口", tags = "绿波干线评价")
public class GreenwaveHistRestServer {
@Autowired
private GreenwaveHistProvider greenwaveHistProvider;
@GetMapping("/findGreenWaveRunState")
@ApiOperation(httpMethod="GET",value="绿波干线运行状态查询", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "greenId", value = "绿波ID", 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 = "endTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = false, dataType = "String",defaultValue = "2024-12-04 23:59:59")
})
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = GreenWaveRunStateVO.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
})
public JsonViewObject findGreenWaveRunState(Integer greenId,@RequestParam(defaultValue ="2024-12-04 00:00:00") String startTime,
@RequestParam(defaultValue ="2024-12-04 23:59:59") String endTime,
@RequestParam(defaultValue ="705,706") String eventType) {
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
List<GreenWaveRunStateVO> list = greenwaveHistProvider.findGreenWaveRunState(greenId,null,startTime,endTime,eventType);
jsonView.success(list);
} catch (DubboProviderException e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@GetMapping("/findStatisticIndexTrend")
@ApiOperation(httpMethod="GET",value="绿波历史数据-数据指标统计", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "greenId", value = "绿波ID", required = true, dataType = "String",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 = "endTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = false, dataType = "String",defaultValue = "2024-12-04 23:59:59")
})
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = GreenwaveHist.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
})
public JsonViewObject findStatisticIndex(String greenId,@RequestParam(defaultValue ="2024-11-12 00:00:00") String startTime,
@RequestParam(defaultValue ="2024-11-13 00:00:00") String endTime) {
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
JSONObject list = greenwaveHistProvider.findStatisticIndex(greenId,startTime,endTime,null);
jsonView.success(list);
} catch (DubboProviderException e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@GetMapping("/findGreenCrossInfo")
@ApiOperation(httpMethod="GET",value="绿波干线路口信息查询", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "greenId", value = "绿波ID", required = true, dataType = "String",defaultValue = "1")
})
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = GreenwaveHist.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
})
public JsonViewObject findGreenCrossInfo(Integer greenId) {
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
List<Map<String,Object>> list = greenwaveHistProvider.findGreenCross(greenId);
jsonView.success(list);
} catch (DubboProviderException e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@GetMapping("/findUnCoordinateDirIndex")
@ApiOperation(httpMethod="GET",value="绿波协调方向、非协调方向->指标趋势", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口ID", required = true, dataType = "String",defaultValue = "13MOD0B5SI0"),
@ApiImplicitParam(name = "greenDir", value = "绿波协调方向,多个逗号分隔", required = true, dataType = "String",defaultValue = "5,7"),
@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-04 23:59:59")
})
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = GreenwaveCrossTrendPo.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
})
public JsonViewObject findUnCoordinateDirIndex(String crossId,String greenDir,String startTime,String endTime) {
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
JSONObject list = greenwaveHistProvider.findUnCoordinateCrossIndex(crossId,greenDir,startTime,endTime);
jsonView.success(list);
} catch (DubboProviderException e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@GetMapping("/findGreenWaveCrossDirIndex")
@ApiOperation(httpMethod="GET",value="绿波路口方向级->分粒度指标趋势", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口ID", required = true, dataType = "String",defaultValue = "13MOD0B5SI0"),
@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 = "endTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = false, dataType = "String",defaultValue = "2024-12-04 23:59:59")
})
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = GreenwaveHist.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
})
public JsonViewObject findGreenWaveCrossDirIndex(String crossId, String startTime, String endTime,String groupType) {
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
JSONObject list = greenwaveHistProvider.findGreenWaveCrossDirIndex(crossId,startTime,endTime,groupType);
jsonView.success(list);
} catch (DubboProviderException e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@GetMapping("/findGreenWaveCrossTurnIndex")
@ApiOperation(httpMethod="GET",value="绿波路口转向级->分粒度指标趋势", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口ID", required = true, dataType = "String",defaultValue = "13MOD0B5SI0"),
@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 = "endTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = false, dataType = "String",defaultValue = "2024-12-04 23:59:59")
})
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = GreenwaveHist.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
})
public JsonViewObject findGreenWaveCrossTurnIndex(String crossId, String startTime, String endTime,String groupType) {
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
JSONObject list = greenwaveHistProvider.findGreenWaveCrossTurnIndex(crossId,startTime,endTime,groupType);
jsonView.success(list);
} catch (DubboProviderException e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@GetMapping("/findGreenWaveCrossIndex")
@ApiOperation(httpMethod="GET",value="绿波路口级->分粒度指标趋势", notes="")
@ApiImplicitParams({
@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 = "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-04 23:59:59")
})
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = GreenwaveHist.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
})
public JsonViewObject findGreenWaveCrossIndex(String crossId, String startTime, String endTime,String groupType) {
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
JSONObject list = greenwaveHistProvider.findGreenWaveCrossIndex(crossId,startTime,endTime,groupType);
jsonView.success(list);
} catch (DubboProviderException e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@GetMapping("/findCrossObjectIndex")
@ApiOperation(httpMethod="GET",value="路口进口【方向级、转向级、车道级】->分粒度指标趋势", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口ID", required = true, dataType = "String",defaultValue = "13O1V0B5SB0"),
@ApiImplicitParam(name = "groupType", value = "时间粒度类型 0:5分钟粒度 1:15分钟粒度 2:30分钟粒度 3:小时粒度 4:天粒度 5:按时间范围直接做平均【不分粒度】", required = true, dataType = "Integer",defaultValue = "1"),
@ApiImplicitParam(name = "startTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String",defaultValue = "2025-01-13 00:00:00"),
@ApiImplicitParam(name = "endTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String",defaultValue = "2025-01-13 23:59:59"),
@ApiImplicitParam(name = "objectType", value = "统计对象类型 1:方向级指标 2:转向级指标 3:车道级指标 4:路口级指标", required = true, dataType = "Integer",defaultValue = "1"),
@ApiImplicitParam(name = "directionName", value = "方向", required = false, dataType = "Integer",defaultValue = "北进口"),
})
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = CrossLaneDataHistPoExtend.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
})
public JsonViewObject findGreenWaveCrossObjectIndex(String crossId, String startTime, String endTime,String groupType,Integer objectType,@RequestParam(defaultValue = "") String directionName) {
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
JSONObject list = null;
if (Objects.equals("5",groupType)) {
list = greenwaveHistProvider.findCrossAvgIndex(crossId,startTime,endTime,groupType,objectType);
}else {
list = greenwaveHistProvider.findCrossObjectIndex(crossId,startTime,endTime,groupType,objectType,directionName);
}
jsonView.success(list);
} catch (DubboProviderException e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@GetMapping("/findCrossExitRoadIndex")
@ApiOperation(httpMethod="GET",value="路口出口道【方向级/车道级】分粒度指标趋势", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口ID", required = true, dataType = "String",defaultValue = "13MOD0B5SI0"),
@ApiImplicitParam(name = "groupType", value = "时间粒度类型 0:5分钟粒度 1:15分钟粒度 2:30分钟粒度 3:小时粒度 4:天粒度", required = true, dataType = "Integer",defaultValue = "1"),
@ApiImplicitParam(name = "startTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String",defaultValue = "2024-12-04 00:00:00"),
@ApiImplicitParam(name = "endTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String",defaultValue = "2024-12-04 23:59:59"),
@ApiImplicitParam(name = "objectType", value = "统计对象类型 1:出口道方向级指标 2:出口道车道级指标", required = true, dataType = "Integer",defaultValue = "1"),
})
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = CrossLaneDataHistPoExtend.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
})
public JsonViewObject findCrossExitRoadIndex(String crossId, String startTime, String endTime,String groupType,Integer objectType) {
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
JSONObject list = greenwaveHistProvider.findCrossExitRoadDirInfo(crossId,startTime,endTime,groupType,objectType);
jsonView.success(list);
} catch (DubboProviderException e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
}
package net.wanji.opt.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.common.annotation.aspect.AspectLog;
import net.wanji.common.enums.BaseEnum;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.bo.GreenwaveStartEndDateBO;
import net.wanji.opt.bo.*;
import net.wanji.opt.service.impl.MainlineEvaluateServiceImpl;
import net.wanji.opt.vo.*;
import org.springframework.web.bind.annotation.*;
import javax.ws.rs.core.MediaType;
import java.util.List;
@Api(value = "MainlineEvaluateController", description = "干线评价")
@RequestMapping("/mainlineEvaluate")
@RestController
public class MainlineEvaluateController {
private final MainlineEvaluateServiceImpl mainlineEvaluateService;
public MainlineEvaluateController(MainlineEvaluateServiceImpl mainlineEvaluateService) {
this.mainlineEvaluateService = mainlineEvaluateService;
}
@ApiOperation(value = "底部曲线图范围下拉列表", notes = "底部曲线图范围下拉列表", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/bottomMenu",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class),
})
public JsonViewObject bottomMenu(@RequestBody BottomMenuBO bo) {
List<String> res = mainlineEvaluateService.bottomMenu(bo);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "底部曲线图", notes = "底部曲线图", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/bottomCurve",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = MainlineEvaluateBottomCurveVO.class),
})
public JsonViewObject bottomCurve(@RequestBody BottomCurveBO bo) throws Exception {
synchronized (this) {
try {
List<MainlineEvaluateBottomCurveVO> res = mainlineEvaluateService.bottomCurve(bo);
return JsonViewObject.newInstance().success(res);
} catch (Exception e) {
return JsonViewObject.newInstance().fail(e.getMessage());
}
}
}
@AspectLog(description = "干线列表", operationType = BaseEnum.OperationTypeEnum.QUERY)
@ApiOperation(value = "干线列表", notes = "干线列表")
@GetMapping("/mainlineList")
public JsonViewObject mainlineList() {
List<MainlineListVO> res = mainlineEvaluateService.mainlineList();
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "干线方案分析", notes = "干线方案分析", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/mainlineSchemeAnalysis",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = MainlineSchemeAnalysisVO.class),
})
public JsonViewObject mainlineSchemeAnalysis(@RequestBody MainlineSchemeAnalysisBO bo) throws Exception {
MainlineSchemeAnalysisVO res = mainlineEvaluateService.mainlineSchemeAnalysis(bo);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "干线方案评价", notes = "干线方案评价", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/mainlineSchemeEvaluate",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = MainlineSchemeEvaluateVO.class),
})
public JsonViewObject mainlineSchemeEvaluate(@RequestBody MainlineSchemeEvaluateBO bo) {
MainlineSchemeEvaluateVO res = mainlineEvaluateService.mainlineSchemeEvaluate(bo);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "干线路口评价", notes = "干线路口评价", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/mainlineCrossEvaluate",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = MainlineCrossEvaluateVO.class),
})
public JsonViewObject mainlineCrossEvaluate(@RequestBody MainlineCrossEvaluateBO bo) {
List<MainlineCrossEvaluateVO> res = mainlineEvaluateService.mainlineCrossEvaluate(bo);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "干线运行分析", notes = "干线运行分析", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/mainlineRunningAnalyse",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = MainlineRunningAnalyseVO.class),
})
public JsonViewObject mainlineRunningAnalyse(@RequestBody GreenwaveStartEndDateBO bo) {
List<MainlineRunningAnalyseVO> res = mainlineEvaluateService.mainlineRunningAnalyse(bo);
return JsonViewObject.newInstance().success(res);
}
}
\ No newline at end of file
package net.wanji.opt.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.common.framework.exception.DubboProviderException;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.bo.CrossIdAndStartEndDateBO;
import net.wanji.databus.bo.CrossIdBO;
import net.wanji.databus.bo.HeatMapBO;
import net.wanji.databus.vo.RunningEvaluateCrossListVO;
import net.wanji.opt.bo.CrossNameBO;
import net.wanji.opt.bo.MetricsDetailBO;
import net.wanji.opt.service.impl.RunningEvaluateServiceImpl;
import net.wanji.opt.vo.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.ws.rs.core.MediaType;
import java.util.List;
/**
* 运行评价
*
* @author Kent HAN
*/
@Api(value = "RunningEvaluateController", description = "运行评价")
@RequestMapping("/runningEvaluate")
@RestController
public class RunningEvaluateController {
private final RunningEvaluateServiceImpl runningEvaluateService;
public RunningEvaluateController(RunningEvaluateServiceImpl runningEvaluateService) {
this.runningEvaluateService = runningEvaluateService;
}
@ApiOperation(value = "路口列表", notes = "路口列表", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/crossList",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = RunningEvaluateCrossListVO.class),
})
public JsonViewObject crossList(@RequestBody CrossNameBO crossNameBO) {
List<RunningEvaluateCrossListVO> res = runningEvaluateService.crossList(crossNameBO);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "信号评价-路口评价", notes = "路口评价", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/crossEvaluate",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = RunningEvaluateCrossEvaluateVO.class),
})
public JsonViewObject crossEvaluate(@RequestBody CrossIdAndStartEndDateBO bo) {
RunningEvaluateCrossEvaluateVO res = null;
try {
res = runningEvaluateService.crossEvaluate(bo);
} catch (DubboProviderException e) {
e.printStackTrace();
}
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "拥堵情况", notes = "拥堵情况", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/congestionStatus",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = RunningEvaluateStatusVO.class),
})
public JsonViewObject congestionStatus(@RequestBody CrossIdAndStartEndDateBO bo) {
RunningEvaluateStatusVO res = runningEvaluateService.congestionStatus(bo);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "失衡情况", notes = "失衡情况", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/unbalanceStatus",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = RunningEvaluateStatusVO.class),
})
public JsonViewObject unbalanceStatus(@RequestBody CrossIdAndStartEndDateBO bo) {
RunningEvaluateStatusVO res = runningEvaluateService.unbalanceStatus(bo);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "溢出情况", notes = "溢出情况", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/spilloverStatus",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = RunningEvaluateStatusVO.class),
})
public JsonViewObject spilloverStatus(@RequestBody CrossIdAndStartEndDateBO bo) {
RunningEvaluateStatusVO res = runningEvaluateService.spilloverStatus(bo);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "方案问题", notes = "方案问题", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/schemeProblems",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = RunningEvaluateSchemeProblemsVO.class),
})
public JsonViewObject schemeProblems(@RequestBody CrossIdAndStartEndDateBO bo) {
List<RunningEvaluateSchemeProblemsVO> res = runningEvaluateService.schemeProblems(bo);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "详细指标查询-范围下拉列表", notes = "详细指标查询-范围下拉列表", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/scopeTree",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = RunningEvaluateScopeTreeVO.class),
})
public JsonViewObject scopeTree(@RequestBody CrossIdBO bo) {
RunningEvaluateScopeTreeVO res = runningEvaluateService.scopeTree(bo);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "详细指标查询", notes = "详细指标查询", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/metricsDetail",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = RunningEvaluateMetricsDetailVO.class),
})
public JsonViewObject schemeProblems(@RequestBody MetricsDetailBO bo) {
RunningEvaluateMetricsDetailVO res = runningEvaluateService.metricsDetail(bo);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "运行评价热力图", notes = "运行评价热力图", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/heatMap",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = RunningEvaluateHeatMapVO.class),
})
public JsonViewObject heatMap(@RequestBody HeatMapBO bo) {
List<RunningEvaluateHeatMapVO> res = runningEvaluateService.heatMap(bo);
return JsonViewObject.newInstance().success(res);
}
}
\ No newline at end of file
package net.wanji.opt.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.bo.CrossIdAndStartEndDateBO;
import net.wanji.databus.bo.HeatMapBO;
import net.wanji.opt.bo.AbnormalDetailBO;
import net.wanji.opt.bo.MetricsTurnAndLaneBO;
import net.wanji.opt.bo.SceneMetricsDetailBO;
import net.wanji.opt.service.impl.SceneEvaluateServiceImpl;
import net.wanji.opt.vo.*;
import net.wanji.opt.vo.SceneMetricsDetailVO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.ws.rs.core.MediaType;
import java.lang.reflect.InvocationTargetException;
import java.text.ParseException;
import java.util.List;
/**
* 场景评价
*
* @author Kent HAN
*/
@Api(value = "SceneEvaluateController", description = "场景评价")
@RequestMapping("/sceneEvaluate")
@RestController
public class SceneEvaluateController {
private final SceneEvaluateServiceImpl sceneEvaluateService;
public SceneEvaluateController(SceneEvaluateServiceImpl sceneEvaluateService) {
this.sceneEvaluateService = sceneEvaluateService;
}
@ApiOperation(value = "异常事件时空分布", notes = "异常事件时空分布", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/abnormalDistribute",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = SceneEvaluateAbnormalDistributeVO.class),
})
public JsonViewObject abnormalDistribute(@RequestBody CrossIdAndStartEndDateBO bo) {
SceneEvaluateAbnormalDistributeVO res = sceneEvaluateService.abnormalDistribute(bo);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "异常事件详情", notes = "异常事件详情", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/abnormalDetail",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = SceneEvaluateAbnormalDetailVO.class),
})
public JsonViewObject abnormalDetail(@RequestBody AbnormalDetailBO abnormalDetailBO) throws ParseException {
SceneEvaluateAbnormalDetailVO res = sceneEvaluateService.abnormalDetail(abnormalDetailBO);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "曲线图", notes = "曲线图", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/metricsDetail",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = SceneMetricsDetailVO.class),
})
public JsonViewObject schemeProblems(@RequestBody SceneMetricsDetailBO bo)
throws InvocationTargetException, NoSuchMethodException, IllegalAccessException {
List<SceneMetricsDetailVO> res = sceneEvaluateService.metricsDetail(bo);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "转向级指标", notes = "转向级指标", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/metricsTurn",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = SceneEvaluateMetricsTurnVO.class),
})
public JsonViewObject metricsTurn(@RequestBody MetricsTurnAndLaneBO bo) throws ParseException {
SceneEvaluateMetricsTurnVO res = sceneEvaluateService.metricsTurn(bo);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "车道级指标", notes = "车道级指标", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/metricsLane",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = SceneEvaluateMetricsLaneVO.class),
})
public JsonViewObject metricsLane(@RequestBody MetricsTurnAndLaneBO bo) throws ParseException {
SceneEvaluateMetricsLaneVO res = sceneEvaluateService.metricsLane(bo);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "场景评价热力图", notes = "场景评价热力图", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/heatMap",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = SceneEvaluateHeatMapVO.class),
})
public JsonViewObject heatMap(@RequestBody HeatMapBO bo) {
List<SceneEvaluateHeatMapVO> res = sceneEvaluateService.heatMap(bo);
return JsonViewObject.newInstance().success(res);
}
}
\ No newline at end of file
package net.wanji.opt.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.bo.CrossIdBO;
import net.wanji.opt.bo.CrossSchemeListBO;
import net.wanji.opt.bo.CurveChartBO;
import net.wanji.opt.bo.ProblemSchemeBO;
import net.wanji.opt.bo.SchemeDetailOverallBO;
import net.wanji.opt.service.impl.SchemeEvaluateServiceImpl;
import net.wanji.opt.vo.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.ws.rs.core.MediaType;
import java.text.ParseException;
import java.util.List;
/**
* 方案评价
*
* @author Kent HAN
*/
@Api(value = "SchemeEvaluateController", description = "方案评价")
@RequestMapping("/schemeEvaluate")
@RestController
public class SchemeEvaluateController {
private final SchemeEvaluateServiceImpl schemeEvaluateService;
public SchemeEvaluateController(SchemeEvaluateServiceImpl schemeEvaluateService) {
this.schemeEvaluateService = schemeEvaluateService;
}
@ApiOperation(value = "问题方案列表", notes = "问题方案列表", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/problemSchemeList",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = SchemeEvaluateProblemSchemeVO.class),
})
public JsonViewObject problemSchemeList(@RequestBody ProblemSchemeBO problemSchemeBO) {
SchemeEvaluateProblemSchemeVO res = schemeEvaluateService.problemSchemeList(problemSchemeBO);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "策略-评价指标下拉菜单", notes = "策略-评价指标下拉菜单", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/strategyMetricMenu",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = SchemeEvaluateStrategyMetricMenuVO.class),
})
public JsonViewObject strategyMetricMenu(@RequestBody CrossIdBO crossIdBO) {
List<SchemeEvaluateStrategyMetricMenuVO> res = schemeEvaluateService.strategyMetricMenu(crossIdBO);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "路口方案列表", notes = "路口方案列表", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/crossSchemeList",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = SchemeEvaluateCrossSchemeListVO.class),
})
public JsonViewObject crossSchemeList(@RequestBody CrossSchemeListBO crossSchemeListBO) {
List<SchemeEvaluateCrossSchemeListVO> res = schemeEvaluateService.crossSchemeList(crossSchemeListBO);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "方案详情-总体评价", notes = "方案详情-总体评价", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/schemeDetailOverall",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = SchemeEvaluateSchemeDetailOverallVO.class),
})
public JsonViewObject schemeDetailOverall(@RequestBody SchemeDetailOverallBO schemeDetailOverallBO)
throws Exception {
SchemeEvaluateSchemeDetailOverallVO res = schemeEvaluateService.schemeDetailOverall(schemeDetailOverallBO);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "方案详情-详细问题", notes = "方案详情-详细问题", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/detailedProblem",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = SchemeEvaluateSchemeDetailedProblemVO.class),
})
public JsonViewObject detailedProblem(@RequestBody SchemeDetailOverallBO schemeDetailOverallBO)
throws ParseException {
SchemeEvaluateSchemeDetailedProblemVO res = schemeEvaluateService.detailedProblem(schemeDetailOverallBO);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "方案详情-曲线图", notes = "方案详情-曲线图", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/curveChart",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = SchemeEvaluateCurveChartVO.class),
})
public JsonViewObject curveChart(@RequestBody CurveChartBO curveChartBO)
throws ParseException, NoSuchFieldException, IllegalAccessException {
List<SchemeEvaluateCurveChartVO> res = schemeEvaluateService.curveChart(curveChartBO);
return JsonViewObject.newInstance().success(res);
}
}
\ No newline at end of file
package net.wanji.opt.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.bo.CrossIdBO;
import net.wanji.databus.vo.GreenwaveListVO;
import net.wanji.opt.bo.*;
import net.wanji.opt.dto.trend.AbnormalCrossListDTO;
import net.wanji.opt.dto.trend.EventAlarmDTO;
import net.wanji.opt.dto.trend.GreenwaveListDTO;
import net.wanji.opt.po.trend.AnalysisRidTurnIndicators;
import net.wanji.opt.po.trend.HoloEventInfoPO;
import net.wanji.opt.service.impl.TrendServiceImpl;
import net.wanji.opt.vo.*;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.core.MediaType;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 态势监测
*
* @author Kent HAN
*/
@Api(value = "TrendController", description = "态势监测")
@RequestMapping("/trend")
@RestController
public class TrendController {
private final TrendServiceImpl trendService;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public TrendController(TrendServiceImpl trendService) {
this.trendService = trendService;
}
@ApiOperation(value = "子区信息-路口监测", notes = "子区信息-路口监测", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/greenwaveCrossMonitor",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenWaveCrossMonitorVO.class),
})
public JsonViewObject greenwaveCrossMonitor(@RequestBody GreenwaveIdBO greenwaveIdBO) {
List<GreenWaveCrossMonitorVO> res = trendService.greenwaveCrossMonitor(greenwaveIdBO);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "子区信息-运行监测", notes = "子区信息-运行监测", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/greenwaveRunMonitor",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenwaveRunMonitorVO.class),
})
public JsonViewObject greenwaveRunMonitor(@RequestBody GreenwaveIdBO greenwaveIdBO) {
List<GreenwaveRunMonitorVO> res = trendService.greenwaveRunMonitor(greenwaveIdBO);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "干线方案详情", notes = "干线方案详情", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/greenwaveDetail",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenwaveDetailVO.class),
})
public JsonViewObject greenwaveDetail(@RequestBody GreenwaveDetailBO bo) throws Exception {
GreenwaveDetailVO res = trendService.greenwaveDetail(bo);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "干线当前详情", notes = "干线当前详情", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/currentGreenwaveDetail",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenwaveDetailVO.class),
})
public JsonViewObject currentGreenwaveDetail(@RequestBody GreenwaveIdBO bo) throws Exception {
GreenwaveDetailVO res = trendService.currentGreenwaveDetail(bo);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "保存子区策略", notes = "保存子区策略", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/saveGreenwaveStrategy",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class),
})
public JsonViewObject saveGreenwaveStrategy(@RequestBody SaveGreenwaveStrategyBO saveGreenwaveStrategyBO) {
trendService.saveGreenwaveStrategy(saveGreenwaveStrategyBO);
return JsonViewObject.newInstance().success();
}
@ApiOperation(value = "子区路口指标", notes = "子区路口指标", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/greenwaveCrossMetrics",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenwaveCrossMetricsVO.class),
})
public JsonViewObject greenwaveCrossMetrics(@RequestBody GreenwaveIdAndTimeStampBO greenwaveIdAndTimeStampBO) throws Exception {
List<GreenwaveCrossMetricsVO> res = trendService.greenwaveCrossMetrics(greenwaveIdAndTimeStampBO);
return JsonViewObject.newInstance().success(res);
}
@ApiOperation(value = "问题子区干线列表", notes = "交通体检-干线列表", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/greenwaveList",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenwaveVO.class),
})
public JsonViewObject greenwaveList(@RequestBody GreenwaveListDTO greenwaveListDTO) {
GreenwaveVO greenwaveVO = new GreenwaveVO();
List<GreenwaveListVO> greenwaveListVOList = trendService.greenwaveList(greenwaveListDTO);
greenwaveVO.setGreenwaveList(greenwaveListVOList);
// 绿波统计信息
GreenwaveListDTO forStats = new GreenwaveListDTO();
List<GreenwaveListVO> greenwaveListForStats = trendService.greenwaveList(forStats);
GreenwaveStats greenwaveStats = trendService.buildGreenwaveStats(greenwaveListForStats);
greenwaveVO.setGreenwaveStats(greenwaveStats);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(greenwaveVO);
}
@ApiOperation(value = "问题路口列表", notes = "问题路口列表", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/abnormalCrossList",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AbnormalCrossVO.class),
})
public JsonViewObject abnormalCrossList(@RequestBody AbnormalCrossListDTO abnormalCrossListDTO) {
AbnormalCrossVO abnormalCrossVO = trendService.abnormalCrossList(abnormalCrossListDTO);
return JsonViewObject.newInstance().success(abnormalCrossVO);
}
@ApiOperation(value = "问题路口详情", notes = "问题路口详情", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/abnormalCrossDetail",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AbnormalCrossDetailVO.class),
})
public JsonViewObject abnormalCrossDetail(@RequestBody CrossIdBO crossIdBO) {
AbnormalCrossDetailVO abnormalCrossDetailVO = trendService.abnormalCrossDetail(crossIdBO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(abnormalCrossDetailVO);
}
@ApiOperation(value = "事件告警", notes = "事件告警", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/eventAlarm",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject eventAlarm(@RequestBody EventAlarmDTO eventAlarmDTO) throws ParseException {
String currentTimeStr = eventAlarmDTO.getCurrentTime();
Date todayTime = sdf.parse(currentTimeStr);
List<EventAlarmVO> eventAlarmVOList = trendService.eventAlarm(todayTime);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(eventAlarmVOList);
}
@ApiOperation(value = "数量实时推送", notes = "数量实时推送", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/countRealTime",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CountRealTimeVO.class),
})
public JsonViewObject countRealTime(@RequestBody CrossIdBO crossIdBO) throws Exception {
String crossId = crossIdBO.getCrossId();
CountRealTimeVO countRealTimeVO = trendService.countRealTime(crossId);
return JsonViewObject.newInstance().success(countRealTimeVO);
}
@ApiOperation(value = "表格分时段查询", notes = "表格分时段查询", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/tableQuery",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = TableQueryVO.class),
})
public JsonViewObject tableQuery(@RequestBody CrossIdAndTimeSpanBO crossIdAndTimeSpanBO) throws Exception {
TableQueryVO tableQueryVO = trendService.tableQuery(crossIdAndTimeSpanBO);
return JsonViewObject.newInstance().success(tableQueryVO);
}
@ApiOperation(value = "表格实时推送", notes = "表格实时推送", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/tableRealTime",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = TableQueryVO.class),
})
public JsonViewObject tableRealTime(@RequestBody CrossIdAndIsFirstBO crossIdAndIsFirstBO) throws Exception {
TableQueryVO tableRealTimeVO = trendService.tableRealTime(crossIdAndIsFirstBO);
return JsonViewObject.newInstance().success(tableRealTimeVO);
}
@ApiOperation(value = "优化类型", notes = "优化类型", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/optType",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = OptTypeVO.class),
})
public JsonViewObject optType(@RequestBody CrossIdBO crossIdBO) {
OptTypeVO optTypeVO = trendService.optType(crossIdBO);
return JsonViewObject.newInstance().success(optTypeVO);
}
@ApiOperation(value = "重点路口监测", notes = "重点路口监测", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/hotspotCross",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = HotspotCrossVO.class),
})
public JsonViewObject hotspotCross(@RequestBody CommonCrossIdVO commonCrossIdVO) throws Exception {
List<HotspotCrossVO> hotspotCrossVOS = trendService.hotspotCross(commonCrossIdVO);
return JsonViewObject.newInstance().success(hotspotCrossVOS);
}
@ApiOperation(value = "路口转向数据", notes = "路口转向数据", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/crossTurnData",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = HotspotCrossTurnVO.class),
})
public JsonViewObject crossTurnData(@RequestBody CommonCrossIdVO commonCrossIdVO) throws Exception {
List<HotspotCrossTurnVO> hotspotCrossVOS = trendService.crossTurnData(commonCrossIdVO);
return JsonViewObject.newInstance().success(hotspotCrossVOS);
}
@ApiOperation(value = "路口车道数据", notes = "路口车道数据", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/crossLaneData",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = HotspotCrossLaneVO.class),
})
public JsonViewObject crossLaneData(@RequestBody CommonCrossIdVO commonCrossIdVO) throws Exception {
List<HotspotCrossLaneVO> hotspotCrossVOS = trendService.crossLaneData(commonCrossIdVO);
return JsonViewObject.newInstance().success(hotspotCrossVOS);
}
@ApiOperation(value = "前五交通流量", notes = "前五交通流量", response = Top5IndexVO.class)
@GetMapping(value = "/top5Flow")
public JsonViewObject top5Flow() throws Exception {
List<Top5IndexVO> results = trendService.top5Flow();
return JsonViewObject.newInstance().success(results);
}
@ApiOperation(value = "路口交通状态", notes = "路口交通状态时长比例", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/crossStatusTimeRate",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossStatusTimeRateVO.class),
})
public JsonViewObject crossStatusTimeRate(@RequestBody CommonCrossIdVO commonCrossIdVO) throws Exception {
CrossStatusTimeRateVO crossStatusTimeRateVO = trendService.crossStatusTimeRate(commonCrossIdVO);
return JsonViewObject.newInstance().success(crossStatusTimeRateVO);
}
@ApiOperation(value = "干线交通状态", notes = "干线交通状态", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/greenStatusTimeRate")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossStatusTimeRateVO.class),
})
public JsonViewObject greenStatusTimeRate(Integer greenId) throws Exception {
GreenStatusTimeRateVO crossStatusTimeRateVO = trendService.greenStatusTimeRate(greenId);
return JsonViewObject.newInstance().success(crossStatusTimeRateVO);
}
@ApiOperation(value = "车道交通指标", notes = "车道交通指标", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/laneTrafficIndex",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = TableQueryVO.CycleDataElement.class),
})
public JsonViewObject laneTrafficIndex(@RequestBody CommonCrossIdDateTimeVO crossIdDateTimeVO) throws Exception {
List<TableQueryVO.CycleDataElement> result = trendService.laneTrafficIndex(crossIdDateTimeVO);
return JsonViewObject.newInstance().success(result);
}
@ApiOperation(value = "车道快照指标", notes = "车道快照指标", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/laneSnapshotIndex",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = TableQueryVO.RealTimeDataElement.class),
})
public JsonViewObject laneSnapshotIndex(@RequestBody LaneSnapshotIndexVO laneSnapshotIndexVO) throws Exception {
List<TableQueryVO.RealTimeDataElement> result = trendService.laneSnapshotIndex(laneSnapshotIndexVO);
return JsonViewObject.newInstance().success(result);
}
@ApiOperation(value = "溢出事件", notes = "溢出事件", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/overFlowEvent",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = TableQueryVO.RealTimeDataElement.class),
})
public JsonViewObject overFlowEvent(@RequestBody LaneSnapshotIndexVO laneSnapshotIndexVO) throws Exception {
List<OverflowEvent> result = trendService.overFlowEvent(laneSnapshotIndexVO);
return JsonViewObject.newInstance().success(result);
}
@ApiOperation(value = "车道周期转向数据", notes = "车道周期转向数据", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/lanePeriodTurnData",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AnalysisRidTurnIndicators.class),
})
public JsonViewObject lanePeriodTurnData(@RequestBody LanePeriodTurnVO lanePeriodTurnVO) throws Exception {
List<AnalysisRidTurnIndicators> result = trendService.lanePeriodTurnData(lanePeriodTurnVO);
return JsonViewObject.newInstance().success(result);
}
@ApiOperation(value = "事件查询列表", notes = "事件查询列表", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/holoEventList",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = HoloEventInfoPO.class),
})
public JsonViewObject holoEvenList(@RequestBody HoloEventVO holoEventVO) throws Exception {
List<HoloEventInfoPO> result = trendService.holoEvenList(holoEventVO);
return JsonViewObject.newInstance().success(result);
}
@ApiOperation(value = "车道查询列表", notes = "车道查询列表", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/laneIdList",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = LaneIdAliasNameVO.class),
})
public JsonViewObject laneIdList(@RequestBody CommonCrossIdVO commonCrossIdVO) throws Exception {
List<LaneIdAliasNameVO> result = trendService.laneIdList(commonCrossIdVO);
return JsonViewObject.newInstance().success(result);
}
@ApiOperation(value = "周期导出功能", notes = "周期导出功能")
@PostMapping(value = "/periodExcel")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = HttpServletResponse.class),
})
public void periodExcel(@RequestBody CommonCrossIdDateTimeVO crossIdDateTimeVO, HttpServletResponse response) throws Exception {
trendService.periodExcel(crossIdDateTimeVO, response);
}
@ApiOperation(value = "周期转向数据导出功能", notes = "周期转向数据导出功能")
@PostMapping(value = "/periodTurnExcel")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = HttpServletResponse.class),
})
public void periodTurnExcel(@RequestBody LanePeriodTurnVO lanePeriodTurnVO, HttpServletResponse response) throws Exception {
trendService.periodTurnExcel(lanePeriodTurnVO, response);
}
@ApiOperation(value = "车道快照数据导出功能", notes = "车道快照数据导出功能")
@PostMapping(value = "/laneSnapshotExcel")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = HttpServletResponse.class),
})
public void laneSnapshotExcel(@RequestBody LaneSnapshotIndexVO laneSnapshotIndexVO, HttpServletResponse response) throws Exception {
trendService.laneSnapshotExcel(laneSnapshotIndexVO, response);
}
}
\ No newline at end of file
package net.wanji.opt.controller.induce;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.kotlin.KtQueryWrapper;
import com.google.common.collect.Maps;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.Constants;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.framework.rest.Page;
import net.wanji.common.framework.rest.ValidationGroups;
import net.wanji.common.utils.tool.DateUtil;
import net.wanji.common.utils.tool.StringUtils;
import net.wanji.databus.dao.entity.GreenwaveInfoPO;
import net.wanji.databus.dao.mapper.GreenwaveInfoMapper;
import net.wanji.opt.dao.mapper.induce.GreenwaveInducesMapper;
import net.wanji.opt.dto.induce.GreenwaveDTO;
import net.wanji.opt.dto.induce.GreenwaveInducesDTO;
import net.wanji.opt.dto.induce.InduceDTO;
import net.wanji.opt.entity.DeviceInduces;
import net.wanji.opt.entity.GreenwaveInduces;
import net.wanji.opt.entity.InduceHist;
import net.wanji.opt.entity.InduceTemplate;
import net.wanji.opt.service.DeviceInducesService;
import net.wanji.opt.service.induce.GreenwaveInducesHistService;
import net.wanji.opt.service.induce.GreenwaveInducesService;
import net.wanji.opt.service.induce.InduceHistService;
import net.wanji.opt.service.induce.InduceTemplateService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.lucene.search.similarities.Lambda;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.constraints.NotBlank;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* <p>
* 绿波-诱导屏幕关系
* </p>
*
* @author guoliang.dong
* @since 2024-11-22
*/
@Api(value = "GreenwaveInducesController", description = "绿波-诱导屏幕关系")
@RestController
@RequestMapping("/greenwaveInduces")
@Slf4j
public class GreenwaveInducesController {
@Resource
private GreenwaveInducesService greenwaveInducesService;
@Resource
private GreenwaveInducesMapper greenwaveInducesMapper;
// @Resource
// private InduceTemplateService induceTemplateService;
@Resource
private DeviceInducesService deviceInducesService;
@Resource
private GreenwaveInfoMapper greenwaveInfoMapper;
@Resource
private GreenwaveInducesHistService greenwaveInducesHistService;
@Resource
private InduceHistService induceHistService;
/**
* 获取所有记录
*
* @return JsonViewObject
*/
@ApiOperation(value = "获取所有记录", notes = "获取所有记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON)
@GetMapping(value = "/byAll", produces = MediaType.APPLICATION_JSON)
JsonViewObject getAll() {
JsonViewObject jsonView = JsonViewObject.newInstance();
long start = System.currentTimeMillis();
try {
// List<GreenwaveInduces> list = this.greenwaveInducesService.list();
// List<InduceTemplate> induceTemplateList = induceTemplateService.list();
List<DeviceInduces> deviceInducesList = deviceInducesService.list();
List<GreenwaveInfoPO> greenwaveInfoPOList = greenwaveInfoMapper.selectAll();
List<InduceDTO> list = new ArrayList<>();
this.greenwaveInducesService.list().stream().forEach(o -> {
InduceDTO induceDTO = new InduceDTO();
induceDTO.setId(o.getId());
induceDTO.setEquipCode(o.getEquipCode());
//获取关联设备信息
List<DeviceInduces> deviceInduces = deviceInducesList.stream().filter(x -> Objects.nonNull(x.getEquipCode()) && x.getEquipCode().equals(o.getEquipCode())).collect(Collectors.toList());// 过滤条件// 收集结果
if (Objects.nonNull(deviceInduces) && deviceInduces.size() > 0) {
induceDTO.setEquipName(deviceInduces.get(0).getEquipName());
induceDTO.setRidDir(o.getDir());
induceDTO.setResolutionWidth(deviceInduces.get(0).getResolutionWidth());
induceDTO.setResolutionHeight(deviceInduces.get(0).getResolutionHeight());
induceDTO.setWkt(deviceInduces.get(0).getWkt());
}
//获取上屏状态
induceDTO.setStatus(o.getStatus());
//获取关联绿波信息
List<GreenwaveDTO> greenwaveList = new ArrayList<>();
this.greenwaveInducesHistService.list().stream().filter(y ->Objects.nonNull(y.getGreenId()) && y.getGreenId().equals(o.getGreenId())).forEach(m -> {
GreenwaveDTO greenwaveDTO = new GreenwaveDTO();
greenwaveDTO.setGreenId(m.getGreenId());
//获取绿波基本信息
List<GreenwaveInfoPO> greenwaveInfoByGreenId = greenwaveInfoPOList.stream().filter(n -> n.getId().equals(o.getGreenId())).collect(Collectors.toList());// 过滤条件// 收集结果
if (Objects.nonNull(greenwaveInfoByGreenId) && greenwaveInfoByGreenId.size() > 0) {
greenwaveDTO.setGreenName(greenwaveInfoByGreenId.get(0).getName());
greenwaveDTO.setDesignSpeed(greenwaveInfoByGreenId.get(0).getDesignSpeed());
}
greenwaveDTO.setStrategyId(m.getStrategyId());
greenwaveDTO.setStrategyName(m.getStrategyName());
greenwaveDTO.setDir(m.getDir());
if(Objects.nonNull(m.getControlOptTimes()) && m.getControlOptTimes().split("\\|").length>0) {
try {
String startTime = DateUtil.format(DateUtil.parse(m.getControlOptTimes().split("\\|")[0], Constants.DATE_FORMAT.E_DATE_FORMAT_SECOND), Constants.DATE_FORMAT.E_DATE_FORMAT_TIME);
String endTime = DateUtil.format(DateUtil.parse(m.getControlOptTimes().split("\\|")[1], Constants.DATE_FORMAT.E_DATE_FORMAT_SECOND), Constants.DATE_FORMAT.E_DATE_FORMAT_TIME);
greenwaveDTO.setControlOptTimes(startTime.substring(0,startTime.lastIndexOf(":"))+"-"+endTime.substring(0,endTime.lastIndexOf(":")));
}catch (ParseException ex){ex.printStackTrace();
greenwaveDTO.setControlOptTimes(m.getControlOptTimes());
}catch (StringIndexOutOfBoundsException ex){ex.printStackTrace();
greenwaveDTO.setControlOptTimes(m.getControlOptTimes());
}
}else {
greenwaveDTO.setControlOptTimes(m.getControlOptTimes());
}
greenwaveList.add(greenwaveDTO);
});
induceDTO.setGreenwaveList(greenwaveList);
//获取关联模板信息
//induceDTO.setInduceTemplateList(induceTemplateList.stream().filter(z -> Objects.isNull(z.getEquipCode()) || z.getEquipCode().equals(o.getEquipCode())).collect(Collectors.toList()));
list.add(induceDTO);
});
jsonView.success(list);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
/**
* 根据条件查询记录
*
* @param greenwaveInduces 查询条件
* @return JsonViewObject
*/
@ApiOperation(value = "根据条件查询记录", notes = "根据条件查询记录", response = JsonViewObject.class, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/byCondition", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
JsonViewObject getByWhere(@ApiParam(value = "查询条件", required = true) @RequestBody @Validated({ValidationGroups.Query.class}) GreenwaveInduces greenwaveInduces){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
String jsonStr = JSON.toJSONString(greenwaveInduces);
try {
//参数校验过程中修改,兼容实现,restful入参不用map,便于进行参数逐个校验
Map params = JSONObject.parseObject(JSONObject.toJSONString(greenwaveInduces), Map.class);
// Map<String, Object> params = new HashMap<>();
// JSONObject.parseObject(JSONObject.toJSONString(GreenwaveInduces), Map.class).forEach((k,v) -> params.put(StringUtils.camelToCapital(k.toString()).toLowerCase(), v));
List<GreenwaveInduces> greenwaveInducesList = this.greenwaveInducesMapper.findByMap(params);
// List<InduceTemplate> induceTemplateList = induceTemplateService.list();
List<DeviceInduces> deviceInducesList = deviceInducesService.list();
List<GreenwaveInfoPO> greenwaveInfoPOList = greenwaveInfoMapper.selectAll();
List<InduceDTO> list = new ArrayList<>();
greenwaveInducesList.stream().forEach(o -> {
InduceDTO induceDTO = new InduceDTO();
induceDTO.setId(o.getId());
induceDTO.setEquipCode(o.getEquipCode());
//获取关联设备信息
List<DeviceInduces> deviceInduces = deviceInducesList.stream().filter(x -> Objects.nonNull(x.getEquipCode()) && x.getEquipCode().equals(o.getEquipCode())).collect(Collectors.toList());// 过滤条件// 收集结果
if (Objects.nonNull(deviceInduces) && deviceInduces.size() > 0) {
induceDTO.setEquipName(deviceInduces.get(0).getEquipName());
induceDTO.setRidDir(o.getDir());
induceDTO.setResolutionWidth(deviceInduces.get(0).getResolutionWidth());
induceDTO.setResolutionHeight(deviceInduces.get(0).getResolutionHeight());
induceDTO.setWkt(deviceInduces.get(0).getWkt());
}
//获取上屏状态
induceDTO.setStatus(o.getStatus());
//获取关联绿波信息
List<GreenwaveDTO> greenwaveList = new ArrayList<>();
this.greenwaveInducesHistService.list().stream().filter(y -> Objects.nonNull(y.getGreenId()) && y.getGreenId().equals(o.getGreenId())).forEach(m -> {
GreenwaveDTO greenwaveDTO = new GreenwaveDTO();
greenwaveDTO.setGreenId(m.getGreenId());
//获取绿波基本信息
List<GreenwaveInfoPO> greenwaveInfoByGreenId = greenwaveInfoPOList.stream().filter(n -> n.getId().equals(o.getGreenId())).collect(Collectors.toList());// 过滤条件// 收集结果
if (Objects.nonNull(greenwaveInfoByGreenId) && greenwaveInfoByGreenId.size() > 0) {
greenwaveDTO.setGreenName(greenwaveInfoByGreenId.get(0).getName());
greenwaveDTO.setDesignSpeed(greenwaveInfoByGreenId.get(0).getDesignSpeed());
}
greenwaveDTO.setStrategyId(m.getStrategyId());
greenwaveDTO.setStrategyName(m.getStrategyName());
greenwaveDTO.setDir(m.getDir());
Double maxSpeed = m.getMaxSpeed();
Double minSpeed = m.getMinSpeed();
greenwaveDTO.setMaxSpeed(maxSpeed.intValue());
greenwaveDTO.setMinSpeed(minSpeed.intValue());
if(Objects.nonNull(m.getControlOptTimes()) && m.getControlOptTimes().split("\\|").length>0) {
try {
String startTime = DateUtil.format(DateUtil.parse(m.getControlOptTimes().split("\\|")[0], Constants.DATE_FORMAT.E_DATE_FORMAT_SECOND), Constants.DATE_FORMAT.E_DATE_FORMAT_TIME);
String endTime = DateUtil.format(DateUtil.parse(m.getControlOptTimes().split("\\|")[1], Constants.DATE_FORMAT.E_DATE_FORMAT_SECOND), Constants.DATE_FORMAT.E_DATE_FORMAT_TIME);
greenwaveDTO.setControlOptTimes(startTime.substring(0,startTime.lastIndexOf(":"))+"-"+endTime.substring(0,endTime.lastIndexOf(":")));
}catch (ParseException ex){ex.printStackTrace();
greenwaveDTO.setControlOptTimes(m.getControlOptTimes());
}catch (StringIndexOutOfBoundsException ex){ex.printStackTrace();
greenwaveDTO.setControlOptTimes(m.getControlOptTimes());
}
}else {
greenwaveDTO.setControlOptTimes(m.getControlOptTimes());
}
greenwaveList.add(greenwaveDTO);
});
induceDTO.setGreenwaveList(greenwaveList);
//获取关联模板信息
//induceDTO.setInduceTemplateList(induceTemplateList.stream().filter(z -> Objects.isNull(z.getEquipCode()) || z.getEquipCode().equals(o.getEquipCode())).collect(Collectors.toList()));
list.add(induceDTO);
});
// 优化诱导屏列表逻辑
// 过滤空名称诱导屏,查询历史表是否有下发记录
LambdaQueryWrapper<InduceHist> queryWrapper = new LambdaQueryWrapper<>();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
queryWrapper.ge(InduceHist::getCreateTime, format.format(new Date()));
List<InduceHist> results = induceHistService.list(queryWrapper);
Set<String> codes = new HashSet<>();
List<InduceDTO> returnList = new ArrayList<>();
if (!CollectionUtils.isEmpty(list)) {
for (InduceHist result : results) {
String equipCode = result.getEquipCode();
codes.add(equipCode);
}
for (InduceDTO induceDTO : list) {
String equipCode = induceDTO.getEquipCode();
if (codes.contains(equipCode)) {
induceDTO.setStatus(1);
}
if (Objects.nonNull(induceDTO.getEquipName())) {
returnList.add(induceDTO);
}
}
}
jsonView.success(returnList);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getByWhere error,jsonStr:{}", this.getClass().getSimpleName(), jsonStr, e);
}
return jsonView;
}
/**
* 根据id查询记录
*
* @param id
* @return JsonViewObject
*/
@ApiOperation(value = "根据id查询记录", notes = "根据id查询记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON)
@GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON)
JsonViewObject getById(@ApiParam(value = "记录的id", required = true, example = "1") @PathVariable("id") @NotBlank(message = "查询id不能为空") String id){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
GreenwaveInduces GreenwaveInduces = this.greenwaveInducesService.getById(id);
jsonView.success(GreenwaveInduces);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("AbstractRestServerImpl getById error, id:{}", id, e);
}
return jsonView;
}
/**
* 根据id删除
*
* @param ids
* @return JsonViewObject
*/
@ApiOperation(value = "根据多个id删除记录", notes = "根据多个id删除记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON)
@ApiImplicitParams(value = {
@ApiImplicitParam(paramType = "query", name = "ids", dataType = "String", required = true, value = "多个记录id,用逗号分隔", example = "1,2")
})
@GetMapping(value = "/deleting", produces = MediaType.APPLICATION_JSON)
JsonViewObject deleteByIds(@QueryParam("ids") @NotBlank(message = "删除ids不能为空") String ids){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
String[] idArray = ids.split(",");
try {
if (idArray.length > 0) {
for (String id : idArray) {
jsonView = this.greenwaveInducesService.removeByIds(Arrays.asList(ids.split(",")))?jsonView.success():jsonView.fail();;
}
}
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("DELETE_FAILED_MSG"));
log.error("AbstractRestServerImpl deleteByIds error, id:{}", ids, e);
}
return jsonView;
}
/**
* 新建记录
*
* @param greenwaveInduces
* @return JsonViewObject
*/
@ApiOperation(value = "新建记录", notes = "新建记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/creating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
JsonViewObject save(@ApiParam(value = "记录的JSON格式字符串", required = true) @RequestBody @Validated({ValidationGroups.Create.class}) GreenwaveInduces greenwaveInduces){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
if (greenwaveInduces != null) {
jsonView = this.greenwaveInducesService.saveOrUpdate(greenwaveInduces)?jsonView.success():jsonView.fail();
}
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG"));
log.error("AbstractRestServerImpl save error, jsonStr:{}", JSON.toJSONString(greenwaveInduces), e);
}
return jsonView;
}
/**
* 修改记录
*
* @param greenwaveInduces
* @return
*/
@ApiOperation(value = "修改记录", notes = "修改记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/updating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
JsonViewObject update(@ApiParam(value = "记录的JSON格式字符串", required = true) @RequestBody @Validated({ValidationGroups.Update.class}) GreenwaveInduces greenwaveInduces){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
if (greenwaveInduces != null) {
jsonView = this.greenwaveInducesService.saveOrUpdate(greenwaveInduces)?jsonView.success():jsonView.fail();
}
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("UPDATE_FAILED_MSG"));
log.error("AbstractRestServerImpl update error, jsonStr:{}", JSON.toJSONString(greenwaveInduces), e);
}
return jsonView;
}
}
package net.wanji.opt.controller.induce;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.Constants;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.framework.rest.ValidationGroups;
import net.wanji.common.utils.tool.DateUtil;
import net.wanji.databus.dao.entity.GreenwaveInfoPO;
import net.wanji.databus.dao.mapper.GreenwaveInfoMapper;
import net.wanji.opt.dto.induce.GreenwaveDirDTO;
import net.wanji.opt.dto.induce.GreenwaveInducesDTO;
import net.wanji.opt.dto.induce.InduceDTO;
import net.wanji.opt.entity.DeviceInduces;
import net.wanji.opt.entity.GreenwaveInduces;
import net.wanji.opt.entity.GreenwaveInducesHist;
import net.wanji.opt.entity.InduceHist;
import net.wanji.opt.service.DeviceInducesService;
import net.wanji.opt.service.induce.GreenwaveInducesHistService;
import net.wanji.opt.service.induce.GreenwaveInducesService;
import net.wanji.opt.service.induce.InduceHistService;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.constraints.NotBlank;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import java.text.ParseException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
/**
* <p>
* 绿波诱导下发状态信息
* </p>
*
* @author guoliang.dong
* @since 2024-11-22
*/
@Api(value = "GreenwaveInducesHistController", description = "绿波-绿波诱导下发状态信息")
@RestController
@RequestMapping("/greenwaveInducesHist")
@Slf4j
public class GreenwaveInducesHistController {
@Resource
private GreenwaveInducesHistService greenwaveInducesHistService;
@Resource
private GreenwaveInducesService greenwaveInducesService;
@Resource
private GreenwaveInfoMapper greenwaveInfoMapper;
@Resource
private DeviceInducesService deviceInducesService;
@Resource
private InduceHistService induceHistService;
/**
* 获取所有记录
*
* @return JsonViewObject
*/
@ApiOperation(value = "获取所有记录", notes = "获取所有记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON)
@GetMapping(value = "/byAll", produces = MediaType.APPLICATION_JSON)
JsonViewObject getAll() {
JsonViewObject jsonView = JsonViewObject.newInstance();
long start = System.currentTimeMillis();
try {
List<GreenwaveInfoPO> greenwaveInfoPOList = greenwaveInfoMapper.selectAll();
List<GreenwaveInduces> greenwaveInducesList = greenwaveInducesService.list();
// List<InduceTemplate> induceTemplateList = induceTemplateService.list();
List<DeviceInduces> deviceInducesList = deviceInducesService.list();
//这里从绿波表里获取基本信息
List<GreenwaveInducesDTO> greenwaveInfoList = new ArrayList<>();
greenwaveInfoPOList.stream().forEach(x -> {
GreenwaveInducesDTO greenwaveInducesDTO = new GreenwaveInducesDTO();
greenwaveInducesDTO.setGreenId(x.getId());
greenwaveInducesDTO.setGreenName(x.getName());
greenwaveInducesDTO.setDesignSpeed(x.getDesignSpeed());
greenwaveInducesDTO.setStatus(x.getStatus());
greenwaveInducesDTO.setWkt(x.getWkt());
AtomicReference<Integer> equipCount = new AtomicReference<>(0);
List<GreenwaveDirDTO> dirList = new ArrayList<>();
greenwaveInducesList.stream().filter(t -> Objects.nonNull(t.getGreenId()) && t.getGreenId().equals(x.getId())).collect(Collectors.groupingBy(GreenwaveInduces::getDir)).entrySet().forEach(k -> {
LambdaQueryWrapper<GreenwaveInducesHist> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(GreenwaveInducesHist::getGreenId, x.getId());
queryWrapper.eq(GreenwaveInducesHist::getDir, k.getKey());
List<GreenwaveInducesHist> newGreenwaveInducesHistList = greenwaveInducesHistService.list(queryWrapper);
newGreenwaveInducesHistList.stream().forEach(o -> {
GreenwaveDirDTO greenwaveDirDTO = new GreenwaveDirDTO();
greenwaveDirDTO.setDir(o.getDir());
greenwaveDirDTO.setStrategyId(o.getStrategyId());
greenwaveDirDTO.setStrategyName(o.getStrategyName());
greenwaveDirDTO.setMinSpeed(o.getMinSpeed());
greenwaveDirDTO.setMaxSpeed(o.getMaxSpeed());
if (Objects.nonNull(o.getControlOptTimes()) && o.getControlOptTimes().split("\\|").length > 0) {
try {
String startTime = DateUtil.format(DateUtil.parse(o.getControlOptTimes().split("\\|")[0], Constants.DATE_FORMAT.E_DATE_FORMAT_SECOND), Constants.DATE_FORMAT.E_DATE_FORMAT_TIME);
String endTime = DateUtil.format(DateUtil.parse(o.getControlOptTimes().split("\\|")[1], Constants.DATE_FORMAT.E_DATE_FORMAT_SECOND), Constants.DATE_FORMAT.E_DATE_FORMAT_TIME);
greenwaveDirDTO.setControlOptTimes(startTime.substring(0, startTime.lastIndexOf(":")) + "-" + endTime.substring(0, endTime.lastIndexOf(":")));
} catch (ParseException ex) {
ex.printStackTrace();
greenwaveDirDTO.setControlOptTimes(o.getControlOptTimes());
} catch (StringIndexOutOfBoundsException ex) {
ex.printStackTrace();
greenwaveDirDTO.setControlOptTimes(o.getControlOptTimes());
}
} else {
greenwaveDirDTO.setControlOptTimes(o.getControlOptTimes());
}
//获取诱导屏列表
List<InduceDTO> induceDTOList = new ArrayList<>();
greenwaveInducesList.stream().filter(l -> Objects.nonNull(l.getGreenId()) && l.getGreenId().equals(o.getGreenId()) && Objects.nonNull(l.getDir()) && l.getDir().equals(o.getDir())).forEach(n -> {
InduceDTO induceDTO = new InduceDTO();
induceDTO.setId(n.getId());
induceDTO.setEquipCode(n.getEquipCode());
induceDTO.setStatus(o.getStatus());
//获取屏幕的设备信息
List<DeviceInduces> deviceInduces = deviceInducesList.stream().filter(m -> Objects.nonNull(m.getEquipCode()) && m.getEquipCode().equals(n.getEquipCode())).collect(Collectors.toList());// 过滤条件// 收集结果
if (Objects.nonNull(deviceInduces) && deviceInduces.size() > 0) {
induceDTO.setEquipName(deviceInduces.get(0).getEquipName());
induceDTO.setRidDir(n.getDir());//
induceDTO.setResolutionWidth(deviceInduces.get(0).getResolutionWidth());//
induceDTO.setResolutionHeight(deviceInduces.get(0).getResolutionHeight());//
induceDTO.setWkt(deviceInduces.get(0).getWkt());
}
//关联模板信息
//induceDTO.setInduceTemplateList(induceTemplateList.stream().filter(x->Objects.isNull(x.getEquipCode()) || x.getEquipCode().equals(n.getEquipCode())).collect(Collectors.toList()));
induceDTOList.add(induceDTO);
});
greenwaveDirDTO.setInduceList(induceDTOList);
equipCount.updateAndGet(v -> v + induceDTOList.size());
dirList.add(greenwaveDirDTO);
});
});
greenwaveInducesDTO.setGreenwaveDirList(dirList);
greenwaveInducesDTO.setEquipCount(equipCount.get());
greenwaveInfoList.add(greenwaveInducesDTO);
});
jsonView.success(greenwaveInfoList);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
/**
* 根据条件查询记录
*
* @param greenwaveInducesHist 查询条件
* @return JsonViewObject
*/
@ApiOperation(value = "根据条件查询记录", notes = "根据条件查询记录", response = JsonViewObject.class, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/byCondition", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
JsonViewObject getByWhere(@ApiParam(value = "查询条件", required = true) @RequestBody @Validated({ValidationGroups.Query.class}) GreenwaveInducesHist greenwaveInducesHist) {
JsonViewObject jsonView = JsonViewObject.newInstance();
long start = System.currentTimeMillis();
String jsonStr = JSON.toJSONString(greenwaveInducesHist);
try {
//参数校验过程中修改,兼容实现,restful入参不用map,便于进行参数逐个校验
Map params = JSONObject.parseObject(JSONObject.toJSONString(greenwaveInducesHist), Map.class);
// Map<String, Object> params = new HashMap<>();
// JSONObject.parseObject(JSONObject.toJSONString(GreenwaveInducesHist), Map.class).forEach((k,v) -> params.put(StringUtils.camelToCapital(k.toString()).toLowerCase(), v));
List<GreenwaveInducesHist> greenwaveInducesHistList = this.greenwaveInducesHistService.list();
List<GreenwaveInfoPO> greenwaveInfoPOList = greenwaveInfoMapper.findByMap(params);
List<GreenwaveInduces> greenwaveInducesList = greenwaveInducesService.list();
// List<InduceTemplate> induceTemplateList = induceTemplateService.list();
List<DeviceInduces> deviceInducesList = deviceInducesService.list();
List<GreenwaveInducesDTO> greenwaveInfoList = new ArrayList<>();
greenwaveInfoPOList.stream().forEach(x -> {
GreenwaveInducesDTO greenwaveInducesDTO = new GreenwaveInducesDTO();
greenwaveInducesDTO.setGreenId(x.getId());
greenwaveInducesDTO.setGreenName(x.getName());
greenwaveInducesDTO.setDesignSpeed(x.getDesignSpeed());
greenwaveInducesDTO.setWkt(x.getWkt());
greenwaveInducesDTO.setStatus(x.getStatus());
AtomicReference<Integer> equipCount = new AtomicReference<>(0);
List<GreenwaveDirDTO> dirList = new ArrayList<>();
greenwaveInducesList.stream().filter(t -> Objects.nonNull(t.getGreenId()) && t.getGreenId().equals(x.getId())).collect(Collectors.groupingBy(GreenwaveInduces::getDir)).entrySet().forEach(k -> {
// greenwaveInducesList.stream().collect(Collectors.toMap(p -> p.getGreenId() + "_" + p.getDir(), p -> p, (existing, replacement) -> (existing.getGreenId() + "_" + existing.getDir()).equals(replacement.getGreenId() + "_" + replacement.getDir()) ? existing : replacement)).values().stream().distinct().collect(Collectors.toList()).stream().forEach(p -> {
LambdaQueryWrapper<GreenwaveInducesHist> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(GreenwaveInducesHist::getGreenId, x.getId());
queryWrapper.eq(GreenwaveInducesHist::getDir, k.getKey());
List<GreenwaveInducesHist> newGreenwaveInducesHistList = greenwaveInducesHistService.list(queryWrapper);
newGreenwaveInducesHistList.stream().forEach(o -> {
// greenwaveInducesHistList.stream().filter(o -> Objects.isNull(o.getGreenId()) && Objects.equals(o.getGreenId(),x.getId())).forEach(o -> {
GreenwaveDirDTO greenwaveDirDTO = new GreenwaveDirDTO();
//这里从绿波表里获取基本信息
// List<GreenwaveInfoPO> greenwaveInfoByGreenId = greenwaveInfoPOList.stream().filter(n -> n.getId().equals(o.getGreenId())).collect(Collectors.toList());// 过滤条件// 收集结果
greenwaveDirDTO.setDir(o.getDir());
greenwaveDirDTO.setStrategyId(o.getStrategyId());
greenwaveDirDTO.setStrategyName(o.getStrategyName());
greenwaveDirDTO.setMinSpeed(o.getMinSpeed());
greenwaveDirDTO.setMaxSpeed(o.getMaxSpeed());
if (Objects.nonNull(o.getControlOptTimes()) && o.getControlOptTimes().split("\\|").length > 0) {
try {
String startTime = DateUtil.format(DateUtil.parse(o.getControlOptTimes().split("\\|")[0], Constants.DATE_FORMAT.E_DATE_FORMAT_SECOND), Constants.DATE_FORMAT.E_DATE_FORMAT_TIME);
String endTime = DateUtil.format(DateUtil.parse(o.getControlOptTimes().split("\\|")[1], Constants.DATE_FORMAT.E_DATE_FORMAT_SECOND), Constants.DATE_FORMAT.E_DATE_FORMAT_TIME);
greenwaveDirDTO.setControlOptTimes(startTime.substring(0, startTime.lastIndexOf(":")) + "-" + endTime.substring(0, endTime.lastIndexOf(":")));
} catch (ParseException ex) {
ex.printStackTrace();
greenwaveDirDTO.setControlOptTimes(o.getControlOptTimes());
} catch (StringIndexOutOfBoundsException ex) {
ex.printStackTrace();
greenwaveDirDTO.setControlOptTimes(o.getControlOptTimes());
}
} else {
greenwaveDirDTO.setControlOptTimes(o.getControlOptTimes());
}
//获取诱导屏列表
List<InduceDTO> induceDTOList = new ArrayList<>();
greenwaveInducesList.stream().filter(l -> Objects.nonNull(l.getGreenId()) && l.getGreenId().equals(o.getGreenId()) && Objects.nonNull(l.getDir()) && l.getDir().equals(o.getDir())).forEach(n -> {
InduceDTO induceDTO = new InduceDTO();
induceDTO.setId(n.getId());
induceDTO.setEquipCode(n.getEquipCode());
induceDTO.setStatus(o.getStatus());
//获取屏幕的设备信息
List<DeviceInduces> deviceInduces = deviceInducesList.stream().filter(m -> Objects.nonNull(m.getEquipCode()) && m.getEquipCode().equals(n.getEquipCode())).collect(Collectors.toList());// 过滤条件// 收集结果
if (Objects.nonNull(deviceInduces) && deviceInduces.size() > 0) {
induceDTO.setEquipName(deviceInduces.get(0).getEquipName());
induceDTO.setRidDir(n.getDir());//
induceDTO.setResolutionWidth(deviceInduces.get(0).getResolutionWidth());//
induceDTO.setResolutionHeight(deviceInduces.get(0).getResolutionHeight());//
induceDTO.setWkt(deviceInduces.get(0).getWkt());
}
//关联模板信息
//induceDTO.setInduceTemplateList(induceTemplateList.stream().filter(x -> Objects.isNull(x.getEquipCode()) || x.getEquipCode().equals(n.getEquipCode())).collect(Collectors.toList()));
induceDTOList.add(induceDTO);
});
greenwaveDirDTO.setInduceList(induceDTOList);
equipCount.updateAndGet(v -> v + induceDTOList.size());
dirList.add(greenwaveDirDTO);
});
});
greenwaveInducesDTO.setGreenwaveDirList(dirList);
greenwaveInducesDTO.setEquipCount(equipCount.get());
greenwaveInfoList.add(greenwaveInducesDTO);
});
List<GreenwaveInducesDTO> list = setGreenStatus(greenwaveInfoList);
jsonView.success(list);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getByWhere error,jsonStr:{}", this.getClass().getSimpleName(), jsonStr, e);
}
return jsonView;
}
/**
* 通过诱导屏上屏记录,修改绿波诱导发布状态
* @param greenwaveInfoList
* @return
*/
private List<GreenwaveInducesDTO> setGreenStatus(List<GreenwaveInducesDTO> greenwaveInfoList) {
LambdaQueryWrapper<InduceHist> queryWrapper = new LambdaQueryWrapper<>();
LocalDateTime date = LocalDate.now().atStartOfDay();
queryWrapper.ge(InduceHist::getCreateTime, date);
List<InduceHist> list = induceHistService.list(queryWrapper);
List<GreenwaveInducesDTO> results = new ArrayList<>();
if (!CollectionUtils.isEmpty(list)) {
Map<String, Integer> map = list.stream().collect(Collectors.toMap(InduceHist::getEquipCode, InduceHist::getGreenId,
(existing, replacement) -> existing));
for (GreenwaveInducesDTO greenwaveInducesDTO : greenwaveInfoList) {
Integer greenId = greenwaveInducesDTO.getGreenId();
if (!map.containsValue(greenId)) {
greenwaveInducesDTO.setStatus(0);
results.add(greenwaveInducesDTO);
} else {
List<GreenwaveDirDTO> greenwaveDirList = greenwaveInducesDTO.getGreenwaveDirList();
for (GreenwaveDirDTO greenwaveDirDTO : greenwaveDirList) {
List<InduceDTO> induceList = greenwaveDirDTO.getInduceList();
for (InduceDTO induceDTO : induceList) {
String equipCode = induceDTO.getEquipCode();
if (map.containsKey(equipCode)) {
greenwaveInducesDTO.setStatus(1);
results.add(greenwaveInducesDTO);
}
}
}
}
}
} else {
for (GreenwaveInducesDTO greenwaveInducesDTO : greenwaveInfoList) {
greenwaveInducesDTO.setStatus(0);
results.add(greenwaveInducesDTO);
}
}
List<GreenwaveInducesDTO> collect = results.stream().distinct().collect(Collectors.toList());
return collect;
}
/**
* 根据id查询记录
*
* @param id
* @return JsonViewObject
*/
@ApiOperation(value = "根据id查询记录", notes = "根据id查询记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON)
@GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON)
JsonViewObject getById(@ApiParam(value = "记录的id", required = true, example = "1") @PathVariable("id") @NotBlank(message = "查询id不能为空") String id){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
GreenwaveInducesHist GreenwaveInducesHist = this.greenwaveInducesHistService.getById(id);
jsonView.success(GreenwaveInducesHist);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("AbstractRestServerImpl getById error, id:{}", id, e);
}
return jsonView;
}
/**
* 根据id删除
*
* @param ids
* @return JsonViewObject
*/
@ApiOperation(value = "根据多个id删除记录", notes = "根据多个id删除记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON)
@ApiImplicitParams(value = {
@ApiImplicitParam(paramType = "query", name = "ids", dataType = "String", required = true, value = "多个记录id,用逗号分隔", example = "1,2")
})
@GetMapping(value = "/deleting", produces = MediaType.APPLICATION_JSON)
JsonViewObject deleteByIds(@QueryParam("ids") @NotBlank(message = "删除ids不能为空") String ids){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
String[] idArray = ids.split(",");
try {
if (idArray.length > 0) {
for (String id : idArray) {
jsonView = this.greenwaveInducesHistService.removeByIds(Arrays.asList(ids.split(",")))?jsonView.success():jsonView.fail();;
}
}
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("DELETE_FAILED_MSG"));
log.error("AbstractRestServerImpl deleteByIds error, id:{}", ids, e);
}
return jsonView;
}
/**
* 新建记录
*
* @param greenwaveInducesHist
* @return JsonViewObject
*/
@ApiOperation(value = "新建记录", notes = "新建记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/creating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
JsonViewObject save(@ApiParam(value = "记录的JSON格式字符串", required = true) @RequestBody @Validated({ValidationGroups.Create.class}) GreenwaveInducesHist greenwaveInducesHist){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
if (greenwaveInducesHist != null) {
jsonView = this.greenwaveInducesHistService.saveOrUpdate(greenwaveInducesHist)?jsonView.success():jsonView.fail();
}
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG"));
log.error("AbstractRestServerImpl save error, jsonStr:{}", JSON.toJSONString(greenwaveInducesHist), e);
}
return jsonView;
}
/**
* 修改记录
*
* @param greenwaveInducesHist
* @return
*/
@ApiOperation(value = "修改记录", notes = "修改记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/updating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
JsonViewObject update(@ApiParam(value = "记录的JSON格式字符串", required = true) @RequestBody @Validated({ValidationGroups.Update.class}) GreenwaveInducesHist greenwaveInducesHist){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
if (greenwaveInducesHist != null) {
jsonView = this.greenwaveInducesHistService.saveOrUpdate(greenwaveInducesHist)?jsonView.success():jsonView.fail();
}
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("UPDATE_FAILED_MSG"));
log.error("AbstractRestServerImpl update error, jsonStr:{}", JSON.toJSONString(greenwaveInducesHist), e);
}
return jsonView;
}
}
package net.wanji.opt.controller.induce;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.framework.rest.ValidationGroups;
import net.wanji.opt.entity.InduceFontHist;
import net.wanji.opt.service.induce.InduceFontHistService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.ws.rs.core.MediaType;
import java.util.List;
/**
* @author duanruiming
* @date 2025/01/21 14:37
*/
@Api(value = "InduceFontHistController", description = "诱导屏-文字下发历史信息")
@RestController
@RequestMapping("/induceFontHist")
@Slf4j
public class InduceFontHistController {
@Resource
private InduceFontHistService induceFontHistService;
@ApiOperation(value = "获取所有诱导文字下发记录", notes = "获取所有诱导文字下发记录",
response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON)
@GetMapping(value = "/byAll", produces = MediaType.APPLICATION_JSON)
public JsonViewObject getAll(@RequestParam(defaultValue = "") String equipCode) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
List<InduceFontHist> list = induceFontHistService.getAll(equipCode);
jsonViewObject.success(list);
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
@ApiOperation(value = "诱导屏文字编辑新增修改", notes = "诱导屏文字编辑新增修改",
response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON)
@PostMapping(value = "/editor", produces = MediaType.APPLICATION_JSON,
consumes = MediaType.APPLICATION_JSON)
public JsonViewObject editor(@ApiParam(value = "查询条件", required = true)
@RequestBody @Validated({ValidationGroups.Query.class})
InduceFontHist induceFontHist) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
induceFontHistService.editor(induceFontHist);
jsonViewObject.success("编辑成功");
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("POST_FAILED_MSG"));
log.error("{} editor error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
@ApiOperation(value = "通过编号获取诱导屏最新文字", notes = "通过编号获取诱导屏最新文字",
response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON)
@GetMapping(value = "/byLastOne", produces = MediaType.APPLICATION_JSON)
public JsonViewObject getLastOne(@RequestParam("equipCode") String equipCode) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
InduceFontHist induceFontHist = induceFontHistService.getLastOne(equipCode);
jsonViewObject.success(induceFontHist);
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} byLastOne error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
@ApiOperation(value = "通过字体id删除诱导屏字体信息", notes = "通过字体id删除诱导屏字体信息",
response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON)
@GetMapping(value = "/deleteOneById", produces = MediaType.APPLICATION_JSON)
public JsonViewObject deleteOneById(@RequestParam("id") Integer id) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
induceFontHistService.deleteOneById(id);
jsonViewObject.success("删除成功");
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} byLastOne error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
}
package net.wanji.opt.controller.induce;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.framework.rest.Page;
import net.wanji.common.framework.rest.ValidationGroups;
import net.wanji.common.utils.tool.DateUtil;
import net.wanji.common.utils.tool.StringUtils;
import net.wanji.opt.dto.induce.InduceDTO;
import net.wanji.opt.entity.InduceHist;
import net.wanji.opt.service.induce.InduceHistService;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.constraints.NotBlank;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import java.util.*;
/**
* <p>
* 诱导屏-下发历史信息
* </p>
*
* @author guoliang.dong
* @since 2024-11-22
*/
@Api(value = "InduceHistController", description = "诱导屏-下发历史信息")
@RestController
@RequestMapping("/induceHist")
@Slf4j
public class InduceHistController {
@Resource
private InduceHistService induceHistService;
/**
* 获取所有诱导下发记录
*
* @return JsonViewObject
*/
@ApiOperation(value = "获取所有诱导下发记录", notes = "获取所有诱导下发记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON)
@GetMapping(value = "/byAll", produces = MediaType.APPLICATION_JSON)
JsonViewObject getAll(){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try{
List<InduceHist> list=this.induceHistService.list();
jsonView.success(list);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
/**
* 根据条件查询记录
*
* @param induceHist 查询条件
* @return JsonViewObject
*/
@ApiOperation(value = "根据条件查询记录", notes = "根据条件查询记录", response = JsonViewObject.class, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/byCondition", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
JsonViewObject getByWhere(@ApiParam(value = "查询条件", required = true) @RequestBody @Validated({ValidationGroups.Query.class}) InduceHist induceHist){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
String jsonStr = JSON.toJSONString(induceHist);
try {
//参数校验过程中修改,兼容实现,restful入参不用map,便于进行参数逐个校验
// Map params = JSONObject.parseObject(JSONObject.toJSONString(InduceHist), Map.class);
Map<String, Object> params = new HashMap<>();
JSONObject.parseObject(JSONObject.toJSONString(induceHist), Map.class).forEach((k,v) -> params.put(StringUtils.camelToCapital(k.toString()).toLowerCase(), v));
List<InduceHist> list = this.induceHistService.listByMap(params);
List<InduceHist> result = new ArrayList<>();
if (!CollectionUtils.isEmpty(list)) {
for (InduceHist hist : list) {
Date createTime = hist.getCreateTime();
Date date = DateUtil.addDay(DateUtil.StringToDate(new Date()), -30);
if (createTime.before(date)) {
continue;
}
result.add(hist);
}
}
jsonView.success(result);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getByWhere error,jsonStr:{}", this.getClass().getSimpleName(), jsonStr, e);
}
return jsonView;
}
/**
* 根据id查询记录
*
* @param id
* @return JsonViewObject
*/
@ApiOperation(value = "根据id查询记录", notes = "根据id查询记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON)
@GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON)
JsonViewObject getById(@ApiParam(value = "记录的id", required = true, example = "1") @PathVariable("id") @NotBlank(message = "查询id不能为空") String id){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
InduceHist InduceHist = this.induceHistService.getById(id);
jsonView.success(InduceHist);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("AbstractRestServerImpl getById error, id:{}", id, e);
}
return jsonView;
}
/**
* 根据id删除
*
* @param ids
* @return JsonViewObject
*/
@ApiOperation(value = "根据多个id删除记录", notes = "根据多个id删除记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON)
@ApiImplicitParams(value = {
@ApiImplicitParam(paramType = "query", name = "ids", dataType = "String", required = true, value = "多个记录id,用逗号分隔", example = "1,2")
})
@GetMapping(value = "/deleting", produces = MediaType.APPLICATION_JSON)
JsonViewObject deleteByIds(@QueryParam("ids") @NotBlank(message = "删除ids不能为空") String ids){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
String[] idArray = ids.split(",");
try {
if (idArray.length > 0) {
for (String id : idArray) {
jsonView = this.induceHistService.removeByIds(Arrays.asList(ids.split(",")))?jsonView.success():jsonView.fail();;
}
}
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("DELETE_FAILED_MSG"));
log.error("AbstractRestServerImpl deleteByIds error, id:{}", ids, e);
}
return jsonView;
}
/**
* 新建记录
*
* @param induceHist
* @return JsonViewObject
*/
@ApiOperation(value = "新建记录", notes = "新建记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/creating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
JsonViewObject save(@ApiParam(value = "记录的JSON格式字符串", required = true) @RequestBody @Validated({ValidationGroups.Create.class}) InduceHist induceHist){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
if (induceHist != null) {
jsonView = this.induceHistService.saveOrUpdate(induceHist)?jsonView.success():jsonView.fail();
}
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG"));
log.error("AbstractRestServerImpl save error, jsonStr:{}", JSON.toJSONString(induceHist), e);
}
return jsonView;
}
/**
* 修改记录
*
* @param induceHist
* @return
*/
@ApiOperation(value = "修改记录", notes = "修改记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/updating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
JsonViewObject update(@ApiParam(value = "记录的JSON格式字符串", required = true) @RequestBody @Validated({ValidationGroups.Update.class}) InduceHist induceHist){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
if (induceHist != null) {
jsonView = this.induceHistService.saveOrUpdate(induceHist)?jsonView.success():jsonView.fail();
}
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("UPDATE_FAILED_MSG"));
log.error("AbstractRestServerImpl update error, jsonStr:{}", JSON.toJSONString(induceHist), e);
}
return jsonView;
}
}
package net.wanji.opt.controller.induce;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.Constants;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.utils.tool.DateUtil;
import net.wanji.opt.dto.induce.MessageParam;
import net.wanji.opt.entity.GreenwaveInduces;
import net.wanji.opt.entity.GreenwaveInducesHist;
import net.wanji.opt.entity.InduceHist;
import net.wanji.opt.entity.InduceTemplate;
import net.wanji.opt.service.induce.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.ws.rs.core.MediaType;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@Api(value = "InduceSendController", description = "诱导屏-下发消息接口(对接易华录)")
@RestController
@RequestMapping("/induce")
@Slf4j
public class InduceSendController {
@Autowired
private InduceSendService induceSendService;
@Autowired
private InduceHistService induceHistService;
@Autowired
private InduceTemplateService induceTemplateService;
@Autowired
private GreenwaveInducesService greenwaveInducesService;
@Autowired
private GreenwaveInducesHistService greenwaveInducesHistService;
@ApiOperation(value = "发送诱导信息", notes = "发送诱导信息", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON)
@PostMapping("/send")
public JsonViewObject send(@RequestBody MessageParam param) {
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
if(Objects.nonNull(param.getGreenId())) {
LambdaQueryWrapper<GreenwaveInducesHist> greenwaveInducesHistQueryWrapper = new LambdaQueryWrapper<>();
greenwaveInducesHistQueryWrapper.eq(GreenwaveInducesHist::getGreenId, param.getGreenId());
List<GreenwaveInducesHist> greenwaveInducesHistList = greenwaveInducesHistService.list(greenwaveInducesHistQueryWrapper);
if (Objects.nonNull(greenwaveInducesHistList) && greenwaveInducesHistList.size() > 0 && Objects.nonNull(greenwaveInducesHistList.get(0).getControlOptTimes()) && greenwaveInducesHistList.get(0).getControlOptTimes().split("|").length > 0 && DateUtil.isBetween(new Date(), DateUtil.parse(greenwaveInducesHistList.get(0).getControlOptTimes().split("\\|")[0], Constants.DATE_FORMAT.E_DATE_FORMAT_SECOND), DateUtil.parse(greenwaveInducesHistList.get(0).getControlOptTimes().split("\\|")[1], Constants.DATE_FORMAT.E_DATE_FORMAT_SECOND))) {
param.setStartTime(greenwaveInducesHistList.get(0).getControlOptTimes().split("\\|")[0]);
param.setEndTime(greenwaveInducesHistList.get(0).getControlOptTimes().split("\\|")[1]);
} else {
param.setStartTime(DateUtil.format(new Date(), Constants.DATE_FORMAT.E_DATE_FORMAT_SECOND));
param.setEndTime(DateUtil.format(System.currentTimeMillis() + 1000 * 60, Constants.DATE_FORMAT.E_DATE_FORMAT_SECOND));
}
}
induceSendService.send(param);
return jsonView.success();
} catch (Exception e) {
log.info(e.getMessage());
return jsonView.fail("发送诱导信息失败");
}
}
@ApiOperation(value = "按绿波带编号批量发送诱导信息", notes = "按绿波带编号批量发送诱导信息", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON)
@PostMapping("/batchSend")
public JsonViewObject batchSend(@RequestBody MessageParam param) {
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
//查询绿波带信息,关联绿波路口,根据绿波路口查询关联诱导屏下发
LambdaQueryWrapper<GreenwaveInduces> greenwaveInducesQueryWrapper = new LambdaQueryWrapper<>();
greenwaveInducesQueryWrapper.eq(GreenwaveInduces::getGreenId, param.getGreenId());
List<GreenwaveInduces> greenwaveInducesList=greenwaveInducesService.list(greenwaveInducesQueryWrapper);
LambdaQueryWrapper<GreenwaveInducesHist> greenwaveInducesHistQueryWrapper = new LambdaQueryWrapper<>();
greenwaveInducesHistQueryWrapper.eq(GreenwaveInducesHist::getGreenId, param.getGreenId());
List<GreenwaveInducesHist> greenwaveInducesHistList=greenwaveInducesHistService.list(greenwaveInducesHistQueryWrapper);
for(GreenwaveInduces greenwaveInduces:greenwaveInducesList)
{
LambdaQueryWrapper<InduceTemplate> induceTemplateQueryWrapper = new LambdaQueryWrapper<>();
induceTemplateQueryWrapper.eq(InduceTemplate::getEquipCode, greenwaveInduces.getEquipCode());
List<InduceTemplate> induceTemplateList=induceTemplateService.list(induceTemplateQueryWrapper);
for(InduceTemplate induceTemplate:induceTemplateList) {
param.setTemplateId(induceTemplate.getId());
param.setInduceId(greenwaveInduces.getId());
param.setEquipCode(greenwaveInduces.getEquipCode());
param.setPlayorder(induceTemplateList.size());
param.setDuration(greenwaveInduces.getDuration());
if (Objects.nonNull(greenwaveInducesHistList) && greenwaveInducesHistList.size() > 0 && Objects.nonNull(greenwaveInducesHistList.get(0).getControlOptTimes()) && greenwaveInducesHistList.get(0).getControlOptTimes().split("\\|").length > 0 && DateUtil.isBetween(new Date(), DateUtil.parse(greenwaveInducesHistList.get(0).getControlOptTimes().split("\\|")[0], Constants.DATE_FORMAT.E_DATE_FORMAT_SECOND), DateUtil.parse(greenwaveInducesHistList.get(0).getControlOptTimes().split("\\|")[1], Constants.DATE_FORMAT.E_DATE_FORMAT_SECOND))) {
param.setStartTime(greenwaveInducesHistList.get(0).getControlOptTimes().split("\\|")[0]);
param.setEndTime(greenwaveInducesHistList.get(0).getControlOptTimes().split("\\|")[1]);
} else {
param.setStartTime(DateUtil.format(new Date(), Constants.DATE_FORMAT.E_DATE_FORMAT_SECOND));
param.setEndTime(DateUtil.format(System.currentTimeMillis() + 1000 * 60, Constants.DATE_FORMAT.E_DATE_FORMAT_SECOND));
}
induceSendService.send(param);
Thread.sleep(1000);
}
}
return jsonView.success();
} catch (Exception e) {
log.info(e.getMessage());
return jsonView.fail("批量发布诱导信息失败");
}
}
/**
* 获取诱导发布图片
*/
@ApiOperation(value = "根据设备编号获取诱导发布图片", notes = "根据设备编号获取诱导发布图片")
@GetMapping(value = "/fileCode")
public ResponseEntity<byte[]> ftpFileByCode(@RequestParam("equipCode") String equipCode) {
// 根据 equipCode 获取文件名
LambdaQueryWrapper<InduceHist> InduceHistQueryWrapper = new LambdaQueryWrapper<>();
InduceHistQueryWrapper.eq(InduceHist::getEquipCode, equipCode);
InduceHistQueryWrapper.orderByDesc(InduceHist::getCreateTime);
InduceHist pictureFile = this.induceHistService.getOne(InduceHistQueryWrapper,false);
if (Objects.isNull(pictureFile) && pictureFile.getFilePath() == null) {
return ResponseEntity.status(HttpStatus.OK)
.body("无效的文件ID".getBytes(StandardCharsets.UTF_8));
}
try {
// 获取ftp服务器图片
byte[] imageBytes = this.induceSendService.downloadImage(pictureFile.getFilePath());
if (imageBytes != null && imageBytes.length > 0) {
// 设置响应头
HttpHeaders headers = new HttpHeaders();
headers.set("Content-Type", "image/jpeg"); // 图片类型
headers.set("Content-Length", String.valueOf(imageBytes.length)); // 设置内容长度
headers.set("Content-Disposition", "inline; filename=\"" + pictureFile.getSourceId() + ".bmp\""); // 设置文件名
// 返回响应
return new ResponseEntity<>(imageBytes, headers, HttpStatus.OK);
} else {
return ResponseEntity.status(HttpStatus.OK)
.body("未查询到对应文件".getBytes(StandardCharsets.UTF_8));
}
} catch (IOException e) {
log.error("ftp文件下载失败: ", e.getMessage());
return ResponseEntity.status(HttpStatus.OK)
.body("程序查询错误请联系管理员".getBytes(StandardCharsets.UTF_8));
}
}
@ApiOperation(value = "根据设备编号和发布时间获取诱导发布图片", notes = "根据设备编号和发布时间获取诱导发布图片")
@GetMapping(value = "/fileCodeHist")
public ResponseEntity<byte[]> ftpFileByCodeAndTime(@RequestParam("equipCode") String equipCode, @RequestParam("date") String date) {
LambdaQueryWrapper<InduceHist> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(InduceHist::getEquipCode, equipCode);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date curDate = new Date();
String curDateStr = format.format(curDate);
String dateTime = curDateStr.concat(" ").concat(date);
queryWrapper.eq(InduceHist::getCreateTime, dateTime);
queryWrapper.orderByDesc(InduceHist::getCreateTime);
InduceHist pictureFile = this.induceHistService.getOne(queryWrapper,false);
if (Objects.isNull(pictureFile) || pictureFile.getFilePath() == null) {
return ResponseEntity.status(HttpStatus.OK)
.body("无效的文件ID".getBytes(StandardCharsets.UTF_8));
}
try {
// 获取ftp服务器图片
byte[] imageBytes = this.induceSendService.downloadImage(pictureFile.getFilePath());
if (imageBytes != null && imageBytes.length > 0) {
// 设置响应头
HttpHeaders headers = new HttpHeaders();
// 图片类型
headers.set("Content-Type", "image/jpeg");
// 设置内容长度
headers.set("Content-Length", String.valueOf(imageBytes.length));
// 设置文件名
headers.set("Content-Disposition", "inline; filename=\"" + pictureFile.getSourceId() + ".bmp\"");
// 返回响应
return new ResponseEntity<>(imageBytes, headers, HttpStatus.OK);
} else {
return ResponseEntity.status(HttpStatus.OK)
.body("未查询到对应文件".getBytes(StandardCharsets.UTF_8));
}
} catch (IOException e) {
log.error("ftp文件下载失败: ", e.getMessage());
return ResponseEntity.status(HttpStatus.OK)
.body("程序查询错误请联系管理员".getBytes(StandardCharsets.UTF_8));
}
}
/**
* 获取ftp图片
*/
@GetMapping(value = "/file")
public ResponseEntity<byte[]> ftpFile(@RequestParam("fileId") Long fileId) {
// 根据 fileId 获取文件名
InduceHist pictureFile = this.induceHistService.getById(fileId);
if (pictureFile == null) {
return ResponseEntity.status(HttpStatus.OK)
.body("无效的文件ID".getBytes(StandardCharsets.UTF_8));
}
try {
// 获取ftp服务器图片
byte[] imageBytes = this.induceSendService.downloadImage(pictureFile.getFilePath());
if (imageBytes != null && imageBytes.length > 0) {
// 设置响应头
HttpHeaders headers = new HttpHeaders();
headers.set("Content-Type", "image/jpeg"); // 图片类型
headers.set("Content-Length", String.valueOf(imageBytes.length)); // 设置内容长度
headers.set("Content-Disposition", "inline; filename=\"" + pictureFile.getSourceId() + ".bmp\""); // 设置文件名
// 返回响应
return new ResponseEntity<>(imageBytes, headers, HttpStatus.OK);
} else {
return ResponseEntity.status(HttpStatus.OK)
.body("未查询到对应文件".getBytes(StandardCharsets.UTF_8));
}
} catch (IOException e) {
log.error("ftp文件下载失败: ", e.getMessage());
return ResponseEntity.status(HttpStatus.OK)
.body("程序查询错误请联系管理员".getBytes(StandardCharsets.UTF_8));
}
}
}
package net.wanji.opt.controller.induce;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.collect.Maps;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.framework.rest.Page;
import net.wanji.common.framework.rest.ValidationGroups;
import net.wanji.common.utils.tool.StringUtils;
import net.wanji.opt.entity.InduceTemplate;
import net.wanji.opt.service.induce.InduceTemplateService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.constraints.NotBlank;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import java.util.*;
/**
* <p>
* 诱导屏-发布模板
* </p>
*
* @author guoliang.dong
* @since 2024-11-22
*/
@Api(value = "InduceTemplateController", description = "诱导屏-发布模板")
@RestController
@RequestMapping("/induceTemplate")
@Slf4j
public class InduceTemplateController {
@Resource
private InduceTemplateService induceTemplateService;
/**
* 获取所有记录
*
* @return JsonViewObject
*/
@ApiOperation(value = "获取所有记录", notes = "获取所有记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON)
@GetMapping(value = "/byAll", produces = MediaType.APPLICATION_JSON)
JsonViewObject getAll(){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
List<InduceTemplate> list = this.induceTemplateService.list();
jsonView.success(list);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
/**
* 根据条件查询记录
*
* @param induceTemplate 查询条件
* @return JsonViewObject
*/
@ApiOperation(value = "根据条件查询记录", notes = "根据条件查询记录", response = JsonViewObject.class, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/byCondition", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
JsonViewObject getByWhere(@ApiParam(value = "查询条件", required = true) @RequestBody @Validated({ValidationGroups.Query.class}) InduceTemplate induceTemplate){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
String jsonStr = JSON.toJSONString(induceTemplate);
try {
//参数校验过程中修改,兼容实现,restful入参不用map,便于进行参数逐个校验
// Map params = JSONObject.parseObject(JSONObject.toJSONString(InduceTemplate), Map.class);
Map<String, Object> params = new HashMap<>();
JSONObject.parseObject(JSONObject.toJSONString(induceTemplate), Map.class).forEach((k,v) -> params.put(StringUtils.camelToCapital(k.toString()).toLowerCase(), v));
List list = this.induceTemplateService.listByMap(params);
jsonView.success(list);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getByWhere error,jsonStr:{}", this.getClass().getSimpleName(), jsonStr, e);
}
return jsonView;
}
/**
* 根据id查询记录
*
* @param id
* @return JsonViewObject
*/
@ApiOperation(value = "根据id查询记录", notes = "根据id查询记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON)
@GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON)
JsonViewObject getById(@ApiParam(value = "记录的id", required = true, example = "1") @PathVariable("id") @NotBlank(message = "查询id不能为空") String id){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
InduceTemplate InduceTemplate = this.induceTemplateService.getById(id);
jsonView.success(InduceTemplate);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("AbstractRestServerImpl getById error, id:{}", id, e);
}
return jsonView;
}
/**
* 根据id删除
*
* @param ids
* @return JsonViewObject
*/
@ApiOperation(value = "根据多个id删除记录", notes = "根据多个id删除记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON)
@ApiImplicitParams(value = {
@ApiImplicitParam(paramType = "query", name = "ids", dataType = "String", required = true, value = "多个记录id,用逗号分隔", example = "1,2")
})
@GetMapping(value = "/deleting", produces = MediaType.APPLICATION_JSON)
JsonViewObject deleteByIds(@QueryParam("ids") @NotBlank(message = "删除ids不能为空") String ids){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
String[] idArray = ids.split(",");
try {
if (idArray.length > 0) {
for (String id : idArray) {
jsonView = this.induceTemplateService.removeByIds(Arrays.asList(ids.split(",")))?jsonView.success():jsonView.fail();
}
}
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("DELETE_FAILED_MSG"));
log.error("AbstractRestServerImpl deleteByIds error, id:{}", ids, e);
}
return jsonView;
}
/**
* 新建记录
*
* @param induceTemplate
* @return JsonViewObject
*/
@ApiOperation(value = "新建记录", notes = "新建记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/creating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
JsonViewObject save(@ApiParam(value = "记录的JSON格式字符串", required = true) @RequestBody @Validated({ValidationGroups.Create.class}) InduceTemplate induceTemplate){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
if (induceTemplate != null) {
jsonView = this.induceTemplateService.saveOrUpdate(induceTemplate)?jsonView.success():jsonView.fail();
}
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG"));
log.error("AbstractRestServerImpl save error, jsonStr:{}", JSON.toJSONString(induceTemplate), e);
}
return jsonView;
}
/**
* 修改记录
*
* @param induceTemplate
* @return
*/
@ApiOperation(value = "修改记录", notes = "修改记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/updating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
JsonViewObject update(@ApiParam(value = "记录的JSON格式字符串", required = true) @RequestBody @Validated({ValidationGroups.Update.class}) InduceTemplate induceTemplate) {
JsonViewObject jsonView = JsonViewObject.newInstance();
long start = System.currentTimeMillis();
try {
if (induceTemplate != null) {
//更新默认模板
if (Objects.nonNull(induceTemplate.getEquipCode())) {
LambdaQueryWrapper<InduceTemplate> induceTemplateQueryWrapper = new LambdaQueryWrapper<>();
induceTemplateQueryWrapper.eq(InduceTemplate::getEquipCode, induceTemplate.getEquipCode());
induceTemplateQueryWrapper.eq(InduceTemplate::getDefaultTemplate, 1);//筛选默认模板进行自动发送,目前屏幕轮播参数无效
List<InduceTemplate> induceTemplateList = this.induceTemplateService.list(induceTemplateQueryWrapper);
induceTemplateList.stream().forEach(o -> {
if (!o.getId().equals(induceTemplate.getId())) {
o.setDefaultTemplate(0);
}
});
try {
this.induceTemplateService.saveOrUpdateBatch(induceTemplateList);
} catch (Exception ex) {
log.error("default template batch update error, jsonStr:{}", JSON.toJSONString(induceTemplate), ex);
}
}
induceTemplate.setDefaultTemplate(1);//设为默认模板
jsonView = this.induceTemplateService.saveOrUpdate(induceTemplate) ? jsonView.success() : jsonView.fail();
}
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("UPDATE_FAILED_MSG"));
log.error("AbstractRestServerImpl update error, jsonStr:{}", JSON.toJSONString(induceTemplate), e);
}
return jsonView;
}
}
package net.wanji.opt.controller.signalcontrol;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.common.annotation.aspect.AspectLog;
import net.wanji.common.enums.BaseEnum;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.bo.CrossIdBO;
import net.wanji.databus.dto.CrossIdDateTimeDTO;
import net.wanji.databus.vo.ControlCommandVO;
import net.wanji.databus.vo.LightsStatusVO2;
import net.wanji.databus.vo.SchemeOptSendVO;
import net.wanji.opt.service.signalcontrol.FeignProxyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.ws.rs.core.MediaType;
/**
* @author duanruiming
* @date 2023/03/01 20:44
*/
@Api(value = "SignalCommandOptController", description = "信号机控制", tags = "信号机控制")
@RequestMapping("/signalControl")
@RestController
public class SignalCommandOptController {
@Autowired
private FeignProxyService feignProxyService;
@AspectLog(description = "诊断优化手动优化方案下发", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@ApiOperation(value = "手动优化方案下发", notes = "优化方案下发", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/schemeOptSend",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class)})
public JsonViewObject schemeOptSend(@RequestBody @Validated SchemeOptSendVO schemeOptSendVO) throws Exception {
JsonViewObject jsonViewObject = feignProxyService.schemeOptSend(schemeOptSendVO);
return jsonViewObject;
}
@AspectLog(description = "诊断优化手动优化方案恢复", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@ApiOperation(value = "手动优化方案恢复", notes = "优化方案恢复", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/schemeOptRestore",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class)})
public JsonViewObject schemeOptRestore(@RequestBody @NotBlank String crossId) throws Exception {
JsonViewObject jsonViewObject = feignProxyService.schemeOptRestore(crossId);
return jsonViewObject;
}
@AspectLog(description = "全红控制", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@ApiOperation(value = "全红控制", notes = "全红控制", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/allRedControl",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class)})
public JsonViewObject allRedControl(@RequestBody ControlCommandVO vo) throws Exception {
//JsonViewObject jsonViewObject = feignProxyService.allRedControl(vo);
JsonViewObject jsonViewObject = JsonViewObject.newInstance().success();
return jsonViewObject;
}
@AspectLog(description = "黄闪控制", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@ApiOperation(value = "黄闪控制", notes = "黄闪控制", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/yellowLightControl",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class)})
public JsonViewObject yellowLightControl(@RequestBody ControlCommandVO vo) throws Exception {
//JsonViewObject jsonViewObject = feignProxyService.yellowLightControl(vo);
JsonViewObject jsonViewObject = JsonViewObject.newInstance().success();
return jsonViewObject;
}
@AspectLog(description = "步进控制", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@ApiOperation(value = "步进控制", notes = "步进控制", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/stepControl",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class)})
public JsonViewObject stepControl(String crossId, Integer command, Integer stepNum) throws Exception {
//JsonViewObject jsonViewObject = feignProxyService.stepControl(crossId, command, stepNum);
JsonViewObject jsonViewObject = JsonViewObject.newInstance().success();
return jsonViewObject;
}
@AspectLog(description = "相位锁定", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@ApiOperation(value = "相位锁定", notes = "相位锁定", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/lockControl",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class)})
public JsonViewObject lockControl(@RequestBody ControlCommandVO vo) throws Exception {
//JsonViewObject jsonViewObject = feignProxyService.lockControl(vo);
JsonViewObject jsonViewObject = JsonViewObject.newInstance().success();
return jsonViewObject;
}
@AspectLog(description = "恢复时间表", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@ApiOperation(value = "恢复时间表", notes = "恢复时间表", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/recoverSchedule",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class)})
public JsonViewObject recoverSchedule(@RequestBody CrossIdBO crossIdBO) throws Exception {
//JsonViewObject jsonViewObject = feignProxyService.recoverSchedule(crossIdBO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance().success();
return jsonViewObject;
}
@AspectLog(description = "查询某一时间灯态历史数据", operationType = BaseEnum.OperationTypeEnum.QUERY)
@PostMapping(value = "/lightStatusOneHist", produces = MediaType.APPLICATION_JSON)
@ApiOperation(value = "查询某一时间灯态历史数据", notes = "查询某一时间灯态历史数据", response = LightsStatusVO2.class,
produces = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = LightsStatusVO2.class)
})
public JsonViewObject lightStatusOneHist(@RequestBody @Valid CrossIdDateTimeDTO crossIdDateTimeDTO) throws Exception {
return feignProxyService.lightStatusOneHist(crossIdDateTimeDTO);
}
}
package net.wanji.opt.controller.signalopt;
import io.swagger.annotations.*;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.bo.CrossIdBO;
import net.wanji.databus.po.CrossDataRealtimePO;
import net.wanji.databus.po.CrossDirDataRealtimePO;
import net.wanji.databus.po.CrossDirStatusDataPO;
import net.wanji.databus.po.TBaseCrossInfo;
import net.wanji.opt.dto.strategy.AddOrUpdateSceneDTO;
import net.wanji.opt.entity.GreenwaveHist;
import net.wanji.opt.po.trend.HoloEventInfoPO;
import net.wanji.opt.service.CrossIndexService;
import net.wanji.opt.vo.AIOptResultVO;
import net.wanji.opt.vo.CrossEventListPO;
import net.wanji.opt.vo.CrossOptResult;
import net.wanji.opt.vo.CrossStatusCountVO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.ws.rs.core.MediaType;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author duanruiming
* @date 2024/11/25 19:10
*/
@Api(value = "CrossIndexController", description = "路口指标控制器")
@RequestMapping("/crossIndex")
@RestController
public class CrossIndexController {
@Resource
private CrossIndexService crossIndexService;
@ApiOperation(value = "路口信息查询", notes = "路口信息查询", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/crossInfoList")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = TBaseCrossInfo.class),
})
public JsonViewObject crossInfoList(@RequestParam(defaultValue = "") Integer areaId) {
List<TBaseCrossInfo> baseCrossInfoPOS = crossIndexService.crossInfoList();
return JsonViewObject.newInstance().success(baseCrossInfoPOS);
}
@ApiOperation(value = "路口方向指标", notes = "路口方向指标", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/crossDirIndex",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AddOrUpdateSceneDTO.class),
})
public JsonViewObject crossDirIndex(@RequestBody CrossIdBO crossIdBO) {
Map<Integer, CrossDirDataRealtimePO> result = crossIndexService.crossDirIndex(crossIdBO);
return JsonViewObject.newInstance().success(result);
}
@ApiOperation(value = "路口指标", notes = "路口指标", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/crossIndex",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AddOrUpdateSceneDTO.class),
})
public JsonViewObject crossIndex(@RequestBody CrossIdBO crossIdBO) {
CrossDataRealtimePO crossDataRealtimePO = crossIndexService.crossIndex(crossIdBO);
return JsonViewObject.newInstance().success(crossDataRealtimePO);
}
@ApiOperation(value = "方案优化曲线", notes = "优化监测-方案优化曲线", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/crossOptResultList",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AddOrUpdateSceneDTO.class),
})
public JsonViewObject crossOptResultList(@RequestBody CrossIdBO crossIdBO) {
List<CrossOptResult> results = null;
try {
results = crossIndexService.crossOptResultList(crossIdBO);
} catch (Exception e) {
JsonViewObject.newInstance().fail("方案优化曲线查询异常");
}
return JsonViewObject.newInstance().success(results);
}
@ApiOperation(value = "AI路口", notes = "优化监测-AI路口", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/crossAIList")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AIOptResultVO.class),
})
public JsonViewObject crossAIList() {
List<AIOptResultVO> results = null;
try {
results = crossIndexService.crossAIList();
} catch (Exception e) {
JsonViewObject.newInstance().fail("优化监测-AI路口查询异常");
}
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 = CrossStatusCountVO.class),
})
public JsonViewObject crossStatusCount(String crossId) {
List<CrossStatusCountVO> results = new ArrayList<>();
try {
results = crossIndexService.crossStatusCount(crossId);
} catch (Exception e) {
JsonViewObject.newInstance().fail("优化监测-问题诊断");
}
return JsonViewObject.newInstance().success(results);
}
@ApiOperation(value = "交通体检-路口监测-事件方向转向", notes = "交通体检-路口监测-事件方向转向", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/crossEventDirTurn")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = HoloEventInfoPO.class),
})
public JsonViewObject crossEventDirTurn(String crossId) {
HoloEventInfoPO result = new HoloEventInfoPO();
try {
result = crossIndexService.crossEventDirTurn(crossId);
} catch (Exception e) {
JsonViewObject.newInstance().fail("优化监测-问题诊断");
}
return JsonViewObject.newInstance().success(result);
}
@ApiOperation(value = "查询各个方向交通状态变化趋势", notes = "查询各个方向交通状态变化趋势", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/crossDirStatusData")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AddOrUpdateSceneDTO.class),
})
public JsonViewObject crossDirStatusData(@RequestBody CrossIdBO crossIdBO) {
CrossDirStatusDataPO result = new CrossDirStatusDataPO();
try {
result = crossIndexService.selectByCrossIdAndHour(crossIdBO.getCrossId(),2);
} catch (Exception e) {
JsonViewObject.newInstance().fail("查询各个方向交通状态变化趋势");
}
return JsonViewObject.newInstance().success(result);
}
@GetMapping("/selectCrossEventList")
@ApiOperation(httpMethod="GET",value="路口监测左下角路口事件列表", notes="")
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = GreenwaveHist.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
})
public JsonViewObject selectCrossEventList() {
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
List<CrossEventListPO> list = crossIndexService.selectCrossEventList();
jsonView.success(list);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
}
return jsonView;
}
}
package net.wanji.opt.controller.signalopt;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.service.signalopt.GreenBeltInfoService;
import net.wanji.opt.vo.GreenBeltCrossDetailVO;
import net.wanji.opt.vo.GreenBeltFlowStopTimeVO;
import net.wanji.opt.vo.GreenBeltKeyCrossFlowTimeVO;
import net.wanji.opt.vo.GreenBeltSpeedWidthVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.ws.rs.core.MediaType;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* @author duanruiming
* @date 2024/11/28 16:03
*/
@Api(value = "GreenBeltController", description = "绿波干线")
@RequestMapping("/greenBelt")
@RestController
public class GreenBeltController {
@Resource
private GreenBeltInfoService greenBeltInfoService;
@ApiOperation(value = "绿波协调方向路口流量停车次数", notes = "绿波协调方向路口流量停车次数", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/greenBeltCrossDetailHist")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenBeltFlowStopTimeVO.class),
})
public JsonViewObject greenBeltCrossDetailHist(Integer greenId) {
List<GreenBeltFlowStopTimeVO> greenBeltFlowStopTimeVOS = Collections.EMPTY_LIST;
try {
greenBeltFlowStopTimeVOS = greenBeltInfoService.greenBeltCrossDetailHist(greenId);
} catch (Exception e) {
JsonViewObject.newInstance().fail("绿波协调方向路口流量停车次数异常");
}
return JsonViewObject.newInstance().success(greenBeltFlowStopTimeVOS);
}
@ApiOperation(value = "绿波带宽曲线", notes = "优化监测-绿波带宽曲线", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/greenBeltSpeedWidth")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenBeltSpeedWidthVO.class),
})
public JsonViewObject greenBeltSpeedWidth(Integer greenId) {
List<GreenBeltSpeedWidthVO> list = Collections.EMPTY_LIST;
try {
list = greenBeltInfoService.greenBeltSpeedWidth(greenId);
} catch (Exception e) {
JsonViewObject.newInstance().fail("绿波带宽曲线异常");
}
return JsonViewObject.newInstance().success(list);
}
@ApiOperation(value = "绿波关键路口流量绿信比", notes = "优化监测-绿波关键路口流量绿信比", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/greenBeltKeyCrossFlowTime")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenBeltKeyCrossFlowTimeVO.class),
})
public JsonViewObject greenBeltKeyCrossFlowTime(Integer greenId) {
List<GreenBeltKeyCrossFlowTimeVO> list = Collections.EMPTY_LIST;
try {
list = greenBeltInfoService.greenBeltKeyCrossFlowTime(greenId);
} catch (Exception e) {
JsonViewObject.newInstance().fail("绿波带宽曲线异常");
}
return JsonViewObject.newInstance().success(list);
}
@ApiOperation(value = "干线详情", notes = "优化监测-干线详情", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/greenBeltCrossDetailList")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenBeltKeyCrossFlowTimeVO.class),
})
public JsonViewObject greenBeltCrossDetailList(Integer greenId) {
GreenBeltCrossDetailVO greenBeltCrossDetailVO = new GreenBeltCrossDetailVO();
try {
greenBeltCrossDetailVO = greenBeltInfoService.greenBeltCrossDetailList(greenId);
} catch (Exception e) {
JsonViewObject.newInstance().fail("优化监测-干线详情");
}
return JsonViewObject.newInstance().success(greenBeltCrossDetailVO);
}
}
package net.wanji.opt.controller.strategy;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.dto.IntegerIdsDTO;
import net.wanji.opt.dto.strategy.AddOrUpdateIdeaDTO;
import net.wanji.opt.dto.strategy.QueryIdeaDTO;
import net.wanji.opt.po.strategy.IdeaPO;
import net.wanji.opt.service.strategy.IdeaService;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import javax.ws.rs.core.MediaType;
/**
* 策略管理-方法库
*
* @author Kent HAN
* @date 2023/2/27 9:25
*/
@Api(value = "IdeaController", description = "策略管理-方法库")
@RequestMapping("/idea")
@RestController
public class IdeaController {
private final IdeaService ideaService;
public IdeaController(IdeaService ideaService) {
this.ideaService = ideaService;
}
@ApiOperation(value = "新增/修改方法", notes = "新增/修改方法", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/addOrUpdateIdea",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class),
})
public JsonViewObject addOrUpdateIdea(@RequestBody @Valid AddOrUpdateIdeaDTO addOrUpdateIdeaDTO) {
try {
ideaService.addOrUpdateIdea(addOrUpdateIdeaDTO);
} catch (DuplicateKeyException e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
throw new DuplicateKeyException("方法编号或方法名称不可重复");
}
return JsonViewObject.newInstance().success();
}
@ApiOperation(value = "删除方法", notes = "删除方法", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/deleteIdea",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class),
})
public JsonViewObject deleteIdea(@RequestBody IntegerIdsDTO integerIdsDTO) {
ideaService.deleteIdea(integerIdsDTO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success();
}
@ApiOperation(value = "查询方法", notes = "查询方法", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/queryIdea",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = IdeaPO.class),
})
public JsonViewObject queryIdea(@RequestBody QueryIdeaDTO queryIdeaDTO) {
PageInfo<IdeaPO> ideaPOList = ideaService.queryIdea(queryIdeaDTO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(ideaPOList);
}
}
package net.wanji.opt.controller.strategy;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.common.exception.UniqueException;
import net.wanji.opt.dto.IntegerIdsDTO;
import net.wanji.opt.dto.strategy.AddOrUpdateSceneDTO;
import net.wanji.opt.dto.strategy.QuerySceneDTO;
import net.wanji.opt.service.strategy.SceneService;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import javax.ws.rs.core.MediaType;
/**
* 策略管理-场景库
*
* @author Kent HAN
* @date 2023/2/27 9:25
*/
@Api(value = "SceneController", description = "策略管理-场景库")
@RequestMapping("/scene")
@RestController
public class SceneController {
private final SceneService sceneService;
public SceneController(SceneService sceneService) {
this.sceneService = sceneService;
}
@ApiOperation(value = "新增/修改场景", notes = "新增/修改场景", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/addOrUpdateScene",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class),
})
public JsonViewObject addOrUpdateScene(@RequestBody @Valid AddOrUpdateSceneDTO addOrUpdateSceneDTO) {
try {
sceneService.addOrUpdateScene(addOrUpdateSceneDTO);
} catch (DuplicateKeyException e) {
throw new DuplicateKeyException("场景编号或场景名称不可重复");
} catch (UniqueException e) {
throw new UniqueException("应用策略或优化方法或优先级不可重复");
}
return JsonViewObject.newInstance().success();
}
@ApiOperation(value = "删除场景", notes = "删除场景", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/deleteScene",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class),
})
public JsonViewObject deleteScene(@RequestBody IntegerIdsDTO integerIdsDTO) {
sceneService.deleteScene(integerIdsDTO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success();
}
@ApiOperation(value = "查询场景", notes = "查询场景", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/queryScene",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AddOrUpdateSceneDTO.class),
})
public JsonViewObject queryScene(@RequestBody QuerySceneDTO querySceneDTO) {
PageInfo<AddOrUpdateSceneDTO> sceneList = sceneService.queryScene(querySceneDTO);
return JsonViewObject.newInstance().success(sceneList);
}
}
package net.wanji.opt.controller.strategy;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.dto.IntegerIdsDTO;
import net.wanji.opt.dto.strategy.AddOrUpdateStrategyDTO;
import net.wanji.opt.dto.strategy.QueryStrategyDTO;
import net.wanji.opt.po.strategy.StrategyPO;
import net.wanji.opt.service.strategy.StrategyService;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import javax.ws.rs.core.MediaType;
/**
* 策略管理-策略库
*
* @author Kent HAN
* @date 2023/2/27 9:25
*/
@Api(value = "StrategyController", description = "策略管理-策略库")
@RequestMapping("/strategy")
@RestController
public class StrategyController {
private final StrategyService strategyService;
public StrategyController(StrategyService strategyService) {
this.strategyService = strategyService;
}
@ApiOperation(value = "新增/修改策略", notes = "新增/修改策略", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/addOrUpdateStrategy",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class),
})
public JsonViewObject addOrUpdateStrategy(@RequestBody @Valid AddOrUpdateStrategyDTO addOrUpdateStrategyDTO) {
try {
strategyService.addOrUpdateStrategy(addOrUpdateStrategyDTO);
} catch (DuplicateKeyException e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
throw new DuplicateKeyException("策略编号或策略名称不可重复");
}
return JsonViewObject.newInstance().success();
}
@ApiOperation(value = "删除策略", notes = "删除策略", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/deleteStrategy",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = JsonViewObject.class),
})
public JsonViewObject deleteStrategy(@RequestBody IntegerIdsDTO integerIdsDTO) {
strategyService.deleteStrategy(integerIdsDTO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success();
}
@ApiOperation(value = "查询策略", notes = "查询策略", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/queryStrategy",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = StrategyPO.class),
})
public JsonViewObject queryStrategy(@RequestBody QueryStrategyDTO queryStrategyDTO) {
PageInfo<StrategyPO> strategyPOList = strategyService.queryStrategy(queryStrategyDTO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(strategyPOList);
}
}
package net.wanji.opt.controllerv2;
import cn.hutool.core.date.DateUtil;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.utils.tool.StringUtils;
import net.wanji.opt.servicev2.CrossService;
import net.wanji.opt.synthesis.pojo.CrossRealTimeAlarmEntity;
import net.wanji.opt.synthesis.pojo.CrossStatusDisOptTimeEntity;
import net.wanji.opt.synthesis.pojo.vo.CrossOrGreenWaveTypeEntity;
import net.wanji.opt.vo2.CrossBaseInfoVO;
import net.wanji.opt.vo2.CrossRealTimeAlarmVO;
import net.wanji.opt.vo2.CrossStatusDistributionVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* @author zhengyifan
* @date 2025/3/15
*/
@Api(value = "CrossController", description = "监测详情-路口事件详情")
@RequestMapping(value = "/cross")
@RestController
@Slf4j
public class CrossController {
@Resource
private CrossService crossService;
@GetMapping("/getCrossStatusDistribution")
@ApiOperation(httpMethod="GET",value="路口状态分布", notes="路口状态分布")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossID", value = "路口ID", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "groupType", value = "时间粒度 0--5分钟 1--15分钟 2--30分钟 3--60分钟", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "date", value = "日期 格式:yyyy-MM-dd", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "objectType", value = "范围 1:方向级指标 2:转向级指标 3:车道级指标 4:路口级指标", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "condition", value = "筛选条件", dataType = "String", paramType = "query"),
})
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossStatusDistributionVO.class),
})
public JsonViewObject getCrossStatusDistribution(String crossID, String date, String groupType, Integer objectType, String condition) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
if (StringUtils.isBlank(date)) {
date = DateUtil.now().substring(0, 10);
}
Map<String, Object> result = crossService.getCrossStatusDistribution(crossID, date, groupType, objectType, condition);
List<CrossStatusDisOptTimeEntity> optTimes = crossService.getOptTimeList(crossID);
List<CrossOrGreenWaveTypeEntity> typeList = crossService.getCrossTypeList(crossID, date);
result.put("optTimesList", optTimes);
result.put("typeList", typeList);
return jsonViewObject.success(result);
} catch (Exception e) {
log.error("监测详情-路口事件详情-路口状态分布: ", e);
return jsonViewObject.success();
}
}
@ApiOperation(value = "路口实时告警", notes = "路口实时告警", response = JsonViewObject.class, httpMethod="GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossID", value = "路口ID", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "time", value = "时间 格式:yyyy-MM-dd HH:ii:ss", dataType = "String", paramType = "query"),
})
@GetMapping(value = "/getCrossRealTimeAlarm")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossRealTimeAlarmVO.class),
})
public JsonViewObject getCrossRealTimeAlarm(String crossID, @RequestParam(defaultValue = "") String time) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
List<CrossRealTimeAlarmEntity> result;
try {
result = crossService.getCrossRealTimeAlarm(crossID, time);
} catch (Exception e) {
log.error("监测详情-路口事件详情-路口实时告警: ", e);
return jsonViewObject.fail("路口实时告警查询失败");
}
return jsonViewObject.success(result);
}
@ApiOperation(value = "路口基础信息", notes = "路口基础信息", response = JsonViewObject.class, httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossID", value = "路口ID", required = true, dataType = "String", paramType = "query"),
})
@GetMapping(value = "/getCrossBaseInfo")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossBaseInfoVO.class)
})
public JsonViewObject getCrossBaseInfo(String crossID) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
CrossBaseInfoVO result;
try {
result = crossService.getCrossBaseInfos(crossID);
} catch (Exception e) {
log.error("监测详情-路口事件详情-路口基础信息: ", e);
return jsonViewObject.fail("路口基础信息查询失败");
}
return jsonViewObject.success(result);
}
}
package net.wanji.opt.controllerv2;
import cn.hutool.core.date.DateUtil;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.utils.tool.StringUtils;
import net.wanji.databus.vo.LightsStatusVO2;
import net.wanji.opt.dto.GreenBeltChartDTO;
import net.wanji.opt.servicev2.TrendServiceV2;
import net.wanji.opt.vo2.*;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.ws.rs.core.MediaType;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author duanruiming
* @date 2025/03/06 18:33
*/
@Api(value = "TrendControllerV2", description = "态势监测v2", tags = "态势监测v2")
@RequestMapping("/trendV2")
@RestController
@Slf4j
public class TrendControllerV2 {
@Resource
private TrendServiceV2 trendServiceV2;
@ApiOperation(value = "通用接口获取服务器时间", notes = "通用接口获取服务器时间", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/getNow")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = String.class),
})
public JsonViewObject getNow() {
return JsonViewObject.newInstance().success(DateUtil.now(), "");
}
@ApiOperation(value = "态势监测-区域体检-雷达图", notes = "态势监测-区域体检-雷达图", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/crossGreenStatusTimeRate")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossGreenStatusTimeRateVO.class),
})
public JsonViewObject crossGreenStatusTimeRate() {
List<CrossGreenStatusTimeRateVO> list = Collections.emptyList();
try {
list = trendServiceV2.crossGreenStatusTimeRate();
} catch (Exception e) {
log.error("态势监测-区域体检-雷达图-查询失败:{}", e);
JsonViewObject.newInstance().success(list);
}
return JsonViewObject.newInstance().success(list);
}
@ApiOperation(value = "态势监测-区域体检-路口列表", notes = "态势监测-区域体检-路口列表",
response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/crossOptInfoList")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossOptInfoVO.class),
})
public JsonViewObject crossOptInfoList() throws Exception {
List<CrossOptInfoVO> list = Collections.emptyList();
try {
list = trendServiceV2.crossOptInfoList();
} catch (Exception e) {
log.error("态势监测-区域体检-路口列表:{}", e);
JsonViewObject.newInstance().success(list);
}
return JsonViewObject.newInstance().success(list);
}
@ApiOperation(value = "态势监测-区域体检-绿波列表", notes = "态势监测-区域体检-绿波列表",
response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/greenOptInfoList")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenOptInfoVO.class),
})
public JsonViewObject greenOptInfoList() throws Exception {
List<GreenOptInfoVO> list = Collections.emptyList();
try {
list = trendServiceV2.greenOptInfoList();
} catch (Exception e) {
log.error("态势监测-区域体检-绿波列表", e);
JsonViewObject.newInstance().success(list);
}
return JsonViewObject.newInstance().success(list);
}
@ApiOperation(value = "态势监测-运行监测-干线优化监测", notes = "态势监测-运行监测-干线优化监测",
response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/greenOptMonitoringList")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = OptMonitoringResultVO.class),
})
public JsonViewObject greenOptMonitoringList() throws Exception {
OptMonitoringResultVO result = new OptMonitoringResultVO();
try {
List<OptMonitoringVO> list = trendServiceV2.greenOptMonitoringList();
countResult(result, list);
} catch (Exception e) {
log.error("态势监测-运行监测-干线优化监测-查询异常:", e);
JsonViewObject.newInstance().success(result);
}
return JsonViewObject.newInstance().success(result);
}
private void countResult(OptMonitoringResultVO result, List<OptMonitoringVO> list) throws Exception {
Map<String, List<OptMonitoringVO>> listMap = list.stream().collect(Collectors.groupingBy(OptMonitoringVO::getType));
List<OptMonitoringResultVO.TypeCount> typeCounts = new ArrayList<>();
for (Map.Entry<String, List<OptMonitoringVO>> entry : listMap.entrySet()) {
String key = entry.getKey();
List<OptMonitoringVO> value = entry.getValue();
OptMonitoringResultVO.TypeCount typeCount = new OptMonitoringResultVO.TypeCount();
typeCount.setType(key);
typeCount.setEventCount(value.size());
List<OptMonitoringVO> optList = value.stream().filter(vo -> Objects.equals(1, vo.getOptStatus())).collect(Collectors.toList());
typeCount.setOptCount(optList.size());
typeCounts.add(typeCount);
}
result.setTypeCount(typeCounts);
result.setOptMonitoringVOList(list);
}
@ApiOperation(value = "态势监测-运行监测-路口优化监测", notes = "态势监测-运行监测-路口优化监测",
response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/crossOptMonitoringList")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = OptMonitoringResultVO.class),
})
public JsonViewObject crossOptMonitoringList() throws Exception {
OptMonitoringResultVO result = new OptMonitoringResultVO();
try {
List<OptMonitoringVO> list = trendServiceV2.crossOptMonitoringList();
countResult(result, list);
} catch (Exception e) {
log.error("态势监测-运行监测-路口优化监测:", e);
JsonViewObject.newInstance().success(result);
}
return JsonViewObject.newInstance().success(result);
}
@ApiOperation(value = "态势监测-事件告警-实时列表", notes = "态势监测-事件告警-实时列表",
response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/eventAlarmRealTimeList")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = OptMonitoringVO.class),
})
public JsonViewObject eventAlarmRealTimeList(String type) throws Exception {
List<OptMonitoringVO> list = Collections.emptyList();
try {
if (StringUtils.isBlank(type)) {
list = trendServiceV2.eventAlarmRealTimeList();
} else {
list = trendServiceV2.eventAlarmRealTimeList().stream()
.filter(vo -> StringUtils.equalsIgnoreCase(type, vo.getType()))
.collect(Collectors.toList());
}
} catch (Exception e) {
log.error("态势监测-事件告警-实时列表:", e);
JsonViewObject.newInstance().success(list);
}
List<OptMonitoringVO> collect = list.stream().
filter(vo -> !StringUtils.equalsIgnoreCase("700", vo.getType())
&& !StringUtils.equalsIgnoreCase("708", vo.getType())).collect(Collectors.toList());
return JsonViewObject.newInstance().success(collect);
}
@ApiOperation(value = "态势监测-区域体检-雷达图绿波类型过滤", notes = "态势监测-区域体检-雷达图绿波类型过滤",
response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/selectGreenEventTypeCountTimeList",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = OptMonitoringVO.class),
})
public JsonViewObject selectGreenEventTypeCountTimeList(@RequestBody EventTypeCountTimeVO vo) throws Exception {
List<StatisticsEventTypeCountTimeVO> list = Collections.emptyList();
try {
list = trendServiceV2.selectGreenEventTypeCountTimeList(vo);
} catch (Exception e) {
log.error("态势监测-区域体检-雷达图绿波类型过滤:", e);
JsonViewObject.newInstance().success(list);
}
return JsonViewObject.newInstance().success(list);
}
@ApiOperation(value = "态势监测-区域体检-雷达图路口类型过滤", notes = "态势监测-区域体检-雷达图路口类型过滤",
response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/selectCrossEventTypeCountTimeList",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = OptMonitoringVO.class),
})
public JsonViewObject selectCrossEventTypeCountTimeList(@RequestBody EventTypeCountTimeVO vo) throws Exception {
List<StatisticsEventTypeCountTimeVO> list = Collections.emptyList();
try {
list = trendServiceV2.selectCrossEventTypeCountTimeList(vo);
} catch (Exception e) {
log.error("态势监测-区域体检-雷达图路口类型过滤:", e);
JsonViewObject.newInstance().success(list);
}
return JsonViewObject.newInstance().success(list);
}
@ApiOperation(value = "态势监测-事件告警-历史列表", notes = "态势监测-事件告警-历史列表",
response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/eventAlarmHistList")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = OptMonitoringVO.class),
})
public JsonViewObject eventAlarmHistList(int pageNo, int pageSize) throws Exception {
PageInfo<StatisticsEventTypeCountTimeVO> results = new PageInfo<>();
try {
results = trendServiceV2.selectCrossGreenHistList(pageNo, pageSize);
} catch (Exception e) {
log.error("态势监测-事件告警-历史列表:", e);
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 = "/optStrategyResultInfo")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = String.class),
})
public JsonViewObject optStrategyResultInfo(String id, String date) throws Exception {
OptStrategyResultInfoVO result = new OptStrategyResultInfoVO();
try {
result = trendServiceV2.optStrategyResultInfo(id, date);
} catch (Exception e) {
log.error("态势监测-策略推荐-优化策略:", e);
JsonViewObject.newInstance().success(result, "");
}
return JsonViewObject.newInstance().success(result, "");
}
@ApiOperation(value = "态势监测-策略推荐-绿波优化相位差", notes = "态势监测-策略推荐-绿波优化相位差",
response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/optStrategyCrossOffsetList")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = OptMonitoringVO.class),
})
public JsonViewObject optStrategyCrossOffsetList(Integer id, String date) throws Exception {
GreenOptCrossOffsetVO greenOptCrossOffsetVO = new GreenOptCrossOffsetVO();
try {
greenOptCrossOffsetVO = trendServiceV2.optStrategyCrossOffsetList(id, date);
} catch (Exception e) {
log.error("态势监测-策略推荐-绿波优化相位差:", e);
JsonViewObject.newInstance().success(greenOptCrossOffsetVO);
}
return JsonViewObject.newInstance().success(greenOptCrossOffsetVO);
}
@ApiOperation(value = "态势监测-查询历史灯态", notes = "态势监测-查询历史灯态",
response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/selectLightStatusHist")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = LightsStatusVO2.class),
})
public JsonViewObject selectLightStatusHist(String id, String date) throws Exception {
LightsStatusVO2 lightsStatusVO2 = null;
try {
lightsStatusVO2 = trendServiceV2.selectLightStatusHist(id, date);
} catch (Exception e) {
log.error("态势监测-查询历史灯态:", e);
JsonViewObject.newInstance().success(lightsStatusVO2);
}
return JsonViewObject.newInstance().success(lightsStatusVO2);
}
@ApiOperation(value = "态势监测-绿波时序图", notes = "态势监测-绿波时序图",
response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/green4SchemeChart")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = String.class),
})
public JsonViewObject green4SchemeChart(Integer greenId, String date) throws Exception {
GreenBeltChartDTO result = new GreenBeltChartDTO();
try {
result = trendServiceV2.green4SchemeChart(greenId, date);
} catch (Exception e) {
log.error("态势监测-绿波时序图:", e);
JsonViewObject.newInstance().success(result, "");
}
return JsonViewObject.newInstance().success(result, "");
}
}
\ No newline at end of file
package net.wanji.opt.controllerv2;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.po.base.EventStatisticPo;
import net.wanji.opt.servicev2.TrunkLineService;
import net.wanji.opt.servicev2.TrunkLineStatusDisService;
import net.wanji.opt.synthesis.pojo.CrossRealTimeAlarmEntity;
import net.wanji.opt.synthesis.pojo.TrunkLineCrossProblemEntity;
import net.wanji.opt.synthesis.pojo.TrunkLineProblemDescribeEntity;
import net.wanji.opt.vo2.CrossRealTimeAlarmVO;
import net.wanji.opt.vo2.TrunkLineCrossProblemVO;
import net.wanji.opt.vo2.TrunkLineProblemDescribeVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* @author zhengyifan
* @date 2025/3/14
*/
@Api(value = "TrunkLineController", description = "监测详情-干线")
@RequestMapping("/trunkLine")
@RestController
@Slf4j
public class TrunkLineController {
@Resource
private TrunkLineStatusDisService trunkLineStatusDisService;
@Resource
private TrunkLineService trunkLineService;
@GetMapping("/statusDisInfoList")
@ApiOperation(httpMethod="GET",value="干线数据", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "greenID", value = "干线ID", required = true, dataType = "String",defaultValue = ""),
@ApiImplicitParam(name = "date", value = "日期", required = true, dataType = "String",defaultValue = ""),
@ApiImplicitParam(name = "timeGranule", value = "时间颗粒度 支持参数:5 15 30 60", required = true, dataType = "String",defaultValue = "5"),
})
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = EventStatisticPo.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
})
public JsonViewObject statusDisInfoList(String greenID, String date, String timeGranule) {
try {
JsonViewObject object = JsonViewObject.newInstance();
JSONObject list = trunkLineStatusDisService.trunkLineStatusDisInfoList(greenID, date, timeGranule);
return object.success(list);
} catch (Exception e) {
log.error("监测详情-干线事件详情-干线交通状态分布趋势: ", e);
return JsonViewObject.newInstance().fail("请求失败");
}
}
@GetMapping("/problemDescribe")
@ApiOperation(httpMethod="GET",value="干线问题描述", notes="干线问题描述", response = JsonViewObject.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "greenID", value = "干线ID", required = true, dataType = "String",defaultValue = ""),
@ApiImplicitParam(name = "time", value = "日期", required = false, dataType = "String",defaultValue = ""),
})
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = TrunkLineProblemDescribeVO.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
})
public JsonViewObject problemDescribe(String greenID , String time ) {
try {
JsonViewObject object = JsonViewObject.newInstance();
List<TrunkLineProblemDescribeEntity> list = trunkLineService.getTrunkLineProblemDescribe(greenID,time);
return object.success(list);
} catch (Exception e) {
log.error("监测详情-干线详情-干线问题描述: ", e);
return JsonViewObject.newInstance().fail("干线问题描述查询失败");
}
}
@ApiOperation(value = "干线实时告警", notes = "干线实时告警", response = JsonViewObject.class, httpMethod="GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "greenID", value = "绿波ID", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "time", value = "时间 格式:yyyy-MM-dd HH:ii:ss",required = true, dataType = "String", paramType = "query"),
})
@GetMapping(value = "/getTrunkLineRealTimeAlarm")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossRealTimeAlarmVO.class),
})
public JsonViewObject getTrunkLineRealTimeAlarm(Integer greenID, String time) {
try {
JsonViewObject object = JsonViewObject.newInstance();
List<CrossRealTimeAlarmEntity> list = trunkLineService.getTrunkLineRealTimeAlarm(greenID,time);
return object.success(list);
} catch (Exception e) {
log.error("获取干线实时告警失败: ", e);
return JsonViewObject.newInstance().fail("获取干线实时告警失败");
}
}
@ApiOperation(value = "干线路口状态", notes = "干线路口状态", response = JsonViewObject.class, httpMethod="GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "greenID", value = "绿波ID", required = true, dataType = "Integer", paramType = "query"),
@ApiImplicitParam(name = "time", value = "时间 格式:yyyy-MM-dd HH:ii:ss", dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "type", value = "类型,0查询当前时间,1查询历史时间",required = true, dataType = "Integer", paramType = "query"),
})
@GetMapping(value = "/getTrunkLineCrossProblem")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = TrunkLineCrossProblemVO.class),
})
public JsonViewObject getTrunkLineCrossProblem(Integer greenID, String time ,Integer type) {
try {
JsonViewObject object = JsonViewObject.newInstance();
List<TrunkLineCrossProblemEntity> list = trunkLineService.getTrunkLineCrossProblem(greenID,time,type);
return object.success(list);
} catch (Exception e) {
log.error("获取干线路口状态失败: ", e);
return JsonViewObject.newInstance().fail("获取干线路口状态失败");
}
}
}
package net.wanji.opt.controllerv2.comprehensivequery;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.entity.comprehensivequery.CrossLaneDataHistPoExtendName;
import net.wanji.opt.entity.comprehensivequery.GreenTreeEntity;
import net.wanji.opt.servicev2.comprehensivequery.ComprehensiveQueryService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.ws.rs.core.MediaType;
import java.util.ArrayList;
import java.util.List;
/**
* @author huangwm
* @date 2025/03/06 18:33
*/
@Api(value = "ComprehensiveQueryController", description = "综合查询", tags = "综合查询")
@RequestMapping("/ComprehensiveQuery")
@RestController
@Slf4j
public class ComprehensiveQueryController {
@Resource
private ComprehensiveQueryService comprehensiveQueryService;
@ApiOperation(value = "获取干线与路口树", notes = "获取干线与路口树", httpMethod="GET", response =JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/getGreenAndCross")
@ApiImplicitParams({
})
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = String.class),
})
public JsonViewObject getGreenAndCross() {
List<GreenTreeEntity> list = new ArrayList<>();
try {
list = comprehensiveQueryService.getGreenAndCross();
} catch (Exception e) {
log.error("综合查询-获取干线与路口树-查询失败:{}", e);
JsonViewObject.newInstance().success(list);
}
return JsonViewObject.newInstance().success(list);
}
@ApiOperation(value = "获取综合查询数据", notes = "获取综合查询数据", httpMethod="GET", response =JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/getComprehensiveQuery")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口id", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "startTime", value = "日期 格式:yyyy-MM-dd h:i:s", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "endTime", value = "日期 格式:yyyy-MM-dd h:i:s", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "objectType", value = "范围 0:路口级指标 1:方向级指标 2:转向级指标", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "groupType", value = "时间粒度 0--5分钟 1--15分钟 2--30分钟 3--60分钟", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "pageNum", value = "分页页码", required = true, dataType = "Integer", paramType = "query"),
@ApiImplicitParam(name = "pageSize", value = "分页数据条数", required = true, dataType = "Integer", paramType = "query"),
})
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = String.class),
})
public JsonViewObject getComprehensiveQuery(String crossId , String startTime ,String endTime ,String objectType ,String groupType,Integer pageNum,Integer pageSize) {
try {
JSONObject list = comprehensiveQueryService.getCrossStatusDistribution(crossId, startTime , endTime , objectType , groupType,pageNum,pageSize);
return JsonViewObject.newInstance().success(list);
} catch (Exception e) {
log.error("综合查询-综合查询数据-查询失败:{}", e);
return JsonViewObject.newInstance().success("");
}
}
}
package net.wanji.opt.controllerv2.evaluation;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.po.CrossDataHistPO;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem.AreaProblemOverview;
import net.wanji.opt.entity.judgeanalysis.AnalysisProblemCrossDay;
import net.wanji.opt.servicev2.evaluation.EvaluationInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.Map;
@RestController
@Slf4j
@RequestMapping("/evaluation-info")
@Api(value="EvaluationInfoController", description="方案评价信息接口", tags = "方案评价信息")
public class EvaluationInfoController {
@Autowired
EvaluationInfoService evaluationInfoService;
@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 = "/overview")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AreaProblemOverview.class),
})
public JsonViewObject problemOverview(String crossId,String startTime, String endTime,String contrastStartTime,String constrastEndTime) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try{
Map<String,Object> resData=evaluationInfoService.getListEvaluationSummarize(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 = "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"),
@ApiImplicitParam(name = "contrastStartTime", value = "对比时段开始时间", required = false, dataType = "string"),
@ApiImplicitParam(name = "constrastEndTime", value = "对比时段截止时间", required = false, dataType = "string"),
})
@GetMapping(value = "/overFlow")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AreaProblemOverview.class),
})
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( evenType, currentAlgo,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 = "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"),
@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 evenType,String currentAlgo,String crossId,String startTime, String endTime,String contrastStartTime,String constrastEndTime) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try{
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"));
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 = "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"),
@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 evenType,String currentAlgo,String crossId,String startTime, String endTime,String contrastStartTime,String constrastEndTime) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try{
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"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
}
package net.wanji.opt.controllerv2.evaluation;
import net.wanji.common.framework.Constants;
import net.wanji.common.framework.dubbointerface.BaseDubboInterface;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.framework.rest.AbstractRestServer;
import net.wanji.common.framework.dubbointerface.BaseDubboInterface;
import net.wanji.common.framework.exception.DubboProviderException;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.AbstractRestServer;
import net.wanji.common.framework.rest.impl.AbstractRestServerImpl;
import net.wanji.opt.servicev2.evaluation.EventInfoService;
import net.wanji.opt.entity.evaluation.EventInfo;
import net.wanji.common.framework.rest.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiImplicitParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
* 交通事件信息 接口API
* </p>
* @version 1.0
* @author wangtao
* @Date 2025-03-18
*/
@RestController
@Slf4j
@RequestMapping("/event-info")
@Api(value="EventInfoController", description="交通事件信息接口", tags = "交通事件信息")
public class EventInfoController extends AbstractRestServerImpl<EventInfo> implements AbstractRestServer<EventInfo>{
@Autowired
private EventInfoService eventInfoService;
@Override
public EventInfoService getBaseDubboInterface() {
return this.eventInfoService;
}
/**
* 获取所有交通事件信息记录
*
* @return JsonViewObject
*/
@ApiOperation(value = "交通事件信息-获取所有记录", notes = "获取所有交通事件信息记录", response = EventInfo.class, produces = MediaType.APPLICATION_JSON,hidden = true)
@GetMapping(value = "/byAll", produces = MediaType.APPLICATION_JSON)
@Override
public JsonViewObject getAll() {
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
List<EventInfo> list = this.getBaseDubboInterface().findAll();
jsonView.success(list);
} catch (DubboProviderException e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@ApiOperation(value = "交通事件信息-根据开始以及结束时间查询交通事件信息", notes = "获取所有交通事件信息记录", response = EventInfo.class, produces = MediaType.APPLICATION_JSON,hidden = false)
@ApiImplicitParams({
@ApiImplicitParam(name = "startTime", value = "开始时间", required = true, dataType = "String",defaultValue = ""),
@ApiImplicitParam(name = "endTime", value = "结束时间", required = true, dataType = "String",defaultValue = ""),
@ApiImplicitParam(name = "crossId", value = "路口id", required = true, dataType = "String",defaultValue = ""),
})
@GetMapping(value = "getListByStartAndEnd")
public JsonViewObject getListByStartAndEnd(String startTime, String endTime, String crossId){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
Map<String, Object> map = new HashMap<>();
map.put("startTime",startTime);
map.put("endTime",endTime);
map.put("crossId",crossId);
try {
List<Map<String,Object>> list = this.getBaseDubboInterface().getListByStartAndEnd(map);
jsonView.success(list);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
/**
* 根据id查询交通事件信息记录
*
* @param id
* @return JsonViewObject
*/
@ApiOperation(value = "交通事件信息-根据id查询记录", notes = "根据id查询交通事件信息记录", response = EventInfo.class, produces = MediaType.APPLICATION_JSON,hidden = true)
@GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON)
@Override
public JsonViewObject getById(@PathVariable String id) {
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
EventInfo entity = this.getBaseDubboInterface().findById(id);
jsonView.success(entity);
} catch (DubboProviderException e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("AbstractRestServerImpl getById error, id:{}", id, e);
}
return jsonView;
}
@ApiOperation(value = "交通事件信息-根据条件查询记录", notes = "根据条件查询记录", consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/byCondition", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@Override
public JsonViewObject getByWhere(@RequestBody EventInfo entity) {
return super.getByWhere(entity);
}
@ApiOperation(value = "交通事件信息-根据条件分页查询记录", notes = "根据条件分页查询记录", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = true)
@PostMapping(value = "/byPage", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ResponseBody
public JsonViewObject getPage(@RequestBody Page<EventInfo> page){
return super.getPage(page);
}
/**
* 根据id删除
*
* @param ids
* @return JsonViewObject
*/
@ApiOperation(value = "交通事件信息-根据多个id删除记录", notes = "根据多个id删除记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON ,hidden = true)
@ApiImplicitParams(value = {
@ApiImplicitParam(paramType = "query", name = "ids", dataType = "String", required = true, value = "多个记录id,用逗号分隔", example = "1,2")
})
@GetMapping(value = "/deleting", produces = MediaType.APPLICATION_JSON)
public JsonViewObject deleteByIds(String ids) {
return super.deleteByIds(ids);
}
/**
* 新建记录
*
* @param entity
* @return JsonViewObject
*/
@ApiOperation(value = "交通事件信息-新建记录", notes = "新建记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = true)
@PostMapping(value = "/creating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject save( @RequestBody EventInfo entity){
return super.save(entity);
}
/**
* 修改记录
*
* @param entity
* @return
*/
@ApiOperation(value = "交通事件信息-修改记录", notes = "修改记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = true)
@PostMapping(value = "/updating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject update(@RequestBody EventInfo entity){
return super.update(entity);
}
}
package net.wanji.opt.controllerv2.eventoptimize;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.*;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.crossproblem.CrossProblemDistributeAnalysisResult;
import net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo;
import net.wanji.opt.entity.eventoptimize.TEventOptimizeInfoVO;
import net.wanji.opt.servicev2.eventoptimize.TEventOptimizeInfoService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.ws.rs.core.MediaType;
@RestController
@Slf4j
@RequestMapping("/event-optimize-info")
@Api(value="TEventOptimizeInfoController", description="报警优化信息接口", tags = "报警优化信息")
public class TEventOptimizeInfoController {
@Resource
private TEventOptimizeInfoService tEventOptimizeInfoService;
// 新增接口用于调用带有条件的分页查询
@ApiOperation(value = "报警优化信息-事件优化记录查询-根据条件分页查询记录", notes = "根据条件分页查询记录", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false)
@ApiImplicitParams({
@ApiImplicitParam(name = "currentPage", value = "页数", required = true, dataType = "int",defaultValue = "1",example = "1"),
@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, dataType = "int",defaultValue = "10"),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String",defaultValue = "2025-03-21 00:00:00"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String",defaultValue = "2025-03-21 23:00:00"),
@ApiImplicitParam(name = "crossId", value = "路口id", required = false, dataType = "String",defaultValue = "",example = "13NAF0B5PH0"),
@ApiImplicitParam(name = "greenId", value = "干线id", required = false, dataType = "int",defaultValue = "",example = "4"),
})
@GetMapping("/selectPageWithCrossIdAndGreenId")
public JsonViewObject selectPageWithCrossIdAndGreenId(
@RequestParam int currentPage,
@RequestParam int pageSize,
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime,
@RequestParam(required = false) Integer greenId,
@RequestParam(required = false) String crossId) {
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
Page<TEventOptimizeInfoVO> retData = tEventOptimizeInfoService.selectPageWithCrossIdAndGreenId(currentPage, pageSize, startTime, endTime, crossId,greenId);
jsonView.success(retData);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@ApiOperation(value = "报警优化信息-根据条件分页查询记录", notes = "根据条件分页查询记录", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false)
@ApiImplicitParams({
@ApiImplicitParam(name = "currentPage", value = "页数", required = true, dataType = "int",defaultValue = "1",example = "1"),
@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, dataType = "int",defaultValue = "10"),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String",defaultValue = "2025-03-21 00:00:00"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String",defaultValue = "2025-03-21 23:00:00"),
@ApiImplicitParam(name = "crossId", value = "路口id", required = true, dataType = "String",defaultValue = "",example = "13MOD0B5SI0"),
@ApiImplicitParam(name = "eventType", value = "事件类型", required = false, dataType = "string", defaultValue = "1"),
@ApiImplicitParam(name = "optStatus", value = "优化状态", required = false, dataType = "integer", defaultValue = "1"),
@ApiImplicitParam(name = "duration", value = "持续时间", required = false, dataType = "integer", defaultValue = "1"),
@ApiImplicitParam(name = "startOptDuration", value = "优化开始时间", required = false, dataType = "integer", defaultValue = "0"),
@ApiImplicitParam(name = "endOptDuration", value = "优化结束时间", required = false, dataType = "integer"),
@ApiImplicitParam(name = "startDuration", value = "事件持续时长开始时间", required = false, dataType = "integer" ),
@ApiImplicitParam(name = "endDuration", value = "事件持续时长结束时间", required = false, dataType = "integer"),
})
@GetMapping("/pageWithConditions")
public JsonViewObject queryPageWithConditions(
@RequestParam int currentPage,
@RequestParam int pageSize,
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime,
@RequestParam(required = false) String crossId,
@RequestParam(required = false) String eventType,
@RequestParam(required = false) Integer optStatus,
@RequestParam(required = false) Integer duration,
@RequestParam(required=false) Integer startOptDuration,
@RequestParam(required=false) Integer endOptDuration,
@RequestParam(required = false) Integer startDuration,
@RequestParam(required = false) Integer endDuration
) {
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
Page<TEventOptimizeInfo> retData = tEventOptimizeInfoService.queryPageWithConditions(currentPage, pageSize, startTime, endTime, crossId,eventType,optStatus,duration,startOptDuration,endOptDuration,startDuration,endDuration);
jsonView.success(retData);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@ApiOperation(value = "路口事件数按事件数/持续时间分布情况", notes = "路口事件数按事件数/持续时间分布情况", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "greenId", value = "干线ID", required = false, dataType = "String"),
@ApiImplicitParam(name = "crossId", value = "路口ID", required = false, dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "查询截止时间,格式yyyy-MM-dd HH:mm:ss", required = true, dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "查询截止时间,格式yyyy-MM-dd HH:mm:ss", required = true, dataType = "String"),
@ApiImplicitParam(name = "groupType", value = "时间粒度类型 0:5分钟粒度 1:15分钟粒度 2:30分钟粒度 3:小时粒度 4:天粒度", required = true, dataType = "Integer",defaultValue = "1"),
})
@GetMapping(value = "/getCrossOptimizeDistribute")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossProblemDistributeAnalysisResult.class),
})
public JsonViewObject getCrossOptimizeDistribute(
@RequestParam(required = false) Integer greenId,
@RequestParam(required = false) String crossId,
@RequestParam String startTime,
@RequestParam String endTime,
@RequestParam Integer groupType) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
JSONObject result = tEventOptimizeInfoService.getCrossOptimizeDistribute(greenId,crossId,startTime,endTime,groupType);
return jsonViewObject.success(result);
} catch (Exception e) {
log.error("路口事件数按事件数/持续时间分布情况", e);
return jsonViewObject.fail("路口事件数按事件数/持续时间分布情况失败");
}
}
// 新增绿波干线接口用于调用带有条件的分页查询
@ApiOperation(value = "报警优化干线信息-根据条件分页查询记录", notes = "根据条件分页查询记录", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false)
@ApiImplicitParams({
@ApiImplicitParam(name = "currentPage", value = "页数", required = true, dataType = "int",defaultValue = "1",example = "1"),
@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, dataType = "int",defaultValue = "10"),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyy-MM-dd HH:mm:ss", required = false, dataType = "String",defaultValue = "2025-03-21 00:00:00"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyy-MM-dd HH:mm:ss", required = false, dataType = "String",defaultValue = "2025-03-21 23:00:00"),
@ApiImplicitParam(name = "greenId", value = "绿波干线", required = true, dataType = "integer", defaultValue = "1"),
@ApiImplicitParam(name = "eventType", value = "事件类型", required = false, dataType = "string", defaultValue = "1"),
@ApiImplicitParam(name = "optStatus", value = "优化状态", required = false, dataType = "integer", defaultValue = "1"),
@ApiImplicitParam(name = "duration", value = "持续时间", required = false, dataType = "integer", defaultValue = "1"),
@ApiImplicitParam(name = "startOptDuration", value = "优化开始时间", required = false, dataType = "integer", defaultValue = "1"),
@ApiImplicitParam(name = "endOptDuration", value = "优化结束时间", required = false, dataType = "integer"),
@ApiImplicitParam(name = "startDuration", value = "事件持续时长开始时间", required = false, dataType = "integer"),
@ApiImplicitParam(name = "endDuration", value = "事件持续时长结束时间", required = false, dataType = "integer"),
})
@GetMapping("/pageWithLineConditions")
public JsonViewObject pageWithLineConditions(
@RequestParam int currentPage,
@RequestParam int pageSize,
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime,
@RequestParam(required = false) Integer greenId,
@RequestParam(required = false) String eventType,
@RequestParam(required = false) Integer optStatus,
@RequestParam(required = false) Integer duration,
@RequestParam(required=false) Integer startOptDuration,
@RequestParam(required=false) Integer endOptDuration,
@RequestParam(required = false) Integer startDuration,
@RequestParam(required = false) Integer endDuration
){
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
Page<TEventOptimizeInfo> retLineData=tEventOptimizeInfoService.pageWithLineConditions(currentPage, pageSize, startTime, endTime, greenId,eventType,optStatus,duration,startOptDuration,endOptDuration,startDuration,endDuration);
jsonView.success(retLineData);
}catch (Exception e){
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
}
\ No newline at end of file
package net.wanji.opt.controllerv2.hikvideo;
import com.alibaba.fastjson.JSONObject;
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig;
import java.util.*;
public class GetCameraPreviewURL {
public static String GetCameraPreviewURL(String cameraIndexCode,String beginTime,String endTime,String recordLocation) {
/**
* STEP1:设置平台参数,根据实际情况,设置host appkey appsecret 三个参数.
*/
ArtemisConfig.host = "37.10.253.17:443"; // 平台的ip端口
ArtemisConfig.appKey = "26868396"; // 密钥appkey
ArtemisConfig.appSecret = "HYD9kdmg8pxy96xfZB7T";// 密钥appSecret
/**
* STEP2:设置OpenAPI接口的上下文
*/
final String ARTEMIS_PATH = "/artemis";
/**
* STEP3:设置接口的URI地址
*/
final String previewURLsApi = ARTEMIS_PATH + "/api/video/v1/cameras/playbackURLs";
Map<String, String> path = new HashMap<String, String>(2) {
{
put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
}
};
/**
* STEP4:设置参数提交方式
*/
String contentType = "application/json";
/**
* STEP5:组装请求参数
*/
JSONObject jsonBody = new JSONObject();
jsonBody.put("cameraIndexCode", cameraIndexCode);
jsonBody.put("beginTime", beginTime);
jsonBody.put("endTime", endTime);
jsonBody.put("recordLocation", recordLocation);
jsonBody.put("protocol", "rtsp");
jsonBody.put("needReturnClipInfo", true);
jsonBody.put("uuid", "");
jsonBody.put("expand", "transCode=0");
String body = jsonBody.toJSONString();
/**
* STEP6:调用接口
*/
String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , null);// post请求application/json类型参数
return result;
}
public static void main(String[] args) {
String result = GetCameraPreviewURL("3ceaf62b4bfc471da75c9c18efaec009","2025-03-20T00:00:00.000+08:00","2025-03-20T00:00:05.000+08:00","0");
System.out.println("result结果示例: " + result);
}
}
package net.wanji.opt.controllerv2.hikvideo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HikVideoController {
@RequestMapping("/test")
public void getHikVideo(String crossId){
}
}
package net.wanji.opt.controllerv2.judgeanalysis;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.greenproblem.GreenProblemTimeDirReasonResult;
import net.wanji.opt.entity.judgeanalysis.AiOptimizeStatistic;
import net.wanji.opt.servicev2.judgeanalysis.AiOptimizeStatisticService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import net.wanji.opt.api.ResultGenerator;
import javax.validation.Valid;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.Map;
/**
* <p>
* AI优化时长 前端控制器
* </p>
*
* @author fengyi
* @since 2025-03-24
*/
@Api(tags = "AI优化时长")
@RestController
@RequestMapping("/ai-optimize-statistic")
@Slf4j
public class AiOptimizeStatisticController {
@Autowired
private AiOptimizeStatisticService aiOptimizeStatisticService;
@ApiOperation(value = "AI优化时长详情", response = AiOptimizeStatistic.class)
@GetMapping(value = "/info/{id}")
public Object info(@PathVariable Long id) {
Object data = aiOptimizeStatisticService.info(id);
return ResultGenerator.genSuccessResult(data);
}
@ApiOperation(value = "AI优化时长新增")
@PostMapping(value = "/add")
public Object add(@Valid @RequestBody AiOptimizeStatistic param) {
aiOptimizeStatisticService.add(param);
return ResultGenerator.genSuccessResult();
}
@ApiOperation(value = "AI优化时长修改")
@PostMapping(value = "/modify")
public Object modify(@Valid @RequestBody AiOptimizeStatistic param) {
aiOptimizeStatisticService.modify(param);
return ResultGenerator.genSuccessResult();
}
@ApiOperation(value = "AI优化时长删除(单个条目)")
@GetMapping(value = "/remove/{id}")
public Object remove(@PathVariable Long id) {
aiOptimizeStatisticService.remove(id);
return ResultGenerator.genSuccessResult();
}
@ApiOperation(value = "AI优化时长删除(多个条目)")
@PostMapping(value = "/removes")
public Object removes(@Valid @RequestBody List<Long> ids) {
aiOptimizeStatisticService.removes(ids);
return ResultGenerator.genSuccessResult();
}
@ApiOperation(value = "绿波干线-绿波优化次数", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiImplicitParams({
@ApiImplicitParam(name = "greenId", value = "绿波干线", required = true, dataType = "string", defaultValue = "1"),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250317"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250318"),
})
@GetMapping(value = "/optimize")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenProblemTimeDirReasonResult.class),
})
public JsonViewObject detail(String greenId,Integer startTime, Integer endTime) {
JsonViewObject jsonView =JsonViewObject.newInstance();
try {
Map<String,Object> resDate = aiOptimizeStatisticService.greenOptimizeByTimeTrend(greenId,startTime,endTime);
jsonView.success(resDate);
}catch (Exception e){
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
}
\ No newline at end of file
package net.wanji.opt.controllerv2.judgeanalysis;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem.AreaCrossProblemAnalysisResult;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem.AreaGreenProblemAnalysisResult;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem.AreaProblemOverview;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem.AreaProblemTrendAnalysisResult;
import net.wanji.opt.entity.judgeanalysis.AnalysisProblemCrossDay;
import net.wanji.opt.servicev2.judgeanalysis.AnalysisProblemAreaDayService;
import net.wanji.opt.servicev2.judgeanalysis.AnalysisProblemCrossDayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
* 绿波问题分析 前端控制器
* </p>
*
* @author fengyi
* @since 2025-03-13
*/
@Api(tags = "研判分析-区域问题分析")
@Slf4j
@RestController
@RequestMapping("/analysis-area-problem")
public class AnalysisProblemAreaDayController {
@Autowired
private AnalysisProblemAreaDayService analysisProblemAreaDayService;
@ApiOperation(value = "区域-问题数量总览", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/overview")
@ApiImplicitParams({
@ApiImplicitParam(name = "areaId", value = "区域ID", required = true, dataType = "String", defaultValue = "12"),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250317"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250318"),
})
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AreaProblemOverview.class),
})
public JsonViewObject areaProblemOverview(Integer areaId, Integer startTime, Integer endTime) {
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
List<AnalysisProblemCrossDay> list = analysisProblemAreaDayService.selectCountByType(areaId,startTime,endTime);
jsonView.success(list);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@ApiOperation(value = "区域-问题数量趋势分析", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/trend")
@ApiImplicitParams({
@ApiImplicitParam(name = "areaId", value = "区域ID", required = true, dataType = "Integer", defaultValue = "12"),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250317"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250318"),
})
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AreaProblemTrendAnalysisResult.class),
})
public JsonViewObject trend(Integer areaId, Integer startTime, Integer endTime) {
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
Map<String,Object> retData = analysisProblemAreaDayService.selectAreaProblemTrend(areaId,startTime,endTime);
jsonView.success(retData);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@ApiOperation(value = "区域-路口问题数量分析", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiImplicitParams({
@ApiImplicitParam(name = "eventType", value = "事件代码 701:路口空放 702:路口失衡,703:路口溢出 707:路口拥堵", required = true, dataType = "String", defaultValue = ""),
@ApiImplicitParam(name = "areaId", value = "区域ID", required = true, dataType = "String", defaultValue = "12"),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250317"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250318"),
})
@GetMapping(value = "/cross-problem-number")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AreaCrossProblemAnalysisResult.class),
})
public JsonViewObject crossProblemNumber(String eventType, Integer areaId, Integer startTime, Integer endTime) {
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
List<Map<String,Object>> retData = analysisProblemAreaDayService.selectCrossAllProblemNums(eventType,areaId,startTime,endTime);
jsonView.success(retData);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@ApiOperation(value = "区域-干线问题数量分析", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiImplicitParams({
@ApiImplicitParam(name = "eventType", value = "事件代码 705:干线缓行 706:干线拥堵 ", required = true, dataType = "String", defaultValue = ""),
@ApiImplicitParam(name = "areaId", value = "区域ID", required = true, dataType = "String", defaultValue = "12"),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250317"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250318"),
})
@GetMapping(value = "/green-problem-number")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AreaGreenProblemAnalysisResult.class),
})
public JsonViewObject greenProblemNumber(String eventType, Integer areaId, Integer startTime, Integer endTime) {
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
List<Map<String,Object>> retData = analysisProblemAreaDayService.selectGreenAllProblemNums(eventType,areaId,startTime,endTime);
jsonView.success(retData);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
}
package net.wanji.opt.controllerv2.judgeanalysis;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem.AreaProblemOverview;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem.AreaProblemTrendAnalysisResult;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.crossproblem.CrossDirProblemTrendAnalysisResult;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.crossproblem.CrossProblemDirTrendAnalysisResult;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.crossproblem.CrossProblemDistributeAnalysisResult;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.crossproblem.CrossProblemTimeDirReasonResult;
import net.wanji.opt.entity.judgeanalysis.AnalysisProblemCrossDay;
import net.wanji.opt.servicev2.judgeanalysis.AnalysisProblemCrossDayService;
import net.wanji.opt.vo2.CrossOptAnalysisVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.Map;
/**
* <p>
* 路口问题分析 前端控制器
* </p>
*
* @author fengyi
* @since 2025-03-13
*/
@Api(tags = "研判分析-路口问题分析")
@RestController
@RequestMapping("/analysis-problem-cross-day")
@Slf4j
public class AnalysisProblemCrossDayController {
@Resource
private AnalysisProblemCrossDayService analysisProblemCrossDayService;
@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 = "timeType", value = "事件类型 1:近一个月 2:近一周", required = true, dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "startTime", value = "开始时间", required = false, dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", required = false, dataType = "String"),
})
@GetMapping(value = "/overview")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AreaProblemOverview.class),
})
public JsonViewObject problemOverview(String crossId,Integer startTime, Integer endTime) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try{
List<AnalysisProblemCrossDay> list=analysisProblemCrossDayService.getListSingleByStartAndEnd(crossId,startTime,endTime);
jsonViewObject.success(list);
}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", defaultValue = "13MNM0B5OR0"),
// @ApiImplicitParam(name = "timeType", value = "事件类型 1:近一个月 2:近一周", required = true, dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250317"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250318"),
})
@GetMapping(value = "/trend")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AreaProblemTrendAnalysisResult.class),
})
public JsonViewObject trend(String crossId,Integer startTime, Integer endTime) {
JsonViewObject jsonView=JsonViewObject.newInstance();
try{
Map<String,Object> resDate=analysisProblemCrossDayService.selectSingerByProblemTrend(crossId,startTime,endTime);
jsonView.success(resDate);
}catch (Exception e){
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@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 = "timeType", value = "事件类型 1:近一个月 2:近一周", required = true, dataType = "Integer", defaultValue = "1"),
})
@GetMapping(value = "/detail")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossProblemTimeDirReasonResult.class),
})
public JsonViewObject detail(String crossId,String timeType) {
return JsonViewObject.newInstance().success(null);
}
@ApiOperation(value = "单路口-各方向问题情况分布", response = CrossProblemDirTrendAnalysisResult.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口ID", required = true, dataType = "String"),
// @ApiImplicitParam(name = "timeType", value = "事件类型 1:近一个月 2:近一周", required = true, dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "eventType", value = "事件代码 701:空放 702:路口失衡,703:路口溢出 707:路口拥堵", required = true, dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250317"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250318"),
})
@GetMapping(value = "/dir-trend")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossDirProblemTrendAnalysisResult.class),
})
public JsonViewObject dirTrend(String crossId,String eventType,Integer startTime, Integer endTime) {
return JsonViewObject.newInstance().success(null);
}
@ApiOperation(value = "路口报警优化分析", notes = "路口报警优化分析", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossID", value = "路口ID", required = true, dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "日期,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "日期,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String"),
})
@GetMapping(value = "/getCrossOptAnalysis")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossOptAnalysisVO.class),
})
public JsonViewObject getCrossOptAnalysis(String crossID, String startTime,String endTime) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
CrossOptAnalysisVO info = analysisProblemCrossDayService.getCrossOptAnalysis(crossID, startTime,endTime);
return jsonViewObject.success(info);
} catch (Exception e) {
log.error("获取路口优化分析失败", e);
return jsonViewObject.fail("获取路口优化分析失败");
}
}
@ApiOperation(value = "路口事件数按事件数/持续时间分布情况", notes = "路口事件数按事件数/持续时间分布情况", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口ID", required = true, dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "查询截止时间,格式yyyy-MM-dd HH:mm:ss", required = true, dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "查询截止时间,格式yyyy-MM-dd HH:mm:ss", required = true, dataType = "String"),
@ApiImplicitParam(name = "groupType", value = "时间粒度类型 0:5分钟粒度 1:15分钟粒度 2:30分钟粒度 3:小时粒度 4:天粒度", required = true, dataType = "Integer",defaultValue = "1"),
})
@GetMapping(value = "/getCrossOptimizeDistribute")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossProblemDistributeAnalysisResult.class),
})
public JsonViewObject getCrossOptimizeDistribute(String crossId, String startTime, String endTime, String groupType) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
return jsonViewObject.success();
} catch (Exception e) {
log.error("路口事件数按事件数/持续时间分布情况", e);
return jsonViewObject.fail("路口事件数按事件数/持续时间分布情况失败");
}
}
}
\ No newline at end of file
package net.wanji.opt.controllerv2.judgeanalysis;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.crossproblem.CrossDirProblemTrendAnalysisResult;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.crossproblem.CrossProblemDirTrendAnalysisResult;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.crossproblem.CrossProblemTimeDirReasonResult;
import net.wanji.opt.entity.judgeanalysis.AnalysisProblemCrossDirHour;
import net.wanji.opt.servicev2.judgeanalysis.AnalysisProblemCrossDirHourService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import net.wanji.opt.api.ResultGenerator;
import javax.validation.Valid;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.Map;
/**
* <p>
* 路口方向按小时粒度问题分析 前端控制器
* </p>
*
* @author fengyi
* @since 2025-03-20
*/
@Api(tags = "路口方向按小时粒度问题分析")
@RestController
@RequestMapping("/analysis-problem-cross-dir-hour")
@Slf4j
public class AnalysisProblemCrossDirHourController {
@Autowired
private AnalysisProblemCrossDirHourService analysisProblemCrossDirHourService;
@ApiOperation(value = "路口方向按小时粒度问题分析详情", response = AnalysisProblemCrossDirHour.class)
@GetMapping(value = "/info/{id}")
public Object info(@PathVariable Long id) {
Object data = analysisProblemCrossDirHourService.info(id);
return ResultGenerator.genSuccessResult(data);
}
@ApiOperation(value = "路口方向按小时粒度问题分析新增")
@PostMapping(value = "/add")
public Object add(@Valid @RequestBody AnalysisProblemCrossDirHour param) {
analysisProblemCrossDirHourService.add(param);
return ResultGenerator.genSuccessResult();
}
@ApiOperation(value = "路口方向按小时粒度问题分析修改")
@PostMapping(value = "/modify")
public Object modify(@Valid @RequestBody AnalysisProblemCrossDirHour param) {
analysisProblemCrossDirHourService.modify(param);
return ResultGenerator.genSuccessResult();
}
@ApiOperation(value = "路口方向按小时粒度问题分析删除(单个条目)")
@GetMapping(value = "/remove/{id}")
public Object remove(@PathVariable Long id) {
analysisProblemCrossDirHourService.remove(id);
return ResultGenerator.genSuccessResult();
}
@ApiOperation(value = "路口方向按小时粒度问题分析删除(多个条目)")
@PostMapping(value = "/removes")
public Object removes(@Valid @RequestBody List<Long> ids) {
analysisProblemCrossDirHourService.removes(ids);
return ResultGenerator.genSuccessResult();
}
@ApiOperation(value = "单路口-各方向问题情况分布", response = CrossProblemDirTrendAnalysisResult.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口ID", required = true, dataType = "String"),
@ApiImplicitParam(name = "eventType", value = "事件代码 701:空放 702:路口失衡,703:路口溢出 707:路口拥堵", required = true, dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250317"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250318"),
})
@GetMapping(value = "/dir-trend")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossDirProblemTrendAnalysisResult.class),
})
public JsonViewObject dirTrend(String crossId, String eventType, Integer startTime, Integer endTime) {
JsonViewObject jsonView=JsonViewObject.newInstance();
try{
Map<String,Object> resDate=analysisProblemCrossDirHourService.directionByProblemTrend(crossId,eventType,startTime,endTime);
jsonView.success(resDate);
}catch (Exception e){
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@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 = "timeType", value = "事件类型 1:近一个月 2:近一周", required = true, dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250317"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250318"),
@ApiImplicitParam(name = "eventType", value = "事件代码 701:空放 702:路口失衡,703:路口溢出 707:路口拥堵", required = true, dataType = "String"),
})
@GetMapping(value = "/detail")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossProblemTimeDirReasonResult.class),
})
public JsonViewObject detail(String crossId,String eventType,Integer startTime, Integer endTime) {
JsonViewObject jsonView=JsonViewObject.newInstance();
try{
Map<String,Object> resDate=analysisProblemCrossDirHourService.crossingHappyByProblemTrend(crossId,eventType,startTime,endTime);
jsonView.success(resDate);
}catch (Exception e){
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
}
\ No newline at end of file
package net.wanji.opt.controllerv2.judgeanalysis;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem.AreaProblemOverview;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem.AreaProblemTrendAnalysisResult;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.crossproblem.CrossProblemDirTrendAnalysisResult;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.greenproblem.GreenCrossProblemTrendAnalysisResult;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.greenproblem.GreenProblemTimeDirReasonResult;
import net.wanji.opt.entity.judgeanalysis.AnalysisProblemGreenDay;
import net.wanji.opt.servicev2.judgeanalysis.AnalysisProblemCrossDayService;
import net.wanji.opt.servicev2.judgeanalysis.AnalysisProblemGreenDayService;
import net.wanji.opt.vo2.CrossOptAnalysisVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.Map;
/**
* <p>
* 绿波问题分析 前端控制器
* </p>
*
* @author fengyi
* @since 2025-03-13
*/
@Api(tags = "研判分析-绿波问题分析")
@RestController
@RequestMapping("/analysis-problem-green-day")
@Slf4j
public class AnalysisProblemGreenDayController {
@Autowired
private AnalysisProblemGreenDayService analysisProblemGreenDayService;
@Resource
private AnalysisProblemCrossDayService analysisProblemCrossDayService;
@ApiOperation(value = "绿波干线-问题数量总览", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiImplicitParams({
@ApiImplicitParam(name = "greenId", value = "绿波干线", required = true, dataType = "Integer"),
// @ApiImplicitParam(name = "timeType", value = "事件类型 1:近一个月 2:近一周", required = false, dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250317"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250318"),
})
@GetMapping(value = "/overview")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AreaProblemOverview.class),
})
public JsonViewObject problemOverview(Integer greenId,Integer startTime,Integer endTime) {
JsonViewObject jsonView= JsonViewObject.newInstance();
try {
List<AnalysisProblemGreenDay> list= analysisProblemGreenDayService.getListGreenByProblemSum(greenId,startTime,endTime);
jsonView.success(list);
}catch (Exception e){
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@ApiOperation(value = "绿波干线-报警走势", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiImplicitParams({
@ApiImplicitParam(name = "greenId", value = "绿波干线", required = true, dataType = "Integer"),
// @ApiImplicitParam(name = "timeType", value = "事件类型 1:近一个月 2:近一周", required = false, dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250317"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250318"),
})
@GetMapping(value = "/trend")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AreaProblemTrendAnalysisResult.class),
})
public JsonViewObject trend(Integer greenId,Integer startTime, Integer endTime) {
JsonViewObject jsonView=JsonViewObject.newInstance();
try{
Map<String,Object> resDate=analysisProblemGreenDayService.getListGreenByProblemTrend(greenId,startTime,endTime);
jsonView.success(resDate);
}catch (Exception e){
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@ApiOperation(value = "绿波干线-问题发生时段、方向、原因分析", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiImplicitParams({
@ApiImplicitParam(name = "greenId", value = "绿波干线", required = true, dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250317"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250318"),
})
@GetMapping(value = "/detail")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenProblemTimeDirReasonResult.class),
})
public JsonViewObject detail(Integer greenId,String timeType) {
return JsonViewObject.newInstance().success(null);
}
@ApiOperation(value = "绿波干线-干线路口问题情况分布",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiImplicitParams({
@ApiImplicitParam(name = "greenId", value = "绿波干线", required = true, dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "timeType", value = "事件类型 1:近一个月 2:近一周", required = false, dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "eventType", value = "事件代码 701:空放 702:路口失衡,703:路口溢出 707:路口拥堵", required = true, dataType = "String", defaultValue = "705"),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250317"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250318"),
})
@GetMapping(value = "/cross-trend")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenCrossProblemTrendAnalysisResult.class),
})
public JsonViewObject dirTrend(Integer greenId,String timeType,String eventType) {
return JsonViewObject.newInstance().success(null);
}
@ApiOperation(value = "干线报警优化分析概览【左侧】", notes = "干线报警优化分析", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "greenId", value = "greenId", required = true, dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "日期,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "日期,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String"),
})
@GetMapping(value = "/getGreenOptAnalysis")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossOptAnalysisVO.class),
})
public JsonViewObject getGreenOptAnalysis(String greenId, String startTime,String endTime) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
CrossOptAnalysisVO info = analysisProblemGreenDayService.getGreenOptAnalysis(greenId, startTime,endTime);
return jsonViewObject.success(info);
} catch (Exception e) {
log.error("获取路口优化分析失败", e);
return jsonViewObject.fail("获取路口优化分析失败");
}
}
}
\ No newline at end of file
package net.wanji.opt.controllerv2.judgeanalysis;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.greenproblem.GreenCrossProblemTrendAnalysisResult;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.greenproblem.GreenProblemTimeDirReasonResult;
import net.wanji.opt.entity.judgeanalysis.AnalysisProblemGreenHour;
import net.wanji.opt.servicev2.judgeanalysis.AnalysisProblemGreenHourService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import net.wanji.opt.api.ResultGenerator;
import javax.validation.Valid;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.Map;
/**
* <p>
* 干线按小时粒度问题分析 前端控制器
* </p>
*
* @author fengyi
* @since 2025-03-21
*/
@Api(tags = "干线按小时粒度问题分析")
@RestController
@RequestMapping("/analysis-problem-green-hour")
@Slf4j
public class AnalysisProblemGreenHourController {
@Autowired
private AnalysisProblemGreenHourService analysisProblemGreenHourService;
@ApiOperation(value = "干线按小时粒度问题分析详情", response = AnalysisProblemGreenHour.class)
@GetMapping(value = "/info/{id}")
public Object info(@PathVariable Long id) {
Object data = analysisProblemGreenHourService.info(id);
return ResultGenerator.genSuccessResult(data);
}
@ApiOperation(value = "干线按小时粒度问题分析新增")
@PostMapping(value = "/add")
public Object add(@Valid @RequestBody AnalysisProblemGreenHour param) {
analysisProblemGreenHourService.add(param);
return ResultGenerator.genSuccessResult();
}
@ApiOperation(value = "干线按小时粒度问题分析修改")
@PostMapping(value = "/modify")
public Object modify(@Valid @RequestBody AnalysisProblemGreenHour param) {
analysisProblemGreenHourService.modify(param);
return ResultGenerator.genSuccessResult();
}
@ApiOperation(value = "干线按小时粒度问题分析删除(单个条目)")
@GetMapping(value = "/remove/{id}")
public Object remove(@PathVariable Long id) {
analysisProblemGreenHourService.remove(id);
return ResultGenerator.genSuccessResult();
}
@ApiOperation(value = "干线按小时粒度问题分析删除(多个条目)")
@PostMapping(value = "/removes")
public Object removes(@Valid @RequestBody List<Long> ids) {
analysisProblemGreenHourService.removes(ids);
return ResultGenerator.genSuccessResult();
}
@ApiOperation(value = "绿波干线-干线路口问题情况分布",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiImplicitParams({
@ApiImplicitParam(name = "greenId", value = "绿波干线", required = true, dataType = "Integer", defaultValue = "1"),
// @ApiImplicitParam(name = "timeType", value = "事件类型 1:近一个月 2:近一周", required = false, dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "eventType", value = "事件代码 701:空放 702:路口失衡,703:路口溢出 707:路口拥堵", required = true, dataType = "String", defaultValue = "705"),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250317"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250318"),
})
@GetMapping(value = "/cross-trend")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenCrossProblemTrendAnalysisResult.class),
})
public JsonViewObject dirTrend(Integer greenId, String eventType,Integer startTime, Integer endTime) {
JsonViewObject jsonView = JsonViewObject.newInstance();
try{
Map<String,Object> resDate= analysisProblemGreenHourService.directionGreenByProblemTrend(greenId,eventType,startTime,endTime);
jsonView.success(resDate);
}catch (Exception e){
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@ApiOperation(value = "绿波干线-问题发生时段、方向、原因分析", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiImplicitParams({
@ApiImplicitParam(name = "greenId", value = "绿波干线", required = true, dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250317"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250318"),
@ApiImplicitParam(name = "eventType", value = "事件代码 701:空放 702:路口失衡,703:路口溢出 707:路口拥堵", required = true, dataType = "String", defaultValue = "705"),
})
@GetMapping(value = "/detail")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenProblemTimeDirReasonResult.class),
})
public JsonViewObject detail(Integer greenId,String eventType,Integer startTime, Integer endTime) {
JsonViewObject jsonView =JsonViewObject.newInstance();
try {
Map<String,Object>resDate = analysisProblemGreenHourService.detailGreenByProblemTrend(greenId,eventType,startTime,endTime);
jsonView.success(resDate);
}catch (Exception e){
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
}
\ No newline at end of file
package net.wanji.opt.controllerv2.judgeanalysis;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.crosssignal.CrossSignalPlanReasonResult;
import net.wanji.opt.servicev2.judgeanalysis.CrossSignalPlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.ws.rs.core.MediaType;
/**
* <p>
* 路口信号方案
* </p>
*/
@RestController
@Slf4j
@RequestMapping("/cross-signal-plan")
@Api(value="CrossSignalPlanController", description="路口信号方案查询", tags = "路口信号方案查询")
public class CrossSignalPlanController {
@Autowired
private CrossSignalPlanService crossSignalPlanService;
@ApiOperation(value = "路口信号方案查询",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口ID", required = true, dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyy-MM-dd HH:mm:ss", required = false, dataType = "Integer", defaultValue = "2025-03-17 00:00:00"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyy-MM-dd HH:mm:ss", required = false, dataType = "Integer", defaultValue = "2025-03-19 00:00:00"),
})
@GetMapping(value = "/getByDateScope")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossSignalPlanReasonResult.class),
})
public JsonViewObject getByDateScope(String crossId,String startTime,String endTime) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
JSONObject jsonObject = crossSignalPlanService.getByDateScope(crossId,startTime,endTime);
return jsonViewObject.success(jsonObject);
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
}
package net.wanji.opt.controllerv2.judgeanalysis.design.response;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ParentResult {
@ApiModelProperty(value = "响应状态")
private String status;
@ApiModelProperty(value = "响应状态描述",dataType = "String")
private String message;
@ApiModelProperty(value = "响应数据体")
private Object content;
@ApiModelProperty(value = "响应状态码")
private Integer code;
@ApiModelProperty(value = "响应时间戳")
private Long timestamp;
}
package net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import java.util.List;
@Data
public class AreaCrossProblemAnalysisResult extends ParentResult {
private List<CrossProblemAnalysisResultResponse> content;
public List<CrossProblemAnalysisResultResponse> getContent() {
return content;
}
public AreaCrossProblemAnalysisResult setContent( List<CrossProblemAnalysisResultResponse> content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class CrossProblemAnalysisResultResponse {
@ApiModelProperty(value = "路口ID",example = "13LBF0B5SP0")
private String crossId ;
@ApiModelProperty(value = "路口名称",example = "经十西路与经十路交叉口")
private String crossName ;
@ApiModelProperty(value = "事件代码 701:空放 702:路口失衡,703:路口溢出 707:路口拥堵",example = "'707'",dataType = "String")
private String eventType ;
@ApiModelProperty(value = "事件类型名称",example = "路口拥堵")
private String eventLabel ;
@ApiModelProperty(value = "事件问题数量",example = "2",dataType = "Integer")
private Integer number ;
}
package net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import java.util.List;
@Data
public class AreaGreenProblemAnalysisResult extends ParentResult {
private List<GreenProblemAnalysisResultResponse> content;
public List<GreenProblemAnalysisResultResponse> getContent() {
return content;
}
public AreaGreenProblemAnalysisResult setContent( List<GreenProblemAnalysisResultResponse> content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class GreenProblemAnalysisResultResponse {
@ApiModelProperty(value = "绿波干线ID",example = "2")
private Integer greenId ;
@ApiModelProperty(value = "绿波干线名称",example = "经十路(舜耕路-山大路)")
private String greenName ;
@ApiModelProperty(value = "事件代码 705:干线缓行 706:干线拥堵",example = "'707'" , dataType = "String")
private String eventType ;
@ApiModelProperty(value = "事件类型名称",example = "路口拥堵")
private String eventLabel ;
@ApiModelProperty(value = "事件问题数量",example = "2")
private Integer number ;
}
package net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import java.util.List;
@Data
public class AreaProblemOverview extends ParentResult {
private List<EventAnalysisResultResponse> content;
public List<EventAnalysisResultResponse> getContent() {
return content;
}
public AreaProblemOverview setContent( List<EventAnalysisResultResponse> content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class EventAnalysisResultResponse {
@ApiModelProperty(value = "事件代码 701:空放 702:路口失衡,703:路口溢出 705:干线缓行 706:干线拥堵 707:路口拥堵",example = "'707'",dataType = "string")
private String eventType ;
@ApiModelProperty(value = "事件类型名称",example = "路口拥堵")
private String eventLabel ;
@ApiModelProperty(value = "问题数量",example = "1")
private Integer number;
}
package net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import java.util.ArrayList;
import java.util.List;
@Data
public class AreaProblemTrendAnalysisResult extends ParentResult {
private ProblemTrendAnalysisResultResponse content;
public ProblemTrendAnalysisResultResponse getContent() {
return content;
}
public AreaProblemTrendAnalysisResult setContent( ProblemTrendAnalysisResultResponse content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class ProblemTrendAnalysisResultResponse {
@ApiModelProperty(value = "时段列表,天粒度格式:yyyyMMdd,(小时/分钟)粒度格式:HH:mm",example = "[\"20250311\",\"20250312\"]",dataType = "String[]")
private List<String> timeList = new ArrayList<>();
// @ApiModelProperty(value = "各路口时段流量列表",
// example = "[{\"name\":\"路口1\",\"list\":[150,300]}," +
// "{\"name\":\"路口2\",\"list\":[150,300]}]")
private List<ProblemTrendAnalysisResultTimeFlow> dataList=new ArrayList<>();
}
package net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author fengyi
* @date 2025/3/17
* @description
*/
@Data
public class ProblemTrendAnalysisResultTimeFlow {
@ApiModelProperty(value = "事件代码 701:空放 702:路口失衡,703:路口溢出 705:干线缓行 706:干线拥堵 707:路口拥堵",example = "'707'",dataType = "string")
private String eventType ;
@ApiModelProperty(value = "事件类型名称",example = "路口拥堵")
private String eventLabel ;
@ApiModelProperty(value = "时段事件数量,时段对应到timeList",example = "[300,400]",dataType = "int[]")
private List<Integer> list ;
}
package net.wanji.opt.controllerv2.judgeanalysis.design.response.crossproblem;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem.AreaProblemTrendAnalysisResult;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem.ProblemTrendAnalysisResultTimeFlow;
import java.util.ArrayList;
import java.util.List;
@Data
public class CrossDirProblemTrendAnalysisResult extends ParentResult {
private CrossDirProblemTrendAnalysisResultResponse content;
public CrossDirProblemTrendAnalysisResultResponse getContent() {
return content;
}
public CrossDirProblemTrendAnalysisResult setContent(CrossDirProblemTrendAnalysisResultResponse content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class CrossDirProblemTrendAnalysisResultResponse {
@ApiModelProperty(value = "时段列表",example = "[\"20250311\",\"20250312\"]")
private List<String> timeList = new ArrayList<>();
// @ApiModelProperty(value = "各路口时段流量列表",
// example = "[{\"name\":\"路口1\",\"list\":[150,300]}," +
// "{\"name\":\"路口2\",\"list\":[150,300]}]")
private List<CrossDirProblemTrendAnalysisResultTimeFlow> dataList=new ArrayList<>();
}
@Data
class CrossDirProblemTrendAnalysisResultTimeFlow extends ProblemTrendAnalysisResultTimeFlow {
@ApiModelProperty(value = "方向编码",example = "1")
private Integer dir ;
@ApiModelProperty(value = "方向名称",example = "")
private String dirName ;
}
package net.wanji.opt.controllerv2.judgeanalysis.design.response.crossproblem;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import java.util.ArrayList;
import java.util.List;
@Data
public class CrossProblemDirTrendAnalysisResult extends ParentResult {
private CrossProblemDirTrendAnalysisResultResponse content;
public CrossProblemDirTrendAnalysisResultResponse getContent() {
return content;
}
public CrossProblemDirTrendAnalysisResult setContent(CrossProblemDirTrendAnalysisResultResponse content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class CrossProblemDirTrendAnalysisResultResponse {
@ApiModelProperty(value = "时段列表",example = "[\"20250311\",\"20250312\"]")
private List<String> timeList = new ArrayList<>();
// @ApiModelProperty(value = "各路口时段流量列表",
// example = "[{\"name\":\"路口1\",\"list\":[150,300]}," +
// "{\"name\":\"路口2\",\"list\":[150,300]}]")
private List<CrossProblemDirTrendAnalysisResultTimeFlow> dataList=new ArrayList<>();
}
@Data
class CrossProblemDirTrendAnalysisResultTimeFlow {
@ApiModelProperty(value = "方向代码:1~7顺时针,分别代表北、东北、东、东南、南、西南、西、西北",example = "1")
private Integer dir ;
@ApiModelProperty(value = "方向描述",example = "北")
private String dirName ;
@ApiModelProperty(value = "时段事件数量,时段对应到timeList",example = "[300,400]")
private List<Integer> list ;
}
package net.wanji.opt.controllerv2.judgeanalysis.design.response.crossproblem;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem.ProblemTrendAnalysisResultTimeFlow;
import java.util.ArrayList;
import java.util.List;
@Data
public class CrossProblemDistributeAnalysisResult extends ParentResult {
private CrossProblemDistributeResponse content;
public CrossProblemDistributeResponse getContent() {
return content;
}
public CrossProblemDistributeAnalysisResult setContent(CrossProblemDistributeResponse content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class CrossProblemDistributeResponse {
@ApiModelProperty(value = "时段列表(小时/分钟)粒度格式:HH:mm",example = "[\"00:15\",\"00:30\"]",dataType = "String[]")
private List<String> timeList = new ArrayList<>();
@ApiModelProperty(value = "时段列表(年-月-日 小时:分钟:秒)粒度格式:yyyy-MM-dd HH:mm:ss",example = "[\"2025-03-21 00:15:00\",\"2025-03-21 00:30:00\"]",dataType = "String[]")
private List<String> timeListAll = new ArrayList<>();
// @ApiModelProperty(value = "各路口时段流量列表",
// example = "[{\"name\":\"路口1\",\"list\":[150,300]}," +
// "{\"name\":\"路口2\",\"list\":[150,300]}]")
private List<ProblemCountDurationDistributeRes> dataList=new ArrayList<>();
}
@Data
class ProblemCountDurationDistributeRes {
@ApiModelProperty(value = "事件代码 701:空放 702:路口失衡,703:路口溢出 705:干线缓行 706:干线拥堵 707:路口拥堵",example = "'707'",dataType = "string")
private String eventType ;
@ApiModelProperty(value = "事件类型名称",example = "路口拥堵")
private String eventLabel ;
@ApiModelProperty(value = "时段事件发生总数量,时段对应到timeList",example = "[300,400]",dataType = "int[]")
private List<Integer> totalNumberList ;
@ApiModelProperty(value = "时段事件未优化总数量,时段对应到timeList",example = "[300,400]",dataType = "int[]")
private List<Integer> noOptimizeNumberList ;
}
package net.wanji.opt.controllerv2.judgeanalysis.design.response.crossproblem;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import java.util.List;
@Data
public class CrossProblemTimeDirReasonResult extends ParentResult {
private CrossProblemTimeDirReasonBody content;
public CrossProblemTimeDirReasonBody getContent() {
return content;
}
public CrossProblemTimeDirReasonResult setContent(CrossProblemTimeDirReasonBody content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class CrossProblemTimeDirReasonBody {
@ApiModelProperty(value = "事件类型码",example = "'701'" )
private String eventType ;
@ApiModelProperty(value = "事件类型名称",example = "路口空放")
private String eventLabel ;
@ApiModelProperty(value = "问题主要发生时段",example = "[\"07:00-08:00\",\"18:00-19:00\"]")
private List<String> timeList ;
@ApiModelProperty(value = "问题主要发生方向"/*,example = "[{'dir':1,'dirName':'北进口'},{'dir':3,'dirName':'东进口'}]"*/)
private List<CrossProblemDir> dirList ;
// TODO 需要有个计算任务,根据小时流量或其他指标计算事件发生的原因
@ApiModelProperty(value = "问题发生原因",example = "[\"区位原因\",\"交通流原因\"]")
private List<String> reasonList ;
}
@Data
class CrossProblemDir {
@ApiModelProperty(value = "方向代码:1~7顺时针,分别代表北、东北、东、东南、南、西南、西、西北",example = "1")
private Integer dir ;
@ApiModelProperty(value = "方向描述",example = "北")
private String dirName ;
}
package net.wanji.opt.controllerv2.judgeanalysis.design.response.crosssignal;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import java.util.List;
@Data
public class CrossSignalPlanReasonResult extends ParentResult {
private CCrossSignalPlanReasonReasonBody content;
public CCrossSignalPlanReasonReasonBody getContent() {
return content;
}
public CrossSignalPlanReasonResult setContent(CCrossSignalPlanReasonReasonBody content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class CCrossSignalPlanReasonReasonBody {
@ApiModelProperty(value = "路口方案详情")
private List<CCrossSignalPlan> list ;
}
@Data
class CCrossSignalPlan {
@ApiModelProperty(value = "方案开始执行时间,格式:yyyy-MM-dd HH:mm:ss",example = "2025-03-21 00:00:00")
private String startTime ;
@ApiModelProperty(value = "方案截止执行时间,格式:yyyy-MM-dd HH:mm:ss",example = "2025-03-21 05:00:00")
private String endTime ;
@ApiModelProperty(value = "方案执行周期,单位秒",example = "120")
private Integer cycle ;
}
package net.wanji.opt.controllerv2.judgeanalysis.design.response.greenproblem;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem.ProblemTrendAnalysisResultTimeFlow;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.crossproblem.CrossDirProblemTrendAnalysisResult;
import java.util.ArrayList;
import java.util.List;
@Data
public class GreenCrossProblemTrendAnalysisResult extends ParentResult {
private GreenProblemTrendAnalysisResultResponse content;
public GreenProblemTrendAnalysisResultResponse getContent() {
return content;
}
public GreenCrossProblemTrendAnalysisResult setContent(GreenProblemTrendAnalysisResultResponse content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class GreenProblemTrendAnalysisResultResponse {
@ApiModelProperty(value = "时段列表",example = "[\"20250311\",\"20250312\"]")
private List<String> timeList = new ArrayList<>();
// @ApiModelProperty(value = "各路口时段流量列表",
// example = "[{\"name\":\"路口1\",\"list\":[150,300]}," +
// "{\"name\":\"路口2\",\"list\":[150,300]}]")
private List<GreenProblemTrendAnalysisResultTimeFlow> dataList=new ArrayList<>();
}
@Data
class GreenProblemTrendAnalysisResultTimeFlow extends ProblemTrendAnalysisResultTimeFlow {
@ApiModelProperty(value = "路口ID",example = "")
private String crossId ;
@ApiModelProperty(value = "路口名称",example = "")
private String crossName ;
}
package net.wanji.opt.controllerv2.judgeanalysis.design.response.greenproblem;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import java.util.List;
@Data
public class GreenProblemTimeDirReasonResult extends ParentResult {
private GreenProblemTimeDirReasonBody content;
public GreenProblemTimeDirReasonBody getContent() {
return content;
}
public GreenProblemTimeDirReasonResult setContent(GreenProblemTimeDirReasonBody content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class GreenProblemTimeDirReasonBody {
@ApiModelProperty(value = "事件类型码",example = "'706'" )
private String eventType ;
@ApiModelProperty(value = "事件类型名称",example = "干线拥堵")
private String eventLabel ;
@ApiModelProperty(value = "问题主要发生时段",example = "[\"07:00-08:00\",\"18:00-19:00\"]")
private List<String> timeList ;
@ApiModelProperty(value = "主要【拥堵/缓行】路口" ,example = "[\"路口1\",\"路口2\"]")
private List<String> mainCongestCrossName ;
@ApiModelProperty(value = "主要【拥堵/缓行】路段",example = "[\"路段1\",\"路段2\"]")
private List<String> mainCongestRoadName ;
// TODO 需要有个计算任务,根据小时流量或其他指标计算事件发生的原因
@ApiModelProperty(value = "问题发生原因",example = "[\"区位原因\",\"交通流原因\"]")
private List<String> reasonList ;
}
package net.wanji.opt.controllerv2.report;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.po.BaseAreaInfoPO;
import net.wanji.opt.controllerv2.report.vo.AreaParamBody;
import net.wanji.opt.servicev2.report.BaseAreaInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* <p>
* 区域基础信息 接口API
* </p>
* @version 1.0
* @author wangtao
* @Date 2025-03-18
*/
@RestController
@Slf4j
@RequestMapping("/base-area-info")
@Api(value="BaseAreaInfoController", description="区域基础信息接口", tags = "区域基础信息")
public class BaseAreaInfoController {
@Autowired
private BaseAreaInfoService baseAreaInfoService;
@ApiOperation(httpMethod="GET",value="区域基础信息-根据区划类型查询对应集合数据", notes="")
@GetMapping(value = "/byCondition")
public JsonViewObject getListByType(@RequestParam(value = "type", required = false, defaultValue = "2") String type) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
List<BaseAreaInfoPO> list = baseAreaInfoService.selectByType(type);
jsonViewObject.success(list);
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
@ApiOperation(httpMethod="POST",value="区域基础信息-自定义区域", notes="")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "name", value = "区域ID", required = true, dataType = "String"),
// @ApiImplicitParam(name = "wkt", value = "区域边界", required = true, dataType = "String", defaultValue = "117.049347926,36.654744674;117.066122093,36.654772445;117.0800809517208,36.65440636491661;117.07979265456723,36.65214909599633;117.07706941120558,36.63829789737139;117.07414217382905,36.63736765765722;117.0707410731053,36.636677059391445;117.06550839703021,36.63722151604908;117.06267677771574,36.63667912391616;117.0577271202223,36.63483777099411;117.05251580910459,36.63437969486462;117.04433347163972,36.63696466063367;117.04843387376732,36.637934238407;117.04968488845323,36.638408635754985;117.049347926,36.654744674;117.066122093,36.654772445;117.0800809517208,36.65440636491661;117.07979265456723,36.65214909599633;117.07706941120558,36.63829789737139;117.07414217382905,36.63736765765722;117.0707410731053,36.636677059391445;117.06550839703021,36.63722151604908;117.06267677771574,36.63667912391616;117.0577271202223,36.63483777099411;117.05251580910459,36.63437969486462;117.04433347163972,36.63696466063367;117.04843387376732,36.637934238407;117.04968488845323,36.638408635754985;117.049347926,36.654744674"),
// @ApiImplicitParam(name = "type", value = "区划类型:1行政区划;2交警辖区;3商圈;4交通小区;5热点区域;6道路 99自定义区域", required = true, dataType = "Integer", defaultValue = "99"),
// })
@PostMapping(value = "/insertAreaInfo")
public JsonViewObject insertAreaInfo(@RequestBody AreaParamBody areaParamBody) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
BaseAreaInfoPO baseAreaInfoPO = new BaseAreaInfoPO();
baseAreaInfoPO.setName(areaParamBody.getName());
baseAreaInfoPO.setPolylines(areaParamBody.getWkt());
baseAreaInfoPO.setType(areaParamBody.getType());
baseAreaInfoService.insertAreaInfo(baseAreaInfoPO);
jsonViewObject.success();
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
@ApiOperation(httpMethod="GET",value="干线路口基础信息-根据区域查询对应集合数据", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "areaId", value = "区域ID", required = false, dataType = "Integer", defaultValue = "12"),
@ApiImplicitParam(name = "wkt", value = "区域边界", required = false, dataType = "String", defaultValue = "117.049347926,36.654744674;117.066122093,36.654772445;117.0800809517208,36.65440636491661;117.07979265456723,36.65214909599633;117.07706941120558,36.63829789737139;117.07414217382905,36.63736765765722;117.0707410731053,36.636677059391445;117.06550839703021,36.63722151604908;117.06267677771574,36.63667912391616;117.0577271202223,36.63483777099411;117.05251580910459,36.63437969486462;117.04433347163972,36.63696466063367;117.04843387376732,36.637934238407;117.04968488845323,36.638408635754985;117.049347926,36.654744674;117.066122093,36.654772445;117.0800809517208,36.65440636491661;117.07979265456723,36.65214909599633;117.07706941120558,36.63829789737139;117.07414217382905,36.63736765765722;117.0707410731053,36.636677059391445;117.06550839703021,36.63722151604908;117.06267677771574,36.63667912391616;117.0577271202223,36.63483777099411;117.05251580910459,36.63437969486462;117.04433347163972,36.63696466063367;117.04843387376732,36.637934238407;117.04968488845323,36.638408635754985;117.049347926,36.654744674"),
@ApiImplicitParam(name = "type", value = "查询类型,1-干线信息 2-路口信息", required = false, dataType = "Integer", defaultValue = "1"),
})
@GetMapping(value = "/getGreenByArea")
public JsonViewObject getGreenByAre(@RequestParam(value = "areaId", required = false, defaultValue = "12") Integer areaId,
@RequestParam(value = "wkt", required = false) String wkt,
@RequestParam(value = "type", required = false) Integer type) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
JSONObject jsonObject = baseAreaInfoService.getGreenByWkt(areaId,wkt,type);
jsonViewObject.success(jsonObject);
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
}
package net.wanji.opt.controllerv2.report;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.controllerv2.report.design.CrossOptimizeAnalysisResult;
import net.wanji.opt.controllerv2.report.design.GreenWaveOptimizeAnalysisResult;
import net.wanji.opt.controllerv2.report.design.ImportCrossReportAnalysis;
import net.wanji.opt.controllerv2.report.design.ImportGreenReportAnalysis;
import net.wanji.opt.controllerv2.report.vo.GreenWaveOptimizeAnalysisResultResponseDTO;
import net.wanji.opt.controllerv2.report.vo.ImportGreenReportAnalysisResponseVO;
import net.wanji.opt.servicev2.report.AnalysisGreenWaveOptimizeWeekService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 干线概况 接口API
* </p>
* @version 1.0
* @author
* @Date 2025-03-18
*/
@RestController
@Slf4j
@RequestMapping("/cross-optimize")
@Api(value="CrossOptimizeAnalysisController", description="路口分析报告", tags = "路口分析报告-周报")
public class CrossOptimizeAnalysisController {
@ApiOperation(httpMethod="GET",value="4.1-路口优化-总体分析", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossIds", value = "干线ID,多个id用','分隔【为空时查询所有干线】", required = false, dataType = "String",defaultValue = "13NEJ0B5R80,13N650B5P30"),
@ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "String",defaultValue = "2025"),
@ApiImplicitParam(name = "week", value = "一年的第几周", required = true, dataType = "String",defaultValue = "14"),
})
@GetMapping(value = "/getTotalityData")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossOptimizeAnalysisResult.class),
})
public JsonViewObject getTotalityData(Integer year,Integer week,@RequestParam(required = false) String crossIds) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
@ApiOperation(httpMethod="GET",value="4.2-重点路口优化分析", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossIds", value = "干线ID,多个id用','分隔【为空时查询所有干线】", required = false, dataType = "String",defaultValue = "13NEJ0B5R80,13N650B5P30"),
@ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "String",defaultValue = "2025"),
@ApiImplicitParam(name = "week", value = "一年的第几周", required = true, dataType = "String",defaultValue = "14"),
})
@GetMapping(value = "/getProblemDetail")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = ImportCrossReportAnalysis.class),
})
public JsonViewObject getProblemDetail(Integer year,Integer week,@RequestParam(required = false) String crossIds) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
}
package net.wanji.opt.controllerv2.report;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.controllerv2.report.design.CrossImportProblemAnalysisResult;
import net.wanji.opt.controllerv2.report.design.CrossProblemTotalityAnalysisResult;
import net.wanji.opt.controllerv2.report.design.CrossRunStateAnalysisResult;
import net.wanji.opt.controllerv2.report.design.CrossRunStatePeakAnalysisResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 路口运行状态 接口API
* </p>
* @version 1.0
* @author
* @Date 2025-03-18
*/
@RestController
@Slf4j
@RequestMapping("/cross-problem")
@Api(value="CrossProblemController", description="", tags = "路口分析报告-周报")
public class CrossProblemController {
@ApiOperation(httpMethod="GET",value="3.1-区域路口问题总体分析", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossIds", value = "路口ID,多个id用','分隔【为空时查询所有】", required = true, dataType = "String",defaultValue = "13NEJ0B5R80,13N650B5P30"),
@ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "String",defaultValue = "2025"),
@ApiImplicitParam(name = "week", value = "一年的第几周", required = true, dataType = "String",defaultValue = "14"),
})
@GetMapping(value = "/getTotalitySituation")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossProblemTotalityAnalysisResult.class),
})
public JsonViewObject getTotalitySituation(String crossIds,Integer year,Integer week) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
@ApiOperation(httpMethod="GET",value="3.2-区域路口重点问题分析", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossIds", value = "路口ID,多个id用','分隔【为空时查询所有】", required = true, dataType = "String",defaultValue = "13NEJ0B5R80,13N650B5P30"),
@ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "String",defaultValue = "2025"),
@ApiImplicitParam(name = "week", value = "一年的第几周", required = true, dataType = "String",defaultValue = "14"),
})
@GetMapping(value = "/getSeriousProblem")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossImportProblemAnalysisResult.class),
})
public JsonViewObject getPeakData(String crossIds,Integer year,Integer week) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
}
package net.wanji.opt.controllerv2.report;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.controllerv2.report.design.CrossRidLaneInfoResult;
import net.wanji.opt.controllerv2.report.design.GreenWaveOptimizeAnalysisResult;
import net.wanji.opt.servicev2.report.CrossRidLaneService;
import net.wanji.opt.vo2.report.CrossRidLaneResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@Slf4j
@RequestMapping("/cross-rid-lane")
@Api(value="CrossRidLaneController", description="路口分析报告接口", tags = "路口分析报告-周报")
public class CrossRidLaneController {
@Autowired
private CrossRidLaneService crossRidLaneService;
@ApiOperation(httpMethod="GET",value="1.1-路口基础信息", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossIds", value = "路口ID,多个id用','分隔", required = true, dataType = "String",defaultValue = "13NEJ0B5R80,13N650B5P30"),
})
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossRidLaneInfoResult.class),
})
@GetMapping(value = "/getCrossInfoList")
public JsonViewObject getCrossInfoList(@RequestParam(value = "crossIds", required = false) String crossIds) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
List<CrossRidLaneResult> object = crossRidLaneService.getCrossInfoList(crossIds);
jsonViewObject.success(object);
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
}
package net.wanji.opt.controllerv2.report;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.controllerv2.report.design.CrossRunStateAnalysisResult;
import net.wanji.opt.controllerv2.report.design.CrossRunStatePeakAnalysisResult;
import net.wanji.opt.controllerv2.report.design.GreenReportRunStateResult;
import net.wanji.opt.controllerv2.report.vo.CrossRunStateAnalysisResultResponseDTO;
import net.wanji.opt.servicev2.report.AnalysisGreenWavePeakDetailService;
import net.wanji.opt.servicev2.report.CrossRidLaneService;
import net.wanji.opt.vo2.report.GreenReportRunStateResponseVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* <p>
* 路口运行状态 接口API
* </p>
* @version 1.0
* @author
* @Date 2025-03-18
*/
@RestController
@Slf4j
@RequestMapping("/cross-run-state")
@Api(value="CrossRunStateController", description="", tags = "路口分析报告-周报")
public class CrossRunStateController {
@Autowired
private CrossRidLaneService crossRidLaneService;
@ApiOperation(httpMethod="GET",value="2.1-交通运行总体情况", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossIds", value = "路口ID,多个id用','分隔【为空时查询所有】", required = true, dataType = "String",defaultValue = "13NEJ0B5R80,13N650B5P30"),
@ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "String",defaultValue = "2025"),
@ApiImplicitParam(name = "week", value = "一年的第几周", required = true, dataType = "String",defaultValue = "14"),
})
@GetMapping(value = "/getTotalitySituation")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossRunStateAnalysisResult.class),
})
public JsonViewObject getTotalitySituation(@RequestParam(required = false) String crossIds, Integer year, Integer week) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
CrossRunStateAnalysisResultResponseDTO responseDTO = crossRidLaneService.getTotalitySituation(crossIds,year,week);
jsonViewObject.success(responseDTO);
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
@ApiOperation(httpMethod="GET",value="2.2-区域路口运行分析", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossIds", value = "路口ID,多个id用','分隔【为空时查询所有】", required = true, dataType = "String",defaultValue = "13NEJ0B5R80,13N650B5P30"),
@ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "String",defaultValue = "2025"),
@ApiImplicitParam(name = "week", value = "一年的第几周", required = true, dataType = "String",defaultValue = "14"),
})
@GetMapping(value = "/getPeakData")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossRunStatePeakAnalysisResult.class),
})
public JsonViewObject getPeakData(String crossIds,Integer year,Integer week) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
}
package net.wanji.opt.controllerv2.report;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.po.BaseAreaInfoPO;
import net.wanji.opt.entity.report.GreenWaveCrossRidInfo;
import net.wanji.opt.servicev2.report.BaseAreaInfoService;
import net.wanji.opt.servicev2.report.GreenWaveCrossRidService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* <p>
* 区域基础信息 接口API
* </p>
* @version 1.0
* @author
* @Date 2025-03-18
*/
@RestController
@Slf4j
@RequestMapping("/green-wave-cross-rid")
@Api(value="GreenWaveCrossRidController", description="干线分析报告接口", tags = "干线分析报告-周报")
public class GreenWaveCrossRidController {
@Autowired
private GreenWaveCrossRidService greenWaveCrossRidService;
@ApiOperation(httpMethod="GET",value="1.1-干线拥堵信息", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "干线ID,多个id用','分隔", required = true, dataType = "String",defaultValue = "1,2"),
@ApiImplicitParam(name = "dayType", value = "高峰类型 1早高峰 2晚高峰 3全天", required = true, dataType = "String",defaultValue = "1"),
})
@GetMapping(value = "/getGreenWeekDataList")
public JsonViewObject getGreenWeekDataList(@RequestParam(value = "ids", required = false, defaultValue = "2") String ids,
@RequestParam(value = "type", required = false, defaultValue = "2") String type
) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
JSONObject object = greenWaveCrossRidService.getGreenInfoList(ids);
jsonViewObject.success(object);
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
@ApiOperation(httpMethod="GET",value="1.1-干线基础信息", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "干线ID,多个id用','分隔", required = true, dataType = "String",defaultValue = "1,2"),
})
@GetMapping(value = "/getGreenInfoList")
public JsonViewObject getGreenInfoList(@RequestParam(value = "ids", required = false, defaultValue = "2") String ids) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
JSONObject object = greenWaveCrossRidService.getGreenInfoList(ids);
jsonViewObject.success(object);
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
}
package net.wanji.opt.controllerv2.report;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.controllerv2.report.design.GreenReportProblemDetailAnalysis;
import net.wanji.opt.controllerv2.report.design.GreenReportProblemOverallAnalysis;
import net.wanji.opt.controllerv2.report.design.GreenWaveOptimizeAnalysisResult;
import net.wanji.opt.controllerv2.report.design.ImportGreenReportAnalysis;
import net.wanji.opt.controllerv2.report.vo.GreenWaveOptimizeAnalysisResultResponseDTO;
import net.wanji.opt.controllerv2.report.vo.ImportGreenReportAnalysisResponseVO;
import net.wanji.opt.servicev2.report.AnalysisGreenWaveOptimizeWeekService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 干线概况 接口API
* </p>
* @version 1.0
* @author
* @Date 2025-03-18
*/
@RestController
@Slf4j
@RequestMapping("/green-wave-optimize")
@Api(value="GreenWaveOptimizeAnalysisController", description="干线分析报告接口", tags = "干线分析报告-周报")
public class GreenWaveOptimizeAnalysisController {
@Autowired
private AnalysisGreenWaveOptimizeWeekService analysisGreenWaveOptimizeWeekService;
@ApiOperation(httpMethod="GET",value="5.1-干线优化-总体分析", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "干线ID,多个id用','分隔【为空时查询所有干线】", required = false, dataType = "String",defaultValue = "1,2"),
@ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "String",defaultValue = "2025"),
@ApiImplicitParam(name = "week", value = "一年的第几周", required = true, dataType = "String",defaultValue = "14"),
})
@GetMapping(value = "/getTotalityData")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenWaveOptimizeAnalysisResult.class),
})
public JsonViewObject getTotalityData(Integer year,Integer week,@RequestParam(required = false) String ids) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
GreenWaveOptimizeAnalysisResultResponseDTO totalityData = analysisGreenWaveOptimizeWeekService.getTotalityData(year, week, ids);
jsonViewObject.success(totalityData);
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
@ApiOperation(httpMethod="GET",value="5.2-重点干线优化分析", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "干线ID,多个id用','分隔【为空时查询所有干线】", required = false, dataType = "String",defaultValue = "1,2"),
@ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "String",defaultValue = "2025"),
@ApiImplicitParam(name = "week", value = "一年的第几周", required = true, dataType = "String",defaultValue = "14"),
})
@GetMapping(value = "/getProblemDetail")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = ImportGreenReportAnalysis.class),
})
public JsonViewObject getProblemDetail(Integer year,Integer week,@RequestParam(required = false) String ids) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
List<ImportGreenReportAnalysisResponseVO> problemDetail = analysisGreenWaveOptimizeWeekService.getProblemDetail(year, week, ids);
jsonViewObject.success(problemDetail);
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
}
package net.wanji.opt.controllerv2.report;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem.AreaCrossProblemAnalysisResult;
import net.wanji.opt.controllerv2.report.design.GreenReportOverviewAnalysisResult;
import net.wanji.opt.controllerv2.report.design.GreenReportSamePeriodCompareResult;
import net.wanji.opt.controllerv2.report.vo.GreenReportSamePeriodCompareData;
import net.wanji.opt.entity.report.GreenWaveWeekData;
import net.wanji.opt.servicev2.report.GreenWaveCrossRidService;
import net.wanji.opt.servicev2.report.GreenWaveWeekDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 干线概况 接口API
* </p>
* @version 1.0
* @author
* @Date 2025-03-18
*/
@RestController
@Slf4j
@RequestMapping("/green-wave-overview")
@Api(value="GreenWaveCrossRidController", description="干线分析报告接口", tags = "干线分析报告-周报")
public class GreenWaveOverviewController {
@Autowired
private GreenWaveCrossRidService greenWaveCrossRidService;
@Autowired
private GreenWaveWeekDataService greenWaveWeekDataService;
@ApiOperation(httpMethod="GET",value="2.1-干线概况-总体情况说明", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "干线ID,多个id用','分隔【为空时查询所有干线】", required = true, dataType = "String",defaultValue = "1,2"),
@ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "String",defaultValue = "2025"),
@ApiImplicitParam(name = "week", value = "一年的第几周", required = true, dataType = "String",defaultValue = "13"),
})
@GetMapping(value = "/getOverallSituation")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenReportOverviewAnalysisResult.class),
})
public JsonViewObject getGreenInfoList(Integer year,Integer week, String ids) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
JSONObject jsonObject = greenWaveWeekDataService.getGreenInfoList( year, week, ids);
jsonViewObject.success(jsonObject);
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
@ApiOperation(httpMethod="GET",value="2.2-干线概况-工作日同期对比", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "干线ID,多个id用','分隔", required = true, dataType = "String",defaultValue = "1,2"),
@ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "String",defaultValue = "2025"),
@ApiImplicitParam(name = "week", value = "一年的第几周", required = true, dataType = "String",defaultValue = "13"),
})
@GetMapping(value = "/getSamePeriodCompare")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenReportSamePeriodCompareResult.class),
})
public JsonViewObject getSamePeriodCompare(Integer year,Integer week, String ids) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
List<GreenReportSamePeriodCompareData> jsonObject = greenWaveWeekDataService.getSamePeriodCompare(year,week,ids);
jsonViewObject.success(jsonObject);
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
}
package net.wanji.opt.controllerv2.report;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.controllerv2.report.design.GreenReportProblemDetailAnalysis;
import net.wanji.opt.controllerv2.report.design.GreenReportProblemOverallAnalysis;
import net.wanji.opt.controllerv2.report.vo.GreenReportProblemDetailAnalysisResult;
import net.wanji.opt.controllerv2.report.vo.GreenReportProblemOverallAnalysisResult;
import net.wanji.opt.servicev2.judgeanalysis.AnalysisGreenCongestionPeriodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 干线概况 接口API
* </p>
* @version 1.0
* @author
* @Date 2025-03-18
*/
@RestController
@Slf4j
@RequestMapping("/green-wave-problem")
@Api(value="GreenWaveProblemAnalysisController", description="干线分析报告接口", tags = "干线分析报告-周报")
public class GreenWaveProblemAnalysisController {
@Autowired
private AnalysisGreenCongestionPeriodService analysisGreenCongestionPeriodService;
@ApiOperation(httpMethod="GET",value="4.1-干线问题-总体分析", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "干线ID,多个id用','分隔【为空时查询所有干线】", required = false, dataType = "String",defaultValue = "1,2"),
@ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "String",defaultValue = "2025"),
@ApiImplicitParam(name = "week", value = "一年的第几周", required = true, dataType = "String",defaultValue = "13"),
})
@GetMapping(value = "/getProblemData")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenReportProblemOverallAnalysis.class),
})
public JsonViewObject getGreenInfoList(Integer year,Integer week,@RequestParam(required = false) String ids) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
GreenReportProblemOverallAnalysisResult greenReportProblemOverallAnalysisResult = analysisGreenCongestionPeriodService.selectListByWeek(year,week,ids);
jsonViewObject.success(greenReportProblemOverallAnalysisResult);
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
//GreenReportProblemDetailAnalysis
@ApiOperation(httpMethod="GET",value="4.2-干线问题-问题详情", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "干线ID,多个id用','分隔【为空时查询所有干线】", required = false, dataType = "String",defaultValue = "1,2"),
@ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "String",defaultValue = "2025"),
@ApiImplicitParam(name = "week", value = "一年的第几周", required = true, dataType = "String",defaultValue = "13"),
})
@GetMapping(value = "/getProblemDetail")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenReportProblemDetailAnalysis.class),
})
public JsonViewObject getProblemDetail(Integer year,Integer week,@RequestParam(required = false) String ids) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
List<GreenReportProblemDetailAnalysisResult> greenReportProblemDetailAnalysisResponseList = analysisGreenCongestionPeriodService.getProblemDetail(year,week,ids);
jsonViewObject.success(greenReportProblemDetailAnalysisResponseList);
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
}
package net.wanji.opt.controllerv2.report;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.controllerv2.report.design.GreenReportOverviewAnalysisResult;
import net.wanji.opt.controllerv2.report.design.GreenReportRunStateResult;
import net.wanji.opt.controllerv2.report.design.GreenReportSamePeriodCompareResult;
import net.wanji.opt.servicev2.report.AnalysisGreenWavePeakDetailService;
import net.wanji.opt.servicev2.report.GreenWaveCrossRidService;
import net.wanji.opt.vo2.report.GreenReportRunStateResponseVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* <p>
* 干线概况 接口API
* </p>
* @version 1.0
* @author
* @Date 2025-03-18
*/
@RestController
@Slf4j
@RequestMapping("/green-wave-run-state")
@Api(value="GreenWaveRunStateController", description="干线分析报告接口", tags = "干线分析报告-周报")
public class GreenWaveRunStateController {
@Resource
private AnalysisGreenWavePeakDetailService analysisGreenWavePeakDetailService;
@ApiOperation(httpMethod="GET",value="3.1-干线运行分析", notes="")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "干线ID,多个id用','分隔【为空时查询所有干线】", required = true, dataType = "String",defaultValue = "1,2"),
@ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "String",defaultValue = "2025"),
@ApiImplicitParam(name = "week", value = "一年的第几周", required = true, dataType = "String",defaultValue = "20"),
})
@GetMapping(value = "/getData")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenReportRunStateResult.class),
})
public JsonViewObject getData(String ids,Integer year,Integer week) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
List<GreenReportRunStateResponseVO> list = analysisGreenWavePeakDetailService.selectWeekRunStateSituation(ids,year,week);
jsonViewObject.success(list);
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
}
package net.wanji.opt.controllerv2.report.design;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import java.util.ArrayList;
import java.util.List;
@Data
public class CrossImportProblemAnalysisResult extends ParentResult {
private CrossImportProblemResultResponse content;
public CrossImportProblemResultResponse getContent() {
return content;
}
public CrossImportProblemAnalysisResult setContent(CrossImportProblemResultResponse content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class CrossImportProblemResultResponse {
@ApiModelProperty(value = "溢出最严重路口", example = "旅游路-洪山路交叉口、旅游路-霞景路交叉口",position = 0)
private String overFlowCrossName;
@ApiModelProperty(value = "本周溢出时长", example = "3.5小时",position = 1)
private String overFlowDuration;
@ApiModelProperty(value = "拥堵最严重路口", example = "旅游路-洪山路交叉口、旅游路-霞景路交叉口",position = 2)
private String congestCrossName;
@ApiModelProperty(value = "本周溢出时长", example = "3.5小时",position = 3)
private String congestDuration;
//================================================================================================//
@ApiModelProperty(value = "溢出路口排名,top10",position = 4)
private List<CrossImportProblemData> overFlowList=new ArrayList<>();
@ApiModelProperty(value = "拥堵路口排名,top10",position = 5)
private List<CrossImportProblemData> congestList=new ArrayList<>();
}
@Data
class CrossImportProblemData {
@ApiModelProperty(value = "数据类型:1溢出 2拥堵",example = "1",position = 0)
private String dataType ;
@ApiModelProperty(value = "路口名称",example = "旅游路-洪山路交叉口",position = 1)
private String crossName ;
@ApiModelProperty(value = "持续时长",example = "90",position = 2)
private Integer duration ;
@ApiModelProperty(value = "本周路口最严重时段",example = "7:00~7:30",position = 3)
private String seriousTimeSpan ;
@ApiModelProperty(value = "本周路口最严重时段持续时长",example = "溢出时长30分钟",position = 4)
private String seriousTimeSpanDuration ;
@ApiModelProperty(value = "工作日平均每天溢出次数",example = "3次",position = 5)
private String workDayAvgOverCount ;
@ApiModelProperty(value = "工作日平均每天溢出时长",example = "溢出时长30分钟",position = 6)
private String workDayAvgOverDuration ;
@ApiModelProperty(value = "路口每天时段详情",position = 7)
private List<CrossImportProblemDetail> list=new ArrayList<>();
}
@Data
class CrossImportProblemDetail{
@ApiModelProperty(value = "周几",example = "周一",position = 0)
private String weekName ;
@ApiModelProperty(value = "时段",example = "7:00~7:30",position = 1)
private String timeSpan ;
@ApiModelProperty(value = "时长",example = "30分钟",position = 2)
private String duration ;
}
package net.wanji.opt.controllerv2.report.design;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import java.util.ArrayList;
import java.util.List;
@Data
public class CrossOptimizeAnalysisResult extends ParentResult {
private CrossOptimizeResultResponse content;
public CrossOptimizeResultResponse getContent() {
return content;
}
public CrossOptimizeAnalysisResult setContent(CrossOptimizeResultResponse content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class CrossOptimizeResultResponse {
@ApiModelProperty(value = "路口名称", example = "经十路(舜耕路-山大路)",position = 0)
private String crossName;
@ApiModelProperty(value = "本周优化次数", example = "300次",position = 1)
private String weekOptimizeCount;
@ApiModelProperty(value = "本周优化时长", example = "98小时",position = 2)
private String weekOptimizeDuration;
@ApiModelProperty(value = "本周溢出次数", example = "98小时",position = 3)
private String weekOptimizeOverflowCount;
@ApiModelProperty(value = "本周拥堵次数", example = "98小时",position = 4)
private String weekOptimizeCongestCount;
@ApiModelProperty(value = "本周空放优化次数", example = "98小时",position = 5)
private String weekOptimizeEmptyCount;
@ApiModelProperty(value = "本周失衡优化次数", example = "98小时",position = 6)
private String weekOptimizeUnbalanceCount;
@ApiModelProperty(value = "本周通行能力同比情况", example = "提升10%",position = 7)
private String weekCapacitySituation;
@ApiModelProperty(value = "本周通停车次数同比情况", example = "减少10%",position = 8)
private String weekStopTimesSituation;
@ApiModelProperty(value = "本周通延误时间同比情况", example = "增加10%",position = 9)
private String weekDelayTimeSituation;
@ApiModelProperty(value = "本周通最大排队同比情况", example = "降低10%",position = 10)
private String weekMaxQueueLengthSituation;
@ApiModelProperty(value = "本周总体情况", example = "明显提升",position = 11)
private String weekTotalitySituation;
//================================================================================================//
@ApiModelProperty(value = "时段列表",example = "[\"本周\",\"上周\"]")
private List<String> timeList = new ArrayList<>();
private List<CrossOptimizeAnalysisData> dataList=new ArrayList<>();
}
@Data
class CrossOptimizeAnalysisData {
@ApiModelProperty(value = "通行能力",example = "8900")
private Integer capacity ;
@ApiModelProperty(value = "停车次数",example = "5")
private Double stopTimes ;
@ApiModelProperty(value = "延误时间,单位秒",example = "40")
private Double delayTime ;
@ApiModelProperty(value = "最大排队长度",example = "6.9")
private Double maxQueueLength ;
}
package net.wanji.opt.controllerv2.report.design;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import java.util.ArrayList;
import java.util.List;
@Data
public class CrossProblemTotalityAnalysisResult extends ParentResult {
private CrossProblemTotalityResultResponse content;
public CrossProblemTotalityResultResponse getContent() {
return content;
}
public CrossProblemTotalityAnalysisResult setContent(CrossProblemTotalityResultResponse content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class CrossProblemTotalityResultResponse {
@ApiModelProperty(value = "路口名称", example = "经十路(舜耕路-山大路)",position = 0)
private String crossName;
@ApiModelProperty(value = "本周溢出总次数", example = "20次",position = 1)
private String weekOverFlowCount;
@ApiModelProperty(value = "本周溢出总次数与上周比较情况", example = "增加【减少】10%",position = 2)
private String weekOverFlowCountCompare;
@ApiModelProperty(value = "本周溢出时长", example = "3.5小时",position = 3)
private String weekOverFlowDuration;
@ApiModelProperty(value = "本周溢出时长与上周比较情况", example = "增加【减少】13%",position = 4)
private String weekOverFlowDurationCompare;
@ApiModelProperty(value = "本周拥堵总次数", example = "20次",position = 5)
private String weekCongestCount;
@ApiModelProperty(value = "本周拥堵总次数与上周比较情况", example = "增加【减少】10%",position = 6)
private String weekCongestCountCompare;
@ApiModelProperty(value = "本周拥堵时长", example = "3.5小时",position = 7)
private String weekCongestDuration;
@ApiModelProperty(value = "本周拥堵时长与上周比较情况", example = "增加【减少】13%",position = 8)
private String weekCongestDurationCompare;
//================================================================================================//
@ApiModelProperty(value = "本周总体效果情况", example = "明显提升",position = 9)
private String weekTotalitySituation;
private List<CrossProblemTotalityData> dataList=new ArrayList<>();
}
@Data
class CrossProblemTotalityData {
@ApiModelProperty(value = "数据类型:1次数 2时长",example = "1",position = 0)
private String dataType ;
@ApiModelProperty(value = "本周溢出数值【次数或时长】",example = "8900",position = 0)
private String thisWeekOverFlowNumber ;
@ApiModelProperty(value = "上周溢出数值【次数或时长】",example = "8900",position = 1)
private String lastWeekOverFlowNumber ;
@ApiModelProperty(value = "本周拥堵数值【次数或时长】",example = "8900",position = 2)
private String thisWeekCongestNumber ;
@ApiModelProperty(value = "上周拥堵数值【次数或时长】",example = "8900",position = 3)
private String lastWeekCongestNumber ;
@ApiModelProperty(value = "本周失衡数值【次数或时长】",example = "8900",position = 4)
private String thisWeekUnbalanceNumber ;
@ApiModelProperty(value = "上周失衡数值【次数或时长】",example = "8900",position = 5)
private String lastWeekUnbalanceNumber ;
@ApiModelProperty(value = "本周空放数值【次数或时长】",example = "8900",position = 6)
private String thisWeekEmptyPassNumber ;
@ApiModelProperty(value = "上周空放数值【次数或时长】",example = "8900",position = 7)
private String lastWeekEmptyPassNumber ;
}
package net.wanji.opt.controllerv2.report.design;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import net.wanji.opt.controllerv2.report.vo.CrossRidLaneVO;
import net.wanji.opt.controllerv2.report.vo.LaneDirNumVO;
import java.util.ArrayList;
import java.util.List;
@Data
public class CrossRidLaneInfoResult extends ParentResult {
private List<CrossRidLaneResultRespose> content;
public List<CrossRidLaneResultRespose> getContent() {
return content;
}
public CrossRidLaneInfoResult setContent(List<CrossRidLaneResultRespose> content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class CrossRidLaneResultRespose {
@ApiModelProperty(value = "路口id" ,example = "13MHA0B5SJ0")
private String crossId;
@ApiModelProperty(value = "路口名称",example = "经十路与纬一路交叉口")
private String crossName;
@ApiModelProperty(value = "路口类型",example = "丁字口")
private String type;
@ApiModelProperty(value = "路口坐标" ,example = "117.221,38.2344")
private String location;
@ApiModelProperty(value = "道路车道数信息" )
private List<CrossRidLaneVORespose> crossRidLaneList;
}
@Data
class CrossRidLaneVORespose {
@ApiModelProperty(value = "车道名称" ,example = "旅游路")
private String laneName;
@ApiModelProperty(value = "车道走向",example = "东西走向")
private String laneDir;
@ApiModelProperty(value = "车道数" ,example = "1")
private Integer laneNum;
@ApiModelProperty(value = "车道方向数量" )
private List<LaneDirNumVORespose> laneDirList;
}
@Data
class LaneDirNumVORespose {
@ApiModelProperty(value = "车道进口方向" ,example = "1")
private String laneInDir;
@ApiModelProperty(value = "车道方向数量" ,example = "1")
private Integer laneDirNum;
@ApiModelProperty(value = "转向车道数量" ,example = "1直行,1直右")
private String laneTurnNum;
}
package net.wanji.opt.controllerv2.report.design;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import java.util.ArrayList;
import java.util.List;
@Data
public class CrossRunStateAnalysisResult extends ParentResult {
private CrossRunStateAnalysisResultResponse content;
public CrossRunStateAnalysisResultResponse getContent() {
return content;
}
public CrossRunStateAnalysisResult setContent(CrossRunStateAnalysisResultResponse content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class CrossRunStateAnalysisResultResponse {
@ApiModelProperty(value = "区域周最大流量路口名称", example = "经十路(舜耕路-山大路)")
private String maxFlowCrossName;
@ApiModelProperty(value = "区域周交通指数最大路口名称", example = "经十路(舜耕路-山大路)")
private String maxTrafficIndexCrossName;
@ApiModelProperty(value = "工作日平均流量", example = "13459899辆")
private String workDayAvgFlow;
@ApiModelProperty(value = "工作日早高峰最大小时流量", example = "35490辆")
private String workDayAmPeakMaxHourFlow;
@ApiModelProperty(value = "工作日晚高峰最大小时流量", example = "23454辆")
private String workDayPmPeakMaxHourFlow;
@ApiModelProperty(value = "工作日平峰最大小时流量", example = "234598辆")
private String workDayFmPeakMaxHourFlow;
@ApiModelProperty(value = "周末全天平均流量", example = "234598辆%")
private String weekEndAvgFlow;
@ApiModelProperty(value = "工作日早高峰平均交通指数", example = "4.5")
private String workDayAmPeakAvgTrafficIndex;
@ApiModelProperty(value = "工作日晚高峰平均交通指数", example = "5.5")
private String workDayPmPeakAvgTrafficIndex;
//========================================================================
@ApiModelProperty(value = "工作日平均流量与上周比较情况", example = "提升【下降】34000辆")
private String avgFlowLastWeekCompare;
@ApiModelProperty(value = "工作日早高峰最大小时流量与上周比较情况", example = "提升【下降】2300辆")
private String amPeakMaxHourFlowLastWeekCompare;
@ApiModelProperty(value = "工作日晚高峰最大小时流量与上周比较情况", example = "提升【下降】3100辆")
private String pmPeakMaxHourFlowLastWeekCompare;
@ApiModelProperty(value = "工作日平峰最大小时流量与上周比较情况", example = "提升【下降】1200辆")
private String fmPeakMaxHourFlowLastWeekCompare;
@ApiModelProperty(value = "周末全天平均流量与上周比较情况", example = "提升【下降】12000辆")
private String endAvgFlowLastWeekCompare;
@ApiModelProperty(value = "工作日早高峰平均交通指数与上周比较情况", example = "增加【减少】20%")
private String amPeakAvgTrafficIndexLastWeekCompare;
@ApiModelProperty(value = "工作日晚高峰平均交通指数与上周比较情况", example = "增加【减少】25%")
private String pmPeakAvgTrafficIndexLastWeekCompare;
//================================================================================================//
private List<CrossRunStateDetailAnalysisData> dataList = new ArrayList<>();
}
@Data
class CrossRunStateDetailAnalysisData {
@ApiModelProperty(value = "路口名称", example = "经十路(舜耕路-山大路)",position =1)
private String crossName;
@ApiModelProperty(value = "本周高峰最大小时流量", example = "8900",position = 2)
private Integer thisWeekPeakMaxFlow;
@ApiModelProperty(value = "上周高峰最大小时流量", example = "8900",position =3)
private Integer lastWeekPeakMaxFlow;
@ApiModelProperty(value = "本周周末最大小时流量", example = "8900",position = 4)
private Integer thisWeekEndMaxFlow;
@ApiModelProperty(value = "上周周末最大小时流量", example = "8900",position = 5)
private Integer lastWeekEndMaxFlow;
@ApiModelProperty(value = "本周工作日早高峰交通指数", example = "4.0",position = 5)
private Integer thisWeekWorkDayAmTrafficIndex;
@ApiModelProperty(value = "上周周工作日早高峰交通指数", example = "3.5",position = 6)
private Integer lastWeekWorkDayAmTrafficIndex;
@ApiModelProperty(value = "本周工作日晚高峰交通指数", example = "3.5",position = 7)
private Integer thisWeekWorkDayPmTrafficIndex;
@ApiModelProperty(value = "上周周工作日晚高峰交通指数", example = "4.5",position = 8)
private Integer lastWeekWorkDayPmTrafficIndex;
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.design;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import java.util.ArrayList;
import java.util.List;
@Data
public class CrossRunStatePeakAnalysisResult extends ParentResult {
private List<CrossRunStatePeakResultResponse> content;
public List<CrossRunStatePeakResultResponse> getContent() {
return content;
}
public CrossRunStatePeakAnalysisResult setContent(List<CrossRunStatePeakResultResponse> content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class CrossRunStatePeakResultResponse {
@ApiModelProperty(value = "路口名称", example = "经十路(舜耕路-山大路)")
private String crossName;
@ApiModelProperty(value = "工作日早高峰平均交通指数与上周比较情况", example = "增加【减少】10%")
private String amPeakAvgTrafficIndexLastWeekCompare;
@ApiModelProperty(value = "工作日晚高峰平均交通指数与上周比较情况", example = "增加【减少】10%")
private String pmPeakAvgTrafficIndexLastWeekCompare;
@ApiModelProperty(value = "工作日早高峰通行能力与上周比较情况", example = "提升【下降】5%")
private String amPeakCapacityLastWeekCompare;
@ApiModelProperty(value = "工作日晚高峰通行能力与上周比较情况", example = "提升【下降】5%")
private String pmPeakCapacityLastWeekCompare;
@ApiModelProperty(value = "工作日早高峰平均延误与上周比较情况", example = "增加【减少】11%")
private String amPeakDelayTimeLastWeekCompare;
@ApiModelProperty(value = "工作日晚高峰平均延误与上周比较情况", example = "增加【减少】11%")
private String pmPeakDelayTimeLastWeekCompare;
@ApiModelProperty(value = "工作日早高峰最大排队与上周比较情况", example = "增加【减少】11%")
private String amPeakMaxQueueLengthLastWeekCompare;
@ApiModelProperty(value = "工作日晚高峰最大排队与上周比较情况", example = "增加【减少】11%")
private String pmPeakMaxQueueLengthLastWeekCompare;
@ApiModelProperty(value = "工作日早高峰停车次数与上周比较情况", example = "增加【减少】5%")
private String amPeakStopTimesLastWeekCompare;
@ApiModelProperty(value = "工作日晚高峰停车次数与上周比较情况", example = "增加【减少】5%")
private String pmPeakStopTimesLastWeekCompare;
@ApiModelProperty(value = "总体运行效果", example = "明显提升【略有下降】")
private String totalityRunSituation;
//================================================================================================//
@ApiModelProperty(value = "本周早高峰集中时段", example = "7:30~8:30")
private String thisWeekAmPeakTimeSpan;
@ApiModelProperty(value = "本周早高峰集中时段持续时长", example = "45分钟")
private String thisWeekAmPeakDuration;
@ApiModelProperty(value = "本周早高峰时段开始时间上周比较情况", example = "提前【延后】20分钟")
private String thisWeekAmPeakStartTimeSituation;
@ApiModelProperty(value = "本周早高峰时段结束时间上周比较情况", example = "提前【延后】20分钟")
private String thisWeekAmPeakEndTimeSituation;
@ApiModelProperty(value = "本周早高峰持续时长上周比较情况", example = "提前【延后】20分钟")
private String thisWeekAmPeakDurationSituation;
@ApiModelProperty(value = "本周早高峰集中时段", example = "7:30~8:30")
private String thisWeekPmPeakTimeSpan;
@ApiModelProperty(value = "本周早高峰集中时段持续时长", example = "45分钟")
private String thisWeekPmPeakDuration;
@ApiModelProperty(value = "本周早高峰时段开始时间上周比较情况", example = "提前【延后】20分钟")
private String thisWeekPmPeakStartTimeSituation;
@ApiModelProperty(value = "本周早高峰时段结束时间上周比较情况", example = "提前【延后】20分钟")
private String thisWeekPmPeakEndTimeSituation;
@ApiModelProperty(value = "本周早高峰持续时长上周比较情况", example = "提前【延后】20分钟")
private String thisWeekPmPeakDurationSituation;
//================================================================================================//
//峰期交通流参数对比分析
private List<CrossRunStatePeakDetailAnalysisData> dataList = new ArrayList<>();
//高峰期时段分析
private List<CrossRunStatePeakTimeSpanAnalysisData> peakList = new ArrayList<>();
}
@Data
class CrossRunStatePeakDetailAnalysisData {
@ApiModelProperty(value = "峰期名称", example = "早高峰/晚高峰",position = 0)
private String peakName;
@ApiModelProperty(value = "本周交通指数", example = "3.4",position = 1)
private Integer thisWeekTrafficIndex;
@ApiModelProperty(value = "上周交通指数", example = "3.4",position = 2)
private Integer lastWeekTrafficIndex;
@ApiModelProperty(value = "本周通行能力", example = "15900",position = 3)
private Integer thisWeekWorkCapacity;
@ApiModelProperty(value = "上周通行能力", example = "16000",position = 4)
private Integer lastWeekCapacity;
@ApiModelProperty(value = "本周平均延误(S)", example = "40",position = 5)
private Integer thisWeekWorkDelayTime;
@ApiModelProperty(value = "上周平均延误(S)", example = "40",position = 6)
private Integer lastWeekDelayTime;
@ApiModelProperty(value = "本周最大排队", example = "240",position = 7)
private Integer thisWeekMaxQueueLength;
@ApiModelProperty(value = "上周最大排队", example = "240",position = 8)
private Integer lastWeekMaxQueueLength;
@ApiModelProperty(value = "本周停车次数", example = "4",position = 9)
private Integer thisWeekStopTimes;
@ApiModelProperty(value = "上周停车次数", example = "3.5",position = 10)
private Integer lastWeekStopTimes;
}
@Data
class CrossRunStatePeakTimeSpanAnalysisData {
@ApiModelProperty(value = "星期", example = "周一",position = 0)
private String weekName;
@ApiModelProperty(value = "本周早高峰时段", example = "7:00~8:00",position = 1)
private String thisWeekAmPeakTimeSpan;
@ApiModelProperty(value = "上周早高峰时段", example = "7:00~8:00",position = 2)
private String lastWeekAmPeakTimeSpan;
@ApiModelProperty(value = "本周早高峰持续时长(min)", example = "30",position = 3)
private String thisWeekAmPeakDuration;
@ApiModelProperty(value = "上周早高峰持续时长(min)", example = "30",position = 4)
private String lastWeekAmPeakDuration;
@ApiModelProperty(value = "本周晚高峰时段", example = "7:00~8:00",position = 5)
private String thisWeekPmPeakTimeSpan;
@ApiModelProperty(value = "上周晚高峰时段", example = "7:00~8:00",position = 6)
private String lastWeekPmPeakTimeSpan;
@ApiModelProperty(value = "本周晚高峰持续时长(min)", example = "30",position = 7)
private String thisWeekPmPeakDuration;
@ApiModelProperty(value = "上周晚高峰持续时长(min)", example = "30",position = 8)
private String lastWeekPmPeakDuration;
}
package net.wanji.opt.controllerv2.report.design;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import java.util.ArrayList;
import java.util.List;
@Data
public class GreenReportOverviewAnalysisResult extends ParentResult {
private List<GreenReportOverviewResultResponse> content;
public List<GreenReportOverviewResultResponse> getContent() {
return content;
}
public GreenReportOverviewAnalysisResult setContent(List<GreenReportOverviewResultResponse> content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class GreenReportOverviewResultResponse {
private List<GreenReportOverview> dataList=new ArrayList<>();
}
@Data
class GreenReportOverview {
@ApiModelProperty(value = "路口ID",example = "")
private String greenId ;
@ApiModelProperty(value = "干线名称",example = "")
private String greenName ;
@ApiModelProperty(value = "干线路段长度,单位米",example = "122")
private double length ;
@ApiModelProperty(value = "干线道路类型,以文字形式描述",example = "主干道")
private String greenRoadType ;
@ApiModelProperty(value = "排名-按拥堵指数排名",example = "1")
private Integer rank ;
@ApiModelProperty(value = "平均拥堵指数",example = "1.5")
private Double congestIndex ;
@ApiModelProperty(value = "平均拥堵指数",example = "1.5")
private Double maxCongestIndex ;
@ApiModelProperty(value = "拥堵次数",example = "1.5")
private Double congestCount ;
@ApiModelProperty(value = "拥堵总时长,单位秒",example = "1.5")
private Double congestDuration;
@ApiModelProperty(value = "拥堵次数中的最大拥堵时长,单位秒",example = "2000")
private Double maxCongestDuration;
@ApiModelProperty(value = "平均拥堵时长,单位秒",example = "2000")
private Double avgCongestDuration;
@ApiModelProperty(value = "最长使时间拥堵时间分布",example = "周一7:30~8:15")
private String congestTimeDistribute;
@ApiModelProperty(value = "最长时间拥堵时段分布",example = "周一7:30~8:15")
private String maxCongestTimeDistribute;
@ApiModelProperty(value = "本周拥堵时段集中分布情况",example = "周一7:30~8:15,周五17:30~18:15")
private String weekCongestTimeDistribute;
@ApiModelProperty(value = "拥堵严重干线",example = "经十路(舜耕路-山大路)、经十路(洪山路-舜华路)")
private String congestHeavyGreenWave;
}
package net.wanji.opt.controllerv2.report.design;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import java.util.ArrayList;
import java.util.List;
@Data
public class GreenReportProblemDetailAnalysis extends ParentResult {
private List<GreenReportProblemDetailAnalysisResponse> content;
public List<GreenReportProblemDetailAnalysisResponse> getContent() {
return content;
}
public GreenReportProblemDetailAnalysis setContent(List<GreenReportProblemDetailAnalysisResponse> content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class GreenReportProblemDetailAnalysisResponse {
@ApiModelProperty(value = "干线ID", example = "")
private String greenId;
@ApiModelProperty(value = "干线名称", example = "经十路(舜耕路-山大路)")
private String greenName;
@ApiModelProperty(value = "干线工作日拥堵时段分布情况", example = "7:00~8:00,12:00~13:30,17:30~18:40")
private String workDayCongestSpan;
@ApiModelProperty(value = "干线工作日平均拥堵时长", example = "1小时")
private String workDayAvgCongestTime;
@ApiModelProperty(value = "干线工作日平均拥堵指数",example = "3.5")
private String workDayAvgCongestIndex;
//================================================================================================//
@ApiModelProperty(value = "干线工作日缓行时段分布情况", example = "7:00~8:00,12:00~13:30,17:30~18:40")
private String workDaySlowRunSpan;
@ApiModelProperty(value = "干线工作日平均缓行时长", example = "0.5小时")
private String workDayAvgSlowRunTime;
@ApiModelProperty(value = "干线工作日缓行平均拥堵指数",example = "3.5")
private String workDayAvgSlowAvgCongestIndex;
//================================================================================================//
@ApiModelProperty(value = "干线周末拥堵时段分布情况", example = "7:00~8:00,12:00~13:30,17:30~18:40")
private String weekEndCongestSpan;
@ApiModelProperty(value = "干线周末平均拥堵时长", example = "1小时")
private String weekEndAvgCongestTime;
@ApiModelProperty(value = "干线周末平均拥堵指数",example = "3.5")
private String weekEndAvgCongestIndex;
//================================================================================================//
@ApiModelProperty(value = "干线周末缓行时段分布情况", example = "7:00~8:00,12:00~13:30,17:30~18:40")
private String weekEndSlowRunSpan;
@ApiModelProperty(value = "干线周末平均缓行时长", example = "0.5小时")
private String weekEndAvgSlowRunTime;
@ApiModelProperty(value = "干线周末缓行平均拥堵指数",example = "3.5")
private String weekEndAvgSlowAvgCongestIndex;
private List<GreenReportProblemDetail> dataList = new ArrayList<>();
}
@Data
class GreenReportProblemDetail {
@ApiModelProperty(value = "星期", example = "周一")
private String week;
@ApiModelProperty(value = "问题时段", example = "7:35~8:40")
private String problemSpan;
@ApiModelProperty(value = "状态:缓行/拥堵", example = "拥堵")
private String status;
@ApiModelProperty(value = "拥堵指数", example = "4.5")
private Double congestIndex;
@ApiModelProperty(value = "平均速度", example = "10")
private Integer avgSpeed;
@ApiModelProperty(value = "行程时间,单位分钟", example = "10")
private Integer travelTime;
}
package net.wanji.opt.controllerv2.report.design;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import java.util.ArrayList;
import java.util.List;
@Data
public class GreenReportProblemOverallAnalysis extends ParentResult {
private GreenReportProblemOverallAnalysisResponse content;
public GreenReportProblemOverallAnalysisResponse getContent() {
return content;
}
public GreenReportProblemOverallAnalysis setContent(GreenReportProblemOverallAnalysisResponse content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class GreenReportProblemOverallAnalysisResponse {
@ApiModelProperty(value = "区域干线总拥堵次数", example = "56次")
private String totalCongestCount;
@ApiModelProperty(value = "区域干线总拥堵时长", example = "11小时")
private String totalCongestDuration;
@ApiModelProperty(value = "拥堵严重干线",example = "经十路(舜耕路-山大路)、经十路(洪山路-舜华路)")
private String congestHeavyGreenWave;
private List<GreenReportProblemOverallData> dataList = new ArrayList<>();
}
@Data
class GreenReportProblemOverallData {
@ApiModelProperty(value = "排序", example = "")
private String sort;
@ApiModelProperty(value = "干线ID", example = "")
private String greenId;
@ApiModelProperty(value = "干线名称", example = "经十路(舜耕路-山大路)")
private String greenName;
List<GreenWaveDirProblemData> list = new ArrayList<>();
}
@Data
class GreenWaveDirProblemData{
@ApiModelProperty(value = "干线类型", example = "主干路")
private String greenWaveType;
@ApiModelProperty(value = "方向", example = "东向西")
private String dir;
@ApiModelProperty(value = "拥堵指数", example = "4.5")
private Double congestIndex;
@ApiModelProperty(value = "拥堵次数", example = "10")
private Integer congestCount;
@ApiModelProperty(value = "拥堵时长,单位秒", example = "10")
private Integer congestDuration;
}
package net.wanji.opt.controllerv2.report.design;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import java.util.ArrayList;
import java.util.List;
@Data
public class GreenReportRunStateResult extends ParentResult {
private List<GreenReportRunStateResponse> content;
public List<GreenReportRunStateResponse> getContent() {
return content;
}
public GreenReportRunStateResult setContent(List<GreenReportRunStateResponse> content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class GreenReportRunStateResponse {
@ApiModelProperty(value = "干线ID", example = "")
private String greenId;
@ApiModelProperty(value = "干线名称", example = "经十路(舜耕路-山大路)")
private String greenName;
@ApiModelProperty(value = "本周早高峰时段集中情况", example = "7:30~8:30")
private String weekAmPeakSpan;
@ApiModelProperty(value = "本周早高峰时段开始时间同比(上周)情况", example = "提前20分钟")
private String amStartSameRatioSituation;
@ApiModelProperty(value = "本周早高峰时段截止时间同比(上周)情况", example = "延后20分钟")
private String amEndSameRatioSituation;
@ApiModelProperty(value = "本周早高峰时段持续时长", example = "45分钟")
private String amDuration;
@ApiModelProperty(value = "本周早高峰时段持续时长同比(上周)情况", example = "增加5分钟")
private String amDurationSameRatioSituation;
@ApiModelProperty(value = "本周早高峰最大行程时间", example = "30分钟")
private String amMaxTravelTime;
@ApiModelProperty(value = "本周早高峰最大行程时间同比(上周)情况", example = "减少6分钟")
private String amMaxTravelTimeSameRatioSituation;
@ApiModelProperty(value = "平均拥堵指数", example = "4.5")
private String amAvgContestIndex;
@ApiModelProperty(value = "平均拥堵指数同比(上周)情况", example = "减少0.5")
private String amAvgContestIndexSameRatioSituation;
@ApiModelProperty(value = "本周早高峰时段集中情况", example = "7:30~8:30")
private String weekPmPeakSpan;
@ApiModelProperty(value = "本周早高峰时段开始时间同比(上周)情况", example = "提前20分钟")
private String pmStartSameRatioSituation;
@ApiModelProperty(value = "本周早高峰时段截止时间同比(上周)情况", example = "延后20分钟")
private String pmEndSameRatioSituation;
@ApiModelProperty(value = "本周早高峰时段持续时长", example = "45分钟")
private String pmDuration;
@ApiModelProperty(value = "本周早高峰时段持续时长同比(上周)情况", example = "增加5分钟")
private String pmDurationSameRatioSituation;
@ApiModelProperty(value = "本周早高峰最大行程时间", example = "30分钟")
private String pmMaxTravelTime;
@ApiModelProperty(value = "本周早高峰最大行程时间同比(上周)情况", example = "减少6分钟")
private String pmMaxTravelTimeSameRatioSituation;
@ApiModelProperty(value = "平均拥堵指数", example = "4.5")
private String pmAvgContestIndex;
@ApiModelProperty(value = "平均拥堵指数同比(上周)情况", example = "减少0.5")
private String pmAvgContestIndexSameRatioSituation;
private List<GreenReportRunStatedData> dataList = new ArrayList<>();
}
@Data
class GreenReportRunStatedData {
@ApiModelProperty(value = "星期", example = "星期一")
private String weekName;
@ApiModelProperty(value = "峰期类型 早高峰、晚高峰、全天", example = "早高峰")
private String peakName;
@ApiModelProperty(value = "本周拥堵时段", example = "7:35~8:40")
private String thisWeekCongestSpan;
@ApiModelProperty(value = "上周拥堵时段", example = "7:50~8:40")
private String lastWeekCongestSpan;
@ApiModelProperty(value = "本周拥堵指数", example = "3.5")
private Double thisWeekCongestIndex;
@ApiModelProperty(value = "上周拥堵指数", example = "3.0")
private Double lastWeekCongestIndex;
@ApiModelProperty(value = "本周平均车速km/h", example = "30.5")
private Double thisWeekAvgSpeed;
@ApiModelProperty(value = "上周平均车速km", example = "30.2")
private Double lastWeekAvgSpeed;
@ApiModelProperty(value = "本周行程时间(分钟)", example = "6.5")
private Double thisWeekTravelTime;
@ApiModelProperty(value = "上周行程时间(分钟)", example = "-1.5%")
private Double lastWeekTravelTime;
}
package net.wanji.opt.controllerv2.report.design;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import net.wanji.opt.controllerv2.report.vo.GreenReportSamePeriodData;
import java.util.ArrayList;
import java.util.List;
@Data
public class GreenReportSamePeriodCompareResult extends ParentResult {
private List<GreenReportSamePeriodCompareDataResponse> content;
public List<GreenReportSamePeriodCompareDataResponse> getContent() {
return content;
}
public GreenReportSamePeriodCompareResult setContent(List<GreenReportSamePeriodCompareDataResponse> content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class GreenReportSamePeriodCompareDataResponse {
@ApiModelProperty(value = "干线ID", example = "")
private String greenId;
@ApiModelProperty(value = "干线名称", example = "")
private String greenName;
@ApiModelProperty(value = "早高峰流量情况", example = "减少")
private String amPeakSituation;
@ApiModelProperty(value = "晚高峰流量情况", example = "减少")
private String pmPeakSituation;
@ApiModelProperty(value = "行程时间同比情况", example = "增加20s")
private String amTravelTimeSituation;
@ApiModelProperty(value = "行程时间同比情况", example = "减少20s")
private String pmTravelTimeSituation;
private List<GreenReportSamePeriodDataBody> dataList = new ArrayList<>();
}
@Data
class GreenReportSamePeriodDataBody {
@ApiModelProperty(value = "峰期类型 早高峰、晚高峰、全天", example = "早高峰")
private String peakName;
@ApiModelProperty(value = "通行量(辆)", example = "736278")
private Integer peakFlow;
@ApiModelProperty(value = "通行量同比", example = "-1.5%")
private Double peakFlowRatio;
@ApiModelProperty(value = "拥堵指数", example = "3.5")
private Double congestIndex;
@ApiModelProperty(value = "拥堵指数同比", example = "3.5%")
private Double congestIndexRatio;
@ApiModelProperty(value = "平均车速km/h", example = "30.5")
private Double avgSpeed;
@ApiModelProperty(value = "平均车速同比", example = "-1.5%")
private Double avgSpeedRatio;
@ApiModelProperty(value = "行程时间(分钟)", example = "6.5")
private Double travelTime;
@ApiModelProperty(value = "行程时间同比", example = "-1.5%")
private Double travelTimeRatio;
}
package net.wanji.opt.controllerv2.report.design;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import java.util.ArrayList;
import java.util.List;
@Data
public class GreenWaveOptimizeAnalysisResult extends ParentResult {
private GreenWaveOptimizeAnalysisResultResponse content;
public GreenWaveOptimizeAnalysisResultResponse getContent() {
return content;
}
public GreenWaveOptimizeAnalysisResult setContent(GreenWaveOptimizeAnalysisResultResponse content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class GreenWaveOptimizeAnalysisResultResponse {
@ApiModelProperty(value = "干线ID", example = "")
private String greenId;
@ApiModelProperty(value = "干线名称", example = "经十路(舜耕路-山大路)")
private String greenName;
@ApiModelProperty(value = "本周优化次数", example = "300次")
private String weekOptimizeCount;
@ApiModelProperty(value = "本周优化时长", example = "98小时")
private String weekOptimizeDuration;
@ApiModelProperty(value = "本周通行能力同比情况", example = "提升10%")
private String weekCapacitySituation;
@ApiModelProperty(value = "本周通停车次数同比情况", example = "减少10%")
private String weekStopTimesSituation;
@ApiModelProperty(value = "本周通行程时间数同比情况", example = "增加10%")
private String weekTravelTimeSituation;
@ApiModelProperty(value = "本周通延误时间同比情况", example = "增加10%")
private String weekDelayTimeSituation;
@ApiModelProperty(value = "本周通平均速度同比情况", example = "降低10%")
private String weekAvgSpeedSituation;
@ApiModelProperty(value = "本周总体情况", example = "降低10%")
private String weekTotalitySituation;
//================================================================================================//
@ApiModelProperty(value = "时段列表",example = "[\"本周\",\"上周\"]")
private List<String> timeList = new ArrayList<>();
private List<GreenWaveOptimizeAnalysisData> dataList=new ArrayList<>();
}
@Data
class GreenWaveOptimizeAnalysisData {
@ApiModelProperty(value = "通行能力",example = "8900")
private Integer capacity ;
@ApiModelProperty(value = "停车次数",example = "5")
private Double stopTimes ;
@ApiModelProperty(value = "延误时间,单位秒",example = "40")
private Double delayTime ;
@ApiModelProperty(value = "行程时间,单位秒",example = "6.9")
private Double travelTime ;
@ApiModelProperty(value = "平均速度",example = "39")
private Double avgSpeed ;
}
package net.wanji.opt.controllerv2.report.design;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import java.util.ArrayList;
import java.util.List;
@Data
public class ImportCrossReportAnalysis extends ParentResult {
private List<ImportCrossAnalysisResponse> content;
public List<ImportCrossAnalysisResponse> getContent() {
return content;
}
public ImportCrossReportAnalysis setContent(List<ImportCrossAnalysisResponse> content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class ImportCrossAnalysisResponse {
@ApiModelProperty(value = "路口名称", example = "经十路(舜耕路-山大路)",position = 0)
private String crossName;
@ApiModelProperty(value = "本周优化集中时段分布情况", example = "7:00~8:00,12:00~13:30,17:30~18:40",position = 1)
private String optimizeSpan;
@ApiModelProperty(value = "本周溢出优化次数", example = "10次",position = 2)
private String overFlowOptimizeCount;
@ApiModelProperty(value = "本周溢出主要发生方向", example = "北出口、南出口",position = 3)
private String overFlowDirs;
@ApiModelProperty(value = "本周拥堵优化次数", example = "10次",position = 4)
private String congestOptimizeCount;
@ApiModelProperty(value = "本周拥堵主要发生方向", example = "北出口、南出口",position = 5)
private String congestDirs;
@ApiModelProperty(value = "本周空放优化次数", example = "10次",position = 6)
private String emptyPassOptimizeCount;
@ApiModelProperty(value = "本周空放主要发生方向", example = "北出口、南出口",position = 7)
private String emptyPassDirs;
@ApiModelProperty(value = "本周失衡优化次数", example = "10次",position = 8)
private String unbalanceOptimizeCount;
@ApiModelProperty(value = "本周失衡主要发生方向", example = "北出口、南出口",position = 9)
private String unbalanceDirs;
//================================================================================================//
@ApiModelProperty(value = "本周平均通行能力", example = "7800辆/小时",position = 10)
private String avgCapacity;
@ApiModelProperty(value = "平均通行能力与上周相比情况", example = "提升",position = 11)
private String avgCapacityCompareSituation;
//================================================================================================//
@ApiModelProperty(value = "本周延误时间", example = "22",position = 12)
private String delayTime;
@ApiModelProperty(value = "延误时间与上周相比情况", example = "增加【减少】10%",position = 13)
private String delayTimeCompare;
//================================================================================================//
@ApiModelProperty(value = "本周停车次数", example = "22",position = 14)
private String avgStopTimes;
@ApiModelProperty(value = "平均拥堵指数与上周相比情况", example = "增加【减少】10%",position = 15)
private String avgCongestIndexCompare;
//================================================================================================//
@ApiModelProperty(value = "本周最大排队长度", example = "203",position = 16)
private String maxQueueLength;
@ApiModelProperty(value = "本周最大排队长度与上周相比情况", example = "提升【降低】10%",position = 17)
private String maxQueueLengthCompare;
//================================================================================================//
@ApiModelProperty(value = "本周总体效果情况", example = "明显提升",position = 18)
private String weekTotalitySituation;
private List<ImportCrossReportAnalysisData> dataList = new ArrayList<>();
}
@Data
class ImportCrossReportAnalysisData {
@ApiModelProperty(value = "星期", example = "星期一", position = 0)
private String weekName;
@ApiModelProperty(value = "策略优化时段", example = "7:35~8:40", position = 1)
private String optimizeTimeSpan;
@ApiModelProperty(value = "本周优化次数与问题次数比", example = "20/100", position = 2)
private String thisWeekCountRadio;
@ApiModelProperty(value = "上周优化次数与问题次数比", example = "20/100", position = 3)
private String lastWeekCountRadio;
@ApiModelProperty(value = "本周通行能力", example = "3466", position = 4)
private Integer thisWeekCapacity;
@ApiModelProperty(value = "上周通行能力", example = "5600", position = 5)
private Integer lastWeekCapacity;
@ApiModelProperty(value = "本周停车次数", example = "20", position = 6)
private Double thisWeekStopTimes;
@ApiModelProperty(value = "上周停车次数", example = "30", position = 7)
private Double lastWeekStopTimes;
@ApiModelProperty(value = "本周延误时间", example = "30.5", position = 8)
private Double thisWeekDelayTime;
@ApiModelProperty(value = "上周延误时间", example = "30.2", position = 9)
private Double lastWeekDelayTime;
@ApiModelProperty(value = "本周最大排队长度", example = "6.5", position = 10)
private Double thisWeekMaxQueueLength;
@ApiModelProperty(value = "上周最大排队长度", example = "-1.5%", position = 11)
private Double lastWeekMaxQueueLength;
}
package net.wanji.opt.controllerv2.report.design;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.ParentResult;
import java.util.ArrayList;
import java.util.List;
@Data
public class ImportGreenReportAnalysis extends ParentResult {
private List<ImportGreenReportAnalysisResponse> content;
public List<ImportGreenReportAnalysisResponse> getContent() {
return content;
}
public ImportGreenReportAnalysis setContent(List<ImportGreenReportAnalysisResponse> content) {
this.content = content;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
@Data
class ImportGreenReportAnalysisResponse {
@ApiModelProperty(value = "干线ID", example = "")
private String greenId;
@ApiModelProperty(value = "干线名称", example = "经十路(舜耕路-山大路)")
private String greenName;
@ApiModelProperty(value = "本周优化集中时段分布情况", example = "7:00~8:00,12:00~13:30,17:30~18:40")
private String optimizeSpan;
@ApiModelProperty(value = "本周平均通行能力", example = "7800辆/小时")
private String avgCapacity;
@ApiModelProperty(value = "平均通行能力与上周相比情况",example = "提升")
private String avgCapacityCompareSituation;
//================================================================================================//
@ApiModelProperty(value = "本周平均拥堵指数", example = "2.3")
private String avgCongestIndex;
@ApiModelProperty(value = "平均拥堵指数与上周相比情况", example = "增加【减少】10%")
private String avgCongestIndexCompare;
//================================================================================================//
@ApiModelProperty(value = "本周平均速度", example = "2.3")
private String avgSpeed;
@ApiModelProperty(value = "本周平均速度与上周相比情况", example = "提升【降低】10%")
private String avgSpeedCompare;
//================================================================================================//
@ApiModelProperty(value = "本周行程时间", example = "15")
private String avgTravelTime;
@ApiModelProperty(value = "本周平均行程时间与上周相比情况", example = "增加【减少】2分钟")
private String avgTravelTimeCompare;
//================================================================================================//
@ApiModelProperty(value = "本周总体效果情况", example = "明显提升")
private String weekTotalitySituation;
private List<ImportGreenReportAnalysisData> dataList = new ArrayList<>();
}
@Data
class ImportGreenReportAnalysisData {
@ApiModelProperty(value = "星期", example = "星期一")
private String weekName;
@ApiModelProperty(value = "策略优化时段", example = "7:35~8:40")
private String optimizeTimeSpan;
@ApiModelProperty(value = "本周通行能力", example = "3466")
private Integer thisWeekCapacity;
@ApiModelProperty(value = "上周通行能力", example = "5600")
private Integer lastWeekCapacity;
@ApiModelProperty(value = "本周拥堵指数", example = "3.5")
private Double thisWeekCongestIndex;
@ApiModelProperty(value = "上周拥堵指数", example = "3.0")
private Double lastWeekCongestIndex;
@ApiModelProperty(value = "本周平均车速km/h", example = "30.5")
private Double thisWeekAvgSpeed;
@ApiModelProperty(value = "上周平均车速km", example = "30.2")
private Double lastWeekAvgSpeed;
@ApiModelProperty(value = "本周行程时间(分钟)", example = "6.5")
private Double thisWeekTravelTime;
@ApiModelProperty(value = "上周行程时间(分钟)", example = "-1.5%")
private Double lastWeekTravelTime;
}
package net.wanji.opt.controllerv2.report.util;
import lombok.Data;
import java.time.Duration;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
public class TimeIntervalMerger {
// 定义时间区间类
@Data
static class TimeInterval {
private LocalTime start;
private LocalTime end;
public TimeInterval(LocalTime start, LocalTime end) {
this.start = start;
this.end = end;
}
// 判断两个区间是否重叠
public boolean overlapsWith(TimeInterval other) {
return !this.end.isBefore(other.start) && !other.end.isBefore(this.start);
}
// 合并两个区间
public TimeInterval mergeWith(TimeInterval other) {
return new TimeInterval(
this.start.isBefore(other.start) ? this.start : other.start,
this.end.isAfter(other.end) ? this.end : other.end
);
}
// 计算时间段的持续时间(以秒为单位)
public long getDurationInSeconds() {
return Duration.between(start, end).getSeconds();
}
}
// 定义支持单个数字小时部分的 DateTimeFormatter
private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("H:mm");
public static String timeString(List<String> timeStrings) {
// 解析时间字符串为 TimeInterval 对象
List<TimeInterval> intervals = timeStrings.stream()
.map(timeStr -> {
String[] parts = timeStr.split("~");
LocalTime start = LocalTime.parse(parts[0].trim(), TIME_FORMATTER);
LocalTime end = LocalTime.parse(parts[1].trim(), TIME_FORMATTER);
return new TimeInterval(start, end);
})
.sorted(Comparator.comparing(TimeInterval::getStart)) // 按开始时间排序
.collect(Collectors.toList());
// 合并重叠的区间
List<TimeInterval> mergedIntervals = new ArrayList<>();
for (TimeInterval current : intervals) {
if (mergedIntervals.isEmpty() || !current.overlapsWith(mergedIntervals.get(mergedIntervals.size() - 1))) {
mergedIntervals.add(current); // 如果不重叠,直接添加
} else {
// 如果重叠,合并当前区间与最后一个区间
TimeInterval last = mergedIntervals.get(mergedIntervals.size() - 1);
mergedIntervals.set(mergedIntervals.size() - 1, last.mergeWith(current));
}
}
// 按时间段长度从大到小排序
mergedIntervals.sort((t1, t2) -> Long.compare(t2.getDurationInSeconds(), t1.getDurationInSeconds()));
// 截取前三个时间段
List<TimeInterval> topThreeIntervals = mergedIntervals.stream()
.limit(3)
.sorted(Comparator.comparing(TimeInterval::getStart)) // 按开始时间重新排序
.collect(Collectors.toList());
// 拼接结果字符串
StringBuilder result = new StringBuilder();
for (int i = 0; i < topThreeIntervals.size(); i++) {
TimeInterval interval = topThreeIntervals.get(i);
if (i > 0) {
result.append(",");
}
result.append(interval.getStart()).append("~").append(interval.getEnd());
}
return result.toString();
}
// 测试代码
public static void main(String[] args) {
List<String> timeStrings = Arrays.asList(
"7:00~8:00",
"12:00~13:30",
"17:30~18:40",
"7:30~9:00",
"17:00~18:00"
);
String result = timeString(timeStrings);
System.out.println(result); // 输出结果
}
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
@ApiModel(description = "绿波干线高峰时段分析实体类")
public class AnalysisGreenCongestionPeriodVO {
@ApiModelProperty(value = "干线ID", example = "1")
private Integer greenId;
@ApiModelProperty(value = "干线车流运行方向 (w2e/e2w/s2n/n2s)", example = "w2e")
private String roadDirection;
@ApiModelProperty(value = "星期几:1~7代表周一至周日", example = "1")
private Integer weekDay;
@ApiModelProperty(value = "拥堵开始时间", example = "2025-04-07 08:00:00")
private Date congestStartTime;
@ApiModelProperty(value = "拥堵截止时间", example = "2025-04-07 10:00:00")
private Date congestEndTime;
@ApiModelProperty(value = "平均拥堵指数", example = "1.5")
private Double congestIndex;
@ApiModelProperty(value = "拥堵类型:2缓行;3拥堵", example = "2")
private Integer status;
@ApiModelProperty(value = "行程时间,单位秒", example = "3600")
private Integer travelTime;
@ApiModelProperty(value = "平均速度 (km/h)", example = "40.5")
private Double speed;
@ApiModelProperty(value = "高峰类型:1早高峰;2晚高峰", example = "1")
private String peakType;
@ApiModelProperty(value = "一年中的第几周,格式yyyyw,如20251", example = "20251")
private Integer yearWeek;
@ApiModelProperty(value = "一周的第一天", example = "2025-04-07 00:00:00")
private Date weekStartTime;
@ApiModelProperty(value = "一周的最后一天", example = "2025-04-13 23:59:59")
private Date weekEndTime;
@ApiModelProperty(value = "数据插入时间", example = "2025-04-07 12:30:00")
private Date insertTime;
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.vo;
import lombok.Data;
import java.util.Date;
@Data
public class AnalysisGreenWaveOptimizeWeekVO{
private Integer greenId;
/**
* 干线车流运行方向 w2e/e2w/s2n/n2s
*/
private String roadDirection;
/**
* 星期几:1~7代表周一至周日
*/
private Integer weekDay;
/**
* 优化时段开始时间
*/
private Date optimizeStartTime;
/**
* 优化时段截止时间
*/
private Date optimizeEndTime;
/**
* 策略ID
*/
private Integer stragetyId;
/**
* 策略时段内优化次数
*/
private Integer optimizeCount;
/**
* 策略时段内优化总时长,单位秒
*/
private Integer optimizeDuration;
/**
* 拥堵指数
*/
private Double congestIndex;
/**
* 上周拥堵指数
*/
private Double lastWeekCongestIndex;
/**
* 通行能力(辆)
*/
private Integer capacity;
/**
* 上周通行能力(辆)
*/
private Integer lastWeekCapacity;
/**
* 停车次数
*/
private Double stopTimes;
/**
* 上周停车次数
*/
private Double lastWeekStopTimes;
/**
* 延误时间,单位秒
*/
private Double delayTime;
/**
* 上周延误时间,单位秒
*/
private Double lastWeekDelayTime;
/**
* 行程时间,单位秒
*/
private Integer travelTime;
/**
* 上周行程时间,单位秒
*/
private Integer lastWeekTravelTime;
/**
* 平均速度,单位km/h
*/
private Double speed;
/**
* 上周平均速度,单位km/h
*/
private Double lastWeekSpeed;
/**
* 一年中的第几周
*/
private Integer yearWeek;
/**
* 一一年中的第几周,格式yyyyw,如20251
*/
private Date weekStartTime;
/**
* 一周的第二天
*/
private Date weekEndTime;
/**
* 数据插入时间
*/
private Date insertTime;
}
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NonNull;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @author fengyi
* @date 2025/3/31
* @description
*/
@Data
public class AreaParamBody {
@ApiModelProperty(value = "区域名称", example = "",required = true)
String name;
@ApiModelProperty(required = true,value = "区域边界坐标,格式:x1,y1;...;xn,yn", example = "117.049347926,36.654744674;117.066122093,36.654772445;117.0800809517208,36.65440636491661;117.07979265456723,36.65214909599633;117.07706941120558,36.63829789737139;117.07414217382905,36.63736765765722;117.0707410731053,36.636677059391445;117.06550839703021,36.63722151604908;117.06267677771574,36.63667912391616;117.0577271202223,36.63483777099411;117.05251580910459,36.63437969486462;117.04433347163972,36.63696466063367;117.04843387376732,36.637934238407;117.04968488845323,36.638408635754985;117.049347926,36.654744674;117.066122093,36.654772445;117.0800809517208,36.65440636491661;117.07979265456723,36.65214909599633;117.07706941120558,36.63829789737139;117.07414217382905,36.63736765765722;117.0707410731053,36.636677059391445;117.06550839703021,36.63722151604908;117.06267677771574,36.63667912391616;117.0577271202223,36.63483777099411;117.05251580910459,36.63437969486462;117.04433347163972,36.63696466063367;117.04843387376732,36.637934238407;117.04968488845323,36.638408635754985;117.049347926,36.654744674")
String wkt;
@ApiModelProperty(value = "区域类型", example = "2",required = true)
Integer type;
}
package net.wanji.opt.controllerv2.report.vo;
import lombok.Data;
@Data
public class CrossPeakAnalysis {
// 路口 ID
private String crossId;
// 类型:1工作日 2节假日
private Integer dayType;
// 高峰类型 1早高峰 2晚高峰 3平峰
private Integer peakType;
// 日总流量平均值
private Integer dayTotalFlow;
// 日最大小时流量平均值
private Integer dayMaxHourFlow;
// 高峰期最大小时流量平均值
private Integer peakMaxHourFlow;
// 高峰期交通指数平均值
private Double peakTrafficIndex;
// 高峰期通行能力平均值
private Integer peakCapacity;
// 高峰期平均延误时间平均值
private Double peakAvgDelayTime;
// 高峰期最大排队长度平均值
private Integer peakMaxQueueLength;
// 高峰期平均停车次数平均值
private Integer peakAvgStopTimes;
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel(value = "CrossRidLaneVO", description = "车道基础信息")
public class CrossRidLaneVO {
@ApiModelProperty(value = "车道名称" )
private String laneName;
@ApiModelProperty(value = "车道走向" )
private String laneDir;
@ApiModelProperty(value = "车道数" )
private Integer laneNum;
@ApiModelProperty(value = "车道方向数量" )
private List<LaneDirNumVO> laneDirList;
}
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class CrossRunStateAnalysisResultResponseDTO {
@ApiModelProperty(value = "区域周最大流量路口名称", example = "经十路(舜耕路-山大路)")
private String maxFlowCrossName;
@ApiModelProperty(value = "区域周交通指数最大路口名称", example = "经十路(舜耕路-山大路)")
private String maxTrafficIndexCrossName;
@ApiModelProperty(value = "工作日平均流量", example = "13459899辆")
private String workDayAvgFlow;
@ApiModelProperty(value = "工作日早高峰最大小时流量", example = "35490辆")
private String workDayAmPeakMaxHourFlow;
@ApiModelProperty(value = "工作日晚高峰最大小时流量", example = "23454辆")
private String workDayPmPeakMaxHourFlow;
@ApiModelProperty(value = "工作日平峰最大小时流量", example = "234598辆")
private String workDayFmPeakMaxHourFlow;
@ApiModelProperty(value = "周末全天平均流量", example = "234598辆%")
private String weekEndAvgFlow;
@ApiModelProperty(value = "工作日早高峰平均交通指数", example = "4.5")
private String workDayAmPeakAvgTrafficIndex;
@ApiModelProperty(value = "工作日晚高峰平均交通指数", example = "5.5")
private String workDayPmPeakAvgTrafficIndex;
//========================================================================
@ApiModelProperty(value = "工作日平均流量与上周比较情况", example = "提升【下降】34000辆")
private String avgFlowLastWeekCompare;
@ApiModelProperty(value = "工作日早高峰最大小时流量与上周比较情况", example = "提升【下降】2300辆")
private String amPeakMaxHourFlowLastWeekCompare;
@ApiModelProperty(value = "工作日晚高峰最大小时流量与上周比较情况", example = "提升【下降】3100辆")
private String pmPeakMaxHourFlowLastWeekCompare;
@ApiModelProperty(value = "工作日平峰最大小时流量与上周比较情况", example = "提升【下降】1200辆")
private String fmPeakMaxHourFlowLastWeekCompare;
@ApiModelProperty(value = "周末全天平均流量与上周比较情况", example = "提升【下降】12000辆")
private String endAvgFlowLastWeekCompare;
@ApiModelProperty(value = "工作日早高峰平均交通指数与上周比较情况", example = "增加【减少】20%")
private String amPeakAvgTrafficIndexLastWeekCompare;
@ApiModelProperty(value = "工作日晚高峰平均交通指数与上周比较情况", example = "增加【减少】25%")
private String pmPeakAvgTrafficIndexLastWeekCompare;
//================================================================================================//
private List<CrossRunStateDetailAnalysisDataDTO> dataList = new ArrayList<>();
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class CrossRunStateDetailAnalysisDataDTO {
@ApiModelProperty(value = "路口名称", example = "经十路(舜耕路-山大路)",position =1)
private String crossName;
@ApiModelProperty(value = "本周高峰最大小时流量", example = "8900",position = 2)
private Integer thisWeekPeakMaxFlow;
@ApiModelProperty(value = "上周高峰最大小时流量", example = "8900",position =3)
private Integer lastWeekPeakMaxFlow;
@ApiModelProperty(value = "本周周末最大小时流量", example = "8900",position = 4)
private Integer thisWeekEndMaxFlow;
@ApiModelProperty(value = "上周周末最大小时流量", example = "8900",position = 5)
private Integer lastWeekEndMaxFlow;
@ApiModelProperty(value = "本周工作日早高峰交通指数", example = "4.0",position = 5)
private Double thisWeekWorkDayAmTrafficIndex;
@ApiModelProperty(value = "上周周工作日早高峰交通指数", example = "3.5",position = 6)
private Double lastWeekWorkDayAmTrafficIndex;
@ApiModelProperty(value = "本周工作日晚高峰交通指数", example = "3.5",position = 7)
private Double thisWeekWorkDayPmTrafficIndex;
@ApiModelProperty(value = "上周周工作日晚高峰交通指数", example = "4.5",position = 8)
private Double lastWeekWorkDayPmTrafficIndex;
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class GreenReportProblemDetailAnalysisResult {
@ApiModelProperty(value = "干线ID", example = "")
private String greenId;
@ApiModelProperty(value = "干线名称", example = "经十路(舜耕路-山大路)")
private String greenName;
@ApiModelProperty(value = "干线工作日拥堵时段分布情况", example = "7:00~8:00,12:00~13:30,17:30~18:40")
private String workDayCongestSpan;
@ApiModelProperty(value = "干线工作日平均拥堵时长", example = "1小时")
private String workDayAvgCongestTime;
@ApiModelProperty(value = "干线工作日平均拥堵指数",example = "3.5")
private String workDayAvgCongestIndex;
//================================================================================================//
@ApiModelProperty(value = "干线工作日缓行时段分布情况", example = "7:00~8:00,12:00~13:30,17:30~18:40")
private String workDaySlowRunSpan;
@ApiModelProperty(value = "干线工作日平均缓行时长", example = "0.5小时")
private String workDayAvgSlowRunTime;
@ApiModelProperty(value = "干线工作日缓行平均拥堵指数",example = "3.5")
private String workDayAvgSlowAvgCongestIndex;
//================================================================================================//
@ApiModelProperty(value = "干线周末拥堵时段分布情况", example = "7:00~8:00,12:00~13:30,17:30~18:40")
private String weekEndCongestSpan;
@ApiModelProperty(value = "干线周末平均拥堵时长", example = "1小时")
private String weekEndAvgCongestTime;
@ApiModelProperty(value = "干线周末平均拥堵指数",example = "3.5")
private String weekEndAvgCongestIndex;
//================================================================================================//
@ApiModelProperty(value = "干线周末缓行时段分布情况", example = "7:00~8:00,12:00~13:30,17:30~18:40")
private String weekEndSlowRunSpan;
@ApiModelProperty(value = "干线周末平均缓行时长", example = "0.5小时")
private String weekEndAvgSlowRunTime;
@ApiModelProperty(value = "干线周末缓行平均拥堵指数",example = "3.5")
private String weekEndAvgSlowAvgCongestIndex;
private List<GreenReportProblemDetailVO> dataList = new ArrayList<>();
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class GreenReportProblemDetailVO {
@ApiModelProperty(value = "星期", example = "周一")
private String week;
@ApiModelProperty(value = "问题时段", example = "7:35~8:40")
private String problemSpan;
@ApiModelProperty(value = "状态:缓行/拥堵", example = "拥堵")
private String status;
@ApiModelProperty(value = "拥堵指数", example = "4.5")
private Double congestIndex;
@ApiModelProperty(value = "平均速度", example = "10")
private Double avgSpeed;
@ApiModelProperty(value = "行程时间,单位分钟", example = "10")
private Integer travelTime;
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class GreenReportProblemOverallAnalysisResult {
@ApiModelProperty(value = "区域干线总拥堵次数", example = "56次")
private String totalCongestCount;
@ApiModelProperty(value = "区域干线总拥堵时长", example = "11小时")
private String totalCongestDuration;
@ApiModelProperty(value = "拥堵严重干线",example = "经十路(舜耕路-山大路)、经十路(洪山路-舜华路)")
private String congestHeavyGreenWave;
private List<GreenReportProblemOverallDataVO> dataList = new ArrayList<>();
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class GreenReportProblemOverallDataVO {
@ApiModelProperty(value = "排序", example = "")
private String sort;
@ApiModelProperty(value = "干线ID", example = "")
private String greenId;
@ApiModelProperty(value = "干线名称", example = "经十路(舜耕路-山大路)")
private String greenName;
List<GreenWaveDirProblemDataVO> list = new ArrayList<>();
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class GreenReportSamePeriodCompareData {
@ApiModelProperty(value = "路口ID", example = "")
private String greenId;
@ApiModelProperty(value = "干线名称", example = "")
private String greenName;
@ApiModelProperty(value = "早高峰流量情况", example = "减少")
private String amPeakSituation;
@ApiModelProperty(value = "晚高峰流量情况", example = "减少")
private String pmPeakSituation;
@ApiModelProperty(value = "行程时间同比情况", example = "增加20s")
private String amTravelTimeSituation;
@ApiModelProperty(value = "行程时间同比情况", example = "减少20s")
private String pmTravelTimeSituation;
private List<GreenReportSamePeriodData> dataList = new ArrayList<>();
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class GreenReportSamePeriodData {
@ApiModelProperty(value = "峰期类型 早高峰、晚高峰、全天", example = "早高峰")
private String peakName;
@ApiModelProperty(value = "通行量(辆)", example = "736278")
private Integer peakFlow;
@ApiModelProperty(value = "通行量同比", example = "-1.5%")
private Double peakFlowRatio;
@ApiModelProperty(value = "拥堵指数", example = "3.5")
private Double congestIndex;
@ApiModelProperty(value = "拥堵指数同比", example = "3.5%")
private Double congestIndexRatio;
@ApiModelProperty(value = "平均车速km/h", example = "30.5")
private Double avgSpeed;
@ApiModelProperty(value = "平均车速同比", example = "-1.5%")
private Double avgSpeedRatio;
@ApiModelProperty(value = "行程时间(分钟)", example = "6.5")
private Double travelTime;
@ApiModelProperty(value = "行程时间同比", example = "-1.5%")
private Double travelTimeRatio;
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class GreenWaveDirProblemDataVO {
@ApiModelProperty(value = "干线类型", example = "主干路")
private String greenWaveType;
@ApiModelProperty(value = "方向", example = "东向西")
private String dir;
@ApiModelProperty(value = "拥堵指数", example = "4.5")
private Double congestIndex;
@ApiModelProperty(value = "拥堵次数", example = "10")
private Integer congestCount;
@ApiModelProperty(value = "拥堵时长,单位秒", example = "10")
private Integer congestDuration;
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class GreenWaveOptimizeAnalysisDataDTO {
@ApiModelProperty(value = "干线Id",example = "1")
private Integer greenId ;
@ApiModelProperty(value = "优化次数",example = "8900")
private Integer optimizeCount ;
@ApiModelProperty(value = "优化时长",example = "8900")
private Integer optimizeDuration ;
@ApiModelProperty(value = "通行能力",example = "8900")
private Integer capacity ;
@ApiModelProperty(value = "停车次数",example = "5")
private Double stopTimes ;
@ApiModelProperty(value = "延误时间,单位秒",example = "40")
private Double delayTime ;
@ApiModelProperty(value = "行程时间,单位秒",example = "6.9")
private Integer travelTime ;
@ApiModelProperty(value = "平均速度",example = "39")
private Double avgSpeed ;
@ApiModelProperty(value = "上周通行能力",example = "8900")
private Integer lastCapacity ;
@ApiModelProperty(value = "上周停车次数",example = "5")
private Double lastStopTimes ;
@ApiModelProperty(value = "上周延误时间,单位秒",example = "40")
private Double lastDelayTime ;
@ApiModelProperty(value = "上周行程时间,单位秒",example = "6.9")
private Integer lastTravelTime ;
@ApiModelProperty(value = "上周平均速度",example = "39")
private Double lastAvgSpeed ;
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class GreenWaveOptimizeAnalysisDataVO {
@ApiModelProperty(value = "通行能力",example = "8900")
private Integer capacity ;
@ApiModelProperty(value = "停车次数",example = "5")
private Double stopTimes ;
@ApiModelProperty(value = "延误时间,单位秒",example = "40")
private Double delayTime ;
@ApiModelProperty(value = "行程时间,单位秒",example = "6.9")
private Integer travelTime ;
@ApiModelProperty(value = "平均速度",example = "39")
private Double avgSpeed ;
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class GreenWaveOptimizeAnalysisResultResponseDTO {
@ApiModelProperty(value = "干线ID", example = "")
private String greenId;
@ApiModelProperty(value = "干线名称", example = "经十路(舜耕路-山大路)")
private String greenName;
@ApiModelProperty(value = "本周优化次数", example = "300次")
private String weekOptimizeCount;
@ApiModelProperty(value = "本周优化时长", example = "98小时")
private String weekOptimizeDuration;
@ApiModelProperty(value = "本周通行能力同比情况", example = "提升10%")
private String weekCapacitySituation;
@ApiModelProperty(value = "本周通停车次数同比情况", example = "减少10%")
private String weekStopTimesSituation;
@ApiModelProperty(value = "本周通行程时间数同比情况", example = "增加10%")
private String weekTravelTimeSituation;
@ApiModelProperty(value = "本周通延误时间同比情况", example = "增加10%")
private String weekDelayTimeSituation;
@ApiModelProperty(value = "本周通平均速度同比情况", example = "降低10%")
private String weekAvgSpeedSituation;
@ApiModelProperty(value = "本周总体情况", example = "降低10%")
private String weekTotalitySituation;
//================================================================================================//
@ApiModelProperty(value = "时段列表",example = "[\"本周\",\"上周\"]")
private List<String> timeList = new ArrayList<>();
private List<GreenWaveOptimizeAnalysisDataVO> dataList=new ArrayList<>();
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "绿波干线周总体拥堵概况", description = "绿波干线周总体拥堵概况")
public class GreenWaveWeekDataVO {
@ApiModelProperty(value = "干线ID",example = "1")
private Integer greenId ;
@ApiModelProperty(value = "干线名称",example = "")
private String greenName ;
@ApiModelProperty(value = "干线路段长度,单位米",example = "232.5")
private double length ;
@ApiModelProperty(value = "干线道路类型,以文字形式描述",example = "主干道")
private String greenRoadType ;
@ApiModelProperty(value = "排名-按拥堵指数排名",example = "1")
private Integer rank ;
@ApiModelProperty(value = "平均拥堵指数",example = "1.5")
private Double congestIndex ;
@ApiModelProperty(value = "最大拥堵指数",example = "1.5")
private Double maxCongestIndex ;
@ApiModelProperty(value = "拥堵次数",example = "1.5")
private Double congestCount ;
@ApiModelProperty(value = "拥堵总时长,单位秒",example = "1.5")
private Double congestDuration;
@ApiModelProperty(value = "拥堵次数中的最大拥堵时长,单位秒",example = "2000")
private Double maxCongestDuration;
@ApiModelProperty(value = "平均拥堵时长,单位秒",example = "2000")
private Double avgCongestDuration;
@ApiModelProperty(value = "最长使时间拥堵时间分布",example = "周一7:30~8:15")
private String congestTimeDistribute;
@ApiModelProperty(value = "最长时间拥堵时段分布",example = "周一7:30~8:15")
private String maxCongestTimeDistribute;
@ApiModelProperty(value = "本周拥堵时段集中分布情况",example = "周一7:30~8:15,周五17:30~18:15")
private String weekCongestTimeDistribute;
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ImportGreenReportAnalysisDataVO {
@ApiModelProperty(value = "星期", example = "星期一")
private String weekName;
@ApiModelProperty(value = "策略优化时段", example = "7:35~8:40")
private String optimizeTimeSpan;
@ApiModelProperty(value = "本周通行能力", example = "3466")
private Integer thisWeekCapacity;
@ApiModelProperty(value = "上周通行能力", example = "5600")
private Integer lastWeekCapacity;
@ApiModelProperty(value = "本周拥堵指数", example = "3.5")
private Double thisWeekCongestIndex;
@ApiModelProperty(value = "上周拥堵指数", example = "3.0")
private Double lastWeekCongestIndex;
@ApiModelProperty(value = "本周平均车速km/h", example = "30.5")
private Double thisWeekAvgSpeed;
@ApiModelProperty(value = "上周平均车速km", example = "30.2")
private Double lastWeekAvgSpeed;
@ApiModelProperty(value = "本周行程时间(分钟)", example = "6.5")
private Double thisWeekTravelTime;
@ApiModelProperty(value = "上周行程时间(分钟)", example = "1.5")
private Double lastWeekTravelTime;
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class ImportGreenReportAnalysisResponseVO {
@ApiModelProperty(value = "干线ID", example = "")
private String greenId;
@ApiModelProperty(value = "干线名称", example = "经十路(舜耕路-山大路)")
private String greenName;
@ApiModelProperty(value = "本周优化集中时段分布情况", example = "7:00~8:00,12:00~13:30,17:30~18:40")
private String optimizeSpan;
@ApiModelProperty(value = "本周平均通行能力", example = "7800辆/小时")
private String avgCapacity;
@ApiModelProperty(value = "平均通行能力与上周相比情况",example = "提升")
private String avgCapacityCompareSituation;
//================================================================================================//
@ApiModelProperty(value = "本周平均拥堵指数", example = "2.3")
private String avgCongestIndex;
@ApiModelProperty(value = "平均拥堵指数与上周相比情况", example = "增加【减少】10%")
private String avgCongestIndexCompare;
//================================================================================================//
@ApiModelProperty(value = "本周平均速度", example = "2.3")
private String avgSpeed;
@ApiModelProperty(value = "本周平均速度与上周相比情况", example = "提升【降低】10%")
private String avgSpeedCompare;
//================================================================================================//
@ApiModelProperty(value = "本周行程时间", example = "15")
private String avgTravelTime;
@ApiModelProperty(value = "本周平均行程时间与上周相比情况", example = "增加【减少】2分钟")
private String avgTravelTimeCompare;
//================================================================================================//
@ApiModelProperty(value = "本周总体效果情况", example = "明显提升")
private String weekTotalitySituation;
private List<ImportGreenReportAnalysisDataVO> dataList = new ArrayList<>();
}
\ No newline at end of file
package net.wanji.opt.controllerv2.report.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "LaneDirNumVO", description = "车道方向信息")
public class LaneDirNumVO {
@ApiModelProperty(value = "车道进口方向" )
private String laneInDir;
@ApiModelProperty(value = "车道方向数量" )
private Integer laneDirNum;
@ApiModelProperty(value = "转向车道数量" )
private String laneTurnNum;
}
package net.wanji.opt.controllerv2.strategy;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo;
import net.wanji.opt.entity.strategy.StrategyParameterConfig;
import net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import net.wanji.opt.entity.strategy.dto.StrategyPriorityGroup;
import net.wanji.opt.servicev2.strategy.StrategyPriorityService;
import net.wanji.opt.synthesis.pojo.StrategyFactoryEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import net.wanji.opt.api.ResultGenerator;
import javax.validation.Valid;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.Map;
/**
* <p>
* 策略优先级日计划详情表 前端控制器
* </p>
*
* @author fengyi
* @since 2025-03-28
*/
@Api(tags = "策略管理")
@RestController
@RequestMapping("/strategy-priority")
@Slf4j
public class StrategyPriorityController {
@Autowired
private StrategyPriorityService strategyPriorityService;
//策略管理-路口列表
@ApiOperation(value = "策略管理-路口列表", notes = "查询全部记录", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false)
@ApiImplicitParams({
// @ApiImplicitParam(name = "crossId", value = "路口id", required = false, dataType = "String"),
})
@GetMapping("/strategyCrossList")
public JsonViewObject pageStrategyCrossList(){
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
List<StrategyPriorityDailyInfo> retLineData=strategyPriorityService.pageStrategyCrossList();
jsonView.success(retLineData);
}catch (Exception e){
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@ApiOperation(value = "策略管理-策略名称", notes = "查询全部记录", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false)
@GetMapping("/strategyList")
public JsonViewObject getStrategyList(){
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
List<StrategyFactoryEntity> retLineData=strategyPriorityService.getStrategyList();
jsonView.success(retLineData);
}catch (Exception e){
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@ApiOperation(value = "策略管理-场景", notes = "查询全部记录", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false)
@GetMapping("/sceneList")
public JsonViewObject getSceneList(Integer type){
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
List<StrategyFactoryEntity> retLineData=strategyPriorityService.getSceneList(type);
jsonView.success(retLineData);
}catch (Exception e){
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@ApiOperation(value = "策略管理-厂商", notes = "查询全部记录", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false)
@GetMapping("/companyList")
public JsonViewObject getCompanyList(){
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
List<StrategyFactoryEntity> retLineData=strategyPriorityService.getCompanyList();
jsonView.success(retLineData);
}catch (Exception e){
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@ApiOperation(value = "策略管理-策略路口干线优先级批量保存", notes = "批量保存", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false)
@ApiImplicitParams({
@ApiImplicitParam(name = "dataList", value = "优先级配置数据", required = false, dataType = "String"),
})
@PostMapping("/savePriority")
public JsonViewObject savePriority(@RequestBody List<StrategyPriorityGroup>dataList){
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
strategyPriorityService.savePriority(dataList);
jsonView.success();
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG"));
log.error("{} StrategyPriorityController-savePriority", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@ApiOperation(value = "策略管理-策略路口干线优先级数据回显", notes = "数据回显", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false)
@ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口id", required = false, dataType = "String"),
@ApiImplicitParam(name = "greenId", value = "干线id", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "type", value = "类型", required = true, dataType = "Integer"),
})
@GetMapping("/getPriorityConfig")
public JsonViewObject getPriorityData(@RequestParam(required = false) String crossId,@RequestParam(required = false) Integer greenId,
@RequestParam(required = true) Integer type){
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
List<StrategyFactoryEntity>list=strategyPriorityService.getPriorityData(crossId,greenId,type);
jsonView.success(list);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG"));
log.error("{} StrategyPriorityController-getPriorityData", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@ApiOperation(value = "策略管理-策略计划表路口干线批量保存", notes = "批量保存", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false)
@ApiImplicitParams({
@ApiImplicitParam(name = "dailyPlanDetails", value = "日计划配置数据", required = false, dataType = "String"),
})
@PostMapping("/savePlanConfig")
public JsonViewObject savePlanConfig(@RequestBody List<StrategyPriorityGroup>dailyPlanDetails){
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
strategyPriorityService.savePlanConfig(dailyPlanDetails);
jsonView.success();
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG"));
log.error("{} StrategyPriorityController-savePlanConfig", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@ApiOperation(value = "策略管理-计划配置路口干线数据回显", notes = "数据回显", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false)
@ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口id", required = false, dataType = "String"),
@ApiImplicitParam(name = "greenId", value = "干线id", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "type", value = "类型", required = true, dataType = "Integer"),
})
@GetMapping("/getPlanConfigData")
public JsonViewObject getPlanConfigData(@RequestParam(required = false) String crossId,@RequestParam(required = false) Integer greenId,
@RequestParam(required = true) Integer type){
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
List<StrategyPriorityDailyInfo>list=strategyPriorityService.getPlanConfigData(crossId,greenId,type);
jsonView.success(list);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG"));
log.error("{} StrategyPriorityController-getPriorityData", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@ApiOperation(value = "策略管理-策略参数配置批量保存", notes = "批量保存", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false)
@ApiImplicitParams({
@ApiImplicitParam(name = "strategyPriorityGroup", value = "参数配置数据", required = false, dataType = "String"),
})
@PostMapping("/saveParamterConfig")
public JsonViewObject saveParamterConfig(@RequestBody StrategyPriorityGroup strategyPriorityGroup){
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
strategyPriorityService.saveParamterConfig(strategyPriorityGroup);
jsonView.success();
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG"));
log.error("{} StrategyPriorityController-saveParamterConfig", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@ApiOperation(value = "策略管理-参数配置数据回显", notes = "数据回显", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false)
@ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口id", required = true, dataType = "String")
})
@GetMapping("/getParamConfigData")
public JsonViewObject getParamConfigData(@RequestParam(required = true) String crossId){
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
List<StrategyParameterConfig>list=strategyPriorityService.getParamConfigData(crossId);
jsonView.success(list);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG"));
log.error("{} StrategyPriorityController-getPriorityData", this.getClass().getSimpleName(), e);
}
return jsonView;
}
/*
策略管理-干线列表
*/
@ApiOperation(value = "策略管理-干线列表", notes = "查询全部记录", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false)
@GetMapping("/getStrategyGreenWave")
public JsonViewObject getStrategyGreenWave(){
JsonViewObject jsonView = JsonViewObject.newInstance();
try {
List<StrategyPriorityDailyInfo> retLineData=strategyPriorityService.getStrategyGreenWave();
jsonView.success(retLineData);
}catch (Exception e){
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getStrategyGreenWave error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
}
\ No newline at end of file
package net.wanji.opt.controllerv2.syslog;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.entity.syslog.SysOptimizeLog;
import net.wanji.opt.servicev2.syslog.SysLogServer;
import net.wanji.opt.vo2.CrossGreenStatusTimeRateVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.ws.rs.core.MediaType;
import java.util.Collections;
import java.util.List;
/**
* @author huangwm
* @date 2025/03/06 18:33
*/
@Api(value = "sysLogController", description = "系统日志", tags = "系统日志")
@RequestMapping("/sysLog")
@RestController
@Slf4j
public class sysLogController {
@Resource
private SysLogServer sysLogServer;
@ApiOperation(value = "获取系统优化日志", notes = "获取系统优化日志",httpMethod="GET", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/getOptimizeLog")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口id", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "startTime", value = "日期 格式:yyyy-MM-dd h:i:s", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "endTime", value = "日期 格式:yyyy-MM-dd h:i:s", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "pageNum", value = "分页页码", required = true, dataType = "Integer", paramType = "query"),
@ApiImplicitParam(name = "pageSize", value = "分页数据条数", required = true, dataType = "Integer", paramType = "query"),
})
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = String.class),
})
public JsonViewObject getOptimizeLog(String crossId,String startTime,String endTime,Integer pageNum,Integer pageSize) {
try {
JSONObject list = sysLogServer.findSysOptimizeLog(crossId,startTime,endTime,pageNum,pageSize);
return JsonViewObject.newInstance().success(list);
} catch (Exception e) {
log.error("系统日志-优化日志-查询失败:{}", e);
return JsonViewObject.newInstance().success("");
}
}
}
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