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 {
public void sendManual(SendManualDTO sendManualDTO) throws Exception {
// 构造场景、策略、方法
String optDataExtend = buildOptDataExtend(sendManualDTO);
SchemeOptSendVO schemeOptSendVO = new SchemeOptSendVO();
schemeOptSendVO.setDataExtend(optDataExtend);
Integer optTypeInt = sendManualDTO.getOptType();
......
package net.wanji.utc.hisense.service.impl;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.utils.tool.StringUtils;
import net.wanji.databus.dao.mapper.CrossInfoMapper;
import net.wanji.databus.dto.CrossSchemeRingsDTO;
import net.wanji.databus.dto.ExtendPhaseDTO;
import net.wanji.databus.dto.StepingPhaseDTO;
import net.wanji.databus.po.CrossInfoPOExt;
import net.wanji.databus.vo.TempSchemeSendVO;
import net.wanji.databus.dao.mapper.CrossInfoMapper;
import net.wanji.databus.vo.*;
import net.wanji.utc.hisense.common.OperationBaseDom;
import net.wanji.utc.hisense.common.constants.HttpConstants;
import net.wanji.utc.hisense.pojo.dto.RingPhaseDTO;
import net.wanji.utc.hisense.pojo.dto.StagePhaseDTO;
import net.wanji.utc.hisense.pojo.result.CrossSchemeRings;
import net.wanji.utc.hisense.service.ControlCommandService;
import net.wanji.utc.hisense.service.StaticInfoService;
import net.wanji.utc.hisense.util.OkHttpClientUtil;
import org.apache.commons.lang3.ObjectUtils;
import org.dom4j.Document;
......@@ -23,6 +28,9 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/**
* @author duanruiming
......@@ -36,6 +44,8 @@ public class ControlCommandServiceImpl implements ControlCommandService {
private String hisenseUrl;
@Resource
private CrossInfoMapper crossInfoMapper;
@Resource
private StaticInfoService staticInfoService;
@Override
public JsonViewObject schemeSend(SchemeSendVO schemeSendVO) throws Exception {
......@@ -295,16 +305,6 @@ public class ControlCommandServiceImpl implements ControlCommandService {
messageContent.addElement(HttpConstants.SPOT).setText(crossInfoPOExt.getCode());
messageContent.addElement(HttpConstants.PATTERN).setText(tempSchemeSendVO.getPattern());
messageContent.addElement(HttpConstants.CYCLE).setText(tempSchemeSendVO.getCycle());
//如果为空赋值神思的默认值
if (ObjectUtils.isEmpty(tempSchemeSendVO.getOffset())) {
tempSchemeSendVO.setOffset("0");
}
if (ObjectUtils.isEmpty(tempSchemeSendVO.getType())) {
tempSchemeSendVO.setType("1");
}
if (ObjectUtils.isEmpty(tempSchemeSendVO.getSplit())) {
tempSchemeSendVO.setSplit("40,0,0,40,50,50,0,0,0,0,0,0,0,0,0,0");
}
messageContent.addElement(HttpConstants.OFFSET).setText(tempSchemeSendVO.getOffset());
messageContent.addElement(HttpConstants.TYPE).setText(tempSchemeSendVO.getType());
messageContent.addElement(HttpConstants.SPLIT).setText(tempSchemeSendVO.getSplit());
......@@ -349,9 +349,60 @@ public class ControlCommandServiceImpl implements ControlCommandService {
//指令执行失败
jsonViewObject.fail("临时方案 - 指令执行失败");
}
Integer code = jsonViewObject.getCode();
int optResult = 1;
if (code != 200) {
optResult = 2;
}
CrossSchemeRingsDTO crossSchemeRingsDTO = new CrossSchemeRingsDTO();
crossSchemeRingsDTO.setCrossId(tempSchemeSendVO.getCrossId());
crossSchemeRingsDTO.setPattern(tempSchemeSendVO.getPattern());
//方案优化记录
crossSchemeOptLog(crossSchemeRingsDTO, tempSchemeSendVO.getSplit(), optResult);
return jsonViewObject;
}
/**
* @return void
* @Description 方案优化记录
* @Param tempSchemeSendVO 环图查询参数
* @Param split 优化的绿信比
* @Param result 下发结果
**/
private void crossSchemeOptLog(CrossSchemeRingsDTO crossSchemeRingsDTO, String split, int result) throws Exception {
//TODO
//方案环图请求
CrossSchemeRings crossSchemeRings = staticInfoService.crossSchemeRings(crossSchemeRingsDTO);
if (Optional.ofNullable(crossSchemeRings).isPresent()) {
//环数
int ringCount = Integer.parseInt(crossSchemeRings.getRingCount());
//周期长度
String cycleLen = crossSchemeRings.getCycleLen();
JSONObject cycleJSONObject = crossSchemeRings.getCycleList();
//相位差
String offset = crossSchemeRings.getOffset();
int cycle = Integer.valueOf(cycleLen);
//方案号
int schemeNo = (Integer.valueOf(crossSchemeRings.getPattern()) + 2) / 3;
List<CrossSchemeRings.Phase> phaseList = crossSchemeRings.getPhaseList();
CrossSchemeRings.Phase phase = phaseList.get(0);
//封装环和环上相位数据
Map<Integer, List<RingPhaseDTO>> ringPhasesMap = StaticInfoServiceImpl.getRingPhasesMap(ringCount, cycleJSONObject, phase);
//环封装阶段
List<StagePhaseDTO> stagePhaseDTOList = StaticInfoServiceImpl.stagePhaseList(cycle, ringCount, ringPhasesMap);
System.out.println(stagePhaseDTOList);
}
}
public static void main(String[] args) {
}
@Override
public JsonViewObject extendPhase(ExtendPhaseDTO extendPhaseDTO) throws Exception {
CrossInfoPOExt crossInfoPOExt = crossInfoMapper.selectById(extendPhaseDTO.getCrossId());
......@@ -361,13 +412,13 @@ public class ControlCommandServiceImpl implements ControlCommandService {
element.addElement(HttpConstants.MESSAGETYPE).setText(HttpConstants.MESSAGETYPE_22);
Element messageContent = (Element) document.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_MESSAGECONTENT);
messageContent.addElement(HttpConstants.SPOT).setText(crossInfoPOExt.getCode());
//暂时按照神思的写死
//相位驻留
messageContent.addElement(HttpConstants.COMMAND).setText("1");
messageContent.addElement(HttpConstants.CTRLSTEP).setText("0");
//给海信发送http请求
// String post = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
String post = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
String post = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
/*String post = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<systemScription System=\"TCIP\" Version=\"1.0\">\n" +
" <subSystem>Hisense</subSystem>\n" +
" <messageType>12</messageType>\n" +
......@@ -383,7 +434,7 @@ public class ControlCommandServiceImpl implements ControlCommandService {
" <CoordCycleStatus>160</CoordCycleStatus>\n" +
" <CoordSyncStatus>123</CoordSyncStatus>\n" +
" </messageContent>\n" +
"</systemScription>";
"</systemScription>";*/
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
if (StringUtils.isBlank(post)) {
log.error("HTTP请求 5.12. 步进及取消控制 失败");
......@@ -391,14 +442,15 @@ public class ControlCommandServiceImpl implements ControlCommandService {
}
Document postResult = DocumentHelper.parseText(post);
String result = postResult.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_RESULT).getText();
//解除步进
messageContent.selectSingleNode(HttpConstants.COMMAND).setText("0");
if (HttpConstants.RESULT_1.equals(result) || HttpConstants.RESULT_2.equals(result)) {
//执行成功,开始延长
Thread.sleep(extendPhaseDTO.getExtendTime() * 1000);
//延长结束,解除步进
messageContent.selectSingleNode(HttpConstants.COMMAND).setText("0");
//给海信发送http请求
// String post1 = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
String post1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
String post1 = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
/*String post1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<systemScription System=\"TCIP\" Version=\"1.0\">\n" +
" <subSystem>Hisense</subSystem>\n" +
" <messageType>12</messageType>\n" +
......@@ -414,7 +466,7 @@ public class ControlCommandServiceImpl implements ControlCommandService {
" <CoordCycleStatus>160</CoordCycleStatus>\n" +
" <CoordSyncStatus>123</CoordSyncStatus>\n" +
" </messageContent>\n" +
"</systemScription>";
"</systemScription>";*/
if (StringUtils.isNotBlank(post1)) {
Document extendPost = DocumentHelper.parseText(post1);
String extendResult = extendPost.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_RESULT).getText();
......@@ -426,8 +478,8 @@ public class ControlCommandServiceImpl implements ControlCommandService {
log.error("HTTP请求 5.12. 步进及取消控制 失败");
//重新发起三次取消控制请求
for (int j = 0; j < 3; j++) {
// String httpPost = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
String httpPost = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
String httpPost = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
/*String httpPost = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<systemScription System=\"TCIP\" Version=\"1.0\">\n" +
" <subSystem>Hisense</subSystem>\n" +
" <messageType>12</messageType>\n" +
......@@ -443,7 +495,7 @@ public class ControlCommandServiceImpl implements ControlCommandService {
" <CoordCycleStatus>160</CoordCycleStatus>\n" +
" <CoordSyncStatus>123</CoordSyncStatus>\n" +
" </messageContent>\n" +
"</systemScription>";
"</systemScription>";*/
if (StringUtils.isNotBlank(httpPost)) {
Document extendPost = DocumentHelper.parseText(httpPost);
String extendResult = extendPost.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_RESULT).getText();
......@@ -455,6 +507,7 @@ public class ControlCommandServiceImpl implements ControlCommandService {
}
} else {
messageContent.selectSingleNode(HttpConstants.COMMAND).setText("0");
//重新发起三次取消控制请求
for (int j = 0; j < 3; j++) {
String httpPost = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
......@@ -490,9 +543,9 @@ public class ControlCommandServiceImpl implements ControlCommandService {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
if (stepingPhaseDTO.getCommand() == 0) {
//取消步进
// boolean isOk = sendMesIsOk(document.asXML());
boolean isOk = true;
if (true) {
boolean isOk = sendMesIsOk(document.asXML());
// boolean isOk = true;
if (isOk) {
return jsonViewObject.success("取消步进 - 控制成功");
} else {
return jsonViewObject.fail("取消步进 - 控制失败");
......@@ -500,8 +553,8 @@ public class ControlCommandServiceImpl implements ControlCommandService {
} else if (stepingPhaseDTO.getCommand() == 1) {
//逻辑:第一次发送步进指令是相位驻留,以后发送才是相位步进,步进成功则取消步进。步进失败,也立即下发取消步进控制
//相位驻留
// String xmlPost = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
String xmlPost = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
String xmlPost = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
/* String xmlPost = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<systemScription System=\"TCIP\" Version=\"1.0\">\n" +
" <subSystem>Hisense</subSystem>\n" +
" <messageType>12</messageType>\n" +
......@@ -517,7 +570,7 @@ public class ControlCommandServiceImpl implements ControlCommandService {
" <CoordCycleStatus>160</CoordCycleStatus>\n" +
" <CoordSyncStatus>123</CoordSyncStatus>\n" +
" </messageContent>\n" +
"</systemScription>";
"</systemScription>";*/
if (StringUtils.isNotBlank(xmlPost)) {
Document extendPost = DocumentHelper.parseText(xmlPost);
......@@ -526,8 +579,8 @@ public class ControlCommandServiceImpl implements ControlCommandService {
//开始步进
//给海信发送http请求
for (int i = 0; i < stepingPhaseDTO.getStepCount(); i++) {
// String post = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
String post = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
String post = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
/*String post = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<systemScription System=\"TCIP\" Version=\"1.0\">\n" +
" <subSystem>Hisense</subSystem>\n" +
" <messageType>12</messageType>\n" +
......@@ -543,7 +596,7 @@ public class ControlCommandServiceImpl implements ControlCommandService {
" <CoordCycleStatus>160</CoordCycleStatus>\n" +
" <CoordSyncStatus>123</CoordSyncStatus>\n" +
" </messageContent>\n" +
"</systemScription>";
"</systemScription>";*/
if (StringUtils.isNotBlank(post)) {
Document postResult = DocumentHelper.parseText(post);
String result = postResult.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_RESULT).getText();
......@@ -553,8 +606,8 @@ public class ControlCommandServiceImpl implements ControlCommandService {
log.error("路口号 :{},第 {} 次步进失败,result:{}", stepingPhaseDTO.getCrossId(), i + 1, result);
messageContent.selectSingleNode(HttpConstants.COMMAND).setText("0");
//取消步进
// boolean isOk = sendMesIsOk(document.asXML());
boolean isOk = true;
boolean isOk = sendMesIsOk(document.asXML());
// boolean isOk = true;
if (isOk) {
return jsonViewObject.fail("相位步进失败,取消步进成功,路口号: " + stepingPhaseDTO.getCrossId());
} else {
......@@ -566,8 +619,8 @@ public class ControlCommandServiceImpl implements ControlCommandService {
} else {
messageContent.selectSingleNode(HttpConstants.COMMAND).setText("0");
//取消步进
// boolean isOk = sendMesIsOk(document.asXML());
boolean isOk = true;
boolean isOk = sendMesIsOk(document.asXML());
// boolean isOk = true;
if (isOk) {
return jsonViewObject.fail("相位步进失败,取消步进成功,路口号: " + stepingPhaseDTO.getCrossId());
} else {
......@@ -578,8 +631,8 @@ public class ControlCommandServiceImpl implements ControlCommandService {
}
messageContent.selectSingleNode(HttpConstants.COMMAND).setText("0");
//取消步进
// boolean isOk = sendMesIsOk(document.asXML());
boolean isOk = true;
boolean isOk = sendMesIsOk(document.asXML());
// boolean isOk = true;
if (isOk) {
return jsonViewObject.success("相位步进成功,,路口号: " + stepingPhaseDTO.getCrossId());
} else {
......
......@@ -152,18 +152,9 @@ public class StaticInfoServiceImpl implements StaticInfoService {
List<CrossSchemeRings.Phase> phaseList = crossSchemeRings.getPhaseList();
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 个放行方向),每个字节表示一个放行方向,
String[] channelDim = phase.getChannelDim().split(" ");
//数据处理
......@@ -186,7 +177,18 @@ public class StaticInfoServiceImpl implements StaticInfoService {
* @Param greenTime 绿
* @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<>();
for (int i = 1; i <= ringCount; i++) {
//取出环中的数据,并去掉空格和_,得到相位
......@@ -220,27 +222,6 @@ public class StaticInfoServiceImpl implements StaticInfoService {
ringPhase.setPhaseTime(red + green + yellow);
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);
}
return map;
......@@ -253,6 +234,20 @@ public class StaticInfoServiceImpl implements StaticInfoService {
* @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) {
//环转阶段
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;
//循环次数,也代表阶段号
......@@ -362,10 +357,7 @@ public class StaticInfoServiceImpl implements StaticInfoService {
stagePhaseList.add(stagePhase);
count++;
}
if (CollectionUtil.isNotEmpty(stagePhaseList)) {
//将结果组装到结果集
doView(lightsMap, lightNum, cycle, ringCount, crossId, schemeNo, stagePhaseList, crossLightsList, crossPhaseList, crossPhaseLightsPOList, channelDim);
}
return stagePhaseList;
}
/**
......
package net.wanji.utc.hisense.task;
import cn.hutool.core.util.ObjectUtil;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.utils.tool.StringUtils;
import net.wanji.databus.dao.entity.CrossLightsPO;
......@@ -113,6 +114,7 @@ public class HisensePhaseCountDownTask {
if (StringUtils.equalsIgnoreCase(schemeId, String.valueOf(dirTurnPojo.getSchemeNo()))) {
if (!StringUtils.equalsIgnoreCase(currenPhaseId, String.valueOf(dirTurnPojo.getPhaseNo()))) {
Map<Integer, List<CrossLightsPO>> dirTurnMap = dirTurnPojo.getDirTurnMap();
if (ObjectUtil.isNotEmpty(dirTurnMap)) {
for (Map.Entry<Integer, List<CrossLightsPO>> dirEntry : dirTurnMap.entrySet()) {
Integer dir = dirEntry.getKey();
Map<Integer, Integer> turnCountDown = new HashMap<>();
......@@ -151,9 +153,12 @@ public class HisensePhaseCountDownTask {
}
setPhaseMap(phaseMap, dir, turnCountDown);
}
}
} else {
Integer cyclePhaseCountDown = lightsStatusVO.getCyclePhaseCountDown();
Map<Integer, List<CrossLightsPO>> dirTurnMap = dirTurnPojo.getDirTurnMap();
if (ObjectUtil.isNotEmpty(dirTurnMap)) {
for (Map.Entry<Integer, List<CrossLightsPO>> dirEntry : dirTurnMap.entrySet()) {
Integer dir = dirEntry.getKey();
Map<Integer, Integer> turnCountDown = new HashMap<>();
......@@ -187,6 +192,8 @@ public class HisensePhaseCountDownTask {
setPhaseMap(phaseMap, dir, turnCountDown);
}
}
}
}
}
}
......@@ -299,7 +306,7 @@ public class HisensePhaseCountDownTask {
if (!StringUtils.equalsIgnoreCase(currentPhaseNo, String.valueOf(phaseNo))) {
// 相位红灯
Map<Integer, List<CrossLightsPO>> dirTurnMap = phaseDirTurnPojo.getDirTurnMap();
if (!dirTurnMap.isEmpty()) {
if (ObjectUtil.isNotEmpty(dirTurnMap)) {
for (Map.Entry<Integer, List<CrossLightsPO>> entry : dirTurnMap.entrySet()) {
String dir = String.valueOf(entry.getKey());
Map<Integer, String> turnColor = null;
......@@ -344,8 +351,10 @@ public class HisensePhaseCountDownTask {
Integer yellowTime = phaseCountDownDTO.getYellowTime();
Integer redTime = phaseCountDownDTO.getRedTime();
Map<Integer, List<CrossLightsPO>> dirTurnMap = phaseDirTurnPojo.getDirTurnMap();
if (!dirTurnMap.isEmpty()) {
if (ObjectUtil.isNotEmpty(dirTurnMap)) {
setDirTurnColor(cyclePhaseCountDown, dirLampGroupMap, yellowTime, redTime, dirTurnMap, crossLightsPOS);
} else {
log.error("路口:{},dirTurnMap为空,{}", crossId, dirTurnMap);
}
}
}
......
......@@ -175,6 +175,7 @@ public class LocalDateTimeUtil {
LocalDateTime localDateTime = parseStringToDateTimeTwo(nowStageStartTime, LocalDateTimeUtil.TIMEFORMATTERTILT);
String time = nowStageStartTime.isEmpty() ? "0" : Long.toString(LocalDateTimeUtil.betweenTwoTime(localDateTime, LocalDateTime.now(), ChronoUnit.SECONDS));
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 {
@NotBlank(message = "offset不能为空")
private String offset;
@ApiModelProperty(value = "优化模式", notes = "目前支持 Type=1(预案模式,按时间调整),Type=15(瓶颈模式,\n" +
"按比例调整)")
@ApiModelProperty(value = "优化模式", notes = "目前支持 Type=1(预案模式,按时间调整),Type=1 时为协调模式,Type=15(瓶颈模式,按比例调整)")
@NotBlank(message = "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