Commit 96949629 authored by duanruiming's avatar duanruiming

Merge remote-tracking branch 'origin/master'

parents 10fbf0c0 88dd9f6a
...@@ -223,7 +223,6 @@ public class DiagnoServiceImpl implements DiagnoService { ...@@ -223,7 +223,6 @@ public class DiagnoServiceImpl implements DiagnoService {
public void sendManual(SendManualDTO sendManualDTO) throws Exception { public void sendManual(SendManualDTO sendManualDTO) throws Exception {
// 构造场景、策略、方法 // 构造场景、策略、方法
String optDataExtend = buildOptDataExtend(sendManualDTO); String optDataExtend = buildOptDataExtend(sendManualDTO);
SchemeOptSendVO schemeOptSendVO = new SchemeOptSendVO(); SchemeOptSendVO schemeOptSendVO = new SchemeOptSendVO();
schemeOptSendVO.setDataExtend(optDataExtend); schemeOptSendVO.setDataExtend(optDataExtend);
Integer optTypeInt = sendManualDTO.getOptType(); Integer optTypeInt = sendManualDTO.getOptType();
......
...@@ -152,18 +152,9 @@ public class StaticInfoServiceImpl implements StaticInfoService { ...@@ -152,18 +152,9 @@ public class StaticInfoServiceImpl implements StaticInfoService {
List<CrossSchemeRings.Phase> phaseList = crossSchemeRings.getPhaseList(); List<CrossSchemeRings.Phase> phaseList = crossSchemeRings.getPhaseList();
CrossSchemeRings.Phase phase = phaseList.get(0); CrossSchemeRings.Phase phase = phaseList.get(0);
//16 个相位的红灯时间(单位秒),中间用空格隔开,不存在的相位置 0。
String[] redTime = phase.getRedTime().split(" ");
//16 个相位的绿灯时间(单位秒),中间用空格隔开,不存在的相位置 0。
String[] greenTime = phase.getGreenTime().split(" ");
//16 个相位的黄灯时间(单位秒),中间用空格隔开,不存在的相位置 0。
String[] yellowTime = phase.getYellowTime().split(" ");
//16 个相位的最小绿时间(单位秒),中间用空格隔开,不存在的相位置 0。
String[] minGTime = phase.getMinGTime().split(" ");
//16 个相位的最大绿时间(单位秒),中间用空格隔开,不存在的相位置 0。
String[] maxGTime = phase.getMaxGTime().split(" ");
//封装环和环上相位数据 //封装环和环上相位数据
Map<Integer, List<RingPhaseDTO>> ringPhasesMap = getRingPhasesMap(ringCount, cycleJSONObject, redTime, greenTime, yellowTime, minGTime, maxGTime); Map<Integer, List<RingPhaseDTO>> ringPhasesMap = getRingPhasesMap(ringCount, cycleJSONObject, phase);
//16 个相位的放行方向,每个相位由 8 字节整型值存储(最多支持 7 个放行方向),每个字节表示一个放行方向, //16 个相位的放行方向,每个相位由 8 字节整型值存储(最多支持 7 个放行方向),每个字节表示一个放行方向,
String[] channelDim = phase.getChannelDim().split(" "); String[] channelDim = phase.getChannelDim().split(" ");
//数据处理 //数据处理
...@@ -186,7 +177,18 @@ public class StaticInfoServiceImpl implements StaticInfoService { ...@@ -186,7 +177,18 @@ public class StaticInfoServiceImpl implements StaticInfoService {
* @Param greenTime 绿 * @Param greenTime 绿
* @Param yellowTime 黄 * @Param yellowTime 黄
**/ **/
private Map<Integer, List<RingPhaseDTO>> getRingPhasesMap(int ringCount, JSONObject cycleJSONObject, String[] redTime, String[] greenTime, String[] yellowTime, String[] minGTime, String[] maxGTime) { public static Map<Integer, List<RingPhaseDTO>> getRingPhasesMap(int ringCount, JSONObject cycleJSONObject, CrossSchemeRings.Phase phaseDto) {
//16 个相位的红灯时间(单位秒),中间用空格隔开,不存在的相位置 0。
String[] redTime = phaseDto.getRedTime().split(" ");
//16 个相位的绿灯时间(单位秒),中间用空格隔开,不存在的相位置 0。
String[] greenTime = phaseDto.getGreenTime().split(" ");
//16 个相位的黄灯时间(单位秒),中间用空格隔开,不存在的相位置 0。
String[] yellowTime = phaseDto.getYellowTime().split(" ");
//16 个相位的最小绿时间(单位秒),中间用空格隔开,不存在的相位置 0。
String[] minGTime = phaseDto.getMinGTime().split(" ");
//16 个相位的最大绿时间(单位秒),中间用空格隔开,不存在的相位置 0。
String[] maxGTime = phaseDto.getMaxGTime().split(" ");
Map<Integer, List<RingPhaseDTO>> map = new HashMap<>(); Map<Integer, List<RingPhaseDTO>> map = new HashMap<>();
for (int i = 1; i <= ringCount; i++) { for (int i = 1; i <= ringCount; i++) {
//取出环中的数据,并去掉空格和_,得到相位 //取出环中的数据,并去掉空格和_,得到相位
...@@ -220,27 +222,6 @@ public class StaticInfoServiceImpl implements StaticInfoService { ...@@ -220,27 +222,6 @@ public class StaticInfoServiceImpl implements StaticInfoService {
ringPhase.setPhaseTime(red + green + yellow); ringPhase.setPhaseTime(red + green + yellow);
ringPhaseDTOS.add(ringPhase); ringPhaseDTOS.add(ringPhase);
} }
/*char[] charArray = ringPhases.toCharArray();
for (int i1 = 0; i1 < charArray.length; i1++) {
RingPhaseDTO ringPhase = new RingPhaseDTO();
int phaseId = Character.getNumericValue(charArray[i1]);
int red = Integer.valueOf(redTime[phaseId - 1]);
int green = Integer.valueOf(greenTime[phaseId - 1]);
int yellow = Integer.valueOf(yellowTime[phaseId - 1]);
int minG = Integer.valueOf(minGTime[phaseId - 1]);
int maxG = Integer.valueOf(maxGTime[phaseId - 1]);
ringPhase.setPhaseId(phaseId);
ringPhase.setPhaseStatus(0);
ringPhase.setRedTime(red);
ringPhase.setGreenTime(green);
ringPhase.setYellowTime(yellow);
ringPhase.setMaxGTime(maxG);
ringPhase.setMinGTime(minG);
ringPhase.setPhaseTime(red + green + yellow);
ringPhaseDTOS.add(ringPhase);
}*/
map.put(i, ringPhaseDTOS); map.put(i, ringPhaseDTOS);
} }
return map; return map;
...@@ -253,6 +234,20 @@ public class StaticInfoServiceImpl implements StaticInfoService { ...@@ -253,6 +234,20 @@ public class StaticInfoServiceImpl implements StaticInfoService {
* @Param phasesTime 各个相位的红绿黄时间和 * @Param phasesTime 各个相位的红绿黄时间和
**/ **/
private void getStagesByRings(Map<String, Integer> lightsMap, AtomicInteger lightNum, int cycle, int ringCount, String crossId, int schemeNo, Map<Integer, List<RingPhaseDTO>> ringPhasesMap, List<CrossLightsPO> crossLightsList, List<CrossPhasePO> crossPhaseList, List<CrossPhaseLightsPO> crossPhaseLightsPOList, String[] channelDim) { private void getStagesByRings(Map<String, Integer> lightsMap, AtomicInteger lightNum, int cycle, int ringCount, String crossId, int schemeNo, Map<Integer, List<RingPhaseDTO>> ringPhasesMap, List<CrossLightsPO> crossLightsList, List<CrossPhasePO> crossPhaseList, List<CrossPhaseLightsPO> crossPhaseLightsPOList, String[] channelDim) {
//环转阶段
List<StagePhaseDTO> stagePhaseList = stagePhaseList(cycle, ringCount, ringPhasesMap);
if (CollectionUtil.isNotEmpty(stagePhaseList)) {
//将结果组装到结果集
doView(lightsMap, lightNum, cycle, ringCount, crossId, schemeNo, stagePhaseList, crossLightsList, crossPhaseList, crossPhaseLightsPOList, channelDim);
}
}
/**
* @Description 环封装阶段
* @Param [cycle, ringCount, ringPhasesMap]
* @return java.util.List<net.wanji.utc.hisense.pojo.dto.StagePhaseDTO>
**/
public static List<StagePhaseDTO> stagePhaseList(int cycle, int ringCount,Map<Integer, List<RingPhaseDTO>> ringPhasesMap){
//已经计算的阶段时长 //已经计算的阶段时长
int stageTime = 0; int stageTime = 0;
//循环次数,也代表阶段号 //循环次数,也代表阶段号
...@@ -362,10 +357,7 @@ public class StaticInfoServiceImpl implements StaticInfoService { ...@@ -362,10 +357,7 @@ public class StaticInfoServiceImpl implements StaticInfoService {
stagePhaseList.add(stagePhase); stagePhaseList.add(stagePhase);
count++; count++;
} }
if (CollectionUtil.isNotEmpty(stagePhaseList)) { return stagePhaseList;
//将结果组装到结果集
doView(lightsMap, lightNum, cycle, ringCount, crossId, schemeNo, stagePhaseList, crossLightsList, crossPhaseList, crossPhaseLightsPOList, channelDim);
}
} }
/** /**
......
package net.wanji.utc.hisense.task; package net.wanji.utc.hisense.task;
import cn.hutool.core.util.ObjectUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.wanji.common.utils.tool.StringUtils; import net.wanji.common.utils.tool.StringUtils;
import net.wanji.databus.dao.entity.CrossLightsPO; import net.wanji.databus.dao.entity.CrossLightsPO;
...@@ -113,6 +114,7 @@ public class HisensePhaseCountDownTask { ...@@ -113,6 +114,7 @@ public class HisensePhaseCountDownTask {
if (StringUtils.equalsIgnoreCase(schemeId, String.valueOf(dirTurnPojo.getSchemeNo()))) { if (StringUtils.equalsIgnoreCase(schemeId, String.valueOf(dirTurnPojo.getSchemeNo()))) {
if (!StringUtils.equalsIgnoreCase(currenPhaseId, String.valueOf(dirTurnPojo.getPhaseNo()))) { if (!StringUtils.equalsIgnoreCase(currenPhaseId, String.valueOf(dirTurnPojo.getPhaseNo()))) {
Map<Integer, List<CrossLightsPO>> dirTurnMap = dirTurnPojo.getDirTurnMap(); Map<Integer, List<CrossLightsPO>> dirTurnMap = dirTurnPojo.getDirTurnMap();
if (ObjectUtil.isNotEmpty(dirTurnMap)) {
for (Map.Entry<Integer, List<CrossLightsPO>> dirEntry : dirTurnMap.entrySet()) { for (Map.Entry<Integer, List<CrossLightsPO>> dirEntry : dirTurnMap.entrySet()) {
Integer dir = dirEntry.getKey(); Integer dir = dirEntry.getKey();
Map<Integer, Integer> turnCountDown = new HashMap<>(); Map<Integer, Integer> turnCountDown = new HashMap<>();
...@@ -151,9 +153,12 @@ public class HisensePhaseCountDownTask { ...@@ -151,9 +153,12 @@ public class HisensePhaseCountDownTask {
} }
setPhaseMap(phaseMap, dir, turnCountDown); setPhaseMap(phaseMap, dir, turnCountDown);
} }
}
} else { } else {
Integer cyclePhaseCountDown = lightsStatusVO.getCyclePhaseCountDown(); Integer cyclePhaseCountDown = lightsStatusVO.getCyclePhaseCountDown();
Map<Integer, List<CrossLightsPO>> dirTurnMap = dirTurnPojo.getDirTurnMap(); Map<Integer, List<CrossLightsPO>> dirTurnMap = dirTurnPojo.getDirTurnMap();
if (ObjectUtil.isNotEmpty(dirTurnMap)) {
for (Map.Entry<Integer, List<CrossLightsPO>> dirEntry : dirTurnMap.entrySet()) { for (Map.Entry<Integer, List<CrossLightsPO>> dirEntry : dirTurnMap.entrySet()) {
Integer dir = dirEntry.getKey(); Integer dir = dirEntry.getKey();
Map<Integer, Integer> turnCountDown = new HashMap<>(); Map<Integer, Integer> turnCountDown = new HashMap<>();
...@@ -187,6 +192,8 @@ public class HisensePhaseCountDownTask { ...@@ -187,6 +192,8 @@ public class HisensePhaseCountDownTask {
setPhaseMap(phaseMap, dir, turnCountDown); setPhaseMap(phaseMap, dir, turnCountDown);
} }
} }
}
} }
} }
} }
...@@ -299,7 +306,7 @@ public class HisensePhaseCountDownTask { ...@@ -299,7 +306,7 @@ public class HisensePhaseCountDownTask {
if (!StringUtils.equalsIgnoreCase(currentPhaseNo, String.valueOf(phaseNo))) { if (!StringUtils.equalsIgnoreCase(currentPhaseNo, String.valueOf(phaseNo))) {
// 相位红灯 // 相位红灯
Map<Integer, List<CrossLightsPO>> dirTurnMap = phaseDirTurnPojo.getDirTurnMap(); Map<Integer, List<CrossLightsPO>> dirTurnMap = phaseDirTurnPojo.getDirTurnMap();
if (!dirTurnMap.isEmpty()) { if (ObjectUtil.isNotEmpty(dirTurnMap)) {
for (Map.Entry<Integer, List<CrossLightsPO>> entry : dirTurnMap.entrySet()) { for (Map.Entry<Integer, List<CrossLightsPO>> entry : dirTurnMap.entrySet()) {
String dir = String.valueOf(entry.getKey()); String dir = String.valueOf(entry.getKey());
Map<Integer, String> turnColor = null; Map<Integer, String> turnColor = null;
...@@ -344,8 +351,10 @@ public class HisensePhaseCountDownTask { ...@@ -344,8 +351,10 @@ public class HisensePhaseCountDownTask {
Integer yellowTime = phaseCountDownDTO.getYellowTime(); Integer yellowTime = phaseCountDownDTO.getYellowTime();
Integer redTime = phaseCountDownDTO.getRedTime(); Integer redTime = phaseCountDownDTO.getRedTime();
Map<Integer, List<CrossLightsPO>> dirTurnMap = phaseDirTurnPojo.getDirTurnMap(); Map<Integer, List<CrossLightsPO>> dirTurnMap = phaseDirTurnPojo.getDirTurnMap();
if (!dirTurnMap.isEmpty()) { if (ObjectUtil.isNotEmpty(dirTurnMap)) {
setDirTurnColor(cyclePhaseCountDown, dirLampGroupMap, yellowTime, redTime, dirTurnMap, crossLightsPOS); setDirTurnColor(cyclePhaseCountDown, dirLampGroupMap, yellowTime, redTime, dirTurnMap, crossLightsPOS);
} else {
log.error("路口:{},dirTurnMap为空,{}", crossId, dirTurnMap);
} }
} }
} }
......
...@@ -175,6 +175,7 @@ public class LocalDateTimeUtil { ...@@ -175,6 +175,7 @@ public class LocalDateTimeUtil {
LocalDateTime localDateTime = parseStringToDateTimeTwo(nowStageStartTime, LocalDateTimeUtil.TIMEFORMATTERTILT); LocalDateTime localDateTime = parseStringToDateTimeTwo(nowStageStartTime, LocalDateTimeUtil.TIMEFORMATTERTILT);
String time = nowStageStartTime.isEmpty() ? "0" : Long.toString(LocalDateTimeUtil.betweenTwoTime(localDateTime, LocalDateTime.now(), ChronoUnit.SECONDS)); String time = nowStageStartTime.isEmpty() ? "0" : Long.toString(LocalDateTimeUtil.betweenTwoTime(localDateTime, LocalDateTime.now(), ChronoUnit.SECONDS));
System.out.println(time); System.out.println(time);
System.out.println(new Date().getTime());
} }
/** /**
......
package net.wanji.databus.dao.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.sql.Date;
/**
* @ClassName CrossSchemeOptLog
* @Description 路口方案优化记录表
* @Author zhouleilei
* @Date 2024/11/23 14:23
*/
@Data
public class CrossSchemeOptLogPO {
@ApiModelProperty(value = "主键id")
private Integer id;
@ApiModelProperty(value = "")
private String crossId;
@ApiModelProperty(value = "")
private Integer schemeId;
@ApiModelProperty(value = "")
private Integer offset;
@ApiModelProperty(value = "")
private String phaseNo;
@ApiModelProperty(value = "")
private Integer oriPhaseTime;
@ApiModelProperty(value = "")
private Integer optPhaseTime;
@ApiModelProperty(value = "")
private Integer optTime;
@ApiModelProperty(value = "优化结果:1-成功 2-失败")
private String optResult;
@ApiModelProperty(value = "")
private Integer batchTime;
@ApiModelProperty(value = "")
private Date insertTime;
}
package net.wanji.databus.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.wanji.databus.dao.entity.CrossSchemeOptLogPO;
/**
* @ClassName CrossSchemeOptLogMapper
* @Description CrossSchemeOptLogMapper
* @Author zhouleilei
* @Date 2024/11/23 14:34
*/
public interface CrossSchemeOptLogMapper extends BaseMapper<CrossSchemeOptLogPO> {
}
...@@ -32,8 +32,7 @@ public class TempSchemeSendVO { ...@@ -32,8 +32,7 @@ public class TempSchemeSendVO {
@NotBlank(message = "offset不能为空") @NotBlank(message = "offset不能为空")
private String offset; private String offset;
@ApiModelProperty(value = "优化模式", notes = "目前支持 Type=1(预案模式,按时间调整),Type=15(瓶颈模式,\n" + @ApiModelProperty(value = "优化模式", notes = "目前支持 Type=1(预案模式,按时间调整),Type=1 时为协调模式,Type=15(瓶颈模式,按比例调整)")
"按比例调整)")
@NotBlank(message = "type不能为空") @NotBlank(message = "type不能为空")
private String type; private String type;
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.databus.dao.mapper.CrossSchemeOptLogMapper">
</mapper>
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