Commit 29036e3a authored by tangwei's avatar tangwei

合并分支到主分支(电站监控)

parents bbcffb3c c3a6c0b8
package com.yeejoin.amos.boot.module.hygf.api.dto;
import lombok.Data;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2023/11/30
*/
@Data
public class DataDto {
String time;
List<String> snCodes;
}
...@@ -50,7 +50,7 @@ public class DayGenerateEX { ...@@ -50,7 +50,7 @@ public class DayGenerateEX {
/** /**
* 累计发电量 * 累计发电量
*/ */
@ExcelProperty(value = "累计发电量(kWh)", index = 8) @ExcelProperty(value = "累计发电量(MWh)", index = 8)
private Double accumulatedPower; private Double accumulatedPower;
/** /**
* 状态 * 状态
......
...@@ -101,9 +101,14 @@ public class JpInverterDto extends BaseDto { ...@@ -101,9 +101,14 @@ public class JpInverterDto extends BaseDto {
private List<JpCollector> jpCollectors; private List<JpCollector> jpCollectors;
private List<JpInverterElectricity> JL; private List<JpInverterElectricity> JL;
private List<JpInverterElectricity> ZL; private List<JpInverterElectricity> ZL;
private List<JpInverterElectricity> interflow;
private List<JpInverterElectricity> directCurrent;
@ApiModelProperty(value = "所属电站名称") @ApiModelProperty(value = "所属电站名称")
private String name; private String name;
......
...@@ -98,4 +98,10 @@ public class JpInverterDtoNew extends BaseDto { ...@@ -98,4 +98,10 @@ public class JpInverterDtoNew extends BaseDto {
@ApiModelProperty(value = "筛选用 最大值") @ApiModelProperty(value = "筛选用 最大值")
private Double maxValue; private Double maxValue;
@ApiModelProperty(value = "所属区域公司名称")
private String companyName;
@ApiModelProperty(value = "电站类型")
private String stationType;
} }
...@@ -96,7 +96,7 @@ public class JpStationDto extends BaseDto { ...@@ -96,7 +96,7 @@ public class JpStationDto extends BaseDto {
/** /**
* 累计发电量 * 累计发电量
*/ */
@ExcelProperty(value = "累计发电量(mWh)", index = 6) @ExcelProperty(value = "累计发电量(MWh)", index = 6)
private Double accumulatedPower; private Double accumulatedPower;
@ExcelIgnore @ExcelIgnore
/** /**
......
...@@ -52,6 +52,6 @@ public class MonthGenerateEX { ...@@ -52,6 +52,6 @@ public class MonthGenerateEX {
/** /**
* 累计发电量 * 累计发电量
*/ */
@ExcelProperty(value = "累计发电量(kWh)", index = 8) @ExcelProperty(value = "累计发电量(MWh)", index = 8)
private Double accumulatedPower; private Double accumulatedPower;
} }
...@@ -46,6 +46,6 @@ public class YearGenerateEX { ...@@ -46,6 +46,6 @@ public class YearGenerateEX {
/** /**
* 累计发电量 * 累计发电量
*/ */
@ExcelProperty(value = "累计发电量(kWh)", index = 8) @ExcelProperty(value = "累计发电量(MWh)", index = 8)
private Double accumulatedPower; private Double accumulatedPower;
} }
...@@ -49,6 +49,6 @@ public class DayGenerate { ...@@ -49,6 +49,6 @@ public class DayGenerate {
@TableField("income") @TableField("income")
// 日收益 // 日收益
private Double dayIncome; private Double income;
} }
...@@ -52,5 +52,5 @@ public class MonthGenerate { ...@@ -52,5 +52,5 @@ public class MonthGenerate {
// 月收益 // 月收益
@TableField("income") @TableField("income")
private Double monthIncome; private Double income;
} }
...@@ -80,42 +80,42 @@ public class TdHYGFInverterDayGenerate implements Serializable { ...@@ -80,42 +80,42 @@ public class TdHYGFInverterDayGenerate implements Serializable {
/** /**
* 交流电压1 * 交流电压1
*/ */
@ExcelProperty("交流电压1(V)") @ExcelProperty("交流电压U(V)")
private Double dcv1; private Double dcv1;
/** /**
* 交流电压2 * 交流电压2
*/ */
@ExcelProperty("交流电压2(V)") @ExcelProperty("交流电压V(V)")
private Double dcv2; private Double dcv2;
/** /**
* 交流电压3 * 交流电压3
*/ */
@ExcelProperty("交流电压3(V)") @ExcelProperty("交流电压W(V)")
private Double dcv3; private Double dcv3;
/** /**
* 交流电压4 * 交流电压4
*/ */
@ExcelProperty("交流电压4(V)") @ExcelIgnore
private Double dcv4; private Double dcv4;
/** /**
* 交流电流1 * 交流电流1
*/ */
@ExcelProperty("交流电流1(A)") @ExcelProperty("交流电流U(A)")
private Double dcc1; private Double dcc1;
/** /**
* 交流电流2 * 交流电流2
*/ */
@ExcelProperty("交流电流2(A)") @ExcelProperty("交流电流V(A)")
private Double dcc2; private Double dcc2;
/** /**
* 交流电流3 * 交流电流3
*/ */
@ExcelProperty("交流电流3(A)") @ExcelProperty("交流电流W(A)")
private Double dcc3; private Double dcc3;
/** /**
* 交流电流4 * 交流电流4
*/ */
@ExcelProperty("交流电流4(A)") @ExcelIgnore
private Double dcc4; private Double dcc4;
/** /**
...@@ -160,22 +160,22 @@ public class TdHYGFInverterDayGenerate implements Serializable { ...@@ -160,22 +160,22 @@ public class TdHYGFInverterDayGenerate implements Serializable {
private Double igbtTemp; private Double igbtTemp;
/** /**
* 直流电流1 * 直流功率1
*/ */
@ExcelIgnore @ExcelIgnore
private Double pv1; private Double pv1;
/** /**
* 直流电流2 * 直流功率2
*/ */
@ExcelIgnore @ExcelIgnore
private Double pv2; private Double pv2;
/** /**
* 直流电流3 * 直流功率3
*/ */
@ExcelIgnore @ExcelIgnore
private Double pv3; private Double pv3;
/** /**
* 直流电流4 * 直流功率4
*/ */
@ExcelIgnore @ExcelIgnore
private Double pv4; private Double pv4;
......
...@@ -50,5 +50,5 @@ public class YearGenerate { ...@@ -50,5 +50,5 @@ public class YearGenerate {
// 年收益 // 年收益
@TableField("income") @TableField("income")
private Double yearIncome; private Double income;
} }
...@@ -39,7 +39,39 @@ ...@@ -39,7 +39,39 @@
<select id="selectPageData" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.JpInverterDtoNew"> <select id="selectPageData" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.JpInverterDtoNew">
select select
hjc. * hjc.sequence_nbr,
hjc.rec_date,
hjc.rec_user_id,
hjc.rec_user_name,
hjc.sn_code,
hjc.state,
hjc.rated_power,
hjc.collector_id,
hjc.collector_sn_code,
hjc.update_time,
hjc.current_power,
ROUND(hjc.day_power_generation,3) as dayPowerGeneration,
ROUND(hjc.month_power_generation,3) as monthPowerGeneration,
ROUND(hjc.year_power_generation,3) as yearPowerGeneration,
hjc.brand,
hjc.model,
hjc.national_standard,
hjc.version,
hjc.generation_hours,
hjc.warranty_period,
hjc.IGBT_temperature,
hjc.AFCI_programme,
hjc.AFCI_version,
hjc.ID,
hjc.capacity,
ROUND(hjc.total_power_generation/1000,3) as totalPowerGeneration,
hjc.third_station_id,
hjc.is_delete,
hjc.third_code,
hjc.station_name,
hjc.addr,
sta.type as stationType,
(select COMPANY_NAME from privilege_company where ORG_CODE = sta.regional_companies_code ) as companyName
from from
hygf_jp_inverter hjc hygf_jp_inverter hjc
left join hygf_jp_station sta on sta.third_station_id = hjc.third_station_id left join hygf_jp_station sta on sta.third_station_id = hjc.third_station_id
...@@ -48,7 +80,7 @@ ...@@ -48,7 +80,7 @@
AND hjc.sn_code like #{dto.snCode} AND hjc.sn_code like #{dto.snCode}
</if> </if>
<if test="dto.minValue != null and dto.minValue !=''"> <if test="dto.minValue != null and dto.minValue !=''">
AND hjc.capacity >= #{dto.type} AND hjc.capacity >= #{dto.minValue}
</if> </if>
<if test="dto.maxValue != null and dto.maxValue !=''"> <if test="dto.maxValue != null and dto.maxValue !=''">
AND hjc.capacity <![CDATA[<=]]> #{dto.maxValue} AND hjc.capacity <![CDATA[<=]]> #{dto.maxValue}
...@@ -68,7 +100,7 @@ ...@@ -68,7 +100,7 @@
AND hjc.sn_code like #{dto.snCode} AND hjc.sn_code like #{dto.snCode}
</if> </if>
<if test="dto.minValue != null and dto.minValue !=''"> <if test="dto.minValue != null and dto.minValue !=''">
AND hjc. capacity >= #{dto.type} AND hjc. capacity >= #{dto.minValue}
</if> </if>
<if test="dto.maxValue != null and dto.maxValue !=''"> <if test="dto.maxValue != null and dto.maxValue !=''">
AND hjc.capacity <![CDATA[<=]]> #{dto.maxValue} AND hjc.capacity <![CDATA[<=]]> #{dto.maxValue}
......
...@@ -178,7 +178,7 @@ ...@@ -178,7 +178,7 @@
<if test="dto.area!=null"> <if test="dto.area!=null">
and hygf_jp_station.area like concat(concat("%",#{dto.area}),"%") and hygf_jp_station.area like concat(concat("%",#{dto.area}),"%")
</if> </if>
<if test="dto.thirdStationIds!=null"> <if test="dto.thirdStationIds!=null and dto.thirdStationIds.size()> 0 ">
and hygf_jp_station.third_station_id in and hygf_jp_station.third_station_id in
<foreach collection="dto.thirdStationIds" item="item" index="index" open="(" separator="," close=")"> <foreach collection="dto.thirdStationIds" item="item" index="index" open="(" separator="," close=")">
#{item} #{item}
...@@ -472,7 +472,7 @@ ...@@ -472,7 +472,7 @@
`rec_user_id` recUserId, `rec_user_id` recUserId,
`rec_user_name` recUserName, `rec_user_name` recUserName,
`sn_code` snCode, `sn_code` snCode,
`capacity` capacity, ROUND(`capacity`,3) capacity,
`name` , `name` ,
`code` , `code` ,
`system_code` systemCode, `system_code` systemCode,
...@@ -501,8 +501,8 @@ ...@@ -501,8 +501,8 @@
`organizational_code` organizationalCode, `organizational_code` organizationalCode,
`is_delete` isDelete, `is_delete` isDelete,
ROUND(`day_generate`,3) dayGenerate, ROUND(`day_generate`,3) dayGenerate,
`month_generate` monthGenerate, ROUND(`month_generate`,3) monthGenerate,
`year_generate` yearGenerate, ROUND(`year_generate`,3) yearGenerate,
`day_income` dayIncome, `day_income` dayIncome,
`month_income` monthIncome, `month_income` monthIncome,
`year_income` yearIncome, `year_income` yearIncome,
...@@ -510,7 +510,7 @@ ...@@ -510,7 +510,7 @@
`cumulative_income` cumulativeIncome, `cumulative_income` cumulativeIncome,
`email`, `email`,
rated_power ratedPower, rated_power ratedPower,
ROUND(`real_time_power`/rated_power,3) fullhour, ROUND(`day_generate`/capacity,3) fullhour,
(select privilege_company.COMPANY_NAME from privilege_company where privilege_company.ORG_CODE=hygf_jp_station.regional_companies_code) regionalCompaniesName (select privilege_company.COMPANY_NAME from privilege_company where privilege_company.ORG_CODE=hygf_jp_station.regional_companies_code) regionalCompaniesName
from hygf_jp_station from hygf_jp_station
<where> <where>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
from from
house_pv_data.td_hygf_inverter_day_generate house_pv_data.td_hygf_inverter_day_generate
<where> <where>
created_time >= (#{time} - 8h ) created_time >= #{time}
<if test="snCode != null and snCode !=''"> <if test="snCode != null and snCode !=''">
and sn_code = #{snCode} and sn_code = #{snCode}
</if> </if>
......
...@@ -71,10 +71,10 @@ ...@@ -71,10 +71,10 @@
AND `level` = #{level} AND `level` = #{level}
</if> </if>
<if test="minvalue != null and minvalue != ''"> <if test="minvalue != null and minvalue != ''">
time_long >= #{minvalue} AND time_long >= (#{minvalue}*1000)
</if> </if>
<if test="maxValue != null and maxValue != ''"> <if test="maxValue != null and maxValue != ''">
AND time_long <![CDATA[<=]]> #{maxValue} AND time_long <![CDATA[<=]]> (#{maxValue}*1000)
</if> </if>
<if test="snCode != null and snCode != ''"> <if test="snCode != null and snCode != ''">
AND sn_code like #{snCode} AND sn_code like #{snCode}
...@@ -95,6 +95,7 @@ ...@@ -95,6 +95,7 @@
AND content like #{content} AND content like #{content}
</if> </if>
</where> </where>
ORDER BY start_time desc
limit #{current},#{size} limit #{current},#{size}
</select> </select>
...@@ -111,7 +112,7 @@ ...@@ -111,7 +112,7 @@
AND level = #{level} AND level = #{level}
</if> </if>
<if test="minvalue != null and minvalue != ''"> <if test="minvalue != null and minvalue != ''">
time_long >= #{minvalue} AND time_long >= #{minvalue}
</if> </if>
<if test="maxValue != null and maxValue != ''"> <if test="maxValue != null and maxValue != ''">
AND time_long <![CDATA[<=]]> #{maxValue} AND time_long <![CDATA[<=]]> #{maxValue}
......
...@@ -112,10 +112,10 @@ public class JpCollectorController extends BaseController { ...@@ -112,10 +112,10 @@ public class JpCollectorController extends BaseController {
List<JpInverter> list = jpInverterServiceImpl.list(queryWrapper); List<JpInverter> list = jpInverterServiceImpl.list(queryWrapper);
List<JpInverter> listData =new ArrayList<>(); List<JpInverter> listData =new ArrayList<>();
for (JpInverter jpInverter : list) { for (JpInverter jpInverter : list) {
jpInverter.setDayPowerGeneration(jpInverter.getDayPowerGeneration()!=null?jpInverter.getDayPowerGeneration()/1000:0); jpInverter.setDayPowerGeneration(jpInverter.getDayPowerGeneration()!=null?Double.valueOf(String.format("%.3f",jpInverter.getDayPowerGeneration())):0);
jpInverter.setMonthPowerGeneration(jpInverter.getMonthPowerGeneration()!=null?jpInverter.getMonthPowerGeneration()/1000:0); jpInverter.setMonthPowerGeneration(jpInverter.getMonthPowerGeneration()!=null?Double.valueOf(String.format("%.3f",jpInverter.getMonthPowerGeneration())):0);
jpInverter.setYearPowerGeneration(jpInverter.getYearPowerGeneration()!=null?jpInverter.getYearPowerGeneration()/1000:0); jpInverter.setYearPowerGeneration(jpInverter.getYearPowerGeneration()!=null?Double.valueOf(String.format("%.3f",jpInverter.getYearPowerGeneration())):0);
jpInverter.setTotalPowerGeneration(jpInverter.getTotalPowerGeneration()!=null?jpInverter.getTotalPowerGeneration()/1000:0); jpInverter.setTotalPowerGeneration(jpInverter.getTotalPowerGeneration()!=null?Double.valueOf(String.format("%.3f",jpInverter.getTotalPowerGeneration()/1000)):0);
listData.add(jpInverter); listData.add(jpInverter);
} }
......
...@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.hygf.api.dto.*; import com.yeejoin.amos.boot.module.hygf.api.dto.*;
import com.yeejoin.amos.boot.module.hygf.api.entity.*; import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpCollectorServiceImpl; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpCollectorServiceImpl;
...@@ -27,6 +28,7 @@ import java.io.IOException; ...@@ -27,6 +28,7 @@ import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -229,7 +231,19 @@ public class JpInverterController extends BaseController { ...@@ -229,7 +231,19 @@ public class JpInverterController extends BaseController {
String thirdStationId = treeParams.get("thirdStationId").toString(); String thirdStationId = treeParams.get("thirdStationId").toString();
if (treeParams.get("date").equals("day")){ if (treeParams.get("date").equals("day")){
time = time+ " 00:00:00"; time = time+ " 00:00:00";
Date date = null;
try {
date = DateUtils.dateParse(time, null);
Date date1 = DateUtils.dateAddHours(date, -8);
time = DateUtils.dateTimeToDateStringIfTimeEndZero(date1);
} catch (ParseException e) {
e.printStackTrace();
}
List<JSONObject> treeParams1 = parseArray(JSONObject.toJSONString(treeParams.get("treeParams")), JSONObject.class); List<JSONObject> treeParams1 = parseArray(JSONObject.toJSONString(treeParams.get("treeParams")), JSONObject.class);
if (CollectionUtils.isEmpty(treeParams1)){
Map<String,Object> obj = new HashMap<>();
return ResponseHelper.buildResponse(obj);
}
return ResponseHelper.buildResponse(jpInverterServiceImpl.selectDayTrend(treeParams1, time, snCode, thirdStationId)); return ResponseHelper.buildResponse(jpInverterServiceImpl.selectDayTrend(treeParams1, time, snCode, thirdStationId));
}else if (treeParams.get("date").equals("month")){ }else if (treeParams.get("date").equals("month")){
return ResponseHelper.buildResponse(jpInverterServiceImpl.selectMonthTrend(time, snCode, thirdStationId)); return ResponseHelper.buildResponse(jpInverterServiceImpl.selectMonthTrend(time, snCode, thirdStationId));
...@@ -250,31 +264,33 @@ public class JpInverterController extends BaseController { ...@@ -250,31 +264,33 @@ public class JpInverterController extends BaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/jpInverterDayReport") @PostMapping (value = "/jpInverterDayReport")
@ApiOperation(httpMethod = "GET", value = "逆变器日报表", notes = "逆变器日报表") @ApiOperation(httpMethod = "GET", value = "逆变器日报表", notes = "逆变器日报表")
public ResponseModel<Page<TdHYGFInverterDayGenerate>> jpInverterDayReport(@RequestParam(value = "current") int current, @RequestParam(value = "size") int size,@RequestParam(required = false) String time, @RequestParam(required = false) String snCodes) { public ResponseModel<Page<TdHYGFInverterDayGenerate>> jpInverterDayReport(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestBody(required = false) DataDto dataDto) {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto()); List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto());
List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList()); List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList());
if(StringUtils.isEmpty(time)){ if(StringUtils.isEmpty(dataDto.getTime())){
time = DateUtil.format(new Date(),"yyyy-MM-dd"); dataDto.setTime(DateUtil.format(new Date(),"yyyy-MM-dd"));
} }
List<String> dd= snCodes!=null? JSON.parseArray(snCodes,String.class):null; // List<String> dd= snCodes!=null? JSON.parseArray(snCodes,String.class):null;
return ResponseHelper.buildResponse(jpInverterServiceImpl.jpInverterDayReport(current,size,time,dd,stationIds)); return ResponseHelper.buildResponse(jpInverterServiceImpl.jpInverterDayReport(current,size,dataDto.getTime(),dataDto.getSnCodes(),stationIds));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/jpInverterDayReportExport", method = RequestMethod.GET) @RequestMapping(value = "/jpInverterDayReportExport", method = RequestMethod.POST)
@ApiOperation(httpMethod = "GET", value = "逆变器日报表导出", notes = "逆变器日报表导出") @ApiOperation(httpMethod = "GET", value = "逆变器日报表导出", notes = "逆变器日报表导出")
public void jpInverterDayReportExport( @RequestParam(required = false)String time,@RequestParam(required = false) String snCodes, HttpServletResponse response) { public void jpInverterDayReportExport( @RequestBody(required = false) DataDto dataDto, HttpServletResponse response) {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto()); List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto());
List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList()); List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList());
if(StringUtils.isEmpty(time)){ if(StringUtils.isEmpty(dataDto.getTime())){
time = DateUtil.format(new Date(),"yyyy-MM-dd"); dataDto.setTime(DateUtil.format(new Date(),"yyyy-MM-dd"));
} }
List<String> dd= snCodes!=null? JSON.parseArray(snCodes,String.class):null; //List<String> dd= snCodes!=null? JSON.parseArray(snCodes,String.class):null;
List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates =jpInverterServiceImpl.jpInverterDayReportExport(time,dd,stationIds); List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates =jpInverterServiceImpl.jpInverterDayReportExport(dataDto.getTime(),dataDto.getSnCodes(),stationIds);
try { try {
setResponseHeadForDowload(response,"逆变器日报表.xls"); setResponseHeadForDowload(response,"逆变器日报表.xls");
EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterDayGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器日报表").doWrite(tdHYGFInverterDayGenerates); EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterDayGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器日报表").doWrite(tdHYGFInverterDayGenerates);
...@@ -283,30 +299,32 @@ public class JpInverterController extends BaseController { ...@@ -283,30 +299,32 @@ public class JpInverterController extends BaseController {
} }
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/jpInverterMonthReport") @PostMapping(value = "/jpInverterMonthReport")
@ApiOperation(httpMethod = "GET", value = "逆变器月报表", notes = "逆变器月报表") @ApiOperation(httpMethod = "GET", value = "逆变器月报表", notes = "逆变器月报表")
public ResponseModel<Page<TdHYGFInverterMonthGenerate>> jpInverterMonthReport(@RequestParam(value = "current") int current, @RequestParam(value = "size") int size,@RequestParam(required = false) String time, @RequestParam(required = false) String snCodes) { public ResponseModel<Page<TdHYGFInverterMonthGenerate>> jpInverterMonthReport(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestBody(required = false) DataDto dataDto) {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto()); List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto());
List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList()); List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList());
if(StringUtils.isEmpty(time)){ if(StringUtils.isEmpty(dataDto.getTime())){
time = DateUtil.format(new Date(),"yyyy-MM"); dataDto.setTime(DateUtil.format(new Date(),"yyyy-MM-dd"));
} }
List<String> dd= snCodes!=null? JSON.parseArray(snCodes,String.class):null; // List<String> dd= snCodes!=null? JSON.parseArray(snCodes,String.class):null;
return ResponseHelper.buildResponse(jpInverterServiceImpl.jpInverterMonthReport(current,size,time,dd,stationIds)); return ResponseHelper.buildResponse(jpInverterServiceImpl.jpInverterMonthReport(current,size,dataDto.getTime(),dataDto.getSnCodes(),stationIds));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/jpInverterMonthReportExport", method = RequestMethod.GET) @RequestMapping(value = "/jpInverterMonthReportExport", method = RequestMethod.POST)
@ApiOperation(httpMethod = "GET", value = "逆变器月报表导出", notes = "逆变器月报表导出") @ApiOperation(httpMethod = "GET", value = "逆变器月报表导出", notes = "逆变器月报表导出")
public void jpInverterMonthReportExport( @RequestParam(required = false)String time,@RequestParam(required = false) String snCodes, HttpServletResponse response) { public void jpInverterMonthReportExport( @RequestBody(required = false) DataDto dataDto, HttpServletResponse response) {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto()); List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto());
List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList()); List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList());
if(StringUtils.isEmpty(time)){ if(StringUtils.isEmpty(dataDto.getTime())){
time = DateUtil.format(new Date(),"yyyy-MM"); dataDto.setTime(DateUtil.format(new Date(),"yyyy-MM-dd"));
} }
List<String> dd= snCodes!=null? JSON.parseArray(snCodes,String.class):null; // List<String> dd= snCodes!=null? JSON.parseArray(snCodes,String.class):null;
List<TdHYGFInverterMonthGenerate> tdHYGFInverterMonthGenerates =jpInverterServiceImpl.jpInverterMonthReportExport(time,dd,stationIds); List<TdHYGFInverterMonthGenerate> tdHYGFInverterMonthGenerates =jpInverterServiceImpl.jpInverterMonthReportExport(dataDto.getTime(),dataDto.getSnCodes(),stationIds);
try { try {
setResponseHeadForDowload(response,"逆变器月报表.xls"); setResponseHeadForDowload(response,"逆变器月报表.xls");
EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterMonthGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器月报表").doWrite(tdHYGFInverterMonthGenerates); EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterMonthGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器月报表").doWrite(tdHYGFInverterMonthGenerates);
...@@ -316,30 +334,32 @@ public class JpInverterController extends BaseController { ...@@ -316,30 +334,32 @@ public class JpInverterController extends BaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/jpInverterYearReport") @PostMapping(value = "/jpInverterYearReport")
@ApiOperation(httpMethod = "GET", value = "逆变器年报表", notes = "逆变器年报表") @ApiOperation(httpMethod = "GET", value = "逆变器年报表", notes = "逆变器年报表")
public ResponseModel<Page<TdHYGFInverterYearGenerate>> jpInverterYearReport(@RequestParam(value = "current") int current, @RequestParam(value = "size") int size, @RequestParam(required = false)String time, @RequestParam(required = false) String snCodes) { public ResponseModel<Page<TdHYGFInverterYearGenerate>> jpInverterYearReport(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestBody(required = false) DataDto dataDto) {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto()); List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto());
List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList()); List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList());
if(StringUtils.isEmpty(time)){ if(StringUtils.isEmpty(dataDto.getTime())){
time = DateUtil.format(new Date(),"yyyy"); dataDto.setTime(DateUtil.format(new Date(),"yyyy-MM-dd"));
} }
List<String> dd= snCodes!=null? JSON.parseArray(snCodes,String.class):null; // List<String> dd= snCodes!=null? JSON.parseArray(snCodes,String.class):null;
return ResponseHelper.buildResponse(jpInverterServiceImpl.jpInverterYearReport(current,size,time,dd,stationIds)); return ResponseHelper.buildResponse(jpInverterServiceImpl.jpInverterYearReport(current,size,dataDto.getTime(),dataDto.getSnCodes(),stationIds));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/jpInverterYearReportExport", method = RequestMethod.GET) @RequestMapping(value = "/jpInverterYearReportExport", method = RequestMethod.POST)
@ApiOperation(httpMethod = "GET", value = "逆变器年报表导出", notes = "逆变器年报表导出") @ApiOperation(httpMethod = "GET", value = "逆变器年报表导出", notes = "逆变器年报表导出")
public void jpInverterYearReportExport(@RequestParam(required = false) String time,@RequestParam(required = false) String snCodes, HttpServletResponse response) { public void jpInverterYearReportExport(@RequestBody(required = false) DataDto dataDto, HttpServletResponse response) {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto()); List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto());
List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList()); List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList());
if(StringUtils.isEmpty(time)){ if(StringUtils.isEmpty(dataDto.getTime())){
time = DateUtil.format(new Date(),"yyyy"); dataDto.setTime(DateUtil.format(new Date(),"yyyy-MM-dd"));
} }
List<String> dd= snCodes!=null? JSON.parseArray(snCodes,String.class):null; // List<String> dd= snCodes!=null? JSON.parseArray(snCodes,String.class):null;
List<TdHYGFInverterYearGenerate> tdHYGFInverterYearGenerates =jpInverterServiceImpl.jpInverterYearReportExport(time,dd,stationIds); List<TdHYGFInverterYearGenerate> tdHYGFInverterYearGenerates =jpInverterServiceImpl.jpInverterYearReportExport(dataDto.getTime(),dataDto.getSnCodes(),stationIds);
try { try {
setResponseHeadForDowload(response,"逆变器年报表.xls"); setResponseHeadForDowload(response,"逆变器年报表.xls");
EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterYearGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器年报表").doWrite(tdHYGFInverterYearGenerates); EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterYearGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器年报表").doWrite(tdHYGFInverterYearGenerates);
...@@ -390,12 +410,13 @@ public class JpInverterController extends BaseController { ...@@ -390,12 +410,13 @@ public class JpInverterController extends BaseController {
public ResponseModel<JpInverterDto> selectOneBySnCode(@PathVariable String snCode) { public ResponseModel<JpInverterDto> selectOneBySnCode(@PathVariable String snCode) {
LambdaQueryWrapper<JpInverter> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<JpInverter> query = new LambdaQueryWrapper<>();
query.eq(JpInverter::getSnCode,snCode); query.eq(JpInverter::getSnCode,snCode);
JpInverter jpInverter = jpInverterServiceImpl.getBaseMapper().selectOne(query); query.orderByDesc(JpInverter::getUpdateTime);
JpInverter jpInverter = jpInverterServiceImpl.getBaseMapper().selectList(query).get(0);
jpInverter.setDayPowerGeneration(jpInverter.getDayPowerGeneration()!=null?jpInverter.getDayPowerGeneration()/1000:0); jpInverter.setDayPowerGeneration(jpInverter.getDayPowerGeneration()!=null?Double.valueOf(String.format("%.3f",jpInverter.getDayPowerGeneration())):0);
jpInverter.setMonthPowerGeneration(jpInverter.getMonthPowerGeneration()!=null?jpInverter.getMonthPowerGeneration()/1000:0); jpInverter.setMonthPowerGeneration(jpInverter.getMonthPowerGeneration()!=null?Double.valueOf(String.format("%.3f",jpInverter.getMonthPowerGeneration())):0);
jpInverter.setYearPowerGeneration(jpInverter.getYearPowerGeneration()!=null?jpInverter.getYearPowerGeneration()/1000:0); jpInverter.setYearPowerGeneration(jpInverter.getYearPowerGeneration()!=null?Double.valueOf(String.format("%.3f",jpInverter.getYearPowerGeneration())):0);
jpInverter.setTotalPowerGeneration(jpInverter.getTotalPowerGeneration()!=null?jpInverter.getTotalPowerGeneration()/1000:0); jpInverter.setTotalPowerGeneration(jpInverter.getTotalPowerGeneration()!=null? Double.valueOf(String.format("%.3f",jpInverter.getTotalPowerGeneration()/1000)) :0);
JpInverterDto jpInverterDto = new JpInverterDto(); JpInverterDto jpInverterDto = new JpInverterDto();
...@@ -404,6 +425,7 @@ public class JpInverterController extends BaseController { ...@@ -404,6 +425,7 @@ public class JpInverterController extends BaseController {
wrapper.eq(BaseEntity::getIsDelete, false); wrapper.eq(BaseEntity::getIsDelete, false);
List<JpCollector> jpCollector = jpCollectorService.getBaseMapper().selectList(wrapper); List<JpCollector> jpCollector = jpCollectorService.getBaseMapper().selectList(wrapper);
String[] names = new String[]{"PV1","PV2","PV3","PV4"}; String[] names = new String[]{"PV1","PV2","PV3","PV4"};
List<String> list = Arrays.asList(names); List<String> list = Arrays.asList(names);
...@@ -414,9 +436,14 @@ public class JpInverterController extends BaseController { ...@@ -414,9 +436,14 @@ public class JpInverterController extends BaseController {
List<JpInverterElectricity> jpInverterElectricities = jpInverterElectricityService.getBaseMapper().selectList(queryWrapper); List<JpInverterElectricity> jpInverterElectricities = jpInverterElectricityService.getBaseMapper().selectList(queryWrapper);
Map<String, List<JpInverterElectricity>> collect = jpInverterElectricities.stream().collect(Collectors.groupingBy(JpInverterElectricity::getType)); Map<String, List<JpInverterElectricity>> collect = jpInverterElectricities.stream().collect(Collectors.groupingBy(JpInverterElectricity::getType));
jpInverterDto.setZL(collect.get("直流")); jpInverterDto.setZL(collect.get("直流"));
jpInverterDto.setJL(collect.get("交流")); jpInverterDto.setJL(collect.get("交流"));
jpInverterDto.setDirectCurrent(collect.get("直流"));
jpInverterDto.setInterflow(collect.get("交流"));
BeanUtils.copyProperties(jpInverter,jpInverterDto); BeanUtils.copyProperties(jpInverter,jpInverterDto);
jpInverterDto.setJpCollectors(jpCollector); jpInverterDto.setJpCollectors(jpCollector);
......
...@@ -75,7 +75,7 @@ public class JpStationController extends BaseController { ...@@ -75,7 +75,7 @@ public class JpStationController extends BaseController {
private static String ZX="在线"; private static String ZX="在线";
private static String LX="离线"; private static String LX="离线";
private static String BJ="报警"; private static String BJ="报警";
private static int FDXSS=1000;
/** /**
* 新增第三方场站 * 新增第三方场站
* *
...@@ -177,6 +177,7 @@ public class JpStationController extends BaseController { ...@@ -177,6 +177,7 @@ public class JpStationController extends BaseController {
String name = jpInverter.stream().map(JpInverter::getSnCode).collect(Collectors.joining(",")); String name = jpInverter.stream().map(JpInverter::getSnCode).collect(Collectors.joining(","));
jpStationDto.setNbsn(name); jpStationDto.setNbsn(name);
jpStationDto.setCjsn(names); jpStationDto.setCjsn(names);
jpStationDto.setCapacity(jpStationDto.getCapacity());
jpStationDto.setRegionalCompaniesName(personnelBusiness.getRegionalCompaniesName()); jpStationDto.setRegionalCompaniesName(personnelBusiness.getRegionalCompaniesName());
return ResponseHelper.buildResponse(jpStationDto); return ResponseHelper.buildResponse(jpStationDto);
} }
...@@ -457,7 +458,12 @@ public class JpStationController extends BaseController { ...@@ -457,7 +458,12 @@ public class JpStationController extends BaseController {
JpStationDto jpStation= jpStationMapper.getCountJpStationdata(reviewDto); JpStationDto jpStation= jpStationMapper.getCountJpStationdata(reviewDto);
List<Map<String,Object>> powerRatio=new ArrayList<>(); List<Map<String,Object>> powerRatio=new ArrayList<>();
Map<String,Object> map=new HashMap<>(); Map<String,Object> map=new HashMap<>();
map.put("value",String.format("%.2f",jpStation.getRealTimePower()/jpStation.getRatedPower())); if(jpStation!=null&&jpStation.getRealTimePower()!=null&&jpStation.getRatedPower()!=null&&jpStation.getRatedPower()>0){
map.put("value",String.format("%.4f",jpStation.getRealTimePower()/(jpStation.getCapacity()*FDXSS)));
}else{
jpStation=new JpStationDto();
map.put("value",0);
}
powerRatio.add(map); powerRatio.add(map);
jpStation.setPowerRatio(powerRatio); jpStation.setPowerRatio(powerRatio);
List<JpStationDto> list=new ArrayList<>(); List<JpStationDto> list=new ArrayList<>();
...@@ -492,13 +498,13 @@ public class JpStationController extends BaseController { ...@@ -492,13 +498,13 @@ public class JpStationController extends BaseController {
Map<String,Object> map=new HashMap<>(); Map<String,Object> map=new HashMap<>();
DecimalFormat format2 = new DecimalFormat("0.00"); DecimalFormat format2 = new DecimalFormat("0.00");
//炭 //炭
map.put("carbon",format2.format(jpStation.getAccumulatedPower()*CARBON)); map.put("carbon",format2.format(jpStation.getAccumulatedPower()*FDXSS*CARBON));
//硫 //硫
map.put("sulfur",format2.format(jpStation.getAccumulatedPower()*SULFUR)); map.put("sulfur",format2.format(jpStation.getAccumulatedPower()*FDXSS*SULFUR));
//粉尘 //粉尘
map.put("dust",format2.format(jpStation.getAccumulatedPower()*DUST)); map.put("dust",format2.format(jpStation.getAccumulatedPower()*FDXSS*DUST));
//煤 //煤
map.put("coal",format2.format(jpStation.getAccumulatedPower()*COAL)); map.put("coal",format2.format(jpStation.getAccumulatedPower()*FDXSS*COAL));
itemList.add(map); itemList.add(map);
result.setCurrent(1); result.setCurrent(1);
result.setTotal(1); result.setTotal(1);
...@@ -520,7 +526,7 @@ public class JpStationController extends BaseController { ...@@ -520,7 +526,7 @@ public class JpStationController extends BaseController {
Map<String,Object> map=new HashMap<>(); Map<String,Object> map=new HashMap<>();
DecimalFormat format2 = new DecimalFormat("0.00"); DecimalFormat format2 = new DecimalFormat("0.000");
//炭 //炭
map.put("name1","实时功率(kW)"); map.put("name1","实时功率(kW)");
map.put("name2","组件总容量(MWp)"); map.put("name2","组件总容量(MWp)");
...@@ -531,7 +537,7 @@ public class JpStationController extends BaseController { ...@@ -531,7 +537,7 @@ public class JpStationController extends BaseController {
Map<String,Object> map2=new HashMap<>(); Map<String,Object> map2=new HashMap<>();
map2.put("name1","当日电量(kWh)"); map2.put("name1","当日电量(MWh)");
map2.put("name2","当日收益(元)"); map2.put("name2","当日收益(元)");
//炭 //炭
map2.put("value1",format2.format(jpStation.getDayGenerate())); map2.put("value1",format2.format(jpStation.getDayGenerate()));
...@@ -548,9 +554,9 @@ public class JpStationController extends BaseController { ...@@ -548,9 +554,9 @@ public class JpStationController extends BaseController {
map4.put("name1","累计电量(MWh)"); map4.put("name1","累计电量(MWh)");
map4.put("name2","累计收益(万元)"); map4.put("name2","累计收益(万元)");
//炭 //炭
map4.put("value1",format2.format(jpStation.getYearGenerate())); map4.put("value1",format2.format(jpStation.getAccumulatedPower()));
//硫 //硫
map4.put("value2",format2.format(jpStation.getYearIncome())); map4.put("value2",format2.format(jpStation.getCumulativeIncome()));
date.add(map); date.add(map);
date.add(map2); date.add(map2);
...@@ -674,10 +680,10 @@ public class JpStationController extends BaseController { ...@@ -674,10 +680,10 @@ public class JpStationController extends BaseController {
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/queryReport") @PostMapping (value = "/queryReport")
@ApiOperation(httpMethod = "GET",value = "场站报表", notes = "场站报表") @ApiOperation(httpMethod = "POST",value = "场站报表", notes = "场站报表")
public ResponseModel<Page<JpStationDto>> queryReport(@RequestParam(value = "current") int current, @RequestParam public ResponseModel<Page<JpStationDto>> queryReport(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size, JpStationDto reviewDto,String type) { (value = "size") int size,@RequestBody JpStationDto reviewDto,@RequestParam(value = "type") String type) {
Page<JpStationDto> page=jpStationServiceImpl.queryReport(current,size,reviewDto,type); Page<JpStationDto> page=jpStationServiceImpl.queryReport(current,size,reviewDto,type);
...@@ -705,11 +711,11 @@ public class JpStationController extends BaseController { ...@@ -705,11 +711,11 @@ public class JpStationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/jpstationReportExport", method = RequestMethod.GET) @RequestMapping(value = "/jpstationReportExport", method = RequestMethod.POST)
@ApiOperation(httpMethod = "GET", value = "电站报表导出", notes = "电站报表导出") @ApiOperation(httpMethod = "POST", value = "电站报表导出", notes = "电站报表导出")
public void jpstationReportExport( HttpServletResponse response,JpStationDto reviewDto,String type) { public void jpstationReportExport( HttpServletResponse response,@RequestBody JpStationDto reviewDto,@RequestParam(value = "type")String type) {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto()); // List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto());
List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList()); // List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList());
List<JpStationDto> jpStationDtos = jpStationServiceImpl.selectReportDate(reviewDto, type,response); List<JpStationDto> jpStationDtos = jpStationServiceImpl.selectReportDate(reviewDto, type,response);
// try { // try {
......
package com.yeejoin.amos.boot.module.hygf.biz.controller; package com.yeejoin.amos.boot.module.hygf.biz.controller;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits; import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpPersonStation; import com.yeejoin.amos.boot.module.hygf.api.entity.JpPersonStation;
...@@ -17,10 +19,9 @@ import io.swagger.annotations.Api; ...@@ -17,10 +19,9 @@ import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.ArrayList; import java.text.ParseException;
import java.util.HashMap; import java.text.SimpleDateFormat;
import java.util.List; import java.util.*;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.TdHygfJpInverterWarnServiceImpl; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.TdHygfJpInverterWarnServiceImpl;
...@@ -244,18 +245,27 @@ public class TdHygfJpInverterWarnController extends BaseController { ...@@ -244,18 +245,27 @@ public class TdHygfJpInverterWarnController extends BaseController {
@RequestParam(required = false) String maxValue, @RequestParam(required = false) String maxValue,
@RequestParam(required = false) String snCode, @RequestParam(required = false) String snCode,
@RequestParam(required = false) List<String> stationId, @RequestParam(required = false) List<String> stationId,
@RequestParam(required = false) List<String> time, @RequestParam(required = false) String[] time,
@RequestParam(required = false) Integer current, @RequestParam(required = false) Integer current,
@RequestParam(required = false) Integer size, @RequestParam(required = false) Integer size,
@RequestParam(required = false) String content) { @RequestParam(required = false) String content) {
Page<TdHygfJpInverterWarnDto> result = new Page<>(); Page<TdHygfJpInverterWarnDto> result = new Page<>();
result.setCurrent(current);
result.setSize(size);
JpStationDto reviewDto = new JpStationDto(); JpStationDto reviewDto = new JpStationDto();
Map<String, String> nameMaps = new HashMap<>(); Map<String, String> nameMaps = new HashMap<>();
if (null != stationName){ if (null != stationName && stationName != ""){
reviewDto.setName(stationName); reviewDto.setName(stationName);
} }
List<JpStation> jpStation = jpStationMapper.getJpStation(reviewDto); List<JpStation> jpStation = jpStationMapper.getJpStation(reviewDto);
if (CollectionUtil.isEmpty(jpStation)){
result.setTotal(0);
List<TdHygfJpInverterWarnDto> list = new ArrayList<>();
result.setRecords(list);
return ResponseHelper.buildResponse(result);
}
nameMaps = jpStation.stream().collect(Collectors.toMap(JpStation::getThirdStationId, JpStation::getName)); nameMaps = jpStation.stream().collect(Collectors.toMap(JpStation::getThirdStationId, JpStation::getName));
if (null == stationId ){ if (null == stationId ){
...@@ -264,8 +274,14 @@ public class TdHygfJpInverterWarnController extends BaseController { ...@@ -264,8 +274,14 @@ public class TdHygfJpInverterWarnController extends BaseController {
String startTime =""; String startTime ="";
String endTime = ""; String endTime = "";
if (null != time){ if (null != time){
startTime = time.get(0);
endTime = time.get(1); try {
startTime = String.valueOf( DateUtils.dateParse(time[0].replace("[",""), null).getTime());
Date date = DateUtils.dateParse(time[1].replace("]", ""), null);
endTime = String.valueOf(DateUtils.dateAddDays(date,1).getTime());
} catch (ParseException e) {
e.printStackTrace();
}
} }
if (StringUtils.isNotEmpty(snCode)){ if (StringUtils.isNotEmpty(snCode)){
snCode = '%'+snCode+'%'; snCode = '%'+snCode+'%';
...@@ -281,8 +297,7 @@ public class TdHygfJpInverterWarnController extends BaseController { ...@@ -281,8 +297,7 @@ public class TdHygfJpInverterWarnController extends BaseController {
map.setTimeLongFormat(TimeUtil map.setTimeLongFormat(TimeUtil
.longFormat(map.getTimeLong())); .longFormat(map.getTimeLong()));
} }
result.setCurrent(current);
result.setSize(size);
result.setTotal(tdHygfJpInverterWarnServiceImpl.selectWarnListTotal(state, level, minvalue, maxValue, snCode, stationId, startTime, endTime, content)); result.setTotal(tdHygfJpInverterWarnServiceImpl.selectWarnListTotal(state, level, minvalue, maxValue, snCode, stationId, startTime, endTime, content));
result.setRecords(maps); result.setRecords(maps);
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
......
...@@ -104,7 +104,14 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -104,7 +104,14 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
} }
public Map<String,Object> selectDayTrend(List<JSONObject>treeParams, String time, String snCode, String thirdStationId) { public Map<String,Object> selectDayTrend(List<JSONObject>treeParams, String time, String snCode, String thirdStationId) {
List<String> key = treeParams.stream().map(e -> e.get("key").toString().replace("_","")).collect(Collectors.toList()); List<String> key = new ArrayList<>();
treeParams.forEach(a->{
if (a.get("key").toString().startsWith("acc")||a.get("key").toString().startsWith("acv")||a.get("key").toString().startsWith("pv")){
key.add(a.get("key").toString().replace("_",""));
}else {
key.add(a.get("key").toString());
}
});
List<Map<String,Object>> tdHYGFInverterDayGenerates = tdHYGFInverterDayGenerateMapper.selectDayTrend(key, time, snCode, thirdStationId); List<Map<String,Object>> tdHYGFInverterDayGenerates = tdHYGFInverterDayGenerateMapper.selectDayTrend(key, time, snCode, thirdStationId);
List<String> zData = new ArrayList<>(); List<String> zData = new ArrayList<>();
tdHYGFInverterDayGenerates.forEach(e->zData.add(e.get("workstatus").toString()) ); tdHYGFInverterDayGenerates.forEach(e->zData.add(e.get("workstatus").toString()) );
...@@ -113,8 +120,10 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -113,8 +120,10 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
List<String> value = new ArrayList<>(); List<String> value = new ArrayList<>();
for (Map<String, Object> obj : tdHYGFInverterDayGenerates) { for (Map<String, Object> obj : tdHYGFInverterDayGenerates) {
xData.add(obj.get("time").toString().substring(0,obj.get("time").toString().length()-4)); xData.add(obj.get("time").toString().substring(0,obj.get("time").toString().length()-4));
String key1 = treeParam.get("key").toString().replace("_",""); String key1 = treeParam.get("key").toString();
value.add(obj.get(key1).toString()); if (treeParam.get("key").toString().startsWith("acc")||treeParam.get("key").toString().startsWith("acv")||treeParam.get("key").toString().startsWith("pv")){
key1 =treeParam.get("key").toString().replace("_","");
} value.add(obj.get(key1).toString());
} }
treeParam.put("data",value); treeParam.put("data",value);
} }
...@@ -128,8 +137,12 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -128,8 +137,12 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
public Page<TdHYGFInverterDayGenerate> jpInverterDayReport(int current, int size, String time, List<String> sncodes, List<String> stationIds) { public Page<TdHYGFInverterDayGenerate> jpInverterDayReport(int current, int size, String time, List<String> sncodes, List<String> stationIds) {
Page<TdHYGFInverterDayGenerate> tdHYGFInverterDayGeneratePage = new Page<>(); Page<TdHYGFInverterDayGenerate> tdHYGFInverterDayGeneratePage = new Page<>();
Date date = DateUtil.parse(time, "yyyy-MM-dd"); Date date = DateUtil.parse(time, "yyyy-MM-dd");
String startTime = DateUtil.format(date, "yyyy-MM-dd") + "00:00:00"; Date timeStart = DateUtils.dateAddHours(date, -8);
String endTime = DateUtil.format(date, "yyyy-MM-dd") + "23:59:59"; Date tiemEnd = DateUtils.dateAddHours(date, 16);
String startTime = DateUtil.format(timeStart, "yyyy-MM-dd HH:mm:ss");
String endTime = DateUtil.format(tiemEnd, "yyyy-MM-dd HH:mm:ss");
//String startTime = DateUtil.format(date, "yyyy-MM-dd") + "00:00:00";
//String endTime = DateUtil.format(date, "yyyy-MM-dd") + "23:59:59";
QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterDayGenerate>() QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterDayGenerate>()
.ge("created_time", startTime) .ge("created_time", startTime)
.le("created_time", endTime) .le("created_time", endTime)
...@@ -148,6 +161,7 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -148,6 +161,7 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
tdHYGFInverterDayGenerates.forEach(tdHYGFInverterDayGenerate -> { tdHYGFInverterDayGenerates.forEach(tdHYGFInverterDayGenerate -> {
Date date1 = new Date(tdHYGFInverterDayGenerate.getCreatedTime()); Date date1 = new Date(tdHYGFInverterDayGenerate.getCreatedTime());
tdHYGFInverterDayGenerate.setCreatedTimeStr(DateUtil.format(date1, DatePattern.NORM_DATETIME_PATTERN)); tdHYGFInverterDayGenerate.setCreatedTimeStr(DateUtil.format(date1, DatePattern.NORM_DATETIME_PATTERN));
tdHYGFInverterDayGenerate.setTotalGen(tdHYGFInverterDayGenerate.getTotalGen() == null ? 0:Double.valueOf(String.format("%.3f",tdHYGFInverterDayGenerate.getTotalGen()/1000)));
}); });
tdHYGFInverterDayGeneratePage.setRecords(tdHYGFInverterDayGenerates); tdHYGFInverterDayGeneratePage.setRecords(tdHYGFInverterDayGenerates);
return tdHYGFInverterDayGeneratePage; return tdHYGFInverterDayGeneratePage;
...@@ -253,9 +267,10 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -253,9 +267,10 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
if (StringUtils.isNotBlank(jpInverter.getSnCode().trim())) { if (StringUtils.isNotBlank(jpInverter.getSnCode().trim())) {
item.put("name", jpInverter.getSnCode().trim()); item.put("name", jpInverter.getSnCode().trim());
item.put("value", jpInverter.getSnCode().trim()); item.put("value", jpInverter.getSnCode().trim());
}
result.add(item); result.add(item);
} }
}
return result; return result;
} }
...@@ -267,13 +282,13 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -267,13 +282,13 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
for (Map<String, Object> map : maps) { for (Map<String, Object> map : maps) {
xData.add(map.get("daytime").toString()); xData.add(map.get("daytime").toString());
value1.add(map.get("generate").toString()); value1.add(map.get("generate").toString());
value2.add(map.get("fullhour").toString()); value2.add(map.get("fullhour") == null?"0":String.format("%.2f",Double.valueOf(map.get("fullhour").toString())));
} }
List<Map<String, Object>> yData = new ArrayList<>(); List<Map<String, Object>> yData = new ArrayList<>();
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
Map<String,Object> map1 = new HashMap<>(); Map<String,Object> map1 = new HashMap<>();
map1.put("name","发电量"); map1.put("name","发电量");
map1.put("unit","kw"); map1.put("unit","kW");
map1.put("data",value1); map1.put("data",value1);
yData.add(map1); yData.add(map1);
Map<String,Object> map2 = new HashMap<>(); Map<String,Object> map2 = new HashMap<>();
...@@ -294,13 +309,13 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -294,13 +309,13 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
for (Map<String, Object> map : maps) { for (Map<String, Object> map : maps) {
xData.add(map.get("daytime").toString()); xData.add(map.get("daytime").toString());
value1.add(map.get("generate").toString()); value1.add(map.get("generate").toString());
value2.add(map.get("fullhour").toString()); value2.add(map.get("fullhour") == null?"0":String.format("%.2f",Double.valueOf(map.get("fullhour").toString())));
} }
List<Map<String, Object>> yData = new ArrayList<>(); List<Map<String, Object>> yData = new ArrayList<>();
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
Map<String,Object> map1 = new HashMap<>(); Map<String,Object> map1 = new HashMap<>();
map1.put("name","发电量"); map1.put("name","发电量");
map1.put("unit","kw"); map1.put("unit","kW");
map1.put("data",value1); map1.put("data",value1);
yData.add(map1); yData.add(map1);
Map<String,Object> map2 = new HashMap<>(); Map<String,Object> map2 = new HashMap<>();
...@@ -321,13 +336,13 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -321,13 +336,13 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
for (Map<String, Object> map : maps) { for (Map<String, Object> map : maps) {
xData.add(map.get("daytime").toString()); xData.add(map.get("daytime").toString());
value1.add(map.get("generate").toString()); value1.add(map.get("generate").toString());
value2.add(map.get("fullhour").toString()); value2.add(map.get("fullhour") == null?"0":String.format("%.2f",Double.valueOf(map.get("fullhour").toString())));
} }
List<Map<String, Object>> yData = new ArrayList<>(); List<Map<String, Object>> yData = new ArrayList<>();
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
Map<String,Object> map1 = new HashMap<>(); Map<String,Object> map1 = new HashMap<>();
map1.put("name","发电量"); map1.put("name","发电量");
map1.put("unit","kw"); map1.put("unit","kW");
map1.put("data",value1); map1.put("data",value1);
yData.add(map1); yData.add(map1);
Map<String,Object> map2 = new HashMap<>(); Map<String,Object> map2 = new HashMap<>();
...@@ -343,14 +358,22 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -343,14 +358,22 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
public Map<String,Object> jpInverterTotal(String snCode, String thirdStationId, String time, String date) { public Map<String,Object> jpInverterTotal(String snCode, String thirdStationId, String time, String date) {
if (date.equals("day")){ if (date.equals("day")){
return tdHYGFInverterMonthGenerateMapper.selectMonthTotal(time, snCode, thirdStationId); Map<String, Object> map = tdHYGFInverterMonthGenerateMapper.selectMonthTotal(time, snCode, thirdStationId);
map.put("fullhour",String.format("%.2f",Double.valueOf(map.get("fullhour").toString())));
return map;
}else if (date.equals("month")){ }else if (date.equals("month")){
return tdHYGFInverterYearGenerateMapper.selectYearTotal(time, snCode, thirdStationId); Map<String, Object> map = tdHYGFInverterYearGenerateMapper.selectYearTotal(time, snCode, thirdStationId);
map.put("fullhour",String.format("%.2f",Double.valueOf(map.get("fullhour").toString())));
return map;
}else if (date.equals("year")){ }else if (date.equals("year")){
List<TdHYGFInverterTotalGenerate> tdHYGFInverterTotalGenerates = tdHYGFInverterYearGenerateMapper.selectTotalSum(time, snCode, thirdStationId); List<TdHYGFInverterTotalGenerate> tdHYGFInverterTotalGenerates = tdHYGFInverterYearGenerateMapper.selectTotalSum(time, snCode, thirdStationId);
if (CollectionUtil.isNotEmpty(tdHYGFInverterTotalGenerates)){ if (CollectionUtil.isNotEmpty(tdHYGFInverterTotalGenerates)){
TdHYGFInverterTotalGenerate tdHYGFInverterTotalGenerate = tdHYGFInverterTotalGenerates.get(0); TdHYGFInverterTotalGenerate tdHYGFInverterTotalGenerate = tdHYGFInverterTotalGenerates.get(0);
return Bean.BeantoMap(tdHYGFInverterTotalGenerate) ;
Map<String, Object> map = Bean.BeantoMap(tdHYGFInverterTotalGenerate);
map.put("fullhour",String.format("%.2f",Double.valueOf(map.get("fullhour").toString())));
return map;
} }
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("fullhour",0); map.put("fullhour",0);
...@@ -363,7 +386,7 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -363,7 +386,7 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
double income = maps.stream().filter(e->null != e.getIncome() ).mapToDouble(TdHYGFInverterTotalGenerate::getIncome).sum(); double income = maps.stream().filter(e->null != e.getIncome() ).mapToDouble(TdHYGFInverterTotalGenerate::getIncome).sum();
double generate = maps.stream().mapToDouble(TdHYGFInverterTotalGenerate::getGenerate).sum(); double generate = maps.stream().mapToDouble(TdHYGFInverterTotalGenerate::getGenerate).sum();
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("fullhour",fullhour); map.put("fullhour",String.format("%.2f",fullhour));
map.put("income",income); map.put("income",income);
map.put("generate",generate); map.put("generate",generate);
return map; return map;
......
...@@ -61,6 +61,8 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -61,6 +61,8 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
@Autowired @Autowired
YearGenerateMapper yearGenerateMapper; YearGenerateMapper yearGenerateMapper;
private static double FDL=0.001;
private static int FD=1000;
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -213,16 +215,21 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -213,16 +215,21 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
if(type.equals("month")){ if(type.equals("month")){
map= getDayListOfMonth(reviewDto.getTimeDateMonth()); map= getDayListOfMonth(reviewDto.getTimeDateMonth());
data= dayGenerateMapper.getDayGeneratqx(reviewDto.getTimeDateMonth(), statioId); if(statioId!=null&&!statioId.isEmpty()) {
data = dayGenerateMapper.getDayGeneratqx(reviewDto.getTimeDateMonth(), statioId);
}
}else if(type.equals("year")){ }else if(type.equals("year")){
map= getyearListOfMonth(reviewDto.getTimeDateYear()); map= getyearListOfMonth(reviewDto.getTimeDateYear());
data= dayGenerateMapper.getMonthGenerateqx(reviewDto.getTimeDateYear(),statioId); if(statioId!=null&&!statioId.isEmpty()) {
data = dayGenerateMapper.getMonthGenerateqx(reviewDto.getTimeDateYear(), statioId);
}
}else{ }else{
map= getyearList(); map= getyearList();
data= dayGenerateMapper.getYearGenerateqx(null, statioId); if(statioId!=null&&!statioId.isEmpty()) {
data = dayGenerateMapper.getYearGenerateqx(null, statioId);
}
} }
listx =map.get("x"); listx =map.get("x");
listy =map.get("y"); listy =map.get("y");
if(data!=null&&!data.isEmpty()){ if(data!=null&&!data.isEmpty()){
...@@ -230,7 +237,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -230,7 +237,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
for (int i = 0; i < listx.size(); i++) { for (int i = 0; i < listx.size(); i++) {
if(datum.getDate().equals(listx.get(i).toString())){ if(datum.getDate().equals(listx.get(i).toString())){
listy.remove(i); listy.remove(i);
String format = datum.getNum()!=null?new DecimalFormat("0.000").format(datum.getNum()):null; String format = datum.getNum()!=null?new DecimalFormat("0.000").format(datum.getNum()*FDL):null;
listy.add(i,format); listy.add(i,format);
break; break;
} }
...@@ -382,7 +389,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -382,7 +389,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
} }
List<JpStation> dataJpStation= jpStationMapper.getJpStation(reviewDto); List<JpStation> dataJpStation= jpStationMapper.getJpStation(reviewDto);
if(reviewDto.getThirdStationIds()==null){ if(reviewDto.getThirdStationIds()==null||reviewDto.getThirdStationIds().isEmpty()){
for (JpStation jpStation : dataJpStation) { for (JpStation jpStation : dataJpStation) {
statioId.add(jpStation.getThirdStationId()); statioId.add(jpStation.getThirdStationId());
} }
...@@ -392,6 +399,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -392,6 +399,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
List<JpStationDto> list = null; List<JpStationDto> list = null;
int count=0; int count=0;
if(dataJpStation!=null&&dataJpStation.size()>0){
switch (type){ switch (type){
case"day": case"day":
LambdaQueryWrapper<DayGenerate> wapper = new LambdaQueryWrapper<DayGenerate>(); LambdaQueryWrapper<DayGenerate> wapper = new LambdaQueryWrapper<DayGenerate>();
...@@ -428,6 +436,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -428,6 +436,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
list = getJpStationDtoAlldto(listJ); list = getJpStationDtoAlldto(listJ);
} }
}
com.baomidou.mybatisplus.extension.plugins.pagination.Page<JpStationDto> pagenew = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<JpStationDto>(); com.baomidou.mybatisplus.extension.plugins.pagination.Page<JpStationDto> pagenew = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<JpStationDto>();
pagenew.setCurrent(pageNum); pagenew.setCurrent(pageNum);
pagenew.setTotal(count); pagenew.setTotal(count);
...@@ -452,10 +461,9 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -452,10 +461,9 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
hd.setStationContact(jpStation.getStationContact()); hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState()); hd.setState(jpStation.getState());
hd.setThirdStationId(jpStation.getThirdStationId()); hd.setThirdStationId(jpStation.getThirdStationId());
hd.setAccumulatedPower(jpStation.getAccumulatedPower()); hd.setAccumulatedPower(jpStation.getAccumulatedPower()!=null?Double.valueOf(String.format("%.3f",jpStation.getAccumulatedPower())):null);
hd.setFullhour(Double.valueOf(String.format("%.2f", jpStation.getAccumulatedPower()/jpStation.getCapacity()))); hd.setFullhour(Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower()*FD/jpStation.getCapacity())));
hd.setAccumulatedPower(jpStation.getAccumulatedPower()); hd.setCumulativeIncome(jpStation.getCumulativeIncome()!=null?Double.valueOf(String.format("%.3f",jpStation.getCumulativeIncome())):null);
hd.setCumulativeIncome(jpStation.getCumulativeIncome());
ld.add(hd); ld.add(hd);
} }
...@@ -473,9 +481,10 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -473,9 +481,10 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
hd.setUserName(jpStation.getUserName()); hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact()); hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState()); hd.setState(jpStation.getState());
hd.setAccumulatedPower(jpStation.getAccumulatedPower()); hd.setAccumulatedPower(jpStation.getAccumulatedPower()!=null?Double.valueOf(String.format("%.3f",jpStation.getAccumulatedPower()*FDL)):null);
hd.setFullhour(Double.valueOf(String.format("%.2f", jpStation.getAccumulatedPower()/jpStation.getCapacity()))); hd.setFullhour(Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower()/jpStation.getCapacity())));
hd.setCumulativeIncome(jpStation.getCumulativeIncome());
hd.setCumulativeIncome(jpStation.getCumulativeIncome()!=null?Double.valueOf(String.format("%.3f",jpStation.getCumulativeIncome())):null);
ld.add(hd); ld.add(hd);
} }
...@@ -493,12 +502,12 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -493,12 +502,12 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
hd.setUserName(jpStation.getUserName()); hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact()); hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState()); hd.setState(jpStation.getState());
hd.setAccumulatedPower(jpStation.getAccumulatedPower()); hd.setAccumulatedPower(jpStation.getAccumulatedPower()!=null?Double.valueOf(String.format("%.3f",jpStation.getAccumulatedPower()*FDL)):null);
hd.setThirdStationId(jpStation.getThirdStationId()); hd.setThirdStationId(jpStation.getThirdStationId());
hd.setFullhour(dayGenerate.getFullhour()!=null?Double.valueOf(String.format("%.2f",dayGenerate.getFullhour())):null); hd.setFullhour(dayGenerate.getFullhour()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getFullhour())):null);
hd.setDayGenerate(dayGenerate.getGenerate()); hd.setDayGenerate(dayGenerate.getGenerate()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getGenerate())):null);
hd.setTimeDate(dayGenerate.getDayTime()); hd.setTimeDate(dayGenerate.getDayTime());
hd.setDayIncome(dayGenerate.getDayIncome()); hd.setDayIncome(dayGenerate.getIncome()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getIncome())):null);
break; break;
} }
} }
...@@ -519,11 +528,11 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -519,11 +528,11 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
hd.setStationContact(jpStation.getStationContact()); hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState()); hd.setState(jpStation.getState());
hd.setThirdStationId(jpStation.getThirdStationId()); hd.setThirdStationId(jpStation.getThirdStationId());
hd.setAccumulatedPower(jpStation.getAccumulatedPower()); hd.setAccumulatedPower(jpStation.getAccumulatedPower()!=null?Double.valueOf(String.format("%.3f",jpStation.getAccumulatedPower()*FDL)):null);
hd.setMonthGenerate(dayGenerate.getGenerate()); hd.setMonthGenerate(dayGenerate.getGenerate()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getGenerate())):null);
hd.setMonthIncome(dayGenerate.getMonthIncome()); hd.setMonthIncome(dayGenerate.getIncome()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getIncome())):null);
hd.setTimeDate(dayGenerate.getMonthTime()); hd.setTimeDate(dayGenerate.getMonthTime());
hd.setFullhour(dayGenerate.getFullhour()!=null?Double.valueOf(String.format("%.2f",dayGenerate.getFullhour())):null); hd.setFullhour(dayGenerate.getFullhour()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getFullhour())):null);
break; break;
} }
} }
...@@ -543,11 +552,12 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -543,11 +552,12 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
hd.setUserName(jpStation.getUserName()); hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact()); hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState()); hd.setState(jpStation.getState());
hd.setAccumulatedPower(jpStation.getAccumulatedPower()); hd.setAccumulatedPower(jpStation.getAccumulatedPower()!=null?Double.valueOf(String.format("%.3f",jpStation.getAccumulatedPower()*FDL)):null);
hd.setThirdStationId(jpStation.getThirdStationId()); hd.setThirdStationId(jpStation.getThirdStationId());
hd.setFullhour(dayGenerate.getFullhour()!=null?Double.valueOf(String.format("%.2f",dayGenerate.getFullhour())):null); hd.setFullhour(dayGenerate.getFullhour()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getFullhour())):null);
hd.setYearGenerate(dayGenerate.getGenerate()); hd.setYearGenerate(dayGenerate.getGenerate()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getGenerate())):null);
hd.setYearIncome(dayGenerate.getYearIncome()); hd.setYearIncome(dayGenerate.getIncome()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getIncome())):null);
hd.setTimeDate(dayGenerate.getYearTime()); hd.setTimeDate(dayGenerate.getYearTime());
break; break;
} }
...@@ -567,7 +577,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -567,7 +577,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
reviewDto.setThirdStationIds(dd); reviewDto.setThirdStationIds(dd);
} }
List<JpStation> dataJpStation= jpStationMapper.getJpStation(reviewDto); List<JpStation> dataJpStation= jpStationMapper.getJpStation(reviewDto);
if(reviewDto.getThirdStationIds()==null){ if(reviewDto.getThirdStationIds()==null||reviewDto.getThirdStationIds().isEmpty()){
for (JpStation jpStation : dataJpStation) { for (JpStation jpStation : dataJpStation) {
statioId.add(jpStation.getThirdStationId()); statioId.add(jpStation.getThirdStationId());
} }
...@@ -577,50 +587,51 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -577,50 +587,51 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
List<JpStationDto> list = null; List<JpStationDto> list = null;
try { try {
if(dataJpStation!=null&&dataJpStation.size()>0) {
switch (type){ switch (type) {
case"day": case "day":
LambdaQueryWrapper<DayGenerate> wapper = new LambdaQueryWrapper<DayGenerate>(); LambdaQueryWrapper<DayGenerate> wapper = new LambdaQueryWrapper<DayGenerate>();
wapper.in(DayGenerate::getThirdStationId,reviewDto.getThirdStationIds()); wapper.in(DayGenerate::getThirdStationId, reviewDto.getThirdStationIds());
wapper.eq(reviewDto.getTimeDate()!=null,DayGenerate::getDayTime,reviewDto.getTimeDate()); wapper.eq(reviewDto.getTimeDate() != null, DayGenerate::getDayTime, reviewDto.getTimeDate());
List<DayGenerate> listday= dayGenerateMapper.selectList(wapper); List<DayGenerate> listday = dayGenerateMapper.selectList(wapper);
List<DayGenerateEX> listne = getJpStationDtodaynew( dataJpStation, listday); List<DayGenerateEX> listne = getJpStationDtodaynew(dataJpStation, listday);
setResponseHeadForDowload(response,"电站日报表.xls"); setResponseHeadForDowload(response, "电站日报表.xls");
EasyExcel.write(response.getOutputStream()).head(DayGenerateEX.class).excelType(ExcelTypeEnum.XLS).sheet("电站报表") EasyExcel.write(response.getOutputStream()).head(DayGenerateEX.class).excelType(ExcelTypeEnum.XLS).sheet("电站报表")
.doWrite(listne); .doWrite(listne);
break; break;
case"month": case "month":
LambdaQueryWrapper<MonthGenerate> wapper1 = new LambdaQueryWrapper<MonthGenerate>(); LambdaQueryWrapper<MonthGenerate> wapper1 = new LambdaQueryWrapper<MonthGenerate>();
wapper1.in(MonthGenerate::getThirdStationId,reviewDto.getThirdStationIds()); wapper1.in(MonthGenerate::getThirdStationId, reviewDto.getThirdStationIds());
wapper1.eq(reviewDto.getTimeDate()!=null,MonthGenerate::getMonthTime,reviewDto.getTimeDate()); wapper1.eq(reviewDto.getTimeDate() != null, MonthGenerate::getMonthTime, reviewDto.getTimeDate());
List<MonthGenerate> listmonth= monthGenerateMapper.selectList(wapper1); List<MonthGenerate> listmonth = monthGenerateMapper.selectList(wapper1);
List<MonthGenerateEX> lo = getJpStationDtomonthnew( dataJpStation, listmonth); List<MonthGenerateEX> lo = getJpStationDtomonthnew(dataJpStation, listmonth);
setResponseHeadForDowload(response,"电站月报表.xls"); setResponseHeadForDowload(response, "电站月报表.xls");
EasyExcel.write(response.getOutputStream()).head(MonthGenerateEX.class).excelType(ExcelTypeEnum.XLS).sheet("电站报表") EasyExcel.write(response.getOutputStream()).head(MonthGenerateEX.class).excelType(ExcelTypeEnum.XLS).sheet("电站报表")
.doWrite(lo); .doWrite(lo);
break; break;
case"year": case "year":
LambdaQueryWrapper<YearGenerate> wapper2 = new LambdaQueryWrapper<YearGenerate>(); LambdaQueryWrapper<YearGenerate> wapper2 = new LambdaQueryWrapper<YearGenerate>();
wapper2.in(YearGenerate::getThirdStationId,reviewDto.getThirdStationIds()); wapper2.in(YearGenerate::getThirdStationId, reviewDto.getThirdStationIds());
wapper2.eq(reviewDto.getTimeDate()!=null,YearGenerate::getYear,reviewDto.getTimeDate()); wapper2.eq(reviewDto.getTimeDate() != null, YearGenerate::getYear, reviewDto.getTimeDate());
List<YearGenerate> listyear= yearGenerateMapper.selectList(wapper2); List<YearGenerate> listyear = yearGenerateMapper.selectList(wapper2);
List<YearGenerateEX> listy = getJpStationDtoyearnew( dataJpStation, listyear); List<YearGenerateEX> listy = getJpStationDtoyearnew(dataJpStation, listyear);
setResponseHeadForDowload(response,"电站年报表.xls"); setResponseHeadForDowload(response, "电站年报表.xls");
EasyExcel.write(response.getOutputStream()).head(YearGenerateEX.class).excelType(ExcelTypeEnum.XLS).sheet("电站报表") EasyExcel.write(response.getOutputStream()).head(YearGenerateEX.class).excelType(ExcelTypeEnum.XLS).sheet("电站报表")
.doWrite(listy); .doWrite(listy);
break; break;
default: default:
list = getJpStationDtoAll(dataJpStation); list = getJpStationDtoAll(dataJpStation);
setResponseHeadForDowload(response,"电站累计报表.xls"); setResponseHeadForDowload(response, "电站累计报表.xls");
EasyExcel.write(response.getOutputStream()).head(JpStationDto.class).excelType(ExcelTypeEnum.XLS).sheet("电站报表") EasyExcel.write(response.getOutputStream()).head(JpStationDto.class).excelType(ExcelTypeEnum.XLS).sheet("电站报表")
.doWrite(list); .doWrite(list);
} }
}
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
...@@ -638,12 +649,12 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -638,12 +649,12 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
hd.setUserName(jpStation.getUserName()); hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact()); hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState()); hd.setState(jpStation.getState());
hd.setAccumulatedPower(jpStation.getAccumulatedPower()); hd.setAccumulatedPower(jpStation.getAccumulatedPower()!=null?Double.valueOf(String.format("%.3f",jpStation.getAccumulatedPower()*FDL)):null);
hd.setFullhour(dayGenerate.getFullhour()!=null?Double.valueOf(String.format("%.2f",dayGenerate.getFullhour())):null); hd.setFullhour(dayGenerate.getFullhour()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getFullhour())):null);
hd.setDayGenerate(dayGenerate.getGenerate()); hd.setDayGenerate(dayGenerate.getGenerate()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getGenerate())):null);
hd.setTimeDate(dayGenerate.getDayTime()); hd.setTimeDate(dayGenerate.getDayTime());
hd.setDayIncome(dayGenerate.getDayIncome()); hd.setDayIncome(dayGenerate.getIncome()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getIncome())):null);
break; break;
} }
} }
...@@ -662,11 +673,11 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -662,11 +673,11 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
hd.setName(jpStation.getName()); hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName()); hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact()); hd.setStationContact(jpStation.getStationContact());
hd.setAccumulatedPower(jpStation.getAccumulatedPower()); hd.setAccumulatedPower(jpStation.getAccumulatedPower()!=null?Double.valueOf(String.format("%.3f",jpStation.getAccumulatedPower()*FDL)):null);
hd.setMonthGenerate(dayGenerate.getGenerate()); hd.setMonthGenerate(dayGenerate.getGenerate()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getGenerate())):null);
hd.setMonthIncome(dayGenerate.getMonthIncome()); hd.setMonthIncome(dayGenerate.getIncome()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getIncome())):null);
hd.setTimeDate(dayGenerate.getMonthTime()); hd.setTimeDate(dayGenerate.getMonthTime());
hd.setFullhour(dayGenerate.getFullhour()!=null?Double.valueOf(String.format("%.2f",dayGenerate.getFullhour())):null); hd.setFullhour(dayGenerate.getFullhour()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getFullhour())):null);
break; break;
} }
} }
...@@ -685,11 +696,11 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -685,11 +696,11 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
hd.setName(jpStation.getName()); hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName()); hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact()); hd.setStationContact(jpStation.getStationContact());
hd.setAccumulatedPower(jpStation.getAccumulatedPower()); hd.setAccumulatedPower(jpStation.getAccumulatedPower()!=null?Double.valueOf(String.format("%.3f",jpStation.getAccumulatedPower()*FDL)):null);
hd.setFullhour(dayGenerate.getFullhour()!=null?Double.valueOf(String.format("%.2f",dayGenerate.getFullhour())):null); hd.setFullhour(dayGenerate.getFullhour()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getFullhour())):null);
hd.setYearGenerate(dayGenerate.getGenerate()); hd.setYearGenerate(dayGenerate.getGenerate()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getGenerate())):null);
hd.setYearIncome(dayGenerate.getYearIncome()); hd.setYearIncome(dayGenerate.getIncome()!=null?Double.valueOf(String.format("%.3f",dayGenerate.getIncome())):null);
hd.setTimeDate(dayGenerate.getYearTime()); hd.setTimeDate(dayGenerate.getYearTime());
break; break;
} }
......
...@@ -42,44 +42,64 @@ ...@@ -42,44 +42,64 @@
"unit": "A" "unit": "A"
} }
] ]
}, {
"name": "直流功率",
"key": "pv",
"children": [
{"name":"直流功率PV1",
"key": "pv_1",
"unit": "kW"
},
{"name":"直流功率PV2",
"key": "pv_2",
"unit": "kW"
}, },
{"name":"直流功率PV3",
"key": "pv_3",
"unit": "kW"
},
{"name":"直流功率PV4",
"key": "pv_4",
"unit": "kW"
}
]},
{ {
"name": "U_交流电压", "name": "U_交流电压",
"key": "acv1", "key": "dcv1",
"unit": "V", "unit": "V",
"children": [ "children": [
] ]
}, },
{ {
"name": "V_交流电压", "name": "V_交流电压",
"key": "acv2", "key": "dcv2",
"unit": "V", "unit": "V",
"children": [ "children": [
] ]
}, { }, {
"name": "W_交流电压", "name": "W_交流电压",
"key": "acv3", "key": "dcv3",
"unit": "V", "unit": "V",
"children": [ "children": [
] ]
}, },
{ {
"name": "U_交流电流", "name": "U_交流电流",
"key": "acc1", "key": "dcc1",
"unit": "A", "unit": "A",
"children": [ "children": [
] ]
}, },
{ {
"name": "W_交流电流", "name": "W_交流电流",
"key": "acc3", "key": "dcc3",
"unit": "A", "unit": "A",
"children": [ "children": [
] ]
}, },
{ {
"name": "V_交流电流", "name": "V_交流电流",
"key": "acc2", "key": "dcc2",
"unit": "A", "unit": "A",
"children": [ "children": [
] ]
...@@ -94,24 +114,46 @@ ...@@ -94,24 +114,46 @@
{ {
"name": "总功率", "name": "总功率",
"key": "total_power", "key": "total_power",
"unit": "kWh",
"children": [ "children": [
] ]
}, },
{ {
"name": "当日电量", "name": "当日电量",
"key": "day_gen", "key": "day_gen",
"unit": "kWh",
"children": [ "children": [
] ]
}, },
{ {
"name": "累计电量", "name": "累计电量",
"key": "total_gen", "key": "total_gen",
"unit": "kWh",
"children": [ "children": [
] ]
}, },
{ {
"name": "IGBT温度", "name": "IGBT温度",
"key": "igbt_temp", "key": "igbt_temp",
"unit": "℃",
"children": [
]
},
{
"name": "直流母线电压",
"key": "zlmxdy",
"children": [
]
},
{
"name": "直流母线半电压",
"key": "zlmxbdy",
"children": [
]
},
{
"name": "绝缘阻抗实时值",
"key": "jyzkssz",
"children": [ "children": [
] ]
} }
......
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