Commit 16cbe09d 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 216e98cf
......@@ -19,6 +19,8 @@ public enum BusinessError implements XError {
WellNumberExists(2007, "井号已存在"),
MakerNumberExists(2008, "出场编号已存在"),
Missing_Organization_ID(2009, "缺少组织ID"),
FileFormatError(2204, "文件格式有误,请检查上传文件格式!"),
UndiscoveredData(2205, "未发现数据,请检查后重新导入!"),
;
private int code;
......
......@@ -10,6 +10,7 @@ import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy
import pps.cloud.system.service.SystemAreaService;
import pps.cloud.system.service.data.sys_area.QuerySysAreaInput;
import pps.cloud.system.service.data.sys_area.QuerySysAreaOutput;
import pps.core.base.enums.BusinessError;
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;
......@@ -21,6 +22,7 @@ import pps.core.common.excel.util.ExcelStyleTool;
import xstartup.annotation.XService;
import xstartup.annotation.XText;
import xstartup.base.XContext;
import xstartup.base.exception.XServiceException;
import xstartup.base.tool.XStorageTool;
import xstartup.data.*;
import xstartup.feature.api.annotation.XApiGet;
......@@ -152,40 +154,58 @@ public class ExcelService {
@XApiUpload(anonymous = true)
public XServiceResult importPhotovoltaicPlant(XContext context, ImportExcelInput input) {
XUploadFile file = input.getFile();
// 文件名称
String fileName = file.getFileName();
// 截取文件后缀
String fileSuffix = null;
if (CharSequenceUtil.isNotBlank(fileName)) {
fileSuffix = fileName.substring(fileName.indexOf("."));
}
// 判断文件是否是excel文件
if (!CharSequenceUtil.equalsAny(fileSuffix, "xlsx", "xls")) {
//"文件格式有误,请检查上传文件格式!!"
}
ExcelReader reader = ExcelUtil.getReader(file.getInputStream(), 0);
int rowCount = reader.getRowCount();
if (rowCount <= 1) {
//导入的为空模板,请检查后重新导入!!
}
this.checkExcel(file);
return XServiceResult.OK;
}
@XText("井口配置导入")
@XApiUpload(anonymous = true)
public XServiceResult importWellhead(XContext context, ImportExcelInput input) {
XUploadFile file = input.getFile();
this.checkExcel(file);
return XServiceResult.OK;
}
@XText("柴发设备配置导入")
@XApiUpload(anonymous = true)
public XServiceResult importDieselGenerator(XContext context, ImportExcelInput input) {
XUploadFile file = input.getFile();
this.checkExcel(file);
return XServiceResult.OK;
}
@XText("储能设备配置导入")
@XApiUpload(anonymous = true)
public XServiceResult importEnergyStorageDevice(XContext context, ImportExcelInput input) {
XUploadFile file = input.getFile();
this.checkExcel(file);
return XServiceResult.OK;
}
/*------------------------------------ private ------------------------------------*/
/**
* 检查excel
*
* @param file 文件
*/
private void checkExcel(XUploadFile file) {
// 文件名称
String fileName = file.getFileName();
// 截取文件后缀
String fileSuffix = null;
if (CharSequenceUtil.isNotBlank(fileName)) {
fileSuffix = CharSequenceUtil.subAfter(fileName, ".", true);
}
String[] parts = {"xlsx", "xls"};
// 判断文件是否是excel文件
if (!CharSequenceUtil.equalsAny(fileSuffix, parts)) {
throw new XServiceException(BusinessError.FileFormatError);
}
ExcelReader reader = ExcelUtil.getReader(file.getInputStream(), 0);
int rowCount = reader.getRowCount();
if (rowCount <= 1) {
throw new XServiceException(BusinessError.UndiscoveredData);
}
}
}
\ No newline at end of file
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