Bläddra i källkod

修改读取的结果

tags/v1.0.0^2
林万龙 3 år sedan
förälder
incheckning
53f20e3317
4 ändrade filer med 11 tillägg och 11 borttagningar
  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 Visa fil

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


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


+ 2
- 2
src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java Visa fil

@@ -139,8 +139,8 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter {
// 从缓存获取SDBP-AST-EPH星历数
//if (Integer.parseInt(starsAsycServerPort) == channel.localAddress().getPort()) {
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 Visa fil

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

}

+ 5
- 5
src/main/java/com/telpo/dipperposition/service/impl/DipperDataAsyncTaskServiceImpl.java Visa fil

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

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


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

// 创建Socket客户端实例;
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 ackAckCheckRef = "233E010102000421293C";
byte[] sendResult = client.sendCmd(hexIn, ackAckCheckRef);
String sendResult = client.sendCmd(hexIn, ackAckCheckRef);
client.closeConnection();

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

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

Laddar…
Avbryt
Spara