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