Compare commits
8 Commits
8d5f20d2e6
...
paris
| Author | SHA1 | Date | |
|---|---|---|---|
| a859c4b649 | |||
| 2e6cee7f49 | |||
| 93460199b2 | |||
| 805d7d01fb | |||
| 292a7c7376 | |||
| 0c4b8b8ca9 | |||
| 7d641db749 | |||
| 605de0a6cd |
@ -1611,6 +1611,7 @@ public class EarningsCalculateServiceImpl implements EarningsCalculateService {
|
|||||||
LocalDateTime end = mDate.with(TemporalAdjusters.lastDayOfMonth());
|
LocalDateTime end = mDate.with(TemporalAdjusters.lastDayOfMonth());
|
||||||
String beginTime= DateUtil.format(begin, CommonConstant.DATE_YMD);
|
String beginTime= DateUtil.format(begin, CommonConstant.DATE_YMD);
|
||||||
String endTime = DateUtil.format(end, 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);
|
List<PowerGenerateRespVO> pvIncome = earningsCalculateMpptService.countPvIncome(req.getStationId(),beginTime, endTime);
|
||||||
Map<String,List<PowerGenerateRespVO>> mapIncome = pvIncome.stream().collect(Collectors.groupingBy(i ->i.getDate()));
|
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){
|
if(elecs != null){
|
||||||
pv.setPowerGenerate(elecs.stream().map(ElecMeterValue::getDigital).reduce(BigDecimal.ZERO,BigDecimal::add));
|
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();
|
String key = RedisKeyConstant.PV.STATION_PV_TODAY_PROFIT + req.getStationId();
|
||||||
//获取今日收益
|
//获取今日收益
|
||||||
BigDecimal todayIncone = (BigDecimal)redisService.get(key);
|
BigDecimal todayIncone = (BigDecimal)redisService.get(key);
|
||||||
|
|||||||
@ -146,6 +146,7 @@ public class OpenStationServiceImpl implements OpenStationService {
|
|||||||
BigDecimal pvActivePower = new BigDecimal(CommonConstant.ZERO);
|
BigDecimal pvActivePower = new BigDecimal(CommonConstant.ZERO);
|
||||||
BigDecimal totalRelease = new BigDecimal(CommonConstant.ZERO);
|
BigDecimal totalRelease = new BigDecimal(CommonConstant.ZERO);
|
||||||
BigDecimal dailyReleaseElec = new BigDecimal(CommonConstant.ZERO);
|
BigDecimal dailyReleaseElec = new BigDecimal(CommonConstant.ZERO);
|
||||||
|
String nowDay = DateUtil.format(new Date(), CommonConstant.DATE_YMD);
|
||||||
if (!pcsList.isEmpty()) {
|
if (!pcsList.isEmpty()) {
|
||||||
for (DeviceRespVO deviceRespVO : pcsList) {
|
for (DeviceRespVO deviceRespVO : pcsList) {
|
||||||
//在缓存里拿映射字段
|
//在缓存里拿映射字段
|
||||||
@ -155,11 +156,37 @@ public class OpenStationServiceImpl implements OpenStationService {
|
|||||||
if (mpptMap != null) {
|
if (mpptMap != null) {
|
||||||
MpptVo vo = JSON.parseObject(JSON.toJSONString(mpptMap), MpptVo.class);
|
MpptVo vo = JSON.parseObject(JSON.toJSONString(mpptMap), MpptVo.class);
|
||||||
if (vo != null) {
|
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 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;
|
dailyReleaseElecMppt = dailyReleaseElecMppt.compareTo(BigDecimal.ZERO)<0?BigDecimal.ZERO:dailyReleaseElecMppt;
|
||||||
|
// 最后组装值
|
||||||
pvActivePower = pvActivePower.add(pvActivePowerMppt);
|
pvActivePower = pvActivePower.add(pvActivePowerMppt);
|
||||||
totalRelease = totalRelease.add(totalReleaseMppt);
|
totalRelease = totalRelease.add(totalReleaseMppt);
|
||||||
dailyReleaseElec = dailyReleaseElec.add(dailyReleaseElecMppt);
|
dailyReleaseElec = dailyReleaseElec.add(dailyReleaseElecMppt);
|
||||||
|
|||||||
@ -199,6 +199,43 @@ public class EarningsCalculateController {
|
|||||||
}
|
}
|
||||||
return betweenList;
|
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
|
@TokenIgnore
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
@ -207,10 +244,6 @@ public class EarningsCalculateController {
|
|||||||
String lang = req.getHeader(CommonConstant.LANG);
|
String lang = req.getHeader(CommonConstant.LANG);
|
||||||
earningsCalculateReq.setLang(lang);
|
earningsCalculateReq.setLang(lang);
|
||||||
EarningsCalculateResp total = earningsCalculateService.getTotal(earningsCalculateReq,PAGE_LIST_TYPE);
|
EarningsCalculateResp total = earningsCalculateService.getTotal(earningsCalculateReq,PAGE_LIST_TYPE);
|
||||||
if(total.getCharge()==null){
|
|
||||||
total.setCharge(new ArrayList<>());
|
|
||||||
total.setDischarge(new ArrayList<>());
|
|
||||||
}
|
|
||||||
ServletOutputStream out = null;
|
ServletOutputStream out = null;
|
||||||
try {
|
try {
|
||||||
out = response.getOutputStream();
|
out = response.getOutputStream();
|
||||||
|
|||||||
@ -63,8 +63,8 @@ public class StationRemoteController {
|
|||||||
|
|
||||||
@PostMapping("search")
|
@PostMapping("search")
|
||||||
@ApiOperation(value = "查询远控电站信息")
|
@ApiOperation(value = "查询远控电站信息")
|
||||||
public DataResult<StationRemoteControl> search(@RequestBody Integer stationId) {
|
public DataResult<StationRemoteControl> search(@RequestBody StationRemoteControlPageVo vo) {
|
||||||
StationRemoteControl stationRemoteControl=stationRemoteControlService.search(stationId);
|
StationRemoteControl stationRemoteControl=stationRemoteControlService.search(vo.getStationId());
|
||||||
return DataResult.success(stationRemoteControl);
|
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.
@ -32,7 +32,7 @@ public class AliSendSmsUtils {
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static void sendMessage(String param,String phoneNumbers) throws Exception{
|
public static void sendMessage(String param,String phoneNumbers) throws Exception{
|
||||||
sendMessage("中自科技","SMS_495990996",param,phoneNumbers);
|
sendMessage("中自科技","SMS_501905058",param,phoneNumbers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,7 +42,7 @@ public class AliSendSmsUtils {
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static void sendFlowMessage(String param,String phoneNumbers) throws Exception{
|
public static void sendFlowMessage(String param,String phoneNumbers) throws Exception{
|
||||||
sendMessage("中自科技","SMS_495990996",param,phoneNumbers);
|
sendMessage("中自科技","SMS_501905058",param,phoneNumbers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -124,7 +124,7 @@ public class AliSendSmsUtils {
|
|||||||
// JSONObject param = new JSONObject();
|
// JSONObject param = new JSONObject();
|
||||||
// param.put(CommonConstant.SMS.SITE_NAME,"绿服酒店站");
|
// param.put(CommonConstant.SMS.SITE_NAME,"绿服酒店站");
|
||||||
// param.put(CommonConstant.SMS.CONTENT,CommonConstant.Heartbeat.STATION_FAIL);
|
// param.put(CommonConstant.SMS.CONTENT,CommonConstant.Heartbeat.STATION_FAIL);
|
||||||
// param.put(CommonConstant.SMS.NAME,"邹");
|
// param.put(CommonConstant.SMS.NAME,"邹杰灵");
|
||||||
// sendMessage(param.toJSONString(),"18583239880");
|
// sendMessage(param.toJSONString(),"18583239880");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1475,6 +1475,7 @@ public class Device001ApiController {
|
|||||||
}
|
}
|
||||||
if (stationHomeRespVos != null && stationHomeRespVos.size() > 0) {
|
if (stationHomeRespVos != null && stationHomeRespVos.size() > 0) {
|
||||||
BigDecimal startEle = stationHomeRespVos.get(0).getDigital();
|
BigDecimal startEle = stationHomeRespVos.get(0).getDigital();
|
||||||
|
query.setBegin(DateUtil.beginOfDay(new Date()));
|
||||||
cacheObj(query, DeviceTypeConstant.PV_DAILY_CHARGE_START, startEle);
|
cacheObj(query, DeviceTypeConstant.PV_DAILY_CHARGE_START, startEle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user