| | |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.other.api.domain.TNotice; |
| | | import com.ruoyi.other.api.domain.TScreenContent; |
| | | import com.ruoyi.other.api.domain.TSystemConfiguration; |
| | | import com.ruoyi.other.api.dto.NoticeQueryDto; |
| | | import com.ruoyi.other.service.TNoticeService; |
| | | import com.ruoyi.other.service.TScreenContentService; |
| | | import com.ruoyi.other.service.TSystemConfigurationService; |
| | | import com.ruoyi.other.util.EnergyRefreshService; |
| | | import com.ruoyi.other.util.KsolarUtils; |
| | | import com.ruoyi.other.vo.*; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.Arrays; |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | private TScreenContentService screenContentService; |
| | | @Resource |
| | | private EnergyRefreshService energyRefreshService; |
| | | @Resource |
| | | private TSystemConfigurationService systemConfigurationService; |
| | | |
| | | /** |
| | | * 顶部-累计电量 |
| | |
| | | @GetMapping(value = "/photovoltaicAndConsumption") |
| | | public AjaxResult<PhotovoltaicAndConsumptionVO> photovoltaicAndConsumption() { |
| | | //需调用接口 获取光伏发电量 |
| | | |
| | | return AjaxResult.success(new PhotovoltaicAndConsumptionVO()); |
| | | PhotovoltaicAndConsumptionVO vo = new PhotovoltaicAndConsumptionVO(); |
| | | vo.setTodayGenerateElectricity(new BigDecimal(KsolarUtils.getTodayEnergy(LocalDateTime.now().toString()))); |
| | | vo.setGreenElectricityToday(vo.getTodayGenerateElectricity().multiply(new BigDecimal("0.94")).setScale(2, RoundingMode.HALF_UP)); |
| | | return AjaxResult.success(vo); |
| | | } |
| | | |
| | | |
| | |
| | | @ApiOperation(tags = {"储能放电情况"},value = "充电桩数据大屏") |
| | | @GetMapping(value = "/energyStorageDischarge") |
| | | public AjaxResult<EnergyStorageDischargeVO> energyStorageDischarge() { |
| | | //需调用接口 获取光伏发电量 |
| | | String electricity = KsolarUtils.getElectricity(); |
| | | List<TSystemConfiguration> list = systemConfigurationService.list(new LambdaQueryWrapper<TSystemConfiguration>().in(TSystemConfiguration::getType, 4, 5)); |
| | | // 昨日放能 |
| | | TSystemConfiguration sysConfig = list.stream().filter(e -> e.getType() == 4).findFirst().orElse(null); |
| | | // 昨日储能 |
| | | TSystemConfiguration sysConfig1 = list.stream().filter(e -> e.getType() == 5).findFirst().orElse(null); |
| | | // 总储能 |
| | | String s = electricity.split("_")[0]; |
| | | // 总放能 |
| | | String s1 = electricity.split("_")[1]; |
| | | |
| | | EnergyStorageDischargeVO vo = new EnergyStorageDischargeVO(); |
| | | vo.setTodayDischarge(energyRefreshService.getCurrentValue()); |
| | | BigDecimal subtract = new BigDecimal(s1).subtract(new BigDecimal(sysConfig.getContent())); |
| | | vo.setTodayDischarge(subtract); |
| | | BigDecimal subtract1 = new BigDecimal(s).subtract(new BigDecimal(sysConfig1.getContent())); |
| | | vo.setTodayStorage(subtract1); |
| | | return AjaxResult.success(vo); |
| | | } |
| | | |
| | |
| | | if(list==null|| list.isEmpty()){ |
| | | return AjaxResult.success(tScreenContent); |
| | | } |
| | | BeanUtils.copyProperties( list.get(0),tScreenContent); |
| | | BeanUtils.copyProperties(list.get(0),tScreenContent); |
| | | list.remove(0); |
| | | list.forEach(x->{ |
| | | tScreenContent.setCarDischarge(tScreenContent.getCarDischarge().add(x.getCarDischarge())); |
| | |
| | | tScreenContent.setValueOne(tScreenContent.getValueOne().add(x.getValueOne())); |
| | | tScreenContent.setValueTwo(tScreenContent.getValueTwo().add(x.getValueTwo())); |
| | | tScreenContent.setValueThree(tScreenContent.getValueThree().add(x.getValueThree())); |
| | | if(tScreenContent.getStatisticalDeadline().isBefore(x.getStatisticalDeadline())) tScreenContent.setStatisticalDeadline(x.getStatisticalDeadline()); |
| | | if(tScreenContent.getStatisticalDeadline().getTime()<(x.getStatisticalDeadline().getTime())) { |
| | | tScreenContent.setStatisticalDeadline(x.getStatisticalDeadline()); |
| | | } |
| | | }); |
| | | return AjaxResult.success(tScreenContent); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"车位数据传输"},value = "充电桩数据大屏") |
| | | @PostMapping(value = "/carportData") |
| | | public AjaxResult<?> carportData(Integer parkingPlace,Integer remainPlace) { |
| | | screenContentService.carportData(parkingPlace,remainPlace); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @ApiOperation(tags = {"获取车位数据传输"},value = "充电桩数据大屏") |
| | | @GetMapping(value = "/getCarportData") |
| | | public AjaxResult<?> getCarportData() { |
| | | HashMap<String,Object> map = screenContentService.getCarportData(); |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 数据回显 站点id |
| | | */ |