Merge branch 'pms'
This commit is contained in:
39
pom.xml
39
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>
|
||||||
@@ -42,20 +43,21 @@
|
|||||||
</distributionManagement>
|
</distributionManagement>
|
||||||
<properties>
|
<properties>
|
||||||
<!--中间件目标地址-->
|
<!--中间件目标地址-->
|
||||||
<!-- <middle.server.url>198.120.100.195</middle.server.url>-->
|
<!-- <middle.server.url>198.120.100.195</middle.server.url>-->
|
||||||
<middle.server.url>192.168.1.31</middle.server.url>
|
<middle.server.url>192.168.1.13</middle.server.url>
|
||||||
<!--微服务模块发布地址-->
|
<!--微服务模块发布地址-->
|
||||||
<!-- <service.server.url>198.120.100.195</service.server.url>-->
|
<!-- <service.server.url>198.120.100.195</service.server.url>-->
|
||||||
<service.server.url>192.168.1.111</service.server.url>
|
<service.server.url>192.168.1.111</service.server.url>
|
||||||
<!--docker仓库地址-->
|
<!--docker仓库地址-->
|
||||||
<docker.server.url>192.168.1.13</docker.server.url>
|
<docker.server.url>192.168.1.13</docker.server.url>
|
||||||
<!--nacos的ip:port-->
|
<!--nacos的ip:port-->
|
||||||
<nacos.url>${middle.server.url}:18848</nacos.url>
|
<nacos.url>${middle.server.url}:18848</nacos.url>
|
||||||
<!--服务器发布内容为空-->
|
<!--服务器发布内容为空-->
|
||||||
<nacos.namespace></nacos.namespace>
|
<!-- <nacos.namespace></nacos.namespace>-->
|
||||||
<!-- <nacos.namespace>fd74182b-1fce-4dba-afa7-2623b0376205</nacos.namespace>-->
|
<nacos.namespace>fd74182b-1fce-4dba-afa7-2623b0376205</nacos.namespace>
|
||||||
<!-- <nacos.namespace>ba3ba5d1-3480-4755-8b87-6b1fce16201c</nacos.namespace>-->
|
<!-- <nacos.namespace>ba3ba5d1-3480-4755-8b87-6b1fce16201c</nacos.namespace>-->
|
||||||
<!-- <nacos.namespace>f6df4a49-39cb-4355-a8fd-8aeb0c537eb1</nacos.namespace>-->
|
<!-- <nacos.namespace>f6df4a49-39cb-4355-a8fd-8aeb0c537eb1</nacos.namespace>-->
|
||||||
|
<!-- <nacos.namespace>02bcd264-c473-4bc1-b225-5fc4b937e32e</nacos.namespace>-->
|
||||||
<!--sentinel:port-->
|
<!--sentinel:port-->
|
||||||
<!-- <sentinel.url>192.168.1.14:8080</sentinel.url>-->
|
<!-- <sentinel.url>192.168.1.14:8080</sentinel.url>-->
|
||||||
<sentinel.url>${middle.server.url}:8080</sentinel.url>
|
<sentinel.url>${middle.server.url}:8080</sentinel.url>
|
||||||
@@ -86,7 +88,6 @@
|
|||||||
<mybatis.version>2.1.3</mybatis.version>
|
<mybatis.version>2.1.3</mybatis.version>
|
||||||
<druid.version>1.2.5</druid.version>
|
<druid.version>1.2.5</druid.version>
|
||||||
<mysql.version>8.0.19</mysql.version>
|
<mysql.version>8.0.19</mysql.version>
|
||||||
<mariadb.version>2.4.0</mariadb.version>
|
|
||||||
<oracle.version>21.6.0.0</oracle.version>
|
<oracle.version>21.6.0.0</oracle.version>
|
||||||
<orai18n.version>21.1.0.0</orai18n.version>
|
<orai18n.version>21.1.0.0</orai18n.version>
|
||||||
<mybatis-plus.version>3.4.2</mybatis-plus.version>
|
<mybatis-plus.version>3.4.2</mybatis-plus.version>
|
||||||
@@ -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>
|
||||||
|
|||||||
@@ -36,4 +36,13 @@ public class GeneralInfo {
|
|||||||
@Value("${business.tempPath}")
|
@Value("${business.tempPath}")
|
||||||
private String businessTempPath;
|
private String businessTempPath;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 文件存储方式
|
||||||
|
* 1:本地磁盘
|
||||||
|
* 2:华为obs
|
||||||
|
* 3: minioss
|
||||||
|
*/
|
||||||
|
@Value("${business.file.storage}")
|
||||||
|
private int businessFileStorage;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ public enum CommonResponseEnum {
|
|||||||
ID_NOT_EXIST("A0100", "id不存在"),
|
ID_NOT_EXIST("A0100", "id不存在"),
|
||||||
|
|
||||||
TIME_ERROR("A0101","时间格式有误"),
|
TIME_ERROR("A0101","时间格式有误"),
|
||||||
|
CLOSE_RESOURCE_ERROR("A0102","关闭资源有误"),
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -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
|
|
||||||
*/
|
|
||||||
private 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>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.njcn.oss.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
* @version 1.0.0
|
||||||
|
* @date 2023年03月06日 11:07
|
||||||
|
*/
|
||||||
|
public interface GeneralConstant {
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 文件存储的3种方式
|
||||||
|
*/
|
||||||
|
Integer LOCAL_DISK = 1;
|
||||||
|
Integer HUAWEI_OBS = 2;
|
||||||
|
Integer MINIO_OSS = 3;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 波形文件的3种后缀
|
||||||
|
*/
|
||||||
|
String CFG =".CFG";
|
||||||
|
String DAT =".DAT";
|
||||||
|
String HDR =".HDR";
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.njcn.oss.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
* @version 1.0.0
|
||||||
|
* @date 2023年03月03日 16:29
|
||||||
|
*/
|
||||||
|
public interface OssPath {
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 波形文件
|
||||||
|
*/
|
||||||
|
String WAVE_DIR="comtrade/";
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 稳态报表
|
||||||
|
*/
|
||||||
|
String HARMONIC_EXCEL_REPORT="harmonic/excel/report";
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 稳态报表模板
|
||||||
|
*/
|
||||||
|
String HARMONIC_EXCEL_TEMPLATE="harmonic/excel/template";
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 算法模块的上传路径
|
||||||
|
*/
|
||||||
|
String ALGORITHM="algorithm/";
|
||||||
|
|
||||||
|
/***
|
||||||
|
* process模块中干扰源入网报告的上传路径
|
||||||
|
*/
|
||||||
|
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>
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
package com.njcn.device.pms.controller.majornetwork;
|
|
||||||
|
|
||||||
|
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
|
||||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
|
||||||
import com.njcn.device.pms.service.majornetwork.TransientPmsService;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.njcn.web.controller.BaseController;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 暂态事件列表(PMS暂用)
|
|
||||||
* @author hongawen
|
|
||||||
* @since 2022-10-14
|
|
||||||
*/
|
|
||||||
@Validated
|
|
||||||
@Slf4j
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/pms/transientStasticData")
|
|
||||||
@Api(tags = "暂态事件列表(PMS暂用)")
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class TransientStasticDataController extends BaseController {
|
|
||||||
|
|
||||||
private final TransientPmsService transientPmsService;
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
|
||||||
@PostMapping("/getTransientAnalyseWavePms")
|
|
||||||
@ApiOperation("暂态事件波形分析")
|
|
||||||
@ApiImplicitParams({
|
|
||||||
@ApiImplicitParam(name = "timeId", value = "暂态时刻", required = true),
|
|
||||||
@ApiImplicitParam(name = "lineId", value = "暂态监测点Id", required = true),
|
|
||||||
@ApiImplicitParam(name = "lineType", value = "暂态监测点类型(1主网 2配网)", required = true)
|
|
||||||
})
|
|
||||||
public HttpResult<WaveDataDTO> getTransientAnalyseWavePms(@RequestParam("timeId") String timeId, @RequestParam("lineId") String lineId, @RequestParam("lineType") Integer lineType){
|
|
||||||
String methodDescribe = getMethodDescribe("getTransientAnalyseWavePms");
|
|
||||||
WaveDataDTO wave = transientPmsService.getTransientAnalyseWavePms(timeId, lineId,lineType);
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, wave, methodDescribe);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package com.njcn.device.pms.service.majornetwork;
|
|
||||||
|
|
||||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TransientPmsService
|
|
||||||
*
|
|
||||||
* @author qijian
|
|
||||||
* @version 1.0.0
|
|
||||||
* @createTime 2022/12/14 - 15:09
|
|
||||||
*/
|
|
||||||
public interface TransientPmsService {
|
|
||||||
/**
|
|
||||||
* 功能描述: 暂态事件波形分析
|
|
||||||
* @param timeId
|
|
||||||
* @param lineId
|
|
||||||
* @param lineType
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
WaveDataDTO getTransientAnalyseWavePms(String timeId, String lineId, Integer lineType);
|
|
||||||
}
|
|
||||||
@@ -1,144 +0,0 @@
|
|||||||
package com.njcn.device.pms.service.majornetwork.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.njcn.common.config.GeneralInfo;
|
|
||||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
|
||||||
import com.njcn.common.pojo.enums.common.ServerEnum;
|
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
|
||||||
import com.njcn.common.utils.PubUtils;
|
|
||||||
import com.njcn.common.utils.wave.AnalyWave;
|
|
||||||
import com.njcn.device.pms.api.DistributionMonitorClient;
|
|
||||||
import com.njcn.device.pms.api.MonitorClient;
|
|
||||||
import com.njcn.device.pms.mapper.majornetwork.DistributionMonitorMapper;
|
|
||||||
import com.njcn.device.pms.mapper.majornetwork.MonitorMapper;
|
|
||||||
import com.njcn.device.pms.mapper.majornetwork.TerminalMapper;
|
|
||||||
import com.njcn.device.pms.pojo.po.DistributionMonitor;
|
|
||||||
import com.njcn.device.pms.pojo.po.Monitor;
|
|
||||||
import com.njcn.device.pms.pojo.po.PmsTerminal;
|
|
||||||
import com.njcn.device.pms.service.majornetwork.EventDetailPmsService;
|
|
||||||
import com.njcn.device.pms.service.majornetwork.IMonitorService;
|
|
||||||
import com.njcn.device.pms.service.majornetwork.TransientPmsService;
|
|
||||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
|
||||||
import com.njcn.device.pq.api.LineFeignClient;
|
|
||||||
import com.njcn.device.pq.enums.DeviceResponseEnum;
|
|
||||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
|
||||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
|
||||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
|
||||||
import com.njcn.event.enums.EventResponseEnum;
|
|
||||||
import com.njcn.event.pojo.param.TransientParam;
|
|
||||||
import com.njcn.event.pojo.param.WaveFileParam;
|
|
||||||
import com.njcn.event.pojo.po.EventDetail;
|
|
||||||
import com.njcn.event.pojo.po.EventDetailNew;
|
|
||||||
import com.njcn.event.pojo.vo.TransientVO;
|
|
||||||
import com.njcn.influxdb.mapper.InfluxDBResultMapperCn;
|
|
||||||
import com.njcn.influxdb.param.InfluxDBPublicParam;
|
|
||||||
import com.njcn.influxdb.utils.InfluxDBCommUtils;
|
|
||||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
|
||||||
import com.njcn.system.enums.DicDataTypeEnum;
|
|
||||||
import com.njcn.system.pojo.po.DictData;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import org.influxdb.dto.QueryResult;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.*;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.time.Instant;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.ZoneId;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.zip.ZipEntry;
|
|
||||||
import java.util.zip.ZipOutputStream;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author: chenchao
|
|
||||||
* @date: 2022/03/29 14:37
|
|
||||||
* @Description: <描述>
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class TransientPmsServiceImpl implements TransientPmsService {
|
|
||||||
|
|
||||||
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
|
||||||
|
|
||||||
private final DicDataFeignClient dicDataFeignClient;
|
|
||||||
|
|
||||||
private final EventDetailPmsService eventDetailPmsService;
|
|
||||||
|
|
||||||
private final GeneralInfo generalInfo;
|
|
||||||
|
|
||||||
private final DistributionMonitorMapper distributionMonitorMapper;
|
|
||||||
|
|
||||||
private final MonitorMapper monitorMapper;
|
|
||||||
|
|
||||||
private final TerminalMapper terminalMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public WaveDataDTO getTransientAnalyseWavePms(String timeId, String lineId,Integer lineType) {
|
|
||||||
//初始化
|
|
||||||
WaveDataDTO waveDataDTO;
|
|
||||||
PmsTerminal pmsTerminal;
|
|
||||||
DictData dictData;
|
|
||||||
String ip = null;
|
|
||||||
String ptTypeName = null;
|
|
||||||
Float pt1 = null;
|
|
||||||
Float pt2 = null;
|
|
||||||
Float ct1 = null;
|
|
||||||
Float ct2 = null;
|
|
||||||
|
|
||||||
//根据监测点id获取信息(1主网 2配网)
|
|
||||||
if (lineType == 1){
|
|
||||||
Monitor monitor = monitorMapper.selectById(lineId);
|
|
||||||
//获取ip
|
|
||||||
pmsTerminal = terminalMapper.selectById(monitor.getTerminalId());
|
|
||||||
ip = pmsTerminal.getIp();
|
|
||||||
//获取接线方式
|
|
||||||
dictData = dicDataFeignClient.getDicDataById(monitor.getTerminalWiringMethod()).getData();
|
|
||||||
ptTypeName = dictData.getName();
|
|
||||||
//获取pt、ct
|
|
||||||
pt1 = monitor.getPt1();
|
|
||||||
pt2 = monitor.getPt1();
|
|
||||||
ct1 = monitor.getCt1();
|
|
||||||
ct2 = monitor.getCt2();
|
|
||||||
}else{
|
|
||||||
DistributionMonitor distributionMonitor = distributionMonitorMapper.selectById(lineId);
|
|
||||||
//获取ip
|
|
||||||
pmsTerminal = terminalMapper.selectById(distributionMonitor.getTerminalId());
|
|
||||||
ip = pmsTerminal.getIp();
|
|
||||||
//获取接线方式
|
|
||||||
dictData = dicDataFeignClient.getDicDataById(distributionMonitor.getTerminalWiringMethod()).getData();
|
|
||||||
ptTypeName = dictData.getName();
|
|
||||||
//获取pt、ct
|
|
||||||
pt1 = distributionMonitor.getPt1();
|
|
||||||
pt2 = distributionMonitor.getPt1();
|
|
||||||
ct1 = distributionMonitor.getCt1();
|
|
||||||
ct2 = distributionMonitor.getCt2();
|
|
||||||
}
|
|
||||||
|
|
||||||
EventDetail eventDetailByTime = eventDetailPmsService.getEventDetailByTime(lineId, timeId);
|
|
||||||
String waveName = eventDetailByTime.getWaveName();
|
|
||||||
|
|
||||||
AnalyWave analyWave = new AnalyWave();
|
|
||||||
WaveDataDTO comtrade = analyWave.getComtrade(generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + ".CFG", 1);
|
|
||||||
if (Objects.isNull(comtrade.getComtradeCfgDTO())) {
|
|
||||||
throw new BusinessException(EventResponseEnum.ANALYSEWAVE_NOT_FOUND);
|
|
||||||
}
|
|
||||||
waveDataDTO = analyWave.getValidData(comtrade);
|
|
||||||
waveDataDTO.setPtType(PubUtils.ptTypeName(ptTypeName));
|
|
||||||
waveDataDTO.setPt((double) (pt1 / pt2));
|
|
||||||
waveDataDTO.setCt((double) (ct1 / ct2));
|
|
||||||
return waveDataDTO;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -17,6 +17,9 @@ public enum EventResponseEnum {
|
|||||||
EVENT_COMMON_ERROR("A00650","暂降模块异常"),
|
EVENT_COMMON_ERROR("A00650","暂降模块异常"),
|
||||||
EVENT_NOT_FOUND("A00651","暂降事件或监测点不存在"),
|
EVENT_NOT_FOUND("A00651","暂降事件或监测点不存在"),
|
||||||
ANALYSEWAVE_NOT_FOUND("A00652","波形文件找不到"),
|
ANALYSEWAVE_NOT_FOUND("A00652","波形文件找不到"),
|
||||||
|
WAVE_DATA_INVALID("A00654","波形文件数据缺失"),
|
||||||
|
DAT_DATA_ERROR("A00653","dat文件数据读取失败"),
|
||||||
|
RMS_DATA_ERROR("A00653","rms数据读取失败"),
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.common.pojo.dto.wave;
|
package com.njcn.event.pojo.dto.wave;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.njcn.common.pojo.dto.wave;
|
package com.njcn.event.pojo.dto.wave;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateTime;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -41,6 +40,11 @@ public class ComtradeCfgDTO implements Serializable {
|
|||||||
// 最终采样率,计算的时候只用一个采样率
|
// 最终采样率,计算的时候只用一个采样率
|
||||||
private Long finalSampleRate;
|
private Long finalSampleRate;
|
||||||
// 整个波形大小
|
// 整个波形大小
|
||||||
private Long nAllWaveNum = 0l;
|
private Long nAllWaveNum = 0L;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 赋值编码格式(二进制)
|
||||||
|
*/
|
||||||
|
private String strBinType;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.common.pojo.dto.wave;
|
package com.njcn.event.pojo.dto.wave;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
package com.njcn.common.pojo.dto.wave;
|
package com.njcn.event.pojo.dto.wave;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author yxb
|
* @author yxb
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.common.pojo.dto.wave;
|
package com.njcn.event.pojo.dto.wave;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.common.pojo.dto.wave;
|
package com.njcn.event.pojo.dto.wave;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.common.pojo.dto.wave;
|
package com.njcn.event.pojo.dto.wave;
|
||||||
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.common.pojo.dto.wave;
|
package com.njcn.event.pojo.dto.wave;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.common.pojo.dto.wave;
|
package com.njcn.event.pojo.dto.wave;
|
||||||
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package com.njcn.event.pojo.po;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version 1.0.0
|
|
||||||
* @author: chenchao
|
|
||||||
* @date: 2022/06/28 19:41
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Component
|
|
||||||
public class WavePath {
|
|
||||||
|
|
||||||
|
|
||||||
@Value("${business.wavePath}")
|
|
||||||
private String wavePath;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -72,6 +72,18 @@
|
|||||||
<artifactId>pq-device-api</artifactId>
|
<artifactId>pq-device-api</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>common-oss</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okio</groupId>
|
||||||
|
<artifactId>okio</artifactId>
|
||||||
|
<version>2.8.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.njcn.event.controller.majornetwork;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.constant.OperateType;
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
|
||||||
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.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
@@ -202,24 +201,6 @@ public class MonitorPointController extends BaseController {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*监测点事件波形分析
|
|
||||||
* @author zbj
|
|
||||||
* @date 2022/7/27
|
|
||||||
*/
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
|
||||||
@PostMapping("/getMonitorEventAnalyseWave")
|
|
||||||
@ApiOperation("监测点事件波形分析")
|
|
||||||
@ApiImplicitParams({
|
|
||||||
@ApiImplicitParam(name = "timeId", value = "时间Id", required = true),
|
|
||||||
@ApiImplicitParam(name = "lineId", value = "监测点Id", required = true)
|
|
||||||
})
|
|
||||||
public HttpResult<WaveDataDTO> getMonitorEventAnalyseWave(@RequestParam("timeId") String timeId, @RequestParam("lineId") String lineId){
|
|
||||||
String methodDescribe = getMethodDescribe("getMonitorEventAnalyseWave");
|
|
||||||
WaveDataDTO wave = eventAnalysisService.getMonitorEventAnalyseWave(timeId, lineId);
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, wave, methodDescribe);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*监测点事件波形下载
|
*监测点事件波形下载
|
||||||
* @author zbj
|
* @author zbj
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ package com.njcn.event.controller.majornetwork;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.constant.OperateType;
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
|
||||||
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.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.event.pojo.dto.wave.WaveDataDTO;
|
||||||
import com.njcn.event.pojo.param.TransientParam;
|
import com.njcn.event.pojo.param.TransientParam;
|
||||||
import com.njcn.event.pojo.param.WaveFileParam;
|
import com.njcn.event.pojo.param.WaveFileParam;
|
||||||
import com.njcn.event.pojo.po.EventDetailNew;
|
import com.njcn.event.pojo.po.EventDetailNew;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.njcn.event.service.majornetwork;
|
package com.njcn.event.service.majornetwork;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
import com.njcn.event.pojo.dto.wave.WaveDataDTO;
|
||||||
import com.njcn.event.pojo.param.*;
|
import com.njcn.event.pojo.param.*;
|
||||||
import com.njcn.event.pojo.po.EventDetail;
|
import com.njcn.event.pojo.po.EventDetail;
|
||||||
import com.njcn.event.pojo.vo.*;
|
import com.njcn.event.pojo.vo.*;
|
||||||
@@ -82,12 +82,7 @@ public interface EventAnalysisService {
|
|||||||
*/
|
*/
|
||||||
Page<WaveTypeVO> getMonitorEventAnalyseQuery(EventBaseParam eventBaseParam);
|
Page<WaveTypeVO> getMonitorEventAnalyseQuery(EventBaseParam eventBaseParam);
|
||||||
|
|
||||||
/**
|
|
||||||
*监测点事件波形分析
|
|
||||||
* @author zbj
|
|
||||||
* @date 2022/7/27
|
|
||||||
*/
|
|
||||||
WaveDataDTO getMonitorEventAnalyseWave(String timeId, String lineId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*监测点事件波形下载
|
*监测点事件波形下载
|
||||||
|
|||||||
@@ -4,16 +4,15 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
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.dto.wave.WaveDataDTO;
|
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
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.PubUtils;
|
import com.njcn.common.utils.PubUtils;
|
||||||
import com.njcn.common.utils.wave.AnalyWave;
|
|
||||||
import com.njcn.device.pq.api.LineFeignClient;
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||||
import com.njcn.event.enums.EventResponseEnum;
|
import com.njcn.event.enums.EventResponseEnum;
|
||||||
import com.njcn.event.pojo.constant.Param;
|
import com.njcn.event.pojo.constant.Param;
|
||||||
|
import com.njcn.event.pojo.dto.wave.WaveDataDTO;
|
||||||
import com.njcn.event.pojo.param.*;
|
import com.njcn.event.pojo.param.*;
|
||||||
import com.njcn.event.pojo.po.EventDetail;
|
import com.njcn.event.pojo.po.EventDetail;
|
||||||
import com.njcn.event.pojo.po.EventDetailNew;
|
import com.njcn.event.pojo.po.EventDetailNew;
|
||||||
@@ -1627,55 +1626,6 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 监测点事件波形分析
|
|
||||||
*
|
|
||||||
* @author zbj
|
|
||||||
* @date 2022/7/27
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public WaveDataDTO getMonitorEventAnalyseWave(String timeId, String lineId) {
|
|
||||||
WaveDataDTO waveDataDTO = new WaveDataDTO();
|
|
||||||
//根据监测点id获取监测点详情
|
|
||||||
LineDetailDataVO lineDetailData = lineFeignClient.getLineDetailData(lineId).getData();
|
|
||||||
EventDetail eventDetailByTime = eventDetailService.getEventDetailByTime(lineId, timeId);
|
|
||||||
|
|
||||||
//暂时没有进行拼接
|
|
||||||
String ip = lineDetailData.getIp();
|
|
||||||
String waveName = eventDetailByTime.getWaveName();
|
|
||||||
/* if(StrUtil.isBlank(waveName)){
|
|
||||||
throw new BusinessException(EventResponseEnum.ANALYSEWAVE_NOT_FOUND);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
AnalyWave analyWave = new AnalyWave();
|
|
||||||
|
|
||||||
|
|
||||||
/*WaveDataDTO comtrade = analyWave.getComtrade(generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + ".CFG", 1);
|
|
||||||
if (Objects.isNull(comtrade.getComtradeCfgDTO())) {
|
|
||||||
throw new BusinessException(EventResponseEnum.ANALYSEWAVE_NOT_FOUND);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
//测试用的本地路径
|
|
||||||
WaveDataDTO comtrade = analyWave.getComtrade("C:\\Users\\CDF\\Desktop\\00-B7-8D-00-E7-15\\1_20220204_125513_383.cfg", 1);
|
|
||||||
|
|
||||||
|
|
||||||
waveDataDTO = analyWave.getValidData(comtrade);
|
|
||||||
|
|
||||||
|
|
||||||
waveDataDTO.setPtType(PubUtils.ptTypeName(lineDetailData.getPtType()));
|
|
||||||
double pt1 = Double.parseDouble(lineDetailData.getPt().split("/")[0]);
|
|
||||||
double pt2 = Double.parseDouble(lineDetailData.getPt().split("/")[1]);
|
|
||||||
double ct1 = Double.parseDouble(lineDetailData.getCt().split("/")[0]);
|
|
||||||
double ct2 = Double.parseDouble(lineDetailData.getCt().split("/")[1]);
|
|
||||||
|
|
||||||
waveDataDTO.setPt(pt1 / pt2);
|
|
||||||
waveDataDTO.setCt(ct1 / ct2);
|
|
||||||
|
|
||||||
|
|
||||||
return waveDataDTO;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ public class EventDetailServiceImpl implements EventDetailService {
|
|||||||
}
|
}
|
||||||
stringBuilder.append(") order by time desc");
|
stringBuilder.append(") order by time desc");
|
||||||
int i = (pageNum - 1)*pageSize;
|
int i = (pageNum - 1)*pageSize;
|
||||||
stringBuilder.append("LIMIT ").append(pageSize).append(" OFFSET ").append(i).append(" tz('Asia/Shanghai')");
|
stringBuilder.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(i).append(" tz('Asia/Shanghai')");
|
||||||
//sql语句
|
//sql语句
|
||||||
String sql = "SELECT * FROM pqs_eventdetail WHERE " + stringBuilder;
|
String sql = "SELECT * FROM pqs_eventdetail WHERE " + stringBuilder;
|
||||||
System.out.println(sql);
|
System.out.println(sql);
|
||||||
|
|||||||
@@ -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.dto.wave.WaveDataDTO;
|
|
||||||
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.common.utils.wave.AnalyWave;
|
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;
|
||||||
@@ -17,6 +17,7 @@ import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
|||||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||||
import com.njcn.event.enums.EventResponseEnum;
|
import com.njcn.event.enums.EventResponseEnum;
|
||||||
import com.njcn.event.mapper.majornetwork.TransientMapper;
|
import com.njcn.event.mapper.majornetwork.TransientMapper;
|
||||||
|
import com.njcn.event.pojo.dto.wave.WaveDataDTO;
|
||||||
import com.njcn.event.pojo.param.TransientParam;
|
import com.njcn.event.pojo.param.TransientParam;
|
||||||
import com.njcn.event.pojo.param.WaveFileParam;
|
import com.njcn.event.pojo.param.WaveFileParam;
|
||||||
import com.njcn.event.pojo.po.EventDetail;
|
import com.njcn.event.pojo.po.EventDetail;
|
||||||
@@ -24,6 +25,8 @@ import com.njcn.event.pojo.po.EventDetailNew;
|
|||||||
import com.njcn.event.pojo.vo.TransientVO;
|
import com.njcn.event.pojo.vo.TransientVO;
|
||||||
import com.njcn.event.service.majornetwork.EventDetailService;
|
import com.njcn.event.service.majornetwork.EventDetailService;
|
||||||
import com.njcn.event.service.majornetwork.TransientService;
|
import com.njcn.event.service.majornetwork.TransientService;
|
||||||
|
import com.njcn.event.utils.WaveUtil;
|
||||||
|
import com.njcn.huawei.obs.util.OBSUtil;
|
||||||
import com.njcn.influxdb.mapper.InfluxDBResultMapperCn;
|
import com.njcn.influxdb.mapper.InfluxDBResultMapperCn;
|
||||||
import com.njcn.influxdb.param.InfluxDBPublicParam;
|
import com.njcn.influxdb.param.InfluxDBPublicParam;
|
||||||
import com.njcn.influxdb.utils.InfluxDBCommUtils;
|
import com.njcn.influxdb.utils.InfluxDBCommUtils;
|
||||||
@@ -45,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;
|
||||||
@@ -75,6 +77,11 @@ public class TransientServiceImpl implements TransientService {
|
|||||||
|
|
||||||
private final InfluxDbUtils influxDbUtils;
|
private final InfluxDbUtils influxDbUtils;
|
||||||
|
|
||||||
|
private final OBSUtil obsUtil;
|
||||||
|
|
||||||
|
private final WaveUtil waveUtil;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<TransientVO> getTransientData(TransientParam transientParam) {
|
public Page<TransientVO> getTransientData(TransientParam transientParam) {
|
||||||
Page<TransientVO> page = new Page<>();
|
Page<TransientVO> page = new Page<>();
|
||||||
@@ -86,7 +93,7 @@ public class TransientServiceImpl implements TransientService {
|
|||||||
List<GeneralDeviceDTO> deviceList = generalDeviceInfoClient.getPracticalRunDeviceInfo(transientParam).getData();
|
List<GeneralDeviceDTO> deviceList = generalDeviceInfoClient.getPracticalRunDeviceInfo(transientParam).getData();
|
||||||
if (!CollectionUtils.isEmpty(deviceList)) {
|
if (!CollectionUtils.isEmpty(deviceList)) {
|
||||||
//获取按终端分类的监测点索引集合
|
//获取按终端分类的监测点索引集合
|
||||||
List<String> LineIndexes = deviceList.stream().flatMap(list->list.getLineIndexes().stream()).collect(Collectors.toList());
|
List<String> LineIndexes = deviceList.stream().flatMap(list -> list.getLineIndexes().stream()).collect(Collectors.toList());
|
||||||
|
|
||||||
if (!CollectionUtils.isEmpty(LineIndexes)) {
|
if (!CollectionUtils.isEmpty(LineIndexes)) {
|
||||||
//influxDB查询待分页数据总量
|
//influxDB查询待分页数据总量
|
||||||
@@ -96,7 +103,7 @@ public class TransientServiceImpl implements TransientService {
|
|||||||
int pages = (int) Math.ceil(data.size() * 1.0 / transientParam.getPageSize());
|
int pages = (int) Math.ceil(data.size() * 1.0 / transientParam.getPageSize());
|
||||||
page.setPages(pages);*/
|
page.setPages(pages);*/
|
||||||
//influxDB分页查询
|
//influxDB分页查询
|
||||||
List<EventDetail> eventDetailData = eventDetailService.getEventDetailLimit(LineIndexes, transientParam.getSearchBeginTime(), transientParam.getSearchEndTime(), transientParam.getPageSize(), transientParam.getPageNum(),transientParam.getWaveType());
|
List<EventDetail> eventDetailData = eventDetailService.getEventDetailLimit(LineIndexes, transientParam.getSearchBeginTime(), transientParam.getSearchEndTime(), transientParam.getPageSize(), transientParam.getPageNum(), transientParam.getWaveType());
|
||||||
|
|
||||||
if (!CollectionUtils.isEmpty(eventDetailData)) {
|
if (!CollectionUtils.isEmpty(eventDetailData)) {
|
||||||
List<String> lineIds = eventDetailData.stream().map(EventDetail::getLineId).collect(Collectors.toList());
|
List<String> lineIds = eventDetailData.stream().map(EventDetail::getLineId).collect(Collectors.toList());
|
||||||
@@ -168,32 +175,45 @@ public class TransientServiceImpl implements TransientService {
|
|||||||
@Override
|
@Override
|
||||||
public WaveDataDTO getTransientAnalyseWave(String timeId, String lineId) {
|
public WaveDataDTO getTransientAnalyseWave(String timeId, String lineId) {
|
||||||
WaveDataDTO waveDataDTO;
|
WaveDataDTO waveDataDTO;
|
||||||
|
//原始数据
|
||||||
|
WaveDataDTO originalData;
|
||||||
//根据监测点id获取监测点详情
|
//根据监测点id获取监测点详情
|
||||||
LineDetailDataVO lineDetailData = lineFeignClient.getLineDetailData(lineId).getData();
|
LineDetailDataVO lineDetailData = lineFeignClient.getLineDetailData(lineId).getData();
|
||||||
EventDetail eventDetailByTime = eventDetailService.getEventDetailByTime(lineId, timeId);
|
EventDetail eventDetailByTime = eventDetailService.getEventDetailByTime(lineId, timeId);
|
||||||
String ip = lineDetailData.getIp();
|
String ip = lineDetailData.getIp();
|
||||||
String waveName = eventDetailByTime.getWaveName();
|
String waveName = eventDetailByTime.getWaveName();
|
||||||
// TransientVO transientVO = transientMapper.getTransientDataById(lineId);
|
String cfgPath, datPath;
|
||||||
// String name = transientVO.getName();
|
if (generalInfo.getBusinessFileStorage() == GeneralConstant.LOCAL_DISK) {
|
||||||
// String substation = transientVO.getSubstation();
|
cfgPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.CFG;
|
||||||
// Double eventValue = new BigDecimal(eventDetailByTime.getEventValue()).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue();
|
datPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.DAT;
|
||||||
// Double v = new BigDecimal(eventValue*100).setScale(0,BigDecimal.ROUND_HALF_UP).doubleValue();
|
InputStream cfgStream = waveUtil.getFileInputStreamByFilePath(cfgPath);
|
||||||
// Double persistTime = eventDetailByTime.getPersistTime()/1000;
|
InputStream datStream = waveUtil.getFileInputStreamByFilePath(datPath);
|
||||||
|
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
|
||||||
// waveDataVO.setName("变电站名称: "+ substation +" 监测点名称: "+ name +" 发生时刻: "+ timeId +" 暂降幅值: "+ v +"% 持续时间: "+ persistTime +"s");
|
throw new BusinessException(EventResponseEnum.ANALYSEWAVE_NOT_FOUND);
|
||||||
// waveDataVO.setTargetName("相电压有效值");
|
}
|
||||||
AnalyWave analyWave = new AnalyWave();
|
originalData = waveUtil.getComtrade(cfgStream, datStream, 1);
|
||||||
// 从本地读取该事件的波形
|
// } else if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||||
WaveDataDTO comtrade = analyWave.getComtrade(generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + ".CFG", 1);
|
} else {
|
||||||
if (Objects.isNull(comtrade.getComtradeCfgDTO())) {
|
cfgPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG;
|
||||||
throw new BusinessException(EventResponseEnum.ANALYSEWAVE_NOT_FOUND);
|
datPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT;
|
||||||
|
try (
|
||||||
|
InputStream cfgStream = obsUtil.fileDownload(cfgPath);
|
||||||
|
InputStream datStream = obsUtil.fileDownload(datPath)
|
||||||
|
) {
|
||||||
|
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
|
||||||
|
throw new BusinessException(EventResponseEnum.ANALYSEWAVE_NOT_FOUND);
|
||||||
|
}
|
||||||
|
originalData = waveUtil.getComtrade(cfgStream, datStream, 1);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new BusinessException(EventResponseEnum.WAVE_DATA_INVALID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
waveDataDTO = analyWave.getValidData(comtrade);
|
waveDataDTO = waveUtil.getValidData(originalData);
|
||||||
waveDataDTO.setPtType(PubUtils.ptTypeName(lineDetailData.getPtType()));
|
waveDataDTO.setPtType(PubUtils.ptTypeName(lineDetailData.getPtType()));
|
||||||
double pt1 = Double.parseDouble(lineDetailData.getPt().split("/")[0]);
|
double pt1 = Double.parseDouble(lineDetailData.getPt().split(StrUtil.SLASH)[0]);
|
||||||
double pt2 = Double.parseDouble(lineDetailData.getPt().split("/")[1]);
|
double pt2 = Double.parseDouble(lineDetailData.getPt().split(StrUtil.SLASH)[1]);
|
||||||
double ct1 = Double.parseDouble(lineDetailData.getCt().split("/")[0]);
|
double ct1 = Double.parseDouble(lineDetailData.getCt().split(StrUtil.SLASH)[0]);
|
||||||
double ct2 = Double.parseDouble(lineDetailData.getCt().split("/")[1]);
|
double ct2 = Double.parseDouble(lineDetailData.getCt().split(StrUtil.SLASH)[1]);
|
||||||
waveDataDTO.setPt(pt1 / pt2);
|
waveDataDTO.setPt(pt1 / pt2);
|
||||||
waveDataDTO.setCt(ct1 / ct2);
|
waveDataDTO.setCt(ct1 / ct2);
|
||||||
return waveDataDTO;
|
return waveDataDTO;
|
||||||
@@ -236,7 +256,7 @@ public class TransientServiceImpl implements TransientService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<EventDetailNew> getTransientValue(TransientParam transientParam){
|
public Page<EventDetailNew> getTransientValue(TransientParam transientParam) {
|
||||||
Page<EventDetailNew> page = new Page<>();
|
Page<EventDetailNew> page = new Page<>();
|
||||||
page.setSize(transientParam.getPageSize());
|
page.setSize(transientParam.getPageSize());
|
||||||
page.setCurrent(transientParam.getPageNum());
|
page.setCurrent(transientParam.getPageNum());
|
||||||
@@ -250,7 +270,7 @@ public class TransientServiceImpl implements TransientService {
|
|||||||
if (!CollectionUtils.isEmpty(lineList)) {
|
if (!CollectionUtils.isEmpty(lineList)) {
|
||||||
StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineList);
|
StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineList);
|
||||||
//influxDB查询待分页数据总量
|
//influxDB查询待分页数据总量
|
||||||
Long total = getTransientDetail(stringBuilder,transientParam);
|
Long total = getTransientDetail(stringBuilder, transientParam);
|
||||||
page.setTotal(total);
|
page.setTotal(total);
|
||||||
//分页总页数
|
//分页总页数
|
||||||
int pages = (int) Math.ceil(transientParam.getPageNum() * 1.0 / transientParam.getPageSize());
|
int pages = (int) Math.ceil(transientParam.getPageNum() * 1.0 / transientParam.getPageSize());
|
||||||
@@ -268,8 +288,8 @@ public class TransientServiceImpl implements TransientService {
|
|||||||
|
|
||||||
|
|
||||||
for (EventDetailNew eventDetail : eventDetailData) {
|
for (EventDetailNew eventDetail : eventDetailData) {
|
||||||
for(AreaLineInfoVO areaLineInfoVO : r){
|
for (AreaLineInfoVO areaLineInfoVO : r) {
|
||||||
if(eventDetail.getLineId().equals(areaLineInfoVO.getLineId())){
|
if (eventDetail.getLineId().equals(areaLineInfoVO.getLineId())) {
|
||||||
eventDetail.setLineId(areaLineInfoVO.getLineId());
|
eventDetail.setLineId(areaLineInfoVO.getLineId());
|
||||||
eventDetail.setLineName(areaLineInfoVO.getLineName());
|
eventDetail.setLineName(areaLineInfoVO.getLineName());
|
||||||
eventDetail.setGdName(areaLineInfoVO.getGdName());
|
eventDetail.setGdName(areaLineInfoVO.getGdName());
|
||||||
@@ -310,22 +330,22 @@ public class TransientServiceImpl implements TransientService {
|
|||||||
/**
|
/**
|
||||||
* 查询数据库
|
* 查询数据库
|
||||||
*/
|
*/
|
||||||
private Long getTransientDetail(StringBuilder stringBuilder,TransientParam transientParam) {
|
private Long getTransientDetail(StringBuilder stringBuilder, TransientParam transientParam) {
|
||||||
Long total = 0L;
|
Long total = 0L;
|
||||||
//组装sql语句
|
//组装sql语句
|
||||||
stringBuilder.append(" and time >= '").append(DateUtil.beginOfDay(DateUtil.parse(transientParam.getSearchBeginTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(transientParam.getSearchEndTime()))).append("'").append(InfluxDBPublicParam.TIME_ZONE);
|
stringBuilder.append(" and time >= '").append(DateUtil.beginOfDay(DateUtil.parse(transientParam.getSearchBeginTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(transientParam.getSearchEndTime()))).append("'").append(InfluxDBPublicParam.TIME_ZONE);
|
||||||
//sql语句
|
//sql语句
|
||||||
String sql = "SELECT count(wave_type) FROM pqs_eventdetail WHERE " + stringBuilder;
|
String sql = "SELECT count(wave_type) FROM pqs_eventdetail WHERE " + stringBuilder;
|
||||||
System.out.println("sql------------->>>"+sql);
|
System.out.println("sql------------->>>" + sql);
|
||||||
//结果集
|
//结果集
|
||||||
QueryResult result = influxDbUtils.query(sql);
|
QueryResult result = influxDbUtils.query(sql);
|
||||||
//结果集映射到对象中
|
//结果集映射到对象中
|
||||||
List<QueryResult.Series> series = result.getResults().get(0).getSeries();
|
List<QueryResult.Series> series = result.getResults().get(0).getSeries();
|
||||||
if(CollUtil.isNotEmpty(series)){
|
if (CollUtil.isNotEmpty(series)) {
|
||||||
Double tem =(Double)series.get(0).getValues().get(0).get(1);
|
Double tem = (Double) series.get(0).getValues().get(0).get(1);
|
||||||
total = tem.longValue();
|
total = tem.longValue();
|
||||||
}
|
}
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -334,31 +354,31 @@ public class TransientServiceImpl implements TransientService {
|
|||||||
private List<EventDetailNew> getTransientDetailLimit(List<String> lineIndexes, TransientParam transientParam) {
|
private List<EventDetailNew> getTransientDetailLimit(List<String> lineIndexes, TransientParam transientParam) {
|
||||||
//查询数据是否为空,不为空拼接sql语句
|
//查询数据是否为空,不为空拼接sql语句
|
||||||
StringBuilder querySql = new StringBuilder();
|
StringBuilder querySql = new StringBuilder();
|
||||||
if(Objects.nonNull(transientParam.getEventValueMin())){
|
if (Objects.nonNull(transientParam.getEventValueMin())) {
|
||||||
querySql.append(" and event_value >=").append(transientParam.getEventValueMin());
|
querySql.append(" and event_value >=").append(transientParam.getEventValueMin());
|
||||||
}
|
}
|
||||||
if(Objects.nonNull(transientParam.getEventValueMax())){
|
if (Objects.nonNull(transientParam.getEventValueMax())) {
|
||||||
querySql.append(" and event_value <=").append(transientParam.getEventValueMax());
|
querySql.append(" and event_value <=").append(transientParam.getEventValueMax());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Objects.nonNull(transientParam.getPersistMin())){
|
if (Objects.nonNull(transientParam.getPersistMin())) {
|
||||||
querySql.append(" and persist_time >=").append(transientParam.getPersistMin());
|
querySql.append(" and persist_time >=").append(transientParam.getPersistMin());
|
||||||
}
|
}
|
||||||
if(Objects.nonNull(transientParam.getEventValueMax())){
|
if (Objects.nonNull(transientParam.getEventValueMax())) {
|
||||||
querySql.append(" and persist_time <=").append(transientParam.getPersistMax());
|
querySql.append(" and persist_time <=").append(transientParam.getPersistMax());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Objects.nonNull(transientParam.getSeverityMin())){
|
if (Objects.nonNull(transientParam.getSeverityMin())) {
|
||||||
querySql.append(" and severity >=").append(transientParam.getSeverityMin());
|
querySql.append(" and severity >=").append(transientParam.getSeverityMin());
|
||||||
}
|
}
|
||||||
if(Objects.nonNull(transientParam.getSeverityMax())){
|
if (Objects.nonNull(transientParam.getSeverityMax())) {
|
||||||
querySql.append(" and severity <=").append(transientParam.getSeverityMax());
|
querySql.append(" and severity <=").append(transientParam.getSeverityMax());
|
||||||
}
|
}
|
||||||
if(Objects.nonNull(transientParam.getFileFlag())){
|
if (Objects.nonNull(transientParam.getFileFlag())) {
|
||||||
querySql.append(" and file_flag = ").append(transientParam.getFileFlag());
|
querySql.append(" and file_flag = ").append(transientParam.getFileFlag());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(CollUtil.isNotEmpty(transientParam.getWaveType())) {
|
if (CollUtil.isNotEmpty(transientParam.getWaveType())) {
|
||||||
querySql.append(" and ( ");
|
querySql.append(" and ( ");
|
||||||
for (int i = 0; i < transientParam.getWaveType().size(); i++) {
|
for (int i = 0; i < transientParam.getWaveType().size(); i++) {
|
||||||
if (transientParam.getWaveType().size() - i != 1) {
|
if (transientParam.getWaveType().size() - i != 1) {
|
||||||
@@ -368,7 +388,7 @@ public class TransientServiceImpl implements TransientService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(CollUtil.isNotEmpty(transientParam.getEventReason())) {
|
if (CollUtil.isNotEmpty(transientParam.getEventReason())) {
|
||||||
querySql.append(" and ( ");
|
querySql.append(" and ( ");
|
||||||
for (int i = 0; i < transientParam.getEventReason().size(); i++) {
|
for (int i = 0; i < transientParam.getEventReason().size(); i++) {
|
||||||
if (transientParam.getWaveType().size() - i != 1) {
|
if (transientParam.getWaveType().size() - i != 1) {
|
||||||
@@ -378,7 +398,7 @@ public class TransientServiceImpl implements TransientService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(CollUtil.isNotEmpty(transientParam.getEventType())) {
|
if (CollUtil.isNotEmpty(transientParam.getEventType())) {
|
||||||
querySql.append(" and ( ");
|
querySql.append(" and ( ");
|
||||||
for (int i = 0; i < transientParam.getEventType().size(); i++) {
|
for (int i = 0; i < transientParam.getEventType().size(); i++) {
|
||||||
if (transientParam.getEventType().size() - i != 1) {
|
if (transientParam.getEventType().size() - i != 1) {
|
||||||
@@ -402,8 +422,8 @@ public class TransientServiceImpl implements TransientService {
|
|||||||
stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("') ");
|
stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("') ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int i = (transientParam.getPageNum() - 1)*transientParam.getPageSize();
|
int i = (transientParam.getPageNum() - 1) * transientParam.getPageSize();
|
||||||
stringBuilder.append("LIMIT ").append(transientParam.getPageSize()).append(" OFFSET ").append(i).append(" tz('Asia/Shanghai')");
|
stringBuilder.append(" LIMIT ").append(transientParam.getPageSize()).append(" OFFSET ").append(i).append(" tz('Asia/Shanghai')");
|
||||||
//sql语句
|
//sql语句
|
||||||
String sql = "SELECT * FROM pqs_eventdetail WHERE " + stringBuilder;
|
String sql = "SELECT * FROM pqs_eventdetail WHERE " + stringBuilder;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.njcn.event.service.majornetwork;
|
package com.njcn.event.service.majornetwork;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
import com.njcn.event.pojo.dto.wave.WaveDataDTO;
|
||||||
import com.njcn.event.pojo.param.TransientParam;
|
import com.njcn.event.pojo.param.TransientParam;
|
||||||
import com.njcn.event.pojo.param.WaveFileParam;
|
import com.njcn.event.pojo.param.WaveFileParam;
|
||||||
import com.njcn.event.pojo.po.EventDetail;
|
import com.njcn.event.pojo.po.EventDetail;
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
package com.njcn.event.utils;
|
||||||
|
|
||||||
|
public class BitConverter {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* byte数组转换为无符号short整数
|
||||||
|
* @param bytes byte数组
|
||||||
|
* @param off 开始位置
|
||||||
|
* @return short整数
|
||||||
|
*/
|
||||||
|
public static short byte2ToUnsignedShort(byte[] bytes, int off) {
|
||||||
|
int low = bytes[off]& 0xFF;
|
||||||
|
int high = bytes[off + 1]& 0xFF;
|
||||||
|
return (short)(((high & 0x00FF) << 8) | (0x00FF & low));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字节转换为浮点
|
||||||
|
*
|
||||||
|
* @param b 字节(至少4个字节)
|
||||||
|
* @param index 开始位置
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static float byte4float(byte[] b, int index) {
|
||||||
|
/* b=new byte[4];
|
||||||
|
b[0]=-16;
|
||||||
|
b[1]=-1;
|
||||||
|
b[2]=117;
|
||||||
|
b[3]=66;*/
|
||||||
|
|
||||||
|
int l;
|
||||||
|
l = b[index + 0];
|
||||||
|
l &= 0xff;
|
||||||
|
l |= ((long) b[index + 1] << 8);
|
||||||
|
l &= 0xffff;
|
||||||
|
l |= ((long) b[index + 2] << 16);
|
||||||
|
l &= 0xffffff;
|
||||||
|
l |= ((long) b[index + 3] << 24);
|
||||||
|
return Float.intBitsToFloat(l);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* byte数组转换为int32整数
|
||||||
|
* @param bytes byte数组
|
||||||
|
* @param off 开始位置
|
||||||
|
* @return int整数
|
||||||
|
*/
|
||||||
|
public static int byte4ToInt(byte[] bytes, int off) {
|
||||||
|
int b0 = bytes[off] & 0xFF;
|
||||||
|
int b1 = bytes[off + 1] & 0xFF;
|
||||||
|
int b2 = bytes[off + 2] & 0xFF;
|
||||||
|
int b3 = bytes[off + 3] & 0xFF;
|
||||||
|
return (b3 << 24) | (b2 << 16) | (b1 << 8) | b0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* byte数组转换为int16整数
|
||||||
|
* @param bytes byte数组
|
||||||
|
* @param off 开始位置
|
||||||
|
* @return int整数
|
||||||
|
*/
|
||||||
|
public static int byte2ToInt(byte[] bytes, int off) {
|
||||||
|
int b0 = bytes[off] & 0xFF;
|
||||||
|
int b1 = bytes[off + 1] & 0xFF;
|
||||||
|
return (b1 << 8) | b0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* byte数组转换为int16整数
|
||||||
|
* @param bytes byte数组
|
||||||
|
* @param off 开始位置
|
||||||
|
* @return int整数
|
||||||
|
*/
|
||||||
|
public static long byte4ToLong(byte[] bytes, int off) {
|
||||||
|
long b0 = bytes[off] & 0xFF;
|
||||||
|
long b1 = bytes[off + 1] & 0xFF;
|
||||||
|
long b2 = bytes[off + 2] & 0xFF;
|
||||||
|
long b3 = bytes[off + 3] & 0xFF;
|
||||||
|
|
||||||
|
return (b3 << 24) | (b2 << 16) | (b1 << 8) | b0;
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -44,3 +44,4 @@ mybatis-plus:
|
|||||||
type-aliases-package: com.njcn.event.pojo
|
type-aliases-package: com.njcn.event.pojo
|
||||||
mqtt:
|
mqtt:
|
||||||
client-id: @artifactId@${random.value}
|
client-id: @artifactId@${random.value}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
package com.njcn.event;
|
package com.njcn.event;
|
||||||
|
|
||||||
|
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;
|
||||||
import com.njcn.event.pojo.PqsEventDetailCount;
|
import com.njcn.event.pojo.PqsEventDetailCount;
|
||||||
|
import com.njcn.event.pojo.dto.wave.EigenvalueDTO;
|
||||||
|
import com.njcn.event.pojo.dto.wave.WaveDataDTO;
|
||||||
|
import com.njcn.event.utils.WaveUtil;
|
||||||
|
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;
|
||||||
@@ -20,8 +26,11 @@ 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.FileNotFoundException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
||||||
import static com.njcn.influxdb.param.InfluxDBPublicParam.PQS_EVENT_DETAIL;
|
import static com.njcn.influxdb.param.InfluxDBPublicParam.PQS_EVENT_DETAIL;
|
||||||
@@ -39,79 +48,85 @@ public class EventBootApplicationTest {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private InfluxDbUtils influxDbUtils;
|
private InfluxDbUtils influxDbUtils;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WaveUtil waveUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OBSUtil obsUtil;
|
||||||
|
|
||||||
// TODO https://github.com/influxdata/influxdb-java/blob/master/QUERY_BUILDER.md
|
// TODO https://github.com/influxdata/influxdb-java/blob/master/QUERY_BUILDER.md
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void queryList() {
|
public void queryList() {
|
||||||
// or 条件数据
|
// or 条件数据
|
||||||
List<Clause> clauses = getClauses();
|
List<Clause> clauses = getClauses();
|
||||||
|
|
||||||
SelectQueryImpl selectQuery = select().column("line_id").column("eventass_index").from(influxDbConfig.getDatabase(), PQS_EVENT_DETAIL);
|
SelectQueryImpl selectQuery = select().column("line_id").column("eventass_index").from(influxDbConfig.getDatabase(), PQS_EVENT_DETAIL);
|
||||||
WhereQueryImpl<SelectQueryImpl> where = selectQuery.where();
|
WhereQueryImpl<SelectQueryImpl> where = selectQuery.where();
|
||||||
|
|
||||||
// WHERE (line_id = '1' OR line_id = '2' OR line_id = '3') 加上前后()
|
// WHERE (line_id = '1' OR line_id = '2' OR line_id = '3') 加上前后()
|
||||||
whereAndNested(clauses, where);
|
whereAndNested(clauses, where);
|
||||||
|
|
||||||
// AND time >= '2022-05-01T00:00:00Z' AND time <= '2022-09-01T00:00:00Z' tz('Asia/Shanghai');
|
// AND time >= '2022-05-01T00:00:00Z' AND time <= '2022-09-01T00:00:00Z' tz('Asia/Shanghai');
|
||||||
where.and(gte("time", "2022-05-01T00:00:00Z")).and(lte("time", "2022-09-01T00:00:00Z"));
|
where.and(gte("time", "2022-05-01T00:00:00Z")).and(lte("time", "2022-09-01T00:00:00Z"));
|
||||||
where.tz("Asia/Shanghai");
|
where.tz("Asia/Shanghai");
|
||||||
|
|
||||||
QueryResult result = influxDbUtils.query(selectQuery.getCommand());
|
QueryResult result = influxDbUtils.query(selectQuery.getCommand());
|
||||||
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
||||||
List<PqsEventDetail> re = influxDBResultMapper.toPOJO(result, PqsEventDetail.class);
|
List<PqsEventDetail> re = influxDBResultMapper.toPOJO(result, PqsEventDetail.class);
|
||||||
Assert.assertTrue(re.size() > 0);
|
Assert.assertTrue(re.size() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void queryCount() {
|
public void queryCount() {
|
||||||
// or 条件数据
|
// or 条件数据
|
||||||
List<Clause> clauses = getClauses();
|
List<Clause> clauses = getClauses();
|
||||||
|
|
||||||
SelectQueryImpl selectQuery = select().count("eventass_index").from(influxDbConfig.getDatabase(), PQS_EVENT_DETAIL);
|
SelectQueryImpl selectQuery = select().count("eventass_index").from(influxDbConfig.getDatabase(), PQS_EVENT_DETAIL);
|
||||||
WhereQueryImpl<SelectQueryImpl> where = selectQuery.where();
|
WhereQueryImpl<SelectQueryImpl> where = selectQuery.where();
|
||||||
|
|
||||||
// WHERE (line_id = '1' OR line_id = '2' OR line_id = '3') 加上前后()
|
// WHERE (line_id = '1' OR line_id = '2' OR line_id = '3') 加上前后()
|
||||||
whereAndNested(clauses, where);
|
whereAndNested(clauses, where);
|
||||||
|
|
||||||
// AND time >= '2022-05-01T00:00:00Z' AND time <= '2022-09-01T00:00:00Z' tz('Asia/Shanghai');
|
// AND time >= '2022-05-01T00:00:00Z' AND time <= '2022-09-01T00:00:00Z' tz('Asia/Shanghai');
|
||||||
where.and(gte("time", "2022-05-01T00:00:00Z")).and(lte("time", "2022-09-01T00:00:00Z"));
|
where.and(gte("time", "2022-05-01T00:00:00Z")).and(lte("time", "2022-09-01T00:00:00Z"));
|
||||||
where.tz("Asia/Shanghai");
|
where.tz("Asia/Shanghai");
|
||||||
|
|
||||||
QueryResult result = influxDbUtils.query(selectQuery.getCommand());
|
QueryResult result = influxDbUtils.query(selectQuery.getCommand());
|
||||||
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
||||||
List<PqsEventDetailCount> re = influxDBResultMapper.toPOJO(result, PqsEventDetailCount.class);
|
List<PqsEventDetailCount> re = influxDBResultMapper.toPOJO(result, PqsEventDetailCount.class);
|
||||||
Assert.assertTrue(re.size() > 0);
|
Assert.assertTrue(re.size() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void queryAggregate() {
|
public void queryAggregate() {
|
||||||
|
|
||||||
// SELECT (SUM(onlinemin) / (SUM(onlinemin) + SUM(offlinemin))) * 100 FROM pqs_onlinerate
|
// SELECT (SUM(onlinemin) / (SUM(onlinemin) + SUM(offlinemin))) * 100 FROM pqs_onlinerate
|
||||||
SelectionQueryImpl select = select();
|
SelectionQueryImpl select = select();
|
||||||
SelectionQueryImpl sum = select.op(op(sum("onlinemin"), "/", op(sum("onlinemin"), "+", sum("offlinemin"))), "*", 100)
|
SelectionQueryImpl sum = select.op(op(sum("onlinemin"), "/", op(sum("onlinemin"), "+", sum("offlinemin"))), "*", 100)
|
||||||
.as("value");
|
.as("value");
|
||||||
SelectQueryImpl selectQuery = sum.from(influxDbConfig.getDatabase(), "pqs_onlinerate");
|
SelectQueryImpl selectQuery = sum.from(influxDbConfig.getDatabase(), "pqs_onlinerate");
|
||||||
WhereQueryImpl<SelectQueryImpl> where = selectQuery.where();
|
WhereQueryImpl<SelectQueryImpl> where = selectQuery.where();
|
||||||
|
|
||||||
// AND time >= '2022-05-01T00:00:00Z' AND time <= '2022-09-01T00:00:00Z' tz('Asia/Shanghai');
|
// AND time >= '2022-05-01T00:00:00Z' AND time <= '2022-09-01T00:00:00Z' tz('Asia/Shanghai');
|
||||||
where.and(gte("time", "2022-05-01T00:00:00Z")).and(lte("time", "2022-09-01T00:00:00Z"));
|
where.and(gte("time", "2022-05-01T00:00:00Z")).and(lte("time", "2022-09-01T00:00:00Z"));
|
||||||
where.tz("Asia/Shanghai");
|
where.tz("Asia/Shanghai");
|
||||||
|
|
||||||
QueryResult result = influxDbUtils.query(selectQuery.getCommand());
|
QueryResult result = influxDbUtils.query(selectQuery.getCommand());
|
||||||
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
||||||
List<PqsOnlinerateAggregate> re = influxDBResultMapper.toPOJO(result, PqsOnlinerateAggregate.class);
|
List<PqsOnlinerateAggregate> re = influxDBResultMapper.toPOJO(result, PqsOnlinerateAggregate.class);
|
||||||
Assert.assertTrue(re.size() > 0);
|
Assert.assertTrue(re.size() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Clause> getClauses() {
|
private List<Clause> getClauses() {
|
||||||
Clause c1 = eq("line_id", "5e467a40023b299070682eb21f2ec9a1");
|
Clause c1 = eq("line_id", "5e467a40023b299070682eb21f2ec9a1");
|
||||||
Clause c2 = eq("line_id", "183245996f303ebfd80eeb3377cecdc2");
|
Clause c2 = eq("line_id", "183245996f303ebfd80eeb3377cecdc2");
|
||||||
Clause c3 = eq("line_id", "0d46f54420246e999d5c68b3133f668c");
|
Clause c3 = eq("line_id", "0d46f54420246e999d5c68b3133f668c");
|
||||||
|
|
||||||
return Arrays.asList(c1, c2, c3);
|
return Arrays.asList(c1, c2, c3);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void whereAndNested(List<Clause> clauses, WhereQueryImpl<SelectQueryImpl> whereQuery) {
|
private void whereAndNested(List<Clause> clauses, WhereQueryImpl<SelectQueryImpl> whereQuery) {
|
||||||
WhereNested<WhereQueryImpl<SelectQueryImpl>> andNested = whereQuery.andNested();
|
WhereNested<WhereQueryImpl<SelectQueryImpl>> andNested = whereQuery.andNested();
|
||||||
for (Clause clause : clauses) {
|
for (Clause clause : clauses) {
|
||||||
@@ -119,5 +134,29 @@ public class EventBootApplicationTest {
|
|||||||
}
|
}
|
||||||
andNested.close();
|
andNested.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testHuaweiOBS() throws FileNotFoundException {
|
||||||
|
|
||||||
|
String cfgPath = OssPath.WAVE_DIR+"192.168.1.190/PQMonitor_PQM1_002438_20210508_092859_938.CFG";
|
||||||
|
String datPath = OssPath.WAVE_DIR+"192.168.1.190/PQMonitor_PQM1_002438_20210508_092859_938.DAT";
|
||||||
|
|
||||||
|
InputStream cfgStream =obsUtil.fileDownload(cfgPath);
|
||||||
|
InputStream datStream =obsUtil.fileDownload(datPath);
|
||||||
|
|
||||||
|
if(Objects.isNull(cfgStream) || Objects.isNull(datStream)){
|
||||||
|
throw new FileNotFoundException(EventResponseEnum.ANALYSEWAVE_NOT_FOUND.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取瞬时波形 //获取原始波形值
|
||||||
|
WaveDataDTO waveDataDTO = waveUtil.getComtrade(cfgStream,datStream, 1);
|
||||||
|
|
||||||
|
// 获取RMS波形
|
||||||
|
WaveDataDTO waveDataDTO1 = waveUtil.getValidData(waveDataDTO);
|
||||||
|
|
||||||
|
// 获取特征值
|
||||||
|
List<EigenvalueDTO> lstEigenvalueDTO = waveUtil.getEigenvalue(waveDataDTO, true);
|
||||||
|
System.out.println(1);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -97,6 +88,13 @@
|
|||||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!--华为obs工具包-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>common-oss</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -1,21 +1,18 @@
|
|||||||
package com.njcn.harmonic.controller.algorithm;
|
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.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
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.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.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;
|
||||||
@@ -25,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.*;
|
||||||
|
|
||||||
|
|
||||||
@@ -37,10 +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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 算法保存
|
* 算法保存
|
||||||
@@ -56,10 +52,10 @@ public class AlgorithmController extends BaseController {
|
|||||||
String methodDescribe = getMethodDescribe("getAlgorithmSave");
|
String methodDescribe = getMethodDescribe("getAlgorithmSave");
|
||||||
RStatFile rStatFile = BeanUtil.copyProperties(param, RStatFile.class);
|
RStatFile rStatFile = BeanUtil.copyProperties(param, RStatFile.class);
|
||||||
boolean b = rStatFileService.updateById(rStatFile);
|
boolean b = rStatFileService.updateById(rStatFile);
|
||||||
if(b){
|
if (b) {
|
||||||
// minIoUtils.removeObjects( minIoProperties.getBucket(),param.getAddress());
|
// minIoUtils.removeObjects( minIoProperties.getBucket(),param.getAddress());
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}else{
|
} else {
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -79,16 +75,10 @@ public class AlgorithmController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/common/upload")
|
@PostMapping("/common/upload")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public HttpResult<MinIoUploadResDTO> uploadFile(MultipartFile file)
|
public HttpResult<String> uploadFile(MultipartFile file) {
|
||||||
{
|
try {
|
||||||
try
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, fileStorageUtil.uploadMultipart(file,OssPath.ALGORITHM), null);
|
||||||
{
|
} catch (Exception e) {
|
||||||
//把名称存入数据
|
|
||||||
MinIoUploadResDTO upload = minIoUtils.upload(file, minIoProperties.getBucket(), "algorithm/");
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, upload, null);
|
|
||||||
}
|
|
||||||
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;
|
||||||
@@ -26,13 +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.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;
|
||||||
@@ -89,31 +88,22 @@ 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;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addCustomReportTemplate(ReportTemplateParam reportTemplateParam) {
|
public boolean addCustomReportTemplate(ReportTemplateParam reportTemplateParam) {
|
||||||
checkName(reportTemplateParam, false);
|
checkName(reportTemplateParam, false);
|
||||||
|
MultipartFile fileContent = reportTemplateParam.getFileContent();
|
||||||
|
String fileName = fileContent.getName();
|
||||||
//检验模板json数据规范
|
//检验模板json数据规范
|
||||||
try {
|
try {
|
||||||
String content = MultipartFileToString(reportTemplateParam.getFileContent());
|
String content = MultipartFileToString(fileContent);
|
||||||
new JSONArray(content);
|
new JSONArray(content);
|
||||||
} 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));
|
||||||
//文件上传到Minio服务器,存入文件名
|
|
||||||
MinIoUploadResDTO minIoUploadResDTO = contentToMinio(reportTemplateParam.getFileContent());
|
|
||||||
reportTemplateParam.setContent(minIoUploadResDTO.getMinFileName());
|
|
||||||
|
|
||||||
//新增模板表
|
//新增模板表
|
||||||
ExcelRptTemp excelRptTemp = new ExcelRptTemp();
|
ExcelRptTemp excelRptTemp = new ExcelRptTemp();
|
||||||
BeanUtils.copyProperties(reportTemplateParam, excelRptTemp);
|
BeanUtils.copyProperties(reportTemplateParam, excelRptTemp);
|
||||||
@@ -137,10 +127,10 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
@Override
|
@Override
|
||||||
public boolean updateCustomReportTemplate(ReportTemplateParam.UpdateReportTemplateParam reportTemplateParam) {
|
public boolean updateCustomReportTemplate(ReportTemplateParam.UpdateReportTemplateParam reportTemplateParam) {
|
||||||
checkName(reportTemplateParam, true);
|
checkName(reportTemplateParam, true);
|
||||||
|
MultipartFile fileContent = reportTemplateParam.getFileContent();
|
||||||
//检验模板json数据规范
|
//检验模板json数据规范
|
||||||
try {
|
try {
|
||||||
String content = MultipartFileToString(reportTemplateParam.getFileContent());
|
String content = MultipartFileToString(fileContent);
|
||||||
new JSONArray(content);
|
new JSONArray(content);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_JSON);
|
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_JSON);
|
||||||
@@ -148,12 +138,8 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
|
|
||||||
//删除之前的文件
|
//删除之前的文件
|
||||||
ExcelRptTemp excelRptTempOld = excelRptTempMapper.selectById(reportTemplateParam.getId());
|
ExcelRptTemp excelRptTempOld = excelRptTempMapper.selectById(reportTemplateParam.getId());
|
||||||
minIoUtils.removeObject(minIoProperties.getBucket(), excelRptTempOld.getContent());
|
fileStorageUtil.deleteFile(excelRptTempOld.getContent());
|
||||||
|
reportTemplateParam.setContent(fileStorageUtil.uploadMultipart(fileContent, OssPath.HARMONIC_EXCEL_TEMPLATE));
|
||||||
//文件上传到Minio服务器,存入文件名
|
|
||||||
MinIoUploadResDTO minIoUploadResDTO = contentToMinio(reportTemplateParam.getFileContent());
|
|
||||||
reportTemplateParam.setContent(minIoUploadResDTO.getMinFileName());
|
|
||||||
|
|
||||||
//修改模板数据
|
//修改模板数据
|
||||||
ExcelRptTemp excelRptTemp = new ExcelRptTemp();
|
ExcelRptTemp excelRptTemp = new ExcelRptTemp();
|
||||||
BeanUtils.copyProperties(reportTemplateParam, excelRptTemp);
|
BeanUtils.copyProperties(reportTemplateParam, excelRptTemp);
|
||||||
@@ -194,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;
|
||||||
}
|
}
|
||||||
@@ -240,10 +226,10 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
lambdaQuery.eq(ExcelRpt::getLineId, reportSearchParam.getLineId()).eq(ExcelRpt::getTempId, reportSearchParam.getTempId());
|
lambdaQuery.eq(ExcelRpt::getLineId, reportSearchParam.getLineId()).eq(ExcelRpt::getTempId, reportSearchParam.getTempId());
|
||||||
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
//拼接数据
|
//拼接数据
|
||||||
@@ -364,13 +350,13 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
/**
|
/**
|
||||||
* 解析报表数据
|
* 解析报表数据
|
||||||
*/
|
*/
|
||||||
private String analyzeReport(ReportSearchParam reportSearchParam,ExcelRptTemp excelRptTemp){
|
private String analyzeReport(ReportSearchParam reportSearchParam, ExcelRptTemp excelRptTemp) {
|
||||||
//根据content,获取v值并进行处理
|
//根据content,获取v值并进行处理
|
||||||
List<ReportTemplateDTO> reportTemplateDTOList = new ArrayList<>();
|
List<ReportTemplateDTO> reportTemplateDTOList = new ArrayList<>();
|
||||||
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;
|
||||||
@@ -394,7 +380,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
if (vItem.length == 4) {
|
if (vItem.length == 4) {
|
||||||
//$HA[_25]#B#max#classId$
|
//$HA[_25]#B#max#classId$
|
||||||
reportTemplateDTO.setTemplateName(vItem[0]);
|
reportTemplateDTO.setTemplateName(vItem[0]);
|
||||||
reportTemplateDTO.setPhase(vItem[1].substring(0,1));
|
reportTemplateDTO.setPhase(vItem[1].substring(0, 1));
|
||||||
reportTemplateDTO.setStatMethod(vItem[2].toUpperCase());
|
reportTemplateDTO.setStatMethod(vItem[2].toUpperCase());
|
||||||
reportTemplateDTO.setClassId(vItem[3]);
|
reportTemplateDTO.setClassId(vItem[3]);
|
||||||
} else if (vItem.length == 3) {
|
} else if (vItem.length == 3) {
|
||||||
@@ -462,11 +448,9 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//文件上传到Minio服务器,存入文件名
|
|
||||||
File newFile = stringToFile(jsonArray.toString());
|
File newFile = stringToFile(jsonArray.toString());
|
||||||
MultipartFile newMultipartFile = getMultipartFile(newFile);
|
MultipartFile newMultipartFile = getMultipartFile(newFile);
|
||||||
MinIoUploadResDTO minIoUploadResDTO = contentToMinio(newMultipartFile);
|
String newContent = fileStorageUtil.uploadMultipart(newMultipartFile, OssPath.HARMONIC_EXCEL_REPORT);
|
||||||
String newContent = minIoUploadResDTO.getMinFileName();
|
|
||||||
|
|
||||||
//存入报表库
|
//存入报表库
|
||||||
ExcelRpt excelRpt = new ExcelRpt();
|
ExcelRpt excelRpt = new ExcelRpt();
|
||||||
@@ -479,7 +463,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
//根据模板激活状态,判断是否进库(修改State字段:0未进库 1已进库)
|
//根据模板激活状态,判断是否进库(修改State字段:0未进库 1已进库)
|
||||||
if (DataStateEnum.ENABLE.getCode().equals(reportSearchParam.getActivation())) {
|
if (DataStateEnum.ENABLE.getCode().equals(reportSearchParam.getActivation())) {
|
||||||
excelRpt.setState(DataStateEnum.ENABLE.getCode());
|
excelRpt.setState(DataStateEnum.ENABLE.getCode());
|
||||||
}else{
|
} else {
|
||||||
excelRpt.setState(DataStateEnum.DELETED.getCode());
|
excelRpt.setState(DataStateEnum.DELETED.getCode());
|
||||||
}
|
}
|
||||||
excelRptMapper.insert(excelRpt);
|
excelRptMapper.insert(excelRpt);
|
||||||
@@ -496,9 +480,9 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
//sql拼接示例:select MAX(IHA2) as IHA2 from power_quality_data where Phase = 'A' and LineId='1324564568' and Stat_Method='max' tz('Asia/Shanghai')
|
//sql拼接示例:select MAX(IHA2) as IHA2 from power_quality_data where Phase = 'A' and LineId='1324564568' and Stat_Method='max' tz('Asia/Shanghai')
|
||||||
|
|
||||||
//cp95函数特殊处理 PERCENTILE(field_key, N)
|
//cp95函数特殊处理 PERCENTILE(field_key, N)
|
||||||
if (InfluxDBSqlConstant.CP95.equals(method)){
|
if (InfluxDBSqlConstant.CP95.equals(method)) {
|
||||||
sql.append(method).append(InfluxDBSqlConstant.LBK).append(data.getTemplateName()).append(InfluxDBSqlConstant.NUM_95).append(InfluxDBSqlConstant.RBK).append(InfluxDBSqlConstant.AS_VALUE);
|
sql.append(method).append(InfluxDBSqlConstant.LBK).append(data.getTemplateName()).append(InfluxDBSqlConstant.NUM_95).append(InfluxDBSqlConstant.RBK).append(InfluxDBSqlConstant.AS_VALUE);
|
||||||
}else{
|
} else {
|
||||||
sql.append(method).append(InfluxDBSqlConstant.LBK).append(data.getTemplateName()).append(InfluxDBSqlConstant.RBK).append(InfluxDBSqlConstant.AS_VALUE);
|
sql.append(method).append(InfluxDBSqlConstant.LBK).append(data.getTemplateName()).append(InfluxDBSqlConstant.RBK).append(InfluxDBSqlConstant.AS_VALUE);
|
||||||
}
|
}
|
||||||
sql.append(InfluxDBSqlConstant.FROM).append(data.getClassId()).append(InfluxDBSqlConstant.WHERE).append(InfluxDBTableConstant.LINE_ID).append(InfluxDBSqlConstant.EQ).append(InfluxDBSqlConstant.QM).append(reportSearchParam.getLineId()).append(InfluxDBSqlConstant.QM);
|
sql.append(InfluxDBSqlConstant.FROM).append(data.getClassId()).append(InfluxDBSqlConstant.WHERE).append(InfluxDBTableConstant.LINE_ID).append(InfluxDBSqlConstant.EQ).append(InfluxDBSqlConstant.QM).append(reportSearchParam.getLineId()).append(InfluxDBSqlConstant.QM);
|
||||||
@@ -508,7 +492,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//data_flicker、data_fluc、data_plt 无 value_type
|
//data_flicker、data_fluc、data_plt 无 value_type
|
||||||
if (!InfluxDBTableConstant.DATA_FLICKER.equals(data.getClassId()) && !InfluxDBTableConstant.DATA_FLUC.equals(data.getClassId()) && !InfluxDBTableConstant.DATA_PLT.equals(data.getClassId())){
|
if (!InfluxDBTableConstant.DATA_FLICKER.equals(data.getClassId()) && !InfluxDBTableConstant.DATA_FLUC.equals(data.getClassId()) && !InfluxDBTableConstant.DATA_PLT.equals(data.getClassId())) {
|
||||||
sql.append(InfluxDBSqlConstant.AND).append(InfluxDBTableConstant.VALUE_TYPE).append(InfluxDBSqlConstant.EQ).append(InfluxDBSqlConstant.QM).append(data.getStatMethod()).append(InfluxDBSqlConstant.QM);
|
sql.append(InfluxDBSqlConstant.AND).append(InfluxDBTableConstant.VALUE_TYPE).append(InfluxDBSqlConstant.EQ).append(InfluxDBSqlConstant.QM).append(data.getStatMethod()).append(InfluxDBSqlConstant.QM);
|
||||||
}
|
}
|
||||||
sql.append(InfluxDBSqlConstant.TZ);
|
sql.append(InfluxDBSqlConstant.TZ);
|
||||||
@@ -520,7 +504,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
List<QueryResult.Result> results = queryResult.getResults();
|
List<QueryResult.Result> results = queryResult.getResults();
|
||||||
if (results.size() != 0) {
|
if (results.size() != 0) {
|
||||||
QueryResult.Result result = results.get(0);
|
QueryResult.Result result = results.get(0);
|
||||||
if (result.getSeries() != null){
|
if (result.getSeries() != null) {
|
||||||
List<QueryResult.Series> seriess = result.getSeries();
|
List<QueryResult.Series> seriess = result.getSeries();
|
||||||
if (seriess.size() != 0) {
|
if (seriess.size() != 0) {
|
||||||
QueryResult.Series series = seriess.get(0);
|
QueryResult.Series series = seriess.get(0);
|
||||||
@@ -539,21 +523,6 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
endList.add(data);
|
endList.add(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传文件到Minio
|
|
||||||
*
|
|
||||||
* @param file 文件
|
|
||||||
* @return 成功标记
|
|
||||||
*/
|
|
||||||
private MinIoUploadResDTO contentToMinio(MultipartFile file) {
|
|
||||||
try {
|
|
||||||
//把名称存入数据
|
|
||||||
MinIoUploadResDTO upload = minIoUtils.upload(file, minIoProperties.getBucket(), "report/");
|
|
||||||
return upload;
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_FILE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件Url 转 String
|
* 文件Url 转 String
|
||||||
@@ -566,7 +535,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
|
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
String line = " ";
|
String line = " ";
|
||||||
while ((line = in.readLine()) != null){
|
while ((line = in.readLine()) != null) {
|
||||||
buffer.append(line);
|
buffer.append(line);
|
||||||
}
|
}
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
@@ -575,7 +544,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
/**
|
/**
|
||||||
* 字符串写入指定文件
|
* 字符串写入指定文件
|
||||||
*
|
*
|
||||||
* @param res 原字符串
|
* @param res 原字符串
|
||||||
* @return 成功标记
|
* @return 成功标记
|
||||||
*/
|
*/
|
||||||
public File stringToFile(String res) {
|
public File stringToFile(String res) {
|
||||||
@@ -584,7 +553,9 @@ 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()) distFile.getParentFile().mkdirs();
|
if (!distFile.getParentFile().exists()) {
|
||||||
|
distFile.getParentFile().mkdirs();
|
||||||
|
}
|
||||||
bufferedReader = new BufferedReader(new StringReader(res));
|
bufferedReader = new BufferedReader(new StringReader(res));
|
||||||
bufferedWriter = new BufferedWriter(new FileWriter(distFile));
|
bufferedWriter = new BufferedWriter(new FileWriter(distFile));
|
||||||
bufferedWriter.write("");
|
bufferedWriter.write("");
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class Test1 extends BaseJunitTest{
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMethod(){
|
public void testMethod(){
|
||||||
InfluxDbUtils influxDBUtil = new InfluxDbUtils(influxDbConfig.getUserName(), influxDbConfig.getPassword(), influxDbConfig.getInfluxDBUrl(), influxDbConfig.getDatabase(), "");
|
InfluxDbUtils influxDBUtil = new InfluxDbUtils(influxDbConfig.getUser(), influxDbConfig.getPassword(), influxDbConfig.getUrl(), influxDbConfig.getDatabase(), "");
|
||||||
SelectQueryImpl selectQuery = select().from(influxDbConfig.getDatabase(),"data_flicker").where(eq("fluc",0)).limit(1).tz("Asia/Shanghai");
|
SelectQueryImpl selectQuery = select().from(influxDbConfig.getDatabase(),"data_flicker").where(eq("fluc",0)).limit(1).tz("Asia/Shanghai");
|
||||||
WhereQueryImpl<SelectQueryImpl> where = selectQuery.where();
|
WhereQueryImpl<SelectQueryImpl> where = selectQuery.where();
|
||||||
QueryResult queryResult = influxDBUtil.query(selectQuery.getCommand());
|
QueryResult queryResult = influxDBUtil.query(selectQuery.getCommand());
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -114,6 +105,12 @@
|
|||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--华为obs工具包-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>common-oss</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -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.*;
|
||||||
@@ -45,6 +44,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 电能质量问题实现类
|
* 电能质量问题实现类
|
||||||
|
*
|
||||||
* @author xiaoyao
|
* @author xiaoyao
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @createTime 2022/11/14 11:03
|
* @createTime 2022/11/14 11:03
|
||||||
@@ -72,19 +72,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);
|
||||||
@@ -98,16 +94,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");
|
||||||
@@ -116,9 +112,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,11 +124,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);
|
||||||
@@ -144,12 +140,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);
|
||||||
@@ -161,12 +157,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);
|
||||||
@@ -178,12 +174,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);
|
||||||
@@ -198,26 +194,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);
|
||||||
@@ -229,49 +225,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;
|
||||||
@@ -283,14 +279,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,16 +296,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,22 +315,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;
|
||||||
@@ -346,22 +342,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;
|
||||||
@@ -370,8 +366,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;
|
||||||
}
|
}
|
||||||
@@ -379,8 +375,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;
|
||||||
}
|
}
|
||||||
@@ -393,31 +389,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -428,26 +424,26 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
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());
|
||||||
@@ -456,8 +452,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -469,13 +465,13 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -484,30 +480,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;
|
||||||
@@ -520,27 +512,27 @@ public class IssuesServiceImpl implements IssuesService {
|
|||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
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);
|
||||||
}
|
}
|
||||||
@@ -559,17 +551,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -586,62 +576,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,11 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
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.pojo.exception.BusinessException;
|
import com.njcn.common.config.GeneralInfo;
|
||||||
|
import com.njcn.oss.constant.OssPath;
|
||||||
import com.njcn.device.pms.api.DistributionMonitorClient;
|
import com.njcn.device.pms.api.DistributionMonitorClient;
|
||||||
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.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;
|
||||||
@@ -59,18 +57,20 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService
|
|||||||
private final DeptFeignClient deptFeignClient;
|
private final DeptFeignClient deptFeignClient;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MinIoUtils minIoUtils;
|
private GeneralInfo generalInfo;
|
||||||
|
|
||||||
|
private final FileStorageUtil fileStorageUtil;
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private MinIoProperties minIoProperties;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 干扰源用户分页查询
|
* 干扰源用户分页查询
|
||||||
|
*
|
||||||
* @param loadTypeUserSearchParam
|
* @param loadTypeUserSearchParam
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Page<RLoadTypeUserManageVO> getLoadTypeUserList(LoadTypeUserSearchParam loadTypeUserSearchParam){
|
public Page<RLoadTypeUserManageVO> getLoadTypeUserList(LoadTypeUserSearchParam loadTypeUserSearchParam) {
|
||||||
Page<RLoadTypeUserManageVO> page = new Page<>(loadTypeUserSearchParam.getPageNum(), loadTypeUserSearchParam.getPageSize());
|
Page<RLoadTypeUserManageVO> page = new Page<>(loadTypeUserSearchParam.getPageNum(), loadTypeUserSearchParam.getPageSize());
|
||||||
Page<RLoadTypeUserManageVO> loadTypeUserPage = loadTypeUserManageMapper.getLoadTypeUserPage(page, loadTypeUserSearchParam);
|
Page<RLoadTypeUserManageVO> loadTypeUserPage = loadTypeUserManageMapper.getLoadTypeUserPage(page, loadTypeUserSearchParam);
|
||||||
|
|
||||||
@@ -91,6 +91,7 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据id查询干扰源用户
|
* 根据id查询干扰源用户
|
||||||
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -100,12 +101,12 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService
|
|||||||
RLoadTypeUserManageVO rLoadTypeUserManageVO = new RLoadTypeUserManageVO();
|
RLoadTypeUserManageVO rLoadTypeUserManageVO = new RLoadTypeUserManageVO();
|
||||||
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;
|
||||||
@@ -113,6 +114,7 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增干扰源用户
|
* 新增干扰源用户
|
||||||
|
*
|
||||||
* @param loadTypeUserParam
|
* @param loadTypeUserParam
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -131,6 +133,7 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传干扰源用户入网报告
|
* 上传干扰源用户入网报告
|
||||||
|
*
|
||||||
* @param loadTypeUserIUploadParam
|
* @param loadTypeUserIUploadParam
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -140,19 +143,18 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService
|
|||||||
|
|
||||||
RLoadTypeUserManage rLoadTypeUserManage = new RLoadTypeUserManage();
|
RLoadTypeUserManage rLoadTypeUserManage = new RLoadTypeUserManage();
|
||||||
BeanUtils.copyProperties(loadTypeUserIUploadParam, rLoadTypeUserManage);
|
BeanUtils.copyProperties(loadTypeUserIUploadParam, rLoadTypeUserManage);
|
||||||
|
MultipartFile multipartFile = loadTypeUserIUploadParam.getFile();
|
||||||
//文件上传到Minio服务器,存入文件名
|
//文件上传到Minio服务器,存入文件名
|
||||||
if(loadTypeUserIUploadParam.getFile() != null){
|
if (Objects.nonNull(multipartFile)) {
|
||||||
MinIoUploadResDTO minIoUploadResDTO = fileToMinio(loadTypeUserIUploadParam.getFile());
|
rLoadTypeUserManage.setIFilePath(fileStorageUtil.uploadMultipart(multipartFile,OssPath.LOAD_TYPE_USER));
|
||||||
rLoadTypeUserManage.setIFilePath(minIoUploadResDTO.getMinFileName());
|
|
||||||
rLoadTypeUserManage.setIUploadTime(new Date());
|
rLoadTypeUserManage.setIUploadTime(new Date());
|
||||||
}
|
}
|
||||||
|
|
||||||
//提交:待审核/保存:新建
|
//提交:待审核/保存:新建
|
||||||
DictData dictData;
|
DictData dictData;
|
||||||
if(Objects.equals(Param.LOAD_TYPE_USER_SUBMIT,loadTypeUserIUploadParam.getStatus())){
|
if (Objects.equals(Param.LOAD_TYPE_USER_SUBMIT, loadTypeUserIUploadParam.getStatus())) {
|
||||||
dictData = dicDataFeignClient.getDicDataByCode(DicDataEnum.AUDIT.getCode()).getData();
|
dictData = dicDataFeignClient.getDicDataByCode(DicDataEnum.AUDIT.getCode()).getData();
|
||||||
}else{
|
} else {
|
||||||
dictData = dicDataFeignClient.getDicDataByCode(DicDataEnum.NEWLY.getCode()).getData();
|
dictData = dicDataFeignClient.getDicDataByCode(DicDataEnum.NEWLY.getCode()).getData();
|
||||||
}
|
}
|
||||||
rLoadTypeUserManage.setIStatus(dictData.getId());
|
rLoadTypeUserManage.setIStatus(dictData.getId());
|
||||||
@@ -164,6 +166,7 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 关联营销用户
|
* 关联营销用户
|
||||||
|
*
|
||||||
* @param
|
* @param
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -179,13 +182,14 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有干扰源用户(与营销系统关联)
|
* 查询所有干扰源用户(与营销系统关联)
|
||||||
|
*
|
||||||
* @param loadTypeUserSearchParam
|
* @param loadTypeUserSearchParam
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Page<RLoadTypeUserManageVO> getLoadTypeRelationList(LoadTypeUserSearchParam loadTypeUserSearchParam) {
|
public Page<RLoadTypeUserManageVO> getLoadTypeRelationList(LoadTypeUserSearchParam loadTypeUserSearchParam) {
|
||||||
Page<RLoadTypeUserManageVO> page = new Page<>(loadTypeUserSearchParam.getPageNum(), loadTypeUserSearchParam.getPageSize());
|
Page<RLoadTypeUserManageVO> page = new Page<>(loadTypeUserSearchParam.getPageNum(), loadTypeUserSearchParam.getPageSize());
|
||||||
Page<RLoadTypeUserManageVO> loadTypeUserPage = loadTypeUserManageMapper.getLoadTypeRelationPage(page,loadTypeUserSearchParam);
|
Page<RLoadTypeUserManageVO> loadTypeUserPage = loadTypeUserManageMapper.getLoadTypeRelationPage(page, loadTypeUserSearchParam);
|
||||||
|
|
||||||
//部门处理:根据部门code取名称
|
//部门处理:根据部门code取名称
|
||||||
List<RLoadTypeUserManageVO> list = loadTypeUserPage.getRecords();
|
List<RLoadTypeUserManageVO> list = loadTypeUserPage.getRecords();
|
||||||
@@ -202,24 +206,11 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService
|
|||||||
return loadTypeUserPage.setRecords(resultList);
|
return loadTypeUserPage.setRecords(resultList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传文件到Minio
|
|
||||||
*
|
|
||||||
* @param file 文件
|
|
||||||
* @return 成功标记
|
|
||||||
*/
|
|
||||||
private MinIoUploadResDTO fileToMinio(MultipartFile file) {
|
|
||||||
try {
|
|
||||||
//把名称存入数据
|
|
||||||
MinIoUploadResDTO upload = minIoUtils.upload(file, minIoProperties.getBucket(), "loadTypeUser/");
|
|
||||||
return upload;
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new BusinessException(ProcessResponseEnum.UPLOAD_FILE_ERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传干扰源用户入网报告
|
* 上传干扰源用户入网报告
|
||||||
|
*
|
||||||
* @param loadTypeUserAUploadParam
|
* @param loadTypeUserAUploadParam
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -229,19 +220,18 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService
|
|||||||
|
|
||||||
RLoadTypeUserManage rLoadTypeUserManage = new RLoadTypeUserManage();
|
RLoadTypeUserManage rLoadTypeUserManage = new RLoadTypeUserManage();
|
||||||
BeanUtils.copyProperties(loadTypeUserAUploadParam, rLoadTypeUserManage);
|
BeanUtils.copyProperties(loadTypeUserAUploadParam, rLoadTypeUserManage);
|
||||||
|
MultipartFile multipartFile = loadTypeUserAUploadParam.getFile();
|
||||||
//文件上传到Minio服务器,存入文件名
|
//文件上传到文件服务器,存入文件名
|
||||||
if(loadTypeUserAUploadParam.getFile() != null){
|
if (Objects.nonNull(multipartFile)) {
|
||||||
MinIoUploadResDTO minIoUploadResDTO = fileToMinio(loadTypeUserAUploadParam.getFile());
|
rLoadTypeUserManage.setAFilePath(fileStorageUtil.uploadMultipart(multipartFile,OssPath.LOAD_TYPE_USER));
|
||||||
rLoadTypeUserManage.setAFilePath(minIoUploadResDTO.getMinFileName());
|
|
||||||
rLoadTypeUserManage.setAUploadTime(new Date());
|
rLoadTypeUserManage.setAUploadTime(new Date());
|
||||||
}
|
}
|
||||||
|
|
||||||
//提交:待审核/保存:新建
|
//提交:待审核/保存:新建
|
||||||
DictData dictData;
|
DictData dictData;
|
||||||
if(Objects.equals(Param.LOAD_TYPE_USER_SUBMIT,loadTypeUserAUploadParam.getStatus())){
|
if (Objects.equals(Param.LOAD_TYPE_USER_SUBMIT, loadTypeUserAUploadParam.getStatus())) {
|
||||||
dictData = dicDataFeignClient.getDicDataByCode(DicDataEnum.AUDIT.getCode()).getData();
|
dictData = dicDataFeignClient.getDicDataByCode(DicDataEnum.AUDIT.getCode()).getData();
|
||||||
}else{
|
} else {
|
||||||
dictData = dicDataFeignClient.getDicDataByCode(DicDataEnum.NEWLY.getCode()).getData();
|
dictData = dicDataFeignClient.getDicDataByCode(DicDataEnum.NEWLY.getCode()).getData();
|
||||||
}
|
}
|
||||||
rLoadTypeUserManage.setAStatus(dictData.getId());
|
rLoadTypeUserManage.setAStatus(dictData.getId());
|
||||||
@@ -252,13 +242,14 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出未建档干扰源用户管理信息
|
* 导出未建档干扰源用户管理信息
|
||||||
|
*
|
||||||
* @param list
|
* @param list
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<LoadTypeUserExcel> exportLoadTypeUserList(List<String> list) {
|
public List<LoadTypeUserExcel> exportLoadTypeUserList(List<String> list) {
|
||||||
//数据处理
|
//数据处理
|
||||||
LambdaQueryWrapper<RLoadTypeUserManage> queryWrapper = new LambdaQueryWrapper<> ();
|
LambdaQueryWrapper<RLoadTypeUserManage> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.in(RLoadTypeUserManage::getId, list);
|
queryWrapper.in(RLoadTypeUserManage::getId, list);
|
||||||
List<RLoadTypeUserManage> rLoadTypeUserManages = loadTypeUserManageMapper.selectList(queryWrapper);
|
List<RLoadTypeUserManage> rLoadTypeUserManages = loadTypeUserManageMapper.selectList(queryWrapper);
|
||||||
//1、部门数据
|
//1、部门数据
|
||||||
@@ -275,25 +266,25 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService
|
|||||||
|
|
||||||
List<LoadTypeUserExcel> resultList = rLoadTypeUserManages.stream().map(item -> {
|
List<LoadTypeUserExcel> resultList = rLoadTypeUserManages.stream().map(item -> {
|
||||||
LoadTypeUserExcel loadTypeUserExcel = new LoadTypeUserExcel();
|
LoadTypeUserExcel loadTypeUserExcel = new LoadTypeUserExcel();
|
||||||
if (item.getUserName() != null){
|
if (item.getUserName() != null) {
|
||||||
loadTypeUserExcel.setUserName(item.getUserName());
|
loadTypeUserExcel.setUserName(item.getUserName());
|
||||||
}
|
}
|
||||||
if (item.getRecordTime() != null){
|
if (item.getRecordTime() != null) {
|
||||||
loadTypeUserExcel.setRecordTime(item.getRecordTime());
|
loadTypeUserExcel.setRecordTime(item.getRecordTime());
|
||||||
}
|
}
|
||||||
if (item.getAIsFileUpload() != null){
|
if (item.getAIsFileUpload() != null) {
|
||||||
loadTypeUserExcel.setIIsFileUpload(item.getIIsFileUpload() == 0 ? "否" : "是"); //实测报告是否上传
|
loadTypeUserExcel.setIIsFileUpload(item.getIIsFileUpload() == 0 ? "否" : "是"); //实测报告是否上传
|
||||||
}
|
}
|
||||||
if (item.getOrgNo() != null){
|
if (item.getOrgNo() != null) {
|
||||||
loadTypeUserExcel.setOrgName(pvTerminalTreeVOMap.get(item.getOrgNo()).getName()); //单位
|
loadTypeUserExcel.setOrgName(pvTerminalTreeVOMap.get(item.getOrgNo()).getName()); //单位
|
||||||
}
|
}
|
||||||
if (item.getLoadType() != null){
|
if (item.getLoadType() != null) {
|
||||||
loadTypeUserExcel.setLoadTypeName(loadTypeMap.get(item.getLoadType()).getName()); //入网报告状态
|
loadTypeUserExcel.setLoadTypeName(loadTypeMap.get(item.getLoadType()).getName()); //入网报告状态
|
||||||
}
|
}
|
||||||
if (item.getIStatus() != null){
|
if (item.getIStatus() != null) {
|
||||||
loadTypeUserExcel.setIStatusName(iStatusMap.get(item.getIStatus()).getName()); //入网报告状态
|
loadTypeUserExcel.setIStatusName(iStatusMap.get(item.getIStatus()).getName()); //入网报告状态
|
||||||
}
|
}
|
||||||
if (item.getAIsFileUpload() != null){
|
if (item.getAIsFileUpload() != null) {
|
||||||
loadTypeUserExcel.setIIsFileUpload(item.getIIsFileUpload() == 0 ? "否" : "是"); //实测报告是否上传
|
loadTypeUserExcel.setIIsFileUpload(item.getIIsFileUpload() == 0 ? "否" : "是"); //实测报告是否上传
|
||||||
}
|
}
|
||||||
return loadTypeUserExcel;
|
return loadTypeUserExcel;
|
||||||
@@ -304,13 +295,14 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出干扰源用户常态化管理信息
|
* 导出干扰源用户常态化管理信息
|
||||||
|
*
|
||||||
* @param list
|
* @param list
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<LoadTypeRelationExcel> exportLoadTypeRelationList(List<String> list) {
|
public List<LoadTypeRelationExcel> exportLoadTypeRelationList(List<String> list) {
|
||||||
//数据处理
|
//数据处理
|
||||||
LambdaQueryWrapper<RLoadTypeUserManage> queryWrapper = new LambdaQueryWrapper<> ();
|
LambdaQueryWrapper<RLoadTypeUserManage> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.in(RLoadTypeUserManage::getId, list);
|
queryWrapper.in(RLoadTypeUserManage::getId, list);
|
||||||
List<RLoadTypeUserManage> rLoadTypeUserManages = loadTypeUserManageMapper.selectList(queryWrapper);
|
List<RLoadTypeUserManage> rLoadTypeUserManages = loadTypeUserManageMapper.selectList(queryWrapper);
|
||||||
//1、部门数据
|
//1、部门数据
|
||||||
@@ -327,19 +319,19 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService
|
|||||||
|
|
||||||
List<LoadTypeRelationExcel> resultList = rLoadTypeUserManages.stream().map(item -> {
|
List<LoadTypeRelationExcel> resultList = rLoadTypeUserManages.stream().map(item -> {
|
||||||
LoadTypeRelationExcel loadTypeRelationExcel = new LoadTypeRelationExcel();
|
LoadTypeRelationExcel loadTypeRelationExcel = new LoadTypeRelationExcel();
|
||||||
if (item.getOrgNo() != null){
|
if (item.getOrgNo() != null) {
|
||||||
loadTypeRelationExcel.setOrgName(pvTerminalTreeVOMap.get(item.getOrgNo()).getName());
|
loadTypeRelationExcel.setOrgName(pvTerminalTreeVOMap.get(item.getOrgNo()).getName());
|
||||||
}
|
}
|
||||||
if (item.getLoadType() != null){
|
if (item.getLoadType() != null) {
|
||||||
loadTypeRelationExcel.setLoadTypeName(loadTypeMap.get(item.getLoadType()).getName());
|
loadTypeRelationExcel.setLoadTypeName(loadTypeMap.get(item.getLoadType()).getName());
|
||||||
}
|
}
|
||||||
if (item.getUserName() != null){
|
if (item.getUserName() != null) {
|
||||||
loadTypeRelationExcel.setUserName(item.getUserName());
|
loadTypeRelationExcel.setUserName(item.getUserName());
|
||||||
}
|
}
|
||||||
if (item.getRelationUserName() != null){
|
if (item.getRelationUserName() != null) {
|
||||||
loadTypeRelationExcel.setRelationUserName(item.getRelationUserName());
|
loadTypeRelationExcel.setRelationUserName(item.getRelationUserName());
|
||||||
}
|
}
|
||||||
if (item.getAStatus() != null){
|
if (item.getAStatus() != null) {
|
||||||
loadTypeRelationExcel.setAStatusName(aStatusMap.get(item.getIStatus()).getName());
|
loadTypeRelationExcel.setAStatusName(aStatusMap.get(item.getIStatus()).getName());
|
||||||
}
|
}
|
||||||
return loadTypeRelationExcel;
|
return loadTypeRelationExcel;
|
||||||
@@ -360,17 +352,17 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService
|
|||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
public Boolean checkLoadTypeUserI(LoadTypeUserCheckParam loadTypeUserCheckParam) {
|
public Boolean checkLoadTypeUserI(LoadTypeUserCheckParam loadTypeUserCheckParam) {
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
UpdateWrapper<RLoadTypeUserManage> updateWrapper = new UpdateWrapper ();
|
UpdateWrapper<RLoadTypeUserManage> updateWrapper = new UpdateWrapper();
|
||||||
updateWrapper.eq ("id", loadTypeUserCheckParam.getId ());
|
updateWrapper.eq("id", loadTypeUserCheckParam.getId());
|
||||||
updateWrapper.set ("i_check_comment", loadTypeUserCheckParam.getCheckComment ());
|
updateWrapper.set("i_check_comment", loadTypeUserCheckParam.getCheckComment());
|
||||||
updateWrapper.set ("i_check_person",loadTypeUserCheckParam.getCheckPerson ());
|
updateWrapper.set("i_check_person", loadTypeUserCheckParam.getCheckPerson());
|
||||||
|
|
||||||
DictData fail = dicDataFeignClient.getDicDataByCode (DicDataEnum.FAIL.getCode ( )).getData ( );
|
DictData fail = dicDataFeignClient.getDicDataByCode(DicDataEnum.FAIL.getCode()).getData();
|
||||||
DictData finish = dicDataFeignClient.getDicDataByCode(DicDataEnum.SUCCESS.getCode()).getData();
|
DictData finish = dicDataFeignClient.getDicDataByCode(DicDataEnum.SUCCESS.getCode()).getData();
|
||||||
|
|
||||||
updateWrapper.set ("i_status", Objects.equals ("1", loadTypeUserCheckParam.getCheckResult ())?finish.getId ():fail.getId ());
|
updateWrapper.set("i_status", Objects.equals("1", loadTypeUserCheckParam.getCheckResult()) ? finish.getId() : fail.getId());
|
||||||
int i= loadTypeUserManageMapper.update (null,updateWrapper);
|
int i = loadTypeUserManageMapper.update(null, updateWrapper);
|
||||||
result = i==1;
|
result = i == 1;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -386,17 +378,17 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService
|
|||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
public Boolean checkLoadTypeUserA(LoadTypeUserCheckParam loadTypeUserCheckParam) {
|
public Boolean checkLoadTypeUserA(LoadTypeUserCheckParam loadTypeUserCheckParam) {
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
UpdateWrapper<RLoadTypeUserManage> updateWrapper = new UpdateWrapper ();
|
UpdateWrapper<RLoadTypeUserManage> updateWrapper = new UpdateWrapper();
|
||||||
updateWrapper.eq ("id", loadTypeUserCheckParam.getId ());
|
updateWrapper.eq("id", loadTypeUserCheckParam.getId());
|
||||||
updateWrapper.set ("a_check_comment", loadTypeUserCheckParam.getCheckComment ());
|
updateWrapper.set("a_check_comment", loadTypeUserCheckParam.getCheckComment());
|
||||||
updateWrapper.set ("a_check_person",loadTypeUserCheckParam.getCheckPerson ());
|
updateWrapper.set("a_check_person", loadTypeUserCheckParam.getCheckPerson());
|
||||||
|
|
||||||
DictData fail = dicDataFeignClient.getDicDataByCode (DicDataEnum.FAIL.getCode ( )).getData ( );
|
DictData fail = dicDataFeignClient.getDicDataByCode(DicDataEnum.FAIL.getCode()).getData();
|
||||||
DictData finish = dicDataFeignClient.getDicDataByCode(DicDataEnum.SUCCESS.getCode()).getData();
|
DictData finish = dicDataFeignClient.getDicDataByCode(DicDataEnum.SUCCESS.getCode()).getData();
|
||||||
|
|
||||||
updateWrapper.set ("a_status", Objects.equals ("1", loadTypeUserCheckParam.getCheckResult ())?finish.getId ():fail.getId ());
|
updateWrapper.set("a_status", Objects.equals("1", loadTypeUserCheckParam.getCheckResult()) ? finish.getId() : fail.getId());
|
||||||
int i= loadTypeUserManageMapper.update (null,updateWrapper);
|
int i = loadTypeUserManageMapper.update(null, updateWrapper);
|
||||||
result = i==1;
|
result = i == 1;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,34 +112,34 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
//部门处理:根据部门code取名称
|
//部门处理:根据部门code取名称
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,25 +196,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,20 +229,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,13 +255,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();
|
||||||
@@ -273,21 +269,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;
|
||||||
@@ -303,8 +299,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;
|
||||||
}
|
}
|
||||||
@@ -320,14 +316,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;
|
||||||
}
|
}
|
||||||
@@ -345,26 +341,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