Commit 1e454345 authored by ZWT's avatar ZWT

feat(零碳): 长庆

1.系统管理模块,查询线路及组织机构树接口修改,增加查询逻辑,通过线路名称模糊查询树列表,完成接口冒烟测试并同步线上接口文档;
2.系统管理模块,查询光伏电站及组织机构树接口修改,增加查询逻辑,通过电站名称模糊查询树列表,完成接口冒烟测试并同步线上接口文档;
3.基础信息配置模块,新增市电峰谷导入模板下载接口,完成接口冒烟测试并同步线上接口文档;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent c497a72d
package pps.core.base.excel;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.CharSequenceUtil;
import pps.cloud.system.service.SystemDictionaryService;
import pps.cloud.system.service.data.sys_dictionary.GetSysDictionaryViewOutput;
import pps.core.base.utils.ServiceUtil;
import pps.core.common.constant.BusinessConstant;
import pps.core.common.excel.config.ExcelDynamicSelect;
import xstartup.base.XSelfServiceContext;
import java.util.List;
import java.util.stream.Collectors;
/**
* 时段类型下拉
*
* @author ZWT
* @date 2024/05/13
*/
public class TimeFrameImpl implements ExcelDynamicSelect {
@Override
public String[] getSource() {
XSelfServiceContext build = XSelfServiceContext.build(SystemDictionaryService.class);
List<GetSysDictionaryViewOutput> list = ServiceUtil.getDictionaryList(build, BusinessConstant.TIME_FRAME);
if (CollUtil.isNotEmpty(list)) {
return CharSequenceUtil.splitToArray(list.stream()
.map(GetSysDictionaryViewOutput::getDicName)
.collect(Collectors.joining(",")), ",");
}
return new String[0];
}
}
\ No newline at end of file
package pps.core.base.excel;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import pps.core.common.constant.BusinessConstant;
import pps.core.common.excel.config.ExcelDynamicSelect;
import java.util.List;
import java.util.stream.Collectors;
/**
* 时段范围下拉
*
* @author ZWT
* @date 2024/05/13
*/
public class TimeRangeImpl implements ExcelDynamicSelect {
@Override
public String[] getSource() {
List<String> collect = DateUtil.rangeToList(DateUtil.beginOfDay(DateUtil.date()),
DateUtil.endOfDay(DateUtil.date()), DateField.MINUTE,
30)
.stream()
.map(d -> d.toString(BusinessConstant.MINUTES_FORMAT))
.collect(Collectors.toList());
collect.add(BusinessConstant.END_OF_DAY_TIME);
return collect.toArray(new String[0]);
}
}
\ No newline at end of file
......@@ -17,10 +17,7 @@ import pps.core.base.service.data.base_diesel_generator.QueryBaseDieselGenerator
import pps.core.base.service.data.base_diesel_generator.QueryBaseDieselGeneratorOutput;
import pps.core.base.service.data.base_energy_storage_device.QueryBaseEnergyStorageDeviceInput;
import pps.core.base.service.data.base_energy_storage_device.QueryBaseEnergyStorageDeviceOutput;
import pps.core.base.service.data.base_excel.ExcelDieselGeneratorTemplate;
import pps.core.base.service.data.base_excel.ExcelEnergyStorageDeviceTemplate;
import pps.core.base.service.data.base_excel.ExcelPhotovoltaicPlantTemplate;
import pps.core.base.service.data.base_excel.ExcelWellheadTemplate;
import pps.core.base.service.data.base_excel.*;
import pps.core.base.service.data.base_photovoltaic_plant.QueryBasePhotovoltaicPlantInput;
import pps.core.base.service.data.base_photovoltaic_plant.QueryBasePhotovoltaicPlantOutput;
import pps.core.base.service.data.base_wellhead.QueryBaseWellheadInput;
......@@ -278,6 +275,28 @@ public class ExcelService {
return XFileResult.success(XFileType.APPLICATION_XLSX, fileSavePath);
}
/**
* 市电峰谷配置导出
*
* @param context 上下文
* @return {@link XFileResult }
*/
@XText("市电峰谷配置导出")
@XApiGet
public XFileResult exportPriceStrategy(XContext context) {
String fileSavePath = XStorageTool.getAbsolutePath("/temp/excel/市电峰谷配置模板.xlsx");
//生成模板
EasyExcelFactory.write(FileUtil.touch(fileSavePath))
.registerWriteHandler(ExcelStyleTool.getStyleStrategy())
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
.autoCloseStream(Boolean.TRUE)
.build()
.write(Collections.emptyList(),
EasyExcelUtil.writeSelectedSheet(ExcelPriceStrategyTemplate.class, 0, "市电峰谷配置")
).finish();
return XFileResult.success(XFileType.APPLICATION_XLSX, fileSavePath);
}
/*------------------------------------ 导入 ------------------------------------*/
/**
......
package pps.core.base.service.data.base_excel;
import com.alibaba.excel.annotation.ExcelProperty;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import pps.core.base.excel.TimeFrameImpl;
import pps.core.base.excel.TimeRangeImpl;
import pps.core.common.excel.config.ExcelSelected;
import java.io.Serializable;
/**
* excel市电峰谷模板
*
* @author ZWT
* @date 2024/05/13 13:51
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ExcelPriceStrategyTemplate implements Serializable {
private static final long serialVersionUID = -2929661573381767982L;
/**
* 时段类型
*/
@NotBlank(message = "缺少月份")
@ExcelSelected(source = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"})
@ExcelProperty(index = 0, value = "月份")
private String month;
/**
* 时段类型
*/
@NotBlank(message = "缺少时段类型")
@ExcelSelected(sourceClass = TimeFrameImpl.class)
@ExcelProperty(index = 1, value = "时段类型")
private String periodTypeName;
/**
* 开始时间
*/
@NotBlank(message = "缺少开始时间")
@ExcelSelected(sourceClass = TimeRangeImpl.class)
@ExcelProperty(index = 2, value = "开始时间")
private String startTime;
/**
* 结束时间
*/
@NotBlank(message = "缺少结束时间")
@ExcelSelected(sourceClass = TimeRangeImpl.class)
@ExcelProperty(index = 3, value = "结束时间")
private String endTime;
/**
* 电价
*/
@NotBlank(message = "缺少电价")
@Min(value = 0, message = "电价需大于0")
@ExcelProperty(index = 4, value = "电价")
private String electrovalence;
}
......@@ -12,7 +12,6 @@ import pps.cloud.system.service.data.sys_dictionary.QuerySysDictionaryViewInput;
import pps.cloud.system.service.data.sys_dictionary.QuerySysDictionaryViewOutput;
import pps.cloud.system.service.data.sys_organization.GetAllOuListByOuIdInput;
import pps.cloud.system.service.data.sys_organization.GetSysOrganizationViewOutput;
import pps.core.common.constant.BusinessConstant;
import xstartup.base.XContext;
import xstartup.data.XListResult;
......@@ -106,7 +105,7 @@ public class ServiceUtil {
public static List<GetSysDictionaryViewOutput> getDictionaryList(XContext context, String alias) {
SystemDictionaryService bean = context.getBean(SystemDictionaryService.class);
XListResult<GetSysDictionaryViewOutput> result = bean.querySysDictionaryByParam(context, GetSysDictionaryViewInput.builder()
.alias(BusinessConstant.RUN_TYPE)
.alias(alias)
.build());
result.throwIfFail();
return result.getResult();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment