Commit d5cd0b12 authored by ZWT's avatar ZWT

feat(吉林演示): 松原

1.修改系统首页大屏总览接口,增加区分组织机构逻辑,完成接口冒烟测试;
2.修改系统首页获取井场列表接口,增加区分组织机构逻辑,完成接口冒烟测试;
3.修改系统首页井场功能下钻后提示报错问题,修改用电功率数据获取逻辑,修复报错问题;
4.修改输电线路分页列表查询接口,增加查询条件,在查询父线路列表时只查询10千伏线路,修改线上接口文档同时完成接口冒烟测试;
5.修改系统首页井场实时监控接口,增加区分组织机构逻辑,完成接口冒烟测试;
6.修改系统首页用能分析接口,增加区分组织机构逻辑,完成接口冒烟测试;
7.修改系统首页井场用能分析(双坐标轴)接口,增加区分组织机构逻辑,完成接口冒烟测试;
8.修改系统首页累积用电接口,增加区分组织机构逻辑,完成接口冒烟测试;
9.修改系统首页光伏实时监控接口,增加区分组织机构逻辑,完成接口冒烟测试;
10.修改系统首页井场效果评价接口,增加区分组织机构逻辑,完成接口冒烟测试;
11.修改系统首页先导实验井间开制度接口,增加区分组织机构逻辑,完成接口冒烟测试;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 892acd0f
...@@ -108,11 +108,6 @@ public class CollectorsUtil { ...@@ -108,11 +108,6 @@ public class CollectorsUtil {
this.characteristics = characteristics; this.characteristics = characteristics;
} }
CollectorImpl(Supplier<A> supplier, BiConsumer<A, T> accumulator, BinaryOperator<A> combiner,
Set<Characteristics> characteristics) {
this(supplier, accumulator, combiner, castingIdentity(), characteristics);
}
@Override @Override
public BiConsumer<A, T> accumulator() { public BiConsumer<A, T> accumulator() {
return accumulator; return accumulator;
......
...@@ -4,12 +4,11 @@ package pps.core.common.utils; ...@@ -4,12 +4,11 @@ package pps.core.common.utils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.streaming.SXSSFWorkbook; import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFFont;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.web.multipart.MultipartFile;
import xstartup.base.util.XDateUtils; import xstartup.base.util.XDateUtils;
import java.io.*; import java.io.IOException;
import java.io.InputStream;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.*; import java.util.*;
import java.util.logging.Logger; import java.util.logging.Logger;
...@@ -55,97 +54,6 @@ public class ExcelUtils { ...@@ -55,97 +54,6 @@ public class ExcelUtils {
return workbook; return workbook;
} }
/**
* 生成Excel并写入数据信息
*
* @param dataSheetList 数据列表
* @return 写入数据后的工作簿对象
*/
public static void exportData(String filePath, InputStream inputStream, List<List<Map<String, Object>>> dataSheetList, List<String> headerList, Map<String, Integer> headerHiddenList, Boolean isAuto, Map<String, Integer> headerAutoList, List<String> sheetNames) throws IOException {
// 生成xlsx的Excel
//Workbook workbook = new SXSSFWorkbook();
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
CellStyle cs = workbook.createCellStyle();
XSSFFont whiteFont = workbook.createFont();
cs.setWrapText(true); //内容自动换行
cs.setAlignment(HorizontalAlignment.CENTER); //水平居中
cs.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中
whiteFont.setFontHeightInPoints((short) 9);//大小
cs.setFont(whiteFont);
//创建多个sheet页
Sheet sheet0 = workbook.getSheetAt(0);
short lastCellNum = sheet0.getRow(0).getLastCellNum();
if (lastCellNum < headerList.size()) {
headerList = headerList.subList(0, lastCellNum);
}
workbook.setSheetName(0, sheetNames.get(0));
for (int i = 1; i < sheetNames.size(); i++) {
workbook.cloneSheet(0, sheetNames.get(i));
}
Integer index = 0;
for (Iterator<List<Map<String, Object>>> sheetIt = dataSheetList.iterator(); sheetIt.hasNext(); ) {
Sheet sheet = workbook.getSheetAt(index++);
//构建每行的数据内容
int rowNum = 1;
for (Iterator<Map<String, Object>> it = sheetIt.next().iterator(); it.hasNext(); ) {
Map<String, Object> data = it.next();
if (data == null) {
continue;
}
//输出行数据
Row row = sheet.createRow(rowNum++);
convertDataToRow(data, row, headerList, cs);
}
//根据headerList表头,判断需要隐藏的列
// sheet.autoSizeColumn(rowNum);
// int colwidth = sheet.getColumnWidth(rowNum) * 2;
// if(colwidth < 255 * 256){
// sheet.setColumnWidth(rowNum , colwidth < 3000 ? 3000 : colwidth);
// }else
// sheet.setColumnWidth(rowNum , 6000);
headerList.forEach(header -> {
if (null != headerHiddenList.get(header)) {
sheet.setColumnHidden(headerHiddenList.get(header), true);
}
if (isAuto && null != headerAutoList.get(header)) {
sheet.autoSizeColumn(headerAutoList.get(header));
}
});
}
FileOutputStream out = null;
try {
File f = new File(filePath); //写文件
//不存在则新增
if (!f.getParentFile().exists()) {
f.getParentFile().mkdirs();
}
if (!f.exists()) {
f.createNewFile();
}
out = new FileOutputStream(f);
out.flush();
workbook.write(out);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
/** /**
* 生成sheet表,并写入第一行数据(列头) * 生成sheet表,并写入第一行数据(列头)
* *
...@@ -267,9 +175,6 @@ public class ExcelUtils { ...@@ -267,9 +175,6 @@ public class ExcelUtils {
return null; return null;
} finally { } finally {
try { try {
/*if (null != workbook) {
workbook.close();
}*/
if (null != inputStream) { if (null != inputStream) {
inputStream.close(); inputStream.close();
} }
...@@ -280,48 +185,6 @@ public class ExcelUtils { ...@@ -280,48 +185,6 @@ public class ExcelUtils {
} }
} }
/**
* 读取Excel文件内容
*
* @param file 上传的Excel文件
* @return 读取结果列表,读取失败时返回null
*/
public static List<Map<String, Object>> readExcel(MultipartFile file, List<String> headerList, Integer sheetIndex) {
Workbook workbook = null;
try {
// 获取Excel后缀名
String fileName = file.getOriginalFilename();
if (fileName == null || fileName.isEmpty() || fileName.lastIndexOf(".") < 0) {
logger.warning("解析Excel失败,因为获取到的Excel文件名非法!");
return null;
}
String fileType = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length());
// 获取Excel工作簿
workbook = getWorkbook(file.getInputStream(), fileType);
// 读取excel中的数据
List<Map<String, Object>> resultDataList = parseExcel(workbook, headerList, sheetIndex);
return resultDataList;
} catch (Exception e) {
logger.warning("解析Excel失败,文件名:" + file.getOriginalFilename() + " 错误信息:" + e.getMessage());
return null;
} finally {
try {
/*if (null != workbook) {
workbook.close();
}*/
} catch (Exception e) {
logger.warning("关闭数据流出错!错误信息:" + e.getMessage());
return null;
}
}
}
/** /**
* 解析Excel数据 * 解析Excel数据
* *
...@@ -437,81 +300,4 @@ public class ExcelUtils { ...@@ -437,81 +300,4 @@ public class ExcelUtils {
} }
return resultData; return resultData;
} }
public static void main(String[] args) {
List<String> headerList = new ArrayList<>(); //列头
headerList.add("姓名");
headerList.add("年龄");
headerList.add("居住城市");
headerList.add("职业");
/************** 读取Excel流程 ******************/
// 设定Excel文件所在路径
String excelFileName = "C:\\Users\\Administrator\\Desktop\\phone.xlsx";
InputStream inputStream = null;
try {
// 获取Excel文件
File excelFile = new File(excelFileName);
if (!excelFile.exists()) {
logger.warning("指定的Excel文件不存在!");
return;
}
inputStream = new FileInputStream(excelFile);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
// 读取Excel文件内容
List<Map<String, Object>> readResult = ExcelUtils.readExcel(inputStream, excelFileName, headerList, null);
/************** 写入Excel流程 ******************/
// 创建需要写入的数据列表
List<Map<String, Object>> dataVOList = new ArrayList<>(2);
Map<String, Object> dataVO = new HashMap<>();
dataVO.put("name", "小明");
dataVO.put("age", 18);
dataVO.put("location", "广州");
dataVO.put("job", "大学生");
Map<String, Object> dataVO2 = new HashMap<>();
dataVO2.put("name", "小花");
dataVO2.put("age", 19);
dataVO2.put("location", "深圳");
dataVO2.put("job", "大学生");
dataVOList.add(dataVO);
dataVOList.add(dataVO2);
// 写入数据到工作簿对象内
Workbook workbook = ExcelUtils.exportData(dataVOList, headerList);
// 以文件的形式输出工作簿对象
FileOutputStream fileOut = null;
try {
String exportFilePath = excelFileName;
File exportFile = new File(exportFilePath);
if (!exportFile.exists()) {
exportFile.createNewFile();
}
fileOut = new FileOutputStream(exportFilePath);
workbook.write(fileOut);
fileOut.flush();
} catch (Exception e) {
logger.warning("输出Excel时发生错误,错误原因:" + e.getMessage());
} finally {
try {
if (null != fileOut) {
fileOut.close();
}
/*if (null != workbook) {
workbook.close();
}*/
} catch (IOException e) {
logger.warning("关闭输出流时发生错误,错误原因:" + e.getMessage());
}
}
}
} }
package pps.core.common.utils; package pps.core.common.utils;
import pps.core.common.enums.TaskPlanTaskAffectDic;
import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
...@@ -14,11 +11,6 @@ import java.util.Date; ...@@ -14,11 +11,6 @@ import java.util.Date;
*/ */
public class JxlsUtils { public class JxlsUtils {
public static void main(String[] args) {
String as = "ss";
System.out.println(as);
}
public String dateFormat(Date date) { public String dateFormat(Date date) {
return this.dateFormat(date, "yyyy-MM-dd"); return this.dateFormat(date, "yyyy-MM-dd");
} }
...@@ -35,34 +27,4 @@ public class JxlsUtils { ...@@ -35,34 +27,4 @@ public class JxlsUtils {
} }
return ""; return "";
} }
public double bigDecimalFormat(Object data) {
return bigDecimalFormat(data, 2);
}
public double bigDecimalFormat(Object data, int num) {
if (data == null) {
return 0d;
}
try {
if (data instanceof BigDecimal) {
return BigDecimalUtil.parseBigDecimal(data, num).doubleValue();
} else if (data instanceof String) {
return BigDecimalUtil.parseBigDecimal(new BigDecimal((String) data), num).doubleValue();
} else {
return BigDecimalUtil.parseBigDecimal(new BigDecimal(data.toString()), num).doubleValue();
}
} catch (Exception e) {
e.printStackTrace();
}
return 0d;
}
public String enumFormat(Integer subValue, Integer parentValue) {
if (subValue == null) {
return "未知";
}
TaskPlanTaskAffectDic bySubValue = TaskPlanTaskAffectDic.findBySubValue(parentValue, subValue);
return bySubValue.getDesc();
}
} }
...@@ -48,24 +48,8 @@ public class ManifestComponentInfoHelper { ...@@ -48,24 +48,8 @@ public class ManifestComponentInfoHelper {
// handle // handle
} }
} }
} catch (Exception ex) { } catch (Exception ex) {
System.out.println(ex.getMessage()); System.out.println(ex.getMessage());
} }
} }
public static ManifestComponentInfo getManifestComponentInfo(String groupName, String artifectId) {
String k = String.format("%s:%s", groupName, artifectId);
if (manifestComponentInfoHashMap.containsKey(k)) {
return manifestComponentInfoHashMap.get(k);
} else {
ManifestComponentInfo manifestComponentInfo = new ManifestComponentInfo();
manifestComponentInfo.setGroupName(groupName);
manifestComponentInfo.setArtifactid(artifectId);
manifestComponentInfo.setVersion("N/A");
manifestComponentInfo.setBuildTime("N/A");
manifestComponentInfo.setDescription("N/A");
return manifestComponentInfo;
}
}
} }
...@@ -81,7 +81,7 @@ public class PatternUtil { ...@@ -81,7 +81,7 @@ public class PatternUtil {
//手机号加*号 //手机号加*号
public static String rePhone(String realPhone) { public static String rePhone(String realPhone) {
String phoneNumber = ""; String phoneNumber;
if (realPhone.length() == 11 && checkPhone(realPhone)) if (realPhone.length() == 11 && checkPhone(realPhone))
phoneNumber = realPhone.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"); phoneNumber = realPhone.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2");
else else
......
...@@ -7,7 +7,6 @@ package pps.core.common.utils; ...@@ -7,7 +7,6 @@ package pps.core.common.utils;
import javax.crypto.Cipher; import javax.crypto.Cipher;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.security.KeyFactory; import java.security.KeyFactory;
import java.security.PrivateKey; import java.security.PrivateKey;
import java.security.PublicKey; import java.security.PublicKey;
...@@ -38,7 +37,7 @@ public class RSAUtil { ...@@ -38,7 +37,7 @@ public class RSAUtil {
} }
//Base64编码转字节数组 //Base64编码转字节数组
public static byte[] base642Byte(String base64Key) throws IOException { public static byte[] base642Byte(String base64Key) {
Base64.Decoder decoder = Base64.getDecoder(); Base64.Decoder decoder = Base64.getDecoder();
return decoder.decode(base64Key); return decoder.decode(base64Key);
} }
...@@ -118,7 +117,7 @@ public class RSAUtil { ...@@ -118,7 +117,7 @@ public class RSAUtil {
Base64.Encoder encoder = Base64.getEncoder(); Base64.Encoder encoder = Base64.getEncoder();
result = encoder.encodeToString(resultBytes); result = encoder.encodeToString(resultBytes);
} catch (Exception e) { } catch (Exception e) {
System.out.println(e.toString()); System.out.println(e);
System.out.println("rsaEncrypt error:" + e.getMessage()); System.out.println("rsaEncrypt error:" + e.getMessage());
} }
return result; return result;
......
...@@ -9,15 +9,8 @@ import java.util.UUID; ...@@ -9,15 +9,8 @@ import java.util.UUID;
public class UUIDHelper { public class UUIDHelper {
private static final NoArgGenerator noArgGenerator = Generators.timeBasedEpochGenerator(new SecureRandom()); private static final NoArgGenerator noArgGenerator = Generators.timeBasedEpochGenerator(new SecureRandom());
public static String newUUID() { public static String newUUID() {
UUID uuid = noArgGenerator.generate(); UUID uuid = noArgGenerator.generate();
return uuid.toString(); return uuid.toString();
} }
public static void main(String[] args) {
for (int i = 0; i < 100; i++) {
System.out.println(newUUID());
}
}
} }
package pps.core.common.utils;
public enum WellKnownRegex {
Email_ENG(1, "^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$"),
Email_CHN(2, "^[A-Za-z0-9\\u4e00-\\u9fa5]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$"),
//电话号码
PHONE(3, "^1(3|4|5|6|7|8|9)\\d{9}$"),
URL1(4, "^((http:\\/\\/)|(https:\\/\\/))?([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6}(\\/)"),
URL2(5, "(https?:\\/\\/)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)"),
IPV4(6, "((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))"),
//英文字母和数字
ENGLETTER_NUM(7, "^[A-Za-z0-9]+$"),
ACCOUNTNAME(8, "^[a-zA-Z][a-zA-Z0-9_]{4,15}$"),
//汉字
CHINESE(9, "^[\\u4e00-\\u9fa5]{0,}$"),
//中英文数字下划线
CHAR_CHN_ENG_NUM(10, "^[\\u4E00-\\u9FA5A-Za-z0-9_]+$"),
//复杂密码Should have 1 lowercase letter, 1 uppercase letter, 1 number, 1 special character and be at least 8 characters long
COMPLEXPWD(11, "(?=(.*[0-9]))(?=.*[\\!@#$%^&*()\\\\[\\]{}\\-_+=~`|:;\"'<>,./?])(?=.*[a-z])(?=(.*[A-Z]))(?=(.*)).{8,}"),
//中等强度密码Should have 1 lowercase letter, 1 uppercase letter, 1 number, and be at least 8 characters long
MODERATEPWD(12, "(?=(.*[0-9]))((?=.*[A-Za-z0-9])(?=.*[A-Z])(?=.*[a-z]))^.{8,}$"),
DATE_ISO8601_YYYY_MM_DD(13, "^(?![+-]?\\d{4,5}-?(?:\\d{2}|W\\d{2})T)(?:|(\\d{4}|[+-]\\d{5})-?(?:|(0\\d|1[0-2])(?:|-?([0-2]\\d|3[0-1]))|([0-2]\\d{2}|3[0-5]\\d|36[0-6])|W([0-4]\\d|5[0-3])(?:|-?([1-7])))(?:(?!\\d)|T(?=\\d)))(?:|([01]\\d|2[0-4])(?:|:?([0-5]\\d)(?:|:?([0-5]\\d)(?:|\\.(\\d{3})))(?:|[zZ]|([+-](?:[01]\\d|2[0-4]))(?:|:?([0-5]\\d)))))$"),
DATE_FORMAT_DD_MM_YYYY(14, "^(0?[1-9]|[12][0-9]|3[01])([ \\/\\-])(0?[1-9]|1[012])\\2([0-9][0-9][0-9][0-9])(([ -])([0-1]?[0-9]|2[0-3]):[0-5]?[0-9]:[0-5]?[0-9])?$"),
INTEGER(20, "^-?\\d+$"),
NEGATIVE_INTEGER(21, "^-\\d*\\.?\\d+$"),
POSITIVE_INTEGER(22, "^\\d+$"),
ZERO_OR_POSITIVE_INTEGER(23, "^[1-9]\\d*|0$"),
FLOAT(24, "^-?([1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*|0?\\.0+|0)$"),
POSITIVE_FLOAT(25, "^[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*$"),
NEGATIVE_FLOAT(26, "^-([1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*)$"),
ZERO_OR_POSITIVE_FLOAT(27, "^[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*|0?\\.0+|0$"),
;
private int id;
private String expression;
WellKnownRegex(int _id, String _expression) {
this.id = _id;
this.expression = _expression;
}
public int getId() {
return id;
}
public String getExpression() {
return expression;
}
}
package pps.core.common.utils;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public abstract class WellKnownRegexValidator {
private static ConcurrentHashMap<WellKnownRegex, Pattern> patterns = new ConcurrentHashMap<>();
private static Pattern getPattern(WellKnownRegex regex) {
if (patterns.containsKey(regex))
return patterns.get(regex);
else {
Pattern ptn = Pattern.compile(regex.getExpression());
patterns.put(regex, ptn);
return ptn;
}
}
public static boolean anyMaths(String txt, WellKnownRegex... regexs) {
for (WellKnownRegex regex : regexs) {
if (getPattern(regex).matcher(txt).matches())
return true;
}
return false;
}
public static boolean completelyMatches(String txt, WellKnownRegex... regexs) {
for (WellKnownRegex regex : regexs) {
if (!completelyMatch(txt, regex))
return false;
}
return true;
}
public static boolean completelyMatch(String txt, WellKnownRegex regex) {
Matcher matcher = getPattern(regex).matcher(txt);
if (!matcher.matches())
return false;
return matcher.group().equals(txt);
}
public static void main(String[] args) {
System.out.println(WellKnownRegexValidator.completelyMatch("0.3", WellKnownRegex.FLOAT));
System.out.println(WellKnownRegexValidator.completelyMatch("3", WellKnownRegex.INTEGER));
}
}
\ 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