| | |
| | | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.config.annotation.LoginNoRequired; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.core.haikang.model.param.respose.RegionDataRankingDataResponse; |
| | | import com.doumee.core.haikang.model.param.respose.RegionEnergyListResponse; |
| | | import com.doumee.service.business.third.model.ApiResponse; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.web.response.platformReport.*; |
| | | import com.doumee.service.business.third.BoardService; |
| | | import io.swagger.annotations.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | | |
| | | /** |
| | | * Created by IntelliJ IDEA. |
| | |
| | | * @create 2024/10/28 13:42 |
| | | */ |
| | | |
| | | @Api(tags = "能耗看板") |
| | | @Api(tags = "【看板大屏】能耗看板") |
| | | @RestController |
| | | @Slf4j |
| | | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/board/api/energy") |
| | | public class EnergyController extends BaseController { |
| | | |
| | | @Autowired |
| | | private BoardService boardService; |
| | | |
| | | @LoginNoRequired |
| | | @ApiOperation("中心数据") |
| | | @GetMapping("/centerData") |
| | | public ApiResponse<EnergyBoardVO> centerData() { |
| | | EnergyBoardVO data = new EnergyBoardVO(); |
| | | Random random = new Random(); |
| | | data.setSmokeBoxTotal(random.nextInt(20000)); |
| | | data.setCarbon(new BigDecimal(random.nextInt(1000))); |
| | | data.setElectricityQuantity(random.nextInt(1000)); |
| | | data.setElectricityYear(new BigDecimal(random.nextInt(10))); |
| | | data.setElectricityMonth(new BigDecimal(random.nextInt(10))); |
| | | |
| | | data.setWaterQuantity(new BigDecimal(random.nextInt(1000))); |
| | | data.setWaterYear(new BigDecimal(random.nextInt(10))); |
| | | data.setWaterMonth(new BigDecimal(random.nextInt(10))); |
| | | |
| | | |
| | | data.setGasQuantity(new BigDecimal(random.nextInt(1000))); |
| | | data.setGasYear(new BigDecimal(random.nextInt(10))); |
| | | data.setGasMonth(new BigDecimal(random.nextInt(10))); |
| | | |
| | | data.setOfficeQuantity(random.nextInt(20)); |
| | | data.setPowerQuantity(random.nextInt(20)); |
| | | data.setWorkHouseQuantity(random.nextInt(20)); |
| | | data.setParkQuantity(random.nextInt(20)); |
| | | data.setTodayElectricity(random.nextInt(20)); |
| | | data.setMonthElectricity(random.nextInt(20)); |
| | | data.setYesterdayElectricity(random.nextInt(20)); |
| | | EnergyBoardVO data =boardService.centerEnergyData(); |
| | | return ApiResponse.success(data); |
| | | } |
| | | |
| | | |
| | | |
| | | @LoginNoRequired |
| | | @ApiOperation("中心用电能耗数据") |
| | | @GetMapping("/regionDataRanking") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "type", value = "查询类型:1=今日;2=本月;3=昨日", required = true), |
| | | }) |
| | | public ApiResponse<List<RegionDataRankingDataResponse>> regionDataRanking(@RequestParam Integer type) { |
| | | return ApiResponse.success(boardService.getRegionDataRanking(type)); |
| | | } |
| | | |
| | | |
| | | @LoginNoRequired |
| | | @ApiOperation("用电总能耗同比、环比和区域用电量集合") |
| | | @GetMapping("/energyRegionData") |
| | | public ApiResponse< RegionEnergyListResponse> energyRegionData() { |
| | | RegionEnergyListResponse data=boardService.energyRegionData(); |
| | | return ApiResponse.success(data); |
| | | } |
| | | |
| | | |
| | | @LoginNoRequired |
| | | @ApiOperation("实时负荷曲线") |
| | | @GetMapping("/loadCurve") |
| | | public ApiResponse<List<EnergyDataVO>> loadCurve() { |
| | | List<EnergyDataVO> loadCurveList = new ArrayList<>(); |
| | | Random random = new Random(); |
| | | for (int i = 1; i <= 23; i++) { |
| | | EnergyDataVO data = new EnergyDataVO(); |
| | | data.setTimeData(StringUtils.leftPad(i+"",2,"0") +":00"); |
| | | data.setEnergy(new BigDecimal(random.nextInt(200))); |
| | | loadCurveList.add(data); |
| | | } |
| | | List<EnergyDataVO> loadCurveList =boardService.loadEnergyCurve(); |
| | | return ApiResponse.success(loadCurveList); |
| | | } |
| | | |
| | |
| | | @ApiOperation("月能耗、油耗分析") |
| | | @GetMapping("/energyDataList") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "type", value = "查询类型:0=水;1=气;2=电;3=油耗", required = true), |
| | | @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "type", value = "查询类型:0=水;1=气;2=油耗;3=用电", required = true), |
| | | }) |
| | | public ApiResponse<List<EnergyDataVO>> energyDataList(@RequestParam Integer type) { |
| | | List<EnergyDataVO> energyDataVOList = new ArrayList<>(); |
| | | Random random = new Random(); |
| | | for (int i = 1; i <= 12; i++) { |
| | | EnergyDataVO data = new EnergyDataVO(); |
| | | data.setTimeData(i +"月"); |
| | | data.setEnergy(new BigDecimal(random.nextInt(200))); |
| | | energyDataVOList.add(data); |
| | | } |
| | | List<EnergyDataVO> energyDataVOList = boardService.energyDataList(type); |
| | | return ApiResponse.success(energyDataVOList); |
| | | } |
| | | |
| | |
| | | @ApiOperation("上月油耗排行") |
| | | @GetMapping("/lastMonthOil") |
| | | public ApiResponse<List<OilDataVO>> lastMonthOil() { |
| | | List<OilDataVO> oilDataVOList = new ArrayList<>(); |
| | | Random random = new Random(); |
| | | BigDecimal maxOil = BigDecimal.ZERO; |
| | | BigDecimal lastOil = BigDecimal.ZERO; |
| | | for (int i = 1; i <= 7; i++) { |
| | | OilDataVO oilDataVO = new OilDataVO(); |
| | | oilDataVO.setCarNo("皖A8" + random.nextInt(9) + random.nextInt(9) + random.nextInt(9) + random.nextInt(9)); |
| | | if(i==1){ |
| | | oilDataVO.setQuantity(new BigDecimal(random.nextInt(100))); |
| | | maxOil = oilDataVO.getQuantity(); |
| | | }else{ |
| | | oilDataVO.setQuantity(new BigDecimal(random.nextInt(lastOil.intValue()))); |
| | | } |
| | | lastOil = oilDataVO.getQuantity(); |
| | | oilDataVO.setMaxOil(maxOil); |
| | | oilDataVOList.add(oilDataVO); |
| | | } |
| | | List<OilDataVO> oilDataVOList = boardService.energyLastMonthOilSort(); |
| | | return ApiResponse.success(oilDataVOList); |
| | | } |
| | | } |