Quellcode durchsuchen

修改北斗的端口

tags/v1.0.0^2
林万龙 vor 3 Jahren
Ursprung
Commit
10880df34e
3 geänderte Dateien mit 13 neuen und 17 gelöschten Zeilen
  1. +2
    -13
      src/main/java/com/telpo/dipperposition/common/SocketClient.java
  2. +5
    -3
      src/main/java/com/telpo/dipperposition/service/impl/DipperDataAsyncTaskServiceImpl.java
  3. +6
    -1
      src/main/java/com/telpo/dipperposition/service/impl/IpProvinceServiceImpl.java

+ 2
- 13
src/main/java/com/telpo/dipperposition/common/SocketClient.java Datei anzeigen

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


public byte[] sendCmd(String astCmd, String ackAckCheckRef) {
public byte[] sendCmd(String astCmd) {
try {
OutputStream os=socket.getOutputStream();
PrintWriter pw=new PrintWriter(os);
@@ -56,23 +56,12 @@ public class SocketClient {
ByteArrayOutputStream swapStream = new ByteArrayOutputStream();
byte[] buff = new byte[100];

//StringBuffer ackResultBuf= new StringBuffer();
//String ackHexOut = HexConvert.convertStringToHex(ackAckCheckRef);
// reply=br.readLine();
// while(reply!=null){
// //log.debug("接收服务器的信息:"+reply);
// //if (ackHexOut.equals(reply)) {
// ackResultBuf.append(reply);
// reply=br.readLine();
// // break;
// //}
// }
int rc = 0;
while ((rc = is.read(buff, 0, 100)) > 0) {
swapStream.write(buff, 0, rc);
}
byte[] in2b = swapStream.toByteArray();
//String ackResult = HexConvert.convertHexToString(ackResultBuf.toString());

//4.关闭资源
swapStream.close();
is.close();


+ 5
- 3
src/main/java/com/telpo/dipperposition/service/impl/DipperDataAsyncTaskServiceImpl.java Datei anzeigen

@@ -48,8 +48,9 @@ public class DipperDataAsyncTaskServiceImpl implements IDipperDataAsyncTaskServi
private byte[] pullEPHFromDipper() {

// 创建Socket客户端实例;
SocketClient client = new SocketClient(schedulingExecutorConfig.getAstServer(),
schedulingExecutorConfig.getAstEphAstHexPort(),schedulingExecutorConfig.getAstTimeout());
String serverAddr = schedulingExecutorConfig.getAstServer();
int serverPort = schedulingExecutorConfig.getAstEphAstHexPort();
SocketClient client = new SocketClient(serverAddr,serverPort,schedulingExecutorConfig.getAstTimeout());

// astTimeCmd 组装
String astTimeCmd = DIPPER_ALL_DATA_REQ;
@@ -63,8 +64,9 @@ public class DipperDataAsyncTaskServiceImpl implements IDipperDataAsyncTaskServi

String hexIn = astTimeCmd + checkSum.substring(0,2) + " " + checkSum.substring(2,4);

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

return sendResult;


+ 6
- 1
src/main/java/com/telpo/dipperposition/service/impl/IpProvinceServiceImpl.java Datei anzeigen

@@ -55,7 +55,12 @@ public class IpProvinceServiceImpl implements IpProvinceService {
ExampleMatcher matcher = ExampleMatcher.matching().withIgnorePaths("_class");
Example<IpProvinceEntity> example = Example.of(query, matcher);
Optional<IpProvinceEntity> data = ipProvinceMapper.findOne(example);
return data.orElse(null);
if (data.isPresent() == true) {
return data.get();
} else {
return null;
}
//return data.orElse(null);
} catch (Exception e) {
log.error("获取IP省份异常:", e);
return null;


Laden…
Abbrechen
Speichern