Commit db0f71e3 authored by zhouleilei's avatar zhouleilei

解决相位问题

parent 5e058812
......@@ -92,6 +92,9 @@ public class CrossRunSchemeCache implements CommandLineRunner {
for (CrossSchedulesPO schedulesPO : schedulesPOS) {
Integer isSpectialDay = schedulesPO.getWeek(); // 0 为特殊日期
Date specialDate = schedulesPO.getSpecialDate();
if (!Optional.ofNullable(specialDate).isPresent()){
continue;
}
String specialDate4DB = DateUtil.format(specialDate, Constants.DATE_FORMAT.E_DATE_FORMAT_SECOND);
String currentDateStr = DateUtil.format(currentDate, Constants.DATE_FORMAT.E_DATE_FORMAT_SECOND);
if (Objects.equals(0, isSpectialDay)) {
......
package net.wanji.utc.hisense.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.wanji.utc.hisense.pojo.view.VNtcipPatternView;
/**
* @ClassName VNtcipTimeBaseDayplanMapper
* @Description 方案视图 Mapper
* @Author zhouleilei
* @Date 2024/11/16 15:12
*/
@DS("oracle")
public interface VNtcipPatternMapper extends BaseMapper<VNtcipPatternView> {
}
package net.wanji.utc.hisense.pojo.view;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* @author zhouleilei
* @date 2024/11/16 15:05
* @descrioption 海信方案视图实体
*/
@Data
@TableName("hicon.V_NTCIPPATTERN")
public class VNtcipPatternView {
//所属路口编号
@TableField("CINTSID")
private String cIntsID;
//方案号
@TableField("NPATTERNNUMBER")
private Integer nPatternNumber;
//周期长
@TableField("NPATTERNCYCLETIME")
private Integer nPatternCycleTime;
//相位差
@TableField("NPATTERNOFFSETTIME")
private Integer nPatternOffsetTime;
//绿信比表号
@TableField("NPATTERNSPLITNUMBER")
private Integer nPatternSplitNumber;
//sequence 表号
@TableField("NPATTERNSEQUENCENUMBER")
private Integer nPatternSequenceNumb;
//策略号
@TableField("NSTRATEGYNO")
private Integer nStrategyNo;
}
......@@ -69,6 +69,8 @@ public class StaticInfoServiceImpl implements StaticInfoService {
private VNtcipTimeBaseAscActionMapper vNtcipTimeBaseAscActionMapper;
@Resource
private VNtcipChannelViewMapper vNtcipChannelViewMapper;
@Resource
private VNtcipPatternMapper vNtcipPatternMapper;
@Override
public List<CrossInfoPO> crossBasicInfo(CrossInfoDTO crossInfoDTO) throws Exception {
......@@ -106,6 +108,11 @@ public class StaticInfoServiceImpl implements StaticInfoService {
List<CrossPhasePO> crossPhaseList = new ArrayList<>();
List<CrossPhaseLightsPO> crossPhaseLightsPOList = new ArrayList<>();
List<CrossSchemePO> crossSchemeList = new ArrayList<>();
//查询该路口的所有方案
//TODO
// LambdaQueryWrapper<VIntersectionView> queryWrapper = new LambdaQueryWrapper<>();
// List<VIntersectionView> vIntersectionEntities = vIntersectionMapper.selectList(queryWrapper);
// vNtcipPatternMapper.selectList(null);
//查询当前运行的方案
CoordinationStatus coordinationStatus = crossPlan(crossId);
if (Optional.ofNullable(coordinationStatus).isPresent()) {
......@@ -184,10 +191,39 @@ public class StaticInfoServiceImpl implements StaticInfoService {
Map<Integer, List<RingPhaseDTO>> map = new HashMap<>();
for (int i = 1; i <= ringCount; i++) {
//取出环中的数据,并去掉空格和_,得到相位
String ringPhases = cycleJSONObject.getString("Cycle" + i)
.replaceAll(" ", "").replaceAll("_", "");
String ringPhases = cycleJSONObject.getString("Cycle" + i);
List<Integer> phaseIdList = new ArrayList<>();
String[] split = ringPhases.split(" ");
for (int i1 = 0; i1 < split.length; i1++) {
String phase = split[i1];
String[] split1 = phase.split("_");
for (String s : split1) {
phaseIdList.add(Integer.parseInt(s));
}
}
List<RingPhaseDTO> ringPhaseDTOS = new ArrayList<>();
char[] charArray = ringPhases.toCharArray();
for (Integer phaseId : phaseIdList) {
RingPhaseDTO ringPhase = new RingPhaseDTO();
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);
}
/*char[] charArray = ringPhases.toCharArray();
for (int i1 = 0; i1 < charArray.length; i1++) {
RingPhaseDTO ringPhase = new RingPhaseDTO();
int phaseId = Character.getNumericValue(charArray[i1]);
......@@ -205,7 +241,7 @@ public class StaticInfoServiceImpl implements StaticInfoService {
ringPhase.setMinGTime(minG);
ringPhase.setPhaseTime(red + green + yellow);
ringPhaseDTOS.add(ringPhase);
}
}*/
map.put(i, ringPhaseDTOS);
}
return map;
......
<?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.utc.hisense.mapper.VNtcipPatternMapper">
</mapper>
\ No newline at end of file
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