Commit 951affee authored by zhoushiguang's avatar zhoushiguang
parents 02eed355 2d8f61be
...@@ -104,6 +104,12 @@ ...@@ -104,6 +104,12 @@
<!-- 依赖声明 --> <!-- 依赖声明 -->
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<!-- knife4j依赖 -->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>2.0.4</version>
</dependency>
<!-- ElasticSearch依赖 --> <!-- ElasticSearch依赖 -->
<dependency> <dependency>
<groupId>org.elasticsearch.client</groupId> <groupId>org.elasticsearch.client</groupId>
......
...@@ -394,6 +394,94 @@ ...@@ -394,6 +394,94 @@
</configuration> </configuration>
</plugin> </plugin>
<!-- maven 打包方式-->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<!--<version>2.6</version>-->
<executions>
<!--将启动脚本复制到指定目录-->
<execution>
<id>copy-bin</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.parent.basedir}/assembly/${project.name}/bin</outputDirectory>
<resources>
<resource>
<directory>src/main/resources/bin</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
<!--将配置文件复制到指定目录-->
<execution>
<id>copy-configs</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.parent.basedir}/assembly/${project.name}/resources
</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>**/bin/*</exclude>
</excludes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<!--将依赖jar包复制到lib目录-->
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.parent.basedir}/assembly/${project.name}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!--指定生成jar包目录-->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<!--<classpathPrefix>lib/</classpathPrefix>-->
<classpathPrefix></classpathPrefix>
<mainClass> net.wanji.web.SignalApplication</mainClass>
</manifest>
<manifestEntries>
<Class-Path>../resources/</Class-Path>
</manifestEntries>
</archive>
<excludes>
<exclude>*.**</exclude>
<exclude>*/**/*.xml</exclude>
</excludes>
<outputDirectory>${project.parent.basedir}/assembly/${project.name}/lib</outputDirectory>
<classesDirectory>
</classesDirectory>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
......
...@@ -17,6 +17,8 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -17,6 +17,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/** /**
* @author hanbing * @author hanbing
* @date 2023/01/04 16:10 * @date 2023/01/04 16:10
...@@ -124,7 +126,22 @@ public class PlanSendController { ...@@ -124,7 +126,22 @@ public class PlanSendController {
@ApiResponse(code = 200, message = "OK", response = SaveSchemeConfigDTO.PhaseListElement.class), @ApiResponse(code = 200, message = "OK", response = SaveSchemeConfigDTO.PhaseListElement.class),
}) })
public JsonViewObject phaseListByTimeSingleRing(@RequestBody CrossIdAndTimeDTO crossIdAndTimeDTO) { public JsonViewObject phaseListByTimeSingleRing(@RequestBody CrossIdAndTimeDTO crossIdAndTimeDTO) {
RingPhasePO ringPhasePO = planSendService.phaseListByTimeSingleRing(crossIdAndTimeDTO); List<SaveSchemeConfigDTO.PhaseListElement> phaseListByTime
= planSendService.phaseListByTimeSingleRing(crossIdAndTimeDTO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(phaseListByTime);
}
@AspectLog(description = "根据当前时间返回相位列表-方案优化对比", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@ApiOperation(value = "根据当前时间返回相位列表-方案优化对比)", notes = "根据当前时间返回相位列表-方案优化对比")
@PostMapping("/phaseListByTimeSingleRingNew")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = SaveSchemeConfigDTO.PhaseListElement.class),
})
public JsonViewObject phaseListByTimeSingleRingNew(@RequestBody CrossIdAndTimeDTO crossIdAndTimeDTO) {
RingPhasePO ringPhasePO = planSendService.phaseListByTimeSingleRingNew(crossIdAndTimeDTO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance(); JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(ringPhasePO); return jsonViewObject.success(ringPhasePO);
......
...@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; ...@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.Date; import java.util.Date;
/** /**
...@@ -14,8 +15,11 @@ import java.util.Date; ...@@ -14,8 +15,11 @@ import java.util.Date;
@Data @Data
public class CrossIdAndTimeDTO { public class CrossIdAndTimeDTO {
@ApiModelProperty(value = "路口ID,如:c7e7b1f352dd4acab4a60088eb391cca", required = true) @ApiModelProperty(value = "路口ID,如:c7e7b1f352dd4acab4a60088eb391cca", required = true)
@NotNull(message = "crossId不可为空")
private String crossId; private String crossId;
@ApiModelProperty(value = "当前日期时间 yyyy-MM-dd HH:mm:ss", required = true) @ApiModelProperty(value = "当前日期时间 yyyy-MM-dd HH:mm:ss", required = true)
@NotNull(message = "datetime不可为空")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date datetime; private Date datetime;
} }
...@@ -2,13 +2,12 @@ package net.wanji.web.service; ...@@ -2,13 +2,12 @@ package net.wanji.web.service;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.bo.CrossIdBO; import net.wanji.databus.bo.CrossIdBO;
import net.wanji.web.dto.CrossIdAndPhaseIdsDTO; import net.wanji.web.dto.*;
import net.wanji.web.dto.CrossIdAndTimeDTO;
import net.wanji.web.dto.ScheduleIdDTO;
import net.wanji.web.dto.SchemeIdDTO;
import net.wanji.web.po.RingPhasePO; import net.wanji.web.po.RingPhasePO;
import net.wanji.web.vo.PhaseListByTimeVO; import net.wanji.web.vo.PhaseListByTimeVO;
import java.util.List;
/** /**
* @author Kent HAN * @author Kent HAN
* @date 2022/11/3 16:14 * @date 2022/11/3 16:14
...@@ -32,7 +31,9 @@ public interface PlanSendService { ...@@ -32,7 +31,9 @@ public interface PlanSendService {
PhaseListByTimeVO phaseListByTime(CrossIdAndTimeDTO crossIdAndTimeDTO); PhaseListByTimeVO phaseListByTime(CrossIdAndTimeDTO crossIdAndTimeDTO);
RingPhasePO phaseListByTimeSingleRing(CrossIdAndTimeDTO crossIdAndTimeDTO); // RingPhasePO phaseListByTimeSingleRing(CrossIdAndTimeDTO crossIdAndTimeDTO);
RingPhasePO phaseListByTimeSingleRingNew(CrossIdAndTimeDTO crossIdAndTimeDTO);
List<SaveSchemeConfigDTO.PhaseListElement> phaseListByTimeSingleRing(CrossIdAndTimeDTO crossIdAndTimeDTO);
/** /**
* 下发数据到utc数据库 * 下发数据到utc数据库
......
...@@ -15,7 +15,6 @@ import net.wanji.databus.dao.entity.*; ...@@ -15,7 +15,6 @@ import net.wanji.databus.dao.entity.*;
import net.wanji.databus.dao.mapper.*; import net.wanji.databus.dao.mapper.*;
import net.wanji.databus.dto.*; import net.wanji.databus.dto.*;
import net.wanji.databus.po.BaseCrossLightsPO; import net.wanji.databus.po.BaseCrossLightsPO;
import net.wanji.databus.po.CoordinationStatus;
import net.wanji.databus.po.CrossSchemeInfoPO; import net.wanji.databus.po.CrossSchemeInfoPO;
import net.wanji.databus.po.SaveToUtcPO; import net.wanji.databus.po.SaveToUtcPO;
import net.wanji.databus.vo.*; import net.wanji.databus.vo.*;
...@@ -625,26 +624,24 @@ public class PlanSendServiceImpl implements PlanSendService { ...@@ -625,26 +624,24 @@ public class PlanSendServiceImpl implements PlanSendService {
} }
@Override @Override
public RingPhasePO phaseListByTimeSingleRing(CrossIdAndTimeDTO crossIdAndTimeDTO) { public RingPhasePO phaseListByTimeSingleRingNew(CrossIdAndTimeDTO crossIdAndTimeDTO) {
RingPhasePO ringPhasePO = new RingPhasePO(); RingPhasePO ringPhasePO = new RingPhasePO();
List<SaveSchemeConfigDTO.PhaseListElement> oriPhaseList = new ArrayList<>(); List<SaveSchemeConfigDTO.PhaseListElement> oriPhaseList = new ArrayList<>();
List<SaveSchemeConfigDTO.PhaseListElement> optPhaseList = new ArrayList<>(); List<SaveSchemeConfigDTO.PhaseListElement> optPhaseList = new ArrayList<>();
//TODO QueryByCrossIdAndTimeDTO queryByCrossIdAndTimeDTO = new QueryByCrossIdAndTimeDTO();
CrossIdDTO crossIdDTO = new CrossIdDTO(); queryByCrossIdAndTimeDTO.setCrossId(crossIdAndTimeDTO.getCrossId());
crossIdDTO.setCrossId(crossIdAndTimeDTO.getCrossId()); queryByCrossIdAndTimeDTO.setDatetime(crossIdAndTimeDTO.getDatetime());
//查询当前运行的方案
JsonViewObject jsonViewObject = utcFeignClients.getSchemeNoStr(crossIdDTO.getCrossId()); JsonViewObject jsonViewObject = utcFeignClients.selectSchemeByParams(queryByCrossIdAndTimeDTO);
Integer code = jsonViewObject.getCode(); if (jsonViewObject.getCode() != 200){
if (code != 200) {
log.error("获取当前方案号失败,路口id:{}", crossIdAndTimeDTO.getCrossId());
return ringPhasePO; return ringPhasePO;
} }
ObjectMapper objectMapper = JacksonUtils.getInstance(); ObjectMapper objectMapper = JacksonUtils.getInstance();
CoordinationStatus content = objectMapper.convertValue(jsonViewObject.getContent(), CoordinationStatus.class); BaseCrossSchemePO content = objectMapper.convertValue(jsonViewObject.getContent(), BaseCrossSchemePO.class);
String coordPatternStatus = content.getCoordPatternStatus(); if (ObjectUtil.isEmpty(content)){
//方案号 return ringPhasePO;
int schemeId = (Integer.valueOf(coordPatternStatus) + 2) / 3; }
System.out.println(schemeId); int schemeId = Integer.valueOf(content.getSchemeNo());
List<CrossSchemeInfoPO> crossSchemeInfoPOS = baseCrossSchemeMapper.selectSchemeInfoByCrossIdAndSchemeId(crossIdAndTimeDTO.getCrossId(), schemeId); List<CrossSchemeInfoPO> crossSchemeInfoPOS = baseCrossSchemeMapper.selectSchemeInfoByCrossIdAndSchemeId(crossIdAndTimeDTO.getCrossId(), schemeId);
if (ObjectUtil.isNotEmpty(crossSchemeInfoPOS)) { if (ObjectUtil.isNotEmpty(crossSchemeInfoPOS)) {
//根据相位号分组 //根据相位号分组
...@@ -660,7 +657,7 @@ public class PlanSendServiceImpl implements PlanSendService { ...@@ -660,7 +657,7 @@ public class PlanSendServiceImpl implements PlanSendService {
phaseListElement.setYellowTime(Integer.valueOf(crossSchemeInfoPO.getYellowTime())); phaseListElement.setYellowTime(Integer.valueOf(crossSchemeInfoPO.getYellowTime()));
phaseListElement.setRedTime(Integer.valueOf(crossSchemeInfoPO.getRedTime())); phaseListElement.setRedTime(Integer.valueOf(crossSchemeInfoPO.getRedTime()));
List<SaveSchemeConfigDTO.DirListElement> dirListElements = new ArrayList<>(); List<SaveSchemeConfigDTO.DirListElement> dirListElements = new ArrayList<>();
Map<String, List<CrossSchemeInfoPO>> dircollect = infoPOS.stream().collect(Collectors.groupingBy(CrossSchemeInfoPO::getDir)); Map<String, List<CrossSchemeInfoPO>> dircollect = infoPOS.stream().filter(x -> x.getDir() != null).collect(Collectors.groupingBy(CrossSchemeInfoPO::getDir));
if (ObjectUtil.isNotEmpty(dircollect)) { if (ObjectUtil.isNotEmpty(dircollect)) {
Set<String> dirSet = dircollect.keySet(); Set<String> dirSet = dircollect.keySet();
for (String string : dirSet) { for (String string : dirSet) {
...@@ -669,7 +666,7 @@ public class PlanSendServiceImpl implements PlanSendService { ...@@ -669,7 +666,7 @@ public class PlanSendServiceImpl implements PlanSendService {
SaveSchemeConfigDTO.DirListElement dirListElement = new SaveSchemeConfigDTO.DirListElement(); SaveSchemeConfigDTO.DirListElement dirListElement = new SaveSchemeConfigDTO.DirListElement();
dirListElement.setDir(Integer.valueOf(po.getDir())); dirListElement.setDir(Integer.valueOf(po.getDir()));
List<SaveSchemeConfigDTO.LaneListElement> laneList = new ArrayList<>(); List<SaveSchemeConfigDTO.LaneListElement> laneList = new ArrayList<>();
Map<String, List<CrossSchemeInfoPO>> laneCollect = crossSchemeInfoPOS1.stream().collect(Collectors.groupingBy(CrossSchemeInfoPO::getLandId)); Map<String, List<CrossSchemeInfoPO>> laneCollect = crossSchemeInfoPOS1.stream().filter(x -> x.getLandId() != null).collect(Collectors.groupingBy(CrossSchemeInfoPO::getLandId));
if (ObjectUtil.isNotEmpty(laneCollect)) { if (ObjectUtil.isNotEmpty(laneCollect)) {
Set<String> stringSet = laneCollect.keySet(); Set<String> stringSet = laneCollect.keySet();
for (String s1 : stringSet) { for (String s1 : stringSet) {
...@@ -690,7 +687,6 @@ public class PlanSendServiceImpl implements PlanSendService { ...@@ -690,7 +687,6 @@ public class PlanSendServiceImpl implements PlanSendService {
phaseListElement.setDirList(dirListElements); phaseListElement.setDirList(dirListElements);
oriPhaseList.add(phaseListElement); oriPhaseList.add(phaseListElement);
} }
} }
if (ObjectUtil.isNotEmpty(oriPhaseList)) { if (ObjectUtil.isNotEmpty(oriPhaseList)) {
CrossSchemeRingsDTO crossSchemeRingsDTO = new CrossSchemeRingsDTO(); CrossSchemeRingsDTO crossSchemeRingsDTO = new CrossSchemeRingsDTO();
...@@ -708,6 +704,9 @@ public class PlanSendServiceImpl implements PlanSendService { ...@@ -708,6 +704,9 @@ public class PlanSendServiceImpl implements PlanSendService {
if (ObjectUtils.isNotEmpty(crossSchedulesPOList)) { if (ObjectUtils.isNotEmpty(crossSchedulesPOList)) {
optPhaseList.addAll(oriPhaseList); optPhaseList.addAll(oriPhaseList);
for (int i = 0; i < optPhaseList.size(); i++) { for (int i = 0; i < optPhaseList.size(); i++) {
if (i == crossSchedulesPOList.size()){
break;
}
CrossSchemeStageOptLogPO optLogPO = crossSchedulesPOList.get(i); CrossSchemeStageOptLogPO optLogPO = crossSchedulesPOList.get(i);
SaveSchemeConfigDTO.PhaseListElement optPhase = optPhaseList.get(i); SaveSchemeConfigDTO.PhaseListElement optPhase = optPhaseList.get(i);
optPhase.setMinGreenTime(0); optPhase.setMinGreenTime(0);
...@@ -721,17 +720,33 @@ public class PlanSendServiceImpl implements PlanSendService { ...@@ -721,17 +720,33 @@ public class PlanSendServiceImpl implements PlanSendService {
optPhase.setYellowFlash(0); optPhase.setYellowFlash(0);
} }
} }
} }
} }
ringPhasePO.setOriPhaseList(oriPhaseList); ringPhasePO.setOriPhaseList(oriPhaseList);
ringPhasePO.setOptPhaseList(optPhaseList); ringPhasePO.setOptPhaseList(optPhaseList);
return ringPhasePO; return ringPhasePO;
} }
@Override
public List<SaveSchemeConfigDTO.PhaseListElement> phaseListByTimeSingleRing(CrossIdAndTimeDTO crossIdAndTimeDTO) {
List<SaveSchemeConfigDTO.PhaseListElement> phaseListByTime = new ArrayList<>();
PhaseListByTimeVO phaseListByTimeVO = phaseListByTime(crossIdAndTimeDTO);
SaveSchemeConfigDTO.PhaseScheme phaseScheme = phaseListByTimeVO.getPhaseScheme();
if (phaseScheme != null) {
List<SaveSchemeConfigDTO.RingListElement> ringList = phaseScheme.getRingList();
SaveSchemeConfigDTO.RingListElement ringListElement = ringList.get(0);
List<SaveSchemeConfigDTO.GroupListElement> groupList = ringListElement.getGroupList();
for (SaveSchemeConfigDTO.GroupListElement groupListElement : groupList) {
List<SaveSchemeConfigDTO.PhaseListElement> phaseList = groupListElement.getPhaseList();
phaseListByTime.addAll(phaseList);
}
}
return phaseListByTime;
}
private PhaseListByTimeVO getPhaseListByTimeVO(String planName, Date datetime, RunningPlanDTO runningPlanDTO, private PhaseListByTimeVO getPhaseListByTimeVO(String planName, Date datetime, RunningPlanDTO runningPlanDTO,
CrossIdBO crossIdBO) { CrossIdBO crossIdBO) {
PhaseListByTimeVO phaseListByTimeVO = new PhaseListByTimeVO(); PhaseListByTimeVO phaseListByTimeVO = new PhaseListByTimeVO();
......
...@@ -146,4 +146,8 @@ public interface FeignCommon { ...@@ -146,4 +146,8 @@ public interface FeignCommon {
@PostMapping("/staticInfo/schemeOptLog") @PostMapping("/staticInfo/schemeOptLog")
JsonViewObject schemeOptLog(@RequestBody CrossSchemeRingsDTO crossSchemeRingsDTO); JsonViewObject schemeOptLog(@RequestBody CrossSchemeRingsDTO crossSchemeRingsDTO);
// 海信-查询方案优化记录
@PostMapping("/staticInfo/selectSchemeByParams")
JsonViewObject selectSchemeByParams(@RequestBody QueryByCrossIdAndTimeDTO queryByCrossIdAndTimeDTO);
} }
...@@ -18,6 +18,10 @@ ...@@ -18,6 +18,10 @@
</properties> </properties>
<dependencies> <dependencies>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
</dependency>
<!-- easyexcel导出 --> <!-- easyexcel导出 -->
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
......
package net.wanji.opt.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author duanruiming
* @date 2024/12/05 15:20
*/
@Getter
@AllArgsConstructor
public enum CrossOptStrategyEnum {
ZERO(0, "无策略"),
ONE(1, "绿灯空放"),
TWO(2, "失衡"),
THREE(3, "溢出");
private int code;
private String desc;
public static String getDesc(int code) {
for (CrossOptStrategyEnum value : CrossOptStrategyEnum.values()) {
if (code == value.code) {
return value.getDesc();
}
}
return "无策略";
}
}
package net.wanji.opt.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author duanruiming
* @date 2024/12/05 19:29
*/
@Getter
@AllArgsConstructor
public enum StrategyControlEnum {
ZERO(0, "绿波带"),
ONE(1, "失衡"),
TWO(2, "溢出"),
THREE(3, "空放");
private int code;
private String desc;
public static String getDesc(int code) {
for (StrategyControlEnum value : StrategyControlEnum.values()) {
if (code == value.getCode()) {
return value.getDesc();
}
}
return "";
}
}
...@@ -11,6 +11,7 @@ import net.wanji.databus.po.CrossDirDataRealtimePO; ...@@ -11,6 +11,7 @@ import net.wanji.databus.po.CrossDirDataRealtimePO;
import net.wanji.databus.po.TBaseCrossInfo; import net.wanji.databus.po.TBaseCrossInfo;
import net.wanji.opt.dto.strategy.AddOrUpdateSceneDTO; import net.wanji.opt.dto.strategy.AddOrUpdateSceneDTO;
import net.wanji.opt.service.CrossIndexService; import net.wanji.opt.service.CrossIndexService;
import net.wanji.opt.vo.CrossOptResult;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -65,4 +66,21 @@ public class CrossIndexController { ...@@ -65,4 +66,21 @@ public class CrossIndexController {
return JsonViewObject.newInstance().success(crossDataRealtimePO); 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);
}
} }
...@@ -8,19 +8,21 @@ import net.wanji.common.framework.rest.JsonViewObject; ...@@ -8,19 +8,21 @@ import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.dto.strategy.AddOrUpdateSceneDTO; import net.wanji.opt.dto.strategy.AddOrUpdateSceneDTO;
import net.wanji.opt.service.signalopt.GreenBeltInfoService; import net.wanji.opt.service.signalopt.GreenBeltInfoService;
import net.wanji.opt.vo.GreenBeltFlowStopTimeVO; import net.wanji.opt.vo.GreenBeltFlowStopTimeVO;
import net.wanji.opt.vo.GreenBeltSpeedWidthVO;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
* @author duanruiming * @author duanruiming
* @date 2024/11/28 16:03 * @date 2024/11/28 16:03
*/ */
@Api(value = "CrossIndexController", description = "路口指标控制器") @Api(value = "GreenBeltController", description = "绿波干线")
@RequestMapping("/greenBelt") @RequestMapping("/greenBelt")
@RestController @RestController
public class GreenBeltController { public class GreenBeltController {
...@@ -35,7 +37,28 @@ public class GreenBeltController { ...@@ -35,7 +37,28 @@ public class GreenBeltController {
@ApiResponse(code = 200, message = "OK", response = AddOrUpdateSceneDTO.class), @ApiResponse(code = 200, message = "OK", response = AddOrUpdateSceneDTO.class),
}) })
public JsonViewObject greenBeltCrossDetailHist(Integer greenId) { public JsonViewObject greenBeltCrossDetailHist(Integer greenId) {
List<GreenBeltFlowStopTimeVO> greenBeltFlowStopTimeVOS = greenBeltInfoService.greenBeltCrossDetailHist(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 = AddOrUpdateSceneDTO.class),
})
public JsonViewObject greenBeltSpeedWidth(Integer greenId) {
List<GreenBeltSpeedWidthVO> greenBeltFlowStopTimeVOS = Collections.EMPTY_LIST;
try {
greenBeltFlowStopTimeVOS = greenBeltInfoService.greenBeltSpeedWidth(greenId);
} catch (Exception e) {
JsonViewObject.newInstance().fail("绿波带宽曲线异常");
}
return JsonViewObject.newInstance().success(greenBeltFlowStopTimeVOS); return JsonViewObject.newInstance().success(greenBeltFlowStopTimeVOS);
} }
} }
...@@ -4,6 +4,7 @@ import net.wanji.databus.bo.CrossIdBO; ...@@ -4,6 +4,7 @@ import net.wanji.databus.bo.CrossIdBO;
import net.wanji.databus.po.CrossDataRealtimePO; import net.wanji.databus.po.CrossDataRealtimePO;
import net.wanji.databus.po.CrossDirDataRealtimePO; import net.wanji.databus.po.CrossDirDataRealtimePO;
import net.wanji.databus.po.TBaseCrossInfo; import net.wanji.databus.po.TBaseCrossInfo;
import net.wanji.opt.vo.CrossOptResult;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -18,4 +19,6 @@ public interface CrossIndexService { ...@@ -18,4 +19,6 @@ public interface CrossIndexService {
CrossDataRealtimePO crossIndex(CrossIdBO crossIdBO); CrossDataRealtimePO crossIndex(CrossIdBO crossIdBO);
List<TBaseCrossInfo> crossInfoList(); List<TBaseCrossInfo> crossInfoList();
List<CrossOptResult> crossOptResultList(CrossIdBO crossIdBO) throws Exception;
} }
...@@ -2,6 +2,7 @@ package net.wanji.opt.service.impl; ...@@ -2,6 +2,7 @@ package net.wanji.opt.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.wanji.common.utils.tool.DateUtil;
import net.wanji.databus.bo.CrossIdBO; import net.wanji.databus.bo.CrossIdBO;
import net.wanji.databus.dao.mapper.BaseCrossInfoMapper; import net.wanji.databus.dao.mapper.BaseCrossInfoMapper;
import net.wanji.databus.dao.mapper.CrossDataRealtimeMapper; import net.wanji.databus.dao.mapper.CrossDataRealtimeMapper;
...@@ -9,14 +10,21 @@ import net.wanji.databus.dao.mapper.CrossDirDataRealtimeMapper; ...@@ -9,14 +10,21 @@ import net.wanji.databus.dao.mapper.CrossDirDataRealtimeMapper;
import net.wanji.databus.po.CrossDataRealtimePO; import net.wanji.databus.po.CrossDataRealtimePO;
import net.wanji.databus.po.CrossDirDataRealtimePO; import net.wanji.databus.po.CrossDirDataRealtimePO;
import net.wanji.databus.po.TBaseCrossInfo; import net.wanji.databus.po.TBaseCrossInfo;
import net.wanji.opt.common.enums.CrossOptStrategyEnum;
import net.wanji.opt.dao.mapper.StrategyCrossResultMapper;
import net.wanji.opt.service.CrossIndexService; import net.wanji.opt.service.CrossIndexService;
import net.wanji.opt.synthesis.pojo.StrategyCrossResultEntity;
import net.wanji.opt.vo.CrossOptResult;
import org.drools.core.util.DateUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap; import java.time.LocalDate;
import java.util.List; import java.time.LocalDateTime;
import java.util.Map; import java.time.LocalTime;
import java.util.*;
import java.util.stream.Collectors;
/** /**
* @author duanruiming * @author duanruiming
...@@ -32,6 +40,8 @@ public class CrossIndexServiceImpl implements CrossIndexService { ...@@ -32,6 +40,8 @@ public class CrossIndexServiceImpl implements CrossIndexService {
private CrossDataRealtimeMapper crossDataRealtimeMapper; private CrossDataRealtimeMapper crossDataRealtimeMapper;
@Resource @Resource
private BaseCrossInfoMapper baseCrossInfoMapper; private BaseCrossInfoMapper baseCrossInfoMapper;
@Resource
private StrategyCrossResultMapper strategyCrossResultMapper;
@Override @Override
public Map<Integer, CrossDirDataRealtimePO> crossDirIndex(CrossIdBO crossIdBO) { public Map<Integer, CrossDirDataRealtimePO> crossDirIndex(CrossIdBO crossIdBO) {
...@@ -60,4 +70,35 @@ public class CrossIndexServiceImpl implements CrossIndexService { ...@@ -60,4 +70,35 @@ public class CrossIndexServiceImpl implements CrossIndexService {
List<TBaseCrossInfo> baseCrossInfoPOS = baseCrossInfoMapper.selectList(queryWrapper); List<TBaseCrossInfo> baseCrossInfoPOS = baseCrossInfoMapper.selectList(queryWrapper);
return baseCrossInfoPOS; return baseCrossInfoPOS;
} }
@Override
public List<CrossOptResult> crossOptResultList(CrossIdBO crossIdBO) throws Exception{
LambdaQueryWrapper<StrategyCrossResultEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StrategyCrossResultEntity::getCrossId, crossIdBO.getCrossId());
LocalDate currentDate = LocalDate.now();
LocalTime startTime = LocalTime.MIDNIGHT;
LocalDateTime startOfDay = LocalDateTime.of(currentDate, startTime);
queryWrapper.eq(StrategyCrossResultEntity::getCrossId, crossIdBO.getCrossId());
queryWrapper.ge(StrategyCrossResultEntity::getIssueTime, startOfDay);
List<StrategyCrossResultEntity> list = strategyCrossResultMapper.selectList(queryWrapper);
List<CrossOptResult> crossOptResults = new ArrayList<>();
if (!CollectionUtils.isEmpty(list)) {
for (StrategyCrossResultEntity entity : list) {
CrossOptResult crossOptResult = new CrossOptResult();
Date date =DateUtil.parse(entity.getIssueTime(), "yyyy-MM-dd HH:mm:ss");
crossOptResult.setTimeStamp(date);
String timingPlan = entity.getTimingPlan();
Integer countDown = entity.getCountDown();
if (entity.getCurrentAlgo() == 2) {
countDown = 5;
}
crossOptResult.setCountDown(countDown);
Integer currentAlgo = entity.getCurrentAlgo();
crossOptResult.setStrategy(currentAlgo);
crossOptResult.setStrategyName(CrossOptStrategyEnum.getDesc(currentAlgo));
crossOptResults.add(crossOptResult);
}
}
return crossOptResults;
}
} }
...@@ -248,11 +248,15 @@ public class DiagnoServiceImpl implements DiagnoService { ...@@ -248,11 +248,15 @@ public class DiagnoServiceImpl implements DiagnoService {
week = 0; week = 0;
} }
//通过路口号和方案号查询方案id //通过路口号和方案号查询方案id
BaseCrossSchemePO baseCrossSchemePO = baseCrossSchemeMapper.selectByCrossIdAndWeek(crossId,week); CrossNowSchemePO baseCrossSchemePO = baseCrossSchemeMapper.selectByCrossIdAndWeek(crossId,week);
if (ObjectUtils.isEmpty(baseCrossSchemePO)){ if (ObjectUtils.isEmpty(baseCrossSchemePO)){
return phaseOptTimeList; return phaseOptTimeList;
} }
Integer schemeNo = Integer.valueOf(baseCrossSchemePO.getSchemeNo()); Integer schemeNo = baseCrossSchemePO.getSchemeId();
if (ObjectUtil.isEmpty(schemeNo)){
log.info("当前路口为黃闪,crossId:{}",crossId);
return phaseOptTimeList;
}
schemeNo = (schemeNo+2)/3; schemeNo = (schemeNo+2)/3;
List<CrossPhasePO> phasePOList = baseCrossPhaseMapper.selectByCrossIdAndSchemeId(crossId, schemeNo); List<CrossPhasePO> phasePOList = baseCrossPhaseMapper.selectByCrossIdAndSchemeId(crossId, schemeNo);
if (ObjectUtils.isEmpty(phasePOList) || ObjectUtils.isEmpty(schemeNo)) { if (ObjectUtils.isEmpty(phasePOList) || ObjectUtils.isEmpty(schemeNo)) {
......
package net.wanji.opt.service.signalopt; package net.wanji.opt.service.signalopt;
import net.wanji.opt.vo.GreenBeltFlowStopTimeVO; import net.wanji.opt.vo.GreenBeltFlowStopTimeVO;
import net.wanji.opt.vo.GreenBeltSpeedWidthVO;
import java.util.List; import java.util.List;
...@@ -9,5 +10,6 @@ import java.util.List; ...@@ -9,5 +10,6 @@ import java.util.List;
* @date 2024/11/19 18:07 * @date 2024/11/19 18:07
*/ */
public interface GreenBeltInfoService { public interface GreenBeltInfoService {
List<GreenBeltFlowStopTimeVO> greenBeltCrossDetailHist(Integer greenId); List<GreenBeltFlowStopTimeVO> greenBeltCrossDetailHist(Integer greenId) throws Exception;
List<GreenBeltSpeedWidthVO> greenBeltSpeedWidth(Integer greenId) throws Exception;
} }
package net.wanji.opt.service.signalopt.impl; package net.wanji.opt.service.signalopt.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.utils.tool.DateUtil;
import net.wanji.databus.dao.mapper.CrossDataHistMapper; import net.wanji.databus.dao.mapper.CrossDataHistMapper;
import net.wanji.databus.dao.mapper.GreenwaveInfoMapper; import net.wanji.databus.dao.mapper.GreenwaveInfoMapper;
import net.wanji.databus.po.CrossDataHistPO; import net.wanji.databus.po.CrossDataHistPO;
import net.wanji.opt.dao.mapper.StrategyControlInfoMapper;
import net.wanji.opt.dao.mapper.StrategyGreenOptHistMapper;
import net.wanji.opt.po.StrategyGreenOptHistEntity;
import net.wanji.opt.service.signalopt.GreenBeltInfoService; import net.wanji.opt.service.signalopt.GreenBeltInfoService;
import net.wanji.opt.synthesis.pojo.StrategyControlDataEntity;
import net.wanji.opt.vo.GreenBeltFlowStopTimeVO; import net.wanji.opt.vo.GreenBeltFlowStopTimeVO;
import net.wanji.opt.vo.GreenBeltSpeedWidthVO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.ParseException;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalTime; import java.time.LocalTime;
...@@ -21,46 +30,82 @@ import java.util.stream.Collectors; ...@@ -21,46 +30,82 @@ import java.util.stream.Collectors;
* @date 2024/12/02 13:42 * @date 2024/12/02 13:42
*/ */
@Service @Service
@Slf4j
public class GreenBeltServiceImpl implements GreenBeltInfoService { public class GreenBeltServiceImpl implements GreenBeltInfoService {
@Resource @Resource
private GreenwaveInfoMapper greenwaveInfoMapper; private GreenwaveInfoMapper greenwaveInfoMapper;
@Resource @Resource
private CrossDataHistMapper crossDataHistMapper; private CrossDataHistMapper crossDataHistMapper;
@Resource
private StrategyGreenOptHistMapper strategyGreenOptHistMapper;
@Override @Override
public List<GreenBeltFlowStopTimeVO> greenBeltCrossDetailHist(Integer greenId) { public List<GreenBeltSpeedWidthVO> greenBeltSpeedWidth(Integer greenId) throws Exception {
List<String> crossIds = greenwaveInfoMapper.selectCrossIdsById(greenId); try {
long currentTimeMillis = System.currentTimeMillis(); LambdaQueryWrapper<StrategyGreenOptHistEntity> queryWrapper = new LambdaQueryWrapper<>();
int startSecond = (int) (currentTimeMillis / 1000 - 3600); queryWrapper.eq(StrategyGreenOptHistEntity::getGreenId, greenId);
int endSecond = (int) (currentTimeMillis / 1000); LocalDate currentDate = LocalDate.now();
List<CrossDataHistPO> crossDataHistPOS = crossDataHistMapper.selectByCrossIdsAndTimestamp(crossIds, startSecond , endSecond); LocalTime startTime = LocalTime.MIDNIGHT;
if (!CollectionUtils.isEmpty(crossDataHistPOS)) { LocalDateTime startOfDay = LocalDateTime.of(currentDate, startTime);
List<GreenBeltFlowStopTimeVO> results = new ArrayList<>(); queryWrapper.ge(StrategyGreenOptHistEntity::getControlTime, startOfDay);
Map<Date, List<CrossDataHistPO>> startTimeMap = crossDataHistPOS.stream().collect(Collectors.groupingBy(CrossDataHistPO::getStartTime)); List<StrategyGreenOptHistEntity> entities = strategyGreenOptHistMapper.selectList(queryWrapper);
for (Map.Entry<Date, List<CrossDataHistPO>> entry : startTimeMap.entrySet()) { List<GreenBeltSpeedWidthVO> results = new ArrayList<>();
GreenBeltFlowStopTimeVO greenBeltFlowStopTimeVO = new GreenBeltFlowStopTimeVO(); if (!CollectionUtils.isEmpty(entities)) {
Date startDate = entry.getKey(); for (StrategyGreenOptHistEntity entity : entities) {
List<GreenBeltFlowStopTimeVO.FlowStopTimeDetail> crossList = new ArrayList<>(); GreenBeltSpeedWidthVO greenBeltSpeedWidthVO = new GreenBeltSpeedWidthVO();
greenBeltFlowStopTimeVO.setStartTime(startDate); Date date = DateUtil.parse(entity.getControlTime(), "yyyy-MM-dd HH:mm:ss");
List<CrossDataHistPO> value = entry.getValue(); greenBeltSpeedWidthVO.setStartTime(date);
if (!CollectionUtils.isEmpty(value)) { greenBeltSpeedWidthVO.setSpeed(entity.getMaxSpeed());
for (CrossDataHistPO crossDataHistPO : value) { greenBeltSpeedWidthVO.setWidth(entity.getGreenWidthTime());
GreenBeltFlowStopTimeVO.FlowStopTimeDetail flowStopTimeDetail = new GreenBeltFlowStopTimeVO.FlowStopTimeDetail(); results.add(greenBeltSpeedWidthVO);
flowStopTimeDetail.setFlow(crossDataHistPO.getFlow());
flowStopTimeDetail.setStopTimes(crossDataHistPO.getStopTimes());
flowStopTimeDetail.setCrossId(crossDataHistPO.getCrossId());
// todo 先删除,后续通过路口距离/速度计算 距离通过卫博发送数据
flowStopTimeDetail.setTravelTime(0.0);
crossList.add(flowStopTimeDetail);
}
} }
greenBeltFlowStopTimeVO.setDetailList(crossList);
results.add(greenBeltFlowStopTimeVO);
} }
Collections.sort(results, Comparator.comparing(GreenBeltFlowStopTimeVO::getStartTime));
return results; return results;
} catch (Exception e) {
log.error("绿波带宽曲线异常:", e);
throw new RuntimeException(e);
}
}
@Override
public List<GreenBeltFlowStopTimeVO> greenBeltCrossDetailHist(Integer greenId) throws Exception {
try {
List<String> crossIds = greenwaveInfoMapper.selectCrossIdsById(greenId);
long currentTimeMillis = System.currentTimeMillis();
int startSecond = (int) (currentTimeMillis / 1000 - 3600);
int endSecond = (int) (currentTimeMillis / 1000);
List<CrossDataHistPO> crossDataHistPOS = crossDataHistMapper.selectByCrossIdsAndTimestamp(crossIds, startSecond , endSecond);
if (!CollectionUtils.isEmpty(crossDataHistPOS)) {
List<GreenBeltFlowStopTimeVO> results = new ArrayList<>();
Map<Date, List<CrossDataHistPO>> startTimeMap = crossDataHistPOS.stream().collect(Collectors.groupingBy(CrossDataHistPO::getStartTime));
for (Map.Entry<Date, List<CrossDataHistPO>> entry : startTimeMap.entrySet()) {
GreenBeltFlowStopTimeVO greenBeltFlowStopTimeVO = new GreenBeltFlowStopTimeVO();
Date startDate = entry.getKey();
List<GreenBeltFlowStopTimeVO.FlowStopTimeDetail> crossList = new ArrayList<>();
greenBeltFlowStopTimeVO.setStartTime(startDate);
List<CrossDataHistPO> value = entry.getValue();
if (!CollectionUtils.isEmpty(value)) {
for (CrossDataHistPO crossDataHistPO : value) {
GreenBeltFlowStopTimeVO.FlowStopTimeDetail flowStopTimeDetail = new GreenBeltFlowStopTimeVO.FlowStopTimeDetail();
flowStopTimeDetail.setFlow(crossDataHistPO.getFlow());
flowStopTimeDetail.setStopTimes(crossDataHistPO.getStopTimes());
flowStopTimeDetail.setCrossId(crossDataHistPO.getCrossId());
// todo 先删除,后续通过路口距离/速度计算 距离通过卫博发送数据
flowStopTimeDetail.setTravelTime(0.0);
crossList.add(flowStopTimeDetail);
}
}
greenBeltFlowStopTimeVO.setDetailList(crossList);
results.add(greenBeltFlowStopTimeVO);
}
Collections.sort(results, Comparator.comparing(GreenBeltFlowStopTimeVO::getStartTime));
return results;
}
return Collections.EMPTY_LIST;
} catch (Exception e) {
log.error("绿波协调方向路口流量停车次数查询异常:", e);
throw new RuntimeException(e);
} }
return Collections.EMPTY_LIST;
} }
} }
...@@ -19,6 +19,8 @@ import net.wanji.databus.po.BaseCrossInfoPO; ...@@ -19,6 +19,8 @@ import net.wanji.databus.po.BaseCrossInfoPO;
import net.wanji.databus.po.TBaseCrossInfo; import net.wanji.databus.po.TBaseCrossInfo;
import net.wanji.opt.cache.BaseCrossInfoCache; import net.wanji.opt.cache.BaseCrossInfoCache;
import net.wanji.opt.cache.GreenWaveInfoCache; import net.wanji.opt.cache.GreenWaveInfoCache;
import net.wanji.opt.common.enums.CrossOptStrategyEnum;
import net.wanji.opt.common.enums.StrategyControlEnum;
import net.wanji.opt.dao.mapper.*; import net.wanji.opt.dao.mapper.*;
import net.wanji.opt.po.StrategyGreenOptHistEntity; import net.wanji.opt.po.StrategyGreenOptHistEntity;
import net.wanji.opt.synthesis.enums.StrategyCrossAlgoEnum; import net.wanji.opt.synthesis.enums.StrategyCrossAlgoEnum;
...@@ -349,41 +351,31 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -349,41 +351,31 @@ public class StrategyControlServiceImpl implements StrategyControlService {
for (StrategyControlDataEntity entity : entities) { for (StrategyControlDataEntity entity : entities) {
StrategyControlDataEntity result = new StrategyControlDataEntity(); StrategyControlDataEntity result = new StrategyControlDataEntity();
BeanUtils.copyProperties(entity, result); BeanUtils.copyProperties(entity, result);
Date start = entity.getScheduleStart(); String time = entity.getTime();
Date end = entity.getScheduleEnd(); List<StrategyControlDataVO.TimeTable> timeTables = instance.readValue(time, new TypeReference<List<StrategyControlDataVO.TimeTable>>() {
if (current.before(start) || current.after(end)) { });
result.setTime(""); for (StrategyControlDataVO.TimeTable timeTable : timeTables) {
} else { int currentWeek = DateUtil.thisDayOfWeek() - 1;
String time = entity.getTime(); String[] timeList = timeTable.getTimeList();
List<StrategyControlDataVO.TimeTable> timeTables = instance.readValue(time, new TypeReference<List<StrategyControlDataVO.TimeTable>>() { for (String s : timeList) {
}); String[] hours = s.split(",");
for (StrategyControlDataVO.TimeTable timeTable : timeTables) { for (String hour : hours) {
int currentWeek = DateUtil.thisDayOfWeek() - 1; String[] currentHour = hour.split("-");
if (currentWeek != timeTable.getWeek()) { String startHour = currentHour[0];
result.setTime(""); String entHour = currentHour[1];
} else { if (StringUtils.equals("24:00", entHour)) {
String[] timeList = timeTable.getTimeList(); entHour = "23:59";
for (String s : timeList) { }
String[] hours = s.split(","); String format = DateUtil.format(current, "HH:mm");
for (String hour : hours) { DateTime currentTime = DateUtil.parse(format, "HH:mm");
String[] currentHour = hour.split("-"); DateTime startHourDate = DateUtil.parse(startHour, "HH:mm");
String startHour = currentHour[0]; DateTime endHourDate = DateUtil.parse(entHour, "HH:mm");
String entHour = currentHour[1]; if (currentTime.after(startHourDate) && currentTime.before(endHourDate)) {
if (StringUtils.equals("24:00", entHour)) { result.setTime(hour);
entHour = "23:59"; result.setStatus(1);
} } else {
String format = DateUtil.format(current, "HH:mm"); // 如果有调度策略在执行,设置为开启,否则关闭,提供前端过滤配置和未配置
DateTime currentTime = DateUtil.parse(format, "HH:mm"); result.setStatus(0);
DateTime startHourDate = DateUtil.parse(startHour, "HH:mm");
DateTime endHourDate = DateUtil.parse(entHour, "HH:mm");
if (currentTime.after(startHourDate) && currentTime.before(endHourDate)) {
result.setTime(hour);
result.setStatus(1);
} else {
// 如果有调度策略在执行,设置为开启,否则关闭,提供前端过滤配置和未配置
result.setStatus(0);
}
}
} }
} }
} }
...@@ -410,19 +402,12 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -410,19 +402,12 @@ public class StrategyControlServiceImpl implements StrategyControlService {
JsonViewObject jsonViewObject = JsonViewObject.newInstance(); JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try { try {
List<StrategyControlDataEntity> currentStrateInfoList = getCurrentStrateInfoList(type); List<StrategyControlDataEntity> currentStrateInfoList = getCurrentStrateInfoList(type);
List<StrategyFactoryEntity> strategyFactoryEntities = strategyFactoryMapper.selectList(null);
List<StrategyControlDataExt> strategyControlDataExts = new ArrayList<>(); List<StrategyControlDataExt> strategyControlDataExts = new ArrayList<>();
for (StrategyControlDataEntity strategyControlDataEntity : currentStrateInfoList) { for (StrategyControlDataEntity strategyControlDataEntity : currentStrateInfoList) {
Integer strategy = strategyControlDataEntity.getStrategy(); Integer strategy = strategyControlDataEntity.getStrategy();
StrategyControlDataExt strategyControlDataExt = new StrategyControlDataExt(); StrategyControlDataExt strategyControlDataExt = new StrategyControlDataExt();
BeanUtils.copyProperties(strategyControlDataEntity, strategyControlDataExt); BeanUtils.copyProperties(strategyControlDataEntity, strategyControlDataExt);
String strategyName = ""; strategyControlDataExt.setStrategyName(StrategyControlEnum.getDesc(strategy));
for (StrategyFactoryEntity strategyFactoryEntity : strategyFactoryEntities) {
if (Objects.equals(strategy, strategyFactoryEntity.getScene())) {
strategyName = strategyFactoryEntity.getStrategyName();
}
}
strategyControlDataExt.setStrategyName(strategyName);
strategyControlDataExt.setOptStatus("未执行"); strategyControlDataExt.setOptStatus("未执行");
if (StringUtils.isNotBlank(strategyControlDataEntity.getTime())) { if (StringUtils.isNotBlank(strategyControlDataEntity.getTime())) {
strategyControlDataExt.setOptStatus("优化中"); strategyControlDataExt.setOptStatus("优化中");
...@@ -645,7 +630,7 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -645,7 +630,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
for (StrategyPlanDTO strategyPlanDTO : strategyPlanDTOS) { for (StrategyPlanDTO strategyPlanDTO : strategyPlanDTOS) {
Integer dailyPlanId = planDetail.getDailyPlanId(); Integer dailyPlanId = planDetail.getDailyPlanId();
List<Integer> weeks = planDetail.getWeeks(); List<Integer> weeks = planDetail.getWeeks();
if (dailyPlanId == strategyPlanDTO.getDailyPlanId()) { if (Objects.equals(dailyPlanId, strategyPlanDTO.getDailyPlanId())) {
strategyPlanDTO.setPlanId(planId); strategyPlanDTO.setPlanId(planId);
strategyPlanDTO.setStartTime(startTime); strategyPlanDTO.setStartTime(startTime);
strategyPlanDTO.setEndTime(endTime); strategyPlanDTO.setEndTime(endTime);
......
...@@ -55,7 +55,7 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService { ...@@ -55,7 +55,7 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService {
GreenBeltAreaIndexVO.DirDetail dirDetail = new GreenBeltAreaIndexVO.DirDetail(); GreenBeltAreaIndexVO.DirDetail dirDetail = new GreenBeltAreaIndexVO.DirDetail();
String roadDirection = realtimePO.getRoadDirection(); String roadDirection = realtimePO.getRoadDirection();
dirDetail.setDirName(GreenBeltDirEnum.getDesc(roadDirection)); dirDetail.setDirName(GreenBeltDirEnum.getDesc(roadDirection));
dirDetail.setTravelTime(realtimePO.getTrvalTime()); dirDetail.setTravelTime(realtimePO.getTrvalTime() / 60);
dirDetail.setStopTimes(realtimePO.getStopTimes()); dirDetail.setStopTimes(realtimePO.getStopTimes());
status = status >= realtimePO.getStatus() ? status : realtimePO.getStatus(); status = status >= realtimePO.getStatus() ? status : realtimePO.getStatus();
dirDetails.add(dirDetail); dirDetails.add(dirDetail);
......
...@@ -38,6 +38,7 @@ import org.springframework.stereotype.Component; ...@@ -38,6 +38,7 @@ import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalTime; import java.time.LocalTime;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -171,12 +172,15 @@ public class InducesMonitorTask { ...@@ -171,12 +172,15 @@ public class InducesMonitorTask {
LambdaQueryWrapper<GreenwaveInducesHist> greenwaveInducesHistQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<GreenwaveInducesHist> greenwaveInducesHistQueryWrapper = new LambdaQueryWrapper<>();
greenwaveInducesHistQueryWrapper.eq(GreenwaveInducesHist::getGreenId, greenwaveInfoPO.getId()); greenwaveInducesHistQueryWrapper.eq(GreenwaveInducesHist::getGreenId, greenwaveInfoPO.getId());
greenwaveInducesHistQueryWrapper.eq(GreenwaveInducesHist::getDir, getDir(greenOptHistEntity.getDir())); greenwaveInducesHistQueryWrapper.eq(GreenwaveInducesHist::getDir, getDir(greenOptHistEntity.getDir()));
GreenwaveInducesHist greenwaveInducesHist = greenwaveInducesHistService.getOne(greenwaveInducesHistQueryWrapper); List<GreenwaveInducesHist> greenwaveInducesHistList = greenwaveInducesHistService.list(greenwaveInducesHistQueryWrapper);
if (Objects.isNull(greenwaveInducesHist)) { GreenwaveInducesHist greenwaveInducesHist=null;
if (Objects.isNull(greenwaveInducesHistList) || greenwaveInducesHistList.size()<1) {
greenwaveInducesHist = new GreenwaveInducesHist(); greenwaveInducesHist = new GreenwaveInducesHist();
greenwaveInducesHist.setCreateTime(new Date()); greenwaveInducesHist.setCreateTime(new Date());
greenwaveInducesHist.setGreenId(greenwaveInfoPO.getId()); greenwaveInducesHist.setGreenId(greenwaveInfoPO.getId());
greenwaveInducesHist.setDir(getDir(greenOptHistEntity.getDir())); greenwaveInducesHist.setDir(getDir(greenOptHistEntity.getDir()));
}else{
greenwaveInducesHist=greenwaveInducesHistList.get(0);
} }
greenwaveInducesHist.setStrategyId(strategyId.get()); greenwaveInducesHist.setStrategyId(strategyId.get());
greenwaveInducesHist.setStrategyName(greenwaveInfoPO.getName());//当前策略名称 greenwaveInducesHist.setStrategyName(greenwaveInfoPO.getName());//当前策略名称
...@@ -186,7 +190,7 @@ public class InducesMonitorTask { ...@@ -186,7 +190,7 @@ public class InducesMonitorTask {
greenwaveInducesHist.setType(greenOptHistEntity.getType());// 执行策略 greenwaveInducesHist.setType(greenOptHistEntity.getType());// 执行策略
greenwaveInducesHist.setMinSpeed(greenOptHistEntity.getMinSpeed()); greenwaveInducesHist.setMinSpeed(greenOptHistEntity.getMinSpeed());
greenwaveInducesHist.setMaxSpeed(greenOptHistEntity.getMaxSpeed()); greenwaveInducesHist.setMaxSpeed(greenOptHistEntity.getMaxSpeed());
greenwaveInducesHist.setDir(greenOptHistEntity.getDirType()); // greenwaveInducesHist.setDir(greenOptHistEntity.getDirType());
//5、获取绿波信息,调用上屏服务;发布互联网诱导方案 //5、获取绿波信息,调用上屏服务;发布互联网诱导方案
//[{"crossId":"13MOD0B5SI0","phaseStartTime":32.0,"phaseEndTime":122.0,"greenStartTime":35.0,"speed":"39.71","offset":208.0,"travelTime":57.0,"distance":"628.81"},{"crossId":"13MQJ0B5SI0","phaseStartTime":43.0,"phaseEndTime":158.0,"greenStartTime":0.0,"speed":"35.54","offset":69.0,"travelTime":42.0,"distance":"414.62"},{"crossId":"13MS20B5SI0","phaseStartTime":32.0,"phaseEndTime":142.0,"greenStartTime":8.0,"speed":"22.72","offset":114.0,"travelTime":116.0,"distance":"732.00"},{"crossId":"13MUK0B5SH0","phaseStartTime":0.0,"phaseEndTime":135.0,"greenStartTime":0.0,"speed":"42.33","offset":50.0,"travelTime":45.0,"distance":"529.16"},{"crossId":"13N0F0B5SH0","phaseStartTime":25.0,"phaseEndTime":156.0,"greenStartTime":70.0,"speed":"40.67","offset":0.0,"travelTime":40.0,"distance":"451.89"},{"crossId":"13N200B5SH0","phaseStartTime":23.0,"phaseEndTime":150.0,"greenStartTime":0.0,"speed":"-1.00","offset":112.0,"travelTime":-1.0,"distance":"-1.00"}] //[{"crossId":"13MOD0B5SI0","phaseStartTime":32.0,"phaseEndTime":122.0,"greenStartTime":35.0,"speed":"39.71","offset":208.0,"travelTime":57.0,"distance":"628.81"},{"crossId":"13MQJ0B5SI0","phaseStartTime":43.0,"phaseEndTime":158.0,"greenStartTime":0.0,"speed":"35.54","offset":69.0,"travelTime":42.0,"distance":"414.62"},{"crossId":"13MS20B5SI0","phaseStartTime":32.0,"phaseEndTime":142.0,"greenStartTime":8.0,"speed":"22.72","offset":114.0,"travelTime":116.0,"distance":"732.00"},{"crossId":"13MUK0B5SH0","phaseStartTime":0.0,"phaseEndTime":135.0,"greenStartTime":0.0,"speed":"42.33","offset":50.0,"travelTime":45.0,"distance":"529.16"},{"crossId":"13N0F0B5SH0","phaseStartTime":25.0,"phaseEndTime":156.0,"greenStartTime":70.0,"speed":"40.67","offset":0.0,"travelTime":40.0,"distance":"451.89"},{"crossId":"13N200B5SH0","phaseStartTime":23.0,"phaseEndTime":150.0,"greenStartTime":0.0,"speed":"-1.00","offset":112.0,"travelTime":-1.0,"distance":"-1.00"}]
// List<GreenBeltInfoVO.CrossGreenDetail> crossGreenDetailList = new ArrayList<>(); // List<GreenBeltInfoVO.CrossGreenDetail> crossGreenDetailList = new ArrayList<>();
...@@ -195,8 +199,7 @@ public class InducesMonitorTask { ...@@ -195,8 +199,7 @@ public class InducesMonitorTask {
// } catch (JsonProcessingException e) { // } catch (JsonProcessingException e) {
// log.error("绿波详情转换失败:" + greenOptHistEntity.getGreenId() + "---" + e.getMessage()); // log.error("绿波详情转换失败:" + greenOptHistEntity.getGreenId() + "---" + e.getMessage());
// } // }
//greenwaveInducesHistService.saveOrUpdate(greenwaveInducesHist);
greenwaveInducesHistService.saveOrUpdate(greenwaveInducesHist);
////自动发送诱导消息 ////自动发送诱导消息
MessageParam messageParam = new MessageParam(); MessageParam messageParam = new MessageParam();
messageParam.setFlg(1); messageParam.setFlg(1);
...@@ -204,7 +207,7 @@ public class InducesMonitorTask { ...@@ -204,7 +207,7 @@ public class InducesMonitorTask {
messageParam.setContents(new String[]{greenOptHistEntity.getMaxSpeed()+"-"+greenOptHistEntity.getMaxSpeed()+"km/h"}); messageParam.setContents(new String[]{greenOptHistEntity.getMaxSpeed()+"-"+greenOptHistEntity.getMaxSpeed()+"km/h"});
messageParam.setType("TFMH"); messageParam.setType("TFMH");
try { try {
if(greenwaveInducesHist.getStatus()==0||greenwaveInducesHist.getModifyTime()!=greenOptHistEntity.getCreateTime()) { if(greenwaveInducesHist.getStatus()==0||greenwaveInducesHist.getModifyTime().before(greenOptHistEntity.getCreateTime())) {
LambdaQueryWrapper<GreenwaveInduces> greenwaveInducesQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<GreenwaveInduces> greenwaveInducesQueryWrapper = new LambdaQueryWrapper<>();
greenwaveInducesQueryWrapper.eq(GreenwaveInduces::getGreenId, greenwaveInfoPO.getId()); greenwaveInducesQueryWrapper.eq(GreenwaveInduces::getGreenId, greenwaveInfoPO.getId());
List<GreenwaveInduces> greenwaveInducesList = greenwaveInducesService.list(greenwaveInducesQueryWrapper); List<GreenwaveInduces> greenwaveInducesList = greenwaveInducesService.list(greenwaveInducesQueryWrapper);
...@@ -229,16 +232,16 @@ public class InducesMonitorTask { ...@@ -229,16 +232,16 @@ public class InducesMonitorTask {
} }
} }
greenwaveInducesHist.setStatus(1); greenwaveInducesHist.setStatus(1);
greenwaveInducesHist.setModifyTime(greenOptHistEntity.getCreateTime());
greenwaveInducesHistService.saveOrUpdate(greenwaveInducesHist);
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} catch (TemplateException e) { } catch (TemplateException e) {
log.info("发送上屏信息异常" + e.getMessage()); log.info("发送上屏信息异常" + e.getMessage());
} }
greenwaveInducesHist.setModifyTime(greenOptHistEntity.getCreateTime());
greenwaveInducesHistService.saveOrUpdate(greenwaveInducesHist);
synCount.getAndIncrement(); synCount.getAndIncrement();
log.info("同步绿波状态信息成功->" + greenwaveInfoPO.getName()); log.info("同步绿波状态信息成功->" + greenwaveInfoPO.getName()+greenOptHistEntity.getDir());
} }
} }
} }
...@@ -300,37 +303,39 @@ public class InducesMonitorTask { ...@@ -300,37 +303,39 @@ public class InducesMonitorTask {
* @return * @return
*/ */
private Integer getDir(String dirType) { private Integer getDir(String dirType) {
if (dirType=="e2w") { //东 if (dirType.equals("e2w")) { //东
return 4; return 4;
} else if (dirType=="s2n") {//南 } else if (dirType.equals("s2n")) {//南
return 1; return 1;
} else if (dirType=="w2e") {//西 } else if (dirType.equals("w2e")) {//西
return 2; return 2;
} else if (dirType=="n2s") {//北 } else if (dirType.equals("n2s")) {//北
return 3; return 3;
} }
return null; return null;
} }
public static void main(String []args){ public static void main(String []args) throws ParseException {
// 获取当前时间 // 获取当前时间
LocalTime now = LocalTime.now(); // LocalTime now = LocalTime.now();
List<String> timesList=new ArrayList(); // List<String> timesList=new ArrayList();
timesList.add("00:00"); // timesList.add("00:00");
timesList.add("23:59"); // timesList.add("23:59");
// 定义时间范围 // // 定义时间范围
LocalTime startTime = LocalTime.parse(timesList.get(0)); // LocalTime startTime = LocalTime.parse(timesList.get(0));
LocalTime endTime = LocalTime.parse(timesList.get(1)); // LocalTime endTime = LocalTime.parse(timesList.get(1));
//
// // 判断当前时间是否在范围内
// if (now.isAfter(startTime) && now.isBefore(endTime)) {
// System.out.println("当前时间在范围内: " + now);
// } else if (now.equals(startTime) || now.equals(endTime)) {
// System.out.println("当前时间恰好在范围边界: " + now);
// } else {
// System.out.println("当前时间不在范围内: " + now);
// }
// 判断当前时间是否在范围内 System.out.print(new Date().before(DateUtil.parse("2024-12-04", Constants.DATE_FORMAT.E_DATE_FORMAT_DAY)));
if (now.isAfter(startTime) && now.isBefore(endTime)) {
System.out.println("当前时间在范围内: " + now);
} else if (now.equals(startTime) || now.equals(endTime)) {
System.out.println("当前时间恰好在范围边界: " + now);
} else {
System.out.println("当前时间不在范围内: " + now);
}
} }
} }
package net.wanji.opt.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author duanruiming
* @date 2024/12/05 11:29
* @description 路口优化结果当前时间优化场景节约时间
*/
@Data
@ApiModel("路口优化曲线实体")
public class CrossOptResult {
@ApiModelProperty("策略")
private Integer strategy;
@ApiModelProperty("策略名称")
private String strategyName;
@ApiModelProperty("节约时间")
private Integer countDown;
@ApiModelProperty("时间戳")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm", timezone = "GMT+8")
private Date timeStamp;
}
package net.wanji.opt.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author duanruiming
* @date 2024/12/05 19:48
*/
@Data
@ApiModel(value = "优化监测-绿波带宽曲线实体")
public class GreenBeltSpeedWidthVO {
@ApiModelProperty("时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm:ss", timezone = "GMT+8")
private Date startTime;
@ApiModelProperty("流量")
private Double speed;
@ApiModelProperty("带宽")
private Double width;
}
...@@ -138,4 +138,15 @@ public class StaticInfoController { ...@@ -138,4 +138,15 @@ public class StaticInfoController {
public JsonViewObject schemeOptLog(@RequestBody @Validated CrossSchemeRingsDTO crossSchemeRingsDTO) throws Exception { public JsonViewObject schemeOptLog(@RequestBody @Validated CrossSchemeRingsDTO crossSchemeRingsDTO) throws Exception {
return JsonViewObject.newInstance().success(staticInfoService.schemeOptLog(crossSchemeRingsDTO)); return JsonViewObject.newInstance().success(staticInfoService.schemeOptLog(crossSchemeRingsDTO));
} }
@AspectLog(description = "根据时间和路口号查询方案号", operationType = BaseEnum.OperationTypeEnum.QUERY)
@PostMapping(value = "/selectSchemeByParams")
@ApiOperation(value = "根据时间和路口号查询方案号", notes = "查询方案优化记录", response = CrossSchemeRings.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossSchemeRings.class)
})
public JsonViewObject selectSchemeByParams(@RequestBody @Validated QueryByCrossIdAndTimeDTO queryByCrossIdAndTimeDTO) throws Exception {
return JsonViewObject.newInstance().success(staticInfoService.selectSchemeByParams(queryByCrossIdAndTimeDTO));
}
} }
package net.wanji.utc.hisense.service; package net.wanji.utc.hisense.service;
import net.wanji.databus.dao.entity.BaseCrossSchemePO;
import net.wanji.databus.dao.entity.CrossSchedulesPO; import net.wanji.databus.dao.entity.CrossSchedulesPO;
import net.wanji.databus.dao.entity.CrossSchemeStageOptLogPO; import net.wanji.databus.dao.entity.CrossSchemeStageOptLogPO;
import net.wanji.databus.dto.*; import net.wanji.databus.dto.*;
...@@ -39,4 +40,11 @@ public interface StaticInfoService { ...@@ -39,4 +40,11 @@ public interface StaticInfoService {
**/ **/
List<CrossSchemeStageOptLogPO> schemeOptLog(CrossSchemeRingsDTO crossSchemeRingsDTO) throws Exception; List<CrossSchemeStageOptLogPO> schemeOptLog(CrossSchemeRingsDTO crossSchemeRingsDTO) throws Exception;
/**
* @Description : 根据时间和路口号查询方案号
* @Param crossId 路口编号
* @Param datetime 时间
**/
BaseCrossSchemePO selectSchemeByParams(QueryByCrossIdAndTimeDTO queryByCrossIdAndTimeDTO) throws Exception;
} }
...@@ -17,6 +17,7 @@ import net.wanji.databus.dto.*; ...@@ -17,6 +17,7 @@ import net.wanji.databus.dto.*;
import net.wanji.databus.po.CoordinationStatus; import net.wanji.databus.po.CoordinationStatus;
import net.wanji.databus.po.CrossInfoPO; import net.wanji.databus.po.CrossInfoPO;
import net.wanji.databus.po.CrossInfoPOExt; import net.wanji.databus.po.CrossInfoPOExt;
import net.wanji.databus.po.CrossNowSchemePO;
import net.wanji.databus.vo.PlanSectionVO; import net.wanji.databus.vo.PlanSectionVO;
import net.wanji.databus.vo.SchemePhaseLightsVO; import net.wanji.databus.vo.SchemePhaseLightsVO;
import net.wanji.utc.hisense.cache.CrossInfoCache; import net.wanji.utc.hisense.cache.CrossInfoCache;
...@@ -40,7 +41,9 @@ import org.springframework.stereotype.Service; ...@@ -40,7 +41,9 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.ZoneId;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -171,10 +174,34 @@ public class StaticInfoServiceImpl implements StaticInfoService { ...@@ -171,10 +174,34 @@ public class StaticInfoServiceImpl implements StaticInfoService {
} }
phaseLightsVO.setCrossPhaseLightsPOList(crossPhaseLightsPOList); phaseLightsVO.setCrossPhaseLightsPOList(crossPhaseLightsPOList);
phaseLightsVO.setCrossLightsList(crossLightsList); phaseLightsVO.setCrossLightsList(crossLightsList);
CrossSchemePO crossSchemePO = addNewScheme(crossId);
crossSchemeList.add(crossSchemePO);
phaseLightsVO.setCrossSchemeList(crossSchemeList); phaseLightsVO.setCrossSchemeList(crossSchemeList);
phaseLightsVO.setCrossPhaseList(crossPhaseList); phaseLightsVO.setCrossPhaseList(crossPhaseList);
return phaseLightsVO; return phaseLightsVO;
} }
//初始化一个黃闪方案
private CrossSchemePO addNewScheme(String crossId){
CrossSchemePO crossSchemePO = new CrossSchemePO();
//方案号
int schemeNo = 85;
crossSchemePO.setSchemeNo(schemeNo + "");
crossSchemePO.setName("方案" + schemeNo);
crossSchemePO.setCrossId(crossId);
crossSchemePO.setCycle(0);
//协调相位id先默认给1
crossSchemePO.setCoordPhase(1);
crossSchemePO.setOffset(0);
//来源默认信号机
crossSchemePO.setSource(1);
//默认给0
crossSchemePO.setIsDeleted(0);
//默认给0
crossSchemePO.setStatus(0);
crossSchemePO.setGmtCreate(null);
crossSchemePO.setGmtModified(null);
return crossSchemePO;
}
/** /**
* @return java.util.Map<java.lang.Integer, java.util.List < net.wanji.utc.hisense.pojo.dto.RingPhaseDTO>> * @return java.util.Map<java.lang.Integer, java.util.List < net.wanji.utc.hisense.pojo.dto.RingPhaseDTO>>
...@@ -690,20 +717,23 @@ public class StaticInfoServiceImpl implements StaticInfoService { ...@@ -690,20 +717,23 @@ public class StaticInfoServiceImpl implements StaticInfoService {
//表中周日用0表示 //表中周日用0表示
week = 0; week = 0;
} }
BaseCrossSchemePO baseCrossSchemePO = baseCrossSchemeMapper.selectByCrossIdAndWeek(crossId, week); CrossNowSchemePO baseCrossSchemePO = baseCrossSchemeMapper.selectByCrossIdAndWeek(crossId, week);
if (ObjectUtil.isNotEmpty(baseCrossSchemePO)) { if (ObjectUtil.isNotEmpty(baseCrossSchemePO)) {
coordinationStatus = new CoordinationStatus(); coordinationStatus = new CoordinationStatus();
//从缓存中拿路口信息 //从缓存中拿路口信息
CrossInfoPO crossInfoPO = CrossInfoCache.getCrossInfoCache().get(crossId); CrossInfoPO crossInfoPO = CrossInfoCache.getCrossInfoCache().get(crossId);
if (ObjectUtil.isNotNull(crossInfoPO)) { if (ObjectUtil.isNotNull(crossInfoPO)) {
coordinationStatus.setSpot(crossInfoPO.getCode()); coordinationStatus.setSpot(crossInfoPO.getCode());
//海信的方案号 Integer poSchemeId = baseCrossSchemePO.getSchemeId();
int schemeNo = Integer.valueOf(baseCrossSchemePO.getSchemeNo()) * 3 - 2; if (baseCrossSchemePO.getControlMode() == 3 || ObjectUtil.isEmpty(poSchemeId)) {
if (schemeNo == 253) { //控制模式为3或者方案号为空,判断为黃闪
//黃闪 coordinationStatus.setCoordPatternStatus(String.valueOf(255));
schemeNo = 255; } else {
//海信的方案号
int schemeNo = Integer.valueOf(baseCrossSchemePO.getSchemeId()) * 3 - 2;
coordinationStatus.setCoordPatternStatus(String.valueOf(schemeNo));
} }
coordinationStatus.setCoordPatternStatus(String.valueOf(schemeNo));
coordinationStatus.setCoordCycleStatus(String.valueOf(baseCrossSchemePO.getCycle())); coordinationStatus.setCoordCycleStatus(String.valueOf(baseCrossSchemePO.getCycle()));
} }
...@@ -771,9 +801,9 @@ public class StaticInfoServiceImpl implements StaticInfoService { ...@@ -771,9 +801,9 @@ public class StaticInfoServiceImpl implements StaticInfoService {
CoordinationStatus coordinationStatus = crossPlan(crossSchemeRingsDTO.getCrossId()); CoordinationStatus coordinationStatus = crossPlan(crossSchemeRingsDTO.getCrossId());
if (ObjectUtil.isEmpty(coordinationStatus)) { if (ObjectUtil.isEmpty(coordinationStatus)) {
//获取方案号失败 //获取方案号失败
log.error("请求方案环图前,获取当前运行方案号失败,crossId:{}",crossSchemeRingsDTO.getCrossId()); log.error("请求方案环图前,获取当前运行方案号失败,crossId:{}", crossSchemeRingsDTO.getCrossId());
return null; return null;
}else if ("255".equals(coordinationStatus.getCoordPatternStatus())){ } else if ("255".equals(coordinationStatus.getCoordPatternStatus())) {
//黃闪 //黃闪
CrossSchemeRings crossSchemeRings = new CrossSchemeRings(); CrossSchemeRings crossSchemeRings = new CrossSchemeRings();
crossSchemeRings.setSpot(crossSchemeRingsDTO.getCrossId()); crossSchemeRings.setSpot(crossSchemeRingsDTO.getCrossId());
...@@ -848,10 +878,10 @@ public class StaticInfoServiceImpl implements StaticInfoService { ...@@ -848,10 +878,10 @@ public class StaticInfoServiceImpl implements StaticInfoService {
} }
/** /**
* @Description 获取环图请求原有的逻辑 * @return net.wanji.utc.hisense.pojo.result.CrossSchemeRings
* @Param [crossSchemeRingsDTO] * @Description 获取环图请求原有的逻辑
* @return net.wanji.utc.hisense.pojo.result.CrossSchemeRings * @Param [crossSchemeRingsDTO]
**/ **/
public CrossSchemeRings crossSchemeRingsHisen(CrossSchemeRingsDTO crossSchemeRingsDTO) throws Exception { public CrossSchemeRings crossSchemeRingsHisen(CrossSchemeRingsDTO crossSchemeRingsDTO) throws Exception {
CrossInfoPOExt crossInfoPOExt = crossInfoMapper.selectById(crossSchemeRingsDTO.getCrossId()); CrossInfoPOExt crossInfoPOExt = crossInfoMapper.selectById(crossSchemeRingsDTO.getCrossId());
...@@ -926,4 +956,34 @@ public class StaticInfoServiceImpl implements StaticInfoService { ...@@ -926,4 +956,34 @@ public class StaticInfoServiceImpl implements StaticInfoService {
List<CrossSchemeStageOptLogPO> crossSchemeStageOptLogPOS = crossSchemeStageOptLogMapper.selectList(queryWrapper); List<CrossSchemeStageOptLogPO> crossSchemeStageOptLogPOS = crossSchemeStageOptLogMapper.selectList(queryWrapper);
return crossSchemeStageOptLogPOS; return crossSchemeStageOptLogPOS;
} }
@Override
public BaseCrossSchemePO selectSchemeByParams(QueryByCrossIdAndTimeDTO queryByCrossIdAndTimeDTO) throws Exception {
Date datetime = queryByCrossIdAndTimeDTO.getDatetime();
//java.util.date转LocalDate
LocalDate localDate = datetime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
int week = localDate.getDayOfWeek().getValue();
if (week == 7) {
//表中周日用0表示
week = 0;
}
// 创建一个 SimpleDateFormat 对象,并指定日期格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 将 Date 对象格式化为字符串
String formattedDate = sdf.format(datetime);
BaseCrossSchemePO baseCrossSchemePO = baseCrossSchemeMapper.selectSchemeByParams(queryByCrossIdAndTimeDTO.getCrossId(), formattedDate, week);
if (ObjectUtil.isNull(baseCrossSchemePO)) {
//获取当前方案号
CoordinationStatus coordinationStatus = crossPlan(queryByCrossIdAndTimeDTO.getCrossId());
if (ObjectUtil.isNotNull(coordinationStatus)) {
baseCrossSchemePO = new BaseCrossSchemePO();
String coordPatternStatus = coordinationStatus.getCoordPatternStatus();
int schemaId = (Integer.valueOf(coordPatternStatus) + 2) / 3;
baseCrossSchemePO.setSchemeNo(String.valueOf(schemaId));
baseCrossSchemePO.setCrossId(queryByCrossIdAndTimeDTO.getCrossId());
baseCrossSchemePO.setCycle(Integer.valueOf(coordinationStatus.getCoordCycleStatus()));
}
}
return baseCrossSchemePO;
}
} }
...@@ -177,6 +177,15 @@ public class StaticInfoController { ...@@ -177,6 +177,15 @@ public class StaticInfoController {
public JsonViewObject schemeOptLog(@Validated @RequestBody CrossSchemeRingsDTO crossSchemeRingsDTO) throws Exception { public JsonViewObject schemeOptLog(@Validated @RequestBody CrossSchemeRingsDTO crossSchemeRingsDTO) throws Exception {
return staticInfoService.schemeOptLog(crossSchemeRingsDTO); return staticInfoService.schemeOptLog(crossSchemeRingsDTO);
} }
@AspectLog(description = "根据时间和路口号查询方案号", operationType = BaseEnum.OperationTypeEnum.QUERY)
@PostMapping(value = "/selectSchemeByParams", produces = MediaType.APPLICATION_JSON)
@ApiOperation(value = "根据时间和路口号查询方案号", notes = "查询方案优化记录")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossSchedulesPO.class)
})
public JsonViewObject selectSchemeByParams(@Validated @RequestBody QueryByCrossIdAndTimeDTO queryByCrossIdAndTimeDTO) throws Exception {
return staticInfoService.selectSchemeByParams(queryByCrossIdAndTimeDTO);
}
} }
...@@ -32,4 +32,5 @@ public interface StaticInfoService { ...@@ -32,4 +32,5 @@ public interface StaticInfoService {
JsonViewObject crossSchemeNo(String crossId) throws Exception; JsonViewObject crossSchemeNo(String crossId) throws Exception;
JsonViewObject crossSchemeRings(CrossSchemeRingsDTO crossSchemeRingsDTO) throws Exception; JsonViewObject crossSchemeRings(CrossSchemeRingsDTO crossSchemeRingsDTO) throws Exception;
JsonViewObject schemeOptLog(CrossSchemeRingsDTO crossSchemeRingsDTO) throws Exception; JsonViewObject schemeOptLog(CrossSchemeRingsDTO crossSchemeRingsDTO) throws Exception;
JsonViewObject selectSchemeByParams(QueryByCrossIdAndTimeDTO queryByCrossIdAndTimeDTO) throws Exception;
} }
...@@ -3,6 +3,7 @@ package net.wanji.utc.service.staticinfo; ...@@ -3,6 +3,7 @@ package net.wanji.utc.service.staticinfo;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.dao.entity.CrossSchedulesPO; import net.wanji.databus.dao.entity.CrossSchedulesPO;
import net.wanji.databus.dto.CrossSchemeRingsDTO; import net.wanji.databus.dto.CrossSchemeRingsDTO;
import net.wanji.databus.dto.QueryByCrossIdAndTimeDTO;
import net.wanji.utc.common.Result; import net.wanji.utc.common.Result;
import java.util.List; import java.util.List;
...@@ -54,4 +55,5 @@ public interface WanJiCommonStaticInfoService { ...@@ -54,4 +55,5 @@ public interface WanJiCommonStaticInfoService {
JsonViewObject crossSchemeRings(CrossSchemeRingsDTO crossSchemeRingsDTO) throws Exception; JsonViewObject crossSchemeRings(CrossSchemeRingsDTO crossSchemeRingsDTO) throws Exception;
JsonViewObject schemeOptLog(CrossSchemeRingsDTO crossSchemeRingsDTO) throws Exception; JsonViewObject schemeOptLog(CrossSchemeRingsDTO crossSchemeRingsDTO) throws Exception;
JsonViewObject selectSchemeByParams(QueryByCrossIdAndTimeDTO queryByCrossIdAndTimeDTO) throws Exception;
} }
...@@ -236,4 +236,11 @@ public class StaticInfoServiceImpl implements StaticInfoService { ...@@ -236,4 +236,11 @@ public class StaticInfoServiceImpl implements StaticInfoService {
jsonViewObject = wanjiCommonStaticInfoService.schemeOptLog(crossSchemeRingsDTO); jsonViewObject = wanjiCommonStaticInfoService.schemeOptLog(crossSchemeRingsDTO);
return jsonViewObject; return jsonViewObject;
} }
@Override
public JsonViewObject selectSchemeByParams(QueryByCrossIdAndTimeDTO queryByCrossIdAndTimeDTO) throws Exception {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
jsonViewObject = wanjiCommonStaticInfoService.selectSchemeByParams(queryByCrossIdAndTimeDTO);
return jsonViewObject;
}
} }
...@@ -11,6 +11,7 @@ import net.wanji.databus.dao.mapper.*; ...@@ -11,6 +11,7 @@ import net.wanji.databus.dao.mapper.*;
import net.wanji.databus.dto.CrossSchedulesDTO; import net.wanji.databus.dto.CrossSchedulesDTO;
import net.wanji.databus.dto.CrossSchemeRingsDTO; import net.wanji.databus.dto.CrossSchemeRingsDTO;
import net.wanji.databus.dto.PlanSectionDTO; import net.wanji.databus.dto.PlanSectionDTO;
import net.wanji.databus.dto.QueryByCrossIdAndTimeDTO;
import net.wanji.databus.vo.CrossIdVO; import net.wanji.databus.vo.CrossIdVO;
import net.wanji.databus.vo.PlanSectionVO; import net.wanji.databus.vo.PlanSectionVO;
import net.wanji.databus.vo.SchemePhaseLightsVO; import net.wanji.databus.vo.SchemePhaseLightsVO;
...@@ -138,6 +139,7 @@ public class WanJiCommonStaticInfoServiceImpl implements WanJiCommonStaticInfoSe ...@@ -138,6 +139,7 @@ public class WanJiCommonStaticInfoServiceImpl implements WanJiCommonStaticInfoSe
CrossSchemePO baseCrossSchemePO = crossSchemeMapper.selectByCrossIdAndSchemeNo(crossId, crossSectionPO.getSchemeId()); CrossSchemePO baseCrossSchemePO = crossSchemeMapper.selectByCrossIdAndSchemeNo(crossId, crossSectionPO.getSchemeId());
if (Objects.nonNull(baseCrossSchemePO)) { if (Objects.nonNull(baseCrossSchemePO)) {
crossSectionPO.setSchemeId(baseCrossSchemePO.getId()); crossSectionPO.setSchemeId(baseCrossSchemePO.getId());
// crossSectionPO.setSchemeId(crossSectionPO.getSchemeId());
crossSectionMapper.insertOne(crossSectionPO); crossSectionMapper.insertOne(crossSectionPO);
} }
}); });
...@@ -217,4 +219,15 @@ public class WanJiCommonStaticInfoServiceImpl implements WanJiCommonStaticInfoSe ...@@ -217,4 +219,15 @@ public class WanJiCommonStaticInfoServiceImpl implements WanJiCommonStaticInfoSe
return jsonViewObject; return jsonViewObject;
} }
@Override
public JsonViewObject selectSchemeByParams(QueryByCrossIdAndTimeDTO queryByCrossIdAndTimeDTO) throws Exception {
String manufacturerIdCode = crossInfoCache.getManufacturerCodeByCrossId(queryByCrossIdAndTimeDTO.getCrossId());
FeignCommon utcFeignClientService = utcFeignClientCache.getUtcFeignClientService(manufacturerIdCode);
JsonViewObject jsonViewObject = utcFeignClientService.selectSchemeByParams(queryByCrossIdAndTimeDTO);
if (Objects.isNull(jsonViewObject) || jsonViewObject.getCode() != 200) {
throw new Exception("查询方案优化记录远程服务调用异常,异常信息" + jsonViewObject.getMessage());
}
return jsonViewObject;
}
} }
...@@ -15,4 +15,6 @@ public class GreenwaveHistPOExt { ...@@ -15,4 +15,6 @@ public class GreenwaveHistPOExt {
private Integer avgSpeed; private Integer avgSpeed;
@ApiModelProperty(value = "拥堵指数") @ApiModelProperty(value = "拥堵指数")
private Double congestionIndex; private Double congestionIndex;
@ApiModelProperty(value = "行程时间")
private Double trvalTime;
} }
package net.wanji.databus.dao.mapper; package net.wanji.databus.dao.mapper;
import net.wanji.databus.dao.entity.BaseCrossSchemePO; import net.wanji.databus.dao.entity.BaseCrossSchemePO;
import net.wanji.databus.po.CrossNowSchemePO;
import net.wanji.databus.po.CrossSchemeInfoPO; import net.wanji.databus.po.CrossSchemeInfoPO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -60,5 +61,6 @@ public interface BaseCrossSchemeMapper { ...@@ -60,5 +61,6 @@ public interface BaseCrossSchemeMapper {
BaseCrossSchemePO selectByCrossIdAndSchemeId(String crossId, Integer schemeId); BaseCrossSchemePO selectByCrossIdAndSchemeId(String crossId, Integer schemeId);
List<CrossSchemeInfoPO> selectSchemeInfoByCrossIdAndSchemeId(String crossId, Integer schemeId); List<CrossSchemeInfoPO> selectSchemeInfoByCrossIdAndSchemeId(String crossId, Integer schemeId);
BaseCrossSchemePO selectByCrossIdAndWeek(@Param("crossId") String crossId,@Param("week") int week); CrossNowSchemePO selectByCrossIdAndWeek(@Param("crossId") String crossId, @Param("week") int week);
BaseCrossSchemePO selectSchemeByParams(@Param("crossId") String crossId,@Param("queryTime") String queryTime,@Param("week") int week);
} }
package net.wanji.databus.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.Date;
/**
* @ClassName QueryByCrossIdAndTimeDTO
* @Description 根据路口编号和时间查询参数
* @Author zhouleilei
* @Date 2024/12/5 10:11
*/
@Data
public class QueryByCrossIdAndTimeDTO {
@ApiModelProperty(value = "路口ID")
@Pattern(regexp = "^[A-Za-z0-9]{11}$", message = "路口编号只能包含英文、数字,必须11个字符")
@NotNull(message = "crossId不能为空")
private String crossId;
@ApiModelProperty(value = "当前日期时间 yyyy-MM-dd HH:mm:ss", required = true)
@NotNull(message = "datetime不可为空")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date datetime;
}
package net.wanji.databus.po;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @ClassName CrossSchemePO
* @Description 路口方案信息
* @Author zhouleilei
* @Date 2024/12/5 14:41
*/
@Data
public class CrossNowSchemePO {
/** 方案号 */
@ApiModelProperty(name = "方案号",notes = "")
private Integer schemeId ;
/** 方案名称 */
@ApiModelProperty(name = "方案名称",notes = "")
private String name ;
/** 路口ID */
@ApiModelProperty(name = "路口ID",notes = "")
private String crossId ;
/** 周期 */
@ApiModelProperty(name = "周期",notes = "")
private Integer cycle = 0;
/** 相位差 */
@ApiModelProperty(name = "相位差",notes = "")
private Integer offset = 0;
/** 时段号 */
@ApiModelProperty(name = "时段号",notes = "")
private Integer sectionNo ;
/** 开始时间 */
@ApiModelProperty(name = "开始时间",notes = "")
private String startTime ;
/** 结束时间 */
@ApiModelProperty(name = "结束时间",notes = "")
private String endTime ;
/** 控制模式 */
@ApiModelProperty(name = "控制模式",notes = "1定周期;2绿波协调;3黄闪;4全红;5关灯;6单点自适应;7全感应;8半感应;9',")
private Integer controlMode ;
}
...@@ -219,9 +219,17 @@ ...@@ -219,9 +219,17 @@
ORDER BY ORDER BY
phaseNo ASC phaseNo ASC
</select> </select>
<select id="selectByCrossIdAndWeek" resultType="net.wanji.databus.dao.entity.BaseCrossSchemePO"> <select id="selectByCrossIdAndWeek" resultType="net.wanji.databus.po.CrossNowSchemePO">
SELECT SELECT
scheme.id AS id,scheme.scheme_no AS schemeNo,scheme.name AS name,scheme.cross_id AS crossId,scheme.cycle AS cycle,scheme.coord_phase AS coordPhase,scheme.offset AS offset,scheme.source AS source,scheme.is_deleted AS isDeleted,scheme.status AS status,scheme.gmt_create AS gmtCreate,scheme.gmt_modified AS gmtModified schedules.cross_id AS corssId,
section.section_no AS sectionNo,
section.start_time AS startTime,
section.end_time AS endTime,
scheme.scheme_no AS schemeId,
scheme.`name` AS name,
scheme.cycle AS cycle,
scheme.`offset` AS offset,
section.control_mode AS controlMode
FROM FROM
t_cross_schedules schedules t_cross_schedules schedules
LEFT JOIN t_cross_section section ON section.cross_id = schedules.cross_id LEFT JOIN t_cross_section section ON section.cross_id = schedules.cross_id
...@@ -236,5 +244,22 @@ ...@@ -236,5 +244,22 @@
ORDER BY DATE_FORMAT( CAST( section.end_time AS TIME ), '%H:%i' ) ASC LIMIT 1 ORDER BY DATE_FORMAT( CAST( section.end_time AS TIME ), '%H:%i' ) ASC LIMIT 1
</select> </select>
<select id="selectSchemeByParams" resultType="net.wanji.databus.dao.entity.BaseCrossSchemePO">
SELECT
scheme.id AS id,scheme.scheme_no AS schemeNo,scheme.name AS name,scheme.cross_id AS crossId,scheme.cycle AS cycle,scheme.coord_phase AS coordPhase,scheme.offset AS offset,scheme.source AS source,scheme.is_deleted AS isDeleted,scheme.status AS status,scheme.gmt_create AS gmtCreate,scheme.gmt_modified AS gmtModified
FROM
t_cross_schedules schedules
LEFT JOIN t_cross_section section ON section.cross_id = schedules.cross_id
AND schedules.plan_id = section.plan_id
LEFT JOIN t_cross_scheme scheme ON scheme.cross_id = section.cross_id
AND section.scheme_id = scheme.id
WHERE
schedules.cross_id = #{crossId}
AND schedules.`week` = #{week}
AND DATE_FORMAT( #{queryTime}, '%H:%i' ) BETWEEN DATE_FORMAT( CAST( section.start_time AS TIME ), '%H:%i' )
AND DATE_FORMAT( CAST( section.end_time AS TIME ), '%H:%i' )
ORDER BY DATE_FORMAT( CAST( section.end_time AS TIME ), '%H:%i' ) ASC LIMIT 1
</select>
</mapper> </mapper>
...@@ -41,7 +41,8 @@ ...@@ -41,7 +41,8 @@
<select id="selectRunMonitor" resultType="net.wanji.databus.dao.entity.GreenwaveHistPOExt"> <select id="selectRunMonitor" resultType="net.wanji.databus.dao.entity.GreenwaveHistPOExt">
SELECT DATE_FORMAT(gmt_modified, '%Y-%m-%d %H:00:00') AS hour, SELECT DATE_FORMAT(gmt_modified, '%Y-%m-%d %H:00:00') AS hour,
ROUND(AVG(speed)) AS avg_speed, ROUND(AVG(speed)) AS avg_speed,
ROUND(AVG(traffic_index), 2) AS congestion_index ROUND(AVG(traffic_index), 2) AS congestion_index,
ROUND(AVG(trval_time), 2) AS trval_time
FROM t_greenwave_hist FROM t_greenwave_hist
WHERE gmt_modified &gt;= DATE_SUB(DATE_FORMAT(#{nowTime}, '%Y-%m-%d %H:00:00'), INTERVAL 10 HOUR) WHERE gmt_modified &gt;= DATE_SUB(DATE_FORMAT(#{nowTime}, '%Y-%m-%d %H:00:00'), INTERVAL 10 HOUR)
AND gmt_modified &lt; DATE_FORMAT(DATE_ADD(#{nowTime}, INTERVAL 1 HOUR), '%Y-%m-%d %H:00:00') AND gmt_modified &lt; DATE_FORMAT(DATE_ADD(#{nowTime}, INTERVAL 1 HOUR), '%Y-%m-%d %H:00:00')
......
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