Commit db469fb2 authored by hezhuozhi's avatar hezhuozhi

修复电站监控报表导出和展示不一致

parent 52925d5a
......@@ -11,9 +11,9 @@ import lombok.Data;
*/
@Data
public class DayGenerateEX {
@ExcelProperty(value = "电站编号", index = 0)
@ApiModelProperty(value = "电站编码")
private String code;
@ExcelProperty(value = "号", index = 0)
@ApiModelProperty(value = "序号")
private Integer index;
@ExcelProperty(value = "电站名称", index = 1)
@ApiModelProperty(value = "电站名称")
private String name;
......
......@@ -14,9 +14,9 @@ public class MonthGenerateEX {
@ExcelProperty(value = "电站编号", index = 0)
@ApiModelProperty(value = "电站编码")
private String code;
@ExcelProperty(value = "号", index = 0)
@ApiModelProperty(value = "序号")
private Integer index;
@ExcelProperty(value = "电站名称", index = 1)
@ApiModelProperty(value = "电站名称")
private String name;
......
......@@ -11,9 +11,9 @@ import lombok.Data;
*/
@Data
public class YearGenerateEX {
@ExcelProperty(value = "电站编号", index = 0)
@ApiModelProperty(value = "电站编码")
private String code;
@ExcelProperty(value = "号", index = 0)
@ApiModelProperty(value = "序号")
private Integer index;
@ExcelProperty(value = "电站名称", index = 1)
@ApiModelProperty(value = "电站名称")
private String name;
......
......@@ -288,7 +288,7 @@ public class JpInverterController extends BaseController {
dataDto.setTime(DateUtil.format(new Date(),"yyyy-MM-dd"));
}
//List<String> dd= snCodes!=null? JSON.parseArray(snCodes,String.class):null;
List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates =jpInverterServiceImpl.jpInverterDayReportExport(dataDto.getTime(),dataDto.getSnCodes(),null,dataDto.getRegionalCompaniesCode());
List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates =jpInverterServiceImpl.jpInverterDayReportExport(dataDto.getTime(),dataDto.getSnCodes(),null,dataDto.getRegionalCompaniesCode(), dataDto.getName());
try {
setResponseHeadForDowload(response,"逆变器日报表.xls");
EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterDayGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器日报表").doWrite(tdHYGFInverterDayGenerates);
......@@ -322,7 +322,7 @@ public class JpInverterController extends BaseController {
dataDto.setTime(DateUtil.format(new Date(),"yyyy-MM"));
}
// List<String> dd= snCodes!=null? JSON.parseArray(snCodes,String.class):null;
List<TdHYGFInverterMonthGenerate> tdHYGFInverterMonthGenerates =jpInverterServiceImpl.jpInverterMonthReportExport(dataDto.getTime(),dataDto.getSnCodes(),null,dataDto.getRegionalCompaniesCode());
List<TdHYGFInverterMonthGenerate> tdHYGFInverterMonthGenerates =jpInverterServiceImpl.jpInverterMonthReportExport(dataDto.getTime(),dataDto.getSnCodes(),null,dataDto.getRegionalCompaniesCode(),dataDto.getName());
try {
setResponseHeadForDowload(response,"逆变器月报表.xls");
EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterMonthGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器月报表").doWrite(tdHYGFInverterMonthGenerates);
......@@ -357,7 +357,7 @@ public class JpInverterController extends BaseController {
dataDto.setTime(DateUtil.format(new Date(),"yyyy"));
}
// List<String> dd= snCodes!=null? JSON.parseArray(snCodes,String.class):null;
List<TdHYGFInverterYearGenerate> tdHYGFInverterYearGenerates =jpInverterServiceImpl.jpInverterYearReportExport(dataDto.getTime(),dataDto.getSnCodes(),null,dataDto.getRegionalCompaniesCode());
List<TdHYGFInverterYearGenerate> tdHYGFInverterYearGenerates =jpInverterServiceImpl.jpInverterYearReportExport(dataDto.getTime(),dataDto.getSnCodes(),null,dataDto.getRegionalCompaniesCode(), dataDto.getName());
try {
setResponseHeadForDowload(response,"逆变器年报表.xls");
EasyExcel.write(response.getOutputStream()).head(TdHYGFInverterYearGenerate.class).excelType(ExcelTypeEnum.XLS).sheet("逆变器年报表").doWrite(tdHYGFInverterYearGenerates);
......
......@@ -246,21 +246,50 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
// return tdHYGFInverterDayGeneratePage;
}
@UserLimits
public List<TdHYGFInverterDayGenerate> jpInverterDayReportExport(String time, List<String> sncodes, List<String> stationIds,String regionalCompaniesCode) {
public List<TdHYGFInverterDayGenerate> jpInverterDayReportExport(String time, List<String> sncodes, List<String> stationIds,String regionalCompaniesCode,String name) {
Map<String, String> regionalCompaniesNameMap = getRegionalCompaniesNameMap();
Date date = DateUtil.parse(time, "yyyy-MM-dd");
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>()
.ge("created_time", startTime)
.le("created_time", endTime);
// .in("third_station_id", stationIds);
if (CollectionUtil.isNotEmpty(sncodes)) {
queryWrapper.in("sn_code", sncodes);
CharSequence time1 = time + " 00:00:00";
CharSequence time2 = time + " 23:59:59";
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String startTime = DateUtil.format(LocalDateTime.parse(time1,df), "yyyy-MM-dd HH:mm:ss");
String endTime = DateUtil.format(LocalDateTime.parse(time2,df), "yyyy-MM-dd HH:mm:ss");
// QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterDayGenerate>()
// .ge("created_time", startTime)
// .le("created_time", endTime);
//// .in("third_station_id", stationIds);
// ;
// if (CollectionUtil.isNotEmpty(sncodes)) {
// queryWrapper.in("sn_code", sncodes);
// }
// queryWrapper.orderByDesc("created_time");
//
// PageHelper.startPage(current, size);
// List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates = tdHYGFInverterDayGenerateMapper.selectList(queryWrapper);
List<Map<String, Object>> listData = tdHYGFInverterDayGenerateMapper.selectSnCodeList(startTime, endTime, sncodes);
List<String> snCodeList = new ArrayList<>();
List<String> maxCreatedTimeList = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
listData.stream().forEach(item -> {
if(item.get("sn_code") != null) {
snCodeList.add(item.get("sn_code").toString());
}
queryWrapper.eq(!StringUtils.isEmpty(regionalCompaniesCode),"regional_companies_code",regionalCompaniesCode);
queryWrapper.orderByDesc("created_time");
List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates = tdHYGFInverterDayGenerateMapper.selectList(queryWrapper);
if(item.get("max_created_time") != null) {
maxCreatedTimeList.add(sdf.format(item.get("max_created_time")));
}
});
if(StringUtils.isNotEmpty(name)) {
name = '%' + name + "%";
}
List<TdHYGFInverterDayGenerate> tdHYGFInverterDayGenerates = tdHYGFInverterDayGenerateMapper.selectListPage(snCodeList, null, startTime, endTime,regionalCompaniesCode, name);
tdHYGFInverterDayGenerates.forEach(tdHYGFInverterDayGenerate -> {
Date date1 = new Date(tdHYGFInverterDayGenerate.getCreatedTime());
tdHYGFInverterDayGenerate.setCreatedTimeStr(DateUtil.format(date1, DatePattern.NORM_DATETIME_PATTERN));
......@@ -324,15 +353,20 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
//// return tdHYGFInverterMonthGeneratePage;
}
@UserLimits
public List<TdHYGFInverterMonthGenerate> jpInverterMonthReportExport( String time, List<String> sncodes, List<String> stationIds,String regionalCompaniesCode) {
public List<TdHYGFInverterMonthGenerate> jpInverterMonthReportExport( String time, List<String> sncodes, List<String> stationIds,String regionalCompaniesCode,String name) {
Map<String, String> regionalCompaniesNameMap = getRegionalCompaniesNameMap();
QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterMonthGenerate>()
.eq("year_month", time);
// .in("third_station_id", stationIds);
if (CollectionUtil.isNotEmpty(sncodes)) {
queryWrapper.in("sn_code", sncodes);
}
if (StringUtils.isNotEmpty(name)) {
queryWrapper.like("name", "%" + name + "%");
}
queryWrapper.eq(!StringUtils.isEmpty(regionalCompaniesCode),"regional_companies_code",regionalCompaniesCode);
queryWrapper.orderByDesc("day_time");
List<TdHYGFInverterMonthGenerate> tdHYGFInverterMonthGenerates = tdHYGFInverterMonthGenerateMapper.selectList(queryWrapper);
tdHYGFInverterMonthGenerates.forEach(tdHYGFInverterMonthGenerate -> {
......@@ -390,7 +424,7 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
// return tdHYGFInverterYearGeneratePage;
}
@UserLimits
public List<TdHYGFInverterYearGenerate> jpInverterYearReportExport(String time, List<String> sncodes, List<String> stationIds,String regionalCompaniesCode) {
public List<TdHYGFInverterYearGenerate> jpInverterYearReportExport(String time, List<String> sncodes, List<String> stationIds,String regionalCompaniesCode,String name) {
Map<String, String> regionalCompaniesNameMap = getRegionalCompaniesNameMap();
QueryWrapper queryWrapper = new QueryWrapper<TdHYGFInverterYearGenerate>()
.eq("year", time);
......@@ -398,11 +432,15 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
if (CollectionUtil.isNotEmpty(sncodes)) {
queryWrapper.in("sn_code", sncodes);
}
if (StringUtils.isNotEmpty(name)) {
queryWrapper.like("name", "%" + name + "%");
}
queryWrapper.eq(!StringUtils.isEmpty(regionalCompaniesCode),"regional_companies_code",regionalCompaniesCode);
queryWrapper.orderByDesc("month_time");
List<TdHYGFInverterYearGenerate> tdHYGFInverterYearGenerates = tdHYGFInverterYearGenerateMapper.selectList(queryWrapper);
tdHYGFInverterYearGenerates.forEach(tdHYGFInverterYearGenerate -> {
tdHYGFInverterYearGenerate.setFullhour(tdHYGFInverterYearGenerate.getFullhour()!=null?Double.valueOf(String.format("%.2f",tdHYGFInverterYearGenerate.getFullhour())):null);
tdHYGFInverterYearGenerate.setGenerate(tdHYGFInverterYearGenerate.getGenerate()!=null?Double.valueOf(String.format("%.2f",tdHYGFInverterYearGenerate.getGenerate())):null);
tdHYGFInverterYearGenerate.setRegionalCompaniesName(regionalCompaniesNameMap.get(tdHYGFInverterYearGenerate.getRegionalCompaniesCode()));
});
return tdHYGFInverterYearGenerates;
......
......@@ -606,7 +606,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, J
hd.setState(jpStation.getState());
hd.setThirdStationId(jpStation.getThirdStationId());
hd.setAccumulatedPower(jpStation.getAccumulatedPower()!=null?Double.valueOf(String.format("%.3f",jpStation.getAccumulatedPower())):null);
hd.setFullhour(jpStation.getAccumulatedPower()!=null ? Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower()*FD/jpStation.getCapacity())):null);
hd.setFullhour(jpStation.getAccumulatedPower()!=null ? Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower()))*FD/jpStation.getCapacity():null);
hd.setCumulativeIncome(jpStation.getCumulativeIncome()!=null?Double.valueOf(String.format("%.3f",jpStation.getCumulativeIncome())):null);
hd.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
hd.setRegionalCompaniesName(regionalCompaniesNameMap.get(jpStation.getRegionalCompaniesCode()));
......@@ -889,25 +889,25 @@ public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, J
public List<DayGenerateEX> getJpStationDtodaynew( List<JpStation> da, List<DayGenerate> listday){
List<DayGenerateEX> ld=new ArrayList<>();
Map<String, String> regionalCompaniesNameMap = getRegionalCompaniesNameMap();
int i=0;
for (DayGenerate dayGenerate : listday) {
DayGenerateEX hd = new DayGenerateEX();
for (JpStation jpStation : da) {
if (jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())) {
hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact());
hd.setState(jpStation.getState());
hd.setAccumulatedPower(jpStation.getAccumulatedPower() != null ? Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower() * FDL)) : null);
break;
}
}
hd.setIndex(i++);
hd.setName(dayGenerate.getStationName());
hd.setState(dayGenerate.getStationState());
hd.setFullhour(dayGenerate.getFullhour() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getFullhour())) : null);
hd.setDayGenerate(dayGenerate.getGenerate() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getGenerate())) : null);
hd.setTimeDate(dayGenerate.getDayTime());
hd.setDayIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
hd.setRegionalCompaniesName(regionalCompaniesNameMap.get(dayGenerate.getRegionalCompaniesCode()));
break;
}
}
ld.add(hd);
}
return ld;
......@@ -916,23 +916,24 @@ public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, J
public List<MonthGenerateEX> getJpStationDtomonthnew(List<JpStation> da, List<MonthGenerate> listmonth) {
List<MonthGenerateEX> ld = new ArrayList<>();
Map<String, String> regionalCompaniesNameMap = getRegionalCompaniesNameMap();
int i=0;
for (MonthGenerate dayGenerate : listmonth) {
MonthGenerateEX hd = new MonthGenerateEX();
for (JpStation jpStation : da) {
if (jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())) {
hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact());
hd.setAccumulatedPower(jpStation.getAccumulatedPower() != null ? Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower() * FDL)) : null);
break;
}
}
hd.setIndex(i++);
hd.setName(dayGenerate.getStationName());
hd.setMonthGenerate(dayGenerate.getGenerate() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getGenerate())) : null);
hd.setMonthIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
hd.setTimeDate(dayGenerate.getMonthTime());
hd.setFullhour(dayGenerate.getFullhour() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getFullhour())) : null);
hd.setRegionalCompaniesName(regionalCompaniesNameMap.get(dayGenerate.getRegionalCompaniesCode()));
break;
}
}
ld.add(hd);
}
return ld;
......@@ -941,24 +942,25 @@ public class JpStationServiceImpl extends BaseService<JpStationDto, JpStation, J
public List<YearGenerateEX> getJpStationDtoyearnew(List<JpStation> da, List<YearGenerate> listyear) {
List<YearGenerateEX> ld = new ArrayList<>();
Map<String, String> regionalCompaniesNameMap = getRegionalCompaniesNameMap();
int i=0;
for (YearGenerate dayGenerate : listyear) {
YearGenerateEX hd = new YearGenerateEX();
for (JpStation jpStation : da) {
if (jpStation.getThirdStationId().equals(dayGenerate.getThirdStationId())) {
hd.setCode(jpStation.getCode());
hd.setName(jpStation.getName());
hd.setUserName(jpStation.getUserName());
hd.setStationContact(jpStation.getStationContact());
hd.setAccumulatedPower(jpStation.getAccumulatedPower() != null ? Double.valueOf(String.format("%.3f", jpStation.getAccumulatedPower() * FDL)) : null);
break;
}
}
hd.setIndex(i++);
hd.setName(dayGenerate.getStationName());
hd.setFullhour(dayGenerate.getFullhour() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getFullhour())) : null);
hd.setYearGenerate(dayGenerate.getGenerate() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getGenerate())) : null);
hd.setYearIncome(dayGenerate.getIncome() != null ? Double.valueOf(String.format("%.3f", dayGenerate.getIncome())) : null);
hd.setTimeDate(dayGenerate.getYearTime());
hd.setRegionalCompaniesName(regionalCompaniesNameMap.get(dayGenerate.getRegionalCompaniesCode()));
break;
}
}
ld.add(hd);
}
return ld;
......
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