Commit 209fb706 authored by ZWT's avatar ZWT

feat(零碳): 长庆

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

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent dd63e807
package pps.core.base.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
......@@ -593,6 +594,30 @@ public class ExcelService {
public XServiceResult importPriceStrategy(XContext context, ImportPriceStrategyExcelInput input) {
List<ExcelPriceStrategyTemplate> list = this.getExcelDataAndCheck(input.getFile(), ExcelPriceStrategyTemplate.class,
null, null);
//设置行号并转换开始/结束时间
List<Integer> errorRowList = new ArrayList<>(32);
int rowNum = 2;
for (ExcelPriceStrategyTemplate excelPriceStrategyTemplate : list) {
try {
//转换开始时间和结束时间(开始时间不能为24:00)
excelPriceStrategyTemplate.setStart(DateTime.of(excelPriceStrategyTemplate.getStartTime(), BusinessConstant.MINUTES_FORMAT));
if (CharSequenceUtil.equals(excelPriceStrategyTemplate.getEndTime(), BusinessConstant.END_OF_DAY_TIME)) {
excelPriceStrategyTemplate.setEnd(BusinessConstant.DATE_FLAG);
} else {
excelPriceStrategyTemplate.setEnd(DateTime.of(excelPriceStrategyTemplate.getEndTime(), BusinessConstant.MINUTES_FORMAT));
}
} catch (Exception e) {
errorRowList.add(rowNum);
}
excelPriceStrategyTemplate.setRowNum(rowNum++);
}
if (CollUtil.isNotEmpty(errorRowList)) {
throw new XServiceException("第[" + CollUtil.join(errorRowList, ",") + "]行,开始或结束时间输入错误!");
}
//按月份分组,按开井时间排序校验开关井时间
list.sort(Comparator.comparing(ExcelPriceStrategyTemplate::getStartTime));
Map<String, List<ExcelPriceStrategyTemplate>> collect = list.stream()
.collect(Collectors.groupingBy(ExcelPriceStrategyTemplate::getMonth));
return XServiceResult.OK;
}
......@@ -616,7 +641,7 @@ public class ExcelService {
this.checkExcelDataSize(dataList);
ValidationUtil.doValidate(dataList);
//检查某个名称字段是否重复
if (ObjectUtil.isNotNull(classifier) || CharSequenceUtil.isBlank(headerName)) {
if (ObjectUtil.isNotNull(classifier) || CharSequenceUtil.isNotBlank(headerName)) {
List<String> duplicate = dataList.stream()
.collect(Collectors.groupingBy(classifier, Collectors.counting()))
.entrySet()
......@@ -625,8 +650,7 @@ public class ExcelService {
.map(Map.Entry::getKey)
.collect(Collectors.toList());
if (CollUtil.isNotEmpty(duplicate)) {
String join = CharSequenceUtil.join(",", duplicate);
throw new XServiceException("表格内[" + headerName + "]列, 名称为[" + join + "]重复");
throw new XServiceException("表格内[" + headerName + "]列, 名称为[" + CollUtil.join(duplicate, ",") + "]重复");
}
}
return dataList;
......
package pps.core.base.service.data.base_excel;
import cn.hutool.core.date.DateTime;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import jakarta.validation.constraints.Min;
......@@ -69,8 +70,20 @@ public class ExcelPriceStrategyTemplate implements Serializable {
@ExcelProperty(index = 4, value = "电价")
private String electrovalence;
/*------------------------------------ other ------------------------------------*/
/**
* 行号
*/
private Integer rowNum;
/**
* 开始
*/
private DateTime start;
/**
* 结束
*/
private DateTime end;
}
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