Commit 4ad3d49b authored by chenzhao's avatar chenzhao

Merge branch 'developer' of http://36.40.66.175:5000/moa/amos-boot-biz into developer

parents f024f5b9 1f83529b
package com.yeejoin.amos.boot.module.hygf.api.dto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModelProperty;
/**
* @description:
* @author: tw
* @createDate: 2023/11/20
*/
public class DayGenerateEX {
@ExcelProperty(value = "电站编码", index = 0)
@ApiModelProperty(value = "电站编码")
private String code;
@ExcelProperty(value = "电站名称", index = 1)
@ApiModelProperty(value = "电站名称")
private String name;
@ExcelProperty(value = "时间", index = 2)
String timeDate;
@ExcelProperty(value = "业主姓名", index = 3)
@ApiModelProperty(value = "业主姓名")
private String userName;
@ExcelProperty(value = "电站联系人", index = 4)
@ApiModelProperty(value = "电站联系人")
private String stationContact;
/**
* 满发小时数
*
* */
@ExcelProperty(value = "满发小时数", index = 5)
private Double fullhour;
@ExcelProperty(value = "日发电量", index = 6)
// 日发电量
private Double dayGenerate;
@ExcelProperty(value = "日收益", index = 7)
// 日收益
private Double dayIncome;
/**
* 累计发电量
*/
@ExcelProperty(value = "累计发电量", index = 8)
private Double accumulatedPower;
/**
* 状态
*/
@ExcelProperty(value = "状态", index = 9)
private String state;
}
package com.yeejoin.amos.boot.module.hygf.api.dto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpCollector;
......@@ -26,74 +28,77 @@ import java.util.Map;
public class JpStationDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ExcelIgnore
@ApiModelProperty(value = "sn编码")
private String snCode;
@ExcelIgnore
@ApiModelProperty(value = "装机容量")
private Double capacity;
@ExcelProperty(value = "电站名称", index = 1)
@ApiModelProperty(value = "电站名称")
private String name;
@ExcelProperty(value = "电站编码", index = 0)
@ApiModelProperty(value = "电站编码")
private String code;
@ExcelIgnore
@ApiModelProperty(value = "组织编码")
private String systemCode;
@ExcelIgnore
@ApiModelProperty(value = "接入平台时间")
private Date accessTime;
@ExcelIgnore
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ExcelIgnore
@ApiModelProperty(value = "地址")
private String address;
@ExcelIgnore
@ApiModelProperty(value = "经度")
private String longitude;
@ExcelIgnore
@ApiModelProperty(value = "维度")
private String latitude;
@ExcelIgnore
@ApiModelProperty(value = "上网电价")
private Double price;
@ExcelProperty(value = "业主姓名", index = 3)
@ApiModelProperty(value = "业主姓名")
private String userName;
@ExcelIgnore
@ApiModelProperty(value = "业主电话")
private String userPhone;
@ExcelProperty(value = "电站联系人", index = 4)
@ApiModelProperty(value = "电站联系人")
private String stationContact;
@ExcelIgnore
@ApiModelProperty(value = "组件数量")
private Integer moduleCount;
@ExcelIgnore
@ApiModelProperty(value = "并网类型")
private String onGridType;
@ExcelIgnore
@ApiModelProperty(value = "并网时间")
private Date onGridTime;
@ExcelIgnore
@ApiModelProperty(value = "第三方电站id")
private String thirdStationId;
@ApiModelProperty(value = "电站id")
private Long stationId;
@ExcelIgnore
@ApiModelProperty(value = "第三方厂商标识")
private String thirdCode;
/**
* 实时功率
*/
@ExcelIgnore
private Double realTimePower;
/**
* 累计发电量
*/
@ExcelProperty(value = "累计发电量", index = 6)
private Double accumulatedPower;
@ExcelIgnore
/**
* 状态
*/
......@@ -101,63 +106,77 @@ public class JpStationDto extends BaseDto {
/**
* 电站类型
*/
@ExcelIgnore
private String type;
/**
* 组织编码
*/
@ExcelIgnore
private String organizationalCode;
@ExcelIgnore
// 日发电量
private Double dayGenerate;
@ExcelIgnore
// 月发电量
private Double monthGenerate;
@ExcelIgnore
// 年发电量
private Double yearGenerate;
// 日收益
private Double dayIncome;
@ExcelIgnore
// 月收益
private Double monthIncome;
@ExcelIgnore
// 年收益
private Double yearIncome;
// 地区
@ExcelIgnore
private String area;
@ExcelIgnore
List<JpPersonStation> statioId;
@ExcelProperty(value = "累计收益", index = 7)
// 累计收益
private Double cumulativeIncome;
@ExcelIgnore
private Double dayPowerUse; // 日用电量
@ExcelIgnore
private Double monthPowerUse; // 月用电量
@ExcelIgnore
private Double yearPowerUse; // 年用电量
@ExcelIgnore
private int countBuiltNum;// 已建设场站数量
@ExcelIgnore
private int countNBuiltNum;// 未建设场站数量
@ExcelIgnore
List<JpInverter> jpInverter;
@ExcelIgnore
List<JpCollector> JpCollector;
// 时间
@ExcelIgnore
String dateType;
@ExcelIgnore
private String email;
@ExcelIgnore
private Double ratedPower;
@ExcelIgnore
private String regionalCompaniesCode;
@ExcelIgnore
private String regionalCompaniesName;
@ExcelIgnore
private String amosCompanyCode;
//场站id
@ExcelIgnore
private List<String> thirdStationIds;
@ExcelProperty(value = "时间", index = 2)
String timeDate;
/**
* 满发小时数
*
* */
@ExcelProperty(value = "满发小时数", index = 5)
private Double fullhour;
......@@ -165,11 +184,13 @@ public class JpStationDto extends BaseDto {
*
* 实时功率比/
* **/
@ExcelIgnore
List<Map<String,Object>> powerRatio;
@ExcelIgnore
String timeDateMonth;
@ExcelIgnore
String timeDateYear;
}
package com.yeejoin.amos.boot.module.hygf.api.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModelProperty;
/**
* @description:
* @author: tw
* @createDate: 2023/11/20
*/
public class MonthGenerateEX {
@ExcelProperty(value = "电站编码", index = 0)
@ApiModelProperty(value = "电站编码")
private String code;
@ExcelProperty(value = "电站名称", index = 1)
@ApiModelProperty(value = "电站名称")
private String name;
@ExcelProperty(value = "时间", index = 2)
String timeDate;
@ExcelProperty(value = "业主姓名", index = 3)
@ApiModelProperty(value = "业主姓名")
private String userName;
@ExcelProperty(value = "电站联系人", index = 4)
@ApiModelProperty(value = "电站联系人")
private String stationContact;
/**
* 满发小时数
*
* */
@ExcelProperty(value = "满发小时数", index = 5)
private Double fullhour;
// 月发电量
@ExcelProperty(value = "月发电量", index = 6)
private Double monthGenerate;
// 月收益
@ExcelProperty(value = "月收益", index = 7)
private Double monthIncome;
/**
* 累计发电量
*/
@ExcelProperty(value = "累计发电量", index = 8)
private Double accumulatedPower;
}
package com.yeejoin.amos.boot.module.hygf.api.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModelProperty;
/**
* @description:
* @author: tw
* @createDate: 2023/11/20
*/
public class YearGenerateEX {
@ExcelProperty(value = "电站编码", index = 0)
@ApiModelProperty(value = "电站编码")
private String code;
@ExcelProperty(value = "电站名称", index = 1)
@ApiModelProperty(value = "电站名称")
private String name;
@ExcelProperty(value = "时间", index = 2)
String timeDate;
@ExcelProperty(value = "业主姓名", index = 3)
@ApiModelProperty(value = "业主姓名")
private String userName;
@ExcelProperty(value = "电站联系人", index = 4)
@ApiModelProperty(value = "电站联系人")
private String stationContact;
/**
* 满发小时数
*
* */
@ExcelProperty(value = "满发小时数", index = 5)
private Double fullhour;
// 年发电量
@ExcelProperty(value = "年发电量", index = 6)
private Double yearGenerate;
// 年收益
@ExcelProperty(value = "年收益", index = 7)
private Double yearIncome;
/**
* 累计发电量
*/
@ExcelProperty(value = "累计发电量", index = 8)
private Double accumulatedPower;
}
......@@ -24,6 +24,8 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.net.URLEncoder;
import java.text.DecimalFormat;
import java.util.*;
......@@ -611,7 +613,7 @@ public class JpStationController extends BaseController {
return ResponseHelper.buildResponse(map);
}
@TycloudOperation(needAuth = false,ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "工率曲线", notes = "电站监控电量收益")
@GetMapping(value = "/getPowerqxnew")
public ResponseModel< Map<String, List<Object>>> getPowerqxnew(JpStationDto reviewDto,String date) {
......@@ -666,32 +668,22 @@ public class JpStationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/jpstationReportExport", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "电站报表导出", notes = "电站报表导出")
public void jpstationReportExport( @RequestParam(required = false)String time,@RequestParam(required = false) List<String> snCodes, HttpServletResponse response,String type) {
public void jpstationReportExport( HttpServletResponse response,JpStationDto reviewDto,String type) {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto());
List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList());
if(StringUtils.isEmpty(time)){
time = DateUtil.format(new Date(),"yyyy-MM-dd");
}
List<JpStationDto> jpStationDtos = jpStationServiceImpl.selectReportDate(time, snCodes, type);
try {
setResponseHeadForDowload(response,"电站报表.xls");
EasyExcel.write(response.getOutputStream()).head(JpStationDto.class).excelType(ExcelTypeEnum.XLS).sheet("电站报表").doWrite(jpStationDtos);
} catch (IOException e) {
throw new RuntimeException(e);
}
List<JpStationDto> jpStationDtos = jpStationServiceImpl.selectReportDate(reviewDto, type,response);
// try {
// setResponseHeadForDowload(response,"电站报表.xls");
// EasyExcel.write(response.getOutputStream()).head(JpStationDto.class).excelType(ExcelTypeEnum.XLS).sheet("电站报表")
//
// .doWrite(jpStationDtos);
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
}
public void setResponseHeadForDowload(HttpServletResponse response, String dowloadFileName) {
try {
response.setCharacterEncoding("UTF-8");
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(dowloadFileName, "UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
}
package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.support.ExcelTypeEnum;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -7,12 +9,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerCurveDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.ReviewDto;
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.mapper.JpStationMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IJpStationService;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.DayGenerateMapper;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.MonthGenerateMapper;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.MonthPowerMapper;
......@@ -26,6 +26,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import springfox.bean.validators.plugins.schema.MinMaxAnnotationPlugin;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -246,10 +250,11 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
}
@Override
@UserLimits
public Map<String, List<Object>> getPowerqxnew(String date,JpStationDto reviewDto) {
List<String> statioId=new ArrayList();
List<JpStation> dataJpStation= this.getJpStation(reviewDto);
List<JpStation> dataJpStation= jpStationMapper.getJpStation(reviewDto);
for (JpStation jpStation : dataJpStation) {
statioId.add(jpStation.getThirdStationId());
}
......@@ -273,8 +278,8 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
}
}
}
map.put("x",listx);
map.put("y",listy);
map.put("axisData",listx);
map.put("seriesData",listy);
return map;
}
......@@ -410,6 +415,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
break;
default:
count= reviewDto.getThirdStationIds()!=null?reviewDto.getThirdStationIds().size():0;
PageHelper.startPage(pageNum, pageSize);
List<JpStationDto> listJ= jpStationMapper.queryForDealerReviewPage(reviewDto);
......@@ -442,7 +448,6 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
hd.setFullhour(Double.valueOf(String.format("%.2f", jpStation.getAccumulatedPower()/jpStation.getCapacity())));
hd.setAccumulatedPower(jpStation.getAccumulatedPower());
hd.setCumulativeIncome(jpStation.getCumulativeIncome());
hd.setDayIncome(null);
ld.add(hd);
}
......@@ -462,7 +467,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
hd.setState(jpStation.getState());
hd.setAccumulatedPower(jpStation.getAccumulatedPower());
hd.setFullhour(Double.valueOf(String.format("%.2f", jpStation.getAccumulatedPower()/jpStation.getCapacity())));
hd.setAccumulatedPower(jpStation.getAccumulatedPower());
hd.setCumulativeIncome(jpStation.getCumulativeIncome());
ld.add(hd);
}
......@@ -543,42 +548,81 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
return ld;
}
public List<JpStationDto> selectReportDate(String time, List<String> snCodes,String type) {
@UserLimits
public List<JpStationDto> selectReportDate(JpStationDto reviewDto,String type,HttpServletResponse response) {
//权限
//权限
List<String> statioId=new ArrayList();
List<JpStation> dataJpStation= this.getJpStation(new JpStationDto());
List<JpStation> dataJpStation= jpStationMapper.getJpStation(reviewDto);
if(reviewDto.getThirdStationIds()==null){
for (JpStation jpStation : dataJpStation) {
statioId.add(jpStation.getThirdStationId());
}
reviewDto.setThirdStationIds(statioId);
}
List<JpStationDto> list = null;
try {
switch (type){
case"day":
LambdaQueryWrapper<DayGenerate> wapper = new LambdaQueryWrapper<DayGenerate>();
wapper.in(statioId!=null,DayGenerate::getThirdStationId,statioId);
wapper.eq(DayGenerate::getDayTime,time);
wapper.in(DayGenerate::getThirdStationId,reviewDto.getThirdStationIds());
wapper.eq(reviewDto.getTimeDate()!=null,DayGenerate::getDayTime,reviewDto.getTimeDate());
List<DayGenerate> listday= dayGenerateMapper.selectList(wapper);
list = getJpStationDtoday( dataJpStation, listday);
setResponseHeadForDowload(response,"电站日报表.xls");
EasyExcel.write(response.getOutputStream()).head(DayGenerateEX.class).excelType(ExcelTypeEnum.XLS).sheet("电站报表")
.doWrite(list);
break;
case"month":
LambdaQueryWrapper<MonthGenerate> wapper1 = new LambdaQueryWrapper<MonthGenerate>();
wapper1.in(statioId!=null,MonthGenerate::getThirdStationId,statioId);
wapper1.eq(MonthGenerate::getMonthTime,time);
wapper1.in(MonthGenerate::getThirdStationId,reviewDto.getThirdStationIds());
wapper1.eq(reviewDto.getTimeDate()!=null,MonthGenerate::getMonthTime,reviewDto.getTimeDate());
List<MonthGenerate> listmonth= monthGenerateMapper.selectList(wapper1);
list = getJpStationDtomonth( dataJpStation, listmonth);
setResponseHeadForDowload(response,"电站月报表.xls");
EasyExcel.write(response.getOutputStream()).head(MonthGenerateEX.class).excelType(ExcelTypeEnum.XLS).sheet("电站报表")
.doWrite(list);
break;
case"year":
LambdaQueryWrapper<YearGenerate> wapper2 = new LambdaQueryWrapper<YearGenerate>();
wapper2.in(statioId!=null,YearGenerate::getThirdStationId,statioId);
wapper2.eq(YearGenerate::getYear,time);
wapper2.in(YearGenerate::getThirdStationId,reviewDto.getThirdStationIds());
wapper2.eq(reviewDto.getTimeDate()!=null,YearGenerate::getYear,reviewDto.getTimeDate());
List<YearGenerate> listyear= yearGenerateMapper.selectList(wapper2);
list = getJpStationDtoyear( dataJpStation, listyear);
setResponseHeadForDowload(response,"电站年报表.xls");
EasyExcel.write(response.getOutputStream()).head(YearGenerateEX.class).excelType(ExcelTypeEnum.XLS).sheet("电站报表")
.doWrite(list);
break;
default:
list = getJpStationDtoAll(dataJpStation);
setResponseHeadForDowload(response,"电站累计报表.xls");
EasyExcel.write(response.getOutputStream()).head(JpStationDto.class).excelType(ExcelTypeEnum.XLS).sheet("电站报表")
.doWrite(list);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return list;
}
public void setResponseHeadForDowload(HttpServletResponse response, String dowloadFileName) {
try {
response.setCharacterEncoding("UTF-8");
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(dowloadFileName, "UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
}
\ No newline at end of file
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