Commit cf29606c authored by chenzhao's avatar chenzhao

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

parents 6784e9a8 715f3548
package com.yeejoin.amos.boot.module.hygf.api.entity; package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
...@@ -14,31 +16,40 @@ public class TdHYGFInverterMonthGenerate implements Serializable { ...@@ -14,31 +16,40 @@ public class TdHYGFInverterMonthGenerate implements Serializable {
/** /**
* 创建时间 * 创建时间
*/ */
@ExcelIgnore
private Long createdTime; private Long createdTime;
/** /**
* 第三方场站id * 第三方场站id
*/ */
@ExcelIgnore
private String thirdStationId; private String thirdStationId;
/** /**
* sncode
*/
private String snCode;
/**
*日 yyyy-MM-dd *日 yyyy-MM-dd
*/ */
@ExcelProperty("时间")
private String dayTime; private String dayTime;
/** /**
* sncode
*/
@ExcelProperty("SN")
private String snCode;
/**
*月 yyyy *月 yyyy
*/ */
@ExcelIgnore
private String yearMonth; private String yearMonth;
/** /**
* 发电量 * 发电量
*/ */
@ExcelProperty("日发电量(kWh)")
private Double generate; private Double generate;
/** /**
* 满发小时数 * 满发小时数
*/ */
@ExcelProperty("日满发小时数(h)")
private Double fullhour; private Double fullhour;
@ExcelIgnore
private Double income; private Double income;
} }
package com.yeejoin.amos.boot.module.hygf.api.entity; package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
...@@ -14,31 +16,40 @@ public class TdHYGFInverterYearGenerate implements Serializable { ...@@ -14,31 +16,40 @@ public class TdHYGFInverterYearGenerate implements Serializable {
/** /**
* 创建时间 * 创建时间
*/ */
@ExcelIgnore
private Long createdTime; private Long createdTime;
/** /**
* 第三方场站id * 第三方场站id
*/ */
@ExcelIgnore
private String thirdStationId; private String thirdStationId;
/** /**
* sncode
*/
private String snCode;
/**
*日 yyyy-MM *日 yyyy-MM
*/ */
@ExcelProperty("时间")
private String monthTime; private String monthTime;
/** /**
* sncode
*/
@ExcelProperty("SN")
private String snCode;
/**
*月 yyyy *月 yyyy
*/ */
@ExcelIgnore
private String year; private String year;
/** /**
* 发电量 * 发电量
*/ */
@ExcelProperty("月发电量(kWh)")
private Double generate; private Double generate;
/** /**
* 满发小时数 * 满发小时数
*/ */
@ExcelProperty("月满发小时数(h)")
private Double fullhour; private Double fullhour;
@ExcelIgnore
private Double income; private Double income;
} }
...@@ -7,8 +7,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -7,8 +7,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
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.dto.ReviewDto; import com.yeejoin.amos.boot.module.hygf.api.dto.ReviewDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation; import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterDayGenerate;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpStationServiceImpl; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpStationServiceImpl;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -40,7 +39,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -40,7 +39,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpCollectorDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpCollectorDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpInverterDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpInverterDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpPersonStation;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpPersonStationMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.JpPersonStationMapper;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
...@@ -263,10 +261,10 @@ public class JpInverterController extends BaseController { ...@@ -263,10 +261,10 @@ public class JpInverterController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/jpInverterMonthReport") @GetMapping(value = "/jpInverterMonthReport")
@ApiOperation(httpMethod = "GET", value = "逆变器月报表", notes = "逆变器月报表") @ApiOperation(httpMethod = "GET", value = "逆变器月报表", notes = "逆变器月报表")
public ResponseModel<Page<TdHYGFInverterDayGenerate>> jpInverterMonthReport(@RequestParam(value = "current") int current, @RequestParam(value = "size") int size, String time, @RequestParam(required = false) List<String> snCodes) { public ResponseModel<Page<TdHYGFInverterYearGenerate>> jpInverterMonthReport(@RequestParam(value = "current") int current, @RequestParam(value = "size") int size, String time, @RequestParam(required = false) List<String> snCodes) {
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());
return ResponseHelper.buildResponse(jpInverterServiceImpl.jpInverterDayReport(current,size,time,snCodes,stationIds)); return ResponseHelper.buildResponse(jpInverterServiceImpl.jpInverterYearReport(current,size,time,snCodes,stationIds));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
...@@ -275,10 +273,10 @@ public class JpInverterController extends BaseController { ...@@ -275,10 +273,10 @@ public class JpInverterController extends BaseController {
public void jpInverterMonthReportExport( String time,@RequestParam(required = false) List<String> snCodes, HttpServletResponse response) { public void jpInverterMonthReportExport( String time,@RequestParam(required = false) List<String> snCodes, 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());
List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates =jpInverterServiceImpl.jpInverterDayReportExport(time,snCodes,stationIds); List<TdHYGFInverterMonthGenerate> tdHYGFInverterMonthGenerates =jpInverterServiceImpl.jpInverterMonthReportExport(time,snCodes,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(TdHYGFInverterMonthGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器月报表").doWrite(tdHYGFInverterMonthGenerates);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
...@@ -299,10 +297,10 @@ public class JpInverterController extends BaseController { ...@@ -299,10 +297,10 @@ public class JpInverterController extends BaseController {
public void jpInverterYearReportExport( String time,@RequestParam(required = false) List<String> snCodes, HttpServletResponse response) { public void jpInverterYearReportExport( String time,@RequestParam(required = false) List<String> snCodes, 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());
List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates =jpInverterServiceImpl.jpInverterDayReportExport(time,snCodes,stationIds); List<TdHYGFInverterYearGenerate> tdHYGFInverterYearGenerates =jpInverterServiceImpl.jpInverterYearReportExport(time,snCodes,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(TdHYGFInverterYearGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器年报表").doWrite(tdHYGFInverterYearGenerates);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
......
...@@ -185,6 +185,18 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -185,6 +185,18 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
return tdHYGFInverterMonthGeneratePage; return tdHYGFInverterMonthGeneratePage;
} }
public List<TdHYGFInverterMonthGenerate> jpInverterMonthReportExport( String time, List<String> sncodes, List<String> stationIds) {
QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterMonthGenerate>()
.eq("year_month", time)
.in("third_station_id", stationIds);
if (CollectionUtil.isNotEmpty(sncodes)) {
queryWrapper.in("sn_code", sncodes);
}
queryWrapper.orderByDesc("day_time");
List<TdHYGFInverterMonthGenerate> tdHYGFInverterMonthGenerates = tdHYGFInverterMonthGenerateMapper.selectList(queryWrapper);
return tdHYGFInverterMonthGenerates;
}
public Page<TdHYGFInverterYearGenerate> jpInverterYearReport(int current, int size, String time, List<String> sncodes, List<String> stationIds) { public Page<TdHYGFInverterYearGenerate> jpInverterYearReport(int current, int size, String time, List<String> sncodes, List<String> stationIds) {
Page<TdHYGFInverterYearGenerate> tdHYGFInverterYearGeneratePage = new Page<>(); Page<TdHYGFInverterYearGenerate> tdHYGFInverterYearGeneratePage = new Page<>();
QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterYearGenerate>() QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterYearGenerate>()
...@@ -202,6 +214,18 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -202,6 +214,18 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
tdHYGFInverterYearGeneratePage.setRecords(tdHYGFInverterYearGenerates); tdHYGFInverterYearGeneratePage.setRecords(tdHYGFInverterYearGenerates);
return tdHYGFInverterYearGeneratePage; return tdHYGFInverterYearGeneratePage;
} }
public List<TdHYGFInverterYearGenerate> jpInverterYearReportExport(String time, List<String> sncodes, List<String> stationIds) {
QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterYearGenerate>()
.eq("year", time)
.in("third_station_id", stationIds);
if (CollectionUtil.isNotEmpty(sncodes)) {
queryWrapper.in("sn_code", sncodes);
}
queryWrapper.orderByDesc("month_time");
List<TdHYGFInverterYearGenerate> tdHYGFInverterYearGenerates = tdHYGFInverterYearGenerateMapper.selectList(queryWrapper);
return tdHYGFInverterYearGenerates;
}
public List<Map<String, String>> getInverterSncodes(List<String> stationIds) { public List<Map<String, String>> getInverterSncodes(List<String> stationIds) {
List<Map<String, String>> result = new ArrayList<>(); List<Map<String, String>> result = new ArrayList<>();
QueryWrapper queryWrapper = new QueryWrapper<JpInverter>() QueryWrapper queryWrapper = new QueryWrapper<JpInverter>()
......
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