Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-zx-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
项目统一框架
一体化_户用光伏项目代码
amos-boot-zx-biz
Commits
30aae562
Commit
30aae562
authored
Oct 22, 2025
by
wujiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交代码
parent
35b81f8b
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
112 additions
and
39 deletions
+112
-39
EquipmentIndexVO.java
.../main/java/com/yeejoin/equip/entity/EquipmentIndexVO.java
+2
-0
EquipmentSpecificIndex.java
...java/com/yeejoin/equip/entity/EquipmentSpecificIndex.java
+3
-3
ConnectionManager.java
...c/main/java/com/yeejoin/equip/eqmx/ConnectionManager.java
+2
-0
MqttConnector.java
...p/src/main/java/com/yeejoin/equip/eqmx/MqttConnector.java
+18
-2
SystemInit.java
...quip/src/main/java/com/yeejoin/equip/eqmx/SystemInit.java
+42
-0
ElasticSearchUtil.java
.../main/java/com/yeejoin/equip/utils/ElasticSearchUtil.java
+1
-1
EquipmentSpecificIndexMapper.xml
...n/resources/mapper/mysql/EquipmentSpecificIndexMapper.xml
+3
-1
JXDZExecute.java
.../amos/boot/module/jxiop/biz/jxdz/factory/JXDZExecute.java
+5
-3
JXDZUtils.java
...join/amos/boot/module/jxiop/biz/jxdz/utils/JXDZUtils.java
+36
-29
No files found.
amos-boot-data/amos-boot-data-equip/src/main/java/com/yeejoin/equip/entity/EquipmentIndexVO.java
View file @
30aae562
...
...
@@ -93,4 +93,6 @@ public class EquipmentIndexVO implements Serializable {
@ApiModelProperty
(
value
=
"装备指标名称"
)
private
String
equipmentIndexName
;
private
String
newAddress
;
}
amos-boot-data/amos-boot-data-equip/src/main/java/com/yeejoin/equip/entity/EquipmentSpecificIndex.java
View file @
30aae562
...
...
@@ -43,7 +43,6 @@ public class EquipmentSpecificIndex extends BaseEntity {
@ApiModelProperty
(
value
=
"装备名称(冗余字段)"
)
@TableField
(
"equipment_specific_name"
)
private
String
equipmentSpecificName
;
// equipmentSpecialName
@ApiModelProperty
(
value
=
"指标名称(冗余字段)"
)
@TableField
(
"equipment_index_name"
)
...
...
@@ -104,8 +103,6 @@ public class EquipmentSpecificIndex extends BaseEntity {
@TableField
(
exist
=
false
)
private
String
indexName
;
@TableField
(
exist
=
false
)
private
String
equipmentSpecificIndexName
;
...
...
@@ -206,4 +203,7 @@ public class EquipmentSpecificIndex extends BaseEntity {
@ApiModelProperty
(
value
=
"网关标识"
)
@TableField
(
value
=
"gateway_id"
)
private
String
gatewayId
;
@TableField
(
value
=
"new_address"
)
private
String
newAddress
;
}
amos-boot-data/amos-boot-data-equip/src/main/java/com/yeejoin/equip/eqmx/ConnectionManager.java
View file @
30aae562
...
...
@@ -6,6 +6,7 @@ import com.yeejoin.equip.kafka.KafkaProducerService;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.DependsOn
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
...
...
@@ -17,6 +18,7 @@ import java.util.concurrent.ConcurrentHashMap;
@Component
@Slf4j
@DependsOn
(
"SystemInit"
)
public
class
ConnectionManager
{
private
final
Map
<
String
,
Connector
>
connectors
=
new
ConcurrentHashMap
<>();
...
...
amos-boot-data/amos-boot-data-equip/src/main/java/com/yeejoin/equip/eqmx/MqttConnector.java
View file @
30aae562
...
...
@@ -103,10 +103,18 @@ public class MqttConnector implements Connector, MqttCallback {
}
String
values
=
msg
.
getString
(
"values"
);
JSONObject
vobj
=
JSONObject
.
parseObject
(
values
,
JSONObject
.
class
);
Map
<
String
,
String
>
map
=
SystemInit
.
map
.
get
(
gatewayId
);
for
(
String
key:
vobj
.
keySet
())
{
JSONObject
result
=
new
JSONObject
();
result
.
put
(
"address"
,
key
);
if
(
map
.
containsKey
(
key
))
{
String
oldAddress
=
map
.
get
(
key
);
result
.
put
(
"address"
,
oldAddress
);
}
else
{
result
.
put
(
"address"
,
key
);
}
result
.
put
(
"value"
,
vobj
.
get
(
key
));
result
.
put
(
"gatewayId"
,
gatewayId
);
//log.info("===========接收MQTT订阅消息,address:{},gatewayId:{},value:{}", address,gatewayId,value);
...
...
@@ -130,10 +138,18 @@ public class MqttConnector implements Connector, MqttCallback {
}
String
values
=
msg
.
getString
(
"values"
);
JSONObject
vobj
=
JSONObject
.
parseObject
(
values
,
JSONObject
.
class
);
Map
<
String
,
String
>
map
=
SystemInit
.
map
.
get
(
gatewayId
);
for
(
String
key:
vobj
.
keySet
())
{
JSONObject
result
=
new
JSONObject
();
result
.
put
(
"address"
,
key
);
if
(
map
.
containsKey
(
key
))
{
String
oldAddress
=
map
.
get
(
key
);
result
.
put
(
"address"
,
oldAddress
);
}
else
{
result
.
put
(
"address"
,
key
);
}
result
.
put
(
"value"
,
vobj
.
get
(
key
));
result
.
put
(
"gatewayId"
,
gatewayId
);
//log.info("===========接收MQTT订阅消息,address:{},gatewayId:{},value:{}", address,gatewayId,value);
...
...
amos-boot-data/amos-boot-data-equip/src/main/java/com/yeejoin/equip/eqmx/SystemInit.java
0 → 100644
View file @
30aae562
package
com
.
yeejoin
.
equip
.
eqmx
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.equip.entity.EquipmentIndexVO
;
import
com.yeejoin.equip.entity.EquipmentSpecificIndex
;
import
com.yeejoin.equip.mapper.mysql.EquipmentSpecificIndexMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.PostConstruct
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
@Component
(
"SystemInit"
)
public
class
SystemInit
{
public
static
Map
<
String
,
Map
<
String
,
String
>>
map
=
new
HashMap
<>();
@Autowired
private
EquipmentSpecificIndexMapper
equipmentSpecificIndexMapper
;
@PostConstruct
public
void
point
()
{
List
<
EquipmentIndexVO
>
list
=
equipmentSpecificIndexMapper
.
getEquipSpecificIndexList
(
null
);
Map
<
String
,
Map
<
String
,
String
>>
result
=
list
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
EquipmentIndexVO:
:
getGatewayId
,
Collectors
.
toMap
(
vo
->
Optional
.
ofNullable
(
vo
.
getNewAddress
()).
orElse
(
""
),
EquipmentIndexVO:
:
getIndexAddress
)
));
map
=
result
;
}
}
amos-boot-data/amos-boot-data-equip/src/main/java/com/yeejoin/equip/utils/ElasticSearchUtil.java
View file @
30aae562
...
...
@@ -187,7 +187,7 @@ public class ElasticSearchUtil {
@Override
public
void
onResponse
(
UpdateResponse
updateResponse
)
{
if
(
DocWriteResponse
.
Result
.
UPDATED
.
equals
(
updateResponse
.
getResult
()))
{
log
.
info
(
"索引:【{}】,主键:【{}】修改成功"
,
indexName
,
id
);
//
log.info("索引:【{}】,主键:【{}】修改成功", indexName, id);
}
}
...
...
amos-boot-data/amos-boot-data-equip/src/main/resources/mapper/mysql/EquipmentSpecificIndexMapper.xml
View file @
30aae562
...
...
@@ -15,6 +15,7 @@
<result
property=
"equipmentIndexName"
column=
"equipment_index_name"
/>
<result
property=
"equipmentSpecificName"
column=
"equipment_specific_name"
/>
<result
property=
"dataType"
column=
"data_type"
/>
<result
property=
"newAddress"
column=
"new_address"
/>
</resultMap>
<select
id=
"getEquipSpecificIndexList"
resultMap=
"ComplementCode"
>
...
...
@@ -30,7 +31,8 @@
si.data_type,
si.equipment_specific_name,
si.equipment_index_name,
si.is_alarm
si.is_alarm,
si.new_address
FROM
wl_equipment_specific_index si
LEFT JOIN wl_equipment_index ei ON si.equipment_index_id = ei.id
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/factory/JXDZExecute.java
View file @
30aae562
...
...
@@ -59,10 +59,11 @@ public class JXDZExecute {
@Scheduled
(
cron
=
"0 0 */1 * * ?"
)
@PostConstruct
public
void
hourInterface
()
{
//
if (!jxdzScheduledEnable) {
//
return;
//
}
if
(!
jxdzScheduledEnable
)
{
return
;
}
log
.
info
(
"开始执行小时任务"
);
//发送请求传入的参数
NeedDataVO
needDataVO
=
new
NeedDataVO
();
...
...
@@ -149,6 +150,7 @@ public class JXDZExecute {
}
@Scheduled
(
cron
=
"0 0 1 * * ?"
)
@PostConstruct
public
void
dayInterface
()
{
if
(!
jxdzScheduledEnable
)
{
return
;
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/utils/JXDZUtils.java
View file @
30aae562
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
utils
;
import
cn.hutool.core.codec.Base64
;
import
cn.hutool.crypto.asymmetric.SM2
;
import
com.alibaba.fastjson.JSONObject
;
import
com.csii.pp.icbc.util.SM2Utils
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.NeedDataVO
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
lombok.extern.slf4j.Slf4j
;
//
import org.bouncycastle.asn1.gm.GMNamedCurves;
//
import org.bouncycastle.asn1.x9.X9ECParameters;
//
import org.bouncycastle.crypto.engines.SM2Engine;
//
import org.bouncycastle.crypto.params.ECDomainParameters;
//
import org.bouncycastle.crypto.params.ECPublicKeyParameters;
//
import org.bouncycastle.crypto.params.ParametersWithRandom;
//
import org.bouncycastle.math.ec.ECPoint;
//
import org.bouncycastle.util.encoders.Hex;
import
org.bouncycastle.asn1.gm.GMNamedCurves
;
import
org.bouncycastle.asn1.x9.X9ECParameters
;
import
org.bouncycastle.crypto.engines.SM2Engine
;
import
org.bouncycastle.crypto.params.ECDomainParameters
;
import
org.bouncycastle.crypto.params.ECPublicKeyParameters
;
import
org.bouncycastle.crypto.params.ParametersWithRandom
;
import
org.bouncycastle.math.ec.ECPoint
;
import
org.bouncycastle.util.encoders.Hex
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.*
;
...
...
@@ -20,6 +22,7 @@ import org.springframework.stereotype.Component;
import
org.springframework.web.client.RestTemplate
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.security.SecureRandom
;
import
java.util.List
;
...
...
@@ -33,7 +36,7 @@ import java.util.Objects;
public
class
JXDZUtils
{
@Value
(
"${coreIp:iiet-jepcc.powerchina.cn:8088}"
)
String
coreIp
;
@Value
(
"${jxdzIp:
122.70.153.215
:9003}"
)
@Value
(
"${jxdzIp:
210.12.143.88
:9003}"
)
String
jxdzIp
;
@Value
(
"${jxdzTokenUserName:jiangxi_epc}"
)
String
jxdzTokenUserName
;
...
...
@@ -49,25 +52,24 @@ public class JXDZUtils {
public
static
String
GF_CODE
=
"PPC17063608260011"
;
private
String
dataEncrypt
(
String
obj
,
String
publicKey
)
{
// X9ECParameters sm2ECParameters = GMNamedCurves.getByName("sm2p256v1");
// ECDomainParameters domainParameters = new ECDomainParameters(sm2ECParameters.getCurve(), sm2ECParameters.getG(),
// sm2ECParameters.getN(), sm2ECParameters.getH());
// ECPoint pukPoint = sm2ECParameters.getCurve()
// .decodePoint(Hex.decode(publicKey));
// ECPublicKeyParameters publicKeyParameters = new ECPublicKeyParameters(pukPoint, domainParameters);
// SM2Engine.Mode mode = SM2Engine.Mode.C1C3C2;
// SM2Engine sm2Engine = new SM2Engine(mode);
// // 设置sm2为加密模式
// sm2Engine.init(true, new ParametersWithRandom(publicKeyParameters, new SecureRandom()));
// byte[] arrayOfBytes = null;
// byte[] in = obj.getBytes(StandardCharsets.UTF_8);
// try {
// arrayOfBytes = sm2Engine.processBlock(in, 0, in.length);
// } catch (Exception e) {
// e.printStackTrace();
// }
// return Base64.encode(arrayOfBytes);
return
null
;
X9ECParameters
sm2ECParameters
=
GMNamedCurves
.
getByName
(
"sm2p256v1"
);
ECDomainParameters
domainParameters
=
new
ECDomainParameters
(
sm2ECParameters
.
getCurve
(),
sm2ECParameters
.
getG
(),
sm2ECParameters
.
getN
(),
sm2ECParameters
.
getH
());
ECPoint
pukPoint
=
sm2ECParameters
.
getCurve
()
.
decodePoint
(
Hex
.
decode
(
publicKey
));
ECPublicKeyParameters
publicKeyParameters
=
new
ECPublicKeyParameters
(
pukPoint
,
domainParameters
);
SM2Engine
.
Mode
mode
=
SM2Engine
.
Mode
.
C1C3C2
;
SM2Engine
sm2Engine
=
new
SM2Engine
(
mode
);
// 设置sm2为加密模式
sm2Engine
.
init
(
true
,
new
ParametersWithRandom
(
publicKeyParameters
,
new
SecureRandom
()));
byte
[]
arrayOfBytes
=
null
;
byte
[]
in
=
obj
.
getBytes
(
StandardCharsets
.
UTF_8
);
try
{
arrayOfBytes
=
sm2Engine
.
processBlock
(
in
,
0
,
in
.
length
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
Base64
.
encode
(
arrayOfBytes
);
}
...
...
@@ -213,7 +215,7 @@ public class JXDZUtils {
* @param reaccessId
* @return
*/
private
String
buildEncryptData
(
Long
platformId
,
Long
time
,
List
data
,
Long
reaccessId
)
{
private
String
buildEncryptData
(
Long
platformId
,
Long
time
,
List
data
,
Long
reaccessId
)
{
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"platformId"
,
platformId
);
if
(!
Objects
.
isNull
(
reaccessId
))
{
...
...
@@ -222,6 +224,11 @@ public class JXDZUtils {
jsonObject
.
put
(
"time"
,
time
);
jsonObject
.
put
(
"data"
,
data
);
log
.
info
(
"发送的原始数据{}"
,
jsonObject
);
// try {
// return SM2Utils.encrypt(publicKey.getBytes(),jsonObject.toJSONString().getBytes());
// } catch (Exception e) {
// throw new RuntimeException(e);
// }
return
dataEncrypt
(
jsonObject
.
toJSONString
(),
publicKey
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment