提交pom
This commit is contained in:
@@ -39,4 +39,68 @@
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>influxdbinsertboot</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>com.spotify</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<executions>
|
||||
<!--执行mvn package,即执行 mvn clean package docker:build-->
|
||||
<execution>
|
||||
<id>build-image</id>
|
||||
<phase>${docker.operate}</phase>
|
||||
<goals>
|
||||
<goal>build</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<!--<serverId>36dockerHarbor</serverId>-->
|
||||
<registryUrl>http://${docker.repostory}</registryUrl>
|
||||
<!-- 镜像名称 -->
|
||||
<imageName>${docker.repostory}/${docker.registry.name}/${project.artifactId}</imageName>
|
||||
<!-- 指定标签 -->
|
||||
<imageTags>
|
||||
<imageTag>latest</imageTag>
|
||||
</imageTags>
|
||||
<!-- 指定远程 Docker API地址 -->
|
||||
<dockerHost>${docker.url}</dockerHost>
|
||||
<dockerDirectory>${basedir}/</dockerDirectory>
|
||||
<!-- 复制 jar包到docker容器指定目录-->
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>/ROOT</targetPath>
|
||||
<!-- 用于指定需要复制的根目录,${project.build.directory}表示target目录 -->
|
||||
<directory>${project.build.directory}</directory>
|
||||
<!-- 用于指定需要复制的文件,${project.build.finalName}.jar就是打包后的target目录下的jar包名称 -->
|
||||
<include>${project.build.finalName}.jar</include>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -53,6 +53,7 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>influxdbreadboot</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@@ -88,8 +89,9 @@
|
||||
<plugin>
|
||||
<groupId>com.spotify</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>1.2.2</version>
|
||||
<executions>
|
||||
<!--执行mvn package,即执行 mvn clean package docker:build-->
|
||||
<execution>
|
||||
<id>build-image</id>
|
||||
<phase>${docker.operate}</phase>
|
||||
@@ -103,15 +105,20 @@
|
||||
<registryUrl>http://${docker.repostory}</registryUrl>
|
||||
<!-- 镜像名称 -->
|
||||
<imageName>${docker.repostory}/${docker.registry.name}/${project.artifactId}</imageName>
|
||||
<!-- 指定标签 -->
|
||||
<imageTags>
|
||||
<imageTag>latest</imageTag>
|
||||
</imageTags>
|
||||
<!-- 指定远程 Docker API地址 -->
|
||||
<dockerHost>${docker.url}</dockerHost>
|
||||
<dockerDirectory>${basedir}/</dockerDirectory>
|
||||
<!-- 复制 jar包到docker容器指定目录-->
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>/ROOT</targetPath>
|
||||
<!-- 用于指定需要复制的根目录,${project.build.directory}表示target目录 -->
|
||||
<directory>${project.build.directory}</directory>
|
||||
<!-- 用于指定需要复制的文件,${project.build.finalName}.jar就是打包后的target目录下的jar包名称 -->
|
||||
<include>${project.build.finalName}.jar</include>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
@@ -8,15 +8,12 @@ import com.njcn.migration.read.service.MigrationService;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
@@ -78,10 +75,9 @@ public class MigrationInfluxDBController {
|
||||
@ApiOperation(value ="获取最新数据信息文件", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
||||
public void importDistributionAreaExcel(HttpServletResponse response) throws IOException {
|
||||
migrationService.initializeExcel();
|
||||
ClassPathResource picPathResource = new ClassPathResource("file/sj.xlsx");
|
||||
FileInputStream fileInputStream = new FileInputStream("/usr/local/jar");
|
||||
response.setHeader("Content-Disposition", "attachment;filename="+ URLEncoder.encode("最新数据信息.xlsx", CharsetUtil.UTF_8));
|
||||
// 输出文件内容
|
||||
InputStream fileInputStream = picPathResource.getInputStream();
|
||||
OutputStream responseOutputStream = response.getOutputStream();
|
||||
byte[] buffer = new byte[4096];
|
||||
int bytesRead;
|
||||
|
||||
@@ -13,10 +13,10 @@ import com.njcn.po.influx.DataV;
|
||||
import com.njcn.migration.read.util.TimeUtil;
|
||||
import com.njcn.po.influx.PqsCommunicate;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -128,7 +128,7 @@ public class MigrationServiceImpl implements MigrationService {
|
||||
|
||||
@Override
|
||||
public void initializeExcel() throws IOException {
|
||||
ClassPathResource picPathResource = new ClassPathResource("file/sj.xlsx");
|
||||
File file = new File("/usr/local/jar");
|
||||
Map<String, String> map = TimeUtil.getLineMap();
|
||||
List<DataV> lineExcel = new ArrayList<>();
|
||||
map.forEach((line,value)->{
|
||||
@@ -146,8 +146,7 @@ public class MigrationServiceImpl implements MigrationService {
|
||||
data.setTimeId(value);
|
||||
devExcel.add(data);
|
||||
});
|
||||
|
||||
ExcelWriter excelWriter = EasyExcel.write(picPathResource.getFile()).build();
|
||||
ExcelWriter excelWriter = EasyExcel.write(file).build();
|
||||
//模板1
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet(0, "line" ).head(DataV.class)
|
||||
.includeColumnFiledNames(Arrays.asList("lineId","timeId"))
|
||||
|
||||
@@ -4,7 +4,6 @@ package com.njcn.migration.read.util;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
@@ -15,10 +14,10 @@ import com.njcn.param.LineCountEvaluateParam;
|
||||
import com.njcn.po.influx.DataV;
|
||||
import com.njcn.po.influx.PqsCommunicate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -35,6 +34,7 @@ public class TimeUtil {
|
||||
private IDataV dataV;
|
||||
@Autowired
|
||||
private IPqsCommunicate communicate;
|
||||
|
||||
/**
|
||||
* key:监测点id value:当前上次结束时间
|
||||
*/
|
||||
@@ -44,6 +44,7 @@ public class TimeUtil {
|
||||
public static void putLineTime(String lineId, String time) {
|
||||
LINE_TIME_MAP.put(lineId, time);
|
||||
}
|
||||
|
||||
public static void putAllLineTime(Map<String, String> limeMap) {
|
||||
LINE_TIME_MAP.putAll(limeMap);
|
||||
}
|
||||
@@ -63,9 +64,11 @@ public class TimeUtil {
|
||||
public static void putDevTime(String devId, String time) {
|
||||
DEV_TIME_MAP.put(devId, time);
|
||||
}
|
||||
|
||||
public static void putAllDevTime(Map<String, String> devMap) {
|
||||
DEV_TIME_MAP.putAll(devMap);
|
||||
}
|
||||
|
||||
public static String getDevTime(String devId) {
|
||||
if (DEV_TIME_MAP.containsKey(devId)) {
|
||||
return DEV_TIME_MAP.get(devId);
|
||||
@@ -79,8 +82,8 @@ public class TimeUtil {
|
||||
|
||||
@PostConstruct
|
||||
public void init() throws IOException {
|
||||
ClassPathResource picPathResource = new ClassPathResource("file/sj.xlsx");
|
||||
List<DataV> excelDataV = EasyExcel.read(picPathResource.getFile())
|
||||
File file = new File("/usr/local/jar/sj.xlsx");
|
||||
List<DataV> excelDataV = EasyExcel.read(file)
|
||||
.head(DataV.class)
|
||||
.sheet(0).doReadSync();
|
||||
List<DataV> datav = dataV.listDataVDesc(new LineCountEvaluateParam());
|
||||
@@ -98,7 +101,7 @@ public class TimeUtil {
|
||||
excelDataV.addAll(datav);
|
||||
}
|
||||
|
||||
List<PqsCommunicate> excelCommunicates = EasyExcel.read(picPathResource.getFile())
|
||||
List<PqsCommunicate> excelCommunicates = EasyExcel.read(file)
|
||||
.head(PqsCommunicate.class)
|
||||
.sheet(1).doReadSync();
|
||||
List<PqsCommunicate> communicates = communicate.listPqsCommunicateDesc(new LineCountEvaluateParam());
|
||||
@@ -116,7 +119,7 @@ public class TimeUtil {
|
||||
excelCommunicates.addAll(communicates);
|
||||
}
|
||||
|
||||
ExcelWriter excelWriter = EasyExcel.write(picPathResource.getFile()).build();
|
||||
ExcelWriter excelWriter = EasyExcel.write(file).build();
|
||||
//模板1
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet(0, "line").head(DataV.class)
|
||||
.includeColumnFiledNames(Arrays.asList("lineId", "timeId"))
|
||||
|
||||
Reference in New Issue
Block a user