Compare commits
277 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 | |||
| ed10b12e79 | |||
| fbd15ca353 | |||
| 2c79cc72c9 | |||
| 69157a138b | |||
|
|
3377bcf488 | ||
|
|
e93f8b4da8 | ||
|
|
e13b1f156e | ||
|
|
ee1f36617d | ||
|
|
9534882845 | ||
| 5d28504f20 | |||
| 7559b94959 | |||
| 14b072b5e7 | |||
| 0a121a3cf5 | |||
| 476993db15 | |||
|
|
cccc7953ed | ||
|
|
aa0982fb81 | ||
| 07e481bc11 | |||
|
|
b766e77c42 | ||
| cbf310a5a1 | |||
| 49dd915e27 | |||
| ed145dd7ff | |||
| 00fd701122 | |||
| 6236243284 | |||
| 6dc1b415dc | |||
|
|
f4fd509d12 | ||
|
|
6e8a188172 | ||
|
|
ceb95be340 | ||
|
|
21f4466580 | ||
| e50f587bb8 | |||
| 7727e9e2bf | |||
|
|
043b8f9a71 | ||
|
|
af058896dc | ||
|
|
957af09daa | ||
| d28a8f8fb1 | |||
|
|
f27a107bba | ||
|
|
bddd1efef3 | ||
|
|
003880619e | ||
|
|
053183cdd0 | ||
| c2af7e708c | |||
|
|
f36b3f9ee9 | ||
|
|
25ee513246 | ||
| 9e23373878 | |||
|
|
971ae03dcf | ||
|
|
68c0b72710 | ||
|
|
8bc94ea9a8 | ||
|
|
b30ad02ac1 | ||
| f22748ef8f | |||
|
|
813af67b9b | ||
|
|
758964d9a8 | ||
| 360a73c04e | |||
|
|
dbf43633ff | ||
| 1ed56bbac1 | |||
| 7c943244b3 | |||
| a492609b36 | |||
| 1f18c71eb7 | |||
| 2319895ff4 | |||
| a6f9e30d54 | |||
|
|
4cff5e90a2 | ||
| 88f7efbc86 | |||
| 1d41b1af12 | |||
|
|
3b5442ecf5 | ||
| 3ec984752f | |||
|
|
99021d3c9c | ||
| b608aab3bd | |||
| f54ce5ae3c | |||
|
|
3a589962a5 | ||
|
|
e54df08dca | ||
| 055c762415 | |||
|
|
cdbb4fe428 | ||
|
|
d972bbef80 | ||
| 1d664fee19 | |||
| eb10a16799 | |||
| 6e85a72b7d | |||
| 59b56a39dc | |||
| da387cc39d | |||
|
|
9d4215afb5 | ||
| 35e3d098a9 | |||
| 61bbbed153 | |||
| 0fe103d01e | |||
| d64b15a8e6 | |||
| 3ed732affd | |||
| 128925a5d6 | |||
| 311b2844ba | |||
| 7dc2cde6ed | |||
|
|
8b1074c172 | ||
|
|
67ad03ddbe | ||
| 24e937e331 | |||
| 89ece63f2e | |||
| 1e79bbdcb0 | |||
| ec051827ac | |||
| 6fa63a7f3e | |||
| a9aa0785da | |||
| 23e7288609 | |||
|
|
a573c17886 | ||
| be8edfd4cf | |||
| 30b4f03f6b | |||
|
|
ee41b0a554 | ||
| 458b2347ed | |||
|
|
c1bfc2347f | ||
| eba02ffcf3 | |||
| 2921145336 | |||
|
|
9de6981cd5 | ||
| fb58b13c91 | |||
|
|
e12e5d90c8 | ||
|
|
075205d4b9 | ||
| 1af8fcc72f | |||
|
|
6ec0ef54e9 | ||
| fd23719a41 | |||
| 306200791a | |||
| e6a1874abf | |||
|
|
8502421b91 | ||
|
|
50cd5d3895 | ||
| 5ca027513f | |||
|
|
87c60206f0 | ||
| dbee4ca31d | |||
|
|
f26ec7003e | ||
| 467906b686 | |||
|
|
b146da4867 | ||
|
|
80dceeb0be | ||
| 8d6ba4afe3 | |||
| ae2207bd97 | |||
| 16e90de9eb | |||
| 5c36e2e4f4 | |||
| df72e7c338 | |||
|
|
234f0be465 | ||
| 0677320a06 | |||
|
|
0e548887a4 | ||
| e1c5a07f14 | |||
| 7a745fea9e | |||
|
|
8db6ddaeb5 | ||
|
|
e140ba4fe3 | ||
| ec9f32d0ad | |||
|
|
0e1a10a860 | ||
|
|
4ad60cbe96 | ||
|
|
731f6f2d12 | ||
|
|
7abce7651d | ||
|
|
d3af5bd9e4 | ||
|
|
dd6c3db9b2 | ||
| 6316389a68 | |||
| c994ada5e7 | |||
|
|
197d3df0fb | ||
| b501b91bc4 |
10
pom.xml
10
pom.xml
@@ -20,7 +20,6 @@
|
|||||||
<module>pqs-advance</module>
|
<module>pqs-advance</module>
|
||||||
<module>pqs-prepare</module>
|
<module>pqs-prepare</module>
|
||||||
<module>pqs-process</module>
|
<module>pqs-process</module>
|
||||||
<module>pqs-influx</module>
|
|
||||||
<module>pqs-bpm</module>
|
<module>pqs-bpm</module>
|
||||||
<module>pqs-supervision</module>
|
<module>pqs-supervision</module>
|
||||||
|
|
||||||
@@ -49,10 +48,15 @@
|
|||||||
<docker.server.url>192.168.1.22</docker.server.url>
|
<docker.server.url>192.168.1.22</docker.server.url>
|
||||||
<!--nacos的ip:port-->
|
<!--nacos的ip:port-->
|
||||||
<nacos.url>${middle.server.url}:18848</nacos.url>
|
<nacos.url>${middle.server.url}:18848</nacos.url>
|
||||||
|
<!--nacos开启鉴权后的用户名-->
|
||||||
|
<nacos.username>nacos</nacos.username>
|
||||||
|
<!--nacos的ip:port-->
|
||||||
|
<nacos.password>nacos</nacos.password>
|
||||||
<!--服务器发布内容为空-->
|
<!--服务器发布内容为空-->
|
||||||
<!-- <nacos.namespace></nacos.namespace>-->
|
<!-- <nacos.namespace></nacos.namespace>-->
|
||||||
<!-- <nacos.namespace>1dd11af6-e668-41fd-a663-02a05705304d</nacos.namespace>-->
|
<nacos.namespace>30c701c4-2a94-49d9-82e1-76aa9456573f</nacos.namespace>
|
||||||
<nacos.namespace>6d75b5c3-cff9-4c4a-8e8b-ca2363753ecb</nacos.namespace>
|
<!-- <nacos.namespace>fd74182b-1fce-4dba-afa7-2623b0376205</nacos.namespace>-->
|
||||||
|
<!-- <nacos.namespace>910d0d69-2254-481b-b9f7-7ecf9cb881b0</nacos.namespace>-->
|
||||||
<!-- sentinel:port-->
|
<!-- sentinel:port-->
|
||||||
<sentinel.url>${middle.server.url}:8080</sentinel.url>
|
<sentinel.url>${middle.server.url}:8080</sentinel.url>
|
||||||
<!--网关地址,主要用于配置swagger中认证token-->
|
<!--网关地址,主要用于配置swagger中认证token-->
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wr
|
||||||
|
*/
|
||||||
@FeignClient(value = ServerInfo.ADVANCE_BOOT,path = "/waveAnalysis",
|
@FeignClient(value = ServerInfo.ADVANCE_BOOT,path = "/waveAnalysis",
|
||||||
fallbackFactory = EventWaveAnalysisFeignClientFallbackFactory.class,
|
fallbackFactory = EventWaveAnalysisFeignClientFallbackFactory.class,
|
||||||
contextId = "waveAnalysis" )
|
contextId = "waveAnalysis" )
|
||||||
@@ -16,9 +19,9 @@ public interface EventWaveAnalysisFeignClient {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 波形高级分析
|
* 波形高级分析
|
||||||
* @param eventIndex
|
* @param eventIndex 事件索引
|
||||||
* @return: com.njcn.common.pojo.response.HttpResult<com.njcn.advance.pojo.dto.waveAnalysis.EntityAdvancedData>
|
* @return com.njcn.common.pojo.response.HttpResult<com.njcn.advance.pojo.dto.waveAnalysis.EntityAdvancedData>
|
||||||
* @Author: wr
|
* @Author: wr
|
||||||
* @Date: 2023/11/1 14:23
|
* @Date: 2023/11/1 14:23
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wr
|
||||||
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
public class EventWaveAnalysisFeignClientFallbackFactory implements FallbackFactory<EventWaveAnalysisFeignClient> {
|
public class EventWaveAnalysisFeignClientFallbackFactory implements FallbackFactory<EventWaveAnalysisFeignClient> {
|
||||||
@@ -24,7 +27,6 @@ public class EventWaveAnalysisFeignClientFallbackFactory implements FallbackFact
|
|||||||
}
|
}
|
||||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
return new EventWaveAnalysisFeignClient() {
|
return new EventWaveAnalysisFeignClient() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<EntityAdvancedData> analysis(String eventIndex) {
|
public HttpResult<EntityAdvancedData> analysis(String eventIndex) {
|
||||||
log.error("{}异常,降级处理,异常为:{}", "波形高级分析", throwable.toString());
|
log.error("{}异常,降级处理,异常为:{}", "波形高级分析", throwable.toString());
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import lombok.Getter;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 承载能力评估相关枚举
|
* @Description: 承载能力评估相关枚举
|
||||||
* @Param:
|
|
||||||
* @return:
|
|
||||||
* @Author: clam
|
* @Author: clam
|
||||||
* @Date: 2024/1/31
|
* @Date: 2024/1/31
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ package com.njcn.advance.enums;
|
|||||||
* @Author: Sunwei 【sunW2016@163.com】
|
* @Author: Sunwei 【sunW2016@163.com】
|
||||||
* @Description: 高级分析返回结果
|
* @Description: 高级分析返回结果
|
||||||
* @Date: Create in 9:02 2018/3/6
|
* @Date: Create in 9:02 2018/3/6
|
||||||
* @Modified By:
|
|
||||||
*/
|
*/
|
||||||
public enum EnumEvt {
|
public enum EnumEvt {
|
||||||
EVT_NUM("evt_num", "高级算法返回事件个数"), EVT_BUF("evt_buf", "高级算法返回数据"), QVVR_TYPE("qvvr_type", "暂降类型"), POW_A("POW_a",
|
EVT_NUM("evt_num", "高级算法返回事件个数"), EVT_BUF("evt_buf", "高级算法返回数据"), QVVR_TYPE("qvvr_type", "暂降类型"), POW_A("POW_a",
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public class CarryCapacityResultPO extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 是否删除(0,无效,1有效)
|
* 是否删除(0,无效,1有效)
|
||||||
*/
|
*/
|
||||||
@TableField(value = "`status`")
|
@TableField(value = "status")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
@TableField(value = "evaluate_type")
|
@TableField(value = "evaluate_type")
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class CarryCapacityStrategyDhlPO extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 充电桩,电弧炉,电气化铁路
|
* 充电桩,电弧炉,电气化铁路
|
||||||
*/
|
*/
|
||||||
@TableField(value = "`type`")
|
@TableField(value = "type")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class CarryCapacityStrategyPO extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 总承载能力评估结果(1-安全,2-III级预警,3-II级预警,4-I 级预警)
|
* 总承载能力评估结果(1-安全,2-III级预警,3-II级预警,4-I 级预警)
|
||||||
*/
|
*/
|
||||||
@TableField(value = "`result`")
|
@TableField(value = "result")
|
||||||
private Integer result;
|
private Integer result;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,7 +40,7 @@ public class CarryCapacityStrategyPO extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 数量
|
* 数量
|
||||||
*/
|
*/
|
||||||
@TableField(value = "`count`")
|
@TableField(value = "count")
|
||||||
private Integer count;
|
private Integer count;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.njcn.advance.utils;
|
package com.njcn.advance.utils;
|
||||||
|
|
||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
import cn.hutool.core.util.CharsetUtil;
|
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -33,8 +32,7 @@ public class WaveUtils {
|
|||||||
public String getFile(String filePath){
|
public String getFile(String filePath){
|
||||||
String temJson = null;
|
String temJson = null;
|
||||||
try(InputStream inputStream = fileStorageUtil.getFileStream(filePath)){
|
try(InputStream inputStream = fileStorageUtil.getFileStream(filePath)){
|
||||||
temJson = IoUtil.read(inputStream, CharsetUtil.UTF_8);
|
temJson = IoUtil.readUtf8(inputStream);
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,6 @@ package com.njcn.advance.controller;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
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.pojo.po.PqsRelevanceLog;
|
||||||
import com.njcn.advance.service.EventRelevantAnalysisService;
|
import com.njcn.advance.service.EventRelevantAnalysisService;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
@@ -18,19 +15,13 @@ import com.njcn.common.utils.PubUtils;
|
|||||||
import com.njcn.event.pojo.po.RmpEventDetailAssPO;
|
import com.njcn.event.pojo.po.RmpEventDetailAssPO;
|
||||||
import com.njcn.event.pojo.vo.AdvanceEventDetailVO;
|
import com.njcn.event.pojo.vo.AdvanceEventDetailVO;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import com.njcn.web.pojo.annotation.DateTimeStrValid;
|
|
||||||
import com.njcn.web.pojo.param.BaseParam;
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
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.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|||||||
@@ -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.CarryCapacityDataIVO;
|
||||||
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDataQVO;
|
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDataQVO;
|
||||||
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDataVO;
|
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.advance.utils.EasyExcelUtil;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
@@ -44,7 +44,7 @@ import java.util.List;
|
|||||||
public class CarryCapacityController extends BaseController {
|
public class CarryCapacityController extends BaseController {
|
||||||
|
|
||||||
|
|
||||||
private final CarryCapcityService carryCapcityService;
|
private final CarryCapacityService carryCapcityService;
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/queryCarryCapacityData")
|
@PostMapping("/queryCarryCapacityData")
|
||||||
@@ -72,8 +72,7 @@ public class CarryCapacityController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||||
public HttpResult<CarryCapacityDataQVO> queryCarryCapacityQData(@RequestBody @Validated CarryCapacityQueryDataParam queryParam) {
|
public HttpResult<CarryCapacityDataQVO> queryCarryCapacityQData(@RequestBody @Validated CarryCapacityQueryDataParam queryParam) {
|
||||||
String methodDescribe = getMethodDescribe("queryCarryCapacityQData");
|
String methodDescribe = getMethodDescribe("queryCarryCapacityQData");
|
||||||
CarryCapacityDataQVO carryCapacityDataQVO = carryCapcityService.queryCarryCapacityQData(queryParam);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, carryCapcityService.queryCarryCapacityQData(queryParam), methodDescribe);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, carryCapacityDataQVO, methodDescribe);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@@ -82,8 +81,7 @@ public class CarryCapacityController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||||
public HttpResult<CarryCapacityDataIVO> queryCarryCapacityIData(@RequestBody @Validated CarryCapacityQueryDataParam queryParam) {
|
public HttpResult<CarryCapacityDataIVO> queryCarryCapacityIData(@RequestBody @Validated CarryCapacityQueryDataParam queryParam) {
|
||||||
String methodDescribe = getMethodDescribe("queryCarryCapacityIData");
|
String methodDescribe = getMethodDescribe("queryCarryCapacityIData");
|
||||||
CarryCapacityDataIVO carryCapacityDataIVO = carryCapcityService.queryCarryCapacityIData(queryParam);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, carryCapcityService.queryCarryCapacityIData(queryParam), methodDescribe);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, carryCapacityDataIVO, methodDescribe);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@@ -92,8 +90,7 @@ public class CarryCapacityController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "calParam", value = "计算参数", required = true)
|
@ApiImplicitParam(name = "calParam", value = "计算参数", required = true)
|
||||||
public HttpResult<CarryCapacityDResultVO> carryCapacityCal(@RequestBody @Validated CarryCapacityCalParam calParam) {
|
public HttpResult<CarryCapacityDResultVO> carryCapacityCal(@RequestBody @Validated CarryCapacityCalParam calParam) {
|
||||||
String methodDescribe = getMethodDescribe("carryCapacityCal");
|
String methodDescribe = getMethodDescribe("carryCapacityCal");
|
||||||
CarryCapacityDResultVO carryCapacityDResultVO = carryCapcityService.carryCapacityCal(calParam);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, carryCapcityService.carryCapacityCal(calParam), methodDescribe);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, carryCapacityDResultVO, methodDescribe);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@@ -109,9 +106,6 @@ public class CarryCapacityController extends BaseController {
|
|||||||
@ApiOperation("导出数据集模板")
|
@ApiOperation("导出数据集模板")
|
||||||
@GetMapping(value = "getExcelTemplate")
|
@GetMapping(value = "getExcelTemplate")
|
||||||
public HttpResult<String> getExcelTemplate(HttpServletResponse response) throws IOException {
|
public HttpResult<String> getExcelTemplate(HttpServletResponse response) throws IOException {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String sheetName = "数据集模版";
|
String sheetName = "数据集模版";
|
||||||
List<CarryCapcityDataEexcel> excels = new ArrayList<>();
|
List<CarryCapcityDataEexcel> excels = new ArrayList<>();
|
||||||
CarryCapcityDataEexcel exportHeadersExcel = new CarryCapcityDataEexcel();
|
CarryCapcityDataEexcel exportHeadersExcel = new CarryCapcityDataEexcel();
|
||||||
@@ -120,10 +114,6 @@ public class CarryCapacityController extends BaseController {
|
|||||||
.sheet(sheetName)
|
.sheet(sheetName)
|
||||||
.doWrite(excels);
|
.doWrite(excels);
|
||||||
EasyExcelUtil.writeWithSheetsWeb(response, "数据集模版.xlsx");
|
EasyExcelUtil.writeWithSheetsWeb(response, "数据集模版.xlsx");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +122,6 @@ public class CarryCapacityController extends BaseController {
|
|||||||
@ApiOperation("上传数据集")
|
@ApiOperation("上传数据集")
|
||||||
public HttpResult<Boolean> uploadExcel(@Validated ExcelDataParam excelDataParam) throws Exception {
|
public HttpResult<Boolean> uploadExcel(@Validated ExcelDataParam excelDataParam) throws Exception {
|
||||||
String methodDescribe = getMethodDescribe("uploadExcel");
|
String methodDescribe = getMethodDescribe("uploadExcel");
|
||||||
|
|
||||||
boolean flag = carryCapcityService.uploadExcel(excelDataParam);
|
boolean flag = carryCapcityService.uploadExcel(excelDataParam);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,7 @@
|
|||||||
package com.njcn.advance.controller.govern.harmonic;
|
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.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.pojo.po.govern.harmonic.SgHarmonicFile;
|
||||||
import com.njcn.advance.service.govern.harmonic.ISgHarmonicFileService;
|
import com.njcn.advance.service.govern.harmonic.ISgHarmonicFileService;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
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.DataStateEnum;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.oss.constant.OssPath;
|
import com.njcn.oss.constant.OssPath;
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import com.njcn.poi.util.PoiUtil;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
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 com.njcn.web.controller.BaseController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,7 +62,7 @@ public class SgHarmonicFileController extends BaseController {
|
|||||||
|
|
||||||
@PostMapping(value = "/listHarmonicData")
|
@PostMapping(value = "/listHarmonicData")
|
||||||
@ApiOperation("获取谐波数据数据")
|
@ApiOperation("获取谐波数据数据")
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.QUERY)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
public HttpResult<List<SgHarmonicFile>> listHarmonicData() {
|
public HttpResult<List<SgHarmonicFile>> listHarmonicData() {
|
||||||
String methodDescribe = getMethodDescribe("listHarmonicData");
|
String methodDescribe = getMethodDescribe("listHarmonicData");
|
||||||
LambdaQueryWrapper<SgHarmonicFile> sgHarmonicFileLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SgHarmonicFile> sgHarmonicFileLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
package com.njcn.advance.controller.govern.voltage;
|
package com.njcn.advance.controller.govern.voltage;
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.advance.pojo.param.govern.voltage.SgGovernSchemeHistoryParam;
|
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.SgGovernSchemeHistoryAllVO;
|
||||||
import com.njcn.advance.pojo.vo.govern.voltage.SgGovernSchemeHistoryVO;
|
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.IGovernSchemeCalcService;
|
||||||
import com.njcn.advance.service.govern.voltage.ISgGovernSchemeHistoryService;
|
import com.njcn.advance.service.govern.voltage.ISgGovernSchemeHistoryService;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
@@ -28,6 +25,9 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Validated
|
@Validated
|
||||||
@RestController
|
@RestController
|
||||||
|
|||||||
@@ -115,7 +115,8 @@ public class SgEventController extends BaseController {
|
|||||||
ExcelImportResult<SgEventExcel> sgEventExcelExcelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), SgEventExcel.class, params);
|
ExcelImportResult<SgEventExcel> sgEventExcelExcelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), SgEventExcel.class, params);
|
||||||
//如果存在非法数据,将不合格的数据导出
|
//如果存在非法数据,将不合格的数据导出
|
||||||
if (sgEventExcelExcelImportResult.isVerifyFail()) {
|
if (sgEventExcelExcelImportResult.isVerifyFail()) {
|
||||||
// PoiUtil.exportFileByWorkbook(sgEventExcelExcelImportResult.getFailWorkbook(), "非法暂降数据.xlsx", response);
|
// 此处到处前端要做特殊处理,具体可以参考技术监督的数据导入,todo...
|
||||||
|
PoiUtil.exportFileByWorkbook(sgEventExcelExcelImportResult.getFailWorkbook(), "非法暂降数据.xlsx", response);
|
||||||
throw new BusinessException(AdvanceResponseEnum.IMPORT_EVENT_DATA_FAIL);
|
throw new BusinessException(AdvanceResponseEnum.IMPORT_EVENT_DATA_FAIL);
|
||||||
} else {
|
} else {
|
||||||
//批量录入暂降数据
|
//批量录入暂降数据
|
||||||
@@ -129,7 +130,6 @@ public class SgEventController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@GetMapping("/calcLoss")
|
@GetMapping("/calcLoss")
|
||||||
@ApiOperation("计算暂降损失")
|
@ApiOperation("计算暂降损失")
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.advance.pojo.param.govern.voltage.SgMachineParam;
|
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.SgMachineVO;
|
||||||
import com.njcn.advance.pojo.vo.govern.voltage.SgProductLineVO;
|
|
||||||
import com.njcn.advance.service.govern.voltage.ISgMachineService;
|
import com.njcn.advance.service.govern.voltage.ISgMachineService;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.constant.OperateType;
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ package com.njcn.advance.controller.govern.voltage;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.advance.pojo.param.govern.voltage.SgProductLineParam;
|
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.pojo.vo.govern.voltage.SgProductLineVO;
|
||||||
import com.njcn.advance.service.govern.voltage.ISgProductLineService;
|
import com.njcn.advance.service.govern.voltage.ISgProductLineService;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
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 cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.advance.pojo.param.govern.voltage.SgSensitiveUnitParam;
|
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.pojo.vo.govern.voltage.SgSensitiveUnitVO;
|
||||||
import com.njcn.advance.service.govern.voltage.ISgSensitiveUnitService;
|
import com.njcn.advance.service.govern.voltage.ISgSensitiveUnitService;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class ResponsibilityController extends BaseController {
|
|||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/responsibilityList")
|
@PostMapping("/responsibilityList")
|
||||||
@ApiOperation("列表分页")
|
@ApiOperation("查询责任划分列表分页")
|
||||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||||
public HttpResult<Page<RespDataDTO>> responsibilityList(@RequestBody @Validated BaseParam queryParam) {
|
public HttpResult<Page<RespDataDTO>> responsibilityList(@RequestBody @Validated BaseParam queryParam) {
|
||||||
String methodDescribe = getMethodDescribe("responsibilityList");
|
String methodDescribe = getMethodDescribe("responsibilityList");
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class UserDataController extends BaseController {
|
|||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/userDataList")
|
@PostMapping("/userDataList")
|
||||||
@ApiOperation("列表分页")
|
@ApiOperation("查询用户列表分页")
|
||||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||||
public HttpResult<Page<RespUserData>> userDataList(@RequestBody @Validated BaseParam queryParam) {
|
public HttpResult<Page<RespUserData>> userDataList(@RequestBody @Validated BaseParam queryParam) {
|
||||||
String methodDescribe = getMethodDescribe("userDataList");
|
String methodDescribe = getMethodDescribe("userDataList");
|
||||||
@@ -102,6 +102,7 @@ public class UserDataController extends BaseController {
|
|||||||
if (fileSize > 3072) {
|
if (fileSize > 3072) {
|
||||||
throw new BusinessException(CommonResponseEnum.FILE_SIZE_ERROR);
|
throw new BusinessException(CommonResponseEnum.FILE_SIZE_ERROR);
|
||||||
}
|
}
|
||||||
|
assert fileName != null;
|
||||||
if (!fileName.matches("^.+\\.(?i)(xlsx)$") && !fileName.matches("^.+\\.(?i)(xls)$")) {
|
if (!fileName.matches("^.+\\.(?i)(xlsx)$") && !fileName.matches("^.+\\.(?i)(xls)$")) {
|
||||||
throw new BusinessException(CommonResponseEnum.FILE_XLSX_ERROR);
|
throw new BusinessException(CommonResponseEnum.FILE_XLSX_ERROR);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!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">
|
<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>
|
</mapper>
|
||||||
@@ -1,19 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!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">
|
<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>
|
</mapper>
|
||||||
@@ -1,29 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!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">
|
<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>
|
</mapper>
|
||||||
@@ -1,30 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!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">
|
<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>
|
</mapper>
|
||||||
@@ -1,23 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!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">
|
<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>
|
</mapper>
|
||||||
@@ -1,23 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!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">
|
<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>
|
</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>
|
|
||||||
@@ -16,7 +16,7 @@ import java.util.List;
|
|||||||
* @author clam
|
* @author clam
|
||||||
* @version V1.0.0
|
* @version V1.0.0
|
||||||
*/
|
*/
|
||||||
public interface CarryCapcityService {
|
public interface CarryCapacityService {
|
||||||
|
|
||||||
|
|
||||||
CarryCapacityDataVO queryCarryCapacityData(CarryCapacityQueryDataParam queryParam);
|
CarryCapacityDataVO queryCarryCapacityData(CarryCapacityQueryDataParam queryParam);
|
||||||
@@ -34,7 +34,6 @@ public class CarryCapacityDevicePOServiceImpl extends ServiceImpl<CarryCapacityD
|
|||||||
public Boolean add(CarryCapacityDeviceParam capacityDeviceParam) {
|
public Boolean add(CarryCapacityDeviceParam capacityDeviceParam) {
|
||||||
CarryCapacityDevicePO carryCapacityDevicePO = new CarryCapacityDevicePO();
|
CarryCapacityDevicePO carryCapacityDevicePO = new CarryCapacityDevicePO();
|
||||||
BeanUtils.copyProperties(capacityDeviceParam,carryCapacityDevicePO);
|
BeanUtils.copyProperties(capacityDeviceParam,carryCapacityDevicePO);
|
||||||
boolean save = this.save(carryCapacityDevicePO);
|
return this.save(carryCapacityDevicePO);
|
||||||
return save;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,20 +59,23 @@ public class CarryCapacityResultPOServiceImpl extends ServiceImpl<CarryCapacityR
|
|||||||
CarryCapacityUserPO carryCapacityUserPO = carryCapacityUserPOService.queyDetailUserById(userId);
|
CarryCapacityUserPO carryCapacityUserPO = carryCapacityUserPOService.queyDetailUserById(userId);
|
||||||
return carryCapacityUserPO.getUserName();
|
return carryCapacityUserPO.getUserName();
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
vo.setUserName(collect1.stream().collect(Collectors.joining(",")));
|
vo.setUserName(String.join(",", collect1));
|
||||||
if (ObjectUtils.isNotEmpty(temp.getIResultList()) ){
|
if (ObjectUtils.isNotEmpty(temp.getIResultList()) ){
|
||||||
String iResultList = temp.getIResultList();
|
String iResultList = temp.getIResultList();
|
||||||
List<CarryCapacityDResultVO.CarryCapacityIResult> list = JSONUtil.toList(JSONUtil.toJsonStr(iResultList), CarryCapacityDResultVO.CarryCapacityIResult.class);
|
List<CarryCapacityDResultVO.CarryCapacityIResult> list = JSONUtil.toList(JSONUtil.toJsonStr(iResultList), CarryCapacityDResultVO.CarryCapacityIResult.class);
|
||||||
vo.setIResultList(list);
|
vo.setIResultList(list);
|
||||||
}
|
}
|
||||||
if(Objects.nonNull(vo.getLineId())){
|
if(StringUtils.isNotBlank(vo.getLineId())){
|
||||||
LineDetailVO data = lineFeignClient.getLineSubGdDetail(vo.getLineId()).getData();
|
LineDetailVO data = lineFeignClient.getLineSubGdDetail(vo.getLineId()).getData();
|
||||||
|
if(Objects.nonNull(data)){
|
||||||
vo.setLineName(data.getGdName()+"->"
|
vo.setLineName(data.getGdName()+"->"
|
||||||
+data.getSubName()+"->"
|
+data.getSubName()+"->"
|
||||||
+data.getDevName()+"->"
|
+data.getDevName()+"->"
|
||||||
+data.getLineName());
|
+data.getLineName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return vo;
|
return vo;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
returnpage.setRecords(collect);
|
returnpage.setRecords(collect);
|
||||||
|
|||||||
@@ -27,12 +27,13 @@ import com.njcn.device.pq.api.DeviceTreeClient;
|
|||||||
import com.njcn.device.pq.api.LineFeignClient;
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||||
import com.njcn.device.pq.pojo.vo.TerminalTree;
|
import com.njcn.device.pq.pojo.vo.TerminalTree;
|
||||||
import com.njcn.influx.deprecated.InfluxDBPublicParam;
|
import com.njcn.influx.constant.InfluxDbSqlConstant;
|
||||||
import com.njcn.influx.imapper.DataHarmPowerPMapper;
|
import com.njcn.influx.imapper.DataHarmPowerPMapper;
|
||||||
import com.njcn.influx.imapper.DataHarmPowerQMapper;
|
import com.njcn.influx.imapper.DataHarmPowerQMapper;
|
||||||
import com.njcn.influx.imapper.DataVMapper;
|
import com.njcn.influx.imapper.DataVMapper;
|
||||||
import com.njcn.influx.imapper.IDataIMapper;
|
import com.njcn.influx.imapper.DataIMapper;
|
||||||
import com.njcn.influx.pojo.bo.CarryCapcityData;
|
import com.njcn.influx.pojo.bo.CarryCapcityData;
|
||||||
|
import com.njcn.influx.pojo.constant.InfluxDBTableConstant;
|
||||||
import com.njcn.influx.pojo.po.DataI;
|
import com.njcn.influx.pojo.po.DataI;
|
||||||
import com.njcn.oss.constant.OssPath;
|
import com.njcn.oss.constant.OssPath;
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
@@ -46,6 +47,7 @@ import org.springframework.beans.BeanUtils;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
@@ -67,21 +69,28 @@ import static com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityStrategyVO.Car
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class CarryCapcityServiceImpl implements CarryCapcityService {
|
public class CarryCapacityServiceImpl implements CarryCapacityService {
|
||||||
|
|
||||||
private final LineFeignClient lineFeignClient;
|
private final LineFeignClient lineFeignClient;
|
||||||
private final DeviceTreeClient deviceTreeClient;
|
private final DeviceTreeClient deviceTreeClient;
|
||||||
private final DataHarmPowerQMapper dataHarmPowerQMapper;
|
|
||||||
private final DataHarmPowerPMapper dataHarmPowerPMapper;
|
@Resource
|
||||||
private final DataVMapper dataVMapper;
|
private DataHarmPowerQMapper dataHarmPowerQMapper;
|
||||||
private final IDataIMapper dataIMapper;
|
|
||||||
|
@Resource
|
||||||
|
private DataHarmPowerPMapper dataHarmPowerPMapper;
|
||||||
|
@Resource
|
||||||
|
private DataVMapper dataVMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DataIMapper dataIMapper;
|
||||||
|
|
||||||
private final CarryCapacityStrategyPOService carryCapacityStrategyPOService;
|
private final CarryCapacityStrategyPOService carryCapacityStrategyPOService;
|
||||||
private final CarryCapacityDataPOService carryCapacityDataPOService;
|
private final CarryCapacityDataPOService carryCapacityDataPOService;
|
||||||
private final RedisUtil redisUtil;
|
private final RedisUtil redisUtil;
|
||||||
private final CarryCapacityResultPOService carryCapacityResultPOService;
|
private final CarryCapacityResultPOService carryCapacityResultPOService;
|
||||||
private final CarryCapacityUserPOService carryCapacityUserPOService;
|
private final CarryCapacityUserPOService carryCapacityUserPOService;
|
||||||
private static final double DEFAULTVALUE=3141.5926;
|
private static final double DEFAULTVALUE = 3.1415926;
|
||||||
|
|
||||||
private final FileStorageUtil fileStorageUtil;
|
private final FileStorageUtil fileStorageUtil;
|
||||||
|
|
||||||
@@ -116,8 +125,6 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
LocalDate endDate2 = endDate.plusWeeks(-1);
|
LocalDate endDate2 = endDate.plusWeeks(-1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
String startTime = LocalDateTimeUtil.format(queryParam.getStartTime(), formatter) + " 00:00:00";
|
String startTime = LocalDateTimeUtil.format(queryParam.getStartTime(), formatter) + " 00:00:00";
|
||||||
String endTime = LocalDateTimeUtil.format(queryParam.getEndTime(), formatter) + " 23:59:00";
|
String endTime = LocalDateTimeUtil.format(queryParam.getEndTime(), formatter) + " 23:59:00";
|
||||||
@@ -152,7 +159,7 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
缺失布置3.1415926,后边更具3.1415926个数来判断数据完整性,及进行数据补充*/
|
缺失布置3.1415926,后边更具3.1415926个数来判断数据完整性,及进行数据补充*/
|
||||||
//有功功率
|
//有功功率
|
||||||
String SqlP1 = "select mean(p)*1000 as value from data_harmpower_p where value_type='CP95' and phasic_type!='T' and line_id='" + lineId +
|
String SqlP1 = "select mean(p)*1000 as value from data_harmpower_p where value_type='CP95' and phasic_type!='T' and line_id='" + lineId +
|
||||||
"' and time >= '" + startTime + "'and time <= '" +endTime + "'"+"group by time("+timeInterval+"m) ,* fill(3.1415926)"+InfluxDBPublicParam.TIME_ZONE;
|
"' and time >= '" + startTime + "'and time <= '" + endTime + "'" + "group by time(" + timeInterval + "m) ,* fill(0.0031415926)" + InfluxDbSqlConstant.TZ;
|
||||||
dataHarmPowerPList = dataHarmPowerPMapper.getSqlResult(SqlP1);
|
dataHarmPowerPList = dataHarmPowerPMapper.getSqlResult(SqlP1);
|
||||||
|
|
||||||
//数据校验
|
//数据校验
|
||||||
@@ -172,7 +179,7 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
|
|
||||||
//无功功率
|
//无功功率
|
||||||
String SqlQ1 = "select mean(q)*1000 as value from data_harmpower_q where value_type='CP95' and phasic_type!='T' and line_id='" + lineId +
|
String SqlQ1 = "select mean(q)*1000 as value from data_harmpower_q where value_type='CP95' and phasic_type!='T' and line_id='" + lineId +
|
||||||
"' and time >= '" + startTime + "'and time <= '" +endTime + "'"+"group by time("+timeInterval+"m) ,* fill(3.1415926)"+InfluxDBPublicParam.TIME_ZONE;
|
"' and time >= '" + startTime + "'and time <= '" + endTime + "'" + "group by time(" + timeInterval + "m) ,* fill(0.0031415926)" + InfluxDbSqlConstant.TZ;
|
||||||
dataHarmPowerQList = dataHarmPowerQMapper.getSqlResult(SqlQ1);
|
dataHarmPowerQList = dataHarmPowerQMapper.getSqlResult(SqlQ1);
|
||||||
//数据缺失填补
|
//数据缺失填补
|
||||||
//数据校验
|
//数据校验
|
||||||
@@ -191,7 +198,6 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
// dataHarmPowerQList);
|
// dataHarmPowerQList);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//前2周的数据用于计算首端电流模型参数
|
//前2周的数据用于计算首端电流模型参数
|
||||||
String forwardStartTime = LocalDateTimeUtil.format(queryParam.getStartTime()
|
String forwardStartTime = LocalDateTimeUtil.format(queryParam.getStartTime()
|
||||||
.plusWeeks(-1)
|
.plusWeeks(-1)
|
||||||
@@ -201,7 +207,7 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
, formatter) + " 23:59:00";
|
, formatter) + " 23:59:00";
|
||||||
|
|
||||||
String SqlP2 = "select mean(p)*1000 as value from data_harmpower_p where value_type='CP95' and phasic_type!='T' and line_id='" + lineId +
|
String SqlP2 = "select mean(p)*1000 as value from data_harmpower_p where value_type='CP95' and phasic_type!='T' and line_id='" + lineId +
|
||||||
"' and time >= '" + forwardStartTime + "'and time <= '" +forwardEndTime + "'"+"group by time("+timeInterval+"m) ,* fill(3.1415926)"+InfluxDBPublicParam.TIME_ZONE;
|
"' and time >= '" + forwardStartTime + "'and time <= '" + forwardEndTime + "'" + "group by time(" + timeInterval + "m) ,* fill(0.0031415926)" + InfluxDbSqlConstant.TZ;
|
||||||
dataHarmPowerP2List = dataHarmPowerPMapper.getSqlResult(SqlP2);
|
dataHarmPowerP2List = dataHarmPowerPMapper.getSqlResult(SqlP2);
|
||||||
//数据校验
|
//数据校验
|
||||||
if (CollectionUtil.isEmpty(dataHarmPowerP2List)) {
|
if (CollectionUtil.isEmpty(dataHarmPowerP2List)) {
|
||||||
@@ -220,7 +226,7 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
|
|
||||||
//无功功率
|
//无功功率
|
||||||
String SqlQ2 = "select mean(q)*1000 as value from data_harmpower_q where value_type='CP95' and phasic_type!='T' and line_id='" + lineId +
|
String SqlQ2 = "select mean(q)*1000 as value from data_harmpower_q where value_type='CP95' and phasic_type!='T' and line_id='" + lineId +
|
||||||
"' and time >= '" + forwardStartTime + "'and time <= '" +forwardEndTime + "'"+"group by time("+timeInterval+"m) ,* fill(3.1415926)"+InfluxDBPublicParam.TIME_ZONE;
|
"' and time >= '" + forwardStartTime + "'and time <= '" + forwardEndTime + "'" + "group by time(" + timeInterval + "m) ,* fill(0.0031415926)" + InfluxDbSqlConstant.TZ;
|
||||||
dataHarmPowerQ2List = dataHarmPowerQMapper.getSqlResult(SqlQ2);
|
dataHarmPowerQ2List = dataHarmPowerQMapper.getSqlResult(SqlQ2);
|
||||||
//数据校验
|
//数据校验
|
||||||
//数据校验
|
//数据校验
|
||||||
@@ -240,7 +246,7 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
|
|
||||||
//电压
|
//电压
|
||||||
String SqlU2 = "select mean(rms)*1000 as value from data_v where value_type='CP95' and phasic_type!='T' and line_id='" + lineId +
|
String SqlU2 = "select mean(rms)*1000 as value from data_v where value_type='CP95' and phasic_type!='T' and line_id='" + lineId +
|
||||||
"' and time >= '" + forwardStartTime + "'and time <= '" +forwardEndTime + "'"+"group by time("+timeInterval+"m) ,* fill(3.1415926)"+InfluxDBPublicParam.TIME_ZONE;
|
"' and time >= '" + forwardStartTime + "'and time <= '" + forwardEndTime + "'" + "group by time(" + timeInterval + "m) ,* fill(0.0031415926)" + InfluxDbSqlConstant.TZ;
|
||||||
dataHarmPowerU2List = dataVMapper.getSqlResult(SqlU2);
|
dataHarmPowerU2List = dataVMapper.getSqlResult(SqlU2);
|
||||||
//数据校验
|
//数据校验
|
||||||
//数据校验
|
//数据校验
|
||||||
@@ -265,7 +271,6 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
dataHarmPowerU2List);
|
dataHarmPowerU2List);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -273,10 +278,6 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
carryCapacityDataVO.setData(dataHarmPowerPList);
|
carryCapacityDataVO.setData(dataHarmPowerPList);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<String> phaseType = Stream.of("A", "B", "C").collect(Collectors.toList());
|
List<String> phaseType = Stream.of("A", "B", "C").collect(Collectors.toList());
|
||||||
|
|
||||||
Map<String, Double> results = new HashMap<>(4);
|
Map<String, Double> results = new HashMap<>(4);
|
||||||
@@ -325,7 +326,7 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
if (CollectionUtil.isEmpty(dataHarmPowerQList)) {
|
if (CollectionUtil.isEmpty(dataHarmPowerQList)) {
|
||||||
//无功功率
|
//无功功率
|
||||||
String SqlQ1 = "select mean(q)*1000 as value from data_harmpower_q where value_type='CP95' and phasic_type!='T' and line_id='" + lineId +
|
String SqlQ1 = "select mean(q)*1000 as value from data_harmpower_q where value_type='CP95' and phasic_type!='T' and line_id='" + lineId +
|
||||||
"' and time >= '" + startTime + "'and time <= '" +endTime + "'"+"group by time("+timeInterval+"m) ,* fill(3.1415926)"+InfluxDBPublicParam.TIME_ZONE;
|
"' and time >= '" + startTime + "'and time <= '" + endTime + "'" + "group by time(" + timeInterval + "m) ,* fill(0.0031415926)" + InfluxDbSqlConstant.TZ;
|
||||||
dataHarmPowerQList = dataHarmPowerQMapper.getSqlResult(SqlQ1);
|
dataHarmPowerQList = dataHarmPowerQMapper.getSqlResult(SqlQ1);
|
||||||
if (CollectionUtil.isEmpty(dataHarmPowerQList)) {
|
if (CollectionUtil.isEmpty(dataHarmPowerQList)) {
|
||||||
throw new BusinessException(AdvanceResponseEnum.DATA_NOT_FOUND);
|
throw new BusinessException(AdvanceResponseEnum.DATA_NOT_FOUND);
|
||||||
@@ -344,9 +345,6 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
carryCapacityDataQVO.setData(dataHarmPowerQList);
|
carryCapacityDataQVO.setData(dataHarmPowerQList);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<String> phaseType = Stream.of("A", "B", "C").collect(Collectors.toList());
|
List<String> phaseType = Stream.of("A", "B", "C").collect(Collectors.toList());
|
||||||
|
|
||||||
Map<String, Double> results = new HashMap<>(4);
|
Map<String, Double> results = new HashMap<>(4);
|
||||||
@@ -397,8 +395,8 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
stringBuilder1.append("mean(i_").append(i).append(") AS i_").append(i).append(",");
|
stringBuilder1.append("mean(i_").append(i).append(") AS i_").append(i).append(",");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stringBuilder2.append ("line_id='").append (lineId).append ("' and ").append(InfluxDBPublicParam.TIME + " >= '").append(startTime).append("' and ").append(InfluxDBPublicParam.TIME).append(" <= '").append(endTime).append("' group by time(").append(timeInterval).append("m),* fill(3.1415926) ").append(InfluxDBPublicParam.TIME_ZONE);
|
stringBuilder2.append("line_id='").append(lineId).append("' and ").append(InfluxDbSqlConstant.TIME + " >= '").append(startTime).append("' and ").append(InfluxDbSqlConstant.TIME).append(" <= '").append(endTime).append("' group by time(").append(timeInterval).append("m),* fill(3.1415926) ").append(InfluxDbSqlConstant.TZ);
|
||||||
String sqlI1 = "select "+stringBuilder1+" from "+ InfluxDBPublicParam.DATA_I+" where value_type='CP95' and phasic_type!='T' and "+stringBuilder2;
|
String sqlI1 = "select " + stringBuilder1 + " from " + InfluxDBTableConstant.DATA_I + " where value_type='CP95' and phasic_type!='T' and " + stringBuilder2;
|
||||||
dataI = dataIMapper.getSqlResult(sqlI1);
|
dataI = dataIMapper.getSqlResult(sqlI1);
|
||||||
if (CollectionUtil.isEmpty(dataI)) {
|
if (CollectionUtil.isEmpty(dataI)) {
|
||||||
throw new BusinessException(AdvanceResponseEnum.DATA_NOT_FOUND);
|
throw new BusinessException(AdvanceResponseEnum.DATA_NOT_FOUND);
|
||||||
@@ -550,7 +548,6 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
.count();
|
.count();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<CarryCapacityStrategyVO> carryCapacityStrategyVOList = carryCapacityStrategyPOService.queyDetail();
|
List<CarryCapacityStrategyVO> carryCapacityStrategyVOList = carryCapacityStrategyPOService.queyDetail();
|
||||||
carryCapacityDResultVO.setReslutLevel(5);
|
carryCapacityDResultVO.setReslutLevel(5);
|
||||||
//1-安全,2-III级预警,3-II级预警,4-I 级预警,依次执行策略看是否符合
|
//1-安全,2-III级预警,3-II级预警,4-I 级预警,依次执行策略看是否符合
|
||||||
@@ -638,7 +635,6 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
LocalDate endDate2 = endDate.plusWeeks(-1);
|
LocalDate endDate2 = endDate.plusWeeks(-1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//前一周的数据
|
//前一周的数据
|
||||||
ExcelDataDTO excelDataDTO = ParsingFile(startDate, endDate, excelDataParam.getFile().getInputStream());
|
ExcelDataDTO excelDataDTO = ParsingFile(startDate, endDate, excelDataParam.getFile().getInputStream());
|
||||||
List<CarryCapcityData> dataHarmPowerPList = excelDataDTO.getDataHarmPowerPList();
|
List<CarryCapcityData> dataHarmPowerPList = excelDataDTO.getDataHarmPowerPList();
|
||||||
@@ -772,8 +768,6 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
LocalDate endDate2 = endDate.plusWeeks(-1);
|
LocalDate endDate2 = endDate.plusWeeks(-1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
String startTime = LocalDateTimeUtil.format(queryParam.getStartTime(), formatter) + " 00:00:00";
|
String startTime = LocalDateTimeUtil.format(queryParam.getStartTime(), formatter) + " 00:00:00";
|
||||||
String endTime = LocalDateTimeUtil.format(queryParam.getEndTime(), formatter) + " 23:59:00";
|
String endTime = LocalDateTimeUtil.format(queryParam.getEndTime(), formatter) + " 23:59:00";
|
||||||
@@ -796,7 +790,7 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
, formatter) + " 23:59:00";
|
, formatter) + " 23:59:00";
|
||||||
|
|
||||||
String SqlP2 = "select mean(p)*1000 as value from data_harmpower_p where value_type='CP95' and phasic_type!='T' and line_id='" + lineId +
|
String SqlP2 = "select mean(p)*1000 as value from data_harmpower_p where value_type='CP95' and phasic_type!='T' and line_id='" + lineId +
|
||||||
"' and time >= '" + forwardStartTime + "'and time <= '" +forwardEndTime + "'"+"group by time("+timeInterval+"m) ,* fill(3.1415926)"+InfluxDBPublicParam.TIME_ZONE;
|
"' and time >= '" + forwardStartTime + "'and time <= '" + forwardEndTime + "'" + "group by time(" + timeInterval + "m) ,* fill(0.0031415926)" + InfluxDbSqlConstant.TZ;
|
||||||
dataHarmPowerP2List = dataHarmPowerPMapper.getSqlResult(SqlP2);
|
dataHarmPowerP2List = dataHarmPowerPMapper.getSqlResult(SqlP2);
|
||||||
//数据校验
|
//数据校验
|
||||||
if (CollectionUtil.isEmpty(dataHarmPowerP2List)) {
|
if (CollectionUtil.isEmpty(dataHarmPowerP2List)) {
|
||||||
@@ -818,14 +812,14 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
|
|
||||||
//无功功率
|
//无功功率
|
||||||
String SqlQ2 = "select mean(q)*1000 as value from data_harmpower_q where value_type='CP95' and phasic_type!='T' and line_id='" + lineId +
|
String SqlQ2 = "select mean(q)*1000 as value from data_harmpower_q where value_type='CP95' and phasic_type!='T' and line_id='" + lineId +
|
||||||
"' and time >= '" + forwardStartTime + "'and time <= '" +forwardEndTime + "'"+"group by time("+timeInterval+"m) ,* fill(3.1415926)"+InfluxDBPublicParam.TIME_ZONE;
|
"' and time >= '" + forwardStartTime + "'and time <= '" + forwardEndTime + "'" + "group by time(" + timeInterval + "m) ,* fill(0.0031415926)" + InfluxDbSqlConstant.TZ;
|
||||||
dataHarmPowerQ2List = dataHarmPowerQMapper.getSqlResult(SqlQ2);
|
dataHarmPowerQ2List = dataHarmPowerQMapper.getSqlResult(SqlQ2);
|
||||||
//数据校验
|
//数据校验
|
||||||
//数据缺失填补
|
//数据缺失填补
|
||||||
linearInterpolation(dataHarmPowerQ2List);
|
linearInterpolation(dataHarmPowerQ2List);
|
||||||
//电压
|
//电压
|
||||||
String SqlU2 = "select mean(rms)*1000 as value from data_v where value_type='CP95' and phasic_type!='T' and line_id='" + lineId +
|
String SqlU2 = "select mean(rms)*1000 as value from data_v where value_type='CP95' and phasic_type!='T' and line_id='" + lineId +
|
||||||
"' and time >= '" + forwardStartTime + "'and time <= '" +forwardEndTime + "'"+"group by time("+timeInterval+"m) ,* fill(3.1415926)"+InfluxDBPublicParam.TIME_ZONE;
|
"' and time >= '" + forwardStartTime + "'and time <= '" + forwardEndTime + "'" + "group by time(" + timeInterval + "m) ,* fill(0.0031415926)" + InfluxDbSqlConstant.TZ;
|
||||||
dataHarmPowerU2List = dataVMapper.getSqlResult(SqlU2);
|
dataHarmPowerU2List = dataVMapper.getSqlResult(SqlU2);
|
||||||
//数据校验
|
//数据校验
|
||||||
|
|
||||||
@@ -982,8 +976,7 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
carryCapacityIResultList.add(carryCapacityIResultVO);
|
carryCapacityIResultList.add(carryCapacityIResultVO);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
} else if (DicDataEnum.Electrified_Rail_Users.getCode().equals(code)) {
|
||||||
else if (DicDataEnum.Electrified_Rail_Users.getCode().equals(code)) {
|
|
||||||
integerList.stream().forEach(temp -> {
|
integerList.stream().forEach(temp -> {
|
||||||
CarryCapacityDResultVO.CarryCapacityIResult carryCapacityIResultVO = new CarryCapacityDResultVO.CarryCapacityIResult();
|
CarryCapacityDResultVO.CarryCapacityIResult carryCapacityIResultVO = new CarryCapacityDResultVO.CarryCapacityIResult();
|
||||||
List<Double> Ilist = new ArrayList<>();
|
List<Double> Ilist = new ArrayList<>();
|
||||||
@@ -1042,8 +1035,6 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1105,7 +1096,6 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<DataI> collect = iEexcelList.stream().map(CarryCapcityDataIEexcel::excelToPO).flatMap(Collection::stream).collect(Collectors.toList());
|
List<DataI> collect = iEexcelList.stream().map(CarryCapcityDataIEexcel::excelToPO).flatMap(Collection::stream).collect(Collectors.toList());
|
||||||
dataIList = collect.stream().filter(
|
dataIList = collect.stream().filter(
|
||||||
item -> Utils.isTimeInRange(item.getTime(), startDate, endDate)
|
item -> Utils.isTimeInRange(item.getTime(), startDate, endDate)
|
||||||
@@ -1163,26 +1153,32 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
*/
|
*/
|
||||||
public static void linearInterpolation(List<CarryCapcityData> data) {
|
public static void linearInterpolation(List<CarryCapcityData> data) {
|
||||||
|
|
||||||
for (int i = 0; i < data.size(); i++) {
|
|
||||||
if (data.get(i).getValue() == DEFAULTVALUE ||Objects.isNull(data.get(i).getValue())) {
|
data.stream().collect(Collectors.groupingBy(CarryCapcityData::getPhaseType)).forEach((k, v) -> {
|
||||||
|
|
||||||
|
for (int i = 0; i < v.size(); i++) {
|
||||||
|
if (v.get(i).getValue() == DEFAULTVALUE || Objects.isNull(v.get(i).getValue())) {
|
||||||
int prevIndex = i - 1;
|
int prevIndex = i - 1;
|
||||||
int nextIndex = i + 1;
|
int nextIndex = i + 1;
|
||||||
while (prevIndex >= 0 && (data.get(prevIndex).getValue() == DEFAULTVALUE|| Objects.isNull(data.get(prevIndex).getValue()))) {
|
while (prevIndex >= 0 && (v.get(prevIndex).getValue() == DEFAULTVALUE || Objects.isNull(v.get(prevIndex).getValue()))) {
|
||||||
prevIndex--;
|
prevIndex--;
|
||||||
}
|
}
|
||||||
while (nextIndex < data.size() && (data.get(nextIndex).getValue() == DEFAULTVALUE|| Objects.isNull(data.get(nextIndex).getValue()))) {
|
while (nextIndex < v.size() && (v.get(nextIndex).getValue() == DEFAULTVALUE || Objects.isNull(v.get(nextIndex).getValue()))) {
|
||||||
nextIndex++;
|
nextIndex++;
|
||||||
}
|
}
|
||||||
if (prevIndex >= 0 && nextIndex < data.size()) {
|
if (prevIndex >= 0 && nextIndex < v.size()) {
|
||||||
double slope = (data.get(nextIndex).getValue() - data.get(prevIndex).getValue()) / (nextIndex - prevIndex);
|
double slope = (v.get(nextIndex).getValue() - v.get(prevIndex).getValue()) / (nextIndex - prevIndex);
|
||||||
data.get(i).setValue(data.get(prevIndex).getValue() + slope * (i - prevIndex));
|
v.get(i).setValue(v.get(prevIndex).getValue() + slope * (i - prevIndex));
|
||||||
} else {
|
} else {
|
||||||
data.get(i).setValue(DEFAULTVALUE);
|
v.get(i).setValue(DEFAULTVALUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: linearInterpolationI 电流数据缺失填补
|
* @Description: linearInterpolationI 电流数据缺失填补
|
||||||
* @Param:
|
* @Param:
|
||||||
@@ -1192,74 +1188,78 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
*/
|
*/
|
||||||
public static void linearInterpolationI(List<DataI> data) {
|
public static void linearInterpolationI(List<DataI> data) {
|
||||||
|
|
||||||
for (int i = 0; i < data.size(); i++) {
|
data.stream().collect(Collectors.groupingBy(DataI::getPhaseType)).forEach((k, v) -> {
|
||||||
if (data.get(i).getI2() == DEFAULTVALUE||Objects.isNull(data.get(i).getI2())) {
|
for (int i = 0; i < v.size(); i++) {
|
||||||
|
if (v.get(i).getI2() == DEFAULTVALUE || Objects.isNull(v.get(i).getI2())) {
|
||||||
int prevIndex = i - 1;
|
int prevIndex = i - 1;
|
||||||
int nextIndex = i + 1;
|
int nextIndex = i + 1;
|
||||||
while (prevIndex >= 0 && (data.get(prevIndex).getI2() == DEFAULTVALUE||Objects.isNull(data.get(prevIndex).getI2()))) {
|
while (prevIndex >= 0 && (v.get(prevIndex).getI2() == DEFAULTVALUE || Objects.isNull(v.get(prevIndex).getI2()))) {
|
||||||
prevIndex--;
|
prevIndex--;
|
||||||
}
|
}
|
||||||
while (nextIndex < data.size() && (data.get(nextIndex).getI2() == DEFAULTVALUE||Objects.isNull(data.get(nextIndex).getI2()))) {
|
while (nextIndex < v.size() && (v.get(nextIndex).getI2() == DEFAULTVALUE || Objects.isNull(v.get(nextIndex).getI2()))) {
|
||||||
nextIndex++;
|
nextIndex++;
|
||||||
}
|
}
|
||||||
if (prevIndex >= 0 && nextIndex < data.size()) {
|
if (prevIndex >= 0 && nextIndex < v.size()) {
|
||||||
double slope = (data.get(nextIndex).getI2() - data.get(prevIndex).getI2()) / (nextIndex - prevIndex);
|
double slope = (v.get(nextIndex).getI2() - v.get(prevIndex).getI2()) / (nextIndex - prevIndex);
|
||||||
data.get(i).setI2(data.get(prevIndex).getI2() + slope * (i - prevIndex));
|
v.get(i).setI2(v.get(prevIndex).getI2() + slope * (i - prevIndex));
|
||||||
data.get(i).setI3(data.get(prevIndex).getI3() + slope * (i - prevIndex));
|
v.get(i).setI3(v.get(prevIndex).getI3() + slope * (i - prevIndex));
|
||||||
data.get(i).setI4(data.get(prevIndex).getI4() + slope * (i - prevIndex));
|
v.get(i).setI4(v.get(prevIndex).getI4() + slope * (i - prevIndex));
|
||||||
data.get(i).setI5(data.get(prevIndex).getI5() + slope * (i - prevIndex));
|
v.get(i).setI5(v.get(prevIndex).getI5() + slope * (i - prevIndex));
|
||||||
data.get(i).setI6(data.get(prevIndex).getI6() + slope * (i - prevIndex));
|
v.get(i).setI6(v.get(prevIndex).getI6() + slope * (i - prevIndex));
|
||||||
data.get(i).setI7(data.get(prevIndex).getI7() + slope * (i - prevIndex));
|
v.get(i).setI7(v.get(prevIndex).getI7() + slope * (i - prevIndex));
|
||||||
data.get(i).setI8(data.get(prevIndex).getI8() + slope * (i - prevIndex));
|
v.get(i).setI8(v.get(prevIndex).getI8() + slope * (i - prevIndex));
|
||||||
data.get(i).setI9(data.get(prevIndex).getI9() + slope * (i - prevIndex));
|
v.get(i).setI9(v.get(prevIndex).getI9() + slope * (i - prevIndex));
|
||||||
data.get(i).setI10(data.get(prevIndex).getI10() + slope * (i - prevIndex));
|
v.get(i).setI10(v.get(prevIndex).getI10() + slope * (i - prevIndex));
|
||||||
data.get(i).setI11(data.get(prevIndex).getI11() + slope * (i - prevIndex));
|
v.get(i).setI11(v.get(prevIndex).getI11() + slope * (i - prevIndex));
|
||||||
data.get(i).setI12(data.get(prevIndex).getI12() + slope * (i - prevIndex));
|
v.get(i).setI12(v.get(prevIndex).getI12() + slope * (i - prevIndex));
|
||||||
data.get(i).setI13(data.get(prevIndex).getI13() + slope * (i - prevIndex));
|
v.get(i).setI13(v.get(prevIndex).getI13() + slope * (i - prevIndex));
|
||||||
data.get(i).setI14(data.get(prevIndex).getI14() + slope * (i - prevIndex));
|
v.get(i).setI14(v.get(prevIndex).getI14() + slope * (i - prevIndex));
|
||||||
data.get(i).setI15(data.get(prevIndex).getI15() + slope * (i - prevIndex));
|
v.get(i).setI15(v.get(prevIndex).getI15() + slope * (i - prevIndex));
|
||||||
data.get(i).setI16(data.get(prevIndex).getI16() + slope * (i - prevIndex));
|
v.get(i).setI16(v.get(prevIndex).getI16() + slope * (i - prevIndex));
|
||||||
data.get(i).setI17(data.get(prevIndex).getI17() + slope * (i - prevIndex));
|
v.get(i).setI17(v.get(prevIndex).getI17() + slope * (i - prevIndex));
|
||||||
data.get(i).setI18(data.get(prevIndex).getI18() + slope * (i - prevIndex));
|
v.get(i).setI18(v.get(prevIndex).getI18() + slope * (i - prevIndex));
|
||||||
data.get(i).setI19(data.get(prevIndex).getI19() + slope * (i - prevIndex));
|
v.get(i).setI19(v.get(prevIndex).getI19() + slope * (i - prevIndex));
|
||||||
data.get(i).setI20(data.get(prevIndex).getI20() + slope * (i - prevIndex));
|
v.get(i).setI20(v.get(prevIndex).getI20() + slope * (i - prevIndex));
|
||||||
data.get(i).setI21(data.get(prevIndex).getI21() + slope * (i - prevIndex));
|
v.get(i).setI21(v.get(prevIndex).getI21() + slope * (i - prevIndex));
|
||||||
data.get(i).setI22(data.get(prevIndex).getI22() + slope * (i - prevIndex));
|
v.get(i).setI22(v.get(prevIndex).getI22() + slope * (i - prevIndex));
|
||||||
data.get(i).setI23(data.get(prevIndex).getI23() + slope * (i - prevIndex));
|
v.get(i).setI23(v.get(prevIndex).getI23() + slope * (i - prevIndex));
|
||||||
data.get(i).setI24(data.get(prevIndex).getI24() + slope * (i - prevIndex));
|
v.get(i).setI24(v.get(prevIndex).getI24() + slope * (i - prevIndex));
|
||||||
data.get(i).setI25(data.get(prevIndex).getI25() + slope * (i - prevIndex));
|
v.get(i).setI25(v.get(prevIndex).getI25() + slope * (i - prevIndex));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
data.get(i).setI2(DEFAULTVALUE);
|
v.get(i).setI2(DEFAULTVALUE);
|
||||||
data.get(i).setI3(DEFAULTVALUE);
|
v.get(i).setI3(DEFAULTVALUE);
|
||||||
data.get(i).setI4(DEFAULTVALUE);
|
v.get(i).setI4(DEFAULTVALUE);
|
||||||
data.get(i).setI5(DEFAULTVALUE);
|
v.get(i).setI5(DEFAULTVALUE);
|
||||||
data.get(i).setI6(DEFAULTVALUE);
|
v.get(i).setI6(DEFAULTVALUE);
|
||||||
data.get(i).setI7(DEFAULTVALUE);
|
v.get(i).setI7(DEFAULTVALUE);
|
||||||
data.get(i).setI8(DEFAULTVALUE);
|
v.get(i).setI8(DEFAULTVALUE);
|
||||||
data.get(i).setI9(DEFAULTVALUE);
|
v.get(i).setI9(DEFAULTVALUE);
|
||||||
data.get(i).setI10(DEFAULTVALUE);
|
v.get(i).setI10(DEFAULTVALUE);
|
||||||
data.get(i).setI11(DEFAULTVALUE);
|
v.get(i).setI11(DEFAULTVALUE);
|
||||||
data.get(i).setI12(DEFAULTVALUE);
|
v.get(i).setI12(DEFAULTVALUE);
|
||||||
data.get(i).setI13(DEFAULTVALUE);
|
v.get(i).setI13(DEFAULTVALUE);
|
||||||
data.get(i).setI14(DEFAULTVALUE);
|
v.get(i).setI14(DEFAULTVALUE);
|
||||||
data.get(i).setI15(DEFAULTVALUE);
|
v.get(i).setI15(DEFAULTVALUE);
|
||||||
data.get(i).setI16(DEFAULTVALUE);
|
v.get(i).setI16(DEFAULTVALUE);
|
||||||
data.get(i).setI17(DEFAULTVALUE);
|
v.get(i).setI17(DEFAULTVALUE);
|
||||||
data.get(i).setI18(DEFAULTVALUE);
|
v.get(i).setI18(DEFAULTVALUE);
|
||||||
data.get(i).setI19(DEFAULTVALUE);
|
v.get(i).setI19(DEFAULTVALUE);
|
||||||
data.get(i).setI20(DEFAULTVALUE);
|
v.get(i).setI20(DEFAULTVALUE);
|
||||||
data.get(i).setI21(DEFAULTVALUE);
|
v.get(i).setI21(DEFAULTVALUE);
|
||||||
data.get(i).setI22(DEFAULTVALUE);
|
v.get(i).setI22(DEFAULTVALUE);
|
||||||
data.get(i).setI23(DEFAULTVALUE);
|
v.get(i).setI23(DEFAULTVALUE);
|
||||||
data.get(i).setI24(DEFAULTVALUE);
|
v.get(i).setI24(DEFAULTVALUE);
|
||||||
data.get(i).setI25(DEFAULTVALUE);
|
v.get(i).setI25(DEFAULTVALUE);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: calUParam 首端电压模型训练获取A,B,C三项C,a,b参数
|
* @Description: calUParam 首端电压模型训练获取A,B,C三项C,a,b参数
|
||||||
* @Param:
|
* @Param:
|
||||||
@@ -1301,8 +1301,7 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
private static boolean compareNumbers(int num1, int num2, String operator) {
|
private static boolean compareNumbers(int num1, int num2, String operator) {
|
||||||
if (operator.equals("/")) {
|
if (operator.equals("/")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (operator.equals("<")) {
|
||||||
else if (operator.equals("<") ) {
|
|
||||||
return num1 < num2;
|
return num1 < num2;
|
||||||
} else if (operator.equals(">")) {
|
} else if (operator.equals(">")) {
|
||||||
return num1 > num2;
|
return num1 > num2;
|
||||||
@@ -1318,6 +1317,7 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
throw new IllegalArgumentException("无效的操作符");
|
throw new IllegalArgumentException("无效的操作符");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean StrategyReslut(List<CarryCapacityStrategyVO> carryCapacityStrategyVOList, int result_level, int safe_count, int warn_count1, int warn_count2, int warn_count3) {
|
private static boolean StrategyReslut(List<CarryCapacityStrategyVO> carryCapacityStrategyVOList, int result_level, int safe_count, int warn_count1, int warn_count2, int warn_count3) {
|
||||||
|
|
||||||
CarryCapacityStrategyVO carryCapacityStrategyVO = carryCapacityStrategyVOList.stream()
|
CarryCapacityStrategyVO carryCapacityStrategyVO = carryCapacityStrategyVOList.stream()
|
||||||
@@ -1380,5 +1380,4 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -58,8 +58,7 @@ public class CarryCapacityStrategyPOServiceImpl extends ServiceImpl<CarryCapacit
|
|||||||
//新增客户策略;
|
//新增客户策略;
|
||||||
carryCapacityStrategyPO.setProtoFlag(2);
|
carryCapacityStrategyPO.setProtoFlag(2);
|
||||||
carryCapacityStrategyPO.setUserFlag(1);
|
carryCapacityStrategyPO.setUserFlag(1);
|
||||||
boolean save = this.save(carryCapacityStrategyPO);
|
return this.save(carryCapacityStrategyPO);
|
||||||
return save;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -133,7 +132,6 @@ public class CarryCapacityStrategyPOServiceImpl extends ServiceImpl<CarryCapacit
|
|||||||
po.setUserFlag(1);
|
po.setUserFlag(1);
|
||||||
return po;
|
return po;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
boolean b = this.saveBatch(collect);
|
return this.saveBatch(collect);
|
||||||
return b;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.njcn.advance.mapper.carrycapacity.CarryCapacityUserPOMapper;
|
|||||||
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityUserParam;
|
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityUserParam;
|
||||||
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityUserPO;
|
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityUserPO;
|
||||||
import com.njcn.advance.service.carrycapacity.CarryCapacityUserPOService;
|
import com.njcn.advance.service.carrycapacity.CarryCapacityUserPOService;
|
||||||
|
import com.njcn.common.pojo.constant.LogInfo;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.user.api.UserFeignClient;
|
import com.njcn.user.api.UserFeignClient;
|
||||||
import com.njcn.user.pojo.vo.UserVO;
|
import com.njcn.user.pojo.vo.UserVO;
|
||||||
@@ -74,10 +75,10 @@ public class CarryCapacityUserPOServiceImpl extends ServiceImpl<CarryCapacityUse
|
|||||||
orderByDesc(CarryCapacityUserPO::getCreateTime);
|
orderByDesc(CarryCapacityUserPO::getCreateTime);
|
||||||
|
|
||||||
IPage<CarryCapacityUserPO> page = this.page (returnpage, queryWrapper);
|
IPage<CarryCapacityUserPO> page = this.page (returnpage, queryWrapper);
|
||||||
page.getRecords().stream().forEach(temp->{
|
page.getRecords().forEach(temp->{
|
||||||
UserVO user = userFeignClient.getUserById(temp.getCreateBy()).getData();
|
UserVO user = userFeignClient.getUserById(temp.getCreateBy()).getData();
|
||||||
|
|
||||||
temp.setCreateBy(user.getName());
|
temp.setCreateBy(Objects.isNull(user)? LogInfo.UNKNOWN_USER:user.getName());
|
||||||
});
|
});
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,9 @@ import cn.hutool.core.bean.BeanUtil;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
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 cn.hutool.core.text.StrPool;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
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.AdvanceResponseEnum;
|
||||||
import com.njcn.advance.enums.GovernSchemeEnum;
|
import com.njcn.advance.enums.GovernSchemeEnum;
|
||||||
import com.njcn.advance.pojo.dto.govern.voltage.ProductLineComputeData;
|
import com.njcn.advance.pojo.dto.govern.voltage.ProductLineComputeData;
|
||||||
@@ -32,6 +29,9 @@ import java.time.LocalDate;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
*/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class GovernSchemeCalcServiceImpl implements IGovernSchemeCalcService {
|
public class GovernSchemeCalcServiceImpl implements IGovernSchemeCalcService {
|
||||||
@@ -77,7 +77,7 @@ public class GovernSchemeCalcServiceImpl implements IGovernSchemeCalcService {
|
|||||||
String startTime = sgGovernSchemeHistoryParam.getStartTime();
|
String startTime = sgGovernSchemeHistoryParam.getStartTime();
|
||||||
String endTime = sgGovernSchemeHistoryParam.getEndTime();
|
String endTime = sgGovernSchemeHistoryParam.getEndTime();
|
||||||
//这种区间计算损失不合适,经过平均后,特征幅值在40%以下,直接被平均为25%,故此处我准备按实际的暂态信息计算
|
//这种区间计算损失不合适,经过平均后,特征幅值在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);
|
List<SgEvent> sgEventList = eventService.getEventData(sgIncomingLine.getId(), startTime, endTime);
|
||||||
if (CollectionUtil.isEmpty(sgEventList)) {
|
if (CollectionUtil.isEmpty(sgEventList)) {
|
||||||
throw new BusinessException(AdvanceResponseEnum.EVENT_DATA_MISS);
|
throw new BusinessException(AdvanceResponseEnum.EVENT_DATA_MISS);
|
||||||
@@ -373,7 +373,7 @@ public class GovernSchemeCalcServiceImpl implements IGovernSchemeCalcService {
|
|||||||
double yearRate, ProductLineComputeData productLineComputeData) {
|
double yearRate, ProductLineComputeData productLineComputeData) {
|
||||||
//为了数据好看点,除以年期望值
|
//为了数据好看点,除以年期望值
|
||||||
Integer payBackPeriod = 1;
|
Integer payBackPeriod = 1;
|
||||||
// Integer payBackPeriod = sgGovernSchemeHistoryAllVO.getPayBackPeriod();
|
//计算出来的方式:Integer payBackPeriod = sgGovernSchemeHistoryAllVO.getPayBackPeriod();
|
||||||
SgGovernSchemeParam schemeParam;
|
SgGovernSchemeParam schemeParam;
|
||||||
//总计暂降次数
|
//总计暂降次数
|
||||||
int eventCount = 0;
|
int eventCount = 0;
|
||||||
@@ -393,7 +393,7 @@ public class GovernSchemeCalcServiceImpl implements IGovernSchemeCalcService {
|
|||||||
Double[] eventEffect = eventService.getEventLossAndFailureRate(productLineComputeData, amplitude, durationTime);
|
Double[] eventEffect = eventService.getEventLossAndFailureRate(productLineComputeData, amplitude, durationTime);
|
||||||
Double singleLoss = eventEffect[0];
|
Double singleLoss = eventEffect[0];
|
||||||
Double productLineFailureRate = eventEffect[1];
|
Double productLineFailureRate = eventEffect[1];
|
||||||
// totalLoss = totalLoss + singleLoss * eventMap.get(sagData);
|
//根据暂态区域分布计算:totalLoss = totalLoss + singleLoss * eventMap.get(sagData);
|
||||||
totalLoss = totalLoss + singleLoss;
|
totalLoss = totalLoss + singleLoss;
|
||||||
if (amplitude < 0.9) {
|
if (amplitude < 0.9) {
|
||||||
eventCount++;
|
eventCount++;
|
||||||
@@ -422,7 +422,7 @@ public class GovernSchemeCalcServiceImpl implements IGovernSchemeCalcService {
|
|||||||
Double[] eventEffect = eventService.getEventLossAndFailureRate(productLineComputeData, amplitude, durationTime);
|
Double[] eventEffect = eventService.getEventLossAndFailureRate(productLineComputeData, amplitude, durationTime);
|
||||||
Double singleLoss = eventEffect[0];
|
Double singleLoss = eventEffect[0];
|
||||||
Double productLineFailureRate = eventEffect[1];
|
Double productLineFailureRate = eventEffect[1];
|
||||||
// totalLoss = totalLoss + singleLoss * eventMap.get(sagData);
|
//根据暂态区域分布计算出:totalLoss = totalLoss + singleLoss * eventMap.get(sagData);
|
||||||
totalLoss = totalLoss + singleLoss;
|
totalLoss = totalLoss + singleLoss;
|
||||||
if (amplitude < 0.9) {
|
if (amplitude < 0.9) {
|
||||||
eventCount++;
|
eventCount++;
|
||||||
@@ -541,7 +541,8 @@ public class GovernSchemeCalcServiceImpl implements IGovernSchemeCalcService {
|
|||||||
* @param power 功率
|
* @param power 功率
|
||||||
*/
|
*/
|
||||||
private void calcEquipment(GovernSchemeEnum governSchemeEnum, CommonSchemeParam commonSchemeParam, QuickSchemeParam quickSchemeParam, Double power, SgGovernSchemeHistoryDetailVO resultVo) {
|
private void calcEquipment(GovernSchemeEnum governSchemeEnum, CommonSchemeParam commonSchemeParam, QuickSchemeParam quickSchemeParam, Double power, SgGovernSchemeHistoryDetailVO resultVo) {
|
||||||
resultVo.setCount(0);//避免NULL时报错
|
// 避免NULL时报错
|
||||||
|
resultVo.setCount(0);
|
||||||
double priceIndex;
|
double priceIndex;
|
||||||
switch (governSchemeEnum) {
|
switch (governSchemeEnum) {
|
||||||
case UPS:
|
case UPS:
|
||||||
@@ -564,7 +565,7 @@ public class GovernSchemeCalcServiceImpl implements IGovernSchemeCalcService {
|
|||||||
AVCInfo avcInfo = calcAvc(power);
|
AVCInfo avcInfo = calcAvc(power);
|
||||||
resultVo.setSize(avcInfo.getSize());
|
resultVo.setSize(avcInfo.getSize());
|
||||||
resultVo.setCount(avcInfo.getCount());
|
resultVo.setCount(avcInfo.getCount());
|
||||||
resultVo.setPower(PubUtils.doubleRound(2, (double) avcInfo.getTotalPower()));
|
resultVo.setPower(PubUtils.doubleRound(2, avcInfo.getTotalPower()));
|
||||||
//根据新需求,总功率低于50kW时,按50kW一跳且价格上浮50%;高于50kW时每50kW一跳。
|
//根据新需求,总功率低于50kW时,按50kW一跳且价格上浮50%;高于50kW时每50kW一跳。
|
||||||
priceIndex = 1;
|
priceIndex = 1;
|
||||||
if (avcInfo.getTotalPower() < 50) {
|
if (avcInfo.getTotalPower() < 50) {
|
||||||
@@ -740,7 +741,7 @@ public class GovernSchemeCalcServiceImpl implements IGovernSchemeCalcService {
|
|||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
@Getter
|
@Getter
|
||||||
class AVCInfo implements Comparable<AVCInfo> {
|
static class AVCInfo implements Comparable<AVCInfo> {
|
||||||
private int totalPower;
|
private int totalPower;
|
||||||
private int power;
|
private int power;
|
||||||
private int count;
|
private int count;
|
||||||
@@ -750,7 +751,7 @@ public class GovernSchemeCalcServiceImpl implements IGovernSchemeCalcService {
|
|||||||
this.power = power;
|
this.power = power;
|
||||||
this.count = (int) Math.ceil(totalPower / this.power);
|
this.count = (int) Math.ceil(totalPower / this.power);
|
||||||
this.size = size;
|
this.size = size;
|
||||||
this.totalPower = this.power * this.count;
|
// 此处后续被覆盖了,this.totalPower = this.power * this.count;
|
||||||
//根据新需求,总功率低于50kW时,按50kW一跳且价格上浮50%;高于50kW时每50kW一跳。
|
//根据新需求,总功率低于50kW时,按50kW一跳且价格上浮50%;高于50kW时每50kW一跳。
|
||||||
double power4price;
|
double power4price;
|
||||||
if (totalPower >= 50) {
|
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.SgEvent;
|
||||||
import com.njcn.advance.pojo.po.govern.voltage.SgIncomingLine;
|
import com.njcn.advance.pojo.po.govern.voltage.SgIncomingLine;
|
||||||
import com.njcn.advance.pojo.vo.govern.voltage.*;
|
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.ISgEventService;
|
||||||
import com.njcn.advance.service.govern.voltage.ISgIncomingLineService;
|
import com.njcn.advance.service.govern.voltage.ISgIncomingLineService;
|
||||||
import com.njcn.advance.service.govern.voltage.ISgProductLineService;
|
import com.njcn.advance.service.govern.voltage.ISgProductLineService;
|
||||||
@@ -214,7 +213,7 @@ public class SgEventServiceImpl extends ServiceImpl<SgEventMapper, SgEvent> impl
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<Integer[], Integer> getEventMap(String id, String startTime, String endTime) {
|
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;
|
LambdaQueryWrapper<SgEvent> lambdaQueryWrapper;
|
||||||
for (double[] amplitudeRange : AMPLITUDE) {
|
for (double[] amplitudeRange : AMPLITUDE) {
|
||||||
for (double[] durationTimeRange : DURATION_TIME) {
|
for (double[] durationTimeRange : DURATION_TIME) {
|
||||||
@@ -344,7 +343,7 @@ public class SgEventServiceImpl extends ServiceImpl<SgEventMapper, SgEvent> impl
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
List<String> incomingLineIDList = imcomingLineList.stream().map(SgIncomingLine::getId).collect(Collectors.toList());
|
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> amplitudes = new ArrayList<>();
|
||||||
ArrayList<String> durations = 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++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
List<Object> list1 = list.get(i);
|
List<Object> list1 = list.get(i);
|
||||||
for (int j = 0; j < list1.size(); j++) {
|
for (int j = 0; j < list1.size(); j++) {
|
||||||
if (i == 0 && j == 0)
|
if (i == 0 && j == 0) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
Object v = list1.get(j);
|
Object v = list1.get(j);
|
||||||
if (i == 0) {//第一行为持续时间
|
//第一行为持续时间
|
||||||
|
if (i == 0) {
|
||||||
durations.add(String.valueOf(v));
|
durations.add(String.valueOf(v));
|
||||||
} else {
|
} else {
|
||||||
if (j == 0) {//第一列为幅值
|
//第一列为幅值
|
||||||
|
if (j == 0) {
|
||||||
amplitudes.add(String.valueOf(v));
|
amplitudes.add(String.valueOf(v));
|
||||||
} else {
|
} else {
|
||||||
ArrayList<String> vv = new ArrayList<String>();
|
ArrayList<String> vv = new ArrayList<>();
|
||||||
String amplitude = amplitudes.get(i - 1);
|
String amplitude = amplitudes.get(i - 1);
|
||||||
vv.add(amplitude);
|
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++) {
|
for (int i = 0; i < value.size(); i++) {
|
||||||
ArrayList<String> v = value.get(i);
|
ArrayList<String> v = value.get(i);
|
||||||
String[] vv = v.toArray(new String[v.size()]);
|
String[] vv = v.toArray(new String[v.size()]);
|
||||||
@@ -420,7 +422,7 @@ public class SgEventServiceImpl extends ServiceImpl<SgEventMapper, SgEvent> impl
|
|||||||
@Override
|
@Override
|
||||||
public Double[] getEventLossAndFailureRate(ProductLineComputeData productLineComputeData, double amplitude, double durationTime) {
|
public Double[] getEventLossAndFailureRate(ProductLineComputeData productLineComputeData, double amplitude, double durationTime) {
|
||||||
//总损失
|
//总损失
|
||||||
Double totalLoss = 0.0;
|
double totalLoss = 0.0;
|
||||||
//生产线故障率
|
//生产线故障率
|
||||||
Double productFailureRate = 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) {
|
public List<List<Object>> countEventTimes(List<String> lineIds, String beginDate, String endDate) {
|
||||||
List<List<Object>> rList = new ArrayList();
|
List<List<Object>> rList = new ArrayList<>();
|
||||||
List<Object> firstRow = new ArrayList<>();
|
List<Object> firstRow = new ArrayList<>();
|
||||||
firstRow.add("幅值\\持续时间");
|
firstRow.add("幅值\\持续时间");
|
||||||
rList.add(firstRow);
|
rList.add(firstRow);
|
||||||
boolean b = true;
|
boolean b = true;
|
||||||
for (double[] amplitudeRange : AMPLITUDE) {
|
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);
|
rList.add(row);
|
||||||
b = false;
|
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) {
|
private ArrayList<Object> getOneRowEventTimesData(List<Object> firstRow, double[] amplitudeRange, List<String> lineIds, String beginDate, String endDate) {
|
||||||
ArrayList<Object> rList = new ArrayList<Object>();
|
ArrayList<Object> rList = new ArrayList<>();
|
||||||
rList.add(NumberUtil.format(amplitudeRange[0] * 0.01, "0.0") + "~" + NumberUtil.format(amplitudeRange[1] * 0.01, "0.0"));
|
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) {
|
if (firstRow != null) {
|
||||||
firstRow.add(NumberUtil.format(durationTimeRange[0] * 0.001, "0.00") + "~" + NumberUtil.format(durationTimeRange[1] * 0.001, "0.00"));
|
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 begin = mainEvent.getStartTime();
|
||||||
LocalDateTime end = LocalDateTimeUtil.offset(begin, mainEvent.getDuration().longValue(), ChronoUnit.MILLIS);
|
LocalDateTime end = LocalDateTimeUtil.offset(begin, mainEvent.getDuration().longValue(), ChronoUnit.MILLIS);
|
||||||
LocalDateTime target = backUpEvent.getStartTime();
|
LocalDateTime target = backUpEvent.getStartTime();
|
||||||
if (!target.isBefore(begin) && !target.isAfter(end)) {
|
return !target.isBefore(begin) && !target.isAfter(end);
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -674,11 +660,8 @@ public class SgEventServiceImpl extends ServiceImpl<SgEventMapper, SgEvent> impl
|
|||||||
private List<SgEvent> processTimeResponse(List<SgEvent> mainEvents, List<SgEvent> backupEvents, int timeResponse) {
|
private List<SgEvent> processTimeResponse(List<SgEvent> mainEvents, List<SgEvent> backupEvents, int timeResponse) {
|
||||||
List<SgEvent> rList = new ArrayList<>();
|
List<SgEvent> rList = new ArrayList<>();
|
||||||
for (SgEvent a : mainEvents) {
|
for (SgEvent a : mainEvents) {
|
||||||
boolean bol = false;
|
boolean bol = timeResponse > a.getDuration();
|
||||||
// 考虑响应时间
|
// 考虑响应时间
|
||||||
if (timeResponse > a.getDuration()) {
|
|
||||||
bol = true;
|
|
||||||
}
|
|
||||||
if (bol) {
|
if (bol) {
|
||||||
rList.add(a);
|
rList.add(a);
|
||||||
}
|
}
|
||||||
@@ -710,7 +693,7 @@ public class SgEventServiceImpl extends ServiceImpl<SgEventMapper, SgEvent> impl
|
|||||||
* @param eventList 暂降事件集合
|
* @param eventList 暂降事件集合
|
||||||
*/
|
*/
|
||||||
private Map<Integer[], Integer> fillMap(List<SgEvent> 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) {
|
for (SgEvent event : eventList) {
|
||||||
Integer[] key = getKey(event.getDuration(), event.getFeatureAmplitude());
|
Integer[] key = getKey(event.getDuration(), event.getFeatureAmplitude());
|
||||||
if (rMap.containsKey(key)) {
|
if (rMap.containsKey(key)) {
|
||||||
@@ -737,9 +720,8 @@ public class SgEventServiceImpl extends ServiceImpl<SgEventMapper, SgEvent> impl
|
|||||||
key[0] = t2;
|
key[0] = t2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
double eTime = eventDurationTime;
|
|
||||||
for (double[] a : DURATION_TIME) {
|
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);
|
Integer t1 = DURATION_TIME_KEY_MAP.get(a);
|
||||||
key[1] = t1;
|
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.param.govern.voltage.SgGovernSchemeHistoryParam;
|
||||||
import com.njcn.advance.pojo.po.govern.voltage.SgGovernSchemeHistory;
|
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.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.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.ISgGovernSchemeHistoryService;
|
||||||
import com.njcn.advance.service.govern.voltage.ISgProductLineService;
|
import com.njcn.advance.service.govern.voltage.ISgProductLineService;
|
||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
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.eq("sg_govern_scheme_history.state", DataStateEnum.ENABLE.getCode());
|
||||||
queryWrapper.orderByDesc("sg_govern_scheme_history.create_time");
|
queryWrapper.orderByDesc("sg_govern_scheme_history.create_time");
|
||||||
Page<SgGovernSchemeHistoryVO> data = this.baseMapper.page(new Page<>(PageFactory.getPageNum(sgSchemeHistoryQueryParam), PageFactory.getPageSize(sgSchemeHistoryQueryParam)), queryWrapper);
|
return this.baseMapper.page(new Page<>(PageFactory.getPageNum(sgSchemeHistoryQueryParam), PageFactory.getPageSize(sgSchemeHistoryQueryParam)), queryWrapper);
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -7,9 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import com.njcn.advance.enums.AdvanceResponseEnum;
|
import com.njcn.advance.enums.AdvanceResponseEnum;
|
||||||
import com.njcn.advance.mapper.govern.voltage.SgIncomingLineMapper;
|
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.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.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.IncomingLineVO;
|
||||||
import com.njcn.advance.pojo.vo.govern.voltage.SgOption;
|
import com.njcn.advance.pojo.vo.govern.voltage.SgOption;
|
||||||
import com.njcn.advance.service.govern.voltage.ISgIncomingLineService;
|
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.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
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.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
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.mapper.govern.voltage.SgProductLineMapper;
|
||||||
import com.njcn.advance.pojo.dto.govern.voltage.ProductLineComputeData;
|
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.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.SgMachine;
|
||||||
import com.njcn.advance.pojo.po.govern.voltage.SgProductLine;
|
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.SgMachineVO;
|
||||||
import com.njcn.advance.pojo.vo.govern.voltage.SgProductLineVO;
|
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.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.ISgMachineService;
|
||||||
import com.njcn.advance.service.govern.voltage.ISgProductLineService;
|
import com.njcn.advance.service.govern.voltage.ISgProductLineService;
|
||||||
import com.njcn.advance.service.govern.voltage.ISgSensitiveUnitService;
|
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.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.web.factory.PageFactory;
|
import com.njcn.web.factory.PageFactory;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.poi.util.StringUtil;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
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.enums.AdvanceResponseEnum;
|
||||||
import com.njcn.advance.mapper.govern.voltage.SgSensitiveUnitMapper;
|
import com.njcn.advance.mapper.govern.voltage.SgSensitiveUnitMapper;
|
||||||
import com.njcn.advance.pojo.param.govern.voltage.SgSensitiveUnitParam;
|
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.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.pojo.vo.govern.voltage.SgSensitiveUnitVO;
|
||||||
import com.njcn.advance.service.govern.voltage.ISgSensitiveUnitService;
|
import com.njcn.advance.service.govern.voltage.ISgSensitiveUnitService;
|
||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
|
|||||||
@@ -3,11 +3,9 @@ package com.njcn.advance.service.impl;
|
|||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.hutool.core.date.TimeInterval;
|
import cn.hutool.core.date.TimeInterval;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@@ -28,7 +26,6 @@ import com.njcn.common.utils.PubUtils;
|
|||||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||||
import com.njcn.device.pq.api.LineFeignClient;
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
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.RmpEventDetailAssPO;
|
||||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||||
import com.njcn.event.pojo.vo.AdvanceEventDetailVO;
|
import com.njcn.event.pojo.vo.AdvanceEventDetailVO;
|
||||||
@@ -36,7 +33,6 @@ import com.njcn.system.api.DicDataFeignClient;
|
|||||||
import com.njcn.system.enums.DicDataEnum;
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
import com.njcn.system.enums.DicDataTypeEnum;
|
import com.njcn.system.enums.DicDataTypeEnum;
|
||||||
import com.njcn.system.enums.SystemResponseEnum;
|
import com.njcn.system.enums.SystemResponseEnum;
|
||||||
import com.njcn.system.pojo.po.Area;
|
|
||||||
import com.njcn.system.pojo.po.DictData;
|
import com.njcn.system.pojo.po.DictData;
|
||||||
import com.njcn.user.api.UserFeignClient;
|
import com.njcn.user.api.UserFeignClient;
|
||||||
import com.njcn.user.pojo.po.User;
|
import com.njcn.user.pojo.po.User;
|
||||||
@@ -49,7 +45,6 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -67,7 +62,6 @@ import java.util.stream.Collectors;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanceMapper, RmpEventDetailPO> implements EventRelevantAnalysisService {
|
public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanceMapper, RmpEventDetailPO> implements EventRelevantAnalysisService {
|
||||||
|
|
||||||
private final RmpEventDetailFeignClient rmpEventDetailFeignClient;
|
|
||||||
|
|
||||||
private final DicDataFeignClient dicDataFeignClient;
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
|
||||||
@@ -112,9 +106,9 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
|||||||
List<SagEvent> listSagEvent = new ArrayList<>();
|
List<SagEvent> listSagEvent = new ArrayList<>();
|
||||||
List<EventAssObj> listEventAssObj = new ArrayList<>();
|
List<EventAssObj> listEventAssObj = new ArrayList<>();
|
||||||
|
|
||||||
Map<String, List<String>> strategyToBusBarMap = new HashMap<>();
|
Map<String, List<String>> strategyToBusBarMap = new HashMap<>(32);
|
||||||
|
|
||||||
Map<String, EntityMtrans> mapRedis = new HashMap<>();
|
Map<String, EntityMtrans> mapRedis = new HashMap<>(32);
|
||||||
|
|
||||||
Map<String, List<EntityLogic>> strategyMap = strategyList.stream().collect(Collectors.groupingBy(EntityLogic::getTPIndex));
|
Map<String, List<EntityLogic>> strategyMap = strategyList.stream().collect(Collectors.groupingBy(EntityLogic::getTPIndex));
|
||||||
strategyMap.forEach((key, list) -> {
|
strategyMap.forEach((key, list) -> {
|
||||||
@@ -133,7 +127,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
|||||||
|
|
||||||
strategyToBusBarMap.forEach((lastKey, lastVal) -> {
|
strategyToBusBarMap.forEach((lastKey, lastVal) -> {
|
||||||
int index = 1;
|
int index = 1;
|
||||||
List<EntityGroupEvtData> list = new ArrayList<EntityGroupEvtData>();
|
List<EntityGroupEvtData> list = new ArrayList<>();
|
||||||
for (EntityGroupEvtData entityGroupEvtData : baseList) {
|
for (EntityGroupEvtData entityGroupEvtData : baseList) {
|
||||||
if (lastVal.contains(entityGroupEvtData.getNodePhysics()) && dictData.getId().equals(entityGroupEvtData.getSagReason())) {
|
if (lastVal.contains(entityGroupEvtData.getNodePhysics()) && dictData.getId().equals(entityGroupEvtData.getSagReason())) {
|
||||||
entityGroupEvtData.setNode(index++);
|
entityGroupEvtData.setNode(index++);
|
||||||
@@ -158,8 +152,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
|||||||
: entityGroupEvtData.length / FinalData.MAX_EVT_NUM + 1;
|
: entityGroupEvtData.length / FinalData.MAX_EVT_NUM + 1;
|
||||||
|
|
||||||
for (int i = 0; i < circulation; i++) {
|
for (int i = 0; i < circulation; i++) {
|
||||||
int to = 0;
|
int to;
|
||||||
|
|
||||||
if (i == circulation - 1) {
|
if (i == circulation - 1) {
|
||||||
to = entityGroupEvtData.length % FinalData.MAX_EVT_NUM > 0
|
to = entityGroupEvtData.length % FinalData.MAX_EVT_NUM > 0
|
||||||
? entityGroupEvtData.length
|
? entityGroupEvtData.length
|
||||||
@@ -283,8 +276,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
|||||||
LambdaQueryWrapper<RmpEventDetailAssPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RmpEventDetailAssPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.between(RmpEventDetailAssPO::getTimeId, timeV.get(0), timeV.get(1))
|
lambdaQueryWrapper.between(RmpEventDetailAssPO::getTimeId, timeV.get(0), timeV.get(1))
|
||||||
.orderByAsc(RmpEventDetailAssPO::getTimeId);
|
.orderByAsc(RmpEventDetailAssPO::getTimeId);
|
||||||
Page<RmpEventDetailAssPO> page = rmpEventDetailAssMapper.selectPage(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), lambdaQueryWrapper);
|
return rmpEventDetailAssMapper.selectPage(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), lambdaQueryWrapper);
|
||||||
return page;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -477,24 +469,24 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
|||||||
|
|
||||||
|
|
||||||
class HandleEvent {
|
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,给其中的数组分配空间
|
||||||
EntityGroupData group_buf = new EntityGroupData();
|
EntityGroupData groupBuf = new EntityGroupData();
|
||||||
|
|
||||||
// 填入日志
|
// 填入日志
|
||||||
setMatrixcata(group_buf, entityMtrans);
|
setMatrixcata(groupBuf, entityMtrans);
|
||||||
create_evt_buf(entityGroupEvtData, group_buf, test_log_num);
|
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++) {
|
for (int i = 0; i < groupBuf.getGrp_all_num(); i++) {
|
||||||
UtilNormalization.sort_cata(group_buf, i);
|
UtilNormalization.sort_cata(groupBuf, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
return group_buf;
|
return groupBuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<EntityGroupEvtData> getData(LocalDateTime startTime, LocalDateTime endTime) {
|
public List<EntityGroupEvtData> getData(LocalDateTime startTime, LocalDateTime endTime) {
|
||||||
@@ -506,52 +498,46 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
|||||||
List<AdvanceEventDetailVO> advanceEventDetailVOLsit = querySagEventsAll(startTime, endTime);
|
List<AdvanceEventDetailVO> advanceEventDetailVOLsit = querySagEventsAll(startTime, endTime);
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < advanceEventDetailVOLsit.size(); i++) { // 获取监测点线路序号
|
for (AdvanceEventDetailVO advanceEventDetailVO : advanceEventDetailVOLsit) { // 获取监测点线路序号
|
||||||
//母线id
|
//母线id
|
||||||
String nodePhysics = advanceEventDetailVOLsit.get(i).getVoltageId();
|
String nodePhysics = advanceEventDetailVO.getVoltageId();
|
||||||
|
|
||||||
// 根据暂降类型获取高级算法对应的编号
|
// 根据暂降类型获取高级算法对应的编号
|
||||||
int cata = 0;
|
int cata;
|
||||||
long ll = 0L;
|
long ll;
|
||||||
int start_time = 0;
|
int startTimeTemp;
|
||||||
|
|
||||||
if (Objects.isNull(advanceEventDetailVOLsit.get(i).getFirstType())) {
|
if (Objects.isNull(advanceEventDetailVO.getFirstType())) {
|
||||||
cata = advanceMap.get(advanceEventDetailVOLsit.get(i).getAdvanceType()).getAlgoDescribe();
|
cata = advanceMap.get(advanceEventDetailVO.getAdvanceType()).getAlgoDescribe();
|
||||||
ll = (long) (Timestamp.valueOf(advanceEventDetailVOLsit.get(i).getStartTime()).getTime()
|
ll = (long) (Timestamp.valueOf(advanceEventDetailVO.getStartTime()).getTime()
|
||||||
+ (advanceEventDetailVOLsit.get(i).getDuration() * 1000));
|
+ (advanceEventDetailVO.getDuration() * 1000));
|
||||||
start_time = (int) (ll / 1000);
|
startTimeTemp = (int) (ll / 1000);
|
||||||
} else {
|
} else {
|
||||||
cata = advanceMap.get(advanceEventDetailVOLsit.get(i).getAdvanceType()).getAlgoDescribe(); // 获取类型
|
cata = advanceMap.get(advanceEventDetailVO.getAdvanceType()).getAlgoDescribe(); // 获取类型
|
||||||
ll = (long) (Timestamp.valueOf(advanceEventDetailVOLsit.get(i).getFirstTime()).getTime()
|
ll = (long) (Timestamp.valueOf(advanceEventDetailVO.getFirstTime()).getTime()
|
||||||
+ (advanceEventDetailVOLsit.get(i).getFirstMs()));
|
+ (advanceEventDetailVO.getFirstMs()));
|
||||||
start_time = (int) (ll / 1000);
|
startTimeTemp = (int) (ll / 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 填充SagEvent对象数据
|
// 填充SagEvent对象数据
|
||||||
SagEvent sagEvent = new SagEvent();
|
SagEvent sagEvent = new SagEvent();
|
||||||
|
|
||||||
sagEvent.setIndexEventDetail(advanceEventDetailVOLsit.get(i).getEventId());
|
sagEvent.setIndexEventDetail(advanceEventDetailVO.getEventId());
|
||||||
sagEvent.setSagTime(advanceEventDetailVOLsit.get(i).getStartTime());
|
sagEvent.setSagTime(advanceEventDetailVO.getStartTime());
|
||||||
sagEvent.setFirstTime(PubUtils.ms2Date(ll));// 必须增加,否则序列化出错
|
sagEvent.setFirstTime(PubUtils.ms2Date(ll));// 必须增加,否则序列化出错
|
||||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
sagEvent.setTime(Timestamp.valueOf(advanceEventDetailVO.getStartTime()).getTime());
|
||||||
|
|
||||||
/*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.setFirstTimeMills(ll);
|
sagEvent.setFirstTimeMills(ll);
|
||||||
sagEvent.setMsec(advanceEventDetailVOLsit.get(i).getDuration().intValue());
|
sagEvent.setMsec(advanceEventDetailVO.getDuration().intValue());
|
||||||
//sagEvent.setSagTime(PubUtils.ms2Date(Timestamp.valueOf(advanceEventDetailVOLsit.get(i).getFirstTime()).getTime()));
|
|
||||||
PlantInfo plantInfo = new PlantInfo();
|
PlantInfo plantInfo = new PlantInfo();
|
||||||
plantInfo.setNameBD(advanceEventDetailVOLsit.get(i).getSubName());
|
plantInfo.setNameBD(advanceEventDetailVO.getSubName());
|
||||||
plantInfo.setNameGD(advanceEventDetailVOLsit.get(i).getGdName());
|
plantInfo.setNameGD(advanceEventDetailVO.getGdName());
|
||||||
plantInfo.setNamePoint(advanceEventDetailVOLsit.get(i).getLineId());
|
plantInfo.setNamePoint(advanceEventDetailVO.getLineId());
|
||||||
sagEvent.setPlantInfo(plantInfo);
|
sagEvent.setPlantInfo(plantInfo);
|
||||||
sagEvent.setIndexPoint(advanceEventDetailVOLsit.get(i).getLineId());
|
sagEvent.setIndexPoint(advanceEventDetailVO.getLineId());
|
||||||
sagEvent.setCata(cata);
|
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);
|
entityGroupEvtDataList.add(entityGroupEvtData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -589,7 +575,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
|||||||
int i, j, k;
|
int i, j, k;
|
||||||
for (i = 0; i < obj.getGrp_all_num(); i++) {
|
for (i = 0; i < obj.getGrp_all_num(); i++) {
|
||||||
String strUUID = IdUtil.simpleUUID();
|
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++) {
|
for (j = 0; j < FinalData.MAX_CATA_NUM + 2; j++) {
|
||||||
if (obj.getGrp_cata_num()[i][j] != 0) {
|
if (obj.getGrp_cata_num()[i][j] != 0) {
|
||||||
@@ -602,7 +588,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listTem.size() > 0) {
|
if (!listTem.isEmpty()) {
|
||||||
processing(listTem, assEvent, date);
|
processing(listTem, assEvent, date);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -645,14 +631,15 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
|||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
* 获取变压器信息并生成矩阵
|
* 获取变压器信息并生成矩阵
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
|
@Deprecated
|
||||||
public void getNodeInfo(HandleEvent handleEvent) {
|
public void getNodeInfo(HandleEvent handleEvent) {
|
||||||
List<EntityLogic> list = relevantLogMapper.getLogic();
|
List<EntityLogic> list = relevantLogMapper.getLogic();
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(list)) {
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
Map<String, List<EntityLogic>> tfMap = list.stream().collect(Collectors.groupingBy(EntityLogic::getTPIndex));
|
Map<String, List<EntityLogic>> tfMap = list.stream().collect(Collectors.groupingBy(EntityLogic::getTPIndex));
|
||||||
Map<String, List<String>> tfBusBarMap = new HashMap<>();
|
Map<String, List<String>> tfBusBarMap = new HashMap<>(32);
|
||||||
|
|
||||||
Map<String, EntityMtrans> entityMtranMap = new HashMap<>();
|
Map<String, EntityMtrans> entityMtranMap = new HashMap<>(32);
|
||||||
|
|
||||||
tfMap.forEach((key, val) -> {
|
tfMap.forEach((key, val) -> {
|
||||||
List<String> tem = new ArrayList<>();
|
List<String> tem = new ArrayList<>();
|
||||||
|
|||||||
@@ -1,27 +1,18 @@
|
|||||||
package com.njcn.advance.service.impl;
|
package com.njcn.advance.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.date.TimeInterval;
|
import cn.hutool.core.date.TimeInterval;
|
||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
import cn.hutool.core.util.CharsetUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
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.enums.EnumEvt;
|
||||||
import com.njcn.advance.mapper.RmpEventAdvanceMapper;
|
import com.njcn.advance.mapper.RmpEventAdvanceMapper;
|
||||||
import com.njcn.advance.pojo.dto.waveAnalysis.*;
|
import com.njcn.advance.pojo.dto.waveAnalysis.*;
|
||||||
|
|
||||||
import com.njcn.advance.service.EventWaveAnalysisService;
|
import com.njcn.advance.service.EventWaveAnalysisService;
|
||||||
import com.njcn.advance.utils.*;
|
import com.njcn.advance.utils.*;
|
||||||
import com.njcn.common.config.GeneralInfo;
|
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.utils.FileUtil;
|
|
||||||
import com.njcn.common.utils.PubUtils;
|
import com.njcn.common.utils.PubUtils;
|
||||||
import com.njcn.device.pq.api.LineFeignClient;
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
|
||||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
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.event.pojo.po.RmpEventDetailPO;
|
||||||
import com.njcn.oss.constant.GeneralConstant;
|
import com.njcn.oss.constant.GeneralConstant;
|
||||||
import com.njcn.oss.constant.OssPath;
|
import com.njcn.oss.constant.OssPath;
|
||||||
@@ -32,12 +23,11 @@ import com.njcn.system.pojo.po.DictData;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.sf.json.JSONObject;
|
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.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -46,7 +36,6 @@ import java.time.ZoneOffset;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pqs
|
* pqs
|
||||||
@@ -59,15 +48,10 @@ import java.util.stream.Stream;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||||
|
|
||||||
private final int MAXLENGTH = 128 * 3000; //波形最大值计算
|
|
||||||
|
|
||||||
private final RmpEventDetailFeignClient rmpEventDetailFeignClient;
|
|
||||||
|
|
||||||
private final DicDataFeignClient dicDataFeignClient;
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
|
||||||
private final LineFeignClient lineFeignClient;
|
private final LineFeignClient lineFeignClient;
|
||||||
|
|
||||||
private final GeneralInfo generalInfo;
|
|
||||||
|
|
||||||
private final FileStorageUtil fileStorageUtil;
|
private final FileStorageUtil fileStorageUtil;
|
||||||
|
|
||||||
@@ -81,20 +65,18 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
TimeInterval timeInterval = new TimeInterval();
|
TimeInterval timeInterval = new TimeInterval();
|
||||||
//调用方法获取暂降事件详情
|
//调用方法获取暂降事件详情
|
||||||
RmpEventDetailPO rmpEventDetailPO = rmpEventAdvanceMapper.selectById(eventIndex);
|
RmpEventDetailPO rmpEventDetailPO = rmpEventAdvanceMapper.selectById(eventIndex);
|
||||||
EntityAdvancedData entityAdvancedData = null;
|
EntityAdvancedData entityAdvancedData;
|
||||||
|
|
||||||
//获取PT变比
|
//获取PT变比
|
||||||
LineDetailDataVO lineDetailDataVO = lineFeignClient.getLineDetailData(rmpEventDetailPO.getLineId()).getData();
|
LineDetailDataVO lineDetailDataVO = lineFeignClient.getLineDetailData(rmpEventDetailPO.getLineId()).getData();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (rmpEventDetailPO.getFileFlag() == 1) {
|
if (rmpEventDetailPO.getFileFlag() == 1) {
|
||||||
//获取所有暂态原因
|
//获取所有暂态原因
|
||||||
List<DictData> dicDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_TYPE.getCode()).getData();
|
List<DictData> dicDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_TYPE.getCode()).getData();
|
||||||
Map<Integer, DictData> eventTypeMap = dicDataList.stream().collect(Collectors.toMap(DictData::getAlgoDescribe, Function.identity()));
|
Map<Integer, DictData> eventTypeMap = dicDataList.stream().collect(Collectors.toMap(DictData::getAlgoDescribe, Function.identity()));
|
||||||
|
InputStream inputStreamCfg;
|
||||||
InputStream inputStreamCfg = null;
|
InputStream inputStreamDat;
|
||||||
InputStream inputStreamDat = null;
|
|
||||||
try {
|
try {
|
||||||
inputStreamCfg = fileStorageUtil.getFileStream(OssPath.WAVE_DIR + lineDetailDataVO.getIp() + StrUtil.SLASH + rmpEventDetailPO.getWavePath() + GeneralConstant.CFG);
|
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);
|
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;
|
InputStreamReader read = null;
|
||||||
String strFileLine = null;
|
String strFileLine;
|
||||||
byte[] array = {};
|
byte[] array = {};
|
||||||
List<String> temCfgList = new ArrayList<>();
|
List<String> temCfgList = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
// 判断文件是否存在
|
// 判断文件是否存在
|
||||||
array = IoUtil.readBytes(inputStreamDat);
|
array = IoUtil.readBytes(inputStreamDat);
|
||||||
|
// 考虑到编码格式
|
||||||
read = new InputStreamReader(inputStreamCfg, CharsetUtil.UTF_8);// 考虑到编码格式
|
read = new InputStreamReader(inputStreamCfg, StandardCharsets.UTF_8);
|
||||||
bufferedReader = new BufferedReader(read);
|
bufferedReader = new BufferedReader(read);
|
||||||
|
|
||||||
while ((strFileLine = bufferedReader.readLine()) != null) {
|
while ((strFileLine = bufferedReader.readLine()) != null) {
|
||||||
@@ -140,10 +122,11 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
entityAdvancedData = new EntityAdvancedData(originalList.size());
|
entityAdvancedData = new EntityAdvancedData(originalList.size());
|
||||||
|
|
||||||
for (int i = 0; i < originalList.size(); i++) {
|
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_x[i] = originalList.get(i).get(0);
|
||||||
entityAdvancedData.smp_b[i] = originalList.get(i).get(2).floatValue();
|
entityAdvancedData.smp_a[i] = originalList.get(i).get(1);
|
||||||
entityAdvancedData.smp_c[i] = originalList.get(i).get(3).floatValue();
|
entityAdvancedData.smp_b[i] = originalList.get(i).get(2);
|
||||||
|
entityAdvancedData.smp_c[i] = originalList.get(i).get(3);
|
||||||
}
|
}
|
||||||
entityAdvancedData.smp_len = originalList.size();
|
entityAdvancedData.smp_len = originalList.size();
|
||||||
|
|
||||||
@@ -156,19 +139,24 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
CauseStruct causeStruct = new CauseStruct();
|
CauseStruct causeStruct = new CauseStruct();
|
||||||
|
|
||||||
for (int i = 0; i < pitchList.size(); i++) {
|
for (int i = 0; i < pitchList.size(); i++) {
|
||||||
rect.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).floatValue();
|
causeStruct.smp_va[i] = pitchList.get(i).get(1);
|
||||||
|
|
||||||
rect.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).floatValue();
|
causeStruct.smp_vb[i] = pitchList.get(i).get(2);
|
||||||
|
|
||||||
rect.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).floatValue();
|
causeStruct.smp_vc[i] = pitchList.get(i).get(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
rect.smp_len = pitchList.size();
|
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");
|
throw new BusinessException("波形超过60S");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,8 +178,6 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
* 根据返回的结果计算,获取暂降类型描述
|
* 根据返回的结果计算,获取暂降类型描述
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
@@ -210,7 +196,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
entityAdvancedData.sagPhaseType[i] = "三相";
|
entityAdvancedData.sagPhaseType[i] = "三相";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -223,11 +209,8 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* 事件未进行高级算法处理:系统调用dll处理并保存结果
|
||||||
* @事件未进行高级算法处理:系统调用dll处理并保存结果
|
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@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) {
|
||||||
@@ -241,7 +224,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
|
|
||||||
initBackData(rect.evt_num, entityAdvancedData);
|
initBackData(rect.evt_num, entityAdvancedData);
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @判断是否调用成功
|
* @判断是否调用成功
|
||||||
* @成功执行更新pqs_eventdetail操作:更新dq持续时间、暂降类型、暂降原因、总分段数目
|
* @成功执行更新pqs_eventdetail操作:更新dq持续时间、暂降类型、暂降原因、总分段数目
|
||||||
*/
|
*/
|
||||||
@@ -307,11 +290,11 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
for (int kk = 0; kk <= i; kk++) {
|
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) {
|
if (kk < i) {
|
||||||
posb += list.get(kk).nSampleNum / list.get(kk).nOneSample * rate;
|
posb += (int) (list.get(kk).nSampleNum / list.get(kk).nOneSample * rate);
|
||||||
pos += list.get(kk).nSampleNum;
|
pos += (int) list.get(kk).nSampleNum;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,11 +312,11 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
for (int kk = 0; kk <= i; kk++) {
|
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) {
|
if (kk < i) {
|
||||||
posb += list.get(kk).nSampleNum / list.get(kk).nOneSample * rate;
|
posb += (int) (list.get(kk).nSampleNum / list.get(kk).nOneSample * rate);
|
||||||
pos += list.get(kk).nSampleNum;
|
pos += (int) list.get(kk).nSampleNum;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,8 +413,10 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
//获取波形的瞬时值、RMS值数据
|
//获取波形的瞬时值、RMS值数据
|
||||||
AnalyWave analyWave = new AnalyWave();
|
AnalyWave analyWave = new AnalyWave();
|
||||||
AnalyWaveModel.tagDataValue tagDataValue = analyWave.readComtrade(temCfgList, array, flag);
|
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.setnOneWaveNum(analyWave.getnOneWaveNum());
|
||||||
waveData.setSunData(shunWave);
|
waveData.setSunData(shunWave);
|
||||||
waveData.setTmpWaveTitle(tagDataValue.getTmpWaveTitle());
|
waveData.setTmpWaveTitle(tagDataValue.getTmpWaveTitle());
|
||||||
@@ -445,13 +430,13 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
List<String> tmpWaveTitle = tagDataValue.getTmpWaveTitle();
|
List<String> tmpWaveTitle = tagDataValue.getTmpWaveTitle();
|
||||||
/*********** Modify by yexibao ---Start **************/
|
/*********** Modify by yexibao ---Start **************/
|
||||||
for (int i = 0; i < tagDataValue.getiPhasic(); i++) {
|
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));
|
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));
|
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));
|
waveData.setC(tmpWaveTitle.get(i + 1).substring(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -478,7 +463,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
|
|
||||||
for (int offset = 0; offset < len; offset++) {
|
for (int offset = 0; offset < len; offset++) {
|
||||||
BackData backData = new BackData();
|
BackData backData = new BackData();
|
||||||
/**
|
/*
|
||||||
* @波形起始点(3相)
|
* @波形起始点(3相)
|
||||||
*/
|
*/
|
||||||
backData.POW_a = Utils.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
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())
|
backData.POW_c = Utils.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||||
.getJSONObject(offset).get(EnumEvt.POW_C.getProperty()).toString(), 0.0f);
|
.getJSONObject(offset).get(EnumEvt.POW_C.getProperty()).toString(), 0.0f);
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @跳变段电压变化
|
* @跳变段电压变化
|
||||||
*/
|
*/
|
||||||
backData.Voltagechange_Va = Utils.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
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())
|
backData.Voltagechange_Vc = Utils.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||||
.getJSONObject(offset).get(EnumEvt.VOLTAGECHANGE_VC.getProperty()).toString(), 0.0f);
|
.getJSONObject(offset).get(EnumEvt.VOLTAGECHANGE_VC.getProperty()).toString(), 0.0f);
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @持续时间
|
* @持续时间
|
||||||
*/
|
*/
|
||||||
backData.hold_time_rms = Utils.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
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())
|
backData.hold_time_dq = Utils.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||||
.getJSONObject(offset).get(EnumEvt.HOLD_TIME_DQ.getProperty()).toString(), 0.0f);
|
.getJSONObject(offset).get(EnumEvt.HOLD_TIME_DQ.getProperty()).toString(), 0.0f);
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @分段信息
|
* @分段信息
|
||||||
*/
|
*/
|
||||||
backData.SEG_T_num = Utils.getIntValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
backData.SEG_T_num = Utils.getIntValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||||
@@ -519,7 +504,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
-1);
|
-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @特征幅值
|
* @特征幅值
|
||||||
*/
|
*/
|
||||||
backData.u_min_num = Utils.getIntValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
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)
|
.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty()).getJSONObject(offset)
|
||||||
.getJSONObject(EnumEvt.U3_MIN.getProperty()).get(Integer.toString(j)).toString(), 0.0f);
|
.getJSONObject(EnumEvt.U3_MIN.getProperty()).get(Integer.toString(j)).toString(), 0.0f);
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @相位跳变
|
* @相位跳变
|
||||||
*/
|
*/
|
||||||
backData.angle_diff_an[j] = Utils.getFloatValue(
|
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(),
|
.getJSONObject(EnumEvt.ANGLE_DIFF_CP.getProperty()).get(Integer.toString(j)).toString(),
|
||||||
0.0f);
|
0.0f);
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @不平衡度
|
* @不平衡度
|
||||||
*/
|
*/
|
||||||
backData.bph_max_value[j] = Utils.getFloatValue(
|
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(),
|
.getJSONObject(EnumEvt.BPH_MAX_VALUE.getProperty()).get(Integer.toString(j)).toString(),
|
||||||
0.0f);
|
0.0f);
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @暂降原因
|
* @暂降原因
|
||||||
*/
|
*/
|
||||||
backData.qvvr_cata_cause[j] = Utils.getIntValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
backData.qvvr_cata_cause[j] = Utils.getIntValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||||
.getJSONObject(offset).getJSONObject(EnumEvt.QVVR_CATA_CAUSE.getProperty())
|
.getJSONObject(offset).getJSONObject(EnumEvt.QVVR_CATA_CAUSE.getProperty())
|
||||||
.get(Integer.toString(j)).toString(), -1);
|
.get(Integer.toString(j)).toString(), -1);
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @暂降类型
|
* @暂降类型
|
||||||
*/
|
*/
|
||||||
backData.qvvr_cata_type[j] = Utils.getIntValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
backData.qvvr_cata_type[j] = Utils.getIntValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||||
.getJSONObject(offset).getJSONObject(EnumEvt.QVVR_CATA_TYPE.getProperty())
|
.getJSONObject(offset).getJSONObject(EnumEvt.QVVR_CATA_TYPE.getProperty())
|
||||||
.get(Integer.toString(j)).toString(), -1);
|
.get(Integer.toString(j)).toString(), -1);
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* @暂降相别
|
* @暂降相别
|
||||||
*/
|
*/
|
||||||
backData.qvvr_phasetype[j] = Utils.getIntValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
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()) {
|
if (!jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).isEmpty()) {
|
||||||
entityAdvancedData.power_after_buf = new PowerData[1];
|
entityAdvancedData.power_after_buf = new PowerData[1];
|
||||||
PowerData power = new PowerData();
|
PowerData power = new PowerData();
|
||||||
float fundP[] = new float[5];
|
float[] fundP = new float[5];
|
||||||
fundP[0] = Utils.getFloatValue(
|
fundP[0] = Utils.getFloatValue(
|
||||||
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
||||||
.getJSONObject(EnumEvt.FUND_P.getProperty()).get("A").toString(), 0.0f);
|
.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);
|
.getJSONObject(EnumEvt.FUND_P.getProperty()).get("zero").toString(), 0.0f);
|
||||||
power.setFundP(fundP);
|
power.setFundP(fundP);
|
||||||
|
|
||||||
float fundQ[] = new float[5];
|
float[] fundQ = new float[5];
|
||||||
fundQ[0] = Utils.getFloatValue(
|
fundQ[0] = Utils.getFloatValue(
|
||||||
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
||||||
.getJSONObject(EnumEvt.FUND_Q.getProperty()).get("A").toString(), 0.0f);
|
.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);
|
.getJSONObject(EnumEvt.FUND_Q.getProperty()).get("zero").toString(), 0.0f);
|
||||||
power.setFundQ(fundQ);
|
power.setFundQ(fundQ);
|
||||||
|
|
||||||
float fundS[] = new float[5];
|
float[] fundS = new float[5];
|
||||||
fundS[0] = Utils.getFloatValue(
|
fundS[0] = Utils.getFloatValue(
|
||||||
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
||||||
.getJSONObject(EnumEvt.FUND_S.getProperty()).get("A").toString(), 0.0f);
|
.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()) {
|
if (!jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).isEmpty()) {
|
||||||
entityAdvancedData.qvvr_direction_info = new DirectionData[1];
|
entityAdvancedData.qvvr_direction_info = new DirectionData[1];
|
||||||
DirectionData direction = new DirectionData();
|
DirectionData direction = new DirectionData();
|
||||||
int trigTime[] = new int[7];
|
int[] trigTime = new int[7];
|
||||||
trigTime[0] = Utils.getIntValue(
|
trigTime[0] = Utils.getIntValue(
|
||||||
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
.getJSONObject(EnumEvt.TRIG_TIME.getProperty()).get("year").toString(), 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);
|
.getJSONObject(EnumEvt.TRIG_TIME.getProperty()).get("millisecond").toString(), 0);
|
||||||
direction.setTrigTime(trigTime);
|
direction.setTrigTime(trigTime);
|
||||||
|
|
||||||
float qvvrBeforeRms[] = new float[6];
|
float[] qvvrBeforeRms = new float[6];
|
||||||
qvvrBeforeRms[0] = Utils.getFloatValue(
|
qvvrBeforeRms[0] = Utils.getFloatValue(
|
||||||
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
.getJSONObject(EnumEvt.QVVR_BEFORE_RMS.getProperty()).get("Fund_Ua").toString(), 0.0f);
|
.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);
|
.getJSONObject(EnumEvt.QVVR_BEFORE_RMS.getProperty()).get("Fund_Ic").toString(), 0.0f);
|
||||||
direction.setQvvrBeforeRms(qvvrBeforeRms);
|
direction.setQvvrBeforeRms(qvvrBeforeRms);
|
||||||
|
|
||||||
float qvvrBeforeZk[] = new float[6];
|
float[] qvvrBeforeZk = new float[6];
|
||||||
qvvrBeforeZk[0] = Utils.getFloatValue(
|
qvvrBeforeZk[0] = Utils.getFloatValue(
|
||||||
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
.getJSONObject(EnumEvt.QVVR_BEFORE_ZK.getProperty()).get("Za").toString(), 0.0f);
|
.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);
|
.getJSONObject(EnumEvt.QVVR_BEFORE_ZK.getProperty()).get("Zca").toString(), 0.0f);
|
||||||
direction.setQvvrBeforeZk(qvvrBeforeZk);
|
direction.setQvvrBeforeZk(qvvrBeforeZk);
|
||||||
|
|
||||||
float qvvrOccurRms[] = new float[6];
|
float[] qvvrOccurRms = new float[6];
|
||||||
qvvrOccurRms[0] = Utils.getFloatValue(
|
qvvrOccurRms[0] = Utils.getFloatValue(
|
||||||
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
.getJSONObject(EnumEvt.QVVR_OCCUR_RMS.getProperty()).get("Fund_Ua").toString(), 0.0f);
|
.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);
|
.getJSONObject(EnumEvt.QVVR_OCCUR_RMS.getProperty()).get("Fund_Ic").toString(), 0.0f);
|
||||||
direction.setQvvrOccurRms(qvvrOccurRms);
|
direction.setQvvrOccurRms(qvvrOccurRms);
|
||||||
|
|
||||||
float qvvrOccurZk[] = new float[6];
|
float[] qvvrOccurZk = new float[6];
|
||||||
qvvrOccurZk[0] = Utils.getFloatValue(
|
qvvrOccurZk[0] = Utils.getFloatValue(
|
||||||
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
.getJSONObject(EnumEvt.QVVR_OCCUR_ZK.getProperty()).get("Za").toString(), 0.0f);
|
.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);
|
.getJSONObject(EnumEvt.QVVR_OCCUR_ZK.getProperty()).get("Zca").toString(), 0.0f);
|
||||||
direction.setQvvrOccurZk(qvvrOccurZk);
|
direction.setQvvrOccurZk(qvvrOccurZk);
|
||||||
|
|
||||||
String qvvrPosInfo[] = new String[1];
|
String[] qvvrPosInfo = new String[1];
|
||||||
qvvrPosInfo[0] = jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
qvvrPosInfo[0] = jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
.getJSONObject(EnumEvt.QVVR_POS_INFO.getProperty()).get("direction").toString();
|
.getJSONObject(EnumEvt.QVVR_POS_INFO.getProperty()).get("direction").toString();
|
||||||
direction.setQvvrPosInfo(qvvrPosInfo);
|
direction.setQvvrPosInfo(qvvrPosInfo);
|
||||||
@@ -784,7 +769,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
if (!jsonObject.getJSONArray(EnumEvt.QVVR_UTBL_INFO.getProperty()).isEmpty()) {
|
if (!jsonObject.getJSONArray(EnumEvt.QVVR_UTBL_INFO.getProperty()).isEmpty()) {
|
||||||
entityAdvancedData.qvvr_utbl_info = new UtblData[1];
|
entityAdvancedData.qvvr_utbl_info = new UtblData[1];
|
||||||
UtblData direction = new UtblData();
|
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)
|
String year = jsonObject.getJSONArray(EnumEvt.QVVR_UTBL_INFO.getProperty()).getJSONObject(0)
|
||||||
.getJSONObject(EnumEvt.TRIG_TIME.getProperty()).get("year").toString();
|
.getJSONObject(EnumEvt.TRIG_TIME.getProperty()).get("year").toString();
|
||||||
String month = jsonObject.getJSONArray(EnumEvt.QVVR_UTBL_INFO.getProperty()).getJSONObject(0)
|
String month = jsonObject.getJSONArray(EnumEvt.QVVR_UTBL_INFO.getProperty()).getJSONObject(0)
|
||||||
@@ -806,7 +791,10 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
e.printStackTrace();
|
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;
|
trigTime[0] = between;
|
||||||
direction.setTrigTime(trigTime);
|
direction.setTrigTime(trigTime);
|
||||||
entityAdvancedData.qvvr_utbl_info[0] = direction;
|
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.date.DateUtil;
|
||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
import cn.hutool.core.text.StrPool;
|
import cn.hutool.core.text.StrPool;
|
||||||
import cn.hutool.core.util.CharsetUtil;
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.advance.mapper.responsibility.RespDataResultMapper;
|
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.CustomerData;
|
||||||
import com.njcn.advance.pojo.dto.responsibility.CustomerResponsibility;
|
import com.njcn.advance.pojo.dto.responsibility.CustomerResponsibility;
|
||||||
import com.njcn.advance.pojo.dto.responsibility.ResponsibilityResult;
|
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.IRespDataResultService;
|
||||||
import com.njcn.advance.service.responsibility.IRespDataService;
|
import com.njcn.advance.service.responsibility.IRespDataService;
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -69,17 +66,17 @@ public class RespDataResultServiceImpl extends ServiceImpl<RespDataResultMapper,
|
|||||||
responsibilityResult.setResponsibilityDataIndex(respDataResult.getResDataId());
|
responsibilityResult.setResponsibilityDataIndex(respDataResult.getResDataId());
|
||||||
//处理时间轴数据
|
//处理时间轴数据
|
||||||
InputStream timeDataStream = fileStorageUtil.getFileStream(respDataResult.getTimeData());
|
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);
|
List<Long> timeData = JSONArray.parseArray(timeDataStr, Long.class);
|
||||||
responsibilityResult.setTimeDatas(timeData);
|
responsibilityResult.setTimeDatas(timeData);
|
||||||
//处理用户详细数据
|
//处理用户详细数据
|
||||||
InputStream userDetailStream = fileStorageUtil.getFileStream(respDataResult.getUserDetailData());
|
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);
|
List<CustomerData> customerData = JSONArray.parseArray(userDetailStr, CustomerData.class);
|
||||||
responsibilityResult.setDatas(customerData);
|
responsibilityResult.setDatas(customerData);
|
||||||
//处理排名前10数据
|
//处理排名前10数据
|
||||||
InputStream respStream = fileStorageUtil.getFileStream(respDataResult.getUserResponsibility());
|
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);
|
List<CustomerResponsibility> respData = JSONArray.parseArray(respStr, CustomerResponsibility.class);
|
||||||
responsibilityResult.setResponsibilities(respData);
|
responsibilityResult.setResponsibilities(respData);
|
||||||
responsibilityResults.add(responsibilityResult);
|
responsibilityResults.add(responsibilityResult);
|
||||||
|
|||||||
@@ -7,12 +7,10 @@ import cn.hutool.core.date.DatePattern;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
import cn.hutool.core.text.StrPool;
|
import cn.hutool.core.text.StrPool;
|
||||||
import cn.hutool.core.util.CharsetUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
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.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
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.IRespDataService;
|
||||||
import com.njcn.advance.service.responsibility.IRespUserDataService;
|
import com.njcn.advance.service.responsibility.IRespUserDataService;
|
||||||
import com.njcn.advance.utils.ResponsibilityAlgorithm;
|
import com.njcn.advance.utils.ResponsibilityAlgorithm;
|
||||||
import com.njcn.advance.utils.ResponsibilityCallDllOrSo;
|
|
||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
@@ -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.dto.LineDevGetDTO;
|
||||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
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.api.LineFeignClient;
|
||||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||||
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
||||||
@@ -82,7 +78,6 @@ import java.util.stream.Stream;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> implements IRespDataService {
|
public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> implements IRespDataService {
|
||||||
|
|
||||||
private final IRespUserDataService iRespUserDataService;
|
|
||||||
|
|
||||||
private final FileStorageUtil fileStorageUtil;
|
private final FileStorageUtil fileStorageUtil;
|
||||||
|
|
||||||
@@ -96,6 +91,22 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
|
|
||||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
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
|
@Override
|
||||||
public Page<RespDataDTO> responsibilityList(BaseParam queryParam) {
|
public Page<RespDataDTO> responsibilityList(BaseParam queryParam) {
|
||||||
QueryWrapper<RespDataDTO> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<RespDataDTO> queryWrapper = new QueryWrapper<>();
|
||||||
@@ -174,13 +185,13 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
int lineInterval = pNumAndInterval.getLineInterval();
|
int lineInterval = pNumAndInterval.getLineInterval();
|
||||||
//第三个参数win,根据起始时间和截止时间的间隔
|
//第三个参数win,根据起始时间和截止时间的间隔
|
||||||
if (dateStr.size() > 1) {
|
if (dateStr.size() > 1) {
|
||||||
if(userIntervalTime == 15){
|
if (userIntervalTime == INTERVAL_TIME_15) {
|
||||||
win = 96;
|
win = WINDOW_96;
|
||||||
} else {
|
} else {
|
||||||
win = 48;
|
win = WINDOW_48;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
win = 4;
|
win = WINDOW_4;
|
||||||
}
|
}
|
||||||
//第四个参数harmMk,默认为0f
|
//第四个参数harmMk,默认为0f
|
||||||
harmMk = 0f;
|
harmMk = 0f;
|
||||||
@@ -191,7 +202,7 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
RespHarmData respHarmData = getRespHarmData(responsibilityCalculateParam, lineInterval);
|
RespHarmData respHarmData = getRespHarmData(responsibilityCalculateParam, lineInterval);
|
||||||
//harmData填充完毕后,开始组装功率数据
|
//harmData填充完毕后,开始组装功率数据
|
||||||
//首先获取当前时间内的各个用户的数据
|
//首先获取当前时间内的各个用户的数据
|
||||||
Map<String/*用户名*/, List<UserDataExcel>> originalPData = new HashMap<>();
|
Map<String/*用户名*/, List<UserDataExcel>> originalPData = new HashMap<>(16);
|
||||||
List<String> names = new ArrayList<>();
|
List<String> names = new ArrayList<>();
|
||||||
Set<String> userNamesFinal = finalData.keySet();
|
Set<String> userNamesFinal = finalData.keySet();
|
||||||
for (String userName : userNamesFinal) {
|
for (String userName : userNamesFinal) {
|
||||||
@@ -231,15 +242,6 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
qvvrDataEntity.harmMk = harmMk;
|
qvvrDataEntity.harmMk = harmMk;
|
||||||
qvvrDataEntity.pData = pData;
|
qvvrDataEntity.pData = pData;
|
||||||
qvvrDataEntity.harmData = respHarmData.getHarmData();
|
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();
|
ResponsibilityAlgorithm responsibilityAlgorithm = new ResponsibilityAlgorithm();
|
||||||
qvvrDataEntity = responsibilityAlgorithm.getResponsibilityResult(qvvrDataEntity);
|
qvvrDataEntity = responsibilityAlgorithm.getResponsibilityResult(qvvrDataEntity);
|
||||||
//至此接口调用结束,开始组装动态责任数据和用户责任量化结果
|
//至此接口调用结束,开始组装动态责任数据和用户责任量化结果
|
||||||
@@ -278,13 +280,13 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
timeDatas.add(calendar.getTimeInMillis());
|
timeDatas.add(calendar.getTimeInMillis());
|
||||||
}
|
}
|
||||||
//OK拿到所有测量点的数据了,现在就是看如何将相同户号的动态数据进行算术和求值,之前的用户name为:户号@测量点号@用户名
|
//OK拿到所有测量点的数据了,现在就是看如何将相同户号的动态数据进行算术和求值,之前的用户name为:户号@测量点号@用户名
|
||||||
Map<String/*用户名(户号)*/, List<CustomerData>> customerDataTemp = new HashMap<>();
|
Map<String/*用户名(户号)*/, List<CustomerData>> customerDataTemp = new HashMap<>(16);
|
||||||
for (int i = 0; i < customerDatas.length; i++) {
|
for (CustomerData data : customerDatas) {
|
||||||
String customerName = customerDatas[i].getCustomerName();
|
String customerName = data.getCustomerName();
|
||||||
String[] customerInfo = customerName.split("@");
|
String[] customerInfo = customerName.split("@");
|
||||||
String name = customerInfo[2] + "(" + customerInfo[0] + ")";
|
String name = customerInfo[2] + "(" + customerInfo[0] + ")";
|
||||||
List<CustomerData> customerData = customerDataTemp.get(name);
|
List<CustomerData> customerData = customerDataTemp.get(name);
|
||||||
CustomerData temp = customerDatas[i];
|
CustomerData temp = data;
|
||||||
temp.setCustomerName(name);
|
temp.setCustomerName(name);
|
||||||
if (CollectionUtils.isEmpty(customerData)) {
|
if (CollectionUtils.isEmpty(customerData)) {
|
||||||
customerData = new ArrayList<>();
|
customerData = new ArrayList<>();
|
||||||
@@ -313,8 +315,8 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
List<Float> valueDatas = new ArrayList<>();
|
List<Float> valueDatas = new ArrayList<>();
|
||||||
for (int i = 0; i < customerData1.get(0).getValueDatas().size(); i++) {
|
for (int i = 0; i < customerData1.get(0).getValueDatas().size(); i++) {
|
||||||
float original = 0.0f;
|
float original = 0.0f;
|
||||||
for (int k = 0; k < customerData1.size(); k++) {
|
for (CustomerData data : customerData1) {
|
||||||
original = original + customerData1.get(k).getValueDatas().get(i);
|
original = original + data.getValueDatas().get(i);
|
||||||
}
|
}
|
||||||
valueDatas.add(original);
|
valueDatas.add(original);
|
||||||
}
|
}
|
||||||
@@ -364,7 +366,7 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
this.baseMapper.updateById(responsibilityData);
|
this.baseMapper.updateById(responsibilityData);
|
||||||
}
|
}
|
||||||
//入库完毕之后,需要将必要数据进行序列化存储,方便后期的重复利用
|
//入库完毕之后,需要将必要数据进行序列化存储,方便后期的重复利用
|
||||||
/**
|
/*
|
||||||
* 需要序列化三种数据结构 1 cal_flag置为1时需要的一些列参数的CacheQvvrData 2 cal_flag为0时的,动态结果。3 用户责任量化结果
|
* 需要序列化三种数据结构 1 cal_flag置为1时需要的一些列参数的CacheQvvrData 2 cal_flag为0时的,动态结果。3 用户责任量化结果
|
||||||
* 其中1/2都只需要一个文件即可
|
* 其中1/2都只需要一个文件即可
|
||||||
* 3因为用户限值的变化调整,可能存在很多个文件,具体根据用户的选择而定
|
* 3因为用户限值的变化调整,可能存在很多个文件,具体根据用户的选择而定
|
||||||
@@ -389,24 +391,23 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
respDataResult.setLimitValue(respHarmData.getOverLimit());
|
respDataResult.setLimitValue(respHarmData.getOverLimit());
|
||||||
//时间横轴数据 timeDatas
|
//时间横轴数据 timeDatas
|
||||||
JSONArray timeDataJson = JSONArray.parseArray(JSON.toJSONString(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"));
|
String timeDataPath = fileStorageUtil.uploadStream(timeDataStream, OssPath.RESPONSIBILITY_USER_RESULT_DATA, FileUtil.generateFileName("json"));
|
||||||
respDataResult.setTimeData(timeDataPath);
|
respDataResult.setTimeData(timeDataPath);
|
||||||
//用户每时刻对应的责任数据
|
//用户每时刻对应的责任数据
|
||||||
JSONArray customerDataJson = JSONArray.parseArray(JSON.toJSONString(customerData));
|
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"));
|
String customerPath = fileStorageUtil.uploadStream(customerStream, OssPath.RESPONSIBILITY_USER_RESULT_DATA, FileUtil.generateFileName("json"));
|
||||||
respDataResult.setUserDetailData(customerPath);
|
respDataResult.setUserDetailData(customerPath);
|
||||||
//调用qvvr生成的中间数据
|
//调用qvvr生成的中间数据
|
||||||
CacheQvvrData cacheQvvrData = new CacheQvvrData(qvvrDataEntity.getPNode(), qvvrDataEntity.getHarmNum(), qvvrDataEntity.getHarmData(), qvvrDataEntity.fKData, qvvrDataEntity.hKData, names, userIntervalTime, qvvrDataEntity.win, userIntervalTime, respHarmData.getHarmTime());
|
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);
|
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"));
|
String cacheQvvrDataPath = fileStorageUtil.uploadStream(cacheQvvrDataStream, OssPath.RESPONSIBILITY_USER_RESULT_DATA, FileUtil.generateFileName("json"));
|
||||||
respDataResult.setQvvrData(cacheQvvrDataPath);
|
respDataResult.setQvvrData(cacheQvvrDataPath);
|
||||||
//用户前10数据存储
|
//用户前10数据存储
|
||||||
JSONArray customerResJson = JSONArray.parseArray(JSON.toJSONString(customerResponsibilities));
|
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"));
|
String customerResPath = fileStorageUtil.uploadStream(customerResStream, OssPath.RESPONSIBILITY_USER_RESULT_DATA, FileUtil.generateFileName("json"));
|
||||||
respDataResult.setUserResponsibility(customerResPath);
|
respDataResult.setUserResponsibility(customerResPath);
|
||||||
respDataResultService.save(respDataResult);
|
respDataResultService.save(respDataResult);
|
||||||
@@ -442,8 +443,7 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
CacheQvvrData cacheQvvrData;
|
CacheQvvrData cacheQvvrData;
|
||||||
try {
|
try {
|
||||||
InputStream fileStream = fileStorageUtil.getFileStream(respDataResultTemp.getQvvrData());
|
InputStream fileStream = fileStorageUtil.getFileStream(respDataResultTemp.getQvvrData());
|
||||||
String qvvrDataStr = IoUtil.read(fileStream, CharsetUtil.UTF_8);
|
String qvvrDataStr = IoUtil.readUtf8(fileStream);
|
||||||
// cacheQvvrData = JSONObject.parseObject(qvvrDataStr, CacheQvvrData.class);
|
|
||||||
cacheQvvrData = PubUtils.json2obj(qvvrDataStr, CacheQvvrData.class);
|
cacheQvvrData = PubUtils.json2obj(qvvrDataStr, CacheQvvrData.class);
|
||||||
|
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
@@ -486,34 +486,34 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
qvvrDataEntity.setHKData(cacheQvvrData.getHKData());
|
qvvrDataEntity.setHKData(cacheQvvrData.getHKData());
|
||||||
qvvrDataEntity.harmData = cacheQvvrData.getHarmData();
|
qvvrDataEntity.harmData = cacheQvvrData.getHarmData();
|
||||||
} else {
|
} else {
|
||||||
if (win == 4) {
|
if (win == WINDOW_4) {
|
||||||
//当窗口为4时,两个时间限制范围在最小公倍数为15时,最起码有5个有效时间点,在最小公倍数为30时,最起码有3个有效时间点
|
//当窗口为4时,两个时间限制范围在最小公倍数为15时,最起码有5个有效时间点,在最小公倍数为30时,最起码有3个有效时间点
|
||||||
if (minMultiple == 15) {
|
if (minMultiple == INTERVAL_TIME_15) {
|
||||||
if (minus < 5) {
|
if (minus < MINUS_5) {
|
||||||
throw new BusinessException(AdvanceResponseEnum.WIN_TIME_ERROR);
|
throw new BusinessException(AdvanceResponseEnum.WIN_TIME_ERROR);
|
||||||
}
|
}
|
||||||
resNum = minus - 4;
|
resNum = minus - MINUS_4;
|
||||||
|
|
||||||
} else if (minMultiple == 30) {
|
} else if (minMultiple == INTERVAL_TIME_30) {
|
||||||
if (minus < 3) {
|
if (minus < MINUS_3) {
|
||||||
throw new BusinessException(AdvanceResponseEnum.WIN_TIME_ERROR);
|
throw new BusinessException(AdvanceResponseEnum.WIN_TIME_ERROR);
|
||||||
}
|
}
|
||||||
resNum = minus - 2;
|
resNum = minus - MINUS_2;
|
||||||
} else {
|
} else {
|
||||||
throw new BusinessException(AdvanceResponseEnum.CALCULATE_INTERVAL_ERROR);
|
throw new BusinessException(AdvanceResponseEnum.CALCULATE_INTERVAL_ERROR);
|
||||||
}
|
}
|
||||||
} else if (win == 96) {
|
} else if (win == WINDOW_96) {
|
||||||
//当窗口为96时,两个时间限值范围在最小公倍数为15时,最起码有97个有效时间点,在最小公倍数为30时,最起码有49个有效时间点
|
//当窗口为96时,两个时间限值范围在最小公倍数为15时,最起码有97个有效时间点,在最小公倍数为30时,最起码有49个有效时间点
|
||||||
if (minMultiple == 15) {
|
if (minMultiple == INTERVAL_TIME_15) {
|
||||||
if (minus < 97) {
|
if (minus <= WINDOW_96) {
|
||||||
throw new BusinessException(AdvanceResponseEnum.WIN_TIME_ERROR);
|
throw new BusinessException(AdvanceResponseEnum.WIN_TIME_ERROR);
|
||||||
}
|
}
|
||||||
resNum = minus - 96;
|
resNum = minus - WINDOW_96;
|
||||||
} else if (minMultiple == 30) {
|
} else if (minMultiple == INTERVAL_TIME_30) {
|
||||||
if (minus < 49) {
|
if (minus <= WINDOW_48) {
|
||||||
throw new BusinessException(AdvanceResponseEnum.WIN_TIME_ERROR);
|
throw new BusinessException(AdvanceResponseEnum.WIN_TIME_ERROR);
|
||||||
}
|
}
|
||||||
resNum = minus - 48;
|
resNum = minus - WINDOW_48;
|
||||||
} else {
|
} else {
|
||||||
throw new BusinessException(AdvanceResponseEnum.CALCULATE_INTERVAL_ERROR);
|
throw new BusinessException(AdvanceResponseEnum.CALCULATE_INTERVAL_ERROR);
|
||||||
}
|
}
|
||||||
@@ -536,13 +536,6 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
qvvrDataEntity.setFKData(FKdata);
|
qvvrDataEntity.setFKData(FKdata);
|
||||||
qvvrDataEntity.setHKData(HKdata);
|
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();
|
ResponsibilityAlgorithm responsibilityAlgorithm = new ResponsibilityAlgorithm();
|
||||||
qvvrDataEntity = responsibilityAlgorithm.getResponsibilityResult(qvvrDataEntity);
|
qvvrDataEntity = responsibilityAlgorithm.getResponsibilityResult(qvvrDataEntity);
|
||||||
if (qvvrDataEntity.calOk == 0) {
|
if (qvvrDataEntity.calOk == 0) {
|
||||||
@@ -582,13 +575,13 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
timeDatas.add(calendar.getTimeInMillis());
|
timeDatas.add(calendar.getTimeInMillis());
|
||||||
}
|
}
|
||||||
//OK拿到所有测量点的数据了,现在就是看如何将相同户号的动态数据进行算术和求值,之前的用户name为:户号@测量点号@用户名
|
//OK拿到所有测量点的数据了,现在就是看如何将相同户号的动态数据进行算术和求值,之前的用户name为:户号@测量点号@用户名
|
||||||
Map<String/*用户名(户号)*/, List<CustomerData>> customerDataTemp = new HashMap<>();
|
Map<String/*用户名(户号)*/, List<CustomerData>> customerDataTemp = new HashMap<>(32);
|
||||||
for (int i = 0; i < customerDatas.length; i++) {
|
for (CustomerData data : customerDatas) {
|
||||||
String customerName = customerDatas[i].getCustomerName();
|
String customerName = data.getCustomerName();
|
||||||
String[] customerInfo = customerName.split("@");
|
String[] customerInfo = customerName.split("@");
|
||||||
String name = customerInfo[2] + "(" + customerInfo[0] + ")";
|
String name = customerInfo[2] + "(" + customerInfo[0] + ")";
|
||||||
List<CustomerData> customerData = customerDataTemp.get(name);
|
List<CustomerData> customerData = customerDataTemp.get(name);
|
||||||
CustomerData customerTemp = customerDatas[i];
|
CustomerData customerTemp = data;
|
||||||
customerTemp.setCustomerName(name);
|
customerTemp.setCustomerName(name);
|
||||||
if (CollectionUtils.isEmpty(customerData)) {
|
if (CollectionUtils.isEmpty(customerData)) {
|
||||||
customerData = new ArrayList<>();
|
customerData = new ArrayList<>();
|
||||||
@@ -619,8 +612,8 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
List<Float> valueDatas = new ArrayList<>();
|
List<Float> valueDatas = new ArrayList<>();
|
||||||
for (int i = 0; i < customerData1.get(0).getValueDatas().size(); i++) {
|
for (int i = 0; i < customerData1.get(0).getValueDatas().size(); i++) {
|
||||||
float original = 0.0f;
|
float original = 0.0f;
|
||||||
for (int k = 0; k < customerData1.size(); k++) {
|
for (CustomerData data : customerData1) {
|
||||||
original = original + customerData1.get(k).getValueDatas().get(i);
|
original = original + data.getValueDatas().get(i);
|
||||||
}
|
}
|
||||||
valueDatas.add(original);
|
valueDatas.add(original);
|
||||||
}
|
}
|
||||||
@@ -650,17 +643,17 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
respDataResult.setLimitValue(responsibilitySecondCalParam.getLimitValue());
|
respDataResult.setLimitValue(responsibilitySecondCalParam.getLimitValue());
|
||||||
//时间横轴数据 timeDatas
|
//时间横轴数据 timeDatas
|
||||||
JSONArray timeDataJson = JSONArray.parseArray(JSON.toJSONString(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"));
|
String timeDataPath = fileStorageUtil.uploadStream(timeDataStream, OssPath.RESPONSIBILITY_USER_RESULT_DATA, FileUtil.generateFileName("json"));
|
||||||
respDataResult.setTimeData(timeDataPath);
|
respDataResult.setTimeData(timeDataPath);
|
||||||
//用户每时刻对应的责任数据
|
//用户每时刻对应的责任数据
|
||||||
JSONArray customerDataJson = JSONArray.parseArray(JSON.toJSONString(customerData));
|
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"));
|
String customerPath = fileStorageUtil.uploadStream(customerStream, OssPath.RESPONSIBILITY_USER_RESULT_DATA, FileUtil.generateFileName("json"));
|
||||||
respDataResult.setUserDetailData(customerPath);
|
respDataResult.setUserDetailData(customerPath);
|
||||||
//用户前10数据存储
|
//用户前10数据存储
|
||||||
JSONArray customerResJson = JSONArray.parseArray(JSON.toJSONString(customerResponsibilities));
|
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"));
|
String customerResPath = fileStorageUtil.uploadStream(customerResStream, OssPath.RESPONSIBILITY_USER_RESULT_DATA, FileUtil.generateFileName("json"));
|
||||||
respDataResult.setUserResponsibility(customerResPath);
|
respDataResult.setUserResponsibility(customerResPath);
|
||||||
respDataResultService.save(respDataResult);
|
respDataResultService.save(respDataResult);
|
||||||
@@ -681,19 +674,20 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
DecimalFormat decimalFormat = new DecimalFormat("0.0000");
|
DecimalFormat decimalFormat = new DecimalFormat("0.0000");
|
||||||
Map<String, Map<String, List<UserDataExcel>>> result;
|
Map<String, Map<String, List<UserDataExcel>>> result;
|
||||||
//当监测点测量间隔为10分钟时,功率数据需要调整为30分钟数据
|
//当监测点测量间隔为10分钟时,功率数据需要调整为30分钟数据
|
||||||
result = new HashMap<>();
|
result = new HashMap<>(32);
|
||||||
Set<String> userNames = finalData.keySet();
|
Set<String> userNames = finalData.keySet();
|
||||||
for (String userName : userNames) {
|
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);
|
Map<String, List<UserDataExcel>> original = finalData.get(userName);
|
||||||
Set<String> dates = original.keySet();
|
Set<String> dates = original.keySet();
|
||||||
for (String date : dates) {
|
for (String date : dates) {
|
||||||
List<UserDataExcel> single = original.get(date);//某当天的数据
|
//某当天的数据
|
||||||
|
List<UserDataExcel> single = original.get(date);
|
||||||
//先根据事时间排序
|
//先根据事时间排序
|
||||||
Collections.sort(single);
|
Collections.sort(single);
|
||||||
//此时根据当天所有的数据,重新计算出所有时间点的数据,担心这个过程会消耗过长时间
|
//此时根据当天所有的数据,重新计算出所有时间点的数据,担心这个过程会消耗过长时间
|
||||||
List<UserDataExcel> tempDatas = new ArrayList<>();
|
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 友谊文档
|
//30分钟内的2个15分钟功率数据相加作平均计算30分钟内的功率数据,最终的数据序列时间间隔30分钟。by 友谊文档
|
||||||
UserDataExcel tempData = new UserDataExcel();
|
UserDataExcel tempData = new UserDataExcel();
|
||||||
tempData.setUserName(single.get(i).getUserName());
|
tempData.setUserName(single.get(i).getUserName());
|
||||||
@@ -720,7 +714,7 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
* @param lineInterval 测量间隔
|
* @param lineInterval 测量间隔
|
||||||
*/
|
*/
|
||||||
private List<HarmData> getDataWithLineInterval(List<HarmData> historyData, int lineInterval) {
|
private List<HarmData> getDataWithLineInterval(List<HarmData> historyData, int lineInterval) {
|
||||||
List<HarmData> result = new ArrayList<>();
|
List<HarmData> result;
|
||||||
switch (lineInterval) {
|
switch (lineInterval) {
|
||||||
case 1:
|
case 1:
|
||||||
result = getHarmResultByTimes(historyData, 15);
|
result = getHarmResultByTimes(historyData, 15);
|
||||||
@@ -728,8 +722,8 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
case 3:
|
case 3:
|
||||||
result = getHarmResultByTimes(historyData, 5);
|
result = getHarmResultByTimes(historyData, 5);
|
||||||
break;
|
break;
|
||||||
case 5:
|
// 间隔为5、10时,直接返回即可
|
||||||
case 10:
|
default:
|
||||||
result = getHarmResultByTimes(historyData, 3);
|
result = getHarmResultByTimes(historyData, 3);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -764,9 +758,10 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
* 根据接口返回值组装需要显示的责任量化数据
|
* 根据接口返回值组装需要显示的责任量化数据
|
||||||
*/
|
*/
|
||||||
private List<CustomerResponsibility> getCustomerResponsibilityData(List<String> names, float[] sumFKdata, int pNode) {
|
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++) {
|
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] + ")";
|
String name = customerInfo[2] + "(" + customerInfo[0] + ")";
|
||||||
CustomerResponsibility customerResponsibility;
|
CustomerResponsibility customerResponsibility;
|
||||||
if (customerResponsibilityMap.containsKey(name)) {
|
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());
|
customerResponsibilities = customerResponsibilities.stream().sorted(Comparator.comparing(CustomerResponsibility::getResponsibilityData).reversed()).collect(Collectors.toList());
|
||||||
if (customerResponsibilities.size() > 10) {
|
if (customerResponsibilities.size() > SORT_10) {
|
||||||
//当用户超出10,将前十用户保留,然后剩余归类为其他用户
|
//当用户超出10,将前十用户保留,然后剩余归类为其他用户
|
||||||
float tenTotal = 0.0f;
|
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());
|
float temp = PubUtils.floatRound(3, customerResponsibilities.get(i).getResponsibilityData());
|
||||||
tenTotal = tenTotal + temp;
|
tenTotal = tenTotal + temp;
|
||||||
}
|
}
|
||||||
@@ -843,7 +838,7 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
tempe = i;
|
tempe = i;
|
||||||
} else if (times.get(i + 1).equals(limitEL)) {
|
} else if (times.get(i + 1).equals(limitEL)) {
|
||||||
tempe = i + 1;
|
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
|
//当起始时间处于中间时,将前值赋值给temps
|
||||||
tempe = i;
|
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) {
|
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>>> 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%就可以判断*/
|
/*第一个参数pNode 如果时间范围内完整性不足90%的节点,不参与责任量化统计,因为之前处理过用采数据,此时只需要判断是否满足100%就可以判断*/
|
||||||
int dueCounts = dateStr.size() * 96;
|
int dueCounts = dateStr.size() * 96;
|
||||||
Set<String> userNames = totalData.keySet();
|
Set<String> userNames = totalData.keySet();
|
||||||
@@ -893,12 +888,12 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
LineDetailDataVO lineDetailData = lineFeignClient.getLineDetailData(lineId).getData();
|
LineDetailDataVO lineDetailData = lineFeignClient.getLineDetailData(lineId).getData();
|
||||||
int lineInterval = lineDetailData.getTimeInterval();
|
int lineInterval = lineDetailData.getTimeInterval();
|
||||||
int userIntervalTime;
|
int userIntervalTime;
|
||||||
if (lineInterval == 1 || lineInterval == 3 || lineInterval == 5) {
|
if (lineInterval == INTERVAL_TIME_1 || lineInterval == INTERVAL_TIME_3 || lineInterval == INTERVAL_TIME_5) {
|
||||||
userIntervalTime = 15;
|
userIntervalTime = INTERVAL_TIME_15;
|
||||||
pNum = dateStr.size() * 96;
|
pNum = dateStr.size() * WINDOW_96;
|
||||||
} else {
|
} else {
|
||||||
userIntervalTime = 30;
|
userIntervalTime = INTERVAL_TIME_30;
|
||||||
pNum = dateStr.size() * 48;
|
pNum = dateStr.size() * WINDOW_48;
|
||||||
finalData = dealFinalDataByLineInterval(finalData);
|
finalData = dealFinalDataByLineInterval(finalData);
|
||||||
}
|
}
|
||||||
return new RespCommon(pNum, userIntervalTime, lineInterval);
|
return new RespCommon(pNum, userIntervalTime, lineInterval);
|
||||||
@@ -918,9 +913,9 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
List<Long> harmTime = new ArrayList<>();
|
List<Long> harmTime = new ArrayList<>();
|
||||||
for (int i = 0; i < historyData.size(); i++) {
|
for (int i = 0; i < historyData.size(); i++) {
|
||||||
Float value = historyData.get(i).getValue();
|
Float value = historyData.get(i).getValue();
|
||||||
if (value != null) {
|
// if (value != null) {
|
||||||
// value = value * 1000;
|
// value = value * 1000;
|
||||||
}
|
// }
|
||||||
harmData[i] = value;
|
harmData[i] = value;
|
||||||
harmTime.add(PubUtils.instantToDate(historyData.get(i).getTime()).getTime());
|
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.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.EnumUtils;
|
import com.njcn.common.utils.EnumUtils;
|
||||||
import com.njcn.device.biz.enums.DeviceResponseEnum;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class GetBalanceUtils {
|
|||||||
filterData(list, newList);
|
filterData(list, newList);
|
||||||
|
|
||||||
// 如果newList为空则不带入dll计算
|
// 如果newList为空则不带入dll计算
|
||||||
if (newList.size() > 0) {
|
if (!newList.isEmpty()) {
|
||||||
packageData(newList, qvvrDataStruct);
|
packageData(newList, qvvrDataStruct);
|
||||||
JnaCallDllOrSo jnaCallDll = new JnaCallBalance("qvvr_balance");
|
JnaCallDllOrSo jnaCallDll = new JnaCallBalance("qvvr_balance");
|
||||||
System.out.println("路径>>>>>>>"+jnaCallDll.getStrpath());
|
System.out.println("路径>>>>>>>"+jnaCallDll.getStrpath());
|
||||||
@@ -63,33 +63,41 @@ public class GetBalanceUtils {
|
|||||||
for (BalanceInfo balanceInfo : list2) {
|
for (BalanceInfo balanceInfo : list2) {
|
||||||
if (balanceInfo.getAreaIndex().equals(list.get(i).getAreaIndex())) {
|
if (balanceInfo.getAreaIndex().equals(list.get(i).getAreaIndex())) {
|
||||||
balanceInfo.setCi(qvvrDataStruct.sys_res[i].CI);
|
balanceInfo.setCi(qvvrDataStruct.sys_res[i].CI);
|
||||||
balanceInfo.setIsCount(1); // 已计算
|
// 已计算
|
||||||
|
balanceInfo.setIsCount(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 0; j < list.get(i).getList().size(); j++) {
|
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) {
|
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++) {
|
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();
|
QtIdxArray qtIdxArray = new QtIdxArray();
|
||||||
|
|
||||||
for (int j = 0; j < list.get(i).getList().size(); j++) {
|
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;
|
qvvrDataStruct.line_idx[i] = qtIdxArray;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 过滤掉没有监测点,没有暂降事件的数据
|
/**
|
||||||
|
* 过滤掉没有监测点,没有暂降事件的数据
|
||||||
|
*/
|
||||||
private void filterData(List<BalanceInfo> list, List<BalanceInfo> listResult) {
|
private void filterData(List<BalanceInfo> list, List<BalanceInfo> listResult) {
|
||||||
for (BalanceInfo balanceInfo : list) {
|
for (BalanceInfo balanceInfo : list) {
|
||||||
BalanceInfo balanceInfo2 = new BalanceInfo();
|
BalanceInfo balanceInfo2 = new BalanceInfo();
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import com.njcn.common.utils.PubUtils;
|
|||||||
*/
|
*/
|
||||||
public class RadarUtil {
|
public class RadarUtil {
|
||||||
|
|
||||||
private static double[] w = {0.565, 0.2622, 0.1175, 0.0553};
|
private static final 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 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 temp = 0d;
|
||||||
double[] b = getB(lossAverage, coefficient);
|
double[] b = getB(lossAverage, coefficient);
|
||||||
|
|
||||||
for (int i = 0; i < a.length; i++) {
|
for (int[] ints : a) {
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (; j < b.length; j++) {
|
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;
|
temp = 1 - temp / j;
|
||||||
if (temp > n) {
|
if (temp > n) {
|
||||||
@@ -45,10 +45,10 @@ public class RadarUtil {
|
|||||||
double temp = 0d;
|
double temp = 0d;
|
||||||
double[] b = getB(lossAverage, coefficient);
|
double[] b = getB(lossAverage, coefficient);
|
||||||
|
|
||||||
for (int i = 0; i < a.length; i++) {
|
for (int[] ints : a) {
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (; j < b.length; j++) {
|
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;
|
temp = 1 - temp / j;
|
||||||
if (temp > n) {
|
if (temp > n) {
|
||||||
@@ -124,6 +124,7 @@ public class RadarUtil {
|
|||||||
} else if (y >= 1 && y < 2.5) {
|
} else if (y >= 1 && y < 2.5) {
|
||||||
r[0] = (2.5 - y) / (2.5 - 1.0);
|
r[0] = (2.5 - y) / (2.5 - 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//1B1
|
//1B1
|
||||||
if (y >= 0.5 && y < 2.0) {
|
if (y >= 0.5 && y < 2.0) {
|
||||||
r[1] = (y - 0.5) / (2.0 - 0.5);
|
r[1] = (y - 0.5) / (2.0 - 0.5);
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ public class ResponsibilityAlgorithm {
|
|||||||
//EK计算,用于后续计算FK(不含背景的用户责任指标)、HK(包含背景的用户责任指标)
|
//EK计算,用于后续计算FK(不含背景的用户责任指标)、HK(包含背景的用户责任指标)
|
||||||
//float **EKarr = (float **)malloc(TL * sizeof(float *));//先申请P个指针型字节的空间
|
//float **EKarr = (float **)malloc(TL * sizeof(float *));//先申请P个指针型字节的空间
|
||||||
//for (int i = 0; i < TL; i++)
|
//for (int i = 0; i < TL; i++)
|
||||||
//EKarr[i] = (float *)malloc(TL * sizeof(float));
|
//EKarr[i] = (float *)malloc(TL * Float.SIZE / Byte.SIZE);
|
||||||
|
|
||||||
float[][] EKarr;
|
float[][] EKarr;
|
||||||
EKarr = dyEKCom(simCor, Pdata, width, P, TL);
|
EKarr = dyEKCom(simCor, Pdata, width, P, TL);
|
||||||
@@ -303,7 +303,7 @@ public class ResponsibilityAlgorithm {
|
|||||||
//不含背景的用户谐波责任指标
|
//不含背景的用户谐波责任指标
|
||||||
//float **FKarr = (float **)malloc(TL * sizeof(float *));//先申请P个指针型字节的空间
|
//float **FKarr = (float **)malloc(TL * sizeof(float *));//先申请P个指针型字节的空间
|
||||||
//for (int i = 0; i < TL; i++)
|
//for (int i = 0; i < TL; i++)
|
||||||
//FKarr[i] = (float *)malloc(TL * sizeof(float));
|
//FKarr[i] = (float *)malloc(TL * Float.SIZE / Byte.SIZE);
|
||||||
float[][] FKarr;
|
float[][] FKarr;
|
||||||
FKarr = DyFKCom(EKdata, width, P, TL);
|
FKarr = DyFKCom(EKdata, width, P, TL);
|
||||||
RealMatrix FKdata = MatrixUtils.createRealMatrix(slcorlength, P);
|
RealMatrix FKdata = MatrixUtils.createRealMatrix(slcorlength, P);
|
||||||
@@ -316,7 +316,7 @@ public class ResponsibilityAlgorithm {
|
|||||||
//包含背景的谐波责任指标
|
//包含背景的谐波责任指标
|
||||||
//float **HKarr = (float **)malloc(TL * sizeof(float *));//先申请P个指针型字节的空间
|
//float **HKarr = (float **)malloc(TL * sizeof(float *));//先申请P个指针型字节的空间
|
||||||
//for (int i = 0; i < TL; i++)
|
//for (int i = 0; i < TL; i++)
|
||||||
//HKarr[i] = (float *)malloc(TL * sizeof(float));
|
//HKarr[i] = (float *)malloc(TL * Float.SIZE / Byte.SIZE);
|
||||||
float[][] HKarr;
|
float[][] HKarr;
|
||||||
HKarr = DyHKCom(bjCore, EKdata, width, P, TL);
|
HKarr = DyHKCom(bjCore, EKdata, width, P, TL);
|
||||||
RealMatrix HKdata = MatrixUtils.createRealMatrix(slcorlength, (P + 1));
|
RealMatrix HKdata = MatrixUtils.createRealMatrix(slcorlength, (P + 1));
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -84,7 +84,7 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
|
|||||||
tokenEnhancers.add(jwtAccessTokenConverter());
|
tokenEnhancers.add(jwtAccessTokenConverter());
|
||||||
tokenEnhancerChain.setTokenEnhancers(tokenEnhancers);
|
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(),
|
granterList.add(new CaptchaTokenGranter(endpoints.getTokenServices(), endpoints.getClientDetailsService(),
|
||||||
@@ -101,7 +101,8 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
|
|||||||
//设置grant_type类型集合
|
//设置grant_type类型集合
|
||||||
.tokenEnhancer(tokenEnhancerChain)
|
.tokenEnhancer(tokenEnhancerChain)
|
||||||
.tokenGranter(compositeTokenGranter)
|
.tokenGranter(compositeTokenGranter)
|
||||||
/**refresh_token有两种使用方式:重复使用(true)、非重复使用(false),默认为true
|
/*
|
||||||
|
* refresh_token有两种使用方式:重复使用(true)、非重复使用(false),默认为true
|
||||||
* 1.重复使用:access_token过期刷新时, refresh token过期时间未改变,仍以初次生成的时间为准
|
* 1.重复使用:access_token过期刷新时, refresh token过期时间未改变,仍以初次生成的时间为准
|
||||||
* 2.非重复使用:access_token过期刷新时, refresh_token过期时间延续,在refresh_token有效期内刷新而无需失效再次登录
|
* 2.非重复使用:access_token过期刷新时, refresh_token过期时间延续,在refresh_token有效期内刷新而无需失效再次登录
|
||||||
*/
|
*/
|
||||||
@@ -125,7 +126,7 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
|
|||||||
tokenServices.setTokenEnhancer(tokenEnhancerChain);
|
tokenServices.setTokenEnhancer(tokenEnhancerChain);
|
||||||
|
|
||||||
// 多用户体系下,刷新token再次认证客户端ID和 UserDetailService 的映射Map
|
// 多用户体系下,刷新token再次认证客户端ID和 UserDetailService 的映射Map
|
||||||
Map<String, UserDetailsService> clientUserDetailsServiceMap = new HashMap<>();
|
Map<String, UserDetailsService> clientUserDetailsServiceMap = new HashMap<>(16);
|
||||||
|
|
||||||
// 系统管理客户端
|
// 系统管理客户端
|
||||||
clientUserDetailsServiceMap.put(ClientEnum.WEB_CLIENT.getClientId(), userDetailsService);
|
clientUserDetailsServiceMap.put(ClientEnum.WEB_CLIENT.getClientId(), userDetailsService);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
protected void configure(HttpSecurity http) throws Exception {
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
http
|
http
|
||||||
.authorizeRequests()
|
.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需要放行的规则)
|
// @link https://gitee.com/xiaoym/knife4j/issues/I1Q5X6 (接口文档knife4j需要放行的规则)
|
||||||
.antMatchers("/webjars/**","/doc.html","/swagger-resources/**","/v2/api-docs").permitAll()
|
.antMatchers("/webjars/**","/doc.html","/swagger-resources/**","/v2/api-docs").permitAll()
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
|
|||||||
@@ -1,20 +1,27 @@
|
|||||||
package com.njcn.auth.controller;
|
package com.njcn.auth.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
import com.nimbusds.jose.jwk.JWKSet;
|
import com.nimbusds.jose.jwk.JWKSet;
|
||||||
import com.nimbusds.jose.jwk.RSAKey;
|
import com.nimbusds.jose.jwk.RSAKey;
|
||||||
import com.njcn.auth.service.UserTokenService;
|
import com.njcn.auth.service.UserTokenService;
|
||||||
|
import com.njcn.auth.utils.AuthPubUtil;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.constant.OperateType;
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
import com.njcn.common.pojo.constant.SecurityConstants;
|
import com.njcn.common.pojo.constant.SecurityConstants;
|
||||||
import com.njcn.common.pojo.dto.UserTokenInfo;
|
import com.njcn.common.pojo.dto.UserTokenInfo;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.common.utils.LogUtil;
|
import com.njcn.common.utils.LogUtil;
|
||||||
import com.njcn.common.utils.sm.DesUtils;
|
import com.njcn.common.utils.sm.DesUtils;
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
|
import com.njcn.user.api.PassWordRuleFeugnClient;
|
||||||
import com.njcn.user.api.UserFeignClient;
|
import com.njcn.user.api.UserFeignClient;
|
||||||
|
import com.njcn.user.enums.UserResponseEnum;
|
||||||
|
import com.njcn.user.pojo.po.UserStrategy;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import com.njcn.web.utils.RequestUtil;
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import com.njcn.web.utils.RestTemplateUtil;
|
import com.njcn.web.utils.RestTemplateUtil;
|
||||||
@@ -39,6 +46,7 @@ import java.security.interfaces.RSAPublicKey;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
@@ -59,11 +67,13 @@ public class AuthController extends BaseController {
|
|||||||
|
|
||||||
private final UserFeignClient userFeignClient;
|
private final UserFeignClient userFeignClient;
|
||||||
|
|
||||||
|
private final PassWordRuleFeugnClient passWordRuleFeugnClient;
|
||||||
|
|
||||||
private final UserTokenService userTokenService;
|
private final UserTokenService userTokenService;
|
||||||
|
|
||||||
|
|
||||||
@ApiIgnore
|
@ApiIgnore
|
||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.AUTHENTICATE)
|
@OperateInfo(info = LogEnum.SYSTEM_SERIOUS, operateType = OperateType.AUTHENTICATE)
|
||||||
@ApiOperation("登录认证")
|
@ApiOperation("登录认证")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = SecurityConstants.GRANT_TYPE, defaultValue = "password", value = "授权模式", required = true),
|
@ApiImplicitParam(name = SecurityConstants.GRANT_TYPE, defaultValue = "password", value = "授权模式", required = true),
|
||||||
@@ -80,6 +90,8 @@ public class AuthController extends BaseController {
|
|||||||
public Object postAccessToken(@ApiIgnore Principal principal, @RequestParam @ApiIgnore Map<String, String> parameters) throws HttpRequestMethodNotSupportedException {
|
public Object postAccessToken(@ApiIgnore Principal principal, @RequestParam @ApiIgnore Map<String, String> parameters) throws HttpRequestMethodNotSupportedException {
|
||||||
String methodDescribe = getMethodDescribe("postAccessToken");
|
String methodDescribe = getMethodDescribe("postAccessToken");
|
||||||
String username = parameters.get(SecurityConstants.USERNAME);
|
String username = parameters.get(SecurityConstants.USERNAME);
|
||||||
|
|
||||||
|
|
||||||
String grantType = parameters.get(SecurityConstants.GRANT_TYPE);
|
String grantType = parameters.get(SecurityConstants.GRANT_TYPE);
|
||||||
if (grantType.equalsIgnoreCase(SecurityConstants.GRANT_CAPTCHA) || grantType.equalsIgnoreCase(SecurityConstants.REFRESH_TOKEN_KEY)) {
|
if (grantType.equalsIgnoreCase(SecurityConstants.GRANT_CAPTCHA) || grantType.equalsIgnoreCase(SecurityConstants.REFRESH_TOKEN_KEY)) {
|
||||||
username = DesUtils.aesDecrypt(username);
|
username = DesUtils.aesDecrypt(username);
|
||||||
@@ -87,6 +99,28 @@ public class AuthController extends BaseController {
|
|||||||
//短信方式登录,将手机号赋值为用户名
|
//短信方式登录,将手机号赋值为用户名
|
||||||
username = parameters.get(SecurityConstants.PHONE);
|
username = parameters.get(SecurityConstants.PHONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//判断当前登录是否超过最大并发数
|
||||||
|
UserStrategy data = passWordRuleFeugnClient.getUserStrategy().getData();
|
||||||
|
String onlineUserKey = SecurityConstants.TOKEN_ONLINE_PREFIX;
|
||||||
|
List<UserTokenInfo> onLineUser = (List<UserTokenInfo>) redisUtil.getLikeListAllValues(onlineUserKey);
|
||||||
|
if(CollectionUtil.isNotEmpty(onLineUser)){
|
||||||
|
String finalUsername = username;
|
||||||
|
onLineUser = onLineUser.stream().filter(item->{
|
||||||
|
JSONObject jsonObject = AuthPubUtil.getLoginByToken(item.getRefreshToken());
|
||||||
|
String login = jsonObject.getStr(SecurityConstants.USER_NAME_KEY);
|
||||||
|
long exp = Long.parseLong(jsonObject.getStr(SecurityConstants.JWT_EXP));
|
||||||
|
long now = Calendar.getInstance().getTimeInMillis()/1000;
|
||||||
|
return (exp > now) && !login.equals(finalUsername);
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer maxNum = data.getMaxNum();
|
||||||
|
if((CollectionUtil.isNotEmpty(onLineUser)?onLineUser.size():0)>=maxNum){
|
||||||
|
throw new BusinessException(UserResponseEnum.LOGIN_USER_OVERLIMIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (grantType.equalsIgnoreCase(SecurityConstants.REFRESH_TOKEN_KEY)) {
|
if (grantType.equalsIgnoreCase(SecurityConstants.REFRESH_TOKEN_KEY)) {
|
||||||
//如果是刷新token,需要去黑名单校验
|
//如果是刷新token,需要去黑名单校验
|
||||||
userTokenService.judgeRefreshToken(parameters.get(SecurityConstants.REFRESH_TOKEN_KEY));
|
userTokenService.judgeRefreshToken(parameters.get(SecurityConstants.REFRESH_TOKEN_KEY));
|
||||||
@@ -106,6 +140,7 @@ public class AuthController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.SYSTEM_SERIOUS, operateType = OperateType.LOGOUT)
|
||||||
@ApiOperation("用户登出系统")
|
@ApiOperation("用户登出系统")
|
||||||
@DeleteMapping("/logout")
|
@DeleteMapping("/logout")
|
||||||
public HttpResult<Object> logout() {
|
public HttpResult<Object> logout() {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.njcn.auth.controller;
|
|||||||
|
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
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.common.LogEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
@@ -21,6 +22,8 @@ import org.springframework.util.MultiValueMap;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
@@ -41,7 +44,7 @@ public class JudgeThirdToken extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
@PostMapping("/guangZhou")
|
@PostMapping("/guangZhou")
|
||||||
@ApiOperation("校验广州超高压token有效性")
|
@ApiOperation("校验广州超高压token有效性")
|
||||||
@ApiImplicitParam(name = "token", value = "", required = true)
|
@ApiImplicitParam(name = "token", required = true)
|
||||||
public HttpResult<Object> guangZhou(String token) {
|
public HttpResult<Object> guangZhou(String token) {
|
||||||
RestTemplate restTemplate = new RestTemplate();
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
String methodDescribe = getMethodDescribe("guangZhou");
|
String methodDescribe = getMethodDescribe("guangZhou");
|
||||||
@@ -65,8 +68,7 @@ public class JudgeThirdToken extends BaseController {
|
|||||||
// 发送post请求,并打印结果,以String类型接收响应结果JSON字符串
|
// 发送post请求,并打印结果,以String类型接收响应结果JSON字符串
|
||||||
String result = restTemplate.postForObject(url, request, String.class);
|
String result = restTemplate.postForObject(url, request, String.class);
|
||||||
JSONObject resultJson = new JSONObject(result);
|
JSONObject resultJson = new JSONObject(result);
|
||||||
System.out.println(result);
|
if (Objects.equals(resultJson.getInt("status"), DataStateEnum.ENABLE.getCode())) {
|
||||||
if (resultJson.getInt("status") == 1) {
|
|
||||||
//成功
|
//成功
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
} else {
|
} 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 javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
@@ -56,7 +57,7 @@ public class CaptchaTokenGranter extends AbstractTokenGranter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
String password = parameters.get(SecurityConstants.PASSWORD);
|
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);
|
String privateKey = redisUtil.getStringByKey(username + ip);
|
||||||
//秘钥用完即删
|
//秘钥用完即删
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class PreAuthenticatedUserDetailsService<T extends Authentication> implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() {
|
||||||
Assert.notNull(this.userDetailsServiceMap, "UserDetailsService must be set");
|
Assert.notNull(this.userDetailsServiceMap, "UserDetailsService must be set");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,8 +29,6 @@ public abstract class AbstractSmsAuthenticationProvider implements Authenticatio
|
|||||||
|
|
||||||
protected final Log logger = LogFactory.getLog(getClass());
|
protected final Log logger = LogFactory.getLog(getClass());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
|
protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
|
||||||
private UserCache userCache = new NullUserCache();
|
private UserCache userCache = new NullUserCache();
|
||||||
private boolean forcePrincipalAsString = false;
|
private boolean forcePrincipalAsString = false;
|
||||||
@@ -64,12 +62,14 @@ public abstract class AbstractSmsAuthenticationProvider implements Authenticatio
|
|||||||
SmsCodeAuthenticationToken authentication)
|
SmsCodeAuthenticationToken authentication)
|
||||||
throws AuthenticationException;
|
throws AuthenticationException;
|
||||||
|
|
||||||
|
@Override
|
||||||
public final void afterPropertiesSet() throws Exception {
|
public final void afterPropertiesSet() throws Exception {
|
||||||
Assert.notNull(this.userCache, "A user cache must be set");
|
Assert.notNull(this.userCache, "A user cache must be set");
|
||||||
Assert.notNull(this.messages, "A message source must be set");
|
Assert.notNull(this.messages, "A message source must be set");
|
||||||
doAfterPropertiesSet();
|
doAfterPropertiesSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Authentication authenticate(Authentication authentication)
|
public Authentication authenticate(Authentication authentication)
|
||||||
throws AuthenticationException {
|
throws AuthenticationException {
|
||||||
Assert.isInstanceOf(SmsCodeAuthenticationToken.class, authentication,
|
Assert.isInstanceOf(SmsCodeAuthenticationToken.class, authentication,
|
||||||
@@ -175,7 +175,7 @@ public abstract class AbstractSmsAuthenticationProvider implements Authenticatio
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doAfterPropertiesSet() throws Exception {
|
protected void doAfterPropertiesSet() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserCache getUserCache() {
|
public UserCache getUserCache() {
|
||||||
@@ -255,6 +255,7 @@ public abstract class AbstractSmsAuthenticationProvider implements Authenticatio
|
|||||||
this.hideUserNotFoundExceptions = hideUserNotFoundExceptions;
|
this.hideUserNotFoundExceptions = hideUserNotFoundExceptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMessageSource(MessageSource messageSource) {
|
public void setMessageSource(MessageSource messageSource) {
|
||||||
this.messages = new MessageSourceAccessor(messageSource);
|
this.messages = new MessageSourceAccessor(messageSource);
|
||||||
}
|
}
|
||||||
@@ -263,6 +264,7 @@ public abstract class AbstractSmsAuthenticationProvider implements Authenticatio
|
|||||||
this.userCache = userCache;
|
this.userCache = userCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean supports(Class<?> authentication) {
|
public boolean supports(Class<?> authentication) {
|
||||||
return (SmsCodeAuthenticationToken.class
|
return (SmsCodeAuthenticationToken.class
|
||||||
.isAssignableFrom(authentication));
|
.isAssignableFrom(authentication));
|
||||||
@@ -295,6 +297,7 @@ public abstract class AbstractSmsAuthenticationProvider implements Authenticatio
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class DefaultPreAuthenticationChecks implements UserDetailsChecker {
|
private class DefaultPreAuthenticationChecks implements UserDetailsChecker {
|
||||||
|
@Override
|
||||||
public void check(UserDetails user) {
|
public void check(UserDetails user) {
|
||||||
if (!user.isAccountNonLocked()) {
|
if (!user.isAccountNonLocked()) {
|
||||||
logger.debug("User account is locked");
|
logger.debug("User account is locked");
|
||||||
@@ -323,6 +326,7 @@ public abstract class AbstractSmsAuthenticationProvider implements Authenticatio
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class DefaultPostAuthenticationChecks implements UserDetailsChecker {
|
private class DefaultPostAuthenticationChecks implements UserDetailsChecker {
|
||||||
|
@Override
|
||||||
public void check(UserDetails user) {
|
public void check(UserDetails user) {
|
||||||
if (!user.isCredentialsNonExpired()) {
|
if (!user.isCredentialsNonExpired()) {
|
||||||
logger.debug("User account credentials have expired");
|
logger.debug("User account credentials have expired");
|
||||||
|
|||||||
@@ -14,14 +14,13 @@ public interface CustomUserDetailsService extends UserDetailsService {
|
|||||||
/**
|
/**
|
||||||
* @param username 用户名
|
* @param username 用户名
|
||||||
* @return 用户信息
|
* @return 用户信息
|
||||||
* @throws UsernameNotFoundException
|
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
UserDetails loadUserByUsername(String username) throws UsernameNotFoundException;
|
UserDetails loadUserByUsername(String username) throws UsernameNotFoundException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param phone 手机号
|
* @param phone 手机号
|
||||||
* @return 用户信息
|
* @return 用户信息
|
||||||
* @throws UsernameNotFoundException
|
|
||||||
*/
|
*/
|
||||||
UserDetails loadUserByPhone(String phone) throws UsernameNotFoundException;
|
UserDetails loadUserByPhone(String phone) throws UsernameNotFoundException;
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import lombok.SneakyThrows;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.security.core.authority.AuthorityUtils;
|
import org.springframework.security.core.authority.AuthorityUtils;
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
|
||||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|||||||
@@ -2,16 +2,11 @@ package com.njcn.auth.service;
|
|||||||
|
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
|
||||||
import com.nimbusds.jose.JWSObject;
|
import com.nimbusds.jose.JWSObject;
|
||||||
import com.njcn.common.config.GeneralInfo;
|
|
||||||
import com.njcn.common.pojo.constant.OperateType;
|
|
||||||
import com.njcn.common.pojo.constant.SecurityConstants;
|
import com.njcn.common.pojo.constant.SecurityConstants;
|
||||||
import com.njcn.common.pojo.dto.LogInfoDTO;
|
|
||||||
import com.njcn.common.pojo.dto.UserTokenInfo;
|
import com.njcn.common.pojo.dto.UserTokenInfo;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.utils.PubUtils;
|
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -38,11 +33,6 @@ public class UserTokenService {
|
|||||||
|
|
||||||
private final RedisUtil redisUtil;
|
private final RedisUtil redisUtil;
|
||||||
|
|
||||||
private final MqttPublisher publisher;
|
|
||||||
|
|
||||||
private final GeneralInfo generalInfo;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 记录用户token信息,并经过处理后达到最新登录的使用者,将之前的token信息置为黑名单,过期状态
|
* 记录用户token信息,并经过处理后达到最新登录的使用者,将之前的token信息置为黑名单,过期状态
|
||||||
* 1、从在线名单中获取该用户的token信息,key为:TOKEN_ONLINE_PREFIX+userid,value为userTokenInfo的json对象
|
* 1、从在线名单中获取该用户的token信息,key为:TOKEN_ONLINE_PREFIX+userid,value为userTokenInfo的json对象
|
||||||
@@ -65,8 +55,8 @@ public class UserTokenService {
|
|||||||
}
|
}
|
||||||
JSONObject accessJson = JSONUtil.parseObj(accessJwsObject.getPayload().toString());
|
JSONObject accessJson = JSONUtil.parseObj(accessJwsObject.getPayload().toString());
|
||||||
String userIndex = accessJson.getStr(SecurityConstants.USER_INDEX_KEY);
|
String userIndex = accessJson.getStr(SecurityConstants.USER_INDEX_KEY);
|
||||||
String nickName = accessJson.getStr(SecurityConstants.USER_NICKNAME_KEY);
|
// String nickName = accessJson.getStr(SecurityConstants.USER_NICKNAME_KEY);
|
||||||
String loginName = accessJson.getStr(SecurityConstants.USER_NAME_KEY);
|
// String loginName = accessJson.getStr(SecurityConstants.USER_NAME_KEY);
|
||||||
//查询是否有在线的当前用户
|
//查询是否有在线的当前用户
|
||||||
String onlineUserKey = SecurityConstants.TOKEN_ONLINE_PREFIX + userIndex;
|
String onlineUserKey = SecurityConstants.TOKEN_ONLINE_PREFIX + userIndex;
|
||||||
Object onlineTokenInfoOld = redisUtil.getObjectByKey(onlineUserKey);
|
Object onlineTokenInfoOld = redisUtil.getObjectByKey(onlineUserKey);
|
||||||
@@ -94,7 +84,7 @@ public class UserTokenService {
|
|||||||
throw new BusinessException(CommonResponseEnum.PARSE_TOKEN_ERROR);
|
throw new BusinessException(CommonResponseEnum.PARSE_TOKEN_ERROR);
|
||||||
}
|
}
|
||||||
JSONObject refreshJson = JSONUtil.parseObj(refreshJwsObject.getPayload().toString());
|
JSONObject refreshJson = JSONUtil.parseObj(refreshJwsObject.getPayload().toString());
|
||||||
String refreshJti = refreshJson.getStr(SecurityConstants.JWT_JTI);
|
// String refreshJti = refreshJson.getStr(SecurityConstants.JWT_JTI);
|
||||||
Long refreshExpireTime = refreshJson.getLong(SecurityConstants.JWT_EXP);
|
Long refreshExpireTime = refreshJson.getLong(SecurityConstants.JWT_EXP);
|
||||||
userTokenInfo.setAccessTokenJti(accessJti);
|
userTokenInfo.setAccessTokenJti(accessJti);
|
||||||
userTokenInfo.setRefreshToken(refreshToken.getValue());
|
userTokenInfo.setRefreshToken(refreshToken.getValue());
|
||||||
@@ -104,8 +94,8 @@ public class UserTokenService {
|
|||||||
redisUtil.saveByKeyWithExpire(onlineUserKey, userTokenInfo, refreshLifeTime.plusMinutes(5L).toEpochSecond(ZoneOffset.of("+8")) - LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")));
|
redisUtil.saveByKeyWithExpire(onlineUserKey, userTokenInfo, refreshLifeTime.plusMinutes(5L).toEpochSecond(ZoneOffset.of("+8")) - LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")));
|
||||||
|
|
||||||
//记录成功登录后的信息
|
//记录成功登录后的信息
|
||||||
LogInfoDTO logInfoDTO = new LogInfoDTO(loginName, nickName, ip, "登录认证", OperateType.AUTHENTICATE, 1, "", 0, 1, generalInfo.getMicroServiceName(), userIndex,LocalDateTime.now());
|
//LogInfoDTO logInfoDTO = new LogInfoDTO(loginName, nickName, ip, "登录认证", OperateType.AUTHENTICATE, 1, "", 0, 1, generalInfo.getMicroServiceName(), userIndex,LocalDateTime.now());
|
||||||
publisher.send("/userLog", PubUtils.obj2json(logInfoDTO), 2, false);
|
//publisher.send("/userLog", PubUtils.obj2json(logInfoDTO), 2, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.njcn.auth.utils;
|
package com.njcn.auth.utils;
|
||||||
|
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import okhttp3.*;
|
import cn.hutool.json.JSONObject;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.nimbusds.jose.JWSObject;
|
||||||
|
import com.njcn.common.pojo.constant.SecurityConstants;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -28,4 +31,12 @@ public class AuthPubUtil {
|
|||||||
return String.join("", textList);
|
return String.join("", textList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
public static JSONObject getLoginByToken(String token){
|
||||||
|
JWSObject jwsObject = JWSObject.parse(token);
|
||||||
|
String payload = jwsObject.getPayload().toString();
|
||||||
|
return JSONUtil.parseObj(payload);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import cn.hutool.json.JSONObject;
|
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import com.njcn.web.utils.RestTemplateUtil;
|
import com.njcn.web.utils.RestTemplateUtil;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import java.util.Arrays;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum BpmProcessInstanceStatusEnum implements IntArrayValuable {
|
public enum BpmProcessInstanceStatusEnum implements IntArrayValuable {
|
||||||
|
|
||||||
|
AWAIT(0, "待提交审批"),
|
||||||
RUNNING(1, "审批中"),
|
RUNNING(1, "审批中"),
|
||||||
APPROVE(2, "审批通过"),
|
APPROVE(2, "审批通过"),
|
||||||
REJECT(3, "审批不通过"),
|
REJECT(3, "审批不通过"),
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotEmpty;
|
import java.util.Collection;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 不通过流程任务的 Request VO")
|
@Schema(description = "管理后台 - 不通过流程任务的 Request VO")
|
||||||
@Data
|
@Data
|
||||||
@@ -21,4 +22,9 @@ public class BpmTaskRejectParam {
|
|||||||
@NotBlank(message = "审批意见不能为空")
|
@NotBlank(message = "审批意见不能为空")
|
||||||
private String reason;
|
private String reason;
|
||||||
|
|
||||||
|
@ApiModelProperty("抄送的用户编号数组")
|
||||||
|
private Collection<String> copyUserIds;
|
||||||
|
|
||||||
|
@ApiModelProperty("变量实例(动态表单)")
|
||||||
|
private Map<String, Object> variables;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
package com.njcn.bpm.pojo.vo;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
* 待办表格回显数据目前包括:
|
||||||
|
* 1. 待办工作流程
|
||||||
|
* 2. 审核不通过的流程,需重新编辑并发起
|
||||||
|
* 3. 预告警事件待办
|
||||||
|
* 4. 终端周期到期待检测
|
||||||
|
* 5. todo... 可能电能质量问题后续也要想办法搜集进来
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class TodoVO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能业务的id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务名称
|
||||||
|
*/
|
||||||
|
private String taskName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务内容
|
||||||
|
*/
|
||||||
|
private String taskContent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime taskCreateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务来源
|
||||||
|
* 1. 待办
|
||||||
|
* 2. 审核不通过
|
||||||
|
* 3. 无流程的任务比如:预告警单、终端周期到期待检测
|
||||||
|
*/
|
||||||
|
private Integer source;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核不通过&无流程的任务跳转路由
|
||||||
|
*/
|
||||||
|
private String routePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发起人
|
||||||
|
*/
|
||||||
|
private String startUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程实例编号
|
||||||
|
*/
|
||||||
|
private String processInstanceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 历史流程实例编号
|
||||||
|
*/
|
||||||
|
private String historyInstanceId;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实际业务流程ID
|
||||||
|
*/
|
||||||
|
private String businessKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 针对路由一样,但是tab页内容不一致,比如预告警单
|
||||||
|
*/
|
||||||
|
private Integer tabValue;
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.njcn.bpm.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.bpm.pojo.dto.BpmInstanceInfo;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统筹流程实例的公共方案
|
||||||
|
* @author hongawen
|
||||||
|
* @version 1.0.0
|
||||||
|
* @date 2024年06月12日 18:14
|
||||||
|
*/
|
||||||
|
public interface IBpmReasonService<T> extends IService<T> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据业务id实时更新当前业务流程状态
|
||||||
|
* @param businessId 实际业务id
|
||||||
|
* @param status 流程实例当前状态,具体参考BpmTaskStatusEnum枚举
|
||||||
|
*/
|
||||||
|
void updateProcessStatus(String businessId,String reason, Integer status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据业务id获取历史审批id以及该任务的重要信息
|
||||||
|
* @param businessId 业务流程id
|
||||||
|
*/
|
||||||
|
BpmInstanceInfo getInstanceInfo(String businessId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注意数据权限!!!!非本人的无需获取
|
||||||
|
* 获取所有当前流程实例为不通过的 具体参考BpmTaskStatusEnum.REJECT枚举的流程Id
|
||||||
|
*/
|
||||||
|
Set<String> getAllRejectInstanceIds();
|
||||||
|
}
|
||||||
@@ -3,9 +3,13 @@ package com.njcn.bpm.service;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.bpm.pojo.dto.BpmInstanceInfo;
|
import com.njcn.bpm.pojo.dto.BpmInstanceInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统筹流程实例的公共方案
|
* 统筹流程实例的公共方案
|
||||||
|
*
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @date 2024年06月12日 18:14
|
* @date 2024年06月12日 18:14
|
||||||
@@ -14,6 +18,7 @@ public interface IBpmService<T> extends IService<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据业务id实时更新当前业务流程状态
|
* 根据业务id实时更新当前业务流程状态
|
||||||
|
*
|
||||||
* @param businessId 实际业务id
|
* @param businessId 实际业务id
|
||||||
* @param status 流程实例当前状态,具体参考BpmTaskStatusEnum枚举
|
* @param status 流程实例当前状态,具体参考BpmTaskStatusEnum枚举
|
||||||
*/
|
*/
|
||||||
@@ -21,7 +26,16 @@ public interface IBpmService<T> extends IService<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据业务id获取历史审批id以及该任务的重要信息
|
* 根据业务id获取历史审批id以及该任务的重要信息
|
||||||
|
*
|
||||||
* @param businessId 业务流程id
|
* @param businessId 业务流程id
|
||||||
*/
|
*/
|
||||||
BpmInstanceInfo getInstanceInfo(String businessId);
|
BpmInstanceInfo getInstanceInfo(String businessId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注意数据权限!!!!非本人的无需获取
|
||||||
|
* 获取所有当前流程实例为不通过的 具体参考BpmTaskStatusEnum.REJECT枚举的流程Id
|
||||||
|
*/
|
||||||
|
Set<String> getAllRejectInstanceIds();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import org.flowable.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior;
|
|||||||
import org.flowable.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior;
|
import org.flowable.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义的【并行】的【多个】流程任务的 assignee 负责人的分配
|
* 自定义的【并行】的【多个】流程任务的 assignee 负责人的分配
|
||||||
@@ -33,7 +32,6 @@ public class BpmParallelMultiInstanceBehavior extends ParallelMultiInstanceBehav
|
|||||||
* 重写该方法,主要实现两个功能:
|
* 重写该方法,主要实现两个功能:
|
||||||
* 1. 忽略原有的 collectionVariable、collectionElementVariable 表达式,而是采用自己定义的
|
* 1. 忽略原有的 collectionVariable、collectionElementVariable 表达式,而是采用自己定义的
|
||||||
* 2. 获得任务的处理人,并设置到 collectionVariable 中,用于 BpmUserTaskActivityBehavior 从中可以获取任务的处理人
|
* 2. 获得任务的处理人,并设置到 collectionVariable 中,用于 BpmUserTaskActivityBehavior 从中可以获取任务的处理人
|
||||||
*
|
|
||||||
* 注意,多个任务实例,每个任务实例对应一个处理人,所以返回的数量就是任务处理人的数量
|
* 注意,多个任务实例,每个任务实例对应一个处理人,所以返回的数量就是任务处理人的数量
|
||||||
*
|
*
|
||||||
* @param execution 执行任务
|
* @param execution 执行任务
|
||||||
@@ -43,7 +41,8 @@ public class BpmParallelMultiInstanceBehavior extends ParallelMultiInstanceBehav
|
|||||||
protected int resolveNrOfInstances(DelegateExecution execution) {
|
protected int resolveNrOfInstances(DelegateExecution execution) {
|
||||||
// 第一步,设置 collectionVariable 和 CollectionVariable
|
// 第一步,设置 collectionVariable 和 CollectionVariable
|
||||||
// 从 execution.getVariable() 读取所有任务处理人的 key
|
// 从 execution.getVariable() 读取所有任务处理人的 key
|
||||||
super.collectionExpression = null; // collectionExpression 和 collectionVariable 是互斥的
|
// collectionExpression 和 collectionVariable 是互斥的
|
||||||
|
super.collectionExpression = null;
|
||||||
super.collectionVariable = FlowableUtils.formatExecutionCollectionVariable(execution.getCurrentActivityId());
|
super.collectionVariable = FlowableUtils.formatExecutionCollectionVariable(execution.getCurrentActivityId());
|
||||||
// 从 execution.getVariable() 读取当前所有任务处理的人的 key
|
// 从 execution.getVariable() 读取当前所有任务处理的人的 key
|
||||||
super.collectionElementVariable = FlowableUtils.formatExecutionCollectionElementVariable(execution.getCurrentActivityId());
|
super.collectionElementVariable = FlowableUtils.formatExecutionCollectionElementVariable(execution.getCurrentActivityId());
|
||||||
|
|||||||
@@ -9,13 +9,10 @@ import org.flowable.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior;
|
|||||||
import org.flowable.engine.impl.bpmn.behavior.SequentialMultiInstanceBehavior;
|
import org.flowable.engine.impl.bpmn.behavior.SequentialMultiInstanceBehavior;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义的【串行】的【多个】流程任务的 assignee 负责人的分配
|
* 自定义的【串行】的【多个】流程任务的 assignee 负责人的分配
|
||||||
*
|
|
||||||
* 本质上,实现和 {@link BpmParallelMultiInstanceBehavior} 一样,只是继承的类不一样
|
* 本质上,实现和 {@link BpmParallelMultiInstanceBehavior} 一样,只是继承的类不一样
|
||||||
*
|
*
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
@@ -31,20 +28,21 @@ public class BpmSequentialMultiInstanceBehavior extends SequentialMultiInstanceB
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 逻辑和 {@link BpmParallelMultiInstanceBehavior#resolveNrOfInstances(DelegateExecution)} 类似
|
* 逻辑和 {@link BpmParallelMultiInstanceBehavior#resolveNrOfInstances(DelegateExecution)} 类似
|
||||||
*
|
|
||||||
* 差异的点:是在【第二步】的时候,需要返回 LinkedHashSet 集合!因为它需要有序!
|
* 差异的点:是在【第二步】的时候,需要返回 LinkedHashSet 集合!因为它需要有序!
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected int resolveNrOfInstances(DelegateExecution execution) {
|
protected int resolveNrOfInstances(DelegateExecution execution) {
|
||||||
// 第一步,设置 collectionVariable 和 CollectionVariable
|
// 第一步,设置 collectionVariable 和 CollectionVariable
|
||||||
// 从 execution.getVariable() 读取所有任务处理人的 key
|
// 从 execution.getVariable() 读取所有任务处理人的 key
|
||||||
super.collectionExpression = null; // collectionExpression 和 collectionVariable 是互斥的
|
// collectionExpression 和 collectionVariable 是互斥的
|
||||||
|
super.collectionExpression = null;
|
||||||
super.collectionVariable = FlowableUtils.formatExecutionCollectionVariable(execution.getCurrentActivityId());
|
super.collectionVariable = FlowableUtils.formatExecutionCollectionVariable(execution.getCurrentActivityId());
|
||||||
// 从 execution.getVariable() 读取当前所有任务处理的人的 key
|
// 从 execution.getVariable() 读取当前所有任务处理的人的 key
|
||||||
super.collectionElementVariable = FlowableUtils.formatExecutionCollectionElementVariable(execution.getCurrentActivityId());
|
super.collectionElementVariable = FlowableUtils.formatExecutionCollectionElementVariable(execution.getCurrentActivityId());
|
||||||
|
|
||||||
// 第二步,获取任务的所有处理人
|
// 第二步,获取任务的所有处理人
|
||||||
List<String> assigneeUserIds = new ArrayList<>(taskCandidateInvoker.calculateUsers(execution)); // 保证有序!!!
|
// 保证有序!!!
|
||||||
|
List<String> assigneeUserIds = new ArrayList<>(taskCandidateInvoker.calculateUsers(execution));
|
||||||
execution.setVariable(super.collectionVariable, assigneeUserIds);
|
execution.setVariable(super.collectionVariable, assigneeUserIds);
|
||||||
return assigneeUserIds.size();
|
return assigneeUserIds.size();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import org.flowable.task.service.TaskService;
|
|||||||
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
|
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义的【单个】流程任务的 assignee 负责人的分配
|
* 自定义的【单个】流程任务的 assignee 负责人的分配
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ public class BpmFlowableConfiguration {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 参考 {@link org.flowable.spring.boot.FlowableJobConfiguration} 类,创建对应的 AsyncListenableTaskExecutor Bean
|
* 参考 {@link org.flowable.spring.boot.FlowableJobConfiguration} 类,创建对应的 AsyncListenableTaskExecutor Bean
|
||||||
*
|
|
||||||
* 如果不创建,会导致项目启动时,Flowable 报错的问题
|
* 如果不创建,会导致项目启动时,Flowable 报错的问题
|
||||||
*/
|
*/
|
||||||
@Bean(name = "applicationTaskExecutor")
|
@Bean(name = "applicationTaskExecutor")
|
||||||
@@ -49,7 +48,6 @@ public class BpmFlowableConfiguration {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* BPM 模块的 ProcessEngineConfigurationConfigurer 实现类:
|
* BPM 模块的 ProcessEngineConfigurationConfigurer 实现类:
|
||||||
*
|
|
||||||
* 1. 设置各种监听器
|
* 1. 设置各种监听器
|
||||||
* 2. 设置自定义的 ActivityBehaviorFactory 实现
|
* 2. 设置自定义的 ActivityBehaviorFactory 实现
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -29,10 +29,10 @@ import java.util.Set;
|
|||||||
public class BpmTaskEventListener extends AbstractFlowableEngineEventListener {
|
public class BpmTaskEventListener extends AbstractFlowableEngineEventListener {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@Lazy // 解决循环依赖
|
@Lazy
|
||||||
private IBpmTaskService taskService;
|
private IBpmTaskService taskService;
|
||||||
@Resource
|
@Resource
|
||||||
@Lazy // 解决循环依赖
|
@Lazy
|
||||||
private IBpmActivityService activityService;
|
private IBpmActivityService activityService;
|
||||||
|
|
||||||
public static final Set<FlowableEngineEventType> TASK_EVENTS = ImmutableSet.<FlowableEngineEventType>builder()
|
public static final Set<FlowableEngineEventType> TASK_EVENTS = ImmutableSet.<FlowableEngineEventType>builder()
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
package com.njcn.bpm.config;
|
|
||||||
|
|
||||||
import com.njcn.bpm.enums.WebFilterOrderEnum;
|
|
||||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* bpm 模块的 web 组件的 Configuration
|
|
||||||
*
|
|
||||||
* @author hongawen
|
|
||||||
*/
|
|
||||||
@Configuration(proxyBeanMethods = false)
|
|
||||||
public class BpmWebConfiguration {
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * bpm 模块的 API 分组
|
|
||||||
// */
|
|
||||||
// @Bean
|
|
||||||
// public GroupedOpenApi bpmGroupedOpenApi() {
|
|
||||||
// return YudaoSwaggerAutoConfiguration.buildGroupedOpenApi("bpm");
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 配置 Flowable Web 过滤器
|
|
||||||
*/
|
|
||||||
/* @Bean
|
|
||||||
public FilterRegistrationBean<FlowableWebFilter> flowableWebFilter() {
|
|
||||||
FilterRegistrationBean<FlowableWebFilter> registrationBean = new FilterRegistrationBean<>();
|
|
||||||
registrationBean.setFilter(new FlowableWebFilter());
|
|
||||||
registrationBean.setOrder(WebFilterOrderEnum.FLOWABLE_FILTER);
|
|
||||||
return registrationBean;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
//package com.njcn.bpm.config;
|
|
||||||
//
|
|
||||||
//import cn.hutool.core.util.StrUtil;
|
|
||||||
//import com.njcn.bpm.utils.FlowableUtils;
|
|
||||||
//import com.njcn.web.utils.RequestUtil;
|
|
||||||
//import org.springframework.web.filter.OncePerRequestFilter;
|
|
||||||
//
|
|
||||||
//import javax.servlet.FilterChain;
|
|
||||||
//import javax.servlet.ServletException;
|
|
||||||
//import javax.servlet.http.HttpServletRequest;
|
|
||||||
//import javax.servlet.http.HttpServletResponse;
|
|
||||||
//import java.io.IOException;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * Flowable Web 过滤器,将 userId 设置到 {@link org.flowable.common.engine.impl.identity.Authentication} 中
|
|
||||||
// *
|
|
||||||
// * @author jason
|
|
||||||
// */
|
|
||||||
//public class FlowableWebFilter extends OncePerRequestFilter {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
|
|
||||||
// throws ServletException, IOException {
|
|
||||||
// try {
|
|
||||||
// String userIndex = RequestUtil.getUserIndex();
|
|
||||||
// // 设置工作流的用户
|
|
||||||
// if (StrUtil.isNotBlank(userIndex)) {
|
|
||||||
// FlowableUtils.setAuthenticatedUserId(userIndex);
|
|
||||||
// }
|
|
||||||
// // 过滤
|
|
||||||
// chain.doFilter(request, response);
|
|
||||||
// } finally {
|
|
||||||
// // 清理
|
|
||||||
// FlowableUtils.clearAuthenticatedUserId();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
@@ -9,6 +9,9 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author guosongrui
|
||||||
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class JacksonConfig {
|
public class JacksonConfig {
|
||||||
public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ public class BpmConstants {
|
|||||||
public static final String TASK_VARIABLE_STATUS = "TASK_STATUS";
|
public static final String TASK_VARIABLE_STATUS = "TASK_STATUS";
|
||||||
/**
|
/**
|
||||||
* 任务的变量 - 理由
|
* 任务的变量 - 理由
|
||||||
*
|
|
||||||
* 例如说:审批通过、不通过的理由
|
* 例如说:审批通过、不通过的理由
|
||||||
*
|
*
|
||||||
* @see org.flowable.task.api.Task#getTaskLocalVariables()
|
* @see org.flowable.task.api.Task#getTaskLocalVariables()
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ import javax.annotation.Resource;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
*/
|
||||||
@Tag(name = "管理后台 - 流程活动实例")
|
@Tag(name = "管理后台 - 流程活动实例")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/bpm/activity")
|
@RequestMapping("/bpm/activity")
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ import javax.validation.Valid;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/bpm/category")
|
@RequestMapping("/bpm/category")
|
||||||
@Validated
|
@Validated
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ import javax.validation.Valid;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/bpm/form")
|
@RequestMapping("/bpm/form")
|
||||||
@Validated
|
@Validated
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ import static com.njcn.bpm.utils.CollectionUtils.convertMap;
|
|||||||
import static com.njcn.bpm.utils.CollectionUtils.convertSet;
|
import static com.njcn.bpm.utils.CollectionUtils.convertSet;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/bpm/model")
|
@RequestMapping("/bpm/model")
|
||||||
@Validated
|
@Validated
|
||||||
@@ -109,7 +112,7 @@ public class BpmModelController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ApiOperation("新建模型")
|
@ApiOperation("新建模型")
|
||||||
@ApiImplicitParam(name = "createRetVO", value = "模型数据", required = true)
|
@ApiImplicitParam(name = "bpmModelParam", value = "模型数据", required = true)
|
||||||
public HttpResult<String> createModel(@Validated @RequestBody BpmModelParam bpmModelParam) {
|
public HttpResult<String> createModel(@Validated @RequestBody BpmModelParam bpmModelParam) {
|
||||||
String methodDescribe = getMethodDescribe("createModel");
|
String methodDescribe = getMethodDescribe("createModel");
|
||||||
String modelId = modelService.createModel(bpmModelParam, null);
|
String modelId = modelService.createModel(bpmModelParam, null);
|
||||||
@@ -157,6 +160,11 @@ public class BpmModelController extends BaseController {
|
|||||||
// return success(true);
|
// return success(true);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除模型
|
||||||
|
* @param id 模型编号
|
||||||
|
*/
|
||||||
@GetMapping("/delete")
|
@GetMapping("/delete")
|
||||||
@ApiOperation("删除模型")
|
@ApiOperation("删除模型")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ import java.util.Map;
|
|||||||
import static com.njcn.bpm.utils.CollectionUtils.convertSet;
|
import static com.njcn.bpm.utils.CollectionUtils.convertSet;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/bpm/processDefinition")
|
@RequestMapping("/bpm/processDefinition")
|
||||||
@Validated
|
@Validated
|
||||||
@@ -81,6 +84,10 @@ public class BpmProcessDefinitionController extends BaseController {
|
|||||||
pageResult, deploymentMap, processDefinitionMap, formMap, categoryMap), methodDescribe);
|
pageResult, deploymentMap, processDefinitionMap, formMap, categoryMap), methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得流程定义列表
|
||||||
|
* @param suspensionState 挂起状态
|
||||||
|
*/
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ApiOperation("获得流程定义列表")
|
@ApiOperation("获得流程定义列表")
|
||||||
@Parameter(name = "suspensionState", description = "挂起状态", required = true) // 参见 Flowable SuspensionState 枚举
|
@Parameter(name = "suspensionState", description = "挂起状态", required = true) // 参见 Flowable SuspensionState 枚举
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ import static com.njcn.bpm.utils.CollectionUtils.convertList;
|
|||||||
import static com.njcn.bpm.utils.CollectionUtils.convertSet;
|
import static com.njcn.bpm.utils.CollectionUtils.convertSet;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/bpm/processInstance")
|
@RequestMapping("/bpm/processInstance")
|
||||||
@Validated
|
@Validated
|
||||||
@@ -204,7 +207,7 @@ public class BpmProcessInstanceController extends BaseController {
|
|||||||
|
|
||||||
@ApiOperation(value = "删除流程实例(会删除已经审核的流程慎用)")
|
@ApiOperation(value = "删除流程实例(会删除已经审核的流程慎用)")
|
||||||
@GetMapping(value = "/deleteInstance")
|
@GetMapping(value = "/deleteInstance")
|
||||||
public HttpResult delete(@ApiParam(value = "流程实例ID", required = true) @RequestParam String instanceIds) {
|
public HttpResult<Boolean> delete(@ApiParam(value = "流程实例ID", required = true) @RequestParam String instanceIds) {
|
||||||
String methodDescribe = getMethodDescribe("delete");
|
String methodDescribe = getMethodDescribe("delete");
|
||||||
processInstanceService.delete(instanceIds,"测试删除");
|
processInstanceService.delete(instanceIds,"测试删除");
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
|||||||
@@ -1,16 +1,24 @@
|
|||||||
package com.njcn.bpm.controller;
|
package com.njcn.bpm.controller;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.bpm.pojo.dto.PageResult;
|
import com.njcn.bpm.pojo.dto.PageResult;
|
||||||
import com.njcn.bpm.pojo.param.task.*;
|
import com.njcn.bpm.pojo.param.task.*;
|
||||||
|
import com.njcn.bpm.pojo.po.BpmCategory;
|
||||||
import com.njcn.bpm.pojo.po.BpmForm;
|
import com.njcn.bpm.pojo.po.BpmForm;
|
||||||
|
import com.njcn.bpm.pojo.vo.TodoVO;
|
||||||
|
import com.njcn.bpm.pojo.vo.instance.BpmProcessInstanceVO;
|
||||||
import com.njcn.bpm.pojo.vo.task.BpmTaskVO;
|
import com.njcn.bpm.pojo.vo.task.BpmTaskVO;
|
||||||
|
import com.njcn.bpm.service.IBpmCategoryService;
|
||||||
import com.njcn.bpm.service.IBpmFormService;
|
import com.njcn.bpm.service.IBpmFormService;
|
||||||
|
import com.njcn.bpm.service.IBpmProcessDefinitionService;
|
||||||
import com.njcn.bpm.service.task.IBpmProcessInstanceService;
|
import com.njcn.bpm.service.task.IBpmProcessInstanceService;
|
||||||
import com.njcn.bpm.service.task.IBpmTaskService;
|
import com.njcn.bpm.service.task.IBpmTaskService;
|
||||||
|
import com.njcn.bpm.utils.BpmProcessInstanceConvert;
|
||||||
import com.njcn.bpm.utils.BpmTaskConvert;
|
import com.njcn.bpm.utils.BpmTaskConvert;
|
||||||
import com.njcn.bpm.utils.CollectionUtils;
|
import com.njcn.bpm.utils.CollectionUtils;
|
||||||
|
import com.njcn.bpm.utils.TodoVOConvert;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
@@ -30,6 +38,7 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.flowable.engine.history.HistoricProcessInstance;
|
import org.flowable.engine.history.HistoricProcessInstance;
|
||||||
|
import org.flowable.engine.repository.ProcessDefinition;
|
||||||
import org.flowable.engine.runtime.ProcessInstance;
|
import org.flowable.engine.runtime.ProcessInstance;
|
||||||
import org.flowable.task.api.Task;
|
import org.flowable.task.api.Task;
|
||||||
import org.flowable.task.api.TaskInfo;
|
import org.flowable.task.api.TaskInfo;
|
||||||
@@ -39,15 +48,16 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import org.flowable.task.api.history.HistoricTaskInstance;
|
import org.flowable.task.api.history.HistoricTaskInstance;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import static com.njcn.bpm.utils.CollectionUtils.*;
|
import static com.njcn.bpm.utils.CollectionUtils.*;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/bpm/task")
|
@RequestMapping("/bpm/task")
|
||||||
@Validated
|
@Validated
|
||||||
@@ -74,6 +84,12 @@ public class BpmTaskController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private DeptFeignClient deptFeignClient;
|
private DeptFeignClient deptFeignClient;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IBpmProcessDefinitionService processDefinitionService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IBpmCategoryService categoryService;
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/todoList")
|
@PostMapping("/todoList")
|
||||||
@@ -100,6 +116,83 @@ public class BpmTaskController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/todoAllList")
|
||||||
|
@ApiOperation("获取所有待办任务")
|
||||||
|
public HttpResult<List<BpmTaskVO>> todoAllList() {
|
||||||
|
String methodDescribe = getMethodDescribe("todoAllList");
|
||||||
|
List<Task> pageResult = taskService.todoAllList(RequestUtil.getUserIndex());
|
||||||
|
if (CollUtil.isEmpty(pageResult)) {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, new ArrayList<>(), methodDescribe);
|
||||||
|
}
|
||||||
|
// 拼接数据
|
||||||
|
Map<String, ProcessInstance> processInstanceMap = processInstanceService.getProcessInstanceMap(
|
||||||
|
convertSet(pageResult, Task::getProcessInstanceId));
|
||||||
|
List<UserVO> userList = userFeignClient.getUserVOByIdList(convertList(processInstanceMap.values(), ProcessInstance::getStartUserId)).getData();
|
||||||
|
Map<String, UserVO> userMap = CollectionUtils.convertMap(userList, UserVO::getId);
|
||||||
|
List<BpmTaskVO> bpmTaskVOPageResult = BpmTaskConvert.INSTANCE.buildTodoTaskList(pageResult, processInstanceMap, userMap,businessCommonFeignClient);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, bpmTaskVOPageResult, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取全部待办任务
|
||||||
|
* 1. 待办工作流程
|
||||||
|
* 2. 审核不通过的流程,需重新编辑并发起
|
||||||
|
* 3. 预告警事件待办
|
||||||
|
* 4. 终端周期到期待检测
|
||||||
|
* 5. todo... 可能电能质量问题后续也要想办法搜集进来
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/allTodoList")
|
||||||
|
@ApiOperation("获取全部待办任务")
|
||||||
|
@ApiImplicitParam(name = "bpmTaskQueryParam", value = "查询参数", required = true)
|
||||||
|
public HttpResult<List<TodoVO>> allTodoList() {
|
||||||
|
String methodDescribe = getMethodDescribe("allTodoList");
|
||||||
|
List<TodoVO> result = new ArrayList<>();
|
||||||
|
// 获取当前用户所有不通过的工作流程
|
||||||
|
List<BpmProcessInstanceVO> rejectProcessInstanceList = getRejectProcessInstanceList();
|
||||||
|
if(CollectionUtil.isNotEmpty(rejectProcessInstanceList)){
|
||||||
|
// 转为统一的todoVO3
|
||||||
|
result.addAll(TodoVOConvert.convertByBpmProcessInstance(rejectProcessInstanceList));
|
||||||
|
}
|
||||||
|
// 获取当前用户所有待办工作流程
|
||||||
|
HttpResult<List<BpmTaskVO>> todoAllList = this.todoAllList();
|
||||||
|
if(CollectionUtil.isNotEmpty(todoAllList.getData())){
|
||||||
|
// 转为统一的todoVO3
|
||||||
|
result.addAll(TodoVOConvert.convertByBpmTaskVO(todoAllList.getData()));
|
||||||
|
}
|
||||||
|
// 获取没有流程的一些待办信息
|
||||||
|
result.addAll(businessCommonFeignClient.getTodoBusiness().getData());
|
||||||
|
result = result.stream().sorted(Comparator.comparing(TodoVO::getTaskCreateTime).reversed()).collect(Collectors.toList());
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前用户所有的不通过流程
|
||||||
|
*/
|
||||||
|
private List<BpmProcessInstanceVO> getRejectProcessInstanceList() {
|
||||||
|
// 先获取当前用户所有审核不通过的流程实例ID
|
||||||
|
Set<String> instanceIdSet = businessCommonFeignClient.getAllRejectInstanceId().getData();
|
||||||
|
if(CollUtil.isEmpty(instanceIdSet)){
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
List<HistoricProcessInstance> instances = processInstanceService.getRejectProcessInstanceList(RequestUtil.getUserIndex(),instanceIdSet);
|
||||||
|
if (CollUtil.isEmpty(instances)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
// 拼接返回
|
||||||
|
Map<String, List<Task>> taskMap = taskService.getTaskMapByProcessInstanceIds(
|
||||||
|
convertList(instances, HistoricProcessInstance::getId));
|
||||||
|
Map<String, ProcessDefinition> processDefinitionMap = processDefinitionService.getProcessDefinitionMap(
|
||||||
|
convertSet(instances, HistoricProcessInstance::getProcessDefinitionId));
|
||||||
|
Map<String, BpmCategory> categoryMap = categoryService.getCategoryMap(
|
||||||
|
convertSet(processDefinitionMap.values(), ProcessDefinition::getCategory));
|
||||||
|
return BpmProcessInstanceConvert.INSTANCE.buildProcessInstancePage(instances, processDefinitionMap, categoryMap, taskMap, null, null,businessCommonFeignClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/doneList")
|
@PostMapping("/doneList")
|
||||||
|
|||||||
@@ -35,6 +35,12 @@ public class BpmProcessInstanceStatusEvent extends ApplicationEvent {
|
|||||||
*/
|
*/
|
||||||
private String businessKey;
|
private String businessKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核消息
|
||||||
|
* 例如说,请假
|
||||||
|
*/
|
||||||
|
private String reason;
|
||||||
|
|
||||||
public BpmProcessInstanceStatusEvent(Object source) {
|
public BpmProcessInstanceStatusEvent(Object source) {
|
||||||
super(source);
|
super(source);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public abstract class BpmProcessInstanceStatusEventListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 获取流程定义Key
|
||||||
* @return 返回监听的流程定义 Key
|
* @return 返回监听的流程定义 Key
|
||||||
*/
|
*/
|
||||||
protected abstract String getProcessDefinitionKey();
|
protected abstract String getProcessDefinitionKey();
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class BpmSupervisionStatusListener implements ApplicationListener<BpmProcessInstanceStatusEvent> {
|
public class BpmSupervisionStatusListener implements ApplicationListener<BpmProcessInstanceStatusEvent> {
|
||||||
|
|
||||||
@@ -31,7 +34,7 @@ public class BpmSupervisionStatusListener implements ApplicationListener<BpmPro
|
|||||||
* @param event 事件
|
* @param event 事件
|
||||||
*/
|
*/
|
||||||
protected void onEvent(BpmProcessInstanceStatusEvent event) {
|
protected void onEvent(BpmProcessInstanceStatusEvent event) {
|
||||||
businessCommonFeignClient.updateProcessStatus(event.getProcessDefinitionKey(),event.getBusinessKey(), event.getStatus());
|
businessCommonFeignClient.updateProcessStatus(event.getProcessDefinitionKey(),event.getBusinessKey(),event.getReason(), event.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
/**
|
/**
|
||||||
* BPM 流程分类 Mapper
|
* BPM 流程分类 Mapper
|
||||||
*
|
*
|
||||||
|
* @author hongawen
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface BpmCategoryMapper extends BaseMapper<BpmCategory> {
|
public interface BpmCategoryMapper extends BaseMapper<BpmCategory> {
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ import com.njcn.bpm.pojo.po.BpmProcessDefinitionInfo;
|
|||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface BpmProcessDefinitionInfoMapper extends BaseMapper<BpmProcessDefinitionInfo> {
|
public interface BpmProcessDefinitionInfoMapper extends BaseMapper<BpmProcessDefinitionInfo> {
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* BPM 流程分类 Service 实现类
|
* BPM 流程分类 Service 实现类
|
||||||
*
|
*
|
||||||
|
* @author hongawen
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@Validated
|
@Validated
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ public class BpmFormServiceImpl extends ServiceImpl<BpmFormMapper, BpmForm> impl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String createForm(BpmFormParam bpmFormParam) {
|
public String createForm(BpmFormParam bpmFormParam) {
|
||||||
// this.validateFields(createReqVO.getFields());
|
|
||||||
checkFormName(bpmFormParam, false);
|
checkFormName(bpmFormParam, false);
|
||||||
// 插入
|
// 插入
|
||||||
BpmForm form = BeanUtils.toBean(bpmFormParam, BpmForm.class);
|
BpmForm form = BeanUtils.toBean(bpmFormParam, BpmForm.class);
|
||||||
@@ -88,13 +87,6 @@ public class BpmFormServiceImpl extends ServiceImpl<BpmFormMapper, BpmForm> impl
|
|||||||
.update();
|
.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
// private void validateFormExists(Long id) {
|
|
||||||
// if (this.baseMapper.selectById(id) == null) {
|
|
||||||
// throw exception(ErrorCodeConstants.FORM_NOT_EXISTS);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BpmForm> getFormList() {
|
public List<BpmForm> getFormList() {
|
||||||
@@ -120,7 +112,8 @@ public class BpmFormServiceImpl extends ServiceImpl<BpmFormMapper, BpmForm> impl
|
|||||||
* @param fields field 数组
|
* @param fields field 数组
|
||||||
*/
|
*/
|
||||||
private void validateFields(List<String> fields) {
|
private void validateFields(List<String> fields) {
|
||||||
if (true) { // TODO 芋艿:兼容 Vue3 工作流:因为采用了新的表单设计器,所以暂时不校验
|
// TODO 芋艿:兼容 Vue3 工作流:因为采用了新的表单设计器,所以暂时不校验
|
||||||
|
if (true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Map<String, String> fieldMap = new HashMap<>(); // key 是 vModel,value 是 label
|
// Map<String, String> fieldMap = new HashMap<>(); // key 是 vModel,value 是 label
|
||||||
|
|||||||
@@ -63,7 +63,8 @@ public class BpmModelServiceImpl implements IBpmModelService {
|
|||||||
modelQuery.modelKey(bpmModelQueryParam.getKey());
|
modelQuery.modelKey(bpmModelQueryParam.getKey());
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotBlank(bpmModelQueryParam.getName())) {
|
if (StrUtil.isNotBlank(bpmModelQueryParam.getName())) {
|
||||||
modelQuery.modelNameLike("%" + bpmModelQueryParam.getName() + "%"); // 模糊匹配
|
// 模糊匹配
|
||||||
|
modelQuery.modelNameLike("%" + bpmModelQueryParam.getName() + "%");
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotBlank(bpmModelQueryParam.getCategory())) {
|
if (StrUtil.isNotBlank(bpmModelQueryParam.getCategory())) {
|
||||||
modelQuery.modelCategory(bpmModelQueryParam.getCategory());
|
modelQuery.modelCategory(bpmModelQueryParam.getCategory());
|
||||||
@@ -110,7 +111,7 @@ public class BpmModelServiceImpl implements IBpmModelService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class) // 因为进行多个操作,所以开启事务
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void updateModel(BpmModelParam.BpmModelUpdateParam updateParam) {
|
public void updateModel(BpmModelParam.BpmModelUpdateParam updateParam) {
|
||||||
// 校验流程模型存在
|
// 校验流程模型存在
|
||||||
Model model = getModel(updateParam.getId());
|
Model model = getModel(updateParam.getId());
|
||||||
@@ -126,7 +127,7 @@ public class BpmModelServiceImpl implements IBpmModelService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class) // 因为进行多个操作,所以开启事务
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void deployModel(String id) {
|
public void deployModel(String id) {
|
||||||
// 1.1 校验流程模型存在
|
// 1.1 校验流程模型存在
|
||||||
Model model = getModel(id);
|
Model model = getModel(id);
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import com.njcn.bpm.pojo.dto.BpmProcessInstanceCreateReqDTO;
|
|||||||
import com.njcn.bpm.pojo.dto.PageResult;
|
import com.njcn.bpm.pojo.dto.PageResult;
|
||||||
import com.njcn.bpm.pojo.param.instance.BpmProcessInstanceCancelParam;
|
import com.njcn.bpm.pojo.param.instance.BpmProcessInstanceCancelParam;
|
||||||
import com.njcn.bpm.pojo.param.instance.BpmProcessInstancePageParam;
|
import com.njcn.bpm.pojo.param.instance.BpmProcessInstancePageParam;
|
||||||
|
import com.njcn.bpm.pojo.param.task.BpmTaskRejectParam;
|
||||||
|
import org.flowable.engine.TaskService;
|
||||||
import org.flowable.engine.delegate.event.FlowableCancelledEvent;
|
import org.flowable.engine.delegate.event.FlowableCancelledEvent;
|
||||||
import org.flowable.engine.history.HistoricProcessInstance;
|
import org.flowable.engine.history.HistoricProcessInstance;
|
||||||
import org.flowable.engine.runtime.ProcessInstance;
|
import org.flowable.engine.runtime.ProcessInstance;
|
||||||
@@ -95,6 +97,10 @@ public interface IBpmProcessInstanceService {
|
|||||||
* @return 流程实例的分页
|
* @return 流程实例的分页
|
||||||
*/
|
*/
|
||||||
PageResult<HistoricProcessInstance> getProcessInstancePage(String userId, BpmProcessInstancePageParam bpmProcessInstancePageParam);
|
PageResult<HistoricProcessInstance> getProcessInstancePage(String userId, BpmProcessInstancePageParam bpmProcessInstancePageParam);
|
||||||
|
|
||||||
|
List<HistoricProcessInstance> getRejectProcessInstanceList(String userIndex, Set<String> instanceIdSet);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// /**
|
// /**
|
||||||
// * 创建流程实例(提供给前端)
|
// * 创建流程实例(提供给前端)
|
||||||
@@ -146,6 +152,13 @@ public interface IBpmProcessInstanceService {
|
|||||||
*/
|
*/
|
||||||
void updateProcessInstanceReject(String id, String reason);
|
void updateProcessInstanceReject(String id, String reason);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新 ProcessInstance 拓展记录为不通过
|
||||||
|
*
|
||||||
|
* @param id 流程编号
|
||||||
|
* @param reason 理由。例如说,审批不通过时,需要传递该值
|
||||||
|
*/
|
||||||
|
void updateProcessInstanceFromReject(String id, String reason, TaskService taskService, BpmTaskRejectParam bpmTaskRejectParam);
|
||||||
/**
|
/**
|
||||||
* 用于测试过程删除流程,正式环境慎用
|
* 用于测试过程删除流程,正式环境慎用
|
||||||
* @author cdf
|
* @author cdf
|
||||||
@@ -153,4 +166,5 @@ public interface IBpmProcessInstanceService {
|
|||||||
*/
|
*/
|
||||||
void delete(String id, String reason);
|
void delete(String id, String reason);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,6 +175,14 @@ public interface IBpmTaskService {
|
|||||||
* @return 子任务列表
|
* @return 子任务列表
|
||||||
*/
|
*/
|
||||||
List<Task> getTaskListByParentTaskId(String parentTaskId);
|
List<Task> getTaskListByParentTaskId(String parentTaskId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户id查询该用户所有的待办事项
|
||||||
|
*
|
||||||
|
* @param userIndex 用户id
|
||||||
|
* @return 所有待办任务
|
||||||
|
*/
|
||||||
|
List<Task> todoAllList(String userIndex);
|
||||||
//
|
//
|
||||||
// /**
|
// /**
|
||||||
// * 通过任务 ID,查询任务名 Map
|
// * 通过任务 ID,查询任务名 Map
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.bpm.service.task.impl;
|
package com.njcn.bpm.service.task.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
@@ -8,11 +9,13 @@ import com.njcn.bpm.constant.BpmConstants;
|
|||||||
import com.njcn.bpm.enums.BpmDeleteReasonEnum;
|
import com.njcn.bpm.enums.BpmDeleteReasonEnum;
|
||||||
import com.njcn.bpm.enums.BpmProcessInstanceStatusEnum;
|
import com.njcn.bpm.enums.BpmProcessInstanceStatusEnum;
|
||||||
import com.njcn.bpm.enums.BpmResponseEnum;
|
import com.njcn.bpm.enums.BpmResponseEnum;
|
||||||
|
import com.njcn.bpm.enums.BpmTaskStatusEnum;
|
||||||
import com.njcn.bpm.event.BpmProcessInstanceEventPublisher;
|
import com.njcn.bpm.event.BpmProcessInstanceEventPublisher;
|
||||||
import com.njcn.bpm.pojo.dto.BpmProcessInstanceCreateReqDTO;
|
import com.njcn.bpm.pojo.dto.BpmProcessInstanceCreateReqDTO;
|
||||||
import com.njcn.bpm.pojo.dto.PageResult;
|
import com.njcn.bpm.pojo.dto.PageResult;
|
||||||
import com.njcn.bpm.pojo.param.instance.BpmProcessInstanceCancelParam;
|
import com.njcn.bpm.pojo.param.instance.BpmProcessInstanceCancelParam;
|
||||||
import com.njcn.bpm.pojo.param.instance.BpmProcessInstancePageParam;
|
import com.njcn.bpm.pojo.param.instance.BpmProcessInstancePageParam;
|
||||||
|
import com.njcn.bpm.pojo.param.task.BpmTaskRejectParam;
|
||||||
import com.njcn.bpm.service.IBpmProcessDefinitionService;
|
import com.njcn.bpm.service.IBpmProcessDefinitionService;
|
||||||
import com.njcn.bpm.service.task.IBpmProcessInstanceService;
|
import com.njcn.bpm.service.task.IBpmProcessInstanceService;
|
||||||
import com.njcn.bpm.strategy.BpmTaskCandidateStartUserSelectStrategy;
|
import com.njcn.bpm.strategy.BpmTaskCandidateStartUserSelectStrategy;
|
||||||
@@ -30,6 +33,7 @@ import org.flowable.bpmn.model.UserTask;
|
|||||||
import org.flowable.common.engine.impl.identity.Authentication;
|
import org.flowable.common.engine.impl.identity.Authentication;
|
||||||
import org.flowable.engine.HistoryService;
|
import org.flowable.engine.HistoryService;
|
||||||
import org.flowable.engine.RuntimeService;
|
import org.flowable.engine.RuntimeService;
|
||||||
|
import org.flowable.engine.TaskService;
|
||||||
import org.flowable.engine.delegate.event.FlowableCancelledEvent;
|
import org.flowable.engine.delegate.event.FlowableCancelledEvent;
|
||||||
import org.flowable.engine.history.HistoricProcessInstance;
|
import org.flowable.engine.history.HistoricProcessInstance;
|
||||||
import org.flowable.engine.repository.ProcessDefinition;
|
import org.flowable.engine.repository.ProcessDefinition;
|
||||||
@@ -72,9 +76,6 @@ public class BpmProcessInstanceServiceImpl implements IBpmProcessInstanceService
|
|||||||
@Resource
|
@Resource
|
||||||
private IBpmProcessDefinitionService processDefinitionService;
|
private IBpmProcessDefinitionService processDefinitionService;
|
||||||
|
|
||||||
// @Resource
|
|
||||||
// private BpmMessageService messageService;
|
|
||||||
//
|
|
||||||
@Resource
|
@Resource
|
||||||
private UserFeignClient userFeignClient;
|
private UserFeignClient userFeignClient;
|
||||||
|
|
||||||
@@ -90,7 +91,6 @@ public class BpmProcessInstanceServiceImpl implements IBpmProcessInstanceService
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ProcessInstance> getProcessInstances(Set<String> ids) {
|
public List<ProcessInstance> getProcessInstances(Set<String> ids) {
|
||||||
return runtimeService.createProcessInstanceQuery().processInstanceIds(ids).list();
|
return runtimeService.createProcessInstanceQuery().processInstanceIds(ids).list();
|
||||||
@@ -113,9 +113,11 @@ public class BpmProcessInstanceServiceImpl implements IBpmProcessInstanceService
|
|||||||
.includeProcessVariables()
|
.includeProcessVariables()
|
||||||
.processInstanceTenantId(FlowableUtils.getTenantId())
|
.processInstanceTenantId(FlowableUtils.getTenantId())
|
||||||
.orderByProcessInstanceStartTime().desc();
|
.orderByProcessInstanceStartTime().desc();
|
||||||
if (userId != null) { // 【我的流程】菜单时,需要传递该字段
|
// 【我的流程】菜单时,需要传递该字段
|
||||||
|
if (userId != null) {
|
||||||
processInstanceQuery.startedBy(userId);
|
processInstanceQuery.startedBy(userId);
|
||||||
} else if (bpmProcessInstancePageParam.getStartUserId() != null) { // 【管理流程】菜单时,才会传递该字段
|
// 【管理流程】菜单时,才会传递该字段
|
||||||
|
} else if (bpmProcessInstancePageParam.getStartUserId() != null) {
|
||||||
processInstanceQuery.startedBy(bpmProcessInstancePageParam.getStartUserId());
|
processInstanceQuery.startedBy(bpmProcessInstancePageParam.getStartUserId());
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotEmpty(bpmProcessInstancePageParam.getName())) {
|
if (StrUtil.isNotEmpty(bpmProcessInstancePageParam.getName())) {
|
||||||
@@ -127,9 +129,13 @@ public class BpmProcessInstanceServiceImpl implements IBpmProcessInstanceService
|
|||||||
if (StrUtil.isNotEmpty(bpmProcessInstancePageParam.getCategory())) {
|
if (StrUtil.isNotEmpty(bpmProcessInstancePageParam.getCategory())) {
|
||||||
processInstanceQuery.processDefinitionCategory(bpmProcessInstancePageParam.getCategory());
|
processInstanceQuery.processDefinitionCategory(bpmProcessInstancePageParam.getCategory());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bpmProcessInstancePageParam.getStatus() != null) {
|
if (bpmProcessInstancePageParam.getStatus() != null) {
|
||||||
processInstanceQuery.variableValueEquals(BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, bpmProcessInstancePageParam.getStatus());
|
processInstanceQuery.variableValueEquals(BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, bpmProcessInstancePageParam.getStatus());
|
||||||
}
|
}
|
||||||
|
//流程状态排除不通过的,不通过会放在待办中,一直到该流程通过
|
||||||
|
processInstanceQuery.variableValueNotEquals(BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, BpmTaskStatusEnum.REJECT.getStatus());
|
||||||
|
|
||||||
|
|
||||||
String beginTimeStr = bpmProcessInstancePageParam.getSearchBeginTime();
|
String beginTimeStr = bpmProcessInstancePageParam.getSearchBeginTime();
|
||||||
String endTimeStr = bpmProcessInstancePageParam.getSearchEndTime();
|
String endTimeStr = bpmProcessInstancePageParam.getSearchEndTime();
|
||||||
@@ -148,6 +154,21 @@ public class BpmProcessInstanceServiceImpl implements IBpmProcessInstanceService
|
|||||||
return new PageResult<>(processInstanceList, processInstanceCount);
|
return new PageResult<>(processInstanceList, processInstanceCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<HistoricProcessInstance> getRejectProcessInstanceList(String userId, Set<String> instanceIdSet) {
|
||||||
|
HistoricProcessInstanceQuery processInstanceQuery = historyService.createHistoricProcessInstanceQuery()
|
||||||
|
// 只查询当前用户的流程实例
|
||||||
|
.startedBy(userId)
|
||||||
|
.includeProcessVariables()
|
||||||
|
// 只查询已驳回的流程实例
|
||||||
|
.variableValueEquals(BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, BpmTaskStatusEnum.REJECT.getStatus())
|
||||||
|
//加上从业务表中产寻到的不通过的实例id
|
||||||
|
.processInstanceIds(instanceIdSet)
|
||||||
|
.processInstanceTenantId(FlowableUtils.getTenantId())
|
||||||
|
.orderByProcessInstanceStartTime().desc();
|
||||||
|
return processInstanceQuery.list();
|
||||||
|
}
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
// @Transactional(rollbackFor = Exception.class)
|
// @Transactional(rollbackFor = Exception.class)
|
||||||
// public String createProcessInstance(Long userId, @Valid BpmProcessInstanceCreateReqVO createReqVO) {
|
// public String createProcessInstance(Long userId, @Valid BpmProcessInstanceCreateReqVO createReqVO) {
|
||||||
@@ -183,10 +204,12 @@ public class BpmProcessInstanceServiceImpl implements IBpmProcessInstanceService
|
|||||||
|
|
||||||
// 2. 创建流程实例
|
// 2. 创建流程实例
|
||||||
if (variables == null) {
|
if (variables == null) {
|
||||||
variables = new HashMap<>();
|
variables = new HashMap<>(32);
|
||||||
}
|
}
|
||||||
FlowableUtils.filterProcessInstanceFormVariable(variables); // 过滤一下,避免 ProcessInstance 系统级的变量被占用
|
// 过滤一下,避免 ProcessInstance 系统级的变量被占用
|
||||||
variables.put(BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, // 流程实例状态:审批中
|
FlowableUtils.filterProcessInstanceFormVariable(variables);
|
||||||
|
// 流程实例状态:审批中
|
||||||
|
variables.put(BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS,
|
||||||
BpmProcessInstanceStatusEnum.RUNNING.getStatus());
|
BpmProcessInstanceStatusEnum.RUNNING.getStatus());
|
||||||
if (CollUtil.isNotEmpty(startUserSelectAssignees)) {
|
if (CollUtil.isNotEmpty(startUserSelectAssignees)) {
|
||||||
variables.put(BpmConstants.PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES, startUserSelectAssignees);
|
variables.put(BpmConstants.PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES, startUserSelectAssignees);
|
||||||
@@ -285,18 +308,30 @@ public class BpmProcessInstanceServiceImpl implements IBpmProcessInstanceService
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateProcessInstanceWhenApprove(ProcessInstance instance) {
|
public void updateProcessInstanceWhenApprove(ProcessInstance instance) {
|
||||||
|
//判断传入参数是否是,不通过信息不通过则需要更新流程信息为不通过
|
||||||
|
Integer processInstanceStatus = BpmProcessInstanceStatusEnum.APPROVE.getStatus();
|
||||||
|
Map<String, Object> processVariables = instance.getProcessVariables();
|
||||||
|
if (processVariables.containsKey(BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS)) {
|
||||||
|
Integer stata = Integer.valueOf(processVariables.get(BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS).toString());
|
||||||
|
if (Objects.equals(BpmProcessInstanceStatusEnum.REJECT.getStatus(), stata)) {
|
||||||
|
processInstanceStatus = BpmProcessInstanceStatusEnum.REJECT.getStatus();
|
||||||
|
}
|
||||||
|
}
|
||||||
// 1. 更新流程实例 status
|
// 1. 更新流程实例 status
|
||||||
runtimeService.setVariable(instance.getId(), BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS,
|
runtimeService.setVariable(instance.getId(), BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS,
|
||||||
BpmProcessInstanceStatusEnum.APPROVE.getStatus());
|
processInstanceStatus);
|
||||||
|
|
||||||
// 2. 发送流程被【通过】的消息
|
// 2. 发送流程被【通过】的消息
|
||||||
// messageService.sendMessageWhenProcessInstanceApprove(BpmProcessInstanceConvert.INSTANCE.buildProcessInstanceApproveMessage(instance));
|
// messageService.sendMessageWhenProcessInstanceApprove(BpmProcessInstanceConvert.INSTANCE.buildProcessInstanceApproveMessage(instance));
|
||||||
|
|
||||||
// 3. 发送流程实例的状态事件
|
// 3. 发送流程实例的状态事件
|
||||||
// 注意:此时如果去查询 ProcessInstance 的话,字段是不全的,所以去查询了 HistoricProcessInstance
|
// 注意:此时如果去查询 ProcessInstance 的话,字段是不全的,所以去查询了 HistoricProcessInstance
|
||||||
|
// 在审核不通过时,会触该信息,设置在审核通过时,才发送
|
||||||
|
if (Objects.equals(BpmProcessInstanceStatusEnum.APPROVE.getStatus(), processInstanceStatus)) {
|
||||||
HistoricProcessInstance processInstance = getHistoricProcessInstance(instance.getId());
|
HistoricProcessInstance processInstance = getHistoricProcessInstance(instance.getId());
|
||||||
processInstanceEventPublisher.sendProcessInstanceResultEvent(
|
processInstanceEventPublisher.sendProcessInstanceResultEvent(
|
||||||
BpmProcessInstanceConvert.INSTANCE.buildProcessInstanceStatusEvent(this, processInstance, BpmProcessInstanceStatusEnum.APPROVE.getStatus()));
|
BpmProcessInstanceConvert.INSTANCE.buildProcessInstanceStatusEvent(this, processInstance, processInstanceStatus));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -314,7 +349,31 @@ public class BpmProcessInstanceServiceImpl implements IBpmProcessInstanceService
|
|||||||
|
|
||||||
// 4. 发送流程实例的状态事件
|
// 4. 发送流程实例的状态事件
|
||||||
processInstanceEventPublisher.sendProcessInstanceResultEvent(
|
processInstanceEventPublisher.sendProcessInstanceResultEvent(
|
||||||
BpmProcessInstanceConvert.INSTANCE.buildProcessInstanceStatusEvent(this, processInstance, BpmProcessInstanceStatusEnum.REJECT.getStatus()));
|
BpmProcessInstanceConvert.INSTANCE.buildProcessInstanceStatusEvent(this, processInstance, reason, BpmProcessInstanceStatusEnum.REJECT.getStatus()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void updateProcessInstanceFromReject(String id, String reason, TaskService taskService, BpmTaskRejectParam bpmTaskRejectParam) {
|
||||||
|
// 1. 更新流程实例 status
|
||||||
|
runtimeService.setVariable(id, BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, BpmProcessInstanceStatusEnum.REJECT.getStatus());
|
||||||
|
|
||||||
|
// 2. 删除流程实例,以实现驳回任务时,取消整个审批流程
|
||||||
|
ProcessInstance processInstance = getProcessInstance(id);
|
||||||
|
// 3.3 调用 BPM complete 去完成任务
|
||||||
|
// 其中,variables 是存储动态表单到 local 任务级别。过滤一下,避免 ProcessInstance 系统级的变量被占用
|
||||||
|
if (CollectionUtil.isNotEmpty(bpmTaskRejectParam.getVariables())) {
|
||||||
|
Map<String, Object> variables = FlowableUtils.filterTaskFormVariable(bpmTaskRejectParam.getVariables());
|
||||||
|
taskService.complete(bpmTaskRejectParam.getId(), variables, true);
|
||||||
|
} else {
|
||||||
|
taskService.complete(bpmTaskRejectParam.getId());
|
||||||
|
}
|
||||||
|
//这是删除所有信息,
|
||||||
|
// deleteProcessInstance(id, StrUtil.format(BpmDeleteReasonEnum.REJECT_TASK.format(reason)));
|
||||||
|
// 4. 发送流程实例的状态事件
|
||||||
|
processInstanceEventPublisher.sendProcessInstanceResultEvent(
|
||||||
|
BpmProcessInstanceConvert.INSTANCE.buildProcessInstanceStatusEvent(this, processInstance, reason, BpmProcessInstanceStatusEnum.REJECT.getStatus()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteProcessInstance(String id, String reason) {
|
public void deleteProcessInstance(String id, String reason) {
|
||||||
|
|||||||
@@ -81,8 +81,7 @@ public class BpmTaskServiceImpl implements IBpmTaskService {
|
|||||||
private IProcessInstanceCopyService processInstanceCopyService;
|
private IProcessInstanceCopyService processInstanceCopyService;
|
||||||
@Resource
|
@Resource
|
||||||
private IBpmModelService bpmModelService;
|
private IBpmModelService bpmModelService;
|
||||||
// @Resource
|
|
||||||
// private BpmMessageService messageService;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private UserFeignClient adminUserApi;
|
private UserFeignClient adminUserApi;
|
||||||
@@ -90,10 +89,12 @@ public class BpmTaskServiceImpl implements IBpmTaskService {
|
|||||||
@Override
|
@Override
|
||||||
public PageResult<Task> getTaskTodoPage(String userId, BpmTaskParam.BpmTaskQueryParam bpmTaskQueryParam) {
|
public PageResult<Task> getTaskTodoPage(String userId, BpmTaskParam.BpmTaskQueryParam bpmTaskQueryParam) {
|
||||||
TaskQuery taskQuery = taskService.createTaskQuery()
|
TaskQuery taskQuery = taskService.createTaskQuery()
|
||||||
.taskAssignee(userId) // 分配给自己
|
// 分配给自己
|
||||||
|
.taskAssignee(userId)
|
||||||
.active()
|
.active()
|
||||||
.includeProcessVariables()
|
.includeProcessVariables()
|
||||||
.orderByTaskCreateTime().desc(); // 创建时间倒序
|
// 创建时间倒序
|
||||||
|
.orderByTaskCreateTime().desc();
|
||||||
if (StrUtil.isNotBlank(bpmTaskQueryParam.getSearchValue())) {
|
if (StrUtil.isNotBlank(bpmTaskQueryParam.getSearchValue())) {
|
||||||
taskQuery.taskNameLike("%" + bpmTaskQueryParam.getSearchValue() + "%");
|
taskQuery.taskNameLike("%" + bpmTaskQueryParam.getSearchValue() + "%");
|
||||||
}
|
}
|
||||||
@@ -112,13 +113,29 @@ public class BpmTaskServiceImpl implements IBpmTaskService {
|
|||||||
return new PageResult<>(tasks, count);
|
return new PageResult<>(tasks, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Task> todoAllList(String userIndex) {
|
||||||
|
TaskQuery taskQuery = taskService.createTaskQuery()
|
||||||
|
// 分配给自己
|
||||||
|
.taskAssignee(userIndex)
|
||||||
|
.active()
|
||||||
|
.includeProcessVariables()
|
||||||
|
// 创建时间倒序
|
||||||
|
.orderByTaskCreateTime().desc();
|
||||||
|
return taskQuery.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<HistoricTaskInstance> getTaskDonePage(String userId, BpmTaskParam.BpmTaskQueryParam bpmTaskQueryParam) {
|
public PageResult<HistoricTaskInstance> getTaskDonePage(String userId, BpmTaskParam.BpmTaskQueryParam bpmTaskQueryParam) {
|
||||||
HistoricTaskInstanceQuery taskQuery = historyService.createHistoricTaskInstanceQuery()
|
HistoricTaskInstanceQuery taskQuery = historyService.createHistoricTaskInstanceQuery()
|
||||||
.finished() // 已完成
|
// 已完成
|
||||||
.taskAssignee(String.valueOf(userId)) // 分配给自己
|
.finished()
|
||||||
|
// 分配给自己
|
||||||
|
.taskAssignee(String.valueOf(userId))
|
||||||
.includeTaskLocalVariables()
|
.includeTaskLocalVariables()
|
||||||
.orderByHistoricTaskInstanceEndTime().desc(); // 审批时间倒序
|
// 审批时间倒序
|
||||||
|
.orderByHistoricTaskInstanceEndTime().desc();
|
||||||
if (StrUtil.isNotBlank(bpmTaskQueryParam.getSearchValue())) {
|
if (StrUtil.isNotBlank(bpmTaskQueryParam.getSearchValue())) {
|
||||||
taskQuery.taskNameLike("%" + bpmTaskQueryParam.getSearchValue() + "%");
|
taskQuery.taskNameLike("%" + bpmTaskQueryParam.getSearchValue() + "%");
|
||||||
}
|
}
|
||||||
@@ -316,7 +333,8 @@ public class BpmTaskServiceImpl implements IBpmTaskService {
|
|||||||
private void approveDelegateTask(BpmTaskApproveParam bpmTaskApproveParam, Task task) {
|
private void approveDelegateTask(BpmTaskApproveParam bpmTaskApproveParam, Task task) {
|
||||||
// 1. 添加审批意见
|
// 1. 添加审批意见
|
||||||
UserVO currentUser = adminUserApi.getUserById(RequestUtil.getUserIndex()).getData();
|
UserVO currentUser = adminUserApi.getUserById(RequestUtil.getUserIndex()).getData();
|
||||||
UserVO ownerUser = adminUserApi.getUserById(task.getOwner()).getData(); // 发起委托的用户
|
// 发起委托的用户
|
||||||
|
UserVO ownerUser = adminUserApi.getUserById(task.getOwner()).getData();
|
||||||
Assert.notNull(ownerUser, "委派任务找不到原审批人,需要检查数据");
|
Assert.notNull(ownerUser, "委派任务找不到原审批人,需要检查数据");
|
||||||
taskService.addComment(bpmTaskApproveParam.getId(), task.getProcessInstanceId(), BpmCommentTypeEnum.DELEGATE_END.getType(),
|
taskService.addComment(bpmTaskApproveParam.getId(), task.getProcessInstanceId(), BpmCommentTypeEnum.DELEGATE_END.getType(),
|
||||||
BpmCommentTypeEnum.DELEGATE_END.formatComment(currentUser.getName(), ownerUser.getName(), bpmTaskApproveParam.getReason()));
|
BpmCommentTypeEnum.DELEGATE_END.formatComment(currentUser.getName(), ownerUser.getName(), bpmTaskApproveParam.getReason()));
|
||||||
@@ -346,7 +364,7 @@ public class BpmTaskServiceImpl implements IBpmTaskService {
|
|||||||
BpmCommentTypeEnum.REJECT.formatComment(bpmTaskRejectParam.getReason()));
|
BpmCommentTypeEnum.REJECT.formatComment(bpmTaskRejectParam.getReason()));
|
||||||
|
|
||||||
// 3. 更新流程实例,审批不通过!
|
// 3. 更新流程实例,审批不通过!
|
||||||
processInstanceService.updateProcessInstanceReject(instance.getProcessInstanceId(), bpmTaskRejectParam.getReason());
|
processInstanceService.updateProcessInstanceFromReject(instance.getProcessInstanceId(), bpmTaskRejectParam.getReason(), taskService, bpmTaskRejectParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -452,6 +470,8 @@ public class BpmTaskServiceImpl implements IBpmTaskService {
|
|||||||
// return historyService.createHistoricTaskInstanceQuery().taskId(id).includeTaskLocalVariables().singleResult();
|
// return historyService.createHistoricTaskInstanceQuery().taskId(id).includeTaskLocalVariables().singleResult();
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<UserTask> getUserTaskListByReturn(String id) {
|
public List<UserTask> getUserTaskListByReturn(String id) {
|
||||||
// 1.1 校验当前任务 task 存在
|
// 1.1 校验当前任务 task 存在
|
||||||
@@ -547,8 +567,10 @@ public class BpmTaskServiceImpl implements IBpmTaskService {
|
|||||||
// 3. 执行驳回
|
// 3. 执行驳回
|
||||||
runtimeService.createChangeActivityStateBuilder()
|
runtimeService.createChangeActivityStateBuilder()
|
||||||
.processInstanceId(currentTask.getProcessInstanceId())
|
.processInstanceId(currentTask.getProcessInstanceId())
|
||||||
.moveActivityIdsToSingleActivityId(returnTaskKeyList, // 当前要跳转的节点列表( 1 或多)
|
// 当前要跳转的节点列表( 1 或多)
|
||||||
bpmTaskReturnParam.getTargetTaskDefinitionKey()) // targetKey 跳转到的节点(1)
|
.moveActivityIdsToSingleActivityId(returnTaskKeyList,
|
||||||
|
// targetKey 跳转到的节点(1)
|
||||||
|
bpmTaskReturnParam.getTargetTaskDefinitionKey())
|
||||||
.changeState();
|
.changeState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -558,7 +580,8 @@ public class BpmTaskServiceImpl implements IBpmTaskService {
|
|||||||
String taskId = reqVO.getId();
|
String taskId = reqVO.getId();
|
||||||
// 1.1 校验任务
|
// 1.1 校验任务
|
||||||
Task task = validateTask(userId, reqVO.getId());
|
Task task = validateTask(userId, reqVO.getId());
|
||||||
if (task.getAssignee().equals(reqVO.getDelegateUserId())) { // 校验当前审批人和被委派人不是同一人
|
// 校验当前审批人和被委派人不是同一人
|
||||||
|
if (task.getAssignee().equals(reqVO.getDelegateUserId())) {
|
||||||
throw new BusinessException(BpmResponseEnum.TASK_DELEGATE_FAIL_USER_REPEAT);
|
throw new BusinessException(BpmResponseEnum.TASK_DELEGATE_FAIL_USER_REPEAT);
|
||||||
}
|
}
|
||||||
// 1.2 校验目标用户存在
|
// 1.2 校验目标用户存在
|
||||||
@@ -585,7 +608,8 @@ public class BpmTaskServiceImpl implements IBpmTaskService {
|
|||||||
String taskId = reqVO.getId();
|
String taskId = reqVO.getId();
|
||||||
// 1.1 校验任务
|
// 1.1 校验任务
|
||||||
Task task = validateTask(userId, reqVO.getId());
|
Task task = validateTask(userId, reqVO.getId());
|
||||||
if (task.getAssignee().equals(reqVO.getAssigneeUserId())) { // 校验当前审批人和被转派人不是同一人
|
// 校验当前审批人和被转派人不是同一人
|
||||||
|
if (task.getAssignee().equals(reqVO.getAssigneeUserId())) {
|
||||||
throw new BusinessException(BpmResponseEnum.TASK_DELEGATE_FAIL_USER_NOT_EXISTS);
|
throw new BusinessException(BpmResponseEnum.TASK_DELEGATE_FAIL_USER_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
// 1.2 校验目标用户存在
|
// 1.2 校验目标用户存在
|
||||||
@@ -603,7 +627,7 @@ public class BpmTaskServiceImpl implements IBpmTaskService {
|
|||||||
taskService.setOwner(taskId, task.getAssignee());
|
taskService.setOwner(taskId, task.getAssignee());
|
||||||
// 3.2 执行转派(审批人),将任务转派给 assigneeUser
|
// 3.2 执行转派(审批人),将任务转派给 assigneeUser
|
||||||
// 委托( delegate)和转派(transfer)的差别,就在这块的调用!!!!
|
// 委托( delegate)和转派(transfer)的差别,就在这块的调用!!!!
|
||||||
taskService.setAssignee(taskId, reqVO.getAssigneeUserId().toString());
|
taskService.setAssignee(taskId, reqVO.getAssigneeUserId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -811,6 +835,7 @@ public class BpmTaskServiceImpl implements IBpmTaskService {
|
|||||||
return taskService.createNativeTaskQuery().sql(sql).parameter("parentTaskId", parentTaskId).list();
|
return taskService.createNativeTaskQuery().sql(sql).parameter("parentTaskId", parentTaskId).list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取子任务个数
|
* 获取子任务个数
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -34,14 +34,14 @@ public class ProcessInstanceCopyServiceImpl extends ServiceImpl<ProcessInstanceC
|
|||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@Lazy // 延迟加载,避免循环依赖
|
@Lazy
|
||||||
private IBpmTaskService taskService;
|
private IBpmTaskService taskService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@Lazy // 延迟加载,避免循环依赖
|
@Lazy
|
||||||
private IBpmProcessInstanceService processInstanceService;
|
private IBpmProcessInstanceService processInstanceService;
|
||||||
@Resource
|
@Resource
|
||||||
@Lazy // 延迟加载,避免循环依赖
|
@Lazy
|
||||||
private IBpmProcessDefinitionService processDefinitionService;
|
private IBpmProcessDefinitionService processDefinitionService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -10,13 +10,11 @@ import com.njcn.bpm.utils.CollectionUtils;
|
|||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.user.api.UserFeignClient;
|
import com.njcn.user.api.UserFeignClient;
|
||||||
import com.njcn.user.pojo.po.User;
|
|
||||||
import com.njcn.user.pojo.vo.UserVO;
|
import com.njcn.user.pojo.vo.UserVO;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.flowable.bpmn.model.BpmnModel;
|
import org.flowable.bpmn.model.BpmnModel;
|
||||||
import org.flowable.bpmn.model.UserTask;
|
import org.flowable.bpmn.model.UserTask;
|
||||||
import org.flowable.engine.delegate.DelegateExecution;
|
import org.flowable.engine.delegate.DelegateExecution;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色 {@link IBpmTaskCandidateStrategy} 实现类
|
* 角色 {@link IBpmTaskCandidateStrategy} 实现类
|
||||||
@@ -21,8 +20,6 @@ public class BpmTaskCandidateRoleStrategy implements IBpmTaskCandidateStrategy {
|
|||||||
@Resource
|
@Resource
|
||||||
private UserFeignClient userFeignClient;
|
private UserFeignClient userFeignClient;
|
||||||
|
|
||||||
// @Resource
|
|
||||||
// private PermissionApi permissionApi;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BpmTaskCandidateStrategyEnum getStrategy() {
|
public BpmTaskCandidateStrategyEnum getStrategy() {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import java.util.*;
|
|||||||
public class BpmTaskCandidateStartUserSelectStrategy implements IBpmTaskCandidateStrategy {
|
public class BpmTaskCandidateStartUserSelectStrategy implements IBpmTaskCandidateStrategy {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@Lazy // 延迟加载,避免循环依赖
|
@Lazy
|
||||||
private IBpmProcessInstanceService processInstanceService;
|
private IBpmProcessInstanceService processInstanceService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import com.njcn.bpm.enums.BpmTaskCandidateStrategyEnum;
|
|||||||
import org.flowable.engine.delegate.DelegateExecution;
|
import org.flowable.engine.delegate.DelegateExecution;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BPM 任务的候选人的策略接口
|
* BPM 任务的候选人的策略接口
|
||||||
@@ -33,6 +32,7 @@ public interface IBpmTaskCandidateStrategy {
|
|||||||
* 基于执行任务,获得任务的候选用户们
|
* 基于执行任务,获得任务的候选用户们
|
||||||
*
|
*
|
||||||
* @param execution 执行任务
|
* @param execution 执行任务
|
||||||
|
* @param param 参数
|
||||||
* @return 用户编号集合
|
* @return 用户编号集合
|
||||||
*/
|
*/
|
||||||
List<String> calculateUsers(DelegateExecution execution, String param);
|
List<String> calculateUsers(DelegateExecution execution, String param);
|
||||||
|
|||||||
@@ -3,13 +3,10 @@ package com.njcn.bpm.utils;
|
|||||||
import cn.hutool.core.util.ArrayUtil;
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.bpm.enums.BpmModelFormTypeEnum;
|
|
||||||
import com.njcn.bpm.pojo.dto.BpmModelMetaInfoRespDTO;
|
import com.njcn.bpm.pojo.dto.BpmModelMetaInfoRespDTO;
|
||||||
import com.njcn.bpm.pojo.dto.PageResult;
|
|
||||||
import com.njcn.bpm.pojo.param.BpmModelParam;
|
import com.njcn.bpm.pojo.param.BpmModelParam;
|
||||||
import com.njcn.bpm.pojo.po.BpmCategory;
|
import com.njcn.bpm.pojo.po.BpmCategory;
|
||||||
import com.njcn.bpm.pojo.po.BpmForm;
|
import com.njcn.bpm.pojo.po.BpmForm;
|
||||||
import com.njcn.bpm.pojo.po.BpmProcessDefinitionInfo;
|
|
||||||
import com.njcn.bpm.pojo.vo.BpmModelRespVO;
|
import com.njcn.bpm.pojo.vo.BpmModelRespVO;
|
||||||
import com.njcn.bpm.pojo.vo.BpmProcessDefinitionInfoVO;
|
import com.njcn.bpm.pojo.vo.BpmProcessDefinitionInfoVO;
|
||||||
import org.flowable.common.engine.impl.db.SuspensionState;
|
import org.flowable.common.engine.impl.db.SuspensionState;
|
||||||
|
|||||||
@@ -70,6 +70,41 @@ public interface BpmProcessInstanceConvert {
|
|||||||
return vpPageResult;
|
return vpPageResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default List<BpmProcessInstanceVO> buildProcessInstancePage(List<HistoricProcessInstance> instances,
|
||||||
|
Map<String, ProcessDefinition> processDefinitionMap,
|
||||||
|
Map<String, BpmCategory> categoryMap,
|
||||||
|
Map<String, List<Task>> taskMap,
|
||||||
|
Map<String, UserVO> userMap,
|
||||||
|
Map<String, Dept> deptMap,
|
||||||
|
BusinessCommonFeignClient businessCommonFeignClient) {
|
||||||
|
List<BpmProcessInstanceVO> vpInstancesResult = BeanUtils.toBean(instances, BpmProcessInstanceVO.class);
|
||||||
|
for (int i = 0; i <instances.size(); i++) {
|
||||||
|
BpmProcessInstanceVO respVO = vpInstancesResult.get(i);
|
||||||
|
respVO.setStatus(FlowableUtils.getProcessInstanceStatus(instances.get(i)));
|
||||||
|
MapUtils.findAndThen(processDefinitionMap, respVO.getProcessDefinitionId(),
|
||||||
|
processDefinition -> respVO.setCategory(processDefinition.getCategory()));
|
||||||
|
MapUtils.findAndThen(categoryMap, respVO.getCategory(), category -> respVO.setCategoryName(category.getName()));
|
||||||
|
respVO.setTasks(BeanUtils.toBean(taskMap.get(respVO.getId()), BpmProcessInstanceVO.Task.class));
|
||||||
|
// user
|
||||||
|
if (userMap != null) {
|
||||||
|
UserVO startUser = userMap.get(instances.get(i).getStartUserId());
|
||||||
|
if (startUser != null) {
|
||||||
|
respVO.setStartUser(BeanUtils.toBean(startUser, BpmProcessInstanceVO.User.class));
|
||||||
|
MapUtils.findAndThen(deptMap, startUser.getDeptId(), dept -> respVO.getStartUser().setDeptName(dept.getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String processDefinitionId = respVO.getProcessDefinitionId();
|
||||||
|
String key = processDefinitionId.substring(0,processDefinitionId.lastIndexOf(":"));
|
||||||
|
key = key.substring(0,key.lastIndexOf(":"));
|
||||||
|
BpmInstanceInfo instanceInfo = businessCommonFeignClient.getInstanceInfo(key, respVO.getBusinessKey()).getData();
|
||||||
|
if(Objects.nonNull(instanceInfo)){
|
||||||
|
respVO.setHistoryInstanceId(instanceInfo.getHistoryInstanceId());
|
||||||
|
respVO.setInstanceSign(instanceInfo.getInstanceSign());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return vpInstancesResult;
|
||||||
|
}
|
||||||
|
|
||||||
default BpmProcessInstanceVO buildProcessInstance(HistoricProcessInstance processInstance,
|
default BpmProcessInstanceVO buildProcessInstance(HistoricProcessInstance processInstance,
|
||||||
ProcessDefinition processDefinition,
|
ProcessDefinition processDefinition,
|
||||||
BpmProcessDefinitionInfo processDefinitionExt,
|
BpmProcessDefinitionInfo processDefinitionExt,
|
||||||
@@ -105,12 +140,13 @@ public interface BpmProcessInstanceConvert {
|
|||||||
return bpmProcessInstanceStatusEvent;
|
return bpmProcessInstanceStatusEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
default BpmProcessInstanceStatusEvent buildProcessInstanceStatusEvent(Object source, ProcessInstance instance, Integer status) {
|
default BpmProcessInstanceStatusEvent buildProcessInstanceStatusEvent(Object source, ProcessInstance instance,String reason, Integer status) {
|
||||||
BpmProcessInstanceStatusEvent bpmProcessInstanceStatusEvent = new BpmProcessInstanceStatusEvent(source);
|
BpmProcessInstanceStatusEvent bpmProcessInstanceStatusEvent = new BpmProcessInstanceStatusEvent(source);
|
||||||
bpmProcessInstanceStatusEvent.setId(instance.getId());
|
bpmProcessInstanceStatusEvent.setId(instance.getId());
|
||||||
bpmProcessInstanceStatusEvent.setStatus(status);
|
bpmProcessInstanceStatusEvent.setStatus(status);
|
||||||
bpmProcessInstanceStatusEvent.setProcessDefinitionKey(instance.getProcessDefinitionKey());
|
bpmProcessInstanceStatusEvent.setProcessDefinitionKey(instance.getProcessDefinitionKey());
|
||||||
bpmProcessInstanceStatusEvent.setBusinessKey(instance.getBusinessKey());
|
bpmProcessInstanceStatusEvent.setBusinessKey(instance.getBusinessKey());
|
||||||
|
bpmProcessInstanceStatusEvent.setReason(reason);
|
||||||
return bpmProcessInstanceStatusEvent;
|
return bpmProcessInstanceStatusEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user