瀏覽代碼

Merge branch 'master' into rpt

fengyanjie@sagacloud.cn 4 年之前
父節點
當前提交
9bff85b3f6

+ 1 - 5
dmp-admin/src/main/java/com/persagy/dmp/admin/jms/executor/TransObjectExecutor.java

@@ -58,17 +58,13 @@ public class TransObjectExecutor implements MessageExecutor {
 			// 处理失效数据
 			transObjectService.transInvalidObject(ctx);
 
-
 		} catch (Exception e) {
-			e.printStackTrace();
+			transObjectService.error(ctx, e.getMessage());
 		} finally {
 			transObjectService.over(ctx);
 		}
-
-
 	}
 
-
 	private TransObjectContext prepareContext(DmpMessage message) {
 		String groupCode = message.getGroupCode();
 		String projectId = message.getProjectId();

+ 4 - 0
dmp-admin/src/main/java/com/persagy/dmp/admin/service/DmpTransObjectService.java

@@ -285,6 +285,10 @@ public class DmpTransObjectService {
         transUtils.transInvalidObject(ctx);
     }
 
+    public void error(TransObjectContext context, String message) {
+        transUtils.writeInfo(context, "error", message);
+    }
+
     public void over(TransObjectContext context) {
         transUtils.writeInfo(context, "over", null);
         String key = KEY_TRANS + context.getProjectId();

+ 128 - 16
dmp-alarm/pom.xml

@@ -112,22 +112,21 @@
         <finalName>dmp-alarm</finalName>
         <plugins>
             <plugin>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-maven-plugin</artifactId>
-            <configuration>
-                <fork>true</fork>
-                <jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
-            </configuration>
-            <executions>
-                <execution>
-                    <goals>
-                        <goal>repackage</goal>
-                    </goals>
-                </execution>
-            </executions>
-        </plugin>
-            <!--
-            -->
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <fork>true</fork>
+                    <jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+
             <plugin>
                 <groupId>com.mysema.maven</groupId>
                 <artifactId>apt-maven-plugin</artifactId>
@@ -145,6 +144,119 @@
                     </execution>
                 </executions>
             </plugin>
+
+            <!-- 按照测试要求打成zip需要的配置 -->
+            <!--获取git信息-->
+            <plugin>
+                <groupId>pl.project13.maven</groupId>
+                <artifactId>git-commit-id-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>revision</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <verbose>true</verbose>
+                    <dateFormat>yyyyMMddHHmm</dateFormat>
+                    <generateGitPropertiesFile>true</generateGitPropertiesFile>
+                    <!--<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>-->
+                    <generateGitPropertiesFilename>target/git.properties</generateGitPropertiesFilename>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>com.coderplus.maven.plugins</groupId>
+                <artifactId>copy-rename-maven-plugin</artifactId>
+                <version>1.0.1</version>
+                <executions>
+                    <execution>
+                        <id>rename-file</id>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>rename</goal>
+                        </goals>
+                        <configuration>
+                            <sourceFile>${project.build.directory}/git.properties</sourceFile>
+                            <destinationFile>${project.build.directory}/version.txt</destinationFile>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <!--拷贝资源文件 copy-resources-->
+            <plugin>
+                <artifactId>maven-resources-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy-resources</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <resources>
+                                <resource>
+                                    <directory>src/main/resources/</directory>
+                                    <includes>
+                                        <include>**/*.yml</include>
+                                    </includes>
+                                </resource>
+                                <resource>
+                                    <directory>${project.build.directory}</directory>
+                                    <includes>
+                                        <include>**/version.txt</include>
+                                    </includes>
+                                </resource>
+                            </resources>
+                            <outputDirectory>${project.build.directory}/config</outputDirectory>
+                        </configuration>
+                    </execution>
+                    <!--拷贝启动脚本-->
+                    <execution>
+                        <id>copy-version</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <resources>
+                                <resource>
+                                    <directory>src/script</directory>
+                                </resource>
+                            </resources>
+                            <outputDirectory>${project.build.directory}</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <!-- 打包压缩 -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>make-assembly</id>
+                        <!-- 当执行mvn package时才会打包 -->
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <configuration>
+                            <finalName>
+                                ${project.artifactId}_${git.commit.time}_git_${git.branch}_${git.commit.id.abbrev}
+                            </finalName>
+                            <!--不包含assembly id-->
+                            <appendAssemblyId>false</appendAssemblyId>
+                            <!--输出路径-->
+                            <!--<outputDirectory>../target/co_search-${project.version}</outputDirectory>-->
+                            <descriptors>
+                                <descriptor>src/script/zip.xml</descriptor>
+                            </descriptors>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
 </project>

+ 1 - 0
dmp-alarm/src/main/java/com/persagy/dmp/alarm/service/AlarmRecordService.java

@@ -241,6 +241,7 @@ public class AlarmRecordService extends AlarmBaseService {
         msg.setProjectId(DmpParameterStorage.getProjectId());
         msg.setTargetId(alarmRecord.getId());
         msg.add("obj", JacksonMapper.toSimpleJson(alarmRecord));
+//        msg.add("obj", alarmRecord);
         msg.setAppId(DmpParameterStorage.getAppId());
         msg.setSendTime(DateUtils.format(new Date()));
         response.add(msg);

+ 2 - 0
dmp-alarm/src/main/java/com/persagy/dmp/alarm/service/PhysicalWorldService.java

@@ -31,6 +31,7 @@ public class PhysicalWorldService {
             @NotNull String classCode) throws Exception {
         JacksonCriteria criteria = JacksonCriteria.newInstance();
         criteria.add("classCode", classCode);
+        criteria.add("valid", 1);
         PagedResponse<ObjectNode> objectNodePagedResponse = physicalWorldClient.queryObj(projectId, groupCode, criteria);
         log.info("物理世界查询对象返回值:", objectNodePagedResponse == null ? null : objectNodePagedResponse.toString());
         List<ObjectNode> data = objectNodePagedResponse.getData();
@@ -59,6 +60,7 @@ public class PhysicalWorldService {
             @NotNull List<String> classCodes) throws Exception {
         JacksonCriteria criteria = JacksonCriteria.newInstance();
         criteria.add("classCode", classCodes);
+        criteria.add("valid", 1);
         PagedResponse<ObjectNode> objectNodePagedResponse = physicalWorldClient.queryObj(projectId, groupCode, criteria);
         log.info("物理世界查询对象返回值:", objectNodePagedResponse == null ? null : objectNodePagedResponse.toString());
         List<ObjectNode> data = objectNodePagedResponse.getData();

+ 5 - 3
dmp-alarm/src/main/resources/bootstrap.yml

@@ -2,9 +2,11 @@ spring:
   application:
     name: dmp-alarm
   profiles:
-    active:
-      - dev
+    active: log-dev
   cloud:
     config:
       profile: dev
-      uri: http://192.168.100.107:9932
+      uri: http://192.168.100.107:9932
+persagy:
+  log:
+    path: ../logs/dmp-alarm/

+ 4 - 0
dmp-alarm/src/script/start.bat

@@ -0,0 +1,4 @@
+@ECHO OFF&PUSHD %~DP0 &TITLE dmp-alarm
+@ECHO 根据情况使用内存限制 命令为:
+@ECHO java -jar -Xms500m -Xmx1024m -Dfile.encoding=utf-8 dmp-alarm.jar
+java -jar -Xms500m -Xmx1024m -Dfile.encoding=utf-8 -DCONFIG_FILE_PATH=D:\SpringCloud dmp-alarm.jar

+ 6 - 0
dmp-alarm/src/script/start.sh

@@ -0,0 +1,6 @@
+#!/bin/sh
+# 根据情况使用内存限制 命令为:
+# nohup java -jar -Xms500m -Xmx1024m -Dfile.encoding=utf-8 dmp-alarm.jar >/dev/null 2>&1 &
+nohup java -jar -Xms500m -Xmx4096m -Dfile.encoding=utf-8 -DCONFIG_FILE_PATH=/mnt/data/SpringCloud dmp-alarm.jar >/dev/null 2>&1 &
+sleep 2
+tail -f ../logs/dmp-alarm/log.log

+ 23 - 0
dmp-alarm/src/script/zip.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<assembly
+        xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/3.1.1"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/3.1.1 http://maven.apache.org/xsd/assembly-3.1.1.xsd">
+    <id>dev</id>
+    <formats>
+        <format>zip</format>
+    </formats>
+    <includeBaseDirectory>false</includeBaseDirectory>
+    <fileSets>
+        <fileSet>
+            <directory>${basedir}/target/</directory>
+            <includes>
+                <include>config/</include>
+                <include>*.jar</include>
+                <include>start.bat</include>
+                <include>start.sh</include>
+            </includes>
+            <outputDirectory>/</outputDirectory>
+        </fileSet>
+    </fileSets>
+</assembly>

+ 113 - 0
dmp-dic/pom.xml

@@ -110,6 +110,119 @@
                     </execution>
                 </executions>
             </plugin>
+
+            <!-- 按照测试要求打成zip需要的配置 -->
+            <!--获取git信息-->
+            <plugin>
+                <groupId>pl.project13.maven</groupId>
+                <artifactId>git-commit-id-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>revision</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <verbose>true</verbose>
+                    <dateFormat>yyyyMMddHHmm</dateFormat>
+                    <generateGitPropertiesFile>true</generateGitPropertiesFile>
+                    <!--<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>-->
+                    <generateGitPropertiesFilename>target/git.properties</generateGitPropertiesFilename>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>com.coderplus.maven.plugins</groupId>
+                <artifactId>copy-rename-maven-plugin</artifactId>
+                <version>1.0.1</version>
+                <executions>
+                    <execution>
+                        <id>rename-file</id>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>rename</goal>
+                        </goals>
+                        <configuration>
+                            <sourceFile>${project.build.directory}/git.properties</sourceFile>
+                            <destinationFile>${project.build.directory}/version.txt</destinationFile>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <!--拷贝资源文件 copy-resources-->
+            <plugin>
+                <artifactId>maven-resources-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy-resources</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <resources>
+                                <resource>
+                                    <directory>src/main/resources/</directory>
+                                    <includes>
+                                        <include>**/*.yml</include>
+                                    </includes>
+                                </resource>
+                                <resource>
+                                    <directory>${project.build.directory}</directory>
+                                    <includes>
+                                        <include>**/version.txt</include>
+                                    </includes>
+                                </resource>
+                            </resources>
+                            <outputDirectory>${project.build.directory}/config</outputDirectory>
+                        </configuration>
+                    </execution>
+                    <!--拷贝启动脚本-->
+                    <execution>
+                        <id>copy-version</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <resources>
+                                <resource>
+                                    <directory>src/script</directory>
+                                </resource>
+                            </resources>
+                            <outputDirectory>${project.build.directory}</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <!-- 打包压缩 -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>make-assembly</id>
+                        <!-- 当执行mvn package时才会打包 -->
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <configuration>
+                            <finalName>
+                                ${project.artifactId}_${git.commit.time}_git_${git.branch}_${git.commit.id.abbrev}
+                            </finalName>
+                            <!--不包含assembly id-->
+                            <appendAssemblyId>false</appendAssemblyId>
+                            <!--输出路径-->
+                            <!--<outputDirectory>../target/co_search-${project.version}</outputDirectory>-->
+                            <descriptors>
+                                <descriptor>src/script/zip.xml</descriptor>
+                            </descriptors>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
 

+ 7 - 1
dmp-dic/src/main/resources/bootstrap.yml

@@ -1,7 +1,13 @@
 spring:
   application:
     name: dmp-dic
+  profiles:
+    active: log-dev
   cloud:
     config:
       profile: dev
-      uri: http://localhost:9932
+      uri: http://localhost:9932
+
+persagy:
+  log:
+    path: ../logs/dmp-dic/

+ 4 - 0
dmp-dic/src/script/start.bat

@@ -0,0 +1,4 @@
+@ECHO OFF&PUSHD %~DP0 &TITLE dmp-dic
+@ECHO 根据情况使用内存限制 命令为:
+@ECHO java -jar -Xms500m -Xmx1024m -Dfile.encoding=utf-8 dmp-dic.jar
+java -jar -Xms500m -Xmx1024m -Dfile.encoding=utf-8 -DCONFIG_FILE_PATH=D:\SpringCloud dmp-dic.jar

+ 6 - 0
dmp-dic/src/script/start.sh

@@ -0,0 +1,6 @@
+#!/bin/sh
+# 根据情况使用内存限制 命令为:
+# nohup java -jar -Xms500m -Xmx1024m -Dfile.encoding=utf-8 dmp-dic.jar >/dev/null 2>&1 &
+nohup java -jar -Xms500m -Xmx4096m -Dfile.encoding=utf-8 -DCONFIG_FILE_PATH=/mnt/data/SpringCloud dmp-dic.jar >/dev/null 2>&1 &
+sleep 2
+tail -f ../logs/dmp-dic/log.log

+ 23 - 0
dmp-dic/src/script/zip.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<assembly
+        xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/3.1.1"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/3.1.1 http://maven.apache.org/xsd/assembly-3.1.1.xsd">
+    <id>dev</id>
+    <formats>
+        <format>zip</format>
+    </formats>
+    <includeBaseDirectory>false</includeBaseDirectory>
+    <fileSets>
+        <fileSet>
+            <directory>${basedir}/target/</directory>
+            <includes>
+                <include>config/</include>
+                <include>*.jar</include>
+                <include>start.bat</include>
+                <include>start.sh</include>
+            </includes>
+            <outputDirectory>/</outputDirectory>
+        </fileSet>
+    </fileSets>
+</assembly>