项目集成华为obs查看波形文件
This commit is contained in:
23
pom.xml
23
pom.xml
@@ -25,6 +25,7 @@
|
|||||||
<module>pqs-process</module>
|
<module>pqs-process</module>
|
||||||
<module>pqs-algorithm</module>
|
<module>pqs-algorithm</module>
|
||||||
|
|
||||||
|
|
||||||
</modules>
|
</modules>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>灿能微服务生态系统</name>
|
<name>灿能微服务生态系统</name>
|
||||||
@@ -111,10 +112,8 @@
|
|||||||
<xxl-job.version>2.3.0</xxl-job.version>
|
<xxl-job.version>2.3.0</xxl-job.version>
|
||||||
<mqtt.version>1.2.7</mqtt.version>
|
<mqtt.version>1.2.7</mqtt.version>
|
||||||
<easypoi.version>4.4.0</easypoi.version>
|
<easypoi.version>4.4.0</easypoi.version>
|
||||||
<progressbar.version>0.5.3</progressbar.version>
|
|
||||||
<okhttp.version>4.8.1</okhttp.version>
|
|
||||||
<minio.version>8.2.1</minio.version>
|
|
||||||
<spring-cloud-huawei.version>1.7.0-Hoxton</spring-cloud-huawei.version>
|
<spring-cloud-huawei.version>1.7.0-Hoxton</spring-cloud-huawei.version>
|
||||||
|
<okhttp.version>4.8.1</okhttp.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -341,29 +340,11 @@
|
|||||||
<artifactId>easypoi-spring-boot-starter</artifactId>
|
<artifactId>easypoi-spring-boot-starter</artifactId>
|
||||||
<version>${easypoi.version}</version>
|
<version>${easypoi.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--调用minio服务器-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>me.tongfei</groupId>
|
|
||||||
<artifactId>progressbar</artifactId>
|
|
||||||
<version>${progressbar.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.squareup.okhttp3</groupId>
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
<artifactId>okhttp</artifactId>
|
<artifactId>okhttp</artifactId>
|
||||||
<version>${okhttp.version}</version>
|
<version>${okhttp.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>io.minio</groupId>
|
|
||||||
<artifactId>minio</artifactId>
|
|
||||||
<version>${minio.version}</version>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>com.squareup.okhttp3</groupId>
|
|
||||||
<artifactId>okhttp</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
<!-- 多数据源切换,当数据源为oracle时需要使用 -->
|
<!-- 多数据源切换,当数据源为oracle时需要使用 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>pqs-common</artifactId>
|
|
||||||
<groupId>com.njcn</groupId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<artifactId>common-minio</artifactId>
|
|
||||||
<name>minioss的公共信息</name>
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.njcn</groupId>
|
|
||||||
<artifactId>common-core</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.njcn</groupId>
|
|
||||||
<artifactId>common-web</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>me.tongfei</groupId>
|
|
||||||
<artifactId>progressbar</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.squareup.okhttp3</groupId>
|
|
||||||
<artifactId>okhttp</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.minio</groupId>
|
|
||||||
<artifactId>minio</artifactId>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>com.squareup.okhttp3</groupId>
|
|
||||||
<artifactId>okhttp</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
package com.njcn.minio.bo;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author hongawen
|
|
||||||
* @version 1.0.0
|
|
||||||
* @date 2022年10月16日 18:40
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class MinIoUploadResDTO implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 475040120689218785L;
|
|
||||||
private String minFileName;
|
|
||||||
private String minFileUrl;
|
|
||||||
|
|
||||||
public MinIoUploadResDTO(String minFileName, String minFileUrl) {
|
|
||||||
this.minFileName = minFileName;
|
|
||||||
this.minFileUrl = minFileUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,104 +0,0 @@
|
|||||||
package com.njcn.minio.bo;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author hongawen
|
|
||||||
* @version 1.0.0
|
|
||||||
* @date 2022年10月16日 18:41
|
|
||||||
*/
|
|
||||||
public class Result<T> implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 6273326371984994386L;
|
|
||||||
private Integer code;
|
|
||||||
private String msg;
|
|
||||||
private T data;
|
|
||||||
|
|
||||||
private Result() {
|
|
||||||
this.code = 200;
|
|
||||||
this.msg = "OK";
|
|
||||||
}
|
|
||||||
|
|
||||||
private Result(T data) {
|
|
||||||
this.code = 200;
|
|
||||||
this.msg = "OK";
|
|
||||||
this.setData(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Result(Integer code, String msg) {
|
|
||||||
this.code = code;
|
|
||||||
this.msg = msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Result(Integer code, String msg, T data) {
|
|
||||||
this.code = code;
|
|
||||||
this.msg = msg;
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Result<T> setError(Integer code, String msg) {
|
|
||||||
this.setCode(code);
|
|
||||||
this.setMsg(msg);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSuccess() {
|
|
||||||
return this.getCode().equals(200);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Result ok() {
|
|
||||||
return new Result();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <T> Result ok(T data) {
|
|
||||||
return new Result(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <T> Result ok(Integer code, String msg) {
|
|
||||||
return new Result(code, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <T> Result ok(Integer code, String msg, T data) {
|
|
||||||
return new Result(code, msg, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <T> Result error() {
|
|
||||||
return new Result(500, "failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <T> Result error(String msg) {
|
|
||||||
return new Result(500, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <T> Result error(Integer code, String msg) {
|
|
||||||
return new Result(code, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <T> Result error(Integer code, String msg, T data) {
|
|
||||||
return new Result(code, msg, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getCode() {
|
|
||||||
return this.code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCode(Integer code) {
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMsg() {
|
|
||||||
return this.msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMsg(String msg) {
|
|
||||||
this.msg = msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public T getData() {
|
|
||||||
return this.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setData(T data) {
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package com.njcn.minio.config;
|
|
||||||
|
|
||||||
import io.minio.MinioClient;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author hongawen
|
|
||||||
* @version 1.0.0
|
|
||||||
* @date 2022年10月16日 18:37
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Component
|
|
||||||
@ConfigurationProperties(prefix = "min.io")
|
|
||||||
public class MinIoProperties {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Minio 服务端ip
|
|
||||||
*/
|
|
||||||
private String endpoint;
|
|
||||||
|
|
||||||
private String accessKey;
|
|
||||||
|
|
||||||
private String secretKey;
|
|
||||||
|
|
||||||
private String bucket;
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public MinioClient getMinioClient() {
|
|
||||||
return MinioClient.builder()
|
|
||||||
.endpoint(endpoint).credentials(accessKey, secretKey).build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,595 +0,0 @@
|
|||||||
package com.njcn.minio.utils;
|
|
||||||
|
|
||||||
import com.njcn.minio.bo.MinIoUploadResDTO;
|
|
||||||
import com.njcn.minio.config.MinIoProperties;
|
|
||||||
import io.minio.*;
|
|
||||||
import io.minio.Result;
|
|
||||||
import io.minio.http.Method;
|
|
||||||
import io.minio.messages.Bucket;
|
|
||||||
import io.minio.messages.DeleteError;
|
|
||||||
import io.minio.messages.DeleteObject;
|
|
||||||
import io.minio.messages.Item;
|
|
||||||
import lombok.SneakyThrows;
|
|
||||||
import org.apache.tomcat.util.http.fileupload.IOUtils;
|
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@EnableConfigurationProperties({MinIoProperties.class})
|
|
||||||
public class MinIoUtils {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private MinioClient instance;
|
|
||||||
|
|
||||||
private static final String SEPARATOR_DOT = ".";
|
|
||||||
|
|
||||||
private static final String SEPARATOR_ACROSS = "-";
|
|
||||||
|
|
||||||
private static final String SEPARATOR_STR = "";
|
|
||||||
|
|
||||||
// 存储桶名称
|
|
||||||
private static final String chunkBucKet = "miniobucket";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 不排序
|
|
||||||
*/
|
|
||||||
public final static boolean NOT_SORT = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 排序
|
|
||||||
*/
|
|
||||||
public final static boolean SORT = true;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 默认过期时间(分钟)
|
|
||||||
*/
|
|
||||||
private final static Integer DEFAULT_EXPIRY = 60;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除分片
|
|
||||||
*/
|
|
||||||
public final static boolean DELETE_CHUNK_OBJECT = true;
|
|
||||||
/**
|
|
||||||
* 不删除分片
|
|
||||||
*/
|
|
||||||
public final static boolean NOT_DELETE_CHUNK_OBJECT = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断桶是否存在
|
|
||||||
* @param bucketName 桶名
|
|
||||||
* @return boolean
|
|
||||||
* @author exe.wangtaotao
|
|
||||||
* @date 2020/10/21 16:33
|
|
||||||
*/
|
|
||||||
public boolean bucketExists(String bucketName) {
|
|
||||||
try {
|
|
||||||
return instance.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建存储桶
|
|
||||||
* 创建 bucket
|
|
||||||
*
|
|
||||||
* @param bucketName 桶名
|
|
||||||
*/
|
|
||||||
public void makeBucket(String bucketName) {
|
|
||||||
try {
|
|
||||||
boolean isExist = bucketExists(bucketName);
|
|
||||||
if (!isExist) {
|
|
||||||
instance.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build());
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return java.util.List<java.lang.String>
|
|
||||||
* @Description 获取文件存储服务的所有存储桶名称
|
|
||||||
* @author exe.wangtaotao
|
|
||||||
* @date 2020/10/21 16:35
|
|
||||||
*/
|
|
||||||
public List<String> listBucketNames() {
|
|
||||||
List<Bucket> bucketList = listBuckets();
|
|
||||||
List<String> bucketListName = new ArrayList<>();
|
|
||||||
for (Bucket bucket : bucketList) {
|
|
||||||
bucketListName.add(bucket.name());
|
|
||||||
}
|
|
||||||
return bucketListName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return java.util.List<io.minio.messages.Bucket>
|
|
||||||
* @Description 列出所有存储桶
|
|
||||||
*/
|
|
||||||
@SneakyThrows
|
|
||||||
private List<Bucket> listBuckets() {
|
|
||||||
return instance.listBuckets();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取对象文件名称列表
|
|
||||||
*
|
|
||||||
* @param bucketName 存储桶名称
|
|
||||||
* @param prefix 对象名称前缀(文件夹 /xx/xx/xxx.jpg 中的 /xx/xx/)
|
|
||||||
* @return objectNames
|
|
||||||
*/
|
|
||||||
public List<String> listObjectNames(String bucketName, String prefix) {
|
|
||||||
return listObjectNames(bucketName, prefix, NOT_SORT);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取对象文件名称列表
|
|
||||||
*
|
|
||||||
* @param bucketName 存储桶名称
|
|
||||||
* @param prefix 对象名称前缀(文件夹 /xx/xx/xxx.jpg 中的 /xx/xx/)
|
|
||||||
* @param sort 是否排序(升序)
|
|
||||||
* @return objectNames
|
|
||||||
*/
|
|
||||||
@SneakyThrows
|
|
||||||
public List<String> listObjectNames(String bucketName, String prefix, Boolean sort) {
|
|
||||||
boolean flag = bucketExists(bucketName);
|
|
||||||
if (flag) {
|
|
||||||
ListObjectsArgs listObjectsArgs;
|
|
||||||
if (null == prefix) {
|
|
||||||
listObjectsArgs = ListObjectsArgs.builder()
|
|
||||||
.bucket(bucketName)
|
|
||||||
.recursive(true)
|
|
||||||
.build();
|
|
||||||
} else {
|
|
||||||
listObjectsArgs = ListObjectsArgs.builder()
|
|
||||||
.bucket(bucketName)
|
|
||||||
.prefix(prefix)
|
|
||||||
.recursive(true)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
Iterable<Result<Item>> chunks = instance.listObjects(listObjectsArgs);
|
|
||||||
List<String> chunkPaths = new ArrayList<>();
|
|
||||||
for (Result<Item> item : chunks) {
|
|
||||||
chunkPaths.add(item.get().objectName());
|
|
||||||
}
|
|
||||||
if (sort) {
|
|
||||||
chunkPaths.sort(new Str2IntComparator(false));
|
|
||||||
}
|
|
||||||
return chunkPaths;
|
|
||||||
}
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 在桶下创建文件夹,文件夹层级结构根据参数决定
|
|
||||||
*
|
|
||||||
* @param bucket 桶名称
|
|
||||||
* @param WotDir 格式为 xxx/xxx/xxx/
|
|
||||||
*/
|
|
||||||
@SneakyThrows
|
|
||||||
public String createDirectory(String bucket, String WotDir) {
|
|
||||||
if (!this.bucketExists(bucket)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
instance.putObject(PutObjectArgs.builder().bucket(bucket).object(WotDir).stream(
|
|
||||||
new ByteArrayInputStream(new byte[]{}), 0, -1)
|
|
||||||
.build());
|
|
||||||
return WotDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除一个文件
|
|
||||||
*
|
|
||||||
* @param bucketName 桶名称
|
|
||||||
* @param objectName /xx/xx/xxx.jpg
|
|
||||||
*/
|
|
||||||
@SneakyThrows
|
|
||||||
public boolean removeObject(String bucketName, String objectName) {
|
|
||||||
|
|
||||||
if (!bucketExists(bucketName)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
instance.removeObject(
|
|
||||||
RemoveObjectArgs.builder()
|
|
||||||
.bucket(bucketName)
|
|
||||||
.object(objectName)
|
|
||||||
.build());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param bucketName 桶名称
|
|
||||||
* @param objectNames /xx/xx/xxx.jpg
|
|
||||||
* @return java.util.List<java.lang.String>
|
|
||||||
* @Description 删除指定桶的多个文件对象, 返回删除错误的对象列表,全部删除成功,返回空列表
|
|
||||||
* @author exe.wangtaotao
|
|
||||||
* @date 2020/10/21 16:43
|
|
||||||
*/
|
|
||||||
@SneakyThrows
|
|
||||||
public List<String> removeObjects(String bucketName, List<String> objectNames) {
|
|
||||||
if (!bucketExists(bucketName)) {
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
List<DeleteObject> deleteObjects = new ArrayList<>(objectNames.size());
|
|
||||||
for (String objectName : objectNames) {
|
|
||||||
deleteObjects.add(new DeleteObject(objectName));
|
|
||||||
}
|
|
||||||
List<String> deleteErrorNames = new ArrayList<>();
|
|
||||||
Iterable<Result<DeleteError>> results = instance.removeObjects(
|
|
||||||
RemoveObjectsArgs.builder()
|
|
||||||
.bucket(bucketName)
|
|
||||||
.objects(deleteObjects)
|
|
||||||
.build());
|
|
||||||
for (Result<DeleteError> result : results) {
|
|
||||||
DeleteError error = result.get();
|
|
||||||
deleteErrorNames.add(error.objectName());
|
|
||||||
}
|
|
||||||
return deleteErrorNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取访问对象的外链地址
|
|
||||||
* 获取文件的下载url
|
|
||||||
*
|
|
||||||
* @param bucketName 存储桶名称
|
|
||||||
* @param objectName 对象名称
|
|
||||||
* @param expiry 过期时间(分钟) 最大为7天 超过7天则默认最大值
|
|
||||||
* @return viewUrl
|
|
||||||
*/
|
|
||||||
@SneakyThrows
|
|
||||||
public String getObjectUrl(String bucketName, String objectName, Integer expiry) {
|
|
||||||
expiry = expiryHandle(expiry);
|
|
||||||
return instance.getPresignedObjectUrl(
|
|
||||||
GetPresignedObjectUrlArgs.builder()
|
|
||||||
.method(Method.GET)
|
|
||||||
.bucket(bucketName)
|
|
||||||
.object(objectName)
|
|
||||||
.expiry(expiry)
|
|
||||||
.build()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建上传文件对象的外链
|
|
||||||
*
|
|
||||||
* @param bucketName 存储桶名称
|
|
||||||
* @param objectName 欲上传文件对象的名称
|
|
||||||
* @return uploadUrl
|
|
||||||
*/
|
|
||||||
public String createUploadUrl(String bucketName, String objectName) {
|
|
||||||
return createUploadUrl(bucketName, objectName, DEFAULT_EXPIRY);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建上传文件对象的外链
|
|
||||||
*
|
|
||||||
* @param bucketName 存储桶名称
|
|
||||||
* @param objectName 欲上传文件对象的名称
|
|
||||||
* @param expiry 过期时间(分钟) 最大为7天 超过7天则默认最大值
|
|
||||||
* @return uploadUrl
|
|
||||||
*/
|
|
||||||
@SneakyThrows
|
|
||||||
public String createUploadUrl(String bucketName, String objectName, Integer expiry) {
|
|
||||||
expiry = expiryHandle(expiry);
|
|
||||||
return instance.getPresignedObjectUrl(
|
|
||||||
GetPresignedObjectUrlArgs.builder()
|
|
||||||
.method(Method.PUT)
|
|
||||||
.bucket(bucketName)
|
|
||||||
.object(objectName)
|
|
||||||
.expiry(expiry)
|
|
||||||
.build()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 批量下载
|
|
||||||
// *
|
|
||||||
// * @param directory
|
|
||||||
// * @return
|
|
||||||
// */
|
|
||||||
// @SneakyThrows
|
|
||||||
// public List<String> downLoadMore(String bucket, String directory) {
|
|
||||||
// Iterable<io.minio.Result<Item>> objs = instance.listObjects(ListObjectsArgs.builder().bucket(bucket).prefix(directory).useUrlEncodingType(false).build());
|
|
||||||
// List<String> list = new ArrayList<>();
|
|
||||||
// for (io.minio.Result<Item> result : objs) {
|
|
||||||
// String objectName = null;
|
|
||||||
// objectName = result.get().objectName();
|
|
||||||
// ObjectStat statObject = instance.statObject(StatObjectArgs.builder().bucket(bucket).object(objectName).build());
|
|
||||||
// if (statObject != null && statObject.length() > 0) {
|
|
||||||
// String fileurl = instance.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder().bucket(bucket).object(statObject.name()).method(Method.GET).build());
|
|
||||||
// list.add(fileurl);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return list;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param multipartFile 文件
|
|
||||||
* @param bucketName 桶名
|
|
||||||
* @param directory image/
|
|
||||||
* @return java.lang.String
|
|
||||||
* @Description 文件上传
|
|
||||||
* @author exe.wangtaotao
|
|
||||||
* @date 2020/10/21 13:45
|
|
||||||
*/
|
|
||||||
public MinIoUploadResDTO upload(MultipartFile multipartFile, String bucketName, String directory) throws Exception {
|
|
||||||
if (!this.bucketExists(bucketName)) {
|
|
||||||
this.makeBucket(bucketName);
|
|
||||||
}
|
|
||||||
InputStream inputStream = multipartFile.getInputStream();
|
|
||||||
directory = Optional.ofNullable(directory).orElse("");
|
|
||||||
String minFileName = directory + minFileName(multipartFile.getOriginalFilename());
|
|
||||||
//上传文件到指定目录
|
|
||||||
instance.putObject(PutObjectArgs.builder()
|
|
||||||
.bucket(bucketName)
|
|
||||||
.object(minFileName)
|
|
||||||
.contentType(multipartFile.getContentType())
|
|
||||||
.stream(inputStream, inputStream.available(), -1)
|
|
||||||
.build());
|
|
||||||
inputStream.close();
|
|
||||||
// 返回生成文件名、访问路径
|
|
||||||
return new MinIoUploadResDTO(minFileName, getObjectUrl(bucketName, minFileName, DEFAULT_EXPIRY));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param response
|
|
||||||
* @return java.lang.String
|
|
||||||
* @Description 下载文件
|
|
||||||
* @author exe.wangtaotao
|
|
||||||
* @date 2020/10/21 15:18
|
|
||||||
*/
|
|
||||||
public void download(HttpServletResponse response, String bucketName, String minFileName) throws Exception {
|
|
||||||
InputStream fileInputStream = instance.getObject(GetObjectArgs.builder()
|
|
||||||
.bucket(bucketName)
|
|
||||||
.object(minFileName).build());
|
|
||||||
response.setHeader("Content-Disposition", "attachment;filename=" + minFileName);
|
|
||||||
response.setContentType("application/force-download");
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
IOUtils.copy(fileInputStream, response.getOutputStream());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量创建分片上传外链
|
|
||||||
*
|
|
||||||
* @param bucketName 存储桶名称
|
|
||||||
* @param objectMD5 欲上传分片文件主文件的MD5
|
|
||||||
* @param chunkCount 分片数量
|
|
||||||
* @return uploadChunkUrls
|
|
||||||
*/
|
|
||||||
public List<String> createUploadChunkUrlList(String bucketName, String objectMD5, Integer chunkCount) {
|
|
||||||
if (null == bucketName) {
|
|
||||||
bucketName = chunkBucKet;
|
|
||||||
}
|
|
||||||
if (null == objectMD5) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
objectMD5 += "/";
|
|
||||||
if (null == chunkCount || 0 == chunkCount) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
List<String> urlList = new ArrayList<>(chunkCount);
|
|
||||||
for (int i = 1; i <= chunkCount; i++) {
|
|
||||||
String objectName = objectMD5 + i + ".chunk";
|
|
||||||
urlList.add(createUploadUrl(bucketName, objectName, DEFAULT_EXPIRY));
|
|
||||||
}
|
|
||||||
return urlList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建指定序号的分片文件上传外链
|
|
||||||
*
|
|
||||||
* @param bucketName 存储桶名称
|
|
||||||
* @param objectMD5 欲上传分片文件主文件的MD5
|
|
||||||
* @param partNumber 分片序号
|
|
||||||
* @return uploadChunkUrl
|
|
||||||
*/
|
|
||||||
public String createUploadChunkUrl(String bucketName, String objectMD5, Integer partNumber) {
|
|
||||||
if (null == bucketName) {
|
|
||||||
bucketName = chunkBucKet;
|
|
||||||
}
|
|
||||||
if (null == objectMD5) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
objectMD5 += "/" + partNumber + ".chunk";
|
|
||||||
return createUploadUrl(bucketName, objectMD5, DEFAULT_EXPIRY);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取分片文件名称列表
|
|
||||||
*
|
|
||||||
* @param bucketName 存储桶名称
|
|
||||||
* @param ObjectMd5 对象Md5
|
|
||||||
* @return objectChunkNames
|
|
||||||
*/
|
|
||||||
public List<String> listChunkObjectNames(String bucketName, String ObjectMd5) {
|
|
||||||
if (null == bucketName) {
|
|
||||||
bucketName = chunkBucKet;
|
|
||||||
}
|
|
||||||
if (null == ObjectMd5) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return listObjectNames(bucketName, ObjectMd5, SORT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取分片名称地址HashMap key=分片序号 value=分片文件地址
|
|
||||||
*
|
|
||||||
* @param bucketName 存储桶名称
|
|
||||||
* @param ObjectMd5 对象Md5
|
|
||||||
* @return objectChunkNameMap
|
|
||||||
*/
|
|
||||||
public Map<Integer, String> mapChunkObjectNames(String bucketName, String ObjectMd5) {
|
|
||||||
if (null == bucketName) {
|
|
||||||
bucketName = chunkBucKet;
|
|
||||||
}
|
|
||||||
if (null == ObjectMd5) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
List<String> chunkPaths = listObjectNames(bucketName, ObjectMd5);
|
|
||||||
if (null == chunkPaths || chunkPaths.size() == 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
Map<Integer, String> chunkMap = new HashMap<>(chunkPaths.size());
|
|
||||||
for (String chunkName : chunkPaths) {
|
|
||||||
Integer partNumber = Integer.parseInt(chunkName.substring(chunkName.indexOf("/") + 1, chunkName.lastIndexOf(".")));
|
|
||||||
chunkMap.put(partNumber, chunkName);
|
|
||||||
}
|
|
||||||
return chunkMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 合并分片文件成对象文件
|
|
||||||
*
|
|
||||||
* @param chunkBucKetName 分片文件所在存储桶名称
|
|
||||||
* @param composeBucketName 合并后的对象文件存储的存储桶名称
|
|
||||||
* @param chunkNames 分片文件名称集合
|
|
||||||
* @param objectName 合并后的对象文件名称
|
|
||||||
* @return true/false
|
|
||||||
*/
|
|
||||||
@SneakyThrows
|
|
||||||
public boolean composeObject(String chunkBucKetName, String composeBucketName, List<String> chunkNames, String objectName, boolean isDeleteChunkObject) {
|
|
||||||
if (null == chunkBucKetName) {
|
|
||||||
chunkBucKetName = chunkBucKet;
|
|
||||||
}
|
|
||||||
List<ComposeSource> sourceObjectList = new ArrayList<>(chunkNames.size());
|
|
||||||
for (String chunk : chunkNames) {
|
|
||||||
sourceObjectList.add(
|
|
||||||
ComposeSource.builder()
|
|
||||||
.bucket(chunkBucKetName)
|
|
||||||
.object(chunk)
|
|
||||||
.build()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
instance.composeObject(
|
|
||||||
ComposeObjectArgs.builder()
|
|
||||||
.bucket(composeBucketName)
|
|
||||||
.object(objectName)
|
|
||||||
.sources(sourceObjectList)
|
|
||||||
.build()
|
|
||||||
);
|
|
||||||
if (isDeleteChunkObject) {
|
|
||||||
removeObjects(chunkBucKetName, chunkNames);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 合并分片文件成对象文件
|
|
||||||
*
|
|
||||||
* @param bucketName 存储桶名称
|
|
||||||
* @param chunkNames 分片文件名称集合
|
|
||||||
* @param objectName 合并后的对象文件名称
|
|
||||||
* @return true/false
|
|
||||||
*/
|
|
||||||
public boolean composeObject(String bucketName, List<String> chunkNames, String objectName) {
|
|
||||||
return composeObject(chunkBucKet, bucketName, chunkNames, objectName, NOT_DELETE_CHUNK_OBJECT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 合并分片文件成对象文件
|
|
||||||
*
|
|
||||||
* @param bucketName 存储桶名称
|
|
||||||
* @param chunkNames 分片文件名称集合
|
|
||||||
* @param objectName 合并后的对象文件名称
|
|
||||||
* @return true/false
|
|
||||||
*/
|
|
||||||
public boolean composeObject(String bucketName, List<String> chunkNames, String objectName, boolean isDeleteChunkObject) {
|
|
||||||
return composeObject(chunkBucKet, bucketName, chunkNames, objectName, isDeleteChunkObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 合并分片文件,合并成功后删除分片文件
|
|
||||||
*
|
|
||||||
* @param bucketName 存储桶名称
|
|
||||||
* @param chunkNames 分片文件名称集合
|
|
||||||
* @param objectName 合并后的对象文件名称
|
|
||||||
* @return true/false
|
|
||||||
*/
|
|
||||||
public boolean composeObjectAndRemoveChunk(String bucketName, List<String> chunkNames, String objectName) {
|
|
||||||
return composeObject(chunkBucKet, bucketName, chunkNames, objectName, DELETE_CHUNK_OBJECT);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param originalFileName 原始名称
|
|
||||||
* @return java.lang.String
|
|
||||||
* @Description 生成上传文件名
|
|
||||||
* @author exe.wangtaotao
|
|
||||||
* @date 2020/10/21 15:07
|
|
||||||
*/
|
|
||||||
public String minFileName(String originalFileName) {
|
|
||||||
String suffix = originalFileName;
|
|
||||||
if (originalFileName.contains(SEPARATOR_DOT)) {
|
|
||||||
suffix = originalFileName.substring(originalFileName.lastIndexOf(SEPARATOR_DOT));
|
|
||||||
}
|
|
||||||
return UUID.randomUUID().toString().replace(SEPARATOR_ACROSS, SEPARATOR_STR).toUpperCase() + suffix;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将分钟数转换为秒数
|
|
||||||
*
|
|
||||||
* @param expiry 过期时间(分钟数)
|
|
||||||
* @return expiry
|
|
||||||
*/
|
|
||||||
private static int expiryHandle(Integer expiry) {
|
|
||||||
expiry = expiry * 60;
|
|
||||||
if (expiry > 604800) {
|
|
||||||
return 604800;
|
|
||||||
}
|
|
||||||
return expiry;
|
|
||||||
}
|
|
||||||
|
|
||||||
static class Str2IntComparator implements Comparator<String> {
|
|
||||||
private final boolean reverseOrder; // 是否倒序
|
|
||||||
|
|
||||||
public Str2IntComparator(boolean reverseOrder) {
|
|
||||||
this.reverseOrder = reverseOrder;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compare(String arg0, String arg1) {
|
|
||||||
Integer intArg0 = Integer.parseInt(arg0.substring(arg0.indexOf("/") + 1, arg0.lastIndexOf(".")));
|
|
||||||
Integer intArg1 = Integer.parseInt(arg1.substring(arg1.indexOf("/") + 1, arg1.lastIndexOf(".")));
|
|
||||||
if (reverseOrder) {
|
|
||||||
return intArg1 - intArg0;
|
|
||||||
} else {
|
|
||||||
return intArg0 - intArg1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/***
|
|
||||||
* 根据url地址获取对象名称
|
|
||||||
* @author hongawen
|
|
||||||
* @date 2022/10/17 20:05
|
|
||||||
* @param objectUrl 对象地址
|
|
||||||
* @return String 对象名称
|
|
||||||
*/
|
|
||||||
public static String getObjectNameByUrl(String objectUrl) {
|
|
||||||
if(objectUrl.indexOf("?") < 0){
|
|
||||||
return "unknownFile";
|
|
||||||
}
|
|
||||||
String objectName = objectUrl.substring(0, objectUrl.indexOf("?"));
|
|
||||||
return objectName.substring(objectName.lastIndexOf("/") + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
37
pqs-common/common-oss/pom.xml
Normal file
37
pqs-common/common-oss/pom.xml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<artifactId>pqs-common</artifactId>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>common-oss</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
<description>
|
||||||
|
文件服务器处理模块
|
||||||
|
</description>
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>huawei-obs-springboot-starter</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>minioss-springboot-starter</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.common.pojo.constant;
|
package com.njcn.oss.constant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.common.pojo.constant;
|
package com.njcn.oss.constant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
@@ -32,5 +32,15 @@ public interface OssPath {
|
|||||||
*/
|
*/
|
||||||
String LOAD_TYPE_USER="loadTypeUser/";
|
String LOAD_TYPE_USER="loadTypeUser/";
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 技术监督管理 进度文件
|
||||||
|
*/
|
||||||
|
String ELECTRICITY_QUALITY = "electricityQuality/";
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 技术监督管理 普测结果报告
|
||||||
|
*/
|
||||||
|
String SURVEY_RESULT = "surveyresult/";
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.njcn.oss.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
* @version 1.0.0
|
||||||
|
* @date 2023年03月07日 22:58
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum OssResponseEnum {
|
||||||
|
/**
|
||||||
|
* 文件服务器异常响应码的范围:
|
||||||
|
* A00550 ~ A00649
|
||||||
|
*/
|
||||||
|
UPLOAD_FILE_ERROR("A00551","上传文件服务器错误,请检查数据"),
|
||||||
|
DOWNLOAD_FILE_ERROR("A00554","下载文件URL不存在,请检查数据")
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
private final String code;
|
||||||
|
|
||||||
|
private final String message;
|
||||||
|
|
||||||
|
OssResponseEnum(String code, String message) {
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
package com.njcn.oss.utils;
|
||||||
|
|
||||||
|
import com.njcn.common.config.GeneralInfo;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.huawei.obs.util.OBSUtil;
|
||||||
|
import com.njcn.minioss.bo.MinIoUploadResDTO;
|
||||||
|
import com.njcn.minioss.config.MinIoProperties;
|
||||||
|
import com.njcn.minioss.util.MinIoUtils;
|
||||||
|
import com.njcn.oss.constant.GeneralConstant;
|
||||||
|
import com.njcn.oss.constant.OssPath;
|
||||||
|
import com.njcn.oss.enums.OssResponseEnum;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
* @version 1.0.0
|
||||||
|
* @date 2023年03月07日 22:24
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class FileStorageUtil {
|
||||||
|
|
||||||
|
private final GeneralInfo generalInfo;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 华为文件服务器工具类
|
||||||
|
* 若有方法需求或方法不满足,去私有仓库下载huawei-obs-springboot-starter模块进行二次开发
|
||||||
|
* 开发完毕后需deploy到maven私有仓库
|
||||||
|
*/
|
||||||
|
private final OBSUtil obsUtil;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 免费开源Minioss文件服务器工具类
|
||||||
|
* 若有方法需求或方法不满足,去私有仓库下载minioss-springboot-starter模块进行二次开发
|
||||||
|
* 开发完毕后需deploy到maven私有仓库
|
||||||
|
*/
|
||||||
|
private final MinIoUtils minIoUtils;
|
||||||
|
|
||||||
|
private final MinIoProperties minIoProperties;
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 上传MultipartFile文件,
|
||||||
|
* @author hongawen
|
||||||
|
* @date 2023/3/7 22:48
|
||||||
|
* @param multipartFile 文件源
|
||||||
|
* @param dir 服务器文件存放路径
|
||||||
|
*/
|
||||||
|
public String uploadMultipart(MultipartFile multipartFile, String dir) {
|
||||||
|
String filePath;
|
||||||
|
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||||
|
filePath = dir + minIoUtils.minFileName(multipartFile.getOriginalFilename());
|
||||||
|
obsUtil.multiFileUpload(multipartFile, filePath);
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
//把名称存入数据
|
||||||
|
MinIoUploadResDTO minIoUploadResDTO = minIoUtils.upload(multipartFile, minIoProperties.getBucket(), dir);
|
||||||
|
filePath = minIoUploadResDTO.getMinFileName();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new BusinessException(OssResponseEnum.UPLOAD_FILE_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 根据文件路径获取文件短期的一个url
|
||||||
|
* @author hongawen
|
||||||
|
* @date 2023/3/7 23:04
|
||||||
|
* @param filePath 文件在服务器的路径
|
||||||
|
*/
|
||||||
|
public String getFileUrl(String filePath){
|
||||||
|
String url;
|
||||||
|
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||||
|
url = obsUtil.getFileUrl(filePath);
|
||||||
|
} else {
|
||||||
|
url = minIoUtils.getObjectUrl(minIoProperties.getBucket(), filePath, 7 * 24 * 60 * 60);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 根据文件路径删除指定文件对象
|
||||||
|
* @author hongawen
|
||||||
|
* @date 2023/3/8 9:25
|
||||||
|
* @param fileName 文件路径名
|
||||||
|
*/
|
||||||
|
public void deleteFile(String fileName){
|
||||||
|
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||||
|
obsUtil.delete(fileName);
|
||||||
|
}else{
|
||||||
|
minIoUtils.removeObject(minIoProperties.getBucket(), fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -22,8 +22,8 @@
|
|||||||
<module>common-influxdb</module>
|
<module>common-influxdb</module>
|
||||||
<module>common-poi</module>
|
<module>common-poi</module>
|
||||||
<module>common-echarts</module>
|
<module>common-echarts</module>
|
||||||
<module>common-minio</module>
|
|
||||||
<module>common-huawei</module>
|
<module>common-huawei</module>
|
||||||
|
<module>common-oss</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
<artifactId>huawei-obs-springboot-starter</artifactId>
|
<artifactId>common-oss</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.config.GeneralInfo;
|
import com.njcn.common.config.GeneralInfo;
|
||||||
import com.njcn.common.pojo.constant.GeneralConstant;
|
|
||||||
import com.njcn.common.pojo.constant.OssPath;
|
|
||||||
import com.njcn.common.pojo.enums.common.ServerEnum;
|
import com.njcn.common.pojo.enums.common.ServerEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.utils.PubUtils;
|
import com.njcn.common.utils.PubUtils;
|
||||||
|
import com.njcn.oss.constant.GeneralConstant;
|
||||||
|
import com.njcn.oss.constant.OssPath;
|
||||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||||
import com.njcn.device.pq.api.LineFeignClient;
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||||
@@ -48,7 +48,6 @@ import java.time.LocalDateTime;
|
|||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -195,8 +194,6 @@ public class TransientServiceImpl implements TransientService {
|
|||||||
originalData = waveUtil.getComtrade(cfgStream, datStream, 1);
|
originalData = waveUtil.getComtrade(cfgStream, datStream, 1);
|
||||||
// } else if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
// } else if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||||
} else {
|
} else {
|
||||||
ip = "192.168.1.190";
|
|
||||||
waveName = "PQMonitor_PQM1_002438_20210508_092859_938";
|
|
||||||
cfgPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG;
|
cfgPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG;
|
||||||
datPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT;
|
datPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT;
|
||||||
try (
|
try (
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.njcn.event;
|
package com.njcn.event;
|
||||||
|
|
||||||
import com.njcn.common.pojo.constant.OssPath;
|
|
||||||
import com.njcn.event.enums.EventResponseEnum;
|
import com.njcn.event.enums.EventResponseEnum;
|
||||||
import com.njcn.event.pojo.PqsEventDetail;
|
import com.njcn.event.pojo.PqsEventDetail;
|
||||||
import com.njcn.event.pojo.PqsOnlinerateAggregate;
|
import com.njcn.event.pojo.PqsOnlinerateAggregate;
|
||||||
@@ -11,6 +10,7 @@ import com.njcn.event.utils.WaveUtil;
|
|||||||
import com.njcn.huawei.obs.util.OBSUtil;
|
import com.njcn.huawei.obs.util.OBSUtil;
|
||||||
import com.njcn.influxdb.config.InfluxDbConfig;
|
import com.njcn.influxdb.config.InfluxDbConfig;
|
||||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||||
|
import com.njcn.oss.constant.OssPath;
|
||||||
import org.influxdb.dto.QueryResult;
|
import org.influxdb.dto.QueryResult;
|
||||||
import org.influxdb.impl.InfluxDBResultMapper;
|
import org.influxdb.impl.InfluxDBResultMapper;
|
||||||
import org.influxdb.querybuilder.SelectQueryImpl;
|
import org.influxdb.querybuilder.SelectQueryImpl;
|
||||||
@@ -26,12 +26,9 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|||||||
@@ -60,18 +60,9 @@
|
|||||||
<artifactId>event-api</artifactId>
|
<artifactId>event-api</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.njcn</groupId>
|
|
||||||
<artifactId>common-minio</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--调用minio服务器-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>me.tongfei</groupId>
|
|
||||||
<artifactId>progressbar</artifactId>
|
|
||||||
<version>0.5.3</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.squareup.okhttp3</groupId>
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
@@ -101,7 +92,7 @@
|
|||||||
<!--华为obs工具包-->
|
<!--华为obs工具包-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
<artifactId>huawei-obs-springboot-starter</artifactId>
|
<artifactId>common-oss</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@@ -3,23 +3,16 @@ package com.njcn.harmonic.controller.algorithm;
|
|||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.njcn.common.config.GeneralInfo;
|
import com.njcn.common.config.GeneralInfo;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.constant.GeneralConstant;
|
|
||||||
import com.njcn.common.pojo.constant.OssPath;
|
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
|
||||||
import com.njcn.harmonic.enums.HarmonicResponseEnum;
|
|
||||||
import com.njcn.harmonic.pojo.param.RStatFileVO;
|
import com.njcn.harmonic.pojo.param.RStatFileVO;
|
||||||
import com.njcn.harmonic.pojo.po.RStatFile;
|
import com.njcn.harmonic.pojo.po.RStatFile;
|
||||||
import com.njcn.harmonic.pojo.vo.PwRStatOrgVO;
|
|
||||||
import com.njcn.harmonic.service.algorithm.RStatFileService;
|
import com.njcn.harmonic.service.algorithm.RStatFileService;
|
||||||
import com.njcn.huawei.obs.util.OBSUtil;
|
import com.njcn.oss.constant.OssPath;
|
||||||
import com.njcn.minio.bo.MinIoUploadResDTO;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import com.njcn.minio.config.MinIoProperties;
|
|
||||||
import com.njcn.minio.utils.MinIoUtils;
|
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
@@ -29,7 +22,6 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
@@ -41,16 +33,10 @@ public class AlgorithmController extends BaseController {
|
|||||||
|
|
||||||
private final RStatFileService rStatFileService;
|
private final RStatFileService rStatFileService;
|
||||||
|
|
||||||
@Resource
|
private final FileStorageUtil fileStorageUtil;
|
||||||
private MinIoUtils minIoUtils;
|
|
||||||
@Resource
|
|
||||||
private MinIoProperties minIoProperties;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private GeneralInfo generalInfo;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private OBSUtil obsUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 算法保存
|
* 算法保存
|
||||||
@@ -91,16 +77,7 @@ public class AlgorithmController extends BaseController {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
public HttpResult<String> uploadFile(MultipartFile file) {
|
public HttpResult<String> uploadFile(MultipartFile file) {
|
||||||
try {
|
try {
|
||||||
//为2则为:华为OBS
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, fileStorageUtil.uploadMultipart(file,OssPath.ALGORITHM), null);
|
||||||
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
|
||||||
String fileName = file.getOriginalFilename();
|
|
||||||
fileName = OssPath.ALGORITHM + minIoUtils.minFileName(fileName);
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, obsUtil.multiFileUpload(file, fileName), null);
|
|
||||||
} else {
|
|
||||||
//把名称存入数据
|
|
||||||
MinIoUploadResDTO upload = minIoUtils.upload(file, minIoProperties.getBucket(), OssPath.ALGORITHM);
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, upload.getMinFileUrl(), null);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, null);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.harmonic.service.impl;
|
package com.njcn.harmonic.service.impl;
|
||||||
|
|
||||||
|
import ch.qos.logback.core.rolling.helper.FileStoreUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
@@ -8,8 +9,6 @@ import cn.hutool.json.JSONObject;
|
|||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.njcn.common.config.GeneralInfo;
|
import com.njcn.common.config.GeneralInfo;
|
||||||
import com.njcn.common.pojo.constant.GeneralConstant;
|
|
||||||
import com.njcn.common.pojo.constant.OssPath;
|
|
||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.harmonic.enums.HarmonicResponseEnum;
|
import com.njcn.harmonic.enums.HarmonicResponseEnum;
|
||||||
@@ -28,14 +27,11 @@ import com.njcn.harmonic.pojo.vo.ReportTemplateVO;
|
|||||||
import com.njcn.harmonic.pojo.vo.ReportTreeVO;
|
import com.njcn.harmonic.pojo.vo.ReportTreeVO;
|
||||||
import com.njcn.harmonic.pojo.vo.SysDeptTempVO;
|
import com.njcn.harmonic.pojo.vo.SysDeptTempVO;
|
||||||
import com.njcn.harmonic.service.CustomReportService;
|
import com.njcn.harmonic.service.CustomReportService;
|
||||||
import com.njcn.huawei.obs.util.OBSUtil;
|
|
||||||
import com.njcn.influxdb.config.InfluxDbConfig;
|
|
||||||
import com.njcn.influxdb.param.InfluxDBSqlConstant;
|
import com.njcn.influxdb.param.InfluxDBSqlConstant;
|
||||||
import com.njcn.influxdb.param.InfluxDBTableConstant;
|
import com.njcn.influxdb.param.InfluxDBTableConstant;
|
||||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||||
import com.njcn.minio.bo.MinIoUploadResDTO;
|
import com.njcn.oss.constant.OssPath;
|
||||||
import com.njcn.minio.config.MinIoProperties;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import com.njcn.minio.utils.MinIoUtils;
|
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
import com.njcn.user.api.DeptFeignClient;
|
import com.njcn.user.api.DeptFeignClient;
|
||||||
import com.njcn.user.pojo.dto.DeptDTO;
|
import com.njcn.user.pojo.dto.DeptDTO;
|
||||||
@@ -92,17 +88,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
|
|
||||||
private final GeneralInfo generalInfo;
|
private final GeneralInfo generalInfo;
|
||||||
|
|
||||||
@Resource
|
private final FileStorageUtil fileStorageUtil;
|
||||||
private MinIoUtils minIoUtils;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private MinIoProperties minIoProperties;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private InfluxDbConfig influxDbConfig;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private OBSUtil obsUtil;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -117,20 +103,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_JSON);
|
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_JSON);
|
||||||
}
|
}
|
||||||
|
reportTemplateParam.setContent(fileStorageUtil.uploadMultipart(fileContent, OssPath.HARMONIC_EXCEL_TEMPLATE));
|
||||||
//为2则为:华为OBS
|
|
||||||
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
|
||||||
fileName = OssPath.HARMONIC_EXCEL_TEMPLATE + minIoUtils.minFileName(fileName);
|
|
||||||
obsUtil.multiFileUpload(fileContent,fileName);
|
|
||||||
reportTemplateParam.setContent(fileName);
|
|
||||||
} else {
|
|
||||||
//否则认为是minioss
|
|
||||||
//文件上传到Minio服务器,存入文件名
|
|
||||||
MinIoUploadResDTO minIoUploadResDTO = contentToMinio(reportTemplateParam.getFileContent(), OssPath.HARMONIC_EXCEL_TEMPLATE);
|
|
||||||
reportTemplateParam.setContent(minIoUploadResDTO.getMinFileName());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//新增模板表
|
//新增模板表
|
||||||
ExcelRptTemp excelRptTemp = new ExcelRptTemp();
|
ExcelRptTemp excelRptTemp = new ExcelRptTemp();
|
||||||
BeanUtils.copyProperties(reportTemplateParam, excelRptTemp);
|
BeanUtils.copyProperties(reportTemplateParam, excelRptTemp);
|
||||||
@@ -155,7 +128,6 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
public boolean updateCustomReportTemplate(ReportTemplateParam.UpdateReportTemplateParam reportTemplateParam) {
|
public boolean updateCustomReportTemplate(ReportTemplateParam.UpdateReportTemplateParam reportTemplateParam) {
|
||||||
checkName(reportTemplateParam, true);
|
checkName(reportTemplateParam, true);
|
||||||
MultipartFile fileContent = reportTemplateParam.getFileContent();
|
MultipartFile fileContent = reportTemplateParam.getFileContent();
|
||||||
String fileName = fileContent.getName();
|
|
||||||
//检验模板json数据规范
|
//检验模板json数据规范
|
||||||
try {
|
try {
|
||||||
String content = MultipartFileToString(fileContent);
|
String content = MultipartFileToString(fileContent);
|
||||||
@@ -166,18 +138,8 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
|
|
||||||
//删除之前的文件
|
//删除之前的文件
|
||||||
ExcelRptTemp excelRptTempOld = excelRptTempMapper.selectById(reportTemplateParam.getId());
|
ExcelRptTemp excelRptTempOld = excelRptTempMapper.selectById(reportTemplateParam.getId());
|
||||||
//为2则为:华为OBS
|
fileStorageUtil.deleteFile(excelRptTempOld.getContent());
|
||||||
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
reportTemplateParam.setContent(fileStorageUtil.uploadMultipart(fileContent, OssPath.HARMONIC_EXCEL_TEMPLATE));
|
||||||
obsUtil.delete(excelRptTempOld.getContent());
|
|
||||||
fileName = OssPath.HARMONIC_EXCEL_TEMPLATE + minIoUtils.minFileName(fileName);
|
|
||||||
obsUtil.multiFileUpload(fileContent,fileName);
|
|
||||||
reportTemplateParam.setContent(fileName);
|
|
||||||
}else{
|
|
||||||
minIoUtils.removeObject(minIoProperties.getBucket(), excelRptTempOld.getContent());
|
|
||||||
//文件上传到Minio服务器,存入文件名
|
|
||||||
MinIoUploadResDTO minIoUploadResDTO = contentToMinio(reportTemplateParam.getFileContent(), OssPath.HARMONIC_EXCEL_TEMPLATE);
|
|
||||||
reportTemplateParam.setContent(minIoUploadResDTO.getMinFileName());
|
|
||||||
}
|
|
||||||
//修改模板数据
|
//修改模板数据
|
||||||
ExcelRptTemp excelRptTemp = new ExcelRptTemp();
|
ExcelRptTemp excelRptTemp = new ExcelRptTemp();
|
||||||
BeanUtils.copyProperties(reportTemplateParam, excelRptTemp);
|
BeanUtils.copyProperties(reportTemplateParam, excelRptTemp);
|
||||||
@@ -218,7 +180,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
@Override
|
@Override
|
||||||
public ExcelRptTemp getCustomReportTemplateById(String id) {
|
public ExcelRptTemp getCustomReportTemplateById(String id) {
|
||||||
ExcelRptTemp excelRptTemp = excelRptTempMapper.selectById(id);
|
ExcelRptTemp excelRptTemp = excelRptTempMapper.selectById(id);
|
||||||
String contentUrl = minIoUtils.getObjectUrl(minIoProperties.getBucket(), excelRptTemp.getContent(), 7 * 24 * 60 * 60);
|
String contentUrl = fileStorageUtil.getFileUrl(excelRptTemp.getContent());
|
||||||
excelRptTemp.setContent(contentUrl);
|
excelRptTemp.setContent(contentUrl);
|
||||||
return excelRptTemp;
|
return excelRptTemp;
|
||||||
}
|
}
|
||||||
@@ -265,9 +227,9 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
List<ExcelRpt> excelRpts = excelRptMapper.selectList(lambdaQuery);
|
List<ExcelRpt> excelRpts = excelRptMapper.selectList(lambdaQuery);
|
||||||
String content;
|
String content;
|
||||||
if (excelRpts.size() > 0) {
|
if (excelRpts.size() > 0) {
|
||||||
content = minIoUtils.getObjectUrl(minIoProperties.getBucket(), excelRpts.get(0).getContent(), 7 * 24 * 60 * 60);
|
content = fileStorageUtil.getFileUrl(excelRpts.get(0).getContent());
|
||||||
} else {
|
} else {
|
||||||
content = minIoUtils.getObjectUrl(minIoProperties.getBucket(), analyzeReport(reportSearchParam, excelRptTemp), 7 * 24 * 60 * 60);
|
content = fileStorageUtil.getFileUrl(analyzeReport(reportSearchParam, excelRptTemp));
|
||||||
}
|
}
|
||||||
|
|
||||||
//拼接数据
|
//拼接数据
|
||||||
@@ -394,7 +356,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
JSONArray jsonArray = null;
|
JSONArray jsonArray = null;
|
||||||
try {
|
try {
|
||||||
//通过文件服务器获取
|
//通过文件服务器获取
|
||||||
String objectUrl = minIoUtils.getObjectUrl(minIoProperties.getBucket(), excelRptTemp.getContent(), 7 * 24 * 60 * 60);
|
String objectUrl = fileStorageUtil.getFileUrl(excelRptTemp.getContent());
|
||||||
jsonArray = JSONUtil.parseArray(urlToString(objectUrl));
|
jsonArray = JSONUtil.parseArray(urlToString(objectUrl));
|
||||||
jsonArray.forEach(item -> {
|
jsonArray.forEach(item -> {
|
||||||
JSONObject jsonObject = (JSONObject) item;
|
JSONObject jsonObject = (JSONObject) item;
|
||||||
@@ -486,22 +448,9 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
String newContent;
|
|
||||||
File newFile = stringToFile(jsonArray.toString());
|
File newFile = stringToFile(jsonArray.toString());
|
||||||
MultipartFile newMultipartFile = getMultipartFile(newFile);
|
MultipartFile newMultipartFile = getMultipartFile(newFile);
|
||||||
//为2则为:华为OBS
|
String newContent = fileStorageUtil.uploadMultipart(newMultipartFile, OssPath.HARMONIC_EXCEL_REPORT);
|
||||||
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
|
||||||
newContent = newMultipartFile.getName();
|
|
||||||
newContent = OssPath.HARMONIC_EXCEL_REPORT + minIoUtils.minFileName(newContent);
|
|
||||||
obsUtil.multiFileUpload(newMultipartFile,newContent);
|
|
||||||
}else{
|
|
||||||
//否则认为是minioss
|
|
||||||
//文件上传到Minio服务器,存入文件名
|
|
||||||
MinIoUploadResDTO minIoUploadResDTO = contentToMinio(newMultipartFile,OssPath.HARMONIC_EXCEL_REPORT);
|
|
||||||
newContent = minIoUploadResDTO.getMinFileName();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//存入报表库
|
//存入报表库
|
||||||
ExcelRpt excelRpt = new ExcelRpt();
|
ExcelRpt excelRpt = new ExcelRpt();
|
||||||
@@ -574,21 +523,6 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
endList.add(data);
|
endList.add(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传文件到Minio
|
|
||||||
*
|
|
||||||
* @param file 文件
|
|
||||||
* @return 成功标记
|
|
||||||
*/
|
|
||||||
private MinIoUploadResDTO contentToMinio(MultipartFile file, String dir) {
|
|
||||||
try {
|
|
||||||
//把名称存入数据
|
|
||||||
MinIoUploadResDTO upload = minIoUtils.upload(file, minIoProperties.getBucket(), dir);
|
|
||||||
return upload;
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_FILE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件Url 转 String
|
* 文件Url 转 String
|
||||||
@@ -619,7 +553,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
String businessTempPath = generalInfo.getBusinessTempPath();
|
String businessTempPath = generalInfo.getBusinessTempPath();
|
||||||
File distFile = new File(businessTempPath + File.separator + "temp.json");
|
File distFile = new File(businessTempPath + File.separator + "temp.json");
|
||||||
try {
|
try {
|
||||||
if (!distFile.getParentFile().exists()){
|
if (!distFile.getParentFile().exists()) {
|
||||||
distFile.getParentFile().mkdirs();
|
distFile.getParentFile().mkdirs();
|
||||||
}
|
}
|
||||||
bufferedReader = new BufferedReader(new StringReader(res));
|
bufferedReader = new BufferedReader(new StringReader(res));
|
||||||
|
|||||||
@@ -112,16 +112,11 @@
|
|||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
<artifactId>common-minio</artifactId>
|
<artifactId>common-oss</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--调用minio服务器-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>me.tongfei</groupId>
|
|
||||||
<artifactId>progressbar</artifactId>
|
|
||||||
<version>0.5.3</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.squareup.okhttp3</groupId>
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
@@ -129,17 +124,6 @@
|
|||||||
<version>4.8.1</version>
|
<version>4.8.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.minio</groupId>
|
|
||||||
<artifactId>minio</artifactId>
|
|
||||||
<version>8.2.1</version>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>com.squareup.okhttp3</groupId>
|
|
||||||
<artifactId>okhttp</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ import com.njcn.harmonic.pojo.po.ExcelRptTemp;
|
|||||||
import com.njcn.influxdb.param.InfluxDBSqlConstant;
|
import com.njcn.influxdb.param.InfluxDBSqlConstant;
|
||||||
import com.njcn.influxdb.param.InfluxDBTableConstant;
|
import com.njcn.influxdb.param.InfluxDBTableConstant;
|
||||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||||
import com.njcn.minio.bo.MinIoUploadResDTO;
|
import com.njcn.minioss.bo.MinIoUploadResDTO;
|
||||||
import com.njcn.minio.config.MinIoProperties;
|
import com.njcn.oss.constant.OssPath;
|
||||||
import com.njcn.minio.utils.MinIoUtils;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import com.njcn.prepare.harmonic.constant.AlgorithmParam;
|
import com.njcn.prepare.harmonic.constant.AlgorithmParam;
|
||||||
import com.njcn.prepare.harmonic.mapper.mysql.line.ExcelRptMapper;
|
import com.njcn.prepare.harmonic.mapper.mysql.line.ExcelRptMapper;
|
||||||
import com.njcn.prepare.harmonic.mapper.mysql.line.ExcelRptTempMapper;
|
import com.njcn.prepare.harmonic.mapper.mysql.line.ExcelRptTempMapper;
|
||||||
@@ -65,11 +65,7 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
|
|
||||||
private final GeneralInfo generalInfo;
|
private final GeneralInfo generalInfo;
|
||||||
|
|
||||||
@Resource
|
private final FileStorageUtil fileStorageUtil;
|
||||||
private MinIoUtils minIoUtils;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private MinIoProperties minIoProperties;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -100,7 +96,7 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
for (ExcelRptTemp excelRptTemp : reportTemplateList) {
|
for (ExcelRptTemp excelRptTemp : reportTemplateList) {
|
||||||
try {
|
try {
|
||||||
//获取content解析数据
|
//获取content解析数据
|
||||||
String objectUrl = minIoUtils.getObjectUrl(minIoProperties.getBucket(), excelRptTemp.getContent(), 7 * 24 * 60 * 60);
|
String objectUrl = fileStorageUtil.getFileUrl(excelRptTemp.getContent());
|
||||||
jsonArray = JSONUtil.parseArray(urlToString(objectUrl));
|
jsonArray = JSONUtil.parseArray(urlToString(objectUrl));
|
||||||
dataList = getDataList(jsonArray);
|
dataList = getDataList(jsonArray);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -144,13 +140,11 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
//月:例如2022十月份,传入2022-10-01进行匹配,有则更新无则插入
|
//月:例如2022十月份,传入2022-10-01进行匹配,有则更新无则插入
|
||||||
//周:例如2022年第五周,传入2022-01-23(周一)进行匹配,有则更新无则插入
|
//周:例如2022年第五周,传入2022-01-23(周一)进行匹配,有则更新无则插入
|
||||||
//日:直接插入,无需配对
|
//日:直接插入,无需配对
|
||||||
//文件上传到Minio服务器,存入文件名
|
//文件上传到文件服务器,存入文件名
|
||||||
MinIoUploadResDTO minIoUploadResDTO = contentToMinio(jsonArray.toString());
|
|
||||||
String afterContent = minIoUploadResDTO.getMinFileName();
|
|
||||||
if (BizParamConstant.STAT_BIZ_DAY.equals(reportParam.getType().toString())){
|
if (BizParamConstant.STAT_BIZ_DAY.equals(reportParam.getType().toString())){
|
||||||
rptInsert(reportParam, lineId, excelRptTemp, afterContent);
|
rptInsert(reportParam, lineId, excelRptTemp, contentToOss(jsonArray.toString()));
|
||||||
}else{
|
}else{
|
||||||
rptBiz(reportParam, lineId, excelRptTemp, afterContent);
|
rptBiz(reportParam, lineId, excelRptTemp, contentToOss(jsonArray.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -331,23 +325,17 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传文件到Minio
|
* 上传文件到Oss
|
||||||
*
|
*
|
||||||
* @param content 文件
|
* @param content 文件
|
||||||
* @return 成功标记
|
* @return 成功标记
|
||||||
*/
|
*/
|
||||||
private MinIoUploadResDTO contentToMinio(String content) {
|
private String contentToOss(String content) {
|
||||||
//上传到minio
|
//上传到minio
|
||||||
String businessTempPath = generalInfo.getBusinessTempPath();
|
String businessTempPath = generalInfo.getBusinessTempPath();
|
||||||
File file = stringToFile(content, businessTempPath + File.separator + "a.json");
|
File file = stringToFile(content, businessTempPath + File.separator + "temp.json");
|
||||||
MultipartFile multiFile = getMultipartFile(file);
|
MultipartFile multiFile = getMultipartFile(file);
|
||||||
try {
|
return fileStorageUtil.uploadMultipart(multiFile, OssPath.HARMONIC_EXCEL_REPORT);
|
||||||
//把名称存入数据
|
|
||||||
MinIoUploadResDTO upload = minIoUtils.upload(multiFile, minIoProperties.getBucket(), "report/");
|
|
||||||
return upload;
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_FILE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -16,10 +16,8 @@ public enum ProcessResponseEnum {
|
|||||||
* A00550 ~ A00649
|
* A00550 ~ A00649
|
||||||
*/
|
*/
|
||||||
PROCESS_COMMON_ERROR("A00550","监督管理模块异常"),
|
PROCESS_COMMON_ERROR("A00550","监督管理模块异常"),
|
||||||
UPLOAD_FILE_ERROR("A00551","上传文件服务器错误,请检查数据"),
|
|
||||||
ARCHIVE_ERROR("A00552","不满足归档调节,操作失败!"),
|
ARCHIVE_ERROR("A00552","不满足归档调节,操作失败!"),
|
||||||
PROCESS_ERROR("A00553","当前流程未审核通过,操作失败!"),
|
PROCESS_ERROR("A00553","当前流程未审核通过,操作失败!"),
|
||||||
DOWNLOAD_FILE_ERROR("A00554","下载文件URL不存在,请检查数据"),
|
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -67,18 +67,9 @@
|
|||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--调用minio服务器-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.njcn</groupId>
|
|
||||||
<artifactId>common-minio</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>me.tongfei</groupId>
|
|
||||||
<artifactId>progressbar</artifactId>
|
|
||||||
<version>0.5.3</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.squareup.okhttp3</groupId>
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
@@ -117,7 +108,7 @@
|
|||||||
<!--华为obs工具包-->
|
<!--华为obs工具包-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
<artifactId>huawei-obs-springboot-starter</artifactId>
|
<artifactId>common-oss</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import com.njcn.common.pojo.enums.common.LogEnum;
|
|||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.minio.bo.MinIoUploadResDTO;
|
|
||||||
import com.njcn.process.pojo.param.*;
|
import com.njcn.process.pojo.param.*;
|
||||||
import com.njcn.process.pojo.vo.*;
|
import com.njcn.process.pojo.vo.*;
|
||||||
import com.njcn.process.service.IssuesService;
|
import com.njcn.process.service.IssuesService;
|
||||||
@@ -185,11 +184,11 @@ public class ElectricityQualityIssuesController extends BaseController {
|
|||||||
@PostMapping("/uploadFile")
|
@PostMapping("/uploadFile")
|
||||||
@ApiOperation("上传文件")
|
@ApiOperation("上传文件")
|
||||||
@ApiImplicitParam(name = "file", value = "填报进度文件", required = true)
|
@ApiImplicitParam(name = "file", value = "填报进度文件", required = true)
|
||||||
public HttpResult<MinIoUploadResDTO> uploadFile(@RequestParam("file") MultipartFile issuesFile){
|
public HttpResult<String> uploadFile(@RequestParam("file") MultipartFile issuesFile){
|
||||||
String methodDescribe = getMethodDescribe("uploadFile");
|
String methodDescribe = getMethodDescribe("uploadFile");
|
||||||
MinIoUploadResDTO out = issuesService.uploadFile(issuesFile);
|
String filePath = issuesService.uploadFile(issuesFile);
|
||||||
out.setMinFileName(issuesFile.getOriginalFilename());
|
// out.setMinFileName(issuesFile.getOriginalFilename());
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, out, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, filePath, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import com.njcn.common.pojo.enums.common.LogEnum;
|
|||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.minio.bo.MinIoUploadResDTO;
|
import com.njcn.minioss.bo.MinIoUploadResDTO;
|
||||||
import com.njcn.poi.util.PoiUtil;
|
import com.njcn.poi.util.PoiUtil;
|
||||||
import com.njcn.process.pojo.param.*;
|
import com.njcn.process.pojo.param.*;
|
||||||
import com.njcn.process.pojo.po.RGeneralSurveyPlanPO;
|
import com.njcn.process.pojo.po.RGeneralSurveyPlanPO;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.njcn.process.service;
|
package com.njcn.process.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.minio.bo.MinIoUploadResDTO;
|
|
||||||
import com.njcn.process.pojo.param.*;
|
import com.njcn.process.pojo.param.*;
|
||||||
import com.njcn.process.pojo.vo.*;
|
import com.njcn.process.pojo.vo.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@@ -79,7 +78,7 @@ public interface IssuesService {
|
|||||||
/**
|
/**
|
||||||
* 上传文件
|
* 上传文件
|
||||||
*/
|
*/
|
||||||
MinIoUploadResDTO uploadFile(MultipartFile issuesFile);
|
String uploadFile(MultipartFile issuesFile);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下载文件
|
* 下载文件
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package com.njcn.process.service;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||||
import com.njcn.minio.bo.MinIoUploadResDTO;
|
import com.njcn.minioss.bo.MinIoUploadResDTO;
|
||||||
import com.njcn.process.pojo.param.*;
|
import com.njcn.process.pojo.param.*;
|
||||||
import com.njcn.process.pojo.po.RGeneralSurveyPlanPO;
|
import com.njcn.process.pojo.po.RGeneralSurveyPlanPO;
|
||||||
import com.njcn.process.pojo.vo.SurveyPlanExcel;
|
import com.njcn.process.pojo.vo.SurveyPlanExcel;
|
||||||
|
|||||||
@@ -13,9 +13,8 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.pojo.constant.BizParamConstant;
|
import com.njcn.common.pojo.constant.BizParamConstant;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.minio.bo.MinIoUploadResDTO;
|
import com.njcn.oss.constant.OssPath;
|
||||||
import com.njcn.minio.config.MinIoProperties;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import com.njcn.minio.utils.MinIoUtils;
|
|
||||||
import com.njcn.process.enums.ProcessResponseEnum;
|
import com.njcn.process.enums.ProcessResponseEnum;
|
||||||
import com.njcn.process.mapper.*;
|
import com.njcn.process.mapper.*;
|
||||||
import com.njcn.process.pojo.param.*;
|
import com.njcn.process.pojo.param.*;
|
||||||
@@ -41,6 +40,7 @@ import java.util.Objects;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 电能质量问题实现类
|
* 电能质量问题实现类
|
||||||
|
*
|
||||||
* @author xiaoyao
|
* @author xiaoyao
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @createTime 2022/11/14 11:03
|
* @createTime 2022/11/14 11:03
|
||||||
@@ -68,19 +68,15 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
|
|
||||||
private final RStatElectricQualityProblemLogMapper rStatElectricQualityProblemLogMapper;
|
private final RStatElectricQualityProblemLogMapper rStatElectricQualityProblemLogMapper;
|
||||||
|
|
||||||
@Resource
|
private final FileStorageUtil fileStorageUtil;
|
||||||
private MinIoUtils minIoUtils;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private MinIoProperties minIoProperties;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增电能质量问题流程表信息
|
* 新增电能质量问题流程表信息
|
||||||
*/
|
*/
|
||||||
private LocalDateTime addIssues(IssuesParam issuesParam,String powerQualityProblemNo){
|
private LocalDateTime addIssues(IssuesParam issuesParam, String powerQualityProblemNo) {
|
||||||
RStatElectricQualityProblemFlow issues = new RStatElectricQualityProblemFlow();
|
RStatElectricQualityProblemFlow issues = new RStatElectricQualityProblemFlow();
|
||||||
LocalDateTime local = LocalDateTimeUtil.now();
|
LocalDateTime local = LocalDateTimeUtil.now();
|
||||||
BeanUtil.copyProperties(issuesParam,issues);
|
BeanUtil.copyProperties(issuesParam, issues);
|
||||||
issues.setPowerQualityProblemNo(powerQualityProblemNo);
|
issues.setPowerQualityProblemNo(powerQualityProblemNo);
|
||||||
issues.setDataDate(local);
|
issues.setDataDate(local);
|
||||||
issues.setStartTime(null);
|
issues.setStartTime(null);
|
||||||
@@ -94,16 +90,16 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
/**
|
/**
|
||||||
* 生成问题编号
|
* 生成问题编号
|
||||||
*/
|
*/
|
||||||
private String getPowerQualityProblemNo(IssuesParam issuesParam){
|
private String getPowerQualityProblemNo(IssuesParam issuesParam) {
|
||||||
StringBuilder powerQualityProblemNo = new StringBuilder();
|
StringBuilder powerQualityProblemNo = new StringBuilder();
|
||||||
powerQualityProblemNo.append(PinyinUtil.getFirstLetter(issuesParam.getOrgName(),"").toUpperCase()).append("-");
|
powerQualityProblemNo.append(PinyinUtil.getFirstLetter(issuesParam.getOrgName(), "").toUpperCase()).append("-");
|
||||||
if (DicDataEnum.ONLINE.getCode().equals(issuesParam.getProblemSources())){
|
if (DicDataEnum.ONLINE.getCode().equals(issuesParam.getProblemSources())) {
|
||||||
powerQualityProblemNo.append("ZXJC");
|
powerQualityProblemNo.append("ZXJC");
|
||||||
}else if (DicDataEnum.GENERAL.getCode().equals(issuesParam.getProblemSources())){
|
} else if (DicDataEnum.GENERAL.getCode().equals(issuesParam.getProblemSources())) {
|
||||||
powerQualityProblemNo.append("PCCB");
|
powerQualityProblemNo.append("PCCB");
|
||||||
}else if (DicDataEnum.USER_COMPLAINTS.getCode().equals(issuesParam.getProblemSources())){
|
} else if (DicDataEnum.USER_COMPLAINTS.getCode().equals(issuesParam.getProblemSources())) {
|
||||||
powerQualityProblemNo.append("YHTS");
|
powerQualityProblemNo.append("YHTS");
|
||||||
}else if (DicDataEnum.DEV_EXCEPTION.getCode().equals(issuesParam.getProblemSources())){
|
} else if (DicDataEnum.DEV_EXCEPTION.getCode().equals(issuesParam.getProblemSources())) {
|
||||||
powerQualityProblemNo.append("YWYC");
|
powerQualityProblemNo.append("YWYC");
|
||||||
}
|
}
|
||||||
String nowDate = DateUtil.format(new Date(), "yyyyMMdd");
|
String nowDate = DateUtil.format(new Date(), "yyyyMMdd");
|
||||||
@@ -112,9 +108,9 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
LambdaQueryWrapper<RStatElectricQualityProblemFlow> issuesQuery = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RStatElectricQualityProblemFlow> issuesQuery = new LambdaQueryWrapper<>();
|
||||||
LocalDateTime local = LocalDateTimeUtil.parse(processDate + "T00:00:00");
|
LocalDateTime local = LocalDateTimeUtil.parse(processDate + "T00:00:00");
|
||||||
LocalDateTime localEnd = LocalDateTimeUtil.parse(processDate + "T23:59:59");
|
LocalDateTime localEnd = LocalDateTimeUtil.parse(processDate + "T23:59:59");
|
||||||
issuesQuery.ge(RStatElectricQualityProblemFlow::getDataDate, local).le(RStatElectricQualityProblemFlow::getDataDate,localEnd);
|
issuesQuery.ge(RStatElectricQualityProblemFlow::getDataDate, local).le(RStatElectricQualityProblemFlow::getDataDate, localEnd);
|
||||||
Integer count = issuesMapper.selectCount(issuesQuery);
|
Integer count = issuesMapper.selectCount(issuesQuery);
|
||||||
powerQualityProblemNo.append(StrUtil.padPre(String.valueOf(count + 1),5, '0'));
|
powerQualityProblemNo.append(StrUtil.padPre(String.valueOf(count + 1), 5, '0'));
|
||||||
return powerQualityProblemNo.toString();
|
return powerQualityProblemNo.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,11 +120,11 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
@Override
|
@Override
|
||||||
public void addExcessiveIssues(ExcessiveParam excessiveParam) {
|
public void addExcessiveIssues(ExcessiveParam excessiveParam) {
|
||||||
IssuesParam issuesParam = new IssuesParam();
|
IssuesParam issuesParam = new IssuesParam();
|
||||||
BeanUtil.copyProperties(excessiveParam,issuesParam);
|
BeanUtil.copyProperties(excessiveParam, issuesParam);
|
||||||
String powerQualityProblemNo = getPowerQualityProblemNo(issuesParam);
|
String powerQualityProblemNo = getPowerQualityProblemNo(issuesParam);
|
||||||
LocalDateTime localDateTime = addIssues(issuesParam,powerQualityProblemNo);
|
LocalDateTime localDateTime = addIssues(issuesParam, powerQualityProblemNo);
|
||||||
RMpOnlineMonitorOverproofProblem excessive = new RMpOnlineMonitorOverproofProblem();
|
RMpOnlineMonitorOverproofProblem excessive = new RMpOnlineMonitorOverproofProblem();
|
||||||
BeanUtil.copyProperties(excessiveParam,excessive);
|
BeanUtil.copyProperties(excessiveParam, excessive);
|
||||||
excessive.setPowerQualityProblemNo(powerQualityProblemNo);
|
excessive.setPowerQualityProblemNo(powerQualityProblemNo);
|
||||||
excessive.setDataDate(localDateTime);
|
excessive.setDataDate(localDateTime);
|
||||||
excessiveMapper.insert(excessive);
|
excessiveMapper.insert(excessive);
|
||||||
@@ -140,12 +136,12 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
@Override
|
@Override
|
||||||
public void addGeneralSurveyIssues(GeneralSurveyParam generalSurveyParam) {
|
public void addGeneralSurveyIssues(GeneralSurveyParam generalSurveyParam) {
|
||||||
IssuesParam issuesParam = new IssuesParam();
|
IssuesParam issuesParam = new IssuesParam();
|
||||||
BeanUtil.copyProperties(generalSurveyParam,issuesParam);
|
BeanUtil.copyProperties(generalSurveyParam, issuesParam);
|
||||||
String powerQualityProblemNo = getPowerQualityProblemNo(issuesParam);
|
String powerQualityProblemNo = getPowerQualityProblemNo(issuesParam);
|
||||||
LocalDateTime localDateTime = addIssues(issuesParam,powerQualityProblemNo);
|
LocalDateTime localDateTime = addIssues(issuesParam, powerQualityProblemNo);
|
||||||
RMpGeneralSurveyOverproofProblem generalSurvey = new RMpGeneralSurveyOverproofProblem();
|
RMpGeneralSurveyOverproofProblem generalSurvey = new RMpGeneralSurveyOverproofProblem();
|
||||||
BeanUtil.copyProperties(generalSurveyParam,generalSurvey);
|
BeanUtil.copyProperties(generalSurveyParam, generalSurvey);
|
||||||
generalSurvey.setOverLimitTarget(ArrayUtil.toString(generalSurveyParam.getSteadyState())+ArrayUtil.toString(generalSurveyParam.getTransientIndicators()));
|
generalSurvey.setOverLimitTarget(ArrayUtil.toString(generalSurveyParam.getSteadyState()) + ArrayUtil.toString(generalSurveyParam.getTransientIndicators()));
|
||||||
generalSurvey.setPowerQualityProblemNo(powerQualityProblemNo);
|
generalSurvey.setPowerQualityProblemNo(powerQualityProblemNo);
|
||||||
generalSurvey.setDataDate(localDateTime);
|
generalSurvey.setDataDate(localDateTime);
|
||||||
generalSurveyMapper.insert(generalSurvey);
|
generalSurveyMapper.insert(generalSurvey);
|
||||||
@@ -157,12 +153,12 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
@Override
|
@Override
|
||||||
public void addComplaintIssues(ComplaintParam complaintParam) {
|
public void addComplaintIssues(ComplaintParam complaintParam) {
|
||||||
IssuesParam issuesParam = new IssuesParam();
|
IssuesParam issuesParam = new IssuesParam();
|
||||||
BeanUtil.copyProperties(complaintParam,issuesParam);
|
BeanUtil.copyProperties(complaintParam, issuesParam);
|
||||||
String powerQualityProblemNo = getPowerQualityProblemNo(issuesParam);
|
String powerQualityProblemNo = getPowerQualityProblemNo(issuesParam);
|
||||||
LocalDateTime localDateTime = addIssues(issuesParam,powerQualityProblemNo);
|
LocalDateTime localDateTime = addIssues(issuesParam, powerQualityProblemNo);
|
||||||
RMpUserComplaint complaint = new RMpUserComplaint();
|
RMpUserComplaint complaint = new RMpUserComplaint();
|
||||||
BeanUtil.copyProperties(complaintParam,complaint);
|
BeanUtil.copyProperties(complaintParam, complaint);
|
||||||
complaint.setAbnormalTarget(ArrayUtil.toString(complaintParam.getSteadyState())+ArrayUtil.toString(complaintParam.getTransientIndicators()));
|
complaint.setAbnormalTarget(ArrayUtil.toString(complaintParam.getSteadyState()) + ArrayUtil.toString(complaintParam.getTransientIndicators()));
|
||||||
complaint.setPowerQualityProblemNo(powerQualityProblemNo);
|
complaint.setPowerQualityProblemNo(powerQualityProblemNo);
|
||||||
complaint.setDataDate(localDateTime);
|
complaint.setDataDate(localDateTime);
|
||||||
complaintMapper.insert(complaint);
|
complaintMapper.insert(complaint);
|
||||||
@@ -174,12 +170,12 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
@Override
|
@Override
|
||||||
public void addAbnormalIssues(AbnormalParam abnormalParam) {
|
public void addAbnormalIssues(AbnormalParam abnormalParam) {
|
||||||
IssuesParam issuesParam = new IssuesParam();
|
IssuesParam issuesParam = new IssuesParam();
|
||||||
BeanUtil.copyProperties(abnormalParam,issuesParam);
|
BeanUtil.copyProperties(abnormalParam, issuesParam);
|
||||||
String powerQualityProblemNo = getPowerQualityProblemNo(issuesParam);
|
String powerQualityProblemNo = getPowerQualityProblemNo(issuesParam);
|
||||||
LocalDateTime localDateTime = addIssues(issuesParam,powerQualityProblemNo);
|
LocalDateTime localDateTime = addIssues(issuesParam, powerQualityProblemNo);
|
||||||
RMpOperationMonitorAbnormal abnormal = new RMpOperationMonitorAbnormal();
|
RMpOperationMonitorAbnormal abnormal = new RMpOperationMonitorAbnormal();
|
||||||
BeanUtil.copyProperties(abnormalParam,abnormal);
|
BeanUtil.copyProperties(abnormalParam, abnormal);
|
||||||
abnormal.setAbnormalTarget(ArrayUtil.toString(abnormalParam.getSteadyState())+ArrayUtil.toString(abnormalParam.getTransientIndicators()));
|
abnormal.setAbnormalTarget(ArrayUtil.toString(abnormalParam.getSteadyState()) + ArrayUtil.toString(abnormalParam.getTransientIndicators()));
|
||||||
abnormal.setPowerQualityProblemNo(powerQualityProblemNo);
|
abnormal.setPowerQualityProblemNo(powerQualityProblemNo);
|
||||||
abnormal.setDataDate(localDateTime);
|
abnormal.setDataDate(localDateTime);
|
||||||
abnormalMapper.insert(abnormal);
|
abnormalMapper.insert(abnormal);
|
||||||
@@ -194,26 +190,26 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
Date dateOut = DateUtil.parse(param.getDataDate());
|
Date dateOut = DateUtil.parse(param.getDataDate());
|
||||||
Date dateBegin = new Date();
|
Date dateBegin = new Date();
|
||||||
Date dateEnd = new Date();
|
Date dateEnd = new Date();
|
||||||
if (Integer.valueOf(BizParamConstant.STAT_BIZ_YEAR).equals(param.getDataType())){
|
if (Integer.valueOf(BizParamConstant.STAT_BIZ_YEAR).equals(param.getDataType())) {
|
||||||
dateBegin = DateUtil.beginOfYear(dateOut);
|
dateBegin = DateUtil.beginOfYear(dateOut);
|
||||||
dateEnd = DateUtil.endOfYear(dateOut);
|
dateEnd = DateUtil.endOfYear(dateOut);
|
||||||
}else if (Integer.valueOf(BizParamConstant.STAT_BIZ_QUARTER).equals(param.getDataType())){
|
} else if (Integer.valueOf(BizParamConstant.STAT_BIZ_QUARTER).equals(param.getDataType())) {
|
||||||
dateBegin = DateUtil.beginOfQuarter(dateOut);
|
dateBegin = DateUtil.beginOfQuarter(dateOut);
|
||||||
dateEnd = DateUtil.endOfQuarter(dateOut);
|
dateEnd = DateUtil.endOfQuarter(dateOut);
|
||||||
}else if (Integer.valueOf(BizParamConstant.STAT_BIZ_MONTH).equals(param.getDataType())){
|
} else if (Integer.valueOf(BizParamConstant.STAT_BIZ_MONTH).equals(param.getDataType())) {
|
||||||
dateBegin = DateUtil.beginOfMonth(dateOut);
|
dateBegin = DateUtil.beginOfMonth(dateOut);
|
||||||
dateEnd = DateUtil.endOfMonth(dateOut);
|
dateEnd = DateUtil.endOfMonth(dateOut);
|
||||||
}
|
}
|
||||||
List<String> deptIds = deptFeignClient.getDepSonIdtByDeptId(param.getOrgNo ()).getData();
|
List<String> deptIds = deptFeignClient.getDepSonIdtByDeptId(param.getOrgNo()).getData();
|
||||||
|
|
||||||
List<IssuesVO> out = issuesMapper.getIssues(deptIds,param,DateUtil.formatDateTime(dateBegin), DateUtil.formatDateTime(dateEnd));
|
List<IssuesVO> out = issuesMapper.getIssues(deptIds, param, DateUtil.formatDateTime(dateBegin), DateUtil.formatDateTime(dateEnd));
|
||||||
if (!CollectionUtils.isEmpty(out)) {
|
if (!CollectionUtils.isEmpty(out)) {
|
||||||
out.forEach(data -> data.setOrgName((deptFeignClient.getDeptById(data.getOrgNo()).getData().getName())));
|
out.forEach(data -> data.setOrgName((deptFeignClient.getDeptById(data.getOrgNo()).getData().getName())));
|
||||||
/*问题来源*/
|
/*问题来源*/
|
||||||
List<DictData> problemSourcesDictData = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.PROBLEM_SOURCES.getCode()).getData();
|
List<DictData> problemSourcesDictData = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.PROBLEM_SOURCES.getCode()).getData();
|
||||||
problemSourcesDictData.forEach(dict -> out.stream().filter(data -> dict.getCode().equals(data.getProblemSources())).forEach(data -> data.setProblemSources(dict.getName())));
|
problemSourcesDictData.forEach(dict -> out.stream().filter(data -> dict.getCode().equals(data.getProblemSources())).forEach(data -> data.setProblemSources(dict.getName())));
|
||||||
page.setTotal(out.size());
|
page.setTotal(out.size());
|
||||||
int pages = (int)Math.ceil(out.size()*1.0/param.getPageSize());
|
int pages = (int) Math.ceil(out.size() * 1.0 / param.getPageSize());
|
||||||
page.setPages(pages);
|
page.setPages(pages);
|
||||||
List<List<IssuesVO>> partition = Lists.partition(out, param.getPageSize());
|
List<List<IssuesVO>> partition = Lists.partition(out, param.getPageSize());
|
||||||
List<IssuesVO> issuesVOS = partition.get(param.getPageNum() - 1);
|
List<IssuesVO> issuesVOS = partition.get(param.getPageNum() - 1);
|
||||||
@@ -225,49 +221,49 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
/**
|
/**
|
||||||
* 问题基本信息查询
|
* 问题基本信息查询
|
||||||
*/
|
*/
|
||||||
private RStatElectricQualityProblemFlow issuesSelectOne(String powerQualityProblemNo){
|
private RStatElectricQualityProblemFlow issuesSelectOne(String powerQualityProblemNo) {
|
||||||
LambdaQueryWrapper<RStatElectricQualityProblemFlow> issuesQuery = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RStatElectricQualityProblemFlow> issuesQuery = new LambdaQueryWrapper<>();
|
||||||
issuesQuery.eq(RStatElectricQualityProblemFlow::getPowerQualityProblemNo,powerQualityProblemNo);
|
issuesQuery.eq(RStatElectricQualityProblemFlow::getPowerQualityProblemNo, powerQualityProblemNo);
|
||||||
return issuesMapper.selectOne(issuesQuery);
|
return issuesMapper.selectOne(issuesQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 填报流程详情查询
|
* 填报流程详情查询
|
||||||
*/
|
*/
|
||||||
private RMpElectricQualityProblemFlowDetails flowDetailSelectOne(String powerQualityProblemNo){
|
private RMpElectricQualityProblemFlowDetails flowDetailSelectOne(String powerQualityProblemNo) {
|
||||||
LambdaQueryWrapper<RMpElectricQualityProblemFlowDetails> flowQuery = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RMpElectricQualityProblemFlowDetails> flowQuery = new LambdaQueryWrapper<>();
|
||||||
flowQuery.eq(RMpElectricQualityProblemFlowDetails::getPowerQualityProblemNo,powerQualityProblemNo);
|
flowQuery.eq(RMpElectricQualityProblemFlowDetails::getPowerQualityProblemNo, powerQualityProblemNo);
|
||||||
return flowDetailsMapper.selectOne(flowQuery);
|
return flowDetailsMapper.selectOne(flowQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理填报信息
|
* 处理填报信息
|
||||||
*/
|
*/
|
||||||
private FlowDetailVO processFlowDetail(RMpElectricQualityProblemFlowDetails details){
|
private FlowDetailVO processFlowDetail(RMpElectricQualityProblemFlowDetails details) {
|
||||||
FlowDetailVO process = new FlowDetailVO();
|
FlowDetailVO process = new FlowDetailVO();
|
||||||
BeanUtil.copyProperties(details,process);
|
BeanUtil.copyProperties(details, process);
|
||||||
if (!StrUtil.isEmpty(details.getReportProcessContentYyfx())){
|
if (!StrUtil.isEmpty(details.getReportProcessContentYyfx())) {
|
||||||
process.setReportProcessContentYyfx(StrUtil.removeSuffix(StrUtil.removePrefix(details.getReportProcessContentYyfx(),"["),"]").split(","));
|
process.setReportProcessContentYyfx(StrUtil.removeSuffix(StrUtil.removePrefix(details.getReportProcessContentYyfx(), "["), "]").split(","));
|
||||||
StrUtil.trim(process.getReportProcessContentYyfx());
|
StrUtil.trim(process.getReportProcessContentYyfx());
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(details.getUserReportProcessContentYyfx())){
|
if (!StrUtil.isEmpty(details.getUserReportProcessContentYyfx())) {
|
||||||
process.setUserReportProcessContentYyfx(StrUtil.removeSuffix(StrUtil.removePrefix(details.getUserReportProcessContentYyfx(),"["),"]").split(","));
|
process.setUserReportProcessContentYyfx(StrUtil.removeSuffix(StrUtil.removePrefix(details.getUserReportProcessContentYyfx(), "["), "]").split(","));
|
||||||
StrUtil.trim(process.getUserReportProcessContentYyfx());
|
StrUtil.trim(process.getUserReportProcessContentYyfx());
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(details.getReportProcessContentJhzg())){
|
if (!StrUtil.isEmpty(details.getReportProcessContentJhzg())) {
|
||||||
process.setReportProcessContentJhzg(StrUtil.removeSuffix(StrUtil.removePrefix(details.getReportProcessContentJhzg(),"["),"]").split(","));
|
process.setReportProcessContentJhzg(StrUtil.removeSuffix(StrUtil.removePrefix(details.getReportProcessContentJhzg(), "["), "]").split(","));
|
||||||
StrUtil.trim(process.getReportProcessContentJhzg());
|
StrUtil.trim(process.getReportProcessContentJhzg());
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(details.getUserReportProcessContentJhzg())){
|
if (!StrUtil.isEmpty(details.getUserReportProcessContentJhzg())) {
|
||||||
process.setUserReportProcessContentJhzg(StrUtil.removeSuffix(StrUtil.removePrefix(details.getUserReportProcessContentJhzg(),"["),"]").split(","));
|
process.setUserReportProcessContentJhzg(StrUtil.removeSuffix(StrUtil.removePrefix(details.getUserReportProcessContentJhzg(), "["), "]").split(","));
|
||||||
StrUtil.trim(process.getUserReportProcessContentJhzg());
|
StrUtil.trim(process.getUserReportProcessContentJhzg());
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(details.getReportProcessContentSjcq())){
|
if (!StrUtil.isEmpty(details.getReportProcessContentSjcq())) {
|
||||||
process.setReportProcessContentSjcq(StrUtil.removeSuffix(StrUtil.removePrefix(details.getReportProcessContentSjcq(),"["),"]").split(","));
|
process.setReportProcessContentSjcq(StrUtil.removeSuffix(StrUtil.removePrefix(details.getReportProcessContentSjcq(), "["), "]").split(","));
|
||||||
StrUtil.trim(process.getReportProcessContentSjcq());
|
StrUtil.trim(process.getReportProcessContentSjcq());
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(details.getUserReportProcessContentSjcq())){
|
if (!StrUtil.isEmpty(details.getUserReportProcessContentSjcq())) {
|
||||||
process.setUserReportProcessContentSjcq(StrUtil.removeSuffix(StrUtil.removePrefix(details.getUserReportProcessContentSjcq(),"["),"]").split(","));
|
process.setUserReportProcessContentSjcq(StrUtil.removeSuffix(StrUtil.removePrefix(details.getUserReportProcessContentSjcq(), "["), "]").split(","));
|
||||||
StrUtil.trim(process.getUserReportProcessContentSjcq());
|
StrUtil.trim(process.getUserReportProcessContentSjcq());
|
||||||
}
|
}
|
||||||
return process;
|
return process;
|
||||||
@@ -279,14 +275,14 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
@Override
|
@Override
|
||||||
public ExcessiveDetailVO getExcessiveDetail(String powerQualityProblemNo) {
|
public ExcessiveDetailVO getExcessiveDetail(String powerQualityProblemNo) {
|
||||||
ExcessiveDetailVO detail = new ExcessiveDetailVO();
|
ExcessiveDetailVO detail = new ExcessiveDetailVO();
|
||||||
BeanUtil.copyProperties(issuesSelectOne(powerQualityProblemNo),detail);
|
BeanUtil.copyProperties(issuesSelectOne(powerQualityProblemNo), detail);
|
||||||
detail.setOrgName(deptFeignClient.getDeptById(detail.getOrgNo()).getData().getName());
|
detail.setOrgName(deptFeignClient.getDeptById(detail.getOrgNo()).getData().getName());
|
||||||
LambdaQueryWrapper<RMpOnlineMonitorOverproofProblem> excessiveQuery = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RMpOnlineMonitorOverproofProblem> excessiveQuery = new LambdaQueryWrapper<>();
|
||||||
excessiveQuery.eq(RMpOnlineMonitorOverproofProblem::getPowerQualityProblemNo,powerQualityProblemNo);
|
excessiveQuery.eq(RMpOnlineMonitorOverproofProblem::getPowerQualityProblemNo, powerQualityProblemNo);
|
||||||
RMpOnlineMonitorOverproofProblem excessiveOut = excessiveMapper.selectOne(excessiveQuery);
|
RMpOnlineMonitorOverproofProblem excessiveOut = excessiveMapper.selectOne(excessiveQuery);
|
||||||
BeanUtil.copyProperties(excessiveOut,detail);
|
BeanUtil.copyProperties(excessiveOut, detail);
|
||||||
RMpElectricQualityProblemFlowDetails flowDetails = flowDetailSelectOne(powerQualityProblemNo);
|
RMpElectricQualityProblemFlowDetails flowDetails = flowDetailSelectOne(powerQualityProblemNo);
|
||||||
BeanUtil.copyProperties(processFlowDetail(flowDetails),detail);
|
BeanUtil.copyProperties(processFlowDetail(flowDetails), detail);
|
||||||
return detail;
|
return detail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,16 +292,16 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
@Override
|
@Override
|
||||||
public GeneralSurveyVO getGeneralSurveyDetail(String powerQualityProblemNo) {
|
public GeneralSurveyVO getGeneralSurveyDetail(String powerQualityProblemNo) {
|
||||||
GeneralSurveyVO detail = new GeneralSurveyVO();
|
GeneralSurveyVO detail = new GeneralSurveyVO();
|
||||||
BeanUtil.copyProperties(issuesSelectOne(powerQualityProblemNo),detail);
|
BeanUtil.copyProperties(issuesSelectOne(powerQualityProblemNo), detail);
|
||||||
detail.setOrgName(deptFeignClient.getDeptById(detail.getOrgNo()).getData().getName());
|
detail.setOrgName(deptFeignClient.getDeptById(detail.getOrgNo()).getData().getName());
|
||||||
LambdaQueryWrapper<RMpGeneralSurveyOverproofProblem> generalSurveyQuery = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RMpGeneralSurveyOverproofProblem> generalSurveyQuery = new LambdaQueryWrapper<>();
|
||||||
generalSurveyQuery.eq(RMpGeneralSurveyOverproofProblem::getPowerQualityProblemNo,powerQualityProblemNo);
|
generalSurveyQuery.eq(RMpGeneralSurveyOverproofProblem::getPowerQualityProblemNo, powerQualityProblemNo);
|
||||||
RMpGeneralSurveyOverproofProblem generalSurveyOut = generalSurveyMapper.selectOne(generalSurveyQuery);
|
RMpGeneralSurveyOverproofProblem generalSurveyOut = generalSurveyMapper.selectOne(generalSurveyQuery);
|
||||||
BeanUtil.copyProperties(generalSurveyOut,detail);
|
BeanUtil.copyProperties(generalSurveyOut, detail);
|
||||||
detail.setSteadyIndicator(steadyIndicator(generalSurveyOut.getOverLimitTarget()));
|
detail.setSteadyIndicator(steadyIndicator(generalSurveyOut.getOverLimitTarget()));
|
||||||
detail.setTransientIndicators(transientIndicators(generalSurveyOut.getOverLimitTarget()));
|
detail.setTransientIndicators(transientIndicators(generalSurveyOut.getOverLimitTarget()));
|
||||||
RMpElectricQualityProblemFlowDetails flowDetails = flowDetailSelectOne(powerQualityProblemNo);
|
RMpElectricQualityProblemFlowDetails flowDetails = flowDetailSelectOne(powerQualityProblemNo);
|
||||||
BeanUtil.copyProperties(processFlowDetail(flowDetails),detail);
|
BeanUtil.copyProperties(processFlowDetail(flowDetails), detail);
|
||||||
return detail;
|
return detail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,22 +311,22 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
@Override
|
@Override
|
||||||
public ComplaintVO getComplaintDetail(String powerQualityProblemNo) {
|
public ComplaintVO getComplaintDetail(String powerQualityProblemNo) {
|
||||||
ComplaintVO detail = new ComplaintVO();
|
ComplaintVO detail = new ComplaintVO();
|
||||||
BeanUtil.copyProperties(issuesSelectOne(powerQualityProblemNo),detail);
|
BeanUtil.copyProperties(issuesSelectOne(powerQualityProblemNo), detail);
|
||||||
detail.setOrgName(deptFeignClient.getDeptById(detail.getOrgNo()).getData().getName());
|
detail.setOrgName(deptFeignClient.getDeptById(detail.getOrgNo()).getData().getName());
|
||||||
LambdaQueryWrapper<RMpUserComplaint> complaintQuery = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RMpUserComplaint> complaintQuery = new LambdaQueryWrapper<>();
|
||||||
complaintQuery.eq(RMpUserComplaint::getPowerQualityProblemNo,powerQualityProblemNo);
|
complaintQuery.eq(RMpUserComplaint::getPowerQualityProblemNo, powerQualityProblemNo);
|
||||||
RMpUserComplaint complaintOut = complaintMapper.selectOne(complaintQuery);
|
RMpUserComplaint complaintOut = complaintMapper.selectOne(complaintQuery);
|
||||||
BeanUtil.copyProperties(complaintOut,detail);
|
BeanUtil.copyProperties(complaintOut, detail);
|
||||||
detail.setSteadyIndicator(steadyIndicator(complaintOut.getAbnormalTarget()));
|
detail.setSteadyIndicator(steadyIndicator(complaintOut.getAbnormalTarget()));
|
||||||
detail.setTransientIndicators(transientIndicators(complaintOut.getAbnormalTarget()));
|
detail.setTransientIndicators(transientIndicators(complaintOut.getAbnormalTarget()));
|
||||||
RMpElectricQualityProblemFlowDetails flowDetails = flowDetailSelectOne(powerQualityProblemNo);
|
RMpElectricQualityProblemFlowDetails flowDetails = flowDetailSelectOne(powerQualityProblemNo);
|
||||||
BeanUtil.copyProperties(processFlowDetail(flowDetails),detail);
|
BeanUtil.copyProperties(processFlowDetail(flowDetails), detail);
|
||||||
if (!StrUtil.isEmpty(complaintOut.getPowerGridAffectDev())){
|
if (!StrUtil.isEmpty(complaintOut.getPowerGridAffectDev())) {
|
||||||
detail.setPowerGridAffectDev(StrUtil.removeSuffix(StrUtil.removePrefix(complaintOut.getPowerGridAffectDev(),"["),"]").split(","));
|
detail.setPowerGridAffectDev(StrUtil.removeSuffix(StrUtil.removePrefix(complaintOut.getPowerGridAffectDev(), "["), "]").split(","));
|
||||||
StrUtil.trim(detail.getPowerGridAffectDev());
|
StrUtil.trim(detail.getPowerGridAffectDev());
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(complaintOut.getUserAffectDev())){
|
if (!StrUtil.isEmpty(complaintOut.getUserAffectDev())) {
|
||||||
detail.setUserAffectDev(StrUtil.removeSuffix(StrUtil.removePrefix(complaintOut.getUserAffectDev(),"["),"]").split(","));
|
detail.setUserAffectDev(StrUtil.removeSuffix(StrUtil.removePrefix(complaintOut.getUserAffectDev(), "["), "]").split(","));
|
||||||
StrUtil.trim(detail.getUserAffectDev());
|
StrUtil.trim(detail.getUserAffectDev());
|
||||||
}
|
}
|
||||||
return detail;
|
return detail;
|
||||||
@@ -342,22 +338,22 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
@Override
|
@Override
|
||||||
public AbnormalVO getAbnormalDetail(String powerQualityProblemNo) {
|
public AbnormalVO getAbnormalDetail(String powerQualityProblemNo) {
|
||||||
AbnormalVO detail = new AbnormalVO();
|
AbnormalVO detail = new AbnormalVO();
|
||||||
BeanUtil.copyProperties(issuesSelectOne(powerQualityProblemNo),detail);
|
BeanUtil.copyProperties(issuesSelectOne(powerQualityProblemNo), detail);
|
||||||
detail.setOrgName(deptFeignClient.getDeptById(detail.getOrgNo()).getData().getName());
|
detail.setOrgName(deptFeignClient.getDeptById(detail.getOrgNo()).getData().getName());
|
||||||
LambdaQueryWrapper<RMpOperationMonitorAbnormal> abnormalQuery = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RMpOperationMonitorAbnormal> abnormalQuery = new LambdaQueryWrapper<>();
|
||||||
abnormalQuery.eq(RMpOperationMonitorAbnormal::getPowerQualityProblemNo,powerQualityProblemNo);
|
abnormalQuery.eq(RMpOperationMonitorAbnormal::getPowerQualityProblemNo, powerQualityProblemNo);
|
||||||
RMpOperationMonitorAbnormal abnormalOut = abnormalMapper.selectOne(abnormalQuery);
|
RMpOperationMonitorAbnormal abnormalOut = abnormalMapper.selectOne(abnormalQuery);
|
||||||
BeanUtil.copyProperties(abnormalOut,detail);
|
BeanUtil.copyProperties(abnormalOut, detail);
|
||||||
detail.setSteadyIndicator(steadyIndicator(abnormalOut.getAbnormalTarget()));
|
detail.setSteadyIndicator(steadyIndicator(abnormalOut.getAbnormalTarget()));
|
||||||
detail.setTransientIndicators(transientIndicators(abnormalOut.getAbnormalTarget()));
|
detail.setTransientIndicators(transientIndicators(abnormalOut.getAbnormalTarget()));
|
||||||
RMpElectricQualityProblemFlowDetails flowDetails = flowDetailSelectOne(powerQualityProblemNo);
|
RMpElectricQualityProblemFlowDetails flowDetails = flowDetailSelectOne(powerQualityProblemNo);
|
||||||
BeanUtil.copyProperties(processFlowDetail(flowDetails),detail);
|
BeanUtil.copyProperties(processFlowDetail(flowDetails), detail);
|
||||||
if (!StrUtil.isEmpty(abnormalOut.getPowerGridAffectDev())){
|
if (!StrUtil.isEmpty(abnormalOut.getPowerGridAffectDev())) {
|
||||||
detail.setPowerGridAffectDev(StrUtil.removeSuffix(StrUtil.removePrefix(abnormalOut.getPowerGridAffectDev(),"["),"]").split(","));
|
detail.setPowerGridAffectDev(StrUtil.removeSuffix(StrUtil.removePrefix(abnormalOut.getPowerGridAffectDev(), "["), "]").split(","));
|
||||||
StrUtil.trim(detail.getPowerGridAffectDev());
|
StrUtil.trim(detail.getPowerGridAffectDev());
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(abnormalOut.getUserAffectDev())){
|
if (!StrUtil.isEmpty(abnormalOut.getUserAffectDev())) {
|
||||||
detail.setUserAffectDev(StrUtil.removeSuffix(StrUtil.removePrefix(abnormalOut.getUserAffectDev(),"["),"]").split(","));
|
detail.setUserAffectDev(StrUtil.removeSuffix(StrUtil.removePrefix(abnormalOut.getUserAffectDev(), "["), "]").split(","));
|
||||||
StrUtil.trim(detail.getUserAffectDev());
|
StrUtil.trim(detail.getUserAffectDev());
|
||||||
}
|
}
|
||||||
return detail;
|
return detail;
|
||||||
@@ -366,8 +362,8 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
/**
|
/**
|
||||||
* 稳态指标处理
|
* 稳态指标处理
|
||||||
*/
|
*/
|
||||||
private String[] steadyIndicator(String target){
|
private String[] steadyIndicator(String target) {
|
||||||
String[] process = StrUtil.removePrefix(target.split("]\\[")[0],"\\[").split(",");
|
String[] process = StrUtil.removePrefix(target.split("]\\[")[0], "\\[").split(",");
|
||||||
StrUtil.trim(process);
|
StrUtil.trim(process);
|
||||||
return process;
|
return process;
|
||||||
}
|
}
|
||||||
@@ -375,8 +371,8 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
/**
|
/**
|
||||||
* 暂态指标处理
|
* 暂态指标处理
|
||||||
*/
|
*/
|
||||||
private String[] transientIndicators(String target){
|
private String[] transientIndicators(String target) {
|
||||||
String[] process = StrUtil.removeSuffix(target.split("]\\[")[1],"]").split(",");
|
String[] process = StrUtil.removeSuffix(target.split("]\\[")[1], "]").split(",");
|
||||||
StrUtil.trim(process);
|
StrUtil.trim(process);
|
||||||
return process;
|
return process;
|
||||||
}
|
}
|
||||||
@@ -388,31 +384,31 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
public void reasonAnalysis(ProcessParam processParam) {
|
public void reasonAnalysis(ProcessParam processParam) {
|
||||||
LocalDateTime local = LocalDateTimeUtil.now();
|
LocalDateTime local = LocalDateTimeUtil.now();
|
||||||
RMpElectricQualityProblemFlowDetails details = new RMpElectricQualityProblemFlowDetails();
|
RMpElectricQualityProblemFlowDetails details = new RMpElectricQualityProblemFlowDetails();
|
||||||
BeanUtil.copyProperties(processParam,details);
|
BeanUtil.copyProperties(processParam, details);
|
||||||
details.setDataDateYyfx(local);
|
details.setDataDateYyfx(local);
|
||||||
details.setReportProcessContentYyfx(ArrayUtil.toString(processParam.getReportProcessContentYyfx()));
|
details.setReportProcessContentYyfx(ArrayUtil.toString(processParam.getReportProcessContentYyfx()));
|
||||||
details.setUserReportProcessContentYyfx(ArrayUtil.toString(processParam.getUserReportProcessContentYyfx()));
|
details.setUserReportProcessContentYyfx(ArrayUtil.toString(processParam.getUserReportProcessContentYyfx()));
|
||||||
flowDetailsMapper.insert(details);
|
flowDetailsMapper.insert(details);
|
||||||
LambdaQueryWrapper<RStatElectricQualityProblemFlow> issuesQuery = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RStatElectricQualityProblemFlow> issuesQuery = new LambdaQueryWrapper<>();
|
||||||
issuesQuery.eq(RStatElectricQualityProblemFlow::getPowerQualityProblemNo,processParam.getPowerQualityProblemNo());
|
issuesQuery.eq(RStatElectricQualityProblemFlow::getPowerQualityProblemNo, processParam.getPowerQualityProblemNo());
|
||||||
RStatElectricQualityProblemFlow issuesOut = issuesMapper.selectOne(issuesQuery);
|
RStatElectricQualityProblemFlow issuesOut = issuesMapper.selectOne(issuesQuery);
|
||||||
issuesOut.setReportProcess(DicDataEnum.CAUSE_ANALYSIS.getCode());
|
issuesOut.setReportProcess(DicDataEnum.CAUSE_ANALYSIS.getCode());
|
||||||
issuesOut.setReportProcessStatus (DicDataEnum.AUDITT.getCode());
|
issuesOut.setReportProcessStatus(DicDataEnum.AUDITT.getCode());
|
||||||
issuesMapper.update(issuesOut,issuesQuery);
|
issuesMapper.update(issuesOut, issuesQuery);
|
||||||
if (DicDataEnum.USER_COMPLAINTS.getCode().equals(issuesOut.getProblemSources())){
|
if (DicDataEnum.USER_COMPLAINTS.getCode().equals(issuesOut.getProblemSources())) {
|
||||||
LambdaQueryWrapper<RMpUserComplaint> complaintQuery = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RMpUserComplaint> complaintQuery = new LambdaQueryWrapper<>();
|
||||||
complaintQuery.eq(RMpUserComplaint::getPowerQualityProblemNo,processParam.getPowerQualityProblemNo());
|
complaintQuery.eq(RMpUserComplaint::getPowerQualityProblemNo, processParam.getPowerQualityProblemNo());
|
||||||
RMpUserComplaint complaintOut = complaintMapper.selectOne(complaintQuery);
|
RMpUserComplaint complaintOut = complaintMapper.selectOne(complaintQuery);
|
||||||
complaintOut.setPowerGridAffectDev(ArrayUtil.toString(processParam.getPowerGridAffectDev()));
|
complaintOut.setPowerGridAffectDev(ArrayUtil.toString(processParam.getPowerGridAffectDev()));
|
||||||
complaintOut.setUserAffectDev(ArrayUtil.toString(processParam.getUserAffectDev()));
|
complaintOut.setUserAffectDev(ArrayUtil.toString(processParam.getUserAffectDev()));
|
||||||
complaintMapper.update(complaintOut,complaintQuery);
|
complaintMapper.update(complaintOut, complaintQuery);
|
||||||
}else if (DicDataEnum.DEV_EXCEPTION.getCode().equals(issuesOut.getProblemSources())){
|
} else if (DicDataEnum.DEV_EXCEPTION.getCode().equals(issuesOut.getProblemSources())) {
|
||||||
LambdaQueryWrapper<RMpOperationMonitorAbnormal> abnormalQuery = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RMpOperationMonitorAbnormal> abnormalQuery = new LambdaQueryWrapper<>();
|
||||||
abnormalQuery.eq(RMpOperationMonitorAbnormal::getPowerQualityProblemNo,processParam.getPowerQualityProblemNo());
|
abnormalQuery.eq(RMpOperationMonitorAbnormal::getPowerQualityProblemNo, processParam.getPowerQualityProblemNo());
|
||||||
RMpOperationMonitorAbnormal abnormalOut = abnormalMapper.selectOne(abnormalQuery);
|
RMpOperationMonitorAbnormal abnormalOut = abnormalMapper.selectOne(abnormalQuery);
|
||||||
abnormalOut.setPowerGridAffectDev(ArrayUtil.toString(processParam.getPowerGridAffectDev()));
|
abnormalOut.setPowerGridAffectDev(ArrayUtil.toString(processParam.getPowerGridAffectDev()));
|
||||||
abnormalOut.setUserAffectDev(ArrayUtil.toString(processParam.getUserAffectDev()));
|
abnormalOut.setUserAffectDev(ArrayUtil.toString(processParam.getUserAffectDev()));
|
||||||
abnormalMapper.update(abnormalOut,abnormalQuery);
|
abnormalMapper.update(abnormalOut, abnormalQuery);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -422,26 +418,26 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
@Override
|
@Override
|
||||||
public void process(ProcessParam processParam, String code) {
|
public void process(ProcessParam processParam, String code) {
|
||||||
LambdaQueryWrapper<RStatElectricQualityProblemFlow> issuesQuery = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RStatElectricQualityProblemFlow> issuesQuery = new LambdaQueryWrapper<>();
|
||||||
issuesQuery.eq(RStatElectricQualityProblemFlow::getPowerQualityProblemNo,processParam.getPowerQualityProblemNo());
|
issuesQuery.eq(RStatElectricQualityProblemFlow::getPowerQualityProblemNo, processParam.getPowerQualityProblemNo());
|
||||||
RStatElectricQualityProblemFlow issuesOut = issuesMapper.selectOne(issuesQuery);
|
RStatElectricQualityProblemFlow issuesOut = issuesMapper.selectOne(issuesQuery);
|
||||||
if (DicDataEnum.SUCCESS.getCode().equals(issuesOut.getReportProcessStatus())){
|
if (DicDataEnum.SUCCESS.getCode().equals(issuesOut.getReportProcessStatus())) {
|
||||||
LambdaQueryWrapper<RMpElectricQualityProblemFlowDetails> query = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RMpElectricQualityProblemFlowDetails> query = new LambdaQueryWrapper<>();
|
||||||
query.eq(RMpElectricQualityProblemFlowDetails::getPowerQualityProblemNo,processParam.getPowerQualityProblemNo());
|
query.eq(RMpElectricQualityProblemFlowDetails::getPowerQualityProblemNo, processParam.getPowerQualityProblemNo());
|
||||||
RMpElectricQualityProblemFlowDetails details = flowDetailsMapper.selectOne(query);
|
RMpElectricQualityProblemFlowDetails details = flowDetailsMapper.selectOne(query);
|
||||||
LocalDateTime local = LocalDateTimeUtil.now();
|
LocalDateTime local = LocalDateTimeUtil.now();
|
||||||
if (DicDataEnum.PLAN_MEASURES.getCode().equals(code)){
|
if (DicDataEnum.PLAN_MEASURES.getCode().equals(code)) {
|
||||||
details.setDataDateJhzg(local);
|
details.setDataDateJhzg(local);
|
||||||
details.setReportProcessContentJhzg(ArrayUtil.toString(processParam.getReportProcessContentJhzg()));
|
details.setReportProcessContentJhzg(ArrayUtil.toString(processParam.getReportProcessContentJhzg()));
|
||||||
details.setUserReportProcessContentJhzg(ArrayUtil.toString(processParam.getUserReportProcessContentJhzg()));
|
details.setUserReportProcessContentJhzg(ArrayUtil.toString(processParam.getUserReportProcessContentJhzg()));
|
||||||
details.setFileNameJhzg(processParam.getFileNameJhzg());
|
details.setFileNameJhzg(processParam.getFileNameJhzg());
|
||||||
details.setFilePathJhzg(processParam.getFilePathJhzg());
|
details.setFilePathJhzg(processParam.getFilePathJhzg());
|
||||||
}else if (DicDataEnum.ACTUAL_MEASURES.getCode().equals(code)){
|
} else if (DicDataEnum.ACTUAL_MEASURES.getCode().equals(code)) {
|
||||||
details.setDataDateSjcq(local);
|
details.setDataDateSjcq(local);
|
||||||
details.setReportProcessContentSjcq(ArrayUtil.toString(processParam.getReportProcessContentSjcq()));
|
details.setReportProcessContentSjcq(ArrayUtil.toString(processParam.getReportProcessContentSjcq()));
|
||||||
details.setUserReportProcessContentSjcq(ArrayUtil.toString(processParam.getUserReportProcessContentSjcq()));
|
details.setUserReportProcessContentSjcq(ArrayUtil.toString(processParam.getUserReportProcessContentSjcq()));
|
||||||
details.setFileNameSjcq(processParam.getFileNameSjcq());
|
details.setFileNameSjcq(processParam.getFileNameSjcq());
|
||||||
details.setFilePathSjcq(processParam.getFilePathSjcq());
|
details.setFilePathSjcq(processParam.getFilePathSjcq());
|
||||||
}else if (DicDataEnum.INSIGHTS.getCode().equals(code)){
|
} else if (DicDataEnum.INSIGHTS.getCode().equals(code)) {
|
||||||
details.setDataDateZlxg(local);
|
details.setDataDateZlxg(local);
|
||||||
details.setDescriptionZlxg(processParam.getDescriptionZlxg());
|
details.setDescriptionZlxg(processParam.getDescriptionZlxg());
|
||||||
details.setFileNameZlxg(processParam.getFileNameZlxg());
|
details.setFileNameZlxg(processParam.getFileNameZlxg());
|
||||||
@@ -450,8 +446,8 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
flowDetailsMapper.update(details, query);
|
flowDetailsMapper.update(details, query);
|
||||||
issuesOut.setReportProcess(code);
|
issuesOut.setReportProcess(code);
|
||||||
issuesOut.setReportProcessStatus(DicDataEnum.AUDITT.getCode());
|
issuesOut.setReportProcessStatus(DicDataEnum.AUDITT.getCode());
|
||||||
issuesMapper.update(issuesOut,issuesQuery);
|
issuesMapper.update(issuesOut, issuesQuery);
|
||||||
}else {
|
} else {
|
||||||
throw new BusinessException(ProcessResponseEnum.PROCESS_ERROR);
|
throw new BusinessException(ProcessResponseEnum.PROCESS_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -462,13 +458,13 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
@Override
|
@Override
|
||||||
public void archive(String powerQualityProblemNo) {
|
public void archive(String powerQualityProblemNo) {
|
||||||
LambdaQueryWrapper<RStatElectricQualityProblemFlow> query = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RStatElectricQualityProblemFlow> query = new LambdaQueryWrapper<>();
|
||||||
query.eq(RStatElectricQualityProblemFlow::getPowerQualityProblemNo,powerQualityProblemNo);
|
query.eq(RStatElectricQualityProblemFlow::getPowerQualityProblemNo, powerQualityProblemNo);
|
||||||
RStatElectricQualityProblemFlow issuesOut = issuesMapper.selectOne(query);
|
RStatElectricQualityProblemFlow issuesOut = issuesMapper.selectOne(query);
|
||||||
if (DicDataEnum.INSIGHTS.getCode().equals(issuesOut.getReportProcess())
|
if (DicDataEnum.INSIGHTS.getCode().equals(issuesOut.getReportProcess())
|
||||||
&& DicDataEnum.SUCCESS.getCode().equals(issuesOut.getReportProcessStatus())){
|
&& DicDataEnum.SUCCESS.getCode().equals(issuesOut.getReportProcessStatus())) {
|
||||||
issuesOut.setReportProcess(DicDataEnum.ARCHIVED.getCode());
|
issuesOut.setReportProcess(DicDataEnum.ARCHIVED.getCode());
|
||||||
issuesMapper.update(issuesOut,query);
|
issuesMapper.update(issuesOut, query);
|
||||||
}else {
|
} else {
|
||||||
throw new BusinessException(ProcessResponseEnum.ARCHIVE_ERROR);
|
throw new BusinessException(ProcessResponseEnum.ARCHIVE_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -477,30 +473,26 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
* 上传文件
|
* 上传文件
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public MinIoUploadResDTO uploadFile(MultipartFile issuesFile) {
|
public String uploadFile(MultipartFile issuesFile) {
|
||||||
try {
|
return fileStorageUtil.uploadMultipart(issuesFile, OssPath.ELECTRICITY_QUALITY);
|
||||||
return minIoUtils.upload(issuesFile, minIoProperties.getBucket(), "electricityQuality/");
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new BusinessException(ProcessResponseEnum.UPLOAD_FILE_ERROR);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下载文件
|
* 下载文件
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String downloadFile(String powerQualityProblemNo,String reportProcess) {
|
public String downloadFile(String powerQualityProblemNo, String reportProcess) {
|
||||||
LambdaQueryWrapper<RMpElectricQualityProblemFlowDetails> issuesQuery = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RMpElectricQualityProblemFlowDetails> issuesQuery = new LambdaQueryWrapper<>();
|
||||||
issuesQuery.eq(RMpElectricQualityProblemFlowDetails::getPowerQualityProblemNo,powerQualityProblemNo);
|
issuesQuery.eq(RMpElectricQualityProblemFlowDetails::getPowerQualityProblemNo, powerQualityProblemNo);
|
||||||
RMpElectricQualityProblemFlowDetails details = flowDetailsMapper.selectOne(issuesQuery);
|
RMpElectricQualityProblemFlowDetails details = flowDetailsMapper.selectOne(issuesQuery);
|
||||||
String filePath = null;
|
String filePath = null;
|
||||||
if (DicDataEnum.CAUSE_ANALYSIS.getName().equals(reportProcess)){
|
if (DicDataEnum.CAUSE_ANALYSIS.getName().equals(reportProcess)) {
|
||||||
filePath = details.getFilePathYyfx();
|
filePath = details.getFilePathYyfx();
|
||||||
}else if (DicDataEnum.PLAN_MEASURES.getName().equals(reportProcess)){
|
} else if (DicDataEnum.PLAN_MEASURES.getName().equals(reportProcess)) {
|
||||||
filePath = details.getFilePathJhzg();
|
filePath = details.getFilePathJhzg();
|
||||||
}else if (DicDataEnum.ACTUAL_MEASURES.getName().equals(reportProcess)){
|
} else if (DicDataEnum.ACTUAL_MEASURES.getName().equals(reportProcess)) {
|
||||||
filePath = details.getFilePathSjcq();
|
filePath = details.getFilePathSjcq();
|
||||||
}else if (DicDataEnum.INSIGHTS.getName().equals(reportProcess)){
|
} else if (DicDataEnum.INSIGHTS.getName().equals(reportProcess)) {
|
||||||
filePath = details.getFilePathZlxg();
|
filePath = details.getFilePathZlxg();
|
||||||
}
|
}
|
||||||
return filePath;
|
return filePath;
|
||||||
@@ -512,27 +504,27 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
@Override
|
@Override
|
||||||
public void deleteIssues(String powerQualityProblemNo) {
|
public void deleteIssues(String powerQualityProblemNo) {
|
||||||
LambdaQueryWrapper<RStatElectricQualityProblemFlow> query = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RStatElectricQualityProblemFlow> query = new LambdaQueryWrapper<>();
|
||||||
query.eq(RStatElectricQualityProblemFlow::getPowerQualityProblemNo,powerQualityProblemNo);
|
query.eq(RStatElectricQualityProblemFlow::getPowerQualityProblemNo, powerQualityProblemNo);
|
||||||
RStatElectricQualityProblemFlow issuesOut = issuesMapper.selectOne(query);
|
RStatElectricQualityProblemFlow issuesOut = issuesMapper.selectOne(query);
|
||||||
if (DicDataEnum.ONLINE.getCode().equals(issuesOut.getProblemSources())){
|
if (DicDataEnum.ONLINE.getCode().equals(issuesOut.getProblemSources())) {
|
||||||
LambdaQueryWrapper<RMpOnlineMonitorOverproofProblem> issuesQuery = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RMpOnlineMonitorOverproofProblem> issuesQuery = new LambdaQueryWrapper<>();
|
||||||
issuesQuery.eq(RMpOnlineMonitorOverproofProblem::getPowerQualityProblemNo,powerQualityProblemNo);
|
issuesQuery.eq(RMpOnlineMonitorOverproofProblem::getPowerQualityProblemNo, powerQualityProblemNo);
|
||||||
excessiveMapper.delete(issuesQuery);
|
excessiveMapper.delete(issuesQuery);
|
||||||
}else if (DicDataEnum.GENERAL.getCode().equals(issuesOut.getProblemSources())){
|
} else if (DicDataEnum.GENERAL.getCode().equals(issuesOut.getProblemSources())) {
|
||||||
LambdaQueryWrapper<RMpGeneralSurveyOverproofProblem> issuesQuery = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RMpGeneralSurveyOverproofProblem> issuesQuery = new LambdaQueryWrapper<>();
|
||||||
issuesQuery.eq(RMpGeneralSurveyOverproofProblem::getPowerQualityProblemNo,powerQualityProblemNo);
|
issuesQuery.eq(RMpGeneralSurveyOverproofProblem::getPowerQualityProblemNo, powerQualityProblemNo);
|
||||||
generalSurveyMapper.delete(issuesQuery);
|
generalSurveyMapper.delete(issuesQuery);
|
||||||
}else if (DicDataEnum.USER_COMPLAINTS.getCode().equals(issuesOut.getProblemSources())){
|
} else if (DicDataEnum.USER_COMPLAINTS.getCode().equals(issuesOut.getProblemSources())) {
|
||||||
LambdaQueryWrapper<RMpUserComplaint> issuesQuery = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RMpUserComplaint> issuesQuery = new LambdaQueryWrapper<>();
|
||||||
issuesQuery.eq(RMpUserComplaint::getPowerQualityProblemNo,powerQualityProblemNo);
|
issuesQuery.eq(RMpUserComplaint::getPowerQualityProblemNo, powerQualityProblemNo);
|
||||||
complaintMapper.delete(issuesQuery);
|
complaintMapper.delete(issuesQuery);
|
||||||
}else if (DicDataEnum.DEV_EXCEPTION.getCode().equals(issuesOut.getProblemSources())){
|
} else if (DicDataEnum.DEV_EXCEPTION.getCode().equals(issuesOut.getProblemSources())) {
|
||||||
LambdaQueryWrapper<RMpOperationMonitorAbnormal> issuesQuery = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RMpOperationMonitorAbnormal> issuesQuery = new LambdaQueryWrapper<>();
|
||||||
issuesQuery.eq(RMpOperationMonitorAbnormal::getPowerQualityProblemNo,powerQualityProblemNo);
|
issuesQuery.eq(RMpOperationMonitorAbnormal::getPowerQualityProblemNo, powerQualityProblemNo);
|
||||||
abnormalMapper.delete(issuesQuery);
|
abnormalMapper.delete(issuesQuery);
|
||||||
}
|
}
|
||||||
LambdaQueryWrapper<RMpElectricQualityProblemFlowDetails> issuesQuery = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RMpElectricQualityProblemFlowDetails> issuesQuery = new LambdaQueryWrapper<>();
|
||||||
issuesQuery.eq(RMpElectricQualityProblemFlowDetails::getPowerQualityProblemNo,powerQualityProblemNo);
|
issuesQuery.eq(RMpElectricQualityProblemFlowDetails::getPowerQualityProblemNo, powerQualityProblemNo);
|
||||||
flowDetailsMapper.delete(issuesQuery);
|
flowDetailsMapper.delete(issuesQuery);
|
||||||
issuesMapper.delete(query);
|
issuesMapper.delete(query);
|
||||||
}
|
}
|
||||||
@@ -551,17 +543,15 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
|
|
||||||
List<String> deptIds = deptFeignClient.getDepSonIdtByDeptId(orgNo).getData();
|
List<String> deptIds = deptFeignClient.getDepSonIdtByDeptId(orgNo).getData();
|
||||||
/*问题个数*/
|
/*问题个数*/
|
||||||
QueryWrapper<RStatElectricQualityProblemFlow> qualityProblemFlowQueryWrapper = new QueryWrapper<> ();
|
QueryWrapper<RStatElectricQualityProblemFlow> qualityProblemFlowQueryWrapper = new QueryWrapper<>();
|
||||||
qualityProblemFlowQueryWrapper.select ("1").
|
qualityProblemFlowQueryWrapper.select("1").
|
||||||
in ("orgNo",deptIds);
|
in("orgNo", deptIds);
|
||||||
Integer integer = issuesMapper.selectCount (qualityProblemFlowQueryWrapper);
|
Integer integer = issuesMapper.selectCount(qualityProblemFlowQueryWrapper);
|
||||||
issueesAndOrderVO.setId (orgNo);
|
issueesAndOrderVO.setId(orgNo);
|
||||||
issueesAndOrderVO.setIssueesCount (integer);
|
issueesAndOrderVO.setIssueesCount(integer);
|
||||||
/*已关联工单数量*/
|
/*已关联工单数量*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return issueesAndOrderVO;
|
return issueesAndOrderVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -577,62 +567,62 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
public Boolean checkPowerQuality(ElectricityQualityCheckParam electricityQualityCheckParam) {
|
public Boolean checkPowerQuality(ElectricityQualityCheckParam electricityQualityCheckParam) {
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
RStatElectricQualityProblemLogPO rStatElectricQualityProblemLogPO = new RStatElectricQualityProblemLogPO();
|
RStatElectricQualityProblemLogPO rStatElectricQualityProblemLogPO = new RStatElectricQualityProblemLogPO();
|
||||||
rStatElectricQualityProblemLogPO.setPowerQualityProblemNo (electricityQualityCheckParam.getPowerQualityProblemNo ());
|
rStatElectricQualityProblemLogPO.setPowerQualityProblemNo(electricityQualityCheckParam.getPowerQualityProblemNo());
|
||||||
rStatElectricQualityProblemLogPO.setChecker (electricityQualityCheckParam.getCheckPerson ());
|
rStatElectricQualityProblemLogPO.setChecker(electricityQualityCheckParam.getCheckPerson());
|
||||||
rStatElectricQualityProblemLogPO.setDataDate ( new Date ());
|
rStatElectricQualityProblemLogPO.setDataDate(new Date());
|
||||||
rStatElectricQualityProblemLogPO.setDescription (electricityQualityCheckParam.getCheckComment ());
|
rStatElectricQualityProblemLogPO.setDescription(electricityQualityCheckParam.getCheckComment());
|
||||||
rStatElectricQualityProblemLogPO.setReportProcess (electricityQualityCheckParam.getReportProcess ());
|
rStatElectricQualityProblemLogPO.setReportProcess(electricityQualityCheckParam.getReportProcess());
|
||||||
rStatElectricQualityProblemLogPO.setReportProcessContent (electricityQualityCheckParam.getCheckComment ());
|
rStatElectricQualityProblemLogPO.setReportProcessContent(electricityQualityCheckParam.getCheckComment());
|
||||||
|
|
||||||
rStatElectricQualityProblemLogPO.setType (Objects.equals ("1", electricityQualityCheckParam.getCheckResult ())?DicDataEnum.SUCCESS.getCode ( ):DicDataEnum.FAIL.getCode ( ));
|
rStatElectricQualityProblemLogPO.setType(Objects.equals("1", electricityQualityCheckParam.getCheckResult()) ? DicDataEnum.SUCCESS.getCode() : DicDataEnum.FAIL.getCode());
|
||||||
/*插入审核日志表*/
|
/*插入审核日志表*/
|
||||||
int insert = rStatElectricQualityProblemLogMapper.insert (rStatElectricQualityProblemLogPO);
|
int insert = rStatElectricQualityProblemLogMapper.insert(rStatElectricQualityProblemLogPO);
|
||||||
String report_process ="";
|
String report_process = "";
|
||||||
String report_process_status ="";
|
String report_process_status = "";
|
||||||
String reportProcess =electricityQualityCheckParam.getReportProcess ();
|
String reportProcess = electricityQualityCheckParam.getReportProcess();
|
||||||
String checkResult = electricityQualityCheckParam.getCheckResult ( );
|
String checkResult = electricityQualityCheckParam.getCheckResult();
|
||||||
if (DicDataEnum.CAUSE_ANALYSIS.getCode ().equals(reportProcess)){
|
if (DicDataEnum.CAUSE_ANALYSIS.getCode().equals(reportProcess)) {
|
||||||
if(Objects.equals ("1", checkResult)){
|
if (Objects.equals("1", checkResult)) {
|
||||||
report_process_status = DicDataEnum.AUDITT.getCode ();
|
report_process_status = DicDataEnum.AUDITT.getCode();
|
||||||
report_process = DicDataEnum.PLAN_MEASURES.getCode ();
|
report_process = DicDataEnum.PLAN_MEASURES.getCode();
|
||||||
}else{
|
} else {
|
||||||
report_process_status = DicDataEnum.FAIL.getCode ();
|
report_process_status = DicDataEnum.FAIL.getCode();
|
||||||
report_process = DicDataEnum.CAUSE_ANALYSIS.getCode ();
|
report_process = DicDataEnum.CAUSE_ANALYSIS.getCode();
|
||||||
}
|
}
|
||||||
}else if (DicDataEnum.PLAN_MEASURES.getCode().equals(reportProcess)){
|
} else if (DicDataEnum.PLAN_MEASURES.getCode().equals(reportProcess)) {
|
||||||
if(Objects.equals ("1", checkResult)){
|
if (Objects.equals("1", checkResult)) {
|
||||||
report_process_status = DicDataEnum.AUDITT.getCode ();
|
report_process_status = DicDataEnum.AUDITT.getCode();
|
||||||
report_process = DicDataEnum.ACTUAL_MEASURES.getCode ();
|
report_process = DicDataEnum.ACTUAL_MEASURES.getCode();
|
||||||
}else{
|
} else {
|
||||||
report_process_status = DicDataEnum.FAIL.getCode ();
|
report_process_status = DicDataEnum.FAIL.getCode();
|
||||||
report_process = DicDataEnum.PLAN_MEASURES.getCode ();
|
report_process = DicDataEnum.PLAN_MEASURES.getCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if (DicDataEnum.ACTUAL_MEASURES.getCode().equals(reportProcess)){
|
} else if (DicDataEnum.ACTUAL_MEASURES.getCode().equals(reportProcess)) {
|
||||||
if(Objects.equals ("1", checkResult)){
|
if (Objects.equals("1", checkResult)) {
|
||||||
report_process_status = DicDataEnum.AUDITT.getCode ();
|
report_process_status = DicDataEnum.AUDITT.getCode();
|
||||||
report_process = DicDataEnum.INSIGHTS.getCode ();
|
report_process = DicDataEnum.INSIGHTS.getCode();
|
||||||
}else{
|
} else {
|
||||||
report_process_status = DicDataEnum.FAIL.getCode ();
|
report_process_status = DicDataEnum.FAIL.getCode();
|
||||||
report_process = DicDataEnum.ACTUAL_MEASURES.getCode ();
|
report_process = DicDataEnum.ACTUAL_MEASURES.getCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if (DicDataEnum.INSIGHTS.getCode().equals(reportProcess)){
|
} else if (DicDataEnum.INSIGHTS.getCode().equals(reportProcess)) {
|
||||||
|
|
||||||
if(Objects.equals ("1", checkResult)){
|
if (Objects.equals("1", checkResult)) {
|
||||||
report_process_status = DicDataEnum.AUDITT.getCode ();
|
report_process_status = DicDataEnum.AUDITT.getCode();
|
||||||
report_process = DicDataEnum.ARCHIVED.getCode ();
|
report_process = DicDataEnum.ARCHIVED.getCode();
|
||||||
}else{
|
} else {
|
||||||
report_process_status = DicDataEnum.FAIL.getCode ();
|
report_process_status = DicDataEnum.FAIL.getCode();
|
||||||
report_process = DicDataEnum.INSIGHTS.getCode ();
|
report_process = DicDataEnum.INSIGHTS.getCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UpdateWrapper<RStatElectricQualityProblemFlow> updateWrapper = new UpdateWrapper ();
|
UpdateWrapper<RStatElectricQualityProblemFlow> updateWrapper = new UpdateWrapper();
|
||||||
updateWrapper.eq ("power_quality_problem_no", electricityQualityCheckParam.getPowerQualityProblemNo ());
|
updateWrapper.eq("power_quality_problem_no", electricityQualityCheckParam.getPowerQualityProblemNo());
|
||||||
updateWrapper.set ("report_process", report_process);
|
updateWrapper.set("report_process", report_process);
|
||||||
updateWrapper.set ("report_process_status",report_process_status);
|
updateWrapper.set("report_process_status", report_process_status);
|
||||||
int i= issuesMapper.update (null,updateWrapper);
|
int i = issuesMapper.update(null, updateWrapper);
|
||||||
result = insert==1&&i==1;
|
result = insert == 1 && i == 1;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,16 +5,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.config.GeneralInfo;
|
import com.njcn.common.config.GeneralInfo;
|
||||||
import com.njcn.common.pojo.constant.GeneralConstant;
|
import com.njcn.oss.constant.OssPath;
|
||||||
import com.njcn.common.pojo.constant.OssPath;
|
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
|
||||||
import com.njcn.device.pms.api.DistributionMonitorClient;
|
import com.njcn.device.pms.api.DistributionMonitorClient;
|
||||||
import com.njcn.huawei.obs.util.OBSUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import com.njcn.minio.bo.MinIoUploadResDTO;
|
|
||||||
import com.njcn.minio.config.MinIoProperties;
|
|
||||||
import com.njcn.minio.utils.MinIoUtils;
|
|
||||||
import com.njcn.process.constant.Param;
|
import com.njcn.process.constant.Param;
|
||||||
import com.njcn.process.enums.ProcessResponseEnum;
|
|
||||||
import com.njcn.process.mapper.LoadTypeUserManageMapper;
|
import com.njcn.process.mapper.LoadTypeUserManageMapper;
|
||||||
import com.njcn.process.pojo.param.*;
|
import com.njcn.process.pojo.param.*;
|
||||||
import com.njcn.process.pojo.po.RLoadTypeUserManage;
|
import com.njcn.process.pojo.po.RLoadTypeUserManage;
|
||||||
@@ -61,16 +55,12 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService
|
|||||||
|
|
||||||
private final DeptFeignClient deptFeignClient;
|
private final DeptFeignClient deptFeignClient;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private MinIoUtils minIoUtils;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private GeneralInfo generalInfo;
|
private GeneralInfo generalInfo;
|
||||||
|
|
||||||
@Resource
|
private final FileStorageUtil fileStorageUtil;
|
||||||
private OBSUtil obsUtil;
|
|
||||||
@Resource
|
|
||||||
private MinIoProperties minIoProperties;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 干扰源用户分页查询
|
* 干扰源用户分页查询
|
||||||
@@ -111,11 +101,11 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService
|
|||||||
BeanUtils.copyProperties(rLoadTypeUserManage, rLoadTypeUserManageVO);
|
BeanUtils.copyProperties(rLoadTypeUserManage, rLoadTypeUserManageVO);
|
||||||
//文件
|
//文件
|
||||||
if (rLoadTypeUserManageVO.getIFilePath() != null) {
|
if (rLoadTypeUserManageVO.getIFilePath() != null) {
|
||||||
String iFile = minIoUtils.getObjectUrl(minIoProperties.getBucket(), rLoadTypeUserManageVO.getIFilePath(), 7 * 24 * 60 * 60);
|
String iFile = fileStorageUtil.getFileUrl(rLoadTypeUserManageVO.getIFilePath());
|
||||||
rLoadTypeUserManageVO.setIFile(iFile);
|
rLoadTypeUserManageVO.setIFile(iFile);
|
||||||
}
|
}
|
||||||
if (rLoadTypeUserManageVO.getAFilePath() != null) {
|
if (rLoadTypeUserManageVO.getAFilePath() != null) {
|
||||||
String aFile = minIoUtils.getObjectUrl(minIoProperties.getBucket(), rLoadTypeUserManageVO.getAFilePath(), 7 * 24 * 60 * 60);
|
String aFile = fileStorageUtil.getFileUrl(rLoadTypeUserManageVO.getAFilePath());
|
||||||
rLoadTypeUserManageVO.setIFile(aFile);
|
rLoadTypeUserManageVO.setIFile(aFile);
|
||||||
}
|
}
|
||||||
return rLoadTypeUserManageVO;
|
return rLoadTypeUserManageVO;
|
||||||
@@ -154,14 +144,7 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService
|
|||||||
MultipartFile multipartFile = loadTypeUserIUploadParam.getFile();
|
MultipartFile multipartFile = loadTypeUserIUploadParam.getFile();
|
||||||
//文件上传到Minio服务器,存入文件名
|
//文件上传到Minio服务器,存入文件名
|
||||||
if (Objects.nonNull(multipartFile)) {
|
if (Objects.nonNull(multipartFile)) {
|
||||||
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
rLoadTypeUserManage.setIFilePath(fileStorageUtil.uploadMultipart(multipartFile,OssPath.LOAD_TYPE_USER));
|
||||||
String fileName = OssPath.LOAD_TYPE_USER + minIoUtils.minFileName(multipartFile.getOriginalFilename());
|
|
||||||
obsUtil.multiFileUpload(multipartFile, fileName);
|
|
||||||
rLoadTypeUserManage.setIFilePath(fileName);
|
|
||||||
} else {
|
|
||||||
MinIoUploadResDTO minIoUploadResDTO = fileToMinio(loadTypeUserIUploadParam.getFile(), OssPath.LOAD_TYPE_USER);
|
|
||||||
rLoadTypeUserManage.setIFilePath(minIoUploadResDTO.getMinFileName());
|
|
||||||
}
|
|
||||||
rLoadTypeUserManage.setIUploadTime(new Date());
|
rLoadTypeUserManage.setIUploadTime(new Date());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,21 +203,7 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService
|
|||||||
return loadTypeUserPage.setRecords(resultList);
|
return loadTypeUserPage.setRecords(resultList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传文件到Minio
|
|
||||||
*
|
|
||||||
* @param file 文件
|
|
||||||
* @return 成功标记
|
|
||||||
*/
|
|
||||||
private MinIoUploadResDTO fileToMinio(MultipartFile file, String dir) {
|
|
||||||
try {
|
|
||||||
//把名称存入数据
|
|
||||||
MinIoUploadResDTO upload = minIoUtils.upload(file, minIoProperties.getBucket(), dir);
|
|
||||||
return upload;
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new BusinessException(ProcessResponseEnum.UPLOAD_FILE_ERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传干扰源用户入网报告
|
* 上传干扰源用户入网报告
|
||||||
@@ -250,14 +219,7 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService
|
|||||||
MultipartFile multipartFile = loadTypeUserAUploadParam.getFile();
|
MultipartFile multipartFile = loadTypeUserAUploadParam.getFile();
|
||||||
//文件上传到文件服务器,存入文件名
|
//文件上传到文件服务器,存入文件名
|
||||||
if (Objects.nonNull(multipartFile)) {
|
if (Objects.nonNull(multipartFile)) {
|
||||||
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
rLoadTypeUserManage.setAFilePath(fileStorageUtil.uploadMultipart(multipartFile,OssPath.LOAD_TYPE_USER));
|
||||||
String fileName = OssPath.LOAD_TYPE_USER + minIoUtils.minFileName(multipartFile.getOriginalFilename());
|
|
||||||
obsUtil.multiFileUpload(multipartFile, fileName);
|
|
||||||
rLoadTypeUserManage.setIFilePath(fileName);
|
|
||||||
} else {
|
|
||||||
MinIoUploadResDTO minIoUploadResDTO = fileToMinio(loadTypeUserAUploadParam.getFile(), OssPath.LOAD_TYPE_USER);
|
|
||||||
rLoadTypeUserManage.setAFilePath(minIoUploadResDTO.getMinFileName());
|
|
||||||
}
|
|
||||||
rLoadTypeUserManage.setAUploadTime(new Date());
|
rLoadTypeUserManage.setAUploadTime(new Date());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.minio.bo.MinIoUploadResDTO;
|
import com.njcn.minioss.bo.MinIoUploadResDTO;
|
||||||
import com.njcn.minio.config.MinIoProperties;
|
import com.njcn.oss.constant.OssPath;
|
||||||
import com.njcn.minio.utils.MinIoUtils;
|
import com.njcn.oss.enums.OssResponseEnum;
|
||||||
import com.njcn.process.enums.ProcessResponseEnum;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import com.njcn.process.mapper.RGeneralSurveyPlanDetailMapper;
|
import com.njcn.process.mapper.RGeneralSurveyPlanDetailMapper;
|
||||||
import com.njcn.process.mapper.RGeneralSurveyPlanPOMapper;
|
import com.njcn.process.mapper.RGeneralSurveyPlanPOMapper;
|
||||||
import com.njcn.process.pojo.param.*;
|
import com.njcn.process.pojo.param.*;
|
||||||
@@ -38,7 +38,6 @@ import java.util.stream.Collectors;
|
|||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Description:
|
* Description:
|
||||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
* Date: 2022/11/11 11:24【需求编号】
|
* Date: 2022/11/11 11:24【需求编号】
|
||||||
@@ -47,27 +46,24 @@ import java.util.stream.Stream;
|
|||||||
* @version V1.0.0
|
* @version V1.0.0
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurveyPlanPOMapper, RGeneralSurveyPlanPO> implements RGeneralSurveyPlanPOService{
|
public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurveyPlanPOMapper, RGeneralSurveyPlanPO> implements RGeneralSurveyPlanPOService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
private @Autowired
|
private RGeneralSurveyPlanDetailService rGeneralSurveyPlanDetailService;
|
||||||
RGeneralSurveyPlanDetailService rGeneralSurveyPlanDetailService;
|
|
||||||
|
|
||||||
private @Autowired
|
|
||||||
RGeneralSurveyPlanPOMapper rGeneralSurveyPlanPOMapper;
|
|
||||||
|
|
||||||
private @Autowired
|
|
||||||
RGeneralSurveyPlanDetailMapper rGeneralSurveyPlanDetailMapper;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MinIoUtils minIoUtils;
|
private RGeneralSurveyPlanPOMapper rGeneralSurveyPlanPOMapper;
|
||||||
|
|
||||||
private @Autowired
|
|
||||||
DeptFeignClient deptFeignClient;
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MinIoProperties minIoProperties;
|
private RGeneralSurveyPlanDetailMapper rGeneralSurveyPlanDetailMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DeptFeignClient deptFeignClient;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FileStorageUtil fileStorageUtil;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param rGeneralSurveyPlanAddParm
|
* @param rGeneralSurveyPlanAddParm
|
||||||
* @Description: addPlan
|
* @Description: addPlan
|
||||||
@@ -80,31 +76,31 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean addPlan(RGeneralSurveyPlanAddParm rGeneralSurveyPlanAddParm) {
|
public Boolean addPlan(RGeneralSurveyPlanAddParm rGeneralSurveyPlanAddParm) {
|
||||||
|
|
||||||
RGeneralSurveyPlanPO rGeneralSurveyPlanPO = new RGeneralSurveyPlanPO ();
|
RGeneralSurveyPlanPO rGeneralSurveyPlanPO = new RGeneralSurveyPlanPO();
|
||||||
BeanUtils.copyProperties (rGeneralSurveyPlanAddParm,rGeneralSurveyPlanPO);
|
BeanUtils.copyProperties(rGeneralSurveyPlanAddParm, rGeneralSurveyPlanPO);
|
||||||
/*todo 后期与工作流绑定*/
|
/*todo 后期与工作流绑定*/
|
||||||
rGeneralSurveyPlanPO.setStatus (1);
|
rGeneralSurveyPlanPO.setStatus(1);
|
||||||
boolean b = this.saveOrUpdateByMultiId (rGeneralSurveyPlanPO);
|
boolean b = this.saveOrUpdateByMultiId(rGeneralSurveyPlanPO);
|
||||||
|
|
||||||
List<RGeneralSurveyPlanAddParm.RGeneralSurveyPlanDetailAddParm> rGeneralSurveyPlanDetailAddParm = rGeneralSurveyPlanAddParm.getRGeneralSurveyPlanDetailAddParm ( );
|
List<RGeneralSurveyPlanAddParm.RGeneralSurveyPlanDetailAddParm> rGeneralSurveyPlanDetailAddParm = rGeneralSurveyPlanAddParm.getRGeneralSurveyPlanDetailAddParm();
|
||||||
QueryWrapper<RGeneralSurveyPlanDetail> queryWrapper = new QueryWrapper ();
|
QueryWrapper<RGeneralSurveyPlanDetail> queryWrapper = new QueryWrapper();
|
||||||
queryWrapper.lambda ().eq (RGeneralSurveyPlanDetail::getPlanNo, rGeneralSurveyPlanAddParm.getPlanNo ());
|
queryWrapper.lambda().eq(RGeneralSurveyPlanDetail::getPlanNo, rGeneralSurveyPlanAddParm.getPlanNo());
|
||||||
rGeneralSurveyPlanDetailService.remove (queryWrapper);
|
rGeneralSurveyPlanDetailService.remove(queryWrapper);
|
||||||
List<RGeneralSurveyPlanDetail> rGeneralSurveyPlanDetailList = new ArrayList<> ();
|
List<RGeneralSurveyPlanDetail> rGeneralSurveyPlanDetailList = new ArrayList<>();
|
||||||
rGeneralSurveyPlanDetailAddParm.forEach (temp->{
|
rGeneralSurveyPlanDetailAddParm.forEach(temp -> {
|
||||||
RGeneralSurveyPlanDetail rGeneralSurveyPlanDetail = new RGeneralSurveyPlanDetail();
|
RGeneralSurveyPlanDetail rGeneralSurveyPlanDetail = new RGeneralSurveyPlanDetail();
|
||||||
BeanUtils.copyProperties (temp, rGeneralSurveyPlanDetail);
|
BeanUtils.copyProperties(temp, rGeneralSurveyPlanDetail);
|
||||||
/*目前时间与计划开始时间,结束时间一致*/
|
/*目前时间与计划开始时间,结束时间一致*/
|
||||||
rGeneralSurveyPlanDetail.setGeneralSurveyStartTime (rGeneralSurveyPlanAddParm.getPlanStartTime ());
|
rGeneralSurveyPlanDetail.setGeneralSurveyStartTime(rGeneralSurveyPlanAddParm.getPlanStartTime());
|
||||||
rGeneralSurveyPlanDetail.setGeneralSurveyTime (rGeneralSurveyPlanAddParm.getPlanStartTime ());
|
rGeneralSurveyPlanDetail.setGeneralSurveyTime(rGeneralSurveyPlanAddParm.getPlanStartTime());
|
||||||
rGeneralSurveyPlanDetail.setGeneralSurveyEndTime (rGeneralSurveyPlanAddParm.getPlanEndTime ());
|
rGeneralSurveyPlanDetail.setGeneralSurveyEndTime(rGeneralSurveyPlanAddParm.getPlanEndTime());
|
||||||
rGeneralSurveyPlanDetail.setPlanNo (rGeneralSurveyPlanAddParm.getPlanNo ());
|
rGeneralSurveyPlanDetail.setPlanNo(rGeneralSurveyPlanAddParm.getPlanNo());
|
||||||
rGeneralSurveyPlanDetail.setGeneralSurveyLeader(rGeneralSurveyPlanAddParm.getLeader ());
|
rGeneralSurveyPlanDetail.setGeneralSurveyLeader(rGeneralSurveyPlanAddParm.getLeader());
|
||||||
rGeneralSurveyPlanDetailList.add (rGeneralSurveyPlanDetail);
|
rGeneralSurveyPlanDetailList.add(rGeneralSurveyPlanDetail);
|
||||||
});
|
});
|
||||||
boolean b1 = rGeneralSurveyPlanDetailService.saveOrUpdateBatchByMultiId (rGeneralSurveyPlanDetailList, 5);
|
boolean b1 = rGeneralSurveyPlanDetailService.saveOrUpdateBatchByMultiId(rGeneralSurveyPlanDetailList, 5);
|
||||||
|
|
||||||
return b&&b1;
|
return b && b1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -116,33 +112,33 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
|
|||||||
* @Date: 2022/11/15
|
* @Date: 2022/11/15
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public IPage<RGeneralSurveyPlanVO> query(RGeneralSurveyPlanQueryParm rGeneralSurveyPlanQueryParm,List<String> statusList ) {
|
public IPage<RGeneralSurveyPlanVO> query(RGeneralSurveyPlanQueryParm rGeneralSurveyPlanQueryParm, List<String> statusList) {
|
||||||
IPage<RGeneralSurveyPlanPO> page = new Page<> (rGeneralSurveyPlanQueryParm.getCurrentPage(), rGeneralSurveyPlanQueryParm.getPageSize());
|
IPage<RGeneralSurveyPlanPO> page = new Page<>(rGeneralSurveyPlanQueryParm.getCurrentPage(), rGeneralSurveyPlanQueryParm.getPageSize());
|
||||||
IPage<RGeneralSurveyPlanVO> returnpage = new Page<> (rGeneralSurveyPlanQueryParm.getCurrentPage(), rGeneralSurveyPlanQueryParm.getPageSize());
|
IPage<RGeneralSurveyPlanVO> returnpage = new Page<>(rGeneralSurveyPlanQueryParm.getCurrentPage(), rGeneralSurveyPlanQueryParm.getPageSize());
|
||||||
|
|
||||||
LambdaQueryWrapper<RGeneralSurveyPlanPO> queryWrapper = new LambdaQueryWrapper<> ();
|
LambdaQueryWrapper<RGeneralSurveyPlanPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
if (!StringUtils.isEmpty (rGeneralSurveyPlanQueryParm.getOrgNo ())) {
|
if (!StringUtils.isEmpty(rGeneralSurveyPlanQueryParm.getOrgNo())) {
|
||||||
List<String> data = deptFeignClient.getDepSonIdtByDeptId (rGeneralSurveyPlanQueryParm.getOrgNo ()).getData ( );
|
List<String> data = deptFeignClient.getDepSonIdtByDeptId(rGeneralSurveyPlanQueryParm.getOrgNo()).getData();
|
||||||
|
|
||||||
queryWrapper.in (RGeneralSurveyPlanPO::getOrgNo, data);
|
queryWrapper.in(RGeneralSurveyPlanPO::getOrgNo, data);
|
||||||
}
|
}
|
||||||
if (!StringUtils.isEmpty (rGeneralSurveyPlanQueryParm. getStatus ())) {
|
if (!StringUtils.isEmpty(rGeneralSurveyPlanQueryParm.getStatus())) {
|
||||||
queryWrapper.eq (RGeneralSurveyPlanPO::getStatus, rGeneralSurveyPlanQueryParm.getStatus ());
|
queryWrapper.eq(RGeneralSurveyPlanPO::getStatus, rGeneralSurveyPlanQueryParm.getStatus());
|
||||||
}
|
}
|
||||||
if (!StringUtils.isEmpty (rGeneralSurveyPlanQueryParm.getIsFileUpload ())) {
|
if (!StringUtils.isEmpty(rGeneralSurveyPlanQueryParm.getIsFileUpload())) {
|
||||||
queryWrapper.eq (RGeneralSurveyPlanPO::getIsFileUpload, rGeneralSurveyPlanQueryParm.getIsFileUpload ());
|
queryWrapper.eq(RGeneralSurveyPlanPO::getIsFileUpload, rGeneralSurveyPlanQueryParm.getIsFileUpload());
|
||||||
}
|
}
|
||||||
if (!Objects.isNull (rGeneralSurveyPlanQueryParm.getPlanStartTime ())) {
|
if (!Objects.isNull(rGeneralSurveyPlanQueryParm.getPlanStartTime())) {
|
||||||
queryWrapper.ge (RGeneralSurveyPlanPO::getPlanStartTime, rGeneralSurveyPlanQueryParm.getPlanStartTime ());
|
queryWrapper.ge(RGeneralSurveyPlanPO::getPlanStartTime, rGeneralSurveyPlanQueryParm.getPlanStartTime());
|
||||||
}
|
}
|
||||||
if (!Objects.isNull (rGeneralSurveyPlanQueryParm.getPlanEndTime ())) {
|
if (!Objects.isNull(rGeneralSurveyPlanQueryParm.getPlanEndTime())) {
|
||||||
queryWrapper.le (RGeneralSurveyPlanPO::getPlanEndTime, rGeneralSurveyPlanQueryParm.getPlanEndTime ());
|
queryWrapper.le(RGeneralSurveyPlanPO::getPlanEndTime, rGeneralSurveyPlanQueryParm.getPlanEndTime());
|
||||||
}
|
}
|
||||||
queryWrapper.in (RGeneralSurveyPlanPO::getStatus, statusList);
|
queryWrapper.in(RGeneralSurveyPlanPO::getStatus, statusList);
|
||||||
queryWrapper.orderByAsc (RGeneralSurveyPlanPO::getStatus).orderByDesc (RGeneralSurveyPlanPO::getPlanCreateTime);
|
queryWrapper.orderByAsc(RGeneralSurveyPlanPO::getStatus).orderByDesc(RGeneralSurveyPlanPO::getPlanCreateTime);
|
||||||
|
|
||||||
List<RGeneralSurveyPlanPO> rGeneralSurveyPlanPOS = rGeneralSurveyPlanPOMapper.selectPage (page,queryWrapper).getRecords ();
|
List<RGeneralSurveyPlanPO> rGeneralSurveyPlanPOS = rGeneralSurveyPlanPOMapper.selectPage(page, queryWrapper).getRecords();
|
||||||
if(CollectionUtils.isEmpty (rGeneralSurveyPlanPOS)){
|
if (CollectionUtils.isEmpty(rGeneralSurveyPlanPOS)) {
|
||||||
return returnpage;
|
return returnpage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,36 +150,36 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
|
|||||||
PvTerminalTreeVO::getName));
|
PvTerminalTreeVO::getName));
|
||||||
|
|
||||||
|
|
||||||
List<String> collect = rGeneralSurveyPlanPOS.stream ( ).map (RGeneralSurveyPlanPO::getPlanNo).collect (Collectors.toList ( ));
|
List<String> collect = rGeneralSurveyPlanPOS.stream().map(RGeneralSurveyPlanPO::getPlanNo).collect(Collectors.toList());
|
||||||
LambdaQueryWrapper<RGeneralSurveyPlanDetail> lambdaQueryWrapper = new LambdaQueryWrapper<> ();
|
LambdaQueryWrapper<RGeneralSurveyPlanDetail> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.in (RGeneralSurveyPlanDetail::getPlanNo, collect);
|
lambdaQueryWrapper.in(RGeneralSurveyPlanDetail::getPlanNo, collect);
|
||||||
List<RGeneralSurveyPlanDetail> rGeneralSurveyPlanDetails = rGeneralSurveyPlanDetailMapper.selectList (lambdaQueryWrapper);
|
List<RGeneralSurveyPlanDetail> rGeneralSurveyPlanDetails = rGeneralSurveyPlanDetailMapper.selectList(lambdaQueryWrapper);
|
||||||
List<RGeneralSurveyPlanVO> rGeneralSurveyPlanVOList = new ArrayList<> ();
|
List<RGeneralSurveyPlanVO> rGeneralSurveyPlanVOList = new ArrayList<>();
|
||||||
rGeneralSurveyPlanPOS.forEach (temp ->{
|
rGeneralSurveyPlanPOS.forEach(temp -> {
|
||||||
RGeneralSurveyPlanVO rGeneralSurveyPlanVO = new RGeneralSurveyPlanVO();
|
RGeneralSurveyPlanVO rGeneralSurveyPlanVO = new RGeneralSurveyPlanVO();
|
||||||
BeanUtils.copyProperties (temp, rGeneralSurveyPlanVO);
|
BeanUtils.copyProperties(temp, rGeneralSurveyPlanVO);
|
||||||
long Busbarcount = rGeneralSurveyPlanDetails.stream ( ).
|
long Busbarcount = rGeneralSurveyPlanDetails.stream().
|
||||||
filter (surveyPlanDetail -> Objects.equals (surveyPlanDetail.getPlanNo ( ), temp.getPlanNo ( ))).
|
filter(surveyPlanDetail -> Objects.equals(surveyPlanDetail.getPlanNo(), temp.getPlanNo())).
|
||||||
map (RGeneralSurveyPlanDetail::getBusbarId).distinct ( ).count ( );
|
map(RGeneralSurveyPlanDetail::getBusbarId).distinct().count();
|
||||||
|
|
||||||
long Subcount = rGeneralSurveyPlanDetails.stream ( ).
|
long Subcount = rGeneralSurveyPlanDetails.stream().
|
||||||
filter (surveyPlanDetail -> Objects.equals (surveyPlanDetail.getPlanNo ( ), temp.getPlanNo ( ))).
|
filter(surveyPlanDetail -> Objects.equals(surveyPlanDetail.getPlanNo(), temp.getPlanNo())).
|
||||||
map (RGeneralSurveyPlanDetail::getSubId).distinct ( ).count ( );
|
map(RGeneralSurveyPlanDetail::getSubId).distinct().count();
|
||||||
rGeneralSurveyPlanVO.setBusCount (Busbarcount);
|
rGeneralSurveyPlanVO.setBusCount(Busbarcount);
|
||||||
rGeneralSurveyPlanVO.setSubCount (Subcount);
|
rGeneralSurveyPlanVO.setSubCount(Subcount);
|
||||||
List<RGeneralSurveyPlanVO.RGeneralSurveyPlanDetailVO> collect1 = rGeneralSurveyPlanDetails.stream ( ).
|
List<RGeneralSurveyPlanVO.RGeneralSurveyPlanDetailVO> collect1 = rGeneralSurveyPlanDetails.stream().
|
||||||
filter (surveyPlanDetail -> Objects.equals (surveyPlanDetail.getPlanNo ( ), temp.getPlanNo ( ))).
|
filter(surveyPlanDetail -> Objects.equals(surveyPlanDetail.getPlanNo(), temp.getPlanNo())).
|
||||||
map (surveyPlanDetail -> {
|
map(surveyPlanDetail -> {
|
||||||
RGeneralSurveyPlanVO.RGeneralSurveyPlanDetailVO rGeneralSurveyPlanDetailVO = new RGeneralSurveyPlanVO.RGeneralSurveyPlanDetailVO ( );
|
RGeneralSurveyPlanVO.RGeneralSurveyPlanDetailVO rGeneralSurveyPlanDetailVO = new RGeneralSurveyPlanVO.RGeneralSurveyPlanDetailVO();
|
||||||
BeanUtils.copyProperties (surveyPlanDetail, rGeneralSurveyPlanDetailVO);
|
BeanUtils.copyProperties(surveyPlanDetail, rGeneralSurveyPlanDetailVO);
|
||||||
return rGeneralSurveyPlanDetailVO;
|
return rGeneralSurveyPlanDetailVO;
|
||||||
}).collect (Collectors.toList ( ));
|
}).collect(Collectors.toList());
|
||||||
rGeneralSurveyPlanVO.setOrgName(pvTerminalTreeVOMap.get(temp.getOrgNo())); //单位名称
|
rGeneralSurveyPlanVO.setOrgName(pvTerminalTreeVOMap.get(temp.getOrgNo())); //单位名称
|
||||||
|
|
||||||
rGeneralSurveyPlanVO.setRGeneralSurveyPlanDetailVOList (collect1);
|
rGeneralSurveyPlanVO.setRGeneralSurveyPlanDetailVOList(collect1);
|
||||||
rGeneralSurveyPlanVOList.add (rGeneralSurveyPlanVO);
|
rGeneralSurveyPlanVOList.add(rGeneralSurveyPlanVO);
|
||||||
});
|
});
|
||||||
returnpage.setRecords (rGeneralSurveyPlanVOList);
|
returnpage.setRecords(rGeneralSurveyPlanVOList);
|
||||||
return returnpage;
|
return returnpage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,25 +195,25 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
|
|||||||
public boolean surveyResultUpload(SurveyResultUploadParam surveyResultUploadParam) {
|
public boolean surveyResultUpload(SurveyResultUploadParam surveyResultUploadParam) {
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
RGeneralSurveyPlanPO rGeneralSurveyPlanPO = new RGeneralSurveyPlanPO();
|
RGeneralSurveyPlanPO rGeneralSurveyPlanPO = new RGeneralSurveyPlanPO();
|
||||||
rGeneralSurveyPlanPO.setPlanNo (surveyResultUploadParam.getPlanId ());
|
rGeneralSurveyPlanPO.setPlanNo(surveyResultUploadParam.getPlanId());
|
||||||
rGeneralSurveyPlanPO = this.selectByMultiId (rGeneralSurveyPlanPO);
|
rGeneralSurveyPlanPO = this.selectByMultiId(rGeneralSurveyPlanPO);
|
||||||
String filePath = rGeneralSurveyPlanPO.getFilePath ();
|
String filePath = rGeneralSurveyPlanPO.getFilePath();
|
||||||
filePath = Optional.ofNullable (filePath).orElse ("");
|
filePath = Optional.ofNullable(filePath).orElse("");
|
||||||
Integer fileCount = rGeneralSurveyPlanPO.getFileCount ( );
|
Integer fileCount = rGeneralSurveyPlanPO.getFileCount();
|
||||||
fileCount = Optional.ofNullable (fileCount).orElse (0);
|
fileCount = Optional.ofNullable(fileCount).orElse(0);
|
||||||
for (int i = 0; i < surveyResultUploadParam.getFile ( ).length; i++) {
|
for (int i = 0; i < surveyResultUploadParam.getFile().length; i++) {
|
||||||
String OriginalFilename = surveyResultUploadParam.getFile ( )[i].getOriginalFilename ();
|
String OriginalFilename = surveyResultUploadParam.getFile()[i].getOriginalFilename();
|
||||||
MinIoUploadResDTO minIoUploadResDTO = fileToMinio(surveyResultUploadParam.getFile ( )[i]);
|
String fileStoragePath = fileStorageUtil.uploadMultipart(surveyResultUploadParam.getFile()[i], OssPath.SURVEY_RESULT);
|
||||||
/*filePath格式:minIo服务文件名+##+原始文件名+;*/
|
/*filePath格式:minIo服务文件名+##+原始文件名+;*/
|
||||||
filePath=filePath+minIoUploadResDTO.getMinFileName ()+"##"+OriginalFilename+";";
|
filePath = filePath + fileStoragePath + "##" + OriginalFilename + ";";
|
||||||
fileCount++;
|
fileCount++;
|
||||||
}
|
}
|
||||||
rGeneralSurveyPlanPO.setStatus (4);
|
rGeneralSurveyPlanPO.setStatus(4);
|
||||||
rGeneralSurveyPlanPO.setFileCount (fileCount);
|
rGeneralSurveyPlanPO.setFileCount(fileCount);
|
||||||
rGeneralSurveyPlanPO.setFilePath (filePath);
|
rGeneralSurveyPlanPO.setFilePath(filePath);
|
||||||
rGeneralSurveyPlanPO.setIsFileUpload (1);
|
rGeneralSurveyPlanPO.setIsFileUpload(1);
|
||||||
rGeneralSurveyPlanPO.setUploadTime (new Date ());
|
rGeneralSurveyPlanPO.setUploadTime(new Date());
|
||||||
this.saveOrUpdateByMultiId (rGeneralSurveyPlanPO);
|
this.saveOrUpdateByMultiId(rGeneralSurveyPlanPO);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,20 +228,20 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
|
|||||||
@Override
|
@Override
|
||||||
public List<MinIoUploadResDTO> surveyResultDownload(String planNo) {
|
public List<MinIoUploadResDTO> surveyResultDownload(String planNo) {
|
||||||
RGeneralSurveyPlanPO rGeneralSurveyPlanPO = new RGeneralSurveyPlanPO();
|
RGeneralSurveyPlanPO rGeneralSurveyPlanPO = new RGeneralSurveyPlanPO();
|
||||||
rGeneralSurveyPlanPO.setPlanNo (planNo);
|
rGeneralSurveyPlanPO.setPlanNo(planNo);
|
||||||
rGeneralSurveyPlanPO = this.selectByMultiId (rGeneralSurveyPlanPO);
|
rGeneralSurveyPlanPO = this.selectByMultiId(rGeneralSurveyPlanPO);
|
||||||
String filePath = rGeneralSurveyPlanPO.getFilePath ( );
|
String filePath = rGeneralSurveyPlanPO.getFilePath();
|
||||||
if(StringUtils.isEmpty (filePath)){
|
if (StringUtils.isEmpty(filePath)) {
|
||||||
throw new BusinessException(ProcessResponseEnum.DOWNLOAD_FILE_ERROR);
|
throw new BusinessException(OssResponseEnum.DOWNLOAD_FILE_ERROR);
|
||||||
}
|
}
|
||||||
String[] split = filePath.substring (0, filePath.length ( ) - 1).split (";");
|
String[] split = filePath.substring(0, filePath.length() - 1).split(";");
|
||||||
List<MinIoUploadResDTO> collect = Stream.of (split).map (temp -> {
|
List<MinIoUploadResDTO> collect = Stream.of(split).map(temp -> {
|
||||||
String[] split1 = temp.split ("##");
|
String[] split1 = temp.split("##");
|
||||||
String OriginalFilename = split1[1];
|
String OriginalFilename = split1[1];
|
||||||
String minoFileName = split1[0];
|
String minoFileName = split1[0];
|
||||||
MinIoUploadResDTO dto = new MinIoUploadResDTO(OriginalFilename,minIoUtils.getObjectUrl (minIoProperties.getBucket ( ), minoFileName, 7 * 24 * 60 * 60));
|
MinIoUploadResDTO dto = new MinIoUploadResDTO(OriginalFilename, fileStorageUtil.getFileUrl(minoFileName));
|
||||||
return dto ;
|
return dto;
|
||||||
}).collect (Collectors.toList ( ));
|
}).collect(Collectors.toList());
|
||||||
return collect;
|
return collect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,13 +254,13 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SurveyPlanExcel> exportSurveyPlan(List<String> planIdList) {
|
public List<SurveyPlanExcel> exportSurveyPlan(List<String> planIdList) {
|
||||||
List<SurveyPlanExcel> surveyPlanExcels = new ArrayList<> ();
|
List<SurveyPlanExcel> surveyPlanExcels = new ArrayList<>();
|
||||||
LambdaQueryWrapper<RGeneralSurveyPlanPO> queryWrapper = new LambdaQueryWrapper<> ();
|
LambdaQueryWrapper<RGeneralSurveyPlanPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.in (RGeneralSurveyPlanPO::getPlanNo,planIdList);
|
queryWrapper.in(RGeneralSurveyPlanPO::getPlanNo, planIdList);
|
||||||
List<RGeneralSurveyPlanPO> rGeneralSurveyPlanPOS = rGeneralSurveyPlanPOMapper.selectList (queryWrapper);
|
List<RGeneralSurveyPlanPO> rGeneralSurveyPlanPOS = rGeneralSurveyPlanPOMapper.selectList(queryWrapper);
|
||||||
LambdaQueryWrapper<RGeneralSurveyPlanDetail> lambdaQueryWrapper = new LambdaQueryWrapper<> ();
|
LambdaQueryWrapper<RGeneralSurveyPlanDetail> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.in (RGeneralSurveyPlanDetail::getPlanNo, planIdList);
|
lambdaQueryWrapper.in(RGeneralSurveyPlanDetail::getPlanNo, planIdList);
|
||||||
List<RGeneralSurveyPlanDetail> rGeneralSurveyPlanDetails = rGeneralSurveyPlanDetailMapper.selectList (lambdaQueryWrapper);
|
List<RGeneralSurveyPlanDetail> rGeneralSurveyPlanDetails = rGeneralSurveyPlanDetailMapper.selectList(lambdaQueryWrapper);
|
||||||
|
|
||||||
//部门处理:根据部门code取名称
|
//部门处理:根据部门code取名称
|
||||||
List<PvTerminalTreeVO> dept = deptFeignClient.allDeptList().getData();
|
List<PvTerminalTreeVO> dept = deptFeignClient.allDeptList().getData();
|
||||||
@@ -272,21 +268,21 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
|
|||||||
collect(Collectors.
|
collect(Collectors.
|
||||||
toMap(PvTerminalTreeVO::getId,
|
toMap(PvTerminalTreeVO::getId,
|
||||||
PvTerminalTreeVO::getName));
|
PvTerminalTreeVO::getName));
|
||||||
rGeneralSurveyPlanPOS.forEach (temp->{
|
rGeneralSurveyPlanPOS.forEach(temp -> {
|
||||||
SurveyPlanExcel surveyPlanExcel = new SurveyPlanExcel();
|
SurveyPlanExcel surveyPlanExcel = new SurveyPlanExcel();
|
||||||
BeanUtils.copyProperties (temp, surveyPlanExcel);
|
BeanUtils.copyProperties(temp, surveyPlanExcel);
|
||||||
|
|
||||||
long Busbarcount = rGeneralSurveyPlanDetails.stream ( ).
|
long Busbarcount = rGeneralSurveyPlanDetails.stream().
|
||||||
filter (surveyPlanDetail -> Objects.equals (surveyPlanDetail.getPlanNo ( ), temp.getPlanNo ( ))).
|
filter(surveyPlanDetail -> Objects.equals(surveyPlanDetail.getPlanNo(), temp.getPlanNo())).
|
||||||
map (RGeneralSurveyPlanDetail::getBusbarId).distinct ( ).count ( );
|
map(RGeneralSurveyPlanDetail::getBusbarId).distinct().count();
|
||||||
|
|
||||||
long Subcount = rGeneralSurveyPlanDetails.stream ( ).
|
long Subcount = rGeneralSurveyPlanDetails.stream().
|
||||||
filter (surveyPlanDetail -> Objects.equals (surveyPlanDetail.getPlanNo ( ), temp.getPlanNo ( ))).
|
filter(surveyPlanDetail -> Objects.equals(surveyPlanDetail.getPlanNo(), temp.getPlanNo())).
|
||||||
map (RGeneralSurveyPlanDetail::getSubId).distinct ( ).count ( );
|
map(RGeneralSurveyPlanDetail::getSubId).distinct().count();
|
||||||
surveyPlanExcel.setBusCount (Busbarcount);
|
surveyPlanExcel.setBusCount(Busbarcount);
|
||||||
surveyPlanExcel.setSubCount (Subcount);
|
surveyPlanExcel.setSubCount(Subcount);
|
||||||
surveyPlanExcel.setOrgNo (pvTerminalTreeVOMap.get (surveyPlanExcel.getOrgNo ()));
|
surveyPlanExcel.setOrgNo(pvTerminalTreeVOMap.get(surveyPlanExcel.getOrgNo()));
|
||||||
surveyPlanExcels.add (surveyPlanExcel);
|
surveyPlanExcels.add(surveyPlanExcel);
|
||||||
});
|
});
|
||||||
|
|
||||||
return surveyPlanExcels;
|
return surveyPlanExcels;
|
||||||
@@ -302,8 +298,8 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<RGeneralSurveyPlanDetailOnQuestionVO> querySurveyPlanOnQuestion(SurveyPlanQuestionQueryParm questionQueryParm) {
|
public List<RGeneralSurveyPlanDetailOnQuestionVO> querySurveyPlanOnQuestion(SurveyPlanQuestionQueryParm questionQueryParm) {
|
||||||
List<RGeneralSurveyPlanDetailOnQuestionVO> rGeneralSurveyPlanDetailOnQuestionVOS = new ArrayList<> ();
|
List<RGeneralSurveyPlanDetailOnQuestionVO> rGeneralSurveyPlanDetailOnQuestionVOS = new ArrayList<>();
|
||||||
rGeneralSurveyPlanDetailOnQuestionVOS =rGeneralSurveyPlanDetailMapper.querySurveyPlanOnQuestion(questionQueryParm);
|
rGeneralSurveyPlanDetailOnQuestionVOS = rGeneralSurveyPlanDetailMapper.querySurveyPlanOnQuestion(questionQueryParm);
|
||||||
|
|
||||||
return rGeneralSurveyPlanDetailOnQuestionVOS;
|
return rGeneralSurveyPlanDetailOnQuestionVOS;
|
||||||
}
|
}
|
||||||
@@ -319,14 +315,14 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
|
|||||||
@Override
|
@Override
|
||||||
public List<RGeneralSurveyPlanPO> querySurveyPlanName(SurveyPlanQuestionQueryParm questionQueryParm) {
|
public List<RGeneralSurveyPlanPO> querySurveyPlanName(SurveyPlanQuestionQueryParm questionQueryParm) {
|
||||||
|
|
||||||
List<String> data = deptFeignClient.getDepSonIdtByDeptId (questionQueryParm.getOrgNo ()).getData ( );
|
List<String> data = deptFeignClient.getDepSonIdtByDeptId(questionQueryParm.getOrgNo()).getData();
|
||||||
|
|
||||||
QueryWrapper<RGeneralSurveyPlanPO> queryWrapper = new QueryWrapper<> ();
|
QueryWrapper<RGeneralSurveyPlanPO> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.select ("plan_name").
|
queryWrapper.select("plan_name").
|
||||||
in ("org_no", data).
|
in("org_no", data).
|
||||||
eq ("DATE_FORMAT(upload_time, '%Y-%m')", new SimpleDateFormat ("yyyy-MM").
|
eq("DATE_FORMAT(upload_time, '%Y-%m')", new SimpleDateFormat("yyyy-MM").
|
||||||
format (questionQueryParm.getPlanStartTime ()));
|
format(questionQueryParm.getPlanStartTime()));
|
||||||
List<RGeneralSurveyPlanPO> list = this.list (queryWrapper);
|
List<RGeneralSurveyPlanPO> list = this.list(queryWrapper);
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@@ -343,26 +339,12 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
|
|||||||
public Boolean checkPlanAudit(RGeneralSurveyPlanChcekParm rGeneralSurveyPlanChcekParm) {
|
public Boolean checkPlanAudit(RGeneralSurveyPlanChcekParm rGeneralSurveyPlanChcekParm) {
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
UpdateWrapper<RGeneralSurveyPlanPO> updateWrapper = new UpdateWrapper();
|
UpdateWrapper<RGeneralSurveyPlanPO> updateWrapper = new UpdateWrapper();
|
||||||
updateWrapper.eq ("plan_no", rGeneralSurveyPlanChcekParm.getPlanNo ());
|
updateWrapper.eq("plan_no", rGeneralSurveyPlanChcekParm.getPlanNo());
|
||||||
updateWrapper.set ("check_comment", rGeneralSurveyPlanChcekParm.getCheckComment ());
|
updateWrapper.set("check_comment", rGeneralSurveyPlanChcekParm.getCheckComment());
|
||||||
updateWrapper.set ("check_person",rGeneralSurveyPlanChcekParm.getCheckPerson ());
|
updateWrapper.set("check_person", rGeneralSurveyPlanChcekParm.getCheckPerson());
|
||||||
updateWrapper.set ("status", Objects.equals ("1", rGeneralSurveyPlanChcekParm.getCheckResult ())?3:2);
|
updateWrapper.set("status", Objects.equals("1", rGeneralSurveyPlanChcekParm.getCheckResult()) ? 3 : 2);
|
||||||
result = this.update (updateWrapper);
|
result = this.update(updateWrapper);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传文件到Minio
|
|
||||||
*
|
|
||||||
* @param file 文件
|
|
||||||
* @return 成功标记
|
|
||||||
*/
|
|
||||||
private MinIoUploadResDTO fileToMinio(MultipartFile file) {
|
|
||||||
try {
|
|
||||||
MinIoUploadResDTO upload = minIoUtils.upload(file, minIoProperties.getBucket(), "surveyresult/");
|
|
||||||
return upload;
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new BusinessException (ProcessResponseEnum.UPLOAD_FILE_ERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,11 +44,7 @@
|
|||||||
<artifactId>common-swagger</artifactId>
|
<artifactId>common-swagger</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.njcn</groupId>
|
|
||||||
<artifactId>common-minio</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -1,84 +0,0 @@
|
|||||||
package com.njcn;
|
|
||||||
|
|
||||||
import com.njcn.minio.config.MinIoProperties;
|
|
||||||
import com.njcn.minio.utils.MinIoUtils;
|
|
||||||
import org.apache.commons.fileupload.FileItem;
|
|
||||||
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
|
||||||
import org.apache.commons.io.IOUtils;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author hongawen
|
|
||||||
* @version 1.0.0
|
|
||||||
* @date 2022年11月02日 19:49
|
|
||||||
*/
|
|
||||||
public class MinioTest extends BaseJunitTest {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private MinIoUtils minIoUtils;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private MinIoProperties minIoProperties;
|
|
||||||
|
|
||||||
/***
|
|
||||||
* 上传
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void upload() throws Exception {
|
|
||||||
String strUrl = "C:\\Users\\DELL\\Desktop\\功能测试文件\\text.json";
|
|
||||||
File file = new File(strUrl);
|
|
||||||
MultipartFile cMultiFile = getMultipartFile(file);
|
|
||||||
System.out.println(minIoUtils.upload(cMultiFile, minIoProperties.getBucket(), "day/"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void removeObject(){
|
|
||||||
String name = "day/8D113DD5CE4B4AB2ABB5E531373E3D88.txt";
|
|
||||||
minIoUtils.removeObject(minIoProperties.getBucket(), name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***
|
|
||||||
* 根据对象名获取查看的url
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void getObjectUrl(){
|
|
||||||
String name = "day/8D113DD5CE4B4AB2ABB5E531373E3D88.txt";
|
|
||||||
System.out.println(minIoUtils.getObjectUrl(minIoProperties.getBucket(), name, 7 * 24 * 60 * 60));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static MultipartFile getMultipartFile(File file) {
|
|
||||||
FileItem item = new DiskFileItemFactory().createItem("file"
|
|
||||||
, MediaType.MULTIPART_FORM_DATA_VALUE
|
|
||||||
, true
|
|
||||||
, file.getName());
|
|
||||||
try (InputStream input = new FileInputStream(file);
|
|
||||||
OutputStream os = item.getOutputStream()) {
|
|
||||||
// 流转移
|
|
||||||
IOUtils.copy(input, os);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new IllegalArgumentException("Invalid file: " + e, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new CommonsMultipartFile(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user