kongdeqiang
2022-09-26 18087f533cd48ddb9f972c0848ffe920ec58ee8e
修改打包和app
4个文件已修改
103 ■■■■■ 已修改文件
pom.xml 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/controller/BarrierController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/dao/OutParkDao.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/boying/service/OutParkService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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>
                            <!--程序启动类application.java的路径-->
                            <mainClass>com.boying.FfparkApplication</mainClass>
                        </manifest>
                        <!-- 指定配置文件目录,这样jar运行时会去找到同目录下的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>
                                    <!-- 指定参与构建的resoures-->
                                    <includes>
                                        <include>*.**</include>
                                    </includes>
                                </resource>
                            </resources>
                            <outputDirectory>1-running/config</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
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("请求成功");
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);
}
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) {