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
813d0df3
Commit
813d0df3
authored
May 28, 2024
by
朱晨阳
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
1f189d7f
554a1b0c
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
884 additions
and
95 deletions
+884
-95
ImasterUtils.java
...com/yeejoin/amos/api/householdapi/Utils/ImasterUtils.java
+11
-5
SunlightUtil.java
...com/yeejoin/amos/api/householdapi/Utils/SunlightUtil.java
+8
-1
ImasterInverterListDetails.java
...houseapi/entity/tdeingine/ImasterInverterListDetails.java
+2
-2
KsolarDataAcquisitionServiceImpl.java
...i/face/service/impl/KsolarDataAcquisitionServiceImpl.java
+0
-0
SunlightServiceImpl.java
...i/householdapi/face/service/impl/SunlightServiceImpl.java
+97
-43
TDBigScreenAnalyseController.java
...le/jxiop/biz/controller/TDBigScreenAnalyseController.java
+42
-31
TdengineTimeServiceImpl.java
...odule/jxiop/biz/service/impl/TdengineTimeServiceImpl.java
+5
-0
IdxBizFanHealthIndexMapper.xml
...n/resources/mapper/cluster/IdxBizFanHealthIndexMapper.xml
+6
-6
IdxFeign.java
...om/yeejoin/amos/boot/module/jxiop/api/feign/IdxFeign.java
+23
-0
StationBasicMapper.java
...amos/boot/module/jxiop/api/mapper/StationBasicMapper.java
+4
-0
StationBasicMapper.xml
...xiop-api/src/main/resources/mapper/StationBasicMapper.xml
+21
-0
EarningsForecastController.java
...dule/jxiop/biz/controller/EarningsForecastController.java
+78
-0
CommonMapper.java
...join/amos/boot/module/jxiop/biz/mapper2/CommonMapper.java
+12
-0
CommonServiceImpl.java
...boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
+31
-7
EarningsForecastImpl.java
...t/module/jxiop/biz/service/impl/EarningsForecastImpl.java
+187
-0
CommonMapper.xml
...en-biz/src/main/resources/mapper/cluster/CommonMapper.xml
+29
-0
CompanyMapper.java
...oot/module/jxiop/api/amosprojectmapper/CompanyMapper.java
+11
-0
AppletMonitorController.java
.../module/jxiop/biz/controller/AppletMonitorController.java
+62
-0
AppletMonitorServiceImpl.java
...dule/jxiop/biz/service/impl/AppletMonitorServiceImpl.java
+238
-0
CompanyMapper.xml
...z/src/main/resources/mapper/amosproject/CompanyMapper.xml
+17
-0
No files found.
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/Utils/ImasterUtils.java
View file @
813d0df3
...
...
@@ -147,7 +147,12 @@ public class ImasterUtils {
}
else
{
jsonArray
=
handlerResponseByResultResolveruleOther
(
ResultResolveRule
,
respone
);
if
(!
ObjectUtils
.
isEmpty
(
jsonArray
))
{
result
=
JSONArray
.
parseArray
(
jsonArray
.
toJSONString
(),
tClass
);
try
{
result
=
JSONArray
.
parseArray
(
jsonArray
.
toJSONString
(),
tClass
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
logger
.
error
(
"华为数据解析错误(getResPonseOther):"
+
jsonArray
.
toJSONString
());
}
}
}
}
else
{
...
...
@@ -207,15 +212,16 @@ public class ImasterUtils {
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
response
);
JSONArray
jsonArray
=
new
JSONArray
();
JSONArray
jsonArrayRet
=
new
JSONArray
();
if
(
ObjectUtil
.
isNotEmpty
(
resultResovle
))
{
if
(
ObjectUtil
.
isNotEmpty
(
resultResovle
)
&&
ObjectUtil
.
isNotEmpty
(
jsonObject
)
)
{
String
[]
rules
=
resultResovle
.
split
(
","
);
if
(
rules
.
length
>
0
)
{
for
(
int
i
=
0
;
i
<
rules
.
length
;
i
++)
{
if
(
"ACCESS_FREQUENCY_IS_TOO_HIGH"
.
equals
(
jsonObject
.
get
(
rules
[
i
])))
{
logger
.
error
(
"华为数据解析错误(handlerResponseByResultResolveruleOther):请求系统次数太频繁,无法获取接口数据"
);
continue
;
}
try
{
jsonObject
=
(
JSONObject
)
jsonObject
.
get
(
rules
[
i
]);
if
(
jsonObject
==
null
)
{
jsonArray
=
(
JSONArray
)
jsonObject
.
get
(
rules
[
i
]);
}
}
catch
(
Exception
exception
)
{
try
{
jsonArray
=
(
JSONArray
)
jsonObject
.
get
(
rules
[
i
]);
...
...
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/Utils/SunlightUtil.java
View file @
813d0df3
...
...
@@ -116,7 +116,14 @@ public class SunlightUtil {
{
put
(
"1"
,
"在线"
);
put
(
"0"
,
"离线"
);
put
(
"2"
,
"报警"
);
}
};
public
static
final
HashMap
<
String
,
String
>
gzzt
=
new
HashMap
<
String
,
String
>()
{
{
put
(
"1"
,
"故障"
);
put
(
"2"
,
"报警"
);
put
(
"4"
,
"正常"
);
}
};
...
...
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/orm/houseapi/entity/tdeingine/ImasterInverterListDetails.java
View file @
813d0df3
...
...
@@ -19,7 +19,7 @@ public class ImasterInverterListDetails {
Double
mppt_total_cap
;
Double
pv24_i
;
Double
pv8_u
;
Double
open_time
;
String
open_time
;
Double
pv22_u
;
Double
a_i
;
Double
pv24_u
;
...
...
@@ -43,7 +43,7 @@ public class ImasterInverterListDetails {
Double
mppt_power
;
Double
pv13_u
;
int
run_state
;
Double
close_time
;
String
close_time
;
Double
pv19_i
;
Double
mppt_7_cap
;
Double
mppt_5_cap
;
...
...
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/impl/KsolarDataAcquisitionServiceImpl.java
View file @
813d0df3
This source diff could not be displayed because it is too large. You can
view the blob
instead.
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/impl/SunlightServiceImpl.java
View file @
813d0df3
...
...
@@ -5,7 +5,10 @@ import cn.hutool.core.date.DateUtil;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.fastjson.JSONArray
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.google.gson.JsonObject
;
import
com.qiniu.util.Json
;
import
com.yeejoin.amos.api.householdapi.Utils.SunlightUtil
;
import
com.yeejoin.amos.api.householdapi.constant.ImasterConstant
;
import
com.yeejoin.amos.api.householdapi.constant.KSolarConstant
;
...
...
@@ -43,6 +46,8 @@ import java.util.concurrent.TimeUnit;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
javax.annotation.PostConstruct
;
/**
* @description:
* @author: tw
...
...
@@ -114,7 +119,6 @@ public class SunlightServiceImpl implements SunlightService {
for
(
Sunlight
sunlight
:
list
)
{
sunlight
.
setCreatedTime
(
System
.
currentTimeMillis
());
sunlightMapper
.
insert
(
sunlight
);
}
logger
.
info
(
"-------阳光同步电站/逆变器/采集器结束"
+
ts
+
"------- "
+
sdf
.
format
(
new
Date
()));
...
...
@@ -194,36 +198,69 @@ public class SunlightServiceImpl implements SunlightService {
jpStation
.
setSnCode
(
sunlightDto
.
getPs_id
().
toString
());
// sncode
Map
<
String
,
String
>
map
=
sunlightDto
.
getTotal_capcity
();
jpStation
.
setCapacity
(
map
!=
null
&&
map
.
get
(
"unit"
)
!=
null
?
SunlightUtil
.
zj
.
get
(
String
.
valueOf
(
map
.
get
(
"unit"
)))
*
Double
.
valueOf
(
String
.
valueOf
(
map
.
get
(
"value"
)))
:
null
);
// 装机容量
Map
<
String
,
String
>
map1
=
sunlightDto
.
getCurr_power
();
jpStation
.
setRealTimePower
(
map1
!=
null
&&
map1
.
get
(
"unit"
)
!=
null
?
SunlightUtil
.
GL
.
get
(
String
.
valueOf
(
map1
.
get
(
"unit"
)))
*
Double
.
valueOf
(
String
.
valueOf
(
map1
.
get
(
"value"
)))
:
null
);
// 实时功率
Map
<
String
,
String
>
map2
=
sunlightDto
.
getToday_energy
();
jpStation
.
setDayGenerate
(
map2
!=
null
&&
map2
.
get
(
"unit"
)
!=
null
?
SunlightUtil
.
fd
.
get
(
String
.
valueOf
(
map2
.
get
(
"unit"
)))
*
Double
.
valueOf
(
String
.
valueOf
(
map2
.
get
(
"value"
)))
:
null
);
// 日发电量
Map
<
String
,
String
>
map3
=
sunlightDto
.
getTotal_energy
();
jpStation
.
setAccumulatedPower
(
map3
!=
null
&&
map3
.
get
(
"unit"
)
!=
null
?
SunlightUtil
.
fd
.
get
(
String
.
valueOf
(
map3
.
get
(
"unit"
)))
*
Double
.
valueOf
(
String
.
valueOf
(
map3
.
get
(
"value"
)))
:
null
);
// 累计发电量
Map
<
String
,
String
>
map4
=
sunlightDto
.
getToday_income
();
jpStation
.
setDayIncome
(
map4
!=
null
&&
map4
.
get
(
"unit"
)
!=
null
?
SunlightUtil
.
sy
.
get
(
String
.
valueOf
(
map4
.
get
(
"unit"
)))
*
Double
.
valueOf
(
String
.
valueOf
(
map4
.
get
(
"value"
)))
:
null
);
// 日收益
Map
<
String
,
String
>
map5
=
sunlightDto
.
getTotal_income
();
jpStation
.
setCumulativeIncome
(
map5
!=
null
&&
map5
.
get
(
"unit"
)
!=
null
?
SunlightUtil
.
sy
.
get
(
String
.
valueOf
(
map5
.
get
(
"unit"
)))
*
Double
.
valueOf
(
String
.
valueOf
(
map5
.
get
(
"value"
)))
:
null
);
// 累计收益
if
(
sunlightDto
.
getPs_fault_status
()
>
2
)
{
jpStation
.
setState
(
SunlightUtil
.
zt
.
get
(
sunlightDto
.
getPs_status
()
+
""
));
// 电站状态
try
{
Map
<
String
,
String
>
map
=
sunlightDto
.
getTotal_capcity
();
if
(
map
!=
null
&&
map
.
get
(
"unit"
)
!=
null
&&
!
map
.
get
(
"unit"
).
isEmpty
()
&&
!
"--"
.
equals
(
map
.
get
(
"value"
)))
{
jpStation
.
setCapacity
(
SunlightUtil
.
zj
.
get
(
String
.
valueOf
(
map
.
get
(
"unit"
)))
*
Double
.
valueOf
(
String
.
valueOf
(
map
.
get
(
"value"
))));
// 装机容量
}
Map
<
String
,
String
>
map1
=
sunlightDto
.
getCurr_power
();
if
(
map1
!=
null
&&
map1
.
get
(
"unit"
)
!=
null
&&
!
map1
.
get
(
"unit"
).
isEmpty
()
&&
!
"--"
.
equals
(
map1
.
get
(
"value"
)))
{
jpStation
.
setRealTimePower
(
SunlightUtil
.
GL
.
get
(
String
.
valueOf
(
map1
.
get
(
"unit"
)))
*
Double
.
valueOf
(
String
.
valueOf
(
map1
.
get
(
"value"
))));
// 实时功率
}
Map
<
String
,
String
>
map2
=
sunlightDto
.
getToday_energy
();
if
(
map2
!=
null
&&
map2
.
get
(
"unit"
)
!=
null
&&
!
map2
.
get
(
"unit"
).
isEmpty
()
&&
!
"--"
.
equals
(
map2
.
get
(
"value"
)))
{
jpStation
.
setDayGenerate
(
SunlightUtil
.
fd
.
get
(
String
.
valueOf
(
map2
.
get
(
"unit"
)))
*
Double
.
valueOf
(
String
.
valueOf
(
map2
.
get
(
"value"
))));
// 日发电量
}
Map
<
String
,
String
>
map3
=
sunlightDto
.
getTotal_energy
();
if
(
map3
!=
null
&&
map3
.
get
(
"unit"
)
!=
null
&&
!
map3
.
get
(
"unit"
).
isEmpty
()
&&
!
"--"
.
equals
(
map3
.
get
(
"value"
)))
{
jpStation
.
setAccumulatedPower
(
SunlightUtil
.
fd
.
get
(
String
.
valueOf
(
map3
.
get
(
"unit"
)))
*
Double
.
valueOf
(
String
.
valueOf
(
map3
.
get
(
"value"
))));
// 累计发电量
}
Map
<
String
,
String
>
map4
=
sunlightDto
.
getToday_income
();
if
(
map4
!=
null
&&
map4
.
get
(
"unit"
)
!=
null
&&
!
map4
.
get
(
"unit"
).
isEmpty
()
&&
!
"--"
.
equals
(
map4
.
get
(
"value"
)))
{
jpStation
.
setDayIncome
(
SunlightUtil
.
sy
.
get
(
String
.
valueOf
(
map4
.
get
(
"unit"
)))
*
Double
.
valueOf
(
String
.
valueOf
(
map4
.
get
(
"value"
))));
// 日收益
}
Map
<
String
,
String
>
map5
=
sunlightDto
.
getTotal_income
();
if
(
map5
!=
null
&&
map5
.
get
(
"unit"
)
!=
null
&&
!
map5
.
get
(
"unit"
).
isEmpty
()
&&
!
"--"
.
equals
(
map5
.
get
(
"value"
)))
{
jpStation
.
setCumulativeIncome
(
SunlightUtil
.
sy
.
get
(
String
.
valueOf
(
map5
.
get
(
"unit"
)))
*
Double
.
valueOf
(
String
.
valueOf
(
map5
.
get
(
"value"
))));
// 累计收益
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
logger
.
error
(
"阳光数据错误:"
+
com
.
alibaba
.
fastjson
.
JSONObject
.
toJSONString
(
sunlightDto
));
}
// 0离线 1在线
// 1故障 2告警 4正常
if
(
"0"
.
equals
(
sunlightDto
.
getPs_status
().
toString
()))
{
jpStation
.
setState
(
"离线"
);
}
else
if
(
"1"
.
equals
(
sunlightDto
.
getPs_status
().
toString
()))
{
if
(
"1"
.
equals
(
sunlightDto
.
getPs_fault_status
().
toString
())
||
"2"
.
equals
(
sunlightDto
.
getPs_fault_status
().
toString
()))
{
jpStation
.
setState
(
"报警"
);
}
else
if
(
"4"
.
equals
(
sunlightDto
.
getPs_fault_status
().
toString
()))
{
jpStation
.
setState
(
"在线"
);
}
else
{
jpStation
.
setState
(
"在线"
);
}
}
else
{
jpStation
.
setState
(
"
报警"
);
// 电站状态
jpStation
.
setState
(
"
在线"
);
}
// 获取电站下通讯模块
...
...
@@ -307,11 +344,6 @@ public class SunlightServiceImpl implements SunlightService {
jpStation
.
setYearGenerate
(
js
!=
null
?
Double
.
valueOf
(
js
.
get
(
0
).
get
(
"4"
)
+
""
)
/
1000
:
null
);
// 年收益
jpStation
.
setYearIncome
(
js
!=
null
?
Double
.
valueOf
(
js
.
get
(
0
).
get
(
"4"
)
+
""
)
/
1000
:
null
);
if
(!
ObjectUtils
.
isEmpty
(
jpStation
.
getSequenceNbr
()))
{
jpStationMapper
.
updateById
(
jpStation
);
}
else
{
jpStationMapper
.
insert
(
jpStation
);
}
String
today
=
DateUtil
.
today
();
String
hour
=
new
Date
().
getHours
()
+
":00"
;
...
...
@@ -373,11 +405,22 @@ public class SunlightServiceImpl implements SunlightService {
// tdJpStation.setCreatedTime(System.currentTimeMillis());
// tdJpStationMapper.insert(tdJpStation);
// }
}
JpStation
jpStationOld
=
jpStationMapper
.
selectOne
(
new
LambdaQueryWrapper
<
JpStation
>().
eq
(
JpStation:
:
getThirdStationId
,
jpStation
.
getThirdStationId
())
.
eq
(
JpStation:
:
getThirdCode
,
PVProducerInfoEnum
.
YG
.
getCode
()));
this
.
setJpInverte
(
listd
,
jpStation
,
listdtx
);
this
.
collectorDetail
(
listd
,
jpStation
);
if
(
jpStationOld
!=
null
)
{
jpStation
.
setSequenceNbr
(
jpStationOld
.
getSequenceNbr
());
jpStationMapper
.
updateById
(
jpStation
);
}
else
{
jpStationMapper
.
insert
(
jpStation
);
}
this
.
setJpInverte
(
listd
,
jpStation
,
listdtx
);
this
.
collectorDetail
(
listd
,
jpStation
);
// 电站报表
// 户用场站日发电量
Date
today1
=
new
Date
();
...
...
@@ -490,7 +533,6 @@ public class SunlightServiceImpl implements SunlightService {
@Override
public
void
run
()
{
try
{
for
(
Device
device
:
devices
)
{
if
(
device
!=
null
)
{
// 获取逆变器信息存库
...
...
@@ -505,12 +547,24 @@ public class SunlightServiceImpl implements SunlightService {
jpInverter
.
setSnCode
(
device
.
getDevice_sn
());
jpInverter
.
setId
(
device
.
getUuid
().
toString
());
if
(
device
.
getGetPs_fault_status
()
>
2
)
{
jpInverter
.
setState
(
SunlightUtil
.
zt
.
get
(
device
.
getDev_status
()
+
""
));
// 0离线 1在线
// 1故障 2告警 4正常
if
(
"0"
.
equals
(
device
.
getDev_status
()))
{
jpInverter
.
setState
(
"离线"
);
}
else
if
(
"1"
.
equals
(
device
.
getDev_status
()))
{
if
(
"1"
.
equals
(
device
.
getDev_fault_status
())
||
"2"
.
equals
(
device
.
getDev_fault_status
()))
{
jpInverter
.
setState
(
"报警"
);
}
else
if
(
"4"
.
equals
(
device
.
getDev_fault_status
()))
{
jpInverter
.
setState
(
"在线"
);
}
else
{
jpInverter
.
setState
(
"在线"
);
}
}
else
{
jpInverter
.
setState
(
"
报警"
);
// 电站状态
jpInverter
.
setState
(
"
在线"
);
}
// logger.error("阳光数据解析(逆变器),无法获取状态:" +
// com.alibaba.fastjson.JSONObject.toJSONString(device));
jpInverter
.
setUpdateTime
(
new
Date
());
jpInverter
.
setDayPowerGeneration
(
jpStation
.
getDayGenerate
());
jpInverter
.
setMonthPowerGeneration
(
jpStation
.
getMonthGenerate
());
...
...
@@ -916,7 +970,7 @@ public class SunlightServiceImpl implements SunlightService {
jpCollector
.
setState
(
"报警"
);
// 电站状态
}
}
else
{
//如果获取不了逆变器状态 并且逆变器没状态就默认离线
// 如果获取不了逆变器状态 并且逆变器没状态就默认离线
if
(
jpCollector
.
getState
()
==
null
)
{
jpCollector
.
setState
(
"离线"
);
}
...
...
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 @
813d0df3
...
...
@@ -13,6 +13,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.Enum.WarningPeriodEnum;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdengine.*
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.format.annotation.DateTimeFormat
;
...
...
@@ -241,26 +242,25 @@ public class TDBigScreenAnalyseController extends BaseController {
List
<
Integer
>
jgList
=
new
ArrayList
<>();
List
<
String
>
list
=
new
ArrayList
<>();
FeignClientResult
<
List
<
CompanyModel
>>
listFeignClientResult
=
Privilege
.
companyClient
.
queryAgencyList
(
"AREA"
);
List
<
CompanyModel
>
companyModels
=
new
ArrayList
<>();
if
(!
ObjectUtils
.
isEmpty
(
listFeignClientResult
))
{
if
(
listFeignClientResult
.
getStatus
()
==
200
)
{
companyModels
=
listFeignClientResult
.
getResult
();
}
else
{
throw
new
RuntimeException
(
listFeignClientResult
.
getMessage
());
}
}
List
<
String
>
collect
=
companyModels
.
stream
().
map
(
t
->
t
.
getCompanyName
()).
collect
(
Collectors
.
toList
());
//
FeignClientResult<List<CompanyModel>> listFeignClientResult = Privilege.companyClient.queryAgencyList("AREA");
//
//
List<CompanyModel> companyModels = new ArrayList<>();
//
//
if (!ObjectUtils.isEmpty(listFeignClientResult)) {
//
if (listFeignClientResult.getStatus() == 200) {
//
companyModels = listFeignClientResult.getResult();
//
} else {
//
throw new RuntimeException(listFeignClientResult.getMessage());
//
}
//
}
//
List<String> collect = companyModels.stream().map(t -> t.getCompanyName()).collect(Collectors.toList());
if
(
"idx_biz_fan_warning_record"
.
equals
(
tableName
))
{
list
=
collect
;
// list = Arrays.asList("华中片区", "西北片区", "西南片区", "华南片区", "华东片区", "东北片区", "华北片区
");
//
list = collect;
list
=
Arrays
.
asList
(
"华中区域"
,
"西北区域"
,
"西南区域"
,
"华南区域"
,
"华东区域"
,
"东北区域"
,
"华北区域
"
);
}
else
{
list
=
collect
;
Collections
.
reverse
(
list
);
// list = Arrays.asList("华北片区", "东北片区", "华东片区", "华南片区", "西南片区", "西北片区", "华中片区");
// list = collect;
list
=
Arrays
.
asList
(
"华北区域"
,
"东北区域"
,
"华东区域"
,
"华南区域"
,
"西南区域"
,
"西北区域"
,
"华中区域"
);
}
list
.
forEach
(
item
->
{
wxList
.
add
(
wxMap
.
getOrDefault
(
item
,
0
));
...
...
@@ -295,18 +295,22 @@ public class TDBigScreenAnalyseController extends BaseController {
List
<
String
>
list
=
new
ArrayList
<>();
FeignClientResult
<
List
<
CompanyModel
>>
listFeignClientResult
=
Privilege
.
companyClient
.
queryAgencyList
(
"AREA"
);
// FeignClientResult<List<CompanyModel>> listFeignClientResult = Privilege.companyClient.queryAgencyList("AREA");
//
// List<CompanyModel> companyModels = new ArrayList<>();
//
// if (!ObjectUtils.isEmpty(listFeignClientResult)) {
// if (listFeignClientResult.getStatus() == 200) {
// companyModels = listFeignClientResult.getResult();
// } else {
// throw new RuntimeException(listFeignClientResult.getMessage());
// }
// }
// list = companyModels.stream().map(CompanyModel::getCompanyName).collect(Collectors.toList());
//
list
=
Arrays
.
asList
(
"华北区域"
,
"东北区域"
,
"华东区域"
,
"华南区域"
,
"西南区域"
,
"西北区域"
,
"华中区域"
);
List
<
CompanyModel
>
companyModels
=
new
ArrayList
<>();
if
(!
ObjectUtils
.
isEmpty
(
listFeignClientResult
))
{
if
(
listFeignClientResult
.
getStatus
()
==
200
)
{
companyModels
=
listFeignClientResult
.
getResult
();
}
else
{
throw
new
RuntimeException
(
listFeignClientResult
.
getMessage
());
}
}
list
=
companyModels
.
stream
().
map
(
CompanyModel:
:
getCompanyName
).
collect
(
Collectors
.
toList
());
List
<
Object
>
seriesData
=
new
ArrayList
<>();
list
.
forEach
(
item
->
seriesData
.
add
(
collect
.
getOrDefault
(
item
,
100.0
)));
resultMap
.
put
(
"axisData"
,
list
);
...
...
@@ -337,6 +341,10 @@ public class TDBigScreenAnalyseController extends BaseController {
}
Integer
count
=
fanWaringRecordMapper
.
getEquipWarningInfoByPageCount
(
arae
,
station
,
stationType
,
warningName
,
stationId
,
startDate
,
endDate
);
//前端存在分页bug 此处限制分页后筛选导致页面超出问题
if
(
count
>
0
&&
current
>
(
count
/
10
+
1
)){
current
=
1
;
}
// List<IdxBizFanWarningRecord> idxBizFanWarningRecordIPage =
// idxBizFanWarningRecordMapper.getEquipWarningInfoByPage(arae, station,
// stationType, (current - 1) * size, size, warningName, stationId, startDate,
...
...
@@ -347,6 +355,7 @@ public class TDBigScreenAnalyseController extends BaseController {
Page
<
FanWarningRecord
>
idxBizFanWarningRecordPage
=
new
Page
<>(
current
,
size
);
idxBizFanWarningRecordPage
.
setRecords
(
idxBizFanWarningRecordIPage
);
idxBizFanWarningRecordPage
.
setTotal
(
count
);
idxBizFanWarningRecordPage
.
setCurrent
(
current
);
return
ResponseHelper
.
buildResponse
(
idxBizFanWarningRecordPage
);
}
...
...
@@ -816,9 +825,11 @@ public class TDBigScreenAnalyseController extends BaseController {
StationBasic
stationBasic
=
stationBasicMapper
.
selectById
(
stationId
);
String
nameByIndexAddress
=
idxBizFanHealthIndexMapper
.
getPointNameByIndexAddress
(
indexAddress
,
tableName
,
stationBasic
.
getFanGatewayId
());
int
num
=
0
;
if
(
StringUtils
.
isNotEmpty
(
tableName2
)){
num
=
idxBizFanHealthIndexMapper
.
getIsWarningByPointId
(
indexAddress
,
stationBasic
.
getFanGatewayId
(),
tableName2
);
}
int
num
=
idxBizFanHealthIndexMapper
.
getIsWarningByPointId
(
indexAddress
,
stationBasic
.
getFanGatewayId
(),
tableName2
);
HashMap
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
resultMap
.
put
(
"text"
,
nameByIndexAddress
);
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/TdengineTimeServiceImpl.java
View file @
813d0df3
...
...
@@ -167,7 +167,12 @@ public class TdengineTimeServiceImpl {
levelDesc
=
item
.
getHealthLevel
();
break
;
}
if
(
healthIndex
==
0
&&
item
.
getGroupLowerLimit
()
==
healthIndex
){
levelDesc
=
item
.
getHealthLevel
();
break
;
}
}
return
levelDesc
;
}
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/resources/mapper/cluster/IdxBizFanHealthIndexMapper.xml
View file @
813d0df3
...
...
@@ -290,7 +290,7 @@
<where>
ANALYSIS_OBJ_TYPE = '场站'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
- INTERVAL 1 DAY
<if
test=
"areaCode != null and areaCode != ''"
>
AND ARAE like concat('%', #{areaCode}, '%')
</if>
...
...
@@ -306,7 +306,7 @@
<where>
ANALYSIS_OBJ_TYPE = '场站'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
- INTERVAL 1 DAY
<if
test=
"areaCode != null and areaCode != ''"
>
AND ARAE like concat('%', #{areaCode}, '%')
</if>
...
...
@@ -453,7 +453,7 @@
<where>
ANALYSIS_OBJ_TYPE = '子系统'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
- INTERVAL 1 DAY
<if
test=
"equipmentName != null and equipmentName != ''"
>
AND EQUIPMENT_NAME like concat( '%', #{equipmentName} ,'风机')
</if>
...
...
@@ -490,7 +490,7 @@
<where>
ANALYSIS_OBJ_TYPE = '设备'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
- INTERVAL 1 DAY
<if
test=
"gatewayId != null and gatewayId != ''"
>
AND GATEWAY_ID = #{gatewayId}
</if>
...
...
@@ -608,7 +608,7 @@
<where>
ANALYSIS_OBJ_TYPE = '子阵'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
- INTERVAL 1 DAY
<if
test=
"gatewayId != null and gatewayId != ''"
>
AND GATEWAY_ID = #{gatewayId}
</if>
...
...
@@ -625,7 +625,7 @@
<where>
ANALYSIS_OBJ_TYPE = '设备'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
- INTERVAL 1 DAY
<if
test=
"subarray != null and subarray != ''"
>
AND SUBARRAY = concat('#', #{subarray})
</if>
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/feign/IdxFeign.java
View file @
813d0df3
...
...
@@ -4,8 +4,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.List
;
import
java.util.Map
;
@FeignClient
(
name
=
"${amos.idx.name:AMOS-IDX}"
,
path
=
"idx"
,
configuration
=
{
FeignConfiguration
.
class
})
...
...
@@ -24,4 +28,23 @@ public interface IdxFeign {
@GetMapping
(
"/table/getPage"
)
FeignClientResult
<
Page
<
Map
<
String
,
Object
>>>
getPage
(
@RequestParam
Map
<
String
,
Object
>
map
);
@RequestMapping
(
value
=
"/publicAnalysis/getStationMessage"
,
method
=
RequestMethod
.
GET
,
consumes
=
"application/json"
)
FeignClientResult
<
List
<
Map
<
String
,
Object
>>>
getStationMark
(
@RequestParam
(
value
=
"code"
)
String
code
);
@RequestMapping
(
value
=
"/publicAnalysis/appletSroce"
,
method
=
RequestMethod
.
GET
,
consumes
=
"application/json"
)
Map
<
String
,
Object
>
getStationMarkList
(
@RequestParam
(
value
=
"code"
)
String
code
,
@RequestParam
(
value
=
"pageNumber"
)
String
pageNumber
,
@RequestParam
(
value
=
"pageSize"
)
String
pageSize
);
@RequestMapping
(
value
=
"/jxIopAnalysis/stationRanking"
,
method
=
RequestMethod
.
GET
,
consumes
=
"application/json"
)
FeignClientResult
<
Map
<
String
,
Object
>>
stationRanking
(
@RequestParam
(
"pageNumber"
)
Long
pageNumber
,
@RequestParam
(
"pageSize"
)
Long
pageSize
,
@RequestParam
(
required
=
false
,
value
=
"stationType"
)
String
type
,
@RequestParam
(
required
=
false
,
value
=
"parentCode"
)
String
parentCode
);
}
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/mapper/StationBasicMapper.java
View file @
813d0df3
...
...
@@ -69,4 +69,8 @@ public interface StationBasicMapper extends BaseMapper<StationBasic> {
*/
List
<
StationBasicDto
>
getStationBasicListAll
();
StationBasicDto
getStationInfoByCode
(
@Param
(
"stationCode"
)
String
stationCode
);
List
<
StationBasicDto
>
getStationsByAreaCode
(
@Param
(
"areaCode"
)
String
stationCode
);
}
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/resources/mapper/StationBasicMapper.xml
View file @
813d0df3
...
...
@@ -192,4 +192,25 @@
FROM
station_basic
</select>
<select
id=
"getStationInfoByCode"
resultType=
"com.yeejoin.amos.boot.module.jxiop.api.dto.StationBasicDto"
>
select
*
from
station_basic
where
station_code = #{stationCode}
</select>
<select
id=
"getStationsByAreaCode"
resultType=
"com.yeejoin.amos.boot.module.jxiop.api.dto.StationBasicDto"
>
select
*
from
station_basic
where
area_code = #{areaCode}
and
is_delete = 0
</select>
</mapper>
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/EarningsForecastController.java
0 → 100644
View file @
813d0df3
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
controller
;
import
cn.hutool.core.map.MapBuilder
;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.StationBasicDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESMoonPowerGeneration
;
import
com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans
;
import
com.yeejoin.amos.boot.module.jxiop.biz.mapper2.CommonMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.EarningsForecastImpl
;
import
org.apache.http.client.HttpClient
;
import
org.elasticsearch.action.get.GetResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.nio.charset.StandardCharsets
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
com
.
alibaba
.
fastjson
.
JSON
.
toJSONString
;
import
static
java
.
lang
.
Boolean
.
TRUE
;
@RestController
@RequestMapping
(
"earningsForecast"
)
public
class
EarningsForecastController
{
@Autowired
private
StationBasicMapper
stationBasicMapper
;
@Autowired
private
EarningsForecastImpl
earningsForecast
;
@RequestMapping
(
value
=
"earningsForecast"
,
method
=
RequestMethod
.
GET
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
public
ResponseModel
<
Object
>
earningsForecast
(
@RequestParam
(
required
=
true
,
value
=
"stationId"
)
Long
stationId
,
@RequestParam
(
required
=
true
,
value
=
"type"
)
String
type
){
return
ResponseHelper
.
buildResponse
(
earningsForecast
.
earningsForecast
(
stationId
,
type
));
}
@RequestMapping
(
value
=
"getStationListByArae"
,
method
=
RequestMethod
.
GET
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
public
ResponseModel
<
List
<
Map
<
String
,
Object
>>>
getStationListByArae
(
String
araeCode
,
String
stationType
){
List
<
Map
<
String
,
Object
>>
maps
=
new
ArrayList
<>();
if
(
stationType
.
equals
(
"FDZ"
)){
stationBasicMapper
.
getStationsByAreaCode
(
araeCode
).
stream
().
filter
(
a
->
a
.
getStationType
().
equals
(
stationType
)).
forEach
(
e
->{
maps
.
add
(
MapBuilder
.<
String
,
Object
>
create
().
put
(
"text"
,
e
.
getStationName
()).
put
(
"value"
,
e
.
getSequenceNbr
()).
build
());
});
}
else
{
stationBasicMapper
.
getStationsByAreaCode
(
araeCode
).
stream
().
filter
(
a
->!
a
.
getStationType
().
equals
(
stationType
)).
forEach
(
e
->{
maps
.
add
(
MapBuilder
.<
String
,
Object
>
create
().
put
(
"text"
,
e
.
getStationName
()).
put
(
"value"
,
e
.
getSequenceNbr
()).
build
());
});
}
return
ResponseHelper
.
buildResponse
(
maps
);
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/mapper2/CommonMapper.java
0 → 100644
View file @
813d0df3
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
mapper2
;
import
org.apache.ibatis.annotations.Select
;
import
java.util.List
;
import
java.util.Map
;
public
interface
CommonMapper
{
List
<
Map
<
String
,
String
>>
selectAgo10Month
();
List
<
Map
<
String
,
String
>>
selectLast3Month
();
}
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
View file @
813d0df3
...
...
@@ -31,6 +31,7 @@ import org.elasticsearch.search.aggregations.bucket.terms.ParsedStringTerms;
import
org.elasticsearch.search.aggregations.bucket.terms.Terms
;
import
org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder
;
import
org.elasticsearch.search.aggregations.metrics.AvgAggregationBuilder
;
import
org.elasticsearch.search.aggregations.metrics.Sum
;
import
org.elasticsearch.search.aggregations.metrics.SumAggregationBuilder
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.PageRequest
;
...
...
@@ -423,7 +424,7 @@ public class CommonServiceImpl {
return
null
;
}
public
<
T
>
List
<
T
>
getListDataByCondtions
(
Map
<
String
,
List
<
String
>>
mustQuerCondtion
,
Map
<
String
,
String
>
shouldQuerCondtion
,
Class
<
T
>
tClass
,
Map
<
String
,
String
>
likeQuerCondtion
)
{
public
<
T
>
TreeMap
<
String
,
Double
>
getListDataByCondtionsSum
(
Map
<
String
,
List
<
String
>>
mustQuerCondtion
,
List
<
Map
<
String
,
String
>
>
shouldQuerCondtion
,
Class
<
T
>
tClass
,
Map
<
String
,
String
>
likeQuerCondtion
)
{
BoolQueryBuilder
queryBuilder
=
QueryBuilders
.
boolQuery
();
if
(!
ObjectUtils
.
isEmpty
(
mustQuerCondtion
))
{
for
(
String
key
:
mustQuerCondtion
.
keySet
())
{
...
...
@@ -432,9 +433,14 @@ public class CommonServiceImpl {
}
}
if
(!
ObjectUtils
.
isEmpty
(
shouldQuerCondtion
))
{
for
(
String
key
:
shouldQuerCondtion
.
keySet
())
{
queryBuilder
.
should
(
QueryBuilders
.
wildcardQuery
(
key
,
shouldQuerCondtion
.
get
(
key
)));
}
BoolQueryBuilder
boolQueryBuilder
=
QueryBuilders
.
boolQuery
();
shouldQuerCondtion
.
forEach
(
e
->{
for
(
String
key
:
e
.
keySet
())
{
boolQueryBuilder
.
should
(
QueryBuilders
.
wildcardQuery
(
key
,
e
.
get
(
key
)));
}
});
boolQueryBuilder
.
minimumShouldMatch
(
1
);
queryBuilder
.
must
(
boolQueryBuilder
);
}
if
(!
ObjectUtils
.
isEmpty
(
likeQuerCondtion
))
{
...
...
@@ -442,15 +448,33 @@ public class CommonServiceImpl {
queryBuilder
.
must
(
QueryBuilders
.
wildcardQuery
(
key
,
"*"
+
likeQuerCondtion
.
get
(
key
)
+
"*"
));
}
}
// 如果只对一个字段进行分组写一个就好
TermsAggregationBuilder
tb1
=
AggregationBuilders
.
terms
(
"group_day"
).
field
(
"day.keyword"
);
// gatewayId
tb1
.
subAggregation
(
AggregationBuilders
.
sum
(
"sum_valueDouble"
).
field
(
"value"
));
Query
query
=
new
NativeSearchQueryBuilder
()
.
withQuery
(
queryBuilder
)
.
withQuery
(
queryBuilder
)
.
addAggregation
(
tb1
)
.
build
();
query
.
setTrackTotalHits
(
true
);
SearchHits
search
=
elasticsearchTemplate
.
search
(
query
,
tClass
);
if
(
search
.
hasSearchHits
())
{
List
<
SearchHit
<
T
>>
searchHitList
=
search
.
getSearchHits
();
List
<
T
>
list
=
searchHitList
.
stream
().
map
(
hit
->
hit
.
getContent
()).
collect
(
Collectors
.
toList
());
return
list
;
Terms
groupDayAgg
=
search
.
getAggregations
().
get
(
"group_day"
);
TreeMap
<
String
,
Double
>
groupedSums
=
new
TreeMap
<>();
for
(
Terms
.
Bucket
entry
:
groupDayAgg
.
getBuckets
())
{
// 获取分组的键(即 "day" 字段的值)
String
day
=
entry
.
getKeyAsString
();
// 获取该分组下的 "sum_valueDouble" 聚合结果
Sum
sumAgg
=
entry
.
getAggregations
().
get
(
"sum_valueDouble"
);
double
sumValue
=
sumAgg
.
getValue
();
// 在这里处理每个分组和对应的总和
// 例如,你可以将它们存储在一个Map中,键是日期,值是总和
groupedSums
.
put
(
day
,
sumValue
);
}
return
groupedSums
;
}
return
null
;
}
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/EarningsForecastImpl.java
0 → 100644
View file @
813d0df3
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
service
.
impl
;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESMoonPowerGeneration
;
import
com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans
;
import
com.yeejoin.amos.boot.module.jxiop.biz.mapper2.CommonMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Service
public
class
EarningsForecastImpl
{
@Autowired
private
CommonServiceImpl
commonService
;
@Autowired
private
CommonMapper
commonMapper
;
@Value
(
"${forecast.url}"
)
private
String
forecastUrl
;
@Autowired
private
StationBasicMapper
stationBasicMapper
;
public
Object
earningsForecast
(
Long
stationId
,
String
type
){
List
<
Map
<
String
,
String
>>
list
=
commonMapper
.
selectAgo10Month
();
List
<
Map
<
String
,
String
>>
lastThreeMonth
=
commonMapper
.
selectLast3Month
();
Map
<
String
,
List
<
String
>>
queryCondtion1
=
new
HashMap
<>();
StationBasic
stationBasic
=
stationBasicMapper
.
selectById
(
stationId
);
if
(
type
.
equals
(
"FDZ"
)){
queryCondtion1
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
stationBasic
.
getFanGatewayId
()));
}
else
{
queryCondtion1
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
stationBasic
.
getBoosterGatewayId
()));
}
List
<
Map
<
String
,
String
>>
objects
=
new
ArrayList
<>();
TreeMap
<
String
,
String
>
months
=
new
TreeMap
<>();
list
.
forEach
(
e
->{
Map
<
String
,
String
>
likeQueryCondtion
=
new
HashMap
<>();
likeQueryCondtion
.
put
(
"id.keyword"
,
e
.
get
(
"MonthYear"
)+
"*"
);
objects
.
add
(
likeQueryCondtion
);
String
key
=
e
.
get
(
"MonthYear"
).
split
(
"-"
)[
1
];
months
.
put
(
String
.
valueOf
(
Integer
.
parseInt
(
key
)),
e
.
get
(
"MonthYear"
));
});
TreeMap
<
String
,
Double
>
map
=
commonService
.
getListDataByCondtionsSum
(
queryCondtion1
,
objects
,
ESMoonPowerGeneration
.
class
,
null
);
TreeMap
<
String
,
Double
>
carbonDioxide
=
new
TreeMap
<>();
TreeMap
<
String
,
Double
>
standardCoal
=
new
TreeMap
<>();
TreeMap
<
String
,
Double
>
toner
=
new
TreeMap
<>();
TreeMap
<
String
,
Double
>
sulfurDioxide
=
new
TreeMap
<>();
//计算历史月发电量的收益
map
.
keySet
().
forEach
(
e
->{
carbonDioxide
.
put
(
months
.
get
(
e
),
Double
.
valueOf
(
String
.
format
(
"%.3f"
,
map
.
get
(
e
)
*
CommonConstans
.
carbonDioxide
)));
standardCoal
.
put
(
months
.
get
(
e
),
Double
.
valueOf
(
String
.
format
(
"%.3f"
,
map
.
get
(
e
)
*
CommonConstans
.
standardCoal
)));
toner
.
put
(
months
.
get
(
e
),
Double
.
valueOf
(
String
.
format
(
"%.3f"
,
map
.
get
(
e
)
*
CommonConstans
.
toner
)));
sulfurDioxide
.
put
(
months
.
get
(
e
),
Double
.
valueOf
(
String
.
format
(
"%.3f"
,
map
.
get
(
e
)
*
CommonConstans
.
sulfurDioxide
)));
});
List
<
TreeMap
<
String
,
List
<
List
<
String
>>>>
resultList
=
new
ArrayList
<>();
TreeMap
<
String
,
List
<
List
<
String
>>>
Co2Map
=
new
TreeMap
();
TreeMap
<
String
,
List
<
List
<
String
>>>
standardCoalMap
=
new
TreeMap
();
TreeMap
<
String
,
List
<
List
<
String
>>>
tonerMap
=
new
TreeMap
();
TreeMap
<
String
,
List
<
List
<
String
>>>
sulfurDioxideMap
=
new
TreeMap
();
TreeMap
<
String
,
List
<
List
<
String
>>>
Co2ForecastMap
=
new
TreeMap
();
TreeMap
<
String
,
List
<
List
<
String
>>>
standardCoalForecastMap
=
new
TreeMap
();
TreeMap
<
String
,
List
<
List
<
String
>>>
tonerForecastMap
=
new
TreeMap
();
TreeMap
<
String
,
List
<
List
<
String
>>>
sulfurDioxideForecastMap
=
new
TreeMap
();
//组装历史数据折线图数据
List
<
List
<
String
>>
Co2List
=
this
.
buildResultData
(
carbonDioxide
);
Co2Map
.
put
(
"data"
,
Co2List
);
List
<
List
<
String
>>
standardCoalList
=
this
.
buildResultData
(
standardCoal
);
standardCoalMap
.
put
(
"data"
,
standardCoalList
);
List
<
List
<
String
>>
tonerList
=
this
.
buildResultData
(
toner
);
tonerMap
.
put
(
"data"
,
tonerList
);
List
<
List
<
String
>>
sulfurDioxideList
=
this
.
buildResultData
(
sulfurDioxide
);
sulfurDioxideMap
.
put
(
"data"
,
sulfurDioxideList
);
//查询预测收益接口
JSONObject
carbonDioxideData
=
getResponse
(
"二氧化碳减排量"
,
carbonDioxide
.
values
().
stream
().
collect
(
Collectors
.
toList
()));
JSONObject
standardCoalData
=
getResponse
(
"标准煤减排量"
,
standardCoal
.
values
().
stream
().
collect
(
Collectors
.
toList
()));
JSONObject
tonerData
=
getResponse
(
"炭粉尘减排量"
,
toner
.
values
().
stream
().
collect
(
Collectors
.
toList
()));
JSONObject
sulfurDioxideData
=
getResponse
(
"二氧化硫减排量"
,
sulfurDioxide
.
values
().
stream
().
collect
(
Collectors
.
toList
()));
//将预测返回的数据组装成组件需要的格式
List
<
List
<
String
>>
carbonDioxideList
=
this
.
buildData
(
lastThreeMonth
,
carbonDioxideData
,
Co2List
);
Co2ForecastMap
.
put
(
"data"
,
carbonDioxideList
);
List
<
List
<
String
>>
standardCoalLists
=
this
.
buildData
(
lastThreeMonth
,
standardCoalData
,
standardCoalList
);
standardCoalForecastMap
.
put
(
"data"
,
standardCoalLists
);
List
<
List
<
String
>>
tonerLists
=
this
.
buildData
(
lastThreeMonth
,
tonerData
,
tonerList
);
tonerForecastMap
.
put
(
"data"
,
tonerLists
);
List
<
List
<
String
>>
sulfurDioxideLists
=
this
.
buildData
(
lastThreeMonth
,
sulfurDioxideData
,
sulfurDioxideList
);
sulfurDioxideForecastMap
.
put
(
"data"
,
sulfurDioxideLists
);
resultList
.
add
(
Co2Map
);
resultList
.
add
(
standardCoalMap
);
resultList
.
add
(
tonerMap
);
resultList
.
add
(
sulfurDioxideMap
);
resultList
.
add
(
Co2ForecastMap
);
resultList
.
add
(
standardCoalForecastMap
);
resultList
.
add
(
tonerForecastMap
);
resultList
.
add
(
sulfurDioxideForecastMap
);
return
resultList
;
}
List
<
List
<
String
>>
buildResultData
(
TreeMap
<
String
,
Double
>
map
){
List
<
List
<
String
>>
lists
=
new
ArrayList
<>();
map
.
keySet
().
forEach
(
e
->{
List
<
String
>
list
=
Arrays
.
asList
(
e
,
String
.
valueOf
(
map
.
get
(
e
)));
lists
.
add
(
list
);
});
return
lists
;
}
String
buildParams
(
String
name
,
List
<
Double
>
values
){
HashMap
<
Object
,
Object
>
requestParams
=
new
HashMap
<>();
HashMap
<
Object
,
Object
>
valueLabel
=
new
HashMap
<>();
HashMap
<
Object
,
Object
>
value
=
new
HashMap
<>();
value
.
put
(
"值"
,
values
);
valueLabel
.
put
(
name
,
value
);
value
.
put
(
"名称"
,
name
);
HashMap
<
Object
,
Object
>
params
=
new
HashMap
<>();
HashMap
<
Object
,
Object
>
basic
=
new
HashMap
<>();
HashMap
<
Object
,
Object
>
dispPrecision
=
new
HashMap
<>();
dispPrecision
.
put
(
"disp_precision"
,
3
);
params
.
put
(
"config"
,
dispPrecision
);
basic
.
put
(
"data"
,
name
);
basic
.
put
(
"seasonal_length"
,
values
.
size
()/
2
);
basic
.
put
(
"model_type"
,
"additive"
);
basic
.
put
(
"model_component_type"
,
"seasonal_only"
);
basic
.
put
(
"is_generate_forecast"
,
true
);
basic
.
put
(
"forecast_number"
,
"3"
);
params
.
put
(
"basic"
,
basic
);
requestParams
.
put
(
"params"
,
params
);
requestParams
.
put
(
"dataset"
,
valueLabel
);
return
JSON
.
toJSONString
(
requestParams
);
}
JSONObject
getResponse
(
String
name
,
List
<
Double
>
values
){
String
requestParam
=
buildParams
(
name
,
values
);
Map
<
String
,
String
>
hashMaphead
=
new
HashMap
<>();
hashMaphead
.
put
(
"Content-Type"
,
"application/x-www-form-urlencoded;charset=utf-8"
);
String
respone
=
HttpUtil
.
createPost
(
forecastUrl
).
headerMap
(
hashMaphead
,
false
).
body
(
requestParam
).
execute
().
body
();
return
JSONObject
.
parseObject
(
respone
);
}
List
<
List
<
String
>>
buildData
(
List
<
Map
<
String
,
String
>>
data
,
JSONObject
obj
,
List
<
List
<
String
>>
lists
){
List
<
List
<
String
>>
newList
=
new
ArrayList
<>();
newList
.
addAll
(
lists
);
JSONObject
dataObject
=
obj
.
getJSONObject
(
"data"
);
// 从data对象中提取forecast和history数组
JSONArray
forecastArray
=
dataObject
.
getJSONArray
(
"forecast"
);
for
(
int
i
=
0
;
i
<
forecastArray
.
size
();
i
++)
{
List
<
String
>
list
=
Arrays
.
asList
(
data
.
get
(
i
).
get
(
"MonthYear"
),
forecastArray
.
getString
(
i
));
newList
.
add
(
list
);
}
return
newList
;
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/resources/mapper/cluster/CommonMapper.xml
0 → 100644
View file @
813d0df3
<?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.CommonMapper"
>
<select
id=
"selectAgo10Month"
resultType=
"map"
>
WITH RECURSIVE month_sequence AS (
SELECT 0 AS num
UNION ALL
SELECT num + 1 FROM month_sequence WHERE num
<
9
)
SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL (num + 1) MONTH), '%Y-%m') AS MonthYear
FROM month_sequence
ORDER BY MonthYear DESC;
</select>
<select
id=
"selectLast3Month"
resultType=
"map"
>
WITH RECURSIVE month_sequence AS (
SELECT 0 AS num
UNION ALL
SELECT num + 1 FROM month_sequence WHERE num
<
2
)
SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL -(num ) MONTH), '%Y-%m') AS MonthYear
FROM month_sequence
ORDER BY MonthYear ASC;
</select>
</mapper>
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/amosprojectmapper/CompanyMapper.java
0 → 100644
View file @
813d0df3
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
api
.
amosprojectmapper
;
public
interface
CompanyMapper
{
public
String
getAreaCompanyCode
(
String
code
);
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/AppletMonitorController.java
0 → 100644
View file @
813d0df3
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
controller
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.StationBasicDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.MonitorFanIndicatorMapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.util.CommonResponse
;
import
com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments
;
import
com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.AppletMonitorServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.MonitorFanIndicatorImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.*
;
@RestController
@Api
(
tags
=
"小程序-监盘"
)
@RequestMapping
(
value
=
"/applet"
)
public
class
AppletMonitorController
{
@Autowired
AppletMonitorServiceImpl
appletMonitorService
;
@Autowired
StationBasicMapper
stationBasicMapper
;
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"风机布置图-总概览"
)
@GetMapping
(
"/CockpitData"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
getData
(
@RequestParam
(
value
=
"code"
)
String
code
,
@RequestParam
(
value
=
"level"
)
String
level
)
{
if
(
"station"
.
equals
(
level
)){
StationBasicDto
stationBasic
=
stationBasicMapper
.
getStationInfoByCode
(
code
);
if
(
stationBasic
.
getStationType
().
equals
(
"FDZ"
))
{
return
ResponseHelper
.
buildResponse
(
appletMonitorService
.
getFanStationInfo
(
stationBasic
));
}
else
{
return
ResponseHelper
.
buildResponse
(
appletMonitorService
.
getPvStationInfo
(
stationBasic
));
}
}
else
{
return
ResponseHelper
.
buildResponse
(
appletMonitorService
.
getAreaInfo
(
code
));
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/AppletMonitorServiceImpl.java
0 → 100644
View file @
813d0df3
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.StationBasicDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.feign.IdxFeign
;
import
com.yeejoin.amos.boot.module.jxiop.api.amosprojectmapper.CompanyMapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments
;
import
com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.ESEquipmentsDTO
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Service
public
class
AppletMonitorServiceImpl
{
@Autowired
CommonServiceImpl
commonServiceImpl
;
@Autowired
StationBasicMapper
stationBasicMapper
;
@Autowired
CompanyMapper
companyMapper
;
@Autowired
CommonServiceImpl
commonService
;
@Autowired
MonitorFanIndicatorImpl
monitorFanIndicator
;
@Autowired
IdxFeign
idxFeign
;
@Autowired
AmosRequestContext
requestContext
;
public
Map
<
String
,
Object
>
getFanStationInfo
(
StationBasicDto
stationBasic
){
String
gatewayId
=
stationBasic
.
getFanGatewayId
();
Map
<
String
,
Object
>
columnMap
=
new
HashMap
<>();
Map
<
String
,
List
<
String
>>
queryCondtion
=
new
HashMap
<>();
queryCondtion
.
put
(
CommonConstans
.
QueryStringEquipmentIndexName
,
Arrays
.
asList
(
"30秒平均风速"
,
"日发电量"
,
"月发电量"
,
"年发电量"
));
queryCondtion
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
gatewayId
));
List
<
ESEquipments
>
result2
=
commonServiceImpl
.
getListDataByCondtions
(
queryCondtion
,
null
,
ESEquipments
.
class
);
columnMap
.
put
(
"日发电量"
,
String
.
format
(
CommonConstans
.
Fourdecimalplaces
,
commonServiceImpl
.
getSumByEquipmentIndxName
(
result2
,
"日发电量"
)));
columnMap
.
put
(
"月发电量"
,
String
.
format
(
CommonConstans
.
Fourdecimalplaces
,
commonServiceImpl
.
getSumByEquipmentIndxName
(
result2
,
"月发电量"
)));
columnMap
.
put
(
"年发电量"
,
String
.
format
(
CommonConstans
.
Fourdecimalplaces
,
commonServiceImpl
.
getSumByEquipmentIndxName
(
result2
,
"年发电量"
)));
columnMap
.
put
(
"30秒平均风速"
,
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
commonServiceImpl
.
getAvagerByEquipmentIndxName
(
result2
,
"30秒平均风速"
)));
Map
<
String
,
List
<
String
>>
queryCondtion1
=
new
HashMap
<>();
queryCondtion1
.
put
(
CommonConstans
.
QueryStringEquipmentIndexName
,
Arrays
.
asList
(
"220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"
));
queryCondtion1
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
stationBasic
.
getBoosterGatewayId
()));
List
<
ESEquipments
>
result1
=
commonService
.
getListDataByCondtions
(
queryCondtion1
,
null
,
ESEquipments
.
class
);
columnMap
.
put
(
"有功功率"
,
String
.
format
(
"%.2f"
,
result1
.
get
(
0
).
getValueF
()));
String
num
=
monitorFanIndicator
.
getEquipCount
(
gatewayId
,
"FDZ"
);
columnMap
.
put
(
"风机台数"
,
num
);
Double
capacityl
=
commonService
.
getStationCapactityByStationWerks
(
stationBasic
.
getStationNumber
());
columnMap
.
put
(
"装机容量"
,
String
.
format
(
"%.2f"
,
capacityl
));
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"installedCapacity"
,
columnMap
.
get
(
"装机容量"
).
toString
());
data
.
put
(
"dayPowerGeneration"
,
columnMap
.
get
(
"日发电量"
).
toString
());
data
.
put
(
"equipNum"
,
columnMap
.
get
(
"风机台数"
).
toString
().
replace
(
".0"
,
""
));
data
.
put
(
"monthPowerGeneration"
,
columnMap
.
get
(
"月发电量"
).
toString
());
data
.
put
(
"windSpeed"
,
columnMap
.
get
(
"30秒平均风速"
).
toString
());
data
.
put
(
"yearPowerGeneration"
,
columnMap
.
get
(
"年发电量"
).
toString
());
data
.
put
(
"activePower"
,
columnMap
.
get
(
"有功功率"
));
data
.
put
(
"dailyUseOfHour"
,
String
.
format
(
"%.2f"
,
((
Double
.
parseDouble
(
columnMap
.
get
(
"日发电量"
).
toString
())
*
10
)
/
(
Double
.
parseDouble
(
columnMap
.
get
(
"装机容量"
).
toString
())))));
//风机运行 及 停机
List
<
ESEquipmentsDTO
>
equipmentsDTOS
=
monitorFanIndicator
.
getFanStatusList
(
String
.
valueOf
(
stationBasic
.
getSequenceNbr
()));
Map
<
String
,
Long
>
countMap
=
equipmentsDTOS
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
ESEquipmentsDTO:
:
getAddress
,
Collectors
.
counting
()));
data
.
put
(
"closeNum"
,
countMap
.
containsKey
(
"停机状态"
)
?
String
.
valueOf
(
countMap
.
get
(
"停机状态"
))
:
"0"
);
data
.
put
(
"operationNum"
,
Integer
.
parseInt
(
num
)
-
Integer
.
parseInt
(
data
.
get
(
"closeNum"
).
toString
()));
Map
<
String
,
Object
>
stationMark
=
idxFeign
.
getStationMarkList
(
stationBasic
.
getProjectOrgCode
(),
"1"
,
"4"
);
// Map<String, Object> result = stationMark.getResult();
List
<
String
>
list
=
Arrays
.
asList
(
"P1"
,
"S1"
,
"H2"
,
"V1"
);
// P1 工况管控分数 S1 设备管控分数 H2 其他分数 V1 人员管控分数
list
.
forEach
(
e
->{
data
.
put
(
e
,
stationMark
.
get
(
e
));
});
data
.
put
(
"value"
,
stationMark
.
get
(
"value"
));
return
data
;
}
public
Map
<
String
,
Object
>
getPvStationInfo
(
StationBasicDto
stationBasic
){
String
gatewayId
=
stationBasic
.
getFanGatewayId
();
String
boosterGatewayId
=
stationBasic
.
getBoosterGatewayId
();
String
[]
columnList
=
new
String
[]{
CommonConstans
.
taiHeGenIndicatorDay
,
CommonConstans
.
taiHeGenIndicatorMonth
,
CommonConstans
.
taiHeGenIndicatorYear
};
Map
<
String
,
Object
>
columnMap
=
new
HashMap
<>();
//日 月 年发电量同仅统计逆变器数据
List
<
Map
<
String
,
Object
>>
mapList
;
for
(
String
column
:
columnList
)
{
Double
result
=
commonService
.
getTotalByIndicatiorByGF
(
boosterGatewayId
,
column
);
columnMap
.
put
(
column
,
result
);
}
Map
<
String
,
List
<
String
>>
queryCondtion
=
new
HashMap
<>();
queryCondtion
.
put
(
CommonConstans
.
QueryStringEquipmentIndexName
,
Arrays
.
asList
(
"南瑞光差保护_313P"
,
"WTX-801_25_WTX-801_总辐射累计"
,
"WTX-801_25_WTX-801_总辐射"
,
"313光差保护_总反向有功电度"
));
queryCondtion
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
stationBasic
.
getBoosterGatewayId
()));
List
<
ESEquipments
>
result1
=
commonService
.
getListDataByCondtions
(
queryCondtion
,
null
,
ESEquipments
.
class
);
columnMap
.
put
(
"有功功率"
,
String
.
format
(
"%.2f"
,
commonService
.
getSumByEquipmentIndxName
(
result1
,
"南瑞光差保护_313P"
)
*
CommonConstans
.
kwToMv
));
String
num
=
monitorFanIndicator
.
getEquipCount
(
gatewayId
,
"GF"
);
columnMap
.
put
(
"风机台数"
,
num
);
Double
capacityl
=
commonService
.
getStationCapactityByStationWerks
(
stationBasic
.
getStationNumber
());
//装机容量保留两位小数
columnMap
.
put
(
"装机容量"
,
String
.
format
(
"%.2f"
,
capacityl
));
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"installedCapacity"
,
columnMap
.
get
(
"装机容量"
).
toString
());
data
.
put
(
"dayPowerGeneration"
,
columnMap
.
get
(
CommonConstans
.
taiHeGenIndicatorDay
).
toString
());
data
.
put
(
"equipNum"
,
columnMap
.
get
(
"风机台数"
).
toString
().
replace
(
".0"
,
""
));
data
.
put
(
"monthPowerGeneration"
,
columnMap
.
get
(
CommonConstans
.
taiHeGenIndicatorMonth
).
toString
());
data
.
put
(
"irradiation"
,
String
.
format
(
"%.2f"
,
commonService
.
getSumByEquipmentIndxName
(
result1
,
"WTX-801_25_WTX-801_总辐射"
)));
data
.
put
(
"yearPowerGeneration"
,
columnMap
.
get
(
CommonConstans
.
taiHeGenIndicatorYear
).
toString
());
data
.
put
(
"activePower"
,
columnMap
.
get
(
"有功功率"
).
toString
());
data
.
put
(
"dailyUseOfHour"
,
String
.
format
(
"%.2f"
,
((
Double
.
parseDouble
(
columnMap
.
get
(
CommonConstans
.
taiHeGenIndicatorDay
).
toString
())
*
CommonConstans
.
wkwhToMv
)
/
(
Double
.
parseDouble
(
columnMap
.
get
(
"装机容量"
).
toString
())))));
data
.
put
(
"globalRadiation"
,
String
.
format
(
"%.2f"
,
commonService
.
getSumByEquipmentIndxName
(
result1
,
"WTX-801_25_WTX-801_总辐射累计"
)));
//综合效率 = 发电量/理论发电量
//理论发电量 = 峰值日照数 * 总装机容量
//峰值日照数 = 累计辐照度/3.6
Double
todayPower
=
Double
.
valueOf
(
columnMap
.
get
(
CommonConstans
.
taiHeGenIndicatorDay
).
toString
());
Double
total
=
commonService
.
getSumByEquipmentIndxName
(
result1
,
"WTX-801_25_WTX-801_总辐射累计"
);
if
(
todayPower
>
0
&&
total
>
0
)
{
Double
overallEfficiency
=
todayPower
*
CommonConstans
.
wkwhToMv
/
((
total
/
3.6
)
*
capacityl
);
data
.
put
(
"combinedEfficiency"
,
String
.
format
(
"%.2f"
,
overallEfficiency
*
100
)
+
"%"
);
//综合效率
}
else
{
data
.
put
(
"combinedEfficiency"
,
"0.00%"
);
//综合效率
}
Map
<
String
,
Object
>
stationMark
=
idxFeign
.
getStationMarkList
(
stationBasic
.
getProjectOrgCode
(),
"1"
,
"4"
);
List
<
String
>
list
=
Arrays
.
asList
(
"P1"
,
"S1"
,
"H2"
,
"V1"
);
// P1 工况管控分数 S1 设备管控分数 H2 其他分数 V1 人员管控分数
list
.
forEach
(
e
->{
data
.
put
(
e
,
stationMark
.
get
(
e
));
});
data
.
put
(
"value"
,
stationMark
.
get
(
"value"
));
return
data
;
}
public
Map
<
String
,
Object
>
getAreaInfo
(
String
code
)
{
List
<
StationBasicDto
>
stations
=
stationBasicMapper
.
getStationsByAreaCode
(
code
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
//全部场站的总装机容量
double
installedCapacity
=
stations
.
stream
().
mapToDouble
(
StationBasicDto:
:
getInstalledCapacity
).
sum
();
result
.
put
(
"installedCapacity"
,
String
.
format
(
"%.2f"
,
installedCapacity
));
Map
<
String
,
List
<
String
>>
queryCondtion
=
new
HashMap
<>();
queryCondtion
.
put
(
CommonConstans
.
QueryStringEquipmentIndexName
,
Arrays
.
asList
(
"南瑞光差保护_313P"
,
"WTX-801_25_WTX-801_总辐射累计"
,
"WTX-801_25_WTX-801_总辐射"
,
"313光差保护_总反向有功电度"
));
queryCondtion
.
put
(
CommonConstans
.
QueryStringGateWayId
,
stations
.
stream
().
map
(
StationBasicDto:
:
getBoosterGatewayId
).
collect
(
Collectors
.
toList
()));
List
<
ESEquipments
>
result1
=
commonService
.
getListDataByCondtions
(
queryCondtion
,
null
,
ESEquipments
.
class
);
List
<
StationBasicDto
>
fdz
=
stations
.
stream
().
filter
(
e
->
e
.
getStationType
().
equals
(
"FDZ"
)).
collect
(
Collectors
.
toList
());
Map
<
String
,
List
<
String
>>
queryCondtion2
=
new
HashMap
<>();
queryCondtion2
.
put
(
CommonConstans
.
QueryStringEquipmentIndexName
,
Arrays
.
asList
(
"220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"
));
queryCondtion2
.
put
(
CommonConstans
.
QueryStringGateWayId
,
Arrays
.
asList
(
fdz
.
get
(
0
).
getBoosterGatewayId
()));
List
<
ESEquipments
>
result2
=
commonService
.
getListDataByCondtions
(
queryCondtion2
,
null
,
ESEquipments
.
class
);
stations
.
removeAll
(
fdz
);
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"type"
,
"风电"
);
data
.
put
(
"installedCapacity"
,
String
.
format
(
"%.2f"
,
fdz
.
stream
().
mapToDouble
(
StationBasicDto:
:
getInstalledCapacity
).
sum
()));
data
.
put
(
"num"
,
stations
.
size
());
data
.
put
(
"activePower"
,
String
.
format
(
"%.2f"
,
result2
.
get
(
0
).
getValueF
()));
list
.
add
(
data
);
Map
<
String
,
Object
>
data2
=
new
HashMap
<>();
data2
.
put
(
"type"
,
"光伏"
);
data2
.
put
(
"installedCapacity"
,
String
.
format
(
"%.2f"
,
stations
.
stream
().
mapToDouble
(
StationBasicDto:
:
getInstalledCapacity
).
sum
()));
data2
.
put
(
"num"
,
fdz
.
size
());
data2
.
put
(
"activePower"
,
String
.
format
(
"%.2f"
,
commonService
.
getSumByEquipmentIndxName
(
result1
,
"南瑞光差保护_313P"
)
*
CommonConstans
.
kwToMv
));
list
.
add
(
data2
);
result
.
put
(
"stationList"
,
list
);
result
.
put
(
"activePower"
,
commonService
.
getSumByEquipmentIndxName
(
result1
,
"南瑞光差保护_313P"
)
*
CommonConstans
.
kwToMv
+
result2
.
get
(
0
).
getValueF
());
double
fzl
=
(
commonService
.
getSumByEquipmentIndxName
(
result1
,
"南瑞光差保护_313P"
)
*
CommonConstans
.
kwToMv
+
result2
.
get
(
0
).
getValueF
())/
installedCapacity
;
String
load
=
String
.
format
(
CommonConstans
.
Fourdecimalplaces
,
fzl
);
result
.
put
(
"load"
,
load
);
String
areaCompanyCode
=
companyMapper
.
getAreaCompanyCode
(
code
);
Map
<
String
,
Object
>
stationMark
=
idxFeign
.
getStationMarkList
(
areaCompanyCode
,
"1"
,
"4"
);
List
<
String
>
params
=
Arrays
.
asList
(
"P1"
,
"S1"
,
"H2"
,
"V1"
);
// P1 工况管控分数 S1 设备管控分数 H2 其他分数 V1 人员管控分数
params
.
forEach
(
e
->{
result
.
put
(
e
,
stationMark
.
get
(
e
));
});
result
.
put
(
"value"
,
stationMark
.
get
(
"value"
));
//获取区域场站排名
FeignClientResult
<
Map
<
String
,
Object
>>
map
=
idxFeign
.
stationRanking
(
1L
,
Long
.
MAX_VALUE
,
"FDZ"
,
areaCompanyCode
);
FeignClientResult
<
Map
<
String
,
Object
>>
map1
=
idxFeign
.
stationRanking
(
1L
,
Long
.
MAX_VALUE
,
"JZSGFDZ"
,
areaCompanyCode
);;
Map
<
String
,
Object
>
result3
=
map
.
getResult
();
Map
<
String
,
Object
>
result4
=
map1
.
getResult
();
result
.
put
(
"rankingFD"
,
result3
.
get
(
"records"
));
result
.
put
(
"rankingGF"
,
result4
.
get
(
"records"
));
Map
<
String
,
List
<
String
>>
queryCondtion1
=
new
HashMap
<>();
List
<
String
>
collect
=
fdz
.
stream
().
map
(
StationBasicDto:
:
getFanGatewayId
).
collect
(
Collectors
.
toList
());
collect
.
addAll
(
stations
.
stream
().
map
(
StationBasicDto:
:
getBoosterGatewayId
).
collect
(
Collectors
.
toList
()));
queryCondtion1
.
put
(
CommonConstans
.
QueryStringGateWayId
,
collect
);
Map
<
String
,
String
>
likeMap
=
new
HashMap
<
String
,
String
>();
likeMap
.
put
(
CommonConstans
.
QueryStringEquipmentIndexName
,
"发电量"
);
List
<
ESEquipments
>
resultWarn
=
commonServiceImpl
.
getListDataByCondtions
(
queryCondtion1
,
null
,
ESEquipments
.
class
,
likeMap
);
double
dayPowerGeneration
=
resultWarn
.
stream
().
filter
(
e
->
e
.
getEquipmentIndexName
().
contains
(
"日发电量"
)).
mapToDouble
(
ESEquipments:
:
getValueF
).
sum
();
double
monthPowerGeneration
=
resultWarn
.
stream
().
filter
(
e
->
e
.
getEquipmentIndexName
().
contains
(
"月发电量"
)).
mapToDouble
(
ESEquipments:
:
getValueF
).
sum
();
double
yearPowerGeneration
=
resultWarn
.
stream
().
filter
(
e
->
e
.
getEquipmentIndexName
().
contains
(
"年发电量"
)).
mapToDouble
(
ESEquipments:
:
getValueF
).
sum
();
result
.
put
(
"dayPowerGeneration"
,
String
.
format
(
"%.4f"
,
dayPowerGeneration
));
result
.
put
(
"monthPowerGeneration"
,
String
.
format
(
"%.4f"
,
monthPowerGeneration
));
result
.
put
(
"yearPowerGeneration"
,
String
.
format
(
"%.4f"
,
yearPowerGeneration
));
return
result
;
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/resources/mapper/amosproject/CompanyMapper.xml
0 → 100644
View file @
813d0df3
<?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.api.amosprojectmapper.CompanyMapper"
>
<select
id=
"getAreaCompanyCode"
resultType=
"string"
>
select
ORG_CODE
from
privilege_company
where
COMPANY_CODE = #{code}
and
LEVEL = 'area'
and IS_DELETED = 0
</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