diff --git a/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsEnergyPriceConfigController.java b/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsEnergyPriceConfigController.java index e8818d2..b6c8e6a 100644 --- a/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsEnergyPriceConfigController.java +++ b/ems-admin/src/main/java/com/xzzn/web/controller/ems/EmsEnergyPriceConfigController.java @@ -5,14 +5,7 @@ import java.util.List; import com.xzzn.ems.domain.vo.EnergyPriceVo; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import com.xzzn.common.annotation.Log; import com.xzzn.common.core.controller.BaseController; import com.xzzn.common.core.domain.AjaxResult; @@ -38,9 +31,9 @@ public class EmsEnergyPriceConfigController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:config:list')") @GetMapping("/list") - public TableDataInfo list() + public TableDataInfo list(String startTime,String endTime) { - List list = emsEnergyPriceConfigService.selectEmsEnergyPriceConfigList(); + List list = emsEnergyPriceConfigService.selectEmsEnergyPriceConfigList(startTime,endTime); return getDataTable2(list); } diff --git a/ems-system/src/main/java/com/xzzn/ems/service/IEmsEnergyPriceConfigService.java b/ems-system/src/main/java/com/xzzn/ems/service/IEmsEnergyPriceConfigService.java index ae44a2e..1be7b8d 100644 --- a/ems-system/src/main/java/com/xzzn/ems/service/IEmsEnergyPriceConfigService.java +++ b/ems-system/src/main/java/com/xzzn/ems/service/IEmsEnergyPriceConfigService.java @@ -25,7 +25,7 @@ public interface IEmsEnergyPriceConfigService * * @return 电价配置集合 */ - public List selectEmsEnergyPriceConfigList(); + public List selectEmsEnergyPriceConfigList(String startTime,String endTime); /** * 新增电价配置-按月 diff --git a/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsEnergyPriceConfigServiceImpl.java b/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsEnergyPriceConfigServiceImpl.java index d288835..187662b 100644 --- a/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsEnergyPriceConfigServiceImpl.java +++ b/ems-system/src/main/java/com/xzzn/ems/service/impl/EmsEnergyPriceConfigServiceImpl.java @@ -61,12 +61,12 @@ public class EmsEnergyPriceConfigServiceImpl implements IEmsEnergyPriceConfigSer * @return 电价配置 */ @Override - public List selectEmsEnergyPriceConfigList() + public List selectEmsEnergyPriceConfigList(String startTime,String endTime) { List responses = new ArrayList<>(); - // 仅查询当年配置 - LocalDate currentDate = LocalDate.now(); - int currentYear = currentDate.getYear(); + // 根据时间截取年份 + String[] startTimeArr = startTime.split("-"); + int currentYear = Integer.valueOf(startTimeArr[0]); List priceConfigs = emsEnergyPriceConfigMapper.getCurrentYearConfigList(currentYear);