Commit ac6c36d4 authored by hanbing's avatar hanbing

Merge remote-tracking branch 'origin/master'

parents db754279 b8331bb4
......@@ -15,6 +15,8 @@ public class Constants {
public static final String COMMAND_TAIL = "7d";
// 操作类型, 数据对象id替换
public static final String COMMAND_COMMON = "010001000000010001%s010105%s000000";
public static final String COMMAND_SET_COMMON = "010001000000010001%s%s0105%s";
public static final String COMMAND_CENTER_COMMON = "010001000000010001%s010105%s%s";
public static final String COMMAND_HEART_BEAT_QUERY = "01000100000001000170";
public static final String COMMAND_HEART_BEAT_REPLY = "80";
public static final String COMMAND_QUERY = "10";
......@@ -30,6 +32,14 @@ public class Constants {
public static final String COMMAND_DEVICE_STATUS = "0d01";
public static final String COMMAND_RUNNING_STATUS = "0d02";
public static final String COMMAND_FAULT_LIST = "1001";
public static final String COMMAND_SET = "30";
public static final String COMMAND_SET_REPLY = "40";
public static final String COMMAND_CENTER_COMMON_SIGN = "1101";
public static final String COMMAND_CENTER_CONTROL_STAGE = "11010201";
public static final String COMMAND_CENTER_CONTROL_SCHEME = "11010301";
public static final String COMMAND_CENTER_CONTROL_MODEL = "11010401";
public static final String COMMAND_CENTER_CHANNEL_MODEL = "1201";
/**
* 通过发送报文内容,添加报文长度,crc校验,报文头尾
......
......@@ -36,12 +36,12 @@ public enum CommandResultSign {
SET_STAGE_INFO("3006", "setStageInfoService"),
SET_PHASE_SECURITY_INFO("3007", "setPhaseSecurityInfoService"),
SET_SCHEME_INFO("3009", "setSchemeInfoService"),
SET_DAILY_PLAN_INFO("3011", "setDailyPlanInfoService"),
SET_SCHEDULES_INFO("3012", "setSchedulesInfoService"),
SET_DAILY_PLAN_INFO("0b0240", "setDailyPlanInfoService"),
SET_SCHEDULES_INFO("090240", "setSchedulesInfoService"),
SET_TRAFFIC_DATA_INFO("3014", "setTrafficDataInfoService"),
SET_ALARM_INFO("3015", "setAlarmInfoService"),
SET_FAULT_INFO("3016", "setFaultInfoService"),
SET_CONTROL_INFO("4017", "setControlInfoService");
SET_CONTROL_INFO("110140", "setControlInfoService");
private String hexSign;
......
package net.wanji.com.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.Objects;
/**
* @author duanruiming
* @date 2023/06/21 9:31
*/
@Getter
@AllArgsConstructor
@RequiredArgsConstructor
public enum SectionControlModeEnum {
FIXED_CYCLE(1, "21", "定周期"),
GREEN_WAVE(2, "13", "绿灯"),
YELLOW_CONTROL(3, "31", "黄灯"),
RED_CONTROL(4, "32", "红灯"),
CLOSED_CONTROL(5, "33", "关灯"),
SELF_CONTROL(6, "14", "绿闪"),
FULL_INDUCTION(7, "31", "黄闪"),
HALF_INDUCTION(8, "32", "红闪");
private Integer wjControl;
private String dtControlHex;
private String message;
public static String getDtControlMode(Integer wjControlHex) {
for (ControlModelEnum value : ControlModelEnum.values()) {
if (Objects.equals(wjControlHex, value.getWjControl())) {
return value.getDtControlHex();
}
}
return null;
}
}
......@@ -5,7 +5,6 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import net.wanji.com.common.constants.Constants;
import net.wanji.com.service.controller.ControlCommandService;
import net.wanji.common.annotation.aspect.AspectLog;
import net.wanji.common.enums.BaseEnum;
......@@ -90,7 +89,7 @@ public class ControlCommandController {
@ApiOperation(value = "全红控制-路口全红控制/恢复", notes = "全红控制-路口全红控制/恢复")
@PostMapping("/allRedControl")
public JsonViewObject allRedControl(@RequestBody @Validated ControlCommandVO commandVO) throws Exception {
return controlCommandService.setSignalControl(commandVO.getCrossCode(), commandVO.getCommand(), Constants.ALL_RED_CONTROL);
return controlCommandService.setSignalControl(commandVO);
}
/**
......@@ -104,7 +103,7 @@ public class ControlCommandController {
@ApiOperation(value = "黄闪控制-路口黄闪控制/恢复", notes = "黄闪控制-路口黄闪控制/恢复")
@PostMapping("/yellowLightControl")
public JsonViewObject yellowLightControl(@RequestBody @Validated ControlCommandVO commandVO) throws Exception {
return controlCommandService.setSignalControl(commandVO.getCrossCode(), commandVO.getCommand(), Constants.YELLOW_LIGHT_CONTROL);
return controlCommandService.setSignalControl(commandVO);
}
/**
......@@ -118,7 +117,7 @@ public class ControlCommandController {
@ApiOperation(value = "关灯控制-路口关灯控制/开灯", notes = "关灯控制-路口关灯控制/开灯")
@PostMapping("/closeLightControl")
public JsonViewObject closeLightControl(@RequestBody @Validated ControlCommandVO commandVO) throws Exception {
return controlCommandService.setSignalControl(commandVO.getCrossCode(), commandVO.getCommand(), Constants.CLOSE_LIGHT_CONTROL);
return controlCommandService.setSignalControl(commandVO);
}
/**
......
package net.wanji.com.netty.commandsign;
import net.wanji.common.utils.tool.StringUtils;
import org.apache.commons.lang3.StringUtils;
/**
* @author duanruiming
......@@ -12,7 +12,7 @@ public class CommandResultSign {
String sign = null;
if (StringUtils.isNotBlank(data)) {
sign = data.substring(24, 26);
if (StringUtils.equalsIgnoreCase("80", sign)) {
if (StringUtils.equals("80", sign)) {
return sign;
}
sign = data.substring(32, 36).concat(sign);
......
......@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetAlarmInfoService implements CommandResponseFactory {
@Override
public String getCommandResponse(CommandPojo commandPojo) {
return null;
return commandPojo.getResponseMsg();
}
}
......@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetBaseInfoService implements CommandResponseFactory {
@Override
public String getCommandResponse(CommandPojo commandPojo) {
return null;
return commandPojo.getResponseMsg();
}
}
......@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetControlInfoService implements CommandResponseFactory {
@Override
public String getCommandResponse(CommandPojo commandPojo) {
return null;
return commandPojo.getResponseMsg();
}
}
......@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetDailyPlanInfoService implements CommandResponseFactory {
@Override
public String getCommandResponse(CommandPojo commandPojo) {
return null;
return commandPojo.getResponseMsg();
}
}
......@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetDetectorInfoService implements CommandResponseFactory {
@Override
public String getCommandResponse(CommandPojo commandPojo) {
return null;
return commandPojo.getResponseMsg();
}
}
......@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetDeviceInfoService implements CommandResponseFactory {
@Override
public String getCommandResponse(CommandPojo commandPojo) {
return null;
return commandPojo.getResponseMsg();
}
}
......@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetFaultInfoService implements CommandResponseFactory {
@Override
public String getCommandResponse(CommandPojo commandPojo) {
return null;
return commandPojo.getResponseMsg();
}
}
......@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetLightsGroupInfoService implements CommandResponseFactory {
@Override
public String getCommandResponse(CommandPojo commandPojo) {
return null;
return commandPojo.getResponseMsg();
}
}
......@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetPhaseInfoService implements CommandResponseFactory {
@Override
public String getCommandResponse(CommandPojo commandPojo) {
return null;
return commandPojo.getResponseMsg();
}
}
......@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetPhaseSecurityInfoService implements CommandResponseFactory {
@Override
public String getCommandResponse(CommandPojo commandPojo) {
return null;
return commandPojo.getResponseMsg();
}
}
......@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetSchedulesInfoService implements CommandResponseFactory {
@Override
public String getCommandResponse(CommandPojo commandPojo) {
return null;
return commandPojo.getResponseMsg();
}
}
......@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetSchemeInfoService implements CommandResponseFactory {
@Override
public String getCommandResponse(CommandPojo commandPojo) {
return null;
return commandPojo.getResponseMsg();
}
}
......@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetStageInfoService implements CommandResponseFactory {
@Override
public String getCommandResponse(CommandPojo commandPojo) {
return null;
return commandPojo.getResponseMsg();
}
}
......@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetTrafficDataInfoService implements CommandResponseFactory {
@Override
public String getCommandResponse(CommandPojo commandPojo) {
return null;
return commandPojo.getResponseMsg();
}
}
......@@ -53,13 +53,11 @@ public interface ControlCommandService extends BeanMarkService{
/**
* 设置信号机控制模式
*
* @param code 信号机编号
* @param command 指令 1 开 0 关
* @param commandType 命令类型
* @param commandVO 信号机编号
* @return
* @throws Exception 异常
*/
JsonViewObject setSignalControl(String code, Integer command, Integer commandType) throws Exception;
JsonViewObject setSignalControl(ControlCommandVO commandVO) throws Exception;
/**
* 恢复时间表
......
......@@ -136,6 +136,7 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
for (PhaseStageInfoPojo phaseStageInfoPojo : phaseStageInfoPojos) {
if (Objects.equals(phaseStageId, phaseStageInfoPojo.getPhaseStageId())) {
List<Integer> phaseList = phaseStageInfoPojo.getPhaseList();
int ringNo = 0;
for (Integer phaseId : phaseList) {
CrossPhasePO crossPhasePO = new CrossPhasePO();
crossPhasePO.setCrossId(crossId);
......@@ -144,7 +145,7 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
++sort;
crossPhasePO.setSort(sort);
crossPhasePO.setPlanId(schemeInfoPojo.getSchemeId());
crossPhasePO.setRingNo(1);
crossPhasePO.setRingNo(++ringNo);
crossPhasePO.setGroupNo(1);
crossPhasePO.setPhaseTime(phaseStageTime);
crossPhasePO.setControlMode(1);
......
package net.wanji.com.util;
import cn.hutool.core.util.HexUtil;
import freemarker.template.utility.StringUtil;
/**
* @author duanruiming
* @date 2023/06/20 15:07
*/
public class CommonUtils {
/**
* 将数组转化为16进制字符串
* @param array
* @return
*/
public static String getHex4Array(int[] array) {
StringBuilder sb = new StringBuilder();
for (int i : array) {
sb.append(i);
}
Integer binary = Integer.valueOf(sb.reverse().toString(), 2);
return HexUtil.toHex(binary);
}
/**
* 将时间转化为16进制 00:00 --> 061E0
* @param time
* @return
*/
public static String getHourMinuteHex(String time) {
StringBuffer sb = new StringBuffer();
String[] split = time.split(":");
String hour = String.format("%02x", Integer.valueOf(split[0]));
String minute = String.format("%02x", Integer.valueOf(split[1]));
return sb.append(hour).append(minute).toString();
}
public static String getBinary(Integer param) {
int[] array = new int[64];
array[param - 1] = 1;
StringBuffer resultSb = new StringBuffer();
for (int i = 0; i < array.length / 8; i++) {
StringBuffer sb = new StringBuffer();
for (int j = 0; j < 8; j++) {
sb.append(array[i * 8 + j]);
}
String hex = String.format("%02x", Integer.parseInt(sb.reverse().toString(), 2));
resultSb.insert(0, hex);
}
return StringUtil.leftPad(resultSb.toString(), 16, "0");
}
public static void main(String[] args) {
System.err.println(getBinary(8));
}
}
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