Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
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
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
05b07135
Commit
05b07135
authored
Apr 09, 2024
by
caotao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.风机电量表计、光伏电量表计api接口采用新方式重写
parent
bed3355f
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
157 additions
and
141 deletions
+157
-141
ElectricityMeterPointDto.java
...s/boot/module/jxiop/api/dto/ElectricityMeterPointDto.java
+17
-0
StationElectricityMeter.java
...boot/module/jxiop/api/entity/StationElectricityMeter.java
+26
-0
CoreFeignClient.java
...oin/amos/boot/module/jxiop/api/feign/CoreFeignClient.java
+20
-4
StationElectricityMeterMapper.java
...odule/jxiop/api/mapper/StationElectricityMeterMapper.java
+7
-0
FeignBasicAuthRequestInterceptor.java
...ule/jxiop/biz/feign/FeignBasicAuthRequestInterceptor.java
+0
-56
FeignConfiguration.java
.../amos/boot/module/jxiop/biz/feign/FeignConfiguration.java
+0
-34
FeignErrorDecoder.java
...n/amos/boot/module/jxiop/biz/feign/FeignErrorDecoder.java
+0
-32
CoreCommonService.java
...amos/boot/module/jxiop/biz/service/CoreCommonService.java
+14
-7
MonitorService.java
...in/amos/boot/module/jxiop/biz/service/MonitorService.java
+10
-0
CoreCommonServiceImpl.java
.../module/jxiop/biz/service/impl/CoreCommonServiceImpl.java
+11
-1
MonitorServiceImpl.java
...oot/module/jxiop/biz/service/impl/MonitorServiceImpl.java
+52
-7
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/dto/ElectricityMeterPointDto.java
0 → 100644
View file @
05b07135
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
api
.
dto
;
import
lombok.Data
;
@Data
public
class
ElectricityMeterPointDto
{
//线路名称
String
name
;
//正向总有功
String
zxzyg
;
//反向总有功
String
fxzyg
;
//正向总无功
String
zxzwg
;
//反向总无功
String
fxzwg
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/entity/StationElectricityMeter.java
0 → 100644
View file @
05b07135
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
api
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
@Data
@TableName
(
value
=
"station_electricity_meter"
,
autoResultMap
=
true
)
public
class
StationElectricityMeter
{
@TableId
(
value
=
"sequence_nbr"
,
type
=
IdType
.
ID_WORKER
)
private
Long
sequenceNbr
;
@TableField
(
value
=
"line_name"
)
private
String
lineName
;
@TableField
(
value
=
"total_forward_actvie_power"
)
private
String
totalForwardActviePower
;
@TableField
(
value
=
"total_reverse_actvie_power"
)
private
String
totalReverseActviePower
;
@TableField
(
value
=
"total_forward_reactvie_power"
)
private
String
totalForwardReactviePower
;
@TableField
(
value
=
"total_reverse_reactvie_power"
)
private
String
totalReverseReactviePower
;
@TableField
(
value
=
"station_id"
)
private
String
stationId
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-
bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz
/feign/CoreFeignClient.java
→
amos-boot-system-jxiop/amos-boot-module-jxiop-
api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api
/feign/CoreFeignClient.java
View file @
05b07135
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
feign
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
api
.
feign
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
org.springframework.cloud.openfeign.FeignClient
;
...
...
@@ -9,15 +9,31 @@ import java.util.List;
//@FeignClient(name = "${mcb.warning.name:MCB-SERVER}", path = "warning", configuration = {FeignConfiguration.class})
@FeignClient
(
name
=
"mcb"
,
url
=
"http://10.20.1.160:10005"
,
path
=
"core"
,
configuration
=
{
FeignConfiguration
.
class
})
FeignConfiguration
.
class
})
public
interface
CoreFeignClient
{
/**
* @pare
* @param stationNames
* @param pointNames
* @return
* @Description 根据场站名称及测点名称获取合成测点值
*/
@GetMapping
(
"/scene-device-info/getValues"
)
FeignClientResult
<
List
<
Object
>>
getValues
(
@RequestParam
(
required
=
false
,
value
=
"stationNames"
)
String
stationNames
,
@RequestParam
(
required
=
false
,
value
=
"pointNames"
)
String
pointNames
);
@RequestParam
(
required
=
false
,
value
=
"pointNames"
)
String
pointNames
);
/**
* @param stationName
* @param filterNames
* @param pointName
* @return
* @Description 根据场站名称及测点名称获取单个测点值
*/
@GetMapping
(
"/scene-device-info/getPointValue"
)
FeignClientResult
<
Object
>
getPointValue
(
@RequestParam
(
required
=
false
,
value
=
"stationName"
)
String
stationName
,
@RequestParam
(
required
=
false
,
value
=
"filterNames"
)
String
filterNames
,
@RequestParam
(
required
=
false
,
value
=
"pointName"
)
String
pointName
);
}
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/mapper/StationElectricityMeterMapper.java
0 → 100644
View file @
05b07135
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
api
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationElectricityMeter
;
public
interface
StationElectricityMeterMapper
extends
BaseMapper
<
StationElectricityMeter
>
{
}
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/feign/FeignBasicAuthRequestInterceptor.java
deleted
100644 → 0
View file @
bed3355f
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
feign
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
feign.RequestInterceptor
;
import
feign.RequestTemplate
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
/**
* @author fengwang
* @date 2022-07-28.
*/
public
class
FeignBasicAuthRequestInterceptor
implements
RequestInterceptor
{
@Autowired
AmosRequestContext
amosAuth
;
public
FeignBasicAuthRequestInterceptor
()
{
}
@Override
public
void
apply
(
RequestTemplate
template
)
{
ServletRequestAttributes
attributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
if
(
attributes
!=
null
)
{
HttpServletRequest
request
=
attributes
.
getRequest
();
/* Get token from header */
String
authToken
=
request
.
getHeader
(
"token"
);
/* If token not found get it from request parameter */
if
(
StringUtils
.
isBlank
(
authToken
))
{
authToken
=
request
.
getHeader
(
"X-Access-Token"
);
}
template
.
header
(
"X-Access-Token"
,
authToken
);
template
.
header
(
"token"
,
authToken
);
template
.
header
(
"appKey"
,
request
.
getHeader
(
"appKey"
));
template
.
header
(
"product"
,
request
.
getHeader
(
"product"
));
template
.
header
(
"clientType"
,
"feignClient"
);
//User-Agent for core
template
.
header
(
"User-Agent"
,
"java"
);
}
else
{
template
.
header
(
"X-Access-Token"
,
amosAuth
.
getToken
());
template
.
header
(
"token"
,
amosAuth
.
getToken
());
template
.
header
(
"appKey"
,
amosAuth
.
getAppKey
());
template
.
header
(
"product"
,
amosAuth
.
getProduct
());
template
.
header
(
"clientType"
,
"feignClient"
);
//User-Agent for core
template
.
header
(
"User-Agent"
,
"java"
);
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/feign/FeignConfiguration.java
deleted
100644 → 0
View file @
bed3355f
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
feign
;
import
feign.codec.Encoder
;
import
feign.form.spring.SpringFormEncoder
;
import
org.springframework.beans.factory.ObjectFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.http.HttpMessageConverters
;
import
org.springframework.cloud.openfeign.support.SpringEncoder
;
import
org.springframework.context.annotation.Bean
;
/**
* @author fengwang
* @date 2022-07-28.
*/
public
class
FeignConfiguration
{
@Autowired
private
ObjectFactory
<
HttpMessageConverters
>
messageConverters
;
@Bean
public
Encoder
feignFormEncoder
()
{
return
new
SpringFormEncoder
(
new
SpringEncoder
(
messageConverters
));
}
@Bean
public
FeignBasicAuthRequestInterceptor
basicAuthRequestInterceptor
()
{
return
new
FeignBasicAuthRequestInterceptor
();
}
@Bean
public
FeignErrorDecoder
errorDecoder
(){
return
new
FeignErrorDecoder
();
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/feign/FeignErrorDecoder.java
deleted
100644 → 0
View file @
bed3355f
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
feign
;
import
com.alibaba.fastjson.JSONObject
;
import
feign.Response
;
import
feign.Util
;
import
feign.codec.ErrorDecoder
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.IOException
;
/**
* @author fengwang
* @date 2022-07-28.
*/
public
class
FeignErrorDecoder
implements
ErrorDecoder
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
FeignErrorDecoder
.
class
);
@Override
public
Exception
decode
(
String
methodKey
,
Response
response
)
{
String
msg
=
null
;
try
{
msg
=
Util
.
toString
(
response
.
body
().
asReader
(
Util
.
UTF_8
));
JSONObject
object
=
JSONObject
.
parseObject
(
msg
);
throw
new
RuntimeException
(
object
.
get
(
"devMessage"
).
toString
());
}
catch
(
IOException
e
)
{
log
.
error
(
"feign 调用失败"
+
e
.
getMessage
());
}
throw
new
RuntimeException
(
methodKey
+
"远程调用失败"
);
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/CoreCommonService.java
View file @
05b07135
...
...
@@ -4,28 +4,35 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.CoreValuesDto
;
import
java.util.List
;
import
java.util.Map
;
public
interface
CoreCommonService
{
/**
* @deprecated 远程调用core服务根据厂长名称
* @param stationNames 要查的场站名称需要使用逗号分隔 eg:夏造风机,石灰山风机
* @param pointsNames 要查的测点名称需要使用逗号分隔开 eg:日发电量,月发电量,年发电
* @param pointsNames
要查的测点名称需要使用逗号分隔开 eg:日发电量,月发电量,年发电
* @return CoreValuesDto
* @deprecated 远程调用core服务根据厂长名称
*/
List
<
CoreValuesDto
>
getValuesByStationNamesAndPointsNames
(
String
stationNames
,
String
pointsNames
);
/**
* @param pointName
* @return
*/
List
<
CoreValuesDto
>
getValuesByStationNamesAndPointsNames
(
String
stationNames
,
String
pointsNames
);
Map
<
String
,
Object
>
getPointValuesByParams
(
String
stationName
,
String
filterNames
,
String
pointName
);
/**
* @deprecated 获取测点数据总和
* @param coreValuesDtoList
* @return
* @deprecated 获取测点数据总和
*/
Double
getSumOfByPointName
(
List
<
CoreValuesDto
>
coreValuesDtoList
,
String
pointName
);
Double
getSumOfByPointName
(
List
<
CoreValuesDto
>
coreValuesDtoList
,
String
pointName
);
/**
* @deprecated 获取测点数据平均值
* @param coreValuesDtoList
* @return
* @deprecated 获取测点数据平均值
*/
Double
getAverageOfByPointName
(
List
<
CoreValuesDto
>
coreValuesDtoList
,
String
pointName
);
Double
getAverageOfByPointName
(
List
<
CoreValuesDto
>
coreValuesDtoList
,
String
pointName
);
}
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/MonitorService.java
View file @
05b07135
...
...
@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.RegionNationWideDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.ResultsData
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.SeriesData
;
...
...
@@ -92,4 +93,13 @@ public interface MonitorService {
* @return
*/
IPage
<
Map
>
getStationOverViewPVByStationId
(
String
stationId
);
/**
* @Description 动态获取电量表计数据
* @param current
* @param size
* @param stationBasic
* @return
*/
ResultsData
getElectricQuantityList
(
int
current
,
int
size
,
StationBasic
stationBasic
);
}
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/CoreCommonServiceImpl.java
View file @
05b07135
...
...
@@ -2,13 +2,14 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.CoreValuesDto
;
import
com.yeejoin.amos.boot.module.jxiop.
biz
.feign.CoreFeignClient
;
import
com.yeejoin.amos.boot.module.jxiop.
api
.feign.CoreFeignClient
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.CoreCommonService
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.atomic.AtomicReference
;
...
...
@@ -34,6 +35,15 @@ public class CoreCommonServiceImpl implements CoreCommonService {
}
@Override
public
Map
<
String
,
Object
>
getPointValuesByParams
(
String
stationName
,
String
filterNames
,
String
pointName
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
FeignClientResult
<
Object
>
feignClientResult
=
coreFeignClient
.
getPointValue
(
stationName
,
filterNames
,
pointName
);
Object
object
=
feignClientResult
.
getResult
();
result
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
object
));
return
result
;
}
@Override
public
Double
getSumOfByPointName
(
List
<
CoreValuesDto
>
coreValuesDtoList
,
String
pointName
)
{
AtomicReference
<
Double
>
result
=
new
AtomicReference
<>(
0.0
);
coreValuesDtoList
=
coreValuesDtoList
.
stream
().
filter
(
coreValuesDto
->
coreValuesDto
.
getDataMap
().
size
()
>
0
&&
coreValuesDto
.
getDataMap
().
containsKey
(
pointName
)).
collect
(
Collectors
.
toList
());
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/MonitorServiceImpl.java
View file @
05b07135
...
...
@@ -9,17 +9,15 @@ import com.yeejoin.amos.boot.module.jxiop.api.dto.*;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.MapRegion
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.Region
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.Station
Plan
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.Station
ElectricityMeter
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.MapRegionMapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.RegionMapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.StationElectricityMeterMapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.util.Constants
;
import
com.yeejoin.amos.boot.module.jxiop.api.util.HttpRequestUtil
;
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.CoreValuesDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.SeriesData
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.*
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.CoreCommonService
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.MonitorService
;
import
lombok.RequiredArgsConstructor
;
...
...
@@ -35,7 +33,6 @@ import org.typroject.tyboot.component.emq.EmqKeeper;
import
java.io.IOException
;;
import
java.nio.charset.StandardCharsets
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -51,6 +48,7 @@ public class MonitorServiceImpl implements MonitorService {
private
final
EmqKeeper
emqKeeper
;
private
final
HttpRequestUtil
httpRequestUtil
;
private
final
CoreCommonService
coreCommonService
;
private
final
StationElectricityMeterMapper
stationElectricityMeterMapper
;
@Value
(
"classpath:/json/overview.json"
)
private
Resource
overview
;
@Value
(
"classpath:/json/overviewGF.json"
)
...
...
@@ -459,7 +457,7 @@ public class MonitorServiceImpl implements MonitorService {
StationBasic
stationBasic
=
stationBasicMapper
.
selectById
(
stationId
);
List
<
CoreValuesDto
>
coreValuesDtoList
=
new
ArrayList
<>();
List
<
String
>
stringNames
=
Arrays
.
asList
(
stationBasic
.
getStationCoreName
(),
stationBasic
.
getBoosterCoreName
());
coreValuesDtoList
=
coreCommonService
.
getValuesByStationNamesAndPointsNames
(
stringNames
.
stream
().
collect
(
Collectors
.
joining
(
","
)),
CommonConstans
.
ACTIVE_POWER
+
","
+
CommonConstans
.
TOTAL_RADIATION_SUM
);
coreValuesDtoList
=
coreCommonService
.
getValuesByStationNamesAndPointsNames
(
stringNames
.
stream
().
collect
(
Collectors
.
joining
(
","
)),
CommonConstans
.
ACTIVE_POWER
+
","
+
CommonConstans
.
TOTAL_RADIATION_SUM
);
// 获取风场详情信息
String
requestUrl
=
Constants
.
BASE_URL
+
"?"
+
Constants
.
get_province_station_item
+
"&stationId="
+
stationId
;
...
...
@@ -637,6 +635,42 @@ public class MonitorServiceImpl implements MonitorService {
}
public
ResultsData
getElectricQuantityList
(
int
current
,
int
size
,
StationBasic
stationBasic
)
{
List
<
StationElectricityMeter
>
stationElectricityMeters
=
stationElectricityMeterMapper
.
selectList
(
new
QueryWrapper
<
StationElectricityMeter
>().
eq
(
"station_id"
,
stationBasic
.
getSequenceNbr
()).
orderByAsc
(
"sequence_nbr"
));
List
<
String
>
pointNames
=
new
ArrayList
<>();
stationElectricityMeters
.
forEach
(
stationElectricityMeter
->
{
pointNames
.
add
(
stationElectricityMeter
.
getTotalReverseReactviePower
());
pointNames
.
add
(
stationElectricityMeter
.
getTotalReverseActviePower
());
pointNames
.
add
(
stationElectricityMeter
.
getTotalForwardReactviePower
());
pointNames
.
add
(
stationElectricityMeter
.
getTotalForwardActviePower
());
});
String
pointNameStr
=
pointNames
.
stream
().
distinct
().
collect
(
Collectors
.
joining
(
","
));
Map
<
String
,
Object
>
requestResult
=
coreCommonService
.
getPointValuesByParams
(
stationBasic
.
getBoosterCoreName
(),
stationBasic
.
getBoosterCoreName
(),
pointNameStr
);
ArrayList
<
Map
<
String
,
String
>>
resultList
=
new
ArrayList
<>();
ArrayList
<
Map
<
String
,
String
>>
resultList1
=
new
ArrayList
<>();
stationElectricityMeters
.
forEach
(
stationElectricityMeter
->
{
HashMap
<
String
,
String
>
stringStringHashMap
=
new
HashMap
<>();
stringStringHashMap
.
put
(
"name"
,
stationElectricityMeter
.
getLineName
());
stringStringHashMap
.
put
(
"zxzyg"
,
keepThreedecimalPlaces
(
Double
.
valueOf
(
requestResult
.
get
(
stationElectricityMeter
.
getTotalForwardActviePower
()).
toString
())));
stringStringHashMap
.
put
(
"fxzyg"
,
keepThreedecimalPlaces
(
Double
.
valueOf
(
requestResult
.
get
(
stationElectricityMeter
.
getTotalReverseActviePower
()).
toString
())));
stringStringHashMap
.
put
(
"zxzwg"
,
keepThreedecimalPlaces
(
Double
.
valueOf
(
requestResult
.
get
(
stationElectricityMeter
.
getTotalForwardReactviePower
()).
toString
())));
stringStringHashMap
.
put
(
"fxzwg"
,
keepThreedecimalPlaces
(
Double
.
valueOf
(
requestResult
.
get
(
stationElectricityMeter
.
getTotalReverseReactviePower
()).
toString
())));
resultList
.
add
(
stringStringHashMap
);
});
resultList
.
addAll
(
resultList1
);
// 构建平台数据
DataGridMock
DataGridMock
=
new
DataGridMock
(
current
,
resultList
.
size
(),
false
,
current
,
resultList
);
ColModel
colModelEventMovement
=
new
ColModel
(
"name"
,
"name"
,
"测量点"
,
"测量点"
,
"dataGrid"
,
"name"
);
ColModel
colModelStationName
=
new
ColModel
(
"zxzyg"
,
"zxzyg"
,
"正向总有功"
,
"正向总有功"
,
"dataGrid"
,
"zxzyg"
);
ColModel
colModelEventDesc
=
new
ColModel
(
"fxzyg"
,
"fxzyg"
,
"反向总有功"
,
"反向总有功"
,
"dataGrid"
,
"fxzyg"
);
ColModel
colModelAlarmGroupName
=
new
ColModel
(
"zxzwg"
,
"zxzwg"
,
"正向总无功"
,
"正向总无功"
,
"dataGrid"
,
"zxzwg"
);
ColModel
colModelEventTime
=
new
ColModel
(
"fxzwg"
,
"fxzwg"
,
"反向总无功"
,
"反向总无功"
,
"dataGrid"
,
"fxzwg"
);
List
<
ColModel
>
listColModel
=
Arrays
.
asList
(
colModelEventMovement
,
colModelStationName
,
colModelEventDesc
,
colModelAlarmGroupName
,
colModelEventTime
);
ResultsData
resultsData
=
new
ResultsData
(
DataGridMock
,
listColModel
);
return
resultsData
;
}
/**
* 保留四位小数的函数
*
...
...
@@ -659,4 +693,15 @@ public class MonitorServiceImpl implements MonitorService {
// 使用String.format方法格式化浮点数,保留两位小数
return
Double
.
valueOf
(
String
.
format
(
"%.2f"
,
param
));
}
/**
* 保留三位小数的函数
*
* @param param 输入的双精度浮点数
* @return 经过四舍五入保留三位小数的双精度浮点数
*/
public
String
keepThreedecimalPlaces
(
Double
param
)
{
// 使用String.format方法格式化浮点数,保留两位小数
return
String
.
format
(
"%.3f"
,
param
);
}
}
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