电价配置-列表加时间范围-暂时只取年份

This commit is contained in:
2025-10-10 11:21:33 +08:00
parent d8d0a83c87
commit 636a2ab73b
3 changed files with 8 additions and 15 deletions

View File

@ -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<EnergyPriceVo> list = emsEnergyPriceConfigService.selectEmsEnergyPriceConfigList();
List<EnergyPriceVo> list = emsEnergyPriceConfigService.selectEmsEnergyPriceConfigList(startTime,endTime);
return getDataTable2(list);
}

View File

@ -25,7 +25,7 @@ public interface IEmsEnergyPriceConfigService
*
* @return 电价配置集合
*/
public List<EnergyPriceVo> selectEmsEnergyPriceConfigList();
public List<EnergyPriceVo> selectEmsEnergyPriceConfigList(String startTime,String endTime);
/**
* 新增电价配置-按月

View File

@ -61,12 +61,12 @@ public class EmsEnergyPriceConfigServiceImpl implements IEmsEnergyPriceConfigSer
* @return 电价配置
*/
@Override
public List<EnergyPriceVo> selectEmsEnergyPriceConfigList()
public List<EnergyPriceVo> selectEmsEnergyPriceConfigList(String startTime,String endTime)
{
List<EnergyPriceVo> responses = new ArrayList<>();
// 仅查询当年配置
LocalDate currentDate = LocalDate.now();
int currentYear = currentDate.getYear();
// 根据时间截取年份
String[] startTimeArr = startTime.split("-");
int currentYear = Integer.valueOf(startTimeArr[0]);
List<EmsEnergyPriceConfig> priceConfigs = emsEnergyPriceConfigMapper.getCurrentYearConfigList(currentYear);