Commit fdc82dc9 authored by tangwei's avatar tangwei

增加监控发电量趋势

parent 0d61a6f3
package com.yeejoin.amos.boot.module.hygf.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import org.springframework.data.annotation.Id;
/**
* @description:
* @author: tw
* @createDate: 2023/11/8
*/
@Data
public class AllGenerateDto {
private Long createdTime;
/**
* 第三方电站id
*/
private String thirdStationId;
/**
* 年
*/
private String yearTime;
/**
* 平均功率
*/
private String year;
/**
* 平均功率
*/
private Double generate;
}
......@@ -12,27 +12,29 @@ import org.springframework.data.annotation.Id;
@Data
public class DayGenerateDto {
private Long createdTime;
/**
* 第三方电站id
*/
private String thirdStationId;
/**
* 小时
*
*/
private String hourTime;
private String dayTime;
/**
* 月份
*/
private String monthDay;
private String yearMonth;
/**
* 发电量
*/
private Double generate;
/**
* 满发小时数
*
* */
private Double fullhour;
}
......@@ -146,4 +146,15 @@ public class JpStationDto extends BaseDto {
private String regionalCompaniesCode;
private String amosCompanyCode;
//场站id
private List<String> thirdStationIds;
String timeDate;
/**
* 满发小时数
*
* */
private Double fullhour;
}
......@@ -18,16 +18,23 @@ public class MonthGenerateDto {
private String thirdStationId;
/**
*
*
*/
private String dayTime;
private String monthTime;
/**
* 月份
* 平均功率
*/
private String yearMonth;
private String year;
/**
* 发电量
* 发电量
*/
private Double generate;
/**
* 满发小时数
*
* */
private Double fullhour;
}
......@@ -16,24 +16,25 @@ public class YearGenerateDto {
/**
* 第三方电站id
*/
private String thirdStationId;
/**
* 年
*/
private String monthTime;
private String yearTime;
/**
* 平均功率
*时间
*/
private String year;
/**
* 平均功率
*年发电量
*/
private Double generate;
/**
* 满发小时数
*
* */
private Double fullhour;
}
......@@ -13,7 +13,7 @@ import org.springframework.data.annotation.Id;
*/
@Data
@Accessors(chain = true)
@TableName("td_hygf_day_generate")
@TableName("td_hygf_station_day_generate")
public class DayGenerate {
@Id
private Long createdTime;
......@@ -39,15 +39,11 @@ public class DayGenerate {
*/
@TableField("generate")
private Double generate;
/**
* 满发小时数
*
* */
@TableField("fullhour")
private Double fullhour;
public DayGenerate(Long createdTime, String thirdStationId, String dayTime, String yearMonth, Double generate) {
this.createdTime = createdTime;
this.thirdStationId = thirdStationId;
this.dayTime = dayTime;
this.yearMonth = yearMonth;
this.generate = generate;
}
public DayGenerate() {
}
}
......@@ -216,4 +216,5 @@ public class JpStation extends BaseEntity {
@TableField("amos_company_code")
private String amosCompanyCode;
}
......@@ -13,7 +13,7 @@ import org.springframework.data.annotation.Id;
*/
@Data
@Accessors(chain = true)
@TableName("td_hygf_month_generate")
@TableName("td_hygf_station_month_generate")
public class MonthGenerate {
@Id
private Long createdTime;
......@@ -36,19 +36,15 @@ public class MonthGenerate {
private String year;
/**
* 平均功率
* 月发电量
*/
@TableField("generate")
private Double generate;
public MonthGenerate(Long createdTime, String thirdStationId, String monthTime, String year, Double generate) {
this.createdTime = createdTime;
this.thirdStationId = thirdStationId;
this.monthTime = monthTime;
this.year = year;
this.generate = generate;
}
public MonthGenerate() {
}
/**
* 满发小时数
*
* */
@TableField("fullhour")
private Double fullhour;
}
......@@ -13,7 +13,7 @@ import org.springframework.data.annotation.Id;
*/
@Data
@Accessors(chain = true)
@TableName("td_hygf_year_generate")
@TableName("td_hygf_station_year_generate")
public class YearGenerate {
@Id
private Long createdTime;
......@@ -30,24 +30,20 @@ public class YearGenerate {
private String yearTime;
/**
*
*时间
*/
@TableField("year")
private String year;
/**
*
*年发电量
*/
@TableField("generate")
private Double generate;
public YearGenerate(Long createdTime, String thirdStationId, String yearTime, String year, Double generate) {
this.createdTime = createdTime;
this.thirdStationId = thirdStationId;
this.yearTime = yearTime;
this.year = year;
this.generate = generate;
}
public YearGenerate() {
}
/**
* 满发小时数
*
* */
@TableField("fullhour")
private Double fullhour;
}
......@@ -49,4 +49,7 @@ public interface JpStationMapper extends BaseMapper<JpStation> {
@UserEmpower(field ={"regional_companies_code","amos_company_code"} ,fieldConditions ={"in","in"} ,relationship="and")
Map<String,Object> getcount( JpStationDto reviewDto);
@UserEmpower(field ={"regional_companies_code","amos_company_code"} ,fieldConditions ={"in","in"} ,relationship="and")
List<JpStationDto> queryForDealerReviewPagenew(@Param("dto") JpStationDto reviewDto);
}
package com.yeejoin.amos.boot.module.hygf.api.service;
import com.yeejoin.amos.boot.module.hygf.api.entity.DayGenerate;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2023/11/8
*/
public interface IDayGenerateService {
List<DayGenerate> getDayGenerateph( List<JpStation> dto, String sort,String dateTime);
}
......@@ -31,6 +31,10 @@ public interface IJpStationService {
//接入中电站数
Map<String,Object>getcountStatejr( JpStationDto reviewDto);
List<JpStation> getJpStation( JpStationDto reviewDto);
Map<String, List<Object>> getGenerateqx(String date, String type, JpStationDto reviewDto);
Map<String, List<Object>> getPowerqxnew(String date, JpStationDto reviewDto);
}
package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerCurveDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.DayGenerate;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation;
import com.yeejoin.amos.boot.module.hygf.api.entity.MonthGenerate;
import com.yeejoin.amos.boot.module.hygf.api.entity.YearGenerate;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @description:
......@@ -9,4 +16,20 @@ import com.yeejoin.amos.boot.module.hygf.api.entity.DayGenerate;
* @createDate: 2023/11/8
*/
public interface DayGenerateMapper extends BaseMapper<DayGenerate> {
//日发电量排行
// desc 前十名
// asc 后十名
List<DayGenerate> getDayGenerateph(@Param("dto") List<JpStation> dto, @Param("sort")String sort,@Param("dateTime")String dateTime);
List<PowerCurveDto> getDayGeneratqx(@Param("date") String month, @Param("dto")List<String> statioId);
List<PowerCurveDto> getMonthGenerateqx(@Param("date") String month, @Param("dto")List<String> statioId);
List<PowerCurveDto> getYearGenerateqx(@Param("date") String month, @Param("dto")List<String> statioId);
}
......@@ -172,9 +172,9 @@
<if test="dto.area!=null">
and hygf_jp_station.area like concat(concat("%",#{dto.area}),"%")
</if>
<if test="dto.statioId!=null">
<if test="dto.thirdStationIds!=null">
and hygf_jp_station.third_station_id in
<foreach collection="dto.statioId" item="item" index="index" open="(" separator="," close=")">
<foreach collection="dto.thirdStationIds" item="item" index="index" open="(" separator="," close=")">
#{item.stationId}
</foreach>
</if>
......@@ -187,6 +187,9 @@
<if test="dto.amosCompanyCode!=null">
and hygf_jp_station.amos_company_code =#{dto.amosCompanyCode}
</if>
<if test="dto.state!=null">
and hygf_jp_station.`state` =#{dto.state}
</if>
</where>
</select>
......@@ -452,5 +455,85 @@
</where>
</select>
<select id="queryForDealerReviewPagenew" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto">
select
`sequence_nbr` sequenceNbr,
`rec_date` recDate,
`rec_user_id` recUserId,
`rec_user_name` recUserName,
`sn_code` snCode,
`capacity` capacity,
`name` ,
`code` ,
`system_code` systemCode,
`access_time` accessTime,
`create_time` createTime,
`address` ,
`longitude` ,
`latitude` ,
`price` ,
`user_name` userName,
`user_phone` userPhone,
`station_contact` stationContact,
`module_count` moduleCount,
`on_grid_type` onGridType,
`on_grid_time` onGridTime,
`third_station_id` thirdStationId,
`third_code` thirdCode,
`station_id` stationId,
`day_power_use` dayPowerUse,
`month_power_use` monthPowerUse,
`year_power_use` yearPowerUse,
ROUND(`real_time_power`,3) realTimePower,
ROUND(`accumulated_power`/1000,3) accumulatedPower,
`state` ,
`type`,
`organizational_code` organizationalCode,
`is_delete` isDelete,
ROUND(`day_generate`,3) dayGenerate,
`month_generate` monthGenerate,
`year_generate` yearGenerate,
`day_income` dayIncome,
`month_income` monthIncome,
`year_income` yearIncome,
`area` ,
`cumulative_income` cumulativeIncome,
`email`,
rated_power ratedPower
from hygf_jp_station
<where>
<if test="dto.name!=null">
and hygf_jp_station.name like concat(concat("%",#{dto.name}),"%")
</if>
<if test="dto.userName!=null">
and hygf_jp_station.user_name like concat(concat("%",#{dto.userName}),"%")
</if>
<if test="dto.address!=null">
and hygf_jp_station.address like concat(concat("%",#{dto.address}),"%")
</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>
<?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.hygf.api.tdenginemapper.DayPowerMapper">
<select id="getDayGenerateph" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.DayPowerDto">
SELECT
*
FROM house_pv_data.td_hygf_station_day_generate
<where>
<if test="dto!=null">
third_station_id in
<foreach collection="dto" item="item" index="index" open="(" separator="," close=")">
#{item.thirdStationId}
</foreach>
</if>
<if test="dateTime!=null">
day_time = #{dateTime}
</if>
</where>
ORDER by fullhour #{sort} limit 10
</select>
<select id="getDayGeneratqx" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerCurveDto">
SELECT
sum(generate)num,
`day_time` date
FROM house_pv_data.td_hygf_station_day_generate where third_station_id in
<foreach collection="dto" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
and year_month = #{date}
GROUP BY `day_time`
</select>
<select id="getMonthGenerateqx" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerCurveDto">
SELECT
sum(generate)num,
`month_time` date
FROM house_pv_data.td_hygf_station_month_generate where third_station_id in
<foreach collection="dto" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
and year = #{date}
GROUP BY `month_time`
</select>
<select id="getYearGenerateqx" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerCurveDto">
SELECT
sum(generate)num,
`year_time` date
FROM house_pv_data.td_hygf_station_year_generate where third_station_id in
<foreach collection="dto" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
and year = #{date}
GROUP BY `hour`
</select>
</mapper>
<?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.hygf.api.tdenginemapper.MonthGenerateMapper">
</mapper>
\ No newline at end of file
<?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.hygf.api.tdenginemapper.YearGenerateMapper">
</mapper>
\ No newline at end of file
......@@ -9,6 +9,7 @@ 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;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpStationMapper;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.DayGenerateServiceImpl;
import com.yeejoin.amos.boot.module.standard.api.entity.PublicAgencyUser;
import org.omg.CORBA.OBJ_ADAPTER;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -53,11 +54,17 @@ public class JpStationController extends BaseController {
@Autowired
JpInverterMapper jpInverterMapper;
@Autowired
DayGenerateServiceImpl dayGenerateServiceImpl;
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;
private static String ZX="在线";
private static String LX="离线";
private static String BJ="报警";
/**
* 新增第三方场站
......@@ -432,11 +439,11 @@ public class JpStationController extends BaseController {
List<Map<String,Object>> list= jpStationServiceImpl.getcountState(reviewDto);
if(list!=null&&!list.isEmpty()){
for (Map<String, Object> map : list) {
if("在线".equals(map.get("state").toString())){
if(ZX.equals(map.get("state").toString())){
collector.put("zx",Integer.valueOf(map.get("num").toString()));
}else if("离线".equals(map.get("state").toString())){
}else if(LX.equals(map.get("state").toString())){
collector.put("lx",Integer.valueOf(map.get("num").toString()));
}else if("报警".equals(map.get("state").toString())){
}else if(BJ.equals(map.get("state").toString())){
collector.put("bj",Integer.valueOf(map.get("num").toString()));
}
}
......@@ -453,6 +460,83 @@ public class JpStationController extends BaseController {
return ResponseHelper.buildResponse(collector);
}
//日满发小时排行
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "节能减排", notes = "节能减排")
@GetMapping(value = "/getDayGenerateph")
public ResponseModel< List<Map<String,Object>>> getDayGenerateph(JpStationDto reviewDto,String type,String dateTime ) {
List<JpStation> list= jpStationServiceImpl.getJpStation(reviewDto);
List<Map<String,Object>> li=new ArrayList<>();
List<DayGenerate> date= dayGenerateServiceImpl.getDayGenerateph(list,type,dateTime);
if(date!=null&&!list.isEmpty()){
for (DayGenerate dayGenerate : date) {
Map<String,Object> map =new HashMap<>();
for (JpStation jpStation : list) {
if(dayGenerate.getThirdStationId().equals(jpStation.getThirdStationId())){
map.put("sequenceNbr",jpStation.getSequenceNbr());
map.put("name",jpStation.getName());
map.put("address",jpStation.getName());
map.put("fullhour",dayGenerate.getFullhour());
break;
}
}
if(!map.isEmpty()){
li.add(map);
}
}
}
return ResponseHelper.buildResponse(li);
}
@TycloudOperation(needAuth = false,ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "发电量曲线", notes = "发电量曲线")
@GetMapping(value = "/getGenerateqx")
public ResponseModel< Map<String, List<Object>>> getGenerateqx(JpStationDto reviewDto,String date, String type) {
Map<String, List<Object>> map= jpStationServiceImpl.getGenerateqx( date, type,reviewDto);
return ResponseHelper.buildResponse(map);
}
@TycloudOperation(needAuth = false,ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "工率曲线", notes = "电站监控电量收益")
@GetMapping(value = "/getPowerqxnew")
public ResponseModel< Map<String, List<Object>>> getPowerqxnew(JpStationDto reviewDto,String date) {
Map<String, List<Object>> map= jpStationServiceImpl.getPowerqxnew( date,reviewDto);
return ResponseHelper.buildResponse(map);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/queryPagenew")
@ApiOperation(httpMethod = "GET",value = "场站列表", notes = "场站列表")
public ResponseModel<Page<JpStationDto>> queryPagenew(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size, JpStationDto reviewDto) {
Page<JpStationDto> page=jpStationServiceImpl.queryForJpStationPage(current,size,reviewDto);
return ResponseHelper.buildResponse(page);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/queryReport")
@ApiOperation(httpMethod = "GET",value = "场站报表", notes = "场站报表")
public ResponseModel<Page<JpStationDto>> queryReport(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size, JpStationDto reviewDto,String type) {
Page<JpStationDto> page=jpStationServiceImpl.queryReport(current,size,reviewDto,type);
return ResponseHelper.buildResponse(page);
}
......
......@@ -5,9 +5,12 @@ import com.yeejoin.amos.boot.module.hygf.api.dto.DayGenerateDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.service.IDayGenerateService;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.DayGenerateMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.List;
/**
* @description:
* @author: tw
......@@ -15,8 +18,10 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
*/
@Service
public class DayGenerateServiceImpl extends BaseService<DayGenerateDto, DayGenerate, DayGenerateMapper> implements IDayGenerateService {
@Autowired
DayGenerateMapper dayGenerateMapper;
@Override
public List<DayGenerate> getDayGenerateph(List<JpStation> dto, String sort,String dateTime) {
return dayGenerateMapper.getDayGenerateph(dto,sort,dateTime);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment