浏览代码

优化代码

ssk 3 周之前
父节点
当前提交
2fbbecfabe
共有 4 个文件被更改,包括 57 次插入51 次删除
  1. 31 22
      alien-second/pom.xml
  2. 0 11
      alien-store/pom.xml
  3. 1 1
      alien-store/src/main/java/shop/alien/store/service/impl/StoreInfoServiceImpl.java
  4. 25 17
      pom.xml

+ 31 - 22
alien-second/pom.xml

@@ -9,7 +9,7 @@
     </parent>
 
     <artifactId>alien-second</artifactId>
-    <version>0.0.1-SNAPSHOT</version>
+    <version>1.0.0</version>
     <name>alien-second</name>
     <description>爱丽恩二手项目</description>
 
@@ -201,31 +201,21 @@
         <dependency>
             <groupId>com.auth0</groupId>
             <artifactId>java-jwt</artifactId>
-            <version>3.4.0</version>
         </dependency>
 
-        <!--        <dependency>-->
-        <!--            <groupId>org.bytedeco</groupId>-->
-        <!--            <artifactId>javacv-platform</artifactId>-->
-        <!--            <version>1.5.5</version> &lt;!&ndash; 请使用最新版本 &ndash;&gt;-->
-        <!--        </dependency>-->
-
         <dependency>
             <groupId>com.alipay.sdk</groupId>
             <artifactId>alipay-sdk-java</artifactId>
-            <version>4.40.8.ALL</version>
         </dependency>
 
         <dependency>
             <groupId>com.aliyun</groupId>
             <artifactId>dysmsapi20170525</artifactId>
-            <version>3.1.0</version>
         </dependency>
 
         <dependency>
             <groupId>com.netease.yidun</groupId>
             <artifactId>yidun-java-sdk</artifactId>
-            <version>1.4.11</version>
         </dependency>
 
         <dependency>
@@ -276,7 +266,6 @@
             <groupId>shop.alien</groupId>
             <artifactId>alien-util</artifactId>
             <version>1.0.0</version>
-            <scope>compile</scope>
         </dependency>
 
     </dependencies>
@@ -285,31 +274,51 @@
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>3.8.1</version>
-                <configuration>
-                    <source>1.8</source>
-                    <target>1.8</target>
-                    <encoding>UTF-8</encoding>
-                </configuration>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <version>3.1.2</version> <!-- 使用最新版本 -->
+                <executions>
+                    <execution>
+                        <id>copy-dependencies</id>
+                        <phase>prepare-package</phase> <!-- 在package之前执行 -->
+                        <goals>
+                            <goal>copy-dependencies</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/lib</outputDirectory> <!-- 指定输出目录 -->
+                            <includeScope>runtime</includeScope> <!-- 仅包含运行时依赖 -->
+                        </configuration>
+                    </execution>
+                </executions>
             </plugin>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
-                <version>${spring-boot.version}</version>
                 <configuration>
                     <mainClass>shop.alien.second.AlienSecondApplication</mainClass>
-                    <skip>true</skip>
+                    <layout>ZIP</layout>
+                    <includes>
+                        <include>
+                            <groupId>nothing</groupId>
+                            <artifactId>nothing</artifactId>
+                        </include>
+                    </includes>
                 </configuration>
                 <executions>
                     <execution>
-                        <id>repackage</id>
                         <goals>
                             <goal>repackage</goal>
                         </goals>
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>8</source>
+                    <target>8</target>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 

+ 0 - 11
alien-store/pom.xml

@@ -199,32 +199,21 @@
         <dependency>
             <groupId>com.auth0</groupId>
             <artifactId>java-jwt</artifactId>
-            <version>3.4.0</version>
         </dependency>
 
-        <!--        <dependency>-->
-        <!--            <groupId>org.bytedeco</groupId>-->
-        <!--            <artifactId>javacv-platform</artifactId>-->
-        <!--            <version>1.5.5</version> &lt;!&ndash; 请使用最新版本 &ndash;&gt;-->
-        <!--        </dependency>-->
-
-
         <dependency>
             <groupId>com.alipay.sdk</groupId>
             <artifactId>alipay-sdk-java</artifactId>
-            <version>4.40.8.ALL</version>
         </dependency>
 
         <dependency>
             <groupId>com.aliyun</groupId>
             <artifactId>dysmsapi20170525</artifactId>
-            <version>3.1.0</version>
         </dependency>
 
         <dependency>
             <groupId>com.netease.yidun</groupId>
             <artifactId>yidun-java-sdk</artifactId>
-            <version>1.4.11</version>
         </dependency>
 
         <dependency>

+ 1 - 1
alien-store/src/main/java/shop/alien/store/service/impl/StoreInfoServiceImpl.java

@@ -866,7 +866,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
         result.setStorePositionLatitude(result.getStorePosition().split(",")[1]);
 
         // 设置距离
-        if ((jingdu != null && !jingdu.isEmpty()) && (weidu != null && !weidu.isEmpty())) {
+        if (StringUtils.isNotEmpty(jingdu) && StringUtils.isNotEmpty(weidu)) {
             double storeJing = Double.parseDouble(result.getStorePosition().split(",")[0]);
             double storeWei = Double.parseDouble(result.getStorePosition().split(",")[1]);
             double storeDistance = DistanceUtil.haversineCalculateDistance(Double.parseDouble(jingdu), Double.parseDouble(weidu), storeJing, storeWei);

+ 25 - 17
pom.xml

@@ -83,6 +83,19 @@
                 <artifactId>fastjson</artifactId>
                 <version>2.0.7</version>
             </dependency>
+
+            <dependency>
+                <groupId>com.aliyun</groupId>
+                <artifactId>dysmsapi20170525</artifactId>
+                <version>3.1.0</version>
+            </dependency>
+
+            <dependency>
+                <groupId>com.alipay.sdk</groupId>
+                <artifactId>alipay-sdk-java</artifactId>
+                <version>4.40.8.ALL</version>
+            </dependency>
+
             <!--Alibaba End-->
 
             <!--Apache Start-->
@@ -334,6 +347,18 @@
                 <version>1.1.6</version>
             </dependency>
 
+            <dependency>
+                <groupId>com.netease.yidun</groupId>
+                <artifactId>yidun-java-sdk</artifactId>
+                <version>1.4.11</version>
+            </dependency>
+
+            <dependency>
+                <groupId>com.auth0</groupId>
+                <artifactId>java-jwt</artifactId>
+                <version>3.4.0</version>
+            </dependency>
+
             <!--Other End-->
         </dependencies>
     </dependencyManagement>
@@ -344,24 +369,7 @@
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <version>2.3.2.RELEASE</version>
-<!--                <configuration>-->
-<!--                    <fork>true</fork>-->
-<!--                    <addResources>true</addResources>-->
-<!--                </configuration>-->
             </plugin>
-<!--            <plugin>-->
-<!--                <groupId>org.apache.maven.plugins</groupId>-->
-<!--                <artifactId>maven-compiler-plugin</artifactId>-->
-<!--                <configuration>-->
-<!--                    <source>8</source>-->
-<!--                    <target>8</target>-->
-<!--                    <basedir/>-->
-<!--                    <buildDirectory/>-->
-<!--                    <mainOutputDirectory/>-->
-<!--                    <outputDirectory/>-->
-<!--                    <projectArtifact/>-->
-<!--                </configuration>-->
-<!--            </plugin>-->
         </plugins>
     </build>
 </project>