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
ddb59419
Commit
ddb59419
authored
Jul 05, 2023
by
caotao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取社会贡献值
parent
2643f2be
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
15 deletions
+57
-15
MonitorFanIndicatorMapper.xml
...i/src/main/resources/mapper/MonitorFanIndicatorMapper.xml
+6
-1
MonitoringMapController.java
.../module/jxiop/biz/controller/MonitoringMapController.java
+7
-5
SocialContributionDto.java
...amos/boot/module/jxiop/biz/dto/SocialContributionDto.java
+15
-0
MonitorFanIndicatorImpl.java
...odule/jxiop/biz/service/impl/MonitorFanIndicatorImpl.java
+1
-1
MonitoringServiceImpl.java
.../module/jxiop/biz/service/impl/MonitoringServiceImpl.java
+28
-8
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/resources/mapper/MonitorFanIndicatorMapper.xml
View file @
ddb59419
...
@@ -72,7 +72,12 @@
...
@@ -72,7 +72,12 @@
WHERE gateway=#{gateway} and
WHERE gateway=#{gateway} and
indicator like concat('%',#{indicator},'%')
indicator like concat('%',#{indicator},'%')
</select>
</select>
<select
id=
"getIndicatoralueTotal"
resultType=
"Object"
>
SELECT SUM(indicator_value) wind_speed
FROM monitor_fan_indicator
WHERE gateway=#{gateway} and
indicator like concat('%',#{indicator},'%')
</select>
<select
id=
"queryRunRecord"
resultType=
"com.yeejoin.amos.boot.module.jxiop.api.dto.RunRecord"
>
<select
id=
"queryRunRecord"
resultType=
"com.yeejoin.amos.boot.module.jxiop.api.dto.RunRecord"
>
SELECT
SELECT
t.equipment_number AS FanName,
t.equipment_number AS FanName,
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/MonitoringMapController.java
View file @
ddb59419
...
@@ -8,6 +8,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
...
@@ -8,6 +8,7 @@ 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.api.mapper.StationBasicMapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.service.IMapRegionService
;
import
com.yeejoin.amos.boot.module.jxiop.api.service.IMapRegionService
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.RegionNationWideDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.RegionNationWideDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.SocialContributionDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.Test
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.Test
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.MonitoringServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.MonitoringServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.RegionServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.RegionServiceImpl
;
...
@@ -46,9 +47,10 @@ public class MonitoringMapController extends BaseController {
...
@@ -46,9 +47,10 @@ public class MonitoringMapController extends BaseController {
return
ResponseHelper
.
buildResponse
(
monitoringServiceImpl
.
getNationWideInfo
(
provinceName
));
return
ResponseHelper
.
buildResponse
(
monitoringServiceImpl
.
getNationWideInfo
(
provinceName
));
}
}
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"获取社会贡献"
)
@GetMapping
(
"/getTotalSocialContribution"
)
public
ResponseModel
<
List
<
SocialContributionDto
>>
getTotalSocialContribution
()
{
return
ResponseHelper
.
buildResponse
(
monitoringServiceImpl
.
getTotalSocialContribution
());
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/dto/SocialContributionDto.java
0 → 100644
View file @
ddb59419
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
dto
;
import
lombok.Data
;
@Data
public
class
SocialContributionDto
{
/**
* 社会贡献值
*/
private
Double
title
;
/**
* 贡献单位
*/
private
String
unit
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/MonitorFanIndicatorImpl.java
View file @
ddb59419
...
@@ -125,7 +125,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
...
@@ -125,7 +125,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
}
/**
/**
* 根据网关与指标获取指标的
平均
值
* 根据网关与指标获取指标的
总
值
* @param gateway
* @param gateway
* @param indicator
* @param indicator
* @return
* @return
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/MonitoringServiceImpl.java
View file @
ddb59419
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
service
.
impl
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.injector.methods.SelectOne
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.Region
;
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.StationBasic
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationCoordinate
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationCoordinate
;
...
@@ -8,6 +9,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.mapper.RegionMapper;
...
@@ -8,6 +9,7 @@ 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.StationBasicMapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.StationCoordinateMapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.StationCoordinateMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.RegionNationWideDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.RegionNationWideDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.SocialContributionDto
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
...
@@ -140,18 +142,36 @@ public class MonitoringServiceImpl {
...
@@ -140,18 +142,36 @@ public class MonitoringServiceImpl {
return
this
.
monitorFanIndicatorImpl
.
getIndicatoralueTotal
(
gateway
,
indicatorcName
);
return
this
.
monitorFanIndicatorImpl
.
getIndicatoralueTotal
(
gateway
,
indicatorcName
);
}
}
public
void
getTotalSocialContribution
(){
public
List
<
SocialContributionDto
>
getTotalSocialContribution
(){
HashMap
<
String
,
Double
>
hashMap
=
new
HashMap
<>();
List
<
SocialContributionDto
>
socialContributionDtoList
=
new
ArrayList
<>();
AtomicReference
<
Double
>
totalSocialContribution
=
new
AtomicReference
<>(
0.0
);
AtomicReference
<
Double
>
totalSocialContribution
=
new
AtomicReference
<>(
0.0
);
//获取所有网关id不为空的数据
//获取所有网关id不为空的数据
List
<
StationBasic
>
stationBasicList
=
stationBasicMapper
.
selectList
(
new
QueryWrapper
<
StationBasic
>().
isNotNull
(
"gateway_id"
));
List
<
StationBasic
>
stationBasicList
=
stationBasicMapper
.
selectList
(
new
QueryWrapper
<
StationBasic
>().
isNotNull
(
"gateway_id"
));
stationBasicList
.
forEach
(
stationBasic
->
{
stationBasicList
.
forEach
(
stationBasic
->
{
totalSocialContribution
.
updateAndGet
(
v
->
v
+
(
Double
)
monitorFanIndicatorImpl
.
getIndicatoralueTotal
(
stationBasic
.
get
StationNumber
(),
"年发电量"
));
totalSocialContribution
.
updateAndGet
(
v
->
v
+
(
Double
)
monitorFanIndicatorImpl
.
getIndicatoralueTotal
(
stationBasic
.
get
GatewayId
(),
"年发电量"
));
});
});
//
SocialContributionDto
co2
=
new
SocialContributionDto
();
// hashMap.put("CO2",(totalSocialContribution * 0.3049)/1000000);
SocialContributionDto
coal
=
new
SocialContributionDto
();
// hashMap.put("Coal",totalSocialContribution*);
SocialContributionDto
toner
=
new
SocialContributionDto
();
// hashMap.put("Toner",totalSocialContribution*);
SocialContributionDto
so2
=
new
SocialContributionDto
();
// hashMap.put("S02",totalSocialContribution*);
/** 社会贡献原始计算公式,后边的数据已经经过处理
//二氧化碳计算公式 *10000*832/10000/1000/1000
//标准煤计算公式 *10000*304.9/10000/1000/1000
//碳粉尘计算公式 *10000*0.032/1000/1000
//二氧化硫计算公式 =A2*10000*0.16/1000/1000
*/
co2
.
setUnit
(
"二氧化碳减排量(万t)"
);
co2
.
setTitle
(
totalSocialContribution
.
get
()
*
0.000832
);
socialContributionDtoList
.
add
(
co2
);
coal
.
setUnit
(
"节约标准煤(万t)"
);
coal
.
setTitle
(
totalSocialContribution
.
get
()
*
0.0003049
);
socialContributionDtoList
.
add
(
coal
);
toner
.
setUnit
(
"碳粉尘减排量(万t)"
);
toner
.
setTitle
(
totalSocialContribution
.
get
()
*
0.00032
);
socialContributionDtoList
.
add
(
toner
);
so2
.
setUnit
(
"二氧化硫减排量(万t)"
);
so2
.
setTitle
(
totalSocialContribution
.
get
()
*
0.0016
);
socialContributionDtoList
.
add
(
so2
);
return
socialContributionDtoList
;
}
}
}
}
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