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
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
46 additions
and
21 deletions
+46
-21
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
+33
-15
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;
...
@@ -24,11 +24,13 @@ import org.springframework.context.ConfigurableApplicationContext;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.FilterType
;
import
org.springframework.core.env.Environment
;
import
org.springframework.core.env.Environment
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler
;
import
java.net.InetAddress
;
import
java.net.InetAddress
;
...
@@ -52,7 +54,8 @@ 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.**.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.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.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
(
exclude
=
{
DataSourceAutoConfiguration
.
class
,
DruidDataSourceAutoConfigure
.
class
})
//@SpringBootApplication
//@SpringBootApplication
public
class
AmosJxiopAnalyseApplication
{
public
class
AmosJxiopAnalyseApplication
{
...
@@ -86,8 +89,8 @@ public class AmosJxiopAnalyseApplication {
...
@@ -86,8 +89,8 @@ public class AmosJxiopAnalyseApplication {
return
;
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
...
@@ -1863,13 +1863,13 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
@Override
@Override
public
void
run
(
ApplicationArguments
args
)
throws
Exception
{
public
void
run
(
ApplicationArguments
args
)
throws
Exception
{
initStationFirstSelect
();
//
initStationFirstSelect();
}
}
/**
/**
* 初始化场站第一个选中
* 初始化场站第一个选中
*/
*/
@Scheduled
(
cron
=
"0 */
3
* * * ?"
)
@Scheduled
(
cron
=
"0 */
10
* * * ?"
)
public
void
initStationFirstSelect
()
{
public
void
initStationFirstSelect
()
{
List
<
StationBasicDto
>
stationBasicDtos
=
stationBasicMapper
.
getStationBasicList
();
List
<
StationBasicDto
>
stationBasicDtos
=
stationBasicMapper
.
getStationBasicList
();
if
(
CollectionUtil
.
isNotEmpty
(
stationBasicDtos
)){
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
...
@@ -9,6 +9,9 @@ import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.TdengineTimeServiceIm
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.springframework.beans.factory.annotation.Autowired
;
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.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
...
@@ -27,6 +30,7 @@ import java.util.concurrent.TimeUnit;
...
@@ -27,6 +30,7 @@ import java.util.concurrent.TimeUnit;
*/
*/
@Component
@Component
@Slf4j
@Slf4j
@EnableScheduling
public
class
SyncESDataToTdengineMqttListener
extends
EmqxListener
{
public
class
SyncESDataToTdengineMqttListener
extends
EmqxListener
{
@Autowired
@Autowired
...
@@ -43,20 +47,13 @@ public class SyncESDataToTdengineMqttListener extends EmqxListener {
...
@@ -43,20 +47,13 @@ public class SyncESDataToTdengineMqttListener extends EmqxListener {
@PostConstruct
@PostConstruct
public
void
test
()
{
public
void
test
()
{
// 每次启动清空redis
// 每次启动清空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
);
redisUtils
.
del
(
JXIOP_ANALYSE_TIME
);
}
}
@Override
// @Async("async")
public
void
processMessage
(
String
topic
,
MqttMessage
mqttMessage
)
throws
ParseException
{
@Scheduled
(
cron
=
"0 */10 * * * ?"
)
log
.
info
(
topic
+
"收到数据同步成功,开始计算健康指数!"
);
public
void
run
()
throws
ParseException
{
byte
[]
payload
=
mqttMessage
.
getPayload
();
String
str
=
new
String
(
payload
);
String
msg
=
JSON
.
parse
(
str
).
toString
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
msg
);
String
flag
=
jsonObject
.
get
(
"sync_flag"
).
toString
();
if
(
"success"
.
equals
(
flag
))
{
Date
time
=
new
Date
();
Date
time
=
new
Date
();
time
=
DateUtil
.
offsetMinute
(
time
,
-
DateUtil
.
minute
(
time
)
%
10
);
time
=
DateUtil
.
offsetMinute
(
time
,
-
DateUtil
.
minute
(
time
)
%
10
);
String
format
=
DateUtil
.
format
(
time
,
"yyyy-MM-dd HH:mm:00"
);
String
format
=
DateUtil
.
format
(
time
,
"yyyy-MM-dd HH:mm:00"
);
...
@@ -76,15 +73,23 @@ public class SyncESDataToTdengineMqttListener extends EmqxListener {
...
@@ -76,15 +73,23 @@ public class SyncESDataToTdengineMqttListener extends EmqxListener {
System
.
out
.
println
(
format
);
System
.
out
.
println
(
format
);
final
Date
timeF
=
time
;
final
Date
timeF
=
time
;
CompletableFuture
<
String
>
fan
=
CompletableFuture
.
supplyAsync
(()->{
CompletableFuture
<
String
>
fan
=
CompletableFuture
.
supplyAsync
(()
->
{
try
{
commonServiceImpl
.
healthWarningMinuteByFan
(
timeF
);
commonServiceImpl
.
healthWarningMinuteByFan
(
timeF
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
String
fanResult
=
"风电任务完成.."
;
String
fanResult
=
"风电任务完成.."
;
System
.
out
.
println
(
fanResult
);
System
.
out
.
println
(
fanResult
);
return
fanResult
;
return
fanResult
;
});
});
CompletableFuture
<
String
>
pv
=
CompletableFuture
.
supplyAsync
(()->{
CompletableFuture
<
String
>
pv
=
CompletableFuture
.
supplyAsync
(()
->
{
try
{
commonServiceImpl
.
healthWarningMinuteByPv
(
timeF
);
commonServiceImpl
.
healthWarningMinuteByPv
(
timeF
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
String
pvResult
=
"光伏任务完成.."
;
String
pvResult
=
"光伏任务完成.."
;
System
.
out
.
println
(
pvResult
);
System
.
out
.
println
(
pvResult
);
return
pvResult
;
return
pvResult
;
...
@@ -94,16 +99,28 @@ public class SyncESDataToTdengineMqttListener extends EmqxListener {
...
@@ -94,16 +99,28 @@ public class SyncESDataToTdengineMqttListener extends EmqxListener {
String
pvResult
=
pv
.
get
();
String
pvResult
=
pv
.
get
();
// 区域 全域最后统一生成
// 区域 全域最后统一生成
tdengineTimeService
.
insertMomentDataAll
(
format
);
tdengineTimeService
.
insertMomentDataAll
(
format
);
if
(
isWholeHour
(
format
))
{
if
(
isWholeHour
(
format
))
{
tdengineTimeService
.
insertHourData
();
tdengineTimeService
.
insertHourData
();
}
}
if
(
isWholeDay
(
format
))
{
if
(
isWholeDay
(
format
))
{
tdengineTimeService
.
insertDayData
();
tdengineTimeService
.
insertDayData
();
}
}
}
catch
(
InterruptedException
|
ExecutionException
e
)
{
}
catch
(
InterruptedException
|
ExecutionException
e
)
{
System
.
out
.
println
(
"任务执行异常"
);
System
.
out
.
println
(
"任务执行异常"
);
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
mqttMessage
)
throws
ParseException
{
log
.
info
(
topic
+
"收到数据同步成功,开始计算健康指数!"
);
byte
[]
payload
=
mqttMessage
.
getPayload
();
String
str
=
new
String
(
payload
);
String
msg
=
JSON
.
parse
(
str
).
toString
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
msg
);
String
flag
=
jsonObject
.
get
(
"sync_flag"
).
toString
();
if
(
"success"
.
equals
(
flag
))
{
run
();
//
//
// ExecutorService excutorService = Executors.newFixedThreadPool(10);
// ExecutorService excutorService = Executors.newFixedThreadPool(10);
// int taskCount = 2;
// int taskCount = 2;
...
@@ -159,6 +176,7 @@ public class SyncESDataToTdengineMqttListener extends EmqxListener {
...
@@ -159,6 +176,7 @@ public class SyncESDataToTdengineMqttListener extends EmqxListener {
// }).start();
// }).start();
// }
// }
}
}
private
boolean
isWholeHour
(
String
dateTimeStr
)
{
private
boolean
isWholeHour
(
String
dateTimeStr
)
{
try
{
try
{
DateTimeFormatter
FORMATTER
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
DateTimeFormatter
FORMATTER
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
...
...
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 diff is collapsed.
Click to expand it.
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
...
@@ -34,7 +34,7 @@ spring.redis.host=10.20.1.210
spring.redis.port
=
6379
spring.redis.port
=
6379
spring.redis.password
=
yeejoin@2020
spring.redis.password
=
yeejoin@2020
openHealth
=
fals
e
openHealth
=
tru
e
spring.cache.type
=
GENERIC
spring.cache.type
=
GENERIC
j2cache.open-spring-cache
=
true
j2cache.open-spring-cache
=
true
j2cache.cache-clean-mode
=
passive
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 @@
...
@@ -173,6 +173,8 @@
<if
test=
"dto.analysisType!= null and dto.analysisType!= ''"
>
and analysis_type = #{dto.analysisType}
</if>
<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.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.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.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.number!= null and dto.number!= ''"
>
AND `number` = #{dto.number}
</if>
<if
test=
"dto.pointName!= null and dto.pointName!= ''"
>
AND point_name = #{dto.pointName}
</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 @@
...
@@ -205,6 +205,8 @@
<if
test=
"dto.analysisType!= null and dto.analysisType!= ''"
>
and analysis_type = #{dto.analysisType}
</if>
<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.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.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.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.subarray!= null and dto.subarray!= ''"
>
AND subarray = #{dto.subarray}
</if>
<if
test=
"dto.pointName!= null and dto.pointName!= ''"
>
AND point_name = #{dto.pointName}
</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