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
ea950796
Commit
ea950796
authored
Nov 13, 2023
by
tangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增场站监控接口
parent
483282d3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
201 additions
and
17 deletions
+201
-17
UserEmpowerInterceptor.java
...s/boot/module/hygf/api/config/UserEmpowerInterceptor.java
+18
-10
DropDown.java
...a/com/yeejoin/amos/boot/module/hygf/api/dto/DropDown.java
+19
-0
JpStationMapper.java
...oin/amos/boot/module/hygf/api/mapper/JpStationMapper.java
+10
-1
JpStationMapper.xml
...f-api/src/main/resources/mapper/mysql/JpStationMapper.xml
+72
-0
JpStationController.java
.../boot/module/hygf/biz/controller/JpStationController.java
+82
-6
No files found.
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/config/UserEmpowerInterceptor.java
View file @
ea950796
...
...
@@ -73,18 +73,25 @@ public class UserEmpowerInterceptor implements Interceptor {
//拼接参数
List
<
String
>
sq
=
selectSql
(
filed
,
fileCondition
,
orgCode
);
String
sqldata
=
" "
;
if
(
sq
!=
null
&&
sq
.
size
()>
1
){
if
(
fileBetweenCondition
!=
null
&&!
fileBetweenCondition
.
isEmpty
()){
for
(
int
i
=
0
;
i
<
sq
.
size
();
i
++)
{
if
(
i
==
sq
.
size
()-
1
){
sqldata
=
sqldata
+
sq
.
get
(
i
);
}
else
{
sqldata
=
sqldata
+
sq
.
get
(
i
)+
" "
+
fileBetweenCondition
+
" "
;
if
(
sq
!=
null
&&
sq
.
size
()>
0
){
if
(
fileCondition
.
length
==
1
){
sqldata
=
sqldata
+
sq
.
get
(
0
);
}
else
{
if
(
fileBetweenCondition
!=
null
&&!
fileBetweenCondition
.
isEmpty
()){
for
(
int
i
=
0
;
i
<
sq
.
size
();
i
++)
{
if
(
i
==
sq
.
size
()-
1
){
sqldata
=
sqldata
+
sq
.
get
(
i
);
}
else
{
sqldata
=
sqldata
+
sq
.
get
(
i
)+
" "
+
fileBetweenCondition
+
" "
;
}
}
}
else
{
throw
new
BadRequest
(
"权限认证失败!参数之间关系不能为空"
);
}
}
else
{
throw
new
BadRequest
(
"权限认证失败!参数之间关系不能为空"
);
}
}
...
...
@@ -106,6 +113,7 @@ public class UserEmpowerInterceptor implements Interceptor {
metaObject
.
setValue
(
"delegate.boundSql.sql"
,
selectBody
.
toString
());
}
catch
(
Exception
e
){
e
.
printStackTrace
();
throw
new
BadRequest
(
"权限认证失败!"
);
}
finally
{
UserEmpowerThreadLocal
.
clean
();
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/dto/DropDown.java
0 → 100644
View file @
ea950796
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @description:
* @author: tw
* @createDate: 2023/11/13
*/
@Data
public
class
DropDown
{
@ApiModelProperty
(
value
=
"单位code"
)
private
String
orgCode
;
@ApiModelProperty
(
value
=
"单位名称"
)
private
String
name
;
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/mapper/JpStationMapper.java
View file @
ea950796
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
mapper
;
import
com.yeejoin.amos.boot.module.hygf.api.config.UserEmpower
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.DropDown
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.ReviewDto
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.JpStation
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -25,4 +25,13 @@ public interface JpStationMapper extends BaseMapper<JpStation> {
@UserEmpower
(
field
={
"regional_companies_code"
,
"amos_company_code"
}
,
fieldConditions
={
"in"
,
"in"
}
,
relationship
=
"and"
)
List
<
JpStation
>
getJpStation
(
@Param
(
"dto"
)
JpStationDto
reviewDto
);
@UserEmpower
(
field
={
"ORG_CODE"
}
,
fieldConditions
={
"in"
}
,
relationship
=
""
)
List
<
DropDown
>
getRegion
();
@UserEmpower
(
field
={
"hygf_regional_companies.regional_companies_code"
,
"hygf_unit_info.amos_company_code"
}
,
fieldConditions
={
"in"
,
"in"
}
,
relationship
=
"and"
)
List
<
DropDown
>
getDealer
(
@Param
(
"regionalCompaniesCode"
)
String
regionalCompaniesCode
);
@UserEmpower
(
field
={
"regional_companies_code"
,
"amos_company_code"
}
,
fieldConditions
={
"in"
,
"in"
}
,
relationship
=
"and"
)
JpStation
getCountJpStationdata
(
@Param
(
"dto"
)
JpStationDto
reviewDto
);
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/resources/mapper/mysql/JpStationMapper.xml
View file @
ea950796
...
...
@@ -178,6 +178,9 @@
#{item.stationId}
</foreach>
</if>
<if
test=
"dto.thirdStationId!=null"
>
and hygf_jp_station.third_station_id =#{dto.thirdStationId}
</if>
<if
test=
"dto.regionalCompaniesCode!=null"
>
and hygf_jp_station.regional_companies_code =#{dto.regionalCompaniesCode}
</if>
...
...
@@ -188,5 +191,74 @@
</where>
</select>
<select
id=
"getRegion"
resultType=
"com.yeejoin.amos.boot.module.hygf.api.dto.DropDown"
>
SELECT privilege_company.ORG_CODE orgCode ,
privilege_company.COMPANY_NAME name
FROM privilege_company
WHERE IS_DELETED=0 and privilege_company.COMPANY_TYPE = 'region'
</select>
<select
id=
"getDealer"
resultType=
"com.yeejoin.amos.boot.module.hygf.api.dto.DropDown"
>
SELECT hygf_unit_info.`name`, hygf_unit_info.amos_company_code orgCode FROM hygf_regional_companies LEFT JOIN hygf_unit_info
ON hygf_unit_info.sequence_nbr=hygf_regional_companies.unit_info_id WHERE hygf_unit_info.audit_status='2'
AND hygf_unit_info.blacklist='0' AND hygf_unit_info.is_delete='0'
and hygf_regional_companies.regional_companies_code =#{regionalCompaniesCode}
and hygf_unit_info.amos_company_code is not null
GROUP BY hygf_unit_info.amos_company_code,hygf_unit_info.`name`
</select>
<select
id=
"getCountJpStationdata"
resultType=
"com.yeejoin.amos.boot.module.hygf.api.entity.JpStation"
>
select
ROUND(sum(real_time_power),3) realTimePower,
ROUND(sum(capacity)/1000,3) capacity,
ROUND(sum(day_generate)/1000,3) dayGenerate,
ROUND(sum(month_generate)/1000,3) monthGenerate,
ROUND(sum(year_generate)/1000,3) yearGenerate,
ROUND(sum(accumulated_power)/1000,3) accumulatedPower,
ROUND( sum(day_income),3) dayIncome,
ROUND(sum(month_income)/10000,3) monthIncome,
ROUND(sum(year_income)/10000,3) yearIncome,
ROUND(sum(cumulative_income)/10000,3) cumulativeIncome,
ROUND(sum(day_power_use)/1000,3) dayPowerUse,
ROUND(sum(month_power_use)/1000,3) monthPowerUse,
ROUND(sum(year_power_use)/1000,3) yearPowerUse,
ROUND(sum(rated_power),3) ratedPower,
count(*) countBuiltNum
from hygf_jp_station
<where>
<if
test=
"dto.name!=null"
>
and hygf_jp_station.name like concat(concat("%",#{dto.name}),"%")
</if>
<if
test=
"dto.area!=null"
>
and hygf_jp_station.area like concat(concat("%",#{dto.area}),"%")
</if>
<if
test=
"dto.statioId!=null"
>
and hygf_jp_station.third_station_id in
<foreach
collection=
"dto.statioId"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{item.stationId}
</foreach>
</if>
<if
test=
"dto.thirdStationId!=null"
>
and hygf_jp_station.third_station_id =#{dto.thirdStationId}
</if>
<if
test=
"dto.regionalCompaniesCode!=null"
>
and hygf_jp_station.regional_companies_code =#{dto.regionalCompaniesCode}
</if>
<if
test=
"dto.amosCompanyCode!=null"
>
and hygf_jp_station.amos_company_code =#{dto.amosCompanyCode}
</if>
</where>
</select>
</mapper>
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/JpStationController.java
View file @
ea950796
...
...
@@ -2,11 +2,9 @@ package com.yeejoin.amos.boot.module.hygf.biz.controller;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.module.hygf.api.config.UserLimits
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.DropDown
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.ReviewDto
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.JpCollector
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.JpInverter
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.JpPersonStation
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.PersonnelBusiness
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.*
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.JpCollectorMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.JpInverterMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.JpPersonStationMapper
;
...
...
@@ -19,6 +17,7 @@ import io.swagger.annotations.Api;
import
org.springframework.web.bind.annotation.RestController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
java.text.DecimalFormat
;
import
java.util.*
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpStationServiceImpl
;
...
...
@@ -54,6 +53,12 @@ public class JpStationController extends BaseController {
@Autowired
JpInverterMapper
jpInverterMapper
;
private
static
Double
CARBON
=
0.997
*
0.001
;
private
static
Double
SULFUR
=
0.03
*
0.001
;
private
static
Double
DUST
=
0.272
*
0.001
;
private
static
Double
COAL
=
0.4
*
0.001
;
/**
* 新增第三方场站
*
...
...
@@ -346,11 +351,82 @@ public class JpStationController extends BaseController {
return
ResponseHelper
.
buildResponse
(
jpStationServiceImpl
.
getPowerqx
(
date
,
type
,
data
));
}
//查询当前登录人权限区域公司
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"查询当前登录人权限区域公司"
,
notes
=
"查询当前登录人权限区域公司"
)
@GetMapping
(
value
=
"/getRegion"
)
@UserLimits
public
ResponseModel
<
List
<
DropDown
>>
getRegion
()
{
List
<
DropDown
>
list
=
jpStationMapper
.
getRegion
();
return
ResponseHelper
.
buildResponse
(
list
);
}
//查询当前登录人权限经销商
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"查询当前登录人权限经销商"
,
notes
=
"查询当前登录人权限经销商"
)
@GetMapping
(
value
=
"/getDealer"
)
@UserLimits
public
ResponseModel
<
List
<
DropDown
>>
getDealer
(
String
regionalCompaniesCode
)
{
List
<
DropDown
>
list
=
jpStationMapper
.
getDealer
(
regionalCompaniesCode
);
return
ResponseHelper
.
buildResponse
(
list
);
}
//电站发电量统计
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"电站发电量统计"
,
notes
=
"电站发电量统计"
)
@GetMapping
(
value
=
"/getCountJpStationdata"
)
public
ResponseModel
<
List
<
JpStation
>>
getCountJpStationdata
(
JpStationDto
reviewDto
)
{
JpStation
jpStation
=
jpStationMapper
.
getCountJpStationdata
(
reviewDto
);
List
<
JpStation
>
list
=
new
ArrayList
<>();
list
.
add
(
jpStation
);
return
ResponseHelper
.
buildResponse
(
list
);
}
//电站分布
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"电站分布"
,
notes
=
"电站分布"
)
@GetMapping
(
value
=
"/getJpStation"
)
public
Object
getJpStation
(
JpStationDto
reviewDto
)
{
List
<
JpStation
>
list
=
jpStationMapper
.
getJpStation
(
reviewDto
);
return
ResponseHelper
.
buildResponse
(
list
);
}
//节能减排
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"节能减排"
,
notes
=
"节能减排"
)
@GetMapping
(
value
=
"/getEnergyConservation"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
getEnergyConservation
(
JpStationDto
reviewDto
)
{
JpStation
jpStation
=
jpStationMapper
.
getCountJpStationdata
(
reviewDto
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
DecimalFormat
format2
=
new
DecimalFormat
(
"#.00"
);
//炭
map
.
put
(
"carbon"
,
format2
.
format
(
jpStation
.
getAccumulatedPower
()*
CARBON
));
//硫
map
.
put
(
"sulfur"
,
format2
.
format
(
jpStation
.
getAccumulatedPower
()*
SULFUR
));
//粉尘
map
.
put
(
"dust"
,
format2
.
format
(
jpStation
.
getAccumulatedPower
()*
DUST
));
//煤
map
.
put
(
"coal"
,
format2
.
format
(
jpStation
.
getAccumulatedPower
()*
COAL
));
return
ResponseHelper
.
buildResponse
(
map
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"工率曲线"
,
notes
=
"电站监控电量收益"
)
@GetMapping
(
value
=
"/test"
)
@UserLimits
public
Object
getPowerqx
()
{
public
Object
getPowerqx
(
JpStationDto
reviewDto
)
{
return
jpStationMapper
.
getJpStation
(
null
);
...
...
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