From 18087f533cd48ddb9f972c0848ffe920ec58ee8e Mon Sep 17 00:00:00 2001
From: kongdeqiang <123456>
Date: 星期一, 26 九月 2022 16:01:14 +0800
Subject: [PATCH] 修改打包和app

---
 src/main/java/com/boying/service/OutParkService.java       |    4 +-
 src/main/java/com/boying/dao/OutParkDao.java               |    8 ++--
 pom.xml                                                    |   83 +++++++++++++++++++++++++++++++++++++++++
 src/main/java/com/boying/controller/BarrierController.java |    8 +++-
 4 files changed, 95 insertions(+), 8 deletions(-)

diff --git a/pom.xml b/pom.xml
index 83d2120..c89597e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,6 +63,89 @@
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
             </plugin>
+            <plugin>
+                <groupId>io.fabric8</groupId>
+                <artifactId>docker-maven-plugin</artifactId>
+            </plugin>
+            <!--涓婄嚎閮ㄧ讲 JAR鍚姩鍒嗙渚濊禆lib鍜岄厤缃�-->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-resources-plugin</artifactId>
+                <version>3.1.0</version>
+            </plugin>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <!--涓嶆墦鍖呰祫婧愭枃浠�-->
+                    <excludes>
+                        <exclude>*.**</exclude>
+                    </excludes>
+                    <archive>
+                        <manifest>
+                            <addClasspath>true</addClasspath>
+                            <classpathPrefix>lib/</classpathPrefix>
+                            <!--jar鍖呬笉鍖呭惈鍞竴鐗堟湰鏍囪瘑-->
+                            <useUniqueVersions>false</useUniqueVersions>
+                            <!--绋嬪簭鍚姩绫籥pplication.java鐨勮矾寰�-->
+                            <mainClass>com.boying.FfparkApplication</mainClass>
+                        </manifest>
+                        <!-- 鎸囧畾閰嶇疆鏂囦欢鐩綍锛岃繖鏍穓ar杩愯鏃朵細鍘绘壘鍒板悓鐩綍涓嬬殑config鏂囦欢澶逛笅鏌ユ壘 -->
+                        <manifestEntries>
+                            <Class-Path>config/</Class-Path>
+                        </manifestEntries>
+                    </archive>
+                    <outputDirectory>1-running/</outputDirectory>
+                </configuration>
+            </plugin>
+            <!--鎷疯礉渚濊禆 copy-dependencies-->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy-dependencies</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>copy-dependencies</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>
+                                1-running/lib/
+                            </outputDirectory>
+                        </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>
+                                    <!-- 鎸囧畾鍙備笌鏋勫缓鐨剅esoures-->
+                                    <includes>
+                                        <include>*.**</include>
+                                    </includes>
+                                </resource>
+                            </resources>
+                            <outputDirectory>1-running/config</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
 
diff --git a/src/main/java/com/boying/controller/BarrierController.java b/src/main/java/com/boying/controller/BarrierController.java
index 9fb68f6..4324835 100644
--- a/src/main/java/com/boying/controller/BarrierController.java
+++ b/src/main/java/com/boying/controller/BarrierController.java
@@ -12,12 +12,14 @@
 import com.boying.service.EnterParkService;
 import com.boying.service.OutParkService;
 import com.boying.service.ParkService;
+import io.netty.util.internal.ObjectUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageRequest;
 import org.springframework.data.domain.Pageable;
 import org.springframework.data.domain.Sort;
 import org.springframework.data.jpa.domain.Specification;
+import org.springframework.util.ObjectUtils;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -142,8 +144,10 @@
                if(type == null || type == 0){
                    //鍙栨秷璁¤垂
                    OutPark outPark = outParkService.findByCarNoAndBarrierId(b.getCarNo(), b.getId());
-                   outPark.setPrice(0d);
-                   outParkService.save(outPark);
+                   if(outPark != null){
+                       outPark.setPrice(0);
+                       outParkService.save(outPark);
+                   }
                    b.setType2(1);
                    barrierService.save(b);
                    return success("璇锋眰鎴愬姛");
diff --git a/src/main/java/com/boying/dao/OutParkDao.java b/src/main/java/com/boying/dao/OutParkDao.java
index 7a7063b..1d51461 100644
--- a/src/main/java/com/boying/dao/OutParkDao.java
+++ b/src/main/java/com/boying/dao/OutParkDao.java
@@ -20,9 +20,9 @@
     @Query(value = "select sum(price) from OutPark where createTime>:startTime and createTime<:endTime")
     Double sumByPrice(Date startTime, Date endTime);
 
-    @Query(value = "from OutPark where barrierId=:bId and status=1 and status2=0 and id = (select max(id) from OutPark)")
-    OutPark count4(Long bId);
+    @Query(value = "from OutPark where barrierId=:bId and status=1 and status2=0 order by createTime desc")
+    List<OutPark> count4(Long bId);
 
-    @Query(value = "from OutPark where barrierId=:id and carNo=:carNo and id = (select max(id) from OutPark)")
-    OutPark findByCarNoAndBarrierId(String carNo, Long id);
+    @Query(value = "from OutPark where barrierId=:id and carNo=:carNo order by createTime desc")
+    List<OutPark> findByCarNoAndBarrierId(String carNo, Long id);
 }
\ No newline at end of file
diff --git a/src/main/java/com/boying/service/OutParkService.java b/src/main/java/com/boying/service/OutParkService.java
index d4e9771..d2decbe 100644
--- a/src/main/java/com/boying/service/OutParkService.java
+++ b/src/main/java/com/boying/service/OutParkService.java
@@ -88,11 +88,11 @@
     }
 
     public OutPark count4(Long bId) {
-        return outParkDao.count4(bId);
+        return outParkDao.count4(bId).get(0);
     }
 
     public OutPark findByCarNoAndBarrierId(String carNo, Long id) {
-        return outParkDao.findByCarNoAndBarrierId(carNo,id);
+        return outParkDao.findByCarNoAndBarrierId(carNo,id).get(0);
     }
 
     public static void main(String[] args) {

--
Gitblit v1.9.1