Compare commits
244 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a1bd88ab8 | ||
|
|
169b701fa9 | ||
| 6a97015cd6 | |||
|
|
b2ab4ee825 | ||
|
|
cc85660043 | ||
|
|
4f7b444737 | ||
| e729485d25 | |||
| f701507fae | |||
| 149d017c49 | |||
| 11116929cc | |||
| e4049de260 | |||
| b4be12e30e | |||
| 1b169830f9 | |||
| 417b36c884 | |||
| d5c18198b9 | |||
| 4a38148d7a | |||
| ab68a98999 | |||
| d435398c64 | |||
| 1acba83ff2 | |||
| 43af977942 | |||
| f0ffb63cff | |||
| ac24724ee8 | |||
| 8f4949af80 | |||
| f1d0e7df42 | |||
| 265eeb7bdd | |||
|
|
78524de495 | ||
|
|
5125ef738a | ||
|
|
721aa81c36 | ||
|
|
eb54a13226 | ||
| 9bc072ec8b | |||
|
|
f380c51a89 | ||
|
|
386e4cb647 | ||
| 46f54685b1 | |||
|
|
55f04541bd | ||
|
|
840c48e136 | ||
| a122df4763 | |||
| f656c15dc5 | |||
| e47584a118 | |||
| 63617c92c0 | |||
| efc075b4a9 | |||
| 3e3165bed8 | |||
| ea70f0fc2c | |||
| 7e130e9eb0 | |||
| da3e897fc2 | |||
|
|
932ab2d6f5 | ||
|
|
f3223bd680 | ||
|
|
9bee2386bf | ||
|
|
3f56fa0de9 | ||
|
|
62db637bdd | ||
|
|
39c9d1f54e | ||
|
|
0c9a93f600 | ||
| fad2279980 | |||
| 99d8e89bec | |||
|
|
8a5fec58d1 | ||
| f603794110 | |||
| 7d727088c2 | |||
|
|
2a703a8c30 | ||
| 1ff860bda9 | |||
| fe756e0f87 | |||
| 373cd71b02 | |||
| 49a3afb505 | |||
|
|
c6475a862c | ||
| 3bf3c65575 | |||
| 7cfbb8fb53 | |||
|
|
dce85a5f4c | ||
| 9be058b9e9 | |||
| 6a3b848dc0 | |||
|
|
396fe59b94 | ||
| e7b4117167 | |||
| 8f57310625 | |||
|
|
401195fc7b | ||
| 1d5ceca9dc | |||
| f1ad74ea2d | |||
| 0b5a3f0a32 | |||
| 3377da4ae3 | |||
|
|
b3015c2dcb | ||
| 35f1b21474 | |||
| 92ffdb1931 | |||
|
|
5b4b756fc3 | ||
|
|
c6f767b3aa | ||
|
|
ca32a4e3c6 | ||
|
|
92ddbd34a8 | ||
| 2c9d17c0ff | |||
| d681bdedfe | |||
| a904650751 | |||
|
|
04ce3eb97d | ||
| 8fc1645b04 | |||
| 2e37cf5b21 | |||
| 42c1faa5dc | |||
| 2f84ace8f1 | |||
| 5cc21b6289 | |||
| a6acf6d1c9 | |||
| ff205cb335 | |||
| b675369f7d | |||
| 9b92c1df03 | |||
| 64d2fd46e2 | |||
| 3484902147 | |||
| 739b697137 | |||
|
|
c85df36f32 | ||
|
|
a87ac5a246 | ||
|
|
91b3f63b99 | ||
| 6cd45fd7f9 | |||
| a608b3850c | |||
| 7b6099e2dc | |||
| d642ed8e52 | |||
| 568f14da96 | |||
|
|
2c8c94746e | ||
|
|
0837e38c83 | ||
|
|
c343e5765c | ||
| b49ba0e06f | |||
|
|
84321ff192 | ||
| 89e38abc00 | |||
| 8229653fb0 | |||
| 5d80582e23 | |||
|
|
7bc9cb9792 | ||
| cd4016eb1c | |||
| d7e63ec2d5 | |||
| 35d05dd3ac | |||
|
|
fad0e10203 | ||
|
|
4e8a26b1fb | ||
|
|
7a877045c9 | ||
| 23ee3b1af2 | |||
|
|
a601af9479 | ||
|
|
d3f412e2cb | ||
| b659dd055f | |||
| 66530aa5aa | |||
| 541d2ab3fe | |||
| cac6b4bdbb | |||
| a225b039fe | |||
| 0fcd67bd38 | |||
|
|
8445a08a64 | ||
|
|
3c820b1645 | ||
| 3132b0a134 | |||
| 618f1314f6 | |||
| 474a368670 | |||
|
|
a6326f574d | ||
| 7c19a21d92 | |||
|
|
dfa95fd701 | ||
|
|
09190b164b | ||
|
|
146e0e4408 | ||
| 448f76d646 | |||
| 0eeedf8f35 | |||
|
|
054fa20bab | ||
| c80e2cd825 | |||
| b3f553c450 | |||
| ef35d9bdbe | |||
| b36f4400bf | |||
| ea5bb460b4 | |||
| c84e79b789 | |||
| b62eacdbd6 | |||
| 84f16b822e | |||
| 29c1f2a530 | |||
|
|
59522c66d9 | ||
| bd153dc7b9 | |||
| 5676c736a5 | |||
|
|
e38a653e3c | ||
| 1e5dbbba19 | |||
|
|
db40090b00 | ||
| 99b56bffac | |||
|
|
04ae4f1fc1 | ||
|
|
08c5e44755 | ||
|
|
f291c85e27 | ||
|
|
38b0f20ea9 | ||
| 275a07f790 | |||
| 3bb5f91c1a | |||
| ab0b6e96c6 | |||
| da814e4bdc | |||
| 33a0ddc6f9 | |||
| ae5ca42391 | |||
| 63680b9f8e | |||
|
|
d20dfd8a26 | ||
|
|
bc3a6f2fa2 | ||
| 20d3631efe | |||
| eda0237e8b | |||
|
|
98cf051fab | ||
| ae440613fb | |||
| 4a0e9e3343 | |||
| 33c0e58ab0 | |||
| a4c17a4ac1 | |||
| 64187da4fb | |||
| e6dc70e048 | |||
| 014ed7fbf7 | |||
| 014b7c30cb | |||
|
|
c99b235d8f | ||
|
|
1088491e02 | ||
| 7c3e8f29be | |||
|
|
4211105c8d | ||
| 89cb22b3ea | |||
| d00371ec8b | |||
|
|
13819454bb | ||
|
|
9ae23ad860 | ||
| 0441720fcd | |||
|
|
dcfcf3ece2 | ||
| 3280c29013 | |||
|
|
320a236582 | ||
| 31281cb346 | |||
|
|
692fe1b213 | ||
|
|
f29748786d | ||
| 989f4f440d | |||
| 35608ffc12 | |||
| 5bdd371d7b | |||
| f5b7852c6a | |||
| 88b44a821d | |||
| e3c147b41b | |||
| 24b4f08d2a | |||
| d5bdcc591c | |||
|
|
e523e139c0 | ||
|
|
bb5d1d3335 | ||
| c5b63acb27 | |||
|
|
78ba6903c6 | ||
|
|
7818bbe095 | ||
| dafd9dda22 | |||
| f9b8c6d28a | |||
| ba6762587f | |||
| 06493c07c3 | |||
| 0c87ebf825 | |||
|
|
183605e9d4 | ||
| f87255c2e8 | |||
|
|
acecfaf4bb | ||
|
|
270eee3c26 | ||
| e350040c5b | |||
| 3875d0764a | |||
|
|
8be5c88737 | ||
|
|
00c5f4c710 | ||
|
|
e250e5169b | ||
|
|
701aa3ef37 | ||
|
|
2c9f941cfa | ||
| 500fbbad9c | |||
| 75cf276ea9 | |||
| dbd7ef9b01 | |||
| b5f180af01 | |||
|
|
b6fdd89192 | ||
| b07ee843f0 | |||
| b45ba6f3b7 | |||
|
|
1ec3385f2d | ||
|
|
024bba337a | ||
| dda65ca041 | |||
|
|
bf67652055 | ||
| 7d508acd6c | |||
|
|
fb8ed6174c | ||
| a3772119b4 | |||
|
|
9f0a1ed19e | ||
|
|
8e6f07330e | ||
| 9fca0e5714 |
12
pom.xml
12
pom.xml
@@ -22,7 +22,7 @@
|
||||
<module>pqs-process</module>
|
||||
<module>pqs-bpm</module>
|
||||
<module>pqs-supervision</module>
|
||||
|
||||
<module>pqs-algorithm</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
<name>灿能微服务生态系统</name>
|
||||
@@ -43,7 +43,7 @@
|
||||
<!-- <middle.server.url>10.95.53.49</middle.server.url>-->
|
||||
<middle.server.url>192.168.1.22</middle.server.url>
|
||||
<!--微服务模块发布地址-->
|
||||
<service.server.url>192.168.1.127</service.server.url>
|
||||
<service.server.url>127.0.0.1</service.server.url>
|
||||
<!--docker仓库地址-->
|
||||
<docker.server.url>192.168.1.22</docker.server.url>
|
||||
<!--nacos的ip:port-->
|
||||
@@ -53,10 +53,10 @@
|
||||
<!--nacos的ip:port-->
|
||||
<nacos.password>nacos</nacos.password>
|
||||
<!--服务器发布内容为空-->
|
||||
<!-- <nacos.namespace></nacos.namespace>-->
|
||||
<!-- <nacos.namespace>1dd11af6-e668-41fd-a663-02a05705304d</nacos.namespace>-->
|
||||
<!-- <nacos.namespace>fd74182b-1fce-4dba-afa7-2623b0376205</nacos.namespace>-->
|
||||
<nacos.namespace>ddcae5af-ac35-4fc4-9804-962de94dfc61</nacos.namespace>
|
||||
<!-- <nacos.namespace></nacos.namespace>-->
|
||||
<!-- <nacos.namespace>30c701c4-2a94-49d9-82e1-76aa9456573f</nacos.namespace>-->
|
||||
<nacos.namespace>fd74182b-1fce-4dba-afa7-2623b0376205</nacos.namespace>
|
||||
<!-- <nacos.namespace>910d0d69-2254-481b-b9f7-7ecf9cb881b0</nacos.namespace>-->
|
||||
<!-- sentinel:port-->
|
||||
<sentinel.url>${middle.server.url}:8080</sentinel.url>
|
||||
<!--网关地址,主要用于配置swagger中认证token-->
|
||||
|
||||
@@ -9,6 +9,9 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.ADVANCE_BOOT,path = "/waveAnalysis",
|
||||
fallbackFactory = EventWaveAnalysisFeignClientFallbackFactory.class,
|
||||
contextId = "waveAnalysis" )
|
||||
@@ -16,9 +19,9 @@ public interface EventWaveAnalysisFeignClient {
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 波形高级分析
|
||||
* @param eventIndex
|
||||
* @return: com.njcn.common.pojo.response.HttpResult<com.njcn.advance.pojo.dto.waveAnalysis.EntityAdvancedData>
|
||||
* 波形高级分析
|
||||
* @param eventIndex 事件索引
|
||||
* @return com.njcn.common.pojo.response.HttpResult<com.njcn.advance.pojo.dto.waveAnalysis.EntityAdvancedData>
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/1 14:23
|
||||
*/
|
||||
|
||||
@@ -11,6 +11,9 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class EventWaveAnalysisFeignClientFallbackFactory implements FallbackFactory<EventWaveAnalysisFeignClient> {
|
||||
@@ -24,7 +27,6 @@ public class EventWaveAnalysisFeignClientFallbackFactory implements FallbackFact
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new EventWaveAnalysisFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<EntityAdvancedData> analysis(String eventIndex) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "波形高级分析", throwable.toString());
|
||||
|
||||
@@ -78,6 +78,8 @@ public enum AdvanceResponseEnum {
|
||||
MACHINE_HAS_UNIT("A0102","当前设备存在元器件"),
|
||||
|
||||
EVENT_TIME_ERROR("A0102","暂降事件时间格式有误,请检查"),
|
||||
|
||||
INVALID_FILE_TYPE("A0102","请选择CSV文件"),
|
||||
;
|
||||
|
||||
private final String code;
|
||||
|
||||
@@ -4,8 +4,6 @@ import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Description: 承载能力评估相关枚举
|
||||
* @Param:
|
||||
* @return:
|
||||
* @Author: clam
|
||||
* @Date: 2024/1/31
|
||||
*/
|
||||
|
||||
@@ -4,7 +4,6 @@ package com.njcn.advance.enums;
|
||||
* @Author: Sunwei 【sunW2016@163.com】
|
||||
* @Description: 高级分析返回结果
|
||||
* @Date: Create in 9:02 2018/3/6
|
||||
* @Modified By:
|
||||
*/
|
||||
public enum EnumEvt {
|
||||
EVT_NUM("evt_num", "高级算法返回事件个数"), EVT_BUF("evt_buf", "高级算法返回数据"), QVVR_TYPE("qvvr_type", "暂降类型"), POW_A("POW_a",
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.njcn.advance.pojo.carrycapacity.excel;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.converters.localdatetime.LocalDateTimeStringConverter;
|
||||
import com.njcn.advance.utils.EasyExcelUtil;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -18,7 +20,8 @@ import java.util.List;
|
||||
@Data
|
||||
public class CarryCapcityDataEexcel {
|
||||
|
||||
@ExcelProperty(index = 0,value = "时间",converter = LocalDateTimeStringConverter.class)
|
||||
@ExcelProperty(index = 0,value = "时间(格式为yyyy-MM-dd hh:mm:ss)",converter = LocalDateTimeStringConverter.class)
|
||||
@JSONField(format = "yyyy-MM-dd hh:mm:ss")
|
||||
private LocalDateTime time;
|
||||
|
||||
@ExcelProperty(index =1,value = {"电压","A"})
|
||||
@@ -266,17 +269,20 @@ public class CarryCapcityDataEexcel {
|
||||
private Double i25_c;
|
||||
|
||||
public static void main(String[] args) {
|
||||
List<CarryCapcityDataEexcel> objects = EasyExcelUtil.syncReadModel("C:\\Users\\无名\\Desktop\\11.xlsx", CarryCapcityDataEexcel.class, 0,3);
|
||||
System.out.println(objects);
|
||||
// List<CarryCapcityDataEexcel> objects = EasyExcelUtil.syncReadModel("C:\\Users\\无名\\Desktop\\11.xlsx", CarryCapcityDataEexcel.class, 0,3);
|
||||
// System.out.println(objects);
|
||||
|
||||
// String sheetName = "sheetName";
|
||||
// List<CarryCapcityDataEexcel> excels = new ArrayList<>();
|
||||
// CarryCapcityDataEexcel exportHeadersExcel = new CarryCapcityDataEexcel();
|
||||
// excels.add(exportHeadersExcel);
|
||||
//
|
||||
// EasyExcel.write("C:\\\\Users\\\\无名\\\\Desktop\\\\22.xlsx", CarryCapcityDataEexcel.class)
|
||||
// .sheet(sheetName)
|
||||
// .doWrite(excels);
|
||||
String sheetName = "sheetName";
|
||||
List<CarryCapcityDataEexcel> excels = new ArrayList<>();
|
||||
CarryCapcityDataEexcel exportHeadersExcel = new CarryCapcityDataEexcel();
|
||||
excels.add(exportHeadersExcel);
|
||||
|
||||
EasyExcel.write("C:\\\\Users\\\\无名\\\\Desktop\\\\22.xlsx", CarryCapcityDataEexcel.class)
|
||||
.sheet(sheetName)
|
||||
.doWrite(excels);
|
||||
EasyExcel.write("C:\\\\Users\\\\无名\\\\Desktop\\\\22.xlsx", CarryCapcityDataEexcel.class)
|
||||
.sheet("sheetName2")
|
||||
.doWrite(excels);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -331,7 +331,7 @@ public class CarryCapcityDataIEexcel {
|
||||
DataI dataI = new DataI();
|
||||
BeanUtils.copyProperties(carryCapcityDataIEexcel,dataI);
|
||||
dataI.setPhaseType(phase);
|
||||
dataI.setTime(carryCapcityDataIEexcel.getTime().plusSeconds(8*60*60));
|
||||
dataI.setTime(carryCapcityDataIEexcel.getTime());
|
||||
|
||||
if (phase.equals("A")) {
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public class CarryCapcityDataPEexcel {
|
||||
CarryCapcityData carryCapcityData = new CarryCapcityData();
|
||||
BeanUtils.copyProperties(carryCapcityDataPEexcel,carryCapcityData);
|
||||
carryCapcityData.setPhaseType(phase);
|
||||
carryCapcityData.setTime(carryCapcityDataPEexcel.getTime().plusSeconds(8*60*60));
|
||||
carryCapcityData.setTime(carryCapcityDataPEexcel.getTime());
|
||||
|
||||
if (phase.equals("A")) {
|
||||
carryCapcityData.setValue(carryCapcityDataPEexcel.getValue_a());
|
||||
|
||||
@@ -49,7 +49,7 @@ public class CarryCapcityDataQEexcel {
|
||||
CarryCapcityData carryCapcityData = new CarryCapcityData();
|
||||
BeanUtils.copyProperties(carryCapcityDataQEexcel,carryCapcityData);
|
||||
carryCapcityData.setPhaseType(phase);
|
||||
carryCapcityData.setTime(carryCapcityDataQEexcel.getTime().plusSeconds(8*60*60));
|
||||
carryCapcityData.setTime(carryCapcityDataQEexcel.getTime());
|
||||
|
||||
if (phase.equals("A")) {
|
||||
carryCapcityData.setValue(carryCapcityDataQEexcel.getValue_a());
|
||||
|
||||
@@ -48,7 +48,7 @@ public class CarryCapcityDataVEexcel {
|
||||
CarryCapcityData carryCapcityData = new CarryCapcityData();
|
||||
BeanUtils.copyProperties(carryCapcityDataVEexcel,carryCapcityData);
|
||||
carryCapcityData.setPhaseType(phase);
|
||||
carryCapcityData.setTime(carryCapcityDataVEexcel.getTime().plusSeconds(8*60*60));
|
||||
carryCapcityData.setTime(carryCapcityDataVEexcel.getTime());
|
||||
|
||||
if (phase.equals("A")) {
|
||||
carryCapcityData.setValue(carryCapcityDataVEexcel.getValue_a());
|
||||
|
||||
@@ -92,7 +92,7 @@ public class CarryCapacityResultPO extends BaseEntity {
|
||||
/**
|
||||
* 是否删除(0,无效,1有效)
|
||||
*/
|
||||
@TableField(value = "`status`")
|
||||
@TableField(value = "status")
|
||||
private Integer status;
|
||||
|
||||
@TableField(value = "evaluate_type")
|
||||
|
||||
@@ -31,7 +31,7 @@ public class CarryCapacityStrategyDhlPO extends BaseEntity {
|
||||
/**
|
||||
* 充电桩,电弧炉,电气化铁路
|
||||
*/
|
||||
@TableField(value = "`type`")
|
||||
@TableField(value = "type")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,7 +22,7 @@ public class CarryCapacityStrategyPO extends BaseEntity {
|
||||
/**
|
||||
* 总承载能力评估结果(1-安全,2-III级预警,3-II级预警,4-I 级预警)
|
||||
*/
|
||||
@TableField(value = "`result`")
|
||||
@TableField(value = "result")
|
||||
private Integer result;
|
||||
|
||||
/**
|
||||
@@ -40,7 +40,7 @@ public class CarryCapacityStrategyPO extends BaseEntity {
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@TableField(value = "`count`")
|
||||
@TableField(value = "count")
|
||||
private Integer count;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,36 +1,17 @@
|
||||
package com.njcn.advance.pojo.dto.relevent;
|
||||
|
||||
import com.njcn.advance.pojo.dto.SagEvent;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
|
||||
public class EntityGroupEvtData implements Cloneable,Comparable<EntityGroupEvtData> {
|
||||
|
||||
//逻辑节点序号
|
||||
private int node;
|
||||
//事件开始时间时标
|
||||
private int start_time;
|
||||
//类别
|
||||
private int cata;
|
||||
//标注类别
|
||||
private int cata2;
|
||||
//物理节点
|
||||
private String nodePhysics;
|
||||
|
||||
private int node;//逻辑节点序号
|
||||
private int start_time;//事件开始时间时标
|
||||
private int cata;//类别
|
||||
private int cata2;//标注类别
|
||||
private String nodePhysics; //物理节点
|
||||
private SagEvent sagEvent;
|
||||
|
||||
private String sagReason;
|
||||
|
||||
|
||||
public Object objClone() {
|
||||
try {
|
||||
return clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
return new EntityGroupEvtData(null, -1, -1, -1,null,null);
|
||||
}
|
||||
}
|
||||
|
||||
public EntityGroupEvtData(String nodePhysics, int start_time, int cata, int cata2, SagEvent sagEvent, String sagReason) {
|
||||
public EntityGroupEvtData(String nodePhysics, int start_time, int cata, int cata2,SagEvent sagEvent,String sagReason) {
|
||||
this.nodePhysics = nodePhysics;
|
||||
this.start_time = start_time;
|
||||
this.cata = cata;
|
||||
@@ -39,6 +20,144 @@ public class EntityGroupEvtData implements Cloneable,Comparable<EntityGroupEvtDa
|
||||
this.sagReason = sagReason;
|
||||
}
|
||||
|
||||
public SagEvent getSagEvent() {
|
||||
return sagEvent;
|
||||
}
|
||||
|
||||
public void setSagEvent(SagEvent sagEvent) {
|
||||
this.sagEvent = sagEvent;
|
||||
}
|
||||
|
||||
public String getNodePhysics() {
|
||||
return nodePhysics;
|
||||
}
|
||||
|
||||
public void setNodePhysics(String nodePhysics) {
|
||||
this.nodePhysics = nodePhysics;
|
||||
}
|
||||
|
||||
public int getNode() {
|
||||
return node;
|
||||
}
|
||||
|
||||
public void setNode(int node) {
|
||||
this.node = node;
|
||||
}
|
||||
|
||||
public int getStart_time() {
|
||||
return start_time;
|
||||
}
|
||||
|
||||
public void setStart_time(int start_time) {
|
||||
this.start_time = start_time;
|
||||
}
|
||||
|
||||
public int getCata() {
|
||||
return cata;
|
||||
}
|
||||
|
||||
public void setCata(int cata) {
|
||||
this.cata = cata;
|
||||
}
|
||||
|
||||
public int getCata2() {
|
||||
return cata2;
|
||||
}
|
||||
|
||||
public void setCata2(int cata2) {
|
||||
this.cata2 = cata2;
|
||||
}
|
||||
|
||||
public String getSagReason() {
|
||||
return sagReason;
|
||||
}
|
||||
|
||||
public void setSagReason(String sagReason) {
|
||||
this.sagReason = sagReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a copy of this object. The precise meaning
|
||||
* of "copy" may depend on the class of the object. The general
|
||||
* intent is that, for any object {@code x}, the expression:
|
||||
* <blockquote>
|
||||
* <pre>
|
||||
* x.clone() != x</pre></blockquote>
|
||||
* will be true, and that the expression:
|
||||
* <blockquote>
|
||||
* <pre>
|
||||
* x.clone().getClass() == x.getClass()</pre></blockquote>
|
||||
* will be {@code true}, but these are not absolute requirements.
|
||||
* While it is typically the case that:
|
||||
* <blockquote>
|
||||
* <pre>
|
||||
* x.clone().equals(x)</pre></blockquote>
|
||||
* will be {@code true}, this is not an absolute requirement.
|
||||
*
|
||||
* By convention, the returned object should be obtained by calling
|
||||
* {@code super.clone}. If a class and all of its superclasses (except
|
||||
* {@code Object}) obey this convention, it will be the case that
|
||||
* {@code x.clone().getClass() == x.getClass()}.
|
||||
*
|
||||
* By convention, the object returned by this method should be independent
|
||||
* of this object (which is being cloned). To achieve this independence,
|
||||
* it may be necessary to modify one or more fields of the object returned
|
||||
* by {@code super.clone} before returning it. Typically, this means
|
||||
* copying any mutable objects that comprise the internal "deep structure"
|
||||
* of the object being cloned and replacing the references to these
|
||||
* objects with references to the copies. If a class contains only
|
||||
* primitive fields or references to immutable objects, then it is usually
|
||||
* the case that no fields in the object returned by {@code super.clone}
|
||||
* need to be modified.
|
||||
*
|
||||
* The method {@code clone} for class {@code Object} performs a
|
||||
* specific cloning operation. First, if the class of this object does
|
||||
* not implement the interface {@code Cloneable}, then a
|
||||
* {@code CloneNotSupportedException} is thrown. Note that all arrays
|
||||
* are considered to implement the interface {@code Cloneable} and that
|
||||
* the return type of the {@code clone} method of an array type {@code T[]}
|
||||
* is {@code T[]} where T is any reference or primitive type.
|
||||
* Otherwise, this method creates a new instance of the class of this
|
||||
* object and initializes all its fields with exactly the contents of
|
||||
* the corresponding fields of this object, as if by assignment; the
|
||||
* contents of the fields are not themselves cloned. Thus, this method
|
||||
* performs a "shallow copy" of this object, not a "deep copy" operation.
|
||||
*
|
||||
* The class {@code Object} does not itself implement the interface
|
||||
* {@code Cloneable}, so calling the {@code clone} method on an object
|
||||
* whose class is {@code Object} will result in throwing an
|
||||
* exception at run time.
|
||||
*
|
||||
* @return a clone of this instance.
|
||||
* @throws CloneNotSupportedException if the object's class does not
|
||||
* support the {@code Cloneable} interface. Subclasses
|
||||
* that override the {@code clone} method can also
|
||||
* throw this exception to indicate that an instance cannot
|
||||
* be cloned.
|
||||
* @see Cloneable
|
||||
*/
|
||||
@Override
|
||||
protected Object clone() throws CloneNotSupportedException {
|
||||
return super.clone();
|
||||
}
|
||||
|
||||
public Object objClone() {
|
||||
try {
|
||||
return clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
return new EntityGroupEvtData("-1", -1, -1, -1,null,null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EntityGroupEvtData{" +
|
||||
"node=" + node +
|
||||
", start_time=" + start_time +
|
||||
", cata=" + cata +
|
||||
", cata2=" + cata2 +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(EntityGroupEvtData obj) {
|
||||
@@ -50,4 +169,4 @@ public class EntityGroupEvtData implements Cloneable,Comparable<EntityGroupEvtDa
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,9 @@ public class EntityLogic {
|
||||
//物理隔绝变压器策略GUID
|
||||
private String tPIndex;
|
||||
//变压器逻辑上节点
|
||||
private String node_h;
|
||||
private Integer node_h;
|
||||
//变压器逻辑下节点
|
||||
private String node_l;
|
||||
private Integer node_l;
|
||||
// 变压器连接方式
|
||||
private Integer type;
|
||||
//变压器物理上节点
|
||||
|
||||
@@ -16,10 +16,10 @@ public class EntityMtrans implements Serializable {
|
||||
public EntityMtrans() {
|
||||
super();
|
||||
Mtrans = new int[FinalData.NODE_NUM][FinalData.NODE_NUM];
|
||||
Matrixcata0 = new int[FinalData.EVT_TYPE_NUM][FinalData.NODE_NUM];
|
||||
Matrixcata1 = new int[FinalData.EVT_TYPE_NUM][FinalData.NODE_NUM];
|
||||
possiable_path = new int[FinalData.MAX_PATH_NUM][FinalData.NODE_NUM + 1];
|
||||
path_num = 0;
|
||||
Matrixcata0 = new int[FinalData.EVT_TYPE_NUM][FinalData.NODE_NUM];
|
||||
Matrixcata1 = new int[FinalData.EVT_TYPE_NUM][FinalData.NODE_NUM];
|
||||
possiable_path = new int[FinalData.MAX_PATH_NUM][FinalData.NODE_NUM + 1];
|
||||
path_num = 0;
|
||||
}
|
||||
|
||||
public int[][] getMatrixcata0() {
|
||||
@@ -69,3 +69,4 @@ public class EntityMtrans implements Serializable {
|
||||
+ Arrays.toString(possiable_path) + ", path_num=" + path_num + "]";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.njcn.advance.pojo.dto.relevent;
|
||||
|
||||
import com.njcn.advance.pojo.dto.SagEvent;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.advance.pojo.dto;
|
||||
package com.njcn.advance.pojo.dto.relevent;
|
||||
|
||||
import com.njcn.advance.pojo.dto.relevent.PlantInfo;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.io.Serializable;
|
||||
* @date 2023年07月21日 10:20
|
||||
*/
|
||||
@Data
|
||||
public class ResponsibilityCalculateParam implements Serializable {
|
||||
public class ResponsibilityCalculateParam implements Serializable {
|
||||
|
||||
|
||||
@ApiModelProperty("开始时间")
|
||||
@@ -40,11 +40,11 @@ public class ResponsibilityCalculateParam implements Serializable {
|
||||
@Min(0)
|
||||
@Max(1)
|
||||
@ApiModelProperty("0-电流 1-电压")
|
||||
private int type;
|
||||
private int type;
|
||||
|
||||
@Min(2)
|
||||
@Max(50)
|
||||
@ApiModelProperty("谐波次数")
|
||||
private Integer time;
|
||||
private Integer time;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.njcn.advance.utils;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.web.constant.ValidMessage;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/12/10 14:51【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public class CheckStringUtil {
|
||||
public static void checkName(String name) {
|
||||
Pattern pattern = Pattern.compile(PatternRegex.SPECIALCHARACTER);
|
||||
if(pattern.matcher(name).find()){
|
||||
throw new BusinessException(ValidMessage.NAME_SPECIAL_REGEX);
|
||||
}
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// checkName("100迈岭站2djvjva13ad");
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -376,4 +376,9 @@ public class EasyExcelUtil {
|
||||
|
||||
return new EasyExcelWriteTool(response.getOutputStream());
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
List<Map<Integer, String>> maps = EasyExcelUtil.syncRead("C:\\Users\\无名\\Desktop\\11.xlsx");
|
||||
System.out.println(maps);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.njcn.advance.utils;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
@Component
|
||||
public class InstantiateUtil<E> {
|
||||
private static final Logger logger= LoggerFactory.getLogger(InstantiateUtil.class);
|
||||
|
||||
|
||||
public byte[] instantiate(E e) {
|
||||
if (e == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
try {
|
||||
ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
|
||||
objectOutputStream.writeObject(e);
|
||||
objectOutputStream.close();
|
||||
return byteArrayOutputStream.toByteArray();
|
||||
|
||||
} catch (IOException e1) {
|
||||
logger.error("发生异常,"+e1.getMessage());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public <E> E deInstantiate(byte[] bytes) {
|
||||
if (bytes == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
|
||||
try {
|
||||
ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
|
||||
try {
|
||||
return (E) objectInputStream.readObject();
|
||||
} catch (ClassNotFoundException e) {
|
||||
logger.error("发生异常,"+e.getMessage());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.error("发生异常,"+e.getMessage());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public String stringInstantiate(E e) { //序列化对象的byte[]数组转为字符串(包装类可不调用)
|
||||
byte[] bytes = instantiate(e);
|
||||
|
||||
if (bytes != null && bytes.length>0 ) {
|
||||
return Base64.encode(bytes);
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public byte[] stringDeInstantiate(String str) { //stringInstantiate方法还原为byte[]数组
|
||||
if (!StringUtils.isEmpty(str)) {
|
||||
return Base64.decode(str);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.njcn.advance.utils;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -33,8 +32,7 @@ public class WaveUtils {
|
||||
public String getFile(String filePath){
|
||||
String temJson = null;
|
||||
try(InputStream inputStream = fileStorageUtil.getFileStream(filePath)){
|
||||
temJson = IoUtil.read(inputStream, CharsetUtil.UTF_8);
|
||||
|
||||
temJson = IoUtil.readUtf8(inputStream);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -2,13 +2,11 @@ package com.njcn.advance.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.netflix.ribbon.proxy.annotation.Http;
|
||||
import com.njcn.advance.pojo.dto.BalanceInfo;
|
||||
import com.njcn.advance.pojo.param.AdvanceBaseParam;
|
||||
import com.njcn.advance.pojo.po.PqsRelevanceLog;
|
||||
import com.njcn.advance.service.EventRelevantAnalysisService;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
@@ -17,23 +15,20 @@ import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailAssPO;
|
||||
import com.njcn.event.pojo.vo.AdvanceEventDetailVO;
|
||||
import com.njcn.web.constant.ValidMessage;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.pojo.annotation.DateTimeStrValid;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.DataInputStream;
|
||||
import java.net.URLDecoder;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
@@ -42,11 +37,11 @@ import java.util.Map;
|
||||
* @author cdf
|
||||
* @date 2023/6/30
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("process")
|
||||
@Api(tags = "暂降事件关联分析")
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class EventRelevantAnalysisController extends BaseController {
|
||||
|
||||
private final EventRelevantAnalysisService eventRelevantAnalysisService;
|
||||
@@ -87,6 +82,11 @@ public class EventRelevantAnalysisController extends BaseController {
|
||||
@ApiOperation("事件波形分析主列表")
|
||||
public HttpResult<Page<RmpEventDetailAssPO>> queryEventsAssPage(@RequestBody BaseParam baseParam){
|
||||
String methodDescribe = getMethodDescribe("queryEventsAssPage");
|
||||
String searchValue = baseParam.getSearchValue();
|
||||
Pattern pattern = Pattern.compile(PatternRegex.SPECIAL_REGEX);
|
||||
if(pattern.matcher(searchValue).find()){
|
||||
throw new BusinessException(ValidMessage.SPECIAL_REGEX);
|
||||
}
|
||||
Page<RmpEventDetailAssPO> page = eventRelevantAnalysisService.queryEventsAssPage(baseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
@@ -197,4 +197,12 @@ public class EventRelevantAnalysisController extends BaseController {
|
||||
boolean flag = eventRelevantAnalysisService.delRelevantLog(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDResultVO;
|
||||
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDataIVO;
|
||||
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDataQVO;
|
||||
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDataVO;
|
||||
import com.njcn.advance.service.carrycapacity.CarryCapcityService;
|
||||
import com.njcn.advance.service.carrycapacity.CarryCapacityService;
|
||||
import com.njcn.advance.utils.EasyExcelUtil;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
@@ -44,7 +44,7 @@ import java.util.List;
|
||||
public class CarryCapacityController extends BaseController {
|
||||
|
||||
|
||||
private final CarryCapcityService carryCapcityService;
|
||||
private final CarryCapacityService carryCapcityService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryCarryCapacityData")
|
||||
@@ -56,15 +56,7 @@ public class CarryCapacityController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, carryCapacityDataVO, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/modelTraining")
|
||||
@ApiOperation("承载能力评估模型训练")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<CarryCapacityDataVO> modelTraining(@RequestBody @Validated CarryCapacityQueryDataParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("modelTraining");
|
||||
CarryCapacityDataVO carryCapacityDataVO = carryCapcityService.modelTraining(queryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, carryCapacityDataVO, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryCarryCapacityQData")
|
||||
@@ -72,8 +64,7 @@ public class CarryCapacityController extends BaseController {
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<CarryCapacityDataQVO> queryCarryCapacityQData(@RequestBody @Validated CarryCapacityQueryDataParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("queryCarryCapacityQData");
|
||||
CarryCapacityDataQVO carryCapacityDataQVO = carryCapcityService.queryCarryCapacityQData(queryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, carryCapacityDataQVO, methodDescribe);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, carryCapcityService.queryCarryCapacityqData(queryParam), methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@@ -82,8 +73,7 @@ public class CarryCapacityController extends BaseController {
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<CarryCapacityDataIVO> queryCarryCapacityIData(@RequestBody @Validated CarryCapacityQueryDataParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("queryCarryCapacityIData");
|
||||
CarryCapacityDataIVO carryCapacityDataIVO = carryCapcityService.queryCarryCapacityIData(queryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, carryCapacityDataIVO, methodDescribe);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, carryCapcityService.queryCarryCapacityiData(queryParam), methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@@ -92,8 +82,7 @@ public class CarryCapacityController extends BaseController {
|
||||
@ApiImplicitParam(name = "calParam", value = "计算参数", required = true)
|
||||
public HttpResult<CarryCapacityDResultVO> carryCapacityCal(@RequestBody @Validated CarryCapacityCalParam calParam) {
|
||||
String methodDescribe = getMethodDescribe("carryCapacityCal");
|
||||
CarryCapacityDResultVO carryCapacityDResultVO = carryCapcityService.carryCapacityCal(calParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, carryCapacityDResultVO, methodDescribe);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, carryCapcityService.carryCapacityCal(calParam), methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@@ -109,9 +98,6 @@ public class CarryCapacityController extends BaseController {
|
||||
@ApiOperation("导出数据集模板")
|
||||
@GetMapping(value = "getExcelTemplate")
|
||||
public HttpResult<String> getExcelTemplate(HttpServletResponse response) throws IOException {
|
||||
|
||||
|
||||
|
||||
String sheetName = "数据集模版";
|
||||
List<CarryCapcityDataEexcel> excels = new ArrayList<>();
|
||||
CarryCapcityDataEexcel exportHeadersExcel = new CarryCapcityDataEexcel();
|
||||
@@ -120,10 +106,6 @@ public class CarryCapacityController extends BaseController {
|
||||
.sheet(sheetName)
|
||||
.doWrite(excels);
|
||||
EasyExcelUtil.writeWithSheetsWeb(response, "数据集模版.xlsx");
|
||||
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -132,7 +114,6 @@ public class CarryCapacityController extends BaseController {
|
||||
@ApiOperation("上传数据集")
|
||||
public HttpResult<Boolean> uploadExcel(@Validated ExcelDataParam excelDataParam) throws Exception {
|
||||
String methodDescribe = getMethodDescribe("uploadExcel");
|
||||
|
||||
boolean flag = carryCapcityService.uploadExcel(excelDataParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.advance.controller.eventGui;
|
||||
|
||||
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.DataInputStream;
|
||||
import java.net.URLDecoder;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("process")
|
||||
@Api(tags = "暂降事件关联分析")
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class EventGuiController {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,12 +1,7 @@
|
||||
package com.njcn.advance.controller.govern.harmonic;
|
||||
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.advance.enums.AdvanceResponseEnum;
|
||||
import com.njcn.advance.pojo.dto.govern.voltage.SgEventExcel;
|
||||
import com.njcn.advance.pojo.po.govern.harmonic.SgHarmonicFile;
|
||||
import com.njcn.advance.service.govern.harmonic.ISgHarmonicFileService;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
@@ -14,17 +9,14 @@ import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
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.utils.HttpResultUtil;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.poi.util.PoiUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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;
|
||||
|
||||
@@ -33,7 +25,6 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -71,7 +62,7 @@ public class SgHarmonicFileController extends BaseController {
|
||||
|
||||
@PostMapping(value = "/listHarmonicData")
|
||||
@ApiOperation("获取谐波数据数据")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.QUERY)
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
public HttpResult<List<SgHarmonicFile>> listHarmonicData() {
|
||||
String methodDescribe = getMethodDescribe("listHarmonicData");
|
||||
LambdaQueryWrapper<SgHarmonicFile> sgHarmonicFileLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
package com.njcn.advance.controller.govern.voltage;
|
||||
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.SgGovernSchemeHistoryParam;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.SgUserParam;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgGovernSchemeHistoryAllVO;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgGovernSchemeHistoryVO;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgUserVO;
|
||||
import com.njcn.advance.service.govern.voltage.IGovernSchemeCalcService;
|
||||
import com.njcn.advance.service.govern.voltage.ISgGovernSchemeHistoryService;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
@@ -28,6 +25,9 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
*/
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestController
|
||||
|
||||
@@ -68,7 +68,7 @@ public class SgEventController extends BaseController {
|
||||
@PostMapping("/getEventDataByProductLineId")
|
||||
@ApiOperation("查询生产线下时间范围内的暂降数据")
|
||||
@ApiImplicitParam(name = "sgEventParamQueryParam", value = "查询参数", required = true)
|
||||
public HttpResult<List<SgEventVO>> getEventDataByProductLineId(@RequestBody SgEventParam.SgEventParamQueryParam sgEventParamQueryParam) {
|
||||
public HttpResult<List<SgEventVO>> getEventDataByProductLineId(@RequestBody SgEventParam.SgEventParamQueryParam sgEventParamQueryParam) {
|
||||
String methodDescribe = getMethodDescribe("getEventDataByProductLineId");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, sgEventParamQueryParam);
|
||||
List<SgEventVO> result = sgEventService.getEventDataByProductLineId(sgEventParamQueryParam);
|
||||
@@ -104,8 +104,15 @@ public class SgEventController extends BaseController {
|
||||
@PostMapping(value = "/importEventData")
|
||||
@ApiOperation("批量导入暂降数据")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
||||
public HttpResult<String> importEventData(@RequestParam("file") MultipartFile file, @RequestParam("incomingLineId") String incomingLineId, @RequestParam("productLineId") String productLineId,HttpServletResponse response) {
|
||||
public HttpResult<String> importEventData(@RequestParam("file") MultipartFile file, @RequestParam("incomingLineId") String incomingLineId, @RequestParam("productLineId") String productLineId, HttpServletResponse response) {
|
||||
String methodDescribe = getMethodDescribe("importEventData");
|
||||
|
||||
// 检查文件MIME类型是否为csv
|
||||
String contentType = file.getContentType();
|
||||
if (!"text/csv".equals(contentType)) {
|
||||
throw new BusinessException(AdvanceResponseEnum.INVALID_FILE_TYPE);
|
||||
}
|
||||
|
||||
ImportParams params = new ImportParams();
|
||||
params.setHeadRows(1);
|
||||
params.setNeedVerify(true);
|
||||
@@ -115,12 +122,13 @@ public class SgEventController extends BaseController {
|
||||
ExcelImportResult<SgEventExcel> sgEventExcelExcelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), SgEventExcel.class, params);
|
||||
//如果存在非法数据,将不合格的数据导出
|
||||
if (sgEventExcelExcelImportResult.isVerifyFail()) {
|
||||
// PoiUtil.exportFileByWorkbook(sgEventExcelExcelImportResult.getFailWorkbook(), "非法暂降数据.xlsx", response);
|
||||
// 此处到处前端要做特殊处理,具体可以参考技术监督的数据导入,todo...
|
||||
PoiUtil.exportFileByWorkbook(sgEventExcelExcelImportResult.getFailWorkbook(), "非法暂降数据.xlsx", response);
|
||||
throw new BusinessException(AdvanceResponseEnum.IMPORT_EVENT_DATA_FAIL);
|
||||
} else {
|
||||
//批量录入暂降数据
|
||||
List<SgEventExcel> sgEventExcels = sgEventExcelExcelImportResult.getList();
|
||||
sgEventService.importEventData(sgEventExcels, incomingLineId,productLineId);
|
||||
sgEventService.importEventData(sgEventExcels, incomingLineId, productLineId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(AdvanceResponseEnum.IMPORT_EVENT_DATA_FAIL);
|
||||
@@ -129,7 +137,6 @@ public class SgEventController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/calcLoss")
|
||||
@ApiOperation("计算暂降损失")
|
||||
|
||||
@@ -5,7 +5,6 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.SgMachineParam;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgMachineVO;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgProductLineVO;
|
||||
import com.njcn.advance.service.govern.voltage.ISgMachineService;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
|
||||
@@ -4,7 +4,6 @@ package com.njcn.advance.controller.govern.voltage;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.SgProductLineParam;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgProductLine;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgProductLineVO;
|
||||
import com.njcn.advance.service.govern.voltage.ISgProductLineService;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
|
||||
@@ -4,7 +4,6 @@ package com.njcn.advance.controller.govern.voltage;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.SgSensitiveUnitParam;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgMachineVO;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgSensitiveUnitVO;
|
||||
import com.njcn.advance.service.govern.voltage.ISgSensitiveUnitService;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
|
||||
@@ -102,6 +102,7 @@ public class UserDataController extends BaseController {
|
||||
if (fileSize > 3072) {
|
||||
throw new BusinessException(CommonResponseEnum.FILE_SIZE_ERROR);
|
||||
}
|
||||
assert fileName != null;
|
||||
if (!fileName.matches("^.+\\.(?i)(xlsx)$") && !fileName.matches("^.+\\.(?i)(xls)$")) {
|
||||
throw new BusinessException(CommonResponseEnum.FILE_XLSX_ERROR);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.njcn.advance.mapper;
|
||||
|
||||
public interface RelevanceMapper {
|
||||
|
||||
|
||||
// 查询监测点的线路ID
|
||||
String queryLineIdbyPointId(String pointId);
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.njcn.advance.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.advance.pojo.dto.SagEvent;
|
||||
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.njcn.advance.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.advance.pojo.dto.SagEvent;
|
||||
|
||||
import com.njcn.advance.pojo.dto.relevent.EventAssObj;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailAssPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -1,20 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.advance.mapper.carrycapacity.CarryCapacityDataPOMapper">
|
||||
<resultMap id="BaseResultMap" type="com.njcn.advance.pojo.carrycapacity.po.CarryCapacityDataPO">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table carry_capacity_data-->
|
||||
<id column="line_id" jdbcType="VARCHAR" property="lineId" />
|
||||
<id column="start_time" jdbcType="DATE" property="startTime" />
|
||||
<id column="end_time" jdbcType="DATE" property="endTime" />
|
||||
<result column="date_list" jdbcType="VARCHAR" property="dateList" />
|
||||
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
line_id, start_time, end_time, date_list, create_by, create_time, update_by, update_time
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -1,19 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.advance.mapper.carrycapacity.CarryCapacityDevicePOMapper">
|
||||
<resultMap id="BaseResultMap" type="com.njcn.advance.pojo.carrycapacity.po.CarryCapacityDevicePO">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table carry_capacity_device-->
|
||||
<id column="dev_id" jdbcType="VARCHAR" property="devId" />
|
||||
<result column="dev_name" jdbcType="VARCHAR" property="devName" />
|
||||
<result column="protocol_capacity" jdbcType="DOUBLE" property="protocolCapacity" />
|
||||
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
dev_id, dev_name, protocol_capacity, create_by, create_time, update_by, update_time
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -1,29 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.advance.mapper.carrycapacity.CarryCapacityResultPOMapper">
|
||||
<resultMap id="BaseResultMap" type="com.njcn.advance.pojo.carrycapacity.po.CarryCapacityResultPO">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table carry_capacity_result-->
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="line_id" jdbcType="VARCHAR" property="lineId" />
|
||||
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
||||
<result column="start_time" jdbcType="DATE" property="startTime" />
|
||||
<result column="end_time" jdbcType="DATE" property="endTime" />
|
||||
<result column="u_t_level" jdbcType="INTEGER" property="uTLevel" />
|
||||
<result column="pf_t_level" jdbcType="INTEGER" property="pfTLevel" />
|
||||
<result column="b_t_level" jdbcType="INTEGER" property="bTLevel" />
|
||||
<result column="i_level" jdbcType="INTEGER" property="iLevel" />
|
||||
<result column="reslut_level" jdbcType="INTEGER" property="reslutLevel" />
|
||||
<result column="evaluate_date" jdbcType="DATE" property="evaluateDate" />
|
||||
<result column="status" jdbcType="INTEGER" property="status" />
|
||||
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, line_id, user_id, start_time, end_time, u_t_level, pf_t_level, b_t_level, i_level,
|
||||
reslut_level, evaluate_date, `status`, create_by, create_time, update_by, update_time
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -1,30 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.advance.mapper.carrycapacity.CarryCapacityStrategyDhlPOMapper">
|
||||
<resultMap id="BaseResultMap" type="com.njcn.advance.pojo.carrycapacity.po.CarryCapacityStrategyDhlPO">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table carry_capacity_strategy_dhl-->
|
||||
<result column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||
<result column="comparison_operators_1" jdbcType="VARCHAR" property="comparisonOperators1" />
|
||||
<result column="count_1" jdbcType="INTEGER" property="count1" />
|
||||
<result column="comparison_operators_2" jdbcType="VARCHAR" property="comparisonOperators2" />
|
||||
<result column="count_2" jdbcType="INTEGER" property="count2" />
|
||||
<result column="comparison_operators_3" jdbcType="VARCHAR" property="comparisonOperators3" />
|
||||
<result column="count_3" jdbcType="INTEGER" property="count3" />
|
||||
<result column="proto_flag" jdbcType="INTEGER" property="protoFlag" />
|
||||
<result column="comparison_operators_4" jdbcType="VARCHAR" property="comparisonOperators4" />
|
||||
<result column="count_4" jdbcType="INTEGER" property="count4" />
|
||||
<result column="user_flag" jdbcType="INTEGER" property="userFlag" />
|
||||
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, `type`, comparison_operators_1, count_1, comparison_operators_2, count_2, comparison_operators_3,
|
||||
count_3, proto_flag, comparison_operators_4, count_4, user_flag, create_by, create_time,
|
||||
update_by, update_time
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -1,23 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.advance.mapper.carrycapacity.CarryCapacityStrategyPOMapper">
|
||||
<resultMap id="BaseResultMap" type="com.njcn.advance.pojo.carrycapacity.po.CarryCapacityStrategyPO">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table carry_capacity_strategy-->
|
||||
<result column="result" jdbcType="INTEGER" property="result" />
|
||||
<result column="index_result" jdbcType="INTEGER" property="indexResult" />
|
||||
<result column="comparison_operators" jdbcType="VARCHAR" property="comparisonOperators" />
|
||||
<result column="count" jdbcType="INTEGER" property="count" />
|
||||
<result column="proto_flag" jdbcType="INTEGER" property="protoFlag" />
|
||||
<result column="user_flag" jdbcType="INTEGER" property="userFlag" />
|
||||
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
`result`, index_result, comparison_operators, `count`, proto_flag, user_flag, create_by,
|
||||
create_time, update_by, update_time
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -1,23 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.advance.mapper.carrycapacity.CarryCapacityUserPOMapper">
|
||||
<resultMap id="BaseResultMap" type="com.njcn.advance.pojo.carrycapacity.po.CarryCapacityUserPO">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table carry_capacity_user-->
|
||||
<id column="user_id" jdbcType="VARCHAR" property="userId" />
|
||||
<result column="user_name" jdbcType="VARCHAR" property="userName" />
|
||||
<result column="user_type" jdbcType="VARCHAR" property="userType" />
|
||||
<result column="voltage" jdbcType="VARCHAR" property="voltage" />
|
||||
<result column="protocol_capacity" jdbcType="DOUBLE" property="protocolCapacity" />
|
||||
<result column="area" jdbcType="VARCHAR" property="area" />
|
||||
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
user_id, user_name, user_type, voltage, protocol_capacity, area, create_by, create_time,
|
||||
update_by, update_time
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.advance.mapper.RelevantLogMapper">
|
||||
|
||||
<select id="updateCause" resultType="EntityLogic">
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.advance.mapper.RelevanceMapper">
|
||||
|
||||
<select id="queryLineIdbyPointId" resultType="string" parameterType="string">
|
||||
select pid from pq_line where id = #{pointId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="queryCodebyGuid" resultType="java.lang.Integer" parameterType="java.lang.String">
|
||||
select triphase from sys_dict_data where id = #{guid}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -16,14 +16,14 @@ import java.util.List;
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface CarryCapcityService {
|
||||
public interface CarryCapacityService {
|
||||
|
||||
|
||||
CarryCapacityDataVO queryCarryCapacityData(CarryCapacityQueryDataParam queryParam);
|
||||
|
||||
CarryCapacityDataQVO queryCarryCapacityQData(CarryCapacityQueryDataParam queryParam);
|
||||
CarryCapacityDataQVO queryCarryCapacityqData(CarryCapacityQueryDataParam queryParam);
|
||||
|
||||
CarryCapacityDataIVO queryCarryCapacityIData(CarryCapacityQueryDataParam queryParam);
|
||||
CarryCapacityDataIVO queryCarryCapacityiData(CarryCapacityQueryDataParam queryParam);
|
||||
|
||||
CarryCapacityDResultVO carryCapacityCal(CarryCapacityCalParam calParam);
|
||||
|
||||
@@ -31,7 +31,6 @@ public interface CarryCapcityService {
|
||||
|
||||
boolean uploadExcel(ExcelDataParam excelDataParam) throws Exception;
|
||||
|
||||
CarryCapacityDataVO modelTraining(CarryCapacityQueryDataParam queryParam);
|
||||
|
||||
CarryCapacityDResultVO carryCapacityEvaluate(CarryCapacityEvaluateParam calParam);
|
||||
}
|
||||
@@ -1,10 +1,14 @@
|
||||
package com.njcn.advance.service.carrycapacity.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.advance.mapper.carrycapacity.CarryCapacityDevicePOMapper;
|
||||
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityDeviceParam;
|
||||
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityDevicePO;
|
||||
import com.njcn.advance.service.carrycapacity.CarryCapacityDevicePOService;
|
||||
import com.njcn.advance.utils.CheckStringUtil;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -23,8 +27,13 @@ public class CarryCapacityDevicePOServiceImpl extends ServiceImpl<CarryCapacityD
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateDevice(CarryCapacityDeviceParam.CarryCapacityDeviceUpdateParam deviceParam) {
|
||||
if(StringUtils.isBlank(deviceParam.getDevName())){
|
||||
throw new BusinessException("干扰源设备名称不能为空");
|
||||
}
|
||||
checkName(deviceParam,true);
|
||||
return this.lambdaUpdate().eq(CarryCapacityDevicePO::getDevId, deviceParam.getDevId())
|
||||
.set(CarryCapacityDevicePO::getDevName, deviceParam.getDevName())
|
||||
.set(CarryCapacityDevicePO::getDevScale, deviceParam.getDevScale())
|
||||
.set(CarryCapacityDevicePO::getProtocolCapacity, deviceParam.getProtocolCapacity())
|
||||
.update();
|
||||
}
|
||||
@@ -32,9 +41,44 @@ public class CarryCapacityDevicePOServiceImpl extends ServiceImpl<CarryCapacityD
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean add(CarryCapacityDeviceParam capacityDeviceParam) {
|
||||
CarryCapacityDevicePO carryCapacityDevicePO = new CarryCapacityDevicePO();
|
||||
BeanUtils.copyProperties(capacityDeviceParam,carryCapacityDevicePO);
|
||||
boolean save = this.save(carryCapacityDevicePO);
|
||||
return save;
|
||||
if(StringUtils.isBlank(capacityDeviceParam.getDevName())){
|
||||
throw new BusinessException("干扰源设备名称不能为空");
|
||||
}
|
||||
checkName(capacityDeviceParam,false);
|
||||
|
||||
CarryCapacityDevicePO carryCapacityDevice = new CarryCapacityDevicePO();
|
||||
BeanUtils.copyProperties(capacityDeviceParam,carryCapacityDevice);
|
||||
return this.save(carryCapacityDevice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查名称是否已存在
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
private void checkName(CarryCapacityDeviceParam carryCapacityDeviceParam, boolean isUpdate) {
|
||||
if(carryCapacityDeviceParam.getDevName().length()>32){
|
||||
throw new BusinessException("超过最大长度");
|
||||
|
||||
}
|
||||
CheckStringUtil.checkName(carryCapacityDeviceParam.getDevName());
|
||||
|
||||
LambdaQueryWrapper<CarryCapacityDevicePO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
//条件组合:where state = 1 and name = ?
|
||||
lambdaQueryWrapper.eq(CarryCapacityDevicePO::getUserId,carryCapacityDeviceParam.getUserId()).eq(CarryCapacityDevicePO::getDevName, carryCapacityDeviceParam.getDevName());
|
||||
|
||||
//and id <> ?
|
||||
if (isUpdate) {
|
||||
if (carryCapacityDeviceParam instanceof CarryCapacityDeviceParam.CarryCapacityDeviceUpdateParam) {
|
||||
lambdaQueryWrapper.ne(CarryCapacityDevicePO::getDevId, ((CarryCapacityDeviceParam.CarryCapacityDeviceUpdateParam) carryCapacityDeviceParam).getDevId());
|
||||
}
|
||||
}
|
||||
|
||||
//若存在条件数据抛出异常
|
||||
int count = this.getBaseMapper().selectCount(lambdaQueryWrapper);
|
||||
if (count > 0) {
|
||||
throw new BusinessException("干扰源设备名称已存在");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,21 +56,24 @@ public class CarryCapacityResultPOServiceImpl extends ServiceImpl<CarryCapacityR
|
||||
BeanUtils.copyProperties(temp, vo);
|
||||
String[] split = temp.getUserId().split(",");
|
||||
List<String> collect1 = Arrays.stream(split).sequential().map(userId -> {
|
||||
CarryCapacityUserPO carryCapacityUserPO = carryCapacityUserPOService.queyDetailUserById(userId);
|
||||
return carryCapacityUserPO.getUserName();
|
||||
CarryCapacityUserPO carryCapacityUser = carryCapacityUserPOService.queyDetailUserById(userId);
|
||||
return carryCapacityUser.getUserName();
|
||||
}).collect(Collectors.toList());
|
||||
vo.setUserName(collect1.stream().collect(Collectors.joining(",")));
|
||||
vo.setUserName(String.join(",", collect1));
|
||||
if (ObjectUtils.isNotEmpty(temp.getIResultList()) ){
|
||||
String iResultList = temp.getIResultList();
|
||||
List<CarryCapacityDResultVO.CarryCapacityIResult> list = JSONUtil.toList(JSONUtil.toJsonStr(iResultList), CarryCapacityDResultVO.CarryCapacityIResult.class);
|
||||
vo.setIResultList(list);
|
||||
}
|
||||
if(Objects.nonNull(vo.getLineId())){
|
||||
if(StringUtils.isNotBlank(vo.getLineId())){
|
||||
LineDetailVO data = lineFeignClient.getLineSubGdDetail(vo.getLineId()).getData();
|
||||
vo.setLineName(data.getGdName()+"->"
|
||||
+data.getSubName()+"->"
|
||||
+data.getDevName()+"->"
|
||||
+data.getLineName());
|
||||
if(Objects.nonNull(data)){
|
||||
vo.setLineName(data.getGdName()+"->"
|
||||
+data.getSubName()+"->"
|
||||
+data.getDevName()+"->"
|
||||
+data.getLineName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return vo;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,7 @@ import com.njcn.advance.mapper.carrycapacity.CarryCapacityStrategyDhlPOMapper;
|
||||
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityStrategyDhlPO;
|
||||
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityStrategyDhlVO;
|
||||
import com.njcn.advance.service.carrycapacity.CarryCapacityStrategyDhlPOService;
|
||||
import com.njcn.advance.utils.CheckStringUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -27,7 +28,7 @@ public class CarryCapacityStrategyDhlPOServiceImpl extends ServiceImpl<CarryCapa
|
||||
@Override
|
||||
public List<CarryCapacityStrategyDhlVO> queyDetailDhl() {
|
||||
List<CarryCapacityStrategyDhlPO> list = this.lambdaQuery().eq(CarryCapacityStrategyDhlPO::getUserFlag, 1).list();
|
||||
List<CarryCapacityStrategyDhlVO> collect = list.stream().map(t -> {
|
||||
return list.stream().map(t -> {
|
||||
CarryCapacityStrategyDhlVO vo = new CarryCapacityStrategyDhlVO();
|
||||
vo.setCount1(t.getCount1());
|
||||
vo.setCount2(t.getCount2());
|
||||
@@ -42,7 +43,6 @@ public class CarryCapacityStrategyDhlPOServiceImpl extends ServiceImpl<CarryCapa
|
||||
vo.setType(t.getType());
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
return collect;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityStrategyDhlPO;
|
||||
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityStrategyPO;
|
||||
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityStrategyVO;
|
||||
import com.njcn.advance.service.carrycapacity.CarryCapacityStrategyPOService;
|
||||
import com.njcn.advance.utils.CheckStringUtil;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -38,8 +39,9 @@ public class CarryCapacityStrategyPOServiceImpl extends ServiceImpl<CarryCapacit
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Boolean add(CarryCapacityStrategyParam carryCapacityStrategyParam) {
|
||||
CarryCapacityStrategyPO carryCapacityStrategyPO = new CarryCapacityStrategyPO();
|
||||
BeanUtils.copyProperties(carryCapacityStrategyParam, carryCapacityStrategyPO);
|
||||
|
||||
CarryCapacityStrategyPO carryCapacityStrategy = new CarryCapacityStrategyPO();
|
||||
BeanUtils.copyProperties(carryCapacityStrategyParam, carryCapacityStrategy);
|
||||
//将原始策略处理为不启用
|
||||
this.lambdaUpdate().eq(CarryCapacityStrategyPO::getResult, carryCapacityStrategyParam.getResult())
|
||||
.eq(CarryCapacityStrategyPO::getId, carryCapacityStrategyParam.getId())
|
||||
@@ -56,10 +58,9 @@ public class CarryCapacityStrategyPOServiceImpl extends ServiceImpl<CarryCapacit
|
||||
//将客户对应策略删除
|
||||
this.remove(lambdaQuery);
|
||||
//新增客户策略;
|
||||
carryCapacityStrategyPO.setProtoFlag(2);
|
||||
carryCapacityStrategyPO.setUserFlag(1);
|
||||
boolean save = this.save(carryCapacityStrategyPO);
|
||||
return save;
|
||||
carryCapacityStrategy.setProtoFlag(2);
|
||||
carryCapacityStrategy.setUserFlag(1);
|
||||
return this.save(carryCapacityStrategy);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -133,7 +134,6 @@ public class CarryCapacityStrategyPOServiceImpl extends ServiceImpl<CarryCapacit
|
||||
po.setUserFlag(1);
|
||||
return po;
|
||||
}).collect(Collectors.toList());
|
||||
boolean b = this.saveBatch(collect);
|
||||
return b;
|
||||
return this.saveBatch(collect);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.advance.service.carrycapacity.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -10,10 +11,17 @@ import com.njcn.advance.mapper.carrycapacity.CarryCapacityUserPOMapper;
|
||||
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityUserParam;
|
||||
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityUserPO;
|
||||
import com.njcn.advance.service.carrycapacity.CarryCapacityUserPOService;
|
||||
import com.njcn.advance.utils.CheckStringUtil;
|
||||
import com.njcn.common.pojo.constant.LogInfo;
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.harmonic.enums.HarmonicResponseEnum;
|
||||
import com.njcn.harmonic.pojo.param.ReportTemplateParam;
|
||||
import com.njcn.harmonic.pojo.po.ExcelRptTemp;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.vo.UserVO;
|
||||
import com.njcn.web.constant.ValidMessage;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -21,6 +29,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -37,29 +46,57 @@ public class CarryCapacityUserPOServiceImpl extends ServiceImpl<CarryCapacityUse
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean add(CarryCapacityUserParam carryCapacityUserParam) {
|
||||
CarryCapacityUserPO carryCapacityUserPO = new CarryCapacityUserPO();
|
||||
BeanUtils.copyProperties(carryCapacityUserParam, carryCapacityUserPO);
|
||||
CarryCapacityUserPO one = this.lambdaQuery().eq(CarryCapacityUserPO::getUserName, carryCapacityUserParam.getUserName()).one();
|
||||
if(Objects.nonNull(one)){
|
||||
if(StringUtils.isBlank(carryCapacityUserParam.getUserName())){
|
||||
throw new BusinessException("用户称不能为空");
|
||||
}
|
||||
checkName(carryCapacityUserParam,false);
|
||||
CarryCapacityUserPO carryCapacityUser = new CarryCapacityUserPO();
|
||||
BeanUtils.copyProperties(carryCapacityUserParam, carryCapacityUser);
|
||||
carryCapacityUser.setStatus(1);
|
||||
return this.save(carryCapacityUser);
|
||||
}
|
||||
/**
|
||||
* 检查名称是否已存在
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
private void checkName(CarryCapacityUserParam carryCapacityUserParam, boolean isUpdate) {
|
||||
if(carryCapacityUserParam.getUserName().length()>32){
|
||||
throw new BusinessException("超过最大长度");
|
||||
|
||||
}
|
||||
CheckStringUtil.checkName(carryCapacityUserParam.getUserName());
|
||||
LambdaQueryWrapper<CarryCapacityUserPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
//条件组合:where state = 1 and name = ?
|
||||
lambdaQueryWrapper.eq(CarryCapacityUserPO::getStatus, DataStateEnum.ENABLE.getCode()).eq(CarryCapacityUserPO::getUserName, carryCapacityUserParam.getUserName());
|
||||
|
||||
//and id <> ?
|
||||
if (isUpdate) {
|
||||
if (carryCapacityUserParam instanceof CarryCapacityUserParam.CarryCapacityUserUpdateParam) {
|
||||
lambdaQueryWrapper.ne(CarryCapacityUserPO::getUserId, ((CarryCapacityUserParam.CarryCapacityUserUpdateParam) carryCapacityUserParam).getUserId());
|
||||
}
|
||||
}
|
||||
|
||||
//若存在条件数据抛出异常
|
||||
int count = this.getBaseMapper().selectCount(lambdaQueryWrapper);
|
||||
if (count > 0) {
|
||||
throw new BusinessException(AdvanceResponseEnum.USER_NAME_EXIST);
|
||||
}
|
||||
carryCapacityUserPO.setStatus(1);
|
||||
boolean save = this.save(carryCapacityUserPO);
|
||||
return save;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateUser(CarryCapacityUserParam.CarryCapacityUserUpdateParam userUpdateParam) {
|
||||
CarryCapacityUserPO carryCapacityUserPO = new CarryCapacityUserPO();
|
||||
BeanUtils.copyProperties(userUpdateParam, carryCapacityUserPO);
|
||||
CarryCapacityUserPO one = this.lambdaQuery().eq(CarryCapacityUserPO::getUserName, userUpdateParam.getUserName()).ne(CarryCapacityUserPO::getUserId,userUpdateParam.getUserId()).one();
|
||||
if(Objects.nonNull(one)){
|
||||
throw new BusinessException(AdvanceResponseEnum.USER_NAME_EXIST);
|
||||
if(StringUtils.isBlank(userUpdateParam.getUserName())){
|
||||
throw new BusinessException("用户称不能为空");
|
||||
}
|
||||
checkName(userUpdateParam,true);
|
||||
CarryCapacityUserPO carryCapacityUser = new CarryCapacityUserPO();
|
||||
BeanUtils.copyProperties(userUpdateParam, carryCapacityUser);
|
||||
|
||||
boolean save = this.updateById(carryCapacityUserPO);
|
||||
return save;
|
||||
|
||||
return this.updateById(carryCapacityUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,7 +112,7 @@ public class CarryCapacityUserPOServiceImpl extends ServiceImpl<CarryCapacityUse
|
||||
orderByDesc(CarryCapacityUserPO::getCreateTime);
|
||||
|
||||
IPage<CarryCapacityUserPO> page = this.page (returnpage, queryWrapper);
|
||||
page.getRecords().stream().forEach(temp->{
|
||||
page.getRecords().forEach(temp->{
|
||||
UserVO user = userFeignClient.getUserById(temp.getCreateBy()).getData();
|
||||
|
||||
temp.setCreateBy(Objects.isNull(user)? LogInfo.UNKNOWN_USER:user.getName());
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,12 +4,9 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.text.CharPool;
|
||||
import cn.hutool.core.text.StrPool;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.njcn.advance.enums.AdvanceResponseEnum;
|
||||
import com.njcn.advance.enums.GovernSchemeEnum;
|
||||
import com.njcn.advance.pojo.dto.govern.voltage.ProductLineComputeData;
|
||||
@@ -32,6 +29,9 @@ import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class GovernSchemeCalcServiceImpl implements IGovernSchemeCalcService {
|
||||
@@ -77,7 +77,7 @@ public class GovernSchemeCalcServiceImpl implements IGovernSchemeCalcService {
|
||||
String startTime = sgGovernSchemeHistoryParam.getStartTime();
|
||||
String endTime = sgGovernSchemeHistoryParam.getEndTime();
|
||||
//这种区间计算损失不合适,经过平均后,特征幅值在40%以下,直接被平均为25%,故此处我准备按实际的暂态信息计算
|
||||
// Map<Integer[], Integer> eventMap = eventService.getEventMap(sgIncomingLine.getId(), startTime, endTime);
|
||||
//区间计算方式:Map<Integer[], Integer> eventMap = eventService.getEventMap(sgIncomingLine.getId(), startTime, endTime);
|
||||
List<SgEvent> sgEventList = eventService.getEventData(sgIncomingLine.getId(), startTime, endTime);
|
||||
if (CollectionUtil.isEmpty(sgEventList)) {
|
||||
throw new BusinessException(AdvanceResponseEnum.EVENT_DATA_MISS);
|
||||
@@ -155,7 +155,7 @@ public class GovernSchemeCalcServiceImpl implements IGovernSchemeCalcService {
|
||||
}
|
||||
List<Double> governEffectUPS = new ArrayList<>();
|
||||
for (int i = 0; i < allVO.getPayBackPeriod(); i++) {
|
||||
governEffectUPS.add(allVO.getLoss()- upsVo.getLoss());
|
||||
governEffectUPS.add(allVO.getLoss() - upsVo.getLoss());
|
||||
}
|
||||
upsVo.setGovernEffectArray(governEffectUPS);
|
||||
allVO.setUpsData(upsVo);
|
||||
@@ -178,7 +178,7 @@ public class GovernSchemeCalcServiceImpl implements IGovernSchemeCalcService {
|
||||
copyHistoryVo(avcResult, avcVo);
|
||||
List<Double> governEffectAVC = new ArrayList<>();
|
||||
for (int i = 0; i < allVO.getPayBackPeriod(); i++) {
|
||||
governEffectAVC.add(allVO.getLoss()- avcVo.getLoss());
|
||||
governEffectAVC.add(allVO.getLoss() - avcVo.getLoss());
|
||||
}
|
||||
avcVo.setGovernEffectArray(governEffectAVC);
|
||||
allVO.setAvcData(avcVo);
|
||||
@@ -201,7 +201,7 @@ public class GovernSchemeCalcServiceImpl implements IGovernSchemeCalcService {
|
||||
}
|
||||
List<Double> governEffectQuick = new ArrayList<>();
|
||||
for (int i = 0; i < allVO.getPayBackPeriod(); i++) {
|
||||
governEffectQuick.add(allVO.getLoss()- quickVo.getLoss());
|
||||
governEffectQuick.add(allVO.getLoss() - quickVo.getLoss());
|
||||
}
|
||||
quickVo.setGovernEffectArray(governEffectQuick);
|
||||
allVO.setQuickData(quickVo);
|
||||
@@ -211,7 +211,7 @@ public class GovernSchemeCalcServiceImpl implements IGovernSchemeCalcService {
|
||||
QuickSchemeParam quickParam = new QuickSchemeParam();
|
||||
BeanUtil.copyProperties(quickParamOne, quickParam);
|
||||
SgIncomingLine sgIncomingLine = incomingLineService.getById(quickParam.getIncomingLineId());
|
||||
if(Objects.nonNull(sgIncomingLine)){
|
||||
if (Objects.nonNull(sgIncomingLine)) {
|
||||
quickParam.setIncomingLineId(sgIncomingLine.getName());
|
||||
}
|
||||
allVO.setQuick(quickParam);
|
||||
@@ -373,7 +373,7 @@ public class GovernSchemeCalcServiceImpl implements IGovernSchemeCalcService {
|
||||
double yearRate, ProductLineComputeData productLineComputeData) {
|
||||
//为了数据好看点,除以年期望值
|
||||
Integer payBackPeriod = 1;
|
||||
// Integer payBackPeriod = sgGovernSchemeHistoryAllVO.getPayBackPeriod();
|
||||
//计算出来的方式:Integer payBackPeriod = sgGovernSchemeHistoryAllVO.getPayBackPeriod();
|
||||
SgGovernSchemeParam schemeParam;
|
||||
//总计暂降次数
|
||||
int eventCount = 0;
|
||||
@@ -393,7 +393,7 @@ public class GovernSchemeCalcServiceImpl implements IGovernSchemeCalcService {
|
||||
Double[] eventEffect = eventService.getEventLossAndFailureRate(productLineComputeData, amplitude, durationTime);
|
||||
Double singleLoss = eventEffect[0];
|
||||
Double productLineFailureRate = eventEffect[1];
|
||||
// totalLoss = totalLoss + singleLoss * eventMap.get(sagData);
|
||||
//根据暂态区域分布计算:totalLoss = totalLoss + singleLoss * eventMap.get(sagData);
|
||||
totalLoss = totalLoss + singleLoss;
|
||||
if (amplitude < 0.9) {
|
||||
eventCount++;
|
||||
@@ -422,7 +422,7 @@ public class GovernSchemeCalcServiceImpl implements IGovernSchemeCalcService {
|
||||
Double[] eventEffect = eventService.getEventLossAndFailureRate(productLineComputeData, amplitude, durationTime);
|
||||
Double singleLoss = eventEffect[0];
|
||||
Double productLineFailureRate = eventEffect[1];
|
||||
// totalLoss = totalLoss + singleLoss * eventMap.get(sagData);
|
||||
//根据暂态区域分布计算出:totalLoss = totalLoss + singleLoss * eventMap.get(sagData);
|
||||
totalLoss = totalLoss + singleLoss;
|
||||
if (amplitude < 0.9) {
|
||||
eventCount++;
|
||||
@@ -541,7 +541,8 @@ public class GovernSchemeCalcServiceImpl implements IGovernSchemeCalcService {
|
||||
* @param power 功率
|
||||
*/
|
||||
private void calcEquipment(GovernSchemeEnum governSchemeEnum, CommonSchemeParam commonSchemeParam, QuickSchemeParam quickSchemeParam, Double power, SgGovernSchemeHistoryDetailVO resultVo) {
|
||||
resultVo.setCount(0);//避免NULL时报错
|
||||
// 避免NULL时报错
|
||||
resultVo.setCount(0);
|
||||
double priceIndex;
|
||||
switch (governSchemeEnum) {
|
||||
case UPS:
|
||||
@@ -564,7 +565,7 @@ public class GovernSchemeCalcServiceImpl implements IGovernSchemeCalcService {
|
||||
AVCInfo avcInfo = calcAvc(power);
|
||||
resultVo.setSize(avcInfo.getSize());
|
||||
resultVo.setCount(avcInfo.getCount());
|
||||
resultVo.setPower(PubUtils.doubleRound(2, (double) avcInfo.getTotalPower()));
|
||||
resultVo.setPower(PubUtils.doubleRound(2, avcInfo.getTotalPower()));
|
||||
//根据新需求,总功率低于50kW时,按50kW一跳且价格上浮50%;高于50kW时每50kW一跳。
|
||||
priceIndex = 1;
|
||||
if (avcInfo.getTotalPower() < 50) {
|
||||
@@ -740,7 +741,7 @@ public class GovernSchemeCalcServiceImpl implements IGovernSchemeCalcService {
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
class AVCInfo implements Comparable<AVCInfo> {
|
||||
static class AVCInfo implements Comparable<AVCInfo> {
|
||||
private int totalPower;
|
||||
private int power;
|
||||
private int count;
|
||||
@@ -750,7 +751,7 @@ public class GovernSchemeCalcServiceImpl implements IGovernSchemeCalcService {
|
||||
this.power = power;
|
||||
this.count = (int) Math.ceil(totalPower / this.power);
|
||||
this.size = size;
|
||||
this.totalPower = this.power * this.count;
|
||||
// 此处后续被覆盖了,this.totalPower = this.power * this.count;
|
||||
//根据新需求,总功率低于50kW时,按50kW一跳且价格上浮50%;高于50kW时每50kW一跳。
|
||||
double power4price;
|
||||
if (totalPower >= 50) {
|
||||
|
||||
@@ -16,7 +16,6 @@ import com.njcn.advance.pojo.param.govern.voltage.SgEventParam;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgEvent;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgIncomingLine;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.*;
|
||||
import com.njcn.advance.service.govern.voltage.IGovernSchemeCalcService;
|
||||
import com.njcn.advance.service.govern.voltage.ISgEventService;
|
||||
import com.njcn.advance.service.govern.voltage.ISgIncomingLineService;
|
||||
import com.njcn.advance.service.govern.voltage.ISgProductLineService;
|
||||
@@ -119,7 +118,7 @@ public class SgEventServiceImpl extends ServiceImpl<SgEventMapper, SgEvent> impl
|
||||
|
||||
@Override
|
||||
public void downloadTemplate() {
|
||||
ExcelUtil.exportExcel("暂降事件模板.xls", "暂降数据", SgEventExcel.class, new ArrayList<>());
|
||||
ExcelUtil.exportExcel("暂降事件模板.csv", "暂降数据", SgEventExcel.class, new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -214,7 +213,7 @@ public class SgEventServiceImpl extends ServiceImpl<SgEventMapper, SgEvent> impl
|
||||
*/
|
||||
@Override
|
||||
public Map<Integer[], Integer> getEventMap(String id, String startTime, String endTime) {
|
||||
Map<Integer[], Integer> eventMap = new HashMap<>();
|
||||
Map<Integer[], Integer> eventMap = new HashMap<>(16);
|
||||
LambdaQueryWrapper<SgEvent> lambdaQueryWrapper;
|
||||
for (double[] amplitudeRange : AMPLITUDE) {
|
||||
for (double[] durationTimeRange : DURATION_TIME) {
|
||||
@@ -344,7 +343,7 @@ public class SgEventServiceImpl extends ServiceImpl<SgEventMapper, SgEvent> impl
|
||||
return null;
|
||||
}
|
||||
List<String> incomingLineIDList = imcomingLineList.stream().map(SgIncomingLine::getId).collect(Collectors.toList());
|
||||
List<List<Object>> list = countEventTims(incomingLineIDList, beginDate, endDate);
|
||||
List<List<Object>> list = countEventTimes(incomingLineIDList, beginDate, endDate);
|
||||
// 转换
|
||||
ArrayList<String> amplitudes = new ArrayList<>();
|
||||
ArrayList<String> durations = new ArrayList<>();
|
||||
@@ -353,16 +352,19 @@ public class SgEventServiceImpl extends ServiceImpl<SgEventMapper, SgEvent> impl
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
List<Object> list1 = list.get(i);
|
||||
for (int j = 0; j < list1.size(); j++) {
|
||||
if (i == 0 && j == 0)
|
||||
if (i == 0 && j == 0) {
|
||||
continue;
|
||||
}
|
||||
Object v = list1.get(j);
|
||||
if (i == 0) {//第一行为持续时间
|
||||
//第一行为持续时间
|
||||
if (i == 0) {
|
||||
durations.add(String.valueOf(v));
|
||||
} else {
|
||||
if (j == 0) {//第一列为幅值
|
||||
//第一列为幅值
|
||||
if (j == 0) {
|
||||
amplitudes.add(String.valueOf(v));
|
||||
} else {
|
||||
ArrayList<String> vv = new ArrayList<String>();
|
||||
ArrayList<String> vv = new ArrayList<>();
|
||||
String amplitude = amplitudes.get(i - 1);
|
||||
vv.add(amplitude);
|
||||
|
||||
@@ -375,7 +377,7 @@ public class SgEventServiceImpl extends ServiceImpl<SgEventMapper, SgEvent> impl
|
||||
}
|
||||
}
|
||||
}
|
||||
String strTwo[][] = new String[value.size()][];
|
||||
String[][] strTwo = new String[value.size()][];
|
||||
for (int i = 0; i < value.size(); i++) {
|
||||
ArrayList<String> v = value.get(i);
|
||||
String[] vv = v.toArray(new String[v.size()]);
|
||||
@@ -420,7 +422,7 @@ public class SgEventServiceImpl extends ServiceImpl<SgEventMapper, SgEvent> impl
|
||||
@Override
|
||||
public Double[] getEventLossAndFailureRate(ProductLineComputeData productLineComputeData, double amplitude, double durationTime) {
|
||||
//总损失
|
||||
Double totalLoss = 0.0;
|
||||
double totalLoss = 0.0;
|
||||
//生产线故障率
|
||||
Double productFailureRate = 0.0;
|
||||
//如果是模式二,需要独立计算下设备损失+原料损失
|
||||
@@ -570,20 +572,15 @@ public class SgEventServiceImpl extends ServiceImpl<SgEventMapper, SgEvent> impl
|
||||
|
||||
/**
|
||||
* 统计暂降事件发生次数, 限定条件降幅范围和持续时间范围
|
||||
*
|
||||
* @param lineIds
|
||||
* @param beginDate
|
||||
* @param endDate
|
||||
* @return
|
||||
*/
|
||||
public List<List<Object>> countEventTims(List<String> lineIds, String beginDate, String endDate) {
|
||||
List<List<Object>> rList = new ArrayList();
|
||||
public List<List<Object>> countEventTimes(List<String> lineIds, String beginDate, String endDate) {
|
||||
List<List<Object>> rList = new ArrayList<>();
|
||||
List<Object> firstRow = new ArrayList<>();
|
||||
firstRow.add("幅值\\持续时间");
|
||||
rList.add(firstRow);
|
||||
boolean b = true;
|
||||
for (double[] amplitudeRange : AMPLITUDE) {
|
||||
ArrayList<Object> row = getOneRowEventTimesData(b ? firstRow : null, amplitudeRange, DURATION_TIME, lineIds, beginDate, endDate);
|
||||
ArrayList<Object> row = getOneRowEventTimesData(b ? firstRow : null, amplitudeRange, lineIds, beginDate, endDate);
|
||||
rList.add(row);
|
||||
b = false;
|
||||
}
|
||||
@@ -592,18 +589,11 @@ public class SgEventServiceImpl extends ServiceImpl<SgEventMapper, SgEvent> impl
|
||||
|
||||
/**
|
||||
* 获取一行事件次数统计数据
|
||||
*
|
||||
* @param amplitudeRange
|
||||
* @param durationTime
|
||||
* @param lineIds
|
||||
* @param beginDate
|
||||
* @param endDate
|
||||
* @return
|
||||
*/
|
||||
private ArrayList<Object> getOneRowEventTimesData(List<Object> firstRow, double[] amplitudeRange, double[][] durationTime, List<String> lineIds, String beginDate, String endDate) {
|
||||
ArrayList<Object> rList = new ArrayList<Object>();
|
||||
private ArrayList<Object> getOneRowEventTimesData(List<Object> firstRow, double[] amplitudeRange, List<String> lineIds, String beginDate, String endDate) {
|
||||
ArrayList<Object> rList = new ArrayList<>();
|
||||
rList.add(NumberUtil.format(amplitudeRange[0] * 0.01, "0.0") + "~" + NumberUtil.format(amplitudeRange[1] * 0.01, "0.0"));
|
||||
for (double[] durationTimeRange : durationTime) {
|
||||
for (double[] durationTimeRange : SgEventServiceImpl.DURATION_TIME) {
|
||||
if (firstRow != null) {
|
||||
firstRow.add(NumberUtil.format(durationTimeRange[0] * 0.001, "0.00") + "~" + NumberUtil.format(durationTimeRange[1] * 0.001, "0.00"));
|
||||
}
|
||||
@@ -657,11 +647,7 @@ public class SgEventServiceImpl extends ServiceImpl<SgEventMapper, SgEvent> impl
|
||||
LocalDateTime begin = mainEvent.getStartTime();
|
||||
LocalDateTime end = LocalDateTimeUtil.offset(begin, mainEvent.getDuration().longValue(), ChronoUnit.MILLIS);
|
||||
LocalDateTime target = backUpEvent.getStartTime();
|
||||
if (!target.isBefore(begin) && !target.isAfter(end)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return !target.isBefore(begin) && !target.isAfter(end);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -674,11 +660,8 @@ public class SgEventServiceImpl extends ServiceImpl<SgEventMapper, SgEvent> impl
|
||||
private List<SgEvent> processTimeResponse(List<SgEvent> mainEvents, List<SgEvent> backupEvents, int timeResponse) {
|
||||
List<SgEvent> rList = new ArrayList<>();
|
||||
for (SgEvent a : mainEvents) {
|
||||
boolean bol = false;
|
||||
boolean bol = timeResponse > a.getDuration();
|
||||
// 考虑响应时间
|
||||
if (timeResponse > a.getDuration()) {
|
||||
bol = true;
|
||||
}
|
||||
if (bol) {
|
||||
rList.add(a);
|
||||
}
|
||||
@@ -710,7 +693,7 @@ public class SgEventServiceImpl extends ServiceImpl<SgEventMapper, SgEvent> impl
|
||||
* @param eventList 暂降事件集合
|
||||
*/
|
||||
private Map<Integer[], Integer> fillMap(List<SgEvent> eventList) {
|
||||
Map<Integer[], Integer> rMap = new HashMap<>();
|
||||
Map<Integer[], Integer> rMap = new HashMap<>(16);
|
||||
for (SgEvent event : eventList) {
|
||||
Integer[] key = getKey(event.getDuration(), event.getFeatureAmplitude());
|
||||
if (rMap.containsKey(key)) {
|
||||
@@ -737,9 +720,8 @@ public class SgEventServiceImpl extends ServiceImpl<SgEventMapper, SgEvent> impl
|
||||
key[0] = t2;
|
||||
}
|
||||
}
|
||||
double eTime = eventDurationTime;
|
||||
for (double[] a : DURATION_TIME) {
|
||||
if (eTime > a[0] && eTime <= a[1]) {
|
||||
if (eventDurationTime > a[0] && eventDurationTime <= a[1]) {
|
||||
Integer t1 = DURATION_TIME_KEY_MAP.get(a);
|
||||
key[1] = t1;
|
||||
}
|
||||
|
||||
@@ -10,9 +10,7 @@ import com.njcn.advance.mapper.govern.voltage.SgGovernSchemeHistoryMapper;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.SgGovernSchemeHistoryParam;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgGovernSchemeHistory;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgProductLine;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgUser;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgGovernSchemeHistoryVO;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgProductLineVO;
|
||||
import com.njcn.advance.service.govern.voltage.ISgGovernSchemeHistoryService;
|
||||
import com.njcn.advance.service.govern.voltage.ISgProductLineService;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
@@ -69,9 +67,7 @@ public class SgGovernSchemeHistoryServiceImpl extends ServiceImpl<SgGovernScheme
|
||||
}
|
||||
queryWrapper.eq("sg_govern_scheme_history.state", DataStateEnum.ENABLE.getCode());
|
||||
queryWrapper.orderByDesc("sg_govern_scheme_history.create_time");
|
||||
Page<SgGovernSchemeHistoryVO> data = this.baseMapper.page(new Page<>(PageFactory.getPageNum(sgSchemeHistoryQueryParam), PageFactory.getPageSize(sgSchemeHistoryQueryParam)), queryWrapper);
|
||||
|
||||
return data;
|
||||
return this.baseMapper.page(new Page<>(PageFactory.getPageNum(sgSchemeHistoryQueryParam), PageFactory.getPageSize(sgSchemeHistoryQueryParam)), queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,9 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.advance.enums.AdvanceResponseEnum;
|
||||
import com.njcn.advance.mapper.govern.voltage.SgIncomingLineMapper;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.IncomingLineParam;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.SgUserParam;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgIncomingLine;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgUser;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.IncomingLineVO;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgOption;
|
||||
import com.njcn.advance.service.govern.voltage.ISgIncomingLineService;
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.njcn.advance.service.govern.voltage.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -11,15 +10,11 @@ import com.njcn.advance.enums.AdvanceResponseEnum;
|
||||
import com.njcn.advance.mapper.govern.voltage.SgProductLineMapper;
|
||||
import com.njcn.advance.pojo.dto.govern.voltage.ProductLineComputeData;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.SgProductLineParam;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.SgUserParam;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgMachine;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgProductLine;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgSensitiveUnit;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgUser;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgMachineVO;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgProductLineVO;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgSensitiveUnitVO;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgUserVO;
|
||||
import com.njcn.advance.service.govern.voltage.ISgMachineService;
|
||||
import com.njcn.advance.service.govern.voltage.ISgProductLineService;
|
||||
import com.njcn.advance.service.govern.voltage.ISgSensitiveUnitService;
|
||||
@@ -27,7 +22,6 @@ import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.poi.util.StringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -8,9 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.advance.enums.AdvanceResponseEnum;
|
||||
import com.njcn.advance.mapper.govern.voltage.SgSensitiveUnitMapper;
|
||||
import com.njcn.advance.pojo.param.govern.voltage.SgSensitiveUnitParam;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgMachine;
|
||||
import com.njcn.advance.pojo.po.govern.voltage.SgSensitiveUnit;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgMachineVO;
|
||||
import com.njcn.advance.pojo.vo.govern.voltage.SgSensitiveUnitVO;
|
||||
import com.njcn.advance.service.govern.voltage.ISgSensitiveUnitService;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
|
||||
@@ -3,10 +3,11 @@ package com.njcn.advance.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.date.TimeInterval;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.SerializeUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
@@ -16,7 +17,7 @@ import com.njcn.advance.enums.AdvanceResponseEnum;
|
||||
import com.njcn.advance.mapper.RelevantLogMapper;
|
||||
import com.njcn.advance.mapper.RmpEventAdvanceMapper;
|
||||
import com.njcn.advance.mapper.RmpEventDetailAssMapper;
|
||||
import com.njcn.advance.pojo.dto.SagEvent;
|
||||
|
||||
import com.njcn.advance.pojo.dto.relevent.*;
|
||||
import com.njcn.advance.pojo.po.PqsRelevanceLog;
|
||||
import com.njcn.advance.service.EventRelevantAnalysisService;
|
||||
@@ -27,29 +28,30 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.pojo.po.PqsTflgployass;
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.event.api.RmpEventDetailFeignClient;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailAssPO;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.event.pojo.vo.AdvanceEventDetailVO;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.enums.SystemResponseEnum;
|
||||
import com.njcn.system.pojo.po.Area;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
@@ -67,7 +69,8 @@ import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanceMapper, RmpEventDetailPO> implements EventRelevantAnalysisService {
|
||||
|
||||
private final RmpEventDetailFeignClient rmpEventDetailFeignClient;
|
||||
private final String redisSortKey = "NODESORT";
|
||||
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
@@ -83,6 +86,8 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
|
||||
private final UserFeignClient userFeignClient;
|
||||
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -90,99 +95,92 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
|
||||
TimeInterval timeInterval = new TimeInterval();
|
||||
|
||||
DictData dictData = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.EVENT_REASON.getName(), DicDataEnum.SHORT_TROUBLE.getName()).getData();
|
||||
if (Objects.isNull(dictData)) {
|
||||
throw new BusinessException(SystemResponseEnum.ADVANCE_REASON);
|
||||
}
|
||||
|
||||
|
||||
LocalDateTime date = LocalDateTime.now();
|
||||
HandleEvent handleEvent = new HandleEvent();
|
||||
// 分析的事件进行处理
|
||||
List<EntityGroupEvtData> baseList = handleEvent.getData(startTime, endTime);
|
||||
if(CollectionUtil.isEmpty(baseList)){
|
||||
if (CollectionUtil.isEmpty(baseList)) {
|
||||
throw new BusinessException("当前时间段暂无可分析事件");
|
||||
}
|
||||
List<EntityGroupEvtData> list3 = new ArrayList<>(baseList);
|
||||
|
||||
// 传入的处理事件根据物理隔绝进行分组
|
||||
|
||||
List<EntityLogic> strategyList = relevantLogMapper.getLogic();
|
||||
|
||||
if (CollectionUtil.isNotEmpty(strategyList)) {
|
||||
List<SagEvent> listSagEvent = new ArrayList<>();
|
||||
List<EventAssObj> listEventAssObj = new ArrayList<>();
|
||||
Map<String, EntityMtrans> entityMtransMap = getNodeInfo();
|
||||
Set<Map.Entry<String, EntityMtrans>> setMtrans = entityMtransMap.entrySet();
|
||||
|
||||
Map<String, List<String>> strategyToBusBarMap = new HashMap<>();
|
||||
List<SagEvent> listSagEvent = new ArrayList<>();
|
||||
List<EventAssObj> listEventAssObj = new ArrayList<>();
|
||||
|
||||
Map<String, EntityMtrans> mapRedis = new HashMap<>();
|
||||
Map<String, Map<String, Integer>> nodeMap = (Map<String, Map<String, Integer>>)redisUtil.getObjectByKey(redisSortKey);
|
||||
Set<Map.Entry<String, Map<String, Integer>>> nodeSort = nodeMap.entrySet();
|
||||
|
||||
Map<String, List<EntityLogic>> strategyMap = strategyList.stream().collect(Collectors.groupingBy(EntityLogic::getTPIndex));
|
||||
strategyMap.forEach((key, list) -> {
|
||||
List<String> before = list.stream().map(EntityLogic::getNodeBefore).distinct().collect(Collectors.toList());
|
||||
List<String> after = list.stream().map(EntityLogic::getNodeNext).distinct().collect(Collectors.toList());
|
||||
before.addAll(after);
|
||||
before = before.stream().distinct().collect(Collectors.toList());
|
||||
strategyToBusBarMap.put(key, before);
|
||||
|
||||
FinalData.NODE_NUM = before.size();
|
||||
EntityMtrans entityMtrans = new EntityMtrans();
|
||||
handleEvent.create_matrixcata(list, entityMtrans);
|
||||
DictData dictData = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.EVENT_REASON.getName(), DicDataEnum.SHORT_TROUBLE.getName()).getData();
|
||||
if (Objects.isNull(dictData)) {
|
||||
throw new BusinessException(SystemResponseEnum.ADVANCE_REASON);
|
||||
}
|
||||
|
||||
mapRedis.put(key, entityMtrans);
|
||||
});
|
||||
for (Map.Entry<String, Map<String, Integer>> m : nodeSort) {
|
||||
List<EntityGroupEvtData> list = new ArrayList<EntityGroupEvtData>();
|
||||
Set<Map.Entry<String, Integer>> mapValue = m.getValue().entrySet();
|
||||
FinalData.NODE_NUM = m.getValue().size();
|
||||
|
||||
strategyToBusBarMap.forEach((lastKey, lastVal) -> {
|
||||
int index = 1;
|
||||
List<EntityGroupEvtData> list = new ArrayList<EntityGroupEvtData>();
|
||||
for (EntityGroupEvtData entityGroupEvtData : baseList) {
|
||||
if (lastVal.contains(entityGroupEvtData.getNodePhysics()) && dictData.getId().equals(entityGroupEvtData.getSagReason())) {
|
||||
entityGroupEvtData.setNode(index++);
|
||||
list.add(entityGroupEvtData);
|
||||
for (Map.Entry<String, Integer> mm : mapValue) {
|
||||
for (EntityGroupEvtData groupEvtData : baseList) {
|
||||
if (groupEvtData.getNodePhysics().equals(mm.getKey()) && dictData.getId().equals(groupEvtData.getSagReason())) {
|
||||
groupEvtData.setNode(mm.getValue());
|
||||
list.add(groupEvtData);
|
||||
}
|
||||
}
|
||||
|
||||
baseList.removeIf(entityGroupEvtData -> lastVal.contains(entityGroupEvtData.getNodePhysics()) && dictData.getId().equals(entityGroupEvtData.getSagReason()));
|
||||
// 筛选不在矩阵中的事件id
|
||||
list3.removeIf(entityGroupEvtData -> entityGroupEvtData.getNodePhysics().equals(mm.getKey()) && dictData.getId().equals(entityGroupEvtData.getSagReason()));
|
||||
}
|
||||
|
||||
EntityGroupEvtData[] entityGroupEvtData = new EntityGroupEvtData[list.size()];
|
||||
Collections.sort(list);
|
||||
list.toArray(entityGroupEvtData);
|
||||
|
||||
EntityGroupEvtData[] entityGroupEvtData = new EntityGroupEvtData[list.size()];
|
||||
Collections.sort(list);
|
||||
list.toArray(entityGroupEvtData);
|
||||
for (Map.Entry<String, EntityMtrans> mEntry : setMtrans) {
|
||||
if (mEntry.getKey().equals(m.getKey())) {
|
||||
|
||||
mapRedis.forEach((mKey, mVal) -> {
|
||||
if (mKey.equals(lastKey)) {
|
||||
/********************************************************************
|
||||
* 算法最多处理1000条数据,超过限制需分批处理 先将数据根据某种方式进行升序/降序排序,然后分段处理 加入循环处理
|
||||
*********************************************************************/
|
||||
int circulation = entityGroupEvtData.length % FinalData.MAX_EVT_NUM == 0
|
||||
? entityGroupEvtData.length / FinalData.MAX_EVT_NUM
|
||||
: entityGroupEvtData.length / FinalData.MAX_EVT_NUM + 1;
|
||||
//算法最多处理1000条数据,超过限制需分批处理 先将数据根据某种方式进行升序/降序排序,然后分段处理 加入循环处理
|
||||
|
||||
for (int i = 0; i < circulation; i++) {
|
||||
int to = 0;
|
||||
int circulation = entityGroupEvtData.length % FinalData.MAX_EVT_NUM == 0
|
||||
? entityGroupEvtData.length / FinalData.MAX_EVT_NUM
|
||||
: entityGroupEvtData.length / FinalData.MAX_EVT_NUM + 1;
|
||||
|
||||
if (i == circulation - 1) {
|
||||
to = entityGroupEvtData.length % FinalData.MAX_EVT_NUM > 0
|
||||
? entityGroupEvtData.length
|
||||
: (i + 1) * FinalData.MAX_EVT_NUM - 1;
|
||||
} else {
|
||||
to = (i + 1) * FinalData.MAX_EVT_NUM - 1;
|
||||
}
|
||||
for (int i = 0; i < circulation; i++) {
|
||||
int to = 0;
|
||||
|
||||
EntityGroupEvtData[] arrayObj = Arrays.copyOfRange(entityGroupEvtData,
|
||||
i * FinalData.MAX_EVT_NUM, to);
|
||||
EntityGroupData entityGroupData = handleEvent.translate(arrayObj, mVal);
|
||||
// 处理分析结果
|
||||
handleEvent.show_group_info(entityGroupData, listSagEvent, listEventAssObj, date);
|
||||
if (i == circulation - 1) {
|
||||
to = entityGroupEvtData.length % FinalData.MAX_EVT_NUM > 0
|
||||
? entityGroupEvtData.length
|
||||
: (i + 1) * FinalData.MAX_EVT_NUM - 1;
|
||||
} else {
|
||||
to = (i + 1) * FinalData.MAX_EVT_NUM - 1;
|
||||
}
|
||||
|
||||
EntityGroupEvtData[] arrayObj = Arrays.copyOfRange(entityGroupEvtData,
|
||||
i * FinalData.MAX_EVT_NUM, to);
|
||||
EntityMtrans entityMtrans = mEntry.getValue();
|
||||
EntityGroupData entityGroupData = handleEvent.translate(arrayObj,entityMtrans);
|
||||
// 处理分析结果
|
||||
handleEvent.show_group_info(entityGroupData, listSagEvent, listEventAssObj, date);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* 事件ID不在矩阵中,结果集为基础以时标为标准进行归集处理 注意:三相与(单相/两相)互斥
|
||||
*****************************************************************************/
|
||||
disposeNonStandardData(handleEvent, baseList, listEventAssObj, listSagEvent, date);
|
||||
|
||||
|
||||
@@ -222,13 +220,232 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
entityPqsRelevance.setTimeId(date);
|
||||
relevantLogMapper.insert(entityPqsRelevance);
|
||||
|
||||
}else {
|
||||
throw new BusinessException("当前无变压器策略,请先配置策略");
|
||||
}
|
||||
|
||||
|
||||
log.info("事件关联分析用时:" + timeInterval.interval() / 1000 + "秒");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// @Override
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
// public void processEvents(LocalDateTime startTime, LocalDateTime endTime) {
|
||||
//
|
||||
// TimeInterval timeInterval = new TimeInterval();
|
||||
//
|
||||
//
|
||||
// Map<String, Map<String, Integer>> nodeSort = new HashMap<>();
|
||||
// Map<String, EntityMtrans> entityMtransMap = getNodeInfo();
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// for (Map.Entry<String, Map<String, Integer>> m : nodeSort) {
|
||||
// List<EntityGroupEvtData> list = new ArrayList<EntityGroupEvtData>();
|
||||
// Set<Map.Entry<String, Integer>> mapValue = m.getValue().entrySet();
|
||||
// FinalData.NODE_NUM = m.getValue().size();
|
||||
//
|
||||
// for (Map.Entry<String, Integer> mm : mapValue) {
|
||||
// for (int i = 0; i < entityGroupEvtDatas.length; i++) {
|
||||
// if (entityGroupEvtDatas[i].getNodePhysics() == mm.getKey().intValue() && "短路故障".equals(entityGroupEvtDatas[i].getSagReason())) {
|
||||
// entityGroupEvtDatas[i].setNode(mm.getValue());
|
||||
// list.add(entityGroupEvtDatas[i]);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 筛选不在矩阵中的事件id
|
||||
// Iterator<EntityGroupEvtData> iterator = list3.iterator();
|
||||
// while (iterator.hasNext()) {
|
||||
// EntityGroupEvtData entityGroupEvtData = iterator.next();
|
||||
//
|
||||
// if (entityGroupEvtData.getNodePhysics() == mm.getKey().intValue() && "短路故障".equals(entityGroupEvtData.getSagReason())) {
|
||||
// iterator.remove();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// EntityGroupEvtData[] entityGroupEvtData = new EntityGroupEvtData[list.size()];
|
||||
// Collections.sort(list);
|
||||
// list.toArray(entityGroupEvtData);
|
||||
//
|
||||
// for (Map.Entry<String, JSONObject> mEntry : setMtrans) {
|
||||
// if (mEntry.getKey().equals(m.getKey())) {
|
||||
// *//**//********************************************************************
|
||||
// * 算法最多处理1000条数据,超过限制需分批处理 先将数据根据某种方式进行升序/降序排序,然后分段处理 加入循环处理
|
||||
// *********************************************************************//**//*
|
||||
// int circulation = entityGroupEvtData.length % FinalData.MAX_EVT_NUM == 0
|
||||
// ? entityGroupEvtData.length / FinalData.MAX_EVT_NUM
|
||||
// : entityGroupEvtData.length / FinalData.MAX_EVT_NUM + 1;
|
||||
//
|
||||
// for (int i = 0; i < circulation; i++) {
|
||||
// int to = 0;
|
||||
//
|
||||
// if (i == circulation - 1) {
|
||||
// to = entityGroupEvtData.length % FinalData.MAX_EVT_NUM > 0
|
||||
// ? entityGroupEvtData.length
|
||||
// : (i + 1) * FinalData.MAX_EVT_NUM - 1;
|
||||
// } else {
|
||||
// to = (i + 1) * FinalData.MAX_EVT_NUM - 1;
|
||||
// }
|
||||
//
|
||||
// EntityGroupEvtData[] arrayObj = Arrays.copyOfRange(entityGroupEvtData,
|
||||
// i * FinalData.MAX_EVT_NUM, to);
|
||||
// JSONObject entityMtrans = mEntry.getValue();
|
||||
// EntityGroupData entityGroupData = handleEvent.translate(arrayObj, (EntityMtrans) JSONObject.toBean(entityMtrans, EntityMtrans.class));
|
||||
// // 处理分析结果
|
||||
// handleEvent.show_group_info(entityGroupData, listSagEvent, listEventAssObj, date);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// DictData dictData = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.EVENT_REASON.getName(), DicDataEnum.SHORT_TROUBLE.getName()).getData();
|
||||
// if (Objects.isNull(dictData)) {
|
||||
// throw new BusinessException(SystemResponseEnum.ADVANCE_REASON);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// LocalDateTime date = LocalDateTime.now();
|
||||
// HandleEvent handleEvent = new HandleEvent();
|
||||
// // 分析的事件进行处理
|
||||
// List<EntityGroupEvtData> baseList = handleEvent.getData(startTime, endTime);
|
||||
// if (CollectionUtil.isEmpty(baseList)) {
|
||||
// throw new BusinessException("当前时间段暂无可分析事件");
|
||||
// }
|
||||
//
|
||||
// // 传入的处理事件根据物理隔绝进行分组
|
||||
//
|
||||
// List<EntityLogic> strategyList = relevantLogMapper.getLogic();
|
||||
//
|
||||
// if (CollectionUtil.isNotEmpty(strategyList)) {
|
||||
// List<SagEvent> listSagEvent = new ArrayList<>();
|
||||
// List<EventAssObj> listEventAssObj = new ArrayList<>();
|
||||
//
|
||||
// Map<String, List<String>> strategyToBusBarMap = new HashMap<>(32);
|
||||
//
|
||||
// Map<String, EntityMtrans> mapRedis = new HashMap<>(32);
|
||||
//
|
||||
// Map<String, List<EntityLogic>> strategyMap = strategyList.stream().collect(Collectors.groupingBy(EntityLogic::getTPIndex));
|
||||
// strategyMap.forEach((key, list) -> {
|
||||
// List<String> before = list.stream().map(EntityLogic::getNodeBefore).distinct().collect(Collectors.toList());
|
||||
// List<String> after = list.stream().map(EntityLogic::getNodeNext).distinct().collect(Collectors.toList());
|
||||
// before.addAll(after);
|
||||
// before = before.stream().distinct().collect(Collectors.toList());
|
||||
// strategyToBusBarMap.put(key, before);
|
||||
//
|
||||
// FinalData.NODE_NUM = before.size();
|
||||
// EntityMtrans entityMtrans = new EntityMtrans();
|
||||
// handleEvent.create_matrixcata(list, entityMtrans);
|
||||
//
|
||||
// mapRedis.put(key, entityMtrans);
|
||||
// });
|
||||
//
|
||||
// strategyToBusBarMap.forEach((lastKey, lastVal) -> {
|
||||
// int index = 1;
|
||||
// List<EntityGroupEvtData> list = new ArrayList<>();
|
||||
// for (EntityGroupEvtData entityGroupEvtData : baseList) {
|
||||
// if (lastVal.contains(entityGroupEvtData.getNodePhysics()) && dictData.getId().equals(entityGroupEvtData.getSagReason())) {
|
||||
// entityGroupEvtData.setNode(index++);
|
||||
// list.add(entityGroupEvtData);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// baseList.removeIf(entityGroupEvtData -> lastVal.contains(entityGroupEvtData.getNodePhysics()) && dictData.getId().equals(entityGroupEvtData.getSagReason()));
|
||||
//
|
||||
//
|
||||
// EntityGroupEvtData[] entityGroupEvtData = new EntityGroupEvtData[list.size()];
|
||||
// Collections.sort(list);
|
||||
// list.toArray(entityGroupEvtData);
|
||||
//
|
||||
// mapRedis.forEach((mKey, mVal) -> {
|
||||
// if (mKey.equals(lastKey)) {
|
||||
// //算法最多处理1000条数据,超过限制需分批处理 先将数据根据某种方式进行升序/降序排序,然后分段处理 加入循环处理
|
||||
// int circulation = entityGroupEvtData.length % FinalData.MAX_EVT_NUM == 0
|
||||
// ? entityGroupEvtData.length / FinalData.MAX_EVT_NUM
|
||||
// : entityGroupEvtData.length / FinalData.MAX_EVT_NUM + 1;
|
||||
//
|
||||
// for (int i = 0; i < circulation; i++) {
|
||||
// int to;
|
||||
// if (i == circulation - 1) {
|
||||
// to = entityGroupEvtData.length % FinalData.MAX_EVT_NUM > 0
|
||||
// ? entityGroupEvtData.length
|
||||
// : (i + 1) * FinalData.MAX_EVT_NUM - 1;
|
||||
// } else {
|
||||
// to = (i + 1) * FinalData.MAX_EVT_NUM - 1;
|
||||
// }
|
||||
//
|
||||
// EntityGroupEvtData[] arrayObj = Arrays.copyOfRange(entityGroupEvtData,
|
||||
// i * FinalData.MAX_EVT_NUM, to);
|
||||
// EntityGroupData entityGroupData = handleEvent.translate(arrayObj, mVal);
|
||||
// // 处理分析结果
|
||||
// handleEvent.show_group_info(entityGroupData, listSagEvent, listEventAssObj, date);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// });
|
||||
//
|
||||
//
|
||||
//
|
||||
// //事件ID不在矩阵中,结果集为基础以时标为标准进行归集处理 注意:三相与(单相/两相)互斥
|
||||
//
|
||||
// disposeNonStandardData(handleEvent, baseList, listEventAssObj, listSagEvent, date);
|
||||
//
|
||||
//
|
||||
// int listSize = listEventAssObj.size();
|
||||
// int toIndex = 1000;
|
||||
// for (int i = 0; i < listSize; i += 1000) {
|
||||
// //作用为toIndex最后没有toIndex条数据则剩余几条newList中就装几条
|
||||
// if (i + 1000 > listSize) {
|
||||
// toIndex = listSize - i;
|
||||
// }
|
||||
// //分割lst
|
||||
// List<EventAssObj> newList = listEventAssObj.subList(i, i + toIndex);
|
||||
// //写入添加方法,需要写你的新增方法,把newList分切后的数据新增进入数据库。
|
||||
// rmpEventDetailAssMapper.insertEventAssData(newList);
|
||||
// }
|
||||
//
|
||||
// List<RmpEventDetailPO> eventUpdateList = new ArrayList<>();
|
||||
// for (int i = 0; i < listSagEvent.size(); i++) {
|
||||
// RmpEventDetailPO rmp = new RmpEventDetailPO();
|
||||
// rmp.setEventId(listSagEvent.get(i).getIndexEventDetail());
|
||||
// rmp.setEventassIndex(listSagEvent.get(i).getIndexEventAss());
|
||||
// rmp.setDealTime(listSagEvent.get(i).getDealTime());
|
||||
// eventUpdateList.add(rmp);
|
||||
// if ((i + 1) % 1000 == 0) {
|
||||
// this.updateBatchById(eventUpdateList);
|
||||
// eventUpdateList.clear();
|
||||
// } else if (i == listSagEvent.size() - 1) {
|
||||
// this.updateBatchById(eventUpdateList);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 增加策略记录
|
||||
// String describe = "用户" + RequestUtil.getUserNickname() + "进行了关联分析";
|
||||
// PqsRelevanceLog entityPqsRelevance = new PqsRelevanceLog();
|
||||
// entityPqsRelevance.setContentDes(describe);
|
||||
// entityPqsRelevance.setState(DataStateEnum.ENABLE.getCode());
|
||||
// entityPqsRelevance.setTimeId(date);
|
||||
// relevantLogMapper.insert(entityPqsRelevance);
|
||||
//
|
||||
// } else {
|
||||
// throw new BusinessException("当前无变压器策略,请先配置策略");
|
||||
// }
|
||||
//
|
||||
// log.info("事件关联分析用时:" + timeInterval.interval() / 1000 + "秒");
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Page<AdvanceEventDetailVO> querySagEventsPage(BaseParam baseParam) {
|
||||
List<String> lineIds = generalDeviceInfoClient.deptGetRunLineEvent(RequestUtil.getDeptIndex()).getData();
|
||||
@@ -281,10 +498,12 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
public Page<RmpEventDetailAssPO> queryEventsAssPage(BaseParam baseParam) {
|
||||
List<LocalDateTime> timeV = PubUtils.checkLocalDate(baseParam.getSearchBeginTime(), baseParam.getSearchEndTime());
|
||||
LambdaQueryWrapper<RmpEventDetailAssPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StrUtil.isNotBlank(baseParam.getSearchValue())) {
|
||||
lambdaQueryWrapper.like(RmpEventDetailAssPO::getContentDes, baseParam.getSearchValue());
|
||||
}
|
||||
lambdaQueryWrapper.between(RmpEventDetailAssPO::getTimeId, timeV.get(0), timeV.get(1))
|
||||
.orderByAsc(RmpEventDetailAssPO::getTimeId);
|
||||
Page<RmpEventDetailAssPO> page = rmpEventDetailAssMapper.selectPage(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), lambdaQueryWrapper);
|
||||
return page;
|
||||
return rmpEventDetailAssMapper.selectPage(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -359,7 +578,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
@Override
|
||||
public List<AdvanceEventDetailVO> queryEventList(List<String> eventId) {
|
||||
LambdaQueryWrapper<RmpEventDetailPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(RmpEventDetailPO::getEventId,eventId);
|
||||
lambdaQueryWrapper.in(RmpEventDetailPO::getEventId, eventId);
|
||||
List<RmpEventDetailPO> rmpEventDetailPOList = eventAdvanceMapper.selectList(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isEmpty(rmpEventDetailPOList)) {
|
||||
throw new BusinessException(AdvanceResponseEnum.EVENT_EMPTY);
|
||||
@@ -477,24 +696,24 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
|
||||
|
||||
class HandleEvent {
|
||||
public EntityGroupData translate(EntityGroupEvtData entityGroupEvtData[], EntityMtrans entityMtrans) {
|
||||
public EntityGroupData translate(EntityGroupEvtData[] entityGroupEvtData, EntityMtrans entityMtrans) {
|
||||
// 获取测试数据的数组长度
|
||||
int test_log_num = entityGroupEvtData.length;
|
||||
int testLogNum = entityGroupEvtData.length;
|
||||
|
||||
// 实例化EntityGroupData,给其中的数组分配空间
|
||||
EntityGroupData group_buf = new EntityGroupData();
|
||||
EntityGroupData groupBuf = new EntityGroupData();
|
||||
|
||||
// 填入日志
|
||||
setMatrixcata(group_buf, entityMtrans);
|
||||
create_evt_buf(entityGroupEvtData, group_buf, test_log_num);
|
||||
setMatrixcata(groupBuf, entityMtrans);
|
||||
create_evt_buf(entityGroupEvtData, groupBuf, testLogNum);
|
||||
|
||||
UtilNormalization.sort_Tstart(group_buf); // 根据时标进行划分
|
||||
UtilNormalization.sort_Tstart(groupBuf); // 根据时标进行划分
|
||||
// 根据暂降类型进行划分
|
||||
for (int i = 0; i < group_buf.getGrp_all_num(); i++) {
|
||||
UtilNormalization.sort_cata(group_buf, i);
|
||||
for (int i = 0; i < groupBuf.getGrp_all_num(); i++) {
|
||||
UtilNormalization.sort_cata(groupBuf, i);
|
||||
}
|
||||
|
||||
return group_buf;
|
||||
return groupBuf;
|
||||
}
|
||||
|
||||
public List<EntityGroupEvtData> getData(LocalDateTime startTime, LocalDateTime endTime) {
|
||||
@@ -506,52 +725,46 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
List<AdvanceEventDetailVO> advanceEventDetailVOLsit = querySagEventsAll(startTime, endTime);
|
||||
|
||||
|
||||
for (int i = 0; i < advanceEventDetailVOLsit.size(); i++) { // 获取监测点线路序号
|
||||
for (AdvanceEventDetailVO advanceEventDetailVO : advanceEventDetailVOLsit) { // 获取监测点线路序号
|
||||
//母线id
|
||||
String nodePhysics = advanceEventDetailVOLsit.get(i).getVoltageId();
|
||||
String nodePhysics = advanceEventDetailVO.getVoltageId();
|
||||
|
||||
// 根据暂降类型获取高级算法对应的编号
|
||||
int cata = 0;
|
||||
long ll = 0L;
|
||||
int start_time = 0;
|
||||
int cata;
|
||||
long ll;
|
||||
int startTimeTemp;
|
||||
|
||||
if (Objects.isNull(advanceEventDetailVOLsit.get(i).getFirstType())) {
|
||||
cata = advanceMap.get(advanceEventDetailVOLsit.get(i).getAdvanceType()).getAlgoDescribe();
|
||||
ll = (long) (Timestamp.valueOf(advanceEventDetailVOLsit.get(i).getStartTime()).getTime()
|
||||
+ (advanceEventDetailVOLsit.get(i).getDuration() * 1000));
|
||||
start_time = (int) (ll / 1000);
|
||||
if (Objects.isNull(advanceEventDetailVO.getFirstType())) {
|
||||
cata = advanceMap.get(advanceEventDetailVO.getAdvanceType()).getAlgoDescribe();
|
||||
ll = (long) (Timestamp.valueOf(advanceEventDetailVO.getStartTime()).getTime()
|
||||
+ (advanceEventDetailVO.getDuration() * 1000));
|
||||
startTimeTemp = (int) (ll / 1000);
|
||||
} else {
|
||||
cata = advanceMap.get(advanceEventDetailVOLsit.get(i).getAdvanceType()).getAlgoDescribe(); // 获取类型
|
||||
ll = (long) (Timestamp.valueOf(advanceEventDetailVOLsit.get(i).getFirstTime()).getTime()
|
||||
+ (advanceEventDetailVOLsit.get(i).getFirstMs()));
|
||||
start_time = (int) (ll / 1000);
|
||||
cata = advanceMap.get(advanceEventDetailVO.getAdvanceType()).getAlgoDescribe(); // 获取类型
|
||||
ll = (long) (Timestamp.valueOf(advanceEventDetailVO.getFirstTime()).getTime()
|
||||
+ (advanceEventDetailVO.getFirstMs()));
|
||||
startTimeTemp = (int) (ll / 1000);
|
||||
}
|
||||
|
||||
// 填充SagEvent对象数据
|
||||
SagEvent sagEvent = new SagEvent();
|
||||
|
||||
sagEvent.setIndexEventDetail(advanceEventDetailVOLsit.get(i).getEventId());
|
||||
sagEvent.setSagTime(advanceEventDetailVOLsit.get(i).getStartTime());
|
||||
sagEvent.setIndexEventDetail(advanceEventDetailVO.getEventId());
|
||||
sagEvent.setSagTime(advanceEventDetailVO.getStartTime());
|
||||
sagEvent.setFirstTime(PubUtils.ms2Date(ll));// 必须增加,否则序列化出错
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
/*String tem = advanceEventDetailVOLsit.get(i).getFirstTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
sagEvent.setStrTime(tem + "."
|
||||
+ advanceEventDetailVOLsit.get(i).getFirstMs());*/
|
||||
sagEvent.setTime(Timestamp.valueOf(advanceEventDetailVOLsit.get(i).getStartTime()).getTime());
|
||||
sagEvent.setTime(Timestamp.valueOf(advanceEventDetailVO.getStartTime()).getTime());
|
||||
sagEvent.setFirstTimeMills(ll);
|
||||
sagEvent.setMsec(advanceEventDetailVOLsit.get(i).getDuration().intValue());
|
||||
//sagEvent.setSagTime(PubUtils.ms2Date(Timestamp.valueOf(advanceEventDetailVOLsit.get(i).getFirstTime()).getTime()));
|
||||
sagEvent.setMsec(advanceEventDetailVO.getDuration().intValue());
|
||||
PlantInfo plantInfo = new PlantInfo();
|
||||
plantInfo.setNameBD(advanceEventDetailVOLsit.get(i).getSubName());
|
||||
plantInfo.setNameGD(advanceEventDetailVOLsit.get(i).getGdName());
|
||||
plantInfo.setNamePoint(advanceEventDetailVOLsit.get(i).getLineId());
|
||||
plantInfo.setNameBD(advanceEventDetailVO.getSubName());
|
||||
plantInfo.setNameGD(advanceEventDetailVO.getGdName());
|
||||
plantInfo.setNamePoint(advanceEventDetailVO.getLineId());
|
||||
sagEvent.setPlantInfo(plantInfo);
|
||||
sagEvent.setIndexPoint(advanceEventDetailVOLsit.get(i).getLineId());
|
||||
sagEvent.setIndexPoint(advanceEventDetailVO.getLineId());
|
||||
sagEvent.setCata(cata);
|
||||
|
||||
|
||||
EntityGroupEvtData entityGroupEvtData = new EntityGroupEvtData(nodePhysics, start_time, cata, -1, sagEvent, advanceEventDetailVOLsit.get(i).getAdvanceReason());
|
||||
EntityGroupEvtData entityGroupEvtData = new EntityGroupEvtData(nodePhysics, startTimeTemp, cata, -1, sagEvent, advanceEventDetailVO.getAdvanceReason());
|
||||
entityGroupEvtDataList.add(entityGroupEvtData);
|
||||
}
|
||||
|
||||
@@ -589,7 +802,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
int i, j, k;
|
||||
for (i = 0; i < obj.getGrp_all_num(); i++) {
|
||||
String strUUID = IdUtil.simpleUUID();
|
||||
List<SagEvent> listTem = new ArrayList<SagEvent>();
|
||||
List<SagEvent> listTem = new ArrayList<>();
|
||||
|
||||
for (j = 0; j < FinalData.MAX_CATA_NUM + 2; j++) {
|
||||
if (obj.getGrp_cata_num()[i][j] != 0) {
|
||||
@@ -602,7 +815,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
}
|
||||
}
|
||||
|
||||
if (listTem.size() > 0) {
|
||||
if (!listTem.isEmpty()) {
|
||||
processing(listTem, assEvent, date);
|
||||
}
|
||||
}
|
||||
@@ -645,30 +858,116 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
/*************************************************************************************
|
||||
* 获取变压器信息并生成矩阵
|
||||
*************************************************************************************/
|
||||
public void getNodeInfo(HandleEvent handleEvent) {
|
||||
public Map<String, EntityMtrans> getNodeInfo( ) {
|
||||
Map<String, EntityMtrans> entityMtranMap = new HashMap<>(32);
|
||||
|
||||
HandleEvent handleEvent = new HandleEvent();
|
||||
List<EntityLogic> list = relevantLogMapper.getLogic();
|
||||
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
Map<String, List<EntityLogic>> tfMap = list.stream().collect(Collectors.groupingBy(EntityLogic::getTPIndex));
|
||||
Map<String, List<String>> tfBusBarMap = new HashMap<>();
|
||||
|
||||
Map<String, EntityMtrans> entityMtranMap = new HashMap<>();
|
||||
Map<String, List<String>> map = getLogicInfo(list);
|
||||
Map<String, Map<String, Integer>> setNodeSort = nodeSort(map);
|
||||
redisUtil.saveByKeyWithExpire(redisSortKey,setNodeSort,-1L);
|
||||
|
||||
tfMap.forEach((key, val) -> {
|
||||
List<String> tem = new ArrayList<>();
|
||||
val.forEach(it -> {
|
||||
tem.add(it.getNodeBefore());
|
||||
tem.add(it.getNodeNext());
|
||||
});
|
||||
tfBusBarMap.put(key, tem);
|
||||
setNodeSort.forEach((key, val) -> {
|
||||
FinalData.NODE_NUM = val.size();
|
||||
List<EntityLogic> listNew = new ArrayList<>();
|
||||
|
||||
for (EntityLogic entityLogic : list) {
|
||||
if (entityLogic.getTPIndex().equals(key)) {
|
||||
entityLogic.setNode_h(val.get(entityLogic.getNodeBefore()));
|
||||
entityLogic.setNode_l(val.get(entityLogic.getNodeNext()));
|
||||
listNew.add(entityLogic);
|
||||
}
|
||||
}
|
||||
|
||||
EntityMtrans entityMtrans = new EntityMtrans();
|
||||
handleEvent.create_matrixcata(val, entityMtrans);
|
||||
handleEvent.create_matrixcata(listNew, entityMtrans);
|
||||
entityMtranMap.put(key, entityMtrans);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
return entityMtranMap;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************
|
||||
* 增加排序功能并缓存进redis
|
||||
*******************************************/
|
||||
public Map<String, Map<String, Integer>> nodeSort(Map<String, List<String>> mapList) {
|
||||
Set<Map.Entry<String, List<String>>> sets = mapList.entrySet();
|
||||
Map<String, Map<String, Integer>> map = new HashMap<>();
|
||||
|
||||
for (Map.Entry<String, List<String>> m : sets) {
|
||||
int index = 1;
|
||||
Map<String, Integer> map2 = new HashMap<>();
|
||||
|
||||
for (String item : m.getValue()) {
|
||||
map2.put(item, index++);
|
||||
}
|
||||
|
||||
map.put(m.getKey(), map2);
|
||||
}
|
||||
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 抽取物理隔绝信息与母线的关系并放入map集合中
|
||||
* 与getTflgPloyInfo()方法功能类似
|
||||
*/
|
||||
public Map<String, List<String>> getLogicInfo(List<EntityLogic> list) {
|
||||
if (list.size() > 0) {
|
||||
Iterator<String> iterator = getAreaInfo(list).iterator();
|
||||
Map<String, List<String>> map = new HashMap<>();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
List<String> listLogic = new ArrayList<>();
|
||||
String areaString = iterator.next();
|
||||
|
||||
for (EntityLogic entityLogic : list) {
|
||||
if (entityLogic.getTPIndex().equals(areaString)) {
|
||||
listLogic.add(entityLogic.getNodeBefore());
|
||||
listLogic.add(entityLogic.getNodeNext());
|
||||
}
|
||||
}
|
||||
|
||||
//去除list中重复数据
|
||||
Set<String> set = new TreeSet<>(listLogic);
|
||||
map.put(areaString, new ArrayList<>(set));
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取物理隔绝编码信息
|
||||
* 供getInfo()、getLogicInfo()方法使用
|
||||
* 先从list数组中去重,然后获取物理隔绝编码
|
||||
*/
|
||||
public <T> Set<String> getAreaInfo(List<T> list) {
|
||||
Set<T> set = new HashSet<T>(list);
|
||||
Iterator<T> iterator = set.iterator();
|
||||
Set<String> setReturn = new HashSet<String>();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Object object = iterator.next();
|
||||
|
||||
if (object instanceof PqsTflgployass) {
|
||||
setReturn.add(((PqsTflgployass) object).getTpIndex());
|
||||
continue;
|
||||
}
|
||||
|
||||
setReturn.add(((EntityLogic) object).getTPIndex());
|
||||
}
|
||||
|
||||
return setReturn;
|
||||
}
|
||||
|
||||
|
||||
@@ -706,3 +1005,4 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,27 +1,18 @@
|
||||
package com.njcn.advance.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.TimeInterval;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.njcn.advance.enums.EnumEvt;
|
||||
import com.njcn.advance.mapper.RmpEventAdvanceMapper;
|
||||
import com.njcn.advance.pojo.dto.waveAnalysis.*;
|
||||
|
||||
import com.njcn.advance.service.EventWaveAnalysisService;
|
||||
import com.njcn.advance.utils.*;
|
||||
import com.njcn.common.config.GeneralInfo;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.FileUtil;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.event.api.RmpEventDetailFeignClient;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.oss.constant.GeneralConstant;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
@@ -32,12 +23,11 @@ import com.njcn.system.pojo.po.DictData;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -46,7 +36,6 @@ import java.time.ZoneOffset;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
@@ -59,15 +48,10 @@ import java.util.stream.Stream;
|
||||
@Slf4j
|
||||
public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
|
||||
private final int MAXLENGTH = 128 * 3000; //波形最大值计算
|
||||
|
||||
private final RmpEventDetailFeignClient rmpEventDetailFeignClient;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
|
||||
private final GeneralInfo generalInfo;
|
||||
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
@@ -81,20 +65,18 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
TimeInterval timeInterval = new TimeInterval();
|
||||
//调用方法获取暂降事件详情
|
||||
RmpEventDetailPO rmpEventDetailPO = rmpEventAdvanceMapper.selectById(eventIndex);
|
||||
EntityAdvancedData entityAdvancedData = null;
|
||||
EntityAdvancedData entityAdvancedData;
|
||||
|
||||
//获取PT变比
|
||||
LineDetailDataVO lineDetailDataVO = lineFeignClient.getLineDetailData(rmpEventDetailPO.getLineId()).getData();
|
||||
|
||||
|
||||
|
||||
if (rmpEventDetailPO.getFileFlag() == 1) {
|
||||
//获取所有暂态原因
|
||||
List<DictData> dicDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_TYPE.getCode()).getData();
|
||||
Map<Integer, DictData> eventTypeMap = dicDataList.stream().collect(Collectors.toMap(DictData::getAlgoDescribe, Function.identity()));
|
||||
|
||||
InputStream inputStreamCfg = null;
|
||||
InputStream inputStreamDat = null;
|
||||
InputStream inputStreamCfg;
|
||||
InputStream inputStreamDat;
|
||||
try {
|
||||
inputStreamCfg = fileStorageUtil.getFileStream(OssPath.WAVE_DIR + lineDetailDataVO.getIp() + StrUtil.SLASH + rmpEventDetailPO.getWavePath() + GeneralConstant.CFG);
|
||||
inputStreamDat = fileStorageUtil.getFileStream(OssPath.WAVE_DIR + lineDetailDataVO.getIp() + StrUtil.SLASH + rmpEventDetailPO.getWavePath() + GeneralConstant.DAT);
|
||||
@@ -103,16 +85,16 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
}
|
||||
|
||||
//读取
|
||||
BufferedReader bufferedReader = null;
|
||||
BufferedReader bufferedReader;
|
||||
InputStreamReader read = null;
|
||||
String strFileLine = null;
|
||||
String strFileLine;
|
||||
byte[] array = {};
|
||||
List<String> temCfgList = new ArrayList<>();
|
||||
try {
|
||||
// 判断文件是否存在
|
||||
array = IoUtil.readBytes(inputStreamDat);
|
||||
|
||||
read = new InputStreamReader(inputStreamCfg, CharsetUtil.UTF_8);// 考虑到编码格式
|
||||
// 考虑到编码格式
|
||||
read = new InputStreamReader(inputStreamCfg, StandardCharsets.UTF_8);
|
||||
bufferedReader = new BufferedReader(read);
|
||||
|
||||
while ((strFileLine = bufferedReader.readLine()) != null) {
|
||||
@@ -140,10 +122,11 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
entityAdvancedData = new EntityAdvancedData(originalList.size());
|
||||
|
||||
for (int i = 0; i < originalList.size(); i++) {
|
||||
entityAdvancedData.smp_x[i] = originalList.get(i).get(0).floatValue();//坐标轴
|
||||
entityAdvancedData.smp_a[i] = originalList.get(i).get(1).floatValue();
|
||||
entityAdvancedData.smp_b[i] = originalList.get(i).get(2).floatValue();
|
||||
entityAdvancedData.smp_c[i] = originalList.get(i).get(3).floatValue();
|
||||
//坐标轴
|
||||
entityAdvancedData.smp_x[i] = originalList.get(i).get(0);
|
||||
entityAdvancedData.smp_a[i] = originalList.get(i).get(1);
|
||||
entityAdvancedData.smp_b[i] = originalList.get(i).get(2);
|
||||
entityAdvancedData.smp_c[i] = originalList.get(i).get(3);
|
||||
}
|
||||
entityAdvancedData.smp_len = originalList.size();
|
||||
|
||||
@@ -156,19 +139,24 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
CauseStruct causeStruct = new CauseStruct();
|
||||
|
||||
for (int i = 0; i < pitchList.size(); i++) {
|
||||
rect.smp_va[i] = pitchList.get(i).get(1).floatValue();
|
||||
causeStruct.smp_va[i] = pitchList.get(i).get(1).floatValue();
|
||||
rect.smp_va[i] = pitchList.get(i).get(1);
|
||||
causeStruct.smp_va[i] = pitchList.get(i).get(1);
|
||||
|
||||
rect.smp_vb[i] = pitchList.get(i).get(2).floatValue();
|
||||
causeStruct.smp_vb[i] = pitchList.get(i).get(2).floatValue();
|
||||
rect.smp_vb[i] = pitchList.get(i).get(2);
|
||||
causeStruct.smp_vb[i] = pitchList.get(i).get(2);
|
||||
|
||||
rect.smp_vc[i] = pitchList.get(i).get(3).floatValue();
|
||||
causeStruct.smp_vc[i] = pitchList.get(i).get(3).floatValue();
|
||||
rect.smp_vc[i] = pitchList.get(i).get(3);
|
||||
causeStruct.smp_vc[i] = pitchList.get(i).get(3);
|
||||
}
|
||||
|
||||
rect.smp_len = pitchList.size();
|
||||
|
||||
if (rect.smp_len >= MAXLENGTH) { //超过60s的波形直接抛异常给上面处理
|
||||
//超过60s的波形直接抛异常给上面处理
|
||||
/*
|
||||
* 波形最大值计算
|
||||
*/
|
||||
int MAX_LENGTH = 128 * 3000;
|
||||
if (rect.smp_len >= MAX_LENGTH) {
|
||||
throw new BusinessException("波形超过60S");
|
||||
}
|
||||
|
||||
@@ -182,16 +170,14 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
translateData(jsonObject, rmpEventDetailPO.getStartTime(), entityAdvancedData);
|
||||
|
||||
|
||||
if(rmpEventDetailPO.getDealFlag()!=1){
|
||||
if (rmpEventDetailPO.getDealFlag() != 1) {
|
||||
//如果存在三个文件但是没有调用dll/so计算
|
||||
|
||||
getDataFromDLL(rmpEventDetailPO,waveOriginalData,rect,entityAdvancedData,causeStruct);
|
||||
getDataFromDLL(rmpEventDetailPO, waveOriginalData, rect, entityAdvancedData, causeStruct);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/****************************************************************
|
||||
* 根据返回的结果计算,获取暂降类型描述
|
||||
****************************************************************/
|
||||
@@ -210,7 +196,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
entityAdvancedData.sagPhaseType[i] = "三相";
|
||||
break;
|
||||
default:
|
||||
;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -223,25 +209,22 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @事件未进行高级算法处理:系统调用dll处理并保存结果
|
||||
* 事件未进行高级算法处理:系统调用dll处理并保存结果
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void getDataFromDLL(RmpEventDetailPO rmpEventDetailPOQuery,WaveData waveData, Rect rect, EntityAdvancedData entityAdvancedData, CauseStruct causeStruct) {
|
||||
public void getDataFromDLL(RmpEventDetailPO rmpEventDetailPOQuery, WaveData waveData, Rect rect, EntityAdvancedData entityAdvancedData, CauseStruct causeStruct) {
|
||||
|
||||
if(StrUtil.isBlank(rmpEventDetailPOQuery.getAdvanceType())){
|
||||
if (StrUtil.isBlank(rmpEventDetailPOQuery.getAdvanceType())) {
|
||||
JnaCallDllOrSo jnaCallDllOrSo = new JnaCallBalance("qvvr_dll");
|
||||
jnaCallDllOrSo.setPath();
|
||||
// 计算暂降类
|
||||
// 计算暂降类
|
||||
JnaCallBalance.Eventlibrary INSTANTCE = JnaCallBalance.Eventlibrary.INSTANTCE;
|
||||
INSTANTCE.qvvr_fun(rect);
|
||||
|
||||
initBackData(rect.evt_num, entityAdvancedData);
|
||||
|
||||
/**
|
||||
/*
|
||||
* @判断是否调用成功
|
||||
* @成功执行更新pqs_eventdetail操作:更新dq持续时间、暂降类型、暂降原因、总分段数目
|
||||
*/
|
||||
@@ -252,7 +235,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
rmpEventDetailPO.setDqTime((double) rect.evt_buf[0].hold_time_dq);
|
||||
rmpEventDetailPO.setFirstType((Integer.toString(rect.evt_buf[0].qvvr_cata_type[0])));
|
||||
rmpEventDetailPO.setFirstTime(waveData.getFirstTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
|
||||
rmpEventDetailPO.setFirstMs((double)waveData.getFirstMs());
|
||||
rmpEventDetailPO.setFirstMs((double) waveData.getFirstMs());
|
||||
|
||||
|
||||
// 排序并获取多段中最小的数据
|
||||
@@ -307,11 +290,11 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
int pos = 0;
|
||||
|
||||
for (int kk = 0; kk <= i; kk++) {
|
||||
pose += list.get(kk).nSampleNum / list.get(kk).nOneSample * rate;
|
||||
pose += (int) (list.get(kk).nSampleNum / list.get(kk).nOneSample * rate);
|
||||
|
||||
if (kk < i) {
|
||||
posb += list.get(kk).nSampleNum / list.get(kk).nOneSample * rate;
|
||||
pos += list.get(kk).nSampleNum;
|
||||
posb += (int) (list.get(kk).nSampleNum / list.get(kk).nOneSample * rate);
|
||||
pos += (int) list.get(kk).nSampleNum;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,11 +312,11 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
int pos = 0;
|
||||
|
||||
for (int kk = 0; kk <= i; kk++) {
|
||||
pose += list.get(kk).nSampleNum / list.get(kk).nOneSample * rate;
|
||||
pose += (int) (list.get(kk).nSampleNum / list.get(kk).nOneSample * rate);
|
||||
|
||||
if (kk < i) {
|
||||
posb += list.get(kk).nSampleNum / list.get(kk).nOneSample * rate;
|
||||
pos += list.get(kk).nSampleNum;
|
||||
posb += (int) (list.get(kk).nSampleNum / list.get(kk).nOneSample * rate);
|
||||
pos += (int) list.get(kk).nSampleNum;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,7 +335,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
Map<Integer, DictData> eventTypeMap = dicDataList.stream().collect(Collectors.toMap(DictData::getAlgoDescribe, Function.identity()));
|
||||
|
||||
Integer tem = rect.evt_buf[index].qvvr_cata_type[0];
|
||||
if(eventTypeMap.containsKey(tem)) {
|
||||
if (eventTypeMap.containsKey(tem)) {
|
||||
rmpEventDetailPO.setAdvanceType(eventTypeMap.get(tem).getId());
|
||||
}
|
||||
rmpEventDetailPO.setDealFlag(1);
|
||||
@@ -384,7 +367,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
Map<Integer, DictData> eventReasonMap = dicDataList.stream().collect(Collectors.toMap(DictData::getAlgoDescribe, Function.identity()));
|
||||
|
||||
// 暂降原因的结果更新到数据库
|
||||
if(eventReasonMap.containsKey(causeStruct.cause)) {
|
||||
if (eventReasonMap.containsKey(causeStruct.cause)) {
|
||||
RmpEventDetailPO updateRmpEventDetailPO = new RmpEventDetailPO();
|
||||
updateRmpEventDetailPO.setEventId(rmpEventDetailPOQuery.getEventId());
|
||||
updateRmpEventDetailPO.setAdvanceReason(eventReasonMap.get(causeStruct.cause).getId());
|
||||
@@ -430,8 +413,10 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
//获取波形的瞬时值、RMS值数据
|
||||
AnalyWave analyWave = new AnalyWave();
|
||||
AnalyWaveModel.tagDataValue tagDataValue = analyWave.readComtrade(temCfgList, array, flag);
|
||||
List<List<Float>> shunWave = tagDataValue.getListWaveData();//获取瞬时波形值
|
||||
List<List<Float>> rmsWave = analyWave.showValidData(shunWave);//RMS值波形
|
||||
//获取瞬时波形值
|
||||
List<List<Float>> shunWave = tagDataValue.getListWaveData();
|
||||
//RMS值波形
|
||||
List<List<Float>> rmsWave = analyWave.showValidData(shunWave);
|
||||
waveData.setnOneWaveNum(analyWave.getnOneWaveNum());
|
||||
waveData.setSunData(shunWave);
|
||||
waveData.setTmpWaveTitle(tagDataValue.getTmpWaveTitle());
|
||||
@@ -445,13 +430,13 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
List<String> tmpWaveTitle = tagDataValue.getTmpWaveTitle();
|
||||
/*********** Modify by yexibao ---Start **************/
|
||||
for (int i = 0; i < tagDataValue.getiPhasic(); i++) {
|
||||
if (tmpWaveTitle.get(i + 1).substring(1).indexOf("A") > -1) {
|
||||
if (tmpWaveTitle.get(i + 1).substring(1).contains("A")) {
|
||||
waveData.setA(tmpWaveTitle.get(i + 1).substring(1));
|
||||
}
|
||||
if (tmpWaveTitle.get(i + 1).substring(1).indexOf("B") > -1) {
|
||||
if (tmpWaveTitle.get(i + 1).substring(1).contains("B")) {
|
||||
waveData.setB(tmpWaveTitle.get(i + 1).substring(1));
|
||||
}
|
||||
if (tmpWaveTitle.get(i + 1).substring(1).indexOf("C") > -1) {
|
||||
if (tmpWaveTitle.get(i + 1).substring(1).contains("C")) {
|
||||
waveData.setC(tmpWaveTitle.get(i + 1).substring(1));
|
||||
}
|
||||
}
|
||||
@@ -478,7 +463,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
|
||||
for (int offset = 0; offset < len; offset++) {
|
||||
BackData backData = new BackData();
|
||||
/**
|
||||
/*
|
||||
* @波形起始点(3相)
|
||||
*/
|
||||
backData.POW_a = Utils.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||
@@ -488,7 +473,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
backData.POW_c = Utils.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||
.getJSONObject(offset).get(EnumEvt.POW_C.getProperty()).toString(), 0.0f);
|
||||
|
||||
/**
|
||||
/*
|
||||
* @跳变段电压变化
|
||||
*/
|
||||
backData.Voltagechange_Va = Utils.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||
@@ -498,7 +483,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
backData.Voltagechange_Vc = Utils.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||
.getJSONObject(offset).get(EnumEvt.VOLTAGECHANGE_VC.getProperty()).toString(), 0.0f);
|
||||
|
||||
/**
|
||||
/*
|
||||
* @持续时间
|
||||
*/
|
||||
backData.hold_time_rms = Utils.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||
@@ -506,7 +491,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
backData.hold_time_dq = Utils.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||
.getJSONObject(offset).get(EnumEvt.HOLD_TIME_DQ.getProperty()).toString(), 0.0f);
|
||||
|
||||
/**
|
||||
/*
|
||||
* @分段信息
|
||||
*/
|
||||
backData.SEG_T_num = Utils.getIntValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||
@@ -519,7 +504,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
-1);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* @特征幅值
|
||||
*/
|
||||
backData.u_min_num = Utils.getIntValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||
@@ -539,7 +524,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty()).getJSONObject(offset)
|
||||
.getJSONObject(EnumEvt.U3_MIN.getProperty()).get(Integer.toString(j)).toString(), 0.0f);
|
||||
|
||||
/**
|
||||
/*
|
||||
* @相位跳变
|
||||
*/
|
||||
backData.angle_diff_an[j] = Utils.getFloatValue(
|
||||
@@ -567,7 +552,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
.getJSONObject(EnumEvt.ANGLE_DIFF_CP.getProperty()).get(Integer.toString(j)).toString(),
|
||||
0.0f);
|
||||
|
||||
/**
|
||||
/*
|
||||
* @不平衡度
|
||||
*/
|
||||
backData.bph_max_value[j] = Utils.getFloatValue(
|
||||
@@ -575,21 +560,21 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
.getJSONObject(EnumEvt.BPH_MAX_VALUE.getProperty()).get(Integer.toString(j)).toString(),
|
||||
0.0f);
|
||||
|
||||
/**
|
||||
/*
|
||||
* @暂降原因
|
||||
*/
|
||||
backData.qvvr_cata_cause[j] = Utils.getIntValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||
.getJSONObject(offset).getJSONObject(EnumEvt.QVVR_CATA_CAUSE.getProperty())
|
||||
.get(Integer.toString(j)).toString(), -1);
|
||||
|
||||
/**
|
||||
/*
|
||||
* @暂降类型
|
||||
*/
|
||||
backData.qvvr_cata_type[j] = Utils.getIntValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||
.getJSONObject(offset).getJSONObject(EnumEvt.QVVR_CATA_TYPE.getProperty())
|
||||
.get(Integer.toString(j)).toString(), -1);
|
||||
|
||||
/**
|
||||
/*
|
||||
* @暂降相别
|
||||
*/
|
||||
backData.qvvr_phasetype[j] = Utils.getIntValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||
@@ -604,7 +589,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
if (!jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).isEmpty()) {
|
||||
entityAdvancedData.power_after_buf = new PowerData[1];
|
||||
PowerData power = new PowerData();
|
||||
float fundP[] = new float[5];
|
||||
float[] fundP = new float[5];
|
||||
fundP[0] = Utils.getFloatValue(
|
||||
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
||||
.getJSONObject(EnumEvt.FUND_P.getProperty()).get("A").toString(), 0.0f);
|
||||
@@ -622,7 +607,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
.getJSONObject(EnumEvt.FUND_P.getProperty()).get("zero").toString(), 0.0f);
|
||||
power.setFundP(fundP);
|
||||
|
||||
float fundQ[] = new float[5];
|
||||
float[] fundQ = new float[5];
|
||||
fundQ[0] = Utils.getFloatValue(
|
||||
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
||||
.getJSONObject(EnumEvt.FUND_Q.getProperty()).get("A").toString(), 0.0f);
|
||||
@@ -640,7 +625,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
.getJSONObject(EnumEvt.FUND_Q.getProperty()).get("zero").toString(), 0.0f);
|
||||
power.setFundQ(fundQ);
|
||||
|
||||
float fundS[] = new float[5];
|
||||
float[] fundS = new float[5];
|
||||
fundS[0] = Utils.getFloatValue(
|
||||
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
||||
.getJSONObject(EnumEvt.FUND_S.getProperty()).get("A").toString(), 0.0f);
|
||||
@@ -664,7 +649,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
if (!jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).isEmpty()) {
|
||||
entityAdvancedData.qvvr_direction_info = new DirectionData[1];
|
||||
DirectionData direction = new DirectionData();
|
||||
int trigTime[] = new int[7];
|
||||
int[] trigTime = new int[7];
|
||||
trigTime[0] = Utils.getIntValue(
|
||||
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||
.getJSONObject(EnumEvt.TRIG_TIME.getProperty()).get("year").toString(), 0);
|
||||
@@ -688,7 +673,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
.getJSONObject(EnumEvt.TRIG_TIME.getProperty()).get("millisecond").toString(), 0);
|
||||
direction.setTrigTime(trigTime);
|
||||
|
||||
float qvvrBeforeRms[] = new float[6];
|
||||
float[] qvvrBeforeRms = new float[6];
|
||||
qvvrBeforeRms[0] = Utils.getFloatValue(
|
||||
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||
.getJSONObject(EnumEvt.QVVR_BEFORE_RMS.getProperty()).get("Fund_Ua").toString(), 0.0f);
|
||||
@@ -709,7 +694,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
.getJSONObject(EnumEvt.QVVR_BEFORE_RMS.getProperty()).get("Fund_Ic").toString(), 0.0f);
|
||||
direction.setQvvrBeforeRms(qvvrBeforeRms);
|
||||
|
||||
float qvvrBeforeZk[] = new float[6];
|
||||
float[] qvvrBeforeZk = new float[6];
|
||||
qvvrBeforeZk[0] = Utils.getFloatValue(
|
||||
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||
.getJSONObject(EnumEvt.QVVR_BEFORE_ZK.getProperty()).get("Za").toString(), 0.0f);
|
||||
@@ -730,7 +715,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
.getJSONObject(EnumEvt.QVVR_BEFORE_ZK.getProperty()).get("Zca").toString(), 0.0f);
|
||||
direction.setQvvrBeforeZk(qvvrBeforeZk);
|
||||
|
||||
float qvvrOccurRms[] = new float[6];
|
||||
float[] qvvrOccurRms = new float[6];
|
||||
qvvrOccurRms[0] = Utils.getFloatValue(
|
||||
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||
.getJSONObject(EnumEvt.QVVR_OCCUR_RMS.getProperty()).get("Fund_Ua").toString(), 0.0f);
|
||||
@@ -751,7 +736,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
.getJSONObject(EnumEvt.QVVR_OCCUR_RMS.getProperty()).get("Fund_Ic").toString(), 0.0f);
|
||||
direction.setQvvrOccurRms(qvvrOccurRms);
|
||||
|
||||
float qvvrOccurZk[] = new float[6];
|
||||
float[] qvvrOccurZk = new float[6];
|
||||
qvvrOccurZk[0] = Utils.getFloatValue(
|
||||
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||
.getJSONObject(EnumEvt.QVVR_OCCUR_ZK.getProperty()).get("Za").toString(), 0.0f);
|
||||
@@ -772,7 +757,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
.getJSONObject(EnumEvt.QVVR_OCCUR_ZK.getProperty()).get("Zca").toString(), 0.0f);
|
||||
direction.setQvvrOccurZk(qvvrOccurZk);
|
||||
|
||||
String qvvrPosInfo[] = new String[1];
|
||||
String[] qvvrPosInfo = new String[1];
|
||||
qvvrPosInfo[0] = jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||
.getJSONObject(EnumEvt.QVVR_POS_INFO.getProperty()).get("direction").toString();
|
||||
direction.setQvvrPosInfo(qvvrPosInfo);
|
||||
@@ -784,7 +769,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
if (!jsonObject.getJSONArray(EnumEvt.QVVR_UTBL_INFO.getProperty()).isEmpty()) {
|
||||
entityAdvancedData.qvvr_utbl_info = new UtblData[1];
|
||||
UtblData direction = new UtblData();
|
||||
long trigTime[] = new long[1];
|
||||
long[] trigTime = new long[1];
|
||||
String year = jsonObject.getJSONArray(EnumEvt.QVVR_UTBL_INFO.getProperty()).getJSONObject(0)
|
||||
.getJSONObject(EnumEvt.TRIG_TIME.getProperty()).get("year").toString();
|
||||
String month = jsonObject.getJSONArray(EnumEvt.QVVR_UTBL_INFO.getProperty()).getJSONObject(0)
|
||||
@@ -806,7 +791,10 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
long between = utbl.getTime() - trigeTime.toInstant(ZoneOffset.ofHours(8)).toEpochMilli();
|
||||
long between = 0;
|
||||
if (utbl != null) {
|
||||
between = utbl.getTime() - trigeTime.toInstant(ZoneOffset.ofHours(8)).toEpochMilli();
|
||||
}
|
||||
trigTime[0] = between;
|
||||
direction.setTrigTime(trigTime);
|
||||
entityAdvancedData.qvvr_utbl_info[0] = direction;
|
||||
|
||||
@@ -5,12 +5,10 @@ import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.text.StrPool;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.advance.mapper.responsibility.RespDataResultMapper;
|
||||
import com.njcn.advance.pojo.bo.responsibility.UserDataExcel;
|
||||
import com.njcn.advance.pojo.dto.responsibility.CustomerData;
|
||||
import com.njcn.advance.pojo.dto.responsibility.CustomerResponsibility;
|
||||
import com.njcn.advance.pojo.dto.responsibility.ResponsibilityResult;
|
||||
@@ -19,7 +17,6 @@ import com.njcn.advance.pojo.po.responsibility.RespDataResult;
|
||||
import com.njcn.advance.service.responsibility.IRespDataResultService;
|
||||
import com.njcn.advance.service.responsibility.IRespDataService;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -69,17 +66,17 @@ public class RespDataResultServiceImpl extends ServiceImpl<RespDataResultMapper,
|
||||
responsibilityResult.setResponsibilityDataIndex(respDataResult.getResDataId());
|
||||
//处理时间轴数据
|
||||
InputStream timeDataStream = fileStorageUtil.getFileStream(respDataResult.getTimeData());
|
||||
String timeDataStr = IoUtil.read(timeDataStream, CharsetUtil.UTF_8);
|
||||
String timeDataStr = IoUtil.readUtf8(timeDataStream);
|
||||
List<Long> timeData = JSONArray.parseArray(timeDataStr, Long.class);
|
||||
responsibilityResult.setTimeDatas(timeData);
|
||||
//处理用户详细数据
|
||||
InputStream userDetailStream = fileStorageUtil.getFileStream(respDataResult.getUserDetailData());
|
||||
String userDetailStr = IoUtil.read(userDetailStream, CharsetUtil.UTF_8);
|
||||
String userDetailStr = IoUtil.readUtf8(userDetailStream);
|
||||
List<CustomerData> customerData = JSONArray.parseArray(userDetailStr, CustomerData.class);
|
||||
responsibilityResult.setDatas(customerData);
|
||||
//处理排名前10数据
|
||||
InputStream respStream = fileStorageUtil.getFileStream(respDataResult.getUserResponsibility());
|
||||
String respStr = IoUtil.read(respStream, CharsetUtil.UTF_8);
|
||||
String respStr = IoUtil.readUtf8(respStream);
|
||||
List<CustomerResponsibility> respData = JSONArray.parseArray(respStr, CustomerResponsibility.class);
|
||||
responsibilityResult.setResponsibilities(respData);
|
||||
responsibilityResults.add(responsibilityResult);
|
||||
|
||||
@@ -7,12 +7,10 @@ import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.text.StrPool;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -33,7 +31,6 @@ import com.njcn.advance.service.responsibility.IRespDataResultService;
|
||||
import com.njcn.advance.service.responsibility.IRespDataService;
|
||||
import com.njcn.advance.service.responsibility.IRespUserDataService;
|
||||
import com.njcn.advance.utils.ResponsibilityAlgorithm;
|
||||
import com.njcn.advance.utils.ResponsibilityCallDllOrSo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
@@ -45,7 +42,6 @@ import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
||||
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.pms.pojo.po.StatationStat;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
||||
@@ -82,7 +78,6 @@ import java.util.stream.Stream;
|
||||
@RequiredArgsConstructor
|
||||
public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> implements IRespDataService {
|
||||
|
||||
private final IRespUserDataService iRespUserDataService;
|
||||
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
@@ -96,6 +91,22 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
|
||||
public final static int SORT_10 = 10;
|
||||
public final static int INTERVAL_TIME_1 = 1;
|
||||
public final static int INTERVAL_TIME_3 = 3;
|
||||
public final static int INTERVAL_TIME_5 = 5;
|
||||
public final static int INTERVAL_TIME_15 = 15;
|
||||
public final static int INTERVAL_TIME_30 = 30;
|
||||
public final static int WINDOW_96 = 96;
|
||||
public final static int WINDOW_48 = 48;
|
||||
public final static int WINDOW_4 = 4;
|
||||
|
||||
public final static int MINUS_2 = 2;
|
||||
public final static int MINUS_3 = 3;
|
||||
public final static int MINUS_4 = 4;
|
||||
public final static int MINUS_5 = 5;
|
||||
|
||||
|
||||
@Override
|
||||
public Page<RespDataDTO> responsibilityList(BaseParam queryParam) {
|
||||
QueryWrapper<RespDataDTO> queryWrapper = new QueryWrapper<>();
|
||||
@@ -122,7 +133,7 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
//没有排序参数,默认根据sort字段排序,没有排序字段的,根据updateTime更新时间排序
|
||||
queryWrapper.orderBy(true, false, "pqs_resp_data.create_time");
|
||||
}
|
||||
queryWrapper.between("pqs_resp_data.create_time",DateUtil.beginOfDay(DateUtil.parse(queryParam.getSearchBeginTime())), DateUtil.endOfDay(DateUtil.parse(queryParam.getSearchEndTime())));
|
||||
queryWrapper.between("pqs_resp_data.create_time", DateUtil.beginOfDay(DateUtil.parse(queryParam.getSearchBeginTime())), DateUtil.endOfDay(DateUtil.parse(queryParam.getSearchEndTime())));
|
||||
}
|
||||
queryWrapper.eq("pqs_resp_data.state", DataStateEnum.ENABLE.getCode());
|
||||
Page<RespDataDTO> page = this.baseMapper.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), queryWrapper);
|
||||
@@ -174,13 +185,13 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
int lineInterval = pNumAndInterval.getLineInterval();
|
||||
//第三个参数win,根据起始时间和截止时间的间隔
|
||||
if (dateStr.size() > 1) {
|
||||
if(userIntervalTime == 15){
|
||||
win = 96;
|
||||
}else{
|
||||
win = 48;
|
||||
if (userIntervalTime == INTERVAL_TIME_15) {
|
||||
win = WINDOW_96;
|
||||
} else {
|
||||
win = WINDOW_48;
|
||||
}
|
||||
} else {
|
||||
win = 4;
|
||||
win = WINDOW_4;
|
||||
}
|
||||
//第四个参数harmMk,默认为0f
|
||||
harmMk = 0f;
|
||||
@@ -191,7 +202,7 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
RespHarmData respHarmData = getRespHarmData(responsibilityCalculateParam, lineInterval);
|
||||
//harmData填充完毕后,开始组装功率数据
|
||||
//首先获取当前时间内的各个用户的数据
|
||||
Map<String/*用户名*/, List<UserDataExcel>> originalPData = new HashMap<>();
|
||||
Map<String/*用户名*/, List<UserDataExcel>> originalPData = new HashMap<>(16);
|
||||
List<String> names = new ArrayList<>();
|
||||
Set<String> userNamesFinal = finalData.keySet();
|
||||
for (String userName : userNamesFinal) {
|
||||
@@ -231,15 +242,6 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
qvvrDataEntity.harmMk = harmMk;
|
||||
qvvrDataEntity.pData = pData;
|
||||
qvvrDataEntity.harmData = respHarmData.getHarmData();
|
||||
// ResponsibilityCallDllOrSo responsibilityCallDllOrSo = new ResponsibilityCallDllOrSo("harm_response");
|
||||
// responsibilityCallDllOrSo.setPath();
|
||||
// ResponsibilityCallDllOrSo.ResponsibilityLibrary responsibilityLibrary = ResponsibilityCallDllOrSo.ResponsibilityLibrary.INSTANTCE;
|
||||
// try {
|
||||
// responsibilityLibrary.harm_response(qvvrStruct);
|
||||
// } catch (Exception exception) {
|
||||
// exception.printStackTrace();
|
||||
// }
|
||||
|
||||
ResponsibilityAlgorithm responsibilityAlgorithm = new ResponsibilityAlgorithm();
|
||||
qvvrDataEntity = responsibilityAlgorithm.getResponsibilityResult(qvvrDataEntity);
|
||||
//至此接口调用结束,开始组装动态责任数据和用户责任量化结果
|
||||
@@ -278,13 +280,13 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
timeDatas.add(calendar.getTimeInMillis());
|
||||
}
|
||||
//OK拿到所有测量点的数据了,现在就是看如何将相同户号的动态数据进行算术和求值,之前的用户name为:户号@测量点号@用户名
|
||||
Map<String/*用户名(户号)*/, List<CustomerData>> customerDataTemp = new HashMap<>();
|
||||
for (int i = 0; i < customerDatas.length; i++) {
|
||||
String customerName = customerDatas[i].getCustomerName();
|
||||
Map<String/*用户名(户号)*/, List<CustomerData>> customerDataTemp = new HashMap<>(16);
|
||||
for (CustomerData data : customerDatas) {
|
||||
String customerName = data.getCustomerName();
|
||||
String[] customerInfo = customerName.split("@");
|
||||
String name = customerInfo[2] + "(" + customerInfo[0] + ")";
|
||||
List<CustomerData> customerData = customerDataTemp.get(name);
|
||||
CustomerData temp = customerDatas[i];
|
||||
CustomerData temp = data;
|
||||
temp.setCustomerName(name);
|
||||
if (CollectionUtils.isEmpty(customerData)) {
|
||||
customerData = new ArrayList<>();
|
||||
@@ -306,15 +308,15 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
//表示用户唯一的
|
||||
customerData.add(customerData1.get(0));
|
||||
} else {
|
||||
//表示用户可能包含多个监测点号,需要进行数据累加
|
||||
// 表示用户可能包含多个监测点号,需要进行数据累加
|
||||
CustomerData customerDataT = new CustomerData();
|
||||
customerDataT.setCustomerName(cusName);
|
||||
//进行数值累加
|
||||
List<Float> valueDatas = new ArrayList<>();
|
||||
for (int i = 0; i < customerData1.get(0).getValueDatas().size(); i++) {
|
||||
float original = 0.0f;
|
||||
for (int k = 0; k < customerData1.size(); k++) {
|
||||
original = original + customerData1.get(k).getValueDatas().get(i);
|
||||
for (CustomerData data : customerData1) {
|
||||
original = original + data.getValueDatas().get(i);
|
||||
}
|
||||
valueDatas.add(original);
|
||||
}
|
||||
@@ -364,7 +366,7 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
this.baseMapper.updateById(responsibilityData);
|
||||
}
|
||||
//入库完毕之后,需要将必要数据进行序列化存储,方便后期的重复利用
|
||||
/**
|
||||
/*
|
||||
* 需要序列化三种数据结构 1 cal_flag置为1时需要的一些列参数的CacheQvvrData 2 cal_flag为0时的,动态结果。3 用户责任量化结果
|
||||
* 其中1/2都只需要一个文件即可
|
||||
* 3因为用户限值的变化调整,可能存在很多个文件,具体根据用户的选择而定
|
||||
@@ -389,24 +391,23 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
respDataResult.setLimitValue(respHarmData.getOverLimit());
|
||||
//时间横轴数据 timeDatas
|
||||
JSONArray timeDataJson = JSONArray.parseArray(JSON.toJSONString(timeDatas));
|
||||
InputStream timeDataStream = IoUtil.toStream(timeDataJson.toString(), CharsetUtil.UTF_8);
|
||||
InputStream timeDataStream = IoUtil.toUtf8Stream(timeDataJson.toString());
|
||||
String timeDataPath = fileStorageUtil.uploadStream(timeDataStream, OssPath.RESPONSIBILITY_USER_RESULT_DATA, FileUtil.generateFileName("json"));
|
||||
respDataResult.setTimeData(timeDataPath);
|
||||
//用户每时刻对应的责任数据
|
||||
JSONArray customerDataJson = JSONArray.parseArray(JSON.toJSONString(customerData));
|
||||
InputStream customerStream = IoUtil.toStream(customerDataJson.toString(), CharsetUtil.UTF_8);
|
||||
InputStream customerStream = IoUtil.toUtf8Stream(customerDataJson.toString());
|
||||
String customerPath = fileStorageUtil.uploadStream(customerStream, OssPath.RESPONSIBILITY_USER_RESULT_DATA, FileUtil.generateFileName("json"));
|
||||
respDataResult.setUserDetailData(customerPath);
|
||||
//调用qvvr生成的中间数据
|
||||
CacheQvvrData cacheQvvrData = new CacheQvvrData(qvvrDataEntity.getPNode(), qvvrDataEntity.getHarmNum(), qvvrDataEntity.getHarmData(), qvvrDataEntity.fKData, qvvrDataEntity.hKData, names, userIntervalTime, qvvrDataEntity.win, userIntervalTime, respHarmData.getHarmTime());
|
||||
// JSONObject cacheQvvrDataDataJson = (JSONObject) JSONObject.toJSON(cacheQvvrData);
|
||||
String cacheJson = PubUtils.obj2json(cacheQvvrData);
|
||||
InputStream cacheQvvrDataStream = IoUtil.toStream(cacheJson, CharsetUtil.UTF_8);
|
||||
InputStream cacheQvvrDataStream = IoUtil.toUtf8Stream(cacheJson);
|
||||
String cacheQvvrDataPath = fileStorageUtil.uploadStream(cacheQvvrDataStream, OssPath.RESPONSIBILITY_USER_RESULT_DATA, FileUtil.generateFileName("json"));
|
||||
respDataResult.setQvvrData(cacheQvvrDataPath);
|
||||
//用户前10数据存储
|
||||
JSONArray customerResJson = JSONArray.parseArray(JSON.toJSONString(customerResponsibilities));
|
||||
InputStream customerResStream = IoUtil.toStream(customerResJson.toString(), CharsetUtil.UTF_8);
|
||||
InputStream customerResStream = IoUtil.toUtf8Stream(customerResJson.toString());
|
||||
String customerResPath = fileStorageUtil.uploadStream(customerResStream, OssPath.RESPONSIBILITY_USER_RESULT_DATA, FileUtil.generateFileName("json"));
|
||||
respDataResult.setUserResponsibility(customerResPath);
|
||||
respDataResultService.save(respDataResult);
|
||||
@@ -442,9 +443,8 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
CacheQvvrData cacheQvvrData;
|
||||
try {
|
||||
InputStream fileStream = fileStorageUtil.getFileStream(respDataResultTemp.getQvvrData());
|
||||
String qvvrDataStr = IoUtil.read(fileStream, CharsetUtil.UTF_8);
|
||||
// cacheQvvrData = JSONObject.parseObject(qvvrDataStr, CacheQvvrData.class);
|
||||
cacheQvvrData = PubUtils.json2obj(qvvrDataStr,CacheQvvrData.class);
|
||||
String qvvrDataStr = IoUtil.readUtf8(fileStream);
|
||||
cacheQvvrData = PubUtils.json2obj(qvvrDataStr, CacheQvvrData.class);
|
||||
|
||||
} catch (Exception exception) {
|
||||
throw new BusinessException(AdvanceResponseEnum.RESP_RESULT_DATA_NOT_FOUND);
|
||||
@@ -486,34 +486,34 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
qvvrDataEntity.setHKData(cacheQvvrData.getHKData());
|
||||
qvvrDataEntity.harmData = cacheQvvrData.getHarmData();
|
||||
} else {
|
||||
if (win == 4) {
|
||||
if (win == WINDOW_4) {
|
||||
//当窗口为4时,两个时间限制范围在最小公倍数为15时,最起码有5个有效时间点,在最小公倍数为30时,最起码有3个有效时间点
|
||||
if (minMultiple == 15) {
|
||||
if (minus < 5) {
|
||||
if (minMultiple == INTERVAL_TIME_15) {
|
||||
if (minus < MINUS_5) {
|
||||
throw new BusinessException(AdvanceResponseEnum.WIN_TIME_ERROR);
|
||||
}
|
||||
resNum = minus - 4;
|
||||
resNum = minus - MINUS_4;
|
||||
|
||||
} else if (minMultiple == 30) {
|
||||
if (minus < 3) {
|
||||
} else if (minMultiple == INTERVAL_TIME_30) {
|
||||
if (minus < MINUS_3) {
|
||||
throw new BusinessException(AdvanceResponseEnum.WIN_TIME_ERROR);
|
||||
}
|
||||
resNum = minus - 2;
|
||||
resNum = minus - MINUS_2;
|
||||
} else {
|
||||
throw new BusinessException(AdvanceResponseEnum.CALCULATE_INTERVAL_ERROR);
|
||||
}
|
||||
} else if (win == 96) {
|
||||
} else if (win == WINDOW_96) {
|
||||
//当窗口为96时,两个时间限值范围在最小公倍数为15时,最起码有97个有效时间点,在最小公倍数为30时,最起码有49个有效时间点
|
||||
if (minMultiple == 15) {
|
||||
if (minus < 97) {
|
||||
if (minMultiple == INTERVAL_TIME_15) {
|
||||
if (minus <= WINDOW_96) {
|
||||
throw new BusinessException(AdvanceResponseEnum.WIN_TIME_ERROR);
|
||||
}
|
||||
resNum = minus - 96;
|
||||
} else if (minMultiple == 30) {
|
||||
if (minus < 49) {
|
||||
resNum = minus - WINDOW_96;
|
||||
} else if (minMultiple == INTERVAL_TIME_30) {
|
||||
if (minus <= WINDOW_48) {
|
||||
throw new BusinessException(AdvanceResponseEnum.WIN_TIME_ERROR);
|
||||
}
|
||||
resNum = minus - 48;
|
||||
resNum = minus - WINDOW_48;
|
||||
} else {
|
||||
throw new BusinessException(AdvanceResponseEnum.CALCULATE_INTERVAL_ERROR);
|
||||
}
|
||||
@@ -536,13 +536,6 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
qvvrDataEntity.setFKData(FKdata);
|
||||
qvvrDataEntity.setHKData(HKdata);
|
||||
}
|
||||
// ResponsibilityCallDllOrSo responsibilityCallDllOrSo = new ResponsibilityCallDllOrSo("harm_response");
|
||||
// responsibilityCallDllOrSo.setPath();
|
||||
// ResponsibilityCallDllOrSo.ResponsibilityLibrary responsibilityLibrary = ResponsibilityCallDllOrSo.ResponsibilityLibrary.INSTANTCE;
|
||||
// responsibilityLibrary.harm_response(qvvrStruct);
|
||||
// if (qvvrStruct.cal_ok == 0) {
|
||||
// throw new BusinessException(AdvanceResponseEnum.RESPONSIBILITY_PARAMETER_ERROR);
|
||||
// }
|
||||
ResponsibilityAlgorithm responsibilityAlgorithm = new ResponsibilityAlgorithm();
|
||||
qvvrDataEntity = responsibilityAlgorithm.getResponsibilityResult(qvvrDataEntity);
|
||||
if (qvvrDataEntity.calOk == 0) {
|
||||
@@ -582,13 +575,13 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
timeDatas.add(calendar.getTimeInMillis());
|
||||
}
|
||||
//OK拿到所有测量点的数据了,现在就是看如何将相同户号的动态数据进行算术和求值,之前的用户name为:户号@测量点号@用户名
|
||||
Map<String/*用户名(户号)*/, List<CustomerData>> customerDataTemp = new HashMap<>();
|
||||
for (int i = 0; i < customerDatas.length; i++) {
|
||||
String customerName = customerDatas[i].getCustomerName();
|
||||
Map<String/*用户名(户号)*/, List<CustomerData>> customerDataTemp = new HashMap<>(32);
|
||||
for (CustomerData data : customerDatas) {
|
||||
String customerName = data.getCustomerName();
|
||||
String[] customerInfo = customerName.split("@");
|
||||
String name = customerInfo[2] + "(" + customerInfo[0] + ")";
|
||||
List<CustomerData> customerData = customerDataTemp.get(name);
|
||||
CustomerData customerTemp = customerDatas[i];
|
||||
CustomerData customerTemp = data;
|
||||
customerTemp.setCustomerName(name);
|
||||
if (CollectionUtils.isEmpty(customerData)) {
|
||||
customerData = new ArrayList<>();
|
||||
@@ -612,15 +605,15 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
//表示用户唯一的
|
||||
customerData.add(customerData1.get(0));
|
||||
} else {
|
||||
//表示用户可能包含多个监测点号,需要进行数据累加
|
||||
// 表示用户可能包含多个监测点号,需要进行数据累加
|
||||
CustomerData customerDataT = new CustomerData();
|
||||
customerDataT.setCustomerName(cusName);
|
||||
//进行数值累加
|
||||
List<Float> valueDatas = new ArrayList<>();
|
||||
for (int i = 0; i < customerData1.get(0).getValueDatas().size(); i++) {
|
||||
float original = 0.0f;
|
||||
for (int k = 0; k < customerData1.size(); k++) {
|
||||
original = original + customerData1.get(k).getValueDatas().get(i);
|
||||
for (CustomerData data : customerData1) {
|
||||
original = original + data.getValueDatas().get(i);
|
||||
}
|
||||
valueDatas.add(original);
|
||||
}
|
||||
@@ -650,17 +643,17 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
respDataResult.setLimitValue(responsibilitySecondCalParam.getLimitValue());
|
||||
//时间横轴数据 timeDatas
|
||||
JSONArray timeDataJson = JSONArray.parseArray(JSON.toJSONString(timeDatas));
|
||||
InputStream timeDataStream = IoUtil.toStream(timeDataJson.toString(), CharsetUtil.UTF_8);
|
||||
InputStream timeDataStream = IoUtil.toUtf8Stream(timeDataJson.toString());
|
||||
String timeDataPath = fileStorageUtil.uploadStream(timeDataStream, OssPath.RESPONSIBILITY_USER_RESULT_DATA, FileUtil.generateFileName("json"));
|
||||
respDataResult.setTimeData(timeDataPath);
|
||||
//用户每时刻对应的责任数据
|
||||
JSONArray customerDataJson = JSONArray.parseArray(JSON.toJSONString(customerData));
|
||||
InputStream customerStream = IoUtil.toStream(customerDataJson.toString(), CharsetUtil.UTF_8);
|
||||
InputStream customerStream = IoUtil.toUtf8Stream(customerDataJson.toString());
|
||||
String customerPath = fileStorageUtil.uploadStream(customerStream, OssPath.RESPONSIBILITY_USER_RESULT_DATA, FileUtil.generateFileName("json"));
|
||||
respDataResult.setUserDetailData(customerPath);
|
||||
//用户前10数据存储
|
||||
JSONArray customerResJson = JSONArray.parseArray(JSON.toJSONString(customerResponsibilities));
|
||||
InputStream customerResStream = IoUtil.toStream(customerResJson.toString(), CharsetUtil.UTF_8);
|
||||
InputStream customerResStream = IoUtil.toUtf8Stream(customerResJson.toString());
|
||||
String customerResPath = fileStorageUtil.uploadStream(customerResStream, OssPath.RESPONSIBILITY_USER_RESULT_DATA, FileUtil.generateFileName("json"));
|
||||
respDataResult.setUserResponsibility(customerResPath);
|
||||
respDataResultService.save(respDataResult);
|
||||
@@ -681,19 +674,20 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
DecimalFormat decimalFormat = new DecimalFormat("0.0000");
|
||||
Map<String, Map<String, List<UserDataExcel>>> result;
|
||||
//当监测点测量间隔为10分钟时,功率数据需要调整为30分钟数据
|
||||
result = new HashMap<>();
|
||||
result = new HashMap<>(32);
|
||||
Set<String> userNames = finalData.keySet();
|
||||
for (String userName : userNames) {
|
||||
Map<String, List<UserDataExcel>> temp = new HashMap<>();
|
||||
Map<String, List<UserDataExcel>> temp = new HashMap<>(32);
|
||||
Map<String, List<UserDataExcel>> original = finalData.get(userName);
|
||||
Set<String> dates = original.keySet();
|
||||
for (String date : dates) {
|
||||
List<UserDataExcel> single = original.get(date);//某当天的数据
|
||||
//某当天的数据
|
||||
List<UserDataExcel> single = original.get(date);
|
||||
//先根据事时间排序
|
||||
Collections.sort(single);
|
||||
//此时根据当天所有的数据,重新计算出所有时间点的数据,担心这个过程会消耗过长时间
|
||||
List<UserDataExcel> tempDatas = new ArrayList<>();
|
||||
for (int i = 0; i < 96; i = i + 2) {
|
||||
for (int i = 0; i < WINDOW_96; i = i + 2) {
|
||||
//30分钟内的2个15分钟功率数据相加作平均计算30分钟内的功率数据,最终的数据序列时间间隔30分钟。by 友谊文档
|
||||
UserDataExcel tempData = new UserDataExcel();
|
||||
tempData.setUserName(single.get(i).getUserName());
|
||||
@@ -720,7 +714,7 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
* @param lineInterval 测量间隔
|
||||
*/
|
||||
private List<HarmData> getDataWithLineInterval(List<HarmData> historyData, int lineInterval) {
|
||||
List<HarmData> result = new ArrayList<>();
|
||||
List<HarmData> result;
|
||||
switch (lineInterval) {
|
||||
case 1:
|
||||
result = getHarmResultByTimes(historyData, 15);
|
||||
@@ -728,8 +722,8 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
case 3:
|
||||
result = getHarmResultByTimes(historyData, 5);
|
||||
break;
|
||||
case 5:
|
||||
case 10:
|
||||
// 间隔为5、10时,直接返回即可
|
||||
default:
|
||||
result = getHarmResultByTimes(historyData, 3);
|
||||
break;
|
||||
}
|
||||
@@ -764,9 +758,10 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
* 根据接口返回值组装需要显示的责任量化数据
|
||||
*/
|
||||
private List<CustomerResponsibility> getCustomerResponsibilityData(List<String> names, float[] sumFKdata, int pNode) {
|
||||
Map<String/*用户名(户号)*/, CustomerResponsibility> customerResponsibilityMap = new HashMap<>();
|
||||
Map<String/*用户名(户号)*/, CustomerResponsibility> customerResponsibilityMap = new HashMap<>(16);
|
||||
for (int i = 0; i < pNode; i++) {
|
||||
String[] customerInfo = names.get(i).split("@");/*用户ID 测量点ID 用户名*/
|
||||
/*用户ID 测量点ID 用户名*/
|
||||
String[] customerInfo = names.get(i).split("@");
|
||||
String name = customerInfo[2] + "(" + customerInfo[0] + ")";
|
||||
CustomerResponsibility customerResponsibility;
|
||||
if (customerResponsibilityMap.containsKey(name)) {
|
||||
@@ -787,10 +782,10 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
}
|
||||
//取出前十的用户责任数据
|
||||
customerResponsibilities = customerResponsibilities.stream().sorted(Comparator.comparing(CustomerResponsibility::getResponsibilityData).reversed()).collect(Collectors.toList());
|
||||
if (customerResponsibilities.size() > 10) {
|
||||
if (customerResponsibilities.size() > SORT_10) {
|
||||
//当用户超出10,将前十用户保留,然后剩余归类为其他用户
|
||||
float tenTotal = 0.0f;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
for (int i = 0; i < SORT_10; i++) {
|
||||
float temp = PubUtils.floatRound(3, customerResponsibilities.get(i).getResponsibilityData());
|
||||
tenTotal = tenTotal + temp;
|
||||
}
|
||||
@@ -843,7 +838,7 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
tempe = i;
|
||||
} else if (times.get(i + 1).equals(limitEL)) {
|
||||
tempe = i + 1;
|
||||
} else if (times.get(i) < limitEL & times.get(i + 1) > limitEL) {//
|
||||
} else if (times.get(i) < limitEL & times.get(i + 1) > limitEL) {
|
||||
//当起始时间处于中间时,将前值赋值给temps
|
||||
tempe = i;
|
||||
}
|
||||
@@ -865,7 +860,7 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
*/
|
||||
private Map<String, Map<String, List<UserDataExcel>>> getFinalUserData(DealDataResult dealDataResult, List<String> dateStr) {
|
||||
Map<String/*户号@监测点号@户名*/, Map<String/*yyyy-MM-dd天日期*/, List<UserDataExcel>>> totalData = dealDataResult.getTotalListData();
|
||||
Map<String/*户号@监测点号@户名*/, Map<String/*yyyy-MM-dd天日期*/, List<UserDataExcel>>> finalData = new HashMap<>();
|
||||
Map<String/*户号@监测点号@户名*/, Map<String/*yyyy-MM-dd天日期*/, List<UserDataExcel>>> finalData = new HashMap<>(16);
|
||||
/*第一个参数pNode 如果时间范围内完整性不足90%的节点,不参与责任量化统计,因为之前处理过用采数据,此时只需要判断是否满足100%就可以判断*/
|
||||
int dueCounts = dateStr.size() * 96;
|
||||
Set<String> userNames = totalData.keySet();
|
||||
@@ -893,12 +888,12 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
LineDetailDataVO lineDetailData = lineFeignClient.getLineDetailData(lineId).getData();
|
||||
int lineInterval = lineDetailData.getTimeInterval();
|
||||
int userIntervalTime;
|
||||
if (lineInterval == 1 || lineInterval == 3 || lineInterval == 5) {
|
||||
userIntervalTime = 15;
|
||||
pNum = dateStr.size() * 96;
|
||||
if (lineInterval == INTERVAL_TIME_1 || lineInterval == INTERVAL_TIME_3 || lineInterval == INTERVAL_TIME_5) {
|
||||
userIntervalTime = INTERVAL_TIME_15;
|
||||
pNum = dateStr.size() * WINDOW_96;
|
||||
} else {
|
||||
userIntervalTime = 30;
|
||||
pNum = dateStr.size() * 48;
|
||||
userIntervalTime = INTERVAL_TIME_30;
|
||||
pNum = dateStr.size() * WINDOW_48;
|
||||
finalData = dealFinalDataByLineInterval(finalData);
|
||||
}
|
||||
return new RespCommon(pNum, userIntervalTime, lineInterval);
|
||||
@@ -918,9 +913,9 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
List<Long> harmTime = new ArrayList<>();
|
||||
for (int i = 0; i < historyData.size(); i++) {
|
||||
Float value = historyData.get(i).getValue();
|
||||
if (value != null) {
|
||||
// if (value != null) {
|
||||
// value = value * 1000;
|
||||
}
|
||||
// }
|
||||
harmData[i] = value;
|
||||
harmTime.add(PubUtils.instantToDate(historyData.get(i).getTime()).getTime());
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ 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.utils.EnumUtils;
|
||||
import com.njcn.device.biz.enums.DeviceResponseEnum;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.njcn.advance.utils;
|
||||
|
||||
import com.njcn.advance.enums.AdvanceResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import org.apache.commons.math3.linear.DecompositionSolver;
|
||||
import org.apache.commons.math3.linear.LUDecomposition;
|
||||
import org.apache.commons.math3.linear.MatrixUtils;
|
||||
@@ -102,10 +104,16 @@ public class CZNLPG {
|
||||
//矩阵求逆
|
||||
|
||||
public static RealMatrix inverseMatrix(RealMatrix matrix) {
|
||||
LUDecomposition LUDe = new LUDecomposition(matrix);
|
||||
DecompositionSolver solver = LUDe.getSolver();
|
||||
RealMatrix result = solver.getInverse();
|
||||
return result;
|
||||
try {
|
||||
LUDecomposition LUDe = new LUDecomposition(matrix);
|
||||
DecompositionSolver solver = LUDe.getSolver();
|
||||
RealMatrix result = solver.getInverse();
|
||||
return result;
|
||||
}catch (Exception e){
|
||||
throw new BusinessException("数据存在问题无法进行矩阵求逆");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,7 +38,7 @@ public class GetBalanceUtils {
|
||||
filterData(list, newList);
|
||||
|
||||
// 如果newList为空则不带入dll计算
|
||||
if (newList.size() > 0) {
|
||||
if (!newList.isEmpty()) {
|
||||
packageData(newList, qvvrDataStruct);
|
||||
JnaCallDllOrSo jnaCallDll = new JnaCallBalance("qvvr_balance");
|
||||
System.out.println("路径>>>>>>>"+jnaCallDll.getStrpath());
|
||||
@@ -63,33 +63,41 @@ public class GetBalanceUtils {
|
||||
for (BalanceInfo balanceInfo : list2) {
|
||||
if (balanceInfo.getAreaIndex().equals(list.get(i).getAreaIndex())) {
|
||||
balanceInfo.setCi(qvvrDataStruct.sys_res[i].CI);
|
||||
balanceInfo.setIsCount(1); // 已计算
|
||||
// 已计算
|
||||
balanceInfo.setIsCount(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (int j = 0; j < list.get(i).getList().size(); j++) {
|
||||
list.get(i).getList().get(j).setCiv(qvvrDataStruct.sys_res[i].CIV[j]); // 设置监测点的评估数据
|
||||
list.get(i).getList().get(j).setL(qvvrDataStruct.sys_res[i].L[j]); // 设置监测点的评估等级
|
||||
// 设置监测点的评估数据
|
||||
list.get(i).getList().get(j).setCiv(qvvrDataStruct.sys_res[i].CIV[j]);
|
||||
// 设置监测点的评估等级
|
||||
list.get(i).getList().get(j).setL(qvvrDataStruct.sys_res[i].L[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void packageData(List<BalanceInfo> list, QvvrDataStruct qvvrDataStruct) {
|
||||
qvvrDataStruct.sys_num = list.size(); // 系统数目
|
||||
// 系统数目
|
||||
qvvrDataStruct.sys_num = list.size();
|
||||
|
||||
for (int i = 0; i < qvvrDataStruct.sys_num; i++) {
|
||||
qvvrDataStruct.line_num[i] = list.get(i).getList().size(); // 监测点数目
|
||||
// 监测点数目
|
||||
qvvrDataStruct.line_num[i] = list.get(i).getList().size();
|
||||
QtIdxArray qtIdxArray = new QtIdxArray();
|
||||
|
||||
for (int j = 0; j < list.get(i).getList().size(); j++) {
|
||||
qtIdxArray.qtIdxs[j] = list.get(i).getList().get(j).getQtIdx(); // 各监测点数据
|
||||
// 各监测点数据
|
||||
qtIdxArray.qtIdxs[j] = list.get(i).getList().get(j).getQtIdx();
|
||||
}
|
||||
|
||||
qvvrDataStruct.line_idx[i] = qtIdxArray;
|
||||
}
|
||||
}
|
||||
|
||||
// 过滤掉没有监测点,没有暂降事件的数据
|
||||
/**
|
||||
* 过滤掉没有监测点,没有暂降事件的数据
|
||||
*/
|
||||
private void filterData(List<BalanceInfo> list, List<BalanceInfo> listResult) {
|
||||
for (BalanceInfo balanceInfo : list) {
|
||||
BalanceInfo balanceInfo2 = new BalanceInfo();
|
||||
|
||||
@@ -7,8 +7,8 @@ import com.njcn.common.utils.PubUtils;
|
||||
*/
|
||||
public class RadarUtil {
|
||||
|
||||
private static double[] w = {0.565, 0.2622, 0.1175, 0.0553};
|
||||
private static int[][] a = {{1, 0, 0, 0, 0}, {0, 1, 0, 0, 0}, {0, 0, 1, 0, 0}, {0, 0, 0, 1, 0}, {0, 0, 0, 0, 1}};
|
||||
private static final double[] w = {0.565, 0.2622, 0.1175, 0.0553};
|
||||
private static final int[][] a = {{1, 0, 0, 0, 0}, {0, 1, 0, 0, 0}, {0, 0, 1, 0, 0}, {0, 0, 0, 1, 0}, {0, 0, 0, 0, 1}};
|
||||
|
||||
/**
|
||||
* 获取治理前后的风险评估等级
|
||||
@@ -21,10 +21,10 @@ public class RadarUtil {
|
||||
double temp = 0d;
|
||||
double[] b = getB(lossAverage, coefficient);
|
||||
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
for (int[] ints : a) {
|
||||
int j = 0;
|
||||
for (; j < b.length; j++) {
|
||||
temp = temp + Math.abs(a[i][j] - b[j]);
|
||||
temp = temp + Math.abs(ints[j] - b[j]);
|
||||
}
|
||||
temp = 1 - temp / j;
|
||||
if (temp > n) {
|
||||
@@ -45,10 +45,10 @@ public class RadarUtil {
|
||||
double temp = 0d;
|
||||
double[] b = getB(lossAverage, coefficient);
|
||||
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
for (int[] ints : a) {
|
||||
int j = 0;
|
||||
for (; j < b.length; j++) {
|
||||
temp = temp + Math.abs(a[i][j] - b[j]);
|
||||
temp = temp + Math.abs(ints[j] - b[j]);
|
||||
}
|
||||
temp = 1 - temp / j;
|
||||
if (temp > n) {
|
||||
@@ -124,6 +124,7 @@ public class RadarUtil {
|
||||
} else if (y >= 1 && y < 2.5) {
|
||||
r[0] = (2.5 - y) / (2.5 - 1.0);
|
||||
}
|
||||
|
||||
//1B1
|
||||
if (y >= 0.5 && y < 2.0) {
|
||||
r[1] = (y - 0.5) / (2.0 - 0.5);
|
||||
@@ -181,11 +182,12 @@ public class RadarUtil {
|
||||
* @param governYearLoss 治理后损失
|
||||
*/
|
||||
public static Double getRadarResult(Double yearLoss, Double governYearLoss) {
|
||||
// 年治理效果
|
||||
double loss = yearLoss - governYearLoss;
|
||||
if (loss == 0D || yearLoss == 0) {
|
||||
return 0D;
|
||||
} else {
|
||||
return PubUtils.doubleRound(2,loss / (Math.ceil(yearLoss / 100D) * 100));
|
||||
return PubUtils.doubleRound(2, loss / (Math.ceil(yearLoss / 100D) * 100));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,28 +4,33 @@ package com.njcn.advance.utils;
|
||||
import com.njcn.advance.pojo.dto.relevent.*;
|
||||
|
||||
public class UtilNormalization {
|
||||
public static void matrixcata_pro(EntityLogic[] transformer, EntityMtrans entityMtrans, int len) {
|
||||
int i, j, k, con;
|
||||
String node1, node2;
|
||||
public static void matrixcata_pro(EntityLogic[] transformer,EntityMtrans entityMtrans, int len) {
|
||||
int i, j, k;
|
||||
int node1, node2, con;
|
||||
int src_node[] = new int[] { 0 };
|
||||
|
||||
// 连接方式转化为矩阵形式,行、列表示所有节点
|
||||
// inf表示两个节点不相连,0表示与自身相连,其他数值表示变压器连接类型
|
||||
// 将初始矩阵的元素设为inf,对角线元素设为0
|
||||
for (i = 0; i < FinalData.NODE_NUM; i++) {
|
||||
for (j = 0; j < FinalData.NODE_NUM; j++) {
|
||||
for (j = 0; j < FinalData.NODE_NUM; j++)
|
||||
entityMtrans.getMtrans()[i][j] = FinalData.DATA_INF;
|
||||
}
|
||||
entityMtrans.getMtrans()[i][i] = 0;
|
||||
}
|
||||
|
||||
// 根据transformer设置元素
|
||||
for (i = 0; i < len; i++) {
|
||||
node1 = transformer[i].getNode_h();
|
||||
node2 = transformer[i].getNode_l();
|
||||
con = transformer[i].getType();
|
||||
entityMtrans.getMtrans()[node1 - 1][node2 - 1] = con;
|
||||
entityMtrans.getMtrans()[node2 - 1][node1 - 1] = con;
|
||||
}
|
||||
StringBuilder str = new StringBuilder();
|
||||
for (i = 0; i < FinalData.NODE_NUM; i++) {
|
||||
for (j = 0; j < FinalData.NODE_NUM; j++) {
|
||||
str.append(entityMtrans.getMtrans()[i][j]).append(" ");
|
||||
if (j == (FinalData.NODE_NUM - 1)) {
|
||||
if (j == (FinalData.NODE_NUM - 1))
|
||||
str.append("\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,60 +38,52 @@ public class UtilNormalization {
|
||||
// Matrixcata模式匹配矩阵,列为节点数,行为总类别数,元素为第一个节点分别是1-6类别情况下其他节点类别情况。
|
||||
// 元素1,2,3,4,5,6 分别对应 Dc,Cb,Da,Cc,Db,Ca
|
||||
// 设置矩阵第一行元素
|
||||
for (i = 0; i < FinalData.NODE_NUM; i++) {
|
||||
for (i = 0; i < FinalData.NODE_NUM; i++)
|
||||
entityMtrans.getMatrixcata0()[0][i] = 0;
|
||||
}
|
||||
for (i = 1; i < FinalData.NODE_NUM; i++) {
|
||||
// 路径缓存清空
|
||||
for (j = 0; j < FinalData.MAX_PATH_NUM; j++) {
|
||||
for (k = 0; k < (FinalData.NODE_NUM + 1); k++) {
|
||||
for (k = 0; k < (FinalData.NODE_NUM + 1); k++)
|
||||
entityMtrans.getPossiable_path()[j][k] = 0;
|
||||
}
|
||||
}
|
||||
entityMtrans.setPath_num(0);
|
||||
// 寻找路径
|
||||
src_node[0] = 0;
|
||||
findPath(entityMtrans, src_node, i, 0, 1, FinalData.NODE_NUM);
|
||||
if (entityMtrans.getPath_num() != 0) {
|
||||
if (entityMtrans.getPath_num() != 0)
|
||||
entityMtrans.getMatrixcata0()[0][i] = entityMtrans.getPossiable_path()[0][FinalData.NODE_NUM]; // 采用第一条路径
|
||||
} else {
|
||||
else
|
||||
entityMtrans.getMatrixcata0()[0][i] = FinalData.DATA_INF; // 找不到路径填大值表示不通
|
||||
}
|
||||
}
|
||||
// 构造矩阵其他行元素
|
||||
for (i = 1; i < FinalData.EVT_TYPE_NUM; i++) {
|
||||
for (j = 0; j < FinalData.NODE_NUM; j++)
|
||||
// EntityGroupData.Matrixcata0[i][j] =
|
||||
// EntityGroupData.Matrixcata0[0][j] + i;
|
||||
{
|
||||
if (entityMtrans.getMatrixcata0()[0][j] == FinalData.DATA_INF) {
|
||||
entityMtrans.getMatrixcata0()[i][j] = FinalData.DATA_INF;
|
||||
} else {
|
||||
entityMtrans.getMatrixcata0()[i][j] = entityMtrans.getMatrixcata0()[0][j] + i;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 将数据归类到0-5
|
||||
for (i = 0; i < FinalData.EVT_TYPE_NUM; i++) {
|
||||
for (j = 0; j < FinalData.NODE_NUM; j++) {
|
||||
for (j = 0; j < FinalData.NODE_NUM; j++)
|
||||
entityMtrans.getMatrixcata1()[i][j] = entityMtrans.getMatrixcata0()[i][j] % 6;
|
||||
}
|
||||
}
|
||||
// 0换成6,将数据归类到1-6
|
||||
for (i = 0; i < FinalData.EVT_TYPE_NUM; i++) {
|
||||
for (j = 0; j < FinalData.NODE_NUM; j++) {
|
||||
if (entityMtrans.getMatrixcata1()[i][j] == 0) {
|
||||
if (entityMtrans.getMatrixcata1()[i][j] == 0)
|
||||
entityMtrans.getMatrixcata1()[i][j] = 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
str.delete(0, str.length());
|
||||
for (i = 0; i < FinalData.EVT_TYPE_NUM; i++) {
|
||||
for (j = 0; j < FinalData.NODE_NUM; j++) {
|
||||
str.append(entityMtrans.getMatrixcata1()[i][j]).append(" ");
|
||||
if (j == (FinalData.NODE_NUM - 1)) {
|
||||
if (j == (FinalData.NODE_NUM - 1))
|
||||
str.append("\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.time.*;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/*****************************************************************
|
||||
* 字符串转基础类型,可能转换不成功,封装该方法
|
||||
@@ -113,16 +114,16 @@ public class Utils {
|
||||
public static boolean isTimeInRange(Instant instant, LocalDate startTime, LocalDate endTime) {
|
||||
// 将Instant对象转换为LocalDateTime对象
|
||||
LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
|
||||
|
||||
Instant instant1 = startTime.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant().plusMillis(TimeUnit.HOURS.toMillis(8));
|
||||
Instant instant2 = endTime.plusDays(1).atStartOfDay(ZoneId.systemDefault()).toInstant().plusMillis(TimeUnit.HOURS.toMillis(8));
|
||||
// 检查LocalDateTime对象是否在startTime和endTime之间
|
||||
boolean isInRange = !localDateTime.toLocalDate().isBefore(startTime) && !localDateTime.toLocalDate().isAfter(endTime.plus(1, ChronoUnit.DAYS));
|
||||
boolean isInRange = instant1.isBefore(instant) && instant2.isAfter(instant);
|
||||
|
||||
// 返回结果
|
||||
return isInRange;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static <T> List<Double> getAttributeValueByPropertyName(List<T> list, String propertyName) {
|
||||
List<Double> resultList = new ArrayList<>();
|
||||
for (T item : list) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
27
pqs-algorithm/algorithm-api/pom.xml
Normal file
27
pqs-algorithm/algorithm-api/pom.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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-algorithm</artifactId>
|
||||
<groupId>com.njcn</groupId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>algorithm-api</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>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.njcn.algorithm.pojo.param;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 算法编排的计算参数
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年11月03日 09:21
|
||||
*/
|
||||
@Data
|
||||
public class CalculatedParam<T> implements Serializable {
|
||||
|
||||
/***
|
||||
* 是否全链路执行算法
|
||||
* 非全链路执行时,tag集合必须非空
|
||||
*/
|
||||
@ApiModelProperty(name = "fullChain",value = "是否全链执行")
|
||||
private boolean fullChain;
|
||||
|
||||
/**
|
||||
* 目前仅监测点日统计存在补招功能 by yxb
|
||||
* 是否补招标识,默认不补招
|
||||
*/
|
||||
@ApiModelProperty(name = "repair",value = "是否补招")
|
||||
private boolean repair;
|
||||
|
||||
/**
|
||||
* 日期_yyyy-MM-dd
|
||||
*/
|
||||
@ApiModelProperty(name = "dataDate",value = "时间日期_yyyy-MM-dd")
|
||||
private String dataDate;
|
||||
|
||||
/***
|
||||
* 需要执行的组件
|
||||
* 当不需要全链路执行时,通过tag名称动态指定执行某个算法组件
|
||||
*/
|
||||
@ApiModelProperty(name = "tagNames",value = "待执行链节点的tag集合")
|
||||
private Set<String> tagNames;
|
||||
|
||||
/**
|
||||
* 待计算的对象索引集合,监测点、设备、母线、变电站、单位下监测点等等
|
||||
*/
|
||||
@ApiModelProperty(name = "idList",value = "索引集合")
|
||||
private List<T> idList;
|
||||
}
|
||||
131
pqs-algorithm/algorithm-boot/pom.xml
Normal file
131
pqs-algorithm/algorithm-boot/pom.xml
Normal file
@@ -0,0 +1,131 @@
|
||||
<?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-algorithm</artifactId>
|
||||
<groupId>com.njcn</groupId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>algorithm-boot</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>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-swagger</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-microservice</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-redis</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>algorithm-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-spring-boot-starter</artifactId>
|
||||
<version>2.12.4.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-rule-nacos</artifactId>
|
||||
<version>2.12.4.1</version>
|
||||
</dependency>
|
||||
|
||||
<!--暂态模块-->
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>event-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--稳态模块-->
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>harmonic-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>algorithmboot</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>com.spotify</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>build-image</id>
|
||||
<phase>${docker.operate}</phase>
|
||||
<goals>
|
||||
<goal>build</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<!--<serverId>36dockerHarbor</serverId>-->
|
||||
<registryUrl>http://${docker.repostory}</registryUrl>
|
||||
<!-- 镜像名称 -->
|
||||
<imageName>${docker.repostory}/${docker.registry.name}/${project.artifactId}</imageName>
|
||||
<imageTags>
|
||||
<imageTag>latest</imageTag>
|
||||
</imageTags>
|
||||
<dockerHost>${docker.url}</dockerHost>
|
||||
<dockerDirectory>${basedir}/</dockerDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>/ROOT</targetPath>
|
||||
<directory>${project.build.directory}</directory>
|
||||
<include>${project.build.finalName}.jar</include>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.algorithm;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0
|
||||
* @data 2024/11/4 14:05
|
||||
*/
|
||||
@Slf4j
|
||||
@EnableFeignClients(basePackages = "com.njcn")
|
||||
@SpringBootApplication(scanBasePackages = "com.njcn")
|
||||
public class AlgorithmApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(AlgorithmApplication.class,args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.njcn.algorithm.event.mapper;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.event.pojo.po.RMpEventDetailD;
|
||||
import com.njcn.event.pojo.po.RMpEventDetailM;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0
|
||||
* @data 2024/11/6 15:55
|
||||
*/
|
||||
public interface RMpEventDetailDMapper extends MppBaseMapper<RMpEventDetailD> {
|
||||
|
||||
/***
|
||||
* 处理在暂态指标明细——月报表数据获取
|
||||
* @author hongawen
|
||||
* @date 2023/11/2 10:54
|
||||
* @param lineIds 监测点集合
|
||||
* @param dataDate 统计日期
|
||||
* @param beginMonth 起始时间
|
||||
* @param endMonth 截止时间
|
||||
* @return List<RMpEventDetailDPO>
|
||||
*/
|
||||
List<RMpEventDetailM> handleMonth(@Param("lineIds") List<String> lineIds, @Param("dataDate") String dataDate, @Param("beginMonth") DateTime beginMonth, @Param("endMonth") DateTime endMonth);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.njcn.algorithm.event.mapper;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.event.pojo.po.RMpEventDetailM;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/12/28 14:58【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface RMpEventDetailMMapper extends MppBaseMapper<RMpEventDetailM> {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.njcn.algorithm.event.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.event.pojo.po.RMpEventDetailD;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0
|
||||
* @data 2024/11/6 15:43
|
||||
*/
|
||||
public interface RMpEventDetailMapper extends BaseMapper<RmpEventDetailPO> {
|
||||
|
||||
/***
|
||||
* 处理在暂态指标明细——日报表数据获取
|
||||
* @author hongawen
|
||||
* @date 2023/11/2 10:54
|
||||
* @param lineIds 监测点集合
|
||||
* @param dataDate 统计日期
|
||||
* @param beginDay 起始时间
|
||||
* @param endDay 截止时间
|
||||
* @param voltageDip 电压暂降
|
||||
* @param voltageRise 电压暂升
|
||||
* @param shortInterruptions 短时中断
|
||||
* @return List<RMpEventDetailDPO>
|
||||
*/
|
||||
List<RMpEventDetailD> handleDay(@Param("lineIds") List<String> lineIds, @Param("dataDate") String dataDate, @Param("beginDay") LocalDateTime beginDay, @Param("endDay") LocalDateTime endDay, @Param("voltageDip") String voltageDip, @Param("voltageRise") String voltageRise, @Param("shortInterruptions") String shortInterruptions);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.algorithm.event.mapper.RMpEventDetailDMapper">
|
||||
|
||||
<select id="handleMonth" resultType="com.njcn.event.pojo.po.RMpEventDetailM">
|
||||
SELECT
|
||||
#{dataDate} dataDate,
|
||||
measurement_point_id measurement_point_id,
|
||||
sum(sag_times) AS sagTimes,
|
||||
sum(swell_times) AS swellTimes,
|
||||
sum(interrupt_times) AS interruptTimes
|
||||
FROM
|
||||
r_mp_event_detail_d r_mp_event_detail_d
|
||||
where
|
||||
r_mp_event_detail_d.data_date between #{beginMonth} and #{endMonth}
|
||||
AND
|
||||
r_mp_event_detail_d.measurement_point_id IN
|
||||
<foreach collection="lineIds" item="lineId" separator="," open="(" close=")">
|
||||
#{lineId}
|
||||
</foreach>
|
||||
GROUP BY
|
||||
measurement_point_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.algorithm.event.mapper.RMpEventDetailMMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.algorithm.event.mapper.RMpEventDetailMapper">
|
||||
|
||||
<select id="handleDay" resultType="com.njcn.event.pojo.po.RMpEventDetailD">
|
||||
SELECT
|
||||
#{dataDate} dataDate,
|
||||
measurement_point_id measurement_point_id,
|
||||
sum( event_type = #{voltageDip} ) AS sagTimes,
|
||||
sum( event_type = #{voltageRise} ) AS swellTimes,
|
||||
sum( event_type = #{shortInterruptions} ) AS interruptTimes
|
||||
FROM
|
||||
r_mp_event_detail r_mp_event_detail
|
||||
where r_mp_event_detail.start_time between #{beginDay} and #{endDay}
|
||||
AND r_mp_event_detail.measurement_point_id
|
||||
IN
|
||||
<foreach collection="lineIds" item="lineId" separator="," open="(" close=")">
|
||||
#{lineId}
|
||||
</foreach>
|
||||
GROUP BY
|
||||
measurement_point_id
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.njcn.algorithm.event.service;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.algorithm.pojo.param.CalculatedParam;
|
||||
import com.njcn.event.pojo.po.RMpEventDetailD;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0
|
||||
* @data 2024/11/6 15:48
|
||||
*/
|
||||
public interface IRMpEventDetailDService extends IMppService<RMpEventDetailD> {
|
||||
|
||||
/***
|
||||
* 监测点暂态指标明细--月表算法
|
||||
* @author hongawen
|
||||
* @date 2023/11/2 11:19
|
||||
* @param calculatedParam 查询条件
|
||||
*/
|
||||
void handleMonth(CalculatedParam calculatedParam);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.njcn.algorithm.event.service;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.event.pojo.po.RMpEventDetailM;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0
|
||||
* @data 2024/11/6 16:03
|
||||
*/
|
||||
public interface IRMpEventDetailMService extends IMppService<RMpEventDetailM> {
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.njcn.algorithm.event.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.algorithm.pojo.param.CalculatedParam;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0
|
||||
* @data 2024/11/6 15:31
|
||||
*/
|
||||
public interface IRMpEventDetailService extends IService<RmpEventDetailPO> {
|
||||
|
||||
|
||||
/***
|
||||
* 监测点暂态指标明细--日表算法
|
||||
* @author hongawen
|
||||
* @date 2023/11/2 11:19
|
||||
* @param calculatedParam 查询条件
|
||||
*/
|
||||
void handleDay(CalculatedParam calculatedParam);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.njcn.algorithm.event.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.algorithm.event.mapper.RMpEventDetailDMapper;
|
||||
import com.njcn.algorithm.event.service.IRMpEventDetailDService;
|
||||
import com.njcn.algorithm.event.service.IRMpEventDetailMService;
|
||||
import com.njcn.algorithm.pojo.param.CalculatedParam;
|
||||
import com.njcn.event.pojo.po.RMpEventDetailD;
|
||||
import com.njcn.event.pojo.po.RMpEventDetailM;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0
|
||||
* @data 2024/11/6 15:49
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class RMpEventDetailDServiceImpl extends MppServiceImpl<RMpEventDetailDMapper, RMpEventDetailD> implements IRMpEventDetailDService {
|
||||
|
||||
|
||||
private final IRMpEventDetailMService rMpEventDetailMService;
|
||||
|
||||
|
||||
|
||||
/***
|
||||
*监测点暂态指标明细--月表算法
|
||||
*/
|
||||
@Override
|
||||
public void handleMonth(CalculatedParam calculatedParam) {
|
||||
List<String> lineIds = calculatedParam.getIdList();
|
||||
//以尺寸1000分片
|
||||
List<List<String>> pendingIds = ListUtils.partition(lineIds, 1000);
|
||||
DateTime beginMonth = DateUtil.beginOfMonth(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN));
|
||||
DateTime endMonth = DateUtil.endOfMonth(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN));
|
||||
for (List<String> pendingId : pendingIds) {
|
||||
List<RMpEventDetailM> rMpEventDetailMPOList = this.baseMapper.handleMonth(pendingId, DateUtil.format(beginMonth, DatePattern.NORM_DATE_PATTERN), beginMonth, endMonth);
|
||||
rMpEventDetailMService.saveOrUpdateBatchByMultiId(rMpEventDetailMPOList);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.algorithm.event.service.impl;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.algorithm.event.mapper.RMpEventDetailMMapper;
|
||||
import com.njcn.algorithm.event.service.IRMpEventDetailMService;
|
||||
import com.njcn.event.pojo.po.RMpEventDetailM;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/12/28 14:58【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class RMpEventDetailMServiceImpl extends MppServiceImpl<RMpEventDetailMMapper, RMpEventDetailM> implements IRMpEventDetailMService {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.njcn.algorithm.event.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.algorithm.event.mapper.RMpEventDetailMapper;
|
||||
import com.njcn.algorithm.event.service.IRMpEventDetailDService;
|
||||
import com.njcn.algorithm.event.service.IRMpEventDetailService;
|
||||
import com.njcn.algorithm.pojo.param.CalculatedParam;
|
||||
import com.njcn.event.pojo.po.RMpEventDetailD;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2023/4/23 13:50【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class RMpEventDetailServiceImpl extends ServiceImpl<RMpEventDetailMapper, RmpEventDetailPO> implements IRMpEventDetailService {
|
||||
|
||||
private final IRMpEventDetailDService rMpEventDetailDService;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
|
||||
/***
|
||||
* 监测点暂态指标明细--日表算法
|
||||
*/
|
||||
@Override
|
||||
public void handleDay(CalculatedParam calculatedParam) {
|
||||
List<String> lineIds = calculatedParam.getIdList();
|
||||
//以尺寸1000分片
|
||||
List<List<String>> pendingIds = ListUtils.partition(lineIds,1000);
|
||||
LocalDateTime beginDay = LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN));
|
||||
LocalDateTime endDay = LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN));
|
||||
for (List<String> pendingId : pendingIds) {
|
||||
//查询
|
||||
List<RMpEventDetailD> rMpEventDetailDList = this.baseMapper.handleDay(
|
||||
pendingId
|
||||
,LocalDateTimeUtil.format(beginDay,DatePattern.NORM_DATE_PATTERN)
|
||||
,beginDay
|
||||
,endDay
|
||||
,getEventTypeId(DicDataEnum.VOLTAGE_DIP.getCode())
|
||||
,getEventTypeId(DicDataEnum.VOLTAGE_RISE.getCode())
|
||||
,getEventTypeId(DicDataEnum.SHORT_INTERRUPTIONS.getCode()));
|
||||
//入库
|
||||
rMpEventDetailDService.saveOrUpdateBatchByMultiId(rMpEventDetailDList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getEventTypeId(String code) {
|
||||
String eventType = redisUtil.getStringByKey(code);
|
||||
eventType = Optional.ofNullable(eventType).orElseGet(() -> {
|
||||
DictData data = dicDataFeignClient.getDicDataByCode(code).getData();
|
||||
redisUtil.saveByKey(data.getCode(), data.getId());
|
||||
return data.getId();
|
||||
});
|
||||
|
||||
return eventType;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.njcn.algorithm.harmonic.line.mapper;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.harmonic.pojo.po.algorithm.line.RMpMonitorEvaluateD;
|
||||
|
||||
/**
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface RMpMonitorEvaluateDMapper extends MppBaseMapper<RMpMonitorEvaluateD> {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.algorithm.harmonic.line.mapper.RMpMonitorEvaluateDMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.algorithm.harmonic.line.service;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.algorithm.pojo.param.CalculatedParam;
|
||||
import com.njcn.harmonic.pojo.po.algorithm.line.RMpMonitorEvaluateD;
|
||||
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2023/4/19 15:42【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface IRMpMonitorEvaluateDService extends IMppService<RMpMonitorEvaluateD> {
|
||||
|
||||
|
||||
/***
|
||||
* 监测点报表--日统计
|
||||
* @author hongawen
|
||||
* @date 2023/11/3 14:48
|
||||
* @param calculatedParam 查询条件
|
||||
*/
|
||||
void handleDay(CalculatedParam calculatedParam);
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
package com.njcn.algorithm.harmonic.line.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.algorithm.harmonic.line.mapper.RMpMonitorEvaluateDMapper;
|
||||
import com.njcn.algorithm.harmonic.line.service.IRMpMonitorEvaluateDService;
|
||||
import com.njcn.algorithm.pojo.param.CalculatedParam;
|
||||
import com.njcn.algorithm.support.mapper.PmsAbnormalRulesMapper;
|
||||
import com.njcn.device.biz.commApi.CommLineClient;
|
||||
import com.njcn.device.biz.pojo.dto.LineDTO;
|
||||
import com.njcn.device.pq.constant.Param;
|
||||
import com.njcn.device.pq.pojo.po.PmsAbnormalRules;
|
||||
import com.njcn.harmonic.pojo.po.algorithm.line.RMpMonitorEvaluateD;
|
||||
import com.njcn.influx.pojo.po.DataFlicker;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class RMpMonitorEvaluateDServiceImpl extends MppServiceImpl<RMpMonitorEvaluateDMapper, RMpMonitorEvaluateD> implements IRMpMonitorEvaluateDService {
|
||||
|
||||
private final CommLineClient commLineClient;
|
||||
// private final DataVInfluxdbService dataVInfluxdbService;
|
||||
// private final PmsAbnormalRulesMapper pmsAbnormalRulesMapper;
|
||||
// private final DataIntegrityRateInfluxService dataIntegrityRateInfluxService;
|
||||
|
||||
/***
|
||||
* 监测点报表--日统计
|
||||
* @author hongawen
|
||||
* @date 2023/11/3 14:48
|
||||
* @param calculatedParam 查询条件
|
||||
*/
|
||||
@Override
|
||||
public void handleDay(CalculatedParam calculatedParam) {
|
||||
// //1、取出规则
|
||||
// List<PmsAbnormalRules> pmsAbnormalRules = pmsAbnormalRulesMapper.selectList(null);
|
||||
// String beginDay =LocalDateTimeUtil.format(LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)),DatePattern.NORM_DATETIME_PATTERN);
|
||||
// String endDay = LocalDateTimeUtil.format(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)),DatePattern.NORM_DATETIME_PATTERN);
|
||||
// //以尺寸1000分片
|
||||
// List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(), 100);
|
||||
// for (List<String> pendingId : pendingIds) {
|
||||
// List<LineDTO> lineDTOList = commLineClient.getLineDetailBatch(pendingId).getData();
|
||||
// List<RMpMonitorEvaluateD> rMpMonitorEvaluateDS = new ArrayList<>();
|
||||
// for (LineDTO lineDTO : lineDTOList) {
|
||||
// if (ObjectUtil.isNotNull(lineDTO)) {
|
||||
// /*todo 统计间隔,电压等级取值方式后期提供融合版本接口获取不然pms,pqs系统取值方式不一样*/
|
||||
// /*统计间隔*/
|
||||
// Integer statisticalInterval = lineDTO.getTimeInterval();
|
||||
// /*电压等级*/
|
||||
// Double voltage = Double.parseDouble(lineDTO.getVoltageLevel());
|
||||
// List<DataVFiveItemDTO> fiveItems = dataVInfluxdbService.getFiveItems(lineDTO.getL@ineId(), beginDay, endDay, statisticalInterval);
|
||||
// RMpMonitorEvaluateD rMpMonitorEvaluateD = new RMpMonitorEvaluateD();
|
||||
// rMpMonitorEvaluateD = calculateRMpMonitorEvaluateDPO(rMpMonitorEvaluateD, fiveItems, pmsAbnormalRules, voltage, lineDTO);
|
||||
// Date date = DateUtil.parse(beginDay);
|
||||
// DataFlicker twoFlickerData = dataIntegrityRateInfluxService.getTwoFlickerData(lineDTO.getLineId(), date, 5);
|
||||
// LocalDate localDate = LocalDateTimeUtil.parseDate(beginDay, DatePattern.NORM_DATETIME_PATTERN);
|
||||
//
|
||||
// if (Objects.isNull(twoFlickerData)) {
|
||||
// rMpMonitorEvaluateD.setPltCount(0);
|
||||
// rMpMonitorEvaluateD.setPstCount(0);
|
||||
// } else {
|
||||
// rMpMonitorEvaluateD.setPltCount(twoFlickerData.getPltCount());
|
||||
// rMpMonitorEvaluateD.setPstCount(twoFlickerData.getPstCount());
|
||||
// }
|
||||
// rMpMonitorEvaluateD.setAllMinuteCount(fiveItems.size());
|
||||
// rMpMonitorEvaluateD.setDeviceId(lineDTO.getDevId());
|
||||
// rMpMonitorEvaluateD.setDataDate(localDate);
|
||||
// rMpMonitorEvaluateD.setMeasurementPointId(lineDTO.getLineId());
|
||||
// rMpMonitorEvaluateDS.add(rMpMonitorEvaluateD);
|
||||
// }
|
||||
// }
|
||||
// if (CollUtil.isNotEmpty(rMpMonitorEvaluateDS)) {
|
||||
// this.saveOrUpdateBatchByMultiId(rMpMonitorEvaluateDS, 500);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 3、频率在【45,55】之间;
|
||||
* 4、相电压有效值在【0.85p.u.,1.2p.u.】之间;p.u=电压等级/1.732
|
||||
* 5、线电压有效值在【0.85p.u.,1.2p.u.】之间;p.u=电压等级
|
||||
* 6、电压总谐波畸变率在【0.1%,20%】之间;
|
||||
* 7、负序电压不平衡度在【0,20%】。满足以上条件则是一条有效数据
|
||||
* @Param: [fiveItems, pmsAbnormalRules, voltage]
|
||||
* @return: java.lang.Integer
|
||||
* @Author: clam
|
||||
* @Date: 2023/2/23
|
||||
*/
|
||||
// private RMpMonitorEvaluateD calculateRMpMonitorEvaluateDPO(RMpMonitorEvaluateD rMpMonitorEvaluateD, List<DataVFiveItemDTO> fiveItems, List<PmsAbnormalRules> pmsAbnormalRules, Double voltage, LineDTO data) {
|
||||
//
|
||||
// Integer freqCount = 0;
|
||||
// Integer unbalanceCount = 0;
|
||||
// Integer phaseVoltageCount = 0;
|
||||
// Integer lineVoltageCount = 0;
|
||||
// Integer vThdCount = 0;
|
||||
// Integer effectiveMinuteCount = 0;
|
||||
//
|
||||
// PmsAbnormalRules freqLimit = pmsAbnormalRules.stream().filter(temp -> Objects.equals(temp.getTarget(), Param.TARGET_FREQ)).collect(Collectors.toList()).get(0);
|
||||
// PmsAbnormalRules rmsLimit = pmsAbnormalRules.stream().filter(temp -> Objects.equals(temp.getTarget(), Param.TARGET_RMS)).collect(Collectors.toList()).get(0);
|
||||
// PmsAbnormalRules rms_lvrLimit = pmsAbnormalRules.stream().filter(temp -> Objects.equals(temp.getTarget(), Param.TARGET_RMS_LVR)).collect(Collectors.toList()).get(0);
|
||||
// PmsAbnormalRules v_thdLimit = pmsAbnormalRules.stream().filter(temp -> Objects.equals(temp.getTarget(), Param.TARGET_V_THD)).collect(Collectors.toList()).get(0);
|
||||
// PmsAbnormalRules v_unbalanceLimit = pmsAbnormalRules.stream().filter(temp -> Objects.equals(temp.getTarget(), Param.TARGET_V_UNBALANCE)).collect(Collectors.toList()).get(0);
|
||||
// if (!CollectionUtils.isEmpty(fiveItems)) {
|
||||
// for (DataVFiveItemDTO fiveItem : fiveItems) {
|
||||
// Double freqMax = fiveItem.getFreqMax();
|
||||
// Double freqMin = fiveItem.getFreqMin();
|
||||
//
|
||||
// Double rmsMax = fiveItem.getRmsMax();
|
||||
// Double rmsMin = fiveItem.getRmsMin();
|
||||
// Double vThdMax = fiveItem.getVThdMax();
|
||||
// Double vThdMin = fiveItem.getVThdMin();
|
||||
//
|
||||
// Double vUnbalanceMax = fiveItem.getVUnbalanceMax();
|
||||
// Double vUnbalanceMin = fiveItem.getVUnbalanceMin();
|
||||
// Double rmsLvrMax = fiveItem.getRmsLvrMax();
|
||||
// Double rmsLvrMin = fiveItem.getRmsLvrMin();
|
||||
//
|
||||
// Boolean rmsflag = false;
|
||||
// Boolean rmsLvrflag = false;
|
||||
// Boolean vUnbalanceflag = false;
|
||||
//
|
||||
// freqCount++;
|
||||
// unbalanceCount++;
|
||||
// phaseVoltageCount++;
|
||||
// lineVoltageCount++;
|
||||
// vThdCount++;
|
||||
// effectiveMinuteCount++;
|
||||
// // 先注释掉 校验跑出监测点
|
||||
//// if (freqLimit.getLowerLimit() <= freqMin && freqMax <= freqLimit.getUpperLimit()) {
|
||||
//// freqCount++;
|
||||
//// }
|
||||
//// /*,监测点的接线方式,如果是星形接线这个指标要判断,角形界面则不判断,默认它是正常的*/
|
||||
//// if (Objects.equals("0", data.getPtType())) {
|
||||
//// if (rmsLimit.getLowerLimit() * (voltage / 1.732) <= rmsMin && rmsMax <= rmsLimit.getUpperLimit() * (voltage / 1.732)) {
|
||||
//// phaseVoltageCount++;
|
||||
//// rmsflag = true;
|
||||
//// }
|
||||
//// } else {
|
||||
//// rmsflag = true;
|
||||
//// phaseVoltageCount++;
|
||||
//// }
|
||||
//// if (Objects.equals("1", data.getPtPhaseType())) {
|
||||
//// if (rms_lvrLimit.getLowerLimit() * voltage <= rmsLvrMin && rmsLvrMax <= rms_lvrLimit.getUpperLimit() * voltage) {
|
||||
//// lineVoltageCount++;
|
||||
//// rmsLvrflag = true;
|
||||
//// }
|
||||
////
|
||||
//// } else {
|
||||
//// rmsLvrflag = true;
|
||||
//// lineVoltageCount++;
|
||||
////
|
||||
//// }
|
||||
//// if (Objects.equals("1", data.getPtPhaseType()) && Objects.equals("0", data.getPtType())) {
|
||||
//// if (v_unbalanceLimit.getLowerLimit() <= vUnbalanceMin && vUnbalanceMax <= v_unbalanceLimit.getUpperLimit()
|
||||
//// ) {
|
||||
//// unbalanceCount++;
|
||||
//// vUnbalanceflag = true;
|
||||
//// }
|
||||
//// } else {
|
||||
//// unbalanceCount++;
|
||||
//// vUnbalanceflag = true;
|
||||
//// }
|
||||
////
|
||||
////
|
||||
//// if (v_thdLimit.getLowerLimit() <= vThdMin && vThdMax <= v_thdLimit.getUpperLimit()) {
|
||||
//// vThdCount++;
|
||||
//// }
|
||||
////
|
||||
////
|
||||
//// if (freqLimit.getLowerLimit() <= freqMin && freqMax <= freqLimit.getUpperLimit() &&
|
||||
//// rmsflag &&
|
||||
//// rmsLvrflag &&
|
||||
//// v_thdLimit.getLowerLimit() <= vThdMin && vThdMax <= v_thdLimit.getUpperLimit() &&
|
||||
//// vUnbalanceflag
|
||||
////
|
||||
//// ) {
|
||||
//// effectiveMinuteCount++;
|
||||
//// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// rMpMonitorEvaluateD.setEffectiveMinuteCount(effectiveMinuteCount);
|
||||
// rMpMonitorEvaluateD.setFreqCount(freqCount);
|
||||
// rMpMonitorEvaluateD.setPhaseVoltageCount(phaseVoltageCount);
|
||||
// rMpMonitorEvaluateD.setLineVoltageCount(lineVoltageCount);
|
||||
// rMpMonitorEvaluateD.setVThdCount(vThdCount);
|
||||
// rMpMonitorEvaluateD.setUnbalanceCount(unbalanceCount);
|
||||
// return rMpMonitorEvaluateD;
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.njcn.algorithm.support.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.device.pq.pojo.po.PmsAbnormalRules;
|
||||
|
||||
/**
|
||||
* PmsAbnormalRulesMapper
|
||||
*
|
||||
* @author qijian
|
||||
* @date 2022/10/26
|
||||
*/
|
||||
public interface PmsAbnormalRulesMapper extends BaseMapper<PmsAbnormalRules> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.algorithm.support.mapper.PmsAbnormalRulesMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,56 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: '@name@'
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10223
|
||||
#feign接口开启服务熔断降级处理
|
||||
feign:
|
||||
sentinel:
|
||||
enabled: true
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
#nacos注册中心以及配置中心的指定
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: @service.server.url@
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
config:
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
file-extension: yaml
|
||||
shared-configs:
|
||||
- data-id: share-config.yaml
|
||||
refresh: true
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
||||
liteflow:
|
||||
rule-source: config/liteflow.el.xml
|
||||
# rule-source-ext-data-map:
|
||||
# serverAddr: @nacos.url@
|
||||
# dataId: prepare_liteflow
|
||||
# group: DEFAULT_GROUP
|
||||
# namespace: @nacos.namespace@
|
||||
when-max-wait-time: 600000
|
||||
print-banner: false
|
||||
|
||||
|
||||
#项目日志的配置
|
||||
logging:
|
||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
level:
|
||||
root: error
|
||||
|
||||
|
||||
mqtt:
|
||||
client-id: @artifactId@${random.value}
|
||||
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<flow>
|
||||
<chain name="measurement_point">
|
||||
THEN(
|
||||
rMpSurplusAbnormalD
|
||||
);
|
||||
</chain>
|
||||
<chain name="org_point">
|
||||
THEN(
|
||||
WHEN(rDimBusbarHarmnic.tag("r_dim_busbar_harmnic_d")),
|
||||
rOperatingIndex.tag("r_operating_index_d"),
|
||||
rOperatingIndex.tag("r_operating_index_m"),
|
||||
rOperatingIndex.tag("r_operating_index_q"),
|
||||
rOperatingIndex.tag("r_operating_index_y"),
|
||||
rStatOrg.tag("r_stat_org_d"),
|
||||
rStatOrg.tag("r_stat_org_m"),
|
||||
rStatOrg.tag("r_stat_org_q"),
|
||||
rStatOrg.tag("r_stat_org_y"),
|
||||
rStatPollutionOrg.tag("r_stat_pollution_org_d"),
|
||||
rStatPollutionOrg.tag("r_stat_pollution_org_m"),
|
||||
rStatPollutionOrg.tag("r_stat_pollution_org_q"),
|
||||
rStatPollutionOrg.tag("r_stat_pollution_org_y"),
|
||||
rStatHarmonic.tag("r_stat_harmonic_d"),
|
||||
rStatHarmonic.tag("r_stat_harmonic_m"),
|
||||
rStatHarmonic.tag("r_stat_harmonic_q"),
|
||||
rStatHarmonic.tag("r_stat_harmonic_y"),
|
||||
rStatHarmonicVoltage.tag("r_stat_harmonic_voltage_d"),
|
||||
rStatHarmonicVoltage.tag("r_stat_harmonic_voltage_m"),
|
||||
rStatHarmonicOrg.tag("r_stat_harmonic_org_d"),
|
||||
rStatHarmonicOrg.tag("r_stat_harmonic_org_m"),
|
||||
rStatHarmonicOrg.tag("r_stat_harmonic_org_q"),
|
||||
rStatHarmonicOrg.tag("r_stat_harmonic_org_y"),
|
||||
rStatEvent.tag("r_stat_event_d"),
|
||||
rStatEvent.tag("r_stat_event_m"),
|
||||
rStatEvent.tag("r_stat_event_q"),
|
||||
rStatEvent.tag("r_stat_event_y"),
|
||||
rStatEventVoltage.tag("r_stat_event_voltage_d"),
|
||||
rStatEventVoltage.tag("r_stat_event_voltage_m"),
|
||||
rStatEventOrg.tag("r_stat_event_org_d"),
|
||||
rStatEventOrg.tag("r_stat_event_org_m"),
|
||||
rStatEventOrg.tag("r_stat_event_org_q"),
|
||||
rStatEventOrg.tag("r_stat_event_org_y"),
|
||||
rStatEventLoadType.tag("r_stat_load_type_d"),
|
||||
rStatEventLoadType.tag("r_stat_load_type_m"),
|
||||
rStatEventLoadType.tag("r_stat_load_type_q"),
|
||||
rStatEventLoadType.tag("r_stat_load_type_y"),
|
||||
rStatAlarmCount.tag("r_stat_alarm_count_w"),
|
||||
rStatAlarmCount.tag("r_stat_area_alarm_count_m"),
|
||||
rDimBusTarget.tag("r_dim_bus_target_d"),
|
||||
rDimBusTarget.tag("r_dim_bus_target_m"),
|
||||
rDimBusTarget.tag("r_dim_bus_target_y"),
|
||||
rDimObjTarget.tag("r_dim_obj_target_d"),
|
||||
rDimObjTarget.tag("r_dim_obj_target_m"),
|
||||
rDimObjTarget.tag("r_dim_obj_target_y"),
|
||||
rDimObjGlobal.tag("r_dim_obj_global_d"),
|
||||
rDimObjGlobal.tag("r_dim_obj_global_m"),
|
||||
rDimObjGlobal.tag("r_dim_obj_global_y"),
|
||||
rDimObjBusStationEventStartis.tag("r_dim_bus_station_event_startis_d"),
|
||||
rDimObjBusStationEventStartis.tag("r_dim_bus_station_event_startis_m"),
|
||||
rDimObjBusStationEventStartis.tag("r_dim_bus_station_event_startis_y")
|
||||
);
|
||||
</chain>
|
||||
<chain name="sub_station">
|
||||
THEN(
|
||||
THEN(
|
||||
rUploadSubStatisticalData
|
||||
),
|
||||
THEN(
|
||||
rStatSubstation.tag("r_stat_substation_d"),
|
||||
rStatSubstation.tag("r_stat_substation_m"),
|
||||
rStatSubstation.tag("r_stat_substation_q"),
|
||||
rStatSubstation.tag("r_stat_substation_y")
|
||||
),
|
||||
THEN(
|
||||
rStatPollutionSubstation.tag("r_stat_pollution_substation_d"),
|
||||
rStatPollutionSubstation.tag("r_stat_pollution_substation_m"),
|
||||
rStatPollutionSubstation.tag("r_stat_pollution_substation_q"),
|
||||
rStatPollutionSubstation.tag("r_stat_pollution_substation_y")
|
||||
)
|
||||
);
|
||||
</chain>
|
||||
<chain name="dim_station_busbar">
|
||||
THEN(
|
||||
THEN(
|
||||
rDimObjEvent.tag("r_dim_obj_event_d"),
|
||||
rDimObjEvent.tag("r_dim_obj_event_m"),
|
||||
rDimObjEvent.tag("r_dim_obj_event_y")
|
||||
)
|
||||
);
|
||||
</chain>
|
||||
<chain name="genera_trix">
|
||||
THEN(
|
||||
THEN(
|
||||
rBusbarVoltage.tag("r_dim_voltage_d"),
|
||||
rBusbarVoltage.tag("r_dim_voltage_m"),
|
||||
rBusbarVoltage.tag("r_dim_voltage_y")
|
||||
),
|
||||
THEN(
|
||||
rStatBusbarHarmonicY
|
||||
),
|
||||
THEN(
|
||||
rStatOrgBusBarVoltage.tag("r_stat_org_busbar_voltage_d"),
|
||||
rStatOrgBusBarVoltage.tag("r_stat_org_busbar_voltage_m"),
|
||||
rStatOrgBusBarVoltage.tag("r_stat_org_busbar_voltage_q"),
|
||||
rStatOrgBusBarVoltage.tag("r_stat_org_busbar_voltage_y")
|
||||
)
|
||||
);
|
||||
</chain>
|
||||
<chain name="upload_org">
|
||||
THEN(
|
||||
rUploadPointStatisticalData,
|
||||
rUploadEvaluationData,
|
||||
pqTypicalSourceCreatePOService
|
||||
|
||||
);
|
||||
</chain>
|
||||
<chain name="orgSub_station">
|
||||
THEN(
|
||||
THEN(
|
||||
rStatSubstationVoltage.tag("r_stat_substation_voltage_m")
|
||||
)
|
||||
);
|
||||
</chain>
|
||||
</flow>
|
||||
25
pqs-algorithm/pom.xml
Normal file
25
pqs-algorithm/pom.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>pqs</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>algorithm-api</module>
|
||||
<module>algorithm-boot</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>pqs-algorithm</artifactId>
|
||||
<description>算法模块</description>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
@@ -84,7 +84,7 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
|
||||
tokenEnhancers.add(jwtAccessTokenConverter());
|
||||
tokenEnhancerChain.setTokenEnhancers(tokenEnhancers);
|
||||
// 获取原有默认授权模式(授权码模式、密码模式、客户端模式、简化模式)的授权者
|
||||
List<TokenGranter> granterList = new ArrayList<>(Arrays.asList(endpoints.getTokenGranter()));
|
||||
List<TokenGranter> granterList = new ArrayList<>(Collections.singletonList(endpoints.getTokenGranter()));
|
||||
|
||||
// 添加验证码授权模式授权者
|
||||
granterList.add(new CaptchaTokenGranter(endpoints.getTokenServices(), endpoints.getClientDetailsService(),
|
||||
@@ -101,9 +101,10 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
|
||||
//设置grant_type类型集合
|
||||
.tokenEnhancer(tokenEnhancerChain)
|
||||
.tokenGranter(compositeTokenGranter)
|
||||
/**refresh_token有两种使用方式:重复使用(true)、非重复使用(false),默认为true
|
||||
*1.重复使用:access_token过期刷新时, refresh token过期时间未改变,仍以初次生成的时间为准
|
||||
*2.非重复使用:access_token过期刷新时, refresh_token过期时间延续,在refresh_token有效期内刷新而无需失效再次登录
|
||||
/*
|
||||
* refresh_token有两种使用方式:重复使用(true)、非重复使用(false),默认为true
|
||||
* 1.重复使用:access_token过期刷新时, refresh token过期时间未改变,仍以初次生成的时间为准
|
||||
* 2.非重复使用:access_token过期刷新时, refresh_token过期时间延续,在refresh_token有效期内刷新而无需失效再次登录
|
||||
*/
|
||||
.reuseRefreshTokens(true)
|
||||
.tokenServices(tokenServices(endpoints));
|
||||
@@ -125,7 +126,7 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
|
||||
tokenServices.setTokenEnhancer(tokenEnhancerChain);
|
||||
|
||||
// 多用户体系下,刷新token再次认证客户端ID和 UserDetailService 的映射Map
|
||||
Map<String, UserDetailsService> clientUserDetailsServiceMap = new HashMap<>();
|
||||
Map<String, UserDetailsService> clientUserDetailsServiceMap = new HashMap<>(16);
|
||||
|
||||
// 系统管理客户端
|
||||
clientUserDetailsServiceMap.put(ClientEnum.WEB_CLIENT.getClientId(), userDetailsService);
|
||||
|
||||
@@ -37,7 +37,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http
|
||||
.authorizeRequests()
|
||||
.antMatchers("/oauth/getPublicKey","/oauth/logout","/auth/getImgCode","/judgeToken/guangZhou","/oauth/autoLogin").permitAll()
|
||||
.antMatchers("/oauth/getPublicKey","/oauth/logout","/auth/getImgCode","/judgeToken/guangZhou","/judgeToken/heBei","/oauth/autoLogin").permitAll()
|
||||
// @link https://gitee.com/xiaoym/knife4j/issues/I1Q5X6 (接口文档knife4j需要放行的规则)
|
||||
.antMatchers("/webjars/**","/doc.html","/swagger-resources/**","/v2/api-docs").permitAll()
|
||||
.anyRequest().authenticated()
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.auth.controller;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
@@ -21,6 +22,8 @@ import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
@@ -41,7 +44,7 @@ public class JudgeThirdToken extends BaseController {
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/guangZhou")
|
||||
@ApiOperation("校验广州超高压token有效性")
|
||||
@ApiImplicitParam(name = "token", value = "", required = true)
|
||||
@ApiImplicitParam(name = "token", required = true)
|
||||
public HttpResult<Object> guangZhou(String token) {
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
String methodDescribe = getMethodDescribe("guangZhou");
|
||||
@@ -65,8 +68,7 @@ public class JudgeThirdToken extends BaseController {
|
||||
// 发送post请求,并打印结果,以String类型接收响应结果JSON字符串
|
||||
String result = restTemplate.postForObject(url, request, String.class);
|
||||
JSONObject resultJson = new JSONObject(result);
|
||||
System.out.println(result);
|
||||
if (resultJson.getInt("status") == 1) {
|
||||
if (Objects.equals(resultJson.getInt("status"), DataStateEnum.ENABLE.getCode())) {
|
||||
//成功
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
@@ -74,4 +76,44 @@ public class JudgeThirdToken extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/heBei")
|
||||
@ApiOperation("校验河北token有效性")
|
||||
@ApiImplicitParam(name = "token", required = true)
|
||||
public HttpResult<Object> heBei(String token) {
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
String methodDescribe = getMethodDescribe("heBei");
|
||||
LogUtil.njcnDebug(log, "{},token:{}", methodDescribe, token);
|
||||
|
||||
/* // 请求地址
|
||||
String url = "http://dwzyywzt-test.com/baseCenter/oauth2/user/token";
|
||||
|
||||
// 请求头设置,x-www-form-urlencoded格式的数据
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
||||
|
||||
//提交参数设置
|
||||
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
|
||||
map.add("token", token);
|
||||
|
||||
// 组装请求体
|
||||
HttpEntity<MultiValueMap<String, String>> request =
|
||||
new HttpEntity<>(map, headers);
|
||||
|
||||
// 发送post请求,并打印结果,以String类型接收响应结果JSON字符串
|
||||
String result = restTemplate.postForObject(url, request, String.class);
|
||||
JSONObject resultJson = new JSONObject(result);
|
||||
if (Objects.equals(resultJson.getInt("status"), DataStateEnum.ENABLE.getCode())) {
|
||||
//成功
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}*/
|
||||
|
||||
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, "HE_DNZLJCYW", methodDescribe);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.springframework.security.oauth2.provider.token.AuthorizationServerTok
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
@@ -56,7 +57,7 @@ public class CaptchaTokenGranter extends AbstractTokenGranter {
|
||||
}
|
||||
}
|
||||
String password = parameters.get(SecurityConstants.PASSWORD);
|
||||
String ip = RequestUtil.getRequest().getHeader(SecurityConstants.REQUEST_HEADER_KEY_CLIENT_REAL_IP);
|
||||
String ip = Objects.requireNonNull(RequestUtil.getRequest()).getHeader(SecurityConstants.REQUEST_HEADER_KEY_CLIENT_REAL_IP);
|
||||
//密码处理
|
||||
String privateKey = redisUtil.getStringByKey(username + ip);
|
||||
//秘钥用完即删
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user