Commit 448da13f authored by ZWT's avatar ZWT

feat(吉林演示): 松原

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

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent d0738ac9
......@@ -318,19 +318,13 @@ public class EthernetAddress
* @since 4.1
*/
public static EthernetAddress fromEgressInterface(InetSocketAddress externalSocketAddress) {
DatagramSocket socket = null;
try {
socket = new DatagramSocket();
try (DatagramSocket socket = new DatagramSocket()) {
socket.connect(externalSocketAddress);
InetAddress localAddress = socket.getLocalAddress();
NetworkInterface egressIf = NetworkInterface.getByInetAddress(localAddress);
return fromInterface(egressIf);
} catch (SocketException e) {
return null;
} finally {
if (socket != null) {
socket.close();
}
}
}
......@@ -553,4 +547,4 @@ public class EthernetAddress
sb.append(HEX_CHARS[(hex >> 4) & 0xF]);
sb.append(HEX_CHARS[(hex & 0x0f)]);
}
}
}
\ No newline at end of file
......@@ -108,7 +108,7 @@ public class Generators {
digester = MessageDigest.getInstance("SHA-1");
type = UUIDType.NAME_BASED_SHA1;
} catch (NoSuchAlgorithmException nex) {
throw new IllegalArgumentException("Couldn't instantiate SHA-1 MessageDigest instance: " + nex.toString());
throw new IllegalArgumentException("Couldn't instantiate SHA-1 MessageDigest instance: " + nex);
}
}
return new NameBasedGenerator(namespace, digester, type);
......
......@@ -27,8 +27,8 @@ import java.util.UUID;
* Simple command-line interface to UUID generation functionality.
*/
public class Jug {
protected final static HashMap<String, String> TYPES = new HashMap<String, String>();
protected final static HashMap<String, String> OPTIONS = new HashMap<String, String>();
protected final static HashMap<String, String> TYPES = new HashMap<>();
protected final static HashMap<String, String> OPTIONS = new HashMap<>();
static {
TYPES.put("time-based", "t");
......@@ -117,7 +117,7 @@ public class Jug {
--count;
// Type we recognize?
String tmp = (String) TYPES.get(type);
String tmp = TYPES.get(type);
if (tmp == null) {
if (!TYPES.containsValue(type)) {
System.err.println("Unrecognized UUID generation type '" +
......@@ -138,14 +138,14 @@ public class Jug {
for (int i = 0; i < count; ++i) {
String opt = args[i];
if (opt.length() == 0 || opt.charAt(0) != '-') {
if (opt.isEmpty() || opt.charAt(0) != '-') {
System.err.println("Unrecognized option '" + opt + "' (missing leading hyphen?), exiting.");
System.exit(1);
}
char option = (char) 0;
if (opt.startsWith("--")) {
String o = (String) OPTIONS.get(opt.substring(2));
String o = OPTIONS.get(opt.substring(2));
// Let's translate longer names to simple names:
if (o != null) {
option = o.charAt(0);
......@@ -187,7 +187,7 @@ public class Jug {
try {
addr = EthernetAddress.valueOf(next);
} catch (NumberFormatException nex) {
System.err.println("Invalid ethernet address for option '" + opt + "', error: " + nex.toString());
System.err.println("Invalid ethernet address for option '" + opt + "', error: " + nex);
System.exit(1);
}
break;
......@@ -274,28 +274,21 @@ public class Jug {
System.err.println("--name (-n) - argument missing when using method that requires it, exiting.");
System.exit(1);
}
if (typeC == 'n') {
String orig = nameSpace;
nameSpace = nameSpace.toLowerCase();
if (nameSpace.equals("url")) {
nsUUID = NameBasedGenerator.NAMESPACE_URL;
} else if (nameSpace.equals("dns")) {
nsUUID = NameBasedGenerator.NAMESPACE_DNS;
} else {
System.err.println("Unrecognized namespace '" + orig
+ "'; only DNS and URL allowed for name-based generation.");
System.exit(1);
}
String orig = nameSpace;
nameSpace = nameSpace.toLowerCase();
if (nameSpace.equals("url")) {
nsUUID = NameBasedGenerator.NAMESPACE_URL;
} else if (nameSpace.equals("dns")) {
nsUUID = NameBasedGenerator.NAMESPACE_DNS;
} else {
System.err.println("Unrecognized namespace '" + orig
+ "'; only DNS and URL allowed for name-based generation.");
System.exit(1);
}
nameArgGenerator = Generators.nameBasedGenerator(nsUUID);
break;
}
// And then let's rock:
if (verbose) {
System.out.println();
}
// When measuring performance, make sure that the random number
// generator is initialized prior to measurements...
long now = 0L;
......@@ -335,4 +328,4 @@ public class Jug {
System.out.println("Performance: took " + now + " milliseconds to generate (and print out) " + genCount + " UUIDs; average being " + (avg / 10) + "." + (avg % 10) + " msec.");
}
}
}
}
\ No newline at end of file
package com.fasterxml.uuid;
import com.fasterxml.uuid.impl.TimeBasedEpochGenerator;
public class MyGenerator {
public static void main(String[] args) {
TimeBasedEpochGenerator timeBasedEpochGenerator = Generators.timeBasedEpochGenerator();
int i = 10;
while (i > 0) {
String uuid = timeBasedEpochGenerator.generate().toString();
System.out.println(uuid);
i--;
}
}
}
......@@ -10,4 +10,4 @@ import java.util.UUID;
*/
public abstract class NoArgGenerator extends UUIDGenerator {
public abstract UUID generate();
}
}
\ No newline at end of file
......@@ -22,4 +22,4 @@ public abstract class StringArgGenerator extends UUIDGenerator {
* @since 3.1
*/
public abstract UUID generate(byte[] nameBytes);
}
}
\ No newline at end of file
......@@ -78,4 +78,4 @@ public abstract class TimestampSynchronizer {
*/
protected abstract long update(long now)
throws IOException;
}
}
\ No newline at end of file
......@@ -31,4 +31,4 @@ public class UUIDClock {
public long currentTimeMillis() {
return System.currentTimeMillis();
}
}
}
\ No newline at end of file
package com.fasterxml.uuid;
import java.util.Comparator;
import java.util.UUID;
/**
* Default {@link java.util.UUID} comparator is not very useful, since
* it just does blind byte-by-byte comparison which does not work well
* for time+location - based UUIDs. Additionally it also uses signed
* comparisons for longs which can lead to unexpected behavior
* This comparator does implement proper lexical ordering: starting with
* type (different types are collated
* separately), followed by time and location (for time/location based),
* and simple lexical (byte-by-byte) ordering for name/hash and random
* variants.
*
* @author tatu
*/
public class UUIDComparator implements Comparator<UUID> {
/**
* Static helper method that can be used instead of instantiating comparator
* (used by unit tests, can be used by code too)
*/
public static int staticCompare(UUID u1, UUID u2) {
// First: major sorting by types
int type = u1.version();
int diff = type - u2.version();
if (diff != 0) {
return diff;
}
// Second: for time-based variant, order by time stamp:
if (type == UUIDType.TIME_BASED.raw()) {
diff = compareULongs(u1.timestamp(), u2.timestamp());
if (diff == 0) {
// or if that won't work, by other bits lexically
diff = compareULongs(u1.getLeastSignificantBits(), u2.getLeastSignificantBits());
}
} else {
// note: java.util.UUIDs compares with sign extension, IMO that's wrong, so:
diff = compareULongs(u1.getMostSignificantBits(),
u2.getMostSignificantBits());
if (diff == 0) {
diff = compareULongs(u1.getLeastSignificantBits(),
u2.getLeastSignificantBits());
}
}
return diff;
}
protected final static int compareULongs(long l1, long l2) {
int diff = compareUInts((int) (l1 >> 32), (int) (l2 >> 32));
if (diff == 0) {
diff = compareUInts((int) l1, (int) l2);
}
return diff;
}
protected final static int compareUInts(int i1, int i2) {
/* bit messier due to java's insistence on signed values: if both
* have same sign, normal comparison (by subtraction) works fine;
* but if signs don't agree need to resolve differently
*/
if (i1 < 0) {
return (i2 < 0) ? (i1 - i2) : 1;
}
return (i2 < 0) ? -1 : (i1 - i2);
}
@Override
public int compare(UUID u1, UUID u2) {
return staticCompare(u1, u2);
}
}
......@@ -46,4 +46,4 @@ public abstract class UUIDGenerator {
* generator instance will produce.
*/
public abstract UUIDType getType();
}
}
\ No newline at end of file
......@@ -373,7 +373,7 @@ public class UUIDTimer {
do {
try {
Thread.sleep(delay);
} catch (InterruptedException ie) {
} catch (InterruptedException ignored) {
}
delay = 1L;
/* This is just a sanity check: don't want an "infinite"
......@@ -385,4 +385,4 @@ public class UUIDTimer {
}
} while (System.currentTimeMillis() < waitUntil);
}
}
}
\ No newline at end of file
......@@ -20,7 +20,7 @@ public enum UUIDType {
private final int _raw;
private UUIDType(int raw) {
UUIDType(int raw) {
_raw = raw;
}
......
......@@ -69,4 +69,4 @@ public class LoggerFacade {
}
}
}
}
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import com.fasterxml.uuid.StringArgGenerator;
import com.fasterxml.uuid.UUIDType;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.util.UUID;
......@@ -36,7 +37,7 @@ public class NameBasedGenerator extends StringArgGenerator {
public final static UUID NAMESPACE_X500 = UUID.fromString("6ba7b814-9dad-11d1-80b4-00c04fd430c8");
static {
_utf8 = Charset.forName("UTF-8");
_utf8 = StandardCharsets.UTF_8;
}
/**
......@@ -54,7 +55,6 @@ public class NameBasedGenerator extends StringArgGenerator {
*/
protected final MessageDigest _digester;
protected final UUIDType _type;
private final LoggerFacade _logger = LoggerFacade.getLogger(getClass());
/*
/**********************************************************************
......@@ -85,6 +85,7 @@ public class NameBasedGenerator extends StringArgGenerator {
} else {
// Hmmh... error out? Let's default to SHA-1, but log a warning
type = UUIDType.NAME_BASED_SHA1;
LoggerFacade _logger = LoggerFacade.getLogger(getClass());
_logger.warn("Could not determine type of Digester from '%s'; assuming 'SHA-1' type", typeStr);
}
}
......@@ -132,4 +133,4 @@ public class NameBasedGenerator extends StringArgGenerator {
}
return UUIDUtil.constructUUID(_type, digest);
}
}
}
\ No newline at end of file
......@@ -22,11 +22,6 @@ import java.util.UUID;
* @since 3.0
*/
public class RandomBasedGenerator extends NoArgGenerator {
/**
* Default shared random number generator, used if no random number generator
* is explicitly specified for instance
*/
protected static Random _sharedRandom = null;
/**
* Random number generator that this generator uses.
......@@ -62,11 +57,10 @@ public class RandomBasedGenerator extends NoArgGenerator {
/**********************************************************************
*/
protected final static long _toLong(byte[] buffer, int offset) {
protected static long _toLong(byte[] buffer, int offset) {
long l1 = _toInt(buffer, offset);
long l2 = _toInt(buffer, offset + 4);
long l = (l1 << 32) + ((l2 << 32) >>> 32);
return l;
return (l1 << 32) + ((l2 << 32) >>> 32);
}
/*
......@@ -75,7 +69,7 @@ public class RandomBasedGenerator extends NoArgGenerator {
/**********************************************************************
*/
private final static long _toInt(byte[] buffer, int offset) {
private static long _toInt(byte[] buffer, int offset) {
return (buffer[offset] << 24)
+ ((buffer[++offset] & 0xFF) << 16)
+ ((buffer[++offset] & 0xFF) << 8)
......@@ -111,4 +105,4 @@ public class RandomBasedGenerator extends NoArgGenerator {
}
return UUIDUtil.constructUUID(UUIDType.RANDOM_BASED, r1, r2);
}
}
}
\ No newline at end of file
......@@ -58,11 +58,10 @@ public class TimeBasedEpochGenerator extends NoArgGenerator {
/**********************************************************************
*/
protected final static long _toLong(byte[] buffer, int offset) {
long l1 = _toInt(buffer, offset);
long l2 = _toInt(buffer, offset + 4);
long l = (l1 << 32) + ((l2 << 32) >>> 32);
return l;
protected static long _toLong(byte[] buffer) {
long l1 = _toInt(buffer, 0);
long l2 = _toInt(buffer, 4);
return (l1 << 32) + ((l2 << 32) >>> 32);
}
/*
......@@ -71,7 +70,7 @@ public class TimeBasedEpochGenerator extends NoArgGenerator {
/**********************************************************************
*/
private final static long _toInt(byte[] buffer, int offset) {
private static long _toInt(byte[] buffer, int offset) {
return (buffer[offset] << 24)
+ ((buffer[++offset] & 0xFF) << 16)
+ ((buffer[++offset] & 0xFF) << 8)
......@@ -84,7 +83,7 @@ public class TimeBasedEpochGenerator extends NoArgGenerator {
/**********************************************************************
*/
private final static long _toShort(byte[] buffer, int offset) {
private static long _toShort(byte[] buffer, int offset) {
return ((buffer[offset] & 0xFF) << 8)
+ (buffer[++offset] & 0xFF);
}
......@@ -107,7 +106,7 @@ public class TimeBasedEpochGenerator extends NoArgGenerator {
// And then the other 64 bits of random; likewise UUIDUtil.constructUUID
// will overwrite first 2 random bits so it's "only" 62 bits
long l2 = _toLong(rnd, 0);
long l2 = _toLong(rnd);
// and as per above, this call fills in "variant" and "version" bits
return UUIDUtil.constructUUID(UUIDType.TIME_BASED_EPOCH, l1, l2);
......
......@@ -106,11 +106,11 @@ public class TimeBasedGenerator extends NoArgGenerator {
// need to squeeze in type (4 MSBs in byte 6, clock hi)
midhi &= ~0xF000; // remove high nibble of 6th byte
midhi |= 0x1000; // type 1
long midhiL = (long) midhi;
long midhiL = midhi;
midhiL = ((midhiL << 32) >>> 32); // to get rid of sign extension
// and reconstruct
long l1 = (((long) clockLo) << 32) | midhiL;
// last detail: must force 2 MSB to be '10'
return new UUID(l1, _uuidL2);
}
}
}
\ No newline at end of file
......@@ -111,14 +111,13 @@ public class TimeBasedReorderedGenerator extends NoArgGenerator {
// and then bottom 28 bits split into mid (16 bits), low (12 bits)
final int timestampLow = (int) rawTimestamp;
// and then low part gets mixed with variant identifier
final int timeBottom = (((timestampLow >> 12) & 0xFFFF) << 16)
long timeBottomL = ((long) ((timestampLow >> 12) & 0xFFFF) << 16)
// and final 12 bits mixed with variant identifier
| 0x6000 | (timestampLow & 0xFFF);
long timeBottomL = (long) timeBottom;
timeBottomL = ((timeBottomL << 32) >>> 32); // to get rid of sign extension
// and reconstruct
long l1 = timestampHigh | timeBottomL;
return new UUID(l1, _uuidL2);
}
}
}
\ No newline at end of file
......@@ -148,7 +148,7 @@ public class UUIDUtil {
public static UUID constructUUID(UUIDType type, long l1, long l2) {
// first, ensure type is ok
l1 &= ~0xF000L; // remove high nibble of 6th byte
l1 |= (long) (type.raw() << 12);
l1 |= (long) type.raw() << 12;
// second, ensure variant is properly set too (8th byte; most-sig byte of second long)
l2 = ((l2 << 2) >>> 2); // remove 2 MSB
l2 |= (2L << 62); // set 2 MSB to '10'
......@@ -161,7 +161,7 @@ public class UUIDUtil {
public static long initUUIDFirstLong(long l1, int rawType) {
l1 &= ~0xF000L; // remove high nibble of 6th byte
l1 |= (long) (rawType << 12);
l1 |= (long) rawType << 12;
return l1;
}
......@@ -259,7 +259,7 @@ public class UUIDUtil {
//private final static long MASK_LOW_INT = 0x0FFFFFFFF;
protected final static long gatherLong(byte[] buffer, int offset) {
protected static long gatherLong(byte[] buffer, int offset) {
long hi = ((long) _gatherInt(buffer, offset)) << 32;
//long lo = ((long) _gatherInt(buffer, offset+4)) & MASK_LOW_INT;
long lo = (((long) _gatherInt(buffer, offset + 4)) << 32) >>> 32;
......@@ -272,19 +272,19 @@ public class UUIDUtil {
/********************************************************************************
*/
private final static void _appendInt(int value, byte[] buffer, int offset) {
private static void _appendInt(int value, byte[] buffer, int offset) {
buffer[offset++] = (byte) (value >> 24);
buffer[offset++] = (byte) (value >> 16);
buffer[offset++] = (byte) (value >> 8);
buffer[offset] = (byte) value;
}
private final static int _gatherInt(byte[] buffer, int offset) {
private static int _gatherInt(byte[] buffer, int offset) {
return (buffer[offset] << 24) | ((buffer[offset + 1] & 0xFF) << 16)
| ((buffer[offset + 2] & 0xFF) << 8) | (buffer[offset + 3] & 0xFF);
}
private final static void _checkUUIDByteArray(byte[] bytes, int offset) {
private static void _checkUUIDByteArray(byte[] bytes, int offset) {
if (bytes == null) {
throw new IllegalArgumentException("Invalid byte[] passed: can not be null");
}
......@@ -295,4 +295,4 @@ public class UUIDUtil {
throw new IllegalArgumentException("Invalid offset (" + offset + ") passed: not enough room in byte array (need 16 bytes)");
}
}
}
}
\ No newline at end of file
......@@ -405,4 +405,4 @@ public class HttpRequestClient {
// 创建一个包含各种SSL协议的SSLConnectionSocketFactory实例对象
return new SSLConnectionSocketFactory(ctx, new String[]{"SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"}, null, NoopHostnameVerifier.INSTANCE);
}
}
}
\ No newline at end of file
......@@ -44,4 +44,4 @@ public class SpringContextUtils implements ApplicationContextAware {
SpringContextUtils.applicationContext = applicationContext;
}
}
}
\ No newline at end of file
......@@ -86,4 +86,4 @@ public class TaskLockCache implements XCacheObject, XCacheLife {
return null;
}
}
}
}
\ No newline at end of file
......@@ -6,7 +6,6 @@ import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddressList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
......@@ -54,9 +53,7 @@ public class CascadeWriteHandler implements SheetWriteHandler {
Cell proviCell = provinceRow.createCell(i + 1);
proviCell.setCellValue(largeList.get(i));
}
Iterator<String> keyIterator = this.siteMap.keySet().iterator();
while (keyIterator.hasNext()) {
String key = keyIterator.next();
for (String key : this.siteMap.keySet()) {
List<String> son = siteMap.get(key);
Row row = hideSheet.createRow(rowId++);
row.createCell(0).setCellValue(key);
......@@ -142,4 +139,4 @@ public class CascadeWriteHandler implements SheetWriteHandler {
return "$" + start + "$" + rowId + ":$" + endPrefix + endSuffix + "$" + rowId;
}
}
}
}
\ No newline at end of file
......@@ -83,7 +83,6 @@ public class SelectedSheetWriteHandler implements SheetWriteHandler {
});
}
/**
* 返回excel列标A-Z-AA-ZZ
*
......
......@@ -272,8 +272,7 @@ public class EasyExcelUtil {
EasyExcel.read(inputStream, clazz, excelListener).build();
inputStream.close();
return excelReader;
} catch (Exception e) {
e.printStackTrace();
} catch (Exception ignored) {
}
return null;
}
......
......@@ -55,4 +55,4 @@ public class ValidationUtil {
throw new XServiceException(stringBuilder.toString());
}
}
}
}
\ No newline at end of file
......@@ -19,4 +19,4 @@ public class PpsCoreCommonModule extends XModule {
XProviderManager.setDefaultImplement(context, XSessionStorageProvider.class, PpsSessionStorageProviderImpl.class);
ManifestComponentInfoHelper.init(this.getClass().getClassLoader());
}
}
}
\ No newline at end of file
......@@ -8,4 +8,4 @@ public class MyIDGenerator extends DefaultIdentifierGenerator {
public String nextUUID(Object entity) {
return UUIDHelper.newUUID().replace("-", "");
}
}
}
\ No newline at end of file
......@@ -19,4 +19,4 @@ public enum MybaitisGlobalConfigSuppiler implements Supplier<GlobalConfig> {
public GlobalConfig get() {
return globalConfig;
}
}
}
\ No newline at end of file
......@@ -19,4 +19,4 @@ public class PpsCoreCommonMybatis extends XMybatis {
public GlobalConfig getGlobalConfig() {
return MybaitisGlobalConfigSuppiler.INSTANCE.get();
}
}
}
\ No newline at end of file
......@@ -46,4 +46,4 @@ public class PpsSessionStorageProviderImpl implements XSessionStorageProvider {
SessionCache.tryRefresh(context, userId, expires);
return XServiceResult.OK;
}
}
}
\ No newline at end of file
......@@ -36,4 +36,4 @@ public class MediaTypes {
public void setMediaTypeName(String mediaTypeName) {
MediaTypeName = mediaTypeName;
}
}
}
\ No newline at end of file
......@@ -463,4 +463,4 @@ public class PpsUserSession implements Serializable {
", ouPath='" + ouPath + '\'' +
'}';
}
}
}
\ No newline at end of file
......@@ -24,4 +24,4 @@ public class SysOrganization {
public void setOuName(String ouName) {
this.ouName = ouName;
}
}
}
\ No newline at end of file
......@@ -44,8 +44,7 @@ public class ExcelUtils {
Sheet sheet = buildDataSheet(workbook, headerList);
//构建每行的数据内容
int rowNum = 1;
for (Iterator<Map<String, Object>> it = dataList.iterator(); it.hasNext(); ) {
Map<String, Object> data = it.next();
for (Map<String, Object> data : dataList) {
if (CollUtil.isEmpty(data)) {
continue;
}
......@@ -251,8 +250,8 @@ public class ExcelUtils {
returnValue = cell.getStringCellValue();
break;
case BOOLEAN: //布尔
Boolean booleanValue = cell.getBooleanCellValue();
returnValue = booleanValue.toString();
boolean booleanValue = cell.getBooleanCellValue();
returnValue = Boolean.toString(booleanValue);
break;
case BLANK: // 空值
break;
......@@ -280,11 +279,11 @@ public class ExcelUtils {
Map<String, Object> resultData = new HashMap<>();
Cell cell;
int cellNum = 0;
for (int i = 0; i < headerList.size(); i++) {
for (String s : headerList) {
cell = row.getCell(cellNum++);
String name = convertCellValueToString(cell);
resultData.put(headerList.get(i), name);
resultData.put(s, name);
}
return resultData;
}
}
}
\ No newline at end of file
......@@ -19,20 +19,15 @@ import java.util.Map;
*/
public class ExportExcelUtils {
public static void outputFileData(byte[] fileBuff, String filePath) throws Exception {
public static void outputFileData(byte[] fileBuff, String filePath) {
File file = new File(filePath);
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
OutputStream out = Files.newOutputStream(file.toPath());
try {
try (OutputStream out = Files.newOutputStream(file.toPath())) {
out.write(fileBuff);
out.flush();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (out != null)
out.close();
} catch (IOException ignored) {
}
}
......@@ -59,9 +54,8 @@ public class ExportExcelUtils {
funcs.put("utils", new JxlsUtils()); //添加自定义功能
evaluator.getJexlEngine().setFunctions(funcs);
jxlsHelper.processTemplate(context, transformer);
} catch (IOException e) {
e.printStackTrace();
} catch (IOException ignored) {
}
return buff.toByteArray();
}
}
}
\ No newline at end of file
......@@ -24,9 +24,8 @@ public class JxlsUtils {
try {
SimpleDateFormat dateFmt = new SimpleDateFormat(pattern);
return dateFmt.format(date);
} catch (Exception e) {
e.printStackTrace();
} catch (Exception ignored) {
}
return "";
}
}
}
\ No newline at end of file
......@@ -47,4 +47,4 @@ public class ManifestComponentInfoHelper {
System.out.println(ex.getMessage());
}
}
}
}
\ No newline at end of file
......@@ -88,4 +88,4 @@ public class PatternUtil {
phoneNumber = realPhone;
return phoneNumber;
}
}
}
\ No newline at end of file
......@@ -69,8 +69,7 @@ public class RSAUtil {
}
decryptedData = out.toByteArray();
out.close();
} catch (Exception e) {
e.printStackTrace();
} catch (Exception ignored) {
}
return new String(decryptedData);
}
......@@ -111,7 +110,7 @@ public class RSAUtil {
}
Base64.Encoder encoder = Base64.getEncoder();
result = encoder.encodeToString(resultBytes);
} catch (Exception e) {
} catch (Exception ignored) {
}
return result;
}
......@@ -128,4 +127,4 @@ public class RSAUtil {
String decryptRes = RSAUtil.RsaDecrypt(encryptRes, privateKey);
System.out.println("res加密密文解密后的内容 : " + decryptRes);
}
}
}
\ No newline at end of file
......@@ -48,4 +48,4 @@ public class TreeNode<T> implements Serializable {
public void setChildren(List<T> children) {
this.children = children;
}
}
}
\ No newline at end of file
......@@ -44,13 +44,11 @@ public class TreeUtils {
*/
public static <T extends TreeNode> List<T> build(List<T> treeNodes) {
List<T> result = new ArrayList<>();
//list转map
Map<String, T> nodeMap = new LinkedHashMap<>(treeNodes.size());
for (T treeNode : treeNodes) {
nodeMap.put(treeNode.getId(), treeNode);
}
for (T node : nodeMap.values()) {
T parent = nodeMap.get(node.getPid());
if (parent != null && !(node.getId().equals(parent.getId()))) {
......@@ -60,8 +58,6 @@ public class TreeUtils {
result.add(node);
}
return result;
}
}
}
\ No newline at end of file
......@@ -13,4 +13,4 @@ public class UUIDHelper {
UUID uuid = noArgGenerator.generate();
return uuid.toString();
}
}
}
\ No newline at end of file
......@@ -66,10 +66,7 @@ public class VerificationCode {
//测试
public static void main(String[] args) throws Exception {
//创建文件输出流对象
// OutputStream out = new FileOutputStream("D://img/"+System.currentTimeMillis()+".jpg");
Map<String, Object> map = VerificationCode.generateCodeAndPic();
// ImageIO.write((RenderedImage) map.get("codePic"), "jpeg", out);
System.out.println("验证码的值为:" + map.get("code"));
}
}
}
\ 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