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
d8f10aa4
Commit
d8f10aa4
authored
Jul 15, 2024
by
hezhuozhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
27563 中国电建NGN智慧能源一体化平台接入运维数据(江西电建) 定时调用
parent
d76c69e6
Hide whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
2384 additions
and
6 deletions
+2384
-6
application-king.properties
...-jxiop-biz/src/main/resources/application-king.properties
+7
-4
pom.xml
...t-system-jxiop/amos-boot-module-jxiop-monitor-biz/pom.xml
+17
-0
PvDeviceDataMapper.java
...amos/boot/module/jxiop/api/mapper/PvDeviceDataMapper.java
+7
-0
PvStationDataMapper.java
...mos/boot/module/jxiop/api/mapper/PvStationDataMapper.java
+7
-0
StationDailyDataMapper.java
.../boot/module/jxiop/api/mapper/StationDailyDataMapper.java
+7
-0
WindDeviceDataMapper.java
...os/boot/module/jxiop/api/mapper/WindDeviceDataMapper.java
+7
-0
WindStationDataMapper.java
...s/boot/module/jxiop/api/mapper/WindStationDataMapper.java
+7
-0
JXDZExecuteController.java
...ot/module/jxiop/biz/controller/JXDZExecuteController.java
+30
-0
JXDZAccessTypeEnum.java
...s/boot/module/jxiop/biz/jxdz/Enum/JXDZAccessTypeEnum.java
+14
-0
JXDZCodeEnum.java
...in/amos/boot/module/jxiop/biz/jxdz/Enum/JXDZCodeEnum.java
+14
-0
JXDZDataTypeEnum.java
...mos/boot/module/jxiop/biz/jxdz/Enum/JXDZDataTypeEnum.java
+26
-0
PvDeviceDataEntity.java
...boot/module/jxiop/biz/jxdz/entity/PvDeviceDataEntity.java
+44
-0
PvStationDataEntity.java
...oot/module/jxiop/biz/jxdz/entity/PvStationDataEntity.java
+110
-0
StationDailyDataEntity.java
.../module/jxiop/biz/jxdz/entity/StationDailyDataEntity.java
+109
-0
WindDeviceDataEntity.java
...ot/module/jxiop/biz/jxdz/entity/WindDeviceDataEntity.java
+44
-0
WindStationDataEntity.java
...t/module/jxiop/biz/jxdz/entity/WindStationDataEntity.java
+89
-0
DZMTSJServiceImpl.java
...boot/module/jxiop/biz/jxdz/factory/DZMTSJServiceImpl.java
+169
-0
FDZJCServiceImpl.java
.../boot/module/jxiop/biz/jxdz/factory/FDZJCServiceImpl.java
+152
-0
FDZSBJCServiceImpl.java
...oot/module/jxiop/biz/jxdz/factory/FDZSBJCServiceImpl.java
+170
-0
GFDZJCServiceImpl.java
...boot/module/jxiop/biz/jxdz/factory/GFDZJCServiceImpl.java
+170
-0
GFDZSBJCServiceImpl.java
...ot/module/jxiop/biz/jxdz/factory/GFDZSBJCServiceImpl.java
+192
-0
IJXDZService.java
...amos/boot/module/jxiop/biz/jxdz/factory/IJXDZService.java
+30
-0
JXDZExecute.java
.../amos/boot/module/jxiop/biz/jxdz/factory/JXDZExecute.java
+141
-0
JXDZFactory.java
.../amos/boot/module/jxiop/biz/jxdz/factory/JXDZFactory.java
+38
-0
PvDeviceDataServiceImpl.java
...t/module/jxiop/biz/jxdz/impl/PvDeviceDataServiceImpl.java
+11
-0
PvStationDataServiceImpl.java
.../module/jxiop/biz/jxdz/impl/PvStationDataServiceImpl.java
+11
-0
StationDailyDataServiceImpl.java
...dule/jxiop/biz/jxdz/impl/StationDailyDataServiceImpl.java
+11
-0
WindDeviceDataServiceImpl.java
...module/jxiop/biz/jxdz/impl/WindDeviceDataServiceImpl.java
+11
-0
WindStationDataServiceImpl.java
...odule/jxiop/biz/jxdz/impl/WindStationDataServiceImpl.java
+11
-0
JXDZUtils.java
...join/amos/boot/module/jxiop/biz/jxdz/utils/JXDZUtils.java
+224
-0
NeedDataVO.java
...eejoin/amos/boot/module/jxiop/biz/jxdz/vo/NeedDataVO.java
+23
-0
PvDeviceDataVO.java
...in/amos/boot/module/jxiop/biz/jxdz/vo/PvDeviceDataVO.java
+30
-0
PvStationDataVO.java
...n/amos/boot/module/jxiop/biz/jxdz/vo/PvStationDataVO.java
+95
-0
StationDailyDataVO.java
...mos/boot/module/jxiop/biz/jxdz/vo/StationDailyDataVO.java
+98
-0
WindDeviceDataVO.java
.../amos/boot/module/jxiop/biz/jxdz/vo/WindDeviceDataVO.java
+30
-0
WindStationDataVO.java
...amos/boot/module/jxiop/biz/jxdz/vo/WindStationDataVO.java
+77
-0
JXDZMapper.java
...eejoin/amos/boot/module/jxiop/biz/mapper2/JXDZMapper.java
+90
-0
application-dev1.properties
...onitor-biz/src/main/resources/application-dev1.properties
+7
-2
JXDZMapper.xml
...itor-biz/src/main/resources/mapper/cluster/JXDZMapper.xml
+54
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/resources/application-king.properties
View file @
d8f10aa4
...
...
@@ -15,11 +15,11 @@ spring.db3.datasource.username=root
spring.db3.datasource.password
=
Yeejoin@2020
## eureka properties:
eureka.instance.hostname
=
47.92.234.253
eureka.instance.hostname
=
10.20.1.160
eureka.client.serviceUrl.defaultZone
=
http://admin:a1234560@${eureka.instance.hostname}:10001/eureka/
## redis properties:
spring.redis.database
=
1
spring.redis.host
=
47.92.234.253
spring.redis.host
=
10.20.1.210
spring.redis.port
=
6379
spring.redis.password
=
yeejoin@2020
...
...
@@ -98,4 +98,7 @@ spring.activemq.password=admin
spring.jms.pub-sub-domain
=
false
myqueue
=
amos.privilege.v1.JXIOP.AQSC_FDGL.userBusiness
modifypasswordqueue
=
amos.privilege.v1.JXIOP.AMOS_ADMIN.modifyPassword
yth.qg.id
=
1
\ No newline at end of file
yth.qg.id
=
1
emqx.client-user-name
=
admin
emqx.client-password
=
public
logic
=
false
\ No newline at end of file
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/pom.xml
View file @
d8f10aa4
...
...
@@ -19,11 +19,23 @@
<groupId>
com.amosframework.boot
</groupId>
<artifactId>
amos-boot-module-common-biz
</artifactId>
<version>
${amos-biz-boot.version}
</version>
<exclusions>
<exclusion>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcprov-jdk16
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
com.amosframework.boot
</groupId>
<artifactId>
amos-boot-biz-common
</artifactId>
<version>
1.0.0
</version>
<exclusions>
<exclusion>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcprov-jdk16
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
com.amosframework.boot
</groupId>
...
...
@@ -36,6 +48,11 @@
<artifactId>
hutool-all
</artifactId>
<version>
5.7.22
</version>
</dependency>
<dependency>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcprov-jdk15to18
</artifactId>
<version>
1.69
</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.influxdb</groupId>-->
<!-- <artifactId>influxdb-java</artifactId>-->
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/mapper/PvDeviceDataMapper.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
api
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.PvDeviceDataEntity
;
public
interface
PvDeviceDataMapper
extends
BaseMapper
<
PvDeviceDataEntity
>
{
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/mapper/PvStationDataMapper.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
api
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.PvStationDataEntity
;
public
interface
PvStationDataMapper
extends
BaseMapper
<
PvStationDataEntity
>
{
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/mapper/StationDailyDataMapper.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
api
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.StationDailyDataEntity
;
public
interface
StationDailyDataMapper
extends
BaseMapper
<
StationDailyDataEntity
>
{
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/mapper/WindDeviceDataMapper.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
api
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.WindDeviceDataEntity
;
public
interface
WindDeviceDataMapper
extends
BaseMapper
<
WindDeviceDataEntity
>
{
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/mapper/WindStationDataMapper.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
api
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.WindStationDataEntity
;
public
interface
WindStationDataMapper
extends
BaseMapper
<
WindStationDataEntity
>
{
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/JXDZExecuteController.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
controller
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.factory.JXDZExecute
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
@RestController
@RequestMapping
(
value
=
"/jxdz"
)
public
class
JXDZExecuteController
{
@Autowired
JXDZExecute
jxdzExecute
;
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
"/testDay"
)
public
String
testDay
()
{
jxdzExecute
.
dayInterface
();
return
"Success"
;
}
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
"/testHour"
)
public
String
testHour
()
{
jxdzExecute
.
hourInterface
();
return
"Success"
;
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/Enum/JXDZAccessTypeEnum.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
Enum
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
@Getter
@AllArgsConstructor
public
enum
JXDZAccessTypeEnum
{
CAIJI
(
1
,
"采集"
),
BULU
(
2
,
"补录"
),
;
private
Integer
code
;
private
String
remark
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/Enum/JXDZCodeEnum.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
Enum
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
@Getter
@AllArgsConstructor
public
enum
JXDZCodeEnum
{
XZ
(
"W005"
,
"夏造风电站"
),
GF
(
"P001"
,
"泰和前进光伏电站"
),
;
private
String
code
;
private
String
remark
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/Enum/JXDZDataTypeEnum.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
Enum
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
@Getter
@AllArgsConstructor
public
enum
JXDZDataTypeEnum
{
FDZJC
(
1
,
"风电站监测数据"
),
GFDZJC
(
2
,
"光伏电站监测数据"
),
FDZSBJC
(
3
,
"风电站设备监测数据"
),
GFDZSBJC
(
4
,
"光伏电站设备监测数据"
),
DZMTSJ
(
5
,
"电站每天数据包括:运维、节能减排、发电效率"
),
;
private
Integer
code
;
private
String
remark
;
public
static
JXDZDataTypeEnum
getEnumByCode
(
Integer
code
)
{
for
(
JXDZDataTypeEnum
jxdzDataTypeEnum
:
JXDZDataTypeEnum
.
values
())
{
if
(
jxdzDataTypeEnum
.
getCode
().
equals
(
code
))
{
return
jxdzDataTypeEnum
;
}
}
return
null
;
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/entity/PvDeviceDataEntity.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
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
;
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
value
=
"jxdz_pv_device_data"
,
autoResultMap
=
true
)
public
class
PvDeviceDataEntity
extends
BaseEntity
{
@TableField
(
"code"
)
private
String
code
;
@TableField
(
"name"
)
private
String
name
;
/**
* 毫秒级别时间
*/
@TableField
(
"date_time"
)
private
Long
dateTime
;
/**
*日发电量
*/
@TableField
(
"generation_daily"
)
private
Double
GenerationDaily
;
/**
*月发电量
*/
@TableField
(
"generation_month"
)
private
Double
GenerationMonth
;
/**
*年发电量
*/
@TableField
(
"generation_year"
)
private
Double
GenerationYear
;
/**
*累计发电量
*/
@TableField
(
"generation_gross"
)
private
Double
GenerationGross
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/entity/PvStationDataEntity.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
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
;
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
value
=
"jxdz_pv_station_data"
,
autoResultMap
=
true
)
public
class
PvStationDataEntity
extends
BaseEntity
{
@TableField
(
"code"
)
private
String
code
;
@TableField
(
"name"
)
private
String
name
;
/**
* 毫秒级别时间
*/
@TableField
(
"date_time"
)
private
Long
dateTime
;
/**
*发电功率
*/
@TableField
(
"generation_power"
)
private
Double
GenerationPower
;
/**
*总辐射
*/
@TableField
(
"total_radiation"
)
private
Double
TotalRadiation
;
/**
*直接辐射
*/
@TableField
(
"direct_radiation"
)
private
Double
DirectRadiation
;
/**
*散射辐射
*/
@TableField
(
"scatter_radiation"
)
private
Double
ScatterRadiation
;
/**
*日发电量
*/
@TableField
(
"generation_daily"
)
private
Double
GenerationDaily
;
/**
*月发电量
*/
@TableField
(
"generation_month"
)
private
Double
GenerationMonth
;
/**
*年发电量
*/
@TableField
(
"generation_year"
)
private
Double
GenerationYear
;
/**
*累计发电量
*/
@TableField
(
"generation_gross"
)
private
Double
GenerationGross
;
/**
*利用小时数
*/
@TableField
(
"utilize_hours"
)
private
Double
UtilizeHours
;
/**
*损失电量
*/
@TableField
(
"loss_electricity"
)
private
Double
LossElectricity
;
/**
*总辐照度
*/
@TableField
(
"total_irradiance"
)
private
Double
TotalIrradiance
;
/**
*直接辐照度
*/
@TableField
(
"direct_irradiance"
)
private
Double
DirectIrradiance
;
/**
*散射辐照度
*/
@TableField
(
"scatter_irradiance"
)
private
Double
ScatterIrradiance
;
/**
* 日上网电量
*/
@TableField
(
"on_grid_energy_daily"
)
private
Double
OnGridEnergyDaily
;
/**
* 月上网电量
*/
@TableField
(
"on_grid_energy_month"
)
private
Double
OnGridEnergyMonth
;
/**
* 年上网电量
*/
@TableField
(
"on_grid_energy_year"
)
private
Double
OnGridEnergyYear
;
/**
* 累计上网电量
*/
@TableField
(
"on_grid_energy_gross"
)
private
Double
OnGridEnergyGross
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/entity/StationDailyDataEntity.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
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
;
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
value
=
"jxdz_station_daily_data"
,
autoResultMap
=
true
)
public
class
StationDailyDataEntity
extends
BaseEntity
{
@TableField
(
"code"
)
private
String
code
;
@TableField
(
"name"
)
private
String
name
;
/**
* 毫秒级别时间
*/
@TableField
(
"date_time"
)
private
Long
dateTime
;
/**
* 工作票总数
*/
@TableField
(
"work_ticket_total_nums"
)
private
Double
WorkTicketTotalNums
;
/**
* 办理中工作票数
*/
@TableField
(
"work_ticket_processing_nums"
)
private
Double
WorkTicketProcessingNums
;
/**
* 已作废工作票数
*/
@TableField
(
"work_ticket_invalidated_nums"
)
private
Double
WorkTicketInvalidatedNums
;
/**
* 执行中工作票总数
*/
@TableField
(
"work_ticket_executing_nums"
)
private
Double
WorkTicketExecutingNums
;
/**
* 已终结的工作票数
*/
@TableField
(
"work_ticket_terminated_nums"
)
private
Double
WorkTicketTerminatedNums
;
/**
*定期工作任务
*/
@TableField
(
"regular_tasks_nums"
)
private
Double
RegularTasksNums
;
/**
* 巡检任务数量
*/
@TableField
(
"inspection_tasks_nums"
)
private
Double
InspectionTasksNums
;
/**
* 工单总数
*/
@TableField
(
"work_order_total_nums"
)
private
Double
WorkOrderTotalNums
;
/**
* 工单作废数
*/
@TableField
(
"work_order_invalidated_nums"
)
private
Double
WorkOrderInvalidatedNums
;
/**
* 工单待开工数
*/
@TableField
(
"work_order_to_be_opened_nums"
)
private
Double
WorkOrderToBeOpenedNums
;
/**
* 工单终结数
*/
@TableField
(
"work_order_terminated_nums"
)
private
Double
WorkOrderTerminatedNums
;
/**
* 工单开工数
*/
@TableField
(
"work_order_start_nums"
)
private
Double
WorkOrderStartNums
;
/**
* 二氧化碳减排量
*/
@TableField
(
"co2_emission_reduction"
)
private
Double
Co2EmissionReduction
;
/**
* 节约标准煤
*/
@TableField
(
"standard_coal_saving"
)
private
Double
StandardCoalSaving
;
/**
* 二氧化硫减排量
*/
@TableField
(
"so2_emission_reduction"
)
private
Double
So2EmissionReduction
;
/**
* 碳粉尘减排量
*/
@TableField
(
"carbon_dust_emission_reduction"
)
private
Double
CarbonDustEmissionReduction
;
/**
* 发电效率
*/
@TableField
(
"generation_efficiency"
)
private
Double
GenerationEfficiency
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/entity/WindDeviceDataEntity.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
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
;
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
value
=
"jxdz_wind_device_data"
,
autoResultMap
=
true
)
public
class
WindDeviceDataEntity
extends
BaseEntity
{
@TableField
(
"code"
)
private
String
code
;
@TableField
(
"name"
)
private
String
name
;
/**
* 毫秒级别时间
*/
@TableField
(
"date_time"
)
private
Long
dateTime
;
/**
*日发电量
*/
@TableField
(
"generation_daily"
)
private
Double
GenerationDaily
;
/**
*月发电量
*/
@TableField
(
"generation_month"
)
private
Double
GenerationMonth
;
/**
*年发电量
*/
@TableField
(
"generation_year"
)
private
Double
GenerationYear
;
/**
*累计发电量
*/
@TableField
(
"generation_gross"
)
private
Double
GenerationGross
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/entity/WindStationDataEntity.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
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
;
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
value
=
"jxdz_wind_station_data"
,
autoResultMap
=
true
)
public
class
WindStationDataEntity
extends
BaseEntity
{
@TableField
(
"code"
)
private
String
code
;
@TableField
(
"name"
)
private
String
name
;
/**
* 毫秒级别时间
*/
@TableField
(
"date_time"
)
private
Long
dateTime
;
/**
*发电功率
*/
@TableField
(
"generation_power"
)
private
Double
GenerationPower
;
/**
* 风速
*/
@TableField
(
"wind_speed"
)
private
Double
WindSpeed
;
/**
*风向
*/
@TableField
(
"wind_direction"
)
private
Double
WindDirection
;
/**
*日发电量
*/
@TableField
(
"generation_daily"
)
private
Double
GenerationDaily
;
/**
* 月发电量
*/
@TableField
(
"generation_month"
)
private
Double
GenerationMonth
;
/**
* 年发电量
*/
@TableField
(
"generation_year"
)
private
Double
GenerationYear
;
/**
*累计发电量
*/
@TableField
(
"generation_gross"
)
private
Double
GenerationGross
;
/**
*利用小时数
*/
@TableField
(
"utilize_hours"
)
private
Double
UtilizeHours
;
/**
*损失电量
*/
@TableField
(
"loss_electricity"
)
private
Double
LossElectricity
;
/**
* 日上网电量
*/
@TableField
(
"on_grid_energy_daily"
)
private
Double
OnGridEnergyDaily
;
/**
* 月上网电量
*/
@TableField
(
"on_grid_energy_month"
)
private
Double
OnGridEnergyMonth
;
/**
* 年上网电量
*/
@TableField
(
"on_grid_energy_year"
)
private
Double
OnGridEnergyYear
;
/**
* 累计上网电量
*/
@TableField
(
"on_grid_energy_gross"
)
private
Double
OnGridEnergyGross
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/factory/DZMTSJServiceImpl.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
factory
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZAccessTypeEnum
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZCodeEnum
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.StationDailyDataEntity
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.impl.StationDailyDataServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.utils.JXDZUtils
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.NeedDataVO
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.StationDailyDataVO
;
import
com.yeejoin.amos.boot.module.jxiop.biz.mapper2.JXDZMapper
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.stereotype.Service
;
import
java.text.ParseException
;
import
java.time.LocalDate
;
import
java.time.ZoneId
;
import
java.util.*
;
@Service
public
class
DZMTSJServiceImpl
implements
IJXDZService
{
@Autowired
JXDZUtils
jxdzUtils
;
@Autowired
StationDailyDataServiceImpl
stationDailyDataService
;
@Autowired
JXDZMapper
jxdzMapper
;
@Override
public
void
backupData
(
List
list
,
Long
dateTime
)
{
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
List
<
StationDailyDataEntity
>
stationDailyDataEntityList
=
new
ArrayList
<>();
list
.
forEach
(
item
->
{
StationDailyDataEntity
stationDailyDataEntity
=
BeanUtil
.
copyProperties
(
item
,
StationDailyDataEntity
.
class
);
stationDailyDataEntity
.
setDateTime
(
dateTime
);
stationDailyDataEntityList
.
add
(
stationDailyDataEntity
);
});
stationDailyDataService
.
saveBatch
(
stationDailyDataEntityList
);
}
}
@Override
public
List
buildData
(
Integer
accessType
,
Long
dateTime
)
{
List
<
StationDailyDataVO
>
list
=
new
ArrayList
<>();
if
(
JXDZAccessTypeEnum
.
BULU
.
getCode
().
equals
(
accessType
))
{
List
<
StationDailyDataEntity
>
stationDailyDataEntityList
=
stationDailyDataService
.
list
(
new
LambdaQueryWrapper
<
StationDailyDataEntity
>().
eq
(
StationDailyDataEntity:
:
getDateTime
,
dateTime
));
list
=
BeanUtil
.
copyToList
(
stationDailyDataEntityList
,
StationDailyDataVO
.
class
);
}
else
{
list
.
add
(
getBusinessData
(
JXDZCodeEnum
.
XZ
.
getCode
(),
JXDZCodeEnum
.
XZ
.
getRemark
()));
list
.
add
(
getBusinessData
(
JXDZCodeEnum
.
GF
.
getCode
(),
JXDZCodeEnum
.
GF
.
getRemark
()));
}
return
list
;
}
/**
* 获取业务数据
* @param code
* @param name
* @return
*/
private
StationDailyDataVO
getBusinessData
(
String
code
,
String
name
)
{
StationDailyDataVO
stationDailyDataVO
=
new
StationDailyDataVO
();
if
(
JXDZCodeEnum
.
XZ
.
getCode
().
equals
(
code
)){
stationDailyDataVO
.
setCode
(
JXDZUtils
.
XZ_CODE
);
}
else
if
(
JXDZCodeEnum
.
GF
.
getCode
().
equals
(
code
)){
stationDailyDataVO
.
setCode
(
JXDZUtils
.
GF_CODE
);
}
else
{
stationDailyDataVO
.
setCode
(
code
);
}
stationDailyDataVO
.
setName
(
name
);
stationDailyDataVO
.
setWorkTicketTotalNums
(
jxdzMapper
.
countWorkTicketTotalByCode
(
code
).
doubleValue
());
stationDailyDataVO
.
setWorkTicketProcessingNums
(
jxdzMapper
.
countWorkTicketProcessingByCode
(
code
).
doubleValue
());
stationDailyDataVO
.
setWorkTicketInvalidatedNums
(
jxdzMapper
.
countWorkOrderInvalidatedByCode
(
code
).
doubleValue
());
stationDailyDataVO
.
setWorkTicketExecutingNums
(
jxdzMapper
.
countWorkTicketInvalidatedByCode
(
code
).
doubleValue
());
stationDailyDataVO
.
setWorkTicketTerminatedNums
(
jxdzMapper
.
countWorkTicketTerminatedByCode
(
code
).
doubleValue
());
stationDailyDataVO
.
setRegularTasksNums
(
jxdzMapper
.
countRegularTasksByCode
(
code
).
doubleValue
());
stationDailyDataVO
.
setInspectionTasksNums
(
jxdzMapper
.
countInspectionTasksByCode
(
code
).
doubleValue
());
stationDailyDataVO
.
setWorkOrderTotalNums
(
jxdzMapper
.
countWorkOrderTotalByCode
(
code
).
doubleValue
());
stationDailyDataVO
.
setWorkOrderInvalidatedNums
(
jxdzMapper
.
countWorkOrderToBeOpenedByCode
(
code
).
doubleValue
());
stationDailyDataVO
.
setWorkOrderToBeOpenedNums
(
jxdzMapper
.
countWorkOrderTotalByCode
(
code
).
doubleValue
());
stationDailyDataVO
.
setWorkOrderTerminatedNums
(
jxdzMapper
.
countWorkOrderTerminatedByCode
(
code
).
doubleValue
());
stationDailyDataVO
.
setWorkOrderStartNums
(
jxdzMapper
.
countWorkOrderStartByCode
(
code
).
doubleValue
());
//调用core 接口
JSONObject
jsonObject
=
new
JSONObject
();
if
(
JXDZCodeEnum
.
XZ
.
getCode
().
equals
(
code
))
{
String
url
=
"/core/datastorage/gateway/point/list?groupId=1764453166557986818&dataType=analog"
;
jsonObject
=
jxdzUtils
.
sendCoreGetRequest
(
url
);
}
else
if
(
JXDZCodeEnum
.
GF
.
getCode
().
equals
(
code
))
{
String
url
=
"/core/datastorage/gateway/point/list?groupId=1770308721235230721&dataType=analog"
;
jsonObject
=
jxdzUtils
.
sendCoreGetRequest
(
url
);
}
if
(
jsonObject
.
getInteger
(
"status"
)
==
HttpStatus
.
OK
.
value
())
{
//补充电站测点信息
supplementStationData
(
jsonObject
.
getJSONArray
(
"result"
),
stationDailyDataVO
);
supplementBDData
(
stationDailyDataVO
,
code
);
//补充其他信息
}
return
stationDailyDataVO
;
}
/**
* 补充部盾提供的数据
* @param stationDailyDataVO
*/
private
void
supplementBDData
(
StationDailyDataVO
stationDailyDataVO
,
String
code
)
{
if
(
JXDZCodeEnum
.
GF
.
getCode
().
equals
(
code
))
{
try
{
String
yesterday
=
DateUtils
.
dateFormat
(
Date
.
from
(
LocalDate
.
now
().
minusDays
(
1
).
atStartOfDay
(
ZoneId
.
systemDefault
()).
toInstant
()),
"yyyy-MM-dd"
);
String
url
=
"/screen_api?method=scene_screen.large_screen.get_loss_of_electricity&reporting_data="
+
yesterday
+
"&source_station_id=1701778419827638274&station_type=PV"
;
JSONObject
jsonObject
=
jxdzUtils
.
sendCoreGetRequest
(
url
);
if
(
0
==
jsonObject
.
getInteger
(
"status"
))
{
JSONObject
data
=
jsonObject
.
getJSONObject
(
"data"
);
if
(!
Objects
.
isNull
(
data
))
{
stationDailyDataVO
.
setGenerationEfficiency
(
data
.
getDouble
(
"comprehensive_efficiency"
));
}
}
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
/**
* 补充场站数据
* @param result
* @param stationDailyDataVO
*/
private
void
supplementStationData
(
JSONArray
result
,
StationDailyDataVO
stationDailyDataVO
)
{
if
(
CollectionUtil
.
isNotEmpty
(
result
))
{
for
(
Object
o
:
result
)
{
if
(
o
instanceof
Map
)
{
Map
map
=
(
Map
)
o
;
JSONObject
jsonObject
=
new
JSONObject
(
map
);
String
pointName
=
(
String
)
map
.
get
(
"pointName"
);
if
(
"二氧化碳排放量(t)"
.
equals
(
pointName
))
{
stationDailyDataVO
.
setCo2EmissionReduction
(
jsonObject
.
getDouble
(
"value"
));
}
if
(
"节约标准煤(t)"
.
equals
(
pointName
))
{
stationDailyDataVO
.
setStandardCoalSaving
(
jsonObject
.
getDouble
(
"value"
));
}
if
(
"二氧化硫排放量(t)"
.
equals
(
pointName
))
{
stationDailyDataVO
.
setSo2EmissionReduction
(
jsonObject
.
getDouble
(
"value"
));
}
if
(
"碳粉尘减排量(t)"
.
equals
(
pointName
))
{
stationDailyDataVO
.
setCarbonDustEmissionReduction
(
jsonObject
.
getDouble
(
"value"
));
}
if
(
"发电效率"
.
equals
(
pointName
))
{
stationDailyDataVO
.
setGenerationEfficiency
(
jsonObject
.
getDouble
(
"value"
));
}
}
}
}
}
@Override
public
void
sendData
(
Integer
accessType
,
NeedDataVO
needDataVO
,
List
list
)
{
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
jxdzUtils
.
sendJXDZPostRequest
(
"/ngnsyncjiangxiyw/accessdaydata/stationDailyData"
,
accessType
,
needDataVO
,
list
);
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/factory/FDZJCServiceImpl.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
factory
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZAccessTypeEnum
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZCodeEnum
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.WindStationDataEntity
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.impl.WindStationDataServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.utils.JXDZUtils
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.NeedDataVO
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.WindStationDataVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.stereotype.Service
;
import
java.text.ParseException
;
import
java.time.LocalDate
;
import
java.time.ZoneId
;
import
java.util.*
;
@Service
public
class
FDZJCServiceImpl
implements
IJXDZService
{
@Autowired
JXDZUtils
jxdzUtils
;
@Autowired
WindStationDataServiceImpl
windStationDataService
;
@Override
public
void
backupData
(
List
list
,
Long
dateTime
)
{
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
List
<
WindStationDataEntity
>
windStationDataEntityList
=
new
ArrayList
<>();
list
.
forEach
(
item
->
{
WindStationDataEntity
windStationDataEntity
=
BeanUtil
.
copyProperties
(
item
,
WindStationDataEntity
.
class
);
windStationDataEntity
.
setDateTime
(
dateTime
);
windStationDataEntityList
.
add
(
windStationDataEntity
);
});
windStationDataService
.
saveBatch
(
windStationDataEntityList
);
}
}
@Override
public
List
buildData
(
Integer
accessType
,
Long
dateTime
)
{
List
<
WindStationDataVO
>
list
=
new
ArrayList
<>();
if
(
JXDZAccessTypeEnum
.
BULU
.
getCode
().
equals
(
accessType
))
{
List
<
WindStationDataEntity
>
windStationDataEntityList
=
windStationDataService
.
list
(
new
LambdaQueryWrapper
<
WindStationDataEntity
>().
eq
(
WindStationDataEntity:
:
getDateTime
,
dateTime
));
list
=
BeanUtil
.
copyToList
(
windStationDataEntityList
,
WindStationDataVO
.
class
);
}
else
{
list
.
add
(
getBusinessData
(
JXDZCodeEnum
.
XZ
.
getCode
(),
JXDZCodeEnum
.
XZ
.
getRemark
()));
}
return
list
;
}
private
WindStationDataVO
getBusinessData
(
String
code
,
String
name
)
{
WindStationDataVO
windStationDataVO
=
new
WindStationDataVO
();
if
(
JXDZCodeEnum
.
XZ
.
getCode
().
equals
(
code
)){
windStationDataVO
.
setCode
(
JXDZUtils
.
XZ_CODE
);
}
else
{
windStationDataVO
.
setCode
(
code
);
}
windStationDataVO
.
setName
(
name
);
//调用core 接口
JSONObject
jsonObject
=
new
JSONObject
();
if
(
JXDZCodeEnum
.
XZ
.
getCode
().
equals
(
code
))
{
String
url
=
"/core/datastorage/gateway/point/list?groupId=1764453166557986818&dataType=analog"
;
jsonObject
=
jxdzUtils
.
sendCoreGetRequest
(
url
);
}
if
(
jsonObject
.
getInteger
(
"status"
)
==
HttpStatus
.
OK
.
value
())
{
//补充电站测点信息
supplementStationData
(
jsonObject
.
getJSONArray
(
"result"
),
windStationDataVO
);
supplementBDData
(
windStationDataVO
,
code
);
}
return
windStationDataVO
;
}
/**
* 补充部盾提供的数据
* @param windStationDataVO
*/
private
void
supplementBDData
(
WindStationDataVO
windStationDataVO
,
String
code
)
{
JSONObject
jsonObject
=
new
JSONObject
();
if
(
JXDZCodeEnum
.
XZ
.
getCode
().
equals
(
code
))
{
String
yesterday
=
null
;
try
{
yesterday
=
DateUtils
.
dateFormat
(
Date
.
from
(
LocalDate
.
now
().
minusDays
(
1
).
atStartOfDay
(
ZoneId
.
systemDefault
()).
toInstant
()),
"yyyy-MM-dd"
);
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
e
);
}
String
url
=
"/screen_api?method=scene_screen.large_screen.get_loss_of_electricity&reporting_data="
+
yesterday
+
"&source_station_id=1701779143491878913&station_type=FAN"
;
jsonObject
=
jxdzUtils
.
sendCoreGetRequest
(
url
);
}
if
(
0
==
jsonObject
.
getInteger
(
"status"
))
{
JSONObject
data
=
jsonObject
.
getJSONObject
(
"data"
);
if
(!
Objects
.
isNull
(
data
))
{
windStationDataVO
.
setLossElectricity
(
data
.
getDouble
(
"loss_of_electricity_day"
));
windStationDataVO
.
setOnGridEnergyDaily
(
data
.
getDouble
(
"on_grid_energy_day"
));
windStationDataVO
.
setOnGridEnergyMonth
(
data
.
getDouble
(
"on_grid_energy_month"
));
windStationDataVO
.
setOnGridEnergyYear
(
data
.
getDouble
(
"on_grid_energy_year"
));
windStationDataVO
.
setOnGridEnergyGross
(
data
.
getDouble
(
"on_grid_energy"
));
}
}
}
/**
* 补充电站数据
* @param result
* @param windStationDataVO
*/
private
void
supplementStationData
(
JSONArray
result
,
WindStationDataVO
windStationDataVO
)
{
if
(
CollectionUtil
.
isNotEmpty
(
result
))
{
for
(
Object
o
:
result
)
{
if
(
o
instanceof
Map
)
{
Map
map
=
(
Map
)
o
;
JSONObject
jsonObject
=
new
JSONObject
(
map
);
String
pointName
=
(
String
)
map
.
get
(
"pointName"
);
if
(
"发电功率"
.
equals
(
pointName
))
{
windStationDataVO
.
setGenerationPower
(
jsonObject
.
getDouble
(
"value"
));
}
if
(
"瞬时平均风速"
.
equals
(
pointName
))
{
windStationDataVO
.
setWindSpeed
(
jsonObject
.
getDouble
(
"value"
));
}
if
(
"风向"
.
equals
(
pointName
))
{
windStationDataVO
.
setWindDirection
(
jsonObject
.
getDouble
(
"value"
));
}
if
(
"日发电量总和"
.
equals
(
pointName
))
{
windStationDataVO
.
setGenerationDaily
(
jsonObject
.
getDouble
(
"value"
));
}
if
(
"月发电量总和"
.
equals
(
pointName
))
{
windStationDataVO
.
setGenerationMonth
(
jsonObject
.
getDouble
(
"value"
));
}
if
(
"年发电量总和"
.
equals
(
pointName
))
{
windStationDataVO
.
setGenerationYear
(
jsonObject
.
getDouble
(
"value"
));
windStationDataVO
.
setGenerationGross
(
jsonObject
.
getDouble
(
"value"
));
}
if
(
"日利用小时数"
.
equals
(
pointName
))
{
windStationDataVO
.
setUtilizeHours
(
jsonObject
.
getDouble
(
"value"
));
}
}
}
}
}
@Override
public
void
sendData
(
Integer
accessType
,
NeedDataVO
needDataVO
,
List
list
)
{
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
jxdzUtils
.
sendJXDZPostRequest
(
"/ngnsyncjiangxiyw/accesshourdata/windStationData"
,
accessType
,
needDataVO
,
list
);
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/factory/FDZSBJCServiceImpl.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
factory
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZAccessTypeEnum
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZCodeEnum
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.WindDeviceDataEntity
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.impl.WindDeviceDataServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.utils.JXDZUtils
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.NeedDataVO
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.WindDeviceDataVO
;
import
com.yeejoin.amos.boot.module.jxiop.biz.mapper2.JXDZMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
@Service
public
class
FDZSBJCServiceImpl
implements
IJXDZService
{
@Autowired
JXDZUtils
jxdzUtils
;
@Autowired
WindDeviceDataServiceImpl
windDeviceDataService
;
@Autowired
JXDZMapper
jxdzMapper
;
@Override
public
void
backupData
(
List
list
,
Long
dateTime
)
{
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
List
<
WindDeviceDataEntity
>
windDeviceDataEntityList
=
new
ArrayList
<>();
list
.
forEach
(
item
->
{
WindDeviceDataEntity
windDeviceDataEntity
=
BeanUtil
.
copyProperties
(
item
,
WindDeviceDataEntity
.
class
);
windDeviceDataEntity
.
setDateTime
(
dateTime
);
windDeviceDataEntityList
.
add
(
windDeviceDataEntity
);
});
windDeviceDataService
.
saveBatch
(
windDeviceDataEntityList
);
}
}
@Override
public
List
buildData
(
Integer
accessType
,
Long
dateTime
)
{
List
<
WindDeviceDataVO
>
list
=
new
ArrayList
<>();
if
(
JXDZAccessTypeEnum
.
BULU
.
getCode
().
equals
(
accessType
))
{
List
<
WindDeviceDataEntity
>
windDeviceDataEntityList
=
windDeviceDataService
.
list
(
new
LambdaQueryWrapper
<
WindDeviceDataEntity
>().
eq
(
WindDeviceDataEntity:
:
getDateTime
,
dateTime
));
list
=
BeanUtil
.
copyToList
(
windDeviceDataEntityList
,
WindDeviceDataVO
.
class
);
}
else
{
JSONArray
zzBusinessData
=
getZZBusinessData
();
if
(
CollectionUtil
.
isNotEmpty
(
zzBusinessData
))
{
for
(
Object
o
:
zzBusinessData
)
{
if
(
o
instanceof
Map
)
{
Map
map
=
(
Map
)
o
;
JSONObject
jsonObject
=
new
JSONObject
(
map
);
if
(
jsonObject
.
getString
(
"name"
).
contains
(
"风机"
))
{
list
.
add
(
getWindDeviceDataVO
(
jsonObject
));
}
}
}
}
}
return
list
;
}
/**
* 获取风电设备数据
* @param jsonObject
* @return
*/
private
WindDeviceDataVO
getWindDeviceDataVO
(
JSONObject
jsonObject
)
{
WindDeviceDataVO
windDeviceDataVO
=
new
WindDeviceDataVO
();
String
sequenceNbr
=
jsonObject
.
getString
(
"sequenceNbr"
);
windDeviceDataVO
.
setName
(
jsonObject
.
getString
(
"name"
));
windDeviceDataVO
.
setCode
(
getWindDeviceCode
(
jsonObject
.
getString
(
"name"
)));
//开始调用具体列表接口
JSONArray
windDeviceJSONArray
=
getWindDeviceDataBySequenceNbr
(
sequenceNbr
);
if
(
CollectionUtil
.
isNotEmpty
(
windDeviceJSONArray
))
{
for
(
Object
o
:
windDeviceJSONArray
)
{
if
(
o
instanceof
Map
)
{
Map
map
=
(
Map
)
o
;
JSONObject
result
=
new
JSONObject
(
map
);
String
pointName
=
(
String
)
map
.
get
(
"pointName"
);
if
(
"日发电量"
.
equals
(
pointName
))
{
windDeviceDataVO
.
setGenerationDaily
(
result
.
getDouble
(
"value"
));
}
if
(
"月发电量"
.
equals
(
pointName
))
{
windDeviceDataVO
.
setGenerationMonth
(
result
.
getDouble
(
"value"
));
}
if
(
"年发电量"
.
equals
(
pointName
))
{
windDeviceDataVO
.
setGenerationYear
(
result
.
getDouble
(
"value"
));
windDeviceDataVO
.
setGenerationGross
(
result
.
getDouble
(
"value"
));
}
}
}
}
return
windDeviceDataVO
;
}
/**
* 获取风电设备Code
* @param name
* @return
*/
private
String
getWindDeviceCode
(
String
name
)
{
String
replaceString
=
name
.
replace
(
"风机"
,
""
);
Integer
value
=
Integer
.
valueOf
(
replaceString
);
String
field
=
"%#"
+
value
+
"风机系统%"
;
String
replaceField
=
"%#"
+
replaceString
+
"风机系统%"
;
return
jxdzMapper
.
getDeviceCode
(
JXDZCodeEnum
.
XZ
.
getCode
(),
field
,
replaceField
);
}
/**
* 根据主键获取具体的风电测点数据
* @param sequenceNbr
* @return
*/
private
JSONArray
getWindDeviceDataBySequenceNbr
(
String
sequenceNbr
)
{
JSONObject
jsonObject
=
jxdzUtils
.
sendCoreGetRequest
(
"/core/datastorage/gateway/point/list?groupId="
+
sequenceNbr
+
"&dataType=analog"
);
if
(!
Objects
.
isNull
(
jsonObject
))
{
if
(
jsonObject
.
getInteger
(
"status"
)
==
HttpStatus
.
OK
.
value
())
{
return
jsonObject
.
getJSONArray
(
"result"
);
}
}
return
new
JSONArray
();
}
/**
* 获取装置测点数据
* @return
*/
private
JSONArray
getZZBusinessData
()
{
JSONObject
jsonObject
=
jxdzUtils
.
sendCoreGetRequest
(
"/core/front-gateway-device/tree?gatewayId=1762633242759958530"
);
if
(!
Objects
.
isNull
(
jsonObject
))
{
if
(
jsonObject
.
getInteger
(
"status"
)
==
HttpStatus
.
OK
.
value
())
{
JSONArray
result
=
jsonObject
.
getJSONArray
(
"result"
);
if
(
CollectionUtil
.
isNotEmpty
(
result
))
{
JSONObject
firstObject
=
result
.
getJSONObject
(
0
).
getJSONArray
(
"children"
).
getJSONObject
(
0
);
if
(!
Objects
.
isNull
(
firstObject
))
{
JSONArray
children
=
firstObject
.
getJSONArray
(
"children"
);
if
(
CollectionUtil
.
isNotEmpty
(
children
))
{
for
(
Object
child
:
children
)
{
if
(
child
instanceof
Map
)
{
Map
map
=
(
Map
)
child
;
JSONObject
childJSON
=
new
JSONObject
(
map
);
if
(
"装置测点"
.
equals
(
childJSON
.
getString
(
"name"
)))
{
return
childJSON
.
getJSONArray
(
"children"
);
}
}
}
}
}
}
}
}
return
new
JSONArray
();
}
@Override
public
void
sendData
(
Integer
accessType
,
NeedDataVO
needDataVO
,
List
list
)
{
if
(
CollectionUtil
.
isNotEmpty
(
list
)){
jxdzUtils
.
sendJXDZPostRequest
(
"/ngnsyncjiangxiyw/accesshourdata/windDeviceData"
,
accessType
,
needDataVO
,
list
);
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/factory/GFDZJCServiceImpl.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
factory
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZAccessTypeEnum
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZCodeEnum
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.PvStationDataEntity
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.impl.PvStationDataServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.utils.JXDZUtils
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.NeedDataVO
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.PvStationDataVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.stereotype.Service
;
import
java.text.ParseException
;
import
java.time.LocalDate
;
import
java.time.ZoneId
;
import
java.util.*
;
@Service
public
class
GFDZJCServiceImpl
implements
IJXDZService
{
@Autowired
JXDZUtils
jxdzUtils
;
@Autowired
PvStationDataServiceImpl
pvStationDataService
;
@Override
public
void
backupData
(
List
list
,
Long
dateTime
)
{
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
List
<
PvStationDataEntity
>
pvStationDataEntityList
=
new
ArrayList
<>();
list
.
forEach
(
item
->
{
PvStationDataEntity
pvStationDataEntity
=
BeanUtil
.
copyProperties
(
item
,
PvStationDataEntity
.
class
);
pvStationDataEntity
.
setDateTime
(
dateTime
);
pvStationDataEntityList
.
add
(
pvStationDataEntity
);
});
pvStationDataService
.
saveBatch
(
pvStationDataEntityList
);
}
}
@Override
public
List
buildData
(
Integer
accessType
,
Long
dateTime
)
{
List
<
PvStationDataVO
>
list
=
new
ArrayList
<>();
if
(
JXDZAccessTypeEnum
.
BULU
.
getCode
().
equals
(
accessType
))
{
List
<
PvStationDataEntity
>
windStationDataEntityList
=
pvStationDataService
.
list
(
new
LambdaQueryWrapper
<
PvStationDataEntity
>().
eq
(
PvStationDataEntity:
:
getDateTime
,
dateTime
));
list
=
BeanUtil
.
copyToList
(
windStationDataEntityList
,
PvStationDataVO
.
class
);
}
else
{
list
.
add
(
getBusinessData
(
JXDZCodeEnum
.
GF
.
getCode
(),
JXDZCodeEnum
.
GF
.
getRemark
()));
}
return
list
;
}
private
PvStationDataVO
getBusinessData
(
String
code
,
String
name
)
{
PvStationDataVO
pvStationDataVO
=
new
PvStationDataVO
();
if
(
JXDZCodeEnum
.
GF
.
getCode
().
equals
(
code
))
{
pvStationDataVO
.
setCode
(
JXDZUtils
.
GF_CODE
);
}
else
{
pvStationDataVO
.
setCode
(
code
);
}
pvStationDataVO
.
setName
(
name
);
//调用core 接口
JSONObject
jsonObject
=
new
JSONObject
();
if
(
JXDZCodeEnum
.
GF
.
getCode
().
equals
(
code
))
{
String
url
=
"/core/datastorage/gateway/point/list?groupId=1770308721235230721&dataType=analog"
;
jsonObject
=
jxdzUtils
.
sendCoreGetRequest
(
url
);
}
if
(
jsonObject
.
getInteger
(
"status"
)
==
HttpStatus
.
OK
.
value
())
{
//补充电站测点信息
supplementStationData
(
jsonObject
.
getJSONArray
(
"result"
),
pvStationDataVO
);
supplementBDData
(
pvStationDataVO
,
code
);
}
return
pvStationDataVO
;
}
/**
* 补充损失电量
* @param pvStationDataVO
* @param code
*/
private
void
supplementBDData
(
PvStationDataVO
pvStationDataVO
,
String
code
)
{
JSONObject
jsonObject
=
new
JSONObject
();
if
(
JXDZCodeEnum
.
GF
.
getCode
().
equals
(
code
))
{
String
yesterday
=
null
;
try
{
yesterday
=
DateUtils
.
dateFormat
(
Date
.
from
(
LocalDate
.
now
().
minusDays
(
1
).
atStartOfDay
(
ZoneId
.
systemDefault
()).
toInstant
()),
"yyyy-MM-dd"
);
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
e
);
}
String
url
=
"/screen_api?method=scene_screen.large_screen.get_loss_of_electricity&reporting_data="
+
yesterday
+
"&source_station_id=1701778419827638274&station_type=PV"
;
jsonObject
=
jxdzUtils
.
sendCoreGetRequest
(
url
);
}
if
(
0
==
jsonObject
.
getInteger
(
"status"
))
{
JSONObject
data
=
jsonObject
.
getJSONObject
(
"data"
);
if
(!
Objects
.
isNull
(
data
))
{
pvStationDataVO
.
setLossElectricity
(
data
.
getDouble
(
"loss_of_electricity_day"
));
pvStationDataVO
.
setOnGridEnergyDaily
(
data
.
getDouble
(
"on_grid_energy_day"
));
pvStationDataVO
.
setOnGridEnergyMonth
(
data
.
getDouble
(
"on_grid_energy_month"
));
pvStationDataVO
.
setOnGridEnergyYear
(
data
.
getDouble
(
"on_grid_energy_year"
));
pvStationDataVO
.
setOnGridEnergyGross
(
data
.
getDouble
(
"on_grid_energy"
));
}
}
}
/**
* 补充场站数据
* @param result
* @param pvStationDataVO
*/
private
void
supplementStationData
(
JSONArray
result
,
PvStationDataVO
pvStationDataVO
)
{
if
(
CollectionUtil
.
isNotEmpty
(
result
))
{
for
(
Object
o
:
result
)
{
if
(
o
instanceof
Map
)
{
Map
map
=
(
Map
)
o
;
JSONObject
jsonObject
=
new
JSONObject
(
map
);
String
pointName
=
(
String
)
map
.
get
(
"pointName"
);
if
(
"发电功率"
.
equals
(
pointName
))
{
pvStationDataVO
.
setGenerationPower
((
Double
)
map
.
get
(
"value"
));
}
if
(
"总辐射"
.
equals
(
pointName
))
{
pvStationDataVO
.
setTotalRadiation
(
jsonObject
.
getDouble
(
"value"
));
}
if
(
"直接辐射"
.
equals
(
pointName
))
{
pvStationDataVO
.
setDirectRadiation
(
jsonObject
.
getDouble
(
"value"
));
}
if
(
"散射辐射"
.
equals
(
pointName
))
{
pvStationDataVO
.
setScatterRadiation
(
jsonObject
.
getDouble
(
"value"
));
}
if
(
"直接辐照度"
.
equals
(
pointName
))
{
pvStationDataVO
.
setDirectIrradiance
(
jsonObject
.
getDouble
(
"value"
));
}
if
(
"总辐照度"
.
equals
(
pointName
))
{
pvStationDataVO
.
setTotalIrradiance
(
jsonObject
.
getDouble
(
"value"
));
}
if
(
"散射辐照度"
.
equals
(
pointName
))
{
pvStationDataVO
.
setScatterIrradiance
(
jsonObject
.
getDouble
(
"value"
));
}
if
(
"日发电量"
.
equals
(
pointName
))
{
pvStationDataVO
.
setGenerationDaily
(
jsonObject
.
getDouble
(
"value"
));
}
if
(
"月发电量"
.
equals
(
pointName
))
{
pvStationDataVO
.
setGenerationMonth
(
jsonObject
.
getDouble
(
"value"
));
}
if
(
"年发电量"
.
equals
(
pointName
))
{
pvStationDataVO
.
setGenerationYear
(
jsonObject
.
getDouble
(
"value"
));
}
if
(
"累计发电量"
.
equals
(
pointName
))
{
pvStationDataVO
.
setGenerationGross
(
jsonObject
.
getDouble
(
"value"
));
}
if
(
"利用小时数"
.
equals
(
pointName
))
{
pvStationDataVO
.
setUtilizeHours
(
jsonObject
.
getDouble
(
"value"
));
}
}
}
}
}
@Override
public
void
sendData
(
Integer
accessType
,
NeedDataVO
needDataVO
,
List
list
)
{
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
jxdzUtils
.
sendJXDZPostRequest
(
"/ngnsyncjiangxiyw/accesshourdata/pvStationData"
,
accessType
,
needDataVO
,
list
);
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/factory/GFDZSBJCServiceImpl.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
factory
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZAccessTypeEnum
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZCodeEnum
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.PvDeviceDataEntity
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.impl.PvDeviceDataServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.utils.JXDZUtils
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.NeedDataVO
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.PvDeviceDataVO
;
import
com.yeejoin.amos.boot.module.jxiop.biz.mapper2.JXDZMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
@Service
public
class
GFDZSBJCServiceImpl
implements
IJXDZService
{
@Autowired
JXDZUtils
jxdzUtils
;
@Autowired
PvDeviceDataServiceImpl
pvDeviceDataService
;
@Autowired
JXDZMapper
jxdzMapper
;
@Override
public
void
backupData
(
List
list
,
Long
dateTime
)
{
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
List
<
PvDeviceDataEntity
>
pvDeviceDataEntityList
=
new
ArrayList
<>();
list
.
forEach
(
item
->
{
PvDeviceDataEntity
pvDeviceDataEntity
=
BeanUtil
.
copyProperties
(
item
,
PvDeviceDataEntity
.
class
);
pvDeviceDataEntity
.
setDateTime
(
dateTime
);
pvDeviceDataEntityList
.
add
(
pvDeviceDataEntity
);
});
pvDeviceDataService
.
saveBatch
(
pvDeviceDataEntityList
);
}
}
@Override
public
List
buildData
(
Integer
accessType
,
Long
dateTime
)
{
List
<
PvDeviceDataVO
>
list
=
new
ArrayList
<>();
if
(
JXDZAccessTypeEnum
.
BULU
.
getCode
().
equals
(
accessType
))
{
List
<
PvDeviceDataEntity
>
windStationDataEntityList
=
pvDeviceDataService
.
list
(
new
LambdaQueryWrapper
<
PvDeviceDataEntity
>().
eq
(
PvDeviceDataEntity:
:
getDateTime
,
dateTime
));
list
=
BeanUtil
.
copyToList
(
windStationDataEntityList
,
PvDeviceDataVO
.
class
);
}
else
{
JSONArray
zzBusinessData
=
getZZBusinessData
();
if
(
CollectionUtil
.
isNotEmpty
(
zzBusinessData
))
{
for
(
Object
o
:
zzBusinessData
)
{
if
(
o
instanceof
Map
)
{
Map
map
=
(
Map
)
o
;
JSONObject
jsonObject
=
new
JSONObject
(
map
);
if
(
jsonObject
.
getString
(
"name"
).
contains
(
"子阵"
))
{
list
.
add
(
getPvDeviceDataVO
(
jsonObject
));
}
}
}
}
}
return
list
;
}
/**
* 获取光伏设备数据
* @param jsonObject
* @return
*/
private
PvDeviceDataVO
getPvDeviceDataVO
(
JSONObject
jsonObject
)
{
PvDeviceDataVO
pvDeviceDataVO
=
new
PvDeviceDataVO
();
String
sequenceNbr
=
jsonObject
.
getString
(
"sequenceNbr"
);
pvDeviceDataVO
.
setName
(
jsonObject
.
getString
(
"name"
));
pvDeviceDataVO
.
setCode
(
getPvDeviceCode
(
jsonObject
.
getString
(
"name"
)));
//开始调用具体列表接口
JSONArray
windDeviceJSONArray
=
getPvDeviceDataBySequenceNbr
(
sequenceNbr
);
if
(
CollectionUtil
.
isNotEmpty
(
windDeviceJSONArray
))
{
for
(
Object
o
:
windDeviceJSONArray
)
{
if
(
o
instanceof
Map
)
{
Map
map
=
(
Map
)
o
;
JSONObject
result
=
new
JSONObject
(
map
);
String
pointLocation
=
result
.
getString
(
"pointLocation"
);
Boolean
flag
=
checkPvDevice
(
pointLocation
,
jsonObject
.
getString
(
"name"
));
if
(
flag
)
{
String
pointName
=
(
String
)
map
.
get
(
"pointName"
);
if
(
pointName
.
contains
(
"日发电量"
))
{
pvDeviceDataVO
.
setGenerationDaily
(
result
.
getDouble
(
"value"
));
}
if
(
pointName
.
contains
(
"月发电量"
))
{
pvDeviceDataVO
.
setGenerationMonth
(
result
.
getDouble
(
"value"
));
}
if
(
pointName
.
contains
(
"年发电量"
))
{
pvDeviceDataVO
.
setGenerationYear
(
result
.
getDouble
(
"value"
));
}
if
(
pointName
.
contains
(
"总发电量"
))
{
pvDeviceDataVO
.
setGenerationGross
(
result
.
getDouble
(
"value"
));
}
}
}
}
}
return
pvDeviceDataVO
;
}
/**
* 校验路径是否是子阵的 路径倒数第三位为子阵
* @param pointLocation
* @param name
* @return
*/
private
Boolean
checkPvDevice
(
String
pointLocation
,
String
name
)
{
if
(!
StrUtil
.
isEmpty
(
pointLocation
))
{
String
[]
split
=
pointLocation
.
split
(
"/"
);
if
(!
Objects
.
isNull
(
split
))
{
String
zdName
=
split
[
split
.
length
-
3
];
if
(
zdName
.
equals
(
name
))
{
return
true
;
}
}
}
return
false
;
}
/**
* 获取光伏设备数据根据主键
* @param sequenceNbr
* @return
*/
private
JSONArray
getPvDeviceDataBySequenceNbr
(
String
sequenceNbr
)
{
JSONObject
jsonObject
=
jxdzUtils
.
sendCoreGetRequest
(
"/core/datastorage/gateway/point/list?groupId="
+
sequenceNbr
+
"&dataType=accumulator"
);
if
(!
Objects
.
isNull
(
jsonObject
))
{
if
(
jsonObject
.
getInteger
(
"status"
)
==
HttpStatus
.
OK
.
value
())
{
return
jsonObject
.
getJSONArray
(
"result"
);
}
}
return
new
JSONArray
();
}
/**
* 获取光伏设备Code
* @param name
* @return
*/
private
String
getPvDeviceCode
(
String
name
)
{
String
replaceString
=
name
.
replace
(
"子阵"
,
""
);
Integer
value
=
Integer
.
valueOf
(
replaceString
);
String
field
=
"%#"
+
value
+
"光伏阵区系统%"
;
String
replaceField
=
"%#"
+
replaceString
+
"光伏阵区系统%"
;
return
jxdzMapper
.
getDeviceCode
(
JXDZCodeEnum
.
GF
.
getCode
(),
field
,
replaceField
);
}
private
JSONArray
getZZBusinessData
()
{
JSONObject
jsonObject
=
jxdzUtils
.
sendCoreGetRequest
(
"/core/front-gateway-device/tree?gatewayId=1762633785632919553"
);
if
(!
Objects
.
isNull
(
jsonObject
))
{
if
(
jsonObject
.
getInteger
(
"status"
)
==
HttpStatus
.
OK
.
value
())
{
JSONArray
result
=
jsonObject
.
getJSONArray
(
"result"
);
if
(
CollectionUtil
.
isNotEmpty
(
result
))
{
JSONObject
firstObject
=
result
.
getJSONObject
(
0
).
getJSONArray
(
"children"
).
getJSONObject
(
0
);
if
(!
Objects
.
isNull
(
firstObject
))
{
JSONArray
children
=
firstObject
.
getJSONArray
(
"children"
);
if
(
CollectionUtil
.
isNotEmpty
(
children
))
{
for
(
Object
child
:
children
)
{
if
(
child
instanceof
Map
)
{
Map
map
=
(
Map
)
child
;
JSONObject
childJSON
=
new
JSONObject
(
map
);
if
(
"装置测点"
.
equals
(
childJSON
.
getString
(
"name"
)))
{
return
childJSON
.
getJSONArray
(
"children"
);
}
}
}
}
}
}
}
}
return
new
JSONArray
();
}
@Override
public
void
sendData
(
Integer
accessType
,
NeedDataVO
needDataVO
,
List
list
)
{
if
(
CollectionUtil
.
isNotEmpty
(
list
)){
jxdzUtils
.
sendJXDZPostRequest
(
"/ngnsyncjiangxiyw/accesshourdata/pvDeviceData"
,
accessType
,
needDataVO
,
list
);
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/factory/IJXDZService.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
factory
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.NeedDataVO
;
import
java.util.List
;
public
interface
IJXDZService
{
/**
* 备份数据
* @param list
* @param dateTime
*/
void
backupData
(
List
list
,
Long
dateTime
);
/**
* 构建数据
* @param accessType
* @param dateTime
* @return
*/
List
buildData
(
Integer
accessType
,
Long
dateTime
);
/**
* 发送数据
* @param accessType
* @param needDataVO
* @param list
*/
void
sendData
(
Integer
accessType
,
NeedDataVO
needDataVO
,
List
list
);
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/factory/JXDZExecute.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
factory
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZAccessTypeEnum
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZDataTypeEnum
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.utils.JXDZUtils
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.vo.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.time.LocalDateTime
;
import
java.time.ZoneOffset
;
import
java.util.List
;
import
java.util.Map
;
@Component
@Slf4j
public
class
JXDZExecute
{
@Autowired
JXDZUtils
jxdzUtils
;
@Autowired
JXDZFactory
jxdzFactory
;
@Value
(
"${scheduledEnable:false}"
)
private
Boolean
scheduledEnable
;
@Scheduled
(
cron
=
"0 0 */1 * * ?"
)
public
void
hourInterface
()
{
if
(!
scheduledEnable
)
{
return
;
}
log
.
info
(
"开始执行小时任务"
);
//发送请求传入的参数
NeedDataVO
needDataVO
=
new
NeedDataVO
();
needDataVO
.
setPlatformId
(
Long
.
valueOf
(
1360001
));
needDataVO
.
setDateTime
(
LocalDateTime
.
now
().
withMinute
(
0
).
withSecond
(
0
).
withNano
(
0
).
atZone
(
ZoneOffset
.
systemDefault
()).
toInstant
().
toEpochMilli
());
//构建数据
IJXDZService
fdzjcService
=
jxdzFactory
.
getJXDZService
(
JXDZDataTypeEnum
.
FDZJC
);
IJXDZService
gfdzjcService
=
jxdzFactory
.
getJXDZService
(
JXDZDataTypeEnum
.
GFDZJC
);
IJXDZService
fdzsbjcService
=
jxdzFactory
.
getJXDZService
(
JXDZDataTypeEnum
.
FDZSBJC
);
IJXDZService
gfdzsbjcService
=
jxdzFactory
.
getJXDZService
(
JXDZDataTypeEnum
.
GFDZSBJC
);
List
<
WindStationDataVO
>
windStationDataVOList
=
fdzjcService
.
buildData
(
JXDZAccessTypeEnum
.
CAIJI
.
getCode
(),
needDataVO
.
getDateTime
());
List
<
PvStationDataVO
>
pvStationDataVOList
=
gfdzjcService
.
buildData
(
JXDZAccessTypeEnum
.
CAIJI
.
getCode
(),
needDataVO
.
getDateTime
());
List
<
WindDeviceDataVO
>
windDeviceDataVOList
=
fdzsbjcService
.
buildData
(
JXDZAccessTypeEnum
.
CAIJI
.
getCode
(),
needDataVO
.
getDateTime
());
List
<
PvDeviceDataVO
>
pvDeviceDataVOList
=
gfdzsbjcService
.
buildData
(
JXDZAccessTypeEnum
.
CAIJI
.
getCode
(),
needDataVO
.
getDateTime
());
//备份数据
fdzjcService
.
backupData
(
windStationDataVOList
,
needDataVO
.
getDateTime
());
gfdzjcService
.
backupData
(
pvStationDataVOList
,
needDataVO
.
getDateTime
());
fdzsbjcService
.
backupData
(
windDeviceDataVOList
,
needDataVO
.
getDateTime
());
gfdzsbjcService
.
backupData
(
pvDeviceDataVOList
,
needDataVO
.
getDateTime
());
//发送请求
fdzjcService
.
sendData
(
JXDZAccessTypeEnum
.
CAIJI
.
getCode
(),
needDataVO
,
windStationDataVOList
);
gfdzjcService
.
sendData
(
JXDZAccessTypeEnum
.
CAIJI
.
getCode
(),
needDataVO
,
pvStationDataVOList
);
fdzsbjcService
.
sendData
(
JXDZAccessTypeEnum
.
CAIJI
.
getCode
(),
needDataVO
,
windDeviceDataVOList
);
gfdzsbjcService
.
sendData
(
JXDZAccessTypeEnum
.
CAIJI
.
getCode
(),
needDataVO
,
pvDeviceDataVOList
);
log
.
info
(
"小时任务执行成功"
);
}
@Scheduled
(
cron
=
"0 0 1 * * ?"
)
public
void
dayInterface
()
{
if
(!
scheduledEnable
)
{
return
;
}
log
.
info
(
"开始执行天任务"
);
//发送请求传入的参数
NeedDataVO
needDataVO
=
new
NeedDataVO
();
needDataVO
.
setPlatformId
(
Long
.
valueOf
(
1360001
));
needDataVO
.
setDateTime
(
LocalDateTime
.
now
().
withHour
(
0
).
withMinute
(
0
).
withSecond
(
0
).
withNano
(
0
).
atZone
(
ZoneOffset
.
systemDefault
()).
toInstant
().
toEpochMilli
());
//构建数据
IJXDZService
dzmtsjService
=
jxdzFactory
.
getJXDZService
(
JXDZDataTypeEnum
.
DZMTSJ
);
List
<
StationDailyDataVO
>
stationDailyDataVOList
=
dzmtsjService
.
buildData
(
JXDZAccessTypeEnum
.
CAIJI
.
getCode
(),
needDataVO
.
getDateTime
());
//备份数据
dzmtsjService
.
backupData
(
stationDailyDataVOList
,
needDataVO
.
getDateTime
());
//发送请求
dzmtsjService
.
sendData
(
JXDZAccessTypeEnum
.
CAIJI
.
getCode
(),
needDataVO
,
stationDailyDataVOList
);
//处理补录
listNeed
();
log
.
info
(
"天任务执行成功"
);
}
/**
* 处理需要补录的数据
*/
private
void
listNeed
()
{
log
.
info
(
"处理补录数据中"
);
JSONObject
listNeedJson
=
jxdzUtils
.
sendJXDZGetRequest
(
"/ngnsyncjiangxiyw/needreaccess/listNeed?platformId=1360001"
);
if
(
HttpStatus
.
OK
.
value
()
==
listNeedJson
.
getInteger
(
"code"
))
{
JSONArray
data
=
listNeedJson
.
getJSONArray
(
"data"
);
if
(
CollectionUtil
.
isNotEmpty
(
data
))
{
log
.
info
(
"需要补录的数据有{}条"
,
data
.
size
());
for
(
Object
o
:
data
)
{
if
(
o
instanceof
Map
)
{
Map
needData
=
(
Map
)
o
;
dealListNeedData
(
new
JSONObject
(
needData
));
}
}
}
else
{
log
.
info
(
"没有补录的数据需要处理"
);
}
}
log
.
info
(
"补录数据处理完成"
);
}
private
void
dealListNeedData
(
JSONObject
needData
)
{
NeedDataVO
needDataVO
=
JSONObject
.
parseObject
(
needData
.
toJSONString
(),
NeedDataVO
.
class
);
JXDZDataTypeEnum
dataTypeEnum
=
JXDZDataTypeEnum
.
getEnumByCode
(
needDataVO
.
getDataType
());
IJXDZService
fdzjcService
=
jxdzFactory
.
getJXDZService
(
JXDZDataTypeEnum
.
FDZJC
);
IJXDZService
gfdzjcService
=
jxdzFactory
.
getJXDZService
(
JXDZDataTypeEnum
.
GFDZJC
);
IJXDZService
fdzsbjcService
=
jxdzFactory
.
getJXDZService
(
JXDZDataTypeEnum
.
FDZSBJC
);
IJXDZService
gfdzsbjcService
=
jxdzFactory
.
getJXDZService
(
JXDZDataTypeEnum
.
GFDZSBJC
);
IJXDZService
gzmtsjService
=
jxdzFactory
.
getJXDZService
(
JXDZDataTypeEnum
.
DZMTSJ
);
switch
(
dataTypeEnum
)
{
case
FDZJC:
fdzjcService
.
sendData
(
JXDZAccessTypeEnum
.
BULU
.
getCode
(),
needDataVO
,
fdzjcService
.
buildData
(
JXDZAccessTypeEnum
.
BULU
.
getCode
(),
needDataVO
.
getDateTime
()));
break
;
case
GFDZJC:
gfdzjcService
.
sendData
(
JXDZAccessTypeEnum
.
BULU
.
getCode
(),
needDataVO
,
gfdzjcService
.
buildData
(
JXDZAccessTypeEnum
.
BULU
.
getCode
(),
needDataVO
.
getDateTime
()));
break
;
case
FDZSBJC:
fdzsbjcService
.
sendData
(
JXDZAccessTypeEnum
.
BULU
.
getCode
(),
needDataVO
,
fdzsbjcService
.
buildData
(
JXDZAccessTypeEnum
.
BULU
.
getCode
(),
needDataVO
.
getDateTime
()));
break
;
case
GFDZSBJC:
gfdzsbjcService
.
sendData
(
JXDZAccessTypeEnum
.
BULU
.
getCode
(),
needDataVO
,
gfdzsbjcService
.
buildData
(
JXDZAccessTypeEnum
.
BULU
.
getCode
(),
needDataVO
.
getDateTime
()));
break
;
case
DZMTSJ:
gzmtsjService
.
sendData
(
JXDZAccessTypeEnum
.
BULU
.
getCode
(),
needDataVO
,
gzmtsjService
.
buildData
(
JXDZAccessTypeEnum
.
BULU
.
getCode
(),
needDataVO
.
getDateTime
()));
break
;
default
:
throw
new
BadRequest
(
"没有找到匹配的补录数据类型"
);
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/factory/JXDZFactory.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
factory
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.Enum.JXDZDataTypeEnum
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
@Component
public
class
JXDZFactory
{
@Autowired
private
FDZJCServiceImpl
fdzjcService
;
@Autowired
private
GFDZJCServiceImpl
gfdzjcService
;
@Autowired
private
FDZSBJCServiceImpl
fdzsbjcService
;
@Autowired
private
GFDZSBJCServiceImpl
gfdzsbjcService
;
@Autowired
private
DZMTSJServiceImpl
dzmtsjService
;
public
IJXDZService
getJXDZService
(
JXDZDataTypeEnum
dataType
)
{
switch
(
dataType
)
{
case
FDZJC:
return
fdzjcService
;
case
GFDZJC:
return
gfdzjcService
;
case
FDZSBJC:
return
fdzsbjcService
;
case
GFDZSBJC:
return
gfdzsbjcService
;
case
DZMTSJ:
return
dzmtsjService
;
default
:
throw
new
BadRequest
(
"没有找到匹配的补录数据类型"
);
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/impl/PvDeviceDataServiceImpl.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
impl
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.PvDeviceDataMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.PvDeviceDataEntity
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
@Service
public
class
PvDeviceDataServiceImpl
extends
BaseService
<
PvDeviceDataEntity
,
PvDeviceDataEntity
,
PvDeviceDataMapper
>
{
}
\ No newline at end of file
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/impl/PvStationDataServiceImpl.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
impl
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.PvStationDataMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.PvStationDataEntity
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
@Service
public
class
PvStationDataServiceImpl
extends
BaseService
<
PvStationDataEntity
,
PvStationDataEntity
,
PvStationDataMapper
>
{
}
\ No newline at end of file
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/impl/StationDailyDataServiceImpl.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
impl
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.StationDailyDataMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.StationDailyDataEntity
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
@Service
public
class
StationDailyDataServiceImpl
extends
BaseService
<
StationDailyDataEntity
,
StationDailyDataEntity
,
StationDailyDataMapper
>
{
}
\ No newline at end of file
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/impl/WindDeviceDataServiceImpl.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
impl
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.WindDeviceDataMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.WindDeviceDataEntity
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
@Service
public
class
WindDeviceDataServiceImpl
extends
BaseService
<
WindDeviceDataEntity
,
WindDeviceDataEntity
,
WindDeviceDataMapper
>
{
}
\ No newline at end of file
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/impl/WindStationDataServiceImpl.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
impl
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.WindStationDataMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.jxdz.entity.WindStationDataEntity
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
@Service
public
class
WindStationDataServiceImpl
extends
BaseService
<
WindStationDataEntity
,
WindStationDataEntity
,
WindStationDataMapper
>
{
}
\ No newline at end of file
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/utils/JXDZUtils.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
utils
;
import
cn.hutool.core.codec.Base64
;
import
com.alibaba.fastjson.JSONObject
;
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.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.*
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.client.RestTemplate
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.nio.charset.StandardCharsets
;
import
java.security.SecureRandom
;
import
java.util.List
;
import
java.util.Objects
;
/**
* 江西电建工具类
*/
@Component
@Slf4j
public
class
JXDZUtils
{
@Value
(
"${coreIp:iiet-jepcc.powerchina.cn:8088}"
)
String
coreIp
;
@Value
(
"${jxdzIp:122.70.153.215:9003}"
)
String
jxdzIp
;
@Value
(
"${jxdzTokenUserName:jiangxi_epc}"
)
String
jxdzTokenUserName
;
@Value
(
"${jxdzTokenPassword:123456}"
)
String
jxdzTokenPassword
;
@Value
(
"${jxdzPublicKey:04508e9c4df8463c784df2dde2536e792851a8f3fd0e5ff29b7bf1a5d9e3f566aa49a7a5fe7683e3dc4dc30dd7bc8773838a9e4fbcf7dfac53461c8777a6aed691}"
)
String
publicKey
;
@Autowired
RestTemplate
restTemplate
;
@Autowired
AmosRequestContext
amosRequestContext
;
public
static
String
XZ_CODE
=
"PWC20123608280010"
;
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
);
}
/**
* 获取token
* @return
*/
private
String
getToken
()
{
String
url
=
"http://"
+
jxdzIp
+
"/auth/justLogin"
;
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"username"
,
jxdzTokenUserName
);
jsonObject
.
put
(
"password"
,
jxdzTokenPassword
);
HttpEntity
<
JSONObject
>
httpEntity
=
new
HttpEntity
<>(
jsonObject
,
headers
);
try
{
ResponseEntity
<
JSONObject
>
result
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
JSONObject
.
class
);
if
(
HttpStatus
.
OK
==
result
.
getStatusCode
())
{
JSONObject
body
=
result
.
getBody
();
if
(
HttpStatus
.
OK
.
value
()
==
body
.
getInteger
(
"code"
))
{
JSONObject
data
=
body
.
getJSONObject
(
"data"
);
return
data
.
getString
(
"access_token"
);
}
else
{
throw
new
BadRequest
(
"获取token失败,失败原因["
+
body
+
"]"
);
}
}
else
{
throw
new
BadRequest
(
"获取token失败,失败原因["
+
result
+
"]"
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
throw
new
BadRequest
(
"获取token失败,失败原因["
+
e
.
getMessage
()
+
"]"
);
}
}
/**
* 发送GET请求
* @param url
* @return
*/
public
JSONObject
sendCoreGetRequest
(
String
url
)
{
String
reqUrl
=
"http://"
+
coreIp
+
url
;
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
set
(
"Token"
,
amosRequestContext
.
getToken
());
headers
.
set
(
"Product"
,
amosRequestContext
.
getProduct
());
headers
.
set
(
"Appkey"
,
amosRequestContext
.
getAppKey
());
HttpEntity
entity
=
new
HttpEntity
<>(
headers
);
log
.
info
(
"发送GET请求,请求地址{}"
,
reqUrl
);
try
{
ResponseEntity
<
JSONObject
>
response
=
restTemplate
.
exchange
(
reqUrl
,
HttpMethod
.
GET
,
entity
,
JSONObject
.
class
);
if
(
HttpStatus
.
OK
==
response
.
getStatusCode
())
{
log
.
info
(
"发送请求成功,请求返回体{}"
,
response
.
getBody
());
return
response
.
getBody
();
}
else
{
throw
new
BadRequest
(
"返回接口异常,失败原因["
+
response
+
"]"
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
throw
new
BadRequest
(
"发送GET请求失败,失败原因["
+
e
.
getMessage
()
+
"]"
);
}
}
/**
* 发送GET请求
* @param url
* @return
*/
public
JSONObject
sendJXDZGetRequest
(
String
url
)
{
String
reqUrl
=
"http://"
+
jxdzIp
+
url
;
log
.
info
(
"发送GET请求,请求地址{}"
,
reqUrl
);
HttpEntity
entity
=
new
HttpEntity
<>(
buildHttpHeaders
());
try
{
ResponseEntity
<
JSONObject
>
response
=
restTemplate
.
exchange
(
reqUrl
,
HttpMethod
.
GET
,
entity
,
JSONObject
.
class
);
if
(
HttpStatus
.
OK
==
response
.
getStatusCode
())
{
log
.
info
(
"发送请求成功,请求返回体{}"
,
response
.
getBody
());
return
response
.
getBody
();
}
else
{
throw
new
BadRequest
(
"返回接口异常,失败原因["
+
response
+
"]"
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
throw
new
BadRequest
(
"发送GET请求失败,失败原因["
+
e
.
getMessage
()
+
"]"
);
}
}
/**
* 发送Post请求
* @param url
* @param accessType
* @param needDataVO
* @param data
*/
public
void
sendJXDZPostRequest
(
String
url
,
Integer
accessType
,
NeedDataVO
needDataVO
,
List
data
)
{
String
reqUrl
=
"http://"
+
jxdzIp
+
url
;
log
.
info
(
"发送POST请求,请求地址{}"
,
reqUrl
);
HttpEntity
<
JSONObject
>
entity
=
new
HttpEntity
<>(
buildBody
(
needDataVO
.
getPlatformId
(),
needDataVO
.
getDateTime
(),
data
,
accessType
,
needDataVO
.
getReaccessId
()),
buildHttpHeaders
());
try
{
ResponseEntity
<
JSONObject
>
response
=
restTemplate
.
postForEntity
(
reqUrl
,
entity
,
JSONObject
.
class
);
if
(
HttpStatus
.
OK
==
response
.
getStatusCode
())
{
JSONObject
body
=
response
.
getBody
();
if
(
HttpStatus
.
OK
.
value
()
==
body
.
getInteger
(
"code"
))
{
log
.
info
(
"发送JXDZ请求成功,请求返回体{}"
,
response
.
getBody
());
}
else
{
log
.
info
(
"发送JXDZ请求失败,请求返回体{}"
,
response
.
getBody
());
throw
new
BadRequest
(
"发送JXDZ请求失败,失败原因["
+
response
.
getBody
()
+
"]"
);
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
throw
new
BadRequest
(
"发送POST请求失败,失败原因["
+
e
.
getMessage
()
+
"]"
);
}
}
private
HttpHeaders
buildHttpHeaders
()
{
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
String
authorization
=
"Bearer "
+
getToken
();
headers
.
set
(
"Authorization"
,
authorization
);
return
headers
;
}
/**
* 构建请求体
* @param platformId
* @param time
* @param data
* @param accessType
* @param reaccessId
* @return
*/
private
JSONObject
buildBody
(
Long
platformId
,
Long
time
,
List
data
,
Integer
accessType
,
Long
reaccessId
)
{
JSONObject
body
=
new
JSONObject
();
body
.
put
(
"accessType"
,
accessType
);
body
.
put
(
"encryptData"
,
buildEncryptData
(
platformId
,
time
,
data
,
reaccessId
));
return
body
;
}
/**
* 加密数据
* @param platformId
* @param time
* @param data
* @param reaccessId
* @return
*/
private
String
buildEncryptData
(
Long
platformId
,
Long
time
,
List
data
,
Long
reaccessId
)
{
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"platformId"
,
platformId
);
if
(!
Objects
.
isNull
(
reaccessId
))
{
jsonObject
.
put
(
"reaccessId"
,
reaccessId
);
}
jsonObject
.
put
(
"time"
,
time
);
jsonObject
.
put
(
"data"
,
data
);
return
dataEncrypt
(
jsonObject
.
toJSONString
(),
publicKey
);
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/vo/NeedDataVO.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
vo
;
import
lombok.Data
;
@Data
public
class
NeedDataVO
{
/**
* 补录数据的标识
*/
private
Long
reaccessId
;
/**
* 子系统标识
*/
private
Long
platformId
;
/**
* 需要补录的数据类型
*/
private
Integer
dataType
;
/**
* 毫秒级别时间
*/
private
Long
dateTime
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/vo/PvDeviceDataVO.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
vo
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
lombok.Data
;
@Data
public
class
PvDeviceDataVO
{
private
String
code
;
private
String
name
;
/**
*日发电量
*/
@JSONField
(
name
=
"GenerationDaily"
)
private
Double
GenerationDaily
;
/**
*月发电量
*/
@JSONField
(
name
=
"GenerationMonth"
)
private
Double
GenerationMonth
;
/**
*年发电量
*/
@JSONField
(
name
=
"GenerationYear"
)
private
Double
GenerationYear
;
/**
*累计发电量
*/
@JSONField
(
name
=
"GenerationGross"
)
private
Double
GenerationGross
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/vo/PvStationDataVO.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
vo
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
lombok.Data
;
@Data
public
class
PvStationDataVO
{
private
String
code
;
private
String
name
;
/**
*发电功率
*/
@JSONField
(
name
=
"GenerationPower"
)
private
Double
GenerationPower
;
/**
*总辐射
*/
@JSONField
(
name
=
"TotalRadiation"
)
private
Double
TotalRadiation
;
/**
*直接辐射
*/
@JSONField
(
name
=
"DirectRadiation"
)
private
Double
DirectRadiation
;
/**
*散射辐射
*/
@JSONField
(
name
=
"ScatterRadiation"
)
private
Double
ScatterRadiation
;
/**
*日发电量
*/
@JSONField
(
name
=
"GenerationDaily"
)
private
Double
GenerationDaily
;
/**
*月发电量
*/
@JSONField
(
name
=
"GenerationMonth"
)
private
Double
GenerationMonth
;
/**
*年发电量
*/
@JSONField
(
name
=
"GenerationYear"
)
private
Double
GenerationYear
;
/**
*累计发电量
*/
@JSONField
(
name
=
"GenerationGross"
)
private
Double
GenerationGross
;
/**
*利用小时数
*/
@JSONField
(
name
=
"UtilizeHours"
)
private
Double
UtilizeHours
;
/**
*损失电量
*/
@JSONField
(
name
=
"LossElectricity"
)
private
Double
LossElectricity
;
/**
*总辐照度
*/
@JSONField
(
name
=
"TotalIrradiance"
)
private
Double
TotalIrradiance
;
/**
*直接辐照度
*/
@JSONField
(
name
=
"DirectIrradiance"
)
private
Double
DirectIrradiance
;
/**
*散射辐照度
*/
@JSONField
(
name
=
"ScatterIrradiance"
)
private
Double
ScatterIrradiance
;
/**
* 日上网电量
*/
@JSONField
(
name
=
"OnGridEnergyDaily"
)
private
Double
OnGridEnergyDaily
;
/**
* 月上网电量
*/
@JSONField
(
name
=
"OnGridEnergyMonth"
)
private
Double
OnGridEnergyMonth
;
/**
* 年上网电量
*/
@JSONField
(
name
=
"OnGridEnergyYear"
)
private
Double
OnGridEnergyYear
;
/**
* 累计上网电量
*/
@JSONField
(
name
=
"OnGridEnergyGross"
)
private
Double
OnGridEnergyGross
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/vo/StationDailyDataVO.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
vo
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
lombok.Data
;
/**
* 电站运维数据
*/
@Data
public
class
StationDailyDataVO
{
private
String
code
;
private
String
name
;
/**
* 工作票总数
*/
@JSONField
(
name
=
"WorkTicketTotalNums"
)
private
Double
WorkTicketTotalNums
;
/**
* 办理中工作票数
*/
@JSONField
(
name
=
"WorkTicketProcessingNums"
)
private
Double
WorkTicketProcessingNums
;
/**
* 已作废工作票数
*/
@JSONField
(
name
=
"WorkTicketInvalidatedNums"
)
private
Double
WorkTicketInvalidatedNums
;
/**
* 执行中工作票总数
*/
@JSONField
(
name
=
"WorkTicketExecutingNums"
)
private
Double
WorkTicketExecutingNums
;
/**
* 已终结的工作票数
*/
@JSONField
(
name
=
"WorkTicketTerminatedNums"
)
private
Double
WorkTicketTerminatedNums
;
/**
*定期工作任务
*/
@JSONField
(
name
=
"RegularTasksNums"
)
private
Double
RegularTasksNums
;
/**
* 巡检任务数量
*/
@JSONField
(
name
=
"InspectionTasksNums"
)
private
Double
InspectionTasksNums
;
/**
* 工单总数
*/
@JSONField
(
name
=
"WorkOrderTotalNums"
)
private
Double
WorkOrderTotalNums
;
/**
* 工单作废数
*/
@JSONField
(
name
=
"WorkOrderInvalidatedNums"
)
private
Double
WorkOrderInvalidatedNums
;
/**
* 工单待开工数
*/
@JSONField
(
name
=
"WorkOrderToBeOpenedNums"
)
private
Double
WorkOrderToBeOpenedNums
;
/**
* 工单终结数
*/
@JSONField
(
name
=
"WorkOrderTerminatedNums"
)
private
Double
WorkOrderTerminatedNums
;
/**
* 工单开工数
*/
@JSONField
(
name
=
"WorkOrderStartNums"
)
private
Double
WorkOrderStartNums
;
/**
* 二氧化碳减排量
*/
@JSONField
(
name
=
"Co2EmissionReduction"
)
private
Double
Co2EmissionReduction
;
/**
* 节约标准煤
*/
@JSONField
(
name
=
"StandardCoalSaving"
)
private
Double
StandardCoalSaving
;
/**
* 二氧化硫减排量
*/
@JSONField
(
name
=
"So2EmissionReduction"
)
private
Double
So2EmissionReduction
;
/**
* 碳粉尘减排量
*/
@JSONField
(
name
=
"CarbonDustEmissionReduction"
)
private
Double
CarbonDustEmissionReduction
;
/**
* 发电效率
*/
@JSONField
(
name
=
"GenerationEfficiency"
)
private
Double
GenerationEfficiency
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/vo/WindDeviceDataVO.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
vo
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
lombok.Data
;
@Data
public
class
WindDeviceDataVO
{
private
String
code
;
private
String
name
;
/**
*日发电量
*/
@JSONField
(
name
=
"GenerationDaily"
)
private
Double
GenerationDaily
;
/**
*月发电量
*/
@JSONField
(
name
=
"GenerationMonth"
)
private
Double
GenerationMonth
;
/**
*年发电量
*/
@JSONField
(
name
=
"GenerationYear"
)
private
Double
GenerationYear
;
/**
*累计发电量
*/
@JSONField
(
name
=
"GenerationGross"
)
private
Double
GenerationGross
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/jxdz/vo/WindStationDataVO.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
jxdz
.
vo
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
lombok.Data
;
@Data
public
class
WindStationDataVO
{
private
String
code
;
private
String
name
;
/**
*发电功率
*/
@JSONField
(
name
=
"GenerationPower"
)
private
Double
GenerationPower
;
/**
* 风速
*/
@JSONField
(
name
=
"WindSpeed"
)
private
Double
WindSpeed
;
/**
*风向
*/
@JSONField
(
name
=
"WindDirection"
)
private
Double
WindDirection
;
/**
*日发电量
*/
@JSONField
(
name
=
"GenerationDaily"
)
private
Double
GenerationDaily
;
/**
* 月发电量
*/
@JSONField
(
name
=
"GenerationMonth"
)
private
Double
GenerationMonth
;
/**
* 年发电量
*/
@JSONField
(
name
=
"GenerationYear"
)
private
Double
GenerationYear
;
/**
*累计发电量
*/
@JSONField
(
name
=
"GenerationGross"
)
private
Double
GenerationGross
;
/**
*利用小时数
*/
@JSONField
(
name
=
"UtilizeHours"
)
private
Double
UtilizeHours
;
/**
*损失电量
*/
@JSONField
(
name
=
"LossElectricity"
)
private
Double
LossElectricity
;
/**
* 日上网电量
*/
@JSONField
(
name
=
"OnGridEnergyDaily"
)
private
Double
OnGridEnergyDaily
;
/**
* 月上网电量
*/
@JSONField
(
name
=
"OnGridEnergyMonth"
)
private
Double
OnGridEnergyMonth
;
/**
* 年上网电量
*/
@JSONField
(
name
=
"OnGridEnergyYear"
)
private
Double
OnGridEnergyYear
;
/**
* 累计上网电量
*/
@JSONField
(
name
=
"OnGridEnergyGross"
)
private
Double
OnGridEnergyGross
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/mapper2/JXDZMapper.java
0 → 100644
View file @
d8f10aa4
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
mapper2
;
import
org.apache.ibatis.annotations.Param
;
public
interface
JXDZMapper
{
/**
* 获取工作票总数
* @param code
* @return
*/
Integer
countWorkTicketTotalByCode
(
@Param
(
"code"
)
String
code
);
/**
* 获取处理中工作票总数
* @param code
* @return
*/
Integer
countWorkTicketProcessingByCode
(
@Param
(
"code"
)
String
code
);
/**
* 获取作废的工作票总数
* @param code
* @return
*/
Integer
countWorkTicketInvalidatedByCode
(
@Param
(
"code"
)
String
code
);
/**
* 获取已终结的工作票总数
* @param code
* @return
*/
Integer
countWorkTicketTerminatedByCode
(
@Param
(
"code"
)
String
code
);
/**
* 定期工作任务
* @param code
* @return
*/
Integer
countRegularTasksByCode
(
@Param
(
"code"
)
String
code
);
/**
* 巡检任务数量
* @param code
* @return
*/
Integer
countInspectionTasksByCode
(
@Param
(
"code"
)
String
code
);
/**
* 工单总数
* @param code
* @return
*/
Integer
countWorkOrderTotalByCode
(
@Param
(
"code"
)
String
code
);
/**
* 工单作废数
* @param code
* @return
*/
Integer
countWorkOrderInvalidatedByCode
(
@Param
(
"code"
)
String
code
);
/**
* 工单待开工数
* @param code
* @return
*/
Integer
countWorkOrderToBeOpenedByCode
(
@Param
(
"code"
)
String
code
);
/**
* 工单终结数
* @param code
* @return
*/
Integer
countWorkOrderTerminatedByCode
(
@Param
(
"code"
)
String
code
);
/**
* 工单开工数
* @param code
* @return
*/
Integer
countWorkOrderStartByCode
(
@Param
(
"code"
)
String
code
);
/**
* 获取设备Code
* @param werks
* @param value
* @return
*/
String
getDeviceCode
(
@Param
(
"werks"
)
String
werks
,
@Param
(
"value"
)
String
value
,
@Param
(
"replaceValue"
)
String
replaceValue
);
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/resources/application-dev1.properties
View file @
d8f10aa4
...
...
@@ -162,8 +162,13 @@ spring.elasticsearch.rest.username=elastic
spring.elasticsearch.rest.password
=
Yeejoin@2020
spring.elasticsearch.rest.read-timeout
=
30000
logic
=
false
coreIp
=
iiet-jepcc.powerchina.cn:8088
jxdzIp
=
122.70.153.215:9003
jxdzTokenUserName
=
jiangxi_epc
jxdzTokenPassword
=
123456
publicKey
=
04508e9c4df8463c784df2dde2536e792851a8f3fd0e5ff29b7bf1a5d9e3f566aa49a7a5fe7683e3dc4dc30dd7bc8773838a9e4fbcf7dfac53461c8777a6aed691
scheduledEnable
=
false
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/resources/mapper/cluster/JXDZMapper.xml
0 → 100644
View file @
d8f10aa4
<?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.yeejoin.amos.boot.module.jxiop.biz.mapper2.JXDZMapper"
>
<select
id=
"countWorkTicketTotalByCode"
resultType=
"java.lang.Integer"
>
select COUNT(1) from yxgl_gzp_main where WERKS=#{code}
</select>
<select
id=
"countWorkTicketProcessingByCode"
resultType=
"java.lang.Integer"
>
select COUNT(1) from yxgl_gzp_main where WERKS=#{code} and ZSTAT in
('01','02','03','04','05','06','07','08','09','10','11','12','15','17','20','21','22','23','24','25','26','27','28','29','30','31','32','33')
</select>
<select
id=
"countWorkTicketInvalidatedByCode"
resultType=
"java.lang.Integer"
>
select COUNT(1) from yxgl_gzp_main where WERKS=#{code} and ZSTAT ='19'
</select>
<select
id=
"countWorkTicketTerminatedByCode"
resultType=
"java.lang.Integer"
>
select COUNT(1) from yxgl_gzp_main where WERKS=#{code} and ZSTAT ='13'
</select>
<select
id=
"countRegularTasksByCode"
resultType=
"java.lang.Integer"
>
SELECT COUNT(1) from yxgl_dqgz_dqrw where WERKS=#{code}
</select>
<select
id=
"countInspectionTasksByCode"
resultType=
"java.lang.Integer"
>
select COUNT(1) from yxgl_xhjc_new_xjrw where WERKS=#{code}
</select>
<select
id=
"countWorkOrderTotalByCode"
resultType=
"java.lang.Integer"
>
select COUNT(1) from fdgl_job_main where WERKS=#{code}
</select>
<select
id=
"countWorkOrderInvalidatedByCode"
resultType=
"java.lang.Integer"
>
select COUNT(1) from fdgl_job_main where WERKS=#{code} and STATE ='4'
</select>
<select
id=
"countWorkOrderToBeOpenedByCode"
resultType=
"java.lang.Integer"
>
select COUNT(1) from fdgl_job_main where WERKS=#{code} and STATE ='6'
</select>
<select
id=
"countWorkOrderTerminatedByCode"
resultType=
"java.lang.Integer"
>
select COUNT(1) from fdgl_job_main where WERKS=#{code} and STATE ='3'
</select>
<select
id=
"countWorkOrderStartByCode"
resultType=
"java.lang.Integer"
>
select COUNT(1) from fdgl_job_main where WERKS=#{code} and STATE ='1'
</select>
<select
id=
"getDeviceCode"
resultType=
"java.lang.String"
>
select KKSBM from sjgl_zsj_zsbtz where WERKS=#{werks} and (KKSMS like #{value} or KKSMS like #{replaceValue})
</select>
</mapper>
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