Ver Fonte

add pom.xml

rainbow954 há 7 anos atrás
pai
commit
38b0bae6e8

+ 63 - 2
pom.xml

@@ -23,7 +23,29 @@
 		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
 		<java.version>1.8</java.version>
 	</properties>
-
+	<profiles>
+        <profile>
+            <id>dev</id>
+            <properties>
+                <env>dev</env>
+            </properties>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+        </profile>
+        <profile>
+            <id>test</id>
+            <properties>
+                <env>test</env>
+            </properties>
+        </profile>
+        <profile>
+            <id>prod</id>
+            <properties>
+                <env>prod</env>
+            </properties>
+        </profile>
+    </profiles>
 	<dependencies>
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
@@ -84,15 +106,54 @@
 		</dependency>
 	</dependencies>
 
+	
 	<build>
 		<finalName>data-acceptance</finalName>
+		<resources>
+            <resource>
+                <directory>${project.basedir}/src/main/resources</directory>
+                <excludes>
+                    <exclude>dev/**</exclude>
+                    <exclude>test/**</exclude>
+                    <exclude>prod/**</exclude>
+                </excludes>
+                <filtering>false</filtering>
+            </resource>
+            <resource>
+                <directory>${project.basedir}/src/main/resources/${env}</directory>
+                <filtering>false</filtering>
+            </resource>
+        </resources>
 		<plugins>
 			<plugin>
 				<groupId>org.springframework.boot</groupId>
 				<artifactId>spring-boot-maven-plugin</artifactId>
 			</plugin>
+			<plugin>
+				<artifactId>maven-resources-plugin</artifactId>
+				<version>2.5</version>
+				<configuration>
+					<encoding>UTF-8</encoding>
+				</configuration>
+				<executions>
+					<execution>
+						<id>copy-bin</id>
+						<phase>package</phase>
+						<goals>
+							<goal>copy-resources</goal>
+						</goals>
+						<configuration>
+							<outputDirectory>${project.build.directory}</outputDirectory>
+							<resources>
+								<resource>
+									<directory>src/bin</directory>
+								</resource>
+							</resources>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
 		</plugins>
 	</build>
 
-
 </project>

+ 4 - 0
src/bin/start.sh

@@ -0,0 +1,4 @@
+#!/bin/bash
+nohup java -Dspring.profiles.active=all -jar data-acceptance.jar > /dev/null &
+
+

+ 2 - 0
src/bin/stop.sh

@@ -0,0 +1,2 @@
+#!/bin/bash
+kill  `ps -ef|grep data-transfer.jar| grep -v grep| awk '{print $2}'`

+ 0 - 86
src/main/resources/application.yml

@@ -1,86 +0,0 @@
-spring:
-  application:
-    name: device-acceptance
-  kafka:
-    bootstrap-servers: 192.168.0.119:9092
-  redis:
-    host: 192.168.0.119
-    password: tidecloudredis
-    timeout: 10000
-    port: 6379
-    max: 100
-    maxIdle: 10
-    minIdle: 3
-    maxWaitMills: 10000
-eureka:
-  client:
-    service-url:
-      defaultZone: http://192.168.0.118:12000/eureka
-  instance:
-    prefer-ip-address: true
-  port: 16666
-  localaddress: 10.27.118.76
-
-acceptance:
- device:
-  deviceList:
-   -
-    name: watch
-    topic: device-watch
-    ip: 10.27.118.76
-    port: 7009
-    dataFileDir: /home/service/collector_watch/rawdata/
-    handlerClass: com.tidecloud.dataacceptance.service.impl.WatchServerHandler
-    enable: true
-    
-   -
-    name: bingshui
-    topic: device-bingshui
-    ip: 10.27.118.76
-    port: 7510
-    dataFileDir: /home/service/collector_7510/rawdata/
-    handlerClass: com.tidecloud.dataacceptance.service.impl.BingShuiGpsServerHandler
-    enable: false
-    
-   -
-    name: bsj
-    topic: device-bsj
-    ip: 10.25.19.87
-    port: 6707
-    dataFileDir: /home/service/collector_6707/rawdata/
-    handlerClass: com.tidecloud.dataacceptance.service.impl.BSJGpsServerHandler
-    enable: false
-    
-   -
-    name: yitong
-    topic: device-yitong
-    ip: 10.27.118.76
-    port: 7011
-    dataFileDir: /home/service/collector_yitong/rawdata-car/
-    handlerClass: com.tidecloud.dataacceptance.service.impl.YiTongGpsServerHandler
-    enable: false    
-   -
-    name: yuguang
-    topic: device-yuguang
-    ip: 10.27.118.76
-    port: 7510
-    dataFileDir: /home/service/collector_7510/rawdata/
-    handlerClass: com.tidecloud.dataacceptance.service.impl.YuGuangGpsServerHandler
-    enable: false       
-
-   -
-    name: vorgea
-    topic: device-vorgea
-    ip: 10.27.118.76
-    port: 7511
-    dataFileDir: /home/service/collector_vorgea/rawdata/
-    handlerClass: com.tidecloud.dataacceptance.service.impl.VorgeaUR0401ServerHandler
-    enable: false         
-      
-logging:
-  config:
-    classpath: logback.xml
-
-
-
-

+ 8 - 0
src/main/resources/prod/application.yml

@@ -3,6 +3,8 @@ spring:
     name: device-acceptance
   kafka:
     bootstrap-servers: 10.25.48.95:9092
+  profiles:
+    active: all  
   redis:
     host: 10.25.48.128
     password: tidecloudredis
@@ -21,6 +23,12 @@ eureka:
   port: 16666
   localaddress: 10.27.118.76
 
+---
+spring:
+  profiles: all
+  application:
+    name: acceptance-product
+    
 acceptance:
  device:
   deviceList:

+ 2 - 2
src/test/java/com/tidecloud/dataacceptance/HelloClientIntHandler.java

@@ -51,9 +51,9 @@ public class HelloClientIntHandler extends ChannelInboundHandlerAdapter {
         		,0x00 ,0x00 ,0x00 ,0x00 ,0x2B ,0x04 ,0x4B ,0x7D ,0x02 ,0x01 ,(byte)0xD9 ,0x30 ,0x01 ,0x1C ,0x31 ,0x01 ,0x0F ,0x13 ,0x7E
         		
         };
-        String msg1 = "[3G*3925079946*0116*UD2,070418,155939,V,38.034930,N,114.4015300,E,0.00,0.0,0.0,0,60,52,4,0,00000010,7,255,460,0,12447,45388,132,12500,40896,127,12500,10589,125,12500,40897,122,13000,40087,121,12500,47974,120,12500,49241,120,2,TP-LINK_5AEC,b0:95:8e:d7:5a:ec,-94,guojiahuan,50:bd:5f:7b:af:7c,-85,13.1]";
+        String message = "[3G*3925079946*0116*UD2,070418,155939,V,38.034930,N,114.4015300,E,0.00,0.0,0.0,0,60,52,4,0,00000010,7,255,460,0,12447,45388,132,12500,40896,127,12500,10589,125,12500,40897,122,13000,40087,121,12500,47974,120,12500,49241,120,2,TP-LINK_5AEC,b0:95:8e:d7:5a:ec,-94,guojiahuan,50:bd:5f:7b:af:7c,-85,13.1]";
 		
-       String message = "[3G*3925160519*00A1*UD,040418,101823,A,29.719760,N,119.6245500,E,2.81,49.2,0.0,3,71,9,0,0,00000011,4,255,460,0,22463,34421,130,22463,24421,120,22575,14074,119,22463,34961,113,0,78.8]";
+      // String message = "[3G*3925160519*00A1*UD,040418,101823,A,29.719760,N,119.6245500,E,2.81,49.2,0.0,3,71,9,0,0,00000011,4,255,460,0,22463,34421,130,22463,24421,120,22575,14074,119,22463,34961,113,0,78.8]";
 //      byte[] a=  {0x02,0x00,0x00,0x35,0x01,0x23,0x12,0x31,0x23,0x12,0x07,0x5D,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x13,0x01,
 //    		  0x8D,0x6D,0xB4,0x07,0x1B,0x08,
 //    		  0x8A,0x00,0x37,0x00,0x00,0x00,0xFC,0x18,0x03,0x30,0x14,0x27,0x37,0x01,0x04,0x00,0x00,0x00,0x00,0x03,0x02,0x00,0x00,