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
149f1b03
Commit
149f1b03
authored
Jul 30, 2024
by
wujiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改片区参数
parent
886f2158
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
479 additions
and
86 deletions
+479
-86
AmosJxiopAnalyseApplication.java
...in/java/com/yeejoin/amos/AmosJxiopAnalyseApplication.java
+12
-11
TDBigScreenAnalyseController.java
...le/jxiop/biz/controller/TDBigScreenAnalyseController.java
+67
-44
IdxBizFanHealthIndexLatest.java
...t/module/jxiop/biz/entity/IdxBizFanHealthIndexLatest.java
+146
-0
IdxBizPvHealthIndexLatest.java
...ot/module/jxiop/biz/entity/IdxBizPvHealthIndexLatest.java
+157
-0
SyncESDataToTdengineMqttListener.java
.../jxiop/biz/listener/SyncESDataToTdengineMqttListener.java
+61
-23
IdxBizFanHealthIndexLatestMapper.java
...e/jxiop/biz/mapper2/IdxBizFanHealthIndexLatestMapper.java
+14
-0
IdxBizPvHealthIndexLatestMapper.java
...le/jxiop/biz/mapper2/IdxBizPvHealthIndexLatestMapper.java
+14
-0
CommonServiceImpl.java
...boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
+8
-8
HealthStatusIndicatorServiceImpl.java
...op/biz/service/impl/HealthStatusIndicatorServiceImpl.java
+0
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/AmosJxiopAnalyseApplication.java
View file @
149f1b03
...
...
@@ -30,10 +30,8 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
java.net.InetAddress
;
/**
* <pre>
* 智信能源科技服务启动类
...
...
@@ -51,14 +49,16 @@ import java.net.InetAddress;
@EnableScheduling
@MapperScan
({
"org.typroject.tyboot.demo.face.orm.dao*"
,
"org.typroject.tyboot.face.*.orm.dao*"
,
"org.typroject.tyboot.core.auth.face.orm.dao*"
,
"org.typroject.tyboot.component.*.face.orm.dao*"
,
"com.yeejoin.amos.boot.module.**.api.mapper"
,
"com.yeejoin.amos.boot.biz.common.dao.mapper"
,
"com.yeejoin.amos.boot.module.common.biz.*"
,
"com.yeejoin.amos.boot.module.jxiop.api.mapper"
,
"com.yeejoin.amos.boot.module.jxiop.biz.tdmapper"
,
"com.yeejoin.amos.boot.module.jxiop.biz.mapper5"
})
"com.yeejoin.amos.boot.module.**.api.mapper"
,
"com.yeejoin.amos.boot.biz.common.dao.mapper"
,
"com.yeejoin.amos.boot.module.common.biz.*"
,
"com.yeejoin.amos.boot.module.jxiop.api.mapper"
,
"com.yeejoin.amos.boot.module.jxiop.biz.tdmapper"
,
"com.yeejoin.amos.boot.module.jxiop.biz.mapper5"
})
@ComponentScan
(
basePackages
=
{
"org.typroject"
,
"com.yeejoin.amos"
})
@SpringBootApplication
(
exclude
=
{
DataSourceAutoConfiguration
.
class
,
DruidDataSourceAutoConfigure
.
class
})
@SpringBootApplication
(
exclude
=
{
DataSourceAutoConfiguration
.
class
,
DruidDataSourceAutoConfigure
.
class
})
//@SpringBootApplication
public
class
AmosJxiopAnalyseApplication
{
@Autowired
private
EmqKeeper
emqKeeper
;
//本地是否执行健康指数算法开关
//
本地是否执行健康指数算法开关
@Value
(
"${openHealth:false}"
)
Boolean
openHealth
;
@Autowired
...
...
@@ -76,17 +76,18 @@ public class AmosJxiopAnalyseApplication {
String
path
=
oConvertUtils
.
getString
(
env
.
getProperty
(
"server.servlet.context-path"
));
logger
.
info
(
"\n----------------------------------------------------------\n\t"
+
"Application Amos-Biz-Boot-Jxiop-Montior is running! Access URLs:\n\t"
+
"Swagger文档: \thttp://"
+
ip
+
":"
+
port
+
path
+
"/doc.html\n"
+
"----------------------------------------------------------"
);
+
"Application Amos-Biz-Boot-Jxiop-Montior is running! Access URLs:\n\t"
+
"Swagger文档: \thttp://"
+
ip
+
":"
+
port
+
path
+
"/doc.html\n"
+
"----------------------------------------------------------"
);
}
@Bean
public
void
initMqtt
()
throws
Exception
{
if
(
openHealth
)
{
//订阅固化周期性数据成功的消息
if
(!
openHealth
)
{
return
;
}
// 订阅固化周期性数据成功的消息
emqKeeper
.
subscript
(
"sync_esdata_to_tdengine_notice"
,
1
,
syncESDataToTdengineMqttListener
);
//
订阅业务固化同步数据成功消息
//
订阅业务固化同步数据成功消息
emqKeeper
.
subscript
(
"sync_iotdata_to_tdengine_notice"
,
1
,
syncDasSuccessMqttListener
);
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/TDBigScreenAnalyseController.java
View file @
149f1b03
This diff is collapsed.
Click to expand it.
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/entity/IdxBizFanHealthIndexLatest.java
0 → 100644
View file @
149f1b03
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.util.Date
;
/**
*
*
* @author system_generator
* @date 2023-08-15
*/
@Data
@Accessors
(
chain
=
true
)
@TableName
(
"fan_health_index_latest_data"
)
public
class
IdxBizFanHealthIndexLatest
{
private
static
final
long
serialVersionUID
=
1L
;
/**
*
*/
@TableId
(
value
=
"SEQUENCE_NBR"
,
type
=
IdType
.
ID_WORKER_STR
)
private
String
sequenceNbr
;
/**
*
*/
@TableField
(
"REC_DATE"
)
private
Date
recDate
;
/**
* 分析维度类型
*/
@TableField
(
"ANALYSIS_OBJ_TYPE"
)
private
String
analysisObjType
;
/**
* 分析维度seq
*/
@TableField
(
"ANALYSIS_OBJ_SEQ"
)
private
String
analysisObjSeq
;
/**
*
*/
@TableField
(
"WEIGTH"
)
private
Double
weigth
;
/**
*
*/
@TableField
(
"HEALTH_INDEX"
)
private
Double
healthIndex
;
/**
* 健康等级
*/
@TableField
(
"HEALTH_LEVEL"
)
private
String
healthLevel
;
/**
*
*/
@TableField
(
"ANALYSIS_TYPE"
)
private
String
analysisType
;
/**
*
*/
@TableField
(
"ANALYSIS_START_TIME"
)
private
Date
analysisStartTime
;
/**
*
*/
@TableField
(
"ANALYSIS_END_TIME"
)
private
Date
analysisEndTime
;
/**
* 片区
*/
@TableField
(
"ARAE"
)
private
String
arae
;
/**
* 场站
*/
@TableField
(
"STATION"
)
private
String
station
;
/**
* 子系统
*/
@TableField
(
"SUB_SYSTEM"
)
private
String
subSystem
;
/**
* 型号
*/
@TableField
(
"NUMBER"
)
private
String
number
;
/**
* 设备名称
*/
@TableField
(
"EQUIPMENT_NAME"
)
private
String
equipmentName
;
/**
*
*/
@TableField
(
"GATEWAY_ID"
)
private
String
gatewayId
;
/**
* 点表地址
*/
@TableField
(
"INDEX_ADDRESS"
)
private
String
indexAddress
;
@TableField
(
"ANOMALY"
)
private
Double
ANOMALY
;
/**
* 分析变量名称
*/
@TableField
(
"POINT_NAME"
)
private
String
pointName
;
@TableField
(
"ANALYSIS_TIME"
)
private
String
ANALYSISTIME
;
/**
* KKS码
*/
@TableField
(
"KKS"
)
private
String
kks
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/entity/IdxBizPvHealthIndexLatest.java
0 → 100644
View file @
149f1b03
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
/**
*
*
* @author system_generator
* @date 2023-08-15
*/
@Data
@Accessors
(
chain
=
true
)
@TableName
(
"pv_health_index_latest_data"
)
public
class
IdxBizPvHealthIndexLatest
{
private
static
final
long
serialVersionUID
=
1L
;
/**
*
*/
@TableId
(
value
=
"SEQUENCE_NBR"
,
type
=
IdType
.
ID_WORKER_STR
)
private
String
sequenceNbr
;
/**
*
*/
@TableField
(
"REC_DATE"
)
private
Date
recDate
;
/**
* 分析维度类型
*/
@TableField
(
"ANALYSIS_OBJ_TYPE"
)
private
String
analysisObjType
;
/**
* 分析维度seq
*/
@TableField
(
"ANALYSIS_OBJ_SEQ"
)
private
String
analysisObjSeq
;
/**
*
*/
@TableField
(
"WEIGTH"
)
private
Double
weigth
;
/**
*
*/
@TableField
(
"HEALTH_INDEX"
)
private
Double
healthIndex
;
/**
* 健康等级
*/
@TableField
(
"HEALTH_LEVEL"
)
private
String
healthLevel
;
/**
* 分析周期
*/
@TableField
(
"ANALYSIS_TYPE"
)
private
String
analysisType
;
/**
*
*/
@TableField
(
"ANALYSIS_START_TIME"
)
private
Date
analysisStartTime
;
/**
*
*/
@TableField
(
"ANALYSIS_END_TIME"
)
private
Date
analysisEndTime
;
/**
* 片区
*/
@TableField
(
"ARAE"
)
private
String
arae
;
/**
* 场站
*/
@TableField
(
"STATION"
)
private
String
station
;
/**
* 子阵
*/
@TableField
(
"SUBARRAY"
)
private
String
subarray
;
/**
* 厂商
*/
@TableField
(
"MANUFACTURER"
)
private
String
manufacturer
;
/**
* 设备类型
*/
@TableField
(
"DEVICE_TYPE"
)
private
String
deviceType
;
/**
* 网关ID
*/
@TableField
(
"GATEWAY_ID"
)
private
String
gatewayId
;
/**
* 点表地址
*/
@TableField
(
"INDEX_ADDRESS"
)
private
String
indexAddress
;
/**
* 设备名称
*/
@TableField
(
"EQUIPMENT_NAME"
)
private
String
equipmentName
;
@TableField
(
"ANOMALY"
)
private
Double
ANOMALY
;
/**
* 分析变量名称
*/
@TableField
(
"POINT_NAME"
)
private
String
pointName
;
@TableField
(
"ANALYSIS_TIME"
)
private
String
ANALYSISTIME
;
/**
* KKS码
*/
@TableField
(
"KKS"
)
private
String
kks
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/listener/SyncESDataToTdengineMqttListener.java
View file @
149f1b03
...
...
@@ -5,6 +5,9 @@ import java.util.Date;
import
java.util.concurrent.CountDownLatch
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.TimeUnit
;
import
javax.annotation.PostConstruct
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -13,6 +16,7 @@ import org.typroject.tyboot.component.emq.EmqxListener;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.TdengineTimeServiceImpl
;
...
...
@@ -32,8 +36,20 @@ public class SyncESDataToTdengineMqttListener extends EmqxListener {
@Autowired
private
TdengineTimeServiceImpl
tdengineTimeService
;
@Autowired
private
RedisUtils
redisUtils
;
private
final
static
String
JXIOP_ANALYSE_TIME
=
"JXIOP_ANALYSE_TIME"
;
@PostConstruct
public
void
test
()
{
// 每次启动清空redis
//redisUtils.set(JXIOP_ANALYSE_TIME, "2024-07-30 13:40:00");
redisUtils
.
del
(
JXIOP_ANALYSE_TIME
);
}
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
mqttMessage
)
throws
InterruptedException
,
ParseException
{
public
void
processMessage
(
String
topic
,
MqttMessage
mqttMessage
)
throws
ParseException
{
log
.
info
(
topic
+
"收到数据同步成功,开始计算健康指数!"
);
byte
[]
payload
=
mqttMessage
.
getPayload
();
String
str
=
new
String
(
payload
);
...
...
@@ -46,24 +62,46 @@ public class SyncESDataToTdengineMqttListener extends EmqxListener {
time
=
DateUtil
.
offsetMinute
(
time
,
-
DateUtil
.
minute
(
time
)
%
10
);
String
format
=
DateUtil
.
format
(
time
,
"yyyy-MM-dd HH:mm:00"
);
time
=
DateUtil
.
parse
(
format
,
"yyyy-MM-dd HH:mm:00"
);
ExecutorService
excutorService
=
Executors
.
newFixedThreadPool
(
4
);
if
(
redisUtils
.
get
(
JXIOP_ANALYSE_TIME
)
!=
null
)
{
// 如果相差20分钟 按10分钟处理 可能装备发消息晚了
String
lastformat
=
String
.
valueOf
(
redisUtils
.
get
(
JXIOP_ANALYSE_TIME
));
Date
oldTime
=
DateUtil
.
parse
(
lastformat
,
"yyyy-MM-dd HH:mm:00"
);
long
diffInMillies
=
Math
.
abs
(
time
.
getTime
()
-
oldTime
.
getTime
());
long
diffInMinutes
=
TimeUnit
.
MINUTES
.
convert
(
diffInMillies
,
TimeUnit
.
MILLISECONDS
);
if
(
diffInMinutes
==
20
)
{
time
=
DateUtil
.
offsetMinute
(
time
,
-
10
);
format
=
DateUtil
.
format
(
time
,
"yyyy-MM-dd HH:mm:00"
);
}
}
redisUtils
.
set
(
JXIOP_ANALYSE_TIME
,
format
);
System
.
out
.
println
(
format
);
final
Date
timeF
=
time
;
ExecutorService
excutorService
=
Executors
.
newFixedThreadPool
(
10
);
int
taskCount
=
2
;
final
CountDownLatch
latch
=
new
CountDownLatch
(
taskCount
);
excutorService
.
submit
(()->{
commonServiceImpl
.
healthWarningMinuteByFan
();
excutorService
.
submit
(()
->
{
commonServiceImpl
.
healthWarningMinuteByFan
(
timeF
);
System
.
out
.
println
(
"风电任务完成.."
);
latch
.
countDown
();
});
excutorService
.
submit
(()->{
commonServiceImpl
.
healthWarningMinuteByPv
();
excutorService
.
submit
(()
->
{
commonServiceImpl
.
healthWarningMinuteByPv
(
timeF
);
System
.
out
.
println
(
"光伏任务完成.."
);
latch
.
countDown
();
});
try
{
System
.
out
.
println
(
"等待所有任务完成.."
);
latch
.
await
();
System
.
out
.
println
(
"所有任务完成"
);
//区域 全域最后统一生成
}
catch
(
InterruptedException
e
)
{
System
.
out
.
println
(
"任务执行异常"
);
e
.
printStackTrace
();
Thread
.
currentThread
().
interrupt
();
}
// 结束线程池
excutorService
.
shutdown
();
// 区域 全域最后统一生成
tdengineTimeService
.
insertMomentDataAll
(
format
);
// // 开始异步计算光伏的健康指数算法
...
...
@@ -77,19 +115,19 @@ public class SyncESDataToTdengineMqttListener extends EmqxListener {
// commonServiceImpl.healthWarningMinuteByFan();
// }).start();
}
if
(
"pvsuccess"
.
equals
(
flag
))
{
// 开始异步计算光伏的健康指数算法
new
Thread
(()
->
{
// 调用光伏的健康指数算法
commonServiceImpl
.
healthWarningMinuteByPv
();
}).
start
();
}
if
(
"fansuccess"
.
equals
(
flag
))
{
// 开始异步计算光伏的健康指数算法
new
Thread
(()
->
{
// 调用光伏的健康指数算法
commonServiceImpl
.
healthWarningMinuteByFan
();
}).
start
();
}
//
if ("pvsuccess".equals(flag)) {
//
// 开始异步计算光伏的健康指数算法
//
new Thread(() -> {
//
// 调用光伏的健康指数算法
//
commonServiceImpl.healthWarningMinuteByPv();
//
}).start();
//
}
//
if ("fansuccess".equals(flag)) {
//
// 开始异步计算光伏的健康指数算法
//
new Thread(() -> {
//
// 调用光伏的健康指数算法
//
commonServiceImpl.healthWarningMinuteByFan();
//
}).start();
//
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/mapper2/IdxBizFanHealthIndexLatestMapper.java
0 → 100644
View file @
149f1b03
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
mapper2
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndexLatest
;
/**
* Mapper 接口
*
* @author system_generator
* @date 2023-08-15
*/
public
interface
IdxBizFanHealthIndexLatestMapper
extends
BaseMapper
<
IdxBizFanHealthIndexLatest
>
{
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/mapper2/IdxBizPvHealthIndexLatestMapper.java
0 → 100644
View file @
149f1b03
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
mapper2
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvHealthIndexLatest
;
/**
* Mapper 接口
*
* @author system_generator
* @date 2023-08-15
*/
public
interface
IdxBizPvHealthIndexLatestMapper
extends
BaseMapper
<
IdxBizPvHealthIndexLatest
>
{
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
View file @
149f1b03
...
...
@@ -1828,15 +1828,15 @@ public class CommonServiceImpl {
// @Scheduled(cron = "0 0/10 * * * ?")
// @Async("async")
public
void
healthWarningMinuteByFan
()
{
public
void
healthWarningMinuteByFan
(
Date
time
)
{
if
(!
openHealth
)
{
return
;
}
Date
time
=
new
Date
();
time
=
DateUtil
.
offsetMinute
(
time
,
-
DateUtil
.
minute
(
time
)
%
10
);
//
Date time = new Date();
//
time = DateUtil.offsetMinute(time, -DateUtil.minute(time) % 10);
String
format
=
DateUtil
.
format
(
time
,
"yyyy-MM-dd HH:mm:00"
);
time
=
DateUtil
.
parse
(
format
,
"yyyy-MM-dd HH:mm:00"
);
//
time = DateUtil.parse(format, "yyyy-MM-dd HH:mm:00");
logger
.
info
(
"风机---------------------健康指数时间----"
+
time
);
// Calendar calendar = Calendar.getInstance();
List
<
IdxBizFanPointProcessVariableClassificationDto
>
data
=
idxBizFanPointProcessVariableClassificationMapper
...
...
@@ -2455,15 +2455,15 @@ public class CommonServiceImpl {
// @Scheduled(cron = "0 0/10 * * * ?")
// @Async("async")
public
void
healthWarningMinuteByPv
()
{
public
void
healthWarningMinuteByPv
(
Date
time
)
{
if
(!
openHealth
)
{
return
;
}
// Calendar calendar = Calendar.getInstance();
Date
time
=
new
Date
();
time
=
DateUtil
.
offsetMinute
(
time
,
-
DateUtil
.
minute
(
time
)
%
10
);
//
Date time = new Date();
//
time = DateUtil.offsetMinute(time, -DateUtil.minute(time) % 10);
String
format
=
DateUtil
.
format
(
time
,
"yyyy-MM-dd HH:mm:00"
);
time
=
DateUtil
.
parse
(
format
,
"yyyy-MM-dd HH:mm:00"
);
//
time = DateUtil.parse(format, "yyyy-MM-dd HH:mm:00");
logger
.
info
(
"光伏---------------------健康指数时间----"
+
time
);
List
<
IdxBizPvPointProcessVariableClassificationDto
>
data
=
idxBizPvPointProcessVariableClassificationMapper
.
getInfluxDBData
();
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/HealthStatusIndicatorServiceImpl.java
View file @
149f1b03
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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