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
25c1b88a
Commit
25c1b88a
authored
Aug 13, 2024
by
wujiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改生成指数问题
parent
779ac0bc
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
82 additions
and
57 deletions
+82
-57
AmosJxiopAnalyseApplication.java
...in/java/com/yeejoin/amos/AmosJxiopAnalyseApplication.java
+6
-3
TDBigScreenAnalyseController.java
...le/jxiop/biz/controller/TDBigScreenAnalyseController.java
+2
-2
TdInfoQueryController.java
...ot/module/jxiop/biz/controller/TdInfoQueryController.java
+0
-0
SyncESDataToTdengineMqttListener.java
.../jxiop/biz/listener/SyncESDataToTdengineMqttListener.java
+69
-51
CommonServiceImpl.java
...boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
+0
-0
application-kingbase8.properties
...e-biz/src/main/resources/application-kingbase8.properties
+1
-1
FanHealthIndex.xml
...iz/src/main/resources/mapper/tdengine2/FanHealthIndex.xml
+2
-0
PvHealthIndex.xml
...biz/src/main/resources/mapper/tdengine2/PvHealthIndex.xml
+2
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/AmosJxiopAnalyseApplication.java
View file @
25c1b88a
...
...
@@ -24,11 +24,13 @@ import org.springframework.context.ConfigurableApplicationContext;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.FilterType
;
import
org.springframework.core.env.Environment
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler
;
import
java.net.InetAddress
;
...
...
@@ -52,7 +54,8 @@ import java.net.InetAddress;
"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"
})
@ComponentScan
(
basePackages
=
{
"org.typroject"
,
"com.yeejoin.amos"
},
excludeFilters
=
@ComponentScan
.
Filter
(
type
=
FilterType
.
ASSIGNABLE_TYPE
,
classes
=
{
GlobalExceptionHandler
.
class
}))
@SpringBootApplication
(
exclude
=
{
DataSourceAutoConfiguration
.
class
,
DruidDataSourceAutoConfigure
.
class
})
//@SpringBootApplication
public
class
AmosJxiopAnalyseApplication
{
...
...
@@ -86,8 +89,8 @@ public class AmosJxiopAnalyseApplication {
return
;
}
// 订阅固化周期性数据成功的消息
emqKeeper
.
subscript
(
"sync_esdata_to_tdengine_notice"
,
1
,
syncESDataToTdengineMqttListener
);
emqKeeper
.
subscript
(
"sync_esdata_to_tdengine_notice
1
"
,
1
,
syncESDataToTdengineMqttListener
);
// 订阅业务固化同步数据成功消息
emqKeeper
.
subscript
(
"sync_iotdata_to_tdengine_notice"
,
1
,
syncDasSuccessMqttListener
);
//
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 @
25c1b88a
...
...
@@ -1863,13 +1863,13 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
@Override
public
void
run
(
ApplicationArguments
args
)
throws
Exception
{
initStationFirstSelect
();
//
initStationFirstSelect();
}
/**
* 初始化场站第一个选中
*/
@Scheduled
(
cron
=
"0 */
3
* * * ?"
)
@Scheduled
(
cron
=
"0 */
10
* * * ?"
)
public
void
initStationFirstSelect
()
{
List
<
StationBasicDto
>
stationBasicDtos
=
stationBasicMapper
.
getStationBasicList
();
if
(
CollectionUtil
.
isNotEmpty
(
stationBasicDtos
)){
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/TdInfoQueryController.java
View file @
25c1b88a
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/listener/SyncESDataToTdengineMqttListener.java
View file @
25c1b88a
...
...
@@ -9,6 +9,9 @@ import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.TdengineTimeServiceIm
import
lombok.extern.slf4j.Slf4j
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
...
...
@@ -27,6 +30,7 @@ import java.util.concurrent.TimeUnit;
*/
@Component
@Slf4j
@EnableScheduling
public
class
SyncESDataToTdengineMqttListener
extends
EmqxListener
{
@Autowired
...
...
@@ -43,10 +47,70 @@ public class SyncESDataToTdengineMqttListener extends EmqxListener {
@PostConstruct
public
void
test
()
{
// 每次启动清空redis
//redisUtils.set(JXIOP_ANALYSE_TIME, "2024-07-30 13:40:00");
//
redisUtils.set(JXIOP_ANALYSE_TIME, "2024-07-30 13:40:00");
redisUtils
.
del
(
JXIOP_ANALYSE_TIME
);
}
// @Async("async")
@Scheduled
(
cron
=
"0 */10 * * * ?"
)
public
void
run
()
throws
ParseException
{
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"
);
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
;
CompletableFuture
<
String
>
fan
=
CompletableFuture
.
supplyAsync
(()
->
{
try
{
commonServiceImpl
.
healthWarningMinuteByFan
(
timeF
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
String
fanResult
=
"风电任务完成.."
;
System
.
out
.
println
(
fanResult
);
return
fanResult
;
});
CompletableFuture
<
String
>
pv
=
CompletableFuture
.
supplyAsync
(()
->
{
try
{
commonServiceImpl
.
healthWarningMinuteByPv
(
timeF
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
String
pvResult
=
"光伏任务完成.."
;
System
.
out
.
println
(
pvResult
);
return
pvResult
;
});
try
{
String
fanResult
=
fan
.
get
();
String
pvResult
=
pv
.
get
();
// 区域 全域最后统一生成
tdengineTimeService
.
insertMomentDataAll
(
format
);
if
(
isWholeHour
(
format
))
{
tdengineTimeService
.
insertHourData
();
}
if
(
isWholeDay
(
format
))
{
tdengineTimeService
.
insertDayData
();
}
}
catch
(
InterruptedException
|
ExecutionException
e
)
{
System
.
out
.
println
(
"任务执行异常"
);
e
.
printStackTrace
();
}
}
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
mqttMessage
)
throws
ParseException
{
log
.
info
(
topic
+
"收到数据同步成功,开始计算健康指数!"
);
...
...
@@ -56,54 +120,7 @@ public class SyncESDataToTdengineMqttListener extends EmqxListener {
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
msg
);
String
flag
=
jsonObject
.
get
(
"sync_flag"
).
toString
();
if
(
"success"
.
equals
(
flag
))
{
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"
);
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
;
CompletableFuture
<
String
>
fan
=
CompletableFuture
.
supplyAsync
(()->{
commonServiceImpl
.
healthWarningMinuteByFan
(
timeF
);
String
fanResult
=
"风电任务完成.."
;
System
.
out
.
println
(
fanResult
);
return
fanResult
;
});
CompletableFuture
<
String
>
pv
=
CompletableFuture
.
supplyAsync
(()->{
commonServiceImpl
.
healthWarningMinuteByPv
(
timeF
);
String
pvResult
=
"光伏任务完成.."
;
System
.
out
.
println
(
pvResult
);
return
pvResult
;
});
try
{
String
fanResult
=
fan
.
get
();
String
pvResult
=
pv
.
get
();
// 区域 全域最后统一生成
tdengineTimeService
.
insertMomentDataAll
(
format
);
if
(
isWholeHour
(
format
)){
tdengineTimeService
.
insertHourData
();
}
if
(
isWholeDay
(
format
)){
tdengineTimeService
.
insertDayData
();
}
}
catch
(
InterruptedException
|
ExecutionException
e
)
{
System
.
out
.
println
(
"任务执行异常"
);
e
.
printStackTrace
();
}
run
();
//
// ExecutorService excutorService = Executors.newFixedThreadPool(10);
// int taskCount = 2;
...
...
@@ -159,7 +176,8 @@ public class SyncESDataToTdengineMqttListener extends EmqxListener {
// }).start();
// }
}
private
boolean
isWholeHour
(
String
dateTimeStr
)
{
private
boolean
isWholeHour
(
String
dateTimeStr
)
{
try
{
DateTimeFormatter
FORMATTER
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
LocalDateTime
dateTime
=
LocalDateTime
.
parse
(
dateTimeStr
,
FORMATTER
);
...
...
@@ -169,7 +187,7 @@ public class SyncESDataToTdengineMqttListener extends EmqxListener {
}
}
private
boolean
isWholeDay
(
String
dateTimeStr
)
{
private
boolean
isWholeDay
(
String
dateTimeStr
)
{
try
{
DateTimeFormatter
FORMATTER
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
LocalDateTime
dateTime
=
LocalDateTime
.
parse
(
dateTimeStr
,
FORMATTER
);
...
...
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 @
25c1b88a
This source diff could not be displayed because it is too large. You can
view the blob
instead.
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/resources/application-kingbase8.properties
View file @
25c1b88a
...
...
@@ -34,7 +34,7 @@ spring.redis.host=10.20.1.210
spring.redis.port
=
6379
spring.redis.password
=
yeejoin@2020
openHealth
=
fals
e
openHealth
=
tru
e
spring.cache.type
=
GENERIC
j2cache.open-spring-cache
=
true
j2cache.cache-clean-mode
=
passive
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/resources/mapper/tdengine2/FanHealthIndex.xml
View file @
25c1b88a
...
...
@@ -173,6 +173,8 @@
<if
test=
"dto.analysisType!= null and dto.analysisType!= ''"
>
and analysis_type = #{dto.analysisType}
</if>
<if
test=
"dto.endDateTs!= null and dto.endDateTs!= '' "
>
and ts
<
= #{dto.endDateTs}
</if>
<if
test=
"dto.startDateTs!= null and dto.startDateTs!= ''"
>
and ts
>
= #{dto.startDateTs}
</if>
<!--<if test="dto.endDate!= null and dto.endDate!= ''"> and ts <= #{dto.endDate} </if>
<if test="dto.startDate!= null and dto.startDate!= ''"> and ts >= #{dto.startDate} </if>-->
<if
test=
"dto.area!= null and dto.area!= ''"
>
AND area = #{dto.area}
</if>
<if
test=
"dto.number!= null and dto.number!= ''"
>
AND `number` = #{dto.number}
</if>
<if
test=
"dto.pointName!= null and dto.pointName!= ''"
>
AND point_name = #{dto.pointName}
</if>
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/resources/mapper/tdengine2/PvHealthIndex.xml
View file @
25c1b88a
...
...
@@ -205,6 +205,8 @@
<if
test=
"dto.analysisType!= null and dto.analysisType!= ''"
>
and analysis_type = #{dto.analysisType}
</if>
<if
test=
"dto.endDateTs!= null and dto.endDateTs!= ''"
>
and ts
<
= #{dto.endDateTs}
</if>
<if
test=
"dto.startDateTs!= null and dto.startDateTs!= ''"
>
and ts
>
= #{dto.startDateTs}
</if>
<!--<if test="dto.endDate!= null and dto.endDate!= ''"> and ts <= #{dto.endDate} </if>
<if test="dto.startDate!= null and dto.startDate!= ''"> and ts >= #{dto.startDate} </if>-->
<if
test=
"dto.area!= null and dto.area!= ''"
>
AND area = #{dto.area}
</if>
<if
test=
"dto.subarray!= null and dto.subarray!= ''"
>
AND subarray = #{dto.subarray}
</if>
<if
test=
"dto.pointName!= null and dto.pointName!= ''"
>
AND point_name = #{dto.pointName}
</if>
...
...
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