Browse Source

修改读取的结果

tags/v1.0.0^2
林万龙 3 years ago
parent
commit
53f20e3317
4 changed files with 11 additions and 11 deletions
  1. +3
    -3
      src/main/java/com/telpo/dipperposition/common/SocketClient.java
  2. +2
    -2
      src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java
  3. +1
    -1
      src/main/java/com/telpo/dipperposition/service/IDipperDataAsyncTaskService.java
  4. +5
    -5
      src/main/java/com/telpo/dipperposition/service/impl/DipperDataAsyncTaskServiceImpl.java

+ 3
- 3
src/main/java/com/telpo/dipperposition/common/SocketClient.java View File

@@ -38,7 +38,7 @@ public class SocketClient {
} }




public byte[] sendCmd(String astCmd, String ackAckCheckRef) {
public String sendCmd(String astCmd, String ackAckCheckRef) {
try { try {
OutputStream os=socket.getOutputStream(); OutputStream os=socket.getOutputStream();
PrintWriter pw=new PrintWriter(os); PrintWriter pw=new PrintWriter(os);
@@ -79,8 +79,8 @@ public class SocketClient {
pw.close(); pw.close();
os.close(); os.close();
//log.debug(ackResult); //log.debug(ackResult);
log.debug("接收服务器的信息:"+in2b.toString());
return in2b;
log.debug("接收服务器的信息:"+HexConvert.BinaryToHexString(in2b));
return HexConvert.BinaryToHexString(in2b);
} catch (IOException e) { } catch (IOException e) {
log.error("Socket sendCmd Error:" + e.getMessage()); log.error("Socket sendCmd Error:" + e.getMessage());
return null; return null;


+ 2
- 2
src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java View File

@@ -139,8 +139,8 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter {
// 从缓存获取SDBP-AST-EPH星历数 // 从缓存获取SDBP-AST-EPH星历数
//if (Integer.parseInt(starsAsycServerPort) == channel.localAddress().getPort()) { //if (Integer.parseInt(starsAsycServerPort) == channel.localAddress().getPort()) {
if (AST_POS_CMD.equals(recvmg)) { if (AST_POS_CMD.equals(recvmg)) {
byte[] astEPHBytes = dipperDataAsyncTaskService.getAstEPH();
buf = Unpooled.buffer(astEPHBytes.length);
String astEPHBytes = dipperDataAsyncTaskService.getAstEPH();
buf = Unpooled.buffer(astEPHBytes.getBytes().length);
} }






+ 1
- 1
src/main/java/com/telpo/dipperposition/service/IDipperDataAsyncTaskService.java View File

@@ -23,6 +23,6 @@ public interface IDipperDataAsyncTaskService {
* 根据IP获取EPH * 根据IP获取EPH
* *
*/ */
byte[] getAstEPH();
String getAstEPH();


} }

+ 5
- 5
src/main/java/com/telpo/dipperposition/service/impl/DipperDataAsyncTaskServiceImpl.java View File

@@ -32,7 +32,7 @@ public class DipperDataAsyncTaskServiceImpl implements IDipperDataAsyncTaskServi
@Override @Override
public void pullAstEPH() { public void pullAstEPH() {
// (1) 发送bds获取星历数据 // (1) 发送bds获取星历数据
byte[] dipperData = pullEPHFromDipper();
String dipperData = pullEPHFromDipper();


// (2) 获取星历数据 // (2) 获取星历数据
if (dipperData == null) { if (dipperData == null) {
@@ -44,7 +44,7 @@ public class DipperDataAsyncTaskServiceImpl implements IDipperDataAsyncTaskServi
} }




private byte[] pullEPHFromDipper() {
private String pullEPHFromDipper() {


// 创建Socket客户端实例; // 创建Socket客户端实例;
SocketClient client = new SocketClient(schedulingExecutorConfig.getAstServer(), schedulingExecutorConfig.getEphAstHexPort(),schedulingExecutorConfig.getAstTimeout()); SocketClient client = new SocketClient(schedulingExecutorConfig.getAstServer(), schedulingExecutorConfig.getEphAstHexPort(),schedulingExecutorConfig.getAstTimeout());
@@ -54,7 +54,7 @@ public class DipperDataAsyncTaskServiceImpl implements IDipperDataAsyncTaskServi
String hexIn = astTimeCmd + HexConvert.makeChecksum(astTimeCmd); String hexIn = astTimeCmd + HexConvert.makeChecksum(astTimeCmd);


String ackAckCheckRef = "233E010102000421293C"; String ackAckCheckRef = "233E010102000421293C";
byte[] sendResult = client.sendCmd(hexIn, ackAckCheckRef);
String sendResult = client.sendCmd(hexIn, ackAckCheckRef);
client.closeConnection(); client.closeConnection();


return sendResult; return sendResult;
@@ -62,7 +62,7 @@ public class DipperDataAsyncTaskServiceImpl implements IDipperDataAsyncTaskServi


@Override @Override
@Async("asyncServiceExecutor") @Async("asyncServiceExecutor")
public byte[] getAstEPH(){
return (byte[])redisUtil.get(DIPPER_DATA_KEY);
public String getAstEPH(){
return (String)redisUtil.get(DIPPER_DATA_KEY);
} }
} }

Loading…
Cancel
Save