Commit 9ab74bef authored by ZWT's avatar ZWT

feat(零碳): 长庆

1.添加easy excel配置,增加转换器,增加全局excel导出样式,增加场站下拉选解析器;
2.开发光伏电站模板导出接口,增加模板导出类,并完成接口冒烟测试及接口文档;
3.间开制度管理模块新增设为基础制度开关接口,添加线上接口文档并完成接口冒烟测试;
4.开发井口配置模板导出接口,增加模板导出类,并完成接口冒烟测试及接口文档;
5.开发第三方有功功率历史数据导入接口,增加模板配置类,添加线上接口文档并完成接口冒烟测试;
6.开发给长庆使用的获取第三方认证token接口,验证获取token后是否能正常跳转指定页面,创建长庆用演示用户及角色;
7.开发柴发设备配置模板导出接口,增加模板导出类,并完成接口冒烟测试及接口文档;
8.开发储能设备配置模板导出接口,增加模板导出类,并完成接口冒烟测试及接口文档;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent b33c2a6a
......@@ -31,4 +31,9 @@ public class QuerySysAreaOutput {
* 城市代码
*/
private String cityCode;
/**
* ID
*/
private Integer id;
}
......@@ -84,7 +84,8 @@
<select id="selectProvinceAndCity" parameterType="list" resultMap="ExtResultMap">
SELECT p.`name` AS province,
a.`name` AS city,
a.city_code
a.city_code,
a.id
FROM sys_area p
LEFT JOIN sys_area a ON p.id = a.parent_id
WHERE p.`name` IN
......
......@@ -8,6 +8,7 @@ import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import pps.cloud.system.service.data.sys_area.QuerySysAreaOutput;
import pps.cloud.system.service.data.sys_organization.GetSysOrganizationViewOutput;
import pps.core.base.entity.BasePhotovoltaicPlantEnt;
import pps.core.base.entity.BasePhotovoltaicPlantView;
import pps.core.base.enums.BusinessError;
......@@ -24,6 +25,8 @@ import pps.core.common.excel.listener.ExcelListener;
import pps.core.common.excel.util.EasyExcelUtil;
import pps.core.common.excel.util.ExcelStyleTool;
import pps.core.common.excel.util.ValidationUtil;
import pps.core.common.session.PpsUserSession;
import pps.core.common.utils.BaseUtils;
import xstartup.annotation.XService;
import xstartup.annotation.XText;
import xstartup.base.XContext;
......@@ -37,6 +40,7 @@ import xstartup.feature.api.annotation.XApiGet;
import xstartup.feature.api.annotation.XApiUpload;
import xstartup.helper.XTransactionHelper;
import java.math.BigDecimal;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -168,7 +172,10 @@ public class ExcelService {
public XServiceResult importPhotovoltaicPlant(XContext context, ImportExcelInput input) {
List<ExcelPhotovoltaicPlantTemplate> list = this.getExcelDataAndCheck(input.getFile(), ExcelPhotovoltaicPlantTemplate.class, "电站名称", ExcelPhotovoltaicPlantTemplate::getStationName);
//整理各种字典数据
Map<String, Integer> city = ServiceUtil.getProvinceAndCityList(context, "陕西", "甘肃").stream()
.collect(Collectors.toMap(QuerySysAreaOutput::getCity, QuerySysAreaOutput::getId));
Map<String, String> ouMap = ServiceUtil.getPlantList(context).stream()
.collect(Collectors.toMap(GetSysOrganizationViewOutput::getOuName, GetSysOrganizationViewOutput::getId));
//封装并校验电站名称(校验电站名称是否重复,重复不导入),并插入数据
BasePhotovoltaicPlantMapper mapper = context.getBean(BasePhotovoltaicPlantMapper.class);
List<BasePhotovoltaicPlantEnt> plantEntList = mapper.selectList(new LambdaQueryWrapper<BasePhotovoltaicPlantEnt>()
......@@ -186,6 +193,22 @@ public class ExcelService {
stringBuilder.append("第").append(rowNum).append("行,[电站名称重复]");
} else {
//数据封装
BasePhotovoltaicPlantView build = BasePhotovoltaicPlantView.builder()
.ouName(ent.getOuName())
.ouId(ouMap.get(ent.getOuName()))
.areaCode(city.get(ent.getCity()))
.stationName(ent.getStationName())
.makerNumber(ent.getMakerNumber())
.photovoltaicModelName(ent.getPhotovoltaicModelName())
.mountingAngle(new BigDecimal(ent.getMountingAngle()))
.totalPower(new BigDecimal(ent.getTotalPower()))
.arrayOrientation(new BigDecimal(ent.getArrayOrientation()))
.longitude(new BigDecimal(ent.getLongitude()))
.latitude(new BigDecimal(ent.getLatitude()))
.elevation(new BigDecimal(ent.getElevation()))
.build();
BaseUtils.setBaseModelDefault(build, context.getSession(PpsUserSession.class));
insertList.add(build);
}
rowNum++;
}
......
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