Commit f27078c3 authored by duanruiming's avatar duanruiming

[update] 代码优化

parent 67df2652
package net.wanji.utc.dt.controller; package net.wanji.utc.dt.controller;
/**
* @author Kent HAN
* @date 2022/12/1 15:07
*/
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponse;
......
...@@ -16,7 +16,7 @@ public class MessageDecoder extends ByteToMessageDecoder { ...@@ -16,7 +16,7 @@ public class MessageDecoder extends ByteToMessageDecoder {
*自定义解码器 *自定义解码器
*/ */
@Override @Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
byte[] bytes = new byte[in.readableBytes()]; byte[] bytes = new byte[in.readableBytes()];
in.readBytes(bytes); in.readBytes(bytes);
out.add(HexUtil.encodeHexStr(bytes)); out.add(HexUtil.encodeHexStr(bytes));
......
...@@ -19,7 +19,7 @@ public class MessageEnCoder extends MessageToByteEncoder<String> { ...@@ -19,7 +19,7 @@ public class MessageEnCoder extends MessageToByteEncoder<String> {
* @throws Exception * @throws Exception
*/ */
@Override @Override
protected void encode(ChannelHandlerContext ctx, String msg, ByteBuf out) throws Exception { protected void encode(ChannelHandlerContext ctx, String msg, ByteBuf out) {
out.writeBytes(AESUtils.parseHexStr2Byte(msg)); out.writeBytes(AESUtils.parseHexStr2Byte(msg));
} }
} }
...@@ -6,19 +6,17 @@ import io.netty.channel.ChannelHandlerContext; ...@@ -6,19 +6,17 @@ import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler; import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.socket.DatagramPacket; import io.netty.channel.socket.DatagramPacket;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.wanji.utc.dt.cache.CrossInfoCache; import net.wanji.common.framework.spring.ServiceBeanContext;
import net.wanji.databus.po.CrossInfoPO;
import net.wanji.utc.dt.cache.netty.NettyMessageCache; import net.wanji.utc.dt.cache.netty.NettyMessageCache;
import net.wanji.utc.dt.common.enums.CommandResultSignEnum; import net.wanji.utc.dt.common.enums.CommandResultSignEnum;
import net.wanji.utc.dt.netty.commandsign.CommandResultSign; import net.wanji.utc.dt.netty.commandsign.CommandResultSign;
import net.wanji.utc.dt.netty.pojo.CommandPojo; import net.wanji.utc.dt.netty.pojo.CommandPojo;
import net.wanji.utc.dt.netty.response.CommandResponseFactory; import net.wanji.utc.dt.netty.response.CommandResponseFactory;
import net.wanji.utc.dt.pojo.netty.MessageResultPojo; import net.wanji.utc.dt.pojo.netty.MessageResultPojo;
import net.wanji.common.framework.spring.ServiceBeanContext;
import net.wanji.databus.po.CrossInfoPO;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.util.Objects; import java.util.Objects;
...@@ -26,9 +24,6 @@ import java.util.Objects; ...@@ -26,9 +24,6 @@ import java.util.Objects;
@Component @Component
public class NettyServerHandler extends SimpleChannelInboundHandler<DatagramPacket> { public class NettyServerHandler extends SimpleChannelInboundHandler<DatagramPacket> {
@Resource
private CrossInfoCache crossInfoCache;
/** /**
* 读取消息 * 读取消息
* *
......
...@@ -42,8 +42,4 @@ public class LightsInfoPojo { ...@@ -42,8 +42,4 @@ public class LightsInfoPojo {
} }
return turnDir; return turnDir;
} }
public static void main(String[] args) {
System.err.println(1 % 4 == 1);
}
} }
...@@ -82,13 +82,13 @@ public interface ControlCommandService { ...@@ -82,13 +82,13 @@ public interface ControlCommandService {
*/ */
JsonViewObject phaseDiffSend(); JsonViewObject phaseDiffSend();
/** // /**
* 删除信号机配置参数 // * 删除信号机配置参数
* 删除信号机配置参数-目前支持相位、方案、计划、日期 // * 删除信号机配置参数-目前支持相位、方案、计划、日期
* // *
* @param delBaseConfigPO // * @param delBaseConfigPO
* @return // * @return
*/ // */
// JsonViewObject delBaseConfig(DelBaseConfigPOfigPO delBaseConfigPO) throws Exception; // JsonViewObject delBaseConfig(DelBaseConfigPOfigPO delBaseConfigPO) throws Exception;
/** /**
......
package net.wanji.utc.dt.service; package net.wanji.utc.dt.service;
import net.wanji.databus.dao.entity.CrossSchedulesPO; import net.wanji.databus.dao.entity.CrossSchedulesPO;
import net.wanji.databus.dto.CrossInfoDTO;
import net.wanji.databus.dto.PlanSectionDTO; import net.wanji.databus.dto.PlanSectionDTO;
import net.wanji.databus.dto.SchemePhaseLightsDTO; import net.wanji.databus.dto.SchemePhaseLightsDTO;
import net.wanji.databus.po.CrossInfoPO;
import net.wanji.databus.vo.PlanSectionVO; import net.wanji.databus.vo.PlanSectionVO;
import net.wanji.databus.vo.SchemePhaseLightsVO; import net.wanji.databus.vo.SchemePhaseLightsVO;
...@@ -13,8 +11,6 @@ import java.util.List; ...@@ -13,8 +11,6 @@ import java.util.List;
public interface StaticInfoService { public interface StaticInfoService {
List<CrossInfoPO> crossBasicInfo(CrossInfoDTO crossInfoDTO) throws Exception;
SchemePhaseLightsVO schemePhaseLights(SchemePhaseLightsDTO schemePhaseLightsDTO) throws Exception; SchemePhaseLightsVO schemePhaseLights(SchemePhaseLightsDTO schemePhaseLightsDTO) throws Exception;
List<PlanSectionVO> planSection(PlanSectionDTO planSectionDTO) throws Exception; List<PlanSectionVO> planSection(PlanSectionDTO planSectionDTO) throws Exception;
......
...@@ -33,6 +33,7 @@ import java.util.stream.Collectors; ...@@ -33,6 +33,7 @@ import java.util.stream.Collectors;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@Slf4j @Slf4j
@SuppressWarnings("all")
public class DTControlCommandServiceImpl implements ControlCommandService { public class DTControlCommandServiceImpl implements ControlCommandService {
/** /**
......
...@@ -27,6 +27,7 @@ import java.util.stream.Collectors; ...@@ -27,6 +27,7 @@ import java.util.stream.Collectors;
* @date 2023/05/08 17:28 * @date 2023/05/08 17:28
*/ */
@Service @Service
@SuppressWarnings("all")
public class DTSignalStatusServiceImpl implements SignalStatusService { public class DTSignalStatusServiceImpl implements SignalStatusService {
@Override @Override
......
...@@ -35,6 +35,7 @@ import java.util.stream.Collectors; ...@@ -35,6 +35,7 @@ import java.util.stream.Collectors;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@Slf4j @Slf4j
@SuppressWarnings("all")
public class DTStaticInfoServiceImpl implements StaticInfoService { public class DTStaticInfoServiceImpl implements StaticInfoService {
private final SignalDataCache signalDataCache; private final SignalDataCache signalDataCache;
......
...@@ -4,13 +4,13 @@ import cn.hutool.core.util.HexUtil; ...@@ -4,13 +4,13 @@ import cn.hutool.core.util.HexUtil;
import freemarker.template.utility.StringUtil; import freemarker.template.utility.StringUtil;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
* @author duanruiming * @author duanruiming
* @date 2023/06/20 15:07 * @date 2023/06/20 15:07
*/ */
@SuppressWarnings("all")
public class CommonUtils { public class CommonUtils {
/** /**
...@@ -87,10 +87,6 @@ public class CommonUtils { ...@@ -87,10 +87,6 @@ public class CommonUtils {
return StringUtil.leftPad(resultSb.toString(), 16, "0"); return StringUtil.leftPad(resultSb.toString(), 16, "0");
} }
public static void main(String[] args) {
System.err.println(getBinary4PhaseList(Arrays.asList(5,6,7,8)));
}
/** /**
* 将单个参数转化为4位二进制 * 将单个参数转化为4位二进制
* *
......
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