@@ -7,4 +7,6 @@ ENV TimeZone=Asia/Shanghai | |||
ENV active=dev | |||
ENV JAVA_OPTS="-Xmx256M -Xms256M" | |||
RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone | |||
ENTRYPOINT java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /dipperposition.jar --spring.profiles.active=$active | |||
ENTRYPOINT java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -Dio.netty.leakDetectionLevel=ADVANCED -jar /dipperposition.jar --spring.profiles.active=$active | |||
java -Xmx256M -Xms256M -Djava.security.egd=file:/dev/./urandom -Dio.netty.leakDetectionLevel=ADVANCED -jar /dipperposition.jar --spring.profiles.active= |
@@ -2,29 +2,29 @@ | |||
environment=$1 | |||
version=$2 | |||
echo "环境变量为${environment},版本为$version!" | |||
if [[ ${environment} == 'production' ]]; then | |||
echo "开始远程构建容器" | |||
docker stop dipperposition_service || true | |||
docker rm dipperposition_service || true | |||
docker rmi -f $(docker images | grep registry.cn-shanghai.aliyuncs.com/telpo_platform/rzl_adapter | awk '{print $3}') | |||
docker login --username=rzl_wangjx@1111649216405698 --password=telpo.123 registry.cn-shanghai.aliyuncs.com | |||
docker pull registry.cn-shanghai.aliyuncs.com/telpo_platform/dipperposition_service:$version | |||
docker run -e active=pro -v /home/data/dipperposition/log:/var/log/dipperposition --restart=always -p 8105:8105 -p 9011:9011 -p 9012:9012 -p 9013:9013 -d --name dipperposition_service registry.cn-shanghai.aliyuncs.com/telpo_platform/dipperposition_service:$version | |||
#删除产生的None镜像 | |||
docker rmi -f $(docker images | grep none | awk '{print $3}') | |||
docker ps -a | |||
else | |||
if [[ ${environment} == 'test' ]]; then | |||
#echo "开始远程构建容器" | |||
docker stop dipperposition_service || true | |||
docker rm dipperposition_service || true | |||
docker rmi -f $(docker images | grep 139.224.254.18:5000/dipperposition_service | awk '{print $3}') | |||
docker pull 139.224.254.18:5000/dipperposition_service:$version | |||
docker run -v /home/data/dipperposition/log:/var/log/dipperposition -e active=test --restart=always -d --network host -p 9011:9011 --name dipperposition_service 139.224.254.18:5000/dipperposition_service:$version | |||
#processID='ps -ef | grep dipperposition | awk '{print $2}' | awk NR==1' | |||
ps -ef | grep dipperposition | awk '{print $2}' | xargs kill -9 | |||
#echo $processID | |||
#if [[ "$processID" != "" ]]; then | |||
# kill -9 $processID | |||
#fi | |||
if [[ ${environment} == 'pro' ]]; then | |||
echo 'run in production environment' | |||
cd /home/data/dipperposition | |||
if [[ -f /home/linwl/dipperposition/dipperposition.jar ]]; then | |||
echo 'mv /home/linwl/dipperposition/dipperposition.jar to destination' | |||
mv /home/linwl/dipperposition/dipperposition.jar /home/data/dipperposition/dipperposition.jar | |||
fi | |||
nohup java -Xmx2048M -Xms2048M -Djava.security.egd=file:/dev/./urandom -Dio.netty.leakDetectionLevel=ADVANCED -jar dipperposition.jar --spring.profiles.active=pro & | |||
#删除产生的None镜像 | |||
docker rmi -f $(docker images | grep none | awk '{print $3}') | |||
docker ps -a | |||
fi | |||
if [[ ${environment} == 'test' ]]; then | |||
cd /home/data/dipperposition | |||
if [[ -f /home/linwl/Work/DipperPosition/dipperposition.jar ]]; then | |||
mv /home/linwl/Work/DipperPosition/dipperposition.jar /home/data/dipperposition/dipperposition.jar | |||
fi | |||
nohup java -Xmx128M -Xms128M -Djava.security.egd=file:/dev/./urandom -Dio.netty.leakDetectionLevel=ADVANCED -jar dipperposition.jar --spring.profiles.active=test & | |||
fi |
@@ -40,32 +40,10 @@ | |||
<optional>true</optional> | |||
</dependency> | |||
<!--天波通用包--> | |||
<dependency> | |||
<groupId>com.telpo</groupId> | |||
<artifactId>common</artifactId> | |||
<version>1.1.19</version> | |||
</dependency> | |||
<!-- springcloud alibaba依赖包--> | |||
<dependency> | |||
<groupId>com.alibaba.cloud</groupId> | |||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.alibaba.cloud</groupId> | |||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.alibaba.boot</groupId> | |||
<artifactId>nacos-config-spring-boot-starter</artifactId> | |||
<version>0.2.7</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.alibaba.nacos</groupId> | |||
<artifactId>nacos-client</artifactId> | |||
<groupId>cn.hutool</groupId> | |||
<artifactId>hutool-core</artifactId> | |||
<version>5.5.2</version> | |||
</dependency> | |||
<dependency> | |||
@@ -138,6 +116,11 @@ | |||
<version>2.0</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.springframework.data</groupId> | |||
<artifactId>spring-data-mongodb</artifactId> | |||
<version>2.2.5.RELEASE</version> | |||
</dependency> | |||
</dependencies> | |||
<dependencyManagement> | |||
@@ -150,13 +133,6 @@ | |||
<scope>import</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.alibaba.cloud</groupId> | |||
<artifactId>spring-cloud-alibaba-dependencies</artifactId> | |||
<version>${spring-cloud-alibaba.version}</version> | |||
<type>pom</type> | |||
<scope>import</scope> | |||
</dependency> | |||
</dependencies> | |||
</dependencyManagement> | |||
@@ -1,12 +1,10 @@ | |||
package com.telpo.dipperposition; | |||
import com.telpo.dipperposition.server.DipperPositionServer; | |||
import com.telpo.dipperposition.server.TimeAsyncServer; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.boot.SpringApplication; | |||
import org.springframework.boot.autoconfigure.SpringBootApplication; | |||
import org.springframework.boot.context.properties.ConfigurationPropertiesScan; | |||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; | |||
import org.springframework.context.ConfigurableApplicationContext; | |||
import org.springframework.core.env.ConfigurableEnvironment; | |||
import org.springframework.scheduling.annotation.EnableAsync; | |||
@@ -19,7 +17,6 @@ import org.springframework.scheduling.annotation.EnableScheduling; | |||
* @create: 2020-06-18 16:39 | |||
*/ | |||
@SpringBootApplication | |||
@EnableDiscoveryClient | |||
@ConfigurationPropertiesScan | |||
@EnableAsync | |||
@EnableScheduling | |||
@@ -38,7 +38,7 @@ public class SocketClient { | |||
} | |||
public String sendCmd(String astCmd, String ackAckCheckRef) { | |||
public byte[] sendCmd(String astCmd, String ackAckCheckRef) { | |||
try { | |||
OutputStream os=socket.getOutputStream(); | |||
PrintWriter pw=new PrintWriter(os); | |||
@@ -80,7 +80,8 @@ public class SocketClient { | |||
os.close(); | |||
//log.debug(ackResult); | |||
log.debug("接收服务器的信息:"+HexConvert.BinaryToHexString(in2b)); | |||
return HexConvert.BinaryToHexString(in2b); | |||
//return HexConvert.BinaryToHexString(in2b); | |||
return in2b; | |||
} catch (IOException e) { | |||
log.error("Socket sendCmd Error:" + e.getMessage()); | |||
return null; | |||
@@ -19,17 +19,19 @@ import java.util.concurrent.ThreadPoolExecutor; | |||
* @author: linwl | |||
* @create: 2020-07-11 09:17 | |||
*/ | |||
@Getter | |||
@Setter | |||
@Configuration | |||
@Slf4j | |||
public class AsyncExecutorConfig implements AsyncConfigurer { | |||
@Value("${async.pool.corePoolSize}") | |||
@Value(value = "${async.pool.corePoolSize:4}") | |||
private int corePoolSize; | |||
@Value("${async.pool.maxPoolSize}") | |||
@Value(value = "${async.pool.maxPoolSize:8}") | |||
private int maxPoolSize; | |||
@Value("${async.pool.queueCapacity}") | |||
@Value(value = "${async.pool.queueCapacity:5000}") | |||
private int queueCapacity; | |||
@Bean(name = "asyncServiceExecutor") | |||
@@ -1,17 +1,12 @@ | |||
package com.telpo.dipperposition.config; | |||
import com.alibaba.nacos.api.config.annotation.NacosValue; | |||
import com.alibaba.nacos.spring.context.annotation.config.NacosPropertySource; | |||
import com.telpo.dipperposition.common.OkHttpUtil; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.context.annotation.Configuration; | |||
import javax.annotation.PostConstruct; | |||
/** | |||
* @program: gateway | |||
* @program: NettyServerConfig | |||
* @description: jwt设置 | |||
* @author: linwl | |||
* @create: 2020-06-18 17:45 | |||
@@ -19,26 +14,18 @@ import javax.annotation.PostConstruct; | |||
@Getter | |||
@Setter | |||
@Configuration | |||
@NacosPropertySource(dataId="dipperposition-service", autoRefreshed=true) | |||
public class NettyServerConfig { | |||
@NacosValue(value = "${position-server.serverAddr}") | |||
@Value(value = "${position-server.serverAddr}") | |||
private String serverAddr; | |||
@NacosValue(value = "${position-server.timeAsycPort:9011}") | |||
@Value(value = "${position-server.timeAsycPort:9011}") | |||
private String timeAsycServerPort; | |||
@NacosValue(value = "${position-server.posAsycPort}") | |||
@Value(value = "${position-server.posAsycPort:9013}") | |||
private String posAsycServerPort; | |||
@NacosValue(value = "${position-server.starsAsycPort}") | |||
@Value(value = "${position-server.starsAsycPort:9012}") | |||
private String starsAsycServerPort; | |||
// public static NettyServerConfig nettyServerConfig; | |||
// | |||
// @PostConstruct | |||
// public void init() { | |||
// nettyServerConfig = this; | |||
// } | |||
} |
@@ -1,5 +1,7 @@ | |||
package com.telpo.dipperposition.config; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import lombok.extern.slf4j.Slf4j; | |||
import okhttp3.ConnectionPool; | |||
import okhttp3.OkHttpClient; | |||
@@ -24,23 +26,25 @@ import java.util.concurrent.TimeUnit; | |||
* @author: linwl | |||
* @create: 2020-07-17 15:29 | |||
*/ | |||
@Getter | |||
@Setter | |||
@Configuration | |||
@Slf4j | |||
public class OkHttpConfig { | |||
@Value("${OkHttp-config.pool.max-conn}") | |||
@Value(value = "${OkHttp-config.pool.max-conn}") | |||
private Integer maxConn; | |||
@Value("${OkHttp-config.pool.keep-alive}") | |||
@Value(value = "${OkHttp-config.pool.keep-alive}") | |||
private Integer keepAlive; | |||
@Value("${OkHttp-config.read-timeout}") | |||
@Value(value = "${OkHttp-config.read-timeout}") | |||
private long readTimeout; | |||
@Value("${OkHttp-config.conn-timeout}") | |||
@Value(value = "${OkHttp-config.conn-timeout}") | |||
private long connTimeout; | |||
@Value("${OkHttp-config.write-timeout}") | |||
@Value(value = "${OkHttp-config.write-timeout}") | |||
private long writeTimeout; | |||
@Bean | |||
@@ -1,16 +1,12 @@ | |||
package com.telpo.dipperposition.config; | |||
import com.alibaba.nacos.api.config.annotation.NacosValue; | |||
import com.alibaba.nacos.spring.context.annotation.config.NacosPropertySource; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.context.annotation.Configuration; | |||
import javax.annotation.PostConstruct; | |||
/** | |||
* @program: gateway | |||
* @program: PositionConfig | |||
* @description: jwt设置 | |||
* @author: linwl | |||
* @create: 2020-06-18 17:45 | |||
@@ -18,32 +14,13 @@ import javax.annotation.PostConstruct; | |||
@Getter | |||
@Setter | |||
@Configuration | |||
@NacosPropertySource(dataId="dipperposition-service", autoRefreshed=true) | |||
public class PositionConfig { | |||
@NacosValue("${pos.centerProvinceFilePath}") | |||
String centerProvinceFilePath; | |||
@NacosValue("${pos.ipPositionRequestPath}") | |||
String ipPositionRequestPath; | |||
@NacosValue("${pos.ipPositionRequestKey}") | |||
String ipPositionRequestKey; | |||
@NacosValue("${pos.centerProvince}") | |||
String centerProvince; | |||
@NacosValue("${pos.astServer}") | |||
String astServer; | |||
@NacosValue("${pos.astPosAstPort}") | |||
int posAstPort; | |||
@NacosValue("${pos.astTimeout}") | |||
int astTimeout; | |||
@Value(value = "${pos.ipPositionRequestPath}") | |||
private String ipPositionRequestPath; | |||
@Value(value = "${pos.ipPositionRequestKey}") | |||
private String ipPositionRequestKey; | |||
@Value(value = "${pos.centerProvince}") | |||
private String centerProvince; | |||
// public static PositionConfig positionConfig; | |||
// | |||
// @PostConstruct | |||
// public void init() { | |||
// positionConfig = this; | |||
// } | |||
} |
@@ -20,19 +20,19 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar; | |||
@Configuration | |||
public class SchedulingExecutorConfig implements SchedulingConfigurer { | |||
@Value("${scheduler.pool.size}") | |||
@Value(value = "${scheduler.pool.size}") | |||
private int pollSize; | |||
@Value("${scheduler.pool.await-seconds}") | |||
@Value(value = "${scheduler.pool.await-seconds}") | |||
private int awaitSeconds; | |||
@Value("${pos.ast.server}") | |||
@Value(value = "${pos.astServer}") | |||
private String astServer; | |||
@Value("${pos.ast.ephAstPort}") | |||
private int ephAstPort; | |||
@Value("${pos.ast.ephAstHexPort}") | |||
private int ephAstHexPort; | |||
@Value("${pos.ast.timeout}") | |||
@Value(value = "${pos.astPosAstPort}") | |||
private int posAstPort; | |||
@Value(value = "${pos.astEphAstHexPort}") | |||
private int astEphAstHexPort; | |||
@Value(value = "${pos.astTimeout}") | |||
private int astTimeout; | |||
@Override | |||
@@ -1,37 +0,0 @@ | |||
package com.telpo.dipperposition.controller; | |||
import com.telpo.dipperposition.service.IDipperAstPosAsyncTaskService; | |||
import com.telpo.dipperposition.service.IDipperAstTimeAsyncTaskService; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import javax.annotation.PostConstruct; | |||
/** | |||
* @program: DipperAstPosAsyncTaskController | |||
* @description: 北斗定位 | |||
* @author: linwl | |||
* @create: 2020-07-10 14:01 | |||
*/ | |||
@RestController | |||
@Slf4j | |||
public class DipperAstPosAsyncTaskController { | |||
@Autowired | |||
IDipperAstPosAsyncTaskService dipperAstPosAsyncTaskService; | |||
// private DipperAstPosAsyncTaskController dipperAstPosAsyncTaskController; | |||
// @PostConstruct | |||
// public void init() { | |||
// dipperAstPosAsyncTaskController = this; | |||
// } | |||
/* | |||
* 拉取星历数据 | |||
*/ | |||
public String pushAstPos(String ipAddress) { | |||
return dipperAstPosAsyncTaskService.pushAstPos(ipAddress); | |||
} | |||
} |
@@ -1,39 +0,0 @@ | |||
package com.telpo.dipperposition.controller; | |||
import com.telpo.dipperposition.service.IDipperAstTimeAsyncTaskService; | |||
import com.telpo.dipperposition.service.IDipperDataAsyncTaskService; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import javax.annotation.PostConstruct; | |||
/** | |||
* @program: DipperPositionController | |||
* @description: 北斗定位 | |||
* @author: linwl | |||
* @create: 2020-07-10 14:01 | |||
*/ | |||
@RestController | |||
@Slf4j | |||
public class DipperAstTimeAsyncTaskController { | |||
@Autowired | |||
IDipperAstTimeAsyncTaskService dipperTimeAsyncTaskService; | |||
// private DipperAstTimeAsyncTaskController dipperTimeAsyncTaskController; | |||
// @PostConstruct | |||
// public void init() { | |||
// dipperTimeAsyncTaskController = this; | |||
// } | |||
/* | |||
* 拉取星历数据 | |||
*/ | |||
public String pushAstTime() { | |||
return dipperTimeAsyncTaskService.pushAstTime(); | |||
} | |||
} |
@@ -1,55 +0,0 @@ | |||
package com.telpo.dipperposition.controller; | |||
import com.telpo.dipperposition.service.IDipperDataAsyncTaskService; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import javax.annotation.PostConstruct; | |||
/** | |||
* @program: DipperPositionController | |||
* @description: 北斗定位 | |||
* @author: linwl | |||
* @create: 2020-07-10 14:01 | |||
*/ | |||
@RestController | |||
@Slf4j | |||
public class DipperDataAsyncTaskController { | |||
@Value(value = "${position-server.serverAddr}") | |||
private String serverAddr; | |||
//RzlAccount rzlAccount; | |||
@Autowired | |||
IDipperDataAsyncTaskService dipperDataAsyncTaskService; | |||
// private DipperDataAsyncTaskController dipperDataAsyncTaskController; | |||
// @PostConstruct | |||
// public void init() { | |||
// dipperDataAsyncTaskController = this; | |||
// } | |||
/* | |||
* 拉取星历数据 | |||
*/ | |||
public void pullAstEPH() { | |||
dipperDataAsyncTaskService.pullAstEPH(); | |||
} | |||
// | |||
// /* | |||
// * 获取星历数据 | |||
// */ | |||
// public String getAstEPH() { | |||
// log.info("DipperDataAsyncTaskController serverAddr = " + serverAddr); | |||
// return dipperDataAsyncTaskService.getAstEPH(); | |||
// } | |||
@RequestMapping("/getPos") | |||
public String getPos() { | |||
return "return serverAddr = " + serverAddr; | |||
} | |||
} |
@@ -5,6 +5,7 @@ import com.telpo.dipperposition.service.IDipperAstPosAsyncTaskService; | |||
import com.telpo.dipperposition.service.IDipperAstTimeAsyncTaskService; | |||
import com.telpo.dipperposition.service.IDipperDataAsyncTaskService; | |||
import io.netty.buffer.ByteBuf; | |||
import io.netty.buffer.ByteBufAllocator; | |||
import io.netty.buffer.CompositeByteBuf; | |||
import io.netty.buffer.Unpooled; | |||
import io.netty.channel.socket.SocketChannel; | |||
@@ -30,7 +31,7 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { | |||
private static String AST_TIME_CMD = "TIME"; | |||
private static String AST_POS_CMD = "POS"; | |||
private static String AST_EPH_CMD = "EPH"; | |||
private static String AST_ALL_CMD = "all"; | |||
private static String AST_ALL_CMD = "ALL"; | |||
private static String AST_TIME_CMD_BYTE = "54494d45"; | |||
private static String AST_POS_CMD_BYTE = "504f53"; | |||
private static String AST_EPH_CMD_BYTE = "455048"; | |||
@@ -71,23 +72,8 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { | |||
log.info("链接报告完毕"); | |||
//通知客户端链接建立成功 | |||
// 默认返回取得时间成功 | |||
String ackAckCheckRef = "233E0101020004020A1D"; | |||
// if (Integer.parseInt(nettyServerConfig.getPosAsycServerPort()) == channel.localAddress().getPort()) { | |||
// ackAckCheckRef = "233E010102000401091C"; | |||
// } | |||
// if (Integer.parseInt(nettyServerConfig.getStarsAsycServerPort()) == channel.localAddress().getPort()) { | |||
// ackAckCheckRef = "233E010102000421293C"; | |||
// } | |||
if (9013 == channel.localAddress().getPort()) { | |||
ackAckCheckRef = "233E010102000401091C"; | |||
} | |||
if (9012 == channel.localAddress().getPort()) { | |||
ackAckCheckRef = "233E010102000421293C"; | |||
} | |||
//String str = "通知客户端链接建立成功" + " " + LocalDateTime.now() + " " + channel.localAddress().getHostString() + | |||
// "\r\n"; | |||
// String ackAckCheckRef = "233E0101020004020A1D"; | |||
String ackAckCheckRef = "23 3E 01 01 02 00 04 21 29 3C"; | |||
ByteBuf buf = Unpooled.buffer(ackAckCheckRef.getBytes().length); | |||
buf.writeBytes(ackAckCheckRef.getBytes(CharsetUtil.UTF_8)); | |||
ctx.writeAndFlush(buf); | |||
@@ -109,6 +95,7 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { | |||
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { | |||
//接收msg消息与上一章节相比,此处已经不需要自己进行解码} | |||
SocketChannel channel = (SocketChannel) ctx.channel(); | |||
ByteBufAllocator bba = channel.config().getAllocator(); | |||
String ipAddress = channel.remoteAddress().getHostString(); | |||
log.info("接收到消息:" + msg + ",客户端IP:" + ipAddress); | |||
if(ipAddress.contains(":")) { | |||
@@ -125,9 +112,11 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { | |||
channelAns = nettyServerHandler.dipperTimeAsyncTaskService.pushAstTime(); | |||
//log.debug(channelAns); | |||
if (channelAns != null) { | |||
buf = Unpooled.buffer(channelAns.getBytes().length); | |||
buf = bba.buffer(channelAns.getBytes().length); | |||
//Unpooled.buffer(channelAns.getBytes().length); | |||
buf.writeBytes(channelAns.getBytes(CharsetUtil.UTF_8)); | |||
ctx.writeAndFlush(buf); | |||
ctx.write(buf); | |||
ctx.flush(); | |||
} | |||
} | |||
// 发送SDBP-AST-POS获取辅助位置信息 | |||
@@ -135,49 +124,72 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { | |||
channelAns = nettyServerHandler.dipperAstPosAsyncTaskService.pushAstPos(ipAddress); | |||
//log.debug(channelAns); | |||
if (channelAns != null) { | |||
buf = Unpooled.buffer(channelAns.getBytes().length); | |||
buf = bba.buffer(channelAns.getBytes().length); | |||
//Unpooled.buffer(channelAns.getBytes().length); | |||
buf.writeBytes(channelAns.getBytes(CharsetUtil.UTF_8)); | |||
ctx.writeAndFlush(buf); | |||
ctx.write(buf); | |||
ctx.flush(); | |||
} | |||
} | |||
// 从缓存获取SDBP-AST-EPH星历数 | |||
if (AST_EPH_CMD.equals(msg)) { | |||
channelAns = nettyServerHandler.dipperDataAsyncTaskService.getAstEPH(); | |||
//channelAns = nettyServerHandler.dipperDataAsyncTaskService.getAstEPH(); | |||
byte[] returnBytes = nettyServerHandler.dipperDataAsyncTaskService.getAstEPH(); | |||
//log.debug(channelAns); | |||
if (channelAns != null) { | |||
buf = Unpooled.buffer(channelAns.getBytes().length); | |||
buf.writeBytes(channelAns.getBytes(CharsetUtil.UTF_8)); | |||
ctx.writeAndFlush(buf); | |||
} | |||
//if (channelAns != null) { | |||
// buf = bba.buffer(channelAns.getBytes().length); | |||
buf = bba.buffer(returnBytes.length); | |||
//Unpooled.buffer(channelAns.getBytes().length); | |||
buf.writeBytes(returnBytes); | |||
ctx.write(buf); | |||
ctx.flush(); | |||
//} | |||
} | |||
// 最后把SDBP-AST-TIME、SDBP-AST-POS、SDBP-AST-EPH并包一起发给设备。 | |||
// 设备采用16进制获取数据,则代理服务器也是采用16进制返回数据。 | |||
// 通知客户端链消息发送成功 | |||
if (AST_ALL_CMD.equals(msg)) { | |||
CompositeByteBuf compositeByteBuf = Unpooled.compositeBuffer(); | |||
if (AST_ALL_CMD.equals(msg.toString().toUpperCase())) { | |||
channelAns = nettyServerHandler.dipperTimeAsyncTaskService.pushAstTime(); | |||
if (channelAns != null) { | |||
ByteBuf channelTimeAnsBuf = Unpooled.buffer(channelAns.getBytes().length); | |||
log.debug("Time Buffer Length is:" + channelAns.getBytes().length); | |||
ByteBuf channelTimeAnsBuf = bba.buffer(channelAns.getBytes().length); | |||
//Unpooled.buffer(channelAns.getBytes().length); | |||
channelTimeAnsBuf.writeBytes(channelAns.getBytes(CharsetUtil.UTF_8)); | |||
compositeByteBuf.addComponent(channelTimeAnsBuf); | |||
// compositeByteBuf.addComponent(channelTimeAnsBuf); | |||
ctx.write(channelTimeAnsBuf); | |||
ctx.flush(); | |||
} | |||
channelAns = nettyServerHandler.dipperAstPosAsyncTaskService.pushAstPos(ipAddress); | |||
if (channelAns != null) { | |||
ByteBuf channelPosAnsBuf = Unpooled.buffer(channelAns.getBytes().length); | |||
log.debug("Pos Buffer Length is:" + channelAns.getBytes().length); | |||
ByteBuf channelPosAnsBuf = bba.buffer(channelAns.getBytes().length); | |||
//Unpooled.buffer(channelAns.getBytes().length); | |||
channelPosAnsBuf.writeBytes(channelAns.getBytes(CharsetUtil.UTF_8)); | |||
compositeByteBuf.addComponent(channelPosAnsBuf); | |||
} | |||
channelAns = nettyServerHandler.dipperDataAsyncTaskService.getAstEPH(); | |||
if (channelAns != null) { | |||
ByteBuf channelPehAnsBuf = Unpooled.buffer(channelAns.getBytes().length); | |||
channelPehAnsBuf.writeBytes(channelAns.getBytes(CharsetUtil.UTF_8)); | |||
compositeByteBuf.addComponent(channelPehAnsBuf); | |||
//compositeByteBuf.addComponent(channelPosAnsBuf); | |||
ctx.write(channelPosAnsBuf); | |||
ctx.flush(); | |||
} | |||
ctx.writeAndFlush(compositeByteBuf); | |||
byte[] returnBytes = nettyServerHandler.dipperDataAsyncTaskService.getAstEPH(); | |||
//if (channelAns != null) { | |||
log.debug("PEH Buffer Length is:" + returnBytes.length); | |||
// 使用池化的堆内存,以减少内存碎片 | |||
//ByteBuf channelPehAnsBuf = Unpooled.buffer(channelAns.getBytes().length); | |||
//ByteBuf channelPehAnsBuf = bba.buffer(channelAns.getBytes().length); | |||
ByteBuf channelPehAnsBuf = bba.buffer(returnBytes.length); | |||
//channelPehAnsBuf.writeBytes(channelAns.getBytes(CharsetUtil.UTF_8)); | |||
channelPehAnsBuf.writeBytes(returnBytes); | |||
// compositeByteBuf.addComponent(channelPehAnsBuf); | |||
// log.info("CompositeByteBuf Length is:" + compositeByteBuf.capacity()); | |||
ctx.write(channelPehAnsBuf); | |||
ctx.flush(); | |||
//} | |||
// 写给下一个Handler,最后一个Handler将内容移出pipeline | |||
// ctx.writeAndFlush(compositeByteBuf); | |||
} | |||
} | |||
@@ -18,7 +18,9 @@ public class ServerChannelInitializer extends ChannelInitializer<SocketChannel> | |||
//添加编解码 | |||
socketChannel.pipeline().addLast("decoder", new StringDecoder(CharsetUtil.UTF_8)); | |||
socketChannel.pipeline().addLast("encoder", new StringEncoder(CharsetUtil.UTF_8)); | |||
// pipeline的第一个ChannelHandler:ChannelInboundHandlerAdapter | |||
socketChannel.pipeline().addLast(new NettyServerHandler()); | |||
// addLast后会自动创建ChannelHandlerContext | |||
} | |||
} |
@@ -1,13 +1,9 @@ | |||
package com.telpo.dipperposition.mapper; | |||
import com.telpo.dipperposition.annotation.MongoSwitch; | |||
import com.telpo.dipperposition.entity.mongo.IpProvinceEntity; | |||
import db.BaseMongoDbDao; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.data.mongodb.repository.MongoRepository; | |||
import org.springframework.stereotype.Repository; | |||
import java.util.List; | |||
/** | |||
* @program: DataPushServer | |||
@@ -48,8 +48,9 @@ public class DipperPositionServer { | |||
.channel(NioServerSocketChannel.class) | |||
.childHandler(new ServerChannelInitializer()) | |||
.localAddress(socketAddress) | |||
//设置队列大小 | |||
//设置队列大小, 多少合适???? | |||
.option(ChannelOption.SO_BACKLOG, 1024) | |||
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 3000) | |||
// 两小时内没有数据的通信时,TCP会自动发送一个活动探测数据报文 | |||
.childOption(ChannelOption.SO_KEEPALIVE, true); | |||
@@ -62,9 +63,9 @@ public class DipperPositionServer { | |||
//log.info("服务器: {}", myServerAddr); | |||
channelFuture.addListener(future -> { | |||
if (future.isSuccess()){ | |||
System.out.println("start success"); | |||
log.info("start success"); | |||
}else{ | |||
System.out.println("start failed"); | |||
log.info("start failed"); | |||
} | |||
}); | |||
channelFuture.channel().closeFuture().sync(); | |||
@@ -1,81 +0,0 @@ | |||
package com.telpo.dipperposition.server; | |||
import com.alibaba.nacos.api.exception.NacosException; | |||
import com.telpo.dipperposition.handler.ServerChannelInitializer; | |||
import io.netty.bootstrap.ServerBootstrap; | |||
import io.netty.channel.ChannelFuture; | |||
import io.netty.channel.ChannelOption; | |||
import io.netty.channel.EventLoopGroup; | |||
import io.netty.channel.nio.NioEventLoopGroup; | |||
import io.netty.channel.socket.nio.NioServerSocketChannel; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.core.env.ConfigurableEnvironment; | |||
import java.net.InetSocketAddress; | |||
/** | |||
* @program: TimeAsyncServer | |||
* @description: 北斗定位 | |||
* @author: king | |||
* @create: 2021-01-13 14:01 | |||
*/ | |||
@Slf4j | |||
public class TimeAsyncServer { | |||
// @Autowired PositionConfigInfo positionConfigInfo; | |||
private String serverAddr; | |||
private Integer serverPort; | |||
private Integer timeAsycPort; | |||
private Integer posAsycPort; | |||
private Integer starsAsycPort; | |||
public TimeAsyncServer(ConfigurableEnvironment environment) throws NacosException { | |||
this.serverAddr = environment.getProperty("position-server.serverAddr"); | |||
this.serverPort = Integer.parseInt(environment.getProperty("server.port")); | |||
this.timeAsycPort = Integer.parseInt(environment.getProperty("position-server.timeAsycPort")); | |||
this.posAsycPort = Integer.parseInt(environment.getProperty("position-server.posAsycPort")); | |||
this.starsAsycPort = Integer.parseInt(environment.getProperty("position-server.starsAsycPort")); | |||
} | |||
public void start() { | |||
//new 一个主线程组 | |||
EventLoopGroup mainThreadGroup = new NioEventLoopGroup(1); | |||
//new 一个工作线程组 | |||
EventLoopGroup workThreadGroup = new NioEventLoopGroup(200); | |||
//InetSocketAddress socketAddress = new InetSocketAddress(serverAddr,null); | |||
ServerBootstrap bootstrap = new ServerBootstrap() | |||
.group(mainThreadGroup, workThreadGroup) | |||
.channel(NioServerSocketChannel.class) | |||
.childHandler(new ServerChannelInitializer()) | |||
//.localAddress(socketAddress) | |||
//设置队列大小 | |||
.option(ChannelOption.SO_BACKLOG, 1024) | |||
// 两小时内没有数据的通信时,TCP会自动发送一个活动探测数据报文 | |||
.childOption(ChannelOption.SO_KEEPALIVE, true); | |||
//绑定端口,开始接收进来的连接 | |||
try { | |||
ChannelFuture channelFuture = bootstrap.bind(timeAsycPort).sync(); | |||
log.info("时间辅助服务器启动开始监听端口: {}", timeAsycPort); | |||
channelFuture.addListener(future -> { | |||
if (future.isSuccess()){ | |||
System.out.println("start success"); | |||
}else{ | |||
System.out.println("start failed"); | |||
} | |||
}); | |||
channelFuture.channel().closeFuture().sync(); | |||
} catch (InterruptedException e) { | |||
e.printStackTrace(); | |||
} finally { | |||
//关闭主线程组 | |||
mainThreadGroup.shutdownGracefully(); | |||
//关闭工作线程组 | |||
workThreadGroup.shutdownGracefully(); | |||
} | |||
} | |||
} |
@@ -26,6 +26,6 @@ public interface IDipperDataAsyncTaskService { | |||
* 根据IP获取EPH | |||
* | |||
*/ | |||
String getAstEPH(); | |||
byte[] getAstEPH(); | |||
} |
@@ -1,9 +1,7 @@ | |||
package com.telpo.dipperposition.service.impl; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.telpo.dipperposition.common.*; | |||
import com.telpo.dipperposition.config.NettyServerConfig; | |||
import com.telpo.dipperposition.config.PositionConfig; | |||
import com.telpo.dipperposition.entity.mongo.IpProvinceEntity; | |||
import com.telpo.dipperposition.entity.mongo.ProvinceInfoEntity; | |||
@@ -11,21 +9,12 @@ import com.telpo.dipperposition.service.IDipperAstPosAsyncTaskService; | |||
import com.telpo.dipperposition.service.IProvinceInfoService; | |||
import com.telpo.dipperposition.service.IpProvinceService; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang.StringUtils; | |||
import org.apache.commons.lang3.ObjectUtils; | |||
import org.apache.logging.log4j.util.PropertiesUtil; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.scheduling.annotation.Async; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.util.ResourceUtils; | |||
import java.io.File; | |||
import java.io.FileNotFoundException; | |||
import java.io.UnsupportedEncodingException; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.Objects; | |||
/** | |||
* @program: DipperAstPosAsyncTaskServiceImpl | |||
@@ -71,7 +60,7 @@ public class DipperAstPosAsyncTaskServiceImpl implements IDipperAstPosAsyncTaskS | |||
JSONObject paramObject = new JSONObject(); | |||
String result = okHttpUtil.getJsonParams(buffer.toString(), paramObject.toJSONString()); | |||
if (ObjectUtils.isNotEmpty(result)) { | |||
if (StringUtils.isEmpty(result)) { | |||
if (ObjectUtils.isEmpty(result)) { | |||
log.debug("IP省份获取错误,结果为空"); | |||
return null; | |||
} else { | |||
@@ -226,7 +215,7 @@ public class DipperAstPosAsyncTaskServiceImpl implements IDipperAstPosAsyncTaskS | |||
astCheckSumBuf.insert(0,"0"); | |||
} | |||
checkSum = astCheckSumBuf.toString(); | |||
log.info(checkSum); | |||
//log.info(checkSum); | |||
byte[] astPosCmdBytes = HexConvert.hexStringToBytes(astPosCmdBuf.toString()); | |||
StringBuilder astPosCmdNewBuf = new StringBuilder(); | |||
@@ -1,13 +1,8 @@ | |||
package com.telpo.dipperposition.service.impl; | |||
import com.telpo.dipperposition.common.HexConvert; | |||
import com.telpo.dipperposition.common.SocketClient; | |||
import com.telpo.dipperposition.service.IDipperAstPosAsyncTaskService; | |||
import com.telpo.dipperposition.service.IDipperAstTimeAsyncTaskService; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.scheduling.annotation.Async; | |||
import org.springframework.stereotype.Service; | |||
import java.time.LocalDateTime; | |||
@@ -29,13 +29,11 @@ public class DipperDataAsyncTaskServiceImpl implements IDipperDataAsyncTaskServi | |||
@Autowired | |||
private SchedulingExecutorConfig schedulingExecutorConfig; | |||
@Override | |||
@Async("asyncServiceExecutor") | |||
//@Async("asyncServiceExecutor") | |||
public void pullAstEPH() { | |||
// (1) 发送bds获取星历数据 | |||
String dipperData = pullEPHFromDipper(); | |||
byte[] dipperData = pullEPHFromDipper(); | |||
// (2) 获取星历数据 | |||
if (dipperData == null) { | |||
@@ -47,10 +45,11 @@ public class DipperDataAsyncTaskServiceImpl implements IDipperDataAsyncTaskServi | |||
} | |||
} | |||
private String pullEPHFromDipper() { | |||
private byte[] pullEPHFromDipper() { | |||
// 创建Socket客户端实例; | |||
SocketClient client = new SocketClient(schedulingExecutorConfig.getAstServer(), schedulingExecutorConfig.getEphAstHexPort(),schedulingExecutorConfig.getAstTimeout()); | |||
SocketClient client = new SocketClient(schedulingExecutorConfig.getAstServer(), | |||
schedulingExecutorConfig.getAstEphAstHexPort(),schedulingExecutorConfig.getAstTimeout()); | |||
// astTimeCmd 组装 | |||
String astTimeCmd = DIPPER_ALL_DATA_REQ; | |||
@@ -65,14 +64,15 @@ public class DipperDataAsyncTaskServiceImpl implements IDipperDataAsyncTaskServi | |||
String hexIn = astTimeCmd + checkSum.substring(0,2) + " " + checkSum.substring(2,4); | |||
String ackAckCheckRef = "233E010102000421293C"; | |||
String sendResult = client.sendCmd(hexIn, ackAckCheckRef); | |||
byte[] sendResult = client.sendCmd(hexIn, ackAckCheckRef); | |||
client.closeConnection(); | |||
return sendResult; | |||
} | |||
@Override | |||
public String getAstEPH(){ | |||
return (String)redisUtil.get(DIPPER_DATA_KEY); | |||
public byte[] getAstEPH(){ | |||
// String dipperData = pullEPHFromDipper(); | |||
return (byte[])redisUtil.get(DIPPER_DATA_KEY); | |||
} | |||
} |
@@ -1,22 +1,14 @@ | |||
package com.telpo.dipperposition.service.impl; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.telpo.dipperposition.entity.mongo.IpProvinceEntity; | |||
import com.telpo.dipperposition.entity.mongo.ProvinceInfoEntity; | |||
import com.telpo.dipperposition.mapper.IpProvinceMapper; | |||
import com.telpo.dipperposition.service.IpProvinceService; | |||
import jdk.nashorn.internal.runtime.options.Option; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.ObjectUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.data.domain.Example; | |||
import org.springframework.data.domain.ExampleMatcher; | |||
import org.springframework.data.domain.Page; | |||
import org.springframework.data.domain.PageRequest; | |||
import org.springframework.stereotype.Service; | |||
import tools.BeanTools; | |||
import java.util.List; | |||
import java.util.Optional; | |||
/** | |||
@@ -1,8 +1,5 @@ | |||
package com.telpo.dipperposition.service.impl; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.telpo.dipperposition.entity.mongo.IpProvinceEntity; | |||
import com.telpo.dipperposition.entity.mongo.ProvinceInfoEntity; | |||
import com.telpo.dipperposition.mapper.ProvinceInfoMapper; | |||
import com.telpo.dipperposition.service.IProvinceInfoService; | |||
@@ -11,10 +8,7 @@ import org.apache.commons.lang3.ObjectUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.data.domain.Example; | |||
import org.springframework.data.domain.ExampleMatcher; | |||
import org.springframework.data.domain.Page; | |||
import org.springframework.data.domain.PageRequest; | |||
import org.springframework.stereotype.Service; | |||
import tools.BeanTools; | |||
import java.util.List; | |||
import java.util.Optional; | |||
@@ -1,10 +1,8 @@ | |||
package com.telpo.dipperposition.task; | |||
import com.telpo.dipperposition.controller.DipperDataAsyncTaskController; | |||
import com.telpo.dipperposition.service.IDipperDataAsyncTaskService; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.scheduling.annotation.Scheduled; | |||
import org.springframework.stereotype.Component; | |||
@@ -20,7 +18,7 @@ import org.springframework.stereotype.Component; | |||
public class ScheduleService { | |||
@Autowired | |||
private DipperDataAsyncTaskController dipperDataAsyncTaskController; | |||
private IDipperDataAsyncTaskService dipperDataAsyncTaskService; | |||
/* | |||
* 调用9012端口的接口获取星历数据。 | |||
@@ -33,7 +31,7 @@ public class ScheduleService { | |||
log.info("开始星历数据同步!"); | |||
// 获取推送失败的记录 | |||
try { | |||
dipperDataAsyncTaskController.pullAstEPH(); | |||
dipperDataAsyncTaskService.pullAstEPH(); | |||
} catch (Exception e) { | |||
log.error("执行定时获取星历数据发生异常:", e); | |||
} | |||
@@ -0,0 +1,59 @@ | |||
server.port=8105 | |||
logging.config=classpath:log/logback-spring.xml | |||
logging.level.com.telpo.dipperposition.service.impl=DEBUG | |||
logging.level.com.telpo.dipperposition.service.mapper=DEBUG | |||
spring.application.name=dipperposition-service | |||
spring.redis.database=1 | |||
spring.redis.host=172.19.42.45 | |||
#8090 | |||
spring.redis.port=6389 | |||
spring.redis.password=telpo#1234 | |||
spring.redis.timeout=3000 | |||
spring.redis.lettuce.pool.max-active=100 | |||
# 连接池最大连接数(使用负值表示没有限制) | |||
spring.redis.lettuce.pool.max-idle=100 | |||
# 连接池中的最大空闲连接 | |||
spring.redis.lettuce.pool.min-idle=50 | |||
# 连接池中的最小空闲连接 | |||
spring.redis.lettuce.pool.max-wait=6000 | |||
# 连接池最大阻塞等待时间(使用负值表示没有限制) | |||
spring.data.mongodb.host=172.19.42.45 | |||
spring.data.mongodb.port=27017 | |||
spring.data.mongodb.database=common | |||
spring.data.mongodb.username=wangjx | |||
spring.data.mongodb.password=wangjx#1234 | |||
position-server.serverAddr=172.19.42.45 | |||
position-server.timeAsycPort=9011 | |||
position-server.posAsycPort=9013 | |||
position-server.starsAsycPort=9012 | |||
#等待任务完成退出最大秒数 | |||
scheduler.pool.size=2 | |||
scheduler.pool.await-seconds=600 | |||
scheduler.task.cron=0 */30 * * * * | |||
pos.ipPositionRequestPath=https://restapi.amap.com/v3/ip | |||
pos.ipPositionRequestKey=46eb0eba39494a6e9a90a0dc9e76639e | |||
pos.centerProvince=湖北省 | |||
pos.astServer=agnss.techtotop.com | |||
pos.astPosAstPort=8012 | |||
pos.astEphAstHexPort=9012 | |||
pos.astTimeout=30000 | |||
OkHttp-config.pool.max-conn=200 | |||
OkHttp-config.pool.keep-alive=5 | |||
OkHttp-config.read-timeout=10 | |||
OkHttp-config.conn-timeout=10 | |||
OkHttp-config.write-timeout=10 | |||
async.pool.corePoolSize=4 | |||
async.pool.maxPoolSize=8 | |||
async.pool.queueCapacity=5000 | |||
mongo.datasource.dblist.uri=mongodb://wangjx:wangjx#1234@172.19.42.45:27017/common | |||
mongo.datasource.dblist.database=common | |||
@@ -1,10 +1,79 @@ | |||
server: | |||
port: 8105 | |||
logging: | |||
config: classpath:log/logback-spring.xml | |||
level: | |||
com: | |||
telpo: | |||
dipperposition: | |||
service: | |||
impl: debug | |||
mapper: debug | |||
org.springframework.data.mongodb.core.MongoTemplate: DEBUG | |||
spring: | |||
main: | |||
allow-bean-definition-overriding: true | |||
application: | |||
name: dipperposition-service | |||
cloud: | |||
nacos: | |||
config: | |||
server-addr: 172.19.42.38:8848 | |||
file-extension: yml | |||
redis: | |||
database: 1 | |||
host: 172.19.42.45 | |||
#8090 | |||
port: 6379 | |||
password: telpo#1234 | |||
timeout: 3000 | |||
lettuce: | |||
pool: | |||
max-active: 100 # 连接池最大连接数(使用负值表示没有限制) | |||
max-idle: 100 # 连接池中的最大空闲连接 | |||
min-idle: 50 # 连接池中的最小空闲连接 | |||
max-wait: 6000 # 连接池最大阻塞等待时间(使用负值表示没有限制) | |||
data: | |||
mongodb: | |||
host: 172.19.42.45 | |||
port: 27017 | |||
database: common | |||
username: wangjx | |||
password: wangjx#1234 | |||
mongo: | |||
datasource: | |||
dblist: | |||
- uri: mongodb://wangjx:wangjx#1234@172.19.42.45:27015/common | |||
database: common | |||
scheduler: | |||
pool: | |||
size: 2 | |||
#等待任务完成退出最大秒数 | |||
await-seconds: 600 | |||
task: | |||
cron: "0 */30 * * * *" | |||
pos: | |||
ipPositionRequestPath: https://restapi.amap.com/v3/ip | |||
ipPositionRequestKey: 46eb0eba39494a6e9a90a0dc9e76639e | |||
centerProvince: 湖北省 | |||
astServer: agnss.techtotop.com | |||
astPosAstPort: 8012 | |||
astEphAstHexPort: 9012 | |||
astTimeout: 30000 | |||
position-server: | |||
serverAddr: 172.19.42.45 | |||
timeAsycPort: 9011 | |||
posAsycPort: 9013 | |||
starsAsycPort: 9012 | |||
OkHttp-config: | |||
pool: | |||
max-conn: 200 | |||
keep-alive: 5 | |||
read-timeout: 10 | |||
conn-timeout: 10 | |||
write-timeout: 10 | |||
async: | |||
pool: | |||
corePoolSize: 4 | |||
maxPoolSize: 8 | |||
queueCapacity: 5000 |
@@ -1,10 +1,87 @@ | |||
server: | |||
port: 8105 | |||
logging: | |||
config: classpath:log/logback-spring.xml | |||
level: | |||
com: | |||
telpo: | |||
dipperposition: | |||
service: | |||
impl: debug | |||
mapper: debug | |||
org.springframework.data.mongodb.core.MongoTemplate: DEBUG | |||
spring: | |||
main: | |||
allow-bean-definition-overriding: true | |||
application: | |||
name: dipperposition-service | |||
cloud: | |||
nacos: | |||
config: | |||
server-addr: 172.19.42.44:8848 | |||
file-extension: yml | |||
namespace: fee328ef-7348-4984-879a-fd75f9f59cd2 | |||
redis: | |||
database: 1 | |||
host: 172.19.42.44 | |||
#8090 | |||
port: 8090 | |||
password: telpo#1234 | |||
timeout: 3000 | |||
lettuce: | |||
pool: | |||
max-active: 100 # 连接池最大连接数(使用负值表示没有限制) | |||
max-idle: 100 # 连接池中的最大空闲连接 | |||
min-idle: 50 # 连接池中的最小空闲连接 | |||
max-wait: 6000 # 连接池最大阻塞等待时间(使用负值表示没有限制) | |||
data: | |||
mongodb: | |||
host: 172.19.42.40 | |||
port: 27018 | |||
database: common | |||
username: wangjx | |||
password: wangjx#1234 | |||
mongo: | |||
datasource: | |||
dblist: | |||
- uri: mongodb://wangjx:wangjx#1234@172.19.42.40:27018/common | |||
database: common | |||
- uri: mongodb://wangjx:wangjx#1234@172.19.42.40:27018/basicdata | |||
database: basicdata | |||
scheduler: | |||
pool: | |||
size: 2 | |||
#等待任务完成退出最大秒数 | |||
await-seconds: 600 | |||
task: | |||
cron: "0 */30 * * * *" | |||
pos: | |||
centerProvinceFilePath: /csv/provinceLonAlt.csv | |||
ipPositionRequestPath: https://restapi.amap.com/v3/ip | |||
ipPositionRequestKey: 46eb0eba39494a6e9a90a0dc9e76639e | |||
centerProvince: 湖北省 | |||
astServer: agnss.techtotop.com | |||
astPosAstPort: 8012 | |||
astEphAstHexPort: 9012 | |||
astTimeout: 30000 | |||
position-server: | |||
serverAddr: 172.19.42.44 | |||
timeAsycPort: 9011 | |||
posAsycPort: 9013 | |||
starsAsycPort: 9012 | |||
OkHttp-config: | |||
pool: | |||
max-conn: 200 | |||
keep-alive: 5 | |||
read-timeout: 10 | |||
conn-timeout: 10 | |||
write-timeout: 10 | |||
async: | |||
pool: | |||
corePoolSize: 4 | |||
maxPoolSize: 8 | |||
queueCapacity: 5000 |
@@ -58,7 +58,6 @@ mongo: | |||
- uri: mongodb://wangjx:wangjx#1234@172.16.192.26:27017/common | |||
database: common | |||
OkHttp-config: | |||
pool: | |||
max-conn: 200 | |||