package com.gyee.runeconomy.controller.homepage; import com.gyee.runeconomy.dto.R; import com.gyee.runeconomy.dto.ResultMsg; import com.gyee.runeconomy.dto.response.ProEconPointCodeDTO; import com.gyee.runeconomy.service.homepage.EconomyPointHomePageService; import io.swagger.annotations.ApiOperation; import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; 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 java.util.List; import java.util.Map; /** *

* 省公司表 前端控制器 *

* * @author wang * @since 2022-11-22 */ @Log4j2 @RestController @RequestMapping("//economy") public class EconomyHomePageController { @Autowired private EconomyPointHomePageService economyPointHomePageService; /** * 经济运行首页指标 * * @param regionId * @param companyId * @param staType * @param dateType * @return */ @GetMapping(value = "/home-page") @ApiOperation(value = "经济运行-首页", notes = "经济运行-首页") public R getEconomyPointHomePageInfo(@RequestParam(value = "regionId", required = false) String regionId, @RequestParam(value = "companyId", required = false) String companyId, @RequestParam(value = "foreignKeyId", required = true) String foreignKeyId, @RequestParam(value = "staType", required = true) String staType, @RequestParam(value = "dateType", required = true) String dateType, @RequestParam(value = "pointCode", required = false) String pointCode ) throws Exception { Map map = economyPointHomePageService.getEconomyPointHomePageInfo(foreignKeyId, regionId, companyId, staType, dateType, pointCode); if (null != map) { return R.data(ResultMsg.ok(map)); } else { return R.error(ResultMsg.error()); } } /** * 经济运行首页指标 */ @GetMapping(value = "/home-page2") @ApiOperation(value = "经济运行-首页", notes = "经济运行-首页") public R getEconomyPointHomePageInfo2(@RequestParam(value = "regionId", required = false) String regionId, @RequestParam(value = "companyId", required = false) String companyId, @RequestParam(value = "foreignKeyId") String foreignKeyId, @RequestParam(value = "staType") String staType, @RequestParam(value = "dateType") String dateType, @RequestParam(value = "pointCode", required = false) String pointCode ) throws Exception { Map map = economyPointHomePageService.getEconomyPointHomePageInfo2(foreignKeyId, regionId, companyId, staType, dateType, pointCode); if (null != map) { return R.data(ResultMsg.ok(map)); } else { return R.error(ResultMsg.error()); } } /** * 首页指标排行 * * @param foreignKeyId * @param dateType * @param pointCode * @return * @throws Exception */ @GetMapping(value = "/point-ranking") @ApiOperation(value = "经济运行-首页指标排行", notes = "经济运行-首页指标排行") public R getEconomyPointRanking( @RequestParam(value = "foreignKeyId", required = true) String foreignKeyId, @RequestParam(value = "dateType", required = true) String dateType, @RequestParam(value = "staType", required = true) String staType, @RequestParam(value = "pointCode", required = true) String pointCode, @RequestParam(value = "popup", required = false) boolean popup ) { List dtos = null; try { dtos = economyPointHomePageService.getEconomyPointRanking(foreignKeyId, dateType, pointCode, popup, staType); } catch (Exception e) { log.error("请求异常", e); return R.error(ResultMsg.error()); } return R.data(ResultMsg.ok(dtos)); } /** * 首页 发电量 */ @GetMapping(value = "/generating-capacity") @ApiOperation(value = "首页-发电量", notes = "首页-发电量") public ResultMsg getHomeGeneratingCapacity(@RequestParam(value = "companyId", required = false) String companyId) throws Exception { Map map = economyPointHomePageService.getGeneratingCapacity(companyId); if (null != map) { return ResultMsg.ok(map); } else { return ResultMsg.error(); } } /** * 首页 右侧模块 */ @GetMapping(value = "/home-right") @ApiOperation(value = "首页-右侧模块", notes = "首页-右侧模块") public ResultMsg getHomeRight(@RequestParam(value = "companyId", required = false) String companyId) throws Exception { Map map = economyPointHomePageService.getHomeRight(companyId); if (null != map) { return ResultMsg.ok(map); } else { return ResultMsg.error(); } } /** * 首页 右侧模块 */ @GetMapping(value = "/home-middle") @ApiOperation(value = "首页-中间模块", notes = "首页-中间模块") public ResultMsg getHomeMiddle(@RequestParam(value = "companyId", required = false) String companyId) throws Exception { Map map = economyPointHomePageService.getHomeMiddle(companyId); if (null != map) { return ResultMsg.ok(map); } else { return ResultMsg.error(); } } }