Compare commits
5 Commits
0c4b8b8ca9
...
paris
| Author | SHA1 | Date | |
|---|---|---|---|
| a859c4b649 | |||
| 2e6cee7f49 | |||
| 93460199b2 | |||
| 805d7d01fb | |||
| 292a7c7376 |
@ -1611,6 +1611,7 @@ public class EarningsCalculateServiceImpl implements EarningsCalculateService {
|
||||
LocalDateTime end = mDate.with(TemporalAdjusters.lastDayOfMonth());
|
||||
String beginTime= DateUtil.format(begin, CommonConstant.DATE_YMD);
|
||||
String endTime = DateUtil.format(end, CommonConstant.DATE_YMD);
|
||||
String nowTime = DateUtil.format(new Date(), CommonConstant.DATE_YMD);
|
||||
//光伏收益
|
||||
List<PowerGenerateRespVO> pvIncome = earningsCalculateMpptService.countPvIncome(req.getStationId(),beginTime, endTime);
|
||||
Map<String,List<PowerGenerateRespVO>> mapIncome = pvIncome.stream().collect(Collectors.groupingBy(i ->i.getDate()));
|
||||
@ -1636,7 +1637,7 @@ public class EarningsCalculateServiceImpl implements EarningsCalculateService {
|
||||
if(elecs != null){
|
||||
pv.setPowerGenerate(elecs.stream().map(ElecMeterValue::getDigital).reduce(BigDecimal.ZERO,BigDecimal::add));
|
||||
}
|
||||
if(date.equals(endTime)){
|
||||
if(date.equals(nowTime)){
|
||||
String key = RedisKeyConstant.PV.STATION_PV_TODAY_PROFIT + req.getStationId();
|
||||
//获取今日收益
|
||||
BigDecimal todayIncone = (BigDecimal)redisService.get(key);
|
||||
|
||||
@ -146,6 +146,7 @@ public class OpenStationServiceImpl implements OpenStationService {
|
||||
BigDecimal pvActivePower = new BigDecimal(CommonConstant.ZERO);
|
||||
BigDecimal totalRelease = new BigDecimal(CommonConstant.ZERO);
|
||||
BigDecimal dailyReleaseElec = new BigDecimal(CommonConstant.ZERO);
|
||||
String nowDay = DateUtil.format(new Date(), CommonConstant.DATE_YMD);
|
||||
if (!pcsList.isEmpty()) {
|
||||
for (DeviceRespVO deviceRespVO : pcsList) {
|
||||
//在缓存里拿映射字段
|
||||
@ -155,11 +156,37 @@ public class OpenStationServiceImpl implements OpenStationService {
|
||||
if (mpptMap != null) {
|
||||
MpptVo vo = JSON.parseObject(JSON.toJSONString(mpptMap), MpptVo.class);
|
||||
if (vo != null) {
|
||||
BigDecimal pvActivePowerMppt = vo.getPvActivePower() == null ? BigDecimal.ZERO : vo.getPvActivePower().getValue();
|
||||
// 今日功率
|
||||
BigDecimal pvActivePowerMppt = BigDecimal.ZERO;
|
||||
if(vo.getPvActivePower() != null){
|
||||
if(nowDay.equals(DateUtil.format(vo.getPvActivePower().getUpdateTime(), CommonConstant.DATE_YMD))){
|
||||
pvActivePowerMppt = vo.getPvActivePower().getValue();
|
||||
}
|
||||
}
|
||||
// 累计发电量
|
||||
BigDecimal totalReleaseMppt = vo.getTotalRelease() == null ? BigDecimal.ZERO : vo.getTotalRelease().getValue();
|
||||
BigDecimal pvDailyReleaseStart = vo.getPvDailyReleaseStart() == null ? BigDecimal.ZERO : vo.getPvDailyReleaseStart().getValue();
|
||||
BigDecimal dailyReleaseElecMppt = totalReleaseMppt.subtract(pvDailyReleaseStart);
|
||||
// 今日发电起始值
|
||||
BigDecimal pvDailyReleaseStart = BigDecimal.ZERO;
|
||||
if(vo.getPvDailyReleaseStart() != null){
|
||||
if(nowDay.equals(DateUtil.format(vo.getPvDailyReleaseStart().getUpdateTime(), CommonConstant.DATE_YMD))){
|
||||
pvDailyReleaseStart = vo.getPvDailyReleaseStart().getValue();
|
||||
}
|
||||
}
|
||||
// 今日更新的累计发电量
|
||||
BigDecimal totalReleaseMppt1 = BigDecimal.ZERO;
|
||||
if(vo.getTotalRelease() != null){
|
||||
if(nowDay.equals(DateUtil.format(vo.getTotalRelease().getUpdateTime(), CommonConstant.DATE_YMD))){
|
||||
totalReleaseMppt1 = vo.getTotalRelease().getValue();
|
||||
}
|
||||
}
|
||||
// 计算今日发电量 = 今日更新的累计发电量 - 今日发电起始值
|
||||
BigDecimal dailyReleaseElecMppt = BigDecimal.ZERO;
|
||||
if(totalReleaseMppt1.compareTo(BigDecimal.ZERO)>0&&pvDailyReleaseStart.compareTo(BigDecimal.ZERO)>0){
|
||||
dailyReleaseElecMppt = totalReleaseMppt1.subtract(pvDailyReleaseStart);
|
||||
}
|
||||
// 如果计算到的今日发电量小于0 则设置为0
|
||||
dailyReleaseElecMppt = dailyReleaseElecMppt.compareTo(BigDecimal.ZERO)<0?BigDecimal.ZERO:dailyReleaseElecMppt;
|
||||
// 最后组装值
|
||||
pvActivePower = pvActivePower.add(pvActivePowerMppt);
|
||||
totalRelease = totalRelease.add(totalReleaseMppt);
|
||||
dailyReleaseElec = dailyReleaseElec.add(dailyReleaseElecMppt);
|
||||
|
||||
@ -199,6 +199,43 @@ public class EarningsCalculateController {
|
||||
}
|
||||
return betweenList;
|
||||
}
|
||||
@TokenIgnore
|
||||
@PostMapping("/exportPv")
|
||||
@ApiOperation(value = "pv导出")
|
||||
public void exportPv(HttpServletRequest req, HttpServletResponse response, @RequestBody EarningsCalculateReq earningsCalculateReq){
|
||||
String lang = req.getHeader(CommonConstant.LANG);
|
||||
earningsCalculateReq.setLang(lang);
|
||||
EarningsCalculateResp total = earningsCalculateService.getTotal(earningsCalculateReq,PAGE_LIST_TYPE);
|
||||
ServletOutputStream out = null;
|
||||
try {
|
||||
out = response.getOutputStream();
|
||||
response.setContentType("multipart/form-data");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
//文件名字
|
||||
String fileName = "demo.xlsx";
|
||||
response.setHeader("Content-disposition", "attachment;filename=" +fileName);
|
||||
String path="template/earningsPvTemplate.xlsx";
|
||||
//文件模板输入流
|
||||
InputStream inputStream = new ClassPathResource(path).getInputStream();
|
||||
ExcelWriter writer = EasyExcel.write(out).withTemplate(inputStream).build();
|
||||
WriteSheet sheet = EasyExcel.writerSheet().build();
|
||||
FillConfig fillConfig = FillConfig.builder().forceNewRow(true).build();
|
||||
|
||||
List<PowerGenerateRespVO> pvList = earningsCalculateService.getPvMonthData(earningsCalculateReq);
|
||||
for (PowerGenerateRespVO pcsElecData : pvList) {
|
||||
bigDecimalUtil.keepTwoDecimalPlaces(pcsElecData);
|
||||
bigDecimalUtil.ifIsNUll(pcsElecData);
|
||||
}
|
||||
writer.fill(new FillWrapper("vo", pvList), fillConfig, sheet);
|
||||
//填充数据
|
||||
writer.fill(total,fillConfig,sheet);
|
||||
//填充完成
|
||||
writer.finish();
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@TokenIgnore
|
||||
@PostMapping("/export")
|
||||
@ -207,10 +244,6 @@ public class EarningsCalculateController {
|
||||
String lang = req.getHeader(CommonConstant.LANG);
|
||||
earningsCalculateReq.setLang(lang);
|
||||
EarningsCalculateResp total = earningsCalculateService.getTotal(earningsCalculateReq,PAGE_LIST_TYPE);
|
||||
if(total.getCharge()==null){
|
||||
total.setCharge(new ArrayList<>());
|
||||
total.setDischarge(new ArrayList<>());
|
||||
}
|
||||
ServletOutputStream out = null;
|
||||
try {
|
||||
out = response.getOutputStream();
|
||||
|
||||
@ -63,8 +63,8 @@ public class StationRemoteController {
|
||||
|
||||
@PostMapping("search")
|
||||
@ApiOperation(value = "查询远控电站信息")
|
||||
public DataResult<StationRemoteControl> search(@RequestBody Integer stationId) {
|
||||
StationRemoteControl stationRemoteControl=stationRemoteControlService.search(stationId);
|
||||
public DataResult<StationRemoteControl> search(@RequestBody StationRemoteControlPageVo vo) {
|
||||
StationRemoteControl stationRemoteControl=stationRemoteControlService.search(vo.getStationId());
|
||||
return DataResult.success(stationRemoteControl);
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1475,6 +1475,7 @@ public class Device001ApiController {
|
||||
}
|
||||
if (stationHomeRespVos != null && stationHomeRespVos.size() > 0) {
|
||||
BigDecimal startEle = stationHomeRespVos.get(0).getDigital();
|
||||
query.setBegin(DateUtil.beginOfDay(new Date()));
|
||||
cacheObj(query, DeviceTypeConstant.PV_DAILY_CHARGE_START, startEle);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user