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 ...@@ -318,19 +318,13 @@ public class EthernetAddress
* @since 4.1 * @since 4.1
*/ */
public static EthernetAddress fromEgressInterface(InetSocketAddress externalSocketAddress) { public static EthernetAddress fromEgressInterface(InetSocketAddress externalSocketAddress) {
DatagramSocket socket = null; try (DatagramSocket socket = new DatagramSocket()) {
try {
socket = new DatagramSocket();
socket.connect(externalSocketAddress); socket.connect(externalSocketAddress);
InetAddress localAddress = socket.getLocalAddress(); InetAddress localAddress = socket.getLocalAddress();
NetworkInterface egressIf = NetworkInterface.getByInetAddress(localAddress); NetworkInterface egressIf = NetworkInterface.getByInetAddress(localAddress);
return fromInterface(egressIf); return fromInterface(egressIf);
} catch (SocketException e) { } catch (SocketException e) {
return null; return null;
} finally {
if (socket != null) {
socket.close();
}
} }
} }
......
...@@ -108,7 +108,7 @@ public class Generators { ...@@ -108,7 +108,7 @@ public class Generators {
digester = MessageDigest.getInstance("SHA-1"); digester = MessageDigest.getInstance("SHA-1");
type = UUIDType.NAME_BASED_SHA1; type = UUIDType.NAME_BASED_SHA1;
} catch (NoSuchAlgorithmException nex) { } 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); return new NameBasedGenerator(namespace, digester, type);
......
...@@ -27,8 +27,8 @@ import java.util.UUID; ...@@ -27,8 +27,8 @@ import java.util.UUID;
* Simple command-line interface to UUID generation functionality. * Simple command-line interface to UUID generation functionality.
*/ */
public class Jug { public class Jug {
protected final static HashMap<String, String> TYPES = new HashMap<String, String>(); protected final static HashMap<String, String> TYPES = new HashMap<>();
protected final static HashMap<String, String> OPTIONS = new HashMap<String, String>(); protected final static HashMap<String, String> OPTIONS = new HashMap<>();
static { static {
TYPES.put("time-based", "t"); TYPES.put("time-based", "t");
...@@ -117,7 +117,7 @@ public class Jug { ...@@ -117,7 +117,7 @@ public class Jug {
--count; --count;
// Type we recognize? // Type we recognize?
String tmp = (String) TYPES.get(type); String tmp = TYPES.get(type);
if (tmp == null) { if (tmp == null) {
if (!TYPES.containsValue(type)) { if (!TYPES.containsValue(type)) {
System.err.println("Unrecognized UUID generation type '" + System.err.println("Unrecognized UUID generation type '" +
...@@ -138,14 +138,14 @@ public class Jug { ...@@ -138,14 +138,14 @@ public class Jug {
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
String opt = args[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.err.println("Unrecognized option '" + opt + "' (missing leading hyphen?), exiting.");
System.exit(1); System.exit(1);
} }
char option = (char) 0; char option = (char) 0;
if (opt.startsWith("--")) { 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: // Let's translate longer names to simple names:
if (o != null) { if (o != null) {
option = o.charAt(0); option = o.charAt(0);
...@@ -187,7 +187,7 @@ public class Jug { ...@@ -187,7 +187,7 @@ public class Jug {
try { try {
addr = EthernetAddress.valueOf(next); addr = EthernetAddress.valueOf(next);
} catch (NumberFormatException nex) { } 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); System.exit(1);
} }
break; break;
...@@ -274,7 +274,6 @@ public class Jug { ...@@ -274,7 +274,6 @@ public class Jug {
System.err.println("--name (-n) - argument missing when using method that requires it, exiting."); System.err.println("--name (-n) - argument missing when using method that requires it, exiting.");
System.exit(1); System.exit(1);
} }
if (typeC == 'n') {
String orig = nameSpace; String orig = nameSpace;
nameSpace = nameSpace.toLowerCase(); nameSpace = nameSpace.toLowerCase();
if (nameSpace.equals("url")) { if (nameSpace.equals("url")) {
...@@ -286,16 +285,10 @@ public class Jug { ...@@ -286,16 +285,10 @@ public class Jug {
+ "'; only DNS and URL allowed for name-based generation."); + "'; only DNS and URL allowed for name-based generation.");
System.exit(1); System.exit(1);
} }
}
nameArgGenerator = Generators.nameBasedGenerator(nsUUID); nameArgGenerator = Generators.nameBasedGenerator(nsUUID);
break; break;
} }
// And then let's rock:
if (verbose) {
System.out.println();
}
// When measuring performance, make sure that the random number // When measuring performance, make sure that the random number
// generator is initialized prior to measurements... // generator is initialized prior to measurements...
long now = 0L; long now = 0L;
......
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--;
}
}
}
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);
}
}
...@@ -373,7 +373,7 @@ public class UUIDTimer { ...@@ -373,7 +373,7 @@ public class UUIDTimer {
do { do {
try { try {
Thread.sleep(delay); Thread.sleep(delay);
} catch (InterruptedException ie) { } catch (InterruptedException ignored) {
} }
delay = 1L; delay = 1L;
/* This is just a sanity check: don't want an "infinite" /* This is just a sanity check: don't want an "infinite"
......
...@@ -20,7 +20,7 @@ public enum UUIDType { ...@@ -20,7 +20,7 @@ public enum UUIDType {
private final int _raw; private final int _raw;
private UUIDType(int raw) { UUIDType(int raw) {
_raw = raw; _raw = raw;
} }
......
...@@ -4,6 +4,7 @@ import com.fasterxml.uuid.StringArgGenerator; ...@@ -4,6 +4,7 @@ import com.fasterxml.uuid.StringArgGenerator;
import com.fasterxml.uuid.UUIDType; import com.fasterxml.uuid.UUIDType;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.util.UUID; import java.util.UUID;
...@@ -36,7 +37,7 @@ public class NameBasedGenerator extends StringArgGenerator { ...@@ -36,7 +37,7 @@ public class NameBasedGenerator extends StringArgGenerator {
public final static UUID NAMESPACE_X500 = UUID.fromString("6ba7b814-9dad-11d1-80b4-00c04fd430c8"); public final static UUID NAMESPACE_X500 = UUID.fromString("6ba7b814-9dad-11d1-80b4-00c04fd430c8");
static { static {
_utf8 = Charset.forName("UTF-8"); _utf8 = StandardCharsets.UTF_8;
} }
/** /**
...@@ -54,7 +55,6 @@ public class NameBasedGenerator extends StringArgGenerator { ...@@ -54,7 +55,6 @@ public class NameBasedGenerator extends StringArgGenerator {
*/ */
protected final MessageDigest _digester; protected final MessageDigest _digester;
protected final UUIDType _type; protected final UUIDType _type;
private final LoggerFacade _logger = LoggerFacade.getLogger(getClass());
/* /*
/********************************************************************** /**********************************************************************
...@@ -85,6 +85,7 @@ public class NameBasedGenerator extends StringArgGenerator { ...@@ -85,6 +85,7 @@ public class NameBasedGenerator extends StringArgGenerator {
} else { } else {
// Hmmh... error out? Let's default to SHA-1, but log a warning // Hmmh... error out? Let's default to SHA-1, but log a warning
type = UUIDType.NAME_BASED_SHA1; 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); _logger.warn("Could not determine type of Digester from '%s'; assuming 'SHA-1' type", typeStr);
} }
} }
......
...@@ -22,11 +22,6 @@ import java.util.UUID; ...@@ -22,11 +22,6 @@ import java.util.UUID;
* @since 3.0 * @since 3.0
*/ */
public class RandomBasedGenerator extends NoArgGenerator { 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. * Random number generator that this generator uses.
...@@ -62,11 +57,10 @@ public class RandomBasedGenerator extends NoArgGenerator { ...@@ -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 l1 = _toInt(buffer, offset);
long l2 = _toInt(buffer, offset + 4); long l2 = _toInt(buffer, offset + 4);
long l = (l1 << 32) + ((l2 << 32) >>> 32); return (l1 << 32) + ((l2 << 32) >>> 32);
return l;
} }
/* /*
...@@ -75,7 +69,7 @@ public class RandomBasedGenerator extends NoArgGenerator { ...@@ -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) return (buffer[offset] << 24)
+ ((buffer[++offset] & 0xFF) << 16) + ((buffer[++offset] & 0xFF) << 16)
+ ((buffer[++offset] & 0xFF) << 8) + ((buffer[++offset] & 0xFF) << 8)
......
...@@ -58,11 +58,10 @@ public class TimeBasedEpochGenerator extends NoArgGenerator { ...@@ -58,11 +58,10 @@ public class TimeBasedEpochGenerator extends NoArgGenerator {
/********************************************************************** /**********************************************************************
*/ */
protected final static long _toLong(byte[] buffer, int offset) { protected static long _toLong(byte[] buffer) {
long l1 = _toInt(buffer, offset); long l1 = _toInt(buffer, 0);
long l2 = _toInt(buffer, offset + 4); long l2 = _toInt(buffer, 4);
long l = (l1 << 32) + ((l2 << 32) >>> 32); return (l1 << 32) + ((l2 << 32) >>> 32);
return l;
} }
/* /*
...@@ -71,7 +70,7 @@ public class TimeBasedEpochGenerator extends NoArgGenerator { ...@@ -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) return (buffer[offset] << 24)
+ ((buffer[++offset] & 0xFF) << 16) + ((buffer[++offset] & 0xFF) << 16)
+ ((buffer[++offset] & 0xFF) << 8) + ((buffer[++offset] & 0xFF) << 8)
...@@ -84,7 +83,7 @@ public class TimeBasedEpochGenerator extends NoArgGenerator { ...@@ -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) return ((buffer[offset] & 0xFF) << 8)
+ (buffer[++offset] & 0xFF); + (buffer[++offset] & 0xFF);
} }
...@@ -107,7 +106,7 @@ public class TimeBasedEpochGenerator extends NoArgGenerator { ...@@ -107,7 +106,7 @@ public class TimeBasedEpochGenerator extends NoArgGenerator {
// And then the other 64 bits of random; likewise UUIDUtil.constructUUID // And then the other 64 bits of random; likewise UUIDUtil.constructUUID
// will overwrite first 2 random bits so it's "only" 62 bits // 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 // and as per above, this call fills in "variant" and "version" bits
return UUIDUtil.constructUUID(UUIDType.TIME_BASED_EPOCH, l1, l2); return UUIDUtil.constructUUID(UUIDType.TIME_BASED_EPOCH, l1, l2);
......
...@@ -106,7 +106,7 @@ public class TimeBasedGenerator extends NoArgGenerator { ...@@ -106,7 +106,7 @@ public class TimeBasedGenerator extends NoArgGenerator {
// need to squeeze in type (4 MSBs in byte 6, clock hi) // need to squeeze in type (4 MSBs in byte 6, clock hi)
midhi &= ~0xF000; // remove high nibble of 6th byte midhi &= ~0xF000; // remove high nibble of 6th byte
midhi |= 0x1000; // type 1 midhi |= 0x1000; // type 1
long midhiL = (long) midhi; long midhiL = midhi;
midhiL = ((midhiL << 32) >>> 32); // to get rid of sign extension midhiL = ((midhiL << 32) >>> 32); // to get rid of sign extension
// and reconstruct // and reconstruct
long l1 = (((long) clockLo) << 32) | midhiL; long l1 = (((long) clockLo) << 32) | midhiL;
......
...@@ -111,10 +111,9 @@ public class TimeBasedReorderedGenerator extends NoArgGenerator { ...@@ -111,10 +111,9 @@ public class TimeBasedReorderedGenerator extends NoArgGenerator {
// and then bottom 28 bits split into mid (16 bits), low (12 bits) // and then bottom 28 bits split into mid (16 bits), low (12 bits)
final int timestampLow = (int) rawTimestamp; final int timestampLow = (int) rawTimestamp;
// and then low part gets mixed with variant identifier // 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 // and final 12 bits mixed with variant identifier
| 0x6000 | (timestampLow & 0xFFF); | 0x6000 | (timestampLow & 0xFFF);
long timeBottomL = (long) timeBottom;
timeBottomL = ((timeBottomL << 32) >>> 32); // to get rid of sign extension timeBottomL = ((timeBottomL << 32) >>> 32); // to get rid of sign extension
// and reconstruct // and reconstruct
......
...@@ -148,7 +148,7 @@ public class UUIDUtil { ...@@ -148,7 +148,7 @@ public class UUIDUtil {
public static UUID constructUUID(UUIDType type, long l1, long l2) { public static UUID constructUUID(UUIDType type, long l1, long l2) {
// first, ensure type is ok // first, ensure type is ok
l1 &= ~0xF000L; // remove high nibble of 6th byte 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) // second, ensure variant is properly set too (8th byte; most-sig byte of second long)
l2 = ((l2 << 2) >>> 2); // remove 2 MSB l2 = ((l2 << 2) >>> 2); // remove 2 MSB
l2 |= (2L << 62); // set 2 MSB to '10' l2 |= (2L << 62); // set 2 MSB to '10'
...@@ -161,7 +161,7 @@ public class UUIDUtil { ...@@ -161,7 +161,7 @@ public class UUIDUtil {
public static long initUUIDFirstLong(long l1, int rawType) { public static long initUUIDFirstLong(long l1, int rawType) {
l1 &= ~0xF000L; // remove high nibble of 6th byte l1 &= ~0xF000L; // remove high nibble of 6th byte
l1 |= (long) (rawType << 12); l1 |= (long) rawType << 12;
return l1; return l1;
} }
...@@ -259,7 +259,7 @@ public class UUIDUtil { ...@@ -259,7 +259,7 @@ public class UUIDUtil {
//private final static long MASK_LOW_INT = 0x0FFFFFFFF; //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 hi = ((long) _gatherInt(buffer, offset)) << 32;
//long lo = ((long) _gatherInt(buffer, offset+4)) & MASK_LOW_INT; //long lo = ((long) _gatherInt(buffer, offset+4)) & MASK_LOW_INT;
long lo = (((long) _gatherInt(buffer, offset + 4)) << 32) >>> 32; long lo = (((long) _gatherInt(buffer, offset + 4)) << 32) >>> 32;
...@@ -272,19 +272,19 @@ public class UUIDUtil { ...@@ -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 >> 24);
buffer[offset++] = (byte) (value >> 16); buffer[offset++] = (byte) (value >> 16);
buffer[offset++] = (byte) (value >> 8); buffer[offset++] = (byte) (value >> 8);
buffer[offset] = (byte) value; 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) return (buffer[offset] << 24) | ((buffer[offset + 1] & 0xFF) << 16)
| ((buffer[offset + 2] & 0xFF) << 8) | (buffer[offset + 3] & 0xFF); | ((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) { if (bytes == null) {
throw new IllegalArgumentException("Invalid byte[] passed: can not be null"); throw new IllegalArgumentException("Invalid byte[] passed: can not be null");
} }
......
...@@ -6,7 +6,6 @@ import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder; ...@@ -6,7 +6,6 @@ import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddressList; import org.apache.poi.ss.util.CellRangeAddressList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -54,9 +53,7 @@ public class CascadeWriteHandler implements SheetWriteHandler { ...@@ -54,9 +53,7 @@ public class CascadeWriteHandler implements SheetWriteHandler {
Cell proviCell = provinceRow.createCell(i + 1); Cell proviCell = provinceRow.createCell(i + 1);
proviCell.setCellValue(largeList.get(i)); proviCell.setCellValue(largeList.get(i));
} }
Iterator<String> keyIterator = this.siteMap.keySet().iterator(); for (String key : this.siteMap.keySet()) {
while (keyIterator.hasNext()) {
String key = keyIterator.next();
List<String> son = siteMap.get(key); List<String> son = siteMap.get(key);
Row row = hideSheet.createRow(rowId++); Row row = hideSheet.createRow(rowId++);
row.createCell(0).setCellValue(key); row.createCell(0).setCellValue(key);
......
...@@ -83,7 +83,6 @@ public class SelectedSheetWriteHandler implements SheetWriteHandler { ...@@ -83,7 +83,6 @@ public class SelectedSheetWriteHandler implements SheetWriteHandler {
}); });
} }
/** /**
* 返回excel列标A-Z-AA-ZZ * 返回excel列标A-Z-AA-ZZ
* *
......
...@@ -272,8 +272,7 @@ public class EasyExcelUtil { ...@@ -272,8 +272,7 @@ public class EasyExcelUtil {
EasyExcel.read(inputStream, clazz, excelListener).build(); EasyExcel.read(inputStream, clazz, excelListener).build();
inputStream.close(); inputStream.close();
return excelReader; return excelReader;
} catch (Exception e) { } catch (Exception ignored) {
e.printStackTrace();
} }
return null; return null;
} }
......
...@@ -44,8 +44,7 @@ public class ExcelUtils { ...@@ -44,8 +44,7 @@ public class ExcelUtils {
Sheet sheet = buildDataSheet(workbook, headerList); Sheet sheet = buildDataSheet(workbook, headerList);
//构建每行的数据内容 //构建每行的数据内容
int rowNum = 1; int rowNum = 1;
for (Iterator<Map<String, Object>> it = dataList.iterator(); it.hasNext(); ) { for (Map<String, Object> data : dataList) {
Map<String, Object> data = it.next();
if (CollUtil.isEmpty(data)) { if (CollUtil.isEmpty(data)) {
continue; continue;
} }
...@@ -251,8 +250,8 @@ public class ExcelUtils { ...@@ -251,8 +250,8 @@ public class ExcelUtils {
returnValue = cell.getStringCellValue(); returnValue = cell.getStringCellValue();
break; break;
case BOOLEAN: //布尔 case BOOLEAN: //布尔
Boolean booleanValue = cell.getBooleanCellValue(); boolean booleanValue = cell.getBooleanCellValue();
returnValue = booleanValue.toString(); returnValue = Boolean.toString(booleanValue);
break; break;
case BLANK: // 空值 case BLANK: // 空值
break; break;
...@@ -280,10 +279,10 @@ public class ExcelUtils { ...@@ -280,10 +279,10 @@ public class ExcelUtils {
Map<String, Object> resultData = new HashMap<>(); Map<String, Object> resultData = new HashMap<>();
Cell cell; Cell cell;
int cellNum = 0; int cellNum = 0;
for (int i = 0; i < headerList.size(); i++) { for (String s : headerList) {
cell = row.getCell(cellNum++); cell = row.getCell(cellNum++);
String name = convertCellValueToString(cell); String name = convertCellValueToString(cell);
resultData.put(headerList.get(i), name); resultData.put(s, name);
} }
return resultData; return resultData;
} }
......
...@@ -19,20 +19,15 @@ import java.util.Map; ...@@ -19,20 +19,15 @@ import java.util.Map;
*/ */
public class ExportExcelUtils { 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); File file = new File(filePath);
if (!file.getParentFile().exists()) { if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs(); file.getParentFile().mkdirs();
} }
OutputStream out = Files.newOutputStream(file.toPath()); try (OutputStream out = Files.newOutputStream(file.toPath())) {
try {
out.write(fileBuff); out.write(fileBuff);
out.flush(); out.flush();
} catch (IOException e) { } catch (IOException ignored) {
e.printStackTrace();
} finally {
if (out != null)
out.close();
} }
} }
...@@ -59,8 +54,7 @@ public class ExportExcelUtils { ...@@ -59,8 +54,7 @@ public class ExportExcelUtils {
funcs.put("utils", new JxlsUtils()); //添加自定义功能 funcs.put("utils", new JxlsUtils()); //添加自定义功能
evaluator.getJexlEngine().setFunctions(funcs); evaluator.getJexlEngine().setFunctions(funcs);
jxlsHelper.processTemplate(context, transformer); jxlsHelper.processTemplate(context, transformer);
} catch (IOException e) { } catch (IOException ignored) {
e.printStackTrace();
} }
return buff.toByteArray(); return buff.toByteArray();
} }
......
...@@ -24,8 +24,7 @@ public class JxlsUtils { ...@@ -24,8 +24,7 @@ public class JxlsUtils {
try { try {
SimpleDateFormat dateFmt = new SimpleDateFormat(pattern); SimpleDateFormat dateFmt = new SimpleDateFormat(pattern);
return dateFmt.format(date); return dateFmt.format(date);
} catch (Exception e) { } catch (Exception ignored) {
e.printStackTrace();
} }
return ""; return "";
} }
......
...@@ -69,8 +69,7 @@ public class RSAUtil { ...@@ -69,8 +69,7 @@ public class RSAUtil {
} }
decryptedData = out.toByteArray(); decryptedData = out.toByteArray();
out.close(); out.close();
} catch (Exception e) { } catch (Exception ignored) {
e.printStackTrace();
} }
return new String(decryptedData); return new String(decryptedData);
} }
...@@ -111,7 +110,7 @@ public class RSAUtil { ...@@ -111,7 +110,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 ignored) {
} }
return result; return result;
} }
......
...@@ -44,13 +44,11 @@ public class TreeUtils { ...@@ -44,13 +44,11 @@ public class TreeUtils {
*/ */
public static <T extends TreeNode> List<T> build(List<T> treeNodes) { public static <T extends TreeNode> List<T> build(List<T> treeNodes) {
List<T> result = new ArrayList<>(); List<T> result = new ArrayList<>();
//list转map //list转map
Map<String, T> nodeMap = new LinkedHashMap<>(treeNodes.size()); Map<String, T> nodeMap = new LinkedHashMap<>(treeNodes.size());
for (T treeNode : treeNodes) { for (T treeNode : treeNodes) {
nodeMap.put(treeNode.getId(), treeNode); nodeMap.put(treeNode.getId(), treeNode);
} }
for (T node : nodeMap.values()) { for (T node : nodeMap.values()) {
T parent = nodeMap.get(node.getPid()); T parent = nodeMap.get(node.getPid());
if (parent != null && !(node.getId().equals(parent.getId()))) { if (parent != null && !(node.getId().equals(parent.getId()))) {
...@@ -60,8 +58,6 @@ public class TreeUtils { ...@@ -60,8 +58,6 @@ public class TreeUtils {
result.add(node); result.add(node);
} }
return result; return result;
} }
} }
\ No newline at end of file
...@@ -66,10 +66,7 @@ public class VerificationCode { ...@@ -66,10 +66,7 @@ public class VerificationCode {
//测试 //测试
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
//创建文件输出流对象 //创建文件输出流对象
// OutputStream out = new FileOutputStream("D://img/"+System.currentTimeMillis()+".jpg");
Map<String, Object> map = VerificationCode.generateCodeAndPic(); Map<String, Object> map = VerificationCode.generateCodeAndPic();
// ImageIO.write((RenderedImage) map.get("codePic"), "jpeg", out);
System.out.println("验证码的值为:" + map.get("code")); 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