diff --git a/luqj-common/src/main/java/com/luqj/qiniu/task/QiNiuRefreshTokenTask.java b/luqj-common/src/main/java/com/luqj/qiniu/task/QiNiuRefreshTokenTask.java
index f9538e5..f581b4e 100644
--- a/luqj-common/src/main/java/com/luqj/qiniu/task/QiNiuRefreshTokenTask.java
+++ b/luqj-common/src/main/java/com/luqj/qiniu/task/QiNiuRefreshTokenTask.java
@@ -20,7 +20,7 @@ public class QiNiuRefreshTokenTask {
private IQiniuService qiniuService;
// @Scheduled(cron = "0/10 * * * * ?")
- @Scheduled(cron = "* 0/10 * * * ?")
+ @Scheduled(cron = "0 */10 * * * ?")
public void refreshQiniuToken() {
qiniuService.refreshQiniuToken();
diff --git a/luqj-common/src/main/java/com/luqj/util/ArithmeticEnum.java b/luqj-common/src/main/java/com/luqj/util/ArithmeticEnum.java
new file mode 100644
index 0000000..112950c
--- /dev/null
+++ b/luqj-common/src/main/java/com/luqj/util/ArithmeticEnum.java
@@ -0,0 +1,102 @@
+package com.luqj.util;
+
+
+/**
+ * 算术符号
+ * @author chenzm
+ */
+public enum ArithmeticEnum {
+
+ /**左括号**/
+ lb("(", "左括号", -1),
+ /**右括号**/
+ rb(")", "右括号", -1),
+
+ /**乘**/
+ multiply("*", "乘", -3),
+ /**除**/
+ division("/", "除", -3),
+
+ /**加**/
+ addition("+", "加", -4),
+ /**减**/
+ subtract("-", "减", -4),
+
+ /**大于**/
+ gt(">", "大于", -6),
+ /**小于**/
+ lt("<", "小于", -6),
+ /**大于等于**/
+ gte(">=", "大于等于", -6),
+ /**小于等于**/
+ lte("<=", "小于等于", -6);
+
+ /**符号**/
+ private String symbol;
+
+ /**优先级**/
+ private int priority;
+
+ private String desc;
+
+ private ArithmeticEnum(String symbol, String desc, int priority) {
+ this.symbol = symbol;
+ this.desc = desc;
+ this.priority = priority;
+ }
+
+ public boolean isEqualBySymbol(String c) {
+ return this.getSymbol().equals(c);
+ }
+
+ public boolean isEqualBySymbol(char c) {
+ return this.getSymbol().equals("" + c);
+ }
+
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public void setSymbol(String symbol) {
+ this.symbol = symbol;
+ }
+
+ public String getDesc() {
+ return desc;
+ }
+
+ public void setDesc(String desc) {
+ this.desc = desc;
+ }
+
+ public int getPriority() {
+ return priority;
+ }
+
+ public void setPriority(int priority) {
+ this.priority = priority;
+ }
+
+ /**
+ * 获取符号等级
+ */
+ public static int getSymbolLevel(String c) {
+ return getArithmeticEnum(c).getPriority();
+ }
+
+ public static ArithmeticEnum getArithmeticEnum(String c) {
+ for(ArithmeticEnum t : ArithmeticEnum.values()) {
+ if(t.getSymbol().equals(c)) {
+ return t;
+ }
+ }
+ return null;
+ }
+
+ public static boolean containsKey(String c) {
+ if(getArithmeticEnum(c) != null) {
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/luqj-common/src/main/java/com/luqj/util/CharBuffer.java b/luqj-common/src/main/java/com/luqj/util/CharBuffer.java
new file mode 100644
index 0000000..0d4b14f
--- /dev/null
+++ b/luqj-common/src/main/java/com/luqj/util/CharBuffer.java
@@ -0,0 +1,567 @@
+package com.luqj.util;
+
+
+import com.luqj.util.parse.SymbolSet;
+
+import java.util.NoSuchElementException;
+
+/**
+ * 字符缓存
+ */
+public class CharBuffer {
+
+ transient int size = 0;
+
+ transient Node first;
+
+ transient Node last;
+
+ transient int modCount = 0;
+
+ public CharBuffer() {
+ }
+
+ public CharBuffer(String str) {
+ for(char c : str.toCharArray()) {
+ this.add(c);
+ }
+ }
+
+ public CharBuffer(char[] chs) {
+ for(char c : chs) {
+ this.add(c);
+ }
+ }
+
+ public String asString() {
+ return new String(this.toArray());
+ }
+
+ public void addStr(String str) {
+ for(char c : str.toCharArray()) {
+ this.add(c);
+ }
+ }
+
+ /**
+ * Links e as first element.
+ */
+ private void linkFirst(char e) {
+ final Node f = first;
+ final Node newNode = new Node(null, e, f);
+ first = newNode;
+ if (f == null)
+ last = newNode;
+ else
+ f.prev = newNode;
+ size++;
+ modCount++;
+ }
+
+
+ void linkLast(char e) {
+ final Node l = last;
+ final Node newNode = new Node(l, e, null);
+ last = newNode;
+ if (l == null)
+ first = newNode;
+ else
+ l.next = newNode;
+ size++;
+ modCount++;
+ }
+
+ /**
+ * Inserts element e before non-null Node succ.
+ */
+ void linkBefore(char e, Node succ) {
+ // assert succ != null;
+ final Node pred = succ.prev;
+ final Node newNode = new Node(pred, e, succ);
+ succ.prev = newNode;
+ if (pred == null)
+ first = newNode;
+ else
+ pred.next = newNode;
+ size++;
+ modCount++;
+ }
+
+ /**
+ * Unlinks non-null first node f.
+ */
+ private char unlinkFirst(Node f) {
+ // assert f == first && f != null;
+ final char element = f.item;
+ final Node next = f.next;
+ //f.item = ' ';
+ f.next = null; // help GC
+ first = next;
+ if (next == null)
+ last = null;
+ else
+ next.prev = null;
+ size--;
+ modCount++;
+ return element;
+ }
+
+ /**
+ * Unlinks non-null last node l.
+ */
+ private char unlinkLast(Node l) {
+ // assert l == last && l != null;
+ final char element = l.item;
+ final Node prev = l.prev;
+ //l.item = null;
+ l.prev = null; // help GC
+ last = prev;
+ if (prev == null)
+ first = null;
+ else
+ prev.next = null;
+ size--;
+ modCount++;
+ return element;
+ }
+
+ /**
+ * Unlinks non-null node x.
+ */
+ char unlink(Node x) {
+ // assert x != null;
+ final char element = x.item;
+ final Node next = x.next;
+ final Node prev = x.prev;
+
+ if (prev == null) {
+ first = next;
+ } else {
+ prev.next = next;
+ x.prev = null;
+ }
+
+ if (next == null) {
+ last = prev;
+ } else {
+ next.prev = prev;
+ x.next = null;
+ }
+
+ //x.item = null;
+ size--;
+ modCount++;
+ return element;
+ }
+
+ /**
+ * Returns the first element in this list.
+ *
+ * @return the first element in this list
+ * @throws NoSuchElementException if this list is empty
+ */
+ public char getFirst() {
+ final Node f = first;
+ if (f == null)
+ throw new NoSuchElementException();
+ return f.item;
+ }
+
+ /**
+ * Returns the last element in this list.
+ *
+ * @return the last element in this list
+ * @throws NoSuchElementException if this list is empty
+ */
+ public char getLast() {
+ final Node l = last;
+ if (l == null)
+ throw new NoSuchElementException();
+ return l.item;
+ }
+
+ /**
+ * Removes and returns the first element from this list.
+ *
+ * @return the first element from this list
+ * @throws NoSuchElementException if this list is empty
+ */
+ public char removeFirst() {
+ final Node f = first;
+ if (f == null)
+ throw new NoSuchElementException();
+ return unlinkFirst(f);
+ }
+
+ /**
+ * Removes and returns the last element from this list.
+ *
+ * @return the last element from this list
+ * @throws NoSuchElementException if this list is empty
+ */
+ public char removeLast() {
+ final Node l = last;
+ if (l == null)
+ throw new NoSuchElementException();
+ return unlinkLast(l);
+ }
+
+ /**
+ * Inserts the specified element at the beginning of this list.
+ *
+ * @param e the element to add
+ */
+ public void addFirst(char e) {
+ linkFirst(e);
+ }
+
+ /**
+ * Appends the specified element to the end of this list.
+ *
+ *
This method is equivalent to {@link #add}.
+ *
+ * @param e the element to add
+ */
+ public void addLast(char e) {
+ linkLast(e);
+ }
+
+ /**
+ * Returns the number of elements in this list.
+ *
+ * @return the number of elements in this list
+ */
+ public int size() {
+ return size;
+ }
+
+ /**
+ * Appends the specified element to the end of this list.
+ *
+ *
This method is equivalent to {@link #addLast}.
+ *
+ * @param e element to be appended to this list
+ * @return {@code true} (as specified by
+ */
+ public boolean add(char e) {
+ linkLast(e);
+ return true;
+ }
+
+
+
+
+ /**
+ * Removes all of the elements from this list.
+ * The list will be empty after this call returns.
+ */
+ public void clear() {
+ // Clearing all of the links between nodes is "unnecessary", but:
+ // - helps a generational GC if the discarded nodes inhabit
+ // more than one generation
+ // - is sure to free memory even if there is a reachable Iterator
+ for (Node x = first; x != null; ) {
+ Node next = x.next;
+ //x.item = null;
+ x.next = null;
+ x.prev = null;
+ x = next;
+ }
+ first = last = null;
+ size = 0;
+ modCount++;
+ }
+
+
+ // Positional Access Operations
+
+ /**
+ * Returns the element at the specified position in this list.
+ *
+ * @param index index of the element to return
+ * @return the element at the specified position in this list
+ * @throws IndexOutOfBoundsException {@inheritDoc}
+ */
+ public char get(int index) {
+ //checkElementIndex(index);
+ return node(index).item;
+ }
+
+
+
+ /**
+ * Tells if the argument is the index of an existing element.
+ */
+ private boolean isElementIndex(int index) {
+ return index >= 0 && index < size;
+ }
+
+ /**
+ * Tells if the argument is the index of a valid position for an
+ * iterator or an add operation.
+ */
+ private boolean isPositionIndex(int index) {
+ return index >= 0 && index <= size;
+ }
+
+ /**
+ * Constructs an IndexOutOfBoundsException detail message.
+ * Of the many possible refactorings of the error handling code,
+ * this "outlining" performs best with both server and client VMs.
+ */
+ private String outOfBoundsMsg(int index) {
+ return "Index: "+index+", Size: "+size;
+ }
+
+ /*private void checkElementIndex(int index) {
+ if (!isElementIndex(index))
+ throw new IndexOutOfBoundsException(outOfBoundsMsg(index));
+ }*/
+
+ /* private void checkPositionIndex(int index) {
+ if (!isPositionIndex(index))
+ throw new IndexOutOfBoundsException(outOfBoundsMsg(index));
+ }*/
+
+ /**
+ * Returns the (non-null) Node at the specified element index.
+ */
+ Node node(int index) {
+ // assert isElementIndex(index);
+
+ if (index < (size >> 1)) {
+ Node x = first;
+ for (int i = 0; i < index; i++)
+ x = x.next;
+ return x;
+ } else {
+ Node x = last;
+ for (int i = size - 1; i > index; i--)
+ x = x.prev;
+ return x;
+ }
+ }
+
+
+ /**
+ * Retrieves and removes the head (first element) of this list.
+ *
+ * @return the head of this list, or {@code null} if this list is empty
+ * @since 1.5
+ */
+ public char poll() {
+ final Node f = first;
+ return (f == null) ? null : unlinkFirst(f);
+ }
+
+ /**
+ * Retrieves and removes the head (first element) of this list.
+ *
+ * @return the head of this list
+ * @throws NoSuchElementException if this list is empty
+ * @since 1.5
+ */
+ public char remove() {
+ return removeFirst();
+ }
+
+ /**
+ * Adds the specified element as the tail (last element) of this list.
+ *
+ * @param e the element to add
+ * @since 1.5
+ */
+ public boolean offer(char e) {
+ return add(e);
+ }
+
+ // Deque operations
+ /**
+ * Inserts the specified element at the front of this list.
+ *
+ * @param e the element to insert
+ * @since 1.6
+ */
+ public boolean offerFirst(char e) {
+ addFirst(e);
+ return true;
+ }
+
+ /**
+ * Inserts the specified element at the end of this list.
+ *
+ * @param e the element to insert
+ * @since 1.6
+ */
+ public boolean offerLast(char e) {
+ addLast(e);
+ return true;
+ }
+
+ /**
+ * Retrieves, but does not remove, the first element of this list,
+ * or returns {@code null} if this list is empty.
+ *
+ * @return the first element of this list, or {@code null}
+ * if this list is empty
+ * @since 1.6
+ */
+ public char peekFirst() {
+ final Node f = first;
+ return (f == null) ? null : f.item;
+ }
+
+ public boolean isEmpty() {
+ return size() == 0;
+ }
+
+ /**
+ * Retrieves, but does not remove, the last element of this list,
+ * or returns {@code null} if this list is empty.
+ *
+ * @return the last element of this list, or {@code null}
+ * if this list is empty
+ * @since 1.6
+ */
+ public char peekLast() {
+ final Node l = last;
+ return (l == null) ? null : l.item;
+ }
+
+ /**
+ * Retrieves and removes the first element of this list,
+ * or returns {@code null} if this list is empty.
+ *
+ * @return the first element of this list, or {@code null} if
+ * this list is empty
+ * @since 1.6
+ */
+ public char pollFirst() {
+ final Node f = first;
+ return (f == null) ? null : unlinkFirst(f);
+ }
+
+ /**
+ * Retrieves and removes the last element of this list,
+ * or returns {@code null} if this list is empty.
+ *
+ * @return the last element of this list, or {@code null} if
+ * this list is empty
+ * @since 1.6
+ */
+ public char pollLast() {
+ final Node l = last;
+ return (l == null) ? null : unlinkLast(l);
+ }
+
+ /**
+ * Pushes an element onto the stack represented by this list. In other
+ * words, inserts the element at the front of this list.
+ *
+ *
This method is equivalent to {@link #addFirst}.
+ *
+ * @param e the element to push
+ * @since 1.6
+ */
+ public void push(char e) {
+ addFirst(e);
+ }
+
+ /**
+ * Pops an element from the stack represented by this list. In other
+ * words, removes and returns the first element of this list.
+ *
+ *
This method is equivalent to {@link #removeFirst()}.
+ *
+ * @return the element at the front of this list (which is the top
+ * of the stack represented by this list)
+ * @throws NoSuchElementException if this list is empty
+ * @since 1.6
+ */
+ public char pop() {
+ return removeFirst();
+ }
+
+ private static class Node {
+ char item;
+ Node next;
+ Node prev;
+
+ Node(Node prev, char element, Node next) {
+ this.item = element;
+ this.next = next;
+ this.prev = prev;
+ }
+ }
+
+
+
+ /**
+ * Returns an array containing all of the elements in this list
+ * in proper sequence (from first to last element).
+ *
+ *
The returned array will be "safe" in that no references to it are
+ * maintained by this list. (In other words, this method must allocate
+ * a new array). The caller is thus free to modify the returned array.
+ *
+ *
This method acts as bridge between array-based and collection-based
+ * APIs.
+ *
+ * @return an array containing all of the elements in this list
+ * in proper sequence
+ */
+ public char[] toArray() {
+ char[] result = new char[size];
+ int i = 0;
+ for (Node x = first; x != null; x = x.next)
+ result[i++] = x.item;
+ return result;
+ }
+
+ public char[] subArray(int start,int end){
+ if (start < 0)
+ throw new ArrayIndexOutOfBoundsException(start);
+ if (end > size)
+ throw new StringIndexOutOfBoundsException(end);
+ if (start > end)
+ throw new ArrayIndexOutOfBoundsException(end - start);
+ int size = end-start;
+ char[] result = new char[size];
+ int iStart = 0;
+ for (Node x = first; x != null && iStart < end; x = x.next){
+ if(iStart >= start){
+ result[iStart - start] = x.item;
+ }
+ iStart++;
+ }
+ return result;
+ }
+
+
+
+ @Override
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ for (Node x = first; x != null; x = x.next)
+ sb.append(x.item+",");
+ return "["+sb.toString()+"]";
+ }
+
+ /**
+ * 是否是文本
+ * @return
+ */
+ public boolean isText() {
+ boolean isNull = true;
+ for(char c : this.toArray()) {
+ if(c != SymbolSet.SYMBOL_NULL) {
+ isNull = false;
+ break;
+ }
+ }
+ return this.size() > 0 && !isNull;
+ }
+
+
+ private static final long serialVersionUID = 876323262645176354L;
+}
diff --git a/luqj-common/src/main/java/com/luqj/util/FileSystemUtil.java b/luqj-common/src/main/java/com/luqj/util/FileSystemUtil.java
new file mode 100644
index 0000000..e27d14e
--- /dev/null
+++ b/luqj-common/src/main/java/com/luqj/util/FileSystemUtil.java
@@ -0,0 +1,137 @@
+package com.luqj.util;
+
+
+import com.luqj.util.assertion.Assert;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class FileSystemUtil {
+
+ private static final char SYSTEM_SEPARATOR = File.separatorChar;
+
+ private static final char WINDOWS_SEPARATOR = '\\';
+
+ /**
+ * 递归获取指定目录下的所有文件
+ * @param dir
+ * @param filterDir 子目录是否返回在集合中
+ * @return
+ */
+ public static final List getAllFiles(File dir,boolean filterDir,FileFilter filter){
+ Assert.logic(dir.isDirectory() && dir.canRead(),dir+"必须是目录且可读");
+ List result = new ArrayList();
+ File[] files = null;
+ if(filter != null){
+ files = dir.listFiles(filter);
+ }else{
+ files = dir.listFiles();
+ }
+ for (File file : files) {
+ if(file.isDirectory()){
+ if(filterDir){
+ result.add(file);
+ }
+ result.addAll(getAllFiles(file, filterDir, filter));
+ }else{
+ result.add(file);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * 强制删除文件
+ * 引用org.apache.commons.io.FileUtils代码
+ * @param file
+ * @throws IOException
+ */
+ public static void forceDelete(File file) throws IOException {
+ if (file.isDirectory()) {
+ deleteDirectory(file);
+ } else {
+ boolean filePresent = file.exists();
+ if (!file.delete()) {
+ if (!filePresent){
+ throw new FileNotFoundException("File does not exist: " + file);
+ }
+ String message =
+ "Unable to delete file: " + file;
+ throw new IOException(message);
+ }
+ }
+ }
+
+ public static void deleteDirectory(File directory) throws IOException {
+ if (!directory.exists()) {
+ return;
+ }
+
+ if (!isSymlink(directory)) {
+ cleanDirectory(directory);
+ }
+
+ if (!directory.delete()) {
+ String message =
+ "Unable to delete directory " + directory + ".";
+ throw new IOException(message);
+ }
+ }
+
+ public static boolean isSymlink(File file) throws IOException {
+ if (file == null) {
+ throw new NullPointerException("File must not be null");
+ }
+ if (SYSTEM_SEPARATOR == WINDOWS_SEPARATOR) {
+ return false;
+ }
+ File fileInCanonicalDir = null;
+ if (file.getParent() == null) {
+ fileInCanonicalDir = file;
+ } else {
+ File canonicalDir = file.getParentFile().getCanonicalFile();
+ fileInCanonicalDir = new File(canonicalDir, file.getName());
+ }
+
+ if (fileInCanonicalDir.getCanonicalFile().equals(fileInCanonicalDir.getAbsoluteFile())) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ public static void cleanDirectory(File directory) throws IOException {
+ if (!directory.exists()) {
+ String message = directory + " does not exist";
+ throw new IllegalArgumentException(message);
+ }
+
+ if (!directory.isDirectory()) {
+ String message = directory + " is not a directory";
+ throw new IllegalArgumentException(message);
+ }
+
+ File[] files = directory.listFiles();
+ if (files == null) { // null if security restricted
+ throw new IOException("Failed to list contents of " + directory);
+ }
+
+ IOException exception = null;
+ for (File file : files) {
+ try {
+ forceDelete(file);
+ } catch (IOException ioe) {
+ exception = ioe;
+ }
+ }
+
+ if (null != exception) {
+ throw exception;
+ }
+ }
+}
diff --git a/luqj-common/src/main/java/com/luqj/util/IdentificationNumberUtils.java b/luqj-common/src/main/java/com/luqj/util/IdentificationNumberUtils.java
new file mode 100644
index 0000000..c3798c7
--- /dev/null
+++ b/luqj-common/src/main/java/com/luqj/util/IdentificationNumberUtils.java
@@ -0,0 +1,322 @@
+package com.luqj.util;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+/**
+ * Created: 2016/7/5.
+ * Author: Qiannan Lu
+ */
+public class IdentificationNumberUtils {
+ private final static Logger logger = LoggerFactory.getLogger(IdentificationNumberUtils.class);
+
+ /**
+ * 获取身份证号的出生日期字符串
+ *
+ * @param idCard 身份证号
+ * @return 出生日期字符串
+ */
+ public static String birthday(String idCard) {
+ if (StringUtils.isBlank(idCard)
+ || idCard.length() <= 14) {
+ logger.error("传入身份证号{}位数不对!", idCard);
+ return null;
+ }
+
+ return id15ToId18(idCard).substring(6, 14);
+ }
+
+ /**
+ * 获取身份证号的出生日期
+ *
+ * @param idCard 身份证号
+ * @return 出生日期
+ */
+ public static Date birthDate(String idCard) {
+
+ String birthDay = birthday(idCard);
+
+ if (birthDay == null) return null;
+ try {
+ return new SimpleDateFormat("yyyyMMdd").parse(birthDay);
+ } catch (Exception e) {
+ logger.error("提取身份证号{}出生日期出错", idCard, e);
+ return null;
+ }
+ }
+
+ /**
+ * 获取身份证号的年份信息
+ *
+ * @param idCard 身份证号
+ * @return 年份信息
+ */
+ public static String year(String idCard) {
+ Calendar calendar = getBirthDateCalendar(idCard);
+
+ return calendar == null ? null : Integer.toString(calendar.get(Calendar.YEAR));
+ }
+
+ /**
+ * 获取身份证号的月份信息 从1月开始
+ *
+ * @param idCard 身份证号
+ * @return 月份信息
+ */
+ public static String month(String idCard) {
+ Calendar calendar = getBirthDateCalendar(idCard);
+
+ return calendar == null ? null : Integer.toString(calendar.get(Calendar.MONTH) + 1);
+ }
+
+ /**
+ * 获取身份证号的日期信息 月份中的日期
+ *
+ * @param idCard 身份证号
+ * @return 日期信息
+ */
+ public static String day(String idCard) {
+ Calendar calendar = getBirthDateCalendar(idCard);
+
+ return calendar == null ? null : Integer.toString(calendar.get(Calendar.DATE));
+ }
+
+ /**
+ * 获取身份证号的日期信息 一年中的日期
+ *
+ * @param idCard 身份证号
+ * @return 日期信息
+ */
+ public static String dayOfYear(String idCard) {
+
+ Calendar calendar = getBirthDateCalendar(idCard);
+
+ return calendar == null ? null : Integer.toString(calendar.get(Calendar.DAY_OF_YEAR));
+ }
+
+ /**
+ * 获取身份证号的出生日期信息
+ *
+ * @param idCard 身份证号
+ * @return 出生日期
+ */
+ private static Calendar getBirthDateCalendar(String idCard) {
+ Date birthDate = birthDate(idCard);
+
+ if (birthDate == null) return null;
+
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(birthDate);
+ return calendar;
+ }
+
+ /**
+ * 18位身份证转15位.
+ *
+ * @param id18 18为身份证号
+ * @return 15位身份证号
+ */
+ public static String id18ToId15(String id18) {
+ return id18.substring(0, 6) + id18.substring(8, 17);
+ }
+
+ /**
+ * 15位身份证转18位.
+ *
+ * @param id15 15位身份证号
+ * @return 18位身份证号
+ */
+ public static String id15ToId18(String id15) {
+ int IdLength = id15.length();
+ String id18;
+ switch (IdLength) {
+ case 15:
+ String serial = id15.substring(IdLength - 3);
+ if (serial.equals("996") || serial.equals("997") || serial.equals("998") || serial.equals("999")) {
+ id18 = id15.substring(0, 6) + "18" + id15.substring(IdLength - 9);
+ } else {
+ id18 = id15.substring(0, 6) + "19" + id15.substring(IdLength - 9);
+ }
+ id18 = id18 + getIdCheckBit(id18);
+ break;
+ case 17:
+ id18 = id15 + getIdCheckBit(id15);
+ break;
+ case 18:
+ id18 = id15;
+ break;
+ default:
+ id18 = id15;
+ }
+ return id18;
+ }
+
+ /**
+ * 判断传入的字符串是否是身份证号,如果是18位 会判断最后一位标志位
+ * 如果是15位则返回false
+ *
+ * @param idCard 身份证号
+ * @return 是否是真是身份证号
+ */
+ public static boolean isValid(String idCard) {
+
+ boolean isLooksLike = isLooksLike(idCard);
+
+ if (isLooksLike && idCard.length() == 18) {
+ String x = getIdCheckBit(idCard);
+ if (x.equals("" + idCard.charAt(17)))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * 判断传入的字符串(15位或者18位)是否是身份证号,其他直接返回false
+ * @param idCard 身份证号
+ * @return 是否是真是身份证号
+ */
+ public static boolean checkIsIdCard(String idCard) {
+ boolean isLooksLike = isLooksLike(idCard);
+ if (isLooksLike && idCard.length() == 18) {
+ String x = getIdCheckBit(idCard);
+ if (x.equals("" + idCard.charAt(17)))
+ return true;
+ }
+ if (isLooksLike && idCard.length() == 15) {
+ String x = getIdCheckBit(id15ToId18(idCard));
+ if (x.equals("" + id15ToId18(idCard).charAt(17)))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * 判断传入的字符串是否像是身份证号,只会判断出身年月信息
+ *
+ * @param idCard 身份证号
+ * @return 是否像身份证号
+ */
+ public static boolean isLooksLike(String idCard) {
+ if (idCard.length() == 15) {
+
+ String birthday = idCard.substring(6, 12);
+
+ return isYear(birthday.substring(0, 2)) && isMonth(birthday.substring(2, 4)) && isDay(birthday.substring(4, 6));
+ } else if (idCard.length() == 18) {
+ String birthday = idCard.substring(6, 14);
+ return isYear(birthday.substring(0, 4)) && isMonth(birthday.substring(4, 6)) && isDay(birthday.substring(6, 8));
+ }
+ return false;
+ }
+
+ /**
+ * 判断数字是否符合年份
+ *
+ * @param year 数字
+ */
+ private static boolean isYear(String year) {
+ if (year.length() == 4) {
+ try {
+ int y = Integer.parseInt(year);
+ if (y < 1900 || y > 2100) {
+ return false;
+ }
+ } catch (Exception e) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * 判断数字是否符合月份
+ *
+ * @param month 数字
+ */
+ private static boolean isMonth(String month) {
+ try {
+ int m = Integer.parseInt(month);
+ if (m < 1 || m > 12) {
+ return false;
+ }
+ } catch (Exception e) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * 判断数字是否符合日期
+ *
+ * @param day 数字
+ */
+ private static boolean isDay(String day) {
+ try {
+ int d = Integer.parseInt(day);
+ if (d < 1 || d > 31) {
+ return false;
+ }
+ } catch (Exception e) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * 获取18位身份证号的校验位
+ *
+ * @param id18 18位身份证号
+ * @return 校验位
+ */
+ public static String getIdCheckBit(String id18) {
+ String[] strCheckChar = new String[11];
+ int[] nWeight = new int[18];
+ strCheckChar[0] = "1";
+ strCheckChar[1] = "0";
+ strCheckChar[2] = "X";
+ strCheckChar[3] = "9";
+ strCheckChar[4] = "8";
+ strCheckChar[5] = "7";
+ strCheckChar[6] = "6";
+ strCheckChar[7] = "5";
+ strCheckChar[8] = "4";
+ strCheckChar[9] = "3";
+ strCheckChar[10] = "2";
+
+ nWeight[0] = 7;
+ nWeight[1] = 9;
+ nWeight[2] = 10;
+ nWeight[3] = 5;
+ nWeight[4] = 8;
+ nWeight[5] = 4;
+ nWeight[6] = 2;
+ nWeight[7] = 1;
+ nWeight[8] = 6;
+ nWeight[9] = 3;
+ nWeight[10] = 7;
+ nWeight[11] = 9;
+ nWeight[12] = 10;
+ nWeight[13] = 5;
+ nWeight[14] = 8;
+ nWeight[15] = 4;
+ nWeight[16] = 2;
+ nWeight[17] = 1;
+
+ int sumMulti = 0;
+ for (int i = 0; i <= 16; i++) {
+ String ch = id18.substring(i, i + 1);
+ sumMulti = sumMulti + (Integer.parseInt(ch) * nWeight[i]);
+ }
+ int resultMod = sumMulti % 11;
+ return strCheckChar[resultMod];
+ }
+
+
+ public static void main(String[] args) {
+
+ }
+}
diff --git a/luqj-common/src/main/java/com/luqj/util/LinkedMultiValueMap.java b/luqj-common/src/main/java/com/luqj/util/LinkedMultiValueMap.java
new file mode 100644
index 0000000..a5a6c0f
--- /dev/null
+++ b/luqj-common/src/main/java/com/luqj/util/LinkedMultiValueMap.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2002-2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.luqj.util;
+
+import java.io.Serializable;
+import java.util.*;
+
+/**
+ * Simple implementation of {@link MultiValueMap} that wraps a {@link LinkedHashMap},
+ * storing multiple values in a {@link LinkedList}.
+ *
+ * This Map implementation is generally not thread-safe. It is primarily designed
+ * for data structures exposed from request objects, for use in a single thread only.
+ *
+ * @author Arjen Poutsma
+ * @author Juergen Hoeller
+ * @since 3.0
+ */
+public class LinkedMultiValueMap implements MultiValueMap, Serializable {
+
+ private static final long serialVersionUID = 3801124242820219131L;
+
+ private final Map> targetMap;
+
+
+ /**
+ * Create a new LinkedMultiValueMap that wraps a {@link LinkedHashMap}.
+ */
+ public LinkedMultiValueMap() {
+ this.targetMap = new LinkedHashMap>();
+ }
+
+ /**
+ * Create a new LinkedMultiValueMap that wraps a {@link LinkedHashMap}
+ * with the given initial capacity.
+ * @param initialCapacity the initial capacity
+ */
+ public LinkedMultiValueMap(int initialCapacity) {
+ this.targetMap = new LinkedHashMap>(initialCapacity);
+ }
+
+ /**
+ * Copy constructor: Create a new LinkedMultiValueMap with the same mappings
+ * as the specified Map.
+ * @param otherMap the Map whose mappings are to be placed in this Map
+ */
+ public LinkedMultiValueMap(Map> otherMap) {
+ this.targetMap = new LinkedHashMap>(otherMap);
+ }
+
+
+ // MultiValueMap implementation
+
+ public void add(K key, V value) {
+ List values = this.targetMap.get(key);
+ if (values == null) {
+ values = new LinkedList();
+ this.targetMap.put(key, values);
+ }
+ values.add(value);
+ }
+
+ public V getFirst(K key) {
+ List values = this.targetMap.get(key);
+ return (values != null ? values.get(0) : null);
+ }
+
+ public void set(K key, V value) {
+ List values = new LinkedList();
+ values.add(value);
+ this.targetMap.put(key, values);
+ }
+
+ public void setAll(Map values) {
+ for (Entry entry : values.entrySet()) {
+ set(entry.getKey(), entry.getValue());
+ }
+ }
+
+ public Map toSingleValueMap() {
+ LinkedHashMap singleValueMap = new LinkedHashMap(this.targetMap.size());
+ for (Entry> entry : targetMap.entrySet()) {
+ singleValueMap.put(entry.getKey(), entry.getValue().get(0));
+ }
+ return singleValueMap;
+ }
+
+
+ // Map implementation
+
+ public int size() {
+ return this.targetMap.size();
+ }
+
+ public boolean isEmpty() {
+ return this.targetMap.isEmpty();
+ }
+
+ public boolean containsKey(Object key) {
+ return this.targetMap.containsKey(key);
+ }
+
+ public boolean containsValue(Object value) {
+ return this.targetMap.containsValue(value);
+ }
+
+ public List get(Object key) {
+ return this.targetMap.get(key);
+ }
+
+ public List put(K key, List value) {
+ return this.targetMap.put(key, value);
+ }
+
+ public List remove(Object key) {
+ return this.targetMap.remove(key);
+ }
+
+ public void putAll(Map extends K, ? extends List> m) {
+ this.targetMap.putAll(m);
+ }
+
+ public void clear() {
+ this.targetMap.clear();
+ }
+
+ public Set keySet() {
+ return this.targetMap.keySet();
+ }
+
+ public Collection> values() {
+ return this.targetMap.values();
+ }
+
+ public Set>> entrySet() {
+ return this.targetMap.entrySet();
+ }
+
+
+ @Override
+ public boolean equals(Object obj) {
+ return this.targetMap.equals(obj);
+ }
+
+ @Override
+ public int hashCode() {
+ return this.targetMap.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return this.targetMap.toString();
+ }
+
+}
diff --git a/luqj-common/src/main/java/com/luqj/util/MapSortUtil.java b/luqj-common/src/main/java/com/luqj/util/MapSortUtil.java
new file mode 100644
index 0000000..f03a258
--- /dev/null
+++ b/luqj-common/src/main/java/com/luqj/util/MapSortUtil.java
@@ -0,0 +1,153 @@
+package com.luqj.util;
+
+import java.util.*;
+
+/**
+ * Created by lucheng on 2017/8/23.
+ */
+public class MapSortUtil {
+ /**
+ * 使用 Map按key进行排序
+ *
+ * @param map
+ * @return
+ */
+ public static TreeMap sortMapByKey(Map map, String direction) {
+ if (map == null || map.isEmpty()) {
+ return null;
+ }
+
+ TreeMap sortMap = new TreeMap(
+ new MapKeyComparator(direction));
+
+ sortMap.putAll(map);
+
+ return sortMap;
+ }
+
+
+ /**
+ * 使用 Map按value进行排序
+ * @param oriMap
+ * @param direction
+ * @return
+ */
+ public static Map sortMapByValue(Map oriMap, String direction) {
+ if (oriMap == null || oriMap.isEmpty()) {
+ return null;
+ }
+ Map sortedMap = new LinkedHashMap();
+ List> entryList = new ArrayList>(
+ oriMap.entrySet());
+ Collections.sort(entryList, new MapValueComparator(direction));
+
+ Iterator> iter = entryList.iterator();
+ Map.Entry tmpEntry = null;
+ while (iter.hasNext()) {
+ tmpEntry = iter.next();
+ sortedMap.put(tmpEntry.getKey(), tmpEntry.getValue());
+ }
+ return sortedMap;
+ }
+
+ /**
+ * 返回某个index对应的值
+ *
+ * @param map
+ * @param index
+ * @return
+ */
+ public static Double getKeyByIndex(Map map, int index) {
+ int sumCount = 0;
+ Double result = null;
+ for (Map.Entry newEntry : map.entrySet()) {
+ Double number = newEntry.getKey();
+ Integer count = newEntry.getValue();
+ sumCount += count;
+ if (index <= sumCount) {
+ result = number;
+ break;
+ }
+ }
+ return result;
+ }
+
+ public static class MapKeyComparator implements Comparator {
+
+ private String direction;
+
+ public MapKeyComparator(String direction) {
+ this.direction = direction;
+ }
+
+ @Override
+ public int compare(Double o1, Double o2) {
+ if ("DESC".equals(direction))
+ return o2.compareTo(o1); // 降序
+ else
+ return o1.compareTo(o2);
+ }
+
+ public String getDirection() {
+ return direction;
+ }
+
+ public void setDirection(String direction) {
+ this.direction = direction;
+ }
+ }
+
+ public static class MapValueComparator implements Comparator> {
+
+ private String direction;
+
+ public MapValueComparator(String direction) {
+ this.direction = direction;
+ }
+
+ @Override
+ public int compare(Map.Entry o1, Map.Entry o2) {
+ if ("DESC".equals(direction))
+ return o2.getValue().compareTo(o1.getValue()); // 降序
+ else
+ return o1.getValue().compareTo(o2.getValue());
+ }
+
+ public String getDirection() {
+ return direction;
+ }
+
+ public void setDirection(String direction) {
+ this.direction = direction;
+ }
+
+ }
+
+
+ public static void main(String args[]) {
+ Map map = new HashMap<>();
+ map.put(100.21, 10);
+ map.put(120.21, 20);
+ map.put(104.21, 30);
+ map.put(99.32, 70);
+ map.put(114.22, 45);
+
+ TreeMap newMap = sortMapByKey(map, "DESC");
+ System.out.println("after sortByKey:");
+ for (Map.Entry entry : newMap.entrySet()) {
+ System.out.println("key:" + entry.getKey() + ",value:" + entry.getValue());
+ }
+ System.out.println("lastKey:" + newMap.lastKey());
+ System.out.println("lastEntry:" + newMap.lastEntry().getValue());
+
+ Map valueMap = sortMapByValue(map, "DESC");
+ System.out.println("---------------------------");
+ System.out.println("after sortByValue:");
+ for (Map.Entry entry : valueMap.entrySet()) {
+ System.out.println("key:" + entry.getKey() + ",value:" + entry.getValue());
+ }
+ System.out.println("firstKey:" + valueMap.entrySet().iterator().next().getKey());
+ System.out.println("firstValue:" + valueMap.entrySet().iterator().next().getValue());
+ }
+
+}
diff --git a/luqj-common/src/main/java/com/luqj/util/MultiValueMap.java b/luqj-common/src/main/java/com/luqj/util/MultiValueMap.java
new file mode 100644
index 0000000..f3fffc5
--- /dev/null
+++ b/luqj-common/src/main/java/com/luqj/util/MultiValueMap.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2002-2009 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.luqj.util;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Extension of the {@code Map} interface that stores multiple values.
+ *
+ * @author Arjen Poutsma
+ * @since 3.0
+ */
+public interface MultiValueMap extends Map> {
+
+ /**
+ * Return the first value for the given key.
+ * @param key the key
+ * @return the first value for the specified key, or null
+ */
+ V getFirst(K key);
+
+ /**
+ * Add the given single value to the current list of values for the given key.
+ * @param key the key
+ * @param value the value to be added
+ */
+ void add(K key, V value);
+
+ /**
+ * Set the given single value under the given key.
+ * @param key the key
+ * @param value the value to set
+ */
+ void set(K key, V value);
+
+ /**
+ * Set the given values under.
+ * @param values the values.
+ */
+ void setAll(Map values);
+
+ /**
+ * Returns the first values contained in this {@code MultiValueMap}.
+ * @return a single value representation of this map
+ */
+ Map toSingleValueMap();
+
+}
diff --git a/luqj-common/src/main/java/com/luqj/util/NumFormat.java b/luqj-common/src/main/java/com/luqj/util/NumFormat.java
new file mode 100644
index 0000000..85a3949
--- /dev/null
+++ b/luqj-common/src/main/java/com/luqj/util/NumFormat.java
@@ -0,0 +1,460 @@
+package com.luqj.util;
+
+
+
+import com.luqj.util.assertion.Assert;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.sql.Date;
+import java.sql.Timestamp;
+import java.text.DecimalFormat;
+
+public abstract class NumFormat {
+
+ /**
+ * 设置double类型的精确度
+ * @param scale 小数点后保留的位数
+ * @param number 要精确度的值
+ * @return
+ */
+ public static double setScale(double number,int scale){
+ if(Double.isNaN(number)){
+ return 0;
+ }
+ if(Double.isInfinite(number)){
+ return 0;
+ }
+ return new BigDecimal(number).setScale(scale,BigDecimal.ROUND_HALF_UP).doubleValue();
+ }
+
+ /**
+ * 将NUMBER转换成String如果value为Null则返回空字符串
+ * @param value
+ * @return
+ * @author:lwei
+ */
+ public static String toString(Number value){
+ return value == null ? "" : value.toString();
+ }
+
+ /**
+ * 将Date转换成Long
+ * @param value
+ * @return
+ */
+ public static long $Date(Object value) {
+ if(value == null){
+ return 0;
+ }
+ if(value instanceof Date) {
+ return ((Date) value).getTime();
+ }
+ return $Long(value.toString());
+ }
+
+ /**
+ * 将Timestamp转换成Long
+ * @param value
+ * @return
+ */
+ public static long $Timestamp(Object value) {
+ if(value == null){
+ return 0;
+ }
+ if(value instanceof Timestamp) {
+ return ((Timestamp) value).getTime();
+ }
+ return $Long(value.toString());
+ }
+
+ /**
+ * 将类型转换为LONG
+ * @param value
+ * @return
+ */
+ public static long $Long(Long value){
+ return value != null ? value.longValue() : 0;
+ }
+
+ /**
+ * 将类型转换为LONG
+ * @param value
+ * @return
+ */
+ public static long $Long(String value){
+ return Validator.hasText(value) ? Long.valueOf(value.trim()) : 0;
+ }
+
+ /**
+ * 将类型转换为LONG
+ * @param value
+ * @return
+ */
+ public static long $Long(Object value){
+ if(value == null){
+ return 0;
+ }
+ if(value instanceof Long) {
+ return (Long)value;
+ }
+ return $Long(value.toString());
+ }
+
+ public static long $Long(BigDecimal value){
+ return value != null ? value.longValue() : 0;
+ }
+
+ public static long $Long(BigInteger value){
+ return value != null ? value.longValue() : 0;
+ }
+
+
+ public static long $Long(Double value){
+ return value != null ? value.longValue() : 0;
+ }
+
+ public static int $Intger(Integer value){
+ return value != null ? value.intValue() : 0;
+ }
+
+ public static int $Intger(Double value){
+ return value != null ? value.intValue() : 0;
+ }
+
+ public static int $Intger(String value){
+ return Validator.hasText(value) ? Integer.valueOf(value.trim()) : 0;
+ }
+
+ public static int $Intger(Object value){
+ if(value == null){
+ return 0;
+ }
+ if(value instanceof Integer) {
+ return (Integer)value;
+ }
+ return $Intger(value.toString());
+ }
+
+ public static int $Intger(BigDecimal value){
+ return value != null ? value.intValue() : 0;
+ }
+
+ public static int $Intger(BigInteger value){
+ return value != null ? value.intValue() : 0;
+ }
+
+
+ public static double $Double(Double value){
+ return value != null ? value.doubleValue() : 0;
+ }
+
+ public static double $Double(String value){
+ return Validator.hasText(value) ? Double.valueOf(value.trim()) : 0;
+ }
+
+ public static double $Double(BigDecimal value){
+ return value != null ? value.doubleValue() : 0;
+ }
+
+ public static double $Double(BigInteger value){
+ return value != null ? value.doubleValue() : 0;
+ }
+
+ public static double $Double(Object value){
+ if(value == null){
+ return 0;
+ }
+ if(value instanceof Double) {
+ return (Double)value;
+ }
+ return $Double(value.toString());
+ }
+
+
+
+
+ public static float $Float(Float value){
+ return value != null ? value.floatValue() : 0;
+ }
+
+ public static double $Float(String value){
+ return Validator.hasText(value) ? Float.valueOf(value.trim()) : 0;
+ }
+
+ public static double $Float(BigDecimal value){
+ return value != null ? value.floatValue() : 0;
+ }
+
+ public static double $Float(BigInteger value){
+ return value != null ? value.floatValue() : 0;
+ }
+
+ public static double $Float(Object value){
+ if(value == null){
+ return 0;
+ }
+ if(value instanceof Float) {
+ return (Float)value;
+ }
+ return $Float(value.toString());
+ }
+
+ public static short $Short(Short value){
+ return value != null ? value.shortValue() : 0;
+ }
+
+ public static short $Short(String value){
+ return Validator.hasText(value) ? Short.valueOf(value.trim()) : 0;
+ }
+
+ public static short $Short(BigDecimal value){
+ return value != null ? value.shortValue() : 0;
+ }
+
+ public static short $Short(BigInteger value){
+ return value != null ? value.shortValue() : 0;
+ }
+
+ public static short $Short(Object value){
+ if(value == null){
+ return 0;
+ }
+ if(value instanceof Short) {
+ return (Short)value;
+ }
+ return $Short(value.toString());
+ }
+
+ public static byte $Byte(Byte value){
+ return value != null ? value.byteValue() : 0;
+ }
+
+ public static byte $Byte(BigDecimal value){
+ return value != null ? value.byteValue() : 0;
+ }
+
+ public static byte $Byte(BigInteger value){
+ return value != null ? value.byteValue() : 0;
+ }
+
+ public static byte $Byte(String value){
+ return Validator.hasText(value) ? Byte.valueOf(value.trim()) : 0;
+ }
+
+ public static byte $Byte(Object value){
+ return Validator.notNull(value) ? $Byte(value.toString()) : 0;
+ }
+
+ /**
+ * 将指定的Number对象转换为指定的类型对象
+ *
+ * @param number the number to convert
+ * @return 目标类型的对象
+ */
+ public static Number convertNumber(Number number, Class targetClass)
+ throws IllegalArgumentException {
+ Assert.notNull(number, "Number对象不可以为null");
+ Assert.notNull(targetClass, "Number目标类对象参数不可以为null");
+ if (targetClass.isInstance(number)) {
+ return number;
+ }else if (targetClass.equals(Byte.class)) {
+ long value = number.longValue();
+ if (value < Byte.MIN_VALUE || value > Byte.MAX_VALUE) {
+ raiseOverflowException(number, targetClass);
+ }
+ return new Byte(number.byteValue());
+ }else if (targetClass.equals(Short.class)) {
+ long value = number.longValue();
+ if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) {
+ raiseOverflowException(number, targetClass);
+ }
+ return new Short(number.shortValue());
+ }else if (targetClass.equals(Integer.class)) {
+ long value = number.longValue();
+ if (value < Integer.MIN_VALUE || value > Integer.MAX_VALUE) {
+ raiseOverflowException(number, targetClass);
+ }
+ return new Integer(number.intValue());
+ }else if (targetClass.equals(Long.class)) {
+ return new Long(number.longValue());
+ }else if (targetClass.equals(Float.class)) {
+ return new Float(number.floatValue());
+ }else if (targetClass.equals(Double.class)) {
+ return new Double(number.doubleValue());
+ }else if (targetClass.equals(BigInteger.class)) {
+ return BigInteger.valueOf(number.longValue());
+ }else if (targetClass.equals(BigDecimal.class)) {
+ // using BigDecimal(String) here, to avoid unpredictability of BigDecimal(double)
+ // (see BigDecimal javadoc for details)
+ return new BigDecimal(number.toString());
+ }else {
+ throw new IllegalArgumentException("无法将值为 [" + number + "] 类型为 [" +
+ number.getClass().getName() + "] 的对象转换为 [" + targetClass.getName() + "]");
+ }
+ }
+
+ /**
+ * 如果指定的值超过了指定的类型的值所能容纳的最大或最小值将抛该异常
+ * @param number 需要转换的值
+ * @param targetClass 目标对象的类型
+ */
+ private static void raiseOverflowException(Number number, Class targetClass) {
+ throw new IllegalArgumentException("无法将值为 [" + number + "] 类型为 [" +
+ number.getClass().getName() + "] 的对象转换为 [" + targetClass.getName() + "]: 值超过了目标对象的值得范围");
+ }
+
+ /**
+ * 将字符串格式转换为指定的目标类的Number对象
+ * @param text 需要转换的字符串
+ * @param targetClass 目标类型
+ * @return 目标类型的对象
+ * @throws IllegalArgumentException 如果不支持指定的目标类型的话将抛该异常
+ */
+ public static Number parseNumber(String text,Class targetClass) {
+ Assert.notNull(text, "字符串参数不可以为null");
+ Assert.notNull(targetClass, "Number目标类对象参数不可以为null");
+ String trimmed = text.trim();
+ if (targetClass.equals(Byte.class)) {
+ return Byte.decode(trimmed);
+ }
+ else if (targetClass.equals(Short.class)) {
+ return Short.decode(trimmed);
+ }
+ else if (targetClass.equals(Integer.class)) {
+ return Integer.decode(trimmed);
+ }
+ else if (targetClass.equals(Long.class)) {
+ return Long.decode(trimmed);
+ }
+ else if (targetClass.equals(Float.class)) {
+ return Float.valueOf(trimmed);
+ }
+ else if (targetClass.equals(Double.class)) {
+ return Double.valueOf(trimmed);
+ }
+ else if (targetClass.equals(BigInteger.class)) {
+ return decodeBigInteger(trimmed);
+ }
+ else if (targetClass.equals(BigDecimal.class) || targetClass.equals(Number.class)) {
+ return new BigDecimal(trimmed);
+ }
+ else {
+ throw new IllegalArgumentException(
+ "转换失败! String [" + text + "] to target class [" + targetClass.getName() + "]");
+ }
+ }
+
+ /**
+ * 将字符串转换为BigInteger
+ *
+ * 指定的字符串如果是可以是负数表示或者十六进制,八进制表示
+ * 负数表示前面加-,十六进制表示前面加0x 0X #,八进制表示前面加0
+ * @param value 要转换的字符串
+ * @return 返回BigInteger对象
+ * @see BigInteger#BigInteger(String, int)
+ */
+ private static BigInteger decodeBigInteger(String value) {
+ int radix = 10;//基数
+ int index = 0;//串索引
+ boolean negative = false;//判断是否为负数
+ if (value.startsWith("-")) {
+ negative = true;
+ index++;
+ }
+ if (value.startsWith("0x", index) || value.startsWith("0X", index)) {
+ index += 2;
+ radix = 16;
+ }
+ else if (value.startsWith("#", index)) {
+ index++;
+ radix = 16;
+ }
+ else if (value.startsWith("0", index) && value.length() > 1 + index) {
+ index++;
+ radix = 8;
+ }
+ BigInteger result = new BigInteger(value.substring(index), radix);
+ return (negative ? result.negate() : result);
+ }
+
+
+ /**
+ *
+ * @param number
+ * @return
+ */
+ public static String setString(double number){
+ return number==0?" ":String.valueOf(number);
+ }
+
+ /**
+ * 两个Double类型相加后返回Double类型(如果其中一个为NULL则视为0)
+ * @param value1
+ * @param value2
+ * @return
+ */
+ public static Double addValue(Double value1,Double value2){
+ return $Double(value1)+$Double(value2);
+ }
+
+ /**
+ * 两个Long类型相加后返回Long类型(如果其中一个为NULL则视为0)
+ * @param value1
+ * @param value2
+ * @return
+ */
+ public static Long addValue(Long value1,Long value2){
+ return $Long(value1)+$Long(value2);
+ }
+
+ /**
+ * 将double类型的数据改为非科学记数法表示
+ * @param unFormatedNumber
+ * @return
+ */
+ public static String formateNonScience(double unFormatedNumber){
+ DecimalFormat format = new DecimalFormat("#0.000");
+ return format.format(unFormatedNumber);
+ }
+
+
+
+
+
+ public static Number parseNum(Class targetClass,Number v){
+
+ if(targetClass.equals(Byte.class)){
+ return Byte.valueOf(v.byteValue());
+ }
+ else if (targetClass.equals(Short.class)) {
+ return Short.valueOf(v.shortValue());
+ }
+ else if (targetClass.equals(Integer.class)) {
+ return Integer.valueOf(v.intValue());
+ }
+ else if (targetClass.equals(Long.class)) {
+ return Long.valueOf(v.longValue());
+ }
+ else if (targetClass.equals(Float.class)) {
+ return Float.valueOf(0);
+ }
+ else if (targetClass.equals(Double.class)) {
+ return Double.valueOf(v.doubleValue());
+ }
+ else if (targetClass.equals(BigInteger.class)) {
+ return new BigInteger(String.valueOf(v.longValue()));
+ }
+ else if (targetClass.equals(BigDecimal.class) || targetClass.equals(Number.class)) {
+ return new BigDecimal(v.doubleValue());
+ }
+ else {
+ throw new IllegalArgumentException(
+ "类型[" + targetClass.getName() + "],无法初始化0值");
+ }
+ }
+
+
+
+
+}
diff --git a/luqj-common/src/main/java/com/luqj/util/StringUtils.java b/luqj-common/src/main/java/com/luqj/util/StringUtils.java
new file mode 100644
index 0000000..4cbe2a5
--- /dev/null
+++ b/luqj-common/src/main/java/com/luqj/util/StringUtils.java
@@ -0,0 +1,1869 @@
+/**
+ * 版权所有:厦门市巨龙软件工程有限公司
+ * Copyright 2009 Xiamen Dragon Software Eng. Co. Ltd.
+ * All right reserved.
+ *====================================================
+ * 文件名称: StringUtils.java
+ * 修订记录:
+ * No 日期 作者(操作:具体内容)
+ * 1. Mar 3, 2009 何志昭(创建:创建文件)
+ * 2004-11-16 陈雄华更改了splitString方法、增加了toVisualString方法、增加了subStringCount方法
+ * 2. Mar 3, 2009 根据dragonsoft_checks.xml规范进行调整
+ *====================================================
+ * 类描述:
+ *
+ */
+package com.luqj.util;
+
+import java.security.MessageDigest;
+import java.sql.Date;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+
+/**
+ *
+ * 字符串处理工具类.
+ * <blockquote>
+ * <b>数字格式化样式</b>
+ * <table border=0 cellspacing=3 cellpadding=0 width="90%">
+ *
+ * |
+ * Symbol
+ * |
+ *
+ * Location
+ * |
+ *
+ * Localized
+ * |
+ *
+ * Meaning
+ * |
+ *
+ *
+ *
+ * 0 |
+ *
+ * Number
+ * |
+ *
+ * Yes
+ * |
+ *
+ * Digit
+ * |
+ *
+ *
+ *
+ * #
+ * |
+ *
+ * Number
+ * |
+ *
+ * Yes
+ * |
+ *
+ * Digit, zero shows as absent
+ * |
+ *
+ *
+ *
+ * .
+ * |
+ *
+ * Number
+ * |
+ *
+ * Yes
+ * |
+ *
+ * Decimal separator or monetary decimal separator
+ * |
+ *
+ *
+ *
+ * -
+ * |
+ *
+ * Number
+ * |
+ *
+ * Yes
+ * |
+ *
+ * Minus sign
+ * |
+ *
+ *
+ *
+ * ,
+ * |
+ *
+ * Number
+ * |
+ *
+ * Yes
+ * |
+ *
+ * Grouping separator
+ * |
+ *
+ *
+ *
+ * E |
+ *
+ * Number
+ * |
+ *
+ * Yes
+ * |
+ *
+ * Separates mantissa and exponent in scientific notation.
+ *
+ * Need not be quoted in prefix or suffix.
+ * |
+ *
+ *
+ *
+ * ;
+ * |
+ *
+ * Subpattern boundary
+ * |
+ *
+ * Yes
+ * |
+ *
+ * Separates positive and negative subpatterns
+ * |
+ *
+ *
+ *
+ * %
+ * |
+ *
+ * Prefix or suffix
+ * |
+ *
+ * Yes
+ * |
+ *
+ * Multiply by 100 and show as percentage
+ * |
+ *
+ *
+ *
+ * \u2030
+ * |
+ *
+ * Prefix or suffix
+ * |
+ *
+ * Yes
+ * |
+ *
+ * Multiply by 1000 and show as per mille
+ * |
+ *
+ *
+ *
+ * ¤
+ * (
+ *
+ * \u00A4
+ *
+ * )
+ * |
+ *
+ * Prefix or suffix
+ * |
+ *
+ * No
+ * |
+ *
+ * Currency sign, replaced by currency symbol. If
+ * doubled, replaced by international currency symbol.
+ * If present in a pattern, the monetary decimal separator
+ * is used instead of the decimal separator.
+ * |
+ *
+ *
+ *
+ * '
+ * |
+ *
+ * Prefix or suffix
+ * |
+ *
+ * No
+ * |
+ *
+ * Used to quote special characters in a prefix or suffix,
+ * for example,
+ *
+ * "'#'#"
+ *
+ * formats 123 to
+ *
+ * "#123"
+ *
+ * . To create a single quote
+ * itself, use two in a row:
+ *
+ * "# o''clock"
+ *
+ * .
+ * |
+ *
+ * </table>
+ *
+ * <b>符号(Symbol)通常是组合在一起使用的,例如下表</b>
+ * <table border=0 cellspacing=3 cellpadding=0 width="90%">
+ *
+ * |
+ * 输入
+ * |
+ *
+ * 格式
+ * |
+ *
+ * 输出
+ * |
+ *
+ *
+ * |
+ * 1234.123456
+ * |
+ *
+ * 0 |
+ *
+ * 1234
+ * |
+ *
+ *
+ *
+ * 0.00
+ * |
+ *
+ * 1234.12
+ * |
+ *
+ *
+ *
+ * 0.###
+ * |
+ *
+ * 1234.123
+ * |
+ *
+ *
+ *
+ * 0.0000
+ * |
+ *
+ * 1234.1235
+ * |
+ *
+ *
+ *
+ * 00000000.00
+ * |
+ *
+ * 00001234.12
+ * |
+ *
+ *
+ *
+ * ,000.00
+ * |
+ *
+ * 1,234.12
+ * |
+ *
+ *
+ *
+ * ,00.00000000
+ * |
+ *
+ * 12,34.12345600
+ * |
+ *
+ *
+ *
+ * 0.00%
+ * |
+ *
+ * 123412.35%
+ * |
+ *
+ *
+ * |
+ * 1234.100056
+ * |
+ *
+ * 0 |
+ *
+ * 1234
+ * |
+ *
+ *
+ *
+ * 0.00
+ * |
+ *
+ * 1234.10
+ * |
+ *
+ *
+ *
+ * 0.##
+ * |
+ *
+ * 1234.1
+ * |
+ *
+ *
+ *
+ * (人民币),000.00
+ * |
+ *
+ * (人民币)1,234.10
+ * |
+ *
+ *
+ *
+ * ,000.########
+ * |
+ *
+ * 1,234.100056
+ * |
+ *
+ * </table>
+ *
+ * 注:0与#功能类似,区别在于用0表示位数时,格式化后的首尾的0会显示,而用#表示位数时,首尾的0不显示
+ * </blockquote>
+ *
+ *
+ *
+ *
+ * - JDK版本:
+ *
+ * - 1.4
+ *
+ *
+ * @author 涂传滨,伊新煦,陈雄华,谢计生
+ * @version 1.0
+ * @since 1.0
+ * @see DecimalFormat
+ */
+public final class StringUtils {
+
+ /** 字符长度 */
+ public static final int CHAR_LEN = 1;
+
+ /** 字节长度 */
+ public static final int BYTE_LEN = 2;
+
+ final static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyyMMddHHmmss");;
+
+ public static boolean notBlank(String str) {
+ return !isBlank(str);
+ }
+
+ public static boolean notBlank(String... strings) {
+ if (strings == null || strings.length == 0) {
+ return false;
+ }
+ for (String str : strings) {
+ if (isBlank(str)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean hasText(String text) {
+ if (text == null)
+ return false;
+ for (int i = 0; i < text.length(); i++) {
+ if (!Character.isWhitespace(text.charAt(i)))
+ return true;
+ }
+ return false;
+ }
+
+ public static String parseDateToString(Object obj){
+
+ String dateStr = null;
+
+ if(obj == null){
+ return null;
+ }
+
+ if(obj.getClass().getName().equals("java.sql.Date")){
+ Date date = (Date) obj;
+ return String.valueOf(date.getTime());
+ }else if(obj.getClass().getName().equals("java.sql.Timestamp")){
+ Timestamp date = (Timestamp) obj;
+ return String.valueOf(date.getTime());
+ }else if(obj.getClass().getName().equals("java.sql.Time")){
+ Time date = (Time) obj;
+ return String.valueOf(date.getTime());
+ }else{
+ return String.valueOf(obj);
+ }
+
+ /*if(obj.getClass().getName().equals("java.sql.Date")||
+ obj.getClass().getName().equals("java.sql.Timestamp")||
+ obj.getClass().getName().equals("java.sql.Time")){
+ try {
+ Date date = (Date) obj;
+ date.getTime();
+ dateStr = DATE_FORMAT.format(obj);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ logger.error("出现异常的数据"+obj);
+ throw new ArrayIndexOutOfBoundsException("数组越界"+obj);
+ }
+ }else{
+ return (String)obj;
+ }
+ */
+ //return dateStr;
+
+ }
+
+
+ public static String uuid(){
+ return UUID.randomUUID().toString().replaceAll("-", "");
+ }
+
+
+ public static String lowerFirst(String v){
+ return v.replaceFirst(v.substring(0,1), v.substring(0,1).toLowerCase());
+ }
+
+ public static String upFirst(String v){
+ return v.replaceFirst(v.substring(0,1), v.substring(0,1).toUpperCase());
+ }
+
+ /**
+ * 数字字符串转化为整数
+ *
+ * @param intStr
+ * String 待转化的数字字符串
+ * @param intDef
+ * int 当intStr为空或空字符串时返回的缺省值
+ * @return int 返回由数字字符串转化成的数字,当intStr为空或空字符串时,返回缺省值intDef
+ */
+ public static int getInt(String intStr, int intDef) {
+ if (null == intStr || "".equals(intStr.trim())) {
+ return intDef;
+ }
+
+ int intRetu = intDef;
+
+ Double db = new Double(intStr);
+ intRetu = db.intValue();
+ return intRetu;
+ }
+
+ /**
+ * 数字字符串转化为整数,在转化时发生异常,则返回0
+ *
+ * @param intStr
+ * String 待转化的数字字符串
+ * @return int 返回由数字字符串转化成的整数,当intStr为空或空字符串时,返回0
+ */
+ public static int getInt(String intStr) {
+ return getInt(intStr, 0);
+ }
+
+ /**
+ * 数字字符串转化为双精数字
+ *
+ * @param dbstr
+ * String 待转化的数字字符串
+ * @param dbDef
+ * double 当dbstr为空或空字符串时返回的缺省值
+ * @return double 返回由数字字符串转化成的数字,当dbstr为空或空字符串时,则返回缺省值dbDef
+ */
+ public static double getDouble(String dbstr, double dbDef) {
+
+ if (null == dbstr || "".equals(dbstr.trim())) {
+ return dbDef;
+ }
+ double dbRetu = dbDef;
+ Double db = new Double(dbstr);
+ dbRetu = db.doubleValue();
+ return dbRetu;
+ }
+
+ /**
+ * 数字字符串转化为双精数字,在转化时发生异常,则返回0
+ *
+ * @param dbstr
+ * String 待转化的数字字符串
+ * @return double 返回由数字字符串转化成的数字,当dbstr为空或空字符串时,则返回0。
+ */
+ public static double getDouble(String dbstr) {
+ return getDouble(dbstr, 0);
+ }
+
+ /**
+ * 数字字符串转化为长整型
+ *
+ * @param longstr
+ * String 待转化的数字字符串
+ * @param longDef
+ * long 当longstr为空或空字符串时返回的缺省值
+ * @return long 返回由数字字符串转化成的数字,当longstr为空或空字符串时,则返回缺省值longDef
+ */
+ public static long getLong(String longstr, long longDef) {
+ if (null == longstr || "".equals(longstr.trim())) {
+ return longDef;
+ }
+ long longRetu = longDef;
+
+ Double db = new Double(longstr);
+ longRetu = db.longValue();
+
+ return longRetu;
+ }
+
+ /**
+ * 数字字符串转化为长整型,在转化时发生异常,则返回0
+ *
+ * @param longstr
+ * String 待转化的数字字符串
+ * @return long 返回由数字字符串转化成的数字,当longstr为空或空字符串时,则返回0。
+ */
+ public static long getLong(String longstr) {
+ return getLong(longstr, 0);
+ }
+
+ /**
+ * 字符串转化为布尔型
+ *
+ * @param booleanstr
+ * String 待转化的字符串
+ * @param booleanDef
+ * boolean 当字符串为空或为null时返回的值
+ * @return boolean 返回转化化的布尔值,只有当booleanstr为字符串“true”(忽略大小写)时才返回true,
+ * 如果在转化时发生异常(只有为null时),则返回缺省值booleanDef
+ */
+ public static boolean getBoolean(String booleanstr, boolean booleanDef) {
+ if (null == booleanstr) {
+ return booleanDef;
+ }
+ boolean booleanRetu = booleanDef;
+ if ("true".equalsIgnoreCase(booleanstr.trim())) {
+ booleanRetu = true;
+ }
+
+ return booleanRetu;
+ }
+
+ /**
+ * 字符串转化为布尔型.
+ * 只有当booleanstr为字符串“true”(忽略大小写)时才返回true,其它都返回false, 包括booleanstr为null
+ *
+ * @param booleanstr
+ * String 待转化的字符串
+ * @return boolean 返回转化化的布尔值,
+ */
+ public static boolean getBoolean(String booleanstr) {
+ return getBoolean(booleanstr, false);
+ }
+
+ /**
+ * 双精数字格式化,返回字符串
+ *
+ * @param db
+ * double 待格式化的双精数字
+ * @param fmt
+ * String 格式化样式,参见类说明,
+ * fmt非法时,db将按原样转化为字符串后返回。
+ * @return String 格式化后的数字,以字符串方式返回
+ */
+ public static String getNumFormat(double db, String fmt) {
+ String retu = "";
+ if (null == fmt || "".equals(fmt.trim())) {
+ return Double.toString(db);
+ }
+
+ try {
+ DecimalFormat decimalformat = new DecimalFormat(fmt);
+ retu = decimalformat.format(db);
+ decimalformat = null;
+ } catch (IllegalArgumentException iaex) {
+ // ialog.error(ex.getMessage());
+ retu = Double.toString(db);
+ }
+ return retu;
+ }
+
+ /**
+ * 双精数字格式化,把入参中的双精数格式化为带两位小数的数字字符串
+ *
+ * @param db
+ * double 待格式化的双精数字
+ * @return String 格式化为两位小数的数字字符串
+ */
+ public static String getNumFormat(double db) {
+ return getNumFormat(db, "0.00");
+ }
+
+ /**
+ * 数字字符串格式化,返回字符串
+ *
+ * @param numStr
+ * String 待格式化的数字字符串,
+ * 如果numStr参数不是的数字则不进行格式化,按原样返回
+ * @param fmt
+ * String 格式化样式,参见类说明
+ * fmt非法时,将把numStr按原样返回。
+ * @return String 格式化后的字符串
+ */
+ public static String getNumFormat(String numStr, String fmt) {
+ double db = getDouble(numStr, 0);
+ return getNumFormat(db, fmt);
+ }
+
+ /**
+ * 数字字符串格式化,把入参中的数字字符串格式化为带两位小数的数字字符串
+ *
+ * @param numStr
+ * String 待格式化的数字字符串,
+ * 如果numStr参数不是的数字则不进行格式化,按原样返回
+ * @return String 格式化为两位小数的数字字符串
+ */
+ public static String getNumFormat(String numStr) {
+ return getNumFormat(numStr, "0.00");
+ }
+
+ /**
+ * 普通字符串转化为网页中可显示的,如回车转化为<br>.
+ *
+ * @param str
+ * String 待转化的字符串
+ * @return String 转化后的字符串
+ */
+ public static String htmlEncode(String str) {
+ String retu = null;
+ if (null == str || "".equals(str.trim())) {
+ retu = str;
+ } else {
+ String html = str;
+ //StringUtils tool = new StringUtils();
+ html = replaceString(html, "&", "&");
+ html = replaceString(html, "<", "<");
+ html = replaceString(html, ">", ">");
+ html = replaceString(html, "\r\n", "\n");
+ html = replaceString(html, "\n", "
");
+ html = replaceString(html, "\t", " ");
+ html = replaceString(html, " ", " ");
+ html = replaceString(html, "\"", """);
+ retu = html;
+ html = null;
+ }
+ return retu;
+ }
+
+ /**
+ * 字符串替换,把str字符串中的所有oldStr子串替换为newStr字串
+ *
+ * @param sourceStr
+ * String 将被替换的字符串,为null时不执行任何替换操作
+ * @param oldStr
+ * String 将被替换的子串,为null或为空字符串时不执行替换操作
+ * @param newStr
+ * String 将被替换成的子串,为null时不执行替换操作
+ * @param isIgnoreCase
+ * boolean 是否忽略大小写,true表忽略大小写,false表大小写敏感。
+ * @return String 替换后的字符串
+ */
+ public static String replaceString(String sourceStr, String oldStr, String newStr, boolean isIgnoreCase) {
+ if (sourceStr == null || oldStr == null || oldStr.equals("")) {
+ return null;
+ }
+ String strRetStr = sourceStr;
+ int pos = strRetStr.indexOf(oldStr);
+ while (pos != -1) {
+ strRetStr = strRetStr.substring(0, pos) + newStr + strRetStr.substring(pos + oldStr.length());
+ pos = strRetStr.indexOf(oldStr, pos + newStr.length());
+ }
+ return strRetStr;
+ }
+
+ /**
+ * 字符串替换,把str字符串中的所有oldStr子串替换为newStr字串(大小写敏感)
+ *
+ * @param sourceStr
+ * String 将被替换的字符串,为null时不执行任何替换操作
+ * @param oldStr
+ * String 将被替换的子串,为null或为空字符串时不执行替换操作
+ * @param newStr
+ * String 将被替换成的子串,为null时不执行替换操作
+ * @return String 替换后的字符串
+ */
+ public static String replaceString(String sourceStr, String oldStr, String newStr) {
+ return replaceString(sourceStr, oldStr, newStr, false);
+ }
+
+ /**
+ * 字符串按指定分隔符分解为一个数组(大小写敏感).
+ * 例子:
+ * String[] array = StringUtils.splictString("AA/BBB/CCC//DDDD//" , "/" );
+ *
+ * 结果:
+ * array[0]="AA" array[1]="BBB" array[2]="CCC" array[3]="DDDD"
+ *
+ * @param sourceStr
+ * String 源字符串
+ * @param splitStr
+ * String 分隔符
+ * @param isTrim
+ * boolean
+ * @return String[] 字符串数组,
+ * 源字符串为null或为空字符串时,返回长度为1的数组,元素值为空字符串
+ * 分隔符为null或为空字符串时,返回长度为1的数组,元素值为源字符串
+ */
+ public static String[] splitString(String sourceStr, String splitStr, boolean isTrim) {
+ String newSourceStr = sourceStr;
+ String newSplitStr = splitStr;
+
+ if (newSourceStr == null || newSplitStr == null) {
+ return null;
+ }
+
+ if (isTrim) // 去掉开始和结束的分隔符
+ {
+ // 开头的间隔符去掉
+ while (newSourceStr.indexOf(newSplitStr) == 0) {
+ newSourceStr = newSourceStr.substring(newSplitStr.length());
+ }
+
+ // 尾部的间隔符去掉
+ while (newSourceStr.indexOf(newSplitStr, newSourceStr.length() - newSplitStr.length()) > -1) {
+ newSourceStr = newSourceStr.substring(0, sourceStr.length() - newSplitStr.length());
+ }
+ }
+ if (newSourceStr.equals("") || newSplitStr.equals("")) {
+ return null;
+ }
+ return splitString(newSourceStr, newSplitStr);
+ }
+
+ /**
+ * 功能简述 :把字符串放入一个数组
+ *
+ * @param sourceStr
+ * 要被放入的字符串
+ * @param splitStr
+ * 间隔符
+ * @return 转换后的数组,sourceStr或splitStr = null 或 "" 返回null
+ */
+ public static String[] splitString(String sourceStr, String splitStr) {
+ String newSourceStr = sourceStr;
+ String newSplitStr = splitStr;
+
+ if (newSourceStr == null || newSplitStr == null) {
+ return null;
+ }
+ if (newSourceStr.equals("") || newSplitStr.equals("")) {
+ return null;
+ }
+ int intArraySize = subStringCount(newSourceStr, newSplitStr);
+ // 如果为-1则返回
+ if (intArraySize == -1) {
+ return null;
+ }
+
+ newSourceStr += newSplitStr;
+
+ String[] strRetArr = new String[intArraySize + 1];
+ int intpos = newSourceStr.indexOf(newSplitStr);
+ int intArrayPos = 0;
+ while (intpos != -1) {
+ strRetArr[intArrayPos++] = newSourceStr.substring(0, intpos);
+ newSourceStr = newSourceStr.substring(intpos + newSplitStr.length());
+ intpos = newSourceStr.indexOf(newSplitStr);
+ }
+
+ return strRetArr;
+ }
+
+ /**
+ * 功能简述 :把字符串放入一个数组
+ * @param sourceStr
+ * 要被放入的字符串
+ * @param splitStr
+ * 间隔符
+ * @return 转换后的List,sourceStr或splitStr = null 或 "" 返回元素个数为0的List
+ */
+ public static List splitString2List(String sourceStr, String splitStr) {
+ String[] tempArr = splitString(sourceStr, splitStr);
+ List resultList = new ArrayList();
+ if (tempArr != null) {
+ for (int i = 0; i < tempArr.length; i++) {
+ resultList.add(tempArr[i]);
+ }
+ }
+ return resultList;
+ }
+
+ /**
+ * 功能简述 :把字符串放入一个数组
+ *
+ * @param sourceStr
+ * 要被放入的字符串
+ * @param splitStr
+ * 间隔符
+ * @param isTrim
+ * boolean
+ * @return 转换后的List,sourceStr或splitStr = null 或 "" 返回元素个数为0的List
+ */
+ public static List splitString2List(String sourceStr, String splitStr, boolean isTrim) {
+ String[] tempArr = splitString(sourceStr, splitStr, isTrim);
+ List resultList = new ArrayList();
+ if (tempArr != null) {
+ for (int i = 0; i < tempArr.length; i++) {
+ resultList.add(tempArr[i]);
+ }
+ }
+ return resultList;
+ }
+
+ /**
+ * 功能简述 :在一个字符串中查找字符串个数(不区分大小写)
+ *
+ * @param sourceStr
+ * 要被查询的字符串
+ * @param subStr
+ * 要查找的字符串
+ * @return 找到的个数
+ */
+ public static int subStringCount(String sourceStr, String subStr) {
+ // 如果是空指针则返回-1
+ if (sourceStr == null || subStr == null) {
+ return -1;
+ }
+ if (sourceStr.equals("") || subStr.equals("")) {
+ return -1;
+ }
+ int result = 0;
+ int intPos = sourceStr.toUpperCase().indexOf(subStr.toUpperCase());
+ while (intPos != -1) {
+ result++;
+ intPos = sourceStr.toUpperCase().indexOf(subStr.toUpperCase(), intPos + subStr.length());
+ }
+
+ return result;
+ }
+
+ /**
+ * 用指定的分隔符把字符串数组合并成一个字符串. 数组为null或长度为0时返回空字符串
+ * 例子:
+ * String[] array = {"1",null,"","3"};
+ * StringUtils.arrayToString(array,"|");
+ * 返回结果:1|||3
+ *
+ * @param array
+ * String[] 待合并的数组
+ * @param splitStr
+ * String 数组各元素合并后,它们之间的分隔符,为null时用空字符串代替
+ * @return String 合并后的字符串
+ */
+ public static String arrayToString(String[] array, String splitStr) {
+ if (null == array || 0 == array.length) {
+ return "";
+ }
+ String newSplitStr = splitStr;
+ if (null == newSplitStr) {
+ newSplitStr = "";
+ }
+ StringBuffer strBuf = new StringBuffer("");
+ int len = array.length;
+ for (int i = 0; i < len - 1; i++) {
+ strBuf.append((null == array[i]) ? "" : array[i]).append(newSplitStr);
+ }
+ strBuf.append((null == array[len - 1]) ? "" : array[len - 1]);
+
+ return strBuf.toString();
+ }
+
+ /**
+ * 用默认分隔符 | 把字符串数组合并成一个字符串. 数组为null或长度为0时返回空字符串
+ *
+ * @param array
+ * String[] 待合并的数组
+ * @return String 合并后的字符串
+ */
+ public static String arrayToString(String[] array) {
+ return arrayToString(array, "|");
+ }
+
+ /**
+ * 判断字符串是否为null或为空字符串(包括只含空格的字符串)
+ *
+ * @param str
+ * String 待检查的字符串
+ * @return boolean 如果为null或空字符串(包括只含空格的字符串)则返回true,否则返回false
+ */
+ public static boolean isNullBlank(String str) {
+ return (null == str || "".equals(str.trim())) ? true : false;
+ }
+
+ /**
+ * 从字符串中得到指定位置的子串(按分隔符分隔,大小写敏感).
+ * 例子:
+ * StringUtils.decomposeString("a||b|c|d","|",1);
+ * StringUtils.decomposeString("a||b|c|d","|",2);
+ * StringUtils.decomposeString("a||b|c|d","|",3);
+ * StringUtils.decomposeString("a||b|c|d","|",4);
+ * StringUtils.decomposeString("a||b|c|d","|",5);
+ * 返回结果:
+ * a,空字符串,b,c,d
+ *
+ * @param sourceStr
+ * String 源字符串
+ * @param splitStr
+ * String 分隔符
+ * @param pos
+ * int 位置,从1开始
+ * @return String 返回指定位置的子串。
+ * 当分隔符为null或为空字符串时返回源字符串;
+ * 当源字符串为null或为空字符串时返回空字符串;
+ * 当指定位置小于1或大于分隔符个数-1时返回空字符串。
+ */
+ public static String decomposeString(String sourceStr, String splitStr, int pos) {
+ String retu = "";
+ String newSourceStr = sourceStr;
+ if (null == newSourceStr || "".equals(newSourceStr.trim())) {
+ return "";
+ }
+
+ if (pos <= 0) {
+ return "";
+ }
+
+ if (null == splitStr || "".equals(splitStr)) {
+ return sourceStr;
+ }
+
+ newSourceStr = newSourceStr + splitStr;
+ String tmpStr = newSourceStr;
+
+ int splitLen = splitStr.length();
+ int tmpLen = tmpStr.length();
+
+ for (int i = 0; i < pos - 1; i++) {
+ int tmpPosi = tmpStr.indexOf(splitStr);
+ if (tmpPosi < 0 || tmpPosi + splitLen >= tmpLen) {
+ tmpStr = splitStr;
+ break;
+ } else {
+ tmpStr = tmpStr.substring(tmpPosi + splitLen);
+ }
+ }
+ retu = tmpStr.substring(0, tmpStr.indexOf(splitStr));
+ return retu;
+ }
+
+ /**
+ * 从字符串中得到指定位置的子串(按分隔符 | 分隔).
+ *
+ * @param sourceStr
+ * String 源字符串
+ * @param pos
+ * int 位置,从1开始
+ * @return String 返回指定位置的子串。
+ * 当分隔符为null或为空字符串时返回源字符串;
+ * 当源字符串为null或为空字符串时返回空字符串;
+ * 当指定位置小于1或大于分隔符个数-1时返回空字符串。
+ */
+ public static String decomposeString(String sourceStr, int pos) {
+ return decomposeString(sourceStr, "|", pos);
+ }
+
+ /**
+ * 删除指定的前导、后导子串(大小写敏感).
+ * 例子:
+ * StringUtils.trim("and and username = '123' and password = 'abc' and
+ * ","and ");
+ * 结果:username = '123' and password = 'abc'
+ *
+ * @param sourceStr
+ * String 待删除的字符串
+ * @param removeChar
+ * char 子串
+ * @return String 处理后的字符串
+ */
+ public static String trim(String sourceStr, char removeChar) {
+ if (sourceStr == null) {
+ return null;
+ }
+ String newSourceStr = sourceStr;
+
+ newSourceStr = newSourceStr.trim();
+ int loIntBegin = 0;
+ int loIntEnd = 0;
+ int loIntLen = newSourceStr.length();
+ for (int i = 0; i < loIntLen; i++) {
+ if (newSourceStr.charAt(i) == removeChar) {
+ loIntBegin++;
+ } else {
+ break;
+ }
+ }
+ for (int i = 0; i < loIntLen; i++) {
+ if (newSourceStr.charAt(loIntLen - 1 - i) == removeChar) {
+ loIntEnd++;
+ } else {
+ break;
+ }
+ }
+ return newSourceStr.substring(loIntBegin, loIntLen - loIntEnd);
+ }
+
+ /**
+ * 删除指定的前导、后导子串(大小写敏感).
+ * 例子:
+ * StringUtils.trim("and and username = '123' and password = 'abc' and
+ * ","and ");
+ * 结果:username = '123' and password = 'abc'
+ *
+ * @param sourceStr
+ * String 待删除的字符串
+ * @param removeChar
+ * char 子串
+ * @param end
+ * true 只trim末尾,false 只trim头部
+ * @return String 处理后的字符串
+ */
+ public static String trim(String sourceStr, char removeChar, boolean end) {
+ if (sourceStr == null) {
+ return null;
+ }
+ String newSourceStr = sourceStr;
+
+ newSourceStr = newSourceStr.trim();
+ int loIntBegin = 0;
+ int loIntEnd = 0;
+ int loIntLen = newSourceStr.length();
+ for (int i = 0; i < loIntLen; i++) {
+ if (newSourceStr.charAt(i) == removeChar) {
+ loIntBegin++;
+ } else {
+ break;
+ }
+ }
+ for (int i = 0; i < loIntLen; i++) {
+ if (newSourceStr.charAt(loIntLen - 1 - i) == removeChar) {
+ loIntEnd++;
+ } else {
+ break;
+ }
+ }
+ if (end) {
+ return newSourceStr.substring(0, loIntLen - loIntEnd);
+ } else {
+ return newSourceStr.substring(loIntBegin);
+ }
+ }
+
+ /**
+ *
+ * 将字符串截短到特定的长度,一个中文是两个字节的长度,但是是1个字符的长度,例:
+ * 1)truncate("巨龙软件公司",2,CHAR_LEN) = "巨龙"
+ * 2)truncate("巨龙软件公司",2,BYTE_LEN) = "巨"
+ * 3)truncate("dragonsoft",2,CHAR_LEN) = "dr"
+ * 4)truncate("dragonsoft",2,BYTE_LEN) = "dr"
+ *
+ *
+ * @param str
+ * String 需要截的字符串
+ * @param len
+ * int 截到的目标长度
+ * @param lenType
+ * int 长度类型,字符长度{@link CHAR_LEN},字符长度{@link BYTE_LEN}
+ * @return String
+ */
+ public static String truncate(String str, int len, int lenType) {
+ if (str == null) {
+ return str;
+ }
+ // 字符长度
+ if (lenType == CHAR_LEN) {
+ if (str.length() <= len) {
+ return str;
+ } else {
+ return str.substring(0, len);
+ }
+ } else // 字节长度
+ {
+ StringBuffer sb = new StringBuffer();
+ int temp = 0;
+
+ for (int i = 0; i < str.length(); i++) {
+ if (i < len) // 是否到指定的长度
+ {
+ temp = ("" + str.charAt(i)).getBytes().length;
+ if (i + temp <= len) {
+ sb.append(str.charAt(i));
+ } else {
+ break;
+ }
+ } else {
+ break;
+ }
+ }
+ return sb.toString();
+ }
+ }
+
+ /**
+ * 从源字符串中从第一个字符开始取出给定长度的字串.
+ * 源字符串长度大于len时,尾巴追加一个appendStr串
+ *
+ * @param sourceStr
+ * String 源字符串
+ * @param len
+ * int 取出的长度
+ * @param appendStr
+ * String 追加的字符串(常用的appendStr为...)
+ * @return String 取出的子串
+ */
+ public static String substring(String sourceStr, int len, String appendStr) {
+ if (null == sourceStr || "".equals(sourceStr)) {
+ return sourceStr;
+ }
+ if (len <= 0) {
+ return "";
+ }
+
+ String newappendStr = appendStr;
+ if (null == newappendStr) {
+ newappendStr = "";
+ }
+
+ int sourceLen = sourceStr.length();
+ if (len >= sourceLen) {
+ return sourceStr;
+ } else {
+ return sourceStr.substring(0, len) + newappendStr;
+ }
+ }
+
+ /**
+ * 产生指定长度随机字符串(包括字母及数字).
+ *
+ * @param length
+ * int 随机字符串长度
+ * @return String 随机字符串
+ */
+ public static String random(int length) {
+ String retu = "";
+ int d1;
+ int d2;
+ char[] letters = initLetters();
+ //int[] numbers = initNumbers();
+
+ for (int i = 0; i < length; i++) {
+ // d1 = ((int) (Math.random() * 10) % 2);
+ d1 = (int) (Math.random() * 10) % 2;
+
+ if (d1 == 0) { // use a letter
+ // d2 = ((int) (Math.random() * 100) % 52);
+ d2 = (int) (Math.random() * 100) % 52;
+ retu += letters[d2];
+ } else if (d1 == 1) { // use a number
+ retu += (int) (Math.random() * 10);
+ }
+ }
+ return retu;
+ }
+
+ /**
+ * 产生纯字母的随机字符串
+ *
+ * @param length
+ * int 随机字符串长度
+ * @return String 随机字符串
+ */
+ public static String randomString(int length) {
+ String retu = "";
+ int d2;
+ char[] letters = initLetters();
+
+ for (int i = 0; i < length; i++) {
+ // d2 = ((int) (Math.random() * 100) % 52);
+ d2 = (int) (Math.random() * 100) % 52;
+ retu += letters[d2];
+ }
+ return retu;
+ }
+
+ /**
+ * 产生纯数字随机字符串
+ *
+ * @param length
+ * int 随机字符串长度
+ * @return String 随机字符串
+ */
+ public static String randomNumber(int length) {
+ String retu = "";
+ //int[] numbers = initNumbers();
+
+ for (int i = 0; i < length; i++) {
+ retu += (int) (Math.random() * 10);
+ }
+ return retu;
+ }
+
+ /**
+ * 内部方法,产生字母数组
+ *
+ * @return char[]
+ */
+ private static char[] initLetters() {
+ char[] ca = new char[52];
+ for (int i = 0; i < 26; i++) {
+ ca[i] = (char) (65 + i);
+ }
+ for (int i = 26; i < 52; i++) {
+ ca[i] = (char) (71 + i);
+ }
+ return ca;
+ }
+
+ /**
+ * 内部方法,产生数字数组
+ *
+ * @return int[]
+ */
+ /*private static int[] initNumbers() {
+ int[] na = new int[10];
+ for (int i = 0; i < 10; i++) {
+ na[i] = i;
+ }
+ return na;
+ }*/
+
+ /**
+ * 对字符串进行加减密处理.
+ *
+ * @param source
+ * String 待加减密处理的字符串
+ * @param flag
+ * boolean true表进行加密,false表进行减密
+ * @return String 处理后的字符串.
+ * source为空则返回原字符串source,
+ * 如果source中含有中文字符则对这一中文字符不处理.
+ */
+ public static String encrypt(String source, boolean flag) {
+ if (null == source || "".equals(source.trim())) {
+ return source;
+ }
+ String lsKEY1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz~!@#$%^&*(),.;[]{}";
+ String lsKEY2 = "&*()AD;[BFLCGH]{PQ}EI!JKRYZ1MSTXNO23UV,.Wcd45ef6lm7g@h0a#$nij8ob%^ptvz9ku~qrswxy";
+
+ char[] chSource = source.toCharArray();
+
+ StringBuffer strBuf = new StringBuffer(chSource.length);
+
+ int pos;
+ int len = chSource.length;
+ for (int i = 0; i < len; i++) {
+ if (flag) { // 加密
+ pos = lsKEY1.indexOf(chSource[i]);
+ if (pos >= 0) {
+ strBuf.append(lsKEY2.substring(pos, pos + 1));
+ } else {
+ strBuf.append(chSource[i]);
+ }
+ } else { // 减密
+ pos = lsKEY2.indexOf(chSource[i]);
+ if (pos >= 0) {
+ strBuf.append(lsKEY1.substring(pos, pos + 1));
+ } else {
+ strBuf.append(chSource[i]);
+ }
+ }
+ }
+
+ return strBuf.toString();
+
+ }
+
+ /**
+ * 将null字符串转换为空串,方便HTML的显示
+ *
+ * @param sourceStr
+ * 待处理的字符串
+ * @return String 处理的的字符串
+ */
+ public static String toVisualString(String sourceStr) {
+ if (sourceStr == null || sourceStr.equals("")) {
+ return "";
+ } else {
+ return sourceStr;
+ }
+ }
+
+ /**
+ * 将字段填充到指定的长度
+ *
+ * @param sourceStr
+ * String 操作字符串
+ * @param length
+ * int 指定长度
+ * @param withChar
+ * char 填充的字符
+ * @param isPadToEnd
+ * boolean 是否填充在字符的尾部 true :是 ,false:填充在头部
+ * @return String
+ */
+ public static String pad(String sourceStr, int length, char withChar, boolean isPadToEnd) {
+ if (sourceStr == null) {
+ return null;
+ }
+ if (sourceStr.length() >= length) {
+ return sourceStr;
+ }
+
+ StringBuffer sb = new StringBuffer(sourceStr);
+ for (int i = 0; i < length - sourceStr.length(); i++) {
+ if (isPadToEnd) {
+ sb.append(withChar);
+ } else {
+ sb.insert(0, withChar);
+ }
+ }
+ return sb.toString();
+
+ }
+
+ /**
+ * 首字母大写
+ * @return
+ */
+ public static String capToUpper(String str){
+ if (str == null) {
+ return null;
+ }
+ if(str.length()<0){
+ return "";
+ }
+ return str.substring(0,1).toUpperCase()+str.substring(1);
+ }
+ /**
+ * main
+ *
+ * @param args
+ * String[]
+ * @author:Administrator
+ */
+
+
+ /**
+ * 将身份证号码转换为18位
+ *
+ * @param xIdCode
+ * String
+ * @return String
+ */
+ public static String idTo18(String xIdCode) {
+ return IdentificationNumberUtils.id15ToId18(xIdCode);
+ }
+
+ /**
+ * 将身份证号转换为15位
+ *
+ * @param xIdCode
+ * String
+ * @return String
+ */
+ public static String idTo15(String xIdCode) {
+ return IdentificationNumberUtils.id18ToId15(xIdCode);
+ }
+
+ /**
+ * getIdCheckBit
+ *
+ * @param xId
+ * id
+ * @return String
+ * @author:Administrator
+ */
+ private static String getIdCheckBit(String xId) {
+ return IdentificationNumberUtils.getIdCheckBit(xId);
+ }
+
+ /**
+ * MD5加密算法
+ *
+ * @更新时间:Apr 22, 2008
+ * @更新作者:Ryan Wong
+ * @param s
+ * String
+ * @return String
+ */
+ public static String md5(String s) {
+ char[] hexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+ try {
+ byte[] strTemp = s.getBytes();
+ MessageDigest mdTemp = MessageDigest.getInstance("MD5");
+ mdTemp.update(strTemp);
+ byte[] md = mdTemp.digest();
+ int j = md.length;
+ char[] str = new char[j * 2];
+ int k = 0;
+ for (int i = 0; i < j; i++) {
+ byte byte0 = md[i];
+ str[k++] = hexDigits[byte0 >>> 4 & 0xf];
+ str[k++] = hexDigits[byte0 & 0xf];
+ }
+ return new String(str);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ /**
+ * 取得字符串中间的几位
+ *
+ * @更新时间:Apr 22, 2008
+ * @更新作者:Ryan Wong
+ * @param strsource
+ * str_source
+ * @param midlength
+ * midlength
+ * @return String
+ */
+ public static String getMidString(String strsource, int midlength) {
+ String strMid = "";
+ int length = strsource.length();
+ if (midlength > length) {
+ return null;
+ }
+ if (length % 2 == 0) {
+ if (midlength % 2 != 0) {
+ return null;
+ }
+ strMid = strsource.substring(length / 2 - midlength / 2, length / 2 + midlength / 2);
+
+ } else {
+ if (midlength % 2 == 0) {
+ return null;
+ }
+ strMid = strsource.substring((length - 1) / 2 - (midlength - 1) / 2, (length - 1) / 2
+ + (midlength - 1) / 2 + 1);
+
+ }
+ return strMid;
+ }
+
+ public static boolean isNotBlank(String value){
+ return (value!=null) && !value.equals("");
+ }
+
+ public static boolean isBlank(String value){
+ return (value==null) || value.equals("");
+ }
+ /**
+ * getStringToInt
+ * @param value String
+ * @param defaultInt int
+ * @return int
+ * @author:Administrator
+ */
+ public static int getStringToInt(String value, int defaultInt) {
+ int i = defaultInt;
+ if (isNotBlank(value) ) {
+ Integer intObject = getStringByInt(value);
+ if(intObject!=null){
+ return intObject.intValue();
+ }
+ }
+ return i;
+ }
+
+ /**
+ * 字符串替换
+ * @param value String
+ * @param replaceChar String
+ * @return String
+ * @author:Administrator
+ */
+ public static String replaceStr(String value, String replaceChar) {
+ String returnValue = "";
+ if (isNotBlank(value)) {
+ returnValue = value.replaceAll("[" + replaceChar + "]", "");
+ }
+ return returnValue;
+ }
+
+ /**
+ * getNullByString
+ * @param value String
+ * @return String
+ * @author:Administrator
+ */
+ public static String getNullByString(String value) {
+ String values = "";
+ if (isNotBlank(value)) {
+ values = value.trim();
+ }
+ return values;
+ }
+
+ /**
+ * getNullByString
+ * @param value String
+ * @param defaultValue String
+ * @return String
+ * @author:Administrator
+ */
+ public static String getNullByString(String value, String defaultValue) {
+ String values = "";
+ if (isNotBlank(value)) {
+ values = value;
+ } else {
+ values = defaultValue;
+ }
+ return values;
+ }
+
+ /**
+ * getStringByInt
+ * @param value String
+ * @return Integer
+ * @author:Administrator
+ */
+ public static Integer getStringByInt(String value) {
+ Integer intValue = null;
+ if (isNotBlank(value) ) {
+ try{
+ intValue = Integer.valueOf(value);
+ } catch(NumberFormatException ex){
+
+ }
+ }
+ return intValue;
+ }
+
+ /**
+ * getStringByMaxLen
+ * @param value String
+ * @param maxLen int
+ * @return String
+ * @author:Administrator
+ */
+ public static String getStringByMaxLen(String value, int maxLen) {
+ String returnValue = "";
+ if (isNotBlank(value)) {
+ returnValue = value.length() > maxLen ? value.substring(0, maxLen) : value;
+ }
+ return returnValue;
+ }
+
+ /**
+ * getCheckBoxValueByStr
+ * @param value String
+ * @return String
+ * @author:Administrator
+ */
+ public static String getCheckBoxValueByStr(String value) {
+ String returnValue = "";
+ if (isNotBlank(value)) {
+ if (value.equals("on")) {
+ returnValue = "1";
+ } else {
+ returnValue = "0";
+ }
+ }
+ return returnValue;
+ }
+
+ /**
+ * 删除字符两端的空字符串
+ *
+ * @author cailj
+ * @param str
+ * @return
+ */
+ public static String trim(String str) {
+ return str != null ? str.trim() : null;
+ }
+
+ /**
+ * 进行字符规格化(全角转半角,大写转小写处理)
+ * @param input
+ * @return char
+ */
+ public static char[] regularize(char[] input){
+
+ for(int i = 0; i < input.length; i ++){
+ input[i] = regularize(input[i]);
+ }
+ return input;
+ }
+
+ /**
+ * 进行字符规格化(全角转半角,大写转小写处理)
+ * @param input
+ * @return char
+ */
+ public static char regularize(char input){
+ if (input == 12288) {
+ input = (char) 32;
+
+ }else if (input > 65280 && input < 65375) {
+ input = (char) (input - 65248);
+
+ }else if (input >= 'A' && input <= 'Z') {
+ input |= 32;
+ }
+ return input;
+ }
+
+ /**
+ * 进行字符规格化(全角转半角,大写转小写处理)
+ * @param input
+ * @return char
+ */
+ public static String regularize(String input){
+ if(StringUtils.isBlank(input)) return "";
+
+ char[] inputChars = input.toCharArray();
+ for(int i = 0; i < inputChars.length; i ++){
+ inputChars[i] = regularize(inputChars[i]);
+ }
+ return new String(inputChars);
+ }
+
+ /**
+ * 字符反转
+ * eg: reverse(abc) = cba
+ * @param str
+ * @return
+ */
+ public static String reverse(String str) {
+ char[] chrs = str.toCharArray();
+ int n = chrs.length - 1;
+ for (int j = (n-1) >> 1; j >= 0; --j) {
+ char temp = chrs[j];
+ char temp2 = chrs[n - j];
+ chrs[j] = temp2;
+ chrs[n - j] = temp;
+ }
+ return new String(chrs, 0, chrs.length);
+ }
+ /**
+ * 字符串是否是 数字类型
+ * @param str
+ * @return
+ */
+ public static boolean isNumber(String str){
+
+ if(isInteger(str)||isFloat(str)){
+ return true;
+ }else{
+ return false;
+ }
+
+ }
+
+ /**
+ * 判断字符串是否为浮点型
+ * @param str
+ * @return
+ */
+ public static boolean isFloat(String str){
+
+ if(StringUtils.isNullBlank(str))return false;
+
+ Pattern pattern= Pattern.compile("^[-\\+]?\\d+\\.{0,1}[\\d]+$");
+ return pattern.matcher(str).matches();
+ }
+
+ /**
+ * 判断字符串是否是整数
+ * @param str
+ * @return
+ */
+ public static boolean isInteger(String str){
+
+ if(StringUtils.isNullBlank(str))return false;
+
+ Pattern pattern = Pattern.compile("^[-\\+]?[\\d]+$");
+ return pattern.matcher(str).matches();
+ }
+
+ /**
+ * 忽略正则关键字
+ * @param keyword 正在表达式关键字 例如"\t","\d","*"等
+ * @return 返回正则表达式
+ */
+ public static String ignoreRegexKeyword(String keyword){
+ return "\\Q"+keyword+"\\E";
+ }
+
+ /**
+ *
+ * @param str
+ * @param character
+ * @return
+ */
+ public static String removeLastCharacter(String str, String character){
+ if(str==null||str.length()==0){
+ return str;
+ }
+ int en=-1;
+ if((en=str.lastIndexOf(character))>=0&&(en+character.length()==str.length())){
+ return str.substring(0,en);
+ }else{
+ return str;
+ }
+ }
+ public static String ignoreKeyword(String txt){
+ if(txt==null){
+ return null;
+ }
+ String str=ignoreKeyword(txt,"n");
+ str=ignoreKeyword(str,"t");
+ return str;
+ }
+ public static String ignoreKeyword(Object object){
+ return ignoreKeyword(String.valueOf(object));
+ }
+ public static String ignoreKeyword(String txt, String keyWord){
+ if(txt==null){
+ return null;
+ }
+
+ if(txt.length()==0||isBlank(keyWord)){
+ return txt;
+ }
+ return txt.replaceAll("\\"+keyWord,"\\\\"+keyWord);
+ }
+
+
+
+
+ /**
+ * 下划线转驼峰法
+ * @param line 源字符串
+ * @param smallCamel 大小驼峰,是否为小驼峰
+ * @return 转换后的字符串
+ */
+ public static String underline2Camel(String line, boolean smallCamel){
+ if(line==null||"".equals(line)){
+ return "";
+ }
+ StringBuffer sb=new StringBuffer();
+ Pattern pattern= Pattern.compile("([A-Za-z\\d]+)(_)?");
+ Matcher matcher=pattern.matcher(line);
+ while(matcher.find()){
+ String word=matcher.group();
+ sb.append(smallCamel&&matcher.start()==0? Character.toLowerCase(word.charAt(0)): Character.toUpperCase(word.charAt(0)));
+ int index=word.lastIndexOf('_');
+ if(index>0){
+ sb.append(word.substring(1, index).toLowerCase());
+ }else{
+ sb.append(word.substring(1).toLowerCase());
+ }
+ }
+ return sb.toString();
+ }
+ /**
+ * 驼峰法转下划线
+ * @param line 源字符串
+ * @return 转换后的字符串
+ */
+ public static String camel2Underline(String line){
+ if(line==null||"".equals(line)){
+ return "";
+ }
+ line= String.valueOf(line.charAt(0)).toUpperCase().concat(line.substring(1));
+ StringBuffer sb=new StringBuffer();
+ Pattern pattern= Pattern.compile("[A-Z]([a-z\\d]+)?");
+ Matcher matcher=pattern.matcher(line);
+ while(matcher.find()){
+ String word=matcher.group();
+ sb.append(word.toUpperCase());
+ sb.append(matcher.end()==line.length()?"":"_");
+ }
+ return sb.toString();
+ }
+
+
+ //IOS端version比较大小 param1>param2 返回 1 =返回0 <返回-1
+ public static int compareVersion(String versionClient,String versionServe){
+ //版本长度
+ String[] cArr = versionClient.split("\\.");
+ String[] sArr = versionServe.split("\\.");
+ int diff = cArr.length-sArr.length;
+ int result = 0;
+
+ //补齐长度
+ if(diff>0){
+ sArr = align(sArr,cArr,diff);
+ }else{
+ cArr = align(cArr,sArr,-diff);
+ }
+
+ for(int i=0;i0){
+ param2 = align(param2,param1,diff2);
+ }else{
+ param1 = align(param1,param2,-diff2);
+ }
+
+ int param11 = Integer.parseInt(StringUtils.arrayToString(param1,""));
+ int param22 = Integer.parseInt(StringUtils.arrayToString(param2,""));
+
+ if(param11>param22){
+ result = 1;
+ break;
+ }else if(param11Assert
+ *
+ * --描述说明--
+ *
+ *
+ * --样例--
+ * Assert obj = new Assert();
+ * obj.method();
+ *
+ * JDK版本:JDK1.4
+ * @author 李炜
+ */
+public abstract class Validator {
+ /**
+ * 判断表达式是否为true
+ * @param expression 要判断的表达式
+ */
+ public static boolean isTrue(boolean expression) {
+ return expression;
+ }
+
+
+ /**
+ * 判断表达式是否为0
+ * @param expression 要判断的表达式
+ */
+ public static boolean isZero(int num) {
+ return num == 0;
+ }
+
+
+ /**
+ * 判断表达式是否为非空
+ * @param expression 要判断的表达式
+ */
+ public static boolean notZero(int num, String message) {
+ return num == 0;
+ }
+
+
+
+ /**
+ * 判断表达式是否为空
+ * @param expression 要判断的表达式
+ */
+ public static boolean isNull(Object object) {
+ return object == null;
+ }
+
+
+
+ /**
+ * 判断表达式是否为非空
+ * @param expression 要判断的表达式
+ */
+ public static boolean notNull(Object object) {
+ return object != null;
+ }
+
+ /**
+ * 判断字符串长度是否大于指定长度
+ * @param text 字符串
+ * @param size 指定长度
+ */
+ public static boolean gtLength(String text,int size){
+ return notNull(text) && text.length() > size;
+ }
+
+
+ public static boolean gtLength(Collection collection,int size){
+ return notNull(collection) && collection.size() > size;
+ }
+
+ public static boolean gtLength(Map collection,int size){
+ return notNull(collection) && collection.size() > size;
+ }
+
+
+ /**
+ * 判断字符串长度是否小于指定长度
+ * @param text 字符串
+ * @param size 指定长度
+ */
+ public static boolean ltLength(String text,int size){
+ return notNull(text) && text.length() < size;
+ }
+
+ public static boolean ltLength(Collection collection,int size){
+ return notNull(collection) && collection.size()< size;
+ }
+
+ public static boolean ltLength(Map collection,int size){
+ return notNull(collection) && collection.size()< size;
+ }
+
+ /**
+ * 判断text是否为有内容字符串
+ * @param text 要判断的字符串
+ */
+ public static boolean hasLength(String text) {
+ return notNull(text) && gtLength(text, 0);
+ }
+
+ public static boolean hasLength(Object[] arrays){
+ return notNull(arrays) && arrays.length > 0;
+ }
+
+ /**
+ * 判断text是否为有内容字符串
+ * @param text 要判断的字符串
+ */
+ public static boolean hasLength(StringBuffer text) {
+ return notNull(text) && gtLength(text.toString(), 0);
+ }
+
+
+ /**
+ * 判断text是否为有内容,如果都是空白字符也将抛异常
+ * @param text 要判断的字符串
+ */
+ public static boolean hasText(String text) {
+ return notNull(text) && gtLength(text.trim(), 0);
+ }
+
+ public static boolean hasText(StringBuffer sb){
+ return notNull(sb) && gtLength(sb.toString().trim(), 0);
+ }
+
+ /**
+ * 判断数组是否大于指定长度
+ * @param array 数组
+ * @param size 长度
+ */
+ public static boolean gtSize(Object[] array,int size){
+ return notNull(array) && array.length > size;
+ }
+
+ /**
+ * 判断数组是否小于指定长度
+ * @param array 数组
+ * @param size 长度
+ */
+ public static boolean ltSize(Object[] array,int size){
+ return notNull(array) && array.length < size;
+ }
+
+
+ /**
+ * 判断数组是否为空数组
+ * @param array 要判断的数租
+ */
+ public static boolean notEmpty(Object[] array) {
+ return notNull(array) && gtSize(array, 0);
+ }
+
+
+ /**
+ * 判断集合是否为空集合对象
+ * @param array 要判断的集合对象
+ */
+ public static boolean notEmpty(Collection collection) {
+ return notNull(collection) && !collection.isEmpty();
+ }
+
+
+
+
+ /**
+ * 判断Map是否为空对象,有默认消息
+ * @param array 要判断的Map
+ * @throws IllegalArgumentException 如果是空集合对象或者null
+ */
+ public static boolean notEmpty(Map map) {
+ return notNull(map) && !map.isEmpty();
+ }
+
+
+ /**
+ *判断指定的 Object 是否与此 type 所表示的对象赋值兼容
+ * @param 用于检查的Class对象
+ * @param obj 用于检查的对象
+ */
+ public static boolean isInstanceOf(Class type, Object obj, String message) {
+ return notNull(type) && type.isInstance(obj);
+ }
+
+
+ /**
+ * 判断两个类型是否相同
+ * @param type1
+ * @param type2
+ */
+ public static boolean isSameType(Class type1,Class type2,String message){
+ return notNull(type1) && notNull(type2) && type1.equals(type2);
+ }
+
+
+ /**
+ * 判断一个class对象调用newInstance,是否成功
+ * @param type
+ */
+ public static boolean isNewInstanceOf(Class type){
+ if(notNull(type)){
+ try {
+ type.newInstance();
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }else{
+ return false;
+ }
+ }
+
+
+ /**
+ * 判断superType.isAssignableFrom(subType)是否为true
+ * @param superType 超类
+ * @param subType 子类
+ */
+ public static boolean isAssignable(Class superType, Class subType) {
+ return notNull(superType) && notNull(subType) && superType.isAssignableFrom(subType);
+ }
+
+
+
+
+
+}
diff --git a/luqj-common/src/main/java/com/luqj/util/assertion/Assert.java b/luqj-common/src/main/java/com/luqj/util/assertion/Assert.java
new file mode 100644
index 0000000..edee462
--- /dev/null
+++ b/luqj-common/src/main/java/com/luqj/util/assertion/Assert.java
@@ -0,0 +1,395 @@
+/**
+* 版权所有:厦门市巨龙软件工程有限公司
+* Copyright 2010 Xiamen Dragon Software Eng. Co. Ltd.
+* All right reserved.
+*====================================================
+* 文件名称: Assert.java
+* 修订记录:
+* No 日期 作者(操作:具体内容)
+* 1. 2010-8-6 李炜(创建:创建文件)
+*====================================================
+* 类描述:(说明未实现或其它不应生成javadoc的内容)
+*
+*/
+package com.luqj.util.assertion;
+
+
+import com.luqj.util.log.LogUtil;
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ *Assert
+ *
+ * --描述说明--
+ *
+ *
+ * --样例--
+ * Assert obj = new Assert();
+ * obj.method();
+ *
+ * JDK版本:JDK1.4
+ * @author 李炜
+ */
+public abstract class Assert {
+ /**
+ * 断言表达式是否为true
+ * @param expression 要断言的表达式
+ * @param message 抛异常以后的消息
+ * @throws IllegalArgumentException 如果不是true
+ */
+ public static void isTrue(boolean expression, String message) {
+ if (!expression) {
+ throw new IllegalArgumentException(message);
+ }
+ }
+
+ /**
+ * 断言表达式是否为true,有默认消息
+ * @param expression 要断言的表达式
+ * @throws IllegalArgumentException 如果不是true
+ */
+ public static void isTrue(boolean expression) {
+ isTrue(expression, "[断言失败] - 参数必须是 true");
+ }
+
+ /**
+ * 断言表达式是否为0
+ * @param message 抛异常以后的消息
+ * @throws IllegalArgumentException 如果不是空
+ */
+ public static void isZero(long num, String message) {
+ if (num != 0) {
+ throw new IllegalArgumentException(message);
+ }
+ }
+
+ /**
+ * 断言表达式是否为空,有默认消息
+ * @throws IllegalArgumentException 如果不是空
+ */
+ public static void isZero(long num) {
+ isZero(num, "[断言失败] - 参数值必须是0");
+ }
+
+ /**
+ * 断言表达式是否为非空
+ * @param message 抛异常以后的消息
+ * @throws IllegalArgumentException 如果不是非空
+ */
+ public static void notZero(long num, String message) {
+ if (num == 0) {
+ throw new IllegalArgumentException(message);
+ }
+ }
+
+ /**
+ * 断言表达式是否为非空,有默认消息
+ * @throws IllegalArgumentException 如果不是非空
+ */
+ public static void notZero(long num) {
+ notZero(num, "[断言失败] - 参数必须非0");
+ }
+
+
+ /**
+ * 断言表达式是否为空
+ * @param message 抛异常以后的消息
+ * @throws IllegalArgumentException 如果不是空
+ */
+ public static void isNull(Object object, String message) {
+ if (object != null) {
+ throw new IllegalArgumentException(message);
+ }
+ }
+
+ /**
+ * 断言表达式是否为空,有默认消息
+ * @throws IllegalArgumentException 如果不是空
+ */
+ public static void isNull(Object object) {
+ isNull(object, "[断言失败] - 参数必须是 null");
+ }
+
+
+
+ /**
+ * 断言表达式是否为非空
+ * @param message 抛异常以后的消息
+ * @throws IllegalArgumentException 如果不是非空
+ */
+ public static void notNull(Object object, String message) {
+ if (object == null) {
+ throw new IllegalArgumentException(message);
+ }
+ }
+
+ /**
+ * 断言表达式是否为非空,有默认消息
+ * @throws IllegalArgumentException 如果不是非空
+ */
+ public static void notNull(Object object) {
+ notNull(object, "[断言失败] - 参数必须是非空对象");
+ }
+
+
+
+ /**
+ * 断言表达式是否为非空,有默认消息
+ * @throws IllegalArgumentException 如果不是非空
+ */
+ public static void notNull(Object... objects) {
+ for (int i = 0; i < objects.length; i++) {
+ notNull(objects[i], "[断言失败] - 参数["+i+"]必须是非空对象");
+ }
+ }
+
+ /**
+ * 断言text是否为有内容字符串
+ * @param text 要断言的字符串
+ * @param message 抛异常以后的消息
+ * @throws IllegalArgumentException 如果是空串或null对象
+ */
+ public static void hasLength(String text, String message) {
+ if (text == null || text.length() == 0) {
+ throw new IllegalArgumentException(message);
+ }
+ }
+
+ /**
+ * 断言text是否为有内容字符串,有默认消息
+ * @param text 要断言的字符串
+ * @throws IllegalArgumentException 如果是空串或null对象
+ */
+ public static void hasLength(String text) {
+ hasLength(text,
+ "[断言失败] - 参数必须是非空字符串");
+ }
+
+ /**
+ * 断言text是否为有内容,如果都是空白字符也将抛异常
+ * @param text 要断言的字符串
+ * @param message 抛异常以后的消息
+ * @throws IllegalArgumentException 如果是空串或null对象,或所有内容为空白字符
+ */
+ public static void hasText(String text, String message) {
+ if (text == null || text.trim().length() == 0) {
+ throw new IllegalArgumentException(message);
+ }
+ }
+
+ /**
+ * 断言text是否为有内容,如果都是空白字符也将抛异常,有默认消息
+ * @param text 要断言的字符串
+ * @throws IllegalArgumentException 如果是空串或null对象,或所有内容为空白字符
+ */
+ public static void hasText(String text) {
+ hasText(text,
+ "[断言失败] - text必须是有内容的,有内容指不是全部为空白字符的字符串");
+ }
+
+
+ /**
+ * 断言数组是否为空数组
+ * @param array 要断言的数租
+ * @param message 抛异常以后的消息
+ * @throws IllegalArgumentException 如果是空数组或者null
+ */
+ public static void notEmpty(Object[] array, String message) {
+ if (array == null || array.length == 0) {
+ throw new IllegalArgumentException(message);
+ }
+ }
+
+ /**
+ * 断言数组是否为空数组,有默认消息
+ * @param array 要断言的数租
+ * @throws IllegalArgumentException 如果是空数组或者null
+ */
+ public static void notEmpty(Object[] array) {
+ notEmpty(array, "[断言失败] - 参数数组必须是非空数组");
+ }
+
+ /**
+ * 断言集合是否为空集合对象
+ * @param message 抛异常以后的消息
+ * @throws IllegalArgumentException 如果是空集合对象或者null
+ */
+ public static void notEmpty(Collection collection, String message) {
+ if (collection == null || collection.isEmpty()) {
+ throw new IllegalArgumentException(message);
+ }
+ }
+
+ /**
+ * 断言集合是否为空集合对象,有默认消息
+ * @throws IllegalArgumentException 如果是空集合对象或者null
+ */
+ public static void notEmpty(Collection collection) {
+ notEmpty(collection,
+ "[断言失败] - 集合参数必须是有内容的");
+ }
+
+ /**
+ * 断言Map是否为空对象
+ * @param message 抛异常以后的消息
+ * @throws IllegalArgumentException 如果是空集合对象或者null
+ */
+ public static void notEmpty(Map map, String message) {
+ if (map == null || map.isEmpty()) {
+ throw new IllegalArgumentException(message);
+ }
+ }
+
+ /**
+ * 断言Map是否为空对象,有默认消息
+ * @throws IllegalArgumentException 如果是空集合对象或者null
+ */
+ public static void notEmpty(Map map) {
+ notEmpty(map, "[断言失败] - Map参数必须是有内容的");
+ }
+
+
+ /**
+ *断言指定的 Object 是否与此 type 所表示的对象赋值兼容
+ * @param obj 用于检查的对象
+ * @throws IllegalArgumentException 如果不兼容
+ */
+ public static void isInstanceOf(Class clazz, Object obj) {
+ isInstanceOf(clazz, obj, "");
+ }
+
+ /**
+ *断言指定的 Object 是否与此 type 所表示的对象赋值兼容
+ * @param obj 用于检查的对象
+ * @param message 抛异常以后的消息
+ * @throws IllegalArgumentException 如果不兼容
+ */
+ public static void isInstanceOf(Class type, Object obj, String message) {
+ notNull(type, "类型对象不可为空");
+ if (!type.isInstance(obj)) {
+ throw new IllegalArgumentException(message +
+ "Object of class [" + (obj != null ? obj.getClass().getName() : "null") +
+ "] must be an instance of " + type);
+ }
+ }
+
+
+ /**
+ * 断言一个class对象调用newInstance,是否成功
+ * @param type
+ * @throws IllegalArgumentException 如果不成功
+ */
+ public static void isNewInstanceOf(Class type){
+ isNewInstanceOf(type,"");
+ }
+
+ /**
+ * 断言两个类型是否相同
+ * @param type1
+ * @param type2
+ */
+ public static void isSameType(Class type1,Class type2,String message){
+ notNull(type1,"类型对象不可为空");
+ notNull(type2,"类型对象不可为空");
+ if(!type1.equals(type2)){
+ throw new IllegalArgumentException(message);
+ }
+ }
+
+ /**
+ * 断言两个类型是否相同
+ * @param type1
+ * @param type2
+ */
+ public static void isSameType(Class type1,Class type2){
+ isSameType(type1, type2, "必须是相同类型");
+ }
+
+ /**
+ * 断言一个class对象调用newInstance,是否成功
+ * @param type
+ * @param message 抛异常以后的消息
+ * @throws IllegalArgumentException 如果不成功
+ */
+ public static void isNewInstanceOf(Class type,String message){
+ notNull(type,"类型对象不可为空");
+ try {
+ type.newInstance();
+ } catch (InstantiationException e) {
+
+ throw new IllegalArgumentException(message +
+ "Class [" + type +"] must be can new instance ");
+ } catch (IllegalAccessException e) {
+
+ throw new IllegalArgumentException(message +
+ "Class [" + type +"] must be can new instance ");
+ }
+ }
+
+ /**
+ * 断言superType.isAssignableFrom(subType)是否为true
+ * @param superType 超类
+ * @param subType 子类
+ * @throws IllegalArgumentException 如果调用该方法为false
+ */
+ public static void isAssignable(Class superType, Class subType) {
+ isAssignable(superType, subType, "");
+ }
+
+ /**
+ * 断言superType.isAssignableFrom(subType)是否为true
+ * @param superType 超类
+ * @param subType 子类
+ * @param message 抛异常以后的消息
+ * @throws IllegalArgumentException 如果调用该方法为false
+ */
+ public static void isAssignable(Class superType, Class subType, String message) {
+ notNull(superType, "超类的类对象必须为非空");
+ if (subType == null || !superType.isAssignableFrom(subType)) {
+ throw new IllegalArgumentException(message + subType + " is not assignable to " + superType);
+ }
+ }
+
+
+ /**
+ * 断言一个对象所属状态值是否为true
+ * @param expression 要断言的状态表达式
+ * @param message 抛异常以后的消息
+ * @throws IllegalStateException 如果表达式为false
+ */
+ public static void state(boolean expression, String message) {
+ if (!expression) {
+ throw new IllegalStateException(message);
+ }
+ }
+
+
+ /**
+ * 断言一个对象所属状态值是否为true,有默认消息
+ * @param expression 要断言的状态表达式
+ * @throws IllegalStateException 如果表达式为false
+ */
+ public static void state(boolean expression) {
+ state(expression, "[断言失败] - 状态表达式必须式true");
+ }
+
+ public static void logic(boolean expression,String message){
+ if (!expression) {
+ throw new IllegalLogicException(message);
+ }
+ }
+
+ public static void logic(boolean expression){
+ logic(expression, "[断言失败] - 逻辑表达式必须是true");
+ }
+
+ public static void fail(String message){
+ throw new IllegalLogicException(message);
+ }
+
+ public static void fail(String message,Throwable e){
+ throw new IllegalLogicException(LogUtil.exceptionMsg(message,e),e);
+ }
+}
diff --git a/luqj-common/src/main/java/com/luqj/util/assertion/IllegalLogicException.java b/luqj-common/src/main/java/com/luqj/util/assertion/IllegalLogicException.java
new file mode 100644
index 0000000..a1c5f36
--- /dev/null
+++ b/luqj-common/src/main/java/com/luqj/util/assertion/IllegalLogicException.java
@@ -0,0 +1,21 @@
+package com.luqj.util.assertion;
+
+public class IllegalLogicException extends RuntimeException {
+
+ public IllegalLogicException() {
+ super();
+ }
+
+ public IllegalLogicException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+
+ public IllegalLogicException(String arg0) {
+ super(arg0);
+ }
+
+ public IllegalLogicException(Throwable arg0) {
+ super(arg0);
+ }
+
+}
diff --git a/luqj-common/src/main/java/com/luqj/util/date/DateUtils.java b/luqj-common/src/main/java/com/luqj/util/date/DateUtils.java
new file mode 100644
index 0000000..c7546ce
--- /dev/null
+++ b/luqj-common/src/main/java/com/luqj/util/date/DateUtils.java
@@ -0,0 +1,1331 @@
+/**
+ * 版权所有:厦门市巨龙软件工程有限公司
+ * Copyright 2009 Xiamen Dragon Software Eng. Co. Ltd.
+ * All right reserved.
+ *====================================================
+ * 文件名称: DateUtils.java
+ * 修订记录:
+ * No 日期 作者(操作:具体内容)
+ * 1. Mar 3, 2009 何志昭(创建:创建文件)
+ * 2. Mar 3, 2009 根据dragonsoft_checks.xml规范进行调整
+ *====================================================
+ * 类描述:
+ *
+ */
+package com.luqj.util.date;
+
+
+import com.luqj.util.StringUtils;
+import com.luqj.util.Validator;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+/**
+ *
+ *
+ *
+ *
+ *
+ * - JDK版本:
+ *
+ * - 1.4
+ *
+ *
+ * @author 陈雄华,姚建斌,谢计生
+ * @version 1.0
+ * @see Java
+ * simpleDateFormat Tutorial
+ * @see Date
+ * @see Calendar
+ * @see SimpleDateFormat
+ * @since 1.0
+ */
+public class DateUtils {
+
+ /**一分钟的秒数*/
+ public static final int SECONDS_ONE_MINUTE = 60;
+
+ /**一秒的毫秒数*/
+ public static final int MILLISECONDS_ONE_SECOND = 1000;
+
+ /**一小时的秒数*/
+ public static final int SECONDS_ONE_HOUR = 60 * SECONDS_ONE_MINUTE;
+
+ /**一天的秒数*/
+ public static final int SECONDS_ONE_DAY = 24 * SECONDS_ONE_HOUR;
+
+ /** 数据库存储的时间格式串,如yyyymmdd 或yyyymmddHHMiSS */
+ public static final int DB_STORE_DATE = 1;
+
+ /** 用连字符-分隔的时间时间格式串,如yyyy-mm-dd 或yyyy-mm-dd HH:Mi:SS */
+ public static final int HYPHEN_DISPLAY_DATE = 2;
+
+ /** 用连字符.分隔的时间时间格式串,如yyyy.mm.dd 或yyyy.mm.dd HH:Mi:SS */
+ public static final int DOT_DISPLAY_DATE = 3;
+
+ /** 用中文字符分隔的时间格式串,如yyyy年mm月dd 或yyyy年mm月dd HH:Mi:SS */
+ public static final int CN_DISPLAY_DATE = 4;
+ /** 日期的开始时间戳*/
+ public static final String DB_STORE_DATE_BEGIN = "000000";
+ /** 日期的结束时间戳*/
+ public static final String DB_STORE_DATE_END = "235959";
+
+
+ /**
+ * 获取当前月份的第一天
+ * @return 第一天的日期对象
+ * @author:李炜
+ */
+ public static Date getCurMonthFirstDate(){
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
+ return calendar.getTime();
+ }
+
+ /**
+ * 获取当前月份的最后一天
+ * @return 最后一天的日期对象
+ * @author:李炜
+ */
+ public static Date getCurMonthLastDay() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
+ return calendar.getTime();
+ }
+
+
+ /**
+ * 获取日期的开始时间戳
+ * @param storeDate 数据库存储日期,格式yyyyMMddHHmmss
+ * @return storeDate
+ * @author:李炜
+ */
+ public static String getStoreDateBegin(String storeDate){
+ if(storeDate.length() >= 8){
+ return storeDate.substring(0,8)+DB_STORE_DATE_BEGIN;
+ }else{
+ return storeDate;
+ }
+ }
+
+ /**
+ * 获取日期的结束时间戳
+ * @param storeDate 数据库存储日期,格式yyyyMMddHHmmss
+ * @return storeDate
+ * @author:李炜
+ */
+ public static String getStoreDateEnd(String storeDate){
+ if(storeDate.length() >= 8){
+ return storeDate.substring(0,8)+DB_STORE_DATE_END;
+ }else{
+ return storeDate;
+ }
+ }
+
+
+ /**
+ * 得到精确到秒的格式化当前时间串
+ *
+ * @param formatType
+ * 时间格式的类型{@link #DB_STORE_DATE},{@link #EN_HTML_DISPLAY_DATE},{@link #CN_HTML_DISPLAY_DATE}
+ * @return 当前时间格式化时间串
+ */
+ public static String getCurrTimeStr(int formatType) {
+ return getTimeStr(new Date(), formatType);
+ }
+
+ /**
+ * 得到精确到秒的格式化时间串
+ *
+ * @param date
+ * 指定时间
+ * @param formatType
+ * 时间格式的类型{@link #DB_STORE_DATE},{@link #HYPHEN_DISPLAY_DATE},{@link #DOT_DISPLAY_DATE}
+ * @return 指定时间的格式化时间串
+ */
+ public static String getTimeStr(Date date, int formatType) {
+ if (formatType < DB_STORE_DATE || formatType > CN_DISPLAY_DATE) {
+ throw new IllegalArgumentException("时间格式化类型不是合法的值。");
+ } else {
+ String formatStr = null;
+ switch (formatType) {
+ case DB_STORE_DATE:
+ formatStr = "yyyyMMddHHmmss";
+ break;
+ case HYPHEN_DISPLAY_DATE:
+ formatStr = "yyyy'-'MM'-'dd HH:mm:ss";
+ break;
+ case DOT_DISPLAY_DATE:
+ formatStr = "yyyy.MM.dd HH:mm:ss";
+ break;
+ case CN_DISPLAY_DATE:
+ formatStr = "yyyy'年'MM'月'dd HH:mm:ss";
+ break;
+ default:
+ formatStr = "yyyyMMddHHmmss";
+ break;
+ }
+ SimpleDateFormat sdf = new SimpleDateFormat(formatStr);
+ return sdf.format(date);
+ }
+ }
+
+ /**
+ * 得到精确到天的当前格式化日期串
+ *
+ * @param formatType
+ * 时间格式的类型{@link #DB_STORE_DATE},{@link #EN_HTML_DISPLAY_DATE},{@link #CN_HTML_DISPLAY_DATE}
+ * @return String
+ */
+ public static String getCurrDateStr(int formatType) {
+ return getDateStr(new Date(), formatType);
+ }
+
+ /**
+ * 得到精确到天的指定时间格式化日期串
+ *
+ * @param date
+ * 指定时间
+ * @param formatType
+ * 时间格式的类型{@link #DB_STORE_DATE},{@link #EN_HTML_DISPLAY_DATE},{@link #CN_HTML_DISPLAY_DATE}
+ * @return 指定时间格式化日期串
+ */
+ public static String getDateStr(Date date, int formatType) {
+ if (formatType < DB_STORE_DATE || formatType > CN_DISPLAY_DATE) {
+ throw new IllegalArgumentException("时间格式化类型不是合法的值。");
+ } else {
+ String formatStr = null;
+ switch (formatType) {
+ case DB_STORE_DATE:
+ formatStr = "yyyyMMdd";
+ break;
+ case HYPHEN_DISPLAY_DATE:
+ formatStr = "yyyy-MM-dd";
+ break;
+ case DOT_DISPLAY_DATE:
+ formatStr = "yyyy.MM.dd";
+ break;
+ case CN_DISPLAY_DATE:
+ formatStr = "yyyy'年'MM'月'dd";
+ break;
+ default:
+ formatStr = "yyyyMMdd";
+ break;
+ }
+ SimpleDateFormat sdf = new SimpleDateFormat(formatStr);
+ return sdf.format(date);
+ }
+ }
+
+ /**
+ * 得到精确到月的当前时间格式化年月串
+ *
+ * @param formatType
+ * 时间格式的类型{@link #DB_STORE_DATE},{@link #EN_HTML_DISPLAY_DATE},{@link #CN_HTML_DISPLAY_DATE}
+ * @return 精确到月当前时间格式化年月串
+ */
+ public static String getYearMonthStr(int formatType) {
+ return getYearMonthStr(new Date(), formatType);
+ }
+
+ /**
+ * 得到精确到月的指定时间格式化年月串
+ *
+ * @param date
+ * 指定的时间
+ * @param formatType
+ * 时间格式的类型{@link #DB_STORE_DATE},{@link #EN_HTML_DISPLAY_DATE},{@link #CN_HTML_DISPLAY_DATE}
+ * @return 精确到月当前时间格式化年月串
+ */
+ public static String getYearMonthStr(Date date, int formatType) {
+ if (formatType < DB_STORE_DATE || formatType > CN_DISPLAY_DATE) {
+ throw new IllegalArgumentException("时间格式化类型不是合法的值。");
+ } else {
+ String formatStr = null;
+ switch (formatType) {
+ case DB_STORE_DATE:
+ formatStr = "yyyyMM";
+ break;
+ case HYPHEN_DISPLAY_DATE:
+ formatStr = "yyyy-MM";
+ break;
+ case DOT_DISPLAY_DATE:
+ formatStr = "yyyy.MM";
+ break;
+ case CN_DISPLAY_DATE:
+ formatStr = "yyyy'年'MM'月'";
+ break;
+ default:
+ formatStr = "yyyyMM";
+ break;
+ }
+
+ SimpleDateFormat sdf = new SimpleDateFormat(formatStr);
+ return sdf.format(date);
+ }
+ }
+
+ /**
+ * 将数据库存储的日期格式串转换为各种显示的格式
+ *
+ * @param dateStr
+ * 最小6位,最大14位的数据库存储格式时间串如:20041212
+ * @param formatType
+ * 时间格式的类型{@link #DB_STORE_DATE},{@link #EN_HTML_DISPLAY_DATE},{@link #CN_HTML_DISPLAY_DATE}
+ * @return 格式化的时间串
+ */
+ public static String toDisplayStr(String dateStr, int formatType) {
+ if (formatType < DB_STORE_DATE || formatType > CN_DISPLAY_DATE) {
+ throw new IllegalArgumentException("时间格式化类型不是合法的值。");
+ }
+ if (dateStr == null || dateStr.length() < 6 || dateStr.length() > 14 || formatType == DB_STORE_DATE) {
+ return StringUtils.toVisualString(dateStr);
+ } else {
+ char[] charArr = null;
+ switch (formatType) {
+ case HYPHEN_DISPLAY_DATE:
+ charArr = new char[] { '-', '-', ' ', ':', ':' };
+ break;
+ case DOT_DISPLAY_DATE:
+ charArr = new char[] { '.', '.', ' ', ':', ':' };
+ break;
+ case CN_DISPLAY_DATE:
+ charArr = new char[] { '年', '月', ' ', ':', ':' };
+ break;
+ default:
+ charArr = new char[] { '-', '-', ' ', ':', ':' };
+ }
+ try {
+ SimpleDateFormat sdf1 = null;
+ SimpleDateFormat sdf2 = null;
+ switch (dateStr.length()) {
+ case 6:
+ sdf1 = new SimpleDateFormat("yyyyMM");
+ sdf2 = new SimpleDateFormat("yyyy'" + charArr[0] + "'MM");
+ break;
+ case 8:
+ sdf1 = new SimpleDateFormat("yyyyMMdd");
+ sdf2 = new SimpleDateFormat("yyyy'" + charArr[0] + "'MM'" + charArr[1] + "'dd");
+ break;
+ case 10:
+ sdf1 = new SimpleDateFormat("yyyyMMddHH");
+ sdf2 = new SimpleDateFormat("yyyy'" + charArr[0] + "'MM'" + charArr[1] + "'dd'"
+ + "+charArr[2]" + "'HH");
+ break;
+ case 12:
+ sdf1 = new SimpleDateFormat("yyyyMMddHHmm");
+ sdf2 = new SimpleDateFormat("yyyy'" + charArr[0] + "'MM'" + charArr[1] + "'dd'" + charArr[2]
+ + "'HH'" + charArr[3] + "'mm");
+ break;
+ case 14:
+ sdf1 = new SimpleDateFormat("yyyyMMddHHmmss");
+ sdf2 = new SimpleDateFormat("yyyy'" + charArr[0] + "'MM'" + charArr[1] + "'dd'" + charArr[2]
+ + "'HH'" + charArr[3] + "'mm'" + charArr[4] + "'ss");
+ break;
+ default:
+ return dateStr;
+ }
+ return sdf2.format(sdf1.parse(dateStr));
+ } catch (ParseException ex) {
+ return dateStr;
+ }
+ }
+ }
+
+ /**
+ * 将显示格式的时间字符串转换为数据库存储的类型
+ *
+ * @param dateStr
+ * 最小4位,最大19位。显示的时间格式时间串如:2004-12-12
+ * @return 数据库存储的时间字符串
+ */
+ public static String toStoreStr(String dateStr) {
+ if (dateStr == null || dateStr.trim().equals("")) {
+ return "";
+ }
+ StringBuffer strBuf = new StringBuffer();
+ for (int i = 0; i < dateStr.length(); i++) {
+ if (dateStr.charAt(i) >= '0' && dateStr.charAt(i) <= '9') {
+ strBuf.append(dateStr.charAt(i));
+ }
+ }
+ return strBuf.toString();
+ }
+
+ /**
+ * 将生日存储的时间格式转化为年龄(周岁,小数点后不计)
+ *
+ * @param birthdayStr
+ * 生日字段 "yyyymmdd"
+ * @return 年龄
+ */
+ public static String birthdayToAge(String birthdayStr) {
+ if (birthdayStr == null || birthdayStr.length() < 6) {
+ return "";
+ } else {
+ int birthYear = Integer.parseInt(birthdayStr.substring(0, 4));
+ int birthMonth = Integer.parseInt(birthdayStr.substring(4, 6));
+ Calendar cal = new GregorianCalendar();
+ int currYear = cal.get(Calendar.YEAR);
+ int currMonth = cal.get(Calendar.MONTH);
+ int age = currYear - birthYear;
+ age -= (currMonth < birthMonth) ? 1 : 0;
+ return "" + age;
+ }
+ }
+
+ /**
+ *
+ * @param dateTimeStr
+ * String 格式化的时间串
+ * @param formatType
+ * 数据格式类型 {@link #DB_STORE_DATE},{@link #EN_HTML_DISPLAY_DATE},{@link #CN_HTML_DISPLAY_DATE}
+ * @param detal
+ * int 增加或减少的时间
+ * @param field
+ * int 参见Calendar中关于时间字段属性的定义
+ * @return String 返回的
+ */
+ public static String add(String dateTimeStr, int formatType, int detal, int field) {
+ if (dateTimeStr == null || dateTimeStr.length() < 6) {
+ return dateTimeStr;
+ } else {
+ try {
+ String formatStr = null;
+ switch (formatType) {
+ case DB_STORE_DATE:
+ formatStr = "yyyyMMddHHmmss";
+ break;
+ case HYPHEN_DISPLAY_DATE:
+ formatStr = "yyyy-MM-dd HH:mm:ss";
+ break;
+ case DOT_DISPLAY_DATE:
+ formatStr = "yyyy.MM.dd HH:mm:ss";
+ break;
+ case CN_DISPLAY_DATE:
+ formatStr = "yyyy'年'MM'月' HH:mm:ss";
+ break;
+ default:
+ formatStr = "yyyyMMddHHmmss";
+ break;
+ }
+
+ formatStr = formatStr.substring(0, dateTimeStr.length());
+ SimpleDateFormat sdf = new SimpleDateFormat(formatStr);
+ Date d = sdf.parse(dateTimeStr);
+ GregorianCalendar g = new GregorianCalendar();
+ g.setTime(d);
+ g.add(field, detal);
+ d = g.getTime();
+ return sdf.format(d);
+ } catch (ParseException ex) {
+
+ return dateTimeStr;
+ }
+ }
+ }
+
+ // /**
+ // * @param date Date 时间
+ // * @param detal int 增加的时间
+ // * @param field int 参见Calendar中关于时间字段属性的定义
+ // * @return Date
+ // */
+ // public static Date add(Date date, int detal, int field)
+ // {
+ // Calendar g = new GregorianCalendar();
+ // g.setTime(date);
+ // g.add(field, detal);
+ // return g.getTime();
+ // }
+ /**
+ * 日期、时间格式化
+ *
+ * @param date
+ * Date 将要被格式化的日期对象
+ * @param outFmt
+ * String 返回样式,参照类说明,如:yyyy年MM月dd日
+ * @return String 格式化后的日期、时间字符串,data为null时返回null,outFmt非法时返回yyyyMMdd格式
+ */
+ public static String getDateFormat(Date date, String outFmt) {
+ if (null == date) {
+ return null;
+ }
+ String newOutFmt = outFmt;
+
+ if (null == newOutFmt || "".equals(newOutFmt.trim())) { // outFmt非法
+ newOutFmt = "yyyyMMdd";
+ }
+
+ String retu = null;
+ SimpleDateFormat dateFormat = null;
+ try {
+ dateFormat = new SimpleDateFormat(newOutFmt);
+ } catch (IllegalArgumentException iaex) { // outFmt非法
+ dateFormat = new SimpleDateFormat("yyyyMMdd");
+ }
+ retu = dateFormat.format(date);
+
+ dateFormat = null;
+
+ return retu;
+ }
+
+ /**
+ * 把日期时间对象格式化为yyyyMMdd样式
+ *
+ * @param date
+ * Date 将要被格式化的日期对象
+ * @return String 格式化后的日期、时间字符串,如:20041001
+ */
+ public static String getDateFormat(Date date) {
+ return getDateFormat(date, "yyyyMMdd");
+ }
+
+ /**
+ * 把日期时间对象格式化为yyyyMMdd样式
+ *
+ * @param date
+ * Date 将要被格式化的日期对象
+ * @return String 格式化后的日期、时间字符串,如:20041001
+ */
+ public static String getDateFormatByFmt(Date date,String outFmt) {
+ return getDateFormat(date, outFmt);
+ }
+
+ /**
+ * 把系统当前日期时间格式化为指定的样式
+ *
+ * @param outFmt
+ * String 返回样式,参照类说明,如:yyyy年MM月dd日
+ * @return String 格式化后的日期、时间字符串,如:2004年10月01日
+ */
+ public static String getDateFormat(String outFmt) {
+ return getDateFormat(new Date(), outFmt);
+ }
+
+ /**
+ * 把系统当前日期时间格式化为默认样式yyyyMMdd
+ *
+ * @return String 格式化后的日期、时间字符串,如:20041001
+ */
+ public static String getDateFormat() {
+ return getDateFormat(new Date(), "yyyyMMdd");
+ }
+
+ /**
+ * 日期、时间格式化
+ *
+ * @param millis
+ * long the number of milliseconds(毫秒) since January 1, 1970,
+ * 00:00:00 GMT.
+ * @param outFmt
+ * String 返回样式,参照类说明,如:yyyy年MM月dd日
+ * @return String 格式化后的日期、时间字符串
+ */
+ public static String getDateFormat(long millis, String outFmt) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTimeInMillis(millis);
+
+ String retu = getDateFormat(calendar.getTime(), outFmt);
+ calendar = null;
+ return retu;
+ }
+
+ /**
+ * 日期、时间格式化
+ *
+ * @param datestr
+ * String 存在一定格式的日期、时间字符串,如:20041001、200410011503
+ * @param inFmt
+ * String 对datestr参数格式说明,参照类说明,如:yyyyMMdd、yyyyMMddHHmm
+ * @param outFmt
+ * String 返回样式,参照类说明,如:yyyy年MM月dd日
+ * @throws ParseException
+ * 当datestr不能格式化为inFmt格式时抛出此异常
+ * @return String 格式化后的日期、时间字符串,如:2004年10月01日、2004年10月01日
+ * 输出样式outFmt非法时,使用yyyyMMdd格式输出
+ */
+ public static String getDateFormat(String datestr, String inFmt, String outFmt) throws ParseException {
+ if (null == datestr || "".equals(datestr.trim())) {
+ return datestr;
+ }
+
+ if (null == inFmt || "".equals(inFmt.trim())) {
+ return datestr;
+ }
+
+ String newOutFmt = outFmt;
+ if (null == newOutFmt || "".equals(newOutFmt.trim())) { // 输出样式非法
+ newOutFmt = "yyyyMMdd";
+ }
+
+ Date inDate = getDate(datestr, inFmt);
+
+ if (null == inDate) { // 根据inFmt分析datestr时抛出异常
+ return datestr;
+ }
+
+ String retu = getDateFormat(inDate, newOutFmt);
+ inDate = null;
+ return retu;
+ }
+
+ /**
+ * 把日期时间字符串,按inFmt样式转化为日期对象,然后格式化为默认样式yyyyMMdd
+ *
+ * @param datestr
+ * String 存在一定格式的日期、时间字符串,如:20041001、200410011503
+ * @param inFmt
+ * String 对datestr参数格式说明,参照类说明,如:yyyyMMdd、yyyyMMddHHmm
+ * @throws ParseException
+ * 当datestr不能格式化为inFmt格式时抛出此异常
+ * @return String 格式化后的日期、时间字符串,如:20041001、20041001
+ */
+ public static String getDateFormat(String datestr, String inFmt) throws ParseException {
+ return getDateFormat(datestr, inFmt, "yyyyMMdd");
+ }
+
+ /**
+ * 根据inFmt的样式,日期时间字符串转化为日期时间对象
+ *
+ * @param datestr
+ * String 日期时间字符串,如:20041001、2004年10月01日 15:03
+ * @param inFmt
+ * String 对datestr参数格式说明,参照类说明,如yyyyMMdd、yyyy年MM月dd日 HH:mm
+ * @throws ParseException
+ * 当datestr不能格式化为inFmt格式时抛出此异常
+ * @return Date 日期时间对象,格式inFmt非法时,使用yyyyMMdd格式
+ */
+ public static Date getFillDate(String datestr, String inFmt,boolean end) throws ParseException {
+ if (null == datestr || "".equals(datestr.trim())) {
+ return null;
+ }
+
+ String newInFmt = inFmt;
+ if (null == newInFmt || "".equals(newInFmt.trim())) { // inFmt非法
+ newInFmt = "yyyyMMdd";
+ }
+ String[] endFlag = new String[]{"9","5"};
+ String endStr = "";
+ if(datestr.length()!=newInFmt.length()){
+ int len = newInFmt.length()-datestr.length();
+ if(end){
+ for(int i=len;i>0;i--){
+ endStr=endFlag[(i+1)%2]+endStr;
+ }
+ }else{
+ for(int i=len;i>0;i--){
+ endStr+="0";
+ }
+ }
+ }
+
+ datestr=datestr.trim()+endStr;
+ Date inDate = null;
+
+ // 依据inFmt格式把日期字符串转化为日期对象
+ SimpleDateFormat inDateFormat = new SimpleDateFormat(newInFmt);
+ inDateFormat.setLenient(true);
+ inDate = inDateFormat.parse(datestr);
+
+ inDateFormat = null;
+ return inDate;
+ }
+ /**
+ * 根据inFmt的样式,日期时间字符串转化为sql日期时间对象
+ *
+ * @param datestr
+ * String 日期时间字符串,如:20041001、2004年10月01日 15:03
+ * @param inFmt
+ * String 对datestr参数格式说明,参照类说明,如yyyyMMdd、yyyy年MM月dd日 HH:mm
+ * @throws ParseException
+ * 当datestr不能格式化为inFmt格式时抛出此异常
+ * @return Date 日期时间对象,格式inFmt非法时,使用yyyyMMdd格式
+ */
+ public static java.sql.Date getSqlDate(String datestr,String inFmt) throws ParseException{
+ Date utilDate = getDate(datestr, inFmt);
+ return new java.sql.Date(utilDate.getTime());
+ }
+
+ /**
+ * 根据inFmt的样式,日期时间字符串转化为日期时间对象
+ *
+ * @param datestr
+ * String 日期时间字符串,如:20041001、2004年10月01日 15:03
+ * @param inFmt
+ * String 对datestr参数格式说明,参照类说明,如yyyyMMdd、yyyy年MM月dd日 HH:mm
+ * @throws ParseException
+ * 当datestr不能格式化为inFmt格式时抛出此异常
+ * @return Date 日期时间对象,格式inFmt非法时,使用yyyyMMdd格式
+ */
+ public static Date getDate(String datestr, String inFmt) throws ParseException {
+ if (null == datestr || "".equals(datestr.trim())) {
+ return null;
+ }
+
+ String newInFmt = inFmt;
+ if (null == newInFmt || "".equals(newInFmt.trim())) { // inFmt非法
+ newInFmt = "yyyyMMdd";
+ }
+
+ Date inDate = null;
+
+ // 依据inFmt格式把日期字符串转化为日期对象
+ SimpleDateFormat inDateFormat = new SimpleDateFormat(newInFmt);
+ inDateFormat.setLenient(true);
+ inDate = inDateFormat.parse(datestr);
+
+ inDateFormat = null;
+ return inDate;
+ }
+
+ /**
+ *
+ * @param date1
+ * @param date2
+ * @return
+ * @author:李炜
+ */
+ public static int dateDiff(Date date1,Date date2){
+ if(date1.compareTo(date2) == 0){
+ return 0;
+ }
+ long second = Math.abs((date1.getTime() - date2.getTime())) / 1000;
+ return (int) (second / SECONDS_ONE_DAY);
+ }
+
+ /**
+ * 相差的时间(单位:秒)
+ * @param date1
+ * @param date2
+ * @return
+ */
+ public static long secondDiff(Date date1,Date date2){
+ if(date1.compareTo(date2) == 0){
+ return 0;
+ }
+ long second = Math.abs((date1.getTime() - date2.getTime())) / 1000;
+ return second;
+ }
+
+
+ public static int dateCompare(Date date1,Date date2){
+ if(date1 == null){
+ return -1;
+ }
+ if(date2 == null){
+ return -1;
+ }
+ if(date1.compareTo(date2) == 0){
+ return 0;
+ }
+ long second =(date1.getTime() - date2.getTime()) / 1000;
+ return (int) (second / SECONDS_ONE_DAY);
+ }
+
+
+
+ public static int dateSimpleCompare(String dateStr1,String dateStr2,String format){
+
+ Date date1 = null;
+ Date date2 = null;
+ try {
+ SimpleDateFormat dateFormat = new SimpleDateFormat(format);
+ date1 = dateFormat.parse(dateStr1);
+ date2 = dateFormat.parse(dateStr2);
+ if(date1.getTime()>date2.getTime()){
+ return 1;
+ }else if(date1.getTime()
+ * 例子:
+ *
+ *
+ * <blockquote>
+ * 计算去年今天星期几
+ * Date date = DateUtils.addDate(new Date(),Calendar.YEAR,-1);
+ * System.out.println(DateUtils.getDateFormat(date,"E"));
+ * 打印60天后是什么日期,并显示为 yyyy-MM-dd 星期
+ * Date date = DateUtils.addDate(new Date(),Calendar.DATE,60);
+ * System.out.println(DateUtils.getDateFormat(date,"yyyy-MM-dd E"));
+ * </blockquote>
+ *
+ *
+ * @param date
+ * Date 需要调整的日期时间对象
+ * @param calendarField
+ * int 对日期时间对象以什么单位进行调整:
+ *
+ *
+ * <blockquote>
+ * 年 Calendar.YEAR
+ * 月 Calendar.MONTH
+ * 日 Calendar.DATE
+ * 时 Calendar.HOUR
+ * 分 Calendar.MINUTE
+ * 秒 Calendar.SECOND
+ * </blockquote>
+ *
+ *
+ * @param amount
+ * int 调整数量,>0表向后调整(明天,明年),<0表向前调整(昨天,去年)
+ * @return Date 调整后的日期时间对象
+ */
+ public static Date addDate(Date date, int calendarField, int amount) {
+ if (null == date) {
+ return date;
+ }
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(date);
+ calendar.add(calendarField, amount);
+ return calendar.getTime();
+ }
+
+ /**
+ * 对日期时间对象进行调整.
+ *
+ * @param datestr
+ * String 需要调整的日期时间字符串,它的格式为yyyyMMdd
+ * @param calendarField
+ * int 对日期时间对象以什么单位进行调整
+ * @param amount
+ * int 调整数量
+ * @throws ParseException
+ * 当datestr不能格式化为yyyyMMdd格式时抛出此异常
+ * @return Date 调整后的日期时间对象
+ * @see #addDate(Date, int, int)
+ */
+ public static Date addDate(String datestr, int calendarField, int amount) throws ParseException {
+ return addDate(getDate(datestr, "yyyyMMdd"), calendarField, amount);
+ }
+
+ /**
+ * 根据出生日期,计算出在某一个日期的年龄
+ *
+ * @param birthday
+ * Date 出生日期时间对象
+ * @param date2
+ * Date 计算日期对象
+ * @return int 返回date2那一天出生日期为birthday的年龄,如果birthday大于date2则返回-1
+ */
+ public static int getAge(Date birthday, Date date2) {
+ if (null == birthday || null == date2) {
+ return -1;
+ }
+
+ if (birthday.after(date2)) { // birthday大于date2
+ return -1;
+ }
+
+ int ibdYear = StringUtils.getInt(getDateFormat(birthday, "yyyy"), -1);
+ int idate2Year = StringUtils.getInt(getDateFormat(date2, "yyyy"), -1);
+
+ if (ibdYear < 0 || idate2Year < 0) {
+ return -1;
+ }
+ if (ibdYear > idate2Year) {
+ return -1;
+ }
+
+ return idate2Year - ibdYear + 1;
+ }
+
+ /**
+ * 根据出生日期,计算出当前的年龄
+ *
+ * @param birthday
+ * Date 出生日期时间对象
+ * @return int 返回出生日期为birthday的年龄,如果birthday大于当前系统日期则返回-1
+ */
+ public static int getAge(Date birthday) {
+ return getAge(birthday, new Date());
+ }
+
+ /**
+ * 根据出生日期,计算出当前的年龄
+ *
+ * @param birthdaystr
+ * String 出生日期时间字符串,其格式一定为yyyyMMdd
+ * @throws ParseException
+ * 当datestr不能格式化为yyyyMMdd格式时抛出此异常
+ * @return int 返回出生日期为birthday的年龄,如果birthday大于当前系统日期则返回-1
+ */
+ public static int getAge(String birthdaystr) throws ParseException {
+ return getAge(getDate(birthdaystr, "yyyyMMdd"));
+ }
+
+ public static String dbCurrtime(){
+ return getCurrTime(DB_STORE_DATE);
+ }
+
+ /**
+ * 得到14位的当前格式化时间
+ *
+ * @param formatType
+ * 时间格式的类型{@link #DB_STORE_DATE},{@link
+ * @return java.lang.String
+ */
+ public static String getCurrTime(int formatType) {
+ if (formatType < DB_STORE_DATE || formatType > CN_DISPLAY_DATE) {
+ throw new IllegalArgumentException("时间格式化类型不是合法的值。");
+ } else {
+ String formatStr = null;
+ switch (formatType) {
+ case DB_STORE_DATE:
+ formatStr = "yyyyMMddHHmmss";
+ break;
+ case HYPHEN_DISPLAY_DATE:
+ formatStr = "yyyy-MM-dd HH:mm:ss";
+ break;
+ case DOT_DISPLAY_DATE:
+ formatStr = "yyyy.MM.dd HH:mm:ss";
+ break;
+ case CN_DISPLAY_DATE:
+ formatStr = "yyyy年MM月dd HH:mm:ss";
+ break;
+ default:
+ formatStr = "yyyyMMddHHmmss";
+ break;
+ }
+ SimpleDateFormat sdf = new SimpleDateFormat(formatStr);
+ return sdf.format(new Date());
+ }
+ }
+
+ /**
+ * 得到8位的当前格式化日期
+ *
+ * @param formatType
+ * 时间格式的类型{@link #DB_STORE_DATE},{@link
+ * @return java.lang.String
+ */
+ public static String getCurrDate(int formatType) {
+ if (formatType < DB_STORE_DATE || formatType > CN_DISPLAY_DATE) {
+ throw new IllegalArgumentException("时间格式化类型不是合法的值。");
+ } else {
+ String formatStr = null;
+ switch (formatType) {
+ case DB_STORE_DATE:
+ formatStr = "yyyyMMdd";
+ break;
+ case HYPHEN_DISPLAY_DATE:
+ formatStr = "yyyy-MM-dd";
+ break;
+ case DOT_DISPLAY_DATE:
+ formatStr = "yyyy.MM.dd";
+ break;
+ case CN_DISPLAY_DATE:
+ formatStr = "yyyy'年'MM'月'dd";
+ break;
+ default:
+ formatStr = "yyyyMMdd";
+ break;
+ }
+ SimpleDateFormat sdf = new SimpleDateFormat(formatStr);
+ return sdf.format(new Date());
+ }
+ }
+
+ /**
+ * 得到6位的当前格式化年月
+ *
+ * @param formatType
+ * 时间格式的类型{@link #DB_STORE_DATE},{@link
+ * @return java.lang.String
+ */
+ public static String getYearMonth(int formatType) {
+ if (formatType < DB_STORE_DATE || formatType > CN_DISPLAY_DATE) {
+ throw new IllegalArgumentException("时间格式化类型不是合法的值。");
+ } else {
+ String formatStr = null;
+ switch (formatType) {
+ case DB_STORE_DATE:
+ formatStr = "yyyyMM";
+ break;
+ case HYPHEN_DISPLAY_DATE:
+ formatStr = "yyyy-MM";
+ break;
+ case DOT_DISPLAY_DATE:
+ formatStr = "yyyy.MM";
+ break;
+ case CN_DISPLAY_DATE:
+ formatStr = "yyyy'年'MM'月'";
+ break;
+ default:
+ formatStr = "yyyyMM";
+ break;
+ }
+ SimpleDateFormat sdf = new SimpleDateFormat(formatStr);
+ return sdf.format(new Date());
+ }
+ }
+
+ /**
+ * 获取时间所对应的毫秒
+ *
+ * @param datetime
+ * String 时间字符串
+ * @param inFmt
+ * String 时间格式化串
+ * @return long 毫秒数
+ * @throws ParseException
+ * ParseException
+ */
+ public static long getTimeValue(String datetime, String inFmt) throws ParseException {
+ return getDate(datetime, inFmt).getTime();
+ }
+
+ /**
+ * 两个秒数只差
+ * @param startTime
+ * @param endTime
+ * @param inFmt
+ * @return
+ */
+ public static long consumeSecondsValue(String startTime,String endTime,String inFmt) throws ParseException{
+ long startSeconds = getTimeValue(startTime,inFmt);
+ long endSeconds = getTimeValue(endTime,inFmt);
+ return (endSeconds - startSeconds)/1000;
+ }
+
+ /**
+ * 获取时间字符串
+ *
+ * @param milliSeconds
+ * long 从1970年到现在的毫
+ * @param formatType
+ * int 时间类型
+ * @return String 时间字符串
+ */
+ public static String getTimeStr(long milliSeconds, int formatType) {
+ Date d = new Date(milliSeconds);
+ return getTimeStr(d, formatType);
+ }
+
+
+
+ /**
+ * getTimeByValue
+ *
+ * @param time
+ * 时间
+ * @param timeOldFormat
+ * 旧时间格式
+ * @param timeNewFormat
+ * 新时间格式
+ * @return String
+ * @author:Administrator
+ */
+ public static String getTimeByValue(String time, String timeOldFormat, String timeNewFormat) {
+ SimpleDateFormat oldSdf = new SimpleDateFormat(timeOldFormat);
+ SimpleDateFormat newSdf = new SimpleDateFormat(timeNewFormat);
+ String newTime = time;
+ try {
+ if (Validator.hasText(time)) {
+ // Date times = oldSdf.parse(time);
+ newTime = newSdf.format(oldSdf.parse(time));
+ }
+ } catch (ParseException e1) {
+
+ }
+ return newTime;
+ }
+
+
+ /**
+ * 返回上月的起始日期和结束日期,格式YYYYMMDD
+ * @param time
+ * @return
+ * @author:lwei
+ */
+ public static String[] getLastMonthBetweenDay(Date time){
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(time);
+ int year = 0;
+ int month = cal.get(Calendar.MONTH)-1; // 上个月月份
+ if (month == 0) {
+ year = cal.get(Calendar.YEAR) - 1;
+ month = 12;
+ } else {
+ year = cal.get(Calendar.YEAR);
+ }
+ Calendar c = Calendar.getInstance();
+ c.set(year, month, 1);
+ int startDay = c.getActualMinimum(Calendar.DAY_OF_MONTH);//起始天数
+ int endDay = c.getActualMaximum(Calendar.DAY_OF_MONTH); // 结束天数
+ c.set(year, month,startDay);
+ String startTime = getDateFormat(c.getTime());
+ c.clear();
+ c.set(year, month,endDay);
+ String endTime = getDateFormat(c.getTime());
+ return new String[]{startTime,endTime};
+ }
+
+ /**
+ * 返回上月的起始日期和结束日期,格式YYYYMMDD
+ * @param time
+ * @return
+ * @author:huanglm
+ */
+ public static String[] getLastMonthBetweenDayByFmt(Date time,String fmt){
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(time);
+ int year = 0;
+ int month = cal.get(Calendar.MONTH)-1; // 上个月月份
+ if (month == 0) {
+ year = cal.get(Calendar.YEAR) - 1;
+ month = 12;
+ } else {
+ year = cal.get(Calendar.YEAR);
+ }
+ Calendar c = Calendar.getInstance();
+ c.set(year, month, 1);
+ int startDay = c.getActualMinimum(Calendar.DAY_OF_MONTH);//起始天数
+ int endDay = c.getActualMaximum(Calendar.DAY_OF_MONTH); // 结束天数
+ c.set(year, month,startDay);
+ String startTime = getDateFormatByFmt(c.getTime(),fmt);
+ c.clear();
+ c.set(year, month,endDay);
+ String endTime = getDateFormatByFmt(c.getTime(),fmt);
+ return new String[]{startTime,endTime};
+ }
+
+
+
+ /**
+ * 获取两时间字符串的时间间隔描述
+ * 例如:2010-10-10 10:10:10与2010-10-20 20:20:20
+ * 的时间间隔描述串为:10天10时10分10秒
+ * 如果开始时间大于结束时间返回负数,如:-10时10分10秒
+ *
+ * @param beginTime 开始时间字符串
+ * @param endTime 结束时间字符串
+ * @param inFmt String 时间格式化串
+ * @return 两时间字符串的时间差 如:12天03时25分08秒
+ */
+ public static String getTimeBetweenStr(String beginTime,String endTime,String inFmt){
+ SimpleDateFormat dfs = new SimpleDateFormat(inFmt);
+ StringBuffer timeStrBuf = new StringBuffer();
+ try {
+ Date begin = dfs.parse(beginTime);
+ Date end = dfs.parse(endTime);
+ if (begin.compareTo(end) == 0 ) {
+ return "1秒"; //如果开始时间等于结束时间 直接返回1秒
+ }
+ long between = (end.getTime() - begin.getTime()) / 1000; //除以1000是为了转换成秒
+ if (between < 0 ) {
+ timeStrBuf.append("-");
+ between = -between;
+ }
+ long day = between / (24*60*60);
+ long hour = between % (24*60*60) / 3600;
+ long minute = between % (60*60) / 60;
+ long second = between % 60;
+ if (day != 0) {
+ timeStrBuf.append(String.valueOf(day)+"天" );
+ }
+ if (hour != 0) {
+ timeStrBuf.append(String.valueOf(hour)+"时" );
+ }
+
+ if(minute != 0 ) {
+ timeStrBuf.append(String.valueOf(minute)+"分" );
+ }
+ if (second != 0 ) {
+ timeStrBuf.append(String.valueOf(second)+"秒" );
+ }
+ } catch (Exception e) {
+ return null;
+ }
+ return timeStrBuf.toString();
+ }
+
+ /**
+ * 给时间加上或减去指定毫秒,秒,分,时,天、月或年等,返回变动后的时间
+ *
+ * @param date 要加减前的时间,如果不传,则为当前日期
+ * @param field 时间域,有Calendar.MILLISECOND,Calendar.SECOND,Calendar.MINUTE,
+ * * Calendar.HOUR,Calendar.DATE, Calendar.MONTH,Calendar.YEAR
+ * @param amount 按指定时间域加减的时间数量,正数为加,负数为减。
+ * @author huanglm
+ * @return 变动后的时间
+ */
+ public static Date add(Date date, int field, int amount) {
+ if (date == null) {
+ date = new Date();
+ }
+
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+ cal.add(field, amount);
+
+ return cal.getTime();
+ }
+
+ /**
+ *
+ * @param date
+ * @param amount
+ * @author huanglm
+ * @return
+ */
+ public static Date addMilliSecond(Date date, int amount) {
+ return add(date, Calendar.MILLISECOND, amount);
+ }
+
+ /**
+ *
+ *
+ * @param date
+ * @param amount
+ * @author huanglm
+ * @return
+ */
+ public static Date addSecond(Date date, int amount) {
+ return add(date, Calendar.SECOND, amount);
+ }
+
+ /**
+ *
+ * @param date
+ * @param amount
+ * @author huanglm
+ * @return
+ */
+ public static Date addMiunte(Date date, int amount) {
+ return add(date, Calendar.MINUTE, amount);
+ }
+
+ /**
+ *
+ * @param date
+ * @param amount
+ * @author huanglm
+ * @return
+ */
+ public static Date addHour(Date date, int amount) {
+ return add(date, Calendar.HOUR, amount);
+ }
+
+ /**
+ *
+ * @param date
+ * @param amount
+ * @author huanglm
+ * @return
+ */
+ public static Date addDay(Date date, int amount) {
+ return add(date, Calendar.DATE, amount);
+ }
+
+ /**
+ *
+ * @param date
+ * @param amount
+ * @author huanglm
+ * @return
+ */
+ public static Date addMonth(Date date, int amount) {
+ return add(date, Calendar.MONTH, amount);
+ }
+
+ /**
+ *
+ * @param date
+ * @param amount
+ * @author huanglm
+ * @return
+ */
+ public static Date addYear(Date date, int amount) {
+ return add(date, Calendar.YEAR, amount);
+ }
+ public static final SimpleDateFormat YYYYMMDDHHMMSS_DATE_FORMAT = new SimpleDateFormat("yyyyMMddHHmmss");
+ public static Date ORIGINAL_DATE = null;
+ static {
+ try {
+ ORIGINAL_DATE = YYYYMMDDHHMMSS_DATE_FORMAT.parse("19700101080000");
+ } catch (ParseException e) {
+
+ }
+ }
+ /**
+ * 从19700101080000开始增加指定的秒数
+ * @param amount
+ * @return
+ */
+ public static Date addSecond(int amount) {
+ return addSecond(ORIGINAL_DATE, amount);
+ }
+ /**
+ * 从19700101080000开始增加指定的秒数
+ * @param amount
+ * @return
+ */
+ public static String addSecondToString(int amount) {
+ return YYYYMMDDHHMMSS_DATE_FORMAT.format(addSecond(ORIGINAL_DATE, amount));
+ }
+ /**
+ * 测试
+ *
+ * @param args
+ * args
+ * @throws ParseException
+ * ParseException
+ * @author:Administrator
+ */
+ public static void main(String[] args) throws ParseException {
+ Date date=new Date();
+ System.out.println(addMonth(DateUtils.getDate("2024-01-29","yyyy-mm-dd"),1));
+ date.setTime(1491040070000l);
+ System.out.println(getTimeStr(date,2));
+ }
+
+}
diff --git a/luqj-common/src/main/java/com/luqj/util/log/LogUtil.java b/luqj-common/src/main/java/com/luqj/util/log/LogUtil.java
new file mode 100644
index 0000000..6e25eeb
--- /dev/null
+++ b/luqj-common/src/main/java/com/luqj/util/log/LogUtil.java
@@ -0,0 +1,174 @@
+package com.luqj.util.log;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+public abstract class LogUtil {
+
+ private static String getStackTrace(Throwable t) {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ try {
+ t.printStackTrace(pw);
+ return sw.toString();
+ } finally {
+ pw.close();
+ }
+ }
+
+ public static String exceptionMsg(String msg, Throwable e) {
+ return msg + ",异常消息[" + getStackTrace(e) + "]";
+ }
+
+ public static String exceptionSimpleMsg(String msg, Throwable e) {
+ return msg + ",异常消息[" + e.getLocalizedMessage() + "]";
+ }
+
+ /**
+ * 获取计算程序运行的时钟
+ *
+ * @return clock
+ */
+ public static Clock getClock() {
+ return new Clock() {
+ /**开始时间*/
+ private long startTime = System.nanoTime();
+
+ /**
+ * 消耗时间[毫秒]
+ * @return 消耗时间
+ */
+ public long consume() {
+ return LogUtil.consume(startTime, System.nanoTime());
+ }
+
+ /**
+ * 结束时间
+ */
+ public long getEnd() {
+ return System.nanoTime();
+ }
+
+ /**
+ * 开始时间
+ */
+ public long getStart() {
+ return startTime;
+ }
+
+ public long consumeSecond() {
+ return LogUtil.consumeSecond(startTime, System.nanoTime());
+ }
+ };
+ }
+
+
+ /**
+ * 消耗时间[纳秒]
+ *
+ * @return 消耗时间 秒
+ */
+ public static long consumeNano(long startTime, long endTime) {
+ return (endTime - startTime) / 1000000000 + 1;
+ }
+
+ /**
+ * 消耗时间[微秒]
+ *
+ * @return 消耗时间 秒
+ */
+ public static long consume(long startTime, long endTime) {
+ return (endTime - startTime) / 1000000 + 1;
+ }
+
+ /**
+ * 消耗时间[耗秒]
+ *
+ * @return 消耗时间 秒
+ */
+ public static long consumeSecond(long startTime, long endTime) {
+ return (endTime - startTime) / 1000 + 1;
+ }
+
+ /**
+ * getRootCause
+ * 获取异常的原始异常,用于反馈异常的真实原因。
+ *
+ * @param ex 异常信息
+ * @return 原始异常,最底层异常
+ * @author 林小松
+ */
+ public static Throwable getRootCause(Throwable ex) {
+ Throwable cause = ex;
+ while (cause.getCause() != null) {
+ cause = cause.getCause();
+ }
+ return cause;
+ }
+
+ /**
+ * 递归寻找根异常异常信息
+ *
+ * @param ex 异常
+ * @return 异常信息
+ */
+ public static String traceRootExceptionInfo(Throwable ex) {
+ Throwable cause = ex;
+ while (cause.getCause() != null) {
+ cause = cause.getCause();
+ }
+ return cause.toString();
+ }
+
+ /**
+ * 递归寻找引起异常的所有异常信息
+ *
+ * @param ex 异常
+ * @return 异常信息
+ */
+ public static String tarceExceptionInfo(Throwable ex) {
+ StringBuffer sb = new StringBuffer();
+ Throwable cause = ex;
+ sb.insert(0, cause);
+ while (cause.getCause() != null) {
+ cause = cause.getCause();
+ sb.insert(0, cause.toString());
+ }
+ return sb.toString();
+ }
+
+ public static interface Clock {
+
+
+ /**
+ * 返回程序消耗的毫秒数
+ *
+ * @return 消耗毫秒数
+ */
+ long consume();
+
+ /**
+ * 返回程序消耗的秒数
+ *
+ * @return 消耗秒数
+ */
+ long consumeSecond();
+
+ /**
+ * 返回开始时间
+ *
+ * @return 开始时间
+ * @author:lwei
+ */
+ long getStart();
+
+ /**
+ * 返回结束时间
+ *
+ * @return 结束时间
+ * @author:lwei
+ */
+ long getEnd();
+ }
+
+}
diff --git a/luqj-common/src/main/java/com/luqj/util/parse/SymbolSet.java b/luqj-common/src/main/java/com/luqj/util/parse/SymbolSet.java
new file mode 100644
index 0000000..7a53441
--- /dev/null
+++ b/luqj-common/src/main/java/com/luqj/util/parse/SymbolSet.java
@@ -0,0 +1,65 @@
+package com.luqj.util.parse;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 符号集
+ * @author chenzm
+ */
+public class SymbolSet {
+ /**等号*/
+ public final static String SYMBOL_EQ = "=";
+
+ /**空字符*/
+ public final static Character SYMBOL_NULL = ' ';
+
+ /**逗号*/
+ public final static String SYMBOL_COMMA = ",";
+
+ /**双引号*/
+ public final static String SYMBOL_DQM = "\"";
+
+ /**单引号*/
+ public final static String SYMBOL_SQM = "\'";
+
+ public static String chr2Str(char chr) {
+ return "" + chr;
+ }
+
+ static boolean isInSymbol(Map> symBolPos, int charPos, String ...symbols){
+ for(String symbol : symbols) {
+ if(!symBolPos.containsKey(symbol)) {
+ return false;
+ }
+ List posInfo = symBolPos.get(symbol);
+ for(int i = 0; i < posInfo.size(); ) {
+ if(charPos > posInfo.get(i) && charPos < posInfo.get(i + 1)) {
+ return true;
+ }
+ i+=2;
+ }
+ }
+ return false;
+ }
+
+ static Map> getSymBolPos(String exp) {
+ Map> map = new HashMap>();
+ String[] symbols = new String[]{
+ SYMBOL_SQM, SYMBOL_DQM
+ };
+ for(String symbol : symbols) {
+ map.put(symbol, new ArrayList(exp.length()));
+ int charPos = 0;
+ for(char c : exp.toCharArray()) {
+ if(c == symbol.charAt(0)) {
+ map.get(symbol).add(charPos);
+ }
+ charPos++;
+ }
+ }
+ return map;
+ }
+}
diff --git a/luqj-common/src/main/java/com/luqj/util/reflect/ClassUtils.java b/luqj-common/src/main/java/com/luqj/util/reflect/ClassUtils.java
new file mode 100644
index 0000000..7a809c5
--- /dev/null
+++ b/luqj-common/src/main/java/com/luqj/util/reflect/ClassUtils.java
@@ -0,0 +1,762 @@
+package com.luqj.util.reflect;
+
+import com.luqj.util.NumFormat;
+import com.luqj.util.assertion.Assert;
+import javassist.*;
+import javassist.bytecode.CodeAttribute;
+import javassist.bytecode.LocalVariableAttribute;
+import javassist.bytecode.MethodInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.*;
+import java.net.URL;
+import java.net.URLDecoder;
+import java.util.*;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+public class ClassUtils {
+ private static Logger LOGGER = LoggerFactory.getLogger(ClassUtils.class);
+
+ private static ClassPool pool = ClassPool.getDefault();
+
+ static {
+
+ }
+
+
+ public static Annotation[] getAnnotation(Class type, Class annotation) {
+
+ List list = new ArrayList();
+ Class> clazz = type;
+ for (; clazz != Object.class; clazz = clazz.getSuperclass()) {
+ try {
+ if (clazz.getAnnotation(annotation) != null) {
+ list.add(clazz.getAnnotation(annotation));
+ }
+ } catch (Exception e) {
+ // 这里甚么都不要做!并且这里的异常必须这样写,不能抛出去。
+ // 如果这里的异常打印或者往外抛,则就不会执行clazz =
+ // clazz.getSuperclass(),最后就不会进入到父类中了
+
+ }
+ }
+ return list.toArray(new Annotation[]{});
+ }
+
+ /**
+ * 通过反射,获得定义Class时声明的父类的范型参数的类型.
+ * 如public BookManager extends GenricManager
+ *
+ * @param clazz clazz The class to introspect
+ * @param index the Index of the generic ddeclaration,start from 0.
+ */
+ @SuppressWarnings("rawtypes")
+ public static Class getSuperClassGenericity(Class clazz, int index) throws IndexOutOfBoundsException {
+ Type genType = clazz.getGenericSuperclass();
+ if (!(genType instanceof ParameterizedType)) {
+ return Object.class;
+ }
+ Type[] params = ((ParameterizedType) genType).getActualTypeArguments();
+ if (index >= params.length || index < 0) {
+ return Object.class;
+ }
+ if (!(params[index] instanceof Class)) {
+ return Object.class;
+ }
+ return (Class) params[index];
+ }
+
+ public static String getDefBeanName(Class> classType) {
+ String name = classType.getSimpleName();
+ String firstChat = name.substring(0, 1).toLowerCase();
+ return firstChat + name.subSequence(1, name.length());
+ }
+
+ public static T instanceByConstructor(Class tClass,Object... constructorParams) throws Throwable{
+ Class[] constructorTypes = new Class[constructorParams.length];
+ for (int i = 0; i < constructorParams.length; i++) {
+ constructorTypes[i] = constructorParams[i].getClass();
+ }
+ Constructor cla = tClass.getDeclaredConstructor(constructorTypes);
+ return (T) cla.newInstance(constructorParams);
+ }
+
+ public static String classPackageAsResourcePath(Class> clazz) {
+ if (clazz == null) {
+ return "";
+ }
+ String className = clazz.getName();
+ int packageEndIndex = className.lastIndexOf('.');
+ if (packageEndIndex == -1) {
+ return "";
+ }
+ String packageName = className.substring(0, packageEndIndex);
+ return packageName.replace('.', '/');
+ }
+
+
+ public static ClassLoader getDefaultClassLoader() {
+ ClassLoader cl = null;
+ try {
+ cl = Thread.currentThread().getContextClassLoader();
+ } catch (Throwable ex) {
+ // Cannot access thread context ClassLoader - falling back to system class loader...
+ }
+ if (cl == null) {
+ // No thread context class loader -> use class loader of this class.
+ cl = ClassUtils.class.getClassLoader();
+ }
+ return cl;
+ }
+
+ public static Map getMethodParams(Class> clas, Method m) throws NotFoundException {
+ Map params = new LinkedHashMap();
+ pool.insertClassPath(new ClassClassPath(clas));
+ CtClass ctClass = pool.get(clas.getName());
+ CtMethod cm = ctClass.getDeclaredMethod(m.getName());
+ MethodInfo methodInfo = cm.getMethodInfo();
+ Class>[] parameterTypes = m.getParameterTypes();
+ Type[] parameterGTypes = m.getGenericParameterTypes();
+ CodeAttribute codeAttribute = methodInfo.getCodeAttribute();
+ LocalVariableAttribute attr = (LocalVariableAttribute) codeAttribute
+ .getAttribute(LocalVariableAttribute.tag);
+ if (attr == null) {
+ throw new NotFoundException(codeAttribute.toString());
+ }
+ String[] paramNames = new String[cm.getParameterTypes().length];
+ int pos = Modifier.isStatic(cm.getModifiers()) ? 0 : 1;
+ for (int j = 0; j < paramNames.length; j++) {
+ MethodParam mp = new MethodParam(j, attr.variableName(j + pos), parameterTypes[j]);
+ mp.setT(getTypeGenericity(parameterGTypes[j]));
+ params.put(mp.getName(), mp);
+ }
+ LOGGER.trace("方法[" + m.getName() + "]参数为" + params);
+ return params;
+ }
+
+ /**
+ * 获取类型属性的泛型类型
+ *
+ * @return
+ */
+ public static Class>[] getTypeGenericity(Type fc) {
+ if (fc == null) {
+ return new Class>[]{};
+ }
+ // 【3】如果是泛型参数的类型
+ if (fc instanceof ParameterizedType) {
+ ParameterizedType pt = (ParameterizedType) fc;
+ Type[] ts = pt.getActualTypeArguments();
+ List> t = new ArrayList>();
+ for (int i = 0; i < ts.length; i++) {
+ if (ts[i] instanceof WildcardType) {
+ //泛型可能是 >
+ } else {
+ t.add((Class>) ts[i]);
+ }
+
+ }
+ return t.toArray(new Class>[]{});
+ } else {
+ return new Class>[]{};
+ }
+ }
+
+
+ public static boolean isListType(Field field) {
+ return isListType(field.getType());
+ }
+
+ public static boolean isListType(Class> objType) {
+ Class>[] interfaces = objType.getInterfaces();
+ for (Class> i : interfaces) {
+ if (i.equals(List.class)) {
+ return true;
+ }
+ }
+ return objType.isAssignableFrom(List.class);
+ }
+
+ public static boolean isMapType(Field field) {
+ Class> fieldClazz = field.getType();
+ return isMapType(fieldClazz);
+ }
+
+ public static boolean isMapType(Class> objType) {
+ return isType(objType, Map.class);
+ }
+
+ public static boolean isSetType(Field field) {
+ Class> fieldClazz = field.getType();
+ return isSetType(fieldClazz);
+ }
+
+ public static boolean isSetType(Class> objType) {
+ return isType(objType, Set.class);
+ }
+
+ /**
+ * @return
+ */
+ public static boolean isType(Class> parentType, Class> child) {
+ return parentType.isAssignableFrom(child);
+ }
+
+ /**
+ * 获取List类型属性的泛型类型
+ *
+ * @param field
+ * @return
+ */
+ public static Type getSetFieldGenericity(Field field) {
+ Class> fieldClazz = field.getType();
+ Assert.logic(isSetType(fieldClazz), "属性类型必须为Set类型");
+ Type fc = field.getGenericType(); // 关键的地方,如果是List类型,得到其Generic的类型
+ if (fc == null) {
+ return null;
+ }
+ // 【3】如果是泛型参数的类型
+ if (fc instanceof ParameterizedType) {
+ ParameterizedType pt = (ParameterizedType) fc;
+ return pt.getActualTypeArguments()[0]; // 【4】
+ } else {
+ return null;
+ }
+ }
+
+
+ /**
+ * 获取List类型属性的泛型类型
+ *
+ * @param field
+ * @return
+ */
+ public static Type[] getMapFieldGenericity(Field field) {
+ Class> fieldClazz = field.getType();
+ Assert.logic(isMapType(fieldClazz), "属性类型必须为Map类型");
+ Type fc = field.getGenericType(); // 关键的地方,如果是List类型,得到其Generic的类型
+ if (fc == null) {
+ return null;
+ }
+ // 【3】如果是泛型参数的类型
+ if (fc instanceof ParameterizedType) {
+ ParameterizedType pt = (ParameterizedType) fc;
+ return pt.getActualTypeArguments(); // 【4】
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * 获取List类型属性的泛型类型
+ *
+ * @param field
+ * @return
+ */
+ public static Class> getListGenericity(Field field) {
+ Class> fieldClazz = field.getType();
+ Assert.logic(isListType(fieldClazz), "属性类型必须为List类型");
+ Type fc = field.getGenericType(); // 关键的地方,如果是List类型,得到其Generic的类型
+ if (fc == null) {
+ return null;
+ }
+ // 【3】如果是泛型参数的类型
+ if (fc instanceof ParameterizedType) {
+ ParameterizedType pt = (ParameterizedType) fc;
+ return (Class>) pt.getActualTypeArguments()[0]; // 【4】
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * 获取List类型属性的泛型类型
+ *
+ * @param field
+ * @return
+ */
+ public static Class> getListFieldGenericity(Field field) {
+ Class> fieldClazz = field.getType();
+ Assert.logic(fieldClazz.isAssignableFrom(List.class), "属性类型必须为List类型");
+ Type fc = field.getGenericType(); // 关键的地方,如果是List类型,得到其Generic的类型
+ if (fc == null) {
+ return null;
+ }
+ // 【3】如果是泛型参数的类型
+ if (fc instanceof ParameterizedType) {
+ ParameterizedType pt = (ParameterizedType) fc;
+ return (Class>) pt.getActualTypeArguments()[0]; // 【4】
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * 判断属性名是否存在避免调用 getField(String name) 抛异常
+ *
+ * @param type
+ * @return
+ */
+ public static boolean existField(Class> type, Class> fieldType) {
+ if (fieldType == null) {
+ return false;
+ }
+ Field[] fs = getDeclaredFields(type);
+ for (Field field : fs) {
+ if (field.getType().equals(fieldType)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ public static Method getDeclaredMethod(Object object, String methodName, Class>... parameterTypes) {
+ Method method = null;
+ for (Class> clazz = object.getClass(); clazz != Object.class; clazz = clazz.getSuperclass()) {
+ try {
+ clazz.getMethods();
+ method = clazz.getMethod(methodName, parameterTypes);
+ return method;
+ } catch (Exception e) {
+ //这里甚么都不要做!并且这里的异常必须这样写,不能抛出去。
+ //如果这里的异常打印或者往外抛,则就不会执行clazz = clazz.getSuperclass(),最后就不会进入到父类中了
+
+ }
+ }
+ return null;
+ }
+
+ public static Method[] getDeclaredMethods(Object object) {
+ List list = new ArrayList();
+ for (Class> clazz = object.getClass(); clazz != Object.class; clazz = clazz.getSuperclass()) {
+ try {
+ for (Method method : clazz.getDeclaredMethods()) {
+ if (!Modifier.isStatic(method.getModifiers())) {
+ list.add(method);
+ }
+ }
+ } catch (Exception e) {
+ //这里甚么都不要做!并且这里的异常必须这样写,不能抛出去。
+ //如果这里的异常打印或者往外抛,则就不会执行clazz = clazz.getSuperclass(),最后就不会进入到父类中了
+
+ }
+ }
+ return list.toArray(new Method[]{});
+ }
+
+ /**
+ * 递归获取所有的接口
+ *
+ * @param clazz
+ * @return
+ */
+ public static Class>[] getInterfaces(Class> clazz) {
+ List> list = new LinkedList>();
+ Class>[] interfaces = clazz.getInterfaces();
+ for (int i = 0; i < interfaces.length; i++) {
+ Class ifs = interfaces[i];
+ list.add(ifs);
+ list.addAll(Arrays.asList(getInterfaces(ifs)));
+ }
+ return list.toArray(new Class[list.size()]);
+ }
+
+
+ /**
+ * 直接调用对象方法, 而忽略修饰符(private, protected, default)
+ *
+ * @param object : 子类对象
+ * @param methodName : 父类中的方法名
+ * @param parameterTypes : 父类中的方法参数类型
+ * @param parameters : 父类中的方法参数
+ * @return 父类中方法的执行结果
+ */
+
+ public static Object invokeMethod(Object object, String methodName, Class>[] parameterTypes,
+ Object[] parameters) {
+ //根据 对象、方法名和对应的方法参数 通过反射 调用上面的方法获取 Method 对象
+ Method method = getDeclaredMethod(object, methodName, parameterTypes);
+ Assert.notNull(method, "方法[" + methodName + "]不允许为空");
+ //抑制Java对方法进行检查,主要是针对私有方法而言
+ method.setAccessible(true);
+ try {
+ if (null != method) {
+ // 调用object 的 method 所代表的方法,其方法的参数是 parameters
+ return method.invoke(object, parameters);
+ }
+ } catch (Exception e) {
+
+ throw new IllegalArgumentException("方法执行异常,异常消息[" + e.getMessage() + "]", e);
+ }
+ return null;
+ }
+
+
+ /**
+ * 包括父类的属性
+ *
+ * @param type
+ * @return
+ */
+ public static Field[] getDeclaredFields(Class> type) {
+ List list = new ArrayList();
+ Class> clazz = type;
+ for (; clazz != Object.class; clazz = clazz.getSuperclass()) {
+ try {
+ for (Field field : clazz.getDeclaredFields()) {
+ if (!Modifier.isStatic(field.getModifiers())) {
+ list.add(field);
+ }
+ }
+ } catch (Exception e) {
+ // 这里甚么都不要做!并且这里的异常必须这样写,不能抛出去。
+ // 如果这里的异常打印或者往外抛,则就不会执行clazz =
+ // clazz.getSuperclass(),最后就不会进入到父类中了
+
+ }
+ }
+ return list.toArray(new Field[]{});
+ }
+
+
+ public static Field[] getDeclaredFields(Class> type, Class a) {
+ List fs = new ArrayList<>();
+ Field[] fields = getDeclaredFields(type);
+ for (Field field : fields) {
+ if (field.getType().getAnnotation(a) != null) {
+ fs.add(field);
+ }
+ }
+ return fs.toArray(new Field[]{});
+ }
+
+ /**
+ * 包括父类的属性
+ *
+ * @param type
+ * @param fieldName
+ * @return
+ */
+ public static Field getDeclaredFields(Class> type, String fieldName) {
+ Field field = null;
+ Class> clazz = type;
+ for (; clazz != Object.class; clazz = clazz.getSuperclass()) {
+ try {
+ field = clazz.getDeclaredField(fieldName);
+ return field;
+ } catch (Exception e) {
+ // 这里甚么都不要做!并且这里的异常必须这样写,不能抛出去。
+ // 如果这里的异常打印或者往外抛,则就不会执行clazz =
+ // clazz.getSuperclass(),最后就不会进入到父类中了
+
+ }
+ }
+ return null;
+ }
+
+ /**
+ * 判断属性名是否存在避免调用 getField(String name) 抛异常
+ *
+ * @param type
+ * @param fieldName
+ * @return
+ */
+ public static boolean existField(Class> type, String fieldName) {
+ if (fieldName == null) {
+ return false;
+ }
+ return getDeclaredFields(type, fieldName) != null;
+ }
+
+ /**
+ * 递归寻找属性的类型
+ *
+ * @param beanType 根类型
+ * @param fieldStr 如bean.field.field
+ * @return
+ */
+ public static final Class>[] getTypes(Class> beanType, String fieldStr) {
+ Assert.notNull(beanType, "根类型不允许为空");
+ Assert.hasText(fieldStr, "属性串不允许为空");
+ String[] fieldNames = fieldStr.split("\\.");
+ List> returnTypes = new ArrayList>();
+
+ Class> returnType = beanType;
+ for (String fn : fieldNames) {
+ if (ClassUtils.existField(returnType, fn)) {
+ Field f;
+ f = getDeclaredFields(returnType, fn);
+ returnTypes.add(f.getType());
+ returnType = f.getType();
+ } else {
+ return returnTypes.toArray(new Class>[0]);
+ }
+ }
+ return returnTypes.toArray(new Class>[0]);
+ }
+
+
+ public static final boolean isBaseType(Field field) {
+ Assert.notNull(field, "属性不允许为空!");
+ return isBaseType(field.getType());
+ }
+
+ public static final Object initBaseValue(Class> objType) {
+ return parseBaseValue(objType, "");
+ }
+
+
+ public static final Object parseBaseValue(Class> objType, Object value) {
+ Assert.logic(isBaseType(objType), "需要转换的必须是基本类型");
+ if (Short.class.equals(objType) || short.class.equals(objType)) {
+ return NumFormat.$Long(value);
+ } else if (Integer.class.equals(objType) || int.class.equals(objType)) {
+ return NumFormat.$Intger(value);
+ } else if (Long.class.equals(objType) || long.class.equals(objType)) {
+ return NumFormat.$Long(value);
+ } else if (Float.class.equals(objType) || float.class.equals(objType)) {
+ return NumFormat.$Float(value);
+ } else if (Double.class.equals(objType) || double.class.equals(objType)) {
+ return NumFormat.$Double(value);
+ } else if (String.class.equals(objType)) {
+ return value;
+ } else if (Boolean.class.equals(objType) || boolean.class.equals(objType)) {
+ if (value == null) {
+ return Boolean.FALSE;
+ } else {
+ return Boolean.getBoolean(value.toString());
+ }
+
+ }
+ return null;
+ }
+
+
+ public static final Object parseBaseValue(Class> objType, String value) {
+ Assert.logic(isBaseType(objType), "需要转换的必须是基本类型");
+ if (Short.class.equals(objType) || short.class.equals(objType)) {
+ return NumFormat.$Short(value.trim());
+ } else if (Integer.class.equals(objType) || int.class.equals(objType)) {
+ return NumFormat.$Intger(value.trim());
+ } else if (Long.class.equals(objType) || long.class.equals(objType)) {
+ return NumFormat.$Long(value.trim());
+ } else if (Float.class.equals(objType) || float.class.equals(objType)) {
+ return NumFormat.$Float(value.trim());
+ } else if (Double.class.equals(objType) || double.class.equals(objType)) {
+ return NumFormat.$Double(value.trim());
+ } else if (String.class.equals(objType)) {
+ return value;
+ } else if (Boolean.class.equals(objType) || boolean.class.equals(objType)) {
+ return Boolean.parseBoolean(value.trim());
+ }
+ return null;
+ }
+
+ public static final boolean isBaseType(Class> beanType) {
+ Assert.notNull(beanType, "类型不允许为空!");
+ return beanType.isPrimitive()
+ || String.class.equals(beanType)
+ || Long.class.equals(beanType)
+ || Short.class.equals(beanType)
+ || Character.class.equals(beanType)
+ || Integer.class.equals(beanType)
+ || Double.class.equals(beanType)
+ || Boolean.class.equals(beanType)
+ || Float.class.equals(beanType);
+ }
+
+ public static final Object newInstance(Class> beanType, String fieldStr)
+ throws InstantiationException,
+ IllegalAccessException, SecurityException, NoSuchFieldException {
+ Assert.notNull(beanType, "根类型不允许为空");
+ Assert.hasText(fieldStr, "属性串不允许为空");
+
+ Class>[] types = getTypes(beanType, fieldStr);
+ if (types.length == 0) {
+ return null;
+ }
+ String[] fieldNames = fieldStr.split("\\.");
+ Object root = beanType.newInstance();
+ Object obj = root;
+ Class> tmpType = beanType;
+ int i = 0;
+ for (Class> type : types) {
+ Object objTmp = type.newInstance();
+ GSetterUtil.setValueBySetter(obj, tmpType.getDeclaredField(fieldNames[i]), objTmp);
+ obj = objTmp;
+ tmpType = type;
+ i++;
+ }
+ return GSetterUtil.getValueByGetter(root, beanType.getDeclaredField(fieldNames[0]));
+ }
+
+
+ /**
+ * 递归寻找属性的类型
+ *
+ * @param beanType 根类型
+ * @param fieldStr 如bean.field.field
+ * @return
+ */
+ public static final Class> getType(Class> beanType, String fieldStr) {
+ Assert.notNull(beanType, "根类型不允许为空");
+ Assert.hasText(fieldStr, "属性串不允许为空");
+ String[] fieldNames = fieldStr.split("\\.");
+ Class> returnType = beanType;
+ for (String fn : fieldNames) {
+ if (ClassUtils.existField(returnType, fn)) {
+ Field f;
+ try {
+ f = getDeclaredFields(returnType, fn);
+ returnType = f.getType();
+ } catch (NullPointerException e) {
+ //找不到字段返回NULL
+
+ return null;
+ }
+ } else {
+ return null;
+ }
+ }
+ return returnType;
+ }
+
+ /**
+ * 获取某个包下面的class
+ *
+ * @param pack
+ * @return
+ */
+ public static List getClasssFromPackage(String pack) {
+ List classNames = new ArrayList();
+ // 是否循环搜索子包
+ boolean recursive = true;
+ // 包名字
+ String packageName = pack;
+ // 包名对应的路径名称
+ String packageDirName = packageName.replace('.', '/');
+ Enumeration dirs;
+ try {
+ dirs = Thread.currentThread().getContextClassLoader().getResources(packageDirName);
+ while (dirs.hasMoreElements()) {
+ URL url = dirs.nextElement();
+ String protocol = url.getProtocol();
+ if ("file".equals(protocol)) {
+ System.out.println("file类型的扫描");
+ String filePath = URLDecoder.decode(url.getFile(), "UTF-8");
+ findClassInPackageByFile(packageName, filePath, recursive, classNames);
+ } else if ("jar".equals(protocol)) {
+ System.out.println("jar类型的扫描");
+ }
+ }
+ } catch (Exception e) {
+
+ }
+ return classNames;
+ }
+
+ private static void findClassInPackageByFile(String packageName, String filePath, final boolean recursive, List clazzNames) {
+ File dir = new File(filePath);
+ if (!dir.exists() || !dir.isDirectory()) {
+ return;
+ }
+ // 在给定的目录下找到所有的文件,并且进行条件过滤
+ File[] dirFiles = dir.listFiles(new FileFilter() {
+ @Override
+ public boolean accept(File file) {
+ boolean acceptDir = recursive && file.isDirectory();// 接受dir目录
+ boolean acceptClass = file.getName().endsWith("class");// 接受class文件
+ return acceptDir || acceptClass;
+ }
+ });
+
+ for (File file : dirFiles) {
+ if (file.isDirectory()) {
+ findClassInPackageByFile(packageName + "." + file.getName(), file.getAbsolutePath(), recursive, clazzNames);
+ } else {
+ String className = file.getName().substring(0, file.getName().length() - 6);
+ try {
+ clazzNames.add(packageName + "." + className);
+ } catch (Exception e) {
+
+ }
+ }
+ }
+ }
+
+ /**
+ * 从jar文件中读取指定目录下面的所有的class文件
+ *
+ * @param jarPath jar文件存放的位置
+ * @param jarPath 指定的文件目录
+ * @return 所有的的class的对象
+ */
+ public static List getClasssFromJarFile(String jarPath) {
+ List classNameList = new ArrayList<>();
+ JarFile jarFile = null;
+ try {
+ jarFile = new JarFile(jarPath);
+ } catch (IOException e1) {
+
+ }
+ List jarEntryList = new ArrayList<>();
+ Enumeration ee = jarFile.entries();
+ while (ee.hasMoreElements()) {
+ JarEntry entry = ee.nextElement();
+// entry.getName().startsWith(filePath) &&
+ if (entry.getName().endsWith(".class")) {
+ jarEntryList.add(entry);
+ }
+ }
+ for (JarEntry entry : jarEntryList) {
+ String className = entry.getName().replace('/', '.');
+ className = className.substring(0, className.length() - 6);
+ classNameList.add(className);
+ }
+ return classNameList;
+ }
+
+ public static Class[] getMethodParamTypes(Object classInstance, String methodName) {
+ Class[] paramTypes = null;
+ try {
+ Method[] methods = classInstance.getClass().getMethods();//全部方法
+ for (int i = 0; i < methods.length; i++) {
+ if (methodName.equals(methods[i].getName())) {//和传入方法名匹配
+ Class[] params = methods[i].getParameterTypes();
+ paramTypes = new Class[params.length];
+ for (int j = 0; j < params.length; j++) {
+ paramTypes[j] = Class.forName(params[j].getName());
+ }
+ break;
+ }
+ }
+ }catch (Throwable e) {
+ throw new IllegalStateException("获取方法参数类型失败", e);
+ }
+ return paramTypes;
+ }
+
+ public static Method findDeclaredMethod(Object object, String methodName) {
+ Method execMethod = null;
+ for (Method method : object.getClass().getDeclaredMethods()) {
+ if (method.getName().equals(methodName)) {
+ execMethod = method;
+ break;
+ }
+ }
+ return execMethod;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(Arrays.asList(getDeclaredFields(ClassUtils.class)));
+ }
+
+}
diff --git a/luqj-common/src/main/java/com/luqj/util/reflect/GSetterUtil.java b/luqj-common/src/main/java/com/luqj/util/reflect/GSetterUtil.java
new file mode 100644
index 0000000..7224550
--- /dev/null
+++ b/luqj-common/src/main/java/com/luqj/util/reflect/GSetterUtil.java
@@ -0,0 +1,196 @@
+package com.luqj.util.reflect;
+
+import com.luqj.util.assertion.Assert;
+import com.luqj.util.log.LogUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+public abstract class GSetterUtil {
+ private static Logger _log = LoggerFactory.getLogger(GSetterUtil.class);
+
+ public static final String PREFIX_GETTER = "get";
+
+ public static final String PREFIX_SETTER = "set";
+
+
+ public static Object getValueByGetter(Object obj,String fieldName){
+ Field f = ClassUtils.getDeclaredFields(obj.getClass(), fieldName);
+ Assert.notNull(f, obj.getClass()+",找不到指定的属性["+fieldName+"]");
+ return getValueByGetter(obj, f);
+ }
+
+ /**
+ * 判断属性是否可操作,是否有公共getter,setter方法
+ * @return
+ */
+ public static boolean isOpAbleField(Class> type,Field f){
+ return getGetter(type, f) != null && getSetter(type, f) != null;
+ }
+
+ /**
+ * 判断指定的对象属性是否存在getter方法
+ * @param f
+ * @return
+ */
+ public static boolean existGetter(Class> type,Field f){
+ return getGetter(type, f) != null;
+ }
+
+ /**
+ * 判断指定的对象属性是否存在setter方法
+ * @param f
+ * @return
+ */
+ public static boolean existSetter(Class> type,Field f){
+ return getSetter(type, f) != null;
+ }
+
+ public static void setValueBySetter(Object obj,Field f,Object paramValue){
+ setValueBySetter(obj, f.getName(), paramValue,f.getType());
+ }
+
+ public static void setValueBySetter(Object obj,String fieldName,Object paramValue,Class> paramType){
+ Method m = getSetter(obj.getClass(),fieldName,paramType);
+ Assert.notNull(m,obj.getClass().getSimpleName()+"属性["+fieldName+"]不存在setter方法");
+ try {
+ m.invoke(obj,paramValue);
+ } catch (Throwable e) {
+
+ _log.error(LogUtil.exceptionMsg("["+fieldName+"]set方法"+m.getName()+"设置出现异常", e),e);
+ }
+ }
+
+ public static Object getValueByGetter(Object obj,Field f){
+ Method m = getGetter(obj.getClass(), f);
+ Assert.notNull(m,"属性["+f.getName()+"]不存在getter方法");
+ try {
+ return m.invoke(obj);
+ } catch (Throwable e) {
+
+ _log.error(LogUtil.exceptionMsg(f+"set方法"+m.getName()+"设置出现异常", e));
+ return null;
+ }
+ }
+
+ public static String getGetterMethodName(String fieldName){
+ Assert.hasText(fieldName,"属性名必须有内容!");
+ return PREFIX_GETTER + upperFirstChar(fieldName);
+ }
+
+ public static String getSetterMethodName(String fieldName){
+ Assert.hasText(fieldName,"属性名必须有内容!");
+ return PREFIX_SETTER + upperFirstChar(fieldName);
+ }
+
+ public static String upperFirstChar(String fieldName){
+ return fieldName.substring(0,1).toUpperCase()
+ + fieldName.substring(1,fieldName.length());
+ }
+
+ public static String lowerFirstChar(String fieldName){
+ return fieldName.substring(0,1).toLowerCase()
+ + fieldName.substring(1,fieldName.length());
+ }
+
+
+ public static boolean isGetter(Method method){
+ return method.getModifiers() == Modifier.PUBLIC
+ && method.getName().length() > PREFIX_GETTER.length()
+ && method.getName().startsWith(PREFIX_GETTER)
+ && method.getParameterTypes().length == 0;
+ }
+
+ public static boolean isSetter(Method method){
+ return (method.getModifiers() & Modifier.PUBLIC) == 1
+ && method.getName().length() > PREFIX_SETTER.length()
+ && method.getName().startsWith(PREFIX_SETTER)
+ && method.getParameterTypes().length == 1;
+ }
+
+ /**
+ * 获取setter方法,如果找不到或达不到要求返回NULL
+ * @param type
+ * @param f
+ * @return
+ */
+ public static Method getSetter(Class> type,String fieldName,Class> fieldType){
+ try {
+ Method m = type.getMethod(getSetterMethodName(fieldName), fieldType);
+ if(isSetter(m)){
+ return m;
+ }else{
+ return null;
+ }
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+
+ /**
+ * 获取setter方法,如果找不到或达不到要求返回NULL
+ * @param type
+ * @param f
+ * @return
+ */
+ public static Method getSetter(Class> type,Field f){
+ return getSetter(type, f.getName(), f.getType());
+ }
+
+
+
+ /**
+ * 获取getter方法,如果找不到或达不到要求返回NULL
+ * @param type
+ * @param f
+ * @return
+ */
+ public static Method getGetter(Class> type,Field f){
+ try {
+ Method m = type.getMethod(getGetterMethodName(f.getName()));
+ if(isGetter(m)){
+ return m;
+ }else{
+ return null;
+ }
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+
+ /**
+ * 根据setter方法获取属性名
+ * @param method
+ * @return
+ */
+ public static String getFieldNameBySetter(Method method){
+ //get开头且没有参数
+ Assert.notNull(method,"方法不允许为NULL");
+ Assert.logic(isSetter(method),
+ method.getName()+"["+method.getParameterTypes().length+"]不是JAVA标准set方法");
+ String fieldName = method.getName().substring(PREFIX_SETTER.length());
+ fieldName = lowerFirstChar(fieldName);
+ return fieldName;
+ }
+
+ /**
+ * 根据getter方法获取属性名
+ * @param method
+ * @return
+ */
+ public static String getFieldNameByGetter(Method method){
+ //get开头且没有参数
+ Assert.notNull(method,"方法不允许为NULL");
+ Assert.logic(isGetter(method),
+ method.getName()+"["+method.getParameterTypes().length+"]不是JAVA标准get方法");
+ String fieldName = method.getName().substring(PREFIX_GETTER.length());
+ fieldName = lowerFirstChar(fieldName);
+ return fieldName;
+ }
+
+}
diff --git a/luqj-common/src/main/java/com/luqj/util/reflect/JarUtils.java b/luqj-common/src/main/java/com/luqj/util/reflect/JarUtils.java
new file mode 100644
index 0000000..33bb0e7
--- /dev/null
+++ b/luqj-common/src/main/java/com/luqj/util/reflect/JarUtils.java
@@ -0,0 +1,139 @@
+package com.luqj.util.reflect;
+
+
+
+import com.luqj.util.assertion.Assert;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+public class JarUtils {
+
+
+ public static interface JarOperator {
+ void operate(JarFile jar, String className, JarEntry entry);
+ }
+
+
+ public static class ClassLoaderOP implements JarOperator {
+
+ private ClassLoader loader;
+ private Method md1;
+
+ public ClassLoaderOP(ClassLoader loader) {
+ super();
+ try {
+ this.loader = loader;
+ md1 = ClassLoader.class.getDeclaredMethod(
+ "defineClass",
+ String.class, byte[].class, int.class, int.class);
+ md1.setAccessible(true);
+ } catch (Exception e) {
+ Assert.fail("jar文件加载初始化异常,异常消息[" + e.getMessage() + "]");
+ }
+ }
+
+ @Override
+ public void operate(JarFile jar, String className, JarEntry entry) {
+ try {
+ InputStream is = jar.getInputStream(entry);
+ ByteArrayOutputStream dataOut = new ByteArrayOutputStream();
+ byte[] packData = new byte[2048];
+ int readLen = 0;
+ while (-1 != (readLen = is.read(packData))) {
+ dataOut.write(packData, 0, readLen);
+ }
+ if (dataOut.size() <= 0) {
+ throw new ClassNotFoundException(className);
+ }
+ byte[] classFile = dataOut.toByteArray();
+ md1.invoke(loader, className, classFile, 0, classFile.length);
+ } catch (Exception e) {
+
+ Assert.fail("类:" + className + "加载异常,异常消息[" + e.getMessage() + "]");
+ }
+ }
+ }
+
+ public static void operateJar(String file, JarOperator op) {
+ try {
+ JarFile jar = new JarFile(file);
+ Enumeration d = jar.entries();
+ while (d.hasMoreElements()) {
+ JarEntry entry = (JarEntry) d.nextElement();
+ if (entry.getName().endsWith(".class")) {
+ String name = entry.getName();
+ name = name.substring(0, name.length() - 6);
+ name = name.replaceAll("/", ".");
+ op.operate(jar, name, entry);
+ }
+ }
+ } catch (IOException e) {
+
+ Assert.fail("解析JAR:" + file + "出现异常,异常消息[" + e.getMessage() + "]");
+ }
+ }
+
+ public static void loadClass(String file, ClassLoader loader) {
+ ClassLoaderOP op = new ClassLoaderOP(loader);
+ operateJar(file, op);
+ }
+
+
+ /**
+ * 获取所有的 JAVA类信息
+ *
+ * @param file
+ * @return 返回全局类名
+ */
+ public static Collection getAllClassInfo(String file) {
+ List infos = new ArrayList();
+ try {
+ JarFile jar = new JarFile(file);
+ Enumeration d = jar.entries();
+ while (d.hasMoreElements()) {
+ JarEntry entry = (JarEntry) d.nextElement();
+ if (entry.getName().endsWith(".class")) {
+ String name = entry.getName();
+ name = name.substring(0, name.length() - 6);
+ name = name.replaceAll("/", ".");
+ infos.add(name);
+ }
+ }
+ return infos;
+ } catch (IOException e) {
+
+ Assert.fail("解析JAR:" + file + "出现异常,异常消息[" + e.getMessage() + "]");
+ }
+ return infos;
+ }
+
+ public static Collection getResources(String filePath, String dirPath) {
+ List infos = new ArrayList();
+ try {
+ JarFile jar = new JarFile(filePath);
+ Enumeration d = jar.entries();
+ while (d.hasMoreElements()) {
+ JarEntry entry = (JarEntry) d.nextElement();
+ if (entry.getName().startsWith(dirPath) && !entry.isDirectory()) {
+ infos.add(entry.getName());
+ }
+ }
+ return infos;
+ } catch (IOException e) {
+
+ Assert.fail("解析JAR:" + filePath + "出现异常,异常消息[" + e.getMessage() + "]");
+ }
+ return infos;
+ }
+
+
+}
diff --git a/luqj-common/src/main/java/com/luqj/util/reflect/MethodParam.java b/luqj-common/src/main/java/com/luqj/util/reflect/MethodParam.java
new file mode 100644
index 0000000..7efeb19
--- /dev/null
+++ b/luqj-common/src/main/java/com/luqj/util/reflect/MethodParam.java
@@ -0,0 +1,73 @@
+package com.luqj.util.reflect;
+
+public class MethodParam {
+
+ private int index;
+
+ private String name;
+
+ private Class> type;
+
+ /**
+ * 参数的泛型类型集合
+ */
+ private Class>[] t;
+
+ private Object value;
+
+
+ public MethodParam(int index, String name, Class> type) {
+ super();
+ this.index = index;
+ this.name = name;
+ this.type = type;
+ }
+
+ public Class>[] getT() {
+ return t;
+ }
+
+
+ public void setT(Class>[] ts) {
+ t = ts;
+ }
+
+
+ public Object getValue() {
+ return value;
+ }
+
+ public void setValue(Object value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return "MethodParam [index=" + index + ", name=" + name + ", type=" + type + "]";
+ }
+
+
+ public int getIndex() {
+ return index;
+ }
+
+ public void setIndex(int index) {
+ this.index = index;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Class> getType() {
+ return type;
+ }
+
+ public void setType(Class> type) {
+ this.type = type;
+ }
+}
diff --git a/luqj-djl/pom.xml b/luqj-djl/pom.xml
new file mode 100644
index 0000000..887036c
--- /dev/null
+++ b/luqj-djl/pom.xml
@@ -0,0 +1,286 @@
+
+ 4.0.0
+
+ com.ruoyi
+ ruoyi
+ 3.4.0
+
+ luqj-djl
+ 3.4.0
+ jar
+
+ luqj-djl
+ http://maven.apache.org
+
+
+ UTF-8
+ 0.34.0
+ 1.1.0
+ 1.5.11
+
+ macosx-arm64
+ linux-x86_64
+ linux-arm64
+ windows-x86_64
+
+
+ win-x86_64
+ linux-x86_64
+ linux-aarch64
+ osx-aarch64
+
+
+
+
+ ai.djl
+ bom
+ ${djl.version}
+ pom
+ import
+
+
+ cn.smartjavaai
+ bom
+ ${smartjavaai.version}
+ pom
+
+ import
+
+
+ com.microsoft.onnxruntime
+ onnxruntime
+ 1.16.3
+
+
+
+
+
+
+ cn.smartjavaai
+ ocr
+
+
+
+
+ ai.djl.pytorch
+ pytorch-jni
+ 2.7.1-0.34.0
+ runtime
+
+
+
+
+
+ org.bytedeco
+ javacpp
+ ${javacv.version}
+ ${javacv.platform.windows-x86_64}
+
+
+ org.bytedeco
+ ffmpeg
+ 7.1-1.5.11
+ ${javacv.platform.windows-x86_64}
+
+
+
+ org.bytedeco
+ openblas
+ 0.3.26-1.5.10
+ ${javacv.platform.windows-x86_64}
+
+
+
+ org.bytedeco
+ opencv
+ 4.9.0-1.5.10
+ ${javacv.platform.windows-x86_64}
+
+
+
+ ai.djl.pytorch
+ pytorch-native-cpu
+ ${djl.platform.windows-x86_64}
+ 2.7.1
+ runtime
+
+
+
+
+
+
+ org.bytedeco
+ javacpp
+ ${javacv.version}
+ ${javacv.platform.linux-x86_64}
+
+
+ org.bytedeco
+ ffmpeg
+ 7.1-1.5.11
+ ${javacv.platform.linux-x86_64}
+
+
+
+ org.bytedeco
+ openblas
+ 0.3.26-1.5.10
+ ${javacv.platform.linux-x86_64}
+
+
+
+ org.bytedeco
+ opencv
+ 4.9.0-1.5.10
+ ${javacv.platform.linux-x86_64}
+
+
+
+ ai.djl.pytorch
+ pytorch-native-cpu
+ ${djl.platform.linux-x86_64}
+ 2.7.1
+ runtime
+
+
+
+
+ org.bytedeco
+ javacpp
+ ${javacv.version}
+ ${javacv.platform.linux-arm64}
+
+
+ org.bytedeco
+ ffmpeg
+ 7.1-1.5.11
+ ${javacv.platform.linux-arm64}
+
+
+
+ org.bytedeco
+ openblas
+ 0.3.26-1.5.10
+ ${javacv.platform.linux-arm64}
+
+
+
+ org.bytedeco
+ opencv
+ 4.9.0-1.5.10
+ ${javacv.platform.linux-arm64}
+
+
+
+ ai.djl.pytorch
+ pytorch-native-cpu
+ ${djl.platform.linux-aarch64}
+ 2.7.1
+ runtime
+
+
+
+
+
+ org.bytedeco
+ javacpp
+ ${javacv.version}
+ ${javacv.platform.macosx-arm64}
+
+
+ org.bytedeco
+ ffmpeg
+ 7.1-1.5.11
+ ${javacv.platform.macosx-arm64}
+
+
+
+ org.bytedeco
+ openblas
+ 0.3.26-1.5.10
+ ${javacv.platform.macosx-arm64}
+
+
+
+ org.bytedeco
+ opencv
+ 4.9.0-1.5.10
+ ${javacv.platform.macosx-arm64}
+
+
+
+ ai.djl.pytorch
+ pytorch-native-cpu
+ ${djl.platform.osx-aarch64}
+ 2.7.1
+ runtime
+
+
+ ai.djl
+ api
+ 0.34.0
+
+
+
+
+ ai.djl.pytorch
+ pytorch-engine
+ 0.34.0
+
+
+
+ ai.djl
+ api
+
+
+ ai.djl
+ basicdataset
+
+
+ ai.djl
+ model-zoo
+
+
+ ai.djl.timeseries
+ timeseries
+
+
+ ai.djl.huggingface
+ tokenizers
+
+
+ ai.djl.audio
+ audio
+
+
+
+ ai.djl.mxnet
+ mxnet-model-zoo
+
+
+
+ ai.djl.pytorch
+ pytorch-model-zoo
+
+
+
+ ai.djl.tensorflow
+ tensorflow-model-zoo
+
+
+
+ ai.djl.onnxruntime
+ onnxruntime-engine
+
+
+ com.hankcs
+ hanlp
+ portable-1.8.1
+
+
+ org.springframework
+ spring-context
+
+
+
diff --git a/luqj-djl/src/main/java/com/luqj/djl/init/DjlInit.java b/luqj-djl/src/main/java/com/luqj/djl/init/DjlInit.java
new file mode 100644
index 0000000..c998c1d
--- /dev/null
+++ b/luqj-djl/src/main/java/com/luqj/djl/init/DjlInit.java
@@ -0,0 +1,21 @@
+package com.luqj.djl.init;
+
+import com.luqj.djl.utils.EmbeddingModelSingleton;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+import java.util.Arrays;
+
+@Component
+public class DjlInit {
+ @Value("${simcse.path:}")
+ private String simcsePath;
+ @PostConstruct
+ private void init() throws Exception {
+// umsVideoService.deleteRecommentByQuery("cn");
+// EmbeddingModelSingleton.getCriteria(simcsePath);
+// float[] queryVector = EmbeddingModelSingleton.embed("测试用户");
+// System.out.println(Arrays.toString(queryVector));
+ }
+}
diff --git a/luqj-djl/src/main/java/com/luqj/djl/utils/EmbeddingModelSingleton.java b/luqj-djl/src/main/java/com/luqj/djl/utils/EmbeddingModelSingleton.java
new file mode 100644
index 0000000..7056750
--- /dev/null
+++ b/luqj-djl/src/main/java/com/luqj/djl/utils/EmbeddingModelSingleton.java
@@ -0,0 +1,71 @@
+package com.luqj.djl.utils;
+
+import ai.djl.Device;
+import ai.djl.huggingface.translator.TextEmbeddingTranslatorFactory;
+import ai.djl.inference.Predictor;
+import ai.djl.repository.zoo.Criteria;
+import ai.djl.repository.zoo.ZooModel;
+import ai.djl.training.util.ProgressBar;
+import lombok.extern.slf4j.Slf4j;
+
+import java.nio.file.Paths;
+
+@Slf4j
+public class EmbeddingModelSingleton {
+
+ private static volatile Criteria criteriaInstance;
+ private static volatile ZooModel model;
+
+ private EmbeddingModelSingleton() {
+ // 私有构造函数,防止外部实例化
+ }
+
+ public static float[] embed(String text) {
+ try {
+ try (Predictor predictor = model.newPredictor()) {
+ return predictor.predict(text);
+ }
+ } catch (Exception e) {
+ log.error(e.getMessage());
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static double cosine(float[] a, float[] b) {
+ double dot = 0, na = 0, nb = 0;
+ for (int i = 0; i < a.length; i++) {
+ dot += a[i] * b[i];
+ na += a[i] * a[i];
+ nb += b[i] * b[i];
+ }
+ return dot / (Math.sqrt(na) * Math.sqrt(nb) + 1e-8);
+ }
+
+ /**
+ * 获取 Criteria 单例
+ */
+ public static Criteria getCriteria(String path) {
+ if (criteriaInstance == null) {
+ synchronized (EmbeddingModelSingleton.class) {
+ if (criteriaInstance == null) {
+ criteriaInstance = Criteria.builder()
+ .setTypes(String.class, float[].class)
+ .optModelPath(Paths.get(path))
+// .optModelUrls("djl://ai.djl.huggingface.pytorch/princeton-nlp/unsup-simcse-roberta-base")
+ .optEngine("PyTorch")
+ .optDevice(Device.cpu())
+ .optTranslatorFactory(new TextEmbeddingTranslatorFactory())
+ .optModelName("sup-simcse-bert-base-uncased.pt")
+ .optProgress(new ProgressBar())
+ .build();
+ try {
+ model = criteriaInstance.loadModel();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ }
+ return criteriaInstance;
+ }
+}
diff --git a/luqj-ec/pom.xml b/luqj-ec/pom.xml
new file mode 100644
index 0000000..38d6948
--- /dev/null
+++ b/luqj-ec/pom.xml
@@ -0,0 +1,36 @@
+
+ 4.0.0
+
+ com.ruoyi
+ ruoyi
+ 3.4.0
+
+
+ luqj-ec
+ jar
+
+ luqj-ec
+ http://maven.apache.org
+
+
+ UTF-8
+
+
+
+
+ com.ruoyi
+ ruoyi-common
+
+
+ com.baomidou
+ mybatis-plus-extension
+ 3.4.0
+
+
+ com.ruoyi
+ luqj-common
+ 3.4.0
+
+
+
diff --git a/luqj-ec/src/main/java/com/luqj/ec/controller/EcCommandResultController.java b/luqj-ec/src/main/java/com/luqj/ec/controller/EcCommandResultController.java
new file mode 100644
index 0000000..38b0618
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/controller/EcCommandResultController.java
@@ -0,0 +1,118 @@
+package com.luqj.ec.controller;
+import com.ruoyi.common.select.Ids;
+import com.ruoyi.common.select.SelectItem;
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.luqj.ec.domain.EcCommandResult;
+import com.luqj.ec.domain.EcCommandResultPlus;
+import com.luqj.ec.service.IEcCommandResultService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 指令执行结果(客户端回传)Controller
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+@RestController
+@RequestMapping("/ec/ec-command-result")
+public class EcCommandResultController extends BaseController
+{
+ @Autowired
+ private IEcCommandResultService ecCommandResultService;
+ @PreAuthorize("@ss.hasPermi('ec:ec-command-result:getByIds')")
+ @PostMapping("/getByIds")
+ public AjaxResult getByIds(@RequestBody Ids ids)
+ {
+ List list = ecCommandResultService.getByIds(ids.getLongIds(),EcCommandResultPlus::getErrorMsg,EcCommandResultPlus::getId);
+ return AjaxResult.success(list);
+ }
+ @PreAuthorize("@ss.hasPermi('ec:ec-command-result:select')")
+ @GetMapping("/select")
+ public AjaxResult select(String keyword)
+ {
+ List list = ecCommandResultService.select(keyword);
+ return AjaxResult.success(list);
+ }
+ /**
+ * 查询指令执行结果(客户端回传)列表
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-command-result:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(EcCommandResult ecCommandResult)
+ {
+ startPage();
+ List list = ecCommandResultService.selectEcCommandResultList(ecCommandResult);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出指令执行结果(客户端回传)列表
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-command-result:export')")
+ @Log(title = "指令执行结果(客户端回传)", businessType = BusinessType.EXPORT)
+ @GetMapping("/export")
+ public AjaxResult export(EcCommandResult ecCommandResult)
+ {
+ List list = ecCommandResultService.selectEcCommandResultList(ecCommandResult);
+ ExcelUtil util = new ExcelUtil(EcCommandResult.class);
+ return util.exportExcel(list, "ec-command-result");
+ }
+
+ /**
+ * 获取指令执行结果(客户端回传)详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-command-result:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") Long id)
+ {
+ return AjaxResult.success(ecCommandResultService.selectEcCommandResultById(id));
+ }
+
+ /**
+ * 新增指令执行结果(客户端回传)
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-command-result:add')")
+ @Log(title = "指令执行结果(客户端回传)", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody EcCommandResult ecCommandResult)
+ {
+ return toAjax(ecCommandResultService.insertEcCommandResult(ecCommandResult));
+ }
+
+ /**
+ * 修改指令执行结果(客户端回传)
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-command-result:edit')")
+ @Log(title = "指令执行结果(客户端回传)", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody EcCommandResult ecCommandResult)
+ {
+ return toAjax(ecCommandResultService.updateEcCommandResult(ecCommandResult));
+ }
+
+ /**
+ * 删除指令执行结果(客户端回传)
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-command-result:remove')")
+ @Log(title = "指令执行结果(客户端回传)", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable Long[] ids)
+ {
+ return toAjax(ecCommandResultService.deleteEcCommandResultByIds(ids));
+ }
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/controller/EcControlTaskController.java b/luqj-ec/src/main/java/com/luqj/ec/controller/EcControlTaskController.java
new file mode 100644
index 0000000..750416a
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/controller/EcControlTaskController.java
@@ -0,0 +1,118 @@
+package com.luqj.ec.controller;
+import com.ruoyi.common.select.Ids;
+import com.ruoyi.common.select.SelectItem;
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.luqj.ec.domain.EcControlTask;
+import com.luqj.ec.domain.EcControlTaskPlus;
+import com.luqj.ec.service.IEcControlTaskService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 任务(群控核心)Controller
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+@RestController
+@RequestMapping("/ec/ec-task")
+public class EcControlTaskController extends BaseController
+{
+ @Autowired
+ private IEcControlTaskService ecControlTaskService;
+ @PreAuthorize("@ss.hasPermi('ec:ec-task:getByIds')")
+ @PostMapping("/getByIds")
+ public AjaxResult getByIds(@RequestBody Ids ids)
+ {
+ List list = ecControlTaskService.getByIds(ids.getLongIds(),EcControlTaskPlus::getTaskName,EcControlTaskPlus::getId);
+ return AjaxResult.success(list);
+ }
+ @PreAuthorize("@ss.hasPermi('ec:ec-task:select')")
+ @GetMapping("/select")
+ public AjaxResult select(String keyword)
+ {
+ List list = ecControlTaskService.select(keyword);
+ return AjaxResult.success(list);
+ }
+ /**
+ * 查询任务(群控核心)列表
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-task:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(EcControlTask ecControlTask)
+ {
+ startPage();
+ List list = ecControlTaskService.selectEcControlTaskList(ecControlTask);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出任务(群控核心)列表
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-task:export')")
+ @Log(title = "任务(群控核心)", businessType = BusinessType.EXPORT)
+ @GetMapping("/export")
+ public AjaxResult export(EcControlTask ecControlTask)
+ {
+ List list = ecControlTaskService.selectEcControlTaskList(ecControlTask);
+ ExcelUtil util = new ExcelUtil(EcControlTask.class);
+ return util.exportExcel(list, "ec-task");
+ }
+
+ /**
+ * 获取任务(群控核心)详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-task:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") Long id)
+ {
+ return AjaxResult.success(ecControlTaskService.selectEcControlTaskById(id));
+ }
+
+ /**
+ * 新增任务(群控核心)
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-task:add')")
+ @Log(title = "任务(群控核心)", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody EcControlTask ecControlTask)
+ {
+ return toAjax(ecControlTaskService.insertEcControlTask(ecControlTask));
+ }
+
+ /**
+ * 修改任务(群控核心)
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-task:edit')")
+ @Log(title = "任务(群控核心)", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody EcControlTask ecControlTask)
+ {
+ return toAjax(ecControlTaskService.updateEcControlTask(ecControlTask));
+ }
+
+ /**
+ * 删除任务(群控核心)
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-task:remove')")
+ @Log(title = "任务(群控核心)", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable Long[] ids)
+ {
+ return toAjax(ecControlTaskService.deleteEcControlTaskByIds(ids));
+ }
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/controller/EcDeviceCommandController.java b/luqj-ec/src/main/java/com/luqj/ec/controller/EcDeviceCommandController.java
new file mode 100644
index 0000000..191e12b
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/controller/EcDeviceCommandController.java
@@ -0,0 +1,118 @@
+package com.luqj.ec.controller;
+import com.ruoyi.common.select.Ids;
+import com.ruoyi.common.select.SelectItem;
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.luqj.ec.domain.EcDeviceCommand;
+import com.luqj.ec.domain.EcDeviceCommandPlus;
+import com.luqj.ec.service.IEcDeviceCommandService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 控制指令(单条指令)Controller
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+@RestController
+@RequestMapping("/ec/ec-command")
+public class EcDeviceCommandController extends BaseController
+{
+ @Autowired
+ private IEcDeviceCommandService ecDeviceCommandService;
+ @PreAuthorize("@ss.hasPermi('ec:ec-command:getByIds')")
+ @PostMapping("/getByIds")
+ public AjaxResult getByIds(@RequestBody Ids ids)
+ {
+ List list = ecDeviceCommandService.getByIds(ids.getLongIds(),EcDeviceCommandPlus::getCommandType,EcDeviceCommandPlus::getId);
+ return AjaxResult.success(list);
+ }
+ @PreAuthorize("@ss.hasPermi('ec:ec-command:select')")
+ @GetMapping("/select")
+ public AjaxResult select(String keyword)
+ {
+ List list = ecDeviceCommandService.select(keyword);
+ return AjaxResult.success(list);
+ }
+ /**
+ * 查询控制指令(单条指令)列表
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-command:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(EcDeviceCommand ecDeviceCommand)
+ {
+ startPage();
+ List list = ecDeviceCommandService.selectEcDeviceCommandList(ecDeviceCommand);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出控制指令(单条指令)列表
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-command:export')")
+ @Log(title = "控制指令(单条指令)", businessType = BusinessType.EXPORT)
+ @GetMapping("/export")
+ public AjaxResult export(EcDeviceCommand ecDeviceCommand)
+ {
+ List list = ecDeviceCommandService.selectEcDeviceCommandList(ecDeviceCommand);
+ ExcelUtil util = new ExcelUtil(EcDeviceCommand.class);
+ return util.exportExcel(list, "ec-command");
+ }
+
+ /**
+ * 获取控制指令(单条指令)详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-command:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") Long id)
+ {
+ return AjaxResult.success(ecDeviceCommandService.selectEcDeviceCommandById(id));
+ }
+
+ /**
+ * 新增控制指令(单条指令)
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-command:add')")
+ @Log(title = "控制指令(单条指令)", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody EcDeviceCommand ecDeviceCommand)
+ {
+ return toAjax(ecDeviceCommandService.insertEcDeviceCommand(ecDeviceCommand));
+ }
+
+ /**
+ * 修改控制指令(单条指令)
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-command:edit')")
+ @Log(title = "控制指令(单条指令)", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody EcDeviceCommand ecDeviceCommand)
+ {
+ return toAjax(ecDeviceCommandService.updateEcDeviceCommand(ecDeviceCommand));
+ }
+
+ /**
+ * 删除控制指令(单条指令)
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-command:remove')")
+ @Log(title = "控制指令(单条指令)", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable Long[] ids)
+ {
+ return toAjax(ecDeviceCommandService.deleteEcDeviceCommandByIds(ids));
+ }
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/controller/EcDeviceController.java b/luqj-ec/src/main/java/com/luqj/ec/controller/EcDeviceController.java
new file mode 100644
index 0000000..d935cc7
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/controller/EcDeviceController.java
@@ -0,0 +1,118 @@
+package com.luqj.ec.controller;
+import com.ruoyi.common.select.Ids;
+import com.ruoyi.common.select.SelectItem;
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.luqj.ec.domain.EcDevice;
+import com.luqj.ec.domain.EcDevicePlus;
+import com.luqj.ec.service.IEcDeviceService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 设备(手机设备)Controller
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+@RestController
+@RequestMapping("/ec/ec-device")
+public class EcDeviceController extends BaseController
+{
+ @Autowired
+ private IEcDeviceService ecDeviceService;
+ @PreAuthorize("@ss.hasPermi('ec:ec-device:getByIds')")
+ @PostMapping("/getByIds")
+ public AjaxResult getByIds(@RequestBody Ids ids)
+ {
+ List list = ecDeviceService.getByIds(ids.getLongIds(),EcDevicePlus::getDeviceCode,EcDevicePlus::getId);
+ return AjaxResult.success(list);
+ }
+ @PreAuthorize("@ss.hasPermi('ec:ec-device:select')")
+ @GetMapping("/select")
+ public AjaxResult select(String keyword)
+ {
+ List list = ecDeviceService.select(keyword);
+ return AjaxResult.success(list);
+ }
+ /**
+ * 查询设备(手机设备)列表
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-device:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(EcDevice ecDevice)
+ {
+ startPage();
+ List list = ecDeviceService.selectEcDeviceList(ecDevice);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出设备(手机设备)列表
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-device:export')")
+ @Log(title = "设备(手机设备)", businessType = BusinessType.EXPORT)
+ @GetMapping("/export")
+ public AjaxResult export(EcDevice ecDevice)
+ {
+ List list = ecDeviceService.selectEcDeviceList(ecDevice);
+ ExcelUtil util = new ExcelUtil(EcDevice.class);
+ return util.exportExcel(list, "ec-device");
+ }
+
+ /**
+ * 获取设备(手机设备)详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-device:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") Long id)
+ {
+ return AjaxResult.success(ecDeviceService.selectEcDeviceById(id));
+ }
+
+ /**
+ * 新增设备(手机设备)
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-device:add')")
+ @Log(title = "设备(手机设备)", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody EcDevice ecDevice)
+ {
+ return toAjax(ecDeviceService.insertEcDevice(ecDevice));
+ }
+
+ /**
+ * 修改设备(手机设备)
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-device:edit')")
+ @Log(title = "设备(手机设备)", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody EcDevice ecDevice)
+ {
+ return toAjax(ecDeviceService.updateEcDevice(ecDevice));
+ }
+
+ /**
+ * 删除设备(手机设备)
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-device:remove')")
+ @Log(title = "设备(手机设备)", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable Long[] ids)
+ {
+ return toAjax(ecDeviceService.deleteEcDeviceByIds(ids));
+ }
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/controller/EcDeviceStatusController.java b/luqj-ec/src/main/java/com/luqj/ec/controller/EcDeviceStatusController.java
new file mode 100644
index 0000000..63ebdf1
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/controller/EcDeviceStatusController.java
@@ -0,0 +1,118 @@
+package com.luqj.ec.controller;
+import com.ruoyi.common.select.Ids;
+import com.ruoyi.common.select.SelectItem;
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.luqj.ec.domain.EcDeviceStatus;
+import com.luqj.ec.domain.EcDeviceStatusPlus;
+import com.luqj.ec.service.IEcDeviceStatusService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 设备心跳 & 状态(高频)Controller
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+@RestController
+@RequestMapping("/ec/ec-device-status")
+public class EcDeviceStatusController extends BaseController
+{
+ @Autowired
+ private IEcDeviceStatusService ecDeviceStatusService;
+ @PreAuthorize("@ss.hasPermi('ec:ec-device-status:getByIds')")
+ @PostMapping("/getByIds")
+ public AjaxResult getByIds(@RequestBody Ids ids)
+ {
+ List list = ecDeviceStatusService.getByIds(ids.getLongIds(),EcDeviceStatusPlus::getDeviceId,EcDeviceStatusPlus::getId);
+ return AjaxResult.success(list);
+ }
+ @PreAuthorize("@ss.hasPermi('ec:ec-device-status:select')")
+ @GetMapping("/select")
+ public AjaxResult select(String keyword)
+ {
+ List list = ecDeviceStatusService.select(keyword);
+ return AjaxResult.success(list);
+ }
+ /**
+ * 查询设备心跳 & 状态(高频)列表
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-device-status:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(EcDeviceStatus ecDeviceStatus)
+ {
+ startPage();
+ List list = ecDeviceStatusService.selectEcDeviceStatusList(ecDeviceStatus);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出设备心跳 & 状态(高频)列表
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-device-status:export')")
+ @Log(title = "设备心跳 & 状态(高频)", businessType = BusinessType.EXPORT)
+ @GetMapping("/export")
+ public AjaxResult export(EcDeviceStatus ecDeviceStatus)
+ {
+ List list = ecDeviceStatusService.selectEcDeviceStatusList(ecDeviceStatus);
+ ExcelUtil util = new ExcelUtil(EcDeviceStatus.class);
+ return util.exportExcel(list, "ec-device-status");
+ }
+
+ /**
+ * 获取设备心跳 & 状态(高频)详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-device-status:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") Long id)
+ {
+ return AjaxResult.success(ecDeviceStatusService.selectEcDeviceStatusById(id));
+ }
+
+ /**
+ * 新增设备心跳 & 状态(高频)
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-device-status:add')")
+ @Log(title = "设备心跳 & 状态(高频)", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody EcDeviceStatus ecDeviceStatus)
+ {
+ return toAjax(ecDeviceStatusService.insertEcDeviceStatus(ecDeviceStatus));
+ }
+
+ /**
+ * 修改设备心跳 & 状态(高频)
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-device-status:edit')")
+ @Log(title = "设备心跳 & 状态(高频)", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody EcDeviceStatus ecDeviceStatus)
+ {
+ return toAjax(ecDeviceStatusService.updateEcDeviceStatus(ecDeviceStatus));
+ }
+
+ /**
+ * 删除设备心跳 & 状态(高频)
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-device-status:remove')")
+ @Log(title = "设备心跳 & 状态(高频)", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable Long[] ids)
+ {
+ return toAjax(ecDeviceStatusService.deleteEcDeviceStatusByIds(ids));
+ }
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/controller/EcTaskCommandController.java b/luqj-ec/src/main/java/com/luqj/ec/controller/EcTaskCommandController.java
new file mode 100644
index 0000000..9d822e1
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/controller/EcTaskCommandController.java
@@ -0,0 +1,118 @@
+package com.luqj.ec.controller;
+import com.ruoyi.common.select.Ids;
+import com.ruoyi.common.select.SelectItem;
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.luqj.ec.domain.EcTaskCommand;
+import com.luqj.ec.domain.EcTaskCommandPlus;
+import com.luqj.ec.service.IEcTaskCommandService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 任务指令明细(一个任务多条指令)Controller
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+@RestController
+@RequestMapping("/ec/ec-task-command")
+public class EcTaskCommandController extends BaseController
+{
+ @Autowired
+ private IEcTaskCommandService ecTaskCommandService;
+ @PreAuthorize("@ss.hasPermi('ec:ec-task-command:getByIds')")
+ @PostMapping("/getByIds")
+ public AjaxResult getByIds(@RequestBody Ids ids)
+ {
+ List list = ecTaskCommandService.getByIds(ids.getLongIds(),EcTaskCommandPlus::getCommandType,EcTaskCommandPlus::getId);
+ return AjaxResult.success(list);
+ }
+ @PreAuthorize("@ss.hasPermi('ec:ec-task-command:select')")
+ @GetMapping("/select")
+ public AjaxResult select(String keyword)
+ {
+ List list = ecTaskCommandService.select(keyword);
+ return AjaxResult.success(list);
+ }
+ /**
+ * 查询任务指令明细(一个任务多条指令)列表
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-task-command:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(EcTaskCommand ecTaskCommand)
+ {
+ startPage();
+ List list = ecTaskCommandService.selectEcTaskCommandList(ecTaskCommand);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出任务指令明细(一个任务多条指令)列表
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-task-command:export')")
+ @Log(title = "任务指令明细(一个任务多条指令)", businessType = BusinessType.EXPORT)
+ @GetMapping("/export")
+ public AjaxResult export(EcTaskCommand ecTaskCommand)
+ {
+ List list = ecTaskCommandService.selectEcTaskCommandList(ecTaskCommand);
+ ExcelUtil util = new ExcelUtil(EcTaskCommand.class);
+ return util.exportExcel(list, "ec-task-command");
+ }
+
+ /**
+ * 获取任务指令明细(一个任务多条指令)详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-task-command:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") Long id)
+ {
+ return AjaxResult.success(ecTaskCommandService.selectEcTaskCommandById(id));
+ }
+
+ /**
+ * 新增任务指令明细(一个任务多条指令)
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-task-command:add')")
+ @Log(title = "任务指令明细(一个任务多条指令)", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody EcTaskCommand ecTaskCommand)
+ {
+ return toAjax(ecTaskCommandService.insertEcTaskCommand(ecTaskCommand));
+ }
+
+ /**
+ * 修改任务指令明细(一个任务多条指令)
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-task-command:edit')")
+ @Log(title = "任务指令明细(一个任务多条指令)", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody EcTaskCommand ecTaskCommand)
+ {
+ return toAjax(ecTaskCommandService.updateEcTaskCommand(ecTaskCommand));
+ }
+
+ /**
+ * 删除任务指令明细(一个任务多条指令)
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-task-command:remove')")
+ @Log(title = "任务指令明细(一个任务多条指令)", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable Long[] ids)
+ {
+ return toAjax(ecTaskCommandService.deleteEcTaskCommandByIds(ids));
+ }
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/controller/EcTaskDeviceController.java b/luqj-ec/src/main/java/com/luqj/ec/controller/EcTaskDeviceController.java
new file mode 100644
index 0000000..6d2c836
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/controller/EcTaskDeviceController.java
@@ -0,0 +1,118 @@
+package com.luqj.ec.controller;
+import com.ruoyi.common.select.Ids;
+import com.ruoyi.common.select.SelectItem;
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.luqj.ec.domain.EcTaskDevice;
+import com.luqj.ec.domain.EcTaskDevicePlus;
+import com.luqj.ec.service.IEcTaskDeviceService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 任务-设备关联(一任务多设备)Controller
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+@RestController
+@RequestMapping("/ec/ec-task-device")
+public class EcTaskDeviceController extends BaseController
+{
+ @Autowired
+ private IEcTaskDeviceService ecTaskDeviceService;
+ @PreAuthorize("@ss.hasPermi('ec:ec-task-device:getByIds')")
+ @PostMapping("/getByIds")
+ public AjaxResult getByIds(@RequestBody Ids ids)
+ {
+ List list = ecTaskDeviceService.getByIds(ids.getLongIds(),EcTaskDevicePlus::getStatus,EcTaskDevicePlus::getId);
+ return AjaxResult.success(list);
+ }
+ @PreAuthorize("@ss.hasPermi('ec:ec-task-device:select')")
+ @GetMapping("/select")
+ public AjaxResult select(String keyword)
+ {
+ List list = ecTaskDeviceService.select(keyword);
+ return AjaxResult.success(list);
+ }
+ /**
+ * 查询任务-设备关联(一任务多设备)列表
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-task-device:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(EcTaskDevice ecTaskDevice)
+ {
+ startPage();
+ List list = ecTaskDeviceService.selectEcTaskDeviceList(ecTaskDevice);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出任务-设备关联(一任务多设备)列表
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-task-device:export')")
+ @Log(title = "任务-设备关联(一任务多设备)", businessType = BusinessType.EXPORT)
+ @GetMapping("/export")
+ public AjaxResult export(EcTaskDevice ecTaskDevice)
+ {
+ List list = ecTaskDeviceService.selectEcTaskDeviceList(ecTaskDevice);
+ ExcelUtil util = new ExcelUtil(EcTaskDevice.class);
+ return util.exportExcel(list, "ec-task-device");
+ }
+
+ /**
+ * 获取任务-设备关联(一任务多设备)详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-task-device:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") Long id)
+ {
+ return AjaxResult.success(ecTaskDeviceService.selectEcTaskDeviceById(id));
+ }
+
+ /**
+ * 新增任务-设备关联(一任务多设备)
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-task-device:add')")
+ @Log(title = "任务-设备关联(一任务多设备)", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody EcTaskDevice ecTaskDevice)
+ {
+ return toAjax(ecTaskDeviceService.insertEcTaskDevice(ecTaskDevice));
+ }
+
+ /**
+ * 修改任务-设备关联(一任务多设备)
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-task-device:edit')")
+ @Log(title = "任务-设备关联(一任务多设备)", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody EcTaskDevice ecTaskDevice)
+ {
+ return toAjax(ecTaskDeviceService.updateEcTaskDevice(ecTaskDevice));
+ }
+
+ /**
+ * 删除任务-设备关联(一任务多设备)
+ */
+ @PreAuthorize("@ss.hasPermi('ec:ec-task-device:remove')")
+ @Log(title = "任务-设备关联(一任务多设备)", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable Long[] ids)
+ {
+ return toAjax(ecTaskDeviceService.deleteEcTaskDeviceByIds(ids));
+ }
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcCommandResult.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcCommandResult.java
new file mode 100644
index 0000000..2c3820d
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/domain/EcCommandResult.java
@@ -0,0 +1,124 @@
+package com.luqj.ec.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import java.io.Serializable;
+/**
+ * 指令执行结果(客户端回传)对象 ec_command_result
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+public class EcCommandResult extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 主键 */
+ private Long id;
+
+ /** 命令ID */
+ @Excel(name = "命令ID")
+ private Long commandId;
+
+ /** 设备ID */
+ @Excel(name = "设备ID")
+ private Long deviceId;
+
+ /** 返回结果 */
+ @Excel(name = "返回结果")
+ private Integer result;
+
+ /** 错误信息 */
+ @Excel(name = "错误信息")
+ private String errorMsg;
+
+ /** 返回信息 */
+ @Excel(name = "返回信息")
+ private String responseData;
+
+ /** 创建时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date createdAt;
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+ public void setCommandId(Long commandId)
+ {
+ this.commandId = commandId;
+ }
+
+ public Long getCommandId()
+ {
+ return commandId;
+ }
+ public void setDeviceId(Long deviceId)
+ {
+ this.deviceId = deviceId;
+ }
+
+ public Long getDeviceId()
+ {
+ return deviceId;
+ }
+ public void setResult(Integer result)
+ {
+ this.result = result;
+ }
+
+ public Integer getResult()
+ {
+ return result;
+ }
+ public void setErrorMsg(String errorMsg)
+ {
+ this.errorMsg = errorMsg;
+ }
+
+ public String getErrorMsg()
+ {
+ return errorMsg;
+ }
+ public void setResponseData(String responseData)
+ {
+ this.responseData = responseData;
+ }
+
+ public String getResponseData()
+ {
+ return responseData;
+ }
+ public void setCreatedAt(Date createdAt)
+ {
+ this.createdAt = createdAt;
+ }
+
+ public Date getCreatedAt()
+ {
+ return createdAt;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("commandId", getCommandId())
+ .append("deviceId", getDeviceId())
+ .append("result", getResult())
+ .append("errorMsg", getErrorMsg())
+ .append("responseData", getResponseData())
+ .append("createdAt", getCreatedAt())
+ .toString();
+ }
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcCommandResultPlus.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcCommandResultPlus.java
new file mode 100644
index 0000000..0e2b03b
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/domain/EcCommandResultPlus.java
@@ -0,0 +1,120 @@
+package com.luqj.ec.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.TableName;
+/**
+ * 指令执行结果(客户端回传)对象 ec_command_result
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+@TableName(value = "ec_command_result")
+public class EcCommandResultPlus implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 主键 */
+ private Long id;
+ /** 命令ID */
+ @Excel(name = "命令ID")
+ private Long commandId;
+ /** 设备ID */
+ @Excel(name = "设备ID")
+ private Long deviceId;
+ /** 返回结果 */
+ @Excel(name = "返回结果")
+ private Integer result;
+ /** 错误信息 */
+ @Excel(name = "错误信息")
+ private String errorMsg;
+ /** 返回信息 */
+ @Excel(name = "返回信息")
+ private String responseData;
+ /** 创建时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date createdAt;
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+ public void setCommandId(Long commandId)
+ {
+ this.commandId = commandId;
+ }
+
+ public Long getCommandId()
+ {
+ return commandId;
+ }
+ public void setDeviceId(Long deviceId)
+ {
+ this.deviceId = deviceId;
+ }
+
+ public Long getDeviceId()
+ {
+ return deviceId;
+ }
+ public void setResult(Integer result)
+ {
+ this.result = result;
+ }
+
+ public Integer getResult()
+ {
+ return result;
+ }
+ public void setErrorMsg(String errorMsg)
+ {
+ this.errorMsg = errorMsg;
+ }
+
+ public String getErrorMsg()
+ {
+ return errorMsg;
+ }
+ public void setResponseData(String responseData)
+ {
+ this.responseData = responseData;
+ }
+
+ public String getResponseData()
+ {
+ return responseData;
+ }
+ public void setCreatedAt(Date createdAt)
+ {
+ this.createdAt = createdAt;
+ }
+
+ public Date getCreatedAt()
+ {
+ return createdAt;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("commandId", getCommandId())
+ .append("deviceId", getDeviceId())
+ .append("result", getResult())
+ .append("errorMsg", getErrorMsg())
+ .append("responseData", getResponseData())
+ .append("createdAt", getCreatedAt())
+ .toString();
+ }
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcControlTask.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcControlTask.java
new file mode 100644
index 0000000..ac4a52f
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/domain/EcControlTask.java
@@ -0,0 +1,139 @@
+package com.luqj.ec.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import java.io.Serializable;
+/**
+ * 任务(群控核心)对象 ec_control_task
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+public class EcControlTask extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 主键 */
+ private Long id;
+
+ /** 任务名称 */
+ @Excel(name = "任务名称")
+ private String taskName;
+
+ /** 任务类型 */
+ @Excel(name = "任务类型")
+ private Integer taskType;
+
+ /** 用户ID */
+ @Excel(name = "用户ID")
+ private Long userId;
+
+ /** 状态 */
+ @Excel(name = "状态")
+ private Integer status;
+
+ /** 创建时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date createdAt;
+
+ /** 更新时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date updatedAt;
+
+ /** 应用ID */
+ @Excel(name = "应用ID")
+ private Long appId;
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+ public void setTaskName(String taskName)
+ {
+ this.taskName = taskName;
+ }
+
+ public String getTaskName()
+ {
+ return taskName;
+ }
+ public void setTaskType(Integer taskType)
+ {
+ this.taskType = taskType;
+ }
+
+ public Integer getTaskType()
+ {
+ return taskType;
+ }
+ public void setUserId(Long userId)
+ {
+ this.userId = userId;
+ }
+
+ public Long getUserId()
+ {
+ return userId;
+ }
+ public void setStatus(Integer status)
+ {
+ this.status = status;
+ }
+
+ public Integer getStatus()
+ {
+ return status;
+ }
+ public void setCreatedAt(Date createdAt)
+ {
+ this.createdAt = createdAt;
+ }
+
+ public Date getCreatedAt()
+ {
+ return createdAt;
+ }
+ public void setUpdatedAt(Date updatedAt)
+ {
+ this.updatedAt = updatedAt;
+ }
+
+ public Date getUpdatedAt()
+ {
+ return updatedAt;
+ }
+ public void setAppId(Long appId)
+ {
+ this.appId = appId;
+ }
+
+ public Long getAppId()
+ {
+ return appId;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("taskName", getTaskName())
+ .append("taskType", getTaskType())
+ .append("userId", getUserId())
+ .append("status", getStatus())
+ .append("createdAt", getCreatedAt())
+ .append("updatedAt", getUpdatedAt())
+ .append("appId", getAppId())
+ .toString();
+ }
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcControlTaskPlus.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcControlTaskPlus.java
new file mode 100644
index 0000000..9b87bae
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/domain/EcControlTaskPlus.java
@@ -0,0 +1,134 @@
+package com.luqj.ec.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.TableName;
+/**
+ * 任务(群控核心)对象 ec_control_task
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+@TableName(value = "ec_control_task")
+public class EcControlTaskPlus implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 主键 */
+ private Long id;
+ /** 任务名称 */
+ @Excel(name = "任务名称")
+ private String taskName;
+ /** 任务类型 */
+ @Excel(name = "任务类型")
+ private Integer taskType;
+ /** 用户ID */
+ @Excel(name = "用户ID")
+ private Long userId;
+ /** 状态 */
+ @Excel(name = "状态")
+ private Integer status;
+ /** 创建时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date createdAt;
+ /** 更新时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date updatedAt;
+ /** 应用ID */
+ @Excel(name = "应用ID")
+ private Long appId;
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+ public void setTaskName(String taskName)
+ {
+ this.taskName = taskName;
+ }
+
+ public String getTaskName()
+ {
+ return taskName;
+ }
+ public void setTaskType(Integer taskType)
+ {
+ this.taskType = taskType;
+ }
+
+ public Integer getTaskType()
+ {
+ return taskType;
+ }
+ public void setUserId(Long userId)
+ {
+ this.userId = userId;
+ }
+
+ public Long getUserId()
+ {
+ return userId;
+ }
+ public void setStatus(Integer status)
+ {
+ this.status = status;
+ }
+
+ public Integer getStatus()
+ {
+ return status;
+ }
+ public void setCreatedAt(Date createdAt)
+ {
+ this.createdAt = createdAt;
+ }
+
+ public Date getCreatedAt()
+ {
+ return createdAt;
+ }
+ public void setUpdatedAt(Date updatedAt)
+ {
+ this.updatedAt = updatedAt;
+ }
+
+ public Date getUpdatedAt()
+ {
+ return updatedAt;
+ }
+ public void setAppId(Long appId)
+ {
+ this.appId = appId;
+ }
+
+ public Long getAppId()
+ {
+ return appId;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("taskName", getTaskName())
+ .append("taskType", getTaskType())
+ .append("userId", getUserId())
+ .append("status", getStatus())
+ .append("createdAt", getCreatedAt())
+ .append("updatedAt", getUpdatedAt())
+ .append("appId", getAppId())
+ .toString();
+ }
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcDevice.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcDevice.java
new file mode 100644
index 0000000..e2a9f31
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/domain/EcDevice.java
@@ -0,0 +1,292 @@
+package com.luqj.ec.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import java.io.Serializable;
+/**
+ * 设备(手机设备)对象 ec_device
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+public class EcDevice extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 主键 */
+ private Long id;
+
+ /** 设备唯一标识 */
+ @Excel(name = "设备唯一标识")
+ private String deviceCode;
+
+ /** 品牌 */
+ @Excel(name = "品牌")
+ private String brand;
+
+ /** 模型 */
+ @Excel(name = "模型")
+ private String model;
+
+ /** 系统类型 */
+ @Excel(name = "系统类型")
+ private String osType;
+
+ /** 系统版本 */
+ @Excel(name = "系统版本")
+ private String osVersion;
+
+ /** 版本 */
+ @Excel(name = "版本")
+ private String appVersion;
+
+ /** 状态 */
+ @Excel(name = "状态")
+ private Integer status;
+
+ /** 最后在线时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "最后在线时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date lastOnlineTime;
+
+ /** 创建时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date createdAt;
+
+ /** 更新时间 */
+ private Date updatedAt;
+
+ /** ip地址 */
+ @Excel(name = "ip地址")
+ private String ipAddress;
+
+ /** 最后截图 */
+ @Excel(name = "最后截图")
+ private String lastScreenPic;
+
+ /** 宽度 */
+ @Excel(name = "宽度")
+ private Integer widthNum;
+
+ /** 高度 */
+ @Excel(name = "高度")
+ private Integer heightNum;
+
+ /** 控制类型 */
+ @Excel(name = "控制类型")
+ private Integer controlType;
+
+ /** 应用ID */
+ @Excel(name = "应用ID")
+ private Long appId;
+
+ /** 用户ID */
+ @Excel(name = "用户ID")
+ private Long userId;
+
+ /** 密钥 */
+ @Excel(name = "密钥")
+ private String secretKey;
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+ public void setDeviceCode(String deviceCode)
+ {
+ this.deviceCode = deviceCode;
+ }
+
+ public String getDeviceCode()
+ {
+ return deviceCode;
+ }
+ public void setBrand(String brand)
+ {
+ this.brand = brand;
+ }
+
+ public String getBrand()
+ {
+ return brand;
+ }
+ public void setModel(String model)
+ {
+ this.model = model;
+ }
+
+ public String getModel()
+ {
+ return model;
+ }
+ public void setOsType(String osType)
+ {
+ this.osType = osType;
+ }
+
+ public String getOsType()
+ {
+ return osType;
+ }
+ public void setOsVersion(String osVersion)
+ {
+ this.osVersion = osVersion;
+ }
+
+ public String getOsVersion()
+ {
+ return osVersion;
+ }
+ public void setAppVersion(String appVersion)
+ {
+ this.appVersion = appVersion;
+ }
+
+ public String getAppVersion()
+ {
+ return appVersion;
+ }
+ public void setStatus(Integer status)
+ {
+ this.status = status;
+ }
+
+ public Integer getStatus()
+ {
+ return status;
+ }
+ public void setLastOnlineTime(Date lastOnlineTime)
+ {
+ this.lastOnlineTime = lastOnlineTime;
+ }
+
+ public Date getLastOnlineTime()
+ {
+ return lastOnlineTime;
+ }
+ public void setCreatedAt(Date createdAt)
+ {
+ this.createdAt = createdAt;
+ }
+
+ public Date getCreatedAt()
+ {
+ return createdAt;
+ }
+ public void setUpdatedAt(Date updatedAt)
+ {
+ this.updatedAt = updatedAt;
+ }
+
+ public Date getUpdatedAt()
+ {
+ return updatedAt;
+ }
+ public void setIpAddress(String ipAddress)
+ {
+ this.ipAddress = ipAddress;
+ }
+
+ public String getIpAddress()
+ {
+ return ipAddress;
+ }
+ public void setLastScreenPic(String lastScreenPic)
+ {
+ this.lastScreenPic = lastScreenPic;
+ }
+
+ public String getLastScreenPic()
+ {
+ return lastScreenPic;
+ }
+ public void setWidthNum(Integer widthNum)
+ {
+ this.widthNum = widthNum;
+ }
+
+ public Integer getWidthNum()
+ {
+ return widthNum;
+ }
+ public void setHeightNum(Integer heightNum)
+ {
+ this.heightNum = heightNum;
+ }
+
+ public Integer getHeightNum()
+ {
+ return heightNum;
+ }
+ public void setControlType(Integer controlType)
+ {
+ this.controlType = controlType;
+ }
+
+ public Integer getControlType()
+ {
+ return controlType;
+ }
+ public void setAppId(Long appId)
+ {
+ this.appId = appId;
+ }
+
+ public Long getAppId()
+ {
+ return appId;
+ }
+ public void setUserId(Long userId)
+ {
+ this.userId = userId;
+ }
+
+ public Long getUserId()
+ {
+ return userId;
+ }
+ public void setSecretKey(String secretKey)
+ {
+ this.secretKey = secretKey;
+ }
+
+ public String getSecretKey()
+ {
+ return secretKey;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("deviceCode", getDeviceCode())
+ .append("brand", getBrand())
+ .append("model", getModel())
+ .append("osType", getOsType())
+ .append("osVersion", getOsVersion())
+ .append("appVersion", getAppVersion())
+ .append("status", getStatus())
+ .append("lastOnlineTime", getLastOnlineTime())
+ .append("createdAt", getCreatedAt())
+ .append("updatedAt", getUpdatedAt())
+ .append("ipAddress", getIpAddress())
+ .append("lastScreenPic", getLastScreenPic())
+ .append("widthNum", getWidthNum())
+ .append("heightNum", getHeightNum())
+ .append("controlType", getControlType())
+ .append("appId", getAppId())
+ .append("userId", getUserId())
+ .append("secretKey", getSecretKey())
+ .toString();
+ }
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceCommand.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceCommand.java
new file mode 100644
index 0000000..dce8466
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceCommand.java
@@ -0,0 +1,140 @@
+package com.luqj.ec.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import java.io.Serializable;
+/**
+ * 控制指令(单条指令)对象 ec_device_command
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+public class EcDeviceCommand extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 主键 */
+ private Long id;
+
+ /** 设备ID */
+ @Excel(name = "设备ID")
+ private Long deviceId;
+
+ /** 命令类型 */
+ @Excel(name = "命令类型")
+ private String commandType;
+
+ /** 指令参数 */
+ @Excel(name = "指令参数")
+ private String commandContent;
+
+ /** 状态 */
+ @Excel(name = "状态")
+ private Integer status;
+
+ /** 发送时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "发送时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date sendTime;
+
+ /** 执行时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "执行时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date executeTime;
+
+ /** 完成时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date finishTime;
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+ public void setDeviceId(Long deviceId)
+ {
+ this.deviceId = deviceId;
+ }
+
+ public Long getDeviceId()
+ {
+ return deviceId;
+ }
+ public void setCommandType(String commandType)
+ {
+ this.commandType = commandType;
+ }
+
+ public String getCommandType()
+ {
+ return commandType;
+ }
+ public void setCommandContent(String commandContent)
+ {
+ this.commandContent = commandContent;
+ }
+
+ public String getCommandContent()
+ {
+ return commandContent;
+ }
+ public void setStatus(Integer status)
+ {
+ this.status = status;
+ }
+
+ public Integer getStatus()
+ {
+ return status;
+ }
+ public void setSendTime(Date sendTime)
+ {
+ this.sendTime = sendTime;
+ }
+
+ public Date getSendTime()
+ {
+ return sendTime;
+ }
+ public void setExecuteTime(Date executeTime)
+ {
+ this.executeTime = executeTime;
+ }
+
+ public Date getExecuteTime()
+ {
+ return executeTime;
+ }
+ public void setFinishTime(Date finishTime)
+ {
+ this.finishTime = finishTime;
+ }
+
+ public Date getFinishTime()
+ {
+ return finishTime;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("deviceId", getDeviceId())
+ .append("commandType", getCommandType())
+ .append("commandContent", getCommandContent())
+ .append("status", getStatus())
+ .append("sendTime", getSendTime())
+ .append("executeTime", getExecuteTime())
+ .append("finishTime", getFinishTime())
+ .toString();
+ }
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceCommandPlus.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceCommandPlus.java
new file mode 100644
index 0000000..0bfc024
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceCommandPlus.java
@@ -0,0 +1,135 @@
+package com.luqj.ec.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.TableName;
+/**
+ * 控制指令(单条指令)对象 ec_device_command
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+@TableName(value = "ec_device_command")
+public class EcDeviceCommandPlus implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 主键 */
+ private Long id;
+ /** 设备ID */
+ @Excel(name = "设备ID")
+ private Long deviceId;
+ /** 命令类型 */
+ @Excel(name = "命令类型")
+ private String commandType;
+ /** 指令参数 */
+ @Excel(name = "指令参数")
+ private String commandContent;
+ /** 状态 */
+ @Excel(name = "状态")
+ private Integer status;
+ /** 发送时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "发送时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date sendTime;
+ /** 执行时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "执行时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date executeTime;
+ /** 完成时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date finishTime;
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+ public void setDeviceId(Long deviceId)
+ {
+ this.deviceId = deviceId;
+ }
+
+ public Long getDeviceId()
+ {
+ return deviceId;
+ }
+ public void setCommandType(String commandType)
+ {
+ this.commandType = commandType;
+ }
+
+ public String getCommandType()
+ {
+ return commandType;
+ }
+ public void setCommandContent(String commandContent)
+ {
+ this.commandContent = commandContent;
+ }
+
+ public String getCommandContent()
+ {
+ return commandContent;
+ }
+ public void setStatus(Integer status)
+ {
+ this.status = status;
+ }
+
+ public Integer getStatus()
+ {
+ return status;
+ }
+ public void setSendTime(Date sendTime)
+ {
+ this.sendTime = sendTime;
+ }
+
+ public Date getSendTime()
+ {
+ return sendTime;
+ }
+ public void setExecuteTime(Date executeTime)
+ {
+ this.executeTime = executeTime;
+ }
+
+ public Date getExecuteTime()
+ {
+ return executeTime;
+ }
+ public void setFinishTime(Date finishTime)
+ {
+ this.finishTime = finishTime;
+ }
+
+ public Date getFinishTime()
+ {
+ return finishTime;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("deviceId", getDeviceId())
+ .append("commandType", getCommandType())
+ .append("commandContent", getCommandContent())
+ .append("status", getStatus())
+ .append("sendTime", getSendTime())
+ .append("executeTime", getExecuteTime())
+ .append("finishTime", getFinishTime())
+ .toString();
+ }
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcDevicePlus.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcDevicePlus.java
new file mode 100644
index 0000000..f514dd2
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/domain/EcDevicePlus.java
@@ -0,0 +1,276 @@
+package com.luqj.ec.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.TableName;
+/**
+ * 设备(手机设备)对象 ec_device
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+@TableName(value = "ec_device")
+public class EcDevicePlus implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 主键 */
+ private Long id;
+ /** 设备唯一标识 */
+ @Excel(name = "设备唯一标识")
+ private String deviceCode;
+ /** 品牌 */
+ @Excel(name = "品牌")
+ private String brand;
+ /** 模型 */
+ @Excel(name = "模型")
+ private String model;
+ /** 系统类型 */
+ @Excel(name = "系统类型")
+ private String osType;
+ /** 系统版本 */
+ @Excel(name = "系统版本")
+ private String osVersion;
+ /** 版本 */
+ @Excel(name = "版本")
+ private String appVersion;
+ /** 状态 */
+ @Excel(name = "状态")
+ private Integer status;
+ /** 最后在线时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "最后在线时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date lastOnlineTime;
+ /** 创建时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date createdAt;
+ /** 更新时间 */
+ private Date updatedAt;
+ /** ip地址 */
+ @Excel(name = "ip地址")
+ private String ipAddress;
+ /** 最后截图 */
+ @Excel(name = "最后截图")
+ private String lastScreenPic;
+ /** 宽度 */
+ @Excel(name = "宽度")
+ private Integer widthNum;
+ /** 高度 */
+ @Excel(name = "高度")
+ private Integer heightNum;
+ /** 控制类型 */
+ @Excel(name = "控制类型")
+ private Integer controlType;
+ /** 应用ID */
+ @Excel(name = "应用ID")
+ private Long appId;
+ /** 用户ID */
+ @Excel(name = "用户ID")
+ private Long userId;
+ /** 密钥 */
+ @Excel(name = "密钥")
+ private String secretKey;
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+ public void setDeviceCode(String deviceCode)
+ {
+ this.deviceCode = deviceCode;
+ }
+
+ public String getDeviceCode()
+ {
+ return deviceCode;
+ }
+ public void setBrand(String brand)
+ {
+ this.brand = brand;
+ }
+
+ public String getBrand()
+ {
+ return brand;
+ }
+ public void setModel(String model)
+ {
+ this.model = model;
+ }
+
+ public String getModel()
+ {
+ return model;
+ }
+ public void setOsType(String osType)
+ {
+ this.osType = osType;
+ }
+
+ public String getOsType()
+ {
+ return osType;
+ }
+ public void setOsVersion(String osVersion)
+ {
+ this.osVersion = osVersion;
+ }
+
+ public String getOsVersion()
+ {
+ return osVersion;
+ }
+ public void setAppVersion(String appVersion)
+ {
+ this.appVersion = appVersion;
+ }
+
+ public String getAppVersion()
+ {
+ return appVersion;
+ }
+ public void setStatus(Integer status)
+ {
+ this.status = status;
+ }
+
+ public Integer getStatus()
+ {
+ return status;
+ }
+ public void setLastOnlineTime(Date lastOnlineTime)
+ {
+ this.lastOnlineTime = lastOnlineTime;
+ }
+
+ public Date getLastOnlineTime()
+ {
+ return lastOnlineTime;
+ }
+ public void setCreatedAt(Date createdAt)
+ {
+ this.createdAt = createdAt;
+ }
+
+ public Date getCreatedAt()
+ {
+ return createdAt;
+ }
+ public void setUpdatedAt(Date updatedAt)
+ {
+ this.updatedAt = updatedAt;
+ }
+
+ public Date getUpdatedAt()
+ {
+ return updatedAt;
+ }
+ public void setIpAddress(String ipAddress)
+ {
+ this.ipAddress = ipAddress;
+ }
+
+ public String getIpAddress()
+ {
+ return ipAddress;
+ }
+ public void setLastScreenPic(String lastScreenPic)
+ {
+ this.lastScreenPic = lastScreenPic;
+ }
+
+ public String getLastScreenPic()
+ {
+ return lastScreenPic;
+ }
+ public void setWidthNum(Integer widthNum)
+ {
+ this.widthNum = widthNum;
+ }
+
+ public Integer getWidthNum()
+ {
+ return widthNum;
+ }
+ public void setHeightNum(Integer heightNum)
+ {
+ this.heightNum = heightNum;
+ }
+
+ public Integer getHeightNum()
+ {
+ return heightNum;
+ }
+ public void setControlType(Integer controlType)
+ {
+ this.controlType = controlType;
+ }
+
+ public Integer getControlType()
+ {
+ return controlType;
+ }
+ public void setAppId(Long appId)
+ {
+ this.appId = appId;
+ }
+
+ public Long getAppId()
+ {
+ return appId;
+ }
+ public void setUserId(Long userId)
+ {
+ this.userId = userId;
+ }
+
+ public Long getUserId()
+ {
+ return userId;
+ }
+ public void setSecretKey(String secretKey)
+ {
+ this.secretKey = secretKey;
+ }
+
+ public String getSecretKey()
+ {
+ return secretKey;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("deviceCode", getDeviceCode())
+ .append("brand", getBrand())
+ .append("model", getModel())
+ .append("osType", getOsType())
+ .append("osVersion", getOsVersion())
+ .append("appVersion", getAppVersion())
+ .append("status", getStatus())
+ .append("lastOnlineTime", getLastOnlineTime())
+ .append("createdAt", getCreatedAt())
+ .append("updatedAt", getUpdatedAt())
+ .append("ipAddress", getIpAddress())
+ .append("lastScreenPic", getLastScreenPic())
+ .append("widthNum", getWidthNum())
+ .append("heightNum", getHeightNum())
+ .append("controlType", getControlType())
+ .append("appId", getAppId())
+ .append("userId", getUserId())
+ .append("secretKey", getSecretKey())
+ .toString();
+ }
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceStatus.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceStatus.java
new file mode 100644
index 0000000..b4153fc
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceStatus.java
@@ -0,0 +1,154 @@
+package com.luqj.ec.domain;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import java.io.Serializable;
+/**
+ * 设备心跳 & 状态(高频)对象 ec_device_status
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+public class EcDeviceStatus extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 主键 */
+ private Long id;
+
+ /** 设备ID */
+ @Excel(name = "设备ID")
+ private Long deviceId;
+
+ /** 电量百分比 */
+ @Excel(name = "电量百分比")
+ private Long battery;
+
+ /** 网络类型 */
+ @Excel(name = "网络类型")
+ private String networkType;
+
+ /** cpu状态 */
+ @Excel(name = "cpu状态")
+ private BigDecimal cpuUsage;
+
+ /** 内存状态 */
+ @Excel(name = "内存状态")
+ private BigDecimal memoryUsage;
+
+ /** 屏幕状态 */
+ @Excel(name = "屏幕状态")
+ private Integer screenOn;
+
+ /** 创建时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date createdAt;
+
+ /** 创建时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date updatedAt;
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+ public void setDeviceId(Long deviceId)
+ {
+ this.deviceId = deviceId;
+ }
+
+ public Long getDeviceId()
+ {
+ return deviceId;
+ }
+ public void setBattery(Long battery)
+ {
+ this.battery = battery;
+ }
+
+ public Long getBattery()
+ {
+ return battery;
+ }
+ public void setNetworkType(String networkType)
+ {
+ this.networkType = networkType;
+ }
+
+ public String getNetworkType()
+ {
+ return networkType;
+ }
+ public void setCpuUsage(BigDecimal cpuUsage)
+ {
+ this.cpuUsage = cpuUsage;
+ }
+
+ public BigDecimal getCpuUsage()
+ {
+ return cpuUsage;
+ }
+ public void setMemoryUsage(BigDecimal memoryUsage)
+ {
+ this.memoryUsage = memoryUsage;
+ }
+
+ public BigDecimal getMemoryUsage()
+ {
+ return memoryUsage;
+ }
+ public void setScreenOn(Integer screenOn)
+ {
+ this.screenOn = screenOn;
+ }
+
+ public Integer getScreenOn()
+ {
+ return screenOn;
+ }
+ public void setCreatedAt(Date createdAt)
+ {
+ this.createdAt = createdAt;
+ }
+
+ public Date getCreatedAt()
+ {
+ return createdAt;
+ }
+ public void setUpdatedAt(Date updatedAt)
+ {
+ this.updatedAt = updatedAt;
+ }
+
+ public Date getUpdatedAt()
+ {
+ return updatedAt;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("deviceId", getDeviceId())
+ .append("battery", getBattery())
+ .append("networkType", getNetworkType())
+ .append("cpuUsage", getCpuUsage())
+ .append("memoryUsage", getMemoryUsage())
+ .append("screenOn", getScreenOn())
+ .append("createdAt", getCreatedAt())
+ .append("updatedAt", getUpdatedAt())
+ .toString();
+ }
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceStatusPlus.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceStatusPlus.java
new file mode 100644
index 0000000..74bf91e
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceStatusPlus.java
@@ -0,0 +1,148 @@
+package com.luqj.ec.domain;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.TableName;
+/**
+ * 设备心跳 & 状态(高频)对象 ec_device_status
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+@TableName(value = "ec_device_status")
+public class EcDeviceStatusPlus implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 主键 */
+ private Long id;
+ /** 设备ID */
+ @Excel(name = "设备ID")
+ private Long deviceId;
+ /** 电量百分比 */
+ @Excel(name = "电量百分比")
+ private Long battery;
+ /** 网络类型 */
+ @Excel(name = "网络类型")
+ private String networkType;
+ /** cpu状态 */
+ @Excel(name = "cpu状态")
+ private BigDecimal cpuUsage;
+ /** 内存状态 */
+ @Excel(name = "内存状态")
+ private BigDecimal memoryUsage;
+ /** 屏幕状态 */
+ @Excel(name = "屏幕状态")
+ private Integer screenOn;
+ /** 创建时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date createdAt;
+ /** 创建时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date updatedAt;
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+ public void setDeviceId(Long deviceId)
+ {
+ this.deviceId = deviceId;
+ }
+
+ public Long getDeviceId()
+ {
+ return deviceId;
+ }
+ public void setBattery(Long battery)
+ {
+ this.battery = battery;
+ }
+
+ public Long getBattery()
+ {
+ return battery;
+ }
+ public void setNetworkType(String networkType)
+ {
+ this.networkType = networkType;
+ }
+
+ public String getNetworkType()
+ {
+ return networkType;
+ }
+ public void setCpuUsage(BigDecimal cpuUsage)
+ {
+ this.cpuUsage = cpuUsage;
+ }
+
+ public BigDecimal getCpuUsage()
+ {
+ return cpuUsage;
+ }
+ public void setMemoryUsage(BigDecimal memoryUsage)
+ {
+ this.memoryUsage = memoryUsage;
+ }
+
+ public BigDecimal getMemoryUsage()
+ {
+ return memoryUsage;
+ }
+ public void setScreenOn(Integer screenOn)
+ {
+ this.screenOn = screenOn;
+ }
+
+ public Integer getScreenOn()
+ {
+ return screenOn;
+ }
+ public void setCreatedAt(Date createdAt)
+ {
+ this.createdAt = createdAt;
+ }
+
+ public Date getCreatedAt()
+ {
+ return createdAt;
+ }
+ public void setUpdatedAt(Date updatedAt)
+ {
+ this.updatedAt = updatedAt;
+ }
+
+ public Date getUpdatedAt()
+ {
+ return updatedAt;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("deviceId", getDeviceId())
+ .append("battery", getBattery())
+ .append("networkType", getNetworkType())
+ .append("cpuUsage", getCpuUsage())
+ .append("memoryUsage", getMemoryUsage())
+ .append("screenOn", getScreenOn())
+ .append("createdAt", getCreatedAt())
+ .append("updatedAt", getUpdatedAt())
+ .toString();
+ }
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskCommand.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskCommand.java
new file mode 100644
index 0000000..347503b
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskCommand.java
@@ -0,0 +1,93 @@
+package com.luqj.ec.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import java.io.Serializable;
+/**
+ * 任务指令明细(一个任务多条指令)对象 ec_task_command
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+public class EcTaskCommand extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 主键 */
+ private Long id;
+
+ /** 任务ID */
+ @Excel(name = "任务ID")
+ private Long taskId;
+
+ /** 执行顺序 */
+ @Excel(name = "执行顺序")
+ private Long stepOrder;
+
+ /** 指令类型 */
+ @Excel(name = "指令类型")
+ private String commandType;
+
+ /** 指令参数 */
+ @Excel(name = "指令参数")
+ private String commandContent;
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+ public void setTaskId(Long taskId)
+ {
+ this.taskId = taskId;
+ }
+
+ public Long getTaskId()
+ {
+ return taskId;
+ }
+ public void setStepOrder(Long stepOrder)
+ {
+ this.stepOrder = stepOrder;
+ }
+
+ public Long getStepOrder()
+ {
+ return stepOrder;
+ }
+ public void setCommandType(String commandType)
+ {
+ this.commandType = commandType;
+ }
+
+ public String getCommandType()
+ {
+ return commandType;
+ }
+ public void setCommandContent(String commandContent)
+ {
+ this.commandContent = commandContent;
+ }
+
+ public String getCommandContent()
+ {
+ return commandContent;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("taskId", getTaskId())
+ .append("stepOrder", getStepOrder())
+ .append("commandType", getCommandType())
+ .append("commandContent", getCommandContent())
+ .toString();
+ }
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskCommandPlus.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskCommandPlus.java
new file mode 100644
index 0000000..3e12620
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskCommandPlus.java
@@ -0,0 +1,91 @@
+package com.luqj.ec.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.TableName;
+/**
+ * 任务指令明细(一个任务多条指令)对象 ec_task_command
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+@TableName(value = "ec_task_command")
+public class EcTaskCommandPlus implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 主键 */
+ private Long id;
+ /** 任务ID */
+ @Excel(name = "任务ID")
+ private Long taskId;
+ /** 执行顺序 */
+ @Excel(name = "执行顺序")
+ private Long stepOrder;
+ /** 指令类型 */
+ @Excel(name = "指令类型")
+ private String commandType;
+ /** 指令参数 */
+ @Excel(name = "指令参数")
+ private String commandContent;
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+ public void setTaskId(Long taskId)
+ {
+ this.taskId = taskId;
+ }
+
+ public Long getTaskId()
+ {
+ return taskId;
+ }
+ public void setStepOrder(Long stepOrder)
+ {
+ this.stepOrder = stepOrder;
+ }
+
+ public Long getStepOrder()
+ {
+ return stepOrder;
+ }
+ public void setCommandType(String commandType)
+ {
+ this.commandType = commandType;
+ }
+
+ public String getCommandType()
+ {
+ return commandType;
+ }
+ public void setCommandContent(String commandContent)
+ {
+ this.commandContent = commandContent;
+ }
+
+ public String getCommandContent()
+ {
+ return commandContent;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("taskId", getTaskId())
+ .append("stepOrder", getStepOrder())
+ .append("commandType", getCommandType())
+ .append("commandContent", getCommandContent())
+ .toString();
+ }
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskDevice.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskDevice.java
new file mode 100644
index 0000000..6e71e5d
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskDevice.java
@@ -0,0 +1,96 @@
+package com.luqj.ec.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import java.io.Serializable;
+/**
+ * 任务-设备关联(一任务多设备)对象 ec_task_device
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+public class EcTaskDevice extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 主键 */
+ private Long id;
+
+ /** 任务ID */
+ @Excel(name = "任务ID")
+ private Long taskId;
+
+ /** 设备ID */
+ @Excel(name = "设备ID")
+ private Long deviceId;
+
+ /** 状态 */
+ @Excel(name = "状态")
+ private Integer status;
+
+ /** 创建时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date updatedAt;
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+ public void setTaskId(Long taskId)
+ {
+ this.taskId = taskId;
+ }
+
+ public Long getTaskId()
+ {
+ return taskId;
+ }
+ public void setDeviceId(Long deviceId)
+ {
+ this.deviceId = deviceId;
+ }
+
+ public Long getDeviceId()
+ {
+ return deviceId;
+ }
+ public void setStatus(Integer status)
+ {
+ this.status = status;
+ }
+
+ public Integer getStatus()
+ {
+ return status;
+ }
+ public void setUpdatedAt(Date updatedAt)
+ {
+ this.updatedAt = updatedAt;
+ }
+
+ public Date getUpdatedAt()
+ {
+ return updatedAt;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("taskId", getTaskId())
+ .append("deviceId", getDeviceId())
+ .append("status", getStatus())
+ .append("updatedAt", getUpdatedAt())
+ .toString();
+ }
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskDevicePlus.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskDevicePlus.java
new file mode 100644
index 0000000..e785951
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskDevicePlus.java
@@ -0,0 +1,94 @@
+package com.luqj.ec.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.TableName;
+/**
+ * 任务-设备关联(一任务多设备)对象 ec_task_device
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+@TableName(value = "ec_task_device")
+public class EcTaskDevicePlus implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 主键 */
+ private Long id;
+ /** 任务ID */
+ @Excel(name = "任务ID")
+ private Long taskId;
+ /** 设备ID */
+ @Excel(name = "设备ID")
+ private Long deviceId;
+ /** 状态 */
+ @Excel(name = "状态")
+ private Integer status;
+ /** 创建时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date updatedAt;
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+ public void setTaskId(Long taskId)
+ {
+ this.taskId = taskId;
+ }
+
+ public Long getTaskId()
+ {
+ return taskId;
+ }
+ public void setDeviceId(Long deviceId)
+ {
+ this.deviceId = deviceId;
+ }
+
+ public Long getDeviceId()
+ {
+ return deviceId;
+ }
+ public void setStatus(Integer status)
+ {
+ this.status = status;
+ }
+
+ public Integer getStatus()
+ {
+ return status;
+ }
+ public void setUpdatedAt(Date updatedAt)
+ {
+ this.updatedAt = updatedAt;
+ }
+
+ public Date getUpdatedAt()
+ {
+ return updatedAt;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("taskId", getTaskId())
+ .append("deviceId", getDeviceId())
+ .append("status", getStatus())
+ .append("updatedAt", getUpdatedAt())
+ .toString();
+ }
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/mapper/EcCommandResultMapper.java b/luqj-ec/src/main/java/com/luqj/ec/mapper/EcCommandResultMapper.java
new file mode 100644
index 0000000..e716bc2
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/mapper/EcCommandResultMapper.java
@@ -0,0 +1,65 @@
+package com.luqj.ec.mapper;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import com.luqj.ec.domain.EcCommandResult;
+import com.luqj.ec.domain.EcCommandResultPlus;
+
+/**
+ * 指令执行结果(客户端回传)Mapper接口
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+public interface EcCommandResultMapper extends BaseMapper
+{
+ /**
+ * 查询指令执行结果(客户端回传)
+ *
+ * @param id 指令执行结果(客户端回传)ID
+ * @return 指令执行结果(客户端回传)
+ */
+ public EcCommandResult selectEcCommandResultById(Long id);
+
+ /**
+ * 查询指令执行结果(客户端回传)列表
+ *
+ * @param ecCommandResult 指令执行结果(客户端回传)
+ * @return 指令执行结果(客户端回传)集合
+ */
+ public List selectEcCommandResultList(EcCommandResult ecCommandResult);
+
+ /**
+ * 新增指令执行结果(客户端回传)
+ *
+ * @param ecCommandResult 指令执行结果(客户端回传)
+ * @return 结果
+ */
+ public int insertEcCommandResult(EcCommandResult ecCommandResult);
+
+ /**
+ * 修改指令执行结果(客户端回传)
+ *
+ * @param ecCommandResult 指令执行结果(客户端回传)
+ * @return 结果
+ */
+ public int updateEcCommandResult(EcCommandResult ecCommandResult);
+
+ /**
+ * 删除指令执行结果(客户端回传)
+ *
+ * @param id 指令执行结果(客户端回传)ID
+ * @return 结果
+ */
+ public int deleteEcCommandResultById(Long id);
+
+ /**
+ * 批量删除指令执行结果(客户端回传)
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ public int deleteEcCommandResultByIds(Long[] ids);
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/mapper/EcControlTaskMapper.java b/luqj-ec/src/main/java/com/luqj/ec/mapper/EcControlTaskMapper.java
new file mode 100644
index 0000000..305d293
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/mapper/EcControlTaskMapper.java
@@ -0,0 +1,65 @@
+package com.luqj.ec.mapper;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import com.luqj.ec.domain.EcControlTask;
+import com.luqj.ec.domain.EcControlTaskPlus;
+
+/**
+ * 任务(群控核心)Mapper接口
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+public interface EcControlTaskMapper extends BaseMapper
+{
+ /**
+ * 查询任务(群控核心)
+ *
+ * @param id 任务(群控核心)ID
+ * @return 任务(群控核心)
+ */
+ public EcControlTask selectEcControlTaskById(Long id);
+
+ /**
+ * 查询任务(群控核心)列表
+ *
+ * @param ecControlTask 任务(群控核心)
+ * @return 任务(群控核心)集合
+ */
+ public List selectEcControlTaskList(EcControlTask ecControlTask);
+
+ /**
+ * 新增任务(群控核心)
+ *
+ * @param ecControlTask 任务(群控核心)
+ * @return 结果
+ */
+ public int insertEcControlTask(EcControlTask ecControlTask);
+
+ /**
+ * 修改任务(群控核心)
+ *
+ * @param ecControlTask 任务(群控核心)
+ * @return 结果
+ */
+ public int updateEcControlTask(EcControlTask ecControlTask);
+
+ /**
+ * 删除任务(群控核心)
+ *
+ * @param id 任务(群控核心)ID
+ * @return 结果
+ */
+ public int deleteEcControlTaskById(Long id);
+
+ /**
+ * 批量删除任务(群控核心)
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ public int deleteEcControlTaskByIds(Long[] ids);
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/mapper/EcDeviceCommandMapper.java b/luqj-ec/src/main/java/com/luqj/ec/mapper/EcDeviceCommandMapper.java
new file mode 100644
index 0000000..403cc4c
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/mapper/EcDeviceCommandMapper.java
@@ -0,0 +1,65 @@
+package com.luqj.ec.mapper;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import com.luqj.ec.domain.EcDeviceCommand;
+import com.luqj.ec.domain.EcDeviceCommandPlus;
+
+/**
+ * 控制指令(单条指令)Mapper接口
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+public interface EcDeviceCommandMapper extends BaseMapper
+{
+ /**
+ * 查询控制指令(单条指令)
+ *
+ * @param id 控制指令(单条指令)ID
+ * @return 控制指令(单条指令)
+ */
+ public EcDeviceCommand selectEcDeviceCommandById(Long id);
+
+ /**
+ * 查询控制指令(单条指令)列表
+ *
+ * @param ecDeviceCommand 控制指令(单条指令)
+ * @return 控制指令(单条指令)集合
+ */
+ public List selectEcDeviceCommandList(EcDeviceCommand ecDeviceCommand);
+
+ /**
+ * 新增控制指令(单条指令)
+ *
+ * @param ecDeviceCommand 控制指令(单条指令)
+ * @return 结果
+ */
+ public int insertEcDeviceCommand(EcDeviceCommand ecDeviceCommand);
+
+ /**
+ * 修改控制指令(单条指令)
+ *
+ * @param ecDeviceCommand 控制指令(单条指令)
+ * @return 结果
+ */
+ public int updateEcDeviceCommand(EcDeviceCommand ecDeviceCommand);
+
+ /**
+ * 删除控制指令(单条指令)
+ *
+ * @param id 控制指令(单条指令)ID
+ * @return 结果
+ */
+ public int deleteEcDeviceCommandById(Long id);
+
+ /**
+ * 批量删除控制指令(单条指令)
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ public int deleteEcDeviceCommandByIds(Long[] ids);
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/mapper/EcDeviceMapper.java b/luqj-ec/src/main/java/com/luqj/ec/mapper/EcDeviceMapper.java
new file mode 100644
index 0000000..1f8712a
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/mapper/EcDeviceMapper.java
@@ -0,0 +1,65 @@
+package com.luqj.ec.mapper;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import com.luqj.ec.domain.EcDevice;
+import com.luqj.ec.domain.EcDevicePlus;
+
+/**
+ * 设备(手机设备)Mapper接口
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+public interface EcDeviceMapper extends BaseMapper
+{
+ /**
+ * 查询设备(手机设备)
+ *
+ * @param id 设备(手机设备)ID
+ * @return 设备(手机设备)
+ */
+ public EcDevice selectEcDeviceById(Long id);
+
+ /**
+ * 查询设备(手机设备)列表
+ *
+ * @param ecDevice 设备(手机设备)
+ * @return 设备(手机设备)集合
+ */
+ public List selectEcDeviceList(EcDevice ecDevice);
+
+ /**
+ * 新增设备(手机设备)
+ *
+ * @param ecDevice 设备(手机设备)
+ * @return 结果
+ */
+ public int insertEcDevice(EcDevice ecDevice);
+
+ /**
+ * 修改设备(手机设备)
+ *
+ * @param ecDevice 设备(手机设备)
+ * @return 结果
+ */
+ public int updateEcDevice(EcDevice ecDevice);
+
+ /**
+ * 删除设备(手机设备)
+ *
+ * @param id 设备(手机设备)ID
+ * @return 结果
+ */
+ public int deleteEcDeviceById(Long id);
+
+ /**
+ * 批量删除设备(手机设备)
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ public int deleteEcDeviceByIds(Long[] ids);
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/mapper/EcDeviceStatusMapper.java b/luqj-ec/src/main/java/com/luqj/ec/mapper/EcDeviceStatusMapper.java
new file mode 100644
index 0000000..b3909a5
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/mapper/EcDeviceStatusMapper.java
@@ -0,0 +1,65 @@
+package com.luqj.ec.mapper;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import com.luqj.ec.domain.EcDeviceStatus;
+import com.luqj.ec.domain.EcDeviceStatusPlus;
+
+/**
+ * 设备心跳 & 状态(高频)Mapper接口
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+public interface EcDeviceStatusMapper extends BaseMapper
+{
+ /**
+ * 查询设备心跳 & 状态(高频)
+ *
+ * @param id 设备心跳 & 状态(高频)ID
+ * @return 设备心跳 & 状态(高频)
+ */
+ public EcDeviceStatus selectEcDeviceStatusById(Long id);
+
+ /**
+ * 查询设备心跳 & 状态(高频)列表
+ *
+ * @param ecDeviceStatus 设备心跳 & 状态(高频)
+ * @return 设备心跳 & 状态(高频)集合
+ */
+ public List selectEcDeviceStatusList(EcDeviceStatus ecDeviceStatus);
+
+ /**
+ * 新增设备心跳 & 状态(高频)
+ *
+ * @param ecDeviceStatus 设备心跳 & 状态(高频)
+ * @return 结果
+ */
+ public int insertEcDeviceStatus(EcDeviceStatus ecDeviceStatus);
+
+ /**
+ * 修改设备心跳 & 状态(高频)
+ *
+ * @param ecDeviceStatus 设备心跳 & 状态(高频)
+ * @return 结果
+ */
+ public int updateEcDeviceStatus(EcDeviceStatus ecDeviceStatus);
+
+ /**
+ * 删除设备心跳 & 状态(高频)
+ *
+ * @param id 设备心跳 & 状态(高频)ID
+ * @return 结果
+ */
+ public int deleteEcDeviceStatusById(Long id);
+
+ /**
+ * 批量删除设备心跳 & 状态(高频)
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ public int deleteEcDeviceStatusByIds(Long[] ids);
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/mapper/EcTaskCommandMapper.java b/luqj-ec/src/main/java/com/luqj/ec/mapper/EcTaskCommandMapper.java
new file mode 100644
index 0000000..1188938
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/mapper/EcTaskCommandMapper.java
@@ -0,0 +1,65 @@
+package com.luqj.ec.mapper;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import com.luqj.ec.domain.EcTaskCommand;
+import com.luqj.ec.domain.EcTaskCommandPlus;
+
+/**
+ * 任务指令明细(一个任务多条指令)Mapper接口
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+public interface EcTaskCommandMapper extends BaseMapper
+{
+ /**
+ * 查询任务指令明细(一个任务多条指令)
+ *
+ * @param id 任务指令明细(一个任务多条指令)ID
+ * @return 任务指令明细(一个任务多条指令)
+ */
+ public EcTaskCommand selectEcTaskCommandById(Long id);
+
+ /**
+ * 查询任务指令明细(一个任务多条指令)列表
+ *
+ * @param ecTaskCommand 任务指令明细(一个任务多条指令)
+ * @return 任务指令明细(一个任务多条指令)集合
+ */
+ public List selectEcTaskCommandList(EcTaskCommand ecTaskCommand);
+
+ /**
+ * 新增任务指令明细(一个任务多条指令)
+ *
+ * @param ecTaskCommand 任务指令明细(一个任务多条指令)
+ * @return 结果
+ */
+ public int insertEcTaskCommand(EcTaskCommand ecTaskCommand);
+
+ /**
+ * 修改任务指令明细(一个任务多条指令)
+ *
+ * @param ecTaskCommand 任务指令明细(一个任务多条指令)
+ * @return 结果
+ */
+ public int updateEcTaskCommand(EcTaskCommand ecTaskCommand);
+
+ /**
+ * 删除任务指令明细(一个任务多条指令)
+ *
+ * @param id 任务指令明细(一个任务多条指令)ID
+ * @return 结果
+ */
+ public int deleteEcTaskCommandById(Long id);
+
+ /**
+ * 批量删除任务指令明细(一个任务多条指令)
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ public int deleteEcTaskCommandByIds(Long[] ids);
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/mapper/EcTaskDeviceMapper.java b/luqj-ec/src/main/java/com/luqj/ec/mapper/EcTaskDeviceMapper.java
new file mode 100644
index 0000000..c99cad0
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/mapper/EcTaskDeviceMapper.java
@@ -0,0 +1,65 @@
+package com.luqj.ec.mapper;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import com.luqj.ec.domain.EcTaskDevice;
+import com.luqj.ec.domain.EcTaskDevicePlus;
+
+/**
+ * 任务-设备关联(一任务多设备)Mapper接口
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+public interface EcTaskDeviceMapper extends BaseMapper
+{
+ /**
+ * 查询任务-设备关联(一任务多设备)
+ *
+ * @param id 任务-设备关联(一任务多设备)ID
+ * @return 任务-设备关联(一任务多设备)
+ */
+ public EcTaskDevice selectEcTaskDeviceById(Long id);
+
+ /**
+ * 查询任务-设备关联(一任务多设备)列表
+ *
+ * @param ecTaskDevice 任务-设备关联(一任务多设备)
+ * @return 任务-设备关联(一任务多设备)集合
+ */
+ public List selectEcTaskDeviceList(EcTaskDevice ecTaskDevice);
+
+ /**
+ * 新增任务-设备关联(一任务多设备)
+ *
+ * @param ecTaskDevice 任务-设备关联(一任务多设备)
+ * @return 结果
+ */
+ public int insertEcTaskDevice(EcTaskDevice ecTaskDevice);
+
+ /**
+ * 修改任务-设备关联(一任务多设备)
+ *
+ * @param ecTaskDevice 任务-设备关联(一任务多设备)
+ * @return 结果
+ */
+ public int updateEcTaskDevice(EcTaskDevice ecTaskDevice);
+
+ /**
+ * 删除任务-设备关联(一任务多设备)
+ *
+ * @param id 任务-设备关联(一任务多设备)ID
+ * @return 结果
+ */
+ public int deleteEcTaskDeviceById(Long id);
+
+ /**
+ * 批量删除任务-设备关联(一任务多设备)
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ public int deleteEcTaskDeviceByIds(Long[] ids);
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/service/IEcCommandResultService.java b/luqj-ec/src/main/java/com/luqj/ec/service/IEcCommandResultService.java
new file mode 100644
index 0000000..25b525c
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/service/IEcCommandResultService.java
@@ -0,0 +1,89 @@
+package com.luqj.ec.service;
+import java.util.Map;
+import java.util.List;
+import com.luqj.ec.domain.EcCommandResult;
+import com.luqj.ec.domain.EcCommandResultPlus;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
+import com.ruoyi.common.select.SelectItem;
+/**
+ * 指令执行结果(客户端回传)Service接口
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+public interface IEcCommandResultService extends IService
+{
+
+ List select(String keyword);
+ /**
+ * 查询指令执行结果(客户端回传)
+ *
+ * @param id 指令执行结果(客户端回传)ID
+ * @return 指令执行结果(客户端回传)
+ */
+ public EcCommandResult selectEcCommandResultById(Long id);
+
+ /**
+ * 查询指令执行结果(客户端回传)列表
+ *
+ * @param ecCommandResult 指令执行结果(客户端回传)
+ * @return 指令执行结果(客户端回传)集合
+ */
+ public List selectEcCommandResultList(EcCommandResult ecCommandResult);
+
+ /**
+ * 新增指令执行结果(客户端回传)
+ *
+ * @param ecCommandResult 指令执行结果(客户端回传)
+ * @return 结果
+ */
+ public int insertEcCommandResult(EcCommandResult ecCommandResult);
+
+ /**
+ * 修改指令执行结果(客户端回传)
+ *
+ * @param ecCommandResult 指令执行结果(客户端回传)
+ * @return 结果
+ */
+ public int updateEcCommandResult(EcCommandResult ecCommandResult);
+
+ /**
+ * 批量删除指令执行结果(客户端回传)
+ *
+ * @param ids 需要删除的指令执行结果(客户端回传)ID
+ * @return 结果
+ */
+ public int deleteEcCommandResultByIds(Long[] ids);
+
+ /**
+ * 删除指令执行结果(客户端回传)信息
+ *
+ * @param id 指令执行结果(客户端回传)ID
+ * @return 结果
+ */
+ public int deleteEcCommandResultById(Long id);
+
+ List getByIds(List ids, SFunction... columns);
+
+ EcCommandResultPlus getById(Long id, SFunction... columns);
+
+ Map getMapByIds(List ids, SFunction... columns);
+
+ List getByIds(List ids);
+
+ Map getMapByIds(List ids);
+
+ /**
+ * @param field sum 字段
+ * @param where 条件
+ * @param tClass 返回类型
+ * @param
+ * @return
+ */
+ T sum(String field, String where, Class tClass);
+
+ Long count(String where);
+
+ List countByGroupBy(String select, String where, String groupby, Class tClass);
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/service/IEcControlTaskService.java b/luqj-ec/src/main/java/com/luqj/ec/service/IEcControlTaskService.java
new file mode 100644
index 0000000..43a8cdc
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/service/IEcControlTaskService.java
@@ -0,0 +1,89 @@
+package com.luqj.ec.service;
+import java.util.Map;
+import java.util.List;
+import com.luqj.ec.domain.EcControlTask;
+import com.luqj.ec.domain.EcControlTaskPlus;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
+import com.ruoyi.common.select.SelectItem;
+/**
+ * 任务(群控核心)Service接口
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+public interface IEcControlTaskService extends IService
+{
+
+ List select(String keyword);
+ /**
+ * 查询任务(群控核心)
+ *
+ * @param id 任务(群控核心)ID
+ * @return 任务(群控核心)
+ */
+ public EcControlTask selectEcControlTaskById(Long id);
+
+ /**
+ * 查询任务(群控核心)列表
+ *
+ * @param ecControlTask 任务(群控核心)
+ * @return 任务(群控核心)集合
+ */
+ public List selectEcControlTaskList(EcControlTask ecControlTask);
+
+ /**
+ * 新增任务(群控核心)
+ *
+ * @param ecControlTask 任务(群控核心)
+ * @return 结果
+ */
+ public int insertEcControlTask(EcControlTask ecControlTask);
+
+ /**
+ * 修改任务(群控核心)
+ *
+ * @param ecControlTask 任务(群控核心)
+ * @return 结果
+ */
+ public int updateEcControlTask(EcControlTask ecControlTask);
+
+ /**
+ * 批量删除任务(群控核心)
+ *
+ * @param ids 需要删除的任务(群控核心)ID
+ * @return 结果
+ */
+ public int deleteEcControlTaskByIds(Long[] ids);
+
+ /**
+ * 删除任务(群控核心)信息
+ *
+ * @param id 任务(群控核心)ID
+ * @return 结果
+ */
+ public int deleteEcControlTaskById(Long id);
+
+ List getByIds(List ids, SFunction... columns);
+
+ EcControlTaskPlus getById(Long id, SFunction... columns);
+
+ Map getMapByIds(List ids, SFunction... columns);
+
+ List getByIds(List ids);
+
+ Map getMapByIds(List ids);
+
+ /**
+ * @param field sum 字段
+ * @param where 条件
+ * @param tClass 返回类型
+ * @param
+ * @return
+ */
+ T sum(String field, String where, Class tClass);
+
+ Long count(String where);
+
+ List countByGroupBy(String select, String where, String groupby, Class tClass);
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/service/IEcDeviceCommandService.java b/luqj-ec/src/main/java/com/luqj/ec/service/IEcDeviceCommandService.java
new file mode 100644
index 0000000..837cf6c
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/service/IEcDeviceCommandService.java
@@ -0,0 +1,89 @@
+package com.luqj.ec.service;
+import java.util.Map;
+import java.util.List;
+import com.luqj.ec.domain.EcDeviceCommand;
+import com.luqj.ec.domain.EcDeviceCommandPlus;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
+import com.ruoyi.common.select.SelectItem;
+/**
+ * 控制指令(单条指令)Service接口
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+public interface IEcDeviceCommandService extends IService
+{
+
+ List select(String keyword);
+ /**
+ * 查询控制指令(单条指令)
+ *
+ * @param id 控制指令(单条指令)ID
+ * @return 控制指令(单条指令)
+ */
+ public EcDeviceCommand selectEcDeviceCommandById(Long id);
+
+ /**
+ * 查询控制指令(单条指令)列表
+ *
+ * @param ecDeviceCommand 控制指令(单条指令)
+ * @return 控制指令(单条指令)集合
+ */
+ public List selectEcDeviceCommandList(EcDeviceCommand ecDeviceCommand);
+
+ /**
+ * 新增控制指令(单条指令)
+ *
+ * @param ecDeviceCommand 控制指令(单条指令)
+ * @return 结果
+ */
+ public int insertEcDeviceCommand(EcDeviceCommand ecDeviceCommand);
+
+ /**
+ * 修改控制指令(单条指令)
+ *
+ * @param ecDeviceCommand 控制指令(单条指令)
+ * @return 结果
+ */
+ public int updateEcDeviceCommand(EcDeviceCommand ecDeviceCommand);
+
+ /**
+ * 批量删除控制指令(单条指令)
+ *
+ * @param ids 需要删除的控制指令(单条指令)ID
+ * @return 结果
+ */
+ public int deleteEcDeviceCommandByIds(Long[] ids);
+
+ /**
+ * 删除控制指令(单条指令)信息
+ *
+ * @param id 控制指令(单条指令)ID
+ * @return 结果
+ */
+ public int deleteEcDeviceCommandById(Long id);
+
+ List getByIds(List ids, SFunction... columns);
+
+ EcDeviceCommandPlus getById(Long id, SFunction... columns);
+
+ Map getMapByIds(List ids, SFunction... columns);
+
+ List getByIds(List ids);
+
+ Map getMapByIds(List ids);
+
+ /**
+ * @param field sum 字段
+ * @param where 条件
+ * @param tClass 返回类型
+ * @param
+ * @return
+ */
+ T sum(String field, String where, Class tClass);
+
+ Long count(String where);
+
+ List countByGroupBy(String select, String where, String groupby, Class tClass);
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/service/IEcDeviceService.java b/luqj-ec/src/main/java/com/luqj/ec/service/IEcDeviceService.java
new file mode 100644
index 0000000..6cb8ca4
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/service/IEcDeviceService.java
@@ -0,0 +1,89 @@
+package com.luqj.ec.service;
+import java.util.Map;
+import java.util.List;
+import com.luqj.ec.domain.EcDevice;
+import com.luqj.ec.domain.EcDevicePlus;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
+import com.ruoyi.common.select.SelectItem;
+/**
+ * 设备(手机设备)Service接口
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+public interface IEcDeviceService extends IService
+{
+
+ List select(String keyword);
+ /**
+ * 查询设备(手机设备)
+ *
+ * @param id 设备(手机设备)ID
+ * @return 设备(手机设备)
+ */
+ public EcDevice selectEcDeviceById(Long id);
+
+ /**
+ * 查询设备(手机设备)列表
+ *
+ * @param ecDevice 设备(手机设备)
+ * @return 设备(手机设备)集合
+ */
+ public List selectEcDeviceList(EcDevice ecDevice);
+
+ /**
+ * 新增设备(手机设备)
+ *
+ * @param ecDevice 设备(手机设备)
+ * @return 结果
+ */
+ public int insertEcDevice(EcDevice ecDevice);
+
+ /**
+ * 修改设备(手机设备)
+ *
+ * @param ecDevice 设备(手机设备)
+ * @return 结果
+ */
+ public int updateEcDevice(EcDevice ecDevice);
+
+ /**
+ * 批量删除设备(手机设备)
+ *
+ * @param ids 需要删除的设备(手机设备)ID
+ * @return 结果
+ */
+ public int deleteEcDeviceByIds(Long[] ids);
+
+ /**
+ * 删除设备(手机设备)信息
+ *
+ * @param id 设备(手机设备)ID
+ * @return 结果
+ */
+ public int deleteEcDeviceById(Long id);
+
+ List getByIds(List ids, SFunction... columns);
+
+ EcDevicePlus getById(Long id, SFunction... columns);
+
+ Map getMapByIds(List ids, SFunction... columns);
+
+ List getByIds(List ids);
+
+ Map getMapByIds(List ids);
+
+ /**
+ * @param field sum 字段
+ * @param where 条件
+ * @param tClass 返回类型
+ * @param
+ * @return
+ */
+ T sum(String field, String where, Class tClass);
+
+ Long count(String where);
+
+ List countByGroupBy(String select, String where, String groupby, Class tClass);
+}
diff --git a/luqj-ec/src/main/java/com/luqj/ec/service/IEcDeviceStatusService.java b/luqj-ec/src/main/java/com/luqj/ec/service/IEcDeviceStatusService.java
new file mode 100644
index 0000000..b68c014
--- /dev/null
+++ b/luqj-ec/src/main/java/com/luqj/ec/service/IEcDeviceStatusService.java
@@ -0,0 +1,89 @@
+package com.luqj.ec.service;
+import java.util.Map;
+import java.util.List;
+import com.luqj.ec.domain.EcDeviceStatus;
+import com.luqj.ec.domain.EcDeviceStatusPlus;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
+import com.ruoyi.common.select.SelectItem;
+/**
+ * 设备心跳 & 状态(高频)Service接口
+ *
+ * @author luqj
+ * @date 2026-02-27
+ */
+public interface IEcDeviceStatusService extends IService
+{
+
+ List select(String keyword);
+ /**
+ * 查询设备心跳 & 状态(高频)
+ *
+ * @param id 设备心跳 & 状态(高频)ID
+ * @return 设备心跳 & 状态(高频)
+ */
+ public EcDeviceStatus selectEcDeviceStatusById(Long id);
+
+ /**
+ * 查询设备心跳 & 状态(高频)列表
+ *
+ * @param ecDeviceStatus 设备心跳 & 状态(高频)
+ * @return 设备心跳 & 状态(高频)集合
+ */
+ public List selectEcDeviceStatusList(EcDeviceStatus ecDeviceStatus);
+
+ /**
+ * 新增设备心跳 & 状态(高频)
+ *
+ * @param ecDeviceStatus 设备心跳 & 状态(高频)
+ * @return 结果
+ */
+ public int insertEcDeviceStatus(EcDeviceStatus ecDeviceStatus);
+
+ /**
+ * 修改设备心跳 & 状态(高频)
+ *
+ * @param ecDeviceStatus 设备心跳 & 状态(高频)
+ * @return 结果
+ */
+ public int updateEcDeviceStatus(EcDeviceStatus ecDeviceStatus);
+
+ /**
+ * 批量删除设备心跳 & 状态(高频)
+ *
+ * @param ids 需要删除的设备心跳 & 状态(高频)ID
+ * @return 结果
+ */
+ public int deleteEcDeviceStatusByIds(Long[] ids);
+
+ /**
+ * 删除设备心跳 & 状态(高频)信息
+ *
+ * @param id 设备心跳 & 状态(高频)ID
+ * @return 结果
+ */
+ public int deleteEcDeviceStatusById(Long id);
+
+ List getByIds(List ids, SFunction... columns);
+
+ EcDeviceStatusPlus getById(Long id, SFunction... columns);
+
+ Map getMapByIds(List ids, SFunction