Commit ce43e4d4 authored by zhouleilei's avatar zhouleilei

计划数据-计划信息、时段信息 静态数据查询

parent d7b97761
......@@ -5,7 +5,6 @@ import net.wanji.databus.bo.CrossIdBO;
import net.wanji.databus.dto.*;
import net.wanji.databus.po.SaveToUtcPO;
import net.wanji.databus.vo.*;
import net.wanji.opt.vo.SchemeOptSendVO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
......
......@@ -2,7 +2,9 @@ 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.VNtcipTimeBaseDayplanDTO;
import net.wanji.utc.hisense.pojo.view.VNtcipTimeBaseDayplanView;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -21,5 +23,5 @@ public interface VNtcipTimeBaseDayplanMapper extends BaseMapper<VNtcipTimeBaseD
* @param dayPlanId 计划ID
* @return 时段信息
*/
List<VNtcipTimeBaseDayplanView> listByCrossIdAndDayPlanId(String crossId, Integer dayPlanId);
List<VNtcipTimeBaseDayplanDTO> listByCrossIdAndDayPlanId(@Param("crossId") String crossId, @Param("dayPlanId")Integer dayPlanId);
}
package net.wanji.utc.hisense.pojo.view;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
/**
* @ClassName VNtcipTimeBaseDayplan
* @Description 时段-时基动作结果集
* @Author zhouleilei
* @Date 2024/11/11 19:57
*/
@Data
public class VNtcipTimeBaseDayplanDTO {
/** 所属路口编号 NC(6) Y */
@TableField("CINTSID")
private String cIntsID;
/** 时段表号 INT Y (1..16)Y */
@TableField("NDAYPLANNUMBER")
private Integer nDayPlanNumber;
/** 时段序号 INT (1..48) */
@TableField("NDAYPLANEVENTNUMBER")
private Integer nDayPlanEventNumber;
/** 执行时刻的整点数 INT 24 时制 */
@TableField("NDAYPLANHOUR")
private Integer nDayPlanHour;
/** 执行时刻的整分数 INT */
@TableField("NDAYPLANMINUTE")
private Integer nDayPlanMinute;
/** 动作号 INT */
@TableField("NDAYPLANACTIONNUMBEROID")
private Integer nDayPlanActionNumberOID;
/** 策略号 INT 该时段所用方案的所属策略, 默认 0 */
@TableField("NSTRATEGYNO")
private Integer nStrategyNo;
/** 方案号 设置为 0 表明没有方案被选择 */
@TableField("NTIMEBASEASCPATTERN")
private Integer nTimebaseAscPattern;
/** 感应控制辅助功能选择 */
@TableField("NTIMEBASEASCAUXILLARYFUNCTION")
private Integer nTimebaseAscAuxillaryFunction;
/** 特殊功能 */
@TableField("NTIMEBASEASCSPECIALFUNCTION")
private Integer nTimebaseAscSpecialFunction;
}
......@@ -7,7 +7,9 @@ import lombok.extern.slf4j.Slf4j;
import net.wanji.common.utils.tool.ScheduleUtil;
import net.wanji.common.utils.tool.StringUtils;
import net.wanji.databus.dao.entity.CrossLightsPO;
import net.wanji.databus.dao.entity.CrossPlanPO;
import net.wanji.databus.dao.entity.CrossSchedulesPO;
import net.wanji.databus.dao.entity.CrossSectionPO;
import net.wanji.databus.dao.mapper.CrossInfoMapper;
import net.wanji.databus.dao.mapper.ManufacturerInfoMapper;
import net.wanji.databus.dto.*;
......@@ -23,7 +25,7 @@ import net.wanji.utc.hisense.pojo.result.CoordinationStatus;
import net.wanji.utc.hisense.pojo.result.CrossSchemeRings;
import net.wanji.utc.hisense.pojo.view.VIntersectionView;
import net.wanji.utc.hisense.pojo.view.VNtcipChannelPhaseDTO;
import net.wanji.utc.hisense.pojo.view.VNtcipTimeBaseDayplanView;
import net.wanji.utc.hisense.pojo.view.VNtcipTimeBaseDayplanDTO;
import net.wanji.utc.hisense.pojo.view.VNtcipTimeBaseScheduleView;
import net.wanji.utc.hisense.service.StaticInfoService;
import net.wanji.utc.hisense.util.OkHttpClientUtil;
......@@ -36,10 +38,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -110,17 +109,73 @@ public class StaticInfoServiceImpl implements StaticInfoService {
@Override
public List<PlanSectionVO> planSection(PlanSectionDTO planSectionDTO) throws Exception {
LambdaQueryWrapper<VNtcipTimeBaseDayplanView> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(VNtcipTimeBaseDayplanView::getCIntsID, planSectionDTO.getCrossId());
//planNo = -1 时查询所有计划
if (planSectionDTO.getPlanNo() != -1) {
queryWrapper.eq(VNtcipTimeBaseDayplanView::getCIntsID, planSectionDTO.getCrossId());
}
String crossId = planSectionDTO.getCrossId();
//从缓存中拿路口信息
CrossInfoPO crossInfoPO = CrossInfoCache.getCrossInfoCache().get(crossId);
if (Optional.ofNullable(planSectionDTO).isPresent()){
String code = crossInfoPO.getCode();
List<VNtcipTimeBaseDayplanDTO> vNtcipTimeBaseDayplanDTOS = vNtcipTimeBaseDayplanMapper.listByCrossIdAndDayPlanId(code, planSectionDTO.getPlanNo());
if (!CollectionUtils.isEmpty(vNtcipTimeBaseDayplanDTOS)){
List<PlanSectionVO> list = new ArrayList<>();
//根据时段表号分组
Map<Integer, List<VNtcipTimeBaseDayplanDTO>> collect = vNtcipTimeBaseDayplanDTOS.stream().collect(Collectors.groupingBy(VNtcipTimeBaseDayplanDTO::getNDayPlanNumber));
Set<Integer> keySet = collect.keySet();
for (Integer i : keySet) {
PlanSectionVO planSectionVO = new PlanSectionVO();
List<CrossPlanPO> crossPlanPOList = new ArrayList<>();
List<CrossSectionPO> crossSectionPOList = new ArrayList<>();
//时段数据
List<VNtcipTimeBaseDayplanDTO> dayplanDTOS = collect.get(i);
for (int i1 = 0; i1 < dayplanDTOS.size(); i1++) {
VNtcipTimeBaseDayplanDTO dayplanDTO = dayplanDTOS.get(i1);
CrossPlanPO crossPlan = new CrossPlanPO();
CrossSectionPO crossSectionPO = new CrossSectionPO();
crossPlan.setCrossId(crossId);
//计划号-取的是时段表号
crossPlan.setPlanNo(dayplanDTO.getNDayPlanNumber()+"");
crossPlan.setName("海信信号机-时段表号:"+dayplanDTO.getNDayPlanNumber());
List<VNtcipTimeBaseDayplanView> vNtcipTimeBaseDayplanViews = vNtcipTimeBaseDayplanMapper.selectList(queryWrapper);
crossSectionPO.setCrossId(crossId);
//时段号 - 取的是时段序号
crossSectionPO.setSectionNo(dayplanDTO.getNDayPlanEventNumber()+"");
//TODO 开始时间 - 拼接小时和分钟
crossSectionPO.setStartTime(dayplanDTO.getNDayPlanHour()+":"+dayplanDTO.getNDayPlanMinute());
if (i1 == dayplanDTOS.size()-1){
crossSectionPO.setEndTime("23:59");
}else {
VNtcipTimeBaseDayplanDTO dto = dayplanDTOS.get(i1 + 1);
crossSectionPO.setEndTime(dto.getNDayPlanHour()+":"+dto.getNDayPlanMinute());
}
// 计划ID - 取的是时段表号
crossSectionPO.setPlanId(dayplanDTO.getNDayPlanNumber());
//方案号
Integer pattern = dayplanDTO.getNTimebaseAscPattern();
if (pattern == 85){
//黃闪
crossSectionPO.setControlMode(3);
}else {
//定周期
crossSectionPO.setControlMode(1);
}
//方案ID
crossSectionPO.setSchemeId(pattern);
//创建时间
crossSectionPO.setGmtCreate(null);
//创建时间
crossSectionPO.setGmtModified(null);
crossPlanPOList.add(crossPlan);
crossSectionPOList.add(crossSectionPO);
}
planSectionVO.setCrossPlanPOList(crossPlanPOList);
planSectionVO.setCrossSectionPOList(crossSectionPOList);
list.add(planSectionVO);
}
return list;
}
}
return null;
}
......
......@@ -2,5 +2,48 @@
<!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.VNtcipTimeBaseDayplanMapper">
<resultMap type="net.wanji.utc.hisense.pojo.view.VNtcipTimeBaseDayplanDTO" id="BaseResultMap">
<result property="cIntsID" column="CINTSID"/>
<result property="nDayPlanNumber" column="NDAYPLANNUMBER"/>
<result property="nDayPlanEventNumber" column="NDAYPLANEVENTNUMBER"/>
<result property="nDayPlanHour" column="NDAYPLANHOUR"/>
<result property="nDayPlanMinute" column="NDAYPLANMINUTE"/>
<result property="nDayPlanActionNumberOID" column="NDAYPLANACTIONNUMBEROID"/>
<result property="nStrategyNo" column="NSTRATEGYNO"/>
<result property="nTimebaseAscPattern" column="NTIMEBASEASCPATTERN"/>
<result property="nTimebaseAscAuxillaryFunction" column="NTIMEBASEASCAUXILLARYFUNCTION"/>
<result property="nTimebaseAscSpecialFunction" column="NTIMEBASEASCSPECIALFUNCTION"/>
</resultMap>
<select id="listByCrossIdAndDayPlanId"
resultMap="BaseResultMap"
resultType="net.wanji.utc.hisense.pojo.view.VNtcipTimeBaseDayplanDTO">
SELECT
plan.NDAYPLANNUMBER ,
plan.NDAYPLANEVENTNUMBER ,
plan.NDAYPLANHOUR ,
plan.NDAYPLANMINUTE ,
plan.NDAYPLANACTIONNUMBEROID,
(action.NTIMEBASEASCPATTERN +2)/3 AS nTimebaseAscPattern,
plan.NSTRATEGYNO,
action.NTIMEBASEASCAUXILLARYFUNCTION,
action.NTIMEBASEASCSPECIALFUNCTION
FROM
hicon.V_NTCIPTIMEBASEDAYPLAN plan
LEFT JOIN hicon.V_NTCIPTIMEBASEASCACTION action ON plan.CINTSID = action.CINTSID
AND action.NTIMEBASEASCACTIONNUMBER = plan.NDAYPLANACTIONNUMBEROID
WHERE
plan.NDAYPLANACTIONNUMBEROID != 0
<if test="crossId != null">
AND plan.CINTSID = #{crossId}
</if>
<if test="dayPlanId != null and dayPlanId != -1">
AND plan.NDAYPLANNUMBER = #{dayPlanId}
</if>
ORDER BY
plan.NDAYPLANNUMBER
</select>
</mapper>
\ No newline at end of file
......@@ -13,7 +13,6 @@ import net.wanji.databus.dto.ExtendPhaseDTO;
import net.wanji.databus.dto.StepingPhaseDTO;
import net.wanji.databus.po.SaveToUtcPO;
import net.wanji.databus.vo.*;
import net.wanji.opt.vo.SchemeOptSendVO;
import net.wanji.utc.service.control.ControlCommandStrategyService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.validation.annotation.Validated;
......
......@@ -4,7 +4,6 @@ import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.dto.ExtendPhaseDTO;
import net.wanji.databus.dto.StepingPhaseDTO;
import net.wanji.databus.vo.*;
import net.wanji.opt.vo.SchemeOptSendVO;
import net.wanji.utc.po.hk.request.DelBaseConfigPO;
import java.util.Date;
......
......@@ -5,8 +5,6 @@ import net.wanji.databus.dto.ExtendPhaseDTO;
import net.wanji.databus.dto.StepingPhaseDTO;
import net.wanji.databus.po.SaveToUtcPO;
import net.wanji.databus.vo.*;
import net.wanji.opt.vo.SchemeOptSendVO;
import java.util.Date;
/**
......
......@@ -11,7 +11,6 @@ import net.wanji.databus.po.BaseCrossLightsPO;
import net.wanji.databus.po.CrossInfoPO;
import net.wanji.databus.po.SaveToUtcPO;
import net.wanji.databus.vo.*;
import net.wanji.opt.vo.SchemeOptSendVO;
import net.wanji.utc.cache.CrossInfoCache;
import net.wanji.utc.cache.CrossPhaseDirTurnCache;
import net.wanji.utc.cache.CrossSchemePhaseTimeCountCache;
......
......@@ -18,7 +18,6 @@ import net.wanji.databus.dto.StepingPhaseDTO;
import net.wanji.databus.po.CrossInfoPO;
import net.wanji.databus.po.ManufacturerInfoPO;
import net.wanji.databus.vo.*;
import net.wanji.opt.vo.SchemeOptSendVO;
import net.wanji.utc.common.exception.ControlException;
import net.wanji.utc.common.typeenum.BasicEnum;
import net.wanji.utc.common.typeenum.CrossLightsDirEnum;
......
......@@ -6,7 +6,6 @@ import net.wanji.databus.dto.ExtendPhaseDTO;
import net.wanji.databus.dto.StepingPhaseDTO;
import net.wanji.databus.vo.*;
import net.wanji.feign.service.common.FeignCommon;
import net.wanji.opt.vo.SchemeOptSendVO;
import net.wanji.utc.cache.CrossInfoCache;
import net.wanji.utc.cache.UtcFeignClientCache;
import net.wanji.utc.common.constant.Constants;
......
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