Commit 27ee5e69 authored by caotao's avatar caotao

1.逆变器月、年报表更行。

parent 3498e484
...@@ -24,13 +24,13 @@ public class TdHYGFInverterMonthGenerate implements Serializable { ...@@ -24,13 +24,13 @@ public class TdHYGFInverterMonthGenerate implements Serializable {
*/ */
private String snCode; private String snCode;
/** /**
*日 yyyy-MM *日 yyyy-MM-dd
*/ */
private String monthTime; private String dayTime;
/** /**
*月 yyyy *月 yyyy
*/ */
private String year; private String yearMonth;
/** /**
* 发电量 * 发电量
*/ */
...@@ -39,5 +39,6 @@ public class TdHYGFInverterMonthGenerate implements Serializable { ...@@ -39,5 +39,6 @@ public class TdHYGFInverterMonthGenerate implements Serializable {
* 满发小时数 * 满发小时数
*/ */
private Double fullhour; private Double fullhour;
private Double income;
} }
...@@ -26,7 +26,7 @@ public class TdHYGFInverterYearGenerate implements Serializable { ...@@ -26,7 +26,7 @@ public class TdHYGFInverterYearGenerate implements Serializable {
/** /**
*日 yyyy-MM *日 yyyy-MM
*/ */
private String yearTime; private String monthTime;
/** /**
*月 yyyy *月 yyyy
*/ */
...@@ -39,5 +39,6 @@ public class TdHYGFInverterYearGenerate implements Serializable { ...@@ -39,5 +39,6 @@ public class TdHYGFInverterYearGenerate implements Serializable {
* 满发小时数 * 满发小时数
*/ */
private Double fullhour; private Double fullhour;
private Double income;
} }
...@@ -4,6 +4,8 @@ import cn.hutool.core.date.DateUtil; ...@@ -4,6 +4,8 @@ import cn.hutool.core.date.DateUtil;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.support.ExcelTypeEnum; import com.alibaba.excel.support.ExcelTypeEnum;
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.ReviewDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation; import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterDayGenerate; 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;
...@@ -220,31 +222,78 @@ public class JpInverterController extends BaseController { ...@@ -220,31 +222,78 @@ public class JpInverterController extends BaseController {
// jpInverterServiceImpl. // jpInverterServiceImpl.
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getInverterSncodes") @GetMapping(value = "/getInverterSncodes")
@ApiOperation(httpMethod = "GET", value = "获取逆变器snCode", notes = "获取逆变器snCode") @ApiOperation(httpMethod = "GET", value = "获取逆变器snCode", notes = "获取逆变器snCode")
public ResponseModel<List<Map<String,String>>> getInverterSncodes() { public ResponseModel<List<Map<String,String>>> getInverterSncodes() {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(null); 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.getInverterSncodes(stationids)); return ResponseHelper.buildResponse(jpInverterServiceImpl.getInverterSncodes(stationIds));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/jpInverterDayReport") @GetMapping(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, String time, @RequestParam(required = false) List<String> snCodes) { public ResponseModel<Page<TdHYGFInverterDayGenerate>> jpInverterDayReport(@RequestParam(value = "current") int current, @RequestParam(value = "size") int size, String time, @RequestParam(required = false) List<String> snCodes) {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(null); 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.jpInverterDayReport(current,size,time,snCodes,stationIds));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/jpInverterDayReportExport", method = RequestMethod.GET) @RequestMapping(value = "/jpInverterDayReportExport", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "逆变器日报表导出", notes = "逆变器日报表导出") @ApiOperation(httpMethod = "GET", value = "逆变器日报表导出", notes = "逆变器日报表导出")
public void jpInverterDayReportExport( String time,@RequestParam(required = false) List<String> snCodes, HttpServletResponse response) { public void jpInverterDayReportExport( String time,@RequestParam(required = false) List<String> snCodes, HttpServletResponse response) {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(null); 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<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates =jpInverterServiceImpl.jpInverterDayReportExport(time,snCodes,stationIds);
try {
setResponseHeadForDowload(response,"逆变器日报表.xls");
EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterDayGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器日报表").doWrite(tdHYGFInverterDayGenerates);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/jpInverterMonthReport")
@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) {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto());
List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList());
return ResponseHelper.buildResponse(jpInverterServiceImpl.jpInverterDayReport(current,size,time,snCodes,stationIds));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/jpInverterMonthReportExport", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "逆变器月报表导出", notes = "逆变器月报表导出")
public void jpInverterMonthReportExport( String time,@RequestParam(required = false) List<String> snCodes, HttpServletResponse response) {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto());
List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList());
List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates =jpInverterServiceImpl.jpInverterDayReportExport(time,snCodes,stationIds);
try {
setResponseHeadForDowload(response,"逆变器日报表.xls");
EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterDayGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器日报表").doWrite(tdHYGFInverterDayGenerates);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/jpInverterYearReport")
@ApiOperation(httpMethod = "GET", value = "逆变器年报表", notes = "逆变器年报表")
public ResponseModel<Page<TdHYGFInverterDayGenerate>> jpInverterYearReport(@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<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList());
return ResponseHelper.buildResponse(jpInverterServiceImpl.jpInverterDayReport(current,size,time,snCodes,stationIds));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/jpInverterYearReportExport", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "逆变器年报表导出", notes = "逆变器年报表导出")
public void jpInverterYearReportExport( String time,@RequestParam(required = false) List<String> snCodes, HttpServletResponse response) {
List<JpStation> jpStation=jpStationServiceImpl.getJpStation(new JpStationDto());
List<String> stationIds = jpStation.stream().map(jpStation1 -> jpStation1.getThirdStationId()).collect(Collectors.toList());
List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates =jpInverterServiceImpl.jpInverterDayReportExport(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(TdHYGFInverterDayGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器日报表").doWrite(tdHYGFInverterDayGenerates);
......
...@@ -8,7 +8,11 @@ import cn.hutool.core.date.DateUtil; ...@@ -8,7 +8,11 @@ import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.entity.TdHYGFInverterDayGenerate; import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterDayGenerate;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterMonthGenerate;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHYGFInverterYearGenerate;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHYGFInverterDayGenerateMapper; import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHYGFInverterDayGenerateMapper;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHYGFInverterMonthGenerateMapper;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHYGFInverterYearGenerateMapper;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -34,6 +38,10 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -34,6 +38,10 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
implements IJpInverterService { implements IJpInverterService {
@Autowired @Autowired
TdHYGFInverterDayGenerateMapper tdHYGFInverterDayGenerateMapper; TdHYGFInverterDayGenerateMapper tdHYGFInverterDayGenerateMapper;
@Autowired
TdHYGFInverterMonthGenerateMapper tdHYGFInverterMonthGenerateMapper;
@Autowired
TdHYGFInverterYearGenerateMapper tdHYGFInverterYearGenerateMapper;
@Autowired @Autowired
JpInverterMapper jpInverterMapper; JpInverterMapper jpInverterMapper;
...@@ -136,6 +144,41 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -136,6 +144,41 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
return tdHYGFInverterDayGenerates; return tdHYGFInverterDayGenerates;
} }
public Page<TdHYGFInverterMonthGenerate> jpInverterMonthReport(int current, int size, String time, List<String> sncodes, List<String> stationIds) {
Page<TdHYGFInverterMonthGenerate> tdHYGFInverterMonthGeneratePage = new Page<>();
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");
queryWrapper.last(" limit "+(current-1)*size+","+(current*size));
List<TdHYGFInverterMonthGenerate> tdHYGFInverterMonthGenerates = tdHYGFInverterMonthGenerateMapper.selectList(queryWrapper);
tdHYGFInverterMonthGeneratePage.setTotal(tdHYGFInverterMonthGenerates.size());
tdHYGFInverterMonthGeneratePage.setSize(size);
tdHYGFInverterMonthGeneratePage.setCurrent(current);
tdHYGFInverterMonthGeneratePage.setRecords(tdHYGFInverterMonthGenerates);
return tdHYGFInverterMonthGeneratePage;
}
public Page<TdHYGFInverterYearGenerate> jpInverterYearReport(int current, int size, String time, List<String> sncodes, List<String> stationIds) {
Page<TdHYGFInverterYearGenerate> tdHYGFInverterYearGeneratePage = new Page<>();
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");
queryWrapper.last(" limit "+(current-1)*size+","+(current*size));
List<TdHYGFInverterYearGenerate> tdHYGFInverterYearGenerates = tdHYGFInverterYearGenerateMapper.selectList(queryWrapper);
tdHYGFInverterYearGeneratePage.setTotal(tdHYGFInverterYearGenerates.size());
tdHYGFInverterYearGeneratePage.setSize(size);
tdHYGFInverterYearGeneratePage.setCurrent(current);
tdHYGFInverterYearGeneratePage.setRecords(tdHYGFInverterYearGenerates);
return tdHYGFInverterYearGeneratePage;
}
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>()
...@@ -145,9 +188,9 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -145,9 +188,9 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
for (int i = 0; i < jpInverterList.size(); i++) { for (int i = 0; i < jpInverterList.size(); i++) {
JpInverter jpInverter = jpInverterList.get(i); JpInverter jpInverter = jpInverterList.get(i);
Map<String, String> item = new HashMap<>(); Map<String, String> item = new HashMap<>();
if (StringUtils.isNotEmpty(jpInverter.getSnCode())) { if (StringUtils.isNotEmpty(jpInverter.getSnCode().trim())) {
item.put("name", jpInverter.getSnCode()); item.put("name", jpInverter.getSnCode().trim());
item.put("value", jpInverter.getSnCode()); item.put("value", jpInverter.getSnCode().trim());
} }
result.add(item); result.add(item);
} }
......
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