Compare commits
477 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f1ae1886a | ||
|
|
af4863af65 | ||
| 2012221b73 | |||
|
|
f4df52dd1c | ||
| 41c557118c | |||
| 6596a572d6 | |||
|
|
786bd5d660 | ||
|
|
21d2c2b7a7 | ||
|
|
48fa4c2390 | ||
|
|
9d15351fba | ||
|
|
2339a006ec | ||
|
|
7fd904ab79 | ||
|
|
40cb153656 | ||
|
|
f922ee97aa | ||
|
|
26c5e933f5 | ||
|
|
c7d8fc3168 | ||
|
|
bb22857fc9 | ||
|
|
6ef908ff60 | ||
|
|
7461801657 | ||
|
|
4ecec5e6ef | ||
|
|
04a667531b | ||
|
|
a0f6846f53 | ||
|
|
a177d7991c | ||
|
|
f8fb45cf6f | ||
|
|
910069a463 | ||
| 56477157aa | |||
| a6b0509179 | |||
|
|
b5e5286411 | ||
|
|
d01c0e14c0 | ||
|
|
0cf8bbc3d5 | ||
|
|
3a239b5123 | ||
|
|
0eabe977cb | ||
|
|
f1f86ea854 | ||
|
|
e048c92ad1 | ||
|
|
65f46a22f5 | ||
| 5d4cce365e | |||
|
|
b4c9bd12c9 | ||
|
|
8a11a9e5b1 | ||
|
|
b2738e1726 | ||
|
|
5d16d6c494 | ||
|
|
2693015dab | ||
|
|
3ecffc99b8 | ||
| 9c02a7cb8e | |||
|
|
a4edf8b3f6 | ||
| 8328d6c06e | |||
|
|
2ac33e8cec | ||
|
|
bbb911c917 | ||
|
|
bef9723255 | ||
|
|
47e3e5218d | ||
|
|
72800e1e44 | ||
| f6547b02a4 | |||
|
|
8fb22017d3 | ||
|
|
6f8070c85f | ||
| c09a0f4b85 | |||
| ba22f2b796 | |||
|
|
f62aa1f7f7 | ||
|
|
f19a467300 | ||
|
|
f4550b9c76 | ||
|
|
a5791ef76b | ||
|
|
dff4b556eb | ||
|
|
c013cd2eac | ||
| dc366ae1c3 | |||
| a9d2ba8dde | |||
|
|
de138328e9 | ||
|
|
757501efa8 | ||
|
|
73028c70d2 | ||
|
|
bdb3efd81d | ||
| 20423028f7 | |||
|
|
6442219087 | ||
|
|
a0148badaf | ||
| 8745f8bbbe | |||
|
|
277b1710fa | ||
| 1115520106 | |||
|
|
c8b63a7a7a | ||
|
|
1ed27ed29f | ||
|
|
072a2b6bfc | ||
|
|
b2bb7c3901 | ||
|
|
ad2752197a | ||
| 424a81ac53 | |||
|
|
38332616fa | ||
| 118068bafe | |||
| 8103b45a61 | |||
|
|
ef4c4a0a17 | ||
|
|
31a2311698 | ||
|
|
9937c3cb5f | ||
| 482d7f6ce5 | |||
|
|
5905c0b438 | ||
| 594ac7d4d4 | |||
| 9d2aad81e4 | |||
| 6b1303d250 | |||
| c45800f6d5 | |||
|
|
74cdfaf882 | ||
|
|
34ff162db1 | ||
|
|
bd6af21b99 | ||
| f0566a5969 | |||
| 76a571921a | |||
| 512ed2a542 | |||
|
|
c2c5c9668e | ||
|
|
a0b0023def | ||
| a11189d85c | |||
| ed54f79983 | |||
|
|
f03622ac5b | ||
|
|
bf3fe9450f | ||
| b4e2727c58 | |||
| 977ab4bf1b | |||
| d26504c841 | |||
| 418e17a427 | |||
| 4e0e50a4f8 | |||
| e05403bfa7 | |||
| b1a2ccd018 | |||
| 10f39b44a2 | |||
| 9eca074ffb | |||
| 9820d0a915 | |||
|
|
525de0c24c | ||
|
|
744c72dea2 | ||
|
|
b4114f19de | ||
|
|
b0dde94314 | ||
|
|
da7015fd89 | ||
|
|
9058c9081b | ||
|
|
34f317780e | ||
|
|
708b40880e | ||
|
|
bf661b5c1c | ||
|
|
57b08a99c6 | ||
| 8bc8a97e83 | |||
|
|
53548aec32 | ||
|
|
1380af6d50 | ||
|
|
21dcd87be2 | ||
|
|
fb97e421bb | ||
|
|
4f2ae176fa | ||
|
|
06e21711f2 | ||
|
|
95c564595f | ||
|
|
e725cd8a60 | ||
|
|
8507ad8378 | ||
|
|
cb8495fb0d | ||
|
|
8f8d3d38cc | ||
|
|
7eb80121a1 | ||
|
|
3736082096 | ||
|
|
2f303e63a3 | ||
|
|
ab2e5c346e | ||
|
|
ebb45238b0 | ||
|
|
6763721043 | ||
|
|
e235c3ef66 | ||
|
|
40b0e535cb | ||
|
|
9438301ebd | ||
|
|
bfed1b3e93 | ||
|
|
a9515f42b3 | ||
|
|
bbb62586f9 | ||
|
|
6aef21797d | ||
|
|
b7a90ebeb4 | ||
|
|
67665d3762 | ||
|
|
41252af4e9 | ||
|
|
2869f66154 | ||
|
|
2bdaabac6e | ||
|
|
4b41e2edd1 | ||
|
|
5fa09bb41b | ||
|
|
c96cadc5d1 | ||
|
|
b471a05181 | ||
|
|
e42a2c8309 | ||
| ea585a65ff | |||
|
|
59ba5c0a0c | ||
|
|
99d43041cb | ||
|
|
aa5f57a856 | ||
|
|
9fc0fbcbcf | ||
|
|
434dc676ce | ||
| ea83963d33 | |||
|
|
257df0a511 | ||
| 496cff6c11 | |||
|
|
484f9c9f4c | ||
|
|
19b69eed0e | ||
|
|
b165365203 | ||
|
|
a42dcd1d4b | ||
|
|
be3df5c497 | ||
|
|
7b951fa4b6 | ||
|
|
89a7b5b8f6 | ||
|
|
102aa504e6 | ||
| d1cbfcedcc | |||
| 116563f13e | |||
|
|
55bf90d0af | ||
|
|
7ac01b0f5e | ||
| 1a28d25026 | |||
|
|
92b0640f9c | ||
|
|
4a2fb595d0 | ||
| 56dd19b32e | |||
|
|
8460574f10 | ||
| 6f890daad6 | |||
|
|
6727dee61e | ||
|
|
3fcad5ff76 | ||
| 1fe7866970 | |||
|
|
b96d0cdeb1 | ||
| 0c30603f31 | |||
|
|
64bdba9fa2 | ||
|
|
c7a45b5500 | ||
| 42701db2d5 | |||
|
|
6c34c4a968 | ||
|
|
186d701dcb | ||
|
|
9b1b21dad5 | ||
|
|
00bda55ddd | ||
|
|
593b7e9d7b | ||
| f842886c00 | |||
|
|
af58306d96 | ||
|
|
09972e0764 | ||
|
|
7ba71562d8 | ||
|
|
71ba7fa139 | ||
|
|
48408859b1 | ||
|
|
fef01b692a | ||
|
|
55208ecf69 | ||
|
|
9a7d841d9c | ||
|
|
4ef5c982de | ||
|
|
22028fe7eb | ||
|
|
6ff3d7e336 | ||
| fe7af8a632 | |||
|
|
c67a2c8323 | ||
|
|
ce217b8b86 | ||
|
|
ebc52eb8ba | ||
|
|
0e1fb0e254 | ||
|
|
4d61cfc490 | ||
|
|
d0491b4850 | ||
|
|
610a3c1d13 | ||
|
|
ac0a9dd777 | ||
|
|
f294cb315f | ||
|
|
051e7fe14a | ||
|
|
38cbb22eff | ||
|
|
423fa581b4 | ||
|
|
279a8a6e83 | ||
|
|
a108b295d1 | ||
|
|
04bd8a7db3 | ||
|
|
d084950090 | ||
|
|
ff53c91279 | ||
|
|
751dc56568 | ||
| 7f42a21536 | |||
|
|
8ca804283a | ||
|
|
c43c5b4342 | ||
|
|
03ec551f71 | ||
|
|
0ddf98e1af | ||
|
|
1c014a75a7 | ||
|
|
c80ae2f95f | ||
|
|
d633b0bd35 | ||
|
|
81645ae1ba | ||
|
|
708a4e6fbd | ||
|
|
c60d41af10 | ||
|
|
91e2e9e7fe | ||
|
|
d1101cd157 | ||
|
|
7594657021 | ||
|
|
9bef1331f2 | ||
|
|
77e2a73345 | ||
|
|
1b518e508e | ||
|
|
1c12187d93 | ||
|
|
67b6f822c3 | ||
|
|
337797b0ed | ||
|
|
1075a72375 | ||
|
|
9fcf4e39a4 | ||
|
|
189ffad11d | ||
|
|
efccaae69e | ||
|
|
34d4321290 | ||
|
|
6cca428d62 | ||
|
|
653c556867 | ||
|
|
8c4ce5d8af | ||
|
|
2261a786a4 | ||
|
|
1f5916e898 | ||
|
|
fe9a81a3a3 | ||
|
|
c0466ed189 | ||
|
|
bc37e47b43 | ||
|
|
6968bf437d | ||
|
|
08be6c15fb | ||
|
|
1d7440b4f7 | ||
|
|
e0e1b6ea9e | ||
|
|
646e33d93a | ||
|
|
8419450427 | ||
|
|
ae94e35607 | ||
|
|
6fb6733727 | ||
|
|
273dd18405 | ||
|
|
8e78ae4e4c | ||
|
|
dda18320f8 | ||
|
|
993ac5f019 | ||
|
|
98dd7894b8 | ||
|
|
f34a996705 | ||
|
|
bc20fc0705 | ||
| 5d606673a6 | |||
|
|
a4f5034c7f | ||
|
|
6e6a6512c9 | ||
|
|
c7ac87c930 | ||
|
|
06b13fdfe1 | ||
|
|
a2ac240150 | ||
|
|
19e99fda9e | ||
|
|
bf94ed37d9 | ||
|
|
5ee33fabdf | ||
|
|
d65b68bbf4 | ||
|
|
6fb57f8422 | ||
|
|
cbbf2db4eb | ||
| 837ea9e369 | |||
|
|
496c7a7908 | ||
|
|
758b2a9033 | ||
|
|
913a86dcc7 | ||
|
|
84879b8d18 | ||
|
|
79b89e7e8b | ||
|
|
cb06b77aef | ||
|
|
b746a6445f | ||
|
|
c062e2a47f | ||
|
|
5828a52329 | ||
|
|
bb9a0f586f | ||
| 8cef3c8358 | |||
|
|
0c012152bb | ||
|
|
76ec26dca0 | ||
|
|
a5472781de | ||
|
|
ff7fbf92e6 | ||
| 158422860d | |||
| 422645bcfd | |||
|
|
dd96bc4171 | ||
|
|
2c950b3ac5 | ||
|
|
25e975fbc8 | ||
|
|
a006c0df33 | ||
|
|
b5cee74731 | ||
|
|
801e17e274 | ||
|
|
93d649162d | ||
| cc529b7e91 | |||
|
|
8f719e5a73 | ||
|
|
8f8788b43c | ||
|
|
04135f7044 | ||
|
|
aca953e827 | ||
|
|
de6922e9cb | ||
|
|
3e7bba6434 | ||
|
|
bd90965597 | ||
|
|
5b0cdb5c18 | ||
|
|
1e64382a98 | ||
|
|
9d6f8155fd | ||
|
|
2c70ae0696 | ||
|
|
92b34ac4c1 | ||
|
|
8bc0498b9f | ||
|
|
d2a8ddfbd2 | ||
|
|
1c69b3010b | ||
|
|
c045b2921c | ||
|
|
2def1546a9 | ||
|
|
776141bea7 | ||
|
|
ccb11142d1 | ||
|
|
1cc1a9ecf2 | ||
|
|
c374b4e438 | ||
|
|
30ae8aaffb | ||
|
|
2bb6a506de | ||
| 7ce35772ef | |||
| 0db2ebf4fc | |||
|
|
340dd6237e | ||
|
|
576beb10c8 | ||
|
|
ab3d90fd24 | ||
| 8a2ef975ea | |||
|
|
7da5d7c1f8 | ||
|
|
bd9f518241 | ||
|
|
7e4119771c | ||
|
|
45cac83b9b | ||
|
|
ba18a1310d | ||
|
|
1ad3fe48b4 | ||
| 413f668179 | |||
|
|
e3a19da34e | ||
|
|
491abdd18e | ||
|
|
1b3bc9f0f2 | ||
|
|
c9aaf82f3f | ||
|
|
1d87a607df | ||
| 6b33a40200 | |||
| a0e8e093fe | |||
| 12e805ccc1 | |||
| bdc3df38a3 | |||
| 6435d7135d | |||
|
|
99052f17f8 | ||
| 17f9ecee29 | |||
|
|
659f1e1ed5 | ||
|
|
dd9662091a | ||
|
|
dfa0daf70c | ||
|
|
61f7981ee5 | ||
|
|
8c75ecb09f | ||
|
|
de53e41f2c | ||
|
|
5b6ddacbf7 | ||
| 8d41510358 | |||
|
|
46948118dd | ||
| 4e0b16fad1 | |||
|
|
bab07585a9 | ||
|
|
ec2242bc35 | ||
| d58e957dae | |||
| 6ce4a97169 | |||
| ba301200b0 | |||
| 96c72acf72 | |||
| a25e1c7e15 | |||
| 7d4d925158 | |||
| 4f657669ad | |||
|
|
b6b1e9c9cb | ||
|
|
c571f870d8 | ||
| f3a0bb75ee | |||
| 1ee77361ff | |||
| 188b091f8d | |||
|
|
d41471f152 | ||
|
|
257dfa2221 | ||
| f4b7b3bdfe | |||
|
|
9c8ea385ed | ||
| ed3b91b2d8 | |||
|
|
c6d02d8724 | ||
| 2e9d640a75 | |||
|
|
d4dba1617d | ||
| 7163f387f6 | |||
| 3afa32bda4 | |||
| 4416459877 | |||
|
|
e7b0ce96f5 | ||
|
|
9fc1baad28 | ||
| dd4cf1eede | |||
| f5afc2e9bc | |||
| d44b511988 | |||
| f3a48ca345 | |||
|
|
3f6af65763 | ||
|
|
1572276448 | ||
|
|
8fa69a6876 | ||
| ec6e90e37a | |||
| 7054098b76 | |||
|
|
2a78f695dc | ||
|
|
cd82ea6c43 | ||
|
|
93973b6c6f | ||
|
|
f9c8c812ee | ||
| 9b6543bbb6 | |||
|
|
173aa100bd | ||
| 6bb50bdd01 | |||
| 54c909324c | |||
|
|
03c245758d | ||
| 9ca34607cc | |||
|
|
23d8bf8870 | ||
|
|
14fb79b1cc | ||
|
|
495b045e6d | ||
|
|
92887b773c | ||
|
|
db8205fbaa | ||
|
|
f971c3f2fa | ||
| fd74a00de9 | |||
| 534018b2f8 | |||
| f2fc74d27d | |||
|
|
ccb7bafda1 | ||
|
|
51539f1137 | ||
| ec5aae048d | |||
| d52c3e680b | |||
| e5eef6b1d1 | |||
|
|
e6e92a5503 | ||
| a415a410bf | |||
|
|
8d78cede68 | ||
| 07f1cd6f2f | |||
| 4e87c83556 | |||
| f2cfc383fd | |||
|
|
d91960700b | ||
| 55e7f1ce69 | |||
| 0b35ce08b0 | |||
|
|
cd78ad0588 | ||
| 12e1dc258a | |||
| 2b49a8b268 | |||
| 84fdd18f4e | |||
| ce3eb8f916 | |||
| e49ebf51ac | |||
|
|
bbbe729568 | ||
| 6de6c0955d | |||
| b24b282cbb | |||
| af47617d37 | |||
| 6bb8448db3 | |||
|
|
a0a42f8fa3 | ||
|
|
be232d390f | ||
| 28b8ca4ea7 | |||
| a5227c372f | |||
|
|
bf11f4c820 | ||
| ed69e53d69 | |||
|
|
a5e4baeb16 | ||
|
|
b13d34dcfc | ||
|
|
bb113720bc | ||
|
|
6040dee569 | ||
|
|
6b6ec07be2 | ||
|
|
83f5c10532 | ||
|
|
8cf4d04c65 | ||
|
|
2c7d465809 | ||
|
|
7bc1f768f9 | ||
|
|
a7b794b4d0 | ||
|
|
ea8a2bd8e7 | ||
|
|
949aa83539 | ||
|
|
11c95b6b42 | ||
| 38ffc6926d | |||
|
|
97c6e7a1e1 | ||
| 82acf16593 | |||
|
|
5c8a4fbfb8 | ||
|
|
8cfad7b57d |
@@ -1,8 +1,9 @@
|
|||||||
#### 简介
|
#### 简介
|
||||||
设备模块主要包含以下功能:
|
设备模块主要包含以下功能:
|
||||||
|
* 检测计划管理
|
||||||
* 被检设备管理
|
* 被检设备管理
|
||||||
* 检测脚本管理
|
* 被检设备下监测点管理
|
||||||
* 误差体系管理
|
* 误差体系管理
|
||||||
|
* 检测脚本管理
|
||||||
* 检测源管理
|
* 检测源管理
|
||||||
|
* 检测报告管理
|
||||||
|
|
||||||
@@ -8,10 +8,9 @@
|
|||||||
<artifactId>CN_Gather</artifactId>
|
<artifactId>CN_Gather</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>detection</artifactId>
|
<artifactId>detection</artifactId>
|
||||||
<dependencies>
|
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
<artifactId>njcn-common</artifactId>
|
<artifactId>njcn-common</artifactId>
|
||||||
@@ -29,20 +28,12 @@
|
|||||||
<artifactId>spingboot2.3.12</artifactId>
|
<artifactId>spingboot2.3.12</artifactId>
|
||||||
<version>2.3.12</version>
|
<version>2.3.12</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.netty</groupId>
|
|
||||||
<artifactId>netty-all</artifactId>
|
|
||||||
<version>4.1.68.Final</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn.gather</groupId>
|
<groupId>com.njcn.gather</groupId>
|
||||||
<artifactId>device</artifactId>
|
<artifactId>system</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>fastjson</artifactId>
|
<artifactId>fastjson</artifactId>
|
||||||
@@ -54,6 +45,86 @@
|
|||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.netty</groupId>
|
||||||
|
<artifactId>netty-all</artifactId>
|
||||||
|
<version>4.1.68.Final</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- WordToHtml .doc .odcx poi -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-scratchpad</artifactId>
|
||||||
|
<version>4.1.2</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- 操作excel的库 注意版本保持一致 poi poi-ooxml poi-scratchpad -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi</artifactId>
|
||||||
|
<version>4.1.2</version>
|
||||||
|
</dependency>
|
||||||
|
<!--poi-ooxml和*poi-ooxml-schemas*是poi对2007及以上版本的扩充。-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml-schemas</artifactId>
|
||||||
|
<version>4.1.2</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
<version>4.1.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.docx4j/docx4j -->
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>org.docx4j</groupId>-->
|
||||||
|
<!-- <artifactId>docx4j-core</artifactId>-->
|
||||||
|
<!-- <version>8.3.8</version>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.xml.bind</groupId>
|
||||||
|
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||||
|
<version>2.3.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.glassfish.jaxb</groupId>
|
||||||
|
<artifactId>jaxb-runtime</artifactId>
|
||||||
|
<version>2.3.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.docx4j</groupId>
|
||||||
|
<artifactId>docx4j</artifactId>
|
||||||
|
<version>6.1.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<version>2.12.0</version> <!-- 您可以根据需要选择其他版本 -->
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-core</artifactId>
|
||||||
|
<version>2.12.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-annotations</artifactId>
|
||||||
|
<version>2.12.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>RestTemplate-plugin</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-net</groupId>
|
||||||
|
<artifactId>commons-net</artifactId>
|
||||||
|
<version>3.10.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -1,20 +1,15 @@
|
|||||||
package com.njcn.gather.detection.controller;
|
package com.njcn.gather.detection.controller;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.gather.detection.handler.SocketDevResponseService;
|
||||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
import com.njcn.gather.detection.pojo.po.DevData;
|
import com.njcn.gather.detection.pojo.param.SimulateDetectionParam;
|
||||||
import com.njcn.gather.detection.service.PreDetectionService;
|
import com.njcn.gather.detection.service.PreDetectionService;
|
||||||
import com.njcn.gather.detection.service.impl.DetectionServiceImpl;
|
import com.njcn.gather.detection.service.impl.DetectionServiceImpl;
|
||||||
import com.njcn.gather.detection.util.socket.MsgUtil;
|
import com.njcn.gather.device.service.IPqDevService;
|
||||||
import com.njcn.gather.device.device.pojo.vo.PreDetection;
|
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||||
import com.njcn.gather.device.device.service.IPqDevService;
|
|
||||||
import com.njcn.gather.device.script.pojo.param.PqScriptIssueParam;
|
|
||||||
import com.njcn.gather.device.script.pojo.po.SourceIssue;
|
|
||||||
import com.njcn.gather.device.script.service.IPqScriptDtlsService;
|
|
||||||
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import com.njcn.web.utils.HttpResultUtil;
|
import com.njcn.web.utils.HttpResultUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@@ -22,14 +17,13 @@ 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 java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author chendaofei
|
||||||
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Api(tags = "预检测")
|
@Api(tags = "预检测")
|
||||||
@RestController
|
@RestController
|
||||||
@@ -39,90 +33,100 @@ public class PreDetectionController extends BaseController {
|
|||||||
|
|
||||||
private final PreDetectionService preDetectionService;
|
private final PreDetectionService preDetectionService;
|
||||||
|
|
||||||
private final DetectionServiceImpl detectionServiceImpl;
|
|
||||||
|
|
||||||
private final IPqScriptDtlsService pqScriptDtlsService;
|
|
||||||
|
|
||||||
private final IPqDevService iPqDevService;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 终止预检测
|
* 开始检测通用入口
|
||||||
*/
|
* @param param 实体参数
|
||||||
@PostMapping("/closePreTest")
|
|
||||||
@OperateInfo
|
|
||||||
@ApiOperation("终止预检测")
|
|
||||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
|
||||||
public HttpResult<String> closePreTest(@RequestBody PreDetectionParam param){
|
|
||||||
String methodDescribe = getMethodDescribe("closePreTest");
|
|
||||||
preDetectionService.closePreTest(param);
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 开始预检测
|
|
||||||
*/
|
*/
|
||||||
@PostMapping("/startPreTest")
|
@PostMapping("/startPreTest")
|
||||||
@OperateInfo
|
@OperateInfo
|
||||||
@ApiOperation("开始预检测")
|
@ApiOperation("开始检测")
|
||||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||||
public HttpResult<String> startPreTest(@RequestBody PreDetectionParam param){
|
public HttpResult<String> startPreTest(@RequestBody @Validated PreDetectionParam param) {
|
||||||
String methodDescribe = getMethodDescribe("startPreTest");
|
String methodDescribe = getMethodDescribe("startPreTest");
|
||||||
preDetectionService.sourceCommunicationCheck(param);
|
preDetectionService.sourceCommunicationCheck(param);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 程控源-源通讯校验
|
||||||
|
*
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/ytxCheckSimulate")
|
||||||
|
@OperateInfo
|
||||||
|
@ApiOperation("源通讯校验")
|
||||||
|
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||||
|
public HttpResult<String> ytxCheckSimulate(@RequestBody @Validated SimulateDetectionParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("ytxCheckSimulate");
|
||||||
|
preDetectionService.ytxCheckSimulate(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试
|
* 程控源检测
|
||||||
*/
|
*/
|
||||||
@PostMapping("/startTest")
|
@PostMapping("/startSimulateTest")
|
||||||
@OperateInfo
|
@OperateInfo
|
||||||
@ApiOperation("测试")
|
@ApiOperation("启动")
|
||||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||||
public HttpResult<String> startTest(@RequestBody PreDetectionParam param){
|
public HttpResult<String> startTestSimulate(@RequestBody @Validated SimulateDetectionParam param) {
|
||||||
String methodDescribe = getMethodDescribe("startTest");
|
String methodDescribe = getMethodDescribe("startTestSimulate");
|
||||||
//preDetectionService.startTest(param);
|
preDetectionService.sendScript(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
String a = "{\"Time\":\"2025-01-02T14:14:44.958\",\"ID\":\"192.168.1.186_1\",\"result\":false,\"SqlData\":[{\"type\":\"real\",\"desc\":\"FREQ\",\"list\":{\"A\":null,\"B\":null,\"C\":null,\"T\":\"50.035600\"}}],\"SqlDataHarm\":[]}";
|
/**
|
||||||
String b = "{\"Time\":\"2025-01-02T14:14:39.004\",\"ID\":\"192.168.1.203_1\",\"result\":false,\"SqlData\":[{\"type\":\"real\",\"desc\":\"FREQ\",\"list\":{\"A\":null,\"B\":null,\"C\":null,\"T\":\"50.000000\"}}],\"SqlDataHarm\":[]}";
|
* 关闭检测-程控源
|
||||||
String c = "{\"Time\":\"2025-01-02T14:14:39.004\",\"ID\":\"192.168.1.203_2\",\"result\":false,\"SqlData\":[{\"type\":\"real\",\"desc\":\"FREQ\",\"list\":{\"A\":null,\"B\":null,\"C\":null,\"T\":\"50.000000\"}}],\"SqlDataHarm\":[]}";
|
*/
|
||||||
String d = "{\"Time\":\"2025-01-02T14:14:47.956\",\"ID\":\"192.168.1.186_1\",\"result\":false,\"SqlData\":[{\"type\":\"real\",\"desc\":\"FREQ\",\"list\":{\"A\":null,\"B\":null,\"C\":null,\"T\":\"50.032300\"}}],\"SqlDataHarm\":[]}";
|
@PostMapping("/closeSimulateTest")
|
||||||
String e = "{\"Time\":\"2025-01-02T14:14:42.004\",\"ID\":\"192.168.1.203_1\",\"result\":false,\"SqlData\":[{\"type\":\"real\",\"desc\":\"FREQ\",\"list\":{\"A\":null,\"B\":null,\"C\":null,\"T\":\"50.000000\"}}],\"SqlDataHarm\":[]}";
|
@OperateInfo
|
||||||
String f = "{\"Time\":\"2025-01-02T14:14:42.004\",\"ID\":\"192.168.1.203_2\",\"result\":false,\"SqlData\":[{\"type\":\"real\",\"desc\":\"FREQ\",\"list\":{\"A\":null,\"B\":null,\"C\":null,\"T\":\"50.000000\"}}],\"SqlDataHarm\":[]}";
|
@ApiOperation("停止")
|
||||||
|
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||||
List<DevData> devDataList = new ArrayList<>();
|
public HttpResult<String> closeSimulateTest(@RequestBody @Validated SimulateDetectionParam param) {
|
||||||
DevData aa = JSON.parseObject(a, DevData.class);
|
String methodDescribe = getMethodDescribe("closeSimulateTest");
|
||||||
DevData bb = JSON.parseObject(a, DevData.class);
|
preDetectionService.closeTestSimulate(param);
|
||||||
DevData cc = JSON.parseObject(a, DevData.class);
|
|
||||||
DevData dd = JSON.parseObject(a, DevData.class);
|
|
||||||
DevData ee = JSON.parseObject(a, DevData.class);
|
|
||||||
DevData ff = JSON.parseObject(a, DevData.class);
|
|
||||||
devDataList.add(aa);
|
|
||||||
devDataList.add(bb);
|
|
||||||
devDataList.add(cc);
|
|
||||||
devDataList.add(dd);
|
|
||||||
devDataList.add(ee);
|
|
||||||
devDataList.add(ff);
|
|
||||||
|
|
||||||
PqScriptIssueParam issueParam = new PqScriptIssueParam();
|
|
||||||
issueParam.setPlanId(param.getPlanId());
|
|
||||||
issueParam.setSourceId(param.getSourceId());
|
|
||||||
issueParam.setDevIds(param.getDevIds());
|
|
||||||
issueParam.setScriptId("a303b2224845fcc6f60198b8ca23dca9");
|
|
||||||
issueParam.setIsPhaseSequence(false);
|
|
||||||
SourceIssue sourceIssues = pqScriptDtlsService.listSourceIssue(issueParam).get(0);
|
|
||||||
|
|
||||||
List<PreDetection> pqDevList = iPqDevService.getDevInfo(param.getDevIds());
|
|
||||||
Map<String, String> devIdMapComm = pqDevList.stream().collect(Collectors.toMap(PreDetection::getDevIP, PreDetection::getDevId));
|
|
||||||
|
|
||||||
detectionServiceImpl.text(devDataList,param.getErrorSysId(),devIdMapComm,sourceIssues, DictDataEnum.AT_WILL_VALUE);
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系数校验
|
||||||
|
*/
|
||||||
|
@PostMapping("/coefficientCheck")
|
||||||
|
@OperateInfo
|
||||||
|
@ApiOperation("系数校验")
|
||||||
|
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||||
|
public HttpResult<String> coefficientCheck(@RequestBody PreDetectionParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("coefficientCheck");
|
||||||
|
preDetectionService.coefficientCheck(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂停检测
|
||||||
|
*/
|
||||||
|
@GetMapping("/closePreTest")
|
||||||
|
@OperateInfo
|
||||||
|
@ApiOperation("暂停检测")
|
||||||
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
|
public HttpResult<String> temStopTest() {
|
||||||
|
String methodDescribe = getMethodDescribe("temStopTest");
|
||||||
|
preDetectionService.temStopTest();
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重新开始检测
|
||||||
|
*/
|
||||||
|
@PostMapping("/restartTemTest")
|
||||||
|
@OperateInfo
|
||||||
|
@ApiOperation("重新开始检测")
|
||||||
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
|
public HttpResult<String> restartTemTest(@RequestBody PreDetectionParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("restartTemTest");
|
||||||
|
preDetectionService.restartTemTest(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
package com.njcn.gather.detection.controller;
|
|
||||||
|
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
|
||||||
import com.njcn.web.controller.BaseController;
|
|
||||||
import com.njcn.web.utils.HttpResultUtil;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author wr
|
|
||||||
* @description
|
|
||||||
* @date 2024/12/10 14:25
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Api(tags = "守时检测")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/punctuality")
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class PunctualityController extends BaseController {
|
|
||||||
|
|
||||||
// private final PunctualityService punctualityService;
|
|
||||||
|
|
||||||
@OperateInfo
|
|
||||||
@PostMapping("/deliveryTime")
|
|
||||||
@ApiOperation("下发守时检测")
|
|
||||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
|
||||||
public HttpResult<?> list(@RequestBody Object param) {
|
|
||||||
String methodDescribe = getMethodDescribe("list");
|
|
||||||
// punctualityService.triggerTimeMark();
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -10,15 +10,15 @@ import com.njcn.gather.detection.pojo.vo.DevLineTestResult;
|
|||||||
import com.njcn.gather.detection.pojo.vo.SocketDataMsg;
|
import com.njcn.gather.detection.pojo.vo.SocketDataMsg;
|
||||||
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
||||||
import com.njcn.gather.detection.pojo.vo.WebSocketVO;
|
import com.njcn.gather.detection.pojo.vo.WebSocketVO;
|
||||||
import com.njcn.gather.detection.util.socket.MsgUtil;
|
import com.njcn.gather.detection.util.socket.*;
|
||||||
import com.njcn.gather.detection.util.socket.SocketManager;
|
|
||||||
import com.njcn.gather.detection.util.socket.cilent.NettyClient;
|
import com.njcn.gather.detection.util.socket.cilent.NettyClient;
|
||||||
import com.njcn.gather.detection.util.socket.cilent.NettyDevClientHandler;
|
import com.njcn.gather.detection.util.socket.cilent.NettyDevClientHandler;
|
||||||
import com.njcn.gather.detection.util.socket.web.WebSocketHandler;
|
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||||
import com.njcn.gather.device.device.pojo.vo.PreDetection;
|
import com.njcn.gather.device.service.IPqDevService;
|
||||||
import com.njcn.gather.device.device.service.IPqDevService;
|
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||||
import com.njcn.gather.device.script.pojo.po.SourceIssue;
|
import com.njcn.gather.system.pojo.enums.DicDataEnum;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -32,13 +32,17 @@ public class SocketSourceResponseService {
|
|||||||
/**
|
/**
|
||||||
* 向webSocket客户端发送消息
|
* 向webSocket客户端发送消息
|
||||||
*/
|
*/
|
||||||
private final WebSocketHandler webSocketHandler;
|
|
||||||
private final SocketDevResponseService socketDevResponseService;
|
private final SocketDevResponseService socketDevResponseService;
|
||||||
private final IPqDevService iPqDevService;
|
private final IPqDevService iPqDevService;
|
||||||
|
|
||||||
private final String DEV = "_Dev";
|
private final String DEV = "_Dev";
|
||||||
private final String source = "_Source";
|
private final String source = "_Source";
|
||||||
|
|
||||||
|
private final String stepTag = "&&";
|
||||||
|
private final String stepBegin = "_Start";
|
||||||
|
private final String stepEnd = "_End";
|
||||||
|
|
||||||
|
|
||||||
@Value("${socket.device.ip}")
|
@Value("${socket.device.ip}")
|
||||||
private String ip;
|
private String ip;
|
||||||
@@ -47,18 +51,23 @@ public class SocketSourceResponseService {
|
|||||||
private Integer port;
|
private Integer port;
|
||||||
|
|
||||||
private List<PreDetection> devList = new ArrayList<>();
|
private List<PreDetection> devList = new ArrayList<>();
|
||||||
|
private List<String> monitorIdList = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
public void deal(PreDetectionParam param, String msg) throws Exception {
|
public void deal(PreDetectionParam param, String msg) throws Exception {
|
||||||
SocketDataMsg socketDataMsg = MsgUtil.socketDataMsg(msg);
|
SocketDataMsg socketDataMsg = MsgUtil.socketDataMsg(msg);
|
||||||
String[] tem = socketDataMsg.getRequestId().split("&&");
|
String[] tem = socketDataMsg.getRequestId().split(stepTag);
|
||||||
SourceOperateCodeEnum enumByCode = SourceOperateCodeEnum.getDictDataEnumByCode(tem[0]);
|
SourceOperateCodeEnum enumByCode = SourceOperateCodeEnum.getDictDataEnumByCode(tem[0]);
|
||||||
if (ObjectUtil.isNotNull(enumByCode)) {
|
if (ObjectUtil.isNotNull(enumByCode)) {
|
||||||
switch (enumByCode) {
|
switch (enumByCode) {
|
||||||
//源初始化
|
//源初始化
|
||||||
case YJC_YTXJY:
|
case YJC_YTXJY:
|
||||||
|
if (ObjectUtil.isNotNull(param.getPlanId())) {
|
||||||
detectionDev(param, socketDataMsg);
|
detectionDev(param, socketDataMsg);
|
||||||
|
} else {
|
||||||
|
// 程控源-源通信校验
|
||||||
|
handleYtxjySimulate(param, socketDataMsg);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
//相序检测
|
//相序检测
|
||||||
case YJC_XUJY:
|
case YJC_XUJY:
|
||||||
@@ -66,26 +75,152 @@ public class SocketSourceResponseService {
|
|||||||
break;
|
break;
|
||||||
//正式检测
|
//正式检测
|
||||||
case FORMAL_REAL:
|
case FORMAL_REAL:
|
||||||
|
if (ObjectUtil.isNotNull(param.getPlanId())) {
|
||||||
senParamToDev(param, socketDataMsg);
|
senParamToDev(param, socketDataMsg);
|
||||||
|
} else {
|
||||||
|
handleSimulateTest(param, socketDataMsg);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
//系数校验
|
||||||
|
case Coefficient_Check:
|
||||||
|
coefficient(param, socketDataMsg);
|
||||||
break;
|
break;
|
||||||
case QUITE_SOURCE:
|
case QUITE_SOURCE:
|
||||||
quitDeal(socketDataMsg, param);
|
quitDeal(socketDataMsg, param);
|
||||||
// System.out.println("关闭源回调:"+msg);
|
|
||||||
break;
|
break;
|
||||||
|
case YXT:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
System.out.println("1");
|
System.out.println("fggggggggggggggggggggg" + enumByCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleYtxjySimulate(PreDetectionParam param, SocketDataMsg socketDataMsg) {
|
||||||
|
|
||||||
|
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
|
||||||
|
if (ObjectUtil.isNotNull(dictDataEnumByCode)) {
|
||||||
|
switch (dictDataEnumByCode) {
|
||||||
|
case SUCCESS:
|
||||||
|
if (param.getSendWebMsg()) {
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
}
|
||||||
|
System.out.println(param.getSendWebMsg() + "模拟检测-源初始化成功");
|
||||||
|
break;
|
||||||
|
case UNPROCESSED_BUSINESS:
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
break;
|
||||||
|
case SOURCE_CONNECTION_ERROR:
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
break;
|
||||||
|
case CONTROLLED_SOURCE_ERROR:
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
break;
|
||||||
|
case TEST_ITEM_PARSING_ERROR:
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
break;
|
||||||
|
case SOURCE_CONTROL_ERROR:
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
break;
|
||||||
|
case TARGET_SOURCE_ERROR:
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
break;
|
||||||
|
case NOT_INITIALIZED:
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
break;
|
||||||
|
case UNABLE_TO_RESPOND:
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
CnSocketUtil.sendUnSocket(param.getUserPageId());
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理模拟检测时,通信模块返回报文
|
||||||
|
*
|
||||||
|
* @param param
|
||||||
|
* @param socketDataMsg
|
||||||
|
*/
|
||||||
|
private void handleSimulateTest(PreDetectionParam param, SocketDataMsg socketDataMsg) {
|
||||||
|
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
|
||||||
|
if (ObjectUtil.isNotNull(dictDataEnumByCode)) {
|
||||||
|
switch (dictDataEnumByCode) {
|
||||||
|
case SUCCESS:
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
System.out.println("模拟检测-源成功执行脚本" + JSON.toJSONString(socketDataMsg));
|
||||||
|
break;
|
||||||
|
case UNPROCESSED_BUSINESS:
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
|
SocketMsg<String> socketMsg = new SocketMsg<>();
|
||||||
|
socketMsg.setRequestId(socketDataMsg.getRequestId());
|
||||||
|
socketMsg.setOperateCode(socketDataMsg.getOperateCode());
|
||||||
|
socketMsg.setData(dictDataEnumByCode.getMessage());
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketMsg));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系数校验源数据返回处理
|
||||||
|
*/
|
||||||
|
private void coefficient(PreDetectionParam param, SocketDataMsg socketDataMsg) {
|
||||||
|
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
|
||||||
|
if (ObjectUtil.isNotNull(dictDataEnumByCode)) {
|
||||||
|
SocketMsg<String> socketMsg = new SocketMsg<>();
|
||||||
|
switch (dictDataEnumByCode) {
|
||||||
|
case SUCCESS:
|
||||||
|
//向前端推送信息
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
|
||||||
|
String s = param.getUserPageId() + DEV;
|
||||||
|
socketMsg.setRequestId(SourceOperateCodeEnum.Coefficient_Check.getValue());
|
||||||
|
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_02.getValue());
|
||||||
|
DevPhaseSequenceParam phaseSequenceParam = new DevPhaseSequenceParam();
|
||||||
|
phaseSequenceParam.setMoniterIdList(monitorIdList);
|
||||||
|
phaseSequenceParam.setDataType(Arrays.asList("real$VRMS", "real$IRMS"));
|
||||||
|
// 读取3次数据用于系数计算
|
||||||
|
phaseSequenceParam.setReadCount(7); //3
|
||||||
|
// 忽略前4次数据,等待测量稳定
|
||||||
|
phaseSequenceParam.setIgnoreCount(3); //4
|
||||||
|
socketMsg.setData(JSON.toJSONString(phaseSequenceParam));
|
||||||
|
SocketManager.sendMsg(s, JSON.toJSONString(socketMsg));
|
||||||
|
|
||||||
|
break;
|
||||||
|
case UNPROCESSED_BUSINESS:
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
|
socketMsg.setRequestId(socketDataMsg.getRequestId());
|
||||||
|
socketMsg.setOperateCode(socketDataMsg.getOperateCode());
|
||||||
|
socketMsg.setData(dictDataEnumByCode.getMessage());
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketMsg));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 装置检测(当源初始化成功后,直接向装置通道向装置服务器发送,装置检测)
|
* 装置检测(当源初始化成功后,直接向装置通道向装置服务器发送,装置检测)
|
||||||
*
|
*
|
||||||
* @param param
|
* @param param 参数
|
||||||
* @param socketDataMsg
|
* @param socketDataMsg 消息
|
||||||
*/
|
*/
|
||||||
private void detectionDev(PreDetectionParam param, SocketDataMsg socketDataMsg) {
|
private void detectionDev(PreDetectionParam param, SocketDataMsg socketDataMsg) {
|
||||||
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
|
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
|
||||||
@@ -94,31 +229,58 @@ public class SocketSourceResponseService {
|
|||||||
|
|
||||||
switch (dictDataEnumByCode) {
|
switch (dictDataEnumByCode) {
|
||||||
case SUCCESS:
|
case SUCCESS:
|
||||||
|
|
||||||
//todo 前端推送收到的消息暂未处理好
|
//todo 前端推送收到的消息暂未处理好
|
||||||
webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
String s = param.getUserPageId() + DEV;
|
String s = param.getUserPageId() + DEV;
|
||||||
//开始设备通讯检测(发送设备初始化)
|
//开始设备通讯检测(发送设备初始化)
|
||||||
List<PreDetection> devList = iPqDevService.getDevInfo(param.getDevIds());
|
//List<PreDetection> devList = iPqDevService.getDevInfo(param.getDevIds());
|
||||||
Map<String, List<PreDetection>> map = new HashMap(1);
|
Map<String, List<PreDetection>> map = new HashMap<>(1);
|
||||||
map.put("deviceList", devList);
|
map.put("deviceList", FormalTestManager.devList);
|
||||||
String jsonString = JSON.toJSONString(map);
|
String jsonString = JSON.toJSONString(map);
|
||||||
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_SBTXJY.getValue());
|
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_SBTXJY.getValue());
|
||||||
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_INIT_GATHER_01.getValue());
|
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_INIT_GATHER_01.getValue());
|
||||||
socketMsg.setData(jsonString);
|
socketMsg.setData(jsonString);
|
||||||
String json = JSON.toJSONString(socketMsg);
|
String json = JSON.toJSONString(socketMsg);
|
||||||
// SocketManager.sendMsg(s,json);
|
// SocketManager.sendMsg(s,json);
|
||||||
NettyClient.socketClient(ip, port, param.getUserPageId(), json, new NettyDevClientHandler(param, socketDevResponseService));
|
NettyClient.socketClient(ip, port, param, json, new NettyDevClientHandler(param, socketDevResponseService));
|
||||||
break;
|
break;
|
||||||
case UNPROCESSED_BUSINESS:
|
case UNPROCESSED_BUSINESS:
|
||||||
webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
break;
|
||||||
|
case SOURCE_CONNECTION_ERROR:
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
break;
|
||||||
|
case CONTROLLED_SOURCE_ERROR:
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
break;
|
||||||
|
case TEST_ITEM_PARSING_ERROR:
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
break;
|
||||||
|
case SOURCE_CONTROL_ERROR:
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
break;
|
||||||
|
case TARGET_SOURCE_ERROR:
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
break;
|
||||||
|
case NOT_INITIALIZED:
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
break;
|
||||||
|
case UNKNOWN_ERROR:
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
break;
|
||||||
|
case UNABLE_TO_RESPOND:
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
socketMsg = new SocketMsg<>();
|
CnSocketUtil.sendUnSocket(param.getUserPageId());
|
||||||
socketMsg.setRequestId(socketDataMsg.getRequestId());
|
|
||||||
socketMsg.setOperateCode(socketDataMsg.getOperateCode());
|
|
||||||
socketMsg.setData(dictDataEnumByCode.getMessage());
|
|
||||||
webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(socketMsg));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,11 +295,11 @@ public class SocketSourceResponseService {
|
|||||||
private void phaseSequenceDev(PreDetectionParam param, SocketDataMsg socketDataMsg) {
|
private void phaseSequenceDev(PreDetectionParam param, SocketDataMsg socketDataMsg) {
|
||||||
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
|
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
|
||||||
if (ObjectUtil.isNotNull(dictDataEnumByCode)) {
|
if (ObjectUtil.isNotNull(dictDataEnumByCode)) {
|
||||||
SocketMsg<String> socketMsg = new SocketMsg();
|
SocketMsg<String> socketMsg = new SocketMsg<>();
|
||||||
switch (dictDataEnumByCode) {
|
switch (dictDataEnumByCode) {
|
||||||
case SUCCESS:
|
case SUCCESS:
|
||||||
//向前端推送信息
|
//向前端推送信息
|
||||||
webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
|
||||||
String s = param.getUserPageId() + DEV;
|
String s = param.getUserPageId() + DEV;
|
||||||
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_XUJY.getValue());
|
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_XUJY.getValue());
|
||||||
@@ -146,29 +308,33 @@ public class SocketSourceResponseService {
|
|||||||
List<String> moniterIdList = pqDevList.stream().flatMap(x -> x.getMonitorList().stream())
|
List<String> moniterIdList = pqDevList.stream().flatMap(x -> x.getMonitorList().stream())
|
||||||
.map(PreDetection.MonitorListDTO::getLineId)
|
.map(PreDetection.MonitorListDTO::getLineId)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
DevPhaseSequenceParam phaseSequenceParam = new DevPhaseSequenceParam();
|
DevPhaseSequenceParam phaseSequenceParam = new DevPhaseSequenceParam();
|
||||||
phaseSequenceParam.setMoniterIdList(moniterIdList);
|
phaseSequenceParam.setMoniterIdList(moniterIdList);
|
||||||
phaseSequenceParam.setDataType(Arrays.asList("实时数据/电压有效值", "实时数据/电流有效值"));
|
phaseSequenceParam.setDataType(Arrays.asList("real$VRMS", "real$VA", "real$IRMS", "real$IA"));
|
||||||
phaseSequenceParam.setReadCount(1);
|
phaseSequenceParam.setReadCount(1);
|
||||||
phaseSequenceParam.setIgnoreCount(10);
|
phaseSequenceParam.setIgnoreCount(10);
|
||||||
socketMsg.setData(JSON.toJSONString(phaseSequenceParam));
|
socketMsg.setData(JSON.toJSONString(phaseSequenceParam));
|
||||||
SocketManager.sendMsg(s, JSON.toJSONString(socketMsg));
|
SocketManager.sendMsg(s, JSON.toJSONString(socketMsg));
|
||||||
break;
|
break;
|
||||||
case UNPROCESSED_BUSINESS:
|
case UNPROCESSED_BUSINESS:
|
||||||
webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
|
break;
|
||||||
|
case MESSAGE_PARSING_ERROR:
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
socketMsg.setRequestId(socketDataMsg.getRequestId());
|
socketMsg.setRequestId(socketDataMsg.getRequestId());
|
||||||
socketMsg.setOperateCode(socketDataMsg.getOperateCode());
|
socketMsg.setOperateCode(socketDataMsg.getOperateCode());
|
||||||
socketMsg.setData(dictDataEnumByCode.getMessage());
|
socketMsg.setData(dictDataEnumByCode.getMessage());
|
||||||
webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(socketMsg));
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketMsg));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组装和装置要数据
|
* 组装和装置要数据
|
||||||
*
|
*
|
||||||
@@ -186,25 +352,40 @@ public class SocketSourceResponseService {
|
|||||||
|
|
||||||
String s = param.getUserPageId() + DEV;
|
String s = param.getUserPageId() + DEV;
|
||||||
SourceIssue sourceIssue = SocketManager.getSourceList().get(0);
|
SourceIssue sourceIssue = SocketManager.getSourceList().get(0);
|
||||||
String comm = sourceIssue.getDevValueTypeList().get(0);
|
List<String> comm = sourceIssue.getDevValueTypeList(); //形如:类型&小项code这种形式。例如:real$VRMS、real$IRMS
|
||||||
|
System.out.println("向装置下发的参数>>>>>>>>" + comm);
|
||||||
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue()+"&&"+sourceIssue.getType());
|
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + stepTag + sourceIssue.getType());
|
||||||
|
int ignoreCount;
|
||||||
|
int readData;
|
||||||
|
if (DicDataEnum.F.getCode().equals(sourceIssue.getType())) {
|
||||||
|
ignoreCount = 1;
|
||||||
|
readData = 2;
|
||||||
|
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_01.getValue());
|
||||||
|
} else if (DicDataEnum.VOLTAGE.getCode().equals(sourceIssue.getType())) {
|
||||||
|
ignoreCount = 5;
|
||||||
|
readData = 1;
|
||||||
|
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_03.getValue());
|
||||||
|
} else {
|
||||||
|
ignoreCount = 5;
|
||||||
|
readData = 5;
|
||||||
|
//区分实时数据还是分钟数据
|
||||||
|
if ("real".equals(sourceIssue.getDataType())) {
|
||||||
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_02.getValue());
|
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_02.getValue());
|
||||||
List<String> moniterIdList = devList.stream().flatMap(x -> x.getMonitorList().stream()).map(PreDetection.MonitorListDTO::getLineId).collect(Collectors.toList());
|
} else {
|
||||||
DevPhaseSequenceParam phaseSequenceParam = new DevPhaseSequenceParam();
|
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_01.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("devList is empty:" + CollectionUtils.isEmpty(devList));
|
||||||
|
|
||||||
System.out.println("向装置下发的参数"+comm);
|
//List<String> moniterIdList = devList.stream().flatMap(x -> x.getMonitorList().stream()).map(PreDetection.MonitorListDTO::getLineId).collect(Collectors.toList());
|
||||||
phaseSequenceParam.setMoniterIdList(moniterIdList);
|
DevPhaseSequenceParam phaseSequenceParam = new DevPhaseSequenceParam();
|
||||||
phaseSequenceParam.setDataType(Arrays.asList(comm));
|
phaseSequenceParam.setMoniterIdList(monitorIdList);
|
||||||
phaseSequenceParam.setReadCount(2);
|
phaseSequenceParam.setDataType(comm);
|
||||||
phaseSequenceParam.setIgnoreCount(10);
|
phaseSequenceParam.setReadCount(readData);
|
||||||
|
phaseSequenceParam.setIgnoreCount(ignoreCount);
|
||||||
socketMsg.setData(JSON.toJSONString(phaseSequenceParam));
|
socketMsg.setData(JSON.toJSONString(phaseSequenceParam));
|
||||||
SocketManager.sendMsg(s, JSON.toJSONString(socketMsg));
|
SocketManager.sendMsg(s, JSON.toJSONString(socketMsg));
|
||||||
|
|
||||||
|
|
||||||
//告诉前端当前项开始了
|
|
||||||
WebSocketVO<List<DevLineTestResult>> webSocketVO = new WebSocketVO<>();
|
|
||||||
webSocketVO.setRequestId(socketDataMsg.getRequestId().split("&&")[1]+"_Start");
|
|
||||||
List<DevLineTestResult> devListRes = new ArrayList<>();
|
List<DevLineTestResult> devListRes = new ArrayList<>();
|
||||||
devList.forEach(item -> {
|
devList.forEach(item -> {
|
||||||
DevLineTestResult devLineTestResult = new DevLineTestResult();
|
DevLineTestResult devLineTestResult = new DevLineTestResult();
|
||||||
@@ -212,18 +393,22 @@ public class SocketSourceResponseService {
|
|||||||
devLineTestResult.setDeviceName(item.getDevName());
|
devLineTestResult.setDeviceName(item.getDevName());
|
||||||
devListRes.add(devLineTestResult);
|
devListRes.add(devLineTestResult);
|
||||||
});
|
});
|
||||||
webSocketVO.setData(devListRes);
|
|
||||||
webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(webSocketVO));
|
|
||||||
|
|
||||||
|
WebSocketVO<Object> webSocketVO = new WebSocketVO<>();
|
||||||
|
webSocketVO.setRequestId(socketDataMsg.getRequestId().split(stepTag)[1] + stepBegin);
|
||||||
|
webSocketVO.setDesc(SocketManager.getSourceList().get(0).getDesc());
|
||||||
|
webSocketVO.setData(devListRes);
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(webSocketVO));
|
||||||
break;
|
break;
|
||||||
case UNPROCESSED_BUSINESS:
|
case UNPROCESSED_BUSINESS:
|
||||||
webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
socketMsg.setRequestId(socketDataMsg.getRequestId());
|
socketMsg.setRequestId(socketDataMsg.getRequestId());
|
||||||
socketMsg.setOperateCode(socketDataMsg.getOperateCode());
|
socketMsg.setOperateCode(socketDataMsg.getOperateCode());
|
||||||
socketMsg.setData(dictDataEnumByCode.getMessage());
|
socketMsg.setData(dictDataEnumByCode.getMessage());
|
||||||
webSocketHandler.sendMsgToUser(param.getUserPageId(), JSON.toJSONString(socketMsg));
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketMsg));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -235,20 +420,22 @@ public class SocketSourceResponseService {
|
|||||||
*/
|
*/
|
||||||
private void quitDeal(SocketDataMsg socketDataMsg, PreDetectionParam param) {
|
private void quitDeal(SocketDataMsg socketDataMsg, PreDetectionParam param) {
|
||||||
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
|
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
|
||||||
SourceOperateCodeEnum operateCodeEnum = SourceOperateCodeEnum.getDictDataEnumByCode(socketDataMsg.getOperateCode());
|
switch (Objects.requireNonNull(dictDataEnumByCode)) {
|
||||||
SocketMsg socketMsg = new SocketMsg();
|
|
||||||
switch (dictDataEnumByCode) {
|
|
||||||
case SUCCESS:
|
case SUCCESS:
|
||||||
//通讯校验成功
|
//通讯校验成功
|
||||||
SocketManager.removeUser(param.getUserPageId() + source);
|
SocketManager.removeUser(param.getUserPageId() + source);
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
break;
|
break;
|
||||||
case UNPROCESSED_BUSINESS:
|
case UNPROCESSED_BUSINESS:
|
||||||
break;
|
break;
|
||||||
case MESSAGE_PARSING_ERROR:
|
case MESSAGE_PARSING_ERROR:
|
||||||
|
SocketManager.removeUser(param.getUserPageId() + source);
|
||||||
|
break;
|
||||||
|
case UNABLE_TO_RESPOND:
|
||||||
|
SocketManager.removeUser(param.getUserPageId() + source);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
WebSocketVO webSocketVO = new WebSocketVO();
|
CnSocketUtil.quitSendSource(param);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,7 +444,12 @@ public class SocketSourceResponseService {
|
|||||||
|
|
||||||
public void initList(PreDetectionParam param) {
|
public void initList(PreDetectionParam param) {
|
||||||
devList.clear();
|
devList.clear();
|
||||||
|
monitorIdList.clear();
|
||||||
this.devList = iPqDevService.getDevInfo(param.getDevIds());
|
this.devList = iPqDevService.getDevInfo(param.getDevIds());
|
||||||
|
this.monitorIdList = devList.stream().flatMap(x -> x.getMonitorList().stream())
|
||||||
|
.map(PreDetection.MonitorListDTO::getLineId)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
XiNumberManager.xiDevList = devList;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.njcn.gather.detection.pojo.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通信相关的常量
|
||||||
|
*
|
||||||
|
* @author hongawen
|
||||||
|
* @version 1.0
|
||||||
|
* @data 2025/4/15 14:11
|
||||||
|
*/
|
||||||
|
public interface DetectionCommunicateConstant {
|
||||||
|
|
||||||
|
String SOURCE_CHANNEL_NAME = "AUTO_DETECTION_SOURCE";
|
||||||
|
|
||||||
|
String DEVICE_CHANNEL_NAME = "AUTO_DETECTION_DEV";
|
||||||
|
|
||||||
|
String DEV = "_Dev";
|
||||||
|
|
||||||
|
String SOURCE = "_Source";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package com.njcn.gather.detection.pojo.dto;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2025-01-04
|
||||||
|
* @Description: 给装置下发的系数
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DevXiNumData {
|
||||||
|
|
||||||
|
private String devIP;
|
||||||
|
|
||||||
|
private Integer chnNum;
|
||||||
|
|
||||||
|
private List<GF> gf;
|
||||||
|
|
||||||
|
private Integer resultFlag;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class GF{
|
||||||
|
|
||||||
|
private Integer uMonitorPoint;
|
||||||
|
|
||||||
|
private F f;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class F{
|
||||||
|
|
||||||
|
private Integer count;
|
||||||
|
|
||||||
|
@JSONField(name = "Ua_gain", ordinal = 1)
|
||||||
|
private Integer Ua_gain;
|
||||||
|
@JSONField(name = "Ub_gain", ordinal = 2)
|
||||||
|
private Integer Ub_gain;
|
||||||
|
@JSONField(name = "Uc_gain", ordinal = 3)
|
||||||
|
private Integer Uc_gain;
|
||||||
|
@JSONField(name = "U0_gain", ordinal = 4)
|
||||||
|
private Integer U0_gain;
|
||||||
|
|
||||||
|
@JSONField(name = "Ia_gain", ordinal = 5)
|
||||||
|
private Integer Ia_gain;
|
||||||
|
@JSONField(name = "Ib_gain", ordinal = 6)
|
||||||
|
private Integer Ib_gain;
|
||||||
|
@JSONField(name = "Ic_gain", ordinal = 7)
|
||||||
|
private Integer Ic_gain;
|
||||||
|
@JSONField(name = "I0_gain", ordinal = 8)
|
||||||
|
private Integer I0_gain;
|
||||||
|
|
||||||
|
@JSONField(name = "Uab_gain", ordinal = 9)
|
||||||
|
private Integer Uab_gain;
|
||||||
|
@JSONField(name = "Ubc_gain", ordinal = 10)
|
||||||
|
private Integer Ubc_gain;
|
||||||
|
@JSONField(name = "Uca_gain", ordinal = 11)
|
||||||
|
private Integer Uca_gain;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package com.njcn.gather.detection.pojo.enums;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2025/2/12 10:15
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum DetectionCodeEnum {
|
||||||
|
|
||||||
|
FREQ("FREQ", "频率"),
|
||||||
|
VRMS("VRMS", "相电压有效值"),
|
||||||
|
DELTA_V("DELTA_V", "电压偏差"),
|
||||||
|
VA("VA", "电压相角"),
|
||||||
|
U1("U1", "基波电压"),
|
||||||
|
V2_50("V2-50", "谐波电压"),
|
||||||
|
I2_50("I2-50", "谐波电流"),
|
||||||
|
P2_50("P2-50", "谐波有功功率"),
|
||||||
|
SV_1_49("SV_1-49", "间谐波电压"),
|
||||||
|
SI_1_49("SI_1-49", "间谐波电流"),
|
||||||
|
MAG("MAG", "电压幅值"),
|
||||||
|
DUR("DUR", "持续时间"),
|
||||||
|
IRMS("IRMS", "电流有效值"),
|
||||||
|
IA("IA", "电流相角"),
|
||||||
|
V_UNBAN("V_UNBAN", "三相电压负序不平衡度"),
|
||||||
|
I_UNBAN("I_UNBAN", "三相电流负序不平衡度"),
|
||||||
|
PST("PST", "短时间闪变"),
|
||||||
|
P("P", "功率"),
|
||||||
|
|
||||||
|
|
||||||
|
I1("I1", "基波电流"),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
UNKNOWN_ERROR("-1", "未知异常"),
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
private final String code;
|
||||||
|
private final String message;
|
||||||
|
|
||||||
|
DetectionCodeEnum(String code, String message) {
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
public static DetectionCodeEnum getDetectionCodeByCode(String code) {
|
||||||
|
for (DetectionCodeEnum detectionCodeEnum : DetectionCodeEnum.values()) {
|
||||||
|
if (ObjectUtil.equals(code, detectionCodeEnum.getCode())) {
|
||||||
|
return detectionCodeEnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return UNKNOWN_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,13 +9,18 @@ import lombok.Getter;
|
|||||||
@Getter
|
@Getter
|
||||||
public enum DetectionResponseEnum {
|
public enum DetectionResponseEnum {
|
||||||
PLAN_PATTERN_NOT("A020001", "计划模式查询为空"),
|
PLAN_PATTERN_NOT("A020001", "计划模式查询为空"),
|
||||||
|
SCRIPT_PATTERN_NOT("A020001", "检测脚本查询为空"),
|
||||||
SOURCE_INFO_NOT("A020002", "源表信息不存在"),
|
SOURCE_INFO_NOT("A020002", "源表信息不存在"),
|
||||||
PLAN_AND_SOURCE_NOT("A020003", "计划和源关系不存在")
|
PLAN_AND_SOURCE_NOT("A020003", "计划和源关系不存在"),
|
||||||
|
ITEM_TEST_NOT("A020004", "检测项为空"),
|
||||||
|
PLAN_DEV_IP_HAS("A20005","当前计划检测装置ip重复"),
|
||||||
|
SOURCE_NOT_CONNECT("A020006", "源未连接"),
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
private String code;
|
SCRIPT_CHECK_DATA_NOT_EXIST("A020040","测试脚本项暂无配置" );
|
||||||
private String message;
|
|
||||||
|
private final String code;
|
||||||
|
private final String message;
|
||||||
|
|
||||||
DetectionResponseEnum(String code, String message) {
|
DetectionResponseEnum(String code, String message) {
|
||||||
this.code = code;
|
this.code = code;
|
||||||
|
|||||||
@@ -35,35 +35,71 @@ public enum SourceOperateCodeEnum {
|
|||||||
QUIT_INIT_03("QUIT_FUNEND$03", "关闭暂态申请"),
|
QUIT_INIT_03("QUIT_FUNEND$03", "关闭暂态申请"),
|
||||||
|
|
||||||
|
|
||||||
|
DATA_CHNFACTOR$01("DATA_CHNFACTOR$01","校验系数获取"),
|
||||||
|
DATA_CHNFACTOR$02("DATA_CHNFACTOR$02","校验系数下发"),
|
||||||
|
|
||||||
|
VERIFY_MAPPING$01("VERIFY_MAPPING$01","脚本与icd校验"),
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求操作类型对应实体中 requestId
|
* 请求操作类型对应实体中 requestId
|
||||||
*/
|
*/
|
||||||
YJC_YTXJY("yjc_ytxjy", "预检测_源通讯检测"),
|
YJC_YTXJY("yjc_ytxjy", "源通讯检测"),
|
||||||
YJC_SBTXJY("yjc_sbtxjy", "预检测_设备通讯检测"),
|
YJC_SBTXJY("yjc_sbtxjy", "设备通讯检测"),
|
||||||
YJC_XYJY("yjc_xyjy", "预检测_协议校验"),
|
YJC_XYJY("yjc_xyjy", "协议校验"),
|
||||||
YJC_XUJY("YJC_xujy", "预检测_相序校验"),
|
YJC_XUJY("YJC_xujy", "相序校验"),
|
||||||
|
FORMAL_REAL("formal_real","正式检测"),
|
||||||
|
// SIMULATE_REAL("simulate_real","模拟检测"),
|
||||||
|
Coefficient_Check("Coefficient_Check","系数校验"),
|
||||||
|
QUITE("quit","关闭设备通讯初始化"),
|
||||||
|
QUITE_SOURCE("close_source","关闭源通讯"),
|
||||||
|
ERROR_FLOW_END("error_flow_end","当前流程存在异常结束"),
|
||||||
|
YXT("yxt","心跳"),
|
||||||
|
REPORT_CAT("FTP_SEND$01","处理报告"),
|
||||||
|
|
||||||
FORMAL_REAL("formal_real","正式检测_获取实时数据"),
|
UNKNOWN_OPERATE("unknown_operate","未知的操作返回,请联系管理员排查"),
|
||||||
FORMAL_STATISTIC("formal_statistic","正式检测_获取统计数据"),
|
SOCKET_TIMEOUT("socket_timeout","与源或者装置通讯等待超时"),
|
||||||
FORMAL_EVENT("formal_event","正式检测_获取暂态数据"),
|
STOP_TIMEOUT("stop_timeout","暂停时间超过十分钟"),
|
||||||
|
SERVER_ERROR("server_error","服务端主动关闭连接,请稍后再试"),
|
||||||
QUITE("quit","预监测_关闭设备通讯初始化"),
|
DEVICE_ERROR("device_error","设备主动关闭连接,请稍后再试"),
|
||||||
QUITE_SOURCE("close_source","预监测_关闭源通讯"),
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PRE_TEST("0","预检测"),
|
|
||||||
FORMAL_TEST("1","正式检测"),
|
|
||||||
TIME_TEST("2","守时检测"),
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检测类型
|
*
|
||||||
*/
|
*/
|
||||||
Test_Freq("formal_real&&Test_Freq","频率检测"),
|
// COEFFICIENT_TEST("0","系数校验"),
|
||||||
Test_VOL("formal_real&&Test_VOL","电压检测"),
|
// PRE_TEST("1","预检测"),
|
||||||
|
// FORMAL_TEST("2","正式检测"),
|
||||||
|
// TIME_TEST("3","守时检测"),
|
||||||
|
// PHASE_TEST("4","相序检测"),
|
||||||
|
// TEST_TEM_STOP("5","临时停止"),
|
||||||
|
ALL_TEST("1","全部检测"),
|
||||||
|
RE_ERROR_TEST("2","不合格项复检"),
|
||||||
|
TEST_TEM_START("3","继续检测"),
|
||||||
|
SIMULATE_TEST("4","模拟检测"),
|
||||||
|
//TEST_STOP("7","停止检测"),
|
||||||
|
//FAST_TEST("10","一键检测"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系数校验步骤
|
||||||
|
*/
|
||||||
|
big_start("big_start","大电压系数下装开始"),
|
||||||
|
big_end("big_end","大电压系数下装结束"),
|
||||||
|
small_start("small_start","小电压系数下装开始"),
|
||||||
|
small_end("small_end","小电压系数下装结束"),
|
||||||
|
big_comp_start("big_comp_start","大电压校准开始"),
|
||||||
|
big_comp_end("big_comp_end","大电压校准结束"),
|
||||||
|
small_comp_start("small_comp_start","小电压校准开始"),
|
||||||
|
small_comp_end("small_comp_end","小电压校准结束"),
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ftp文件传送指令
|
||||||
|
*/
|
||||||
|
FTP_SEND_01("FTP_SEND$01", "发送文件")
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public enum SourceResponseCodeEnum {
|
|||||||
SUCCESS(10200, "请求成功"),
|
SUCCESS(10200, "请求成功"),
|
||||||
UNPROCESSED_BUSINESS(10201, "立即响应,业务还未处理,类似肯定应答"),
|
UNPROCESSED_BUSINESS(10201, "立即响应,业务还未处理,类似肯定应答"),
|
||||||
NORMAL_RESPONSE(10202, "正常响应中间状态码"),
|
NORMAL_RESPONSE(10202, "正常响应中间状态码"),
|
||||||
|
ICD_NOT_FOUND(10500, "未找到对应ICD"),
|
||||||
MESSAGE_PARSING_ERROR(10520, "报文解析有误"),
|
MESSAGE_PARSING_ERROR(10520, "报文解析有误"),
|
||||||
CONTROLLED_SOURCE_ERROR(10521, "程控源参数有误"),
|
CONTROLLED_SOURCE_ERROR(10521, "程控源参数有误"),
|
||||||
TEST_ITEM_PARSING_ERROR(10522, "测试项解析有误"),
|
TEST_ITEM_PARSING_ERROR(10522, "测试项解析有误"),
|
||||||
@@ -23,6 +24,7 @@ public enum SourceResponseCodeEnum {
|
|||||||
NOT_INITIALIZED(10527, "源未进行初始化"),
|
NOT_INITIALIZED(10527, "源未进行初始化"),
|
||||||
TARGET_SOURCE_ERROR(10528, "目标源有误(该用户已控制其他源,在关闭前无法操作新的源)"),
|
TARGET_SOURCE_ERROR(10528, "目标源有误(该用户已控制其他源,在关闭前无法操作新的源)"),
|
||||||
UNABLE_TO_RESPOND(10529, "源状态有误,无法响应报文(例如源处于输出状态,无法响应初始化报文)"),
|
UNABLE_TO_RESPOND(10529, "源状态有误,无法响应报文(例如源处于输出状态,无法响应初始化报文)"),
|
||||||
|
UNKNOWN_ERROR(-1, "未知异常"),
|
||||||
|
|
||||||
|
|
||||||
//通讯模块
|
//通讯模块
|
||||||
@@ -35,7 +37,9 @@ public enum SourceResponseCodeEnum {
|
|||||||
|
|
||||||
//自定义前端展示消息
|
//自定义前端展示消息
|
||||||
SOCKET_ERROR(25000,"服务端连接失败"),
|
SOCKET_ERROR(25000,"服务端连接失败"),
|
||||||
DEV_COMM_ALL_SUCCESS(25001,"校验成功")
|
DEV_COMM_ALL_SUCCESS(25001,"校验成功"),
|
||||||
|
DEV_COMM_TEST_FAIL(25002,"设备通讯校验失败"),
|
||||||
|
PHASE_CHECK_FAIL(25003,"相序校验未通过"),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package com.njcn.gather.detection.pojo.param;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -12,16 +14,20 @@ import java.util.List;
|
|||||||
@Data
|
@Data
|
||||||
public class PreDetectionParam {
|
public class PreDetectionParam {
|
||||||
|
|
||||||
/**
|
private String operateType;
|
||||||
* 操作类型 0.预检测 1.正式检测
|
|
||||||
*/
|
|
||||||
private String operateType = "0";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检测计划id
|
* 检测计划id
|
||||||
*/
|
*/
|
||||||
|
@NotBlank(message = "计划id不可为空")
|
||||||
private String planId;
|
private String planId;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数字、模拟、比对
|
||||||
|
*/
|
||||||
|
private String pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户功能组成唯一标识 zhangsan_test
|
* 用户功能组成唯一标识 zhangsan_test
|
||||||
*/
|
*/
|
||||||
@@ -30,6 +36,7 @@ public class PreDetectionParam {
|
|||||||
/**
|
/**
|
||||||
* 检测终端id集合
|
* 检测终端id集合
|
||||||
*/
|
*/
|
||||||
|
@NotEmpty(message = "装置不能为空")
|
||||||
private List<String> devIds;
|
private List<String> devIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,4 +53,28 @@ public class PreDetectionParam {
|
|||||||
* 所属误差体系
|
* 所属误差体系
|
||||||
*/
|
*/
|
||||||
private String errorSysId;
|
private String errorSysId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自动生成,用于生成数据表后缀
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
private Boolean sendWebMsg;
|
||||||
|
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 温度
|
||||||
|
*/
|
||||||
|
private Float temperature;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 相对湿度
|
||||||
|
*/
|
||||||
|
private Float humidity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测项列表。第一个元素为预检测、第二个元素为系数校准、第三个元素为正式检测
|
||||||
|
*/
|
||||||
|
private List<Boolean> testItemList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.njcn.gather.detection.pojo.param;
|
||||||
|
|
||||||
|
import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2025-03-06
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SimulateDetectionParam {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作类型 9.模拟检测
|
||||||
|
*/
|
||||||
|
private String operateType = "9";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户功能组成唯一标识 zhangsan_test
|
||||||
|
*/
|
||||||
|
private String userPageId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测脚本Id
|
||||||
|
*/
|
||||||
|
private String scriptId;
|
||||||
|
|
||||||
|
@NotNull(message = DetectionValidMessage.INDEX_NOT_NULL)
|
||||||
|
private Integer scriptIndex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 源id
|
||||||
|
*/
|
||||||
|
@NotBlank(message = DetectionValidMessage.SOURCE_ID_NOT_BLANK)
|
||||||
|
private String sourceId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.njcn.gather.detection.pojo.po;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2025-04-10
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
public class IcdCheckData {
|
||||||
|
|
||||||
|
private String icdType;
|
||||||
|
|
||||||
|
private List<ResultData> resultData;
|
||||||
|
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
public static class ResultData {
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
private String desc;
|
||||||
|
|
||||||
|
private DevData.SqlDataDTO.ListDTO phaseResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
package com.njcn.gather.detection.pojo.vo;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2025-01-04
|
||||||
|
* @Description: 系数校准前端返回实体
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CoefficientVO {
|
||||||
|
|
||||||
|
@JSONField(name = "type", ordinal = 0)
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@JSONField(name = "devName", ordinal = 1)
|
||||||
|
private String devName;
|
||||||
|
|
||||||
|
@JSONField(name = "monitorNum", ordinal = 2)
|
||||||
|
private String monitorNum;
|
||||||
|
|
||||||
|
@JSONField(name = "desc", ordinal = 3)
|
||||||
|
private String desc;
|
||||||
|
|
||||||
|
|
||||||
|
@JSONField(name = "aVuData", ordinal = 4)
|
||||||
|
private String aVuData;
|
||||||
|
|
||||||
|
@JSONField(name = "aVuXi", ordinal = 5)
|
||||||
|
private String aVuXi;
|
||||||
|
|
||||||
|
@JSONField(name = "bVuData", ordinal = 6)
|
||||||
|
private String bVuData;
|
||||||
|
|
||||||
|
@JSONField(name = "bVuXi", ordinal = 7)
|
||||||
|
private String bVuXi;
|
||||||
|
|
||||||
|
@JSONField(name = "cVuData", ordinal = 8)
|
||||||
|
private String cVuData;
|
||||||
|
|
||||||
|
@JSONField(name = "cVuXi", ordinal = 9)
|
||||||
|
private String cVuXi;
|
||||||
|
|
||||||
|
@JSONField(name = "aIeData", ordinal = 10)
|
||||||
|
private String aIeData;
|
||||||
|
|
||||||
|
@JSONField(name = "aIeXi", ordinal = 11)
|
||||||
|
private String aIeXi;
|
||||||
|
|
||||||
|
@JSONField(name = "bIeData", ordinal = 12)
|
||||||
|
private String bIeData;
|
||||||
|
|
||||||
|
@JSONField(name = "bIeXi", ordinal = 13)
|
||||||
|
private String bIeXi;
|
||||||
|
|
||||||
|
@JSONField(name = "cIeData", ordinal = 14)
|
||||||
|
private String cIeData;
|
||||||
|
|
||||||
|
@JSONField(name = "cIeXi", ordinal = 15)
|
||||||
|
private String cIeXi;
|
||||||
|
|
||||||
|
|
||||||
|
@JSONField(name = "aV", ordinal = 16)
|
||||||
|
private String aV;
|
||||||
|
|
||||||
|
@JSONField(name = "bV", ordinal = 17)
|
||||||
|
private String bV;
|
||||||
|
|
||||||
|
@JSONField(name = "cV", ordinal = 18)
|
||||||
|
private String cV;
|
||||||
|
|
||||||
|
@JSONField(name = "aI", ordinal = 19)
|
||||||
|
private String aI;
|
||||||
|
|
||||||
|
@JSONField(name = "bI", ordinal = 20)
|
||||||
|
private String bI;
|
||||||
|
|
||||||
|
@JSONField(name = "cI", ordinal = 21)
|
||||||
|
private String cI;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标识校验不合格的为 0 合格项为 1
|
||||||
|
*/
|
||||||
|
private Integer resultFlag;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class DevParameter{
|
||||||
|
|
||||||
|
private Double devVolt;
|
||||||
|
|
||||||
|
private Double devCurr;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,8 @@ package com.njcn.gather.detection.pojo.vo;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wr
|
* @author wr
|
||||||
* @description
|
* @description
|
||||||
@@ -18,7 +20,7 @@ public class DetectionData {
|
|||||||
private Double num;
|
private Double num;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否是符合数据
|
* 1.合格 2.不合格 3.网络超时 4.无法处理 5.不参与误差比较
|
||||||
*/
|
*/
|
||||||
private Integer isData;
|
private Integer isData;
|
||||||
|
|
||||||
@@ -32,5 +34,18 @@ public class DetectionData {
|
|||||||
*/
|
*/
|
||||||
private Double resultData;
|
private Double resultData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 误差范围
|
||||||
|
*/
|
||||||
|
private String radius;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 误差值
|
||||||
|
*/
|
||||||
|
private BigDecimal errorData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
|
private String unit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import lombok.Data;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author chendaofei
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@@ -17,7 +20,9 @@ public class WebSocketVO<T> {
|
|||||||
|
|
||||||
private String operateCode;
|
private String operateCode;
|
||||||
|
|
||||||
private String code;
|
private Integer code;
|
||||||
|
|
||||||
|
private String desc;
|
||||||
|
|
||||||
private T data;
|
private T data;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.njcn.gather.detection.service;
|
package com.njcn.gather.detection.service;
|
||||||
|
|
||||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
|
import com.njcn.gather.detection.pojo.param.SimulateDetectionParam;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13,6 +13,7 @@ public interface PreDetectionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 源通讯校验socket入参拼接
|
* 源通讯校验socket入参拼接
|
||||||
|
*
|
||||||
* @param param
|
* @param param
|
||||||
* @Author: wr
|
* @Author: wr
|
||||||
* @Date: 2024/12/11 13:26
|
* @Date: 2024/12/11 13:26
|
||||||
@@ -20,12 +21,32 @@ public interface PreDetectionService {
|
|||||||
void sourceCommunicationCheck(PreDetectionParam param);
|
void sourceCommunicationCheck(PreDetectionParam param);
|
||||||
|
|
||||||
|
|
||||||
boolean startTest(PreDetectionParam param);
|
void coefficientCheck(PreDetectionParam param);
|
||||||
|
|
||||||
|
|
||||||
boolean closePreTest(PreDetectionParam param);
|
boolean temStopTest();
|
||||||
|
|
||||||
|
|
||||||
|
boolean restartTemTest(PreDetectionParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模拟测试-源通讯校验
|
||||||
|
*
|
||||||
|
* @param param
|
||||||
|
*/
|
||||||
|
void ytxCheckSimulate(SimulateDetectionParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模拟测试-向源发送脚本
|
||||||
|
*
|
||||||
|
* @param param
|
||||||
|
*/
|
||||||
|
void sendScript(SimulateDetectionParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模拟测试-停止
|
||||||
|
*
|
||||||
|
* @param param
|
||||||
|
*/
|
||||||
|
void closeTestSimulate(SimulateDetectionParam param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
package com.njcn.gather.detection.service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: 守时检测流程
|
|
||||||
* @Author: wr
|
|
||||||
* @Date: 2024/12/10 14:23
|
|
||||||
*/
|
|
||||||
public interface PunctualityService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 触发时间标识
|
|
||||||
*/
|
|
||||||
void triggerTimeMark();
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,49 +1,60 @@
|
|||||||
package com.njcn.gather.detection.service.impl;
|
package com.njcn.gather.detection.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.gather.detection.handler.SocketDevResponseService;
|
import com.njcn.gather.detection.handler.SocketDevResponseService;
|
||||||
import com.njcn.gather.detection.handler.SocketSourceResponseService;
|
import com.njcn.gather.detection.handler.SocketSourceResponseService;
|
||||||
|
import com.njcn.gather.detection.pojo.constant.DetectionCommunicateConstant;
|
||||||
import com.njcn.gather.detection.pojo.enums.DetectionResponseEnum;
|
import com.njcn.gather.detection.pojo.enums.DetectionResponseEnum;
|
||||||
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
import com.njcn.gather.detection.pojo.vo.SocketDataMsg;
|
import com.njcn.gather.detection.pojo.param.SimulateDetectionParam;
|
||||||
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
||||||
import com.njcn.gather.detection.service.PreDetectionService;
|
import com.njcn.gather.detection.service.PreDetectionService;
|
||||||
|
import com.njcn.gather.detection.util.business.DetectionCommunicateUtil;
|
||||||
import com.njcn.gather.detection.util.socket.MsgUtil;
|
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
||||||
|
import com.njcn.gather.detection.util.socket.FormalTestManager;
|
||||||
import com.njcn.gather.detection.util.socket.SocketManager;
|
import com.njcn.gather.detection.util.socket.SocketManager;
|
||||||
|
import com.njcn.gather.detection.util.socket.WebServiceManager;
|
||||||
import com.njcn.gather.detection.util.socket.cilent.NettyClient;
|
import com.njcn.gather.detection.util.socket.cilent.NettyClient;
|
||||||
import com.njcn.gather.detection.util.socket.cilent.NettySourceClientHandler;
|
import com.njcn.gather.detection.util.socket.cilent.NettySourceClientHandler;
|
||||||
import com.njcn.gather.device.device.service.IPqDevService;
|
import com.njcn.gather.device.pojo.po.PqDev;
|
||||||
import com.njcn.gather.device.script.service.IPqScriptDtlsService;
|
import com.njcn.gather.device.service.IPqDevService;
|
||||||
import com.njcn.gather.device.source.pojo.po.PqSource;
|
|
||||||
import com.njcn.gather.device.source.pojo.po.SourceInitialize;
|
|
||||||
import com.njcn.gather.device.source.service.IPqSourceService;
|
|
||||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||||
import com.njcn.gather.plan.pojo.po.AdPlanSource;
|
import com.njcn.gather.plan.pojo.po.AdPlanSource;
|
||||||
import com.njcn.gather.plan.service.IAdPlanService;
|
import com.njcn.gather.plan.service.IAdPlanService;
|
||||||
import com.njcn.gather.plan.service.IAdPlanSourceService;
|
import com.njcn.gather.plan.service.IAdPlanSourceService;
|
||||||
|
import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam;
|
||||||
|
import com.njcn.gather.script.pojo.param.PqScriptIssueParam;
|
||||||
|
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||||
|
import com.njcn.gather.script.service.IPqScriptCheckDataService;
|
||||||
|
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||||
|
import com.njcn.gather.source.pojo.po.SourceInitialize;
|
||||||
|
import com.njcn.gather.source.service.IPqSourceService;
|
||||||
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
||||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelFutureListener;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
public class PreDetectionServiceImpl implements PreDetectionService {
|
public class PreDetectionServiceImpl implements PreDetectionService {
|
||||||
|
|
||||||
private final String source = "_Source";
|
private final String stepTag = "&&";
|
||||||
private final String dev = "_Dev";
|
private final String handlerSourceStr = "_Source";
|
||||||
|
|
||||||
private final IPqDevService iPqDevService;
|
private final IPqDevService iPqDevService;
|
||||||
private final IDictDataService dictDataService;
|
private final IDictDataService dictDataService;
|
||||||
@@ -54,12 +65,12 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
|||||||
|
|
||||||
private final SocketDevResponseService socketDevResponseService;
|
private final SocketDevResponseService socketDevResponseService;
|
||||||
private final SocketSourceResponseService socketSourceResponseService;
|
private final SocketSourceResponseService socketSourceResponseService;
|
||||||
|
private final IPqScriptCheckDataService iPqScriptCheckDataService;
|
||||||
|
|
||||||
|
@Value("${socket.source.ip:192.168.1.138}")
|
||||||
@Value("${socket.source.ip:192.168.1.136}")
|
|
||||||
private String ip;
|
private String ip;
|
||||||
|
|
||||||
@Value("${socket.source.port:10086}")
|
@Value("${socket.source.port:61000}")
|
||||||
private Integer port;
|
private Integer port;
|
||||||
|
|
||||||
private final SocketSourceResponseService sourceResponseService;
|
private final SocketSourceResponseService sourceResponseService;
|
||||||
@@ -67,46 +78,19 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sourceCommunicationCheck(PreDetectionParam param) {
|
public void sourceCommunicationCheck(PreDetectionParam param) {
|
||||||
|
// 参数校验,目前仅检查IP是否重复,后续可在里面扩展
|
||||||
|
checkDevIp(param);
|
||||||
System.out.println("进来了啊啊啊啊啊啊啊啊啊啊啊啊啊----------------------------------------------------------------");
|
//用于处理异常导致的socket通道未关闭,socket交互异常
|
||||||
Channel channel = SocketManager.getChannelByUserId(param.getUserPageId() + source);
|
DetectionCommunicateUtil.checkCommunicateChannel(param);
|
||||||
System.out.println("存活的源=========================="+channel);
|
|
||||||
|
|
||||||
if (Objects.nonNull(channel) && channel.isActive()) {
|
|
||||||
System.out.println("进入关闭源。。//////");
|
|
||||||
SocketDataMsg socketDataMsg = new SocketDataMsg();
|
|
||||||
socketDataMsg.setOperateCode(SourceOperateCodeEnum.CLOSE_GATHER.getValue());
|
|
||||||
socketDataMsg.setRequestId(SourceOperateCodeEnum.QUITE_SOURCE.getValue());
|
|
||||||
SocketManager.sendMsg(param.getUserPageId()+source,JSON.toJSONString(socketDataMsg));
|
|
||||||
|
|
||||||
try {
|
|
||||||
Thread.sleep(2000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
SocketManager.removeUser(param.getUserPageId() + source);
|
|
||||||
SocketManager.removeUser(param.getUserPageId() + dev);
|
|
||||||
|
|
||||||
try {
|
|
||||||
Thread.sleep(2000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
先组装源通讯协议
|
先组装源通讯协议
|
||||||
查询计划什么模式的(除了对比式,其他都是一个计划对应一个源)
|
查询计划什么模式的(除了对比式,其他都是一个计划对应一个源)
|
||||||
*/
|
*/
|
||||||
AdPlan plan = iAdPlanService.getById(param.getPlanId());
|
AdPlan plan = iAdPlanService.getById(param.getPlanId());
|
||||||
PqSource pqSource = pqSourceService.getById(plan.getDatasourceId());
|
param.setScriptId(plan.getScriptId());
|
||||||
|
param.setErrorSysId(plan.getErrorSysId());
|
||||||
|
param.setCode(String.valueOf(plan.getCode()));
|
||||||
if (ObjectUtil.isNotNull(plan)) {
|
if (ObjectUtil.isNotNull(plan)) {
|
||||||
plan.setErrorSysId(plan.getId());
|
|
||||||
String code = dictDataService.getDictDataById(plan.getPattern()).getCode();
|
String code = dictDataService.getDictDataById(plan.getPattern()).getCode();
|
||||||
DictDataEnum dictDataEnumByCode = DictDataEnum.getDictDataEnumByCode(code);
|
DictDataEnum dictDataEnumByCode = DictDataEnum.getDictDataEnumByCode(code);
|
||||||
switch (dictDataEnumByCode) {
|
switch (dictDataEnumByCode) {
|
||||||
@@ -124,7 +108,10 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendYtxSocket(PreDetectionParam param) {
|
@Override
|
||||||
|
public void coefficientCheck(PreDetectionParam param) {
|
||||||
|
// 检测是否存在连接的通道,后期需要做成动态,如果组合中不是第一位,则不需要关闭,也不用初始化 todo....
|
||||||
|
DetectionCommunicateUtil.checkCommunicateChannel(param);
|
||||||
AdPlanSource planSource = adPlanSourceService.getOne(new LambdaQueryWrapper<AdPlanSource>()
|
AdPlanSource planSource = adPlanSourceService.getOne(new LambdaQueryWrapper<AdPlanSource>()
|
||||||
.eq(AdPlanSource::getPlanId, param.getPlanId())
|
.eq(AdPlanSource::getPlanId, param.getPlanId())
|
||||||
);
|
);
|
||||||
@@ -134,12 +121,12 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
|||||||
//开始组装socket报文请求头
|
//开始组装socket报文请求头
|
||||||
socketDevResponseService.initList(param);
|
socketDevResponseService.initList(param);
|
||||||
socketSourceResponseService.initList(param);
|
socketSourceResponseService.initList(param);
|
||||||
SocketMsg msg = new SocketMsg();
|
SocketMsg<String> msg = new SocketMsg<>();
|
||||||
msg.setRequestId(SourceOperateCodeEnum.YJC_YTXJY.getValue());
|
msg.setRequestId(SourceOperateCodeEnum.YJC_YTXJY.getValue());
|
||||||
msg.setOperateCode(SourceOperateCodeEnum.INIT_GATHER.getValue());
|
msg.setOperateCode(SourceOperateCodeEnum.INIT_GATHER.getValue());
|
||||||
msg.setData(JSON.toJSONString(sourceParam));
|
msg.setData(JSON.toJSONString(sourceParam));
|
||||||
param.setSourceId(sourceParam.getSourceId());
|
param.setSourceId(sourceParam.getSourceId());
|
||||||
NettyClient.socketClient(ip, port, param.getUserPageId(), MsgUtil.toJsonWithNewLinePlain(msg), new NettySourceClientHandler(param, sourceResponseService));
|
NettyClient.socketClient(ip, port, param, JSON.toJSONString(msg), new NettySourceClientHandler(param, sourceResponseService));
|
||||||
} else {
|
} else {
|
||||||
throw new BusinessException(DetectionResponseEnum.SOURCE_INFO_NOT);
|
throw new BusinessException(DetectionResponseEnum.SOURCE_INFO_NOT);
|
||||||
}
|
}
|
||||||
@@ -149,28 +136,147 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
private void sendYtxSocket(PreDetectionParam param) {
|
||||||
public boolean startTest(PreDetectionParam param) {
|
WebServiceManager.addPreDetectionParam(param);
|
||||||
|
AdPlanSource planSource = adPlanSourceService.getOne(new LambdaQueryWrapper<AdPlanSource>().eq(AdPlanSource::getPlanId, param.getPlanId()));
|
||||||
|
param.setSourceId(planSource.getSourceId());
|
||||||
|
if (ObjectUtil.isNotNull(planSource)) {
|
||||||
|
//获取源初始化参数
|
||||||
|
SourceInitialize sourceParam = pqSourceService.getSourceInitializeParam(planSource.getSourceId());
|
||||||
|
if (ObjectUtil.isNotNull(sourceParam)) {
|
||||||
|
//开始组装socket报文请求头
|
||||||
socketDevResponseService.initList(param);
|
socketDevResponseService.initList(param);
|
||||||
NettyClient.socketClient(ip, port, param.getUserPageId(), "start\n", new NettySourceClientHandler(param, sourceResponseService));
|
socketSourceResponseService.initList(param);
|
||||||
|
SocketMsg<String> socketMsg = new SocketMsg<>();
|
||||||
|
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_YTXJY.getValue());
|
||||||
|
socketMsg.setOperateCode(SourceOperateCodeEnum.INIT_GATHER.getValue());
|
||||||
|
socketMsg.setData(JSON.toJSONString(sourceParam));
|
||||||
|
//建立与源控程序的socket连接,
|
||||||
|
NettyClient.socketClient(ip, port, param, JSON.toJSONString(socketMsg), new NettySourceClientHandler(param, sourceResponseService));
|
||||||
|
} else {
|
||||||
|
throw new BusinessException(DetectionResponseEnum.SOURCE_INFO_NOT);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new BusinessException(DetectionResponseEnum.PLAN_AND_SOURCE_NOT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendYtxSocketSimulate(PreDetectionParam param) {
|
||||||
|
SourceInitialize sourceParam = pqSourceService.getSourceInitializeParam(param.getSourceId());
|
||||||
|
param.setSourceId(sourceParam.getSourceId());
|
||||||
|
WebServiceManager.addPreDetectionParam(param);
|
||||||
|
if (ObjectUtil.isNotNull(sourceParam)) {
|
||||||
|
SocketMsg<String> socketMsg = new SocketMsg<>();
|
||||||
|
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_YTXJY.getValue());
|
||||||
|
socketMsg.setOperateCode(SourceOperateCodeEnum.INIT_GATHER.getValue());
|
||||||
|
socketMsg.setData(JSON.toJSONString(sourceParam));
|
||||||
|
NettyClient.socketClient(ip, port, param, JSON.toJSONString(socketMsg), new NettySourceClientHandler(param, sourceResponseService));
|
||||||
|
} else {
|
||||||
|
throw new BusinessException(DetectionResponseEnum.SOURCE_INFO_NOT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean temStopTest() {
|
||||||
|
FormalTestManager.stopFlag = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean restartTemTest(PreDetectionParam param) {
|
||||||
|
FormalTestManager.stopFlag = false;
|
||||||
|
socketDevResponseService.initRestart();
|
||||||
|
List<SourceIssue> sourceIssueList = SocketManager.getSourceList();
|
||||||
|
if (CollUtil.isNotEmpty(sourceIssueList)) {
|
||||||
|
SourceIssue sourceIssues = SocketManager.getSourceList().get(0);
|
||||||
|
SocketMsg<String> xuMsg = new SocketMsg<>();
|
||||||
|
xuMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
||||||
|
xuMsg.setData(JSON.toJSONString(sourceIssues));
|
||||||
|
xuMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + "&&" + sourceIssues.getType());
|
||||||
|
SocketManager.sendMsg(param.getUserPageId() + DetectionCommunicateConstant.SOURCE, JSON.toJSONString(xuMsg));
|
||||||
|
} else {
|
||||||
|
//TODO 是否最终检测完成需要推送给用户
|
||||||
|
PqScriptCheckDataParam checkDataParam = new PqScriptCheckDataParam();
|
||||||
|
checkDataParam.setScriptId(param.getScriptId());
|
||||||
|
checkDataParam.setIsValueTypeName(false);
|
||||||
|
List<String> valueType = iPqScriptCheckDataService.getValueType(checkDataParam);
|
||||||
|
|
||||||
|
iPqDevService.updateResult(param.getDevIds(), valueType, param.getCode(), param.getUserId(), param.getTemperature(), param.getHumidity());
|
||||||
|
CnSocketUtil.quitSend(param);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean closePreTest(PreDetectionParam param) {
|
public void ytxCheckSimulate(SimulateDetectionParam param) {
|
||||||
|
PreDetectionParam preDetectionParam = new PreDetectionParam();
|
||||||
|
preDetectionParam.setSourceId(param.getSourceId());
|
||||||
|
preDetectionParam.setUserPageId(param.getUserPageId());
|
||||||
|
preDetectionParam.setSendWebMsg(true);
|
||||||
|
|
||||||
SocketMsg socketMsg = new SocketMsg();
|
DetectionCommunicateUtil.checkCommunicateChannel(preDetectionParam);
|
||||||
socketMsg.setRequestId(SourceOperateCodeEnum.QUITE.getValue());
|
sendYtxSocketSimulate(preDetectionParam);
|
||||||
socketMsg.setOperateCode(SourceOperateCodeEnum.QUIT_INIT_03.getValue());
|
}
|
||||||
SocketManager.sendMsg(param.getUserPageId() + dev, JSON.toJSONString(socketMsg));
|
|
||||||
|
@Override
|
||||||
|
public void sendScript(SimulateDetectionParam param) {
|
||||||
|
Channel channel = SocketManager.getChannelByUserId(param.getUserPageId() + DetectionCommunicateConstant.SOURCE);
|
||||||
|
if (Objects.isNull(channel) || !channel.isActive()) {
|
||||||
|
// 进行源通信连接
|
||||||
|
PreDetectionParam preDetectionParam = new PreDetectionParam();
|
||||||
|
preDetectionParam.setSourceId(param.getSourceId());
|
||||||
|
preDetectionParam.setUserPageId(param.getUserPageId());
|
||||||
|
preDetectionParam.setSendWebMsg(false);
|
||||||
|
this.sendYtxSocketSimulate(preDetectionParam);
|
||||||
|
}
|
||||||
|
//组装源控制脚本
|
||||||
|
PqScriptIssueParam issueParam = new PqScriptIssueParam();
|
||||||
|
issueParam.setSourceId(param.getSourceId());
|
||||||
|
issueParam.setScriptId(param.getScriptId());
|
||||||
|
issueParam.setType(1);
|
||||||
|
issueParam.setIsPhaseSequence(SourceOperateCodeEnum.SIMULATE_TEST.getValue());
|
||||||
|
|
||||||
|
List<SourceIssue> sourceIssues = pqScriptDtlsService.listSourceIssue(issueParam);
|
||||||
|
sourceIssues = sourceIssues.stream()
|
||||||
|
.filter(s -> s.getIndex().equals(param.getScriptIndex()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
SourceIssue sourceIssue = sourceIssues.get(0);
|
||||||
|
List<String> comm = sourceIssue.getDevValueTypeList();
|
||||||
|
System.out.println("向装置下发的参数ddd>>>>>>>>" + comm);
|
||||||
|
|
||||||
|
SocketMsg<String> socketMsg = new SocketMsg<>();
|
||||||
|
socketMsg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue());
|
||||||
|
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + stepTag + sourceIssue.getType());
|
||||||
|
socketMsg.setData(JSON.toJSONString(sourceIssues.get(0)));
|
||||||
|
SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, JSON.toJSONString(socketMsg));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void closeTestSimulate(SimulateDetectionParam param) {
|
||||||
|
Channel channel = SocketManager.getChannelByUserId(param.getUserPageId() + DetectionCommunicateConstant.SOURCE);
|
||||||
|
if (Objects.isNull(channel) || !channel.isActive()) {
|
||||||
|
throw new BusinessException(DetectionResponseEnum.SOURCE_NOT_CONNECT);
|
||||||
|
}
|
||||||
|
SourceInitialize sourceParam = pqSourceService.getSourceInitializeParam(param.getSourceId());
|
||||||
|
PreDetectionParam preDetectionParam = new PreDetectionParam();
|
||||||
|
preDetectionParam.setSourceId(sourceParam.getSourceId());
|
||||||
|
preDetectionParam.setUserPageId(param.getUserPageId());
|
||||||
|
CnSocketUtil.quitSendSource(preDetectionParam);
|
||||||
|
WebServiceManager.removePreDetectionParam();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
socketMsg.setRequestId(SourceOperateCodeEnum.QUITE_SOURCE.getValue());
|
/**
|
||||||
socketMsg.setOperateCode(SourceOperateCodeEnum.CLOSE_GATHER.getValue());
|
* 校验被检设备中是否存在IP重复的
|
||||||
SocketManager.sendMsg(param.getUserPageId() + source, JSON.toJSONString(socketMsg));
|
*/
|
||||||
|
private void checkDevIp(PreDetectionParam param) {
|
||||||
return true;
|
List<PqDev> pqDevList = iPqDevService.listByIds(param.getDevIds());
|
||||||
|
List<String> ipList = pqDevList.stream().map(PqDev::getIp).distinct().collect(Collectors.toList());
|
||||||
|
if (ipList.size() != param.getDevIds().size()) {
|
||||||
|
throw new BusinessException(DetectionResponseEnum.PLAN_DEV_IP_HAS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package com.njcn.gather.detection.util.business;
|
||||||
|
|
||||||
|
import com.njcn.gather.detection.pojo.constant.DetectionCommunicateConstant;
|
||||||
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
|
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
||||||
|
import com.njcn.gather.detection.util.socket.SocketManager;
|
||||||
|
import io.netty.channel.Channel;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测通讯工具类
|
||||||
|
*
|
||||||
|
* @author hongawen
|
||||||
|
* @version 1.0
|
||||||
|
* @data 2025/4/15 15:24
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class DetectionCommunicateUtil {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测是否存在连接的源、设备通讯的模块通道
|
||||||
|
* 有则强行关闭
|
||||||
|
*/
|
||||||
|
public static void checkCommunicateChannel(PreDetectionParam param) {
|
||||||
|
Channel channelSource = SocketManager.getChannelByUserId(param.getUserPageId() + DetectionCommunicateConstant.SOURCE);
|
||||||
|
Channel channelDev = SocketManager.getChannelByUserId(param.getUserPageId() + DetectionCommunicateConstant.DEV);
|
||||||
|
|
||||||
|
if (Objects.nonNull(channelSource) && channelSource.isActive()) {
|
||||||
|
System.out.println("发送关闭源指令。。。。。。。。");
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(channelDev) && channelDev.isActive()) {
|
||||||
|
System.out.println("发送关闭设备通讯指令。。。。。。。。");
|
||||||
|
CnSocketUtil.quitSend(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Thread.sleep(4000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
SocketManager.removeUser(param.getUserPageId() + DetectionCommunicateConstant.SOURCE);
|
||||||
|
SocketManager.removeUser(param.getUserPageId() + DetectionCommunicateConstant.DEV);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Thread.sleep(2000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
package com.njcn.gather.detection.util.socket;
|
package com.njcn.gather.detection.util.socket;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
||||||
|
import com.njcn.gather.detection.pojo.vo.WebSocketVO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: cdf
|
* @Author: cdf
|
||||||
@@ -12,8 +14,8 @@ import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
|||||||
*/
|
*/
|
||||||
public class CnSocketUtil {
|
public class CnSocketUtil {
|
||||||
|
|
||||||
private final static String handlerStr = "_Dev";
|
private final static String devTag = "_Dev";
|
||||||
private final static String handlerSourceStr = "_Source";
|
private final static String sourceTag = "_Source";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退出检测
|
* 退出检测
|
||||||
@@ -22,7 +24,8 @@ public class CnSocketUtil {
|
|||||||
SocketMsg<String> socketMsg = new SocketMsg<>();
|
SocketMsg<String> socketMsg = new SocketMsg<>();
|
||||||
socketMsg.setRequestId(SourceOperateCodeEnum.QUITE.getValue());
|
socketMsg.setRequestId(SourceOperateCodeEnum.QUITE.getValue());
|
||||||
socketMsg.setOperateCode(SourceOperateCodeEnum.QUIT_INIT_03.getValue());
|
socketMsg.setOperateCode(SourceOperateCodeEnum.QUIT_INIT_03.getValue());
|
||||||
SocketManager.sendMsg(param.getUserPageId() + handlerStr, JSON.toJSONString(socketMsg));
|
SocketManager.sendMsg(param.getUserPageId() + devTag, JSON.toJSONString(socketMsg));
|
||||||
|
WebServiceManager.removePreDetectionParam();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,7 +35,34 @@ public class CnSocketUtil {
|
|||||||
SocketMsg<String> socketMsg = new SocketMsg<>();
|
SocketMsg<String> socketMsg = new SocketMsg<>();
|
||||||
socketMsg.setRequestId(SourceOperateCodeEnum.QUITE_SOURCE.getValue());
|
socketMsg.setRequestId(SourceOperateCodeEnum.QUITE_SOURCE.getValue());
|
||||||
socketMsg.setOperateCode(SourceOperateCodeEnum.CLOSE_GATHER.getValue());
|
socketMsg.setOperateCode(SourceOperateCodeEnum.CLOSE_GATHER.getValue());
|
||||||
SocketManager.sendMsg(param.getUserPageId() + handlerSourceStr, JSON.toJSONString(socketMsg));
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("sourceId", param.getSourceId());
|
||||||
|
socketMsg.setData(jsonObject.toJSONString());
|
||||||
|
SocketManager.sendMsg(param.getUserPageId() + sourceTag, JSON.toJSONString(socketMsg));
|
||||||
|
WebServiceManager.removePreDetectionParam();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送webSocket数据
|
||||||
|
*/
|
||||||
|
public static void sendToWebSocket(String userId, String requestId, String operatorType, Object data, String desc){
|
||||||
|
WebSocketVO<Object> webSocketVO = new WebSocketVO<>();
|
||||||
|
webSocketVO.setRequestId(requestId);
|
||||||
|
webSocketVO.setOperateCode(operatorType);
|
||||||
|
webSocketVO.setData(data);
|
||||||
|
webSocketVO.setDesc(desc);
|
||||||
|
WebServiceManager.sendMessage(userId,webSocketVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送未知异常的webSocket数据
|
||||||
|
*/
|
||||||
|
public static void sendUnSocket(String userId){
|
||||||
|
WebSocketVO<Object> webSocketVO = new WebSocketVO<>();
|
||||||
|
webSocketVO.setRequestId(SourceOperateCodeEnum.UNKNOWN_OPERATE.getValue());
|
||||||
|
webSocketVO.setData(SourceOperateCodeEnum.UNKNOWN_OPERATE.getMsg());
|
||||||
|
webSocketVO.setOperateCode(SourceOperateCodeEnum.UNKNOWN_OPERATE.getMsg());
|
||||||
|
WebServiceManager.sendMessage(userId,webSocketVO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package com.njcn.gather.detection.util.socket;
|
||||||
|
|
||||||
|
import com.njcn.gather.detection.pojo.po.DevData;
|
||||||
|
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2025-01-08
|
||||||
|
* @Description: 正式检测对象管理
|
||||||
|
*/
|
||||||
|
public class FormalTestManager {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* key:设备ip,value:当前设备下面的通道序号
|
||||||
|
*/
|
||||||
|
public static Map<String,List<String>> devMapMonitorNum = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所有参与检测的装置
|
||||||
|
*/
|
||||||
|
public static List<PreDetection> devList = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所有参与检测的监测点
|
||||||
|
*/
|
||||||
|
public static List<String> monitorIdListComm = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//用于存储所有测点的实时数据
|
||||||
|
public static List<DevData> realDataXiList = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* key:设备ip,value:装置名称
|
||||||
|
*/
|
||||||
|
public static Map<String, String> devNameMapComm = new HashMap<>();
|
||||||
|
/**
|
||||||
|
* key:设备ip,value:装置id
|
||||||
|
*/
|
||||||
|
public static Map<String, String> devIdMapComm = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 停止触发标识
|
||||||
|
*/
|
||||||
|
public static Boolean stopFlag = false;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已经暂停后的标识
|
||||||
|
*/
|
||||||
|
public static Boolean hasStopFlag = false;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂停后的超时计时时间
|
||||||
|
*/
|
||||||
|
public static Integer stopTime = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 强行赋值关系
|
||||||
|
*/
|
||||||
|
public static Map<String,String> harmonicRelationMap = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,10 +3,7 @@ package com.njcn.gather.detection.util.socket;
|
|||||||
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.serializer.SerializerFeature;
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||||
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
|
||||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
|
||||||
import com.njcn.gather.detection.pojo.vo.SocketDataMsg;
|
import com.njcn.gather.detection.pojo.vo.SocketDataMsg;
|
||||||
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -19,7 +16,6 @@ import java.util.Map;
|
|||||||
public class MsgUtil {
|
public class MsgUtil {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static SocketDataMsg socketDataMsg(String textMsg) {
|
public static SocketDataMsg socketDataMsg(String textMsg) {
|
||||||
return JSON.parseObject(textMsg, SocketDataMsg.class);
|
return JSON.parseObject(textMsg, SocketDataMsg.class);
|
||||||
}
|
}
|
||||||
@@ -46,7 +42,6 @@ public class MsgUtil {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param socketDataMsg
|
* @param socketDataMsg
|
||||||
* @param devMap
|
* @param devMap
|
||||||
* @param type 0.装置 1.监测点
|
* @param type 0.装置 1.监测点
|
||||||
@@ -70,7 +65,4 @@ public class MsgUtil {
|
|||||||
}
|
}
|
||||||
return JSON.toJSONString(socketDataMsg);
|
return JSON.toJSONString(socketDataMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
package com.njcn.gather.detection.util.socket;
|
package com.njcn.gather.detection.util.socket;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.njcn.gather.device.script.pojo.po.SourceIssue;
|
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.nio.NioEventLoopGroup;
|
import io.netty.channel.nio.NioEventLoopGroup;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@@ -17,7 +18,14 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
|||||||
*/
|
*/
|
||||||
public class SocketManager {
|
public class SocketManager {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* key为userId(xxx_Source、xxx_Dev),value为channel
|
||||||
|
*/
|
||||||
private static final Map<String, Channel> socketSessions = new ConcurrentHashMap<>();
|
private static final Map<String, Channel> socketSessions = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* key为userId(xxx_Source、xxx_Dev),value为group
|
||||||
|
*/
|
||||||
private static final Map<String, NioEventLoopGroup> socketGroup = new ConcurrentHashMap<>();
|
private static final Map<String, NioEventLoopGroup> socketGroup = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public static void addUser(String userId, Channel channel) {
|
public static void addUser(String userId, Channel channel) {
|
||||||
@@ -75,11 +83,22 @@ public class SocketManager {
|
|||||||
*/
|
*/
|
||||||
private static List<SourceIssue> sourceIssueList = new CopyOnWriteArrayList<>();
|
private static List<SourceIssue> sourceIssueList = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于存储pq_script_checkdata表里Value_Type与树字典表code
|
||||||
|
*/
|
||||||
|
public static Map<String, String> valueTypeMap = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于存储每个测试小项超时时长key key:检测项 value:时间秒
|
||||||
|
*/
|
||||||
|
public static volatile Map<Integer,Long> clockMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void addSourceList(List<SourceIssue> sList) {
|
public static void addSourceList(List<SourceIssue> sList) {
|
||||||
sourceIssueList = sList;
|
sourceIssueList = sList;
|
||||||
System.out.println(sList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<SourceIssue> getSourceList() {
|
public static List<SourceIssue> getSourceList() {
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package com.njcn.gather.detection.util.socket;
|
||||||
|
|
||||||
|
import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wr
|
||||||
|
* @description
|
||||||
|
* @date 2025/3/27 14:58
|
||||||
|
*/
|
||||||
|
public class UnitUtil {
|
||||||
|
public static String unit(String code, Integer fly) {
|
||||||
|
String unit = "";
|
||||||
|
if (Arrays.asList(0, 1).contains(fly)) {
|
||||||
|
if (DetectionCodeEnum.FREQ.getCode().equals(code)) {
|
||||||
|
unit = "Hz";
|
||||||
|
}
|
||||||
|
if (DetectionCodeEnum.VRMS.getCode().equals(code)) {
|
||||||
|
unit = "V";
|
||||||
|
}
|
||||||
|
if (DetectionCodeEnum.IRMS.getCode().equals(code)) {
|
||||||
|
unit = "A";
|
||||||
|
}
|
||||||
|
if (DetectionCodeEnum.V2_50.getCode().equals(code) ||
|
||||||
|
DetectionCodeEnum.SV_1_49.getCode().equals(code)||
|
||||||
|
DetectionCodeEnum.V_UNBAN.getCode().equals(code) ||
|
||||||
|
DetectionCodeEnum.I_UNBAN.getCode().equals(code)
|
||||||
|
) {
|
||||||
|
unit = "%";
|
||||||
|
}
|
||||||
|
if (DetectionCodeEnum.I2_50.getCode().equals(code) ||
|
||||||
|
DetectionCodeEnum.SI_1_49.getCode().equals(code)
|
||||||
|
) {
|
||||||
|
unit = "A";
|
||||||
|
}
|
||||||
|
if (DetectionCodeEnum.P2_50.getCode().equals(code)) {
|
||||||
|
unit = "W";
|
||||||
|
}
|
||||||
|
if (DetectionCodeEnum.P.getCode().equals(code)) {
|
||||||
|
unit = "P";
|
||||||
|
}
|
||||||
|
if (DetectionCodeEnum.MAG.getCode().equals(code)) {
|
||||||
|
unit = "V";
|
||||||
|
}
|
||||||
|
if (DetectionCodeEnum.DUR.getCode().equals(code)) {
|
||||||
|
unit = "s";
|
||||||
|
}
|
||||||
|
if (DetectionCodeEnum.VA.getCode().equals(code) ||
|
||||||
|
DetectionCodeEnum.IA.getCode().equals(code)
|
||||||
|
) {
|
||||||
|
unit = "°";
|
||||||
|
}
|
||||||
|
if (DetectionCodeEnum.DELTA_V.getCode().equals(code)
|
||||||
|
) {
|
||||||
|
unit = "%";
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
unit = "%";
|
||||||
|
}
|
||||||
|
return unit;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,12 @@
|
|||||||
package com.njcn.gather.detection.util.socket;
|
package com.njcn.gather.detection.util.socket;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
import com.njcn.gather.detection.pojo.vo.WebSocketVO;
|
import com.njcn.gather.detection.pojo.vo.WebSocketVO;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
|
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@@ -23,23 +25,20 @@ public class WebServiceManager {
|
|||||||
//key:页面 value:channel
|
//key:页面 value:channel
|
||||||
private static final Map<String, Channel> userSessions = new ConcurrentHashMap<>();
|
private static final Map<String, Channel> userSessions = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
// 检测参数。key固定为preDetectionParam, value:检测参数
|
||||||
|
private static final Map<String, PreDetectionParam> preDetectionParamMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public static void addUser(String userId, Channel channel) {
|
public static void addUser(String userId, Channel channel) {
|
||||||
userSessions.put(userId, channel);
|
userSessions.put(userId, channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeUser(String userId) {
|
|
||||||
String id = userSessions.get(userId).id().toString();
|
|
||||||
userSessions.remove(userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void removeChannel(String channelId) {
|
public static void removeChannel(String channelId) {
|
||||||
// 遍历并删除
|
// 遍历并删除
|
||||||
Iterator<Map.Entry<String, Channel>> iterator = userSessions.entrySet().iterator();
|
Iterator<Map.Entry<String, Channel>> iterator = userSessions.entrySet().iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Map.Entry<String, Channel> entry = iterator.next();
|
Map.Entry<String, Channel> entry = iterator.next();
|
||||||
if (entry.getValue().id().equals(channelId)) {
|
if (entry.getValue().id().toString().equals(channelId)) {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,11 +55,14 @@ public class WebServiceManager {
|
|||||||
channel.writeAndFlush(wd);
|
channel.writeAndFlush(wd);
|
||||||
}else {
|
}else {
|
||||||
log.error("{}-websocket推送消息失败;当前用户-{}-客户端已经断开连接", LocalDateTime.now(),userId);
|
log.error("{}-websocket推送消息失败;当前用户-{}-客户端已经断开连接", LocalDateTime.now(),userId);
|
||||||
|
// PreDetectionParam param = preDetectionParamMap.get("preDetectionParam");
|
||||||
|
// CnSocketUtil.quitSend(param);
|
||||||
|
// CnSocketUtil.quitSendSource(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendMessage(String userId, WebSocketVO webSocketVO) {
|
public static void sendMessage(String userId, WebSocketVO<Object> webSocketVO) {
|
||||||
Channel channel = userSessions.get(userId);
|
Channel channel = userSessions.get(userId);
|
||||||
if(Objects.nonNull(channel) && channel.isActive()){
|
if(Objects.nonNull(channel) && channel.isActive()){
|
||||||
TextWebSocketFrame wd = new TextWebSocketFrame(JSON.toJSONString(webSocketVO));
|
TextWebSocketFrame wd = new TextWebSocketFrame(JSON.toJSONString(webSocketVO));
|
||||||
@@ -70,5 +72,15 @@ public class WebServiceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void addPreDetectionParam(PreDetectionParam preDetectionParam) {
|
||||||
|
preDetectionParamMap.put("preDetectionParam", preDetectionParam);
|
||||||
|
}
|
||||||
|
public static PreDetectionParam getPreDetectionParam() {
|
||||||
|
return preDetectionParamMap.get("preDetectionParam");
|
||||||
|
}
|
||||||
|
public static void removePreDetectionParam() {
|
||||||
|
preDetectionParamMap.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.njcn.gather.detection.util.socket;
|
||||||
|
|
||||||
|
import com.njcn.gather.detection.pojo.dto.DevXiNumData;
|
||||||
|
import com.njcn.gather.detection.pojo.vo.CoefficientVO;
|
||||||
|
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||||
|
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2025-01-05
|
||||||
|
* @Description: 系数校验管理器
|
||||||
|
*/
|
||||||
|
public class XiNumberManager {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 存储大电压,小电压源控制脚本
|
||||||
|
*/
|
||||||
|
public static List<SourceIssue> xiSourceIssueList = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 存储校验系数的装置ip,校验完一个则删除一个
|
||||||
|
*/
|
||||||
|
public static List<String> devXiList = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最开始存储装置通道原始系数,后续存储大电压计算出来的系数。key为装置ip
|
||||||
|
*/
|
||||||
|
public static Map<String, DevXiNumData> devXiNumDataMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 存储所有测点的小电压系数
|
||||||
|
*/
|
||||||
|
public static Map<String, DevXiNumData> smallDevXiNumDataMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系数校验步数计数器 0.大电压 1.小电压 2.小电压 3.大电压
|
||||||
|
*/
|
||||||
|
public static Integer stepNumber = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// 存放大电压、小电压、大电流、小电流的数值
|
||||||
|
public static List<CoefficientVO.DevParameter> devParameterList = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 因为只支持单台装置获取系数,用于记录未获取到系数的装置,获取到一个删除一个
|
||||||
|
*/
|
||||||
|
public static List<PreDetection> xiDevList = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
package com.njcn.gather.detection.util.socket.cilent;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||||
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
|
import com.njcn.gather.detection.pojo.vo.SocketDataMsg;
|
||||||
|
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
||||||
|
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
||||||
|
import com.njcn.gather.detection.util.socket.MsgUtil;
|
||||||
|
import com.njcn.gather.detection.util.socket.SocketManager;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2025-02-11
|
||||||
|
* @Description: 心跳处理类
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
public class HeartbeatHandler extends SimpleChannelInboundHandler<String> {
|
||||||
|
private final ScheduledExecutorService heartbeatExecutor = Executors.newScheduledThreadPool(1);
|
||||||
|
|
||||||
|
private final String dev = "_Dev";
|
||||||
|
private final String sourceTag = "_Source";
|
||||||
|
|
||||||
|
private final PreDetectionParam param;
|
||||||
|
private final String handlerType;
|
||||||
|
|
||||||
|
// 允许连续未收到心跳响应的最大次数
|
||||||
|
private static final int MAX_HEARTBEAT_MISSES = 3;
|
||||||
|
// 连续未收到心跳响应的次数
|
||||||
|
private int consecutiveHeartbeatMisses = 0;
|
||||||
|
|
||||||
|
|
||||||
|
public HeartbeatHandler(PreDetectionParam param, String type) {
|
||||||
|
this.param = param;
|
||||||
|
this.handlerType = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void channelActive(ChannelHandlerContext ctx) {
|
||||||
|
// 启动心跳定时任务
|
||||||
|
scheduleHeartbeat(ctx);
|
||||||
|
ctx.fireChannelActive();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||||
|
heartbeatExecutor.shutdown();
|
||||||
|
super.channelInactive(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 每30秒发送一次心跳
|
||||||
|
private void scheduleHeartbeat(ChannelHandlerContext ctx) {
|
||||||
|
heartbeatExecutor.scheduleAtFixedRate(() -> {
|
||||||
|
if (ctx.channel().isActive()) {
|
||||||
|
// 发送心跳包
|
||||||
|
SocketMsg<String> msg = new SocketMsg<>();
|
||||||
|
msg.setRequestId("yxt");
|
||||||
|
msg.setOperateCode(SourceOperateCodeEnum.HEARTBEAT.getValue());
|
||||||
|
msg.setData("");
|
||||||
|
ctx.channel().writeAndFlush(JSON.toJSONString(msg) + "\n");
|
||||||
|
|
||||||
|
System.out.println(handlerType + "♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥send" + LocalDateTime.now());
|
||||||
|
consecutiveHeartbeatMisses++;
|
||||||
|
if (consecutiveHeartbeatMisses >= MAX_HEARTBEAT_MISSES) {
|
||||||
|
// 连续三次未收到心跳响应,断开连接
|
||||||
|
System.out.println(handlerType + "连续三次未收到心跳响应,断开连接");
|
||||||
|
if (dev.equals(handlerType)) {
|
||||||
|
//CnSocketUtil.sendToWebSocket(param.getUserPageId(),);
|
||||||
|
CnSocketUtil.quitSend(param);
|
||||||
|
} else {
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Thread.sleep(3000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
System.err.println("线程中断异常: " + e.getMessage());
|
||||||
|
}
|
||||||
|
String key = dev.equals(handlerType) ? param.getUserPageId() + dev : param.getUserPageId() + sourceTag;
|
||||||
|
SocketManager.removeUser(key);
|
||||||
|
consecutiveHeartbeatMisses = 0; // 重置连续心跳丢失次数
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 3, 10, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void channelRead0(ChannelHandlerContext ctx, String msg) throws Exception {
|
||||||
|
// 过滤心跳包,避免进入业务逻辑
|
||||||
|
if (isHeartbeatPacket(msg)) {
|
||||||
|
System.out.println(handlerType + "♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥response" + LocalDateTime.now());
|
||||||
|
consecutiveHeartbeatMisses = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 处理业务数据
|
||||||
|
ctx.fireChannelRead(msg);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isHeartbeatPacket(String msg) {
|
||||||
|
// 判断是否为心跳包
|
||||||
|
SocketDataMsg socketDataMsg = MsgUtil.socketDataMsg(msg);
|
||||||
|
return !Objects.isNull(socketDataMsg.getOperateCode()) && socketDataMsg.getOperateCode().equals(SourceOperateCodeEnum.HEARTBEAT.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,8 +4,9 @@ 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.njcn.gather.detection.pojo.enums.SourceResponseCodeEnum;
|
import com.njcn.gather.detection.pojo.enums.SourceResponseCodeEnum;
|
||||||
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
import com.njcn.gather.detection.pojo.vo.SocketDataMsg;
|
import com.njcn.gather.detection.pojo.vo.SocketDataMsg;
|
||||||
import com.njcn.gather.detection.pojo.vo.WebSocketVO;
|
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
||||||
import com.njcn.gather.detection.util.socket.SocketManager;
|
import com.njcn.gather.detection.util.socket.SocketManager;
|
||||||
import com.njcn.gather.detection.util.socket.WebServiceManager;
|
import com.njcn.gather.detection.util.socket.WebServiceManager;
|
||||||
import io.netty.bootstrap.Bootstrap;
|
import io.netty.bootstrap.Bootstrap;
|
||||||
@@ -30,7 +31,10 @@ import java.util.concurrent.TimeUnit;
|
|||||||
@Getter
|
@Getter
|
||||||
public class NettyClient {
|
public class NettyClient {
|
||||||
|
|
||||||
public static void socketClient(String ip, Integer port, String userPageId,String msg, SimpleChannelInboundHandler<String> handler) {
|
private static final String dev = "_Dev";
|
||||||
|
private static final String source = "_Source";
|
||||||
|
|
||||||
|
public static void socketClient(String ip, Integer port, PreDetectionParam param, String msg, SimpleChannelInboundHandler<String> handler) {
|
||||||
NioEventLoopGroup group = new NioEventLoopGroup();
|
NioEventLoopGroup group = new NioEventLoopGroup();
|
||||||
Bootstrap bootstrap = new Bootstrap();
|
Bootstrap bootstrap = new Bootstrap();
|
||||||
try {
|
try {
|
||||||
@@ -44,19 +48,22 @@ public class NettyClient {
|
|||||||
ch.pipeline()
|
ch.pipeline()
|
||||||
//空闲状态的handler
|
//空闲状态的handler
|
||||||
// 添加LineBasedFrameDecoder来按行分割数据
|
// 添加LineBasedFrameDecoder来按行分割数据
|
||||||
// .addLast(new LineBasedFrameDecoder(10240))
|
.addLast(new LineBasedFrameDecoder(10240))
|
||||||
.addLast(new IdleStateHandler(20, 0, 0, TimeUnit.SECONDS))
|
// .addLast(new IdleStateHandler(0, 10, 0, TimeUnit.SECONDS))
|
||||||
.addLast(new StringDecoder(CharsetUtil.UTF_8))
|
.addLast(new StringDecoder(CharsetUtil.UTF_8))
|
||||||
.addLast(new StringEncoder(CharsetUtil.UTF_8))
|
.addLast(new StringEncoder(CharsetUtil.UTF_8))
|
||||||
|
.addLast(new HeartbeatHandler(param, source))
|
||||||
.addLast(handler);
|
.addLast(handler);
|
||||||
} else {
|
} else {
|
||||||
ch.pipeline()
|
ch.pipeline()
|
||||||
//空闲状态的handler
|
|
||||||
// 添加LineBasedFrameDecoder来按行分割数据
|
// 添加LineBasedFrameDecoder来按行分割数据
|
||||||
.addLast(new LineBasedFrameDecoder(10240))
|
.addLast(new LineBasedFrameDecoder(10240))
|
||||||
.addLast(new IdleStateHandler(10, 0, 0, TimeUnit.SECONDS))
|
|
||||||
.addLast(new StringDecoder(CharsetUtil.UTF_8))
|
.addLast(new StringDecoder(CharsetUtil.UTF_8))
|
||||||
.addLast(new StringEncoder(CharsetUtil.UTF_8))
|
.addLast(new StringEncoder(CharsetUtil.UTF_8))
|
||||||
|
.addLast(new HeartbeatHandler(param, dev))
|
||||||
|
//空闲状态的handler
|
||||||
|
.addLast(new IdleStateHandler(60, 0, 0, TimeUnit.SECONDS))
|
||||||
.addLast(handler);
|
.addLast(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,22 +73,28 @@ public class NettyClient {
|
|||||||
channelFuture.addListener((ChannelFutureListener) ch -> {
|
channelFuture.addListener((ChannelFutureListener) ch -> {
|
||||||
if (!ch.isSuccess()) {
|
if (!ch.isSuccess()) {
|
||||||
System.out.println("链接服务端失败...");
|
System.out.println("链接服务端失败...");
|
||||||
|
// 连接失败时关闭 group
|
||||||
|
group.shutdownGracefully();
|
||||||
} else {
|
} else {
|
||||||
System.out.println("链接服务端成功...");
|
System.out.println("链接服务端成功...");
|
||||||
System.out.println("客户端向服务端发送消息:"+msg);
|
if (handler instanceof NettySourceClientHandler) {
|
||||||
channelFuture.channel().writeAndFlush(msg);
|
NioEventLoopGroup groupByUserId = SocketManager.getGroupByUserId(param.getUserPageId() + source);
|
||||||
|
if(ObjectUtil.isNotNull(groupByUserId)){
|
||||||
|
groupByUserId.shutdownGracefully().sync();
|
||||||
|
}
|
||||||
|
SocketManager.addGroup(param.getUserPageId() + source, group);
|
||||||
|
} else {
|
||||||
|
NioEventLoopGroup groupByUserId = SocketManager.getGroupByUserId(param.getUserPageId() + dev);
|
||||||
|
if(ObjectUtil.isNotNull(groupByUserId)){
|
||||||
|
groupByUserId.shutdownGracefully().sync();
|
||||||
|
}
|
||||||
|
SocketManager.addGroup(param.getUserPageId() + dev, group);
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("客户端向服务端发送消息:" + port + msg);
|
||||||
|
channelFuture.channel().writeAndFlush(msg + "\n");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
NioEventLoopGroup groupByUserId = SocketManager.getGroupByUserId(userPageId + "_Dev");
|
|
||||||
if(ObjectUtil.isNotNull(groupByUserId)){
|
|
||||||
groupByUserId.shutdownGracefully();
|
|
||||||
}else{
|
|
||||||
if (handler instanceof NettySourceClientHandler) {
|
|
||||||
SocketManager.addGroup(userPageId+"_Source",group);
|
|
||||||
}else{
|
|
||||||
SocketManager.addGroup(userPageId+"_Dev",group);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("连接socket服务端发送异常............" + e.getMessage());
|
System.out.println("连接socket服务端发送异常............" + e.getMessage());
|
||||||
group.shutdownGracefully();
|
group.shutdownGracefully();
|
||||||
@@ -94,9 +107,10 @@ public class NettyClient {
|
|||||||
if (handler instanceof NettySourceClientHandler) {
|
if (handler instanceof NettySourceClientHandler) {
|
||||||
socketDataMsg.setOperateCode("Source");
|
socketDataMsg.setOperateCode("Source");
|
||||||
} else {
|
} else {
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
socketDataMsg.setOperateCode("Dev");
|
socketDataMsg.setOperateCode("Dev");
|
||||||
}
|
}
|
||||||
WebServiceManager.sendMsg(userPageId, JSON.toJSONString(socketDataMsg));
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketDataMsg));
|
||||||
} finally {
|
} finally {
|
||||||
// System.out.println("进入clientSocket最后步骤---------------------");
|
// System.out.println("进入clientSocket最后步骤---------------------");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,35 @@
|
|||||||
package com.njcn.gather.detection.util.socket.cilent;
|
package com.njcn.gather.detection.util.socket.cilent;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.njcn.gather.detection.handler.SocketDevResponseService;
|
import com.njcn.gather.detection.handler.SocketDevResponseService;
|
||||||
|
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
import com.njcn.gather.detection.pojo.vo.DevLineTestResult;
|
||||||
import com.njcn.gather.detection.util.socket.SocketManager;
|
import com.njcn.gather.detection.pojo.vo.SocketDataMsg;
|
||||||
|
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
||||||
|
import com.njcn.gather.detection.pojo.vo.WebSocketVO;
|
||||||
|
import com.njcn.gather.detection.util.socket.*;
|
||||||
|
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||||
|
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||||
|
import com.njcn.gather.system.pojo.enums.DicDataEnum;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.SimpleChannelInboundHandler;
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
|
import io.netty.handler.timeout.IdleState;
|
||||||
|
import io.netty.handler.timeout.IdleStateEvent;
|
||||||
import io.netty.handler.timeout.TimeoutException;
|
import io.netty.handler.timeout.TimeoutException;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
import java.net.ProtocolException;
|
import java.net.ProtocolException;
|
||||||
import java.util.Objects;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,6 +50,7 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler<String> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 当通道进行连接时推送消息
|
* 当通道进行连接时推送消息
|
||||||
|
*
|
||||||
* @param ctx
|
* @param ctx
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -41,7 +58,11 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler<String> {
|
|||||||
System.out.println("客户端通道已建立" + ctx.channel().id());
|
System.out.println("客户端通道已建立" + ctx.channel().id());
|
||||||
Channel channel = SocketManager.getChannelByUserId(param.getUserPageId() + dev);
|
Channel channel = SocketManager.getChannelByUserId(param.getUserPageId() + dev);
|
||||||
if (Objects.nonNull(channel)) {
|
if (Objects.nonNull(channel)) {
|
||||||
|
try {
|
||||||
channel.close().sync();
|
channel.close().sync();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
SocketManager.addUser(param.getUserPageId() + dev, ctx.channel());
|
SocketManager.addUser(param.getUserPageId() + dev, ctx.channel());
|
||||||
}
|
}
|
||||||
@@ -64,12 +85,15 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler<String> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 当通道断线时,支持重连
|
* 当通道断线时,支持重连
|
||||||
|
*
|
||||||
* @param ctx
|
* @param ctx
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void channelInactive(ChannelHandlerContext ctx) {
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||||
System.out.println("客户端断线");
|
System.out.println("设备通讯客户端断线");
|
||||||
//SocketManager.addUser(webUser,ctx.channel());
|
ctx.close();
|
||||||
|
SocketManager.removeUser(param.getUserPageId() + dev);
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,11 +104,69 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler<String> {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
||||||
System.out.println("进入超时。。。。。。");
|
Boolean fly = false;
|
||||||
//当连接超过10S和发送消息后10S无响应时候,关闭channel
|
if (evt instanceof IdleStateEvent) {
|
||||||
|
if (((IdleStateEvent) evt).state() == IdleState.READER_IDLE) {
|
||||||
|
System.out.println(LocalDateTime.now() + "devHandler触发读超时函数**************************************");
|
||||||
|
if (!FormalTestManager.hasStopFlag) {
|
||||||
|
if (CollUtil.isNotEmpty(SocketManager.getSourceList())) {
|
||||||
|
SourceIssue sourceIssue = SocketManager.getSourceList().get(0);
|
||||||
|
if (SocketManager.clockMap.containsKey(sourceIssue.getIndex())) {
|
||||||
|
SocketManager.clockMap.put(sourceIssue.getIndex(), SocketManager.clockMap.get(sourceIssue.getIndex()) + 60L);
|
||||||
|
} else {
|
||||||
|
SocketManager.clockMap.put(sourceIssue.getIndex(), 60L);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sourceIssue.getType().equals(DicDataEnum.F.getCode())) {
|
||||||
|
//闪变,正常抛一轮最大等待20分钟超时
|
||||||
|
if (SocketManager.clockMap.get(sourceIssue.getIndex()) > 1300) {
|
||||||
|
fly = true;
|
||||||
|
System.out.println("超时处理-----》" + sourceIssue.getType() + "已超时----------------关闭");
|
||||||
|
CnSocketUtil.quitSend(param);
|
||||||
|
timeoutSend(sourceIssue);
|
||||||
|
}
|
||||||
|
} else if (sourceIssue.getType().equals(DicDataEnum.VOLTAGE.getCode()) || sourceIssue.getType().equals(DicDataEnum.HP.getCode())) {
|
||||||
|
//统计数据项,正常抛一轮数据,超时
|
||||||
|
if (SocketManager.clockMap.get(sourceIssue.getIndex()) > 180) {
|
||||||
|
fly = true;
|
||||||
|
CnSocketUtil.quitSend(param);
|
||||||
|
System.out.println("超时处理-----》" + sourceIssue.getType() + "已超时----------------关闭");
|
||||||
|
timeoutSend(sourceIssue);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//实时数据
|
||||||
|
if (SocketManager.clockMap.get(sourceIssue.getIndex()) > 60) {
|
||||||
|
fly = true;
|
||||||
|
CnSocketUtil.quitSend(param);
|
||||||
|
System.out.println("超时处理-----》" + sourceIssue.getType() + "已超时----------------关闭");
|
||||||
|
timeoutSend(sourceIssue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fly = true;
|
||||||
|
//为空则认为是常规步骤,设定一分钟超时
|
||||||
|
CnSocketUtil.quitSend(param);
|
||||||
|
CnSocketUtil.sendToWebSocket(param.getUserPageId(), SourceOperateCodeEnum.SOCKET_TIMEOUT.getValue(), SourceOperateCodeEnum.SOCKET_TIMEOUT.getValue(), SourceOperateCodeEnum.SOCKET_TIMEOUT.getMsg(), null);
|
||||||
|
}
|
||||||
|
if (fly) {
|
||||||
|
socketResponseService.backCheckState(param);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//如果是暂停操作后
|
||||||
|
FormalTestManager.stopTime += 60;
|
||||||
|
System.out.println("当前进入暂停操作超时函数-----------------" + FormalTestManager.stopTime);
|
||||||
|
if (FormalTestManager.stopTime > 600) {
|
||||||
|
CnSocketUtil.quitSend(param);
|
||||||
|
CnSocketUtil.sendToWebSocket(param.getUserPageId(), SourceOperateCodeEnum.FORMAL_REAL.getValue(), SourceOperateCodeEnum.STOP_TIMEOUT.getValue(), SourceOperateCodeEnum.STOP_TIMEOUT.getMsg(), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handlerAdded(ChannelHandlerContext ctx) {
|
public void handlerAdded(ChannelHandlerContext ctx) {
|
||||||
System.out.println("有通道准备接入" + ctx.channel());
|
System.out.println("有通道准备接入" + ctx.channel());
|
||||||
@@ -93,6 +175,7 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler<String> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||||
|
System.out.println("捕获到设备服务异常。。。。。。。");
|
||||||
// 处理异常,例如记录日志、关闭连接等
|
// 处理异常,例如记录日志、关闭连接等
|
||||||
cause.printStackTrace();
|
cause.printStackTrace();
|
||||||
// 根据异常类型进行不同的处理
|
// 根据异常类型进行不同的处理
|
||||||
@@ -103,6 +186,8 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler<String> {
|
|||||||
} else if (cause instanceof IOException) {
|
} else if (cause instanceof IOException) {
|
||||||
// 处理I/O异常,例如读写错误
|
// 处理I/O异常,例如读写错误
|
||||||
System.out.println("IOException caught: There was an I/O error.");
|
System.out.println("IOException caught: There was an I/O error.");
|
||||||
|
CnSocketUtil.sendToWebSocket(param.getUserPageId(), SourceOperateCodeEnum.DEVICE_ERROR.getValue(), SourceOperateCodeEnum.DEVICE_ERROR.getValue(), SourceOperateCodeEnum.DEVICE_ERROR.getMsg(), null);
|
||||||
|
|
||||||
// 例如,可以记录更详细的I/O错误信息
|
// 例如,可以记录更详细的I/O错误信息
|
||||||
} else if (cause instanceof TimeoutException) {
|
} else if (cause instanceof TimeoutException) {
|
||||||
// 处理超时异常
|
// 处理超时异常
|
||||||
@@ -115,9 +200,53 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler<String> {
|
|||||||
} else {
|
} else {
|
||||||
// 处理其他类型的异常
|
// 处理其他类型的异常
|
||||||
System.out.println("Unknown exception caught: " + cause.getMessage());
|
System.out.println("Unknown exception caught: " + cause.getMessage());
|
||||||
|
CnSocketUtil.sendToWebSocket(param.getUserPageId(), SourceOperateCodeEnum.DEVICE_ERROR.getValue(), SourceOperateCodeEnum.DEVICE_ERROR.getValue(), SourceOperateCodeEnum.DEVICE_ERROR.getMsg(), null);
|
||||||
// 可以记录未知异常信息
|
// 可以记录未知异常信息
|
||||||
}
|
}
|
||||||
|
CnSocketUtil.quitSend(param);
|
||||||
|
CnSocketUtil.quitSendSource(param);
|
||||||
|
socketResponseService.backCheckState(param);
|
||||||
ctx.close();
|
ctx.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送业务消息时候开启计时器,
|
||||||
|
* @param requestId
|
||||||
|
*/
|
||||||
|
/* private void scheduleTimeoutTask(String requestId) {
|
||||||
|
ScheduledFuture<?> future = scheduler.schedule(() -> {
|
||||||
|
if (requestTimeoutTasks.containsKey(requestId)) {
|
||||||
|
// 处理超时逻辑
|
||||||
|
System.out.println("Business request with ID " + requestId + " timed out.");
|
||||||
|
requestTimeoutTasks.remove(requestId);
|
||||||
|
ctx.close();
|
||||||
|
}
|
||||||
|
}, BUSINESS_REQUEST_TIMEOUT, TimeUnit.MILLISECONDS);
|
||||||
|
requestTimeoutTasks.put(requestId, future);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 超时后的处理
|
||||||
|
*/
|
||||||
|
private void timeoutSend(SourceIssue sourceIssue) {
|
||||||
|
List<DevLineTestResult> devListRes = new ArrayList<>();
|
||||||
|
FormalTestManager.devList.forEach(dev -> {
|
||||||
|
DevLineTestResult devLineTestResult = new DevLineTestResult();
|
||||||
|
devLineTestResult.setDeviceId(dev.getDevId());
|
||||||
|
devLineTestResult.setDeviceName(dev.getDevName());
|
||||||
|
List<Integer> resultFlagList = new ArrayList<>();
|
||||||
|
List<PreDetection.MonitorListDTO> monitorListDTOList = dev.getMonitorList();
|
||||||
|
monitorListDTOList.forEach(i -> resultFlagList.add(3));
|
||||||
|
devLineTestResult.setChnResult(resultFlagList.toArray(new Integer[monitorListDTOList.size()]));
|
||||||
|
devListRes.add(devLineTestResult);
|
||||||
|
});
|
||||||
|
WebSocketVO<List<DevLineTestResult>> socketVO = new WebSocketVO<>();
|
||||||
|
socketVO.setRequestId(sourceIssue.getType() + "_End");
|
||||||
|
socketVO.setOperateCode(sourceIssue.getType());
|
||||||
|
socketVO.setData(devListRes);
|
||||||
|
WebServiceManager.sendMsg(param.getUserPageId(), JSON.toJSONString(socketVO));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package com.njcn.gather.detection.util.socket.cilent;
|
package com.njcn.gather.detection.util.socket.cilent;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.njcn.gather.detection.handler.SocketSourceResponseService;
|
import com.njcn.gather.detection.handler.SocketSourceResponseService;
|
||||||
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
import com.njcn.gather.detection.pojo.vo.SocketDataMsg;
|
import com.njcn.gather.detection.pojo.vo.SocketDataMsg;
|
||||||
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
||||||
|
import com.njcn.gather.detection.pojo.vo.WebSocketVO;
|
||||||
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
||||||
import com.njcn.gather.detection.util.socket.MsgUtil;
|
import com.njcn.gather.detection.util.socket.MsgUtil;
|
||||||
import com.njcn.gather.detection.util.socket.SocketManager;
|
import com.njcn.gather.detection.util.socket.SocketManager;
|
||||||
@@ -32,6 +34,7 @@ import java.util.Objects;
|
|||||||
public class NettySourceClientHandler extends SimpleChannelInboundHandler<String> {
|
public class NettySourceClientHandler extends SimpleChannelInboundHandler<String> {
|
||||||
|
|
||||||
private final PreDetectionParam webUser;
|
private final PreDetectionParam webUser;
|
||||||
|
private final String sourceTag = "_Source";
|
||||||
private final SocketSourceResponseService sourceResponseService;
|
private final SocketSourceResponseService sourceResponseService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,7 +46,7 @@ public class NettySourceClientHandler extends SimpleChannelInboundHandler<String
|
|||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
System.out.println("客户端通道已建立" + ctx.channel().id());
|
System.out.println("客户端通道已建立" + ctx.channel().id());
|
||||||
|
|
||||||
SocketManager.addUser(webUser.getUserPageId() + "_Source", ctx.channel());
|
SocketManager.addUser(webUser.getUserPageId() + sourceTag, ctx.channel());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -51,7 +54,7 @@ public class NettySourceClientHandler extends SimpleChannelInboundHandler<String
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, String msg) throws InterruptedException {
|
protected void channelRead0(ChannelHandlerContext ctx, String msg) throws InterruptedException {
|
||||||
System.out.println("接收server端数据>>>>>>" + msg);
|
System.out.println("source接收server端数据>>>>>>" + msg);
|
||||||
try {
|
try {
|
||||||
sourceResponseService.deal(webUser, msg);
|
sourceResponseService.deal(webUser, msg);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -68,7 +71,10 @@ public class NettySourceClientHandler extends SimpleChannelInboundHandler<String
|
|||||||
* @param ctx
|
* @param ctx
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void channelInactive(ChannelHandlerContext ctx) {
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception{
|
||||||
|
System.out.println("源通讯客户端断线");
|
||||||
|
ctx.close();
|
||||||
|
SocketManager.removeUser(webUser.getUserPageId()+sourceTag);
|
||||||
// System.out.println("断线了......" + ctx.channel());
|
// System.out.println("断线了......" + ctx.channel());
|
||||||
// ctx.channel().eventLoop().schedule(() -> {
|
// ctx.channel().eventLoop().schedule(() -> {
|
||||||
// System.out.println("断线重连......");
|
// System.out.println("断线重连......");
|
||||||
@@ -87,13 +93,13 @@ public class NettySourceClientHandler extends SimpleChannelInboundHandler<String
|
|||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
||||||
//如果是空闲状态事件
|
//如果是空闲状态事件
|
||||||
if (evt instanceof IdleStateEvent) {
|
if (evt instanceof IdleStateEvent) {
|
||||||
if (((IdleStateEvent) evt).state() == IdleState.READER_IDLE) {
|
if (((IdleStateEvent) evt).state() == IdleState.WRITER_IDLE) {
|
||||||
//发送ping 保持心跳链接
|
//发送ping 保持心跳链接
|
||||||
SocketMsg msg = new SocketMsg();
|
/* SocketMsg<String> msg = new SocketMsg<>();
|
||||||
msg.setRequestId("yxt");
|
msg.setRequestId("yxt");
|
||||||
msg.setOperateCode(SourceOperateCodeEnum.HEARTBEAT.getValue());
|
msg.setOperateCode(SourceOperateCodeEnum.HEARTBEAT.getValue());
|
||||||
msg.setData("");
|
msg.setData("");
|
||||||
ctx.writeAndFlush(MsgUtil.toJsonWithNewLinePlain(msg));
|
ctx.writeAndFlush(JSON.toJSONString(msg)+"\n");*/
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//防止堆栈溢出
|
//防止堆栈溢出
|
||||||
@@ -110,6 +116,7 @@ public class NettySourceClientHandler extends SimpleChannelInboundHandler<String
|
|||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||||
// 处理异常,例如记录日志、关闭连接等
|
// 处理异常,例如记录日志、关闭连接等
|
||||||
|
System.out.println("捕获到源异常。。。。。。。");
|
||||||
cause.printStackTrace();
|
cause.printStackTrace();
|
||||||
// 根据异常类型进行不同的处理
|
// 根据异常类型进行不同的处理
|
||||||
if (cause instanceof ConnectException) {
|
if (cause instanceof ConnectException) {
|
||||||
@@ -118,7 +125,8 @@ public class NettySourceClientHandler extends SimpleChannelInboundHandler<String
|
|||||||
|
|
||||||
} else if (cause instanceof IOException) {
|
} else if (cause instanceof IOException) {
|
||||||
// 处理I/O异常,例如读写错误
|
// 处理I/O异常,例如读写错误
|
||||||
System.out.println("IOException caught: There was an I/O error.");
|
CnSocketUtil.sendToWebSocket(webUser.getUserPageId(),SourceOperateCodeEnum.SERVER_ERROR.getValue(),SourceOperateCodeEnum.SERVER_ERROR.getValue(),SourceOperateCodeEnum.SERVER_ERROR.getMsg(),null );
|
||||||
|
|
||||||
// 例如,可以记录更详细的I/O错误信息
|
// 例如,可以记录更详细的I/O错误信息
|
||||||
} else if (cause instanceof TimeoutException) {
|
} else if (cause instanceof TimeoutException) {
|
||||||
// 处理超时异常
|
// 处理超时异常
|
||||||
|
|||||||
@@ -0,0 +1,149 @@
|
|||||||
|
package com.njcn.gather.detection.util.socket.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||||
|
import com.njcn.gather.detection.pojo.vo.SocketDataMsg;
|
||||||
|
import com.njcn.gather.detection.util.socket.MsgUtil;
|
||||||
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 客户端业务处理
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2024/12/10 14:18
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class DevNettyServerHandler extends SimpleChannelInboundHandler<String> {
|
||||||
|
|
||||||
|
private final String DEV = "_Dev";
|
||||||
|
private final String source = "_Source";
|
||||||
|
|
||||||
|
private final String stepTag = "&&";
|
||||||
|
private final String stepBegin = "_Start";
|
||||||
|
private final String stepEnd = "_End";
|
||||||
|
|
||||||
|
|
||||||
|
public static final DevNettyServerHandler INSTANCE = new DevNettyServerHandler();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 当通道进行连接时推送消息
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2024/12/10 14:19
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
|
System.out.println("服务端监听到" + ctx.channel().id() + "连接");
|
||||||
|
super.channelActive(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理消息信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void channelRead0(ChannelHandlerContext ctx, String msg) {
|
||||||
|
System.out.println(ctx.channel().id() + "NettyServer服务端接收到客户端消息:" + msg);
|
||||||
|
Channel channel = ctx.channel();
|
||||||
|
SocketDataMsg socketDataMsg = MsgUtil.socketDataMsg(msg);
|
||||||
|
String[] tem = socketDataMsg.getRequestId().split(stepTag);
|
||||||
|
SourceOperateCodeEnum sourceOperateCodeEnum = SourceOperateCodeEnum.getDictDataEnumByCode(tem[0]);
|
||||||
|
|
||||||
|
switch (Objects.requireNonNull(sourceOperateCodeEnum)) {
|
||||||
|
//设备通讯校验
|
||||||
|
case YJC_SBTXJY:
|
||||||
|
String aa = "{\"requestId\":\"yjc_sbtxjy\",\"operateCode\":\"INIT_GATHER$01\",\"data\":null,\"code\":10201}";
|
||||||
|
String bb = "{\"requestId\":\"yjc_sbtxjy\",\"operateCode\":\"INIT_GATHER$01\",\"data\":null,\"code\":10201}";
|
||||||
|
String cc = "{\"requestId\":\"yjc_sbtxjy\",\"operateCode\":\"INIT_GATHER$01\",\"data\":\"192.168.1.237_1\",\"code\":10200}";
|
||||||
|
channel.writeAndFlush(aa+"\n");
|
||||||
|
channel.writeAndFlush(bb+"\n");
|
||||||
|
channel.writeAndFlush(cc+"\n");
|
||||||
|
break;
|
||||||
|
//协议校验
|
||||||
|
case YJC_XYJY:
|
||||||
|
String dd="{\"requestId\":\"yjc_xyjy\",\"operateCode\":\"INIT_GATHER$02\",\"data\":null,\"code\":10201}";
|
||||||
|
String ee = "{\"requestId\":\"yjc_xyjy\",\"operateCode\":\"INIT_GATHER$02\",\"data\":\"192.168.1.237_1\",\"code\":10200}";
|
||||||
|
channel.writeAndFlush(dd+"\n");
|
||||||
|
channel.writeAndFlush(ee+"\n");
|
||||||
|
|
||||||
|
String ff = "{\"requestId\":\"yjc_xyjy\",\"operateCode\":\"INIT_GATHER$03\",\"data\":null,\"code\":10201}";
|
||||||
|
String gg ="{\"requestId\":\"yjc_xyjy\",\"operateCode\":\"INIT_GATHER$03\",\"data\":\"192.168.1.237_1\",\"code\":10200}";
|
||||||
|
channel.writeAndFlush(ff+"\n");
|
||||||
|
channel.writeAndFlush(gg+"\n");
|
||||||
|
break;
|
||||||
|
//相序校验
|
||||||
|
case YJC_XUJY:
|
||||||
|
String hh = "{\"requestId\":\"YJC_xujy\",\"operateCode\":\"DATA_REQUEST$02\",\"data\":null,\"code\":10201}";
|
||||||
|
String ii = "{\"requestId\":\"YJC_xujy\",\"operateCode\":\"DATA_REQUEST$02\",\"data\":\"{\\\"Time\\\":\\\"2025-02-14T15:09:06.004\\\",\\\"ID\\\":\\\"192.168.1.237_1\\\",\\\"result\\\":false,\\\"SqlData\\\":[{\\\"type\\\":\\\"real\\\",\\\"desc\\\":\\\"VRMS\\\",\\\"list\\\":{\\\"A\\\":\\\"59.969920\\\",\\\"B\\\":\\\"49.963360\\\",\\\"C\\\":\\\"39.971470\\\",\\\"T\\\":null}},{\\\"type\\\":\\\"real\\\",\\\"desc\\\":\\\"VA\\\",\\\"list\\\":{\\\"A\\\":\\\"0.000000\\\",\\\"B\\\":\\\"-119.864000\\\",\\\"C\\\":\\\"120.052000\\\",\\\"T\\\":null}},{\\\"type\\\":\\\"real\\\",\\\"desc\\\":\\\"IRMS\\\",\\\"list\\\":{\\\"A\\\":\\\"1.000979\\\",\\\"B\\\":\\\"1.998939\\\",\\\"C\\\":\\\"3.000807\\\",\\\"T\\\":null}},{\\\"type\\\":\\\"real\\\",\\\"desc\\\":\\\"IA\\\",\\\"list\\\":{\\\"A\\\":\\\"-0.038000\\\",\\\"B\\\":\\\"-120.052000\\\",\\\"C\\\":\\\"119.941000\\\",\\\"T\\\":null}}],\\\"SqlDataHarm\\\":[]}\",\"code\":10200}\n";
|
||||||
|
channel.writeAndFlush(hh+"\n");
|
||||||
|
channel.writeAndFlush(ii+"\n");
|
||||||
|
break;
|
||||||
|
//正式检测
|
||||||
|
case FORMAL_REAL:
|
||||||
|
|
||||||
|
break;
|
||||||
|
//系数校验
|
||||||
|
case Coefficient_Check:
|
||||||
|
String a = "{\"requestId\":\"Coefficient_Check\",\"operateCode\":\"DATA_CHNFACTOR$01\",\"data\":null,\"code\":10201}";
|
||||||
|
String b = "{\"requestId\":\"Coefficient_Check\",\"operateCode\":\"DATA_CHNFACTOR$01\",\"data\":\"[{\\\"uMonitorPoint\\\":0,\\\"f\\\":{\\\"Ua_gain\\\":9999,\\\"Ub_gain\\\":10008,\\\"Uc_gain\\\":10000,\\\"U0_gain\\\":10000,\\\"Ia_gain\\\":9997,\\\"Ib_gain\\\":9997,\\\"Ic_gain\\\":10001,\\\"I0_gain\\\":10000,\\\"Uab_gain\\\":9999,\\\"Ubc_gain\\\":10008,\\\"Uca_gain\\\":10000}}]\",\"code\":10200}";
|
||||||
|
channel.writeAndFlush(a+"\n");
|
||||||
|
channel.writeAndFlush(b+"\n");
|
||||||
|
|
||||||
|
switch (Objects.requireNonNull(sourceOperateCodeEnum)) {
|
||||||
|
case DATA_CHNFACTOR$01:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
//退出关闭
|
||||||
|
case QUITE:
|
||||||
|
// quitDeal(socketDataMsg, param, msg);
|
||||||
|
break;
|
||||||
|
case YXT:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handlerAdded(ChannelHandlerContext ctx) {
|
||||||
|
System.out.println("有新连接加入了++++......" + ctx.channel());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||||
|
cause.printStackTrace();
|
||||||
|
ctx.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||||
|
// Client disconnected, close the server-side channel too
|
||||||
|
System.out.println("NettyServer服务端监听到" + ctx.channel().id() + "关闭连接");
|
||||||
|
ctx.close(); // This will trigger the close event on the server side
|
||||||
|
super.channelInactive(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户事件的回调方法(自定义事件用于心跳机制)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
|
//空闲状态的事件
|
||||||
|
// if (evt instanceof IdleStateEvent) {
|
||||||
|
// IdleStateEvent event = (IdleStateEvent) evt;
|
||||||
|
// System.out.println(event.state() + ">>>" + ctx.channel().id());
|
||||||
|
// //已经10秒钟没有读时间了
|
||||||
|
// if (event.state().equals(IdleState.READER_IDLE)){
|
||||||
|
// // 心跳包丢失,10秒没有收到客户端心跳 (断开连接)
|
||||||
|
// ctx.channel().close().sync();
|
||||||
|
// System.out.println("已与 "+ctx.channel().remoteAddress()+" 断开连接");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,6 +6,11 @@ import io.netty.channel.ChannelInitializer;
|
|||||||
import io.netty.channel.nio.NioEventLoopGroup;
|
import io.netty.channel.nio.NioEventLoopGroup;
|
||||||
import io.netty.channel.socket.ServerSocketChannel;
|
import io.netty.channel.socket.ServerSocketChannel;
|
||||||
import io.netty.channel.socket.nio.NioServerSocketChannel;
|
import io.netty.channel.socket.nio.NioServerSocketChannel;
|
||||||
|
import io.netty.channel.socket.nio.NioSocketChannel;
|
||||||
|
import io.netty.handler.codec.LineBasedFrameDecoder;
|
||||||
|
import io.netty.handler.codec.string.StringDecoder;
|
||||||
|
import io.netty.handler.codec.string.StringEncoder;
|
||||||
|
import io.netty.util.CharsetUtil;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,11 +30,17 @@ public class NettyServer {
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
NettyServer nettyServer = new NettyServer();
|
NettyServer nettyServer = new NettyServer();
|
||||||
nettyServer.run();
|
nettyServer.runSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void run() {
|
public static void sourceMain(String[] args) {
|
||||||
|
NettyServer nettyServer = new NettyServer();
|
||||||
|
nettyServer.runDev();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void runSource() {
|
||||||
NioEventLoopGroup boss = new NioEventLoopGroup(1);
|
NioEventLoopGroup boss = new NioEventLoopGroup(1);
|
||||||
NioEventLoopGroup work = new NioEventLoopGroup();
|
NioEventLoopGroup work = new NioEventLoopGroup();
|
||||||
try {
|
try {
|
||||||
@@ -39,19 +50,30 @@ public class NettyServer {
|
|||||||
.handler(new ChannelInitializer<ServerSocketChannel>() {
|
.handler(new ChannelInitializer<ServerSocketChannel>() {
|
||||||
@Override
|
@Override
|
||||||
protected void initChannel(ServerSocketChannel ch) {
|
protected void initChannel(ServerSocketChannel ch) {
|
||||||
System.out.println("服务正在启动中......");
|
System.out.println("源通讯服务正在启动中......");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
//业务处理
|
//业务处理
|
||||||
.childHandler(NettyServerChannelInitializer.INSTANCE);
|
.childHandler(new ChannelInitializer<NioSocketChannel>() {
|
||||||
|
@Override
|
||||||
|
protected void initChannel(NioSocketChannel ch) {
|
||||||
|
ch.pipeline()
|
||||||
|
//空闲状态的handler
|
||||||
|
// 添加LineBasedFrameDecoder来按行分割数据
|
||||||
|
.addLast(new LineBasedFrameDecoder(10240))
|
||||||
|
.addLast(new StringDecoder(CharsetUtil.UTF_8))
|
||||||
|
.addLast(new StringEncoder(CharsetUtil.UTF_8))
|
||||||
|
.addLast(new DevNettyServerHandler());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
ChannelFuture future = bootstrap.bind(port).sync();
|
ChannelFuture future = bootstrap.bind(port).sync();
|
||||||
|
|
||||||
future.addListener(f -> {
|
future.addListener(f -> {
|
||||||
if (future.isSuccess()) {
|
if (future.isSuccess()) {
|
||||||
System.out.println("服务启动成功");
|
System.out.println("源通讯服务启动成功");
|
||||||
} else {
|
} else {
|
||||||
System.out.println("服务启动失败");
|
System.out.println("源通讯服务启动失败");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
future.channel().closeFuture().sync();
|
future.channel().closeFuture().sync();
|
||||||
@@ -63,4 +85,52 @@ public class NettyServer {
|
|||||||
work.shutdownGracefully();
|
work.shutdownGracefully();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void runDev() {
|
||||||
|
NioEventLoopGroup boss = new NioEventLoopGroup(1);
|
||||||
|
NioEventLoopGroup work = new NioEventLoopGroup();
|
||||||
|
try {
|
||||||
|
ServerBootstrap bootstrap = new ServerBootstrap().group(boss, work);
|
||||||
|
bootstrap.channel(NioServerSocketChannel.class)
|
||||||
|
//这个处理器可以不写
|
||||||
|
.handler(new ChannelInitializer<ServerSocketChannel>() {
|
||||||
|
@Override
|
||||||
|
protected void initChannel(ServerSocketChannel ch) {
|
||||||
|
System.out.println("设备通讯服务正在启动中......");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
//业务处理
|
||||||
|
.childHandler(new ChannelInitializer<NioSocketChannel>() {
|
||||||
|
@Override
|
||||||
|
protected void initChannel(NioSocketChannel ch) {
|
||||||
|
ch.pipeline()
|
||||||
|
//空闲状态的handler
|
||||||
|
// 添加LineBasedFrameDecoder来按行分割数据
|
||||||
|
.addLast(new LineBasedFrameDecoder(10240))
|
||||||
|
.addLast(new StringDecoder(CharsetUtil.UTF_8))
|
||||||
|
.addLast(new StringEncoder(CharsetUtil.UTF_8))
|
||||||
|
.addLast(new SourceNettyServerHandler());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ChannelFuture future = bootstrap.bind(port).sync();
|
||||||
|
|
||||||
|
future.addListener(f -> {
|
||||||
|
if (future.isSuccess()) {
|
||||||
|
System.out.println("设备通讯服务启动成功");
|
||||||
|
} else {
|
||||||
|
System.out.println("设备通讯服务启动失败");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
future.channel().closeFuture().sync();
|
||||||
|
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
boss.shutdownGracefully();
|
||||||
|
work.shutdownGracefully();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.njcn.gather.detection.util.socket.service;
|
package com.njcn.gather.detection.util.socket.service;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandler;
|
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.socket.nio.NioSocketChannel;
|
import io.netty.channel.socket.nio.NioSocketChannel;
|
||||||
import io.netty.handler.codec.string.StringDecoder;
|
import io.netty.handler.codec.string.StringDecoder;
|
||||||
@@ -24,7 +23,7 @@ public class NettyServerChannelInitializer extends ChannelInitializer<NioSocketC
|
|||||||
// .addLast(new IdleStateHandler(10, 0, 0, TimeUnit.SECONDS))
|
// .addLast(new IdleStateHandler(10, 0, 0, TimeUnit.SECONDS))
|
||||||
.addLast(new StringDecoder(CharsetUtil.UTF_8))
|
.addLast(new StringDecoder(CharsetUtil.UTF_8))
|
||||||
.addLast(new StringEncoder(CharsetUtil.UTF_8))
|
.addLast(new StringEncoder(CharsetUtil.UTF_8))
|
||||||
.addLast(new NettyServerHandler());
|
.addLast(new DevNettyServerHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,131 +0,0 @@
|
|||||||
package com.njcn.gather.detection.util.socket.service;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import io.netty.channel.Channel;
|
|
||||||
import io.netty.channel.ChannelHandler;
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
|
||||||
import io.netty.channel.SimpleChannelInboundHandler;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: 客户端业务处理
|
|
||||||
* @Author: wr
|
|
||||||
* @Date: 2024/12/10 14:18
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class NettyServerHandler extends SimpleChannelInboundHandler<String> {
|
|
||||||
|
|
||||||
public static final NettyServerHandler INSTANCE = new NettyServerHandler();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: 当通道进行连接时推送消息
|
|
||||||
* @Author: wr
|
|
||||||
* @Date: 2024/12/10 14:19
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
|
||||||
System.out.println("服务端监听到"+ctx.channel().id()+"连接");
|
|
||||||
super.channelActive(ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理消息信息
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void channelRead0(ChannelHandlerContext ctx, String msg) {
|
|
||||||
System.out.println(ctx.channel().id()+"NettyServer服务端接收到客户端消息:"+msg);
|
|
||||||
Channel channel = ctx.channel();
|
|
||||||
/*
|
|
||||||
if(msg.endsWith("结束")) {
|
|
||||||
channel.writeAndFlush("socket指令结果:"+msg);
|
|
||||||
for (int i = 0; i < 5; i++) {
|
|
||||||
channel.writeAndFlush("socket指令结果:"+msg);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
channel.writeAndFlush("socket指令结果:成功指令");
|
|
||||||
}*/
|
|
||||||
if(!msg.contains("HeartBeat")){
|
|
||||||
if(msg.contains("start")){
|
|
||||||
JSONObject jsonObject1 = new JSONObject();
|
|
||||||
jsonObject1.put("requestId","yjc_ytxjy");
|
|
||||||
jsonObject1.put("operateCode","INIT_GATHER");
|
|
||||||
jsonObject1.put("code","10201");
|
|
||||||
channel.writeAndFlush(jsonObject1.toJSONString()+'\n');
|
|
||||||
|
|
||||||
try {
|
|
||||||
Thread.sleep(1000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
|
||||||
jsonObject.put("requestId","yjc_ytxjy");
|
|
||||||
jsonObject.put("operateCode","INIT_GATHER");
|
|
||||||
jsonObject.put("code","10200");
|
|
||||||
channel.writeAndFlush(jsonObject.toJSONString()+'\n');
|
|
||||||
}else if(msg.contains("YJC_xujy")){
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
|
||||||
jsonObject.put("requestId","YJC_xujy");
|
|
||||||
jsonObject.put("operateCode","OPER_GATHER");
|
|
||||||
jsonObject.put("code","10201");
|
|
||||||
channel.writeAndFlush(jsonObject.toJSONString()+'\n');
|
|
||||||
|
|
||||||
try {
|
|
||||||
Thread.sleep(1000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
JSONObject jsonObject1 = new JSONObject();
|
|
||||||
jsonObject1.put("requestId","YJC_xujy");
|
|
||||||
jsonObject1.put("operateCode","OPER_GATHER");
|
|
||||||
jsonObject1.put("code","10200");
|
|
||||||
channel.writeAndFlush(jsonObject1.toJSONString()+'\n');
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handlerAdded(ChannelHandlerContext ctx) {
|
|
||||||
System.out.println("有新连接加入了++++......" + ctx.channel());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
|
||||||
cause.printStackTrace();
|
|
||||||
ctx.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
|
||||||
// Client disconnected, close the server-side channel too
|
|
||||||
System.out.println("NettyServer服务端监听到"+ctx.channel().id()+"关闭连接");
|
|
||||||
ctx.close(); // This will trigger the close event on the server side
|
|
||||||
super.channelInactive(ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户事件的回调方法(自定义事件用于心跳机制)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
|
||||||
//空闲状态的事件
|
|
||||||
// if (evt instanceof IdleStateEvent) {
|
|
||||||
// IdleStateEvent event = (IdleStateEvent) evt;
|
|
||||||
// System.out.println(event.state() + ">>>" + ctx.channel().id());
|
|
||||||
// //已经10秒钟没有读时间了
|
|
||||||
// if (event.state().equals(IdleState.READER_IDLE)){
|
|
||||||
// // 心跳包丢失,10秒没有收到客户端心跳 (断开连接)
|
|
||||||
// ctx.channel().close().sync();
|
|
||||||
// System.out.println("已与 "+ctx.channel().remoteAddress()+" 断开连接");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
package com.njcn.gather.detection.util.socket.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||||
|
import com.njcn.gather.detection.pojo.vo.SocketDataMsg;
|
||||||
|
import com.njcn.gather.detection.util.socket.MsgUtil;
|
||||||
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 客户端业务处理
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2024/12/10 14:18
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class SourceNettyServerHandler extends SimpleChannelInboundHandler<String> {
|
||||||
|
|
||||||
|
private final String DEV = "_Dev";
|
||||||
|
private final String source = "_Source";
|
||||||
|
|
||||||
|
private final String stepTag = "&&";
|
||||||
|
private final String stepBegin = "_Start";
|
||||||
|
private final String stepEnd = "_End";
|
||||||
|
|
||||||
|
public static final SourceNettyServerHandler INSTANCE = new SourceNettyServerHandler();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 当通道进行连接时推送消息
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2024/12/10 14:19
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
|
System.out.println("服务端监听到" + ctx.channel().id() + "连接");
|
||||||
|
super.channelActive(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理消息信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void channelRead0(ChannelHandlerContext ctx, String msg) {
|
||||||
|
System.out.println(ctx.channel().id() + "NettyServer服务端接收到客户端消息:" + msg);
|
||||||
|
Channel channel = ctx.channel();
|
||||||
|
SocketDataMsg socketDataMsg = MsgUtil.socketDataMsg(msg);
|
||||||
|
String[] tem = socketDataMsg.getRequestId().split(stepTag);
|
||||||
|
SourceOperateCodeEnum enumByCode = SourceOperateCodeEnum.getDictDataEnumByCode(tem[0]);
|
||||||
|
JSONObject jsonObject1 = new JSONObject();
|
||||||
|
if (ObjectUtil.isNotNull(enumByCode)) {
|
||||||
|
switch (enumByCode) {
|
||||||
|
//源初始化
|
||||||
|
case YJC_YTXJY:
|
||||||
|
String aa = "{\"requestId\":\"yjc_ytxjy\",\"operateCode\":\"INIT_GATHER\",\"data\":null,\"code\":10201}";
|
||||||
|
String bb = "{\"requestId\":\"yjc_ytxjy\",\"operateCode\":\"INIT_GATHER\",\"data\":null,\"code\":10200}";
|
||||||
|
channel.writeAndFlush(aa+"/n");
|
||||||
|
channel.writeAndFlush(bb+"/n");
|
||||||
|
break;
|
||||||
|
//相序检测
|
||||||
|
case YJC_XUJY:
|
||||||
|
String hh = "{\"requestId\":\"YJC_xujy\",\"operateCode\":\"OPER_GATHER\",\"data\":null,\"code\":10201}";
|
||||||
|
String ii = "{\"requestId\":\"YJC_xujy\",\"operateCode\":\"OPER_GATHER\",\"data\":null,\"code\":10200}";
|
||||||
|
channel.writeAndFlush(hh+"\n");
|
||||||
|
channel.writeAndFlush(ii+"\n");
|
||||||
|
break;
|
||||||
|
//正式检测
|
||||||
|
case FORMAL_REAL:
|
||||||
|
|
||||||
|
break;
|
||||||
|
//系数校验
|
||||||
|
case Coefficient_Check:
|
||||||
|
String a = "{\"requestId\":\"Coefficient_Check\",\"operateCode\":\"OPER_GATHER\",\"data\":null,\"code\":10201}";
|
||||||
|
String b= "{\"requestId\":\"Coefficient_Check\",\"operateCode\":\"OPER_GATHER\",\"data\":null,\"code\":10200}";
|
||||||
|
|
||||||
|
break;
|
||||||
|
case QUITE_SOURCE:
|
||||||
|
|
||||||
|
break;
|
||||||
|
case YXT:
|
||||||
|
jsonObject1.put("requestId", "yjc_ytxjy");
|
||||||
|
jsonObject1.put("operateCode", "INIT_GATHER");
|
||||||
|
jsonObject1.put("code", "10201");
|
||||||
|
channel.writeAndFlush(jsonObject1.toJSONString() + '\n');
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
System.out.println("未知异常" + enumByCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handlerAdded(ChannelHandlerContext ctx) {
|
||||||
|
System.out.println("有新连接加入了++++......" + ctx.channel());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||||
|
cause.printStackTrace();
|
||||||
|
ctx.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||||
|
// Client disconnected, close the server-side channel too
|
||||||
|
System.out.println("NettyServer服务端监听到" + ctx.channel().id() + "关闭连接");
|
||||||
|
ctx.close(); // This will trigger the close event on the server side
|
||||||
|
super.channelInactive(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户事件的回调方法(自定义事件用于心跳机制)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||||
|
//空闲状态的事件
|
||||||
|
// if (evt instanceof IdleStateEvent) {
|
||||||
|
// IdleStateEvent event = (IdleStateEvent) evt;
|
||||||
|
// System.out.println(event.state() + ">>>" + ctx.channel().id());
|
||||||
|
// //已经10秒钟没有读时间了
|
||||||
|
// if (event.state().equals(IdleState.READER_IDLE)){
|
||||||
|
// // 心跳包丢失,10秒没有收到客户端心跳 (断开连接)
|
||||||
|
// ctx.channel().close().sync();
|
||||||
|
// System.out.println("已与 "+ctx.channel().remoteAddress()+" 断开连接");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,13 +1,15 @@
|
|||||||
package com.njcn.gather.detection.util.socket.web;
|
package com.njcn.gather.detection.util.socket.web;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
|
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
||||||
import com.njcn.gather.detection.util.socket.WebServiceManager;
|
import com.njcn.gather.detection.util.socket.WebServiceManager;
|
||||||
import io.netty.channel.ChannelHandler;
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.SimpleChannelInboundHandler;
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
import io.netty.handler.codec.http.FullHttpRequest;
|
import io.netty.handler.codec.http.FullHttpRequest;
|
||||||
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
|
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
|
||||||
|
import io.netty.handler.timeout.IdleStateEvent;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -17,17 +19,19 @@ import org.springframework.stereotype.Component;
|
|||||||
* @Date: 2024/12/10 13:56
|
* @Date: 2024/12/10 13:56
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Component
|
|
||||||
@ChannelHandler.Sharable
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class WebSocketHandler extends SimpleChannelInboundHandler<TextWebSocketFrame> {
|
public class WebSocketHandler extends SimpleChannelInboundHandler<TextWebSocketFrame> {
|
||||||
|
|
||||||
|
private int times;
|
||||||
|
|
||||||
private final static String QUESTION_MARK = "?";
|
private final static String QUESTION_MARK = "?";
|
||||||
private final static String EQUAL_TO = "=";
|
private final static String EQUAL_TO = "=";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
System.out.println("服务端通道已建立" + ctx.channel().remoteAddress());
|
System.out.println("webSocket服务端通道已建立" + ctx.channel().id());
|
||||||
|
super.channelActive(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -49,7 +53,13 @@ public class WebSocketHandler extends SimpleChannelInboundHandler<TextWebSocketF
|
|||||||
} else if (msg instanceof TextWebSocketFrame) {
|
} else if (msg instanceof TextWebSocketFrame) {
|
||||||
//正常的TEXT消息类型
|
//正常的TEXT消息类型
|
||||||
TextWebSocketFrame frame = (TextWebSocketFrame) msg;
|
TextWebSocketFrame frame = (TextWebSocketFrame) msg;
|
||||||
log.info("客户端收到服务器数据:{}", frame.text());
|
//log.info("webSocket服务器收到客户端心跳信息:{}", frame.text());
|
||||||
|
if ("alive".equals(frame.text())) {
|
||||||
|
//System.out.println("webSocket心跳收到时间………………………………………………………………"+LocalDateTime.now());
|
||||||
|
times = 0;
|
||||||
|
TextWebSocketFrame wd = new TextWebSocketFrame("over");
|
||||||
|
ctx.channel().writeAndFlush(wd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
super.channelRead(ctx, msg);
|
super.channelRead(ctx, msg);
|
||||||
|
|
||||||
@@ -57,6 +67,7 @@ public class WebSocketHandler extends SimpleChannelInboundHandler<TextWebSocketF
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户地址获取用户名 ws://127.0.0.1:7777/hello?name=aa
|
* 根据用户地址获取用户名 ws://127.0.0.1:7777/hello?name=aa
|
||||||
|
*
|
||||||
* @param url
|
* @param url
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -92,40 +103,63 @@ public class WebSocketHandler extends SimpleChannelInboundHandler<TextWebSocketF
|
|||||||
@Override
|
@Override
|
||||||
public void handlerAdded(ChannelHandlerContext ctx) {
|
public void handlerAdded(ChannelHandlerContext ctx) {
|
||||||
//WebServiceManager.addUser(userId, ctx.channel());
|
//WebServiceManager.addUser(userId, ctx.channel());
|
||||||
System.out.println("有新的连接接入:" + ctx);
|
System.out.println("webSocket有新的连接接入:" + ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
|
public void handlerRemoved(ChannelHandlerContext ctx) {
|
||||||
// 假设用户 ID 是从某个地方获取的,这里简单示例为 "userId"
|
// 假设用户 ID 是从某个地方获取的,这里简单示例为 "userId"
|
||||||
System.out.println("weoSocket退出: " + ctx);
|
System.out.println("weoSocket客户端退出: " + ctx.channel().id());
|
||||||
WebServiceManager.removeChannel(ctx.channel().id().toString());
|
WebServiceManager.removeChannel(ctx.channel().id().toString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void channelInactive(ChannelHandlerContext ctx) {
|
||||||
|
System.out.println("weoSocket断线" + ctx.channel().id());
|
||||||
|
ctx.close();
|
||||||
|
|
||||||
|
PreDetectionParam preDetectionParam = WebServiceManager.getPreDetectionParam();
|
||||||
|
if (ObjectUtil.isNotNull(preDetectionParam)) {
|
||||||
|
CnSocketUtil.quitSendSource(preDetectionParam); // 能否在这里关闭源socket连接?
|
||||||
|
CnSocketUtil.quitSend(preDetectionParam);
|
||||||
|
} else {
|
||||||
|
preDetectionParam = new PreDetectionParam();
|
||||||
|
preDetectionParam.setUserPageId("cdf");
|
||||||
|
CnSocketUtil.quitSend(preDetectionParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
||||||
//空闲状态的事件
|
IdleStateEvent event = (IdleStateEvent) evt;
|
||||||
// if (evt instanceof IdleStateEvent) {
|
String eventDesc = null;
|
||||||
// IdleStateEvent event = (IdleStateEvent) evt;
|
switch (event.state()) {
|
||||||
// System.out.println(event.state() + ">>>" + ctx.channel().id());
|
case READER_IDLE:
|
||||||
// //已经10秒钟没有读时间了
|
eventDesc = "读空闲";
|
||||||
// if (event.state().equals(IdleState.READER_IDLE)){
|
System.out.println("c端心跳检测发生超时事件--" + eventDesc);
|
||||||
// // 心跳包丢失,10秒没有收到客户端心跳 (断开连接)
|
times++;
|
||||||
// ctx.channel().close().sync();
|
if (times > 3) {
|
||||||
// System.out.println("已与 "+ctx.channel().remoteAddress()+" 断开连接");
|
System.out.println("c端心跳检测空闲次数超过三次 关闭连接");
|
||||||
// }
|
ctx.channel().close();
|
||||||
// }
|
WebServiceManager.removeChannel(ctx.channel().id().toString());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WRITER_IDLE:
|
||||||
|
eventDesc = "写空闲";
|
||||||
|
break;
|
||||||
|
case ALL_IDLE:
|
||||||
|
eventDesc = "读写空闲";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 推送数据至前台
|
//super.userEventTriggered(ctx, evt);
|
||||||
*/
|
|
||||||
public void sendMsgToUser(String userId, String msg) {
|
|
||||||
WebServiceManager.sendMsg(userId, msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||||
cause.printStackTrace();
|
cause.printStackTrace();
|
||||||
|
|||||||
@@ -10,19 +10,18 @@ import io.netty.handler.codec.http.HttpResponseDecoder;
|
|||||||
import io.netty.handler.codec.http.HttpServerCodec;
|
import io.netty.handler.codec.http.HttpServerCodec;
|
||||||
import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler;
|
import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler;
|
||||||
import io.netty.handler.stream.ChunkedWriteHandler;
|
import io.netty.handler.stream.ChunkedWriteHandler;
|
||||||
import lombok.RequiredArgsConstructor;
|
import io.netty.handler.timeout.IdleStateHandler;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: webSocket服务端自定义配置
|
* @Description: webSocket服务端自定义配置
|
||||||
* @Author: wr
|
* @Author: wr
|
||||||
* @Date: 2024/12/10 14:20
|
* @Date: 2024/12/10 14:20
|
||||||
*/
|
*/
|
||||||
@Component
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class WebSocketInitializer extends ChannelInitializer<SocketChannel> {
|
public class WebSocketInitializer extends ChannelInitializer<SocketChannel> {
|
||||||
|
|
||||||
private final WebSocketHandler webSocketHandler;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -44,7 +43,8 @@ public class WebSocketInitializer extends ChannelInitializer<SocketChannel> {
|
|||||||
* 这个时候我们只需要访问 ws://127.0.0.1:7777/hello 就可以了
|
* 这个时候我们只需要访问 ws://127.0.0.1:7777/hello 就可以了
|
||||||
* 这个handler是将http协议升级为websocket 并且使用 101 作为响应码
|
* 这个handler是将http协议升级为websocket 并且使用 101 作为响应码
|
||||||
* */
|
* */
|
||||||
pipeline.addLast(webSocketHandler);
|
pipeline.addLast(new IdleStateHandler(13, 0, 0, TimeUnit.SECONDS));
|
||||||
|
pipeline.addLast(new WebSocketHandler());
|
||||||
pipeline.addLast(new WebSocketServerProtocolHandler("/hello"));
|
pipeline.addLast(new WebSocketServerProtocolHandler("/hello"));
|
||||||
|
|
||||||
pipeline.addLast(new ChannelInboundHandlerAdapter() {
|
pipeline.addLast(new ChannelInboundHandlerAdapter() {
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import javax.annotation.PreDestroy;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class WebSocketService {
|
public class WebSocketService {
|
||||||
|
|
||||||
private final WebSocketInitializer webSocketInitializer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 端口号
|
* 端口号
|
||||||
@@ -57,7 +56,7 @@ public class WebSocketService {
|
|||||||
|
|
||||||
//设置连接保持为活动状态
|
//设置连接保持为活动状态
|
||||||
.childOption(ChannelOption.SO_KEEPALIVE, true)
|
.childOption(ChannelOption.SO_KEEPALIVE, true)
|
||||||
.childHandler(webSocketInitializer);
|
.childHandler(new WebSocketInitializer());
|
||||||
ChannelFuture future = serverBootstrap.bind(port).sync();
|
ChannelFuture future = serverBootstrap.bind(port).sync();
|
||||||
future.addListener(f -> {
|
future.addListener(f -> {
|
||||||
if (future.isSuccess()) {
|
if (future.isSuccess()) {
|
||||||
|
|||||||
@@ -0,0 +1,185 @@
|
|||||||
|
package com.njcn.gather.device.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.LogUtil;
|
||||||
|
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||||
|
import com.njcn.gather.device.pojo.po.PqDev;
|
||||||
|
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||||
|
import com.njcn.gather.device.service.IPqDevService;
|
||||||
|
import com.njcn.gather.type.pojo.po.DevType;
|
||||||
|
import com.njcn.gather.type.service.IDevTypeService;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import com.njcn.web.utils.FileUtil;
|
||||||
|
import com.njcn.web.utils.HttpResultUtil;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @date 2024/11/06
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Api(tags = "被检设备")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/pqDev")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class PqDevController extends BaseController {
|
||||||
|
|
||||||
|
private final IPqDevService pqDevService;
|
||||||
|
private final IDevTypeService devTypeService;
|
||||||
|
|
||||||
|
@OperateInfo
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ApiOperation("分页查询被检设备")
|
||||||
|
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||||
|
public HttpResult<Page<PqDevVO>> list(@RequestBody @Validated PqDevParam.QueryParam queryParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("list");
|
||||||
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||||
|
Page<PqDevVO> result = pqDevService.listPqDevs(queryParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo
|
||||||
|
@GetMapping("/getById")
|
||||||
|
@ApiOperation("根据id查询被检设备")
|
||||||
|
@ApiImplicitParam(name = "id", value = "被检设备id", required = true)
|
||||||
|
public HttpResult<PqDevVO> getById(@RequestParam("id") String id) {
|
||||||
|
String methodDescribe = getMethodDescribe("getById");
|
||||||
|
LogUtil.njcnDebug(log, "{},查询ID为:{}", methodDescribe, id);
|
||||||
|
PqDevVO result = pqDevService.getPqDevById(id);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(operateType = OperateType.ADD)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ApiOperation("新增被检设备")
|
||||||
|
@ApiImplicitParam(name = "pqDevParam", value = "被检设备", required = true)
|
||||||
|
public HttpResult<Boolean> add(@RequestBody @Validated PqDevParam pqDevParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("add");
|
||||||
|
LogUtil.njcnDebug(log, "{},新增数据为:{}", methodDescribe, pqDevParam);
|
||||||
|
boolean result = pqDevService.addPqDev(pqDevParam);
|
||||||
|
if (result) {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
} else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(operateType = OperateType.UPDATE)
|
||||||
|
@PostMapping("/update")
|
||||||
|
@ApiOperation("修改被检设备")
|
||||||
|
@ApiImplicitParam(name = "updateParam", value = "被检设备", required = true)
|
||||||
|
public HttpResult<Boolean> update(@RequestBody @Validated PqDevParam.UpdateParam updateParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("update");
|
||||||
|
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, updateParam);
|
||||||
|
boolean result = pqDevService.updatePqDev(updateParam);
|
||||||
|
if (result) {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
} else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(operateType = OperateType.DELETE)
|
||||||
|
@PostMapping("/delete")
|
||||||
|
@ApiOperation("删除被检设备")
|
||||||
|
@ApiImplicitParam(name = "ids", value = "被检设备id", required = true)
|
||||||
|
public HttpResult<Boolean> delete(@RequestBody @Validated PqDevParam.DeleteParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("delete");
|
||||||
|
LogUtil.njcnDebug(log, "{},删除ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, param.getIds()));
|
||||||
|
boolean result = pqDevService.deletePqDev(param);
|
||||||
|
if (result) {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
} else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ApiOperation("批量导出被检设备")
|
||||||
|
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||||
|
public void exportDev(@RequestBody @Validated PqDevParam.QueryParam queryParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("exportDev");
|
||||||
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||||
|
pqDevService.exportDev(queryParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||||
|
@PostMapping("/downloadTemplate")
|
||||||
|
@ApiOperation("下载被检设备导入文件模板")
|
||||||
|
public void downloadTemplate() {
|
||||||
|
pqDevService.downloadTemplate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
||||||
|
@PostMapping(value = "/import")
|
||||||
|
@ApiOperation("批量导入被检设备")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "file", value = "被检设备数据文件", required = true),
|
||||||
|
@ApiImplicitParam(name = "patternId", value = "模式id", required = true)
|
||||||
|
})
|
||||||
|
public HttpResult<Object> importDev(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, HttpServletResponse response) {
|
||||||
|
String methodDescribe = getMethodDescribe("importDev");
|
||||||
|
LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename());
|
||||||
|
boolean fileType = FileUtil.judgeFileIsExcel(file.getOriginalFilename());
|
||||||
|
if (!fileType) {
|
||||||
|
throw new BusinessException(CommonResponseEnum.FILE_XLSX_ERROR);
|
||||||
|
}
|
||||||
|
pqDevService.importDev(file, patternId, null, response);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@GetMapping("/listUnbound")
|
||||||
|
@ApiOperation("获取指定模式下所有未绑定的设备")
|
||||||
|
@ApiImplicitParam(name = "pattern", value = "模式id", required = true)
|
||||||
|
public HttpResult<List<Map<String, Object>>> listUnbound(@RequestParam("pattern") String pattern) {
|
||||||
|
String methodDescribe = getMethodDescribe("listUnbound");
|
||||||
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, pattern);
|
||||||
|
List<Map<String, Object>> result = pqDevService.listUnbound(pattern);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/listByPlanId")
|
||||||
|
@ApiOperation("查询出所有已绑定的设备")
|
||||||
|
@ApiImplicitParam(name = "planId", value = "计划id", required = true)
|
||||||
|
public HttpResult<List<PqDevVO>> listByPlanId(@RequestBody @Validated PqDevParam.QueryParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("listByPlanId");
|
||||||
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
||||||
|
List<PqDev> pqDevList = pqDevService.listByPlanId(param);
|
||||||
|
|
||||||
|
List<PqDevVO> result = BeanUtil.copyToList(pqDevList, PqDevVO.class);
|
||||||
|
result.forEach(pqDevVO -> {
|
||||||
|
DevType devType = devTypeService.getById(pqDevVO.getDevType());
|
||||||
|
if (ObjectUtil.isNotNull(devType)) {
|
||||||
|
pqDevVO.setDevChns(devType.getDevChns());
|
||||||
|
pqDevVO.setDevVolt(devType.getDevVolt());
|
||||||
|
pqDevVO.setDevCurr(devType.getDevCurr());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package com.njcn.gather.device.mapper;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.njcn.gather.device.pojo.po.PqDev;
|
||||||
|
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @date 2024-11-06
|
||||||
|
*/
|
||||||
|
public interface PqDevMapper extends MPJBaseMapper<PqDev> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据装置id集合获取装置信息
|
||||||
|
* @param devIds 装置id
|
||||||
|
* @return: java.util.List<com.njcn.gather.device.pojo.vo.PreDetection>
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2024/12/12 11:46
|
||||||
|
*/
|
||||||
|
List<PreDetection> selectDevInfo(@Param("devIds") List<String> devIds);
|
||||||
|
|
||||||
|
void finishPlan(@Param("planId")String planId);
|
||||||
|
|
||||||
|
void updateReportState(@Param("id")String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改检测计划的检测结果
|
||||||
|
*
|
||||||
|
* @param planId
|
||||||
|
* @param checkResult
|
||||||
|
*/
|
||||||
|
void updatePlanCheckResult(@Param("planId")String planId, @Param("checkResult")Integer checkResult);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改检测计划的检测状态
|
||||||
|
*
|
||||||
|
* @param planId
|
||||||
|
* @param testState
|
||||||
|
*/
|
||||||
|
void updatePlanTestState(@Param("planId")String planId, @Param("testState")Integer testState);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据计划id获取脚本id
|
||||||
|
*
|
||||||
|
* @param planId
|
||||||
|
*/
|
||||||
|
String getScriptIdByPlanId(String planId);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
<?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.gather.device.mapper.PqDevMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="DevResultMap" type="com.njcn.gather.device.pojo.vo.PreDetection">
|
||||||
|
<id column="Id" property="devId" />
|
||||||
|
<id column="Name" property="devName" />
|
||||||
|
<id column="IP" property="devIP" />
|
||||||
|
<result column="Port" property="port" />
|
||||||
|
<result column="Dev_Type" property="devType" />
|
||||||
|
<result column="Series" property="devCode" />
|
||||||
|
<result column="Dev_Key" property="devKey" />
|
||||||
|
<result column="icdType" property="icdType" />
|
||||||
|
<result column="Dev_Chns" property="devChns" />
|
||||||
|
<result column="Dev_Volt" property="devVolt" />
|
||||||
|
<result column="Dev_Curr" property="devCurr" />
|
||||||
|
|
||||||
|
<collection
|
||||||
|
property="monitorList"
|
||||||
|
column="{ devId = Id}"
|
||||||
|
select="com.njcn.gather.monitor.mapper.PqMonitorMapper.selectMonitorInfo"
|
||||||
|
>
|
||||||
|
</collection>
|
||||||
|
</resultMap>
|
||||||
|
<select id="selectDevInfo" resultMap="DevResultMap">
|
||||||
|
SELECT
|
||||||
|
d.Id,
|
||||||
|
d.Name,
|
||||||
|
d.IP,
|
||||||
|
d.Port,
|
||||||
|
t.name as Dev_Type,
|
||||||
|
d.Series,
|
||||||
|
d.Dev_Key,
|
||||||
|
p.name as icdType,
|
||||||
|
t.Dev_Chns,
|
||||||
|
t.Dev_Volt,
|
||||||
|
t.Dev_Curr
|
||||||
|
FROM
|
||||||
|
pq_dev d
|
||||||
|
inner join pq_dev_type t on d.Dev_Type = t.id
|
||||||
|
inner join pq_icd_path p on t.icd = p.id
|
||||||
|
<where>
|
||||||
|
<if test="devIds !=null and devIds.size()!=0">
|
||||||
|
AND d.Id in
|
||||||
|
<foreach collection="devIds" open="(" close=")" item="item" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="finishPlan" >
|
||||||
|
update ad_plan set Test_State = 2 where id = #{planId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateReportState" >
|
||||||
|
update pq_dev set Report_State = 1 where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updatePlanCheckResult">
|
||||||
|
update ad_plan set Result = #{checkResult} where id = #{planId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updatePlanTestState">
|
||||||
|
update ad_plan set Test_State = #{testState} where id = #{planId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="getScriptIdByPlanId" resultType="java.lang.String">
|
||||||
|
SELECT Script_Id FROM ad_plan WHERE id = #{planId}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
|
|
||||||
@@ -12,6 +12,13 @@ public enum CommonEnum {
|
|||||||
|
|
||||||
NO("0", "否"),
|
NO("0", "否"),
|
||||||
YES("1", "是"),
|
YES("1", "是"),
|
||||||
|
|
||||||
|
|
||||||
|
COEFFICIENT_TEST("0","系数校验"),
|
||||||
|
PRE_TEST("1","预检测"),
|
||||||
|
FORMAL_TEST("2","正式检测"),
|
||||||
|
TIME_TEST("3","守时检测"),
|
||||||
|
PHASE_TEST("4","相序检测"),
|
||||||
;
|
;
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
@@ -10,6 +10,7 @@ import lombok.Getter;
|
|||||||
public enum DevReportStateEnum {
|
public enum DevReportStateEnum {
|
||||||
NOT_GENERATED("未生成", 0),
|
NOT_GENERATED("未生成", 0),
|
||||||
GENERATED("已生成", 1),
|
GENERATED("已生成", 1),
|
||||||
|
GENERATED_UPLOADED("已生成且已上传", 3),
|
||||||
UNCHECKED("未检", 2);
|
UNCHECKED("未检", 2);
|
||||||
|
|
||||||
private final Integer value;
|
private final Integer value;
|
||||||
@@ -0,0 +1,195 @@
|
|||||||
|
package com.njcn.gather.device.pojo.param;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.PatternRegex;
|
||||||
|
import com.njcn.gather.monitor.pojo.param.PqMonitorParam;
|
||||||
|
import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
||||||
|
import com.njcn.web.pojo.annotation.DateTimeStrValid;
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.hibernate.validator.constraints.Range;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @date 2024/11/06
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PqDevParam {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "名称", required = true)
|
||||||
|
@NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "设备模式,字典表(数字、模拟、比对)", required = true)
|
||||||
|
@NotBlank(message = DetectionValidMessage.PATTERN_NOT_BLANK)
|
||||||
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR)
|
||||||
|
private String pattern;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "设备类型,字典表", required = true)
|
||||||
|
@NotBlank(message = DetectionValidMessage.DEV_TYPE_NOT_BLANK)
|
||||||
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_TYPE_FORMAT_ERROR)
|
||||||
|
private String devType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "设备厂家,字典表", required = true)
|
||||||
|
private String manufacturer;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "出厂日期", required = true)
|
||||||
|
private String createDate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "装置编号", required = true)
|
||||||
|
@NotBlank(message = DetectionValidMessage.FACTORYNO_NOT_BLANK)
|
||||||
|
@Pattern(regexp = PatternRegex.DEV_CREATE_ID_REGEX, message = DetectionValidMessage.DEV_CREATE_ID_FORMAT_ERROR)
|
||||||
|
private String createId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "固件版本", required = true)
|
||||||
|
private String hardwareVersion;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "软件版本", required = true)
|
||||||
|
private String softwareVersion;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "通讯协议", required = true)
|
||||||
|
@NotBlank(message = DetectionValidMessage.PROTOCOL_NOT_BLANK)
|
||||||
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PROTOCOL_FORMAT_ERROR)
|
||||||
|
private String protocol;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "IP地址", required = true)
|
||||||
|
@NotBlank(message = DetectionValidMessage.IP_NOT_BLANK)
|
||||||
|
@Pattern(regexp = PatternRegex.IP_REGEX, message = DetectionValidMessage.IP_FORMAT_ERROR)
|
||||||
|
private String ip;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "端口号", required = true)
|
||||||
|
@NotNull(message = DetectionValidMessage.PORT_NOT_NULL)
|
||||||
|
@Range(min = 1, max = 65535, message = DetectionValidMessage.PORT_RANGE_ERROR)
|
||||||
|
private Integer port;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "装置是否为加密版本", required = true)
|
||||||
|
@NotNull(message = DetectionValidMessage.ENCRYPTION_NOT_NULL)
|
||||||
|
@Min(value = 0, message = DetectionValidMessage.ENCRYPTION_FLAG_FORMAT_ERROR)
|
||||||
|
@Max(value = 1, message = DetectionValidMessage.ENCRYPTION_FLAG_FORMAT_ERROR)
|
||||||
|
private Integer encryptionFlag;
|
||||||
|
|
||||||
|
@ApiModelProperty("装置识别码(3ds加密)")
|
||||||
|
private String series;
|
||||||
|
|
||||||
|
@ApiModelProperty("装置秘钥(3ds加密)")
|
||||||
|
private String devKey;
|
||||||
|
|
||||||
|
@ApiModelProperty("样品编号")
|
||||||
|
private String sampleId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "送样日期")
|
||||||
|
@DateTimeStrValid(message = DetectionValidMessage.ARRIVE_DATE_FORMAT_ERROR)
|
||||||
|
private String arrivedDate;
|
||||||
|
|
||||||
|
@ApiModelProperty("所属地市名称")
|
||||||
|
private String cityName;
|
||||||
|
|
||||||
|
@ApiModelProperty("所属供电公司名称")
|
||||||
|
private String gdName;
|
||||||
|
|
||||||
|
@ApiModelProperty("所属电站名称")
|
||||||
|
private String subName;
|
||||||
|
|
||||||
|
@ApiModelProperty("报告路径")
|
||||||
|
private String reportPath;
|
||||||
|
|
||||||
|
@ApiModelProperty("设备关键信息二维码")
|
||||||
|
private String qrCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "检测次数,默认为0", required = true)
|
||||||
|
@NotNull(message = DetectionValidMessage.RECHECK_NUM_NOT_NULL)
|
||||||
|
@Min(value = 0, message = DetectionValidMessage.RECHECK_NUM_FORMAT_ERROR)
|
||||||
|
private Integer reCheckNum;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否支持系数校准")
|
||||||
|
private Integer factorFlag;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点台账列表")
|
||||||
|
@Valid
|
||||||
|
private List<PqMonitorParam> monitorList;
|
||||||
|
|
||||||
|
@ApiModelProperty("icdId")
|
||||||
|
private String icdId;
|
||||||
|
|
||||||
|
@ApiModelProperty("预投计划")
|
||||||
|
private String preinvestmentPlan;
|
||||||
|
|
||||||
|
@ApiModelProperty("委托方")
|
||||||
|
private String delegate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新操作实体
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public static class UpdateParam extends PqDevParam {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "id", required = true)
|
||||||
|
@NotBlank(message = DetectionValidMessage.ID_NOT_BLANK)
|
||||||
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ID_FORMAT_ERROR)
|
||||||
|
private String id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询实体
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public static class QueryParam extends BaseParam {
|
||||||
|
@ApiModelProperty("名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "设备模式,字典表(数字、模拟、比对)")
|
||||||
|
private String pattern;
|
||||||
|
|
||||||
|
@ApiModelProperty("设备厂家")
|
||||||
|
private String manufacturer;
|
||||||
|
|
||||||
|
@ApiModelProperty("检测计划ID")
|
||||||
|
private String planId;
|
||||||
|
|
||||||
|
@ApiModelProperty("检测状态列表")
|
||||||
|
private List<
|
||||||
|
@Min(value = 0, message = DetectionValidMessage.CHECK_STATE_FORMAT_ERROR)
|
||||||
|
@Max(value = 3, message = DetectionValidMessage.CHECK_STATE_FORMAT_ERROR) Integer> checkStateList;
|
||||||
|
|
||||||
|
@ApiModelProperty("检测结果")
|
||||||
|
@Min(value = 0, message = DetectionValidMessage.CHECK_RESULT_FORMAT_ERROR)
|
||||||
|
@Max(value = 2, message = DetectionValidMessage.CHECK_RESULT_FORMAT_ERROR)
|
||||||
|
private Integer checkResult;
|
||||||
|
|
||||||
|
@ApiModelProperty("报告状态")
|
||||||
|
@Min(value = 0, message = DetectionValidMessage.REPORT_STATE_FORMAT_ERROR)
|
||||||
|
@Max(value = 2, message = DetectionValidMessage.REPORT_STATE_FORMAT_ERROR)
|
||||||
|
private Integer reportState;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class DeleteParam {
|
||||||
|
@ApiModelProperty(value = "ids")
|
||||||
|
private List<@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ID_FORMAT_ERROR) String> ids;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "设备模式,字典表(数字、模拟、比对)", required = true)
|
||||||
|
@NotBlank(message = DetectionValidMessage.PATTERN_NOT_BLANK)
|
||||||
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR)
|
||||||
|
private String pattern;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class BindPlanParam {
|
||||||
|
@ApiModelProperty("检测计划ID")
|
||||||
|
@NotNull(message = DetectionValidMessage.PLAN_ID_NOT_NULL)
|
||||||
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PLAN_ID_FORMAT_ERROR)
|
||||||
|
private String planId;
|
||||||
|
|
||||||
|
@ApiModelProperty("被检设备ID列表")
|
||||||
|
@NotNull(message = DetectionValidMessage.PQ_DEV_IDS_NOT_NULL)
|
||||||
|
private List<String> pqDevIds;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.gather.device.device.pojo.po;
|
package com.njcn.gather.device.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
@@ -14,6 +15,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author caozehui
|
* @author caozehui
|
||||||
@@ -45,21 +47,6 @@ public class PqDev extends BaseEntity implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String devType;
|
private String devType;
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备通道数
|
|
||||||
*/
|
|
||||||
private Integer devChns;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 额定电压(V)
|
|
||||||
*/
|
|
||||||
private Double devVolt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 额定电流(A)
|
|
||||||
*/
|
|
||||||
private Double devCurr;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备厂家,字典表
|
* 设备厂家,字典表
|
||||||
*/
|
*/
|
||||||
@@ -111,11 +98,13 @@ public class PqDev extends BaseEntity implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 装置识别码(3ds加密)
|
* 装置识别码(3ds加密)
|
||||||
*/
|
*/
|
||||||
|
@TableField(fill = FieldFill.UPDATE)
|
||||||
private String series;
|
private String series;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 装置秘钥(3ds加密)
|
* 装置秘钥(3ds加密)
|
||||||
*/
|
*/
|
||||||
|
@TableField(fill = FieldFill.UPDATE)
|
||||||
private String devKey;
|
private String devKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -162,11 +151,6 @@ public class PqDev extends BaseEntity implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer reportState;
|
private Integer reportState;
|
||||||
|
|
||||||
/**
|
|
||||||
* 归档状态
|
|
||||||
*/
|
|
||||||
private Integer documentState;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报告路径
|
* 报告路径
|
||||||
*/
|
*/
|
||||||
@@ -207,5 +191,29 @@ public class PqDev extends BaseEntity implements Serializable {
|
|||||||
* 系数校准结果(0:不合格,1:合格)
|
* 系数校准结果(0:不合格,1:合格)
|
||||||
*/
|
*/
|
||||||
private Integer factorCheckResult;
|
private Integer factorCheckResult;
|
||||||
|
|
||||||
|
@TableField("Check_Time")
|
||||||
|
private LocalDateTime checkTime;
|
||||||
|
|
||||||
|
@TableField("Check_By")
|
||||||
|
private String checkBy;
|
||||||
|
|
||||||
|
@TableField("Preinvestment_Plan")
|
||||||
|
private String preinvestmentPlan;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 温度
|
||||||
|
*/
|
||||||
|
private Float temperature;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 相对湿度
|
||||||
|
*/
|
||||||
|
private Float humidity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 委托方
|
||||||
|
*/
|
||||||
|
private String delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package com.njcn.gather.device.pojo.vo;
|
||||||
|
|
||||||
|
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||||
|
import com.njcn.common.pojo.constant.PatternRegex;
|
||||||
|
import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.validator.constraints.Range;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2025-01-15
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CNDevExcel {
|
||||||
|
|
||||||
|
@Excel(name = "预投计划*", width = 20, orderNum = "1")
|
||||||
|
@NotBlank(message = DetectionValidMessage.PREINVESTMENT_PLAN_NOT_BLANK)
|
||||||
|
private String preinvestmentPlan;
|
||||||
|
|
||||||
|
@Excel(name = "装置编号(开始编号-结束编号,编号为数字)*", width = 50, orderNum = "2")
|
||||||
|
@NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK)
|
||||||
|
@Pattern(regexp = PatternRegex.CN_DEV_NAME_REGEX_IMPORT, message = DetectionValidMessage.CN_DEV_NAME_FORMAT_ERROR)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Excel(name = "设备类型*", width = 20, orderNum = "3")
|
||||||
|
@NotBlank(message = DetectionValidMessage.DEV_TYPE_NOT_BLANK)
|
||||||
|
private String devType;
|
||||||
|
|
||||||
|
@Excel(name = "通讯协议*", width = 15, orderNum = "4")
|
||||||
|
@NotBlank(message = DetectionValidMessage.PROTOCOL_NOT_BLANK)
|
||||||
|
private String protocol;
|
||||||
|
|
||||||
|
@Excel(name = "是否加密*", width = 20, replace = {"否_0", "是_1"}, orderNum = "5")
|
||||||
|
@NotNull(message = DetectionValidMessage.ENCRYPTION_NOT_NULL)
|
||||||
|
private Integer encryptionFlag;
|
||||||
|
|
||||||
|
@Excel(name = "识别码(当加密时必填)", width = 30, orderNum = "6")
|
||||||
|
private String series;
|
||||||
|
|
||||||
|
@Excel(name = "秘钥(当加密时必填)", width = 30, orderNum = "7")
|
||||||
|
private String devKey;
|
||||||
|
|
||||||
|
@Excel(name = "是否支持系数校准*", width = 25, replace = {"否_0", "是_1"}, orderNum = "8")
|
||||||
|
private Integer factorFlag;
|
||||||
|
|
||||||
|
@Excel(name = "IP地址*", width = 20, orderNum = "9")
|
||||||
|
@NotBlank(message = DetectionValidMessage.IP_NOT_BLANK)
|
||||||
|
@Pattern(regexp = PatternRegex.IP_REGEX, message = DetectionValidMessage.IP_FORMAT_ERROR)
|
||||||
|
private String ip;
|
||||||
|
|
||||||
|
@Excel(name = "端口号*", width = 15, orderNum = "10")
|
||||||
|
@NotNull(message = DetectionValidMessage.PORT_NOT_NULL)
|
||||||
|
@Range(min = 1, max = 65535, message = DetectionValidMessage.PORT_RANGE_ERROR)
|
||||||
|
private Integer port;
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.njcn.gather.device.pojo.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||||
|
import com.njcn.gather.device.pojo.po.PqDev;
|
||||||
|
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2024-12-13
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PqDevVO extends PqDev {
|
||||||
|
|
||||||
|
private Integer devChns;
|
||||||
|
|
||||||
|
private Double devVolt;
|
||||||
|
|
||||||
|
private Double devCurr;
|
||||||
|
|
||||||
|
private List<PqMonitor> monitorList;
|
||||||
|
}
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
package com.njcn.gather.device.device.pojo.vo;
|
package com.njcn.gather.device.pojo.vo;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.annotation.JSONField;
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.njcn.common.utils.EncryptionUtil;
|
||||||
import com.njcn.gather.device.device.util.DeviceUtil;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
@@ -69,6 +68,10 @@ public class PreDetection {
|
|||||||
|
|
||||||
@JSONField(serialize = false)
|
@JSONField(serialize = false)
|
||||||
private Integer devChns;
|
private Integer devChns;
|
||||||
|
|
||||||
|
private Double devVolt;
|
||||||
|
|
||||||
|
private Double devCurr;
|
||||||
/**
|
/**
|
||||||
* 监测点信息
|
* 监测点信息
|
||||||
*/
|
*/
|
||||||
@@ -100,13 +103,13 @@ public class PreDetection {
|
|||||||
/**
|
/**
|
||||||
* 监测点线路号
|
* 监测点线路号
|
||||||
*/
|
*/
|
||||||
@JSONField(name = "pt")
|
@JSONField(name = "pt") //todo 是否改为ct
|
||||||
private Integer ct;
|
private Integer ct;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDevKey() {
|
public String getDevKey() {
|
||||||
if (StrUtil.isNotBlank(devKey)) {
|
if (StrUtil.isNotBlank(devKey)) {
|
||||||
String key = DeviceUtil.decoderString(1, devKey);
|
String key = EncryptionUtil.decoderString(1, devKey);
|
||||||
if (StrUtil.isNotBlank(key)) {
|
if (StrUtil.isNotBlank(key)) {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
@@ -116,7 +119,7 @@ public class PreDetection {
|
|||||||
|
|
||||||
public String getDevCode() {
|
public String getDevCode() {
|
||||||
if (StrUtil.isNotBlank(devCode)) {
|
if (StrUtil.isNotBlank(devCode)) {
|
||||||
String code = DeviceUtil.decoderString(1, devCode);
|
String code = EncryptionUtil.decoderString(1, devCode);
|
||||||
if (StrUtil.isNotBlank(code)) {
|
if (StrUtil.isNotBlank(code)) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package com.njcn.gather.device.pojo.vo;
|
||||||
|
|
||||||
|
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||||
|
import com.njcn.common.pojo.constant.PatternRegex;
|
||||||
|
import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.validator.constraints.Range;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.Pattern;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2024/11/7
|
||||||
|
* @description 省级平台设备Excel导入导出实体类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ProvinceDevExcel implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Excel(name = "装置编号*", width = 20)
|
||||||
|
@NotBlank(message = DetectionValidMessage.FACTORYNO_NOT_BLANK)
|
||||||
|
private String createId;
|
||||||
|
|
||||||
|
@Excel(name = "设备名称*", width = 20, orderNum = "2")
|
||||||
|
@NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK)
|
||||||
|
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DetectionValidMessage.NAME_FORMAT_ERROR)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Excel(name = "设备类型*", width = 20, orderNum = "3")
|
||||||
|
@NotBlank(message = DetectionValidMessage.DEV_TYPE_NOT_BLANK)
|
||||||
|
private String devType;
|
||||||
|
|
||||||
|
@Excel(name = "设备厂家*", width = 20, orderNum = "7")
|
||||||
|
@NotBlank(message = DetectionValidMessage.MANUFACTURER_NOT_BLANK)
|
||||||
|
private String manufacturer;
|
||||||
|
|
||||||
|
@Excel(name = "出厂日期(yyyy-MM-dd)*", width = 25, format = "yyyy-MM-dd", orderNum = "8")
|
||||||
|
@NotNull(message = DetectionValidMessage.CREATEDATETIME_NOT_NULL)
|
||||||
|
private LocalDate createDate;
|
||||||
|
|
||||||
|
@Excel(name = "固件版本", width = 15, orderNum = "9")
|
||||||
|
private String hardwareVersion;
|
||||||
|
|
||||||
|
@Excel(name = "软件版本", width = 15, orderNum = "10")
|
||||||
|
private String softwareVersion;
|
||||||
|
|
||||||
|
@Excel(name = "通讯协议*", width = 15, orderNum = "11")
|
||||||
|
@NotBlank(message = DetectionValidMessage.PROTOCOL_NOT_BLANK)
|
||||||
|
private String protocol;
|
||||||
|
|
||||||
|
@Excel(name = "是否加密*", width = 20, replace = {"否_0", "是_1"}, orderNum = "12")
|
||||||
|
@NotNull(message = DetectionValidMessage.ENCRYPTION_NOT_NULL)
|
||||||
|
private Integer encryptionFlag;
|
||||||
|
|
||||||
|
@Excel(name = "识别码(当加密时必填)", width = 30, orderNum = "13")
|
||||||
|
private String series;
|
||||||
|
|
||||||
|
@Excel(name = "秘钥(当加密时必填)", width = 30, orderNum = "14")
|
||||||
|
private String devKey;
|
||||||
|
|
||||||
|
// @Excel(name = "是否支持系数校准*", width = 25, replace = {"否_0", "是_1"}, orderNum = "15")
|
||||||
|
// private Integer factorFlag;
|
||||||
|
|
||||||
|
@Excel(name = "IP地址*", width = 20, orderNum = "15")
|
||||||
|
@NotBlank(message = DetectionValidMessage.IP_NOT_BLANK)
|
||||||
|
@Pattern(regexp = PatternRegex.IP_REGEX, message = DetectionValidMessage.IP_FORMAT_ERROR)
|
||||||
|
private String ip;
|
||||||
|
|
||||||
|
@Excel(name = "端口号*", width = 15, orderNum = "16")
|
||||||
|
@NotNull(message = DetectionValidMessage.PORT_NOT_NULL)
|
||||||
|
@Range(min = 1, max = 65535, message = DetectionValidMessage.PORT_RANGE_ERROR)
|
||||||
|
private Integer port;
|
||||||
|
|
||||||
|
@Excel(name = "样品编号", width = 20, orderNum = "17")
|
||||||
|
private String sampleId;
|
||||||
|
|
||||||
|
@Excel(name = "送样日期(yyyy-MM-dd)", width = 25, format = "yyyy-MM-dd", orderNum = "18")
|
||||||
|
private LocalDate arrivedDate;
|
||||||
|
|
||||||
|
@Excel(name="委托方", width = 40, orderNum = "19")
|
||||||
|
private String delegate;
|
||||||
|
}
|
||||||
@@ -0,0 +1,270 @@
|
|||||||
|
package com.njcn.gather.device.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.common.pojo.poi.PullDown;
|
||||||
|
import com.njcn.gather.device.pojo.enums.TimeCheckResultEnum;
|
||||||
|
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||||
|
import com.njcn.gather.device.pojo.po.PqDev;
|
||||||
|
import com.njcn.gather.device.pojo.vo.CNDevExcel;
|
||||||
|
import com.njcn.gather.device.pojo.vo.PqDevVO;
|
||||||
|
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||||
|
import com.njcn.gather.device.pojo.vo.ProvinceDevExcel;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @date 2024/11/06
|
||||||
|
*/
|
||||||
|
public interface IPqDevService extends IService<PqDev> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询被检设备列表
|
||||||
|
*
|
||||||
|
* @param queryParam 查询参数
|
||||||
|
* @return 分页数据,包含被检设备列表
|
||||||
|
*/
|
||||||
|
Page<PqDevVO> listPqDevs(PqDevParam.QueryParam queryParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增被检设备信息
|
||||||
|
*
|
||||||
|
* @param pqDevParam 被检设备信息
|
||||||
|
* @return 新增成功返回true,否则返回false
|
||||||
|
*/
|
||||||
|
boolean addPqDev(PqDevParam pqDevParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改被检设备信息
|
||||||
|
*
|
||||||
|
* @param updateParam 被检设备信息
|
||||||
|
* @return 修改成功返回true,否则返回false
|
||||||
|
*/
|
||||||
|
boolean updatePqDev(PqDevParam.UpdateParam updateParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除被检设备信息
|
||||||
|
*
|
||||||
|
* @param param 被检设备信息
|
||||||
|
* @return 删除成功返回true,否则返回false
|
||||||
|
*/
|
||||||
|
boolean deletePqDev(PqDevParam.DeleteParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量更新被检设备守时检测结果
|
||||||
|
*
|
||||||
|
* @param ids 被检设备id列表
|
||||||
|
* @param result 守时检测结果
|
||||||
|
* @return 更新成功返回true,否则返回false
|
||||||
|
*/
|
||||||
|
boolean updatePqDevTimeCheckResult(List<String> ids, TimeCheckResultEnum result);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取模拟式||数字式设备导出时所需的数据
|
||||||
|
*
|
||||||
|
* @param queryParam 查询参数
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//List<PqDevExcel.SimulateOrDigitalExportData> getSimulateOrDigitExportData(PqDevParam.QueryParam queryParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取比对式设备导出时所需的数据
|
||||||
|
*
|
||||||
|
* @param queryParam 查询参数
|
||||||
|
* @return 比对式设备导出时所需的数据
|
||||||
|
*/
|
||||||
|
//List<PqDevExcel.ContrastExportData> getContrastExportData(PqDevParam.QueryParam queryParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量导入被检设备信息
|
||||||
|
*
|
||||||
|
* @param sgEventExcels 批量导入的数据
|
||||||
|
*/
|
||||||
|
//void importContrastData(List<PqDevExcel.ContrastImportData> sgEventExcels);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量导入被检设备信息
|
||||||
|
*
|
||||||
|
* @param sgEventExcels 批量导入的数据
|
||||||
|
*/
|
||||||
|
//void importSimulateAndDigitalData(List<PqDevExcel.SimulateOrDigitalImportData> sgEventExcels);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有未绑定的设备
|
||||||
|
*
|
||||||
|
* @param pattern 模式Id
|
||||||
|
* @return 未绑定的设备列表
|
||||||
|
*/
|
||||||
|
List<Map<String, Object>> listUnbound(String pattern);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据计划id获取绑定的设备
|
||||||
|
*
|
||||||
|
* @param param 计划id
|
||||||
|
* @return 绑定的设备列表
|
||||||
|
*/
|
||||||
|
List<PqDev> listByPlanId(PqDevParam.QueryParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定计划
|
||||||
|
*
|
||||||
|
* @param planId 计划id
|
||||||
|
* @param devIds 设备id列表
|
||||||
|
* @return 绑定成功返回true,否则返回false
|
||||||
|
*/
|
||||||
|
Integer bind(String planId, List<String> devIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id获取被检设备信息
|
||||||
|
*
|
||||||
|
* @param id 被检设备id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PqDevVO getPqDevById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取装置信息和装置下监测点信息
|
||||||
|
*
|
||||||
|
* @param devIds
|
||||||
|
* @return: java.util.List<com.njcn.gather.device.pojo.vo.PreDetection>
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2024/12/12 15:50
|
||||||
|
*/
|
||||||
|
List<PreDetection> getDevInfo(@Param("devIds") List<String> devIds);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 正式监测完成,修改中断状态
|
||||||
|
*
|
||||||
|
* @param ids
|
||||||
|
* @param valueType
|
||||||
|
* @param code
|
||||||
|
* @param userId
|
||||||
|
* @param temperature
|
||||||
|
* @param humidity
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean updateResult(List<String> ids, List<String> valueType, String code, String userId, Float temperature, Float humidity);
|
||||||
|
|
||||||
|
void updatePqDevReportState(String devId, int i);
|
||||||
|
|
||||||
|
int countUnReportDev(String planId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据计划id列表获取设备列表
|
||||||
|
*
|
||||||
|
* @param planIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PqDev> listByPlanIds(List<String> planIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出设备数据
|
||||||
|
*
|
||||||
|
* @param queryParam
|
||||||
|
*/
|
||||||
|
void exportDev(PqDevParam.QueryParam queryParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下载模板文件
|
||||||
|
*/
|
||||||
|
void downloadTemplate();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入设备数据
|
||||||
|
*
|
||||||
|
* @param file 上传的文件
|
||||||
|
* @param patternId 模式Id
|
||||||
|
* @param planId 计划Id
|
||||||
|
* @param response 响应
|
||||||
|
*/
|
||||||
|
void importDev(MultipartFile file, String patternId, String planId, HttpServletResponse response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入灿能二楼设备数据
|
||||||
|
*
|
||||||
|
* @param file 上传的文件
|
||||||
|
* @param patternId 模式Id
|
||||||
|
* @param planId 计划Id
|
||||||
|
* @param response 响应
|
||||||
|
*/
|
||||||
|
void importCNDev(MultipartFile file, String patternId, String planId, HttpServletResponse response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入灿能二楼设备数据
|
||||||
|
*
|
||||||
|
* @param cnDevExcelList
|
||||||
|
* @param patternId
|
||||||
|
* @param planId
|
||||||
|
*/
|
||||||
|
void importCNDev(List<CNDevExcel> cnDevExcelList, String patternId, String planId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 可视化-灿能二楼设备
|
||||||
|
*
|
||||||
|
* @param pqDevs
|
||||||
|
*/
|
||||||
|
void visualizeCNDev(List<PqDev> pqDevs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逆向可视化-灿能二楼设备
|
||||||
|
*
|
||||||
|
* @param pqDevs 设备列表
|
||||||
|
* @param patternId 模式Id
|
||||||
|
*/
|
||||||
|
void reverseVisualizeCNDev(List<PqDev> pqDevs, String patternId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入省级平台设备数据
|
||||||
|
*
|
||||||
|
* @param file 上传的文件
|
||||||
|
* @param patternId 模式Id
|
||||||
|
* @param planId 计划Id
|
||||||
|
* @param response 响应
|
||||||
|
*/
|
||||||
|
void importProvinceDev(MultipartFile file, String patternId, String planId, HttpServletResponse response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入省级平台设备数据
|
||||||
|
*
|
||||||
|
* @param proviceDevExcelList
|
||||||
|
* @param patternId
|
||||||
|
* @param planId
|
||||||
|
*/
|
||||||
|
void importProvinceDev(List<ProvinceDevExcel> proviceDevExcelList, String patternId, String planId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 可视化-省级平台设备
|
||||||
|
*
|
||||||
|
* @param pqDevs
|
||||||
|
*/
|
||||||
|
void visualizeProvinceDev(List<PqDev> pqDevs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逆向可视化-省级平台设备
|
||||||
|
*
|
||||||
|
* @param pqDevs 设备列表
|
||||||
|
* @param patternId 模式Id
|
||||||
|
*/
|
||||||
|
void reverseVisualizeProvinceDev(List<PqDev> pqDevs, String patternId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取省级平台设备导出、导出文件模板的下拉列表
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PullDown> getProvinceDevPullDownList(int startCol);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取灿能二楼设备导出、导出文件模板的下拉列表
|
||||||
|
*
|
||||||
|
* @param startCol 开始列
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PullDown> getCNDevPullDownList(int startCol);
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.gather.device.err.controller;
|
package com.njcn.gather.err.controller;
|
||||||
|
|
||||||
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;
|
||||||
@@ -7,10 +7,10 @@ import com.njcn.common.pojo.constant.OperateType;
|
|||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.LogUtil;
|
import com.njcn.common.utils.LogUtil;
|
||||||
import com.njcn.gather.device.err.pojo.param.PqErrSysParam;
|
import com.njcn.gather.err.pojo.param.PqErrSysParam;
|
||||||
import com.njcn.gather.device.err.pojo.po.PqErrSys;
|
import com.njcn.gather.err.pojo.po.PqErrSys;
|
||||||
import com.njcn.gather.device.err.pojo.vo.PqErrSysDtlsVO;
|
import com.njcn.gather.err.pojo.vo.PqErrSysDtlsVO;
|
||||||
import com.njcn.gather.device.err.service.IPqErrSysService;
|
import com.njcn.gather.err.service.IPqErrSysService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import com.njcn.web.utils.HttpResultUtil;
|
import com.njcn.web.utils.HttpResultUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@@ -63,14 +63,14 @@ public class PqErrSysController extends BaseController {
|
|||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ApiOperation("新增误差体系")
|
@ApiOperation("新增误差体系")
|
||||||
@ApiImplicitParam(name = "param", value = "误差体系", required = true)
|
@ApiImplicitParam(name = "param", value = "误差体系", required = true)
|
||||||
public HttpResult<Object> add(@RequestBody @Validated PqErrSysParam param) {
|
public HttpResult<Boolean> add(@RequestBody @Validated PqErrSysParam param) {
|
||||||
String methodDescribe = getMethodDescribe("add");
|
String methodDescribe = getMethodDescribe("add");
|
||||||
LogUtil.njcnDebug(log, "{},新增数据为:{}", methodDescribe, param);
|
LogUtil.njcnDebug(log, "{},新增数据为:{}", methodDescribe, param);
|
||||||
boolean result = pqErrSysService.addPqErrSys(param);
|
boolean result = pqErrSysService.addPqErrSys(param);
|
||||||
if (result) {
|
if (result) {
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
} else {
|
} else {
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,14 +78,14 @@ public class PqErrSysController extends BaseController {
|
|||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
@ApiOperation("修改误差体系")
|
@ApiOperation("修改误差体系")
|
||||||
@ApiImplicitParam(name = "param", value = "误差体系", required = true)
|
@ApiImplicitParam(name = "param", value = "误差体系", required = true)
|
||||||
public HttpResult<Object> update(@RequestBody @Validated PqErrSysParam.UpdateParam param) {
|
public HttpResult<Boolean> update(@RequestBody @Validated PqErrSysParam.UpdateParam param) {
|
||||||
String methodDescribe = getMethodDescribe("update");
|
String methodDescribe = getMethodDescribe("update");
|
||||||
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, param);
|
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, param);
|
||||||
boolean result = pqErrSysService.updatePqErrSys(param);
|
boolean result = pqErrSysService.updatePqErrSys(param);
|
||||||
if (result) {
|
if (result) {
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
} else {
|
} else {
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,14 +93,14 @@ public class PqErrSysController extends BaseController {
|
|||||||
@PostMapping("/delete")
|
@PostMapping("/delete")
|
||||||
@ApiOperation("删除误差体系")
|
@ApiOperation("删除误差体系")
|
||||||
@ApiImplicitParam(name = "ids", value = "误差体系id", required = true)
|
@ApiImplicitParam(name = "ids", value = "误差体系id", required = true)
|
||||||
public HttpResult<Object> delete(@RequestBody List<String> ids) {
|
public HttpResult<Boolean> delete(@RequestBody List<String> ids) {
|
||||||
String methodDescribe = getMethodDescribe("delete");
|
String methodDescribe = getMethodDescribe("delete");
|
||||||
LogUtil.njcnDebug(log, "{},删除ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
LogUtil.njcnDebug(log, "{},删除ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
||||||
boolean result = pqErrSysService.deletePqErrSys(ids);
|
boolean result = pqErrSysService.deletePqErrSys(ids);
|
||||||
if (result) {
|
if (result) {
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
} else {
|
} else {
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,19 +125,19 @@ public class PqErrSysController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @OperateInfo(operateType = OperateType.ADD)
|
@OperateInfo(operateType = OperateType.ADD)
|
||||||
// @GetMapping("/copy")
|
@GetMapping("/copy")
|
||||||
// @ApiOperation("复制误差体系")
|
@ApiOperation("复制误差体系")
|
||||||
// @ApiImplicitParam(name = "id", value = "误差体系id", required = true)
|
@ApiImplicitParam(name = "id", value = "误差体系id", required = true)
|
||||||
// public HttpResult<Object> copy(@RequestParam("id") String id) {
|
public HttpResult<Boolean> copy(@RequestParam("id") String id) {
|
||||||
// String methodDescribe = getMethodDescribe("copy");
|
String methodDescribe = getMethodDescribe("copy");
|
||||||
// LogUtil.njcnDebug(log, "{},复制ID为:{}", methodDescribe, id);
|
LogUtil.njcnDebug(log, "{},复制ID为:{}", methodDescribe, id);
|
||||||
// boolean result = pqErrSysService.copyPqErrSys(id);
|
boolean result = pqErrSysService.copyPqErrSys(id);
|
||||||
// if (result) {
|
if (result) {
|
||||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
// } else {
|
} else {
|
||||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.njcn.gather.device.err.mapper;
|
package com.njcn.gather.err.mapper;
|
||||||
|
|
||||||
import com.github.yulichang.base.MPJBaseMapper;
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
import com.njcn.gather.device.err.pojo.po.PqErrSysDtls;
|
import com.njcn.gather.err.pojo.po.PqErrSysDtls;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author caozehui
|
* @author caozehui
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.njcn.gather.err.mapper;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.njcn.gather.err.pojo.po.PqErrSys;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @date 2024-11-27
|
||||||
|
*/
|
||||||
|
public interface PqErrSysMapper extends MPJBaseMapper<PqErrSys> {
|
||||||
|
/**
|
||||||
|
* 根据ids获取绑定的计划数量
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer getCountBoundByIds(@Param("ids") List<String> ids);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?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.gather.device.err.mapper.PqErrSysMapper">
|
<mapper namespace="com.njcn.gather.err.mapper.PqErrSysDtlsMapper">
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?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.gather.err.mapper.PqErrSysMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getCountBoundByIds" resultType="java.lang.Integer">
|
||||||
|
SELECT COUNT(*) FROM ad_plan
|
||||||
|
<if test="ids!= null and ids.size() > 0">
|
||||||
|
<where>
|
||||||
|
AND Error_Sys_Id IN
|
||||||
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</where>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.njcn.gather.device.err.pojo.param;
|
package com.njcn.gather.err.pojo.param;
|
||||||
|
|
||||||
import com.njcn.common.pojo.constant.PatternRegex;
|
import com.njcn.common.pojo.constant.PatternRegex;
|
||||||
import com.njcn.gather.device.pojo.constant.DevValidMessage;
|
import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -17,13 +17,13 @@ import javax.validation.constraints.Pattern;
|
|||||||
public class PqErrSysDtlsParam {
|
public class PqErrSysDtlsParam {
|
||||||
|
|
||||||
@ApiModelProperty(value = "误差项类型", required = true)
|
@ApiModelProperty(value = "误差项类型", required = true)
|
||||||
@NotBlank(message = DevValidMessage.ERR_SYS_DTLS_ERROR_TYPE_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.ERR_SYS_DTLS_ERROR_TYPE_NOT_BLANK)
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ERR_SYS_DTLS_ERROR_TYPE_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ERR_SYS_DTLS_ERROR_TYPE_FORMAT_ERROR)
|
||||||
private String errorType;
|
private String errorType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "脚本项类型", required = true)
|
@ApiModelProperty(value = "脚本项类型", required = true)
|
||||||
@NotBlank(message = DevValidMessage.ERR_SYS_DTLS_SCRIPT_TYPE_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.ERR_SYS_DTLS_SCRIPT_TYPE_NOT_BLANK)
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ERR_SYS_DTLS_SCRIPT_TYPE_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ERR_SYS_DTLS_SCRIPT_TYPE_FORMAT_ERROR)
|
||||||
private String scriptType;
|
private String scriptType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "误差判断起始值", required = true)
|
@ApiModelProperty(value = "误差判断起始值", required = true)
|
||||||
@@ -38,24 +38,25 @@ public class PqErrSysDtlsParam {
|
|||||||
@ApiModelProperty(value = "是否包含结束值", required = true)
|
@ApiModelProperty(value = "是否包含结束值", required = true)
|
||||||
private Integer endFlag;
|
private Integer endFlag;
|
||||||
|
|
||||||
// @ApiModelProperty(value = "单位", required = true)
|
|
||||||
// @NotBlank(message = DeviceValidMessage.UNIT_NOT_BLANK)
|
|
||||||
// @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DeviceValidMessage.UNIT_FORMAT_ERROR)
|
|
||||||
// private String unit;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "判断条件值类型", required = true)
|
@ApiModelProperty(value = "判断条件值类型", required = true)
|
||||||
private Integer conditionType;
|
private Integer conditionType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "最大值误差", required = true)
|
@ApiModelProperty(value = "最大值误差", required = true)
|
||||||
@NotNull(message = DevValidMessage.MAX_ERROR_VALUE_NOT_NULL)
|
@NotNull(message = DetectionValidMessage.MAX_ERROR_VALUE_NOT_NULL)
|
||||||
private Double maxErrorValue;
|
private Double maxErrorValue;
|
||||||
|
|
||||||
@ApiModelProperty(value = "误差值类型", required = true)
|
@ApiModelProperty(value = "误差值类型", required = true)
|
||||||
@NotNull(message = DevValidMessage.ERROR_VALUE_TYPE_NOT_BLANK)
|
@NotNull(message = DetectionValidMessage.ERROR_VALUE_TYPE_NOT_BLANK)
|
||||||
private Integer errorValueType;
|
private Integer errorValueType;
|
||||||
|
|
||||||
@ApiModelProperty("排序")
|
@ApiModelProperty("排序")
|
||||||
@NotNull(message = DevValidMessage.SORT_NOT_NULL)
|
@NotNull(message = DetectionValidMessage.SORT_NOT_NULL)
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
|
@ApiModelProperty("1绝对值、2相对值")
|
||||||
|
private Integer valueType;
|
||||||
|
|
||||||
|
@ApiModelProperty("误差单位")
|
||||||
|
private String errorUnit;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.njcn.gather.device.err.pojo.param;
|
package com.njcn.gather.err.pojo.param;
|
||||||
|
|
||||||
import com.njcn.common.pojo.constant.PatternRegex;
|
import com.njcn.common.pojo.constant.PatternRegex;
|
||||||
import com.njcn.gather.device.pojo.constant.DevValidMessage;
|
import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
||||||
import com.njcn.web.pojo.annotation.DateTimeStrValid;
|
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.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
@@ -20,39 +20,38 @@ import java.util.List;
|
|||||||
public class PqErrSysParam {
|
public class PqErrSysParam {
|
||||||
|
|
||||||
@ApiModelProperty(value = "参照标准名称", required = true)
|
@ApiModelProperty(value = "参照标准名称", required = true)
|
||||||
@NotBlank(message = DevValidMessage.STANDARD_NAME_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.STANDARD_NAME_NOT_BLANK)
|
||||||
@Pattern(regexp = PatternRegex.ERR_SYS_NAME, message = DevValidMessage.STANDARD_NAME_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.ERR_SYS_NAME_REGEX, message = DetectionValidMessage.STANDARD_NAME_FORMAT_ERROR)
|
||||||
private String standardName;
|
private String standardName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "标准实施年份", required = true)
|
@ApiModelProperty(value = "标准实施年份", required = true)
|
||||||
@NotBlank(message = DevValidMessage.STANDARD_TIME_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.STANDARD_TIME_NOT_BLANK)
|
||||||
@DateTimeStrValid(format = "yyyy", message = DevValidMessage.STANDARD_TIME_FORMAT_ERROR)
|
@DateTimeStrValid(format = "yyyy", message = DetectionValidMessage.STANDARD_TIME_FORMAT_ERROR)
|
||||||
private String standardTime;
|
private String standardTime;
|
||||||
|
|
||||||
@ApiModelProperty(value = "设备等级", required = true)
|
@ApiModelProperty(value = "设备等级", required = true)
|
||||||
@NotBlank(message = DevValidMessage.DEV_LEVEL_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.DEV_LEVEL_NOT_BLANK)
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_LEVEL_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_LEVEL_FORMAT_ERROR)
|
||||||
private String devLevel;
|
private String devLevel;
|
||||||
|
|
||||||
@ApiModelProperty("状态")
|
@ApiModelProperty("状态")
|
||||||
@NotNull(message = DevValidMessage.ENABLE_NOT_NULL)
|
@NotNull(message = DetectionValidMessage.ENABLE_NOT_NULL)
|
||||||
@Min(value = 0, message = DevValidMessage.ENABLE_FORMAT_ERROR)
|
@Min(value = 0, message = DetectionValidMessage.ENABLE_FORMAT_ERROR)
|
||||||
@Max(value = 1, message = DevValidMessage.ENABLE_FORMAT_ERROR)
|
@Max(value = 1, message = DetectionValidMessage.ENABLE_FORMAT_ERROR)
|
||||||
private Integer enable;
|
private Integer enable;
|
||||||
|
|
||||||
@ApiModelProperty(value = "误差详情列表", required = true)
|
@ApiModelProperty(value = "误差详情列表", required = true)
|
||||||
@Valid
|
|
||||||
private List<PqErrSysDtlsParam> pqErrSysDtlsList;
|
private List<PqErrSysDtlsParam> pqErrSysDtlsList;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public static class QueryParam extends BaseParam {
|
public static class QueryParam extends BaseParam {
|
||||||
@ApiModelProperty("标准实施年份")
|
@ApiModelProperty("标准实施年份")
|
||||||
@DateTimeStrValid(format = "yyyy", message = DevValidMessage.STANDARD_TIME_FORMAT_ERROR)
|
@DateTimeStrValid(format = "yyyy", message = DetectionValidMessage.STANDARD_TIME_FORMAT_ERROR)
|
||||||
private String standardTime;
|
private String standardTime;
|
||||||
|
|
||||||
@ApiModelProperty("设备等级")
|
@ApiModelProperty("设备等级")
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_LEVEL_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.DEV_LEVEL_FORMAT_ERROR)
|
||||||
private String devLevel;
|
private String devLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,8 +59,8 @@ public class PqErrSysParam {
|
|||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public static class UpdateParam extends PqErrSysParam {
|
public static class UpdateParam extends PqErrSysParam {
|
||||||
@ApiModelProperty("id")
|
@ApiModelProperty("id")
|
||||||
@NotBlank(message = DevValidMessage.ID_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.ID_NOT_BLANK)
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ID_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ID_FORMAT_ERROR)
|
||||||
private String id;
|
private String id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,6 +75,14 @@ public class PqErrSysParam {
|
|||||||
|
|
||||||
@ApiModelProperty("所属检测脚本")
|
@ApiModelProperty("所属检测脚本")
|
||||||
private String scriptId;
|
private String scriptId;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty("电压")
|
||||||
|
private Double un;
|
||||||
|
|
||||||
|
@ApiModelProperty("电流")
|
||||||
|
private Double in;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.gather.device.err.pojo.po;
|
package com.njcn.gather.err.pojo.po;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.gather.device.err.pojo.po;
|
package com.njcn.gather.err.pojo.po;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
@@ -46,7 +46,7 @@ public class PqErrSysDtls implements Serializable {
|
|||||||
private Double startValue;
|
private Double startValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否包含起始值
|
* 是否包含起始值(0> 1>= 2无)
|
||||||
*/
|
*/
|
||||||
private Integer startFlag;
|
private Integer startFlag;
|
||||||
|
|
||||||
@@ -60,10 +60,6 @@ public class PqErrSysDtls implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer endFlag;
|
private Integer endFlag;
|
||||||
|
|
||||||
/**
|
|
||||||
* 单位
|
|
||||||
*/
|
|
||||||
// private String unit;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断条件值类型(包括值类型,绝对值、相对值)
|
* 判断条件值类型(包括值类型,绝对值、相对值)
|
||||||
@@ -77,7 +73,7 @@ public class PqErrSysDtls implements Serializable {
|
|||||||
private Double maxErrorValue;
|
private Double maxErrorValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 误差值类型
|
* 误差值类型(绝对值:0:标称值 1:标准值 2:值比较 相对值:0标称值 1:标准值)
|
||||||
*/
|
*/
|
||||||
private Integer errorValueType;
|
private Integer errorValueType;
|
||||||
|
|
||||||
@@ -86,5 +82,14 @@ public class PqErrSysDtls implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1绝对值、2相对值
|
||||||
|
*/
|
||||||
|
private Integer valueType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 误差单位
|
||||||
|
*/
|
||||||
|
private String errorUnit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package com.njcn.gather.err.pojo.vo;
|
||||||
|
|
||||||
|
import com.njcn.gather.err.pojo.po.PqErrSysDtls;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @date 2024-11-27
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ErrDtlsCheckDataVO implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Id
|
||||||
|
*/
|
||||||
|
private String checkDataId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测指标类型,与数据字典关联(例如电压有效值、谐波电压含有率等)
|
||||||
|
*/
|
||||||
|
private String valueType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*检测指标类型code
|
||||||
|
*/
|
||||||
|
private String valueTypeCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 值
|
||||||
|
*/
|
||||||
|
private Double value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 相别,字典表
|
||||||
|
*/
|
||||||
|
private String phase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认参与比较值(4.不参与值 5.不参与误差比较)
|
||||||
|
*/
|
||||||
|
private Integer isQualified;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 误差体系
|
||||||
|
*/
|
||||||
|
private List<PqErrSysDtls> errSysDtls;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.gather.device.err.pojo.vo;
|
package com.njcn.gather.err.pojo.vo;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
package com.njcn.gather.device.err.service;
|
package com.njcn.gather.err.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.gather.device.err.pojo.param.PqErrSysDtlsParam;
|
import com.njcn.gather.err.pojo.param.PqErrSysDtlsParam;
|
||||||
import com.njcn.gather.device.err.pojo.param.PqErrSysParam;
|
import com.njcn.gather.err.pojo.param.PqErrSysParam;
|
||||||
import com.njcn.gather.device.err.pojo.po.PqErrSysDtls;
|
import com.njcn.gather.err.pojo.po.PqErrSysDtls;
|
||||||
|
import com.njcn.gather.err.pojo.vo.ErrDtlsCheckDataVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -49,4 +50,11 @@ public interface IPqErrSysDtlsService extends IService<PqErrSysDtls> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<PqErrSysDtls> listPqErrSysDtlsByPqErrSysIdAndTypes(PqErrSysParam.DetectionParam param);
|
List<PqErrSysDtls> listPqErrSysDtlsByPqErrSysIdAndTypes(PqErrSysParam.DetectionParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据查询误差体系
|
||||||
|
* @param param 误差体系id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ErrDtlsCheckDataVO> listByPqErrSysIdAndTypes(PqErrSysParam.DetectionParam param);
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
package com.njcn.gather.device.err.service;
|
package com.njcn.gather.err.service;
|
||||||
|
|
||||||
import cn.hutool.core.date.StopWatch;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.gather.device.err.pojo.param.PqErrSysParam;
|
import com.njcn.gather.err.pojo.param.PqErrSysParam;
|
||||||
import com.njcn.gather.device.err.pojo.po.PqErrSys;
|
import com.njcn.gather.err.pojo.po.PqErrSys;
|
||||||
import com.njcn.gather.device.err.pojo.vo.PqErrSysDtlsVO;
|
import com.njcn.gather.err.pojo.vo.PqErrSysDtlsVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -79,5 +78,5 @@ public interface IPqErrSysService extends IService<PqErrSys> {
|
|||||||
* @param id 误差体系id
|
* @param id 误差体系id
|
||||||
* @return 成功返回true,失败返回false
|
* @return 成功返回true,失败返回false
|
||||||
*/
|
*/
|
||||||
//boolean copyPqErrSys(String id);
|
boolean copyPqErrSys(String id);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,158 @@
|
|||||||
|
package com.njcn.gather.err.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum;
|
||||||
|
import com.njcn.gather.err.mapper.PqErrSysDtlsMapper;
|
||||||
|
import com.njcn.gather.err.pojo.param.PqErrSysDtlsParam;
|
||||||
|
import com.njcn.gather.err.pojo.param.PqErrSysParam;
|
||||||
|
import com.njcn.gather.err.pojo.po.PqErrSysDtls;
|
||||||
|
import com.njcn.gather.err.pojo.vo.ErrDtlsCheckDataVO;
|
||||||
|
import com.njcn.gather.err.service.IPqErrSysDtlsService;
|
||||||
|
import com.njcn.gather.script.mapper.PqScriptMapper;
|
||||||
|
import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam;
|
||||||
|
import com.njcn.gather.script.pojo.po.PqScriptCheckData;
|
||||||
|
import com.njcn.gather.script.service.IPqScriptCheckDataService;
|
||||||
|
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @date 2024-11-27
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class PqErrSysDtlsServiceImpl extends ServiceImpl<PqErrSysDtlsMapper, PqErrSysDtls> implements IPqErrSysDtlsService {
|
||||||
|
|
||||||
|
private final IPqScriptCheckDataService pqScriptCheckDataService;
|
||||||
|
private final PqScriptMapper pqScriptMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PqErrSysDtls> listPqErrSysDtlsByPqErrSysId(String pqErrSysId) {
|
||||||
|
return this.lambdaQuery().eq(PqErrSysDtls::getErrorSysId, pqErrSysId).orderBy(true, true, PqErrSysDtls::getSort).list();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public boolean addPqErrSysDtls(String pqErrSysId, List<PqErrSysDtlsParam> list) {
|
||||||
|
List<PqErrSysDtls> data = new ArrayList<>();
|
||||||
|
for (PqErrSysDtlsParam param : list) {
|
||||||
|
PqErrSysDtls pqErrSysDtls = new PqErrSysDtls();
|
||||||
|
BeanUtils.copyProperties(param, pqErrSysDtls);
|
||||||
|
pqErrSysDtls.setErrorSysId(pqErrSysId);
|
||||||
|
data.add(pqErrSysDtls);
|
||||||
|
}
|
||||||
|
return this.saveBatch(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public boolean updatePqErrSysDtls(String pqErrSysId, List<PqErrSysDtlsParam> list) {
|
||||||
|
//先按照pqErrSysId全部删除
|
||||||
|
this.deletePqErrSysDtlsByPqErrSysId(Collections.singletonList(pqErrSysId));
|
||||||
|
//再重新插入
|
||||||
|
this.addPqErrSysDtls(pqErrSysId, list);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public boolean deletePqErrSysDtlsByPqErrSysId(List<String> pqErrSysIds) {
|
||||||
|
QueryWrapper<PqErrSysDtls> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.in("pq_err_sys_dtls.Error_Sys_Id", pqErrSysIds);
|
||||||
|
return this.remove(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PqErrSysDtls> listPqErrSysDtlsByPqErrSysIdAndTypes(PqErrSysParam.DetectionParam param) {
|
||||||
|
PqScriptCheckDataParam script = new PqScriptCheckDataParam();
|
||||||
|
script.setScriptId(param.getScriptId());
|
||||||
|
script.setIndex(param.getIndex());
|
||||||
|
script.setIsValueTypeName(false);
|
||||||
|
List<String> valueType = pqScriptCheckDataService.getValueType(script);
|
||||||
|
//根据检测脚本id和检测序号,查询出检测子项目
|
||||||
|
return this.list(new MPJLambdaWrapper<PqErrSysDtls>().selectAll(PqErrSysDtls.class)
|
||||||
|
.selectAll(PqErrSysDtls.class)
|
||||||
|
.selectAs(DictTree::getCode, PqErrSysDtls::getScriptCode)
|
||||||
|
.leftJoin(DictTree.class, DictTree::getId, PqErrSysDtls::getScriptType)
|
||||||
|
.eq(PqErrSysDtls::getErrorSysId, param.getErrorSysId())
|
||||||
|
.in(PqErrSysDtls::getScriptType, valueType)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ErrDtlsCheckDataVO> listByPqErrSysIdAndTypes(PqErrSysParam.DetectionParam param) {
|
||||||
|
List<ErrDtlsCheckDataVO> info = new ArrayList<>();
|
||||||
|
PqScriptCheckDataParam checkDataParam = new PqScriptCheckDataParam();
|
||||||
|
checkDataParam.setScriptId(param.getScriptId());
|
||||||
|
checkDataParam.setIndex(param.getIndex());
|
||||||
|
//获取检测脚本中所有装置下发的测试项
|
||||||
|
List<PqScriptCheckData> list = pqScriptCheckDataService.listCheckDataCode(checkDataParam);
|
||||||
|
Boolean isValueType = pqScriptMapper.selectScriptIsValueType(param.getScriptId());
|
||||||
|
|
||||||
|
Map<String, Integer> valueType = list.stream().collect(Collectors.toMap(PqScriptCheckData::getValueType, PqScriptCheckData::getErrorFlag,
|
||||||
|
(key1, key2) -> key1));
|
||||||
|
|
||||||
|
//获取误差体系
|
||||||
|
Map<String, List<PqErrSysDtls>> errMap = new HashMap<>(3); //key为误差详情的ScriptType,value为List<PqErrSysDtls>
|
||||||
|
if (CollUtil.isNotEmpty(valueType)) {
|
||||||
|
List<PqErrSysDtls> errSysDtls = this.list(new MPJLambdaWrapper<PqErrSysDtls>().selectAll(PqErrSysDtls.class)
|
||||||
|
.selectAll(PqErrSysDtls.class)
|
||||||
|
.selectAs(DictTree::getCode, PqErrSysDtls::getScriptCode)
|
||||||
|
.leftJoin(DictTree.class, DictTree::getId, PqErrSysDtls::getScriptType)
|
||||||
|
.eq(PqErrSysDtls::getErrorSysId, param.getErrorSysId())
|
||||||
|
.in(PqErrSysDtls::getScriptType, valueType.keySet())
|
||||||
|
);
|
||||||
|
errMap = errSysDtls.stream().collect(Collectors.groupingBy(PqErrSysDtls::getScriptType));
|
||||||
|
}
|
||||||
|
ErrDtlsCheckDataVO dataVO;
|
||||||
|
for (PqScriptCheckData script : list) {
|
||||||
|
dataVO = new ErrDtlsCheckDataVO();
|
||||||
|
dataVO.setCheckDataId(script.getScriptId());
|
||||||
|
dataVO.setValueTypeCode(script.getValueTypeCode());
|
||||||
|
dataVO.setValueType(script.getValueType());
|
||||||
|
dataVO.setValue(script.getValue());
|
||||||
|
dataVO.setPhase(script.getPhase());
|
||||||
|
if (isValueType) {
|
||||||
|
if (DetectionCodeEnum.VRMS.getCode().equals(script.getValueTypeCode())) {
|
||||||
|
BigDecimal volValue = new BigDecimal(script.getValue());
|
||||||
|
BigDecimal result = volValue.multiply(new BigDecimal(param.getUn().toString()))
|
||||||
|
.divide(new BigDecimal(100), 4, BigDecimal.ROUND_HALF_UP);
|
||||||
|
dataVO.setValue(result.doubleValue());
|
||||||
|
}
|
||||||
|
if (DetectionCodeEnum.IRMS.getCode().equals(script.getValueTypeCode())) {
|
||||||
|
BigDecimal volValue = new BigDecimal(script.getValue());
|
||||||
|
BigDecimal result = volValue.multiply(new BigDecimal(param.getIn().toString()))
|
||||||
|
.divide(new BigDecimal(100), 4, BigDecimal.ROUND_HALF_UP);
|
||||||
|
dataVO.setValue(result.doubleValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (valueType.containsKey(script.getValueType())) {
|
||||||
|
//默认值4.无法处理 5.不参与误差比较
|
||||||
|
Integer i = valueType.get(script.getValueType());
|
||||||
|
if (i == 1) { //参与误差比较
|
||||||
|
dataVO.setIsQualified(4);
|
||||||
|
if (errMap.containsKey(script.getValueType())) {
|
||||||
|
dataVO.setErrSysDtls(errMap.get(script.getValueType()));
|
||||||
|
}
|
||||||
|
} else { //不参与误差比较
|
||||||
|
dataVO.setIsQualified(5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
info.add(dataVO);
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.gather.device.err.service.impl;
|
package com.njcn.gather.err.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.text.StrPool;
|
import cn.hutool.core.text.StrPool;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
@@ -7,14 +8,15 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
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.gather.device.err.mapper.PqErrSysMapper;
|
import com.njcn.gather.err.mapper.PqErrSysMapper;
|
||||||
import com.njcn.gather.device.err.pojo.param.PqErrSysParam;
|
import com.njcn.gather.err.pojo.param.PqErrSysDtlsParam;
|
||||||
import com.njcn.gather.device.err.pojo.po.PqErrSys;
|
import com.njcn.gather.err.pojo.param.PqErrSysParam;
|
||||||
import com.njcn.gather.device.err.pojo.po.PqErrSysDtls;
|
import com.njcn.gather.err.pojo.po.PqErrSys;
|
||||||
import com.njcn.gather.device.err.pojo.vo.PqErrSysDtlsVO;
|
import com.njcn.gather.err.pojo.po.PqErrSysDtls;
|
||||||
import com.njcn.gather.device.err.service.IPqErrSysDtlsService;
|
import com.njcn.gather.err.pojo.vo.PqErrSysDtlsVO;
|
||||||
import com.njcn.gather.device.err.service.IPqErrSysService;
|
import com.njcn.gather.err.service.IPqErrSysDtlsService;
|
||||||
import com.njcn.gather.device.pojo.enums.DevResponseEnum;
|
import com.njcn.gather.err.service.IPqErrSysService;
|
||||||
|
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
||||||
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||||
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||||
@@ -22,7 +24,6 @@ import com.njcn.gather.system.dictionary.service.IDictTreeService;
|
|||||||
import com.njcn.web.factory.PageFactory;
|
import com.njcn.web.factory.PageFactory;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
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;
|
||||||
@@ -50,7 +51,7 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
|
|||||||
if (ObjectUtil.isNotNull(param)) {
|
if (ObjectUtil.isNotNull(param)) {
|
||||||
queryWrapper.between(ObjectUtil.isNotEmpty(param.getStandardTime()), "pq_err_sys.Standard_Time", param.getStandardTime() + "-01-01", param.getStandardTime() + "-12-31").eq(ObjectUtil.isNotEmpty(param.getDevLevel()), "pq_err_sys.Dev_Level", param.getDevLevel());
|
queryWrapper.between(ObjectUtil.isNotEmpty(param.getStandardTime()), "pq_err_sys.Standard_Time", param.getStandardTime() + "-01-01", param.getStandardTime() + "-12-31").eq(ObjectUtil.isNotEmpty(param.getDevLevel()), "pq_err_sys.Dev_Level", param.getDevLevel());
|
||||||
}
|
}
|
||||||
queryWrapper.eq("pq_err_sys.state", DataStateEnum.ENABLE.getCode());
|
queryWrapper.eq("pq_err_sys.state", DataStateEnum.ENABLE.getCode()).orderByDesc("pq_err_sys.Create_Time");
|
||||||
return this.page(new Page<>(PageFactory.getPageNum(param), PageFactory.getPageSize(param)), queryWrapper);
|
return this.page(new Page<>(PageFactory.getPageNum(param), PageFactory.getPageSize(param)), queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,8 +65,10 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional
|
||||||
public boolean addPqErrSys(PqErrSysParam param) {
|
public boolean addPqErrSys(PqErrSysParam param) {
|
||||||
|
param.setStandardName(param.getStandardName().trim());
|
||||||
|
this.checkRepeat(param, false);
|
||||||
PqErrSys pqErrSys = new PqErrSys();
|
PqErrSys pqErrSys = new PqErrSys();
|
||||||
BeanUtils.copyProperties(param, pqErrSys);
|
BeanUtils.copyProperties(param, pqErrSys);
|
||||||
String id = UUID.randomUUID().toString().replaceAll("-", "");
|
String id = UUID.randomUUID().toString().replaceAll("-", "");
|
||||||
@@ -78,9 +81,12 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
|
|||||||
return result1 && result2;
|
return result1 && result2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional
|
||||||
public boolean updatePqErrSys(PqErrSysParam.UpdateParam param) {
|
public boolean updatePqErrSys(PqErrSysParam.UpdateParam param) {
|
||||||
|
param.setStandardName(param.getStandardName().trim());
|
||||||
|
this.checkRepeat(param, true);
|
||||||
PqErrSys pqErrSys = new PqErrSys();
|
PqErrSys pqErrSys = new PqErrSys();
|
||||||
BeanUtils.copyProperties(param, pqErrSys);
|
BeanUtils.copyProperties(param, pqErrSys);
|
||||||
pqErrSys.setName(generateErrSysName(param));
|
pqErrSys.setName(generateErrSysName(param));
|
||||||
@@ -91,8 +97,12 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional
|
||||||
public boolean deletePqErrSys(List<String> ids) {
|
public boolean deletePqErrSys(List<String> ids) {
|
||||||
|
Integer count = this.baseMapper.getCountBoundByIds(ids);
|
||||||
|
if (count > 0) {
|
||||||
|
throw new BusinessException(DetectionResponseEnum.ERR_SYS_BOUND_NOT_DELETE);
|
||||||
|
}
|
||||||
pqErrSysDtlsService.deletePqErrSysDtlsByPqErrSysId(ids);
|
pqErrSysDtlsService.deletePqErrSysDtlsByPqErrSysId(ids);
|
||||||
this.lambdaUpdate().in(PqErrSys::getId, ids).set(PqErrSys::getState, DataStateEnum.DELETED.getCode()).update();
|
this.lambdaUpdate().in(PqErrSys::getId, ids).set(PqErrSys::getState, DataStateEnum.DELETED.getCode()).update();
|
||||||
return true;
|
return true;
|
||||||
@@ -116,9 +126,10 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
|
||||||
public List<Map<String, Object>> listAllPqErrSys() {
|
public List<Map<String, Object>> listAllPqErrSys() {
|
||||||
List<PqErrSys> pqErrSysList = this.lambdaQuery().eq(PqErrSys::getState, DataStateEnum.ENABLE.getCode()).list();
|
List<PqErrSys> pqErrSysList = this.lambdaQuery()
|
||||||
|
.eq(PqErrSys::getEnable,DataStateEnum.ENABLE.getCode())
|
||||||
|
.eq(PqErrSys::getState, DataStateEnum.ENABLE.getCode()).list();
|
||||||
List<Map<String, Object>> result = pqErrSysList.stream().map(pqErrSys -> {
|
List<Map<String, Object>> result = pqErrSysList.stream().map(pqErrSys -> {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("id", pqErrSys.getId());
|
map.put("id", pqErrSys.getId());
|
||||||
@@ -182,29 +193,41 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
|
|||||||
if (ObjectUtil.isNotNull(devLevelDictData)) {
|
if (ObjectUtil.isNotNull(devLevelDictData)) {
|
||||||
return param.getStandardName() + "-" + param.getStandardTime() + "-" + devLevelDictData.getName();
|
return param.getStandardName() + "-" + param.getStandardTime() + "-" + devLevelDictData.getName();
|
||||||
}
|
}
|
||||||
throw new BusinessException(DevResponseEnum.PQ_ERRSYS_GEN_NAME_ERROR);
|
throw new BusinessException(DetectionResponseEnum.PQ_ERRSYS_GEN_NAME_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
@Override
|
||||||
// public boolean copyPqErrSys(String id) {
|
public boolean copyPqErrSys(String id) {
|
||||||
// PqErrSys pqErrSys = this.getPqErrSysById(id);
|
PqErrSys pqErrSys = this.getPqErrSysById(id);
|
||||||
// pqErrSys.setId(UUID.randomUUID().toString().replaceAll("-", ""));
|
pqErrSys.setId(UUID.randomUUID().toString().replaceAll("-", ""));
|
||||||
// pqErrSys.setName(pqErrSys.getName() + "_副本");
|
pqErrSys.setName(pqErrSys.getName() + "_copy");
|
||||||
// pqErrSys.setStandardTime(LocalDate.of(pqErrSys.getStandardTime().getYear(), 1, 1));
|
pqErrSys.setStandardName(pqErrSys.getStandardName() + "_copy");
|
||||||
// pqErrSys.getPqErrSysDtlsList().forEach(pqErrSysDtls -> pqErrSysDtls.setId(UUID.randomUUID().toString().replaceAll("-", "")));
|
pqErrSys.setStandardTime(LocalDate.of(pqErrSys.getStandardTime().getYear(), 1, 1));
|
||||||
// return this.save(pqErrSys);
|
List<PqErrSysDtlsParam> pqErrSysDtlsParams = BeanUtil.copyToList(pqErrSys.getPqErrSysDtlsList(), PqErrSysDtlsParam.class);
|
||||||
// }
|
pqErrSysDtlsService.addPqErrSysDtls(pqErrSys.getId(), pqErrSysDtlsParams);
|
||||||
|
return this.save(pqErrSys);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成误差体系名称(标准号+年份+设备等级)
|
* 检查重复
|
||||||
*
|
*
|
||||||
* @return 检测源名称
|
* @param param 检测参数
|
||||||
|
* @param isExcludeSelf 是否排除自己
|
||||||
*/
|
*/
|
||||||
private String generatePqSourceName(PqErrSysParam param) {
|
private void checkRepeat(PqErrSysParam param, boolean isExcludeSelf) {
|
||||||
DictData devLevel = dictDataService.getDictDataById(param.getDevLevel());
|
QueryWrapper<PqErrSys> wrapper = new QueryWrapper<>();
|
||||||
if (ObjectUtils.allNotNull(param.getStandardName(), param.getStandardTime(), devLevel)) {
|
wrapper.eq("Standard_Name", param.getStandardName())
|
||||||
return param.getStandardName() + "-" + param.getStandardTime() + "-" + devLevel.getName();
|
.eq("Standard_Time",param.getStandardTime()+"-01-01")
|
||||||
}
|
.eq("Dev_Level",param.getDevLevel())
|
||||||
throw new BusinessException(DevResponseEnum.ERR_SOURCE_GEN_NAME_ERROR);
|
.eq("state", DataStateEnum.ENABLE.getCode());
|
||||||
|
if (isExcludeSelf) {
|
||||||
|
if(param instanceof PqErrSysParam.UpdateParam){
|
||||||
|
wrapper.ne("Id", ((PqErrSysParam.UpdateParam) param).getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int count = this.count(wrapper);
|
||||||
|
if (count > 0) {
|
||||||
|
throw new BusinessException(DetectionResponseEnum.ERR_SYS_REPEAT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
package com.njcn.gather.icd.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.LogUtil;
|
||||||
|
import com.njcn.gather.icd.pojo.param.PqIcdPathParam;
|
||||||
|
import com.njcn.gather.icd.pojo.po.PqIcdPath;
|
||||||
|
import com.njcn.gather.icd.service.IPqIcdPathService;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import com.njcn.web.utils.HttpResultUtil;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @date 2025-02-10
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Api(tags = "icd管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/icd")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class PqIcdPathController extends BaseController {
|
||||||
|
private final IPqIcdPathService pqIcdPathService;
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@GetMapping("/listAll")
|
||||||
|
@ApiOperation("获取所有icd")
|
||||||
|
public HttpResult<List<PqIcdPath>> listAll() {
|
||||||
|
String methodDescribe = getMethodDescribe("listAll");
|
||||||
|
List<PqIcdPath> result = pqIcdPathService.listAll();
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ApiOperation("分页查询icd")
|
||||||
|
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||||
|
public HttpResult<Page<PqIcdPath>> list(@RequestBody @Validated PqIcdPathParam.QueryParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("list");
|
||||||
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, param);
|
||||||
|
Page<PqIcdPath> result = pqIcdPathService.listIcd(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ApiOperation("新增icd")
|
||||||
|
@ApiImplicitParam(name = "param", value = "icd新增参数", required = true)
|
||||||
|
public HttpResult<Boolean> add(@RequestBody @Validated PqIcdPathParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("add");
|
||||||
|
LogUtil.njcnDebug(log, "{},新增数据为:{}", methodDescribe, param);
|
||||||
|
|
||||||
|
boolean result = pqIcdPathService.addIcd(param);
|
||||||
|
if (result) {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
} else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
|
||||||
|
@PostMapping("/update")
|
||||||
|
@ApiOperation("修改icd")
|
||||||
|
@ApiImplicitParam(name = "param", value = "icd修改参数", required = true)
|
||||||
|
public HttpResult<Boolean> update(@RequestBody @Validated PqIcdPathParam.UpdateParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("update");
|
||||||
|
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, param);
|
||||||
|
|
||||||
|
boolean result = pqIcdPathService.updateIcd(param);
|
||||||
|
if (result) {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
} else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DELETE)
|
||||||
|
@PostMapping("/delete")
|
||||||
|
@ApiOperation("删除icd")
|
||||||
|
@ApiImplicitParam(name = "ids", value = "icd的id列表", required = true)
|
||||||
|
public HttpResult<Boolean> delete(@RequestBody List<String> ids) {
|
||||||
|
String methodDescribe = getMethodDescribe("delete");
|
||||||
|
LogUtil.njcnDebug(log, "{},删除数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
||||||
|
boolean result = pqIcdPathService.deleteIcd(ids);
|
||||||
|
if (result) {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
} else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.njcn.gather.icd.mapper;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.njcn.gather.icd.pojo.po.PqIcdPath;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @date 2025-02-10
|
||||||
|
*/
|
||||||
|
public interface PqIcdPathMapper extends MPJBaseMapper<PqIcdPath> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备类型id获取Icd
|
||||||
|
*
|
||||||
|
* @param devTypeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PqIcdPath selectIcdByDevType(@Param("devTypeId") String devTypeId);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<?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.gather.icd.mapper.PqIcdPathMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectIcdByDevType" resultType="com.njcn.gather.icd.pojo.po.PqIcdPath">
|
||||||
|
select *
|
||||||
|
from pq_icd_path path
|
||||||
|
inner join pq_dev_type type on path.id = type.icd
|
||||||
|
where type.id = #{devTypeId}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
|
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package com.njcn.gather.icd.pojo.param;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.PatternRegex;
|
||||||
|
import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @data 2025-02-11
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PqIcdPathParam {
|
||||||
|
@ApiModelProperty(value = "名称", required = true)
|
||||||
|
@NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK)
|
||||||
|
@Pattern(regexp = PatternRegex.ICD_NAME_REGEX, message = DetectionValidMessage.ICD_NAME_FORMAT_ERROR)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "存储路径", required = true)
|
||||||
|
@NotBlank(message = DetectionValidMessage.ICD_PATH_NOT_BLANK)
|
||||||
|
@Pattern(regexp = PatternRegex.ICD_PATH_REGEX, message = DetectionValidMessage.ICD_PATH_FORMAT_ERROR)
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询实体
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public static class QueryParam extends BaseParam {
|
||||||
|
@ApiModelProperty(value = "名称", required = true)
|
||||||
|
private String name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新参数
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public static class UpdateParam extends PqIcdPathParam {
|
||||||
|
@ApiModelProperty(value = "id", required = true)
|
||||||
|
@NotBlank(message = DetectionValidMessage.ID_NOT_BLANK)
|
||||||
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ID_FORMAT_ERROR)
|
||||||
|
private String id;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.njcn.gather.icd.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.njcn.db.mybatisplus.bo.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @date 2025-02-10
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("pq_icd_path")
|
||||||
|
public class PqIcdPath extends BaseEntity implements Serializable {
|
||||||
|
private static final long serialVersionUID = -93625299788915474L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* icdID
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* icd名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* icd存储地址
|
||||||
|
*/
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态:0-删除 1-正常
|
||||||
|
*/
|
||||||
|
private Integer state;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.njcn.gather.icd.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.gather.icd.pojo.param.PqIcdPathParam;
|
||||||
|
import com.njcn.gather.icd.pojo.po.PqIcdPath;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @date 2025-02-10
|
||||||
|
*/
|
||||||
|
public interface IPqIcdPathService extends IService<PqIcdPath> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有Icd
|
||||||
|
*
|
||||||
|
* @return 所有Icd
|
||||||
|
*/
|
||||||
|
List<PqIcdPath> listAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页获取Icd
|
||||||
|
*
|
||||||
|
* @param param 分页查询参数
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Page<PqIcdPath> listIcd(PqIcdPathParam.QueryParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增Icd
|
||||||
|
*
|
||||||
|
* @param param 新增Icd参数
|
||||||
|
* @return 成功返回true,失败返回false
|
||||||
|
*/
|
||||||
|
boolean addIcd(PqIcdPathParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改Icd
|
||||||
|
*
|
||||||
|
* @param param 修改Icd参数
|
||||||
|
* @return 成功返回true,失败返回false
|
||||||
|
*/
|
||||||
|
boolean updateIcd(PqIcdPathParam.UpdateParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除Icd
|
||||||
|
*
|
||||||
|
* @param ids Icd id列表
|
||||||
|
* @return 成功返回true,失败返回false
|
||||||
|
*/
|
||||||
|
boolean deleteIcd(List<String> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备类型id获取Icd
|
||||||
|
*
|
||||||
|
* @param devTypeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PqIcdPath getIcdByDevType(String devTypeId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
package com.njcn.gather.icd.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.gather.icd.mapper.PqIcdPathMapper;
|
||||||
|
import com.njcn.gather.icd.pojo.param.PqIcdPathParam;
|
||||||
|
import com.njcn.gather.icd.pojo.po.PqIcdPath;
|
||||||
|
import com.njcn.gather.icd.service.IPqIcdPathService;
|
||||||
|
import com.njcn.gather.pojo.enums.DetectionResponseEnum;
|
||||||
|
import com.njcn.web.factory.PageFactory;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author caozehui
|
||||||
|
* @date 2025-02-10
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class PqIcdPathServiceImpl extends ServiceImpl<PqIcdPathMapper, PqIcdPath> implements IPqIcdPathService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PqIcdPath> listAll() {
|
||||||
|
return this.lambdaQuery().eq(PqIcdPath::getState, DataStateEnum.ENABLE.getCode()).list();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<PqIcdPath> listIcd(PqIcdPathParam.QueryParam param) {
|
||||||
|
LambdaQueryWrapper<PqIcdPath> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(PqIcdPath::getState, DataStateEnum.ENABLE.getCode())
|
||||||
|
.like(StrUtil.isNotBlank(param.getName()), PqIcdPath::getName, param.getName())
|
||||||
|
.orderByDesc(PqIcdPath::getCreateTime);
|
||||||
|
Page<PqIcdPath> page = this.page(new Page<>(PageFactory.getPageNum(param), PageFactory.getPageSize(param)), wrapper);
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public boolean addIcd(PqIcdPathParam param) {
|
||||||
|
param.setName(param.getName().trim());
|
||||||
|
this.checkRepeat(param, false);
|
||||||
|
PqIcdPath pqIcdPath = new PqIcdPath();
|
||||||
|
BeanUtils.copyProperties(param, pqIcdPath);
|
||||||
|
pqIcdPath.setState(DataStateEnum.ENABLE.getCode());
|
||||||
|
return this.save(pqIcdPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public boolean updateIcd(PqIcdPathParam.UpdateParam param) {
|
||||||
|
param.setName(param.getName().trim());
|
||||||
|
this.checkRepeat(param, true);
|
||||||
|
PqIcdPath pqIcdPath = new PqIcdPath();
|
||||||
|
BeanUtils.copyProperties(param, pqIcdPath);
|
||||||
|
return this.updateById(pqIcdPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public boolean deleteIcd(List<String> ids) {
|
||||||
|
return this.lambdaUpdate().in(PqIcdPath::getId, ids).set(PqIcdPath::getState, DataStateEnum.DELETED.getCode()).update();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PqIcdPath getIcdByDevType(String devTypeId) {
|
||||||
|
return this.baseMapper.selectIcdByDevType(devTypeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkRepeat(PqIcdPathParam param, boolean isExcludeSelf) {
|
||||||
|
LambdaQueryWrapper<PqIcdPath> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(PqIcdPath::getName, param.getName())
|
||||||
|
.eq(PqIcdPath::getState, DataStateEnum.ENABLE.getCode());
|
||||||
|
if (isExcludeSelf) {
|
||||||
|
if (param instanceof PqIcdPathParam.UpdateParam) {
|
||||||
|
wrapper.ne(PqIcdPath::getId, ((PqIcdPathParam.UpdateParam) param).getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int count = this.count(wrapper);
|
||||||
|
if (count > 0) {
|
||||||
|
throw new BusinessException(DetectionResponseEnum.ICD_PATH_NAME_REPEAT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.njcn.gather.device.monitor.controller;
|
package com.njcn.gather.monitor.controller;
|
||||||
|
|
||||||
import com.njcn.gather.device.monitor.service.IPqMonitorService;
|
import com.njcn.gather.monitor.service.IPqMonitorService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.njcn.gather.device.monitor.mapper;
|
package com.njcn.gather.monitor.mapper;
|
||||||
|
|
||||||
import com.github.yulichang.base.MPJBaseMapper;
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
import com.njcn.gather.device.device.pojo.vo.PreDetection;
|
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||||
import com.njcn.gather.device.monitor.pojo.po.PqMonitor;
|
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -16,7 +16,7 @@ public interface PqMonitorMapper extends MPJBaseMapper<PqMonitor> {
|
|||||||
/**
|
/**
|
||||||
* 根据终端id获取监测点集合
|
* 根据终端id获取监测点集合
|
||||||
* @param devId
|
* @param devId
|
||||||
* @return: java.util.List<com.njcn.gather.device.device.pojo.vo.PreDetection.MonitorListDTO>
|
* @return: java.util.List<com.njcn.gather.device.pojo.vo.PreDetection.MonitorListDTO>
|
||||||
* @Author: wr
|
* @Author: wr
|
||||||
* @Date: 2024/12/12 13:15
|
* @Date: 2024/12/12 13:15
|
||||||
*/
|
*/
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<?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.gather.device.monitor.mapper.PqMonitorMapper">
|
<mapper namespace="com.njcn.gather.monitor.mapper.PqMonitorMapper">
|
||||||
|
|
||||||
<select id="selectMonitorInfo"
|
<select id="selectMonitorInfo"
|
||||||
resultType="com.njcn.gather.device.device.pojo.vo.PreDetection$MonitorListDTO">
|
resultType="com.njcn.gather.device.pojo.vo.PreDetection$MonitorListDTO">
|
||||||
SELECT
|
SELECT
|
||||||
Id as lineId,
|
Id as lineId,
|
||||||
Num as line,
|
Num as line,
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
package com.njcn.gather.device.monitor.pojo.param;
|
package com.njcn.gather.monitor.pojo.param;
|
||||||
|
|
||||||
import com.njcn.common.pojo.constant.PatternRegex;
|
import com.njcn.common.pojo.constant.PatternRegex;
|
||||||
import com.njcn.gather.device.pojo.constant.DevValidMessage;
|
import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
@@ -21,24 +20,24 @@ public class PqMonitorParam {
|
|||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
@ApiModelProperty(value = "所属母线")
|
@ApiModelProperty(value = "所属母线")
|
||||||
@NotBlank(message = DevValidMessage.BELONG_LINE_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.BELONG_LINE_NOT_BLANK)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty(value = "监测点序号")
|
@ApiModelProperty(value = "监测点序号")
|
||||||
@NotNull(message = DevValidMessage.MONITOR_NUM_NOT_NULL)
|
@NotNull(message = DetectionValidMessage.MONITOR_NUM_NOT_NULL)
|
||||||
private Integer num;
|
private Integer num;
|
||||||
|
|
||||||
@ApiModelProperty(value = "PT变比")
|
@ApiModelProperty(value = "PT变比")
|
||||||
@NotNull(message = DevValidMessage.PT_NOT_NULL)
|
@NotNull(message = DetectionValidMessage.PT_NOT_NULL)
|
||||||
private Float pt;
|
private Float pt;
|
||||||
|
|
||||||
@ApiModelProperty(value = "CT变比")
|
@ApiModelProperty(value = "CT变比")
|
||||||
@NotNull(message = DevValidMessage.CT_NOT_NULL)
|
@NotNull(message = DetectionValidMessage.CT_NOT_NULL)
|
||||||
private Float ct;
|
private Float ct;
|
||||||
|
|
||||||
@ApiModelProperty(value = "接线方式")
|
@ApiModelProperty(value = "接线方式")
|
||||||
@NotBlank(message = DevValidMessage.WIRING_TYPE_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.WIRING_TYPE_NOT_BLANK)
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.WIRING_TYPE_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.WIRING_TYPE_FORMAT_ERROR)
|
||||||
private String ptType;
|
private String ptType;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.gather.device.monitor.pojo.po;
|
package com.njcn.gather.monitor.pojo.po;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.njcn.db.mybatisplus.bo.BaseEntity;
|
import com.njcn.db.mybatisplus.bo.BaseEntity;
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.njcn.gather.device.monitor.pojo.vo;
|
package com.njcn.gather.monitor.pojo.vo;
|
||||||
|
|
||||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||||
import com.njcn.common.pojo.constant.PatternRegex;
|
import com.njcn.common.pojo.constant.PatternRegex;
|
||||||
import com.njcn.gather.device.pojo.constant.DevValidMessage;
|
import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@@ -18,24 +18,24 @@ import javax.validation.constraints.Pattern;
|
|||||||
public class PqMonitorExcel {
|
public class PqMonitorExcel {
|
||||||
|
|
||||||
@Excel(name = "监测点序号", width = 20, orderNum = "1")
|
@Excel(name = "监测点序号", width = 20, orderNum = "1")
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.MONITOR_NUM_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.MONITOR_NUM_FORMAT_ERROR)
|
||||||
private Integer num;
|
private Integer num;
|
||||||
|
|
||||||
@Excel(name = "所属母线", width = 20, orderNum = "2")
|
@Excel(name = "所属母线", width = 20, orderNum = "2")
|
||||||
@NotBlank(message = DevValidMessage.BELONG_LINE_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.BELONG_LINE_NOT_BLANK)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Excel(name = "PT变比", width = 20, orderNum = "3")
|
@Excel(name = "PT变比", width = 20, orderNum = "3")
|
||||||
@NotNull(message = DevValidMessage.PT_NOT_NULL)
|
@NotNull(message = DetectionValidMessage.PT_NOT_NULL)
|
||||||
private Float pt;
|
private Float pt;
|
||||||
|
|
||||||
@Excel(name = "CT变比", width = 20, orderNum = "4")
|
@Excel(name = "CT变比", width = 20, orderNum = "4")
|
||||||
@NotNull(message = DevValidMessage.CT_NOT_NULL)
|
@NotNull(message = DetectionValidMessage.CT_NOT_NULL)
|
||||||
private Float ct;
|
private Float ct;
|
||||||
|
|
||||||
@Excel(name = "接线方式", width = 20, orderNum = "5")
|
@Excel(name = "接线方式", width = 20, orderNum = "5")
|
||||||
@NotBlank(message = DevValidMessage.WIRING_TYPE_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.WIRING_TYPE_NOT_BLANK)
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.WIRING_TYPE_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.WIRING_TYPE_FORMAT_ERROR)
|
||||||
private String ptType;
|
private String ptType;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -1,12 +1,11 @@
|
|||||||
package com.njcn.gather.device.monitor.service;
|
package com.njcn.gather.monitor.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.gather.device.device.pojo.po.PqDev;
|
import com.njcn.gather.device.pojo.po.PqDev;
|
||||||
import com.njcn.gather.device.monitor.pojo.param.PqMonitorParam;
|
import com.njcn.gather.monitor.pojo.param.PqMonitorParam;
|
||||||
import com.njcn.gather.device.monitor.pojo.po.PqMonitor;
|
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author caozehui
|
* @author caozehui
|
||||||
@@ -1,26 +1,19 @@
|
|||||||
package com.njcn.gather.device.monitor.service.impl;
|
package com.njcn.gather.monitor.service.impl;
|
||||||
|
|
||||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.gather.device.device.pojo.po.PqDev;
|
import com.njcn.gather.monitor.mapper.PqMonitorMapper;
|
||||||
import com.njcn.gather.device.monitor.mapper.PqMonitorMapper;
|
import com.njcn.gather.monitor.pojo.param.PqMonitorParam;
|
||||||
import com.njcn.gather.device.monitor.pojo.param.PqMonitorParam;
|
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||||
import com.njcn.gather.device.monitor.pojo.po.PqMonitor;
|
import com.njcn.gather.monitor.service.IPqMonitorService;
|
||||||
import com.njcn.gather.device.monitor.pojo.vo.PqMonitorExcel;
|
|
||||||
import com.njcn.gather.device.monitor.service.IPqMonitorService;
|
|
||||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author caozehui
|
* @author caozehui
|
||||||
@@ -39,7 +32,7 @@ public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional
|
||||||
public boolean addPqMonitorByDevId(String devId, List<PqMonitorParam> pqMonitorParamList) {
|
public boolean addPqMonitorByDevId(String devId, List<PqMonitorParam> pqMonitorParamList) {
|
||||||
List<PqMonitor> pqMonitorList = BeanUtil.copyToList(pqMonitorParamList, PqMonitor.class);
|
List<PqMonitor> pqMonitorList = BeanUtil.copyToList(pqMonitorParamList, PqMonitor.class);
|
||||||
pqMonitorList.forEach(pqMonitor -> pqMonitor.setDevId(devId));
|
pqMonitorList.forEach(pqMonitor -> pqMonitor.setDevId(devId));
|
||||||
@@ -47,7 +40,7 @@ public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional
|
||||||
public boolean deletePqMonitorByDevId(String devId) {
|
public boolean deletePqMonitorByDevId(String devId) {
|
||||||
QueryWrapper<PqMonitor> wrapper = new QueryWrapper<>();
|
QueryWrapper<PqMonitor> wrapper = new QueryWrapper<>();
|
||||||
wrapper.eq("pq_monitor.Dev_Id", devId);
|
wrapper.eq("pq_monitor.Dev_Id", devId);
|
||||||
@@ -55,7 +48,7 @@ public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional
|
||||||
public boolean updatePqMonitorByDevId(String devId, List<PqMonitorParam> paramList) {
|
public boolean updatePqMonitorByDevId(String devId, List<PqMonitorParam> paramList) {
|
||||||
// 先删除原有数据
|
// 先删除原有数据
|
||||||
this.deletePqMonitorByDevId(devId);
|
this.deletePqMonitorByDevId(devId);
|
||||||
@@ -1,9 +1,5 @@
|
|||||||
package com.njcn.gather.plan.controller;
|
package com.njcn.gather.plan.controller;
|
||||||
|
|
||||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
|
||||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
|
||||||
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
@@ -13,18 +9,12 @@ 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.LogUtil;
|
import com.njcn.common.utils.LogUtil;
|
||||||
import com.njcn.gather.device.device.service.IPqDevService;
|
|
||||||
import com.njcn.gather.device.pojo.enums.DevResponseEnum;
|
|
||||||
import com.njcn.gather.device.pojo.enums.PatternEnum;
|
|
||||||
import com.njcn.gather.plan.pojo.param.AdPlanParam;
|
import com.njcn.gather.plan.pojo.param.AdPlanParam;
|
||||||
import com.njcn.gather.plan.pojo.vo.AdPlanExcel;
|
|
||||||
import com.njcn.gather.plan.pojo.vo.AdPlanVO;
|
import com.njcn.gather.plan.pojo.vo.AdPlanVO;
|
||||||
import com.njcn.gather.plan.service.IAdPlanService;
|
import com.njcn.gather.plan.service.IAdPlanService;
|
||||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import com.njcn.web.utils.ExcelUtil;
|
import com.njcn.web.utils.FileUtil;
|
||||||
import com.njcn.web.utils.HttpResultUtil;
|
import com.njcn.web.utils.HttpResultUtil;
|
||||||
import com.njcn.web.utils.PoiUtil;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
@@ -53,7 +43,7 @@ public class AdPlanController extends BaseController {
|
|||||||
|
|
||||||
private final IAdPlanService adPlanService;
|
private final IAdPlanService adPlanService;
|
||||||
|
|
||||||
@OperateInfo
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ApiOperation("分页查询检测计划")
|
@ApiOperation("分页查询检测计划")
|
||||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||||
@@ -64,53 +54,53 @@ public class AdPlanController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(operateType = OperateType.ADD)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ApiOperation("新增检测计划")
|
@ApiOperation("新增检测计划")
|
||||||
@ApiImplicitParam(name = "pqDevParam", value = "检测计划", required = true)
|
@ApiImplicitParam(name = "param", value = "检测计划", required = true)
|
||||||
public HttpResult<Object> add(@RequestBody @Validated AdPlanParam param) {
|
public HttpResult<Boolean> add(@RequestBody @Validated AdPlanParam param) {
|
||||||
String methodDescribe = getMethodDescribe("add");
|
String methodDescribe = getMethodDescribe("add");
|
||||||
LogUtil.njcnDebug(log, "{},新增数据为:{}", methodDescribe, param);
|
LogUtil.njcnDebug(log, "{},新增数据为:{}", methodDescribe, param);
|
||||||
boolean result = adPlanService.addAdPlan(param);
|
boolean result = adPlanService.addAdPlan(param);
|
||||||
if (result) {
|
if (result) {
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
} else {
|
} else {
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(operateType = OperateType.UPDATE)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
@ApiOperation("修改检测计划")
|
@ApiOperation("修改检测计划")
|
||||||
@ApiImplicitParam(name = "updateParam", value = "检测计划", required = true)
|
@ApiImplicitParam(name = "updateParam", value = "检测计划", required = true)
|
||||||
public HttpResult<Object> update(@RequestBody @Validated AdPlanParam.UpdateParam updateParam) {
|
public HttpResult<Boolean> update(@RequestBody @Validated AdPlanParam.UpdateParam updateParam) {
|
||||||
String methodDescribe = getMethodDescribe("update");
|
String methodDescribe = getMethodDescribe("update");
|
||||||
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, updateParam);
|
LogUtil.njcnDebug(log, "{},修改数据为:{}", methodDescribe, updateParam);
|
||||||
boolean result = adPlanService.updateAdPlan(updateParam);
|
boolean result = adPlanService.updateAdPlan(updateParam);
|
||||||
if (result) {
|
if (result) {
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
} else {
|
} else {
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(operateType = OperateType.DELETE)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DELETE)
|
||||||
@PostMapping("/delete")
|
@PostMapping("/delete")
|
||||||
@ApiOperation("删除检测计划")
|
@ApiOperation("删除检测计划")
|
||||||
@ApiImplicitParam(name = "ids", value = "检测计划id", required = true)
|
@ApiImplicitParam(name = "ids", value = "检测计划id", required = true)
|
||||||
public HttpResult<Object> delete(@RequestBody List<String> ids) {
|
public HttpResult<Boolean> delete(@RequestBody List<String> ids) {
|
||||||
String methodDescribe = getMethodDescribe("delete");
|
String methodDescribe = getMethodDescribe("delete");
|
||||||
LogUtil.njcnDebug(log, "{},删除ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
LogUtil.njcnDebug(log, "{},删除ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
||||||
boolean result = adPlanService.deleteAdPlan(ids);
|
boolean result = adPlanService.deleteAdPlan(ids);
|
||||||
if (result) {
|
if (result) {
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
} else {
|
} else {
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@GetMapping("/listByPattern")
|
@GetMapping("/listByPattern")
|
||||||
@ApiOperation("按照模式查询检测计划")
|
@ApiOperation("按照模式查询检测计划")
|
||||||
@ApiImplicitParam(name = "pattern", value = "模式Id", required = true)
|
@ApiImplicitParam(name = "pattern", value = "模式Id", required = true)
|
||||||
@@ -121,79 +111,62 @@ public class AdPlanController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
|
||||||
@PostMapping("/downloadTemplate")
|
|
||||||
@ApiOperation("下载监测计划导入文件模板")
|
|
||||||
public void downloadTemplate() {
|
|
||||||
adPlanService.downloadTemplate();
|
|
||||||
}
|
|
||||||
|
|
||||||
@OperateInfo(operateType = OperateType.DOWNLOAD)
|
@OperateInfo(operateType = OperateType.DOWNLOAD)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ApiOperation("导出检测计划")
|
@ApiOperation("导出检测计划")
|
||||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||||
public void export(@RequestBody @Validated AdPlanParam.QueryParam queryParam) {
|
public void exportPlan(@RequestBody @Validated AdPlanParam.QueryParam queryParam) {
|
||||||
String methodDescribe = getMethodDescribe("export");
|
String methodDescribe = getMethodDescribe("exportPlan");
|
||||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||||
List<AdPlanExcel.ExportData> data = adPlanService.getExportData(queryParam);
|
|
||||||
ExcelUtil.exportExcel("检测计划导出数据.xlsx", AdPlanExcel.ExportData.class, data);
|
adPlanService.exportPlan(queryParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||||
|
@PostMapping("/downloadTemplate")
|
||||||
|
@ApiOperation("下载检测计划导出模板")
|
||||||
|
public void downloadTemplate(@RequestBody AdPlanParam.QueryParam queryParam) {
|
||||||
|
adPlanService.downloadTemplate(queryParam.getPatternId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
||||||
@PostMapping(value = "/import")
|
@PostMapping(value = "/import")
|
||||||
@ApiOperation("批量导入检测计划数据")
|
@ApiOperation("导入检测计划数据")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "file", value = "检测计划数据文件", required = true),
|
@ApiImplicitParam(name = "file", value = "检测计划数据文件", required = true),
|
||||||
@ApiImplicitParam(name = "pattern", value = "模式Id", required = true)
|
@ApiImplicitParam(name = "pattern", value = "模式Id", required = true)
|
||||||
})
|
})
|
||||||
public HttpResult<Object> importData(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, HttpServletResponse response) {
|
public HttpResult<Object> importPlan(@RequestParam("file") MultipartFile file, @RequestParam("patternId") String patternId, HttpServletResponse response) {
|
||||||
String methodDescribe = getMethodDescribe("importData");
|
String methodDescribe = getMethodDescribe("importCNPlan");
|
||||||
LogUtil.njcnDebug(log, "{},上传文件为:{}, 模式Id为:{}", methodDescribe, file.getOriginalFilename(), patternId);
|
LogUtil.njcnDebug(log, "{},上传文件为:{}", methodDescribe, file.getOriginalFilename());
|
||||||
|
|
||||||
ImportParams params = new ImportParams();
|
boolean fileType = FileUtil.judgeFileIsExcel(file.getOriginalFilename());
|
||||||
params.setHeadRows(2);
|
if (!fileType) {
|
||||||
params.setNeedVerify(true);
|
throw new BusinessException(CommonResponseEnum.FILE_XLSX_ERROR);
|
||||||
params.setStartSheetIndex(0);
|
|
||||||
params.setSheetNum(1);
|
|
||||||
|
|
||||||
try {
|
|
||||||
ExcelImportResult<AdPlanExcel.ImportData> adPlanExcelResult = ExcelImportUtil.importExcelMore(file.getInputStream(), AdPlanExcel.ImportData.class, params);
|
|
||||||
if (adPlanExcelResult.isVerifyFail()) {
|
|
||||||
// 此处前端要做特殊处理,具体可以参考技术监督的数据导入
|
|
||||||
PoiUtil.exportFileByWorkbook(adPlanExcelResult.getFailWorkbook(), "非法检测计划数据.xlsx", response);
|
|
||||||
} else {
|
|
||||||
List<AdPlanExcel.ImportData> adPlanExcelList = adPlanExcelResult.getList();
|
|
||||||
if (ObjectUtil.isNotEmpty(adPlanExcelList)) {
|
|
||||||
adPlanService.importData(patternId, adPlanExcelList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new BusinessException(DevResponseEnum.IMPORT_DATA_FAIL, e.getMessage());
|
|
||||||
}
|
}
|
||||||
|
adPlanService.importPlan(file, patternId, response);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @OperateInfo
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
// @GetMapping("/getPieData")
|
@PostMapping("/getBigTestItem")
|
||||||
// @ApiOperation("获取饼状图数据")
|
|
||||||
// @ApiImplicitParam(name = "id", value = "检测计划id", required = true)
|
|
||||||
// public HttpResult<List<List<Map<String, Object>>>> getPieData(@RequestParam("planId") String planId) {
|
|
||||||
// String methodDescribe = getMethodDescribe("getPieData");
|
|
||||||
// LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, planId);
|
|
||||||
// List<List<Map<String, Object>>> result = pqDevService.getPieData(planId);
|
|
||||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
|
||||||
// }
|
|
||||||
|
|
||||||
@OperateInfo
|
|
||||||
@GetMapping("/getBigTestItem")
|
|
||||||
@ApiOperation("获取检测大项数据")
|
@ApiOperation("获取检测大项数据")
|
||||||
@ApiImplicitParam(name = "id", value = "检测计划id", required = true)
|
@ApiImplicitParam(name = "id", value = "检测计划id", required = true)
|
||||||
public HttpResult<List<Map<String, String>>> getBigTestItem(@RequestParam("planId") String planId) {
|
public HttpResult<List<Map<String, String>>> getBigTestItem(@RequestBody AdPlanParam.CheckParam checkParam) {
|
||||||
String methodDescribe = getMethodDescribe("getBigTestItem");
|
String methodDescribe = getMethodDescribe("getBigTestItem");
|
||||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, planId);
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, checkParam);
|
||||||
List<Map<String, String>> result = adPlanService.getBigTestItem(planId);
|
List<Map<String, String>> result = adPlanService.getBigTestItem(checkParam.getReCheckType(), checkParam.getPlanId(), checkParam.getDevIds());
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||||
|
@PostMapping("/analyse")
|
||||||
|
@ApiOperation("检测数据分析")
|
||||||
|
@ApiImplicitParam(name = "planId", value = "检测计划id", required = true)
|
||||||
|
public void analyse(@RequestBody List<String> ids) {
|
||||||
|
String methodDescribe = getMethodDescribe("analyse");
|
||||||
|
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
||||||
|
adPlanService.analyse(ids);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ package com.njcn.gather.plan.mapper;
|
|||||||
|
|
||||||
import com.github.yulichang.base.MPJBaseMapper;
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||||
|
import com.njcn.gather.report.pojo.po.PqReport;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author caozehui
|
* @author caozehui
|
||||||
@@ -9,5 +13,29 @@ import com.njcn.gather.plan.pojo.po.AdPlan;
|
|||||||
*/
|
*/
|
||||||
public interface AdPlanMapper extends MPJBaseMapper<AdPlan> {
|
public interface AdPlanMapper extends MPJBaseMapper<AdPlan> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据名称和版本获取报告id
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @param version
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getReportIdByNameAndVersion(@Param("name") String name, @Param("version") String version);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id获取报告模板
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PqReport getPqReportById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有报告模板名称
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<String> listAllReportTemplateName();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package com.njcn.gather.plan.mapper;
|
|||||||
|
|
||||||
import com.github.yulichang.base.MPJBaseMapper;
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
import com.njcn.gather.plan.pojo.po.AdPlanSource;
|
import com.njcn.gather.plan.pojo.po.AdPlanSource;
|
||||||
import com.njcn.gather.device.source.pojo.po.PqSource;
|
import com.njcn.gather.source.pojo.po.PqSource;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@@ -3,5 +3,24 @@
|
|||||||
<mapper namespace="com.njcn.gather.plan.mapper.AdPlanMapper">
|
<mapper namespace="com.njcn.gather.plan.mapper.AdPlanMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getReportIdByNameAndVersion" resultType="java.lang.String">
|
||||||
|
SELECT id
|
||||||
|
FROM pq_report
|
||||||
|
WHERE name = #{name}
|
||||||
|
AND version = #{version}
|
||||||
|
and state = 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getPqReportById" resultType="com.njcn.gather.report.pojo.po.PqReport">
|
||||||
|
SELECT *
|
||||||
|
FROM pq_report
|
||||||
|
WHERE id = #{id}
|
||||||
|
and state = 1
|
||||||
|
</select>
|
||||||
|
<select id="listAllReportTemplateName" resultType="java.lang.String">
|
||||||
|
SELECT concat(name, '_', version) as name
|
||||||
|
FROM pq_report
|
||||||
|
WHERE state = 1
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<mapper namespace="com.njcn.gather.plan.mapper.AdPlanSourceMapper">
|
<mapper namespace="com.njcn.gather.plan.mapper.AdPlanSourceMapper">
|
||||||
|
|
||||||
|
|
||||||
<select id="selectPqSourceByPlanId" resultType="com.njcn.gather.device.source.pojo.po.PqSource">
|
<select id="selectPqSourceByPlanId" resultType="com.njcn.gather.source.pojo.po.PqSource">
|
||||||
SELECT pq_source.*
|
SELECT pq_source.*
|
||||||
FROM pq_source,
|
FROM pq_source,
|
||||||
ad_plan_source
|
ad_plan_source
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ import lombok.Getter;
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public enum DataSourceEnum {
|
public enum DataSourceEnum {
|
||||||
THREE_SENSE_ACTUAL_TIME_DATA("0", "3秒实时数据"),
|
THREE_SENSE_ACTUAL_TIME_DATA("real", "3s实时数据"),
|
||||||
|
|
||||||
MINUTE_STATISTICS_MAX("1", "分钟统计数据-最大"),
|
MINUTE_STATISTICS_MAX("max", "分钟统计数据-最大"),
|
||||||
MINUTE_STATISTICS_MIN("2", "分钟统计数据-最小"),
|
MINUTE_STATISTICS_MIN("min", "分钟统计数据-最小"),
|
||||||
MINUTE_STATISTICS_AVG("3", "分钟统计数据-平均"),
|
MINUTE_STATISTICS_AVG("avg", "分钟统计数据-平均"),
|
||||||
MINUTE_STATISTICS_CP95("4", "分钟统计数据-CP95"),
|
MINUTE_STATISTICS_CP95("cp95", "分钟统计数据-CP95"),
|
||||||
RECORDED_DATA("5", "录播数据");
|
RECORDED_DATA("Recorded_data", "录播数据");
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
private String msg;
|
private String msg;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.gather.device.pojo.enums;
|
package com.njcn.gather.plan.pojo.enums;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.njcn.gather.plan.pojo.param;
|
package com.njcn.gather.plan.pojo.param;
|
||||||
|
|
||||||
import com.njcn.common.pojo.constant.PatternRegex;
|
import com.njcn.common.pojo.constant.PatternRegex;
|
||||||
import com.njcn.gather.device.pojo.constant.DevValidMessage;
|
import com.njcn.gather.pojo.constant.DetectionValidMessage;
|
||||||
import com.njcn.web.pojo.param.BaseParam;
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -18,13 +18,13 @@ import java.util.List;
|
|||||||
public class AdPlanParam {
|
public class AdPlanParam {
|
||||||
|
|
||||||
@ApiModelProperty(value = "名称", required = true)
|
@ApiModelProperty(value = "名称", required = true)
|
||||||
@NotBlank(message = DevValidMessage.NAME_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK)
|
||||||
@Pattern(regexp = PatternRegex.PLAN_NAME_REGEX, message = DevValidMessage.NAME_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.PLAN_NAME_REGEX, message = DetectionValidMessage.NAME_FORMAT_ERROR)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty(value = "模式", required = true)
|
@ApiModelProperty(value = "模式", required = true)
|
||||||
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.PATTERN_NOT_BLANK)
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR)
|
||||||
private String pattern;
|
private String pattern;
|
||||||
|
|
||||||
// @ApiModelProperty(value = "父计划ID")
|
// @ApiModelProperty(value = "父计划ID")
|
||||||
@@ -32,33 +32,44 @@ public class AdPlanParam {
|
|||||||
// private String fatherPlanId;
|
// private String fatherPlanId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "检测源ID列表", required = true)
|
@ApiModelProperty(value = "检测源ID列表", required = true)
|
||||||
@NotEmpty(message = DevValidMessage.SOURCE_IDS_NOT_EMPTY)
|
@NotEmpty(message = DetectionValidMessage.SOURCE_IDS_NOT_EMPTY)
|
||||||
private List<@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.SOURCE_ID_FORMAT_ERROR)String> sourceIds;
|
private List<@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.SOURCE_ID_FORMAT_ERROR) String> sourceIds;
|
||||||
|
|
||||||
@ApiModelProperty(value = "数据源ID列表", required = true)
|
@ApiModelProperty(value = "数据源ID列表", required = true)
|
||||||
@NotEmpty(message = DevValidMessage.DATASOURCE_ID_NOT_EMPTY)
|
@NotEmpty(message = DetectionValidMessage.DATASOURCE_ID_NOT_EMPTY)
|
||||||
private List<String> datasourceIds;
|
private List<String> datasourceIds;
|
||||||
|
|
||||||
@ApiModelProperty(value = "检测脚本ID", required = true)
|
@ApiModelProperty(value = "检测脚本ID", required = true)
|
||||||
@NotBlank(message = DevValidMessage.SCRIPT_ID_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.SCRIPT_ID_NOT_BLANK)
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.SCRIPT_ID_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.SCRIPT_ID_FORMAT_ERROR)
|
||||||
private String scriptId;
|
private String scriptId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "误差体系ID", required = true)
|
@ApiModelProperty(value = "误差体系ID", required = true)
|
||||||
@NotBlank(message = DevValidMessage.ERROR_SYS_ID_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.ERROR_SYS_ID_NOT_BLANK)
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ERROR_SYS_ID_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ERROR_SYS_ID_FORMAT_ERROR)
|
||||||
private String errorSysId;
|
private String errorSysId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "守时检测")
|
@ApiModelProperty(value = "守时检测")
|
||||||
@NotNull(message = DevValidMessage.TIME_CHECK_NOT_NULL)
|
@NotNull(message = DetectionValidMessage.TIME_CHECK_NOT_NULL)
|
||||||
@Min(value = 0, message = DevValidMessage.TIME_CHECK_FORMAT_ERROR)
|
@Min(value = 0, message = DetectionValidMessage.TIME_CHECK_FORMAT_ERROR)
|
||||||
@Max(value = 1, message = DevValidMessage.TIME_CHECK_FORMAT_ERROR)
|
@Max(value = 1, message = DetectionValidMessage.TIME_CHECK_FORMAT_ERROR)
|
||||||
private Integer timeCheck;
|
private Integer timeCheck;
|
||||||
|
|
||||||
@ApiModelProperty("被检设备ID列表")
|
@ApiModelProperty("被检设备ID列表")
|
||||||
@NotNull(message = DevValidMessage.PQ_DEV_IDS_NOT_NULL)
|
@NotNull(message = DetectionValidMessage.PQ_DEV_IDS_NOT_NULL)
|
||||||
private List<String> devIds;
|
private List<String> devIds;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否关联报告")
|
||||||
|
@NotNull(message = DetectionValidMessage.ASSOCIATE_REPORT_NOT_NULL)
|
||||||
|
private Integer associateReport;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "报告模板名称")
|
||||||
|
private String reportTemplateName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "数据处理原则")
|
||||||
|
@NotBlank(message = DetectionValidMessage.DATA_RULE_NOT_BLANK)
|
||||||
|
private String dataRule;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询实体
|
* 分页查询实体
|
||||||
*/
|
*/
|
||||||
@@ -66,27 +77,27 @@ public class AdPlanParam {
|
|||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public static class QueryParam extends BaseParam {
|
public static class QueryParam extends BaseParam {
|
||||||
@ApiModelProperty("名称")
|
@ApiModelProperty("名称")
|
||||||
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DevValidMessage.NAME_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DetectionValidMessage.NAME_FORMAT_ERROR)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty(value = "模式,字典表(数字、模拟、比对)")
|
@ApiModelProperty(value = "模式,字典表(数字、模拟、比对)")
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.PATTERN_FORMAT_ERROR)
|
||||||
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.PATTERN_NOT_BLANK)
|
||||||
private String pattern;
|
private String patternId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "检测状态")
|
@ApiModelProperty(value = "检测状态")
|
||||||
@Min(value = 0, message = DevValidMessage.TEST_STATE_FORMAT_ERROR)
|
@Min(value = 0, message = DetectionValidMessage.TEST_STATE_FORMAT_ERROR)
|
||||||
@Max(value = 2, message = DevValidMessage.TEST_STATE_FORMAT_ERROR)
|
@Max(value = 2, message = DetectionValidMessage.TEST_STATE_FORMAT_ERROR)
|
||||||
private Integer testState;
|
private Integer testState;
|
||||||
|
|
||||||
@ApiModelProperty(value = "报告生成状态")
|
@ApiModelProperty(value = "报告生成状态")
|
||||||
@Min(value = 0, message = DevValidMessage.REPORT_STATE_FORMAT_ERROR)
|
@Min(value = 0, message = DetectionValidMessage.REPORT_STATE_FORMAT_ERROR)
|
||||||
@Max(value = 2, message = DevValidMessage.REPORT_STATE_FORMAT_ERROR)
|
@Max(value = 2, message = DetectionValidMessage.REPORT_STATE_FORMAT_ERROR)
|
||||||
private Integer reportState;
|
private Integer reportState;
|
||||||
|
|
||||||
@ApiModelProperty(value = "检测结果")
|
@ApiModelProperty(value = "检测结果")
|
||||||
@Min(value = 0, message = DevValidMessage.CHECK_RESULT_STATE_FORMAT_ERROR)
|
@Min(value = 0, message = DetectionValidMessage.CHECK_RESULT_STATE_FORMAT_ERROR)
|
||||||
@Max(value = 2, message = DevValidMessage.CHECK_RESULT_STATE_FORMAT_ERROR)
|
@Max(value = 2, message = DetectionValidMessage.CHECK_RESULT_STATE_FORMAT_ERROR)
|
||||||
private Integer result;
|
private Integer result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,36 +105,16 @@ public class AdPlanParam {
|
|||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public static class UpdateParam extends AdPlanParam {
|
public static class UpdateParam extends AdPlanParam {
|
||||||
@ApiModelProperty(value = "id", required = true)
|
@ApiModelProperty(value = "id", required = true)
|
||||||
@NotBlank(message = DevValidMessage.ID_NOT_BLANK)
|
@NotBlank(message = DetectionValidMessage.ID_NOT_BLANK)
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ID_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DetectionValidMessage.ID_FORMAT_ERROR)
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
/**
|
|
||||||
* 检测状态,字典表(未检、检测中、检测完成)
|
|
||||||
*/
|
|
||||||
// @ApiModelProperty(value = "检测状态")
|
|
||||||
// @NotNull(message = DeviceValidMessage.TEST_STATE_NOT_NULL)
|
|
||||||
// @Min(value = 0, message = DeviceValidMessage.TEST_STATE_FORMAT_ERROR)
|
|
||||||
// @Max(value = 2, message = DeviceValidMessage.TEST_STATE_FORMAT_ERROR)
|
|
||||||
// private Integer testState;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 报告生成状态,字典表(未生成、部分生成、全部生成)
|
|
||||||
*/
|
|
||||||
// @ApiModelProperty(value = "报告生成状态")
|
|
||||||
// @NotNull(message = DeviceValidMessage.REPORT_STATE_NOT_NULL)
|
|
||||||
// @Min(value = 0, message = DeviceValidMessage.REPORT_STATE_FORMAT_ERROR)
|
|
||||||
// @Max(value = 2, message = DeviceValidMessage.REPORT_STATE_FORMAT_ERROR)
|
|
||||||
// private Integer reportState;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检测结果,字典表(符合、不符合、/)
|
|
||||||
*/
|
|
||||||
// @ApiModelProperty(value = "检测结果")
|
|
||||||
// @NotNull(message = DeviceValidMessage.CHECK_RESULT_STATE_NOT_NULL)
|
|
||||||
// @Min(value = 0, message = DeviceValidMessage.CHECK_RESULT_STATE_FORMAT_ERROR)
|
|
||||||
// @Max(value = 2, message = DeviceValidMessage.CHECK_RESULT_STATE_FORMAT_ERROR)
|
|
||||||
// private Integer result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class CheckParam {
|
||||||
|
// 0:不合格项复检 1:全部复检
|
||||||
|
private Integer reCheckType;
|
||||||
|
private String planId;
|
||||||
|
private List<String> devIds;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
package com.njcn.gather.plan.pojo.po;
|
package com.njcn.gather.plan.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.njcn.db.mybatisplus.bo.BaseEntity;
|
import com.njcn.db.mybatisplus.bo.BaseEntity;
|
||||||
import io.swagger.models.auth.In;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@@ -78,9 +79,25 @@ public class AdPlan extends BaseEntity implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer code;
|
private Integer code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否关联报告,0-不关联 1-关联
|
||||||
|
*/
|
||||||
|
private Integer associateReport;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报告模板ID,关联PQ_Report表
|
||||||
|
*/
|
||||||
|
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
private String reportTemplateId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态:0-删除 1-正常
|
* 状态:0-删除 1-正常
|
||||||
*/
|
*/
|
||||||
private Integer state;
|
private Integer state;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据处理原则。任意值、部分值、所有值、cp95值、平均值
|
||||||
|
*/
|
||||||
|
private String dataRule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user