111
This commit is contained in:
1 parent
68a2b4f68c
commit
7cd697187c
308 files changed
+30450
-71
No files matched your search
@@ -20,7 +20,7 @@ public class QiNiuRefreshTokenTask {
|
|||||||
private IQiniuService qiniuService;
|
private IQiniuService qiniuService;
|
||||||
|
|
||||||
// @Scheduled(cron = "0/10 * * * * ?")
|
// @Scheduled(cron = "0/10 * * * * ?")
|
||||||
@Scheduled(cron = "* 0/10 * * * ?")
|
@Scheduled(cron = "0 */10 * * * ?")
|
||||||
public void refreshQiniuToken() {
|
public void refreshQiniuToken() {
|
||||||
qiniuService.refreshQiniuToken();
|
qiniuService.refreshQiniuToken();
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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.
|
||||||
|
*
|
||||||
|
* <p>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.
|
||||||
|
*
|
||||||
|
* <p>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.
|
||||||
|
*
|
||||||
|
* <p>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.
|
||||||
|
*
|
||||||
|
* <p>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).
|
||||||
|
*
|
||||||
|
* <p>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.
|
||||||
|
*
|
||||||
|
* <p>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;
|
||||||
|
}
|
||||||
@@ -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<File> getAllFiles(File dir,boolean filterDir,FileFilter filter){
|
||||||
|
Assert.logic(dir.isDirectory() && dir.canRead(),dir+"必须是目录且可读");
|
||||||
|
List<File> result = new ArrayList<File>();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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}.
|
||||||
|
*
|
||||||
|
* <p>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<K, V> implements MultiValueMap<K, V>, Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 3801124242820219131L;
|
||||||
|
|
||||||
|
private final Map<K, List<V>> targetMap;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new LinkedMultiValueMap that wraps a {@link LinkedHashMap}.
|
||||||
|
*/
|
||||||
|
public LinkedMultiValueMap() {
|
||||||
|
this.targetMap = new LinkedHashMap<K, List<V>>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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<K, List<V>>(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<K, List<V>> otherMap) {
|
||||||
|
this.targetMap = new LinkedHashMap<K, List<V>>(otherMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// MultiValueMap implementation
|
||||||
|
|
||||||
|
public void add(K key, V value) {
|
||||||
|
List<V> values = this.targetMap.get(key);
|
||||||
|
if (values == null) {
|
||||||
|
values = new LinkedList<V>();
|
||||||
|
this.targetMap.put(key, values);
|
||||||
|
}
|
||||||
|
values.add(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public V getFirst(K key) {
|
||||||
|
List<V> values = this.targetMap.get(key);
|
||||||
|
return (values != null ? values.get(0) : null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(K key, V value) {
|
||||||
|
List<V> values = new LinkedList<V>();
|
||||||
|
values.add(value);
|
||||||
|
this.targetMap.put(key, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAll(Map<K, V> values) {
|
||||||
|
for (Entry<K, V> entry : values.entrySet()) {
|
||||||
|
set(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<K, V> toSingleValueMap() {
|
||||||
|
LinkedHashMap<K, V> singleValueMap = new LinkedHashMap<K,V>(this.targetMap.size());
|
||||||
|
for (Entry<K, List<V>> 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<V> get(Object key) {
|
||||||
|
return this.targetMap.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<V> put(K key, List<V> value) {
|
||||||
|
return this.targetMap.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<V> remove(Object key) {
|
||||||
|
return this.targetMap.remove(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void putAll(Map<? extends K, ? extends List<V>> m) {
|
||||||
|
this.targetMap.putAll(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
this.targetMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<K> keySet() {
|
||||||
|
return this.targetMap.keySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<List<V>> values() {
|
||||||
|
return this.targetMap.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<Entry<K, List<V>>> 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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<Double, Integer> sortMapByKey(Map<Double, Integer> map, String direction) {
|
||||||
|
if (map == null || map.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
TreeMap<Double, Integer> sortMap = new TreeMap<Double, Integer>(
|
||||||
|
new MapKeyComparator(direction));
|
||||||
|
|
||||||
|
sortMap.putAll(map);
|
||||||
|
|
||||||
|
return sortMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用 Map按value进行排序
|
||||||
|
* @param oriMap
|
||||||
|
* @param direction
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Map<Double, Integer> sortMapByValue(Map<Double, Integer> oriMap, String direction) {
|
||||||
|
if (oriMap == null || oriMap.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Map<Double, Integer> sortedMap = new LinkedHashMap<Double, Integer>();
|
||||||
|
List<Map.Entry<Double, Integer>> entryList = new ArrayList<Map.Entry<Double, Integer>>(
|
||||||
|
oriMap.entrySet());
|
||||||
|
Collections.sort(entryList, new MapValueComparator(direction));
|
||||||
|
|
||||||
|
Iterator<Map.Entry<Double, Integer>> iter = entryList.iterator();
|
||||||
|
Map.Entry<Double, Integer> 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<Double, Integer> map, int index) {
|
||||||
|
int sumCount = 0;
|
||||||
|
Double result = null;
|
||||||
|
for (Map.Entry<Double, Integer> 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<Double> {
|
||||||
|
|
||||||
|
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<Map.Entry<Double, Integer>> {
|
||||||
|
|
||||||
|
private String direction;
|
||||||
|
|
||||||
|
public MapValueComparator(String direction) {
|
||||||
|
this.direction = direction;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(Map.Entry<Double, Integer> o1, Map.Entry<Double, Integer> 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<Double, Integer> 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<Double, Integer> newMap = sortMapByKey(map, "DESC");
|
||||||
|
System.out.println("after sortByKey:");
|
||||||
|
for (Map.Entry<Double, Integer> 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<Double, Integer> valueMap = sortMapByValue(map, "DESC");
|
||||||
|
System.out.println("---------------------------");
|
||||||
|
System.out.println("after sortByValue:");
|
||||||
|
for (Map.Entry<Double, Integer> 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());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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<K, V> extends Map<K, List<V>> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the first value for the given key.
|
||||||
|
* @param key the key
|
||||||
|
* @return the first value for the specified key, or <code>null</code>
|
||||||
|
*/
|
||||||
|
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<K, V> values);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the first values contained in this {@code MultiValueMap}.
|
||||||
|
* @return a single value representation of this map
|
||||||
|
*/
|
||||||
|
Map<K, V> toSingleValueMap();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将指定的<code>Number</code>对象转换为指定的类型对象
|
||||||
|
*
|
||||||
|
* @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() + "]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将字符串转换为<code>BigInteger</code>
|
||||||
|
*
|
||||||
|
* <p>指定的字符串如果是可以是负数表示或者十六进制,八进制表示
|
||||||
|
* 负数表示前面加-,十六进制表示前面加0x 0X #,八进制表示前面加0<p>
|
||||||
|
* @param value 要转换的字符串
|
||||||
|
* @return 返回<code>BigInteger</code>对象
|
||||||
|
* @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值");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,248 @@
|
|||||||
|
/**
|
||||||
|
* 版权所有:厦门市巨龙软件工程有限公司
|
||||||
|
* Copyright 2010 Xiamen Dragon Software Eng. Co. Ltd.
|
||||||
|
* All right reserved.
|
||||||
|
*====================================================
|
||||||
|
* 文件名称: Assert.java
|
||||||
|
* 修订记录:
|
||||||
|
* No 日期 作者(操作:具体内容)
|
||||||
|
* 1. 2010-8-6 李炜(创建:创建文件)
|
||||||
|
*====================================================
|
||||||
|
* 类描述:(说明未实现或其它不应生成javadoc的内容)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.luqj.util;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*<pre><b><font color="blue">Assert</font></b></pre>
|
||||||
|
*
|
||||||
|
*<pre><b> --描述说明--</b></pre>
|
||||||
|
* <pre></pre>
|
||||||
|
* <pre>
|
||||||
|
* <b>--样例--</b>
|
||||||
|
* Assert obj = new Assert();
|
||||||
|
* obj.method();
|
||||||
|
* </pre>
|
||||||
|
* JDK版本:JDK1.4
|
||||||
|
* @author <b>李炜</b>
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*<pre><b><font color="blue">Assert</font></b></pre>
|
||||||
|
*
|
||||||
|
*<pre><b> --描述说明--</b></pre>
|
||||||
|
* <pre></pre>
|
||||||
|
* <pre>
|
||||||
|
* <b>--样例--</b>
|
||||||
|
* Assert obj = new Assert();
|
||||||
|
* obj.method();
|
||||||
|
* </pre>
|
||||||
|
* JDK版本:JDK1.4
|
||||||
|
* @author <b>李炜</b>
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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<String, List<Integer>> symBolPos, int charPos, String ...symbols){
|
||||||
|
for(String symbol : symbols) {
|
||||||
|
if(!symBolPos.containsKey(symbol)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
List<Integer> 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<String, List<Integer>> getSymBolPos(String exp) {
|
||||||
|
Map<String, List<Integer>> map = new HashMap<String, List<Integer>>();
|
||||||
|
String[] symbols = new String[]{
|
||||||
|
SYMBOL_SQM, SYMBOL_DQM
|
||||||
|
};
|
||||||
|
for(String symbol : symbols) {
|
||||||
|
map.put(symbol, new ArrayList<Integer>(exp.length()));
|
||||||
|
int charPos = 0;
|
||||||
|
for(char c : exp.toCharArray()) {
|
||||||
|
if(c == symbol.charAt(0)) {
|
||||||
|
map.get(symbol).add(charPos);
|
||||||
|
}
|
||||||
|
charPos++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<Annotation> list = new ArrayList<Annotation>();
|
||||||
|
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<Book>
|
||||||
|
*
|
||||||
|
* @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> T instanceByConstructor(Class<T> 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<String, MethodParam> getMethodParams(Class<?> clas, Method m) throws NotFoundException {
|
||||||
|
Map<String, MethodParam> params = new LinkedHashMap<String, MethodParam>();
|
||||||
|
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<Class<?>> t = new ArrayList<Class<?>>();
|
||||||
|
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<Method> list = new ArrayList<Method>();
|
||||||
|
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<Class<?>> list = new LinkedList<Class<?>>();
|
||||||
|
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<Field> list = new ArrayList<Field>();
|
||||||
|
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<Field> 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<Class<?>> returnTypes = new ArrayList<Class<?>>();
|
||||||
|
|
||||||
|
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<String> getClasssFromPackage(String pack) {
|
||||||
|
List<String> classNames = new ArrayList<String>();
|
||||||
|
// 是否循环搜索子包
|
||||||
|
boolean recursive = true;
|
||||||
|
// 包名字
|
||||||
|
String packageName = pack;
|
||||||
|
// 包名对应的路径名称
|
||||||
|
String packageDirName = packageName.replace('.', '/');
|
||||||
|
Enumeration<URL> 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<String> 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<String> getClasssFromJarFile(String jarPath) {
|
||||||
|
List<String> classNameList = new ArrayList<>();
|
||||||
|
JarFile jarFile = null;
|
||||||
|
try {
|
||||||
|
jarFile = new JarFile(jarPath);
|
||||||
|
} catch (IOException e1) {
|
||||||
|
|
||||||
|
}
|
||||||
|
List<JarEntry> jarEntryList = new ArrayList<>();
|
||||||
|
Enumeration<JarEntry> 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)));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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<JarEntry> 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<String> getAllClassInfo(String file) {
|
||||||
|
List<String> infos = new ArrayList<String>();
|
||||||
|
try {
|
||||||
|
JarFile jar = new JarFile(file);
|
||||||
|
Enumeration<JarEntry> 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<String> getResources(String filePath, String dirPath) {
|
||||||
|
List<String> infos = new ArrayList<String>();
|
||||||
|
try {
|
||||||
|
JarFile jar = new JarFile(filePath);
|
||||||
|
Enumeration<JarEntry> 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,286 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi</artifactId>
|
||||||
|
<version>3.4.0</version>
|
||||||
|
</parent>
|
||||||
|
<artifactId>luqj-djl</artifactId>
|
||||||
|
<version>3.4.0</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>luqj-djl</name>
|
||||||
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<djl.version>0.34.0</djl.version>
|
||||||
|
<smartjavaai.version>1.1.0</smartjavaai.version>
|
||||||
|
<javacv.version>1.5.11</javacv.version>
|
||||||
|
|
||||||
|
<javacv.platform.macosx-arm64>macosx-arm64</javacv.platform.macosx-arm64>
|
||||||
|
<javacv.platform.linux-x86_64>linux-x86_64</javacv.platform.linux-x86_64>
|
||||||
|
<javacv.platform.linux-arm64>linux-arm64</javacv.platform.linux-arm64>
|
||||||
|
<javacv.platform.windows-x86_64>windows-x86_64</javacv.platform.windows-x86_64>
|
||||||
|
|
||||||
|
|
||||||
|
<djl.platform.windows-x86_64>win-x86_64</djl.platform.windows-x86_64>
|
||||||
|
<djl.platform.linux-x86_64>linux-x86_64</djl.platform.linux-x86_64>
|
||||||
|
<djl.platform.linux-aarch64>linux-aarch64</djl.platform.linux-aarch64>
|
||||||
|
<djl.platform.osx-aarch64>osx-aarch64</djl.platform.osx-aarch64>
|
||||||
|
</properties>
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ai.djl</groupId>
|
||||||
|
<artifactId>bom</artifactId>
|
||||||
|
<version>${djl.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.smartjavaai</groupId>
|
||||||
|
<artifactId>bom</artifactId>
|
||||||
|
<version>${smartjavaai.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<!-- 注意这里是import -->
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.microsoft.onnxruntime</groupId>
|
||||||
|
<artifactId>onnxruntime</artifactId>
|
||||||
|
<version>1.16.3</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<!--OCR检测模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.smartjavaai</groupId>
|
||||||
|
<artifactId>ocr</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>ai.djl.pytorch</groupId>
|
||||||
|
<artifactId>pytorch-jni</artifactId>
|
||||||
|
<version>2.7.1-0.34.0</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- windows平台 (保留对应平台的配置,可以减小包大小)-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bytedeco</groupId>
|
||||||
|
<artifactId>javacpp</artifactId>
|
||||||
|
<version>${javacv.version}</version>
|
||||||
|
<classifier>${javacv.platform.windows-x86_64}</classifier>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bytedeco</groupId>
|
||||||
|
<artifactId>ffmpeg</artifactId>
|
||||||
|
<version>7.1-1.5.11</version>
|
||||||
|
<classifier>${javacv.platform.windows-x86_64}</classifier>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bytedeco</groupId>
|
||||||
|
<artifactId>openblas</artifactId>
|
||||||
|
<version>0.3.26-1.5.10</version>
|
||||||
|
<classifier>${javacv.platform.windows-x86_64}</classifier>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bytedeco</groupId>
|
||||||
|
<artifactId>opencv</artifactId>
|
||||||
|
<version>4.9.0-1.5.10</version>
|
||||||
|
<classifier>${javacv.platform.windows-x86_64}</classifier>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>ai.djl.pytorch</groupId>
|
||||||
|
<artifactId>pytorch-native-cpu</artifactId>
|
||||||
|
<classifier>${djl.platform.windows-x86_64}</classifier>
|
||||||
|
<version>2.7.1</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- linux x86 平台 (保留对应平台的配置,可以减小包大小)-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bytedeco</groupId>
|
||||||
|
<artifactId>javacpp</artifactId>
|
||||||
|
<version>${javacv.version}</version>
|
||||||
|
<classifier>${javacv.platform.linux-x86_64}</classifier>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bytedeco</groupId>
|
||||||
|
<artifactId>ffmpeg</artifactId>
|
||||||
|
<version>7.1-1.5.11</version>
|
||||||
|
<classifier>${javacv.platform.linux-x86_64}</classifier>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bytedeco</groupId>
|
||||||
|
<artifactId>openblas</artifactId>
|
||||||
|
<version>0.3.26-1.5.10</version>
|
||||||
|
<classifier>${javacv.platform.linux-x86_64}</classifier>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bytedeco</groupId>
|
||||||
|
<artifactId>opencv</artifactId>
|
||||||
|
<version>4.9.0-1.5.10</version>
|
||||||
|
<classifier>${javacv.platform.linux-x86_64}</classifier>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>ai.djl.pytorch</groupId>
|
||||||
|
<artifactId>pytorch-native-cpu</artifactId>
|
||||||
|
<classifier>${djl.platform.linux-x86_64}</classifier>
|
||||||
|
<version>2.7.1</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- linux aarch64 平台 (保留对应平台的配置,可以减小包大小)-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bytedeco</groupId>
|
||||||
|
<artifactId>javacpp</artifactId>
|
||||||
|
<version>${javacv.version}</version>
|
||||||
|
<classifier>${javacv.platform.linux-arm64}</classifier>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bytedeco</groupId>
|
||||||
|
<artifactId>ffmpeg</artifactId>
|
||||||
|
<version>7.1-1.5.11</version>
|
||||||
|
<classifier>${javacv.platform.linux-arm64}</classifier>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bytedeco</groupId>
|
||||||
|
<artifactId>openblas</artifactId>
|
||||||
|
<version>0.3.26-1.5.10</version>
|
||||||
|
<classifier>${javacv.platform.linux-arm64}</classifier>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bytedeco</groupId>
|
||||||
|
<artifactId>opencv</artifactId>
|
||||||
|
<version>4.9.0-1.5.10</version>
|
||||||
|
<classifier>${javacv.platform.linux-arm64}</classifier>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>ai.djl.pytorch</groupId>
|
||||||
|
<artifactId>pytorch-native-cpu</artifactId>
|
||||||
|
<classifier>${djl.platform.linux-aarch64}</classifier>
|
||||||
|
<version>2.7.1</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- macOS M系列 平台 (保留对应平台的配置,可以减小包大小)-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bytedeco</groupId>
|
||||||
|
<artifactId>javacpp</artifactId>
|
||||||
|
<version>${javacv.version}</version>
|
||||||
|
<classifier>${javacv.platform.macosx-arm64}</classifier>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bytedeco</groupId>
|
||||||
|
<artifactId>ffmpeg</artifactId>
|
||||||
|
<version>7.1-1.5.11</version>
|
||||||
|
<classifier>${javacv.platform.macosx-arm64}</classifier>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bytedeco</groupId>
|
||||||
|
<artifactId>openblas</artifactId>
|
||||||
|
<version>0.3.26-1.5.10</version>
|
||||||
|
<classifier>${javacv.platform.macosx-arm64}</classifier>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bytedeco</groupId>
|
||||||
|
<artifactId>opencv</artifactId>
|
||||||
|
<version>4.9.0-1.5.10</version>
|
||||||
|
<classifier>${javacv.platform.macosx-arm64}</classifier>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>ai.djl.pytorch</groupId>
|
||||||
|
<artifactId>pytorch-native-cpu</artifactId>
|
||||||
|
<classifier>${djl.platform.osx-aarch64}</classifier>
|
||||||
|
<version>2.7.1</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ai.djl</groupId>
|
||||||
|
<artifactId>api</artifactId>
|
||||||
|
<version>0.34.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- PyTorch 引擎 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>ai.djl.pytorch</groupId>
|
||||||
|
<artifactId>pytorch-engine</artifactId>
|
||||||
|
<version>0.34.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>ai.djl</groupId>
|
||||||
|
<artifactId>api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ai.djl</groupId>
|
||||||
|
<artifactId>basicdataset</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ai.djl</groupId>
|
||||||
|
<artifactId>model-zoo</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ai.djl.timeseries</groupId>
|
||||||
|
<artifactId>timeseries</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ai.djl.huggingface</groupId>
|
||||||
|
<artifactId>tokenizers</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ai.djl.audio</groupId>
|
||||||
|
<artifactId>audio</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- MXNet -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>ai.djl.mxnet</groupId>
|
||||||
|
<artifactId>mxnet-model-zoo</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- Pytorch -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>ai.djl.pytorch</groupId>
|
||||||
|
<artifactId>pytorch-model-zoo</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- TensorFlow -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>ai.djl.tensorflow</groupId>
|
||||||
|
<artifactId>tensorflow-model-zoo</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- ONNXRuntime -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>ai.djl.onnxruntime</groupId>
|
||||||
|
<artifactId>onnxruntime-engine</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.hankcs</groupId>
|
||||||
|
<artifactId>hanlp</artifactId>
|
||||||
|
<version>portable-1.8.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-context</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
@@ -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));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<String, float[]> criteriaInstance;
|
||||||
|
private static volatile ZooModel<String, float[]> model;
|
||||||
|
|
||||||
|
private EmbeddingModelSingleton() {
|
||||||
|
// 私有构造函数,防止外部实例化
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float[] embed(String text) {
|
||||||
|
try {
|
||||||
|
try (Predictor<String, float[]> 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<String, float[]> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi</artifactId>
|
||||||
|
<version>3.4.0</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>luqj-ec</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>luqj-ec</name>
|
||||||
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-extension</artifactId>
|
||||||
|
<version>3.4.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>luqj-common</artifactId>
|
||||||
|
<version>3.4.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
@@ -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<EcCommandResultPlus> 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<SelectItem> 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<EcCommandResult> 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<EcCommandResult> list = ecCommandResultService.selectEcCommandResultList(ecCommandResult);
|
||||||
|
ExcelUtil<EcCommandResult> util = new ExcelUtil<EcCommandResult>(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));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<EcControlTaskPlus> 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<SelectItem> list = ecControlTaskService.select(keyword);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查询任务(群控核心)列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('ec:ec-task:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(EcControlTask ecControlTask)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<EcControlTask> 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<EcControlTask> list = ecControlTaskService.selectEcControlTaskList(ecControlTask);
|
||||||
|
ExcelUtil<EcControlTask> util = new ExcelUtil<EcControlTask>(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));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<EcDeviceCommandPlus> 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<SelectItem> list = ecDeviceCommandService.select(keyword);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查询控制指令(单条指令)列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('ec:ec-command:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(EcDeviceCommand ecDeviceCommand)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<EcDeviceCommand> 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<EcDeviceCommand> list = ecDeviceCommandService.selectEcDeviceCommandList(ecDeviceCommand);
|
||||||
|
ExcelUtil<EcDeviceCommand> util = new ExcelUtil<EcDeviceCommand>(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));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<EcDevicePlus> 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<SelectItem> list = ecDeviceService.select(keyword);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查询设备(手机设备)列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('ec:ec-device:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(EcDevice ecDevice)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<EcDevice> 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<EcDevice> list = ecDeviceService.selectEcDeviceList(ecDevice);
|
||||||
|
ExcelUtil<EcDevice> util = new ExcelUtil<EcDevice>(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));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<EcDeviceStatusPlus> 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<SelectItem> 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<EcDeviceStatus> 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<EcDeviceStatus> list = ecDeviceStatusService.selectEcDeviceStatusList(ecDeviceStatus);
|
||||||
|
ExcelUtil<EcDeviceStatus> util = new ExcelUtil<EcDeviceStatus>(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));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<EcTaskCommandPlus> 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<SelectItem> 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<EcTaskCommand> 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<EcTaskCommand> list = ecTaskCommandService.selectEcTaskCommandList(ecTaskCommand);
|
||||||
|
ExcelUtil<EcTaskCommand> util = new ExcelUtil<EcTaskCommand>(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));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<EcTaskDevicePlus> 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<SelectItem> 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<EcTaskDevice> 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<EcTaskDevice> list = ecTaskDeviceService.selectEcTaskDeviceList(ecTaskDevice);
|
||||||
|
ExcelUtil<EcTaskDevice> util = new ExcelUtil<EcTaskDevice>(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));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<EcCommandResultPlus>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询指令执行结果(客户端回传)
|
||||||
|
*
|
||||||
|
* @param id 指令执行结果(客户端回传)ID
|
||||||
|
* @return 指令执行结果(客户端回传)
|
||||||
|
*/
|
||||||
|
public EcCommandResult selectEcCommandResultById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询指令执行结果(客户端回传)列表
|
||||||
|
*
|
||||||
|
* @param ecCommandResult 指令执行结果(客户端回传)
|
||||||
|
* @return 指令执行结果(客户端回传)集合
|
||||||
|
*/
|
||||||
|
public List<EcCommandResult> 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);
|
||||||
|
}
|
||||||
@@ -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<EcControlTaskPlus>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询任务(群控核心)
|
||||||
|
*
|
||||||
|
* @param id 任务(群控核心)ID
|
||||||
|
* @return 任务(群控核心)
|
||||||
|
*/
|
||||||
|
public EcControlTask selectEcControlTaskById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询任务(群控核心)列表
|
||||||
|
*
|
||||||
|
* @param ecControlTask 任务(群控核心)
|
||||||
|
* @return 任务(群控核心)集合
|
||||||
|
*/
|
||||||
|
public List<EcControlTask> 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);
|
||||||
|
}
|
||||||
@@ -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<EcDeviceCommandPlus>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询控制指令(单条指令)
|
||||||
|
*
|
||||||
|
* @param id 控制指令(单条指令)ID
|
||||||
|
* @return 控制指令(单条指令)
|
||||||
|
*/
|
||||||
|
public EcDeviceCommand selectEcDeviceCommandById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询控制指令(单条指令)列表
|
||||||
|
*
|
||||||
|
* @param ecDeviceCommand 控制指令(单条指令)
|
||||||
|
* @return 控制指令(单条指令)集合
|
||||||
|
*/
|
||||||
|
public List<EcDeviceCommand> 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);
|
||||||
|
}
|
||||||
@@ -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<EcDevicePlus>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询设备(手机设备)
|
||||||
|
*
|
||||||
|
* @param id 设备(手机设备)ID
|
||||||
|
* @return 设备(手机设备)
|
||||||
|
*/
|
||||||
|
public EcDevice selectEcDeviceById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备(手机设备)列表
|
||||||
|
*
|
||||||
|
* @param ecDevice 设备(手机设备)
|
||||||
|
* @return 设备(手机设备)集合
|
||||||
|
*/
|
||||||
|
public List<EcDevice> 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);
|
||||||
|
}
|
||||||
@@ -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<EcDeviceStatusPlus>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询设备心跳 & 状态(高频)
|
||||||
|
*
|
||||||
|
* @param id 设备心跳 & 状态(高频)ID
|
||||||
|
* @return 设备心跳 & 状态(高频)
|
||||||
|
*/
|
||||||
|
public EcDeviceStatus selectEcDeviceStatusById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备心跳 & 状态(高频)列表
|
||||||
|
*
|
||||||
|
* @param ecDeviceStatus 设备心跳 & 状态(高频)
|
||||||
|
* @return 设备心跳 & 状态(高频)集合
|
||||||
|
*/
|
||||||
|
public List<EcDeviceStatus> 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);
|
||||||
|
}
|
||||||
@@ -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<EcTaskCommandPlus>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询任务指令明细(一个任务多条指令)
|
||||||
|
*
|
||||||
|
* @param id 任务指令明细(一个任务多条指令)ID
|
||||||
|
* @return 任务指令明细(一个任务多条指令)
|
||||||
|
*/
|
||||||
|
public EcTaskCommand selectEcTaskCommandById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询任务指令明细(一个任务多条指令)列表
|
||||||
|
*
|
||||||
|
* @param ecTaskCommand 任务指令明细(一个任务多条指令)
|
||||||
|
* @return 任务指令明细(一个任务多条指令)集合
|
||||||
|
*/
|
||||||
|
public List<EcTaskCommand> 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);
|
||||||
|
}
|
||||||
@@ -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<EcTaskDevicePlus>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询任务-设备关联(一任务多设备)
|
||||||
|
*
|
||||||
|
* @param id 任务-设备关联(一任务多设备)ID
|
||||||
|
* @return 任务-设备关联(一任务多设备)
|
||||||
|
*/
|
||||||
|
public EcTaskDevice selectEcTaskDeviceById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询任务-设备关联(一任务多设备)列表
|
||||||
|
*
|
||||||
|
* @param ecTaskDevice 任务-设备关联(一任务多设备)
|
||||||
|
* @return 任务-设备关联(一任务多设备)集合
|
||||||
|
*/
|
||||||
|
public List<EcTaskDevice> 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);
|
||||||
|
}
|
||||||
@@ -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<EcCommandResultPlus>
|
||||||
|
{
|
||||||
|
|
||||||
|
List<SelectItem> select(String keyword);
|
||||||
|
/**
|
||||||
|
* 查询指令执行结果(客户端回传)
|
||||||
|
*
|
||||||
|
* @param id 指令执行结果(客户端回传)ID
|
||||||
|
* @return 指令执行结果(客户端回传)
|
||||||
|
*/
|
||||||
|
public EcCommandResult selectEcCommandResultById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询指令执行结果(客户端回传)列表
|
||||||
|
*
|
||||||
|
* @param ecCommandResult 指令执行结果(客户端回传)
|
||||||
|
* @return 指令执行结果(客户端回传)集合
|
||||||
|
*/
|
||||||
|
public List<EcCommandResult> 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<EcCommandResultPlus> getByIds(List<Long> ids, SFunction<EcCommandResultPlus, ?>... columns);
|
||||||
|
|
||||||
|
EcCommandResultPlus getById(Long id, SFunction<EcCommandResultPlus, ?>... columns);
|
||||||
|
|
||||||
|
Map<Long, EcCommandResultPlus> getMapByIds(List<Long> ids, SFunction<EcCommandResultPlus, ?>... columns);
|
||||||
|
|
||||||
|
List<EcCommandResultPlus> getByIds(List<Long> ids);
|
||||||
|
|
||||||
|
Map<Long, EcCommandResultPlus> getMapByIds(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param field sum 字段
|
||||||
|
* @param where 条件
|
||||||
|
* @param tClass 返回类型
|
||||||
|
* @param <T>
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
<T> T sum(String field, String where, Class<T> tClass);
|
||||||
|
|
||||||
|
Long count(String where);
|
||||||
|
|
||||||
|
<T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass);
|
||||||
|
}
|
||||||
@@ -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<EcControlTaskPlus>
|
||||||
|
{
|
||||||
|
|
||||||
|
List<SelectItem> select(String keyword);
|
||||||
|
/**
|
||||||
|
* 查询任务(群控核心)
|
||||||
|
*
|
||||||
|
* @param id 任务(群控核心)ID
|
||||||
|
* @return 任务(群控核心)
|
||||||
|
*/
|
||||||
|
public EcControlTask selectEcControlTaskById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询任务(群控核心)列表
|
||||||
|
*
|
||||||
|
* @param ecControlTask 任务(群控核心)
|
||||||
|
* @return 任务(群控核心)集合
|
||||||
|
*/
|
||||||
|
public List<EcControlTask> 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<EcControlTaskPlus> getByIds(List<Long> ids, SFunction<EcControlTaskPlus, ?>... columns);
|
||||||
|
|
||||||
|
EcControlTaskPlus getById(Long id, SFunction<EcControlTaskPlus, ?>... columns);
|
||||||
|
|
||||||
|
Map<Long, EcControlTaskPlus> getMapByIds(List<Long> ids, SFunction<EcControlTaskPlus, ?>... columns);
|
||||||
|
|
||||||
|
List<EcControlTaskPlus> getByIds(List<Long> ids);
|
||||||
|
|
||||||
|
Map<Long, EcControlTaskPlus> getMapByIds(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param field sum 字段
|
||||||
|
* @param where 条件
|
||||||
|
* @param tClass 返回类型
|
||||||
|
* @param <T>
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
<T> T sum(String field, String where, Class<T> tClass);
|
||||||
|
|
||||||
|
Long count(String where);
|
||||||
|
|
||||||
|
<T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass);
|
||||||
|
}
|
||||||
@@ -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<EcDeviceCommandPlus>
|
||||||
|
{
|
||||||
|
|
||||||
|
List<SelectItem> select(String keyword);
|
||||||
|
/**
|
||||||
|
* 查询控制指令(单条指令)
|
||||||
|
*
|
||||||
|
* @param id 控制指令(单条指令)ID
|
||||||
|
* @return 控制指令(单条指令)
|
||||||
|
*/
|
||||||
|
public EcDeviceCommand selectEcDeviceCommandById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询控制指令(单条指令)列表
|
||||||
|
*
|
||||||
|
* @param ecDeviceCommand 控制指令(单条指令)
|
||||||
|
* @return 控制指令(单条指令)集合
|
||||||
|
*/
|
||||||
|
public List<EcDeviceCommand> 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<EcDeviceCommandPlus> getByIds(List<Long> ids, SFunction<EcDeviceCommandPlus, ?>... columns);
|
||||||
|
|
||||||
|
EcDeviceCommandPlus getById(Long id, SFunction<EcDeviceCommandPlus, ?>... columns);
|
||||||
|
|
||||||
|
Map<Long, EcDeviceCommandPlus> getMapByIds(List<Long> ids, SFunction<EcDeviceCommandPlus, ?>... columns);
|
||||||
|
|
||||||
|
List<EcDeviceCommandPlus> getByIds(List<Long> ids);
|
||||||
|
|
||||||
|
Map<Long, EcDeviceCommandPlus> getMapByIds(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param field sum 字段
|
||||||
|
* @param where 条件
|
||||||
|
* @param tClass 返回类型
|
||||||
|
* @param <T>
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
<T> T sum(String field, String where, Class<T> tClass);
|
||||||
|
|
||||||
|
Long count(String where);
|
||||||
|
|
||||||
|
<T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass);
|
||||||
|
}
|
||||||
@@ -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<EcDevicePlus>
|
||||||
|
{
|
||||||
|
|
||||||
|
List<SelectItem> select(String keyword);
|
||||||
|
/**
|
||||||
|
* 查询设备(手机设备)
|
||||||
|
*
|
||||||
|
* @param id 设备(手机设备)ID
|
||||||
|
* @return 设备(手机设备)
|
||||||
|
*/
|
||||||
|
public EcDevice selectEcDeviceById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备(手机设备)列表
|
||||||
|
*
|
||||||
|
* @param ecDevice 设备(手机设备)
|
||||||
|
* @return 设备(手机设备)集合
|
||||||
|
*/
|
||||||
|
public List<EcDevice> 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<EcDevicePlus> getByIds(List<Long> ids, SFunction<EcDevicePlus, ?>... columns);
|
||||||
|
|
||||||
|
EcDevicePlus getById(Long id, SFunction<EcDevicePlus, ?>... columns);
|
||||||
|
|
||||||
|
Map<Long, EcDevicePlus> getMapByIds(List<Long> ids, SFunction<EcDevicePlus, ?>... columns);
|
||||||
|
|
||||||
|
List<EcDevicePlus> getByIds(List<Long> ids);
|
||||||
|
|
||||||
|
Map<Long, EcDevicePlus> getMapByIds(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param field sum 字段
|
||||||
|
* @param where 条件
|
||||||
|
* @param tClass 返回类型
|
||||||
|
* @param <T>
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
<T> T sum(String field, String where, Class<T> tClass);
|
||||||
|
|
||||||
|
Long count(String where);
|
||||||
|
|
||||||
|
<T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass);
|
||||||
|
}
|
||||||
@@ -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<EcDeviceStatusPlus>
|
||||||
|
{
|
||||||
|
|
||||||
|
List<SelectItem> select(String keyword);
|
||||||
|
/**
|
||||||
|
* 查询设备心跳 & 状态(高频)
|
||||||
|
*
|
||||||
|
* @param id 设备心跳 & 状态(高频)ID
|
||||||
|
* @return 设备心跳 & 状态(高频)
|
||||||
|
*/
|
||||||
|
public EcDeviceStatus selectEcDeviceStatusById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备心跳 & 状态(高频)列表
|
||||||
|
*
|
||||||
|
* @param ecDeviceStatus 设备心跳 & 状态(高频)
|
||||||
|
* @return 设备心跳 & 状态(高频)集合
|
||||||
|
*/
|
||||||
|
public List<EcDeviceStatus> 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<EcDeviceStatusPlus> getByIds(List<Long> ids, SFunction<EcDeviceStatusPlus, ?>... columns);
|
||||||
|
|
||||||
|
EcDeviceStatusPlus getById(Long id, SFunction<EcDeviceStatusPlus, ?>... columns);
|
||||||
|
|
||||||
|
Map<Long, EcDeviceStatusPlus> getMapByIds(List<Long> ids, SFunction<EcDeviceStatusPlus, ?>... columns);
|
||||||
|
|
||||||
|
List<EcDeviceStatusPlus> getByIds(List<Long> ids);
|
||||||
|
|
||||||
|
Map<Long, EcDeviceStatusPlus> getMapByIds(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param field sum 字段
|
||||||
|
* @param where 条件
|
||||||
|
* @param tClass 返回类型
|
||||||
|
* @param <T>
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
<T> T sum(String field, String where, Class<T> tClass);
|
||||||
|
|
||||||
|
Long count(String where);
|
||||||
|
|
||||||
|
<T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass);
|
||||||
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
package com.luqj.ec.service;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.List;
|
||||||
|
import com.luqj.ec.domain.EcTaskCommand;
|
||||||
|
import com.luqj.ec.domain.EcTaskCommandPlus;
|
||||||
|
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 IEcTaskCommandService extends IService<EcTaskCommandPlus>
|
||||||
|
{
|
||||||
|
|
||||||
|
List<SelectItem> select(String keyword);
|
||||||
|
/**
|
||||||
|
* 查询任务指令明细(一个任务多条指令)
|
||||||
|
*
|
||||||
|
* @param id 任务指令明细(一个任务多条指令)ID
|
||||||
|
* @return 任务指令明细(一个任务多条指令)
|
||||||
|
*/
|
||||||
|
public EcTaskCommand selectEcTaskCommandById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询任务指令明细(一个任务多条指令)列表
|
||||||
|
*
|
||||||
|
* @param ecTaskCommand 任务指令明细(一个任务多条指令)
|
||||||
|
* @return 任务指令明细(一个任务多条指令)集合
|
||||||
|
*/
|
||||||
|
public List<EcTaskCommand> selectEcTaskCommandList(EcTaskCommand ecTaskCommand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增任务指令明细(一个任务多条指令)
|
||||||
|
*
|
||||||
|
* @param ecTaskCommand 任务指令明细(一个任务多条指令)
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertEcTaskCommand(EcTaskCommand ecTaskCommand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改任务指令明细(一个任务多条指令)
|
||||||
|
*
|
||||||
|
* @param ecTaskCommand 任务指令明细(一个任务多条指令)
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateEcTaskCommand(EcTaskCommand ecTaskCommand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除任务指令明细(一个任务多条指令)
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的任务指令明细(一个任务多条指令)ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteEcTaskCommandByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除任务指令明细(一个任务多条指令)信息
|
||||||
|
*
|
||||||
|
* @param id 任务指令明细(一个任务多条指令)ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteEcTaskCommandById(Long id);
|
||||||
|
|
||||||
|
List<EcTaskCommandPlus> getByIds(List<Long> ids, SFunction<EcTaskCommandPlus, ?>... columns);
|
||||||
|
|
||||||
|
EcTaskCommandPlus getById(Long id, SFunction<EcTaskCommandPlus, ?>... columns);
|
||||||
|
|
||||||
|
Map<Long, EcTaskCommandPlus> getMapByIds(List<Long> ids, SFunction<EcTaskCommandPlus, ?>... columns);
|
||||||
|
|
||||||
|
List<EcTaskCommandPlus> getByIds(List<Long> ids);
|
||||||
|
|
||||||
|
Map<Long, EcTaskCommandPlus> getMapByIds(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param field sum 字段
|
||||||
|
* @param where 条件
|
||||||
|
* @param tClass 返回类型
|
||||||
|
* @param <T>
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
<T> T sum(String field, String where, Class<T> tClass);
|
||||||
|
|
||||||
|
Long count(String where);
|
||||||
|
|
||||||
|
<T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass);
|
||||||
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
package com.luqj.ec.service;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.List;
|
||||||
|
import com.luqj.ec.domain.EcTaskDevice;
|
||||||
|
import com.luqj.ec.domain.EcTaskDevicePlus;
|
||||||
|
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 IEcTaskDeviceService extends IService<EcTaskDevicePlus>
|
||||||
|
{
|
||||||
|
|
||||||
|
List<SelectItem> select(String keyword);
|
||||||
|
/**
|
||||||
|
* 查询任务-设备关联(一任务多设备)
|
||||||
|
*
|
||||||
|
* @param id 任务-设备关联(一任务多设备)ID
|
||||||
|
* @return 任务-设备关联(一任务多设备)
|
||||||
|
*/
|
||||||
|
public EcTaskDevice selectEcTaskDeviceById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询任务-设备关联(一任务多设备)列表
|
||||||
|
*
|
||||||
|
* @param ecTaskDevice 任务-设备关联(一任务多设备)
|
||||||
|
* @return 任务-设备关联(一任务多设备)集合
|
||||||
|
*/
|
||||||
|
public List<EcTaskDevice> selectEcTaskDeviceList(EcTaskDevice ecTaskDevice);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增任务-设备关联(一任务多设备)
|
||||||
|
*
|
||||||
|
* @param ecTaskDevice 任务-设备关联(一任务多设备)
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertEcTaskDevice(EcTaskDevice ecTaskDevice);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改任务-设备关联(一任务多设备)
|
||||||
|
*
|
||||||
|
* @param ecTaskDevice 任务-设备关联(一任务多设备)
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateEcTaskDevice(EcTaskDevice ecTaskDevice);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除任务-设备关联(一任务多设备)
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的任务-设备关联(一任务多设备)ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteEcTaskDeviceByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除任务-设备关联(一任务多设备)信息
|
||||||
|
*
|
||||||
|
* @param id 任务-设备关联(一任务多设备)ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteEcTaskDeviceById(Long id);
|
||||||
|
|
||||||
|
List<EcTaskDevicePlus> getByIds(List<Long> ids, SFunction<EcTaskDevicePlus, ?>... columns);
|
||||||
|
|
||||||
|
EcTaskDevicePlus getById(Long id, SFunction<EcTaskDevicePlus, ?>... columns);
|
||||||
|
|
||||||
|
Map<Long, EcTaskDevicePlus> getMapByIds(List<Long> ids, SFunction<EcTaskDevicePlus, ?>... columns);
|
||||||
|
|
||||||
|
List<EcTaskDevicePlus> getByIds(List<Long> ids);
|
||||||
|
|
||||||
|
Map<Long, EcTaskDevicePlus> getMapByIds(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param field sum 字段
|
||||||
|
* @param where 条件
|
||||||
|
* @param tClass 返回类型
|
||||||
|
* @param <T>
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
<T> T sum(String field, String where, Class<T> tClass);
|
||||||
|
|
||||||
|
Long count(String where);
|
||||||
|
|
||||||
|
<T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass);
|
||||||
|
}
|
||||||
@@ -0,0 +1,200 @@
|
|||||||
|
package com.luqj.ec.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.luqj.ec.domain.EcCommandResult;
|
||||||
|
import com.luqj.ec.domain.EcCommandResultPlus;
|
||||||
|
import com.luqj.ec.mapper.EcCommandResultMapper;
|
||||||
|
import com.luqj.ec.service.IEcCommandResultService;
|
||||||
|
import com.ruoyi.common.select.SelectItem;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指令执行结果(客户端回传)Service业务层处理
|
||||||
|
*
|
||||||
|
* @author luqj
|
||||||
|
* @date 2026-02-27
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class EcCommandResultServiceImpl extends ServiceImpl<EcCommandResultMapper, EcCommandResultPlus> implements IEcCommandResultService {
|
||||||
|
@Autowired
|
||||||
|
private EcCommandResultMapper ecCommandResultMapper;
|
||||||
|
@Autowired
|
||||||
|
private JdbcTemplate jdbcTemplate;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EcCommandResultPlus> getByIds(List<Long> ids, SFunction<EcCommandResultPlus, ?>... columns) {
|
||||||
|
LambdaQueryWrapper<EcCommandResultPlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcCommandResultPlus>()
|
||||||
|
.select(columns).in(EcCommandResultPlus::getId, ids);
|
||||||
|
return this.list(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SelectItem> select(String keyword) {
|
||||||
|
LambdaQueryWrapper<EcCommandResultPlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcCommandResultPlus>()
|
||||||
|
.select(EcCommandResultPlus::getId, EcCommandResultPlus::getResult)
|
||||||
|
.like(EcCommandResultPlus::getResult, keyword);
|
||||||
|
List<EcCommandResultPlus> list = this.list(lambdaQueryWrapper);
|
||||||
|
List<SelectItem> result = new ArrayList<>();
|
||||||
|
for (EcCommandResultPlus item : list) {
|
||||||
|
SelectItem selectItem = new SelectItem();
|
||||||
|
selectItem.setName(item.getResult()+"");
|
||||||
|
selectItem.setId(item.getId());
|
||||||
|
result.add(selectItem);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EcCommandResultPlus getById(Long id, SFunction<EcCommandResultPlus, ?>... columns) {
|
||||||
|
LambdaQueryWrapper<EcCommandResultPlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcCommandResultPlus>()
|
||||||
|
.select(columns).eq(EcCommandResultPlus::getId, id);
|
||||||
|
return baseMapper.selectOne(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Long, EcCommandResultPlus> getMapByIds(List<Long> ids, SFunction<EcCommandResultPlus, ?>... columns) {
|
||||||
|
List<EcCommandResultPlus> list = this.getByIds(ids, columns);
|
||||||
|
Map<Long, EcCommandResultPlus> map = new HashMap<>();
|
||||||
|
for (EcCommandResultPlus item : list) {
|
||||||
|
map.put(item.getId(), item);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Long, EcCommandResultPlus> getMapByIds(List<Long> ids) {
|
||||||
|
List<EcCommandResultPlus> list = this.getByIds(ids);
|
||||||
|
Map<Long, EcCommandResultPlus> map = new HashMap<>();
|
||||||
|
for (EcCommandResultPlus item : list) {
|
||||||
|
map.put(item.getId(), item);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EcCommandResultPlus> getByIds(List<Long> ids) {
|
||||||
|
LambdaQueryWrapper<EcCommandResultPlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcCommandResultPlus>().in(EcCommandResultPlus::getId, ids);
|
||||||
|
return this.list(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> T sum(String field, String where, Class<T> tClass) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append("select ");
|
||||||
|
stringBuffer.append(" sum(" + field + ") as total ");
|
||||||
|
stringBuffer.append(" from ec_command_result ");
|
||||||
|
if (StringUtils.isNotBlank(where)) {
|
||||||
|
stringBuffer.append(" where ");
|
||||||
|
stringBuffer.append(where);
|
||||||
|
}
|
||||||
|
T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long count(String where) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append("select ");
|
||||||
|
stringBuffer.append(" count(1)");
|
||||||
|
stringBuffer.append(" from ");
|
||||||
|
stringBuffer.append(" ec_command_result ");
|
||||||
|
if (StringUtils.isNotBlank(where)) {
|
||||||
|
stringBuffer.append(" where ");
|
||||||
|
stringBuffer.append(where);
|
||||||
|
}
|
||||||
|
Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append("select ");
|
||||||
|
stringBuffer.append(select);
|
||||||
|
stringBuffer.append(" from ");
|
||||||
|
stringBuffer.append(" ec_command_result ");
|
||||||
|
if (StringUtils.isNotBlank(where)) {
|
||||||
|
stringBuffer.append(" where ");
|
||||||
|
stringBuffer.append(where);
|
||||||
|
}
|
||||||
|
stringBuffer.append(" group by ");
|
||||||
|
stringBuffer.append(groupby);
|
||||||
|
List result = jdbcTemplate.queryForList(stringBuffer.toString());
|
||||||
|
List<T> tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass);
|
||||||
|
return tList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询指令执行结果(客户端回传)
|
||||||
|
*
|
||||||
|
* @param id 指令执行结果(客户端回传)ID
|
||||||
|
* @return 指令执行结果(客户端回传)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public EcCommandResult selectEcCommandResultById(Long id) {
|
||||||
|
return ecCommandResultMapper.selectEcCommandResultById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询指令执行结果(客户端回传)列表
|
||||||
|
*
|
||||||
|
* @param ecCommandResult 指令执行结果(客户端回传)
|
||||||
|
* @return 指令执行结果(客户端回传)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<EcCommandResult> selectEcCommandResultList(EcCommandResult ecCommandResult) {
|
||||||
|
return ecCommandResultMapper.selectEcCommandResultList(ecCommandResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增指令执行结果(客户端回传)
|
||||||
|
*
|
||||||
|
* @param ecCommandResult 指令执行结果(客户端回传)
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertEcCommandResult(EcCommandResult ecCommandResult) {
|
||||||
|
return ecCommandResultMapper.insertEcCommandResult(ecCommandResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改指令执行结果(客户端回传)
|
||||||
|
*
|
||||||
|
* @param ecCommandResult 指令执行结果(客户端回传)
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateEcCommandResult(EcCommandResult ecCommandResult) {
|
||||||
|
return ecCommandResultMapper.updateEcCommandResult(ecCommandResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除指令执行结果(客户端回传)
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的指令执行结果(客户端回传)ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteEcCommandResultByIds(Long[] ids) {
|
||||||
|
return ecCommandResultMapper.deleteEcCommandResultByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除指令执行结果(客户端回传)信息
|
||||||
|
*
|
||||||
|
* @param id 指令执行结果(客户端回传)ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteEcCommandResultById(Long id) {
|
||||||
|
return ecCommandResultMapper.deleteEcCommandResultById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,205 @@
|
|||||||
|
package com.luqj.ec.service.impl;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.luqj.ec.mapper.EcControlTaskMapper;
|
||||||
|
import com.luqj.ec.domain.EcControlTask;
|
||||||
|
import com.luqj.ec.domain.EcControlTaskPlus;
|
||||||
|
import com.luqj.ec.service.IEcControlTaskService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
import com.ruoyi.common.select.SelectItem;
|
||||||
|
/**
|
||||||
|
* 任务(群控核心)Service业务层处理
|
||||||
|
*
|
||||||
|
* @author luqj
|
||||||
|
* @date 2026-02-27
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class EcControlTaskServiceImpl extends ServiceImpl<EcControlTaskMapper, EcControlTaskPlus> implements IEcControlTaskService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private EcControlTaskMapper ecControlTaskMapper;
|
||||||
|
@Autowired
|
||||||
|
private JdbcTemplate jdbcTemplate;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EcControlTaskPlus> getByIds(List<Long> ids, SFunction<EcControlTaskPlus, ?>... columns) {
|
||||||
|
LambdaQueryWrapper<EcControlTaskPlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcControlTaskPlus>()
|
||||||
|
.select(columns).in(EcControlTaskPlus::getId, ids);
|
||||||
|
return this.list(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<SelectItem> select(String keyword) {
|
||||||
|
LambdaQueryWrapper<EcControlTaskPlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcControlTaskPlus>()
|
||||||
|
.select(EcControlTaskPlus::getId, EcControlTaskPlus::getTaskName)
|
||||||
|
.like(EcControlTaskPlus::getTaskName, keyword);
|
||||||
|
List<EcControlTaskPlus> list = this.list(lambdaQueryWrapper);
|
||||||
|
List<SelectItem> result =new ArrayList<>();
|
||||||
|
for (EcControlTaskPlus item : list){
|
||||||
|
SelectItem selectItem = new SelectItem();
|
||||||
|
selectItem.setName(item.getTaskName());
|
||||||
|
selectItem.setId(item.getId());
|
||||||
|
result.add(selectItem);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public EcControlTaskPlus getById(Long id, SFunction<EcControlTaskPlus, ?>... columns) {
|
||||||
|
LambdaQueryWrapper<EcControlTaskPlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcControlTaskPlus>()
|
||||||
|
.select(columns).eq(EcControlTaskPlus::getId, id);
|
||||||
|
return baseMapper.selectOne(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Long, EcControlTaskPlus> getMapByIds(List<Long> ids, SFunction<EcControlTaskPlus, ?>... columns) {
|
||||||
|
List<EcControlTaskPlus> list = this.getByIds(ids, columns);
|
||||||
|
Map<Long, EcControlTaskPlus> map = new HashMap<>();
|
||||||
|
for (EcControlTaskPlus item : list) {
|
||||||
|
map.put(item.getId(), item);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Long, EcControlTaskPlus> getMapByIds(List<Long> ids) {
|
||||||
|
List<EcControlTaskPlus> list = this.getByIds(ids);
|
||||||
|
Map<Long, EcControlTaskPlus> map = new HashMap<>();
|
||||||
|
for (EcControlTaskPlus item : list) {
|
||||||
|
map.put(item.getId(), item);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EcControlTaskPlus> getByIds(List<Long> ids) {
|
||||||
|
LambdaQueryWrapper<EcControlTaskPlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcControlTaskPlus>().in(EcControlTaskPlus::getId, ids);
|
||||||
|
return this.list(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> T sum(String field, String where, Class<T> tClass) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append("select ");
|
||||||
|
stringBuffer.append(" sum(" + field + ") as total ");
|
||||||
|
stringBuffer.append(" from ec_control_task ");
|
||||||
|
if (StringUtils.isNotBlank(where)) {
|
||||||
|
stringBuffer.append(" where ");
|
||||||
|
stringBuffer.append(where);
|
||||||
|
}
|
||||||
|
T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long count(String where) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append("select ");
|
||||||
|
stringBuffer.append(" count(1)");
|
||||||
|
stringBuffer.append(" from ");
|
||||||
|
stringBuffer.append(" ec_control_task ");
|
||||||
|
if (StringUtils.isNotBlank(where)) {
|
||||||
|
stringBuffer.append(" where ");
|
||||||
|
stringBuffer.append(where);
|
||||||
|
}
|
||||||
|
Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append("select ");
|
||||||
|
stringBuffer.append(select);
|
||||||
|
stringBuffer.append(" from ");
|
||||||
|
stringBuffer.append(" ec_control_task ");
|
||||||
|
if (StringUtils.isNotBlank(where)) {
|
||||||
|
stringBuffer.append(" where ");
|
||||||
|
stringBuffer.append(where);
|
||||||
|
}
|
||||||
|
stringBuffer.append(" group by ");
|
||||||
|
stringBuffer.append(groupby);
|
||||||
|
List result = jdbcTemplate.queryForList(stringBuffer.toString());
|
||||||
|
List<T> tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass);
|
||||||
|
return tList;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查询任务(群控核心)
|
||||||
|
*
|
||||||
|
* @param id 任务(群控核心)ID
|
||||||
|
* @return 任务(群控核心)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public EcControlTask selectEcControlTaskById(Long id)
|
||||||
|
{
|
||||||
|
return ecControlTaskMapper.selectEcControlTaskById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询任务(群控核心)列表
|
||||||
|
*
|
||||||
|
* @param ecControlTask 任务(群控核心)
|
||||||
|
* @return 任务(群控核心)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<EcControlTask> selectEcControlTaskList(EcControlTask ecControlTask)
|
||||||
|
{
|
||||||
|
return ecControlTaskMapper.selectEcControlTaskList(ecControlTask);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增任务(群控核心)
|
||||||
|
*
|
||||||
|
* @param ecControlTask 任务(群控核心)
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertEcControlTask(EcControlTask ecControlTask)
|
||||||
|
{
|
||||||
|
return ecControlTaskMapper.insertEcControlTask(ecControlTask);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改任务(群控核心)
|
||||||
|
*
|
||||||
|
* @param ecControlTask 任务(群控核心)
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateEcControlTask(EcControlTask ecControlTask)
|
||||||
|
{
|
||||||
|
return ecControlTaskMapper.updateEcControlTask(ecControlTask);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除任务(群控核心)
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的任务(群控核心)ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteEcControlTaskByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return ecControlTaskMapper.deleteEcControlTaskByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除任务(群控核心)信息
|
||||||
|
*
|
||||||
|
* @param id 任务(群控核心)ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteEcControlTaskById(Long id)
|
||||||
|
{
|
||||||
|
return ecControlTaskMapper.deleteEcControlTaskById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,205 @@
|
|||||||
|
package com.luqj.ec.service.impl;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.luqj.ec.mapper.EcDeviceCommandMapper;
|
||||||
|
import com.luqj.ec.domain.EcDeviceCommand;
|
||||||
|
import com.luqj.ec.domain.EcDeviceCommandPlus;
|
||||||
|
import com.luqj.ec.service.IEcDeviceCommandService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
import com.ruoyi.common.select.SelectItem;
|
||||||
|
/**
|
||||||
|
* 控制指令(单条指令)Service业务层处理
|
||||||
|
*
|
||||||
|
* @author luqj
|
||||||
|
* @date 2026-02-27
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class EcDeviceCommandServiceImpl extends ServiceImpl<EcDeviceCommandMapper, EcDeviceCommandPlus> implements IEcDeviceCommandService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private EcDeviceCommandMapper ecDeviceCommandMapper;
|
||||||
|
@Autowired
|
||||||
|
private JdbcTemplate jdbcTemplate;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EcDeviceCommandPlus> getByIds(List<Long> ids, SFunction<EcDeviceCommandPlus, ?>... columns) {
|
||||||
|
LambdaQueryWrapper<EcDeviceCommandPlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcDeviceCommandPlus>()
|
||||||
|
.select(columns).in(EcDeviceCommandPlus::getId, ids);
|
||||||
|
return this.list(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<SelectItem> select(String keyword) {
|
||||||
|
LambdaQueryWrapper<EcDeviceCommandPlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcDeviceCommandPlus>()
|
||||||
|
.select(EcDeviceCommandPlus::getId, EcDeviceCommandPlus::getCommandType)
|
||||||
|
.like(EcDeviceCommandPlus::getCommandType, keyword);
|
||||||
|
List<EcDeviceCommandPlus> list = this.list(lambdaQueryWrapper);
|
||||||
|
List<SelectItem> result =new ArrayList<>();
|
||||||
|
for (EcDeviceCommandPlus item : list){
|
||||||
|
SelectItem selectItem = new SelectItem();
|
||||||
|
selectItem.setName(item.getCommandType());
|
||||||
|
selectItem.setId(item.getId());
|
||||||
|
result.add(selectItem);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public EcDeviceCommandPlus getById(Long id, SFunction<EcDeviceCommandPlus, ?>... columns) {
|
||||||
|
LambdaQueryWrapper<EcDeviceCommandPlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcDeviceCommandPlus>()
|
||||||
|
.select(columns).eq(EcDeviceCommandPlus::getId, id);
|
||||||
|
return baseMapper.selectOne(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Long, EcDeviceCommandPlus> getMapByIds(List<Long> ids, SFunction<EcDeviceCommandPlus, ?>... columns) {
|
||||||
|
List<EcDeviceCommandPlus> list = this.getByIds(ids, columns);
|
||||||
|
Map<Long, EcDeviceCommandPlus> map = new HashMap<>();
|
||||||
|
for (EcDeviceCommandPlus item : list) {
|
||||||
|
map.put(item.getId(), item);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Long, EcDeviceCommandPlus> getMapByIds(List<Long> ids) {
|
||||||
|
List<EcDeviceCommandPlus> list = this.getByIds(ids);
|
||||||
|
Map<Long, EcDeviceCommandPlus> map = new HashMap<>();
|
||||||
|
for (EcDeviceCommandPlus item : list) {
|
||||||
|
map.put(item.getId(), item);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EcDeviceCommandPlus> getByIds(List<Long> ids) {
|
||||||
|
LambdaQueryWrapper<EcDeviceCommandPlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcDeviceCommandPlus>().in(EcDeviceCommandPlus::getId, ids);
|
||||||
|
return this.list(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> T sum(String field, String where, Class<T> tClass) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append("select ");
|
||||||
|
stringBuffer.append(" sum(" + field + ") as total ");
|
||||||
|
stringBuffer.append(" from ec_device_command ");
|
||||||
|
if (StringUtils.isNotBlank(where)) {
|
||||||
|
stringBuffer.append(" where ");
|
||||||
|
stringBuffer.append(where);
|
||||||
|
}
|
||||||
|
T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long count(String where) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append("select ");
|
||||||
|
stringBuffer.append(" count(1)");
|
||||||
|
stringBuffer.append(" from ");
|
||||||
|
stringBuffer.append(" ec_device_command ");
|
||||||
|
if (StringUtils.isNotBlank(where)) {
|
||||||
|
stringBuffer.append(" where ");
|
||||||
|
stringBuffer.append(where);
|
||||||
|
}
|
||||||
|
Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append("select ");
|
||||||
|
stringBuffer.append(select);
|
||||||
|
stringBuffer.append(" from ");
|
||||||
|
stringBuffer.append(" ec_device_command ");
|
||||||
|
if (StringUtils.isNotBlank(where)) {
|
||||||
|
stringBuffer.append(" where ");
|
||||||
|
stringBuffer.append(where);
|
||||||
|
}
|
||||||
|
stringBuffer.append(" group by ");
|
||||||
|
stringBuffer.append(groupby);
|
||||||
|
List result = jdbcTemplate.queryForList(stringBuffer.toString());
|
||||||
|
List<T> tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass);
|
||||||
|
return tList;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查询控制指令(单条指令)
|
||||||
|
*
|
||||||
|
* @param id 控制指令(单条指令)ID
|
||||||
|
* @return 控制指令(单条指令)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public EcDeviceCommand selectEcDeviceCommandById(Long id)
|
||||||
|
{
|
||||||
|
return ecDeviceCommandMapper.selectEcDeviceCommandById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询控制指令(单条指令)列表
|
||||||
|
*
|
||||||
|
* @param ecDeviceCommand 控制指令(单条指令)
|
||||||
|
* @return 控制指令(单条指令)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<EcDeviceCommand> selectEcDeviceCommandList(EcDeviceCommand ecDeviceCommand)
|
||||||
|
{
|
||||||
|
return ecDeviceCommandMapper.selectEcDeviceCommandList(ecDeviceCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增控制指令(单条指令)
|
||||||
|
*
|
||||||
|
* @param ecDeviceCommand 控制指令(单条指令)
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertEcDeviceCommand(EcDeviceCommand ecDeviceCommand)
|
||||||
|
{
|
||||||
|
return ecDeviceCommandMapper.insertEcDeviceCommand(ecDeviceCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改控制指令(单条指令)
|
||||||
|
*
|
||||||
|
* @param ecDeviceCommand 控制指令(单条指令)
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateEcDeviceCommand(EcDeviceCommand ecDeviceCommand)
|
||||||
|
{
|
||||||
|
return ecDeviceCommandMapper.updateEcDeviceCommand(ecDeviceCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除控制指令(单条指令)
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的控制指令(单条指令)ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteEcDeviceCommandByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return ecDeviceCommandMapper.deleteEcDeviceCommandByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除控制指令(单条指令)信息
|
||||||
|
*
|
||||||
|
* @param id 控制指令(单条指令)ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteEcDeviceCommandById(Long id)
|
||||||
|
{
|
||||||
|
return ecDeviceCommandMapper.deleteEcDeviceCommandById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,205 @@
|
|||||||
|
package com.luqj.ec.service.impl;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.luqj.ec.mapper.EcDeviceMapper;
|
||||||
|
import com.luqj.ec.domain.EcDevice;
|
||||||
|
import com.luqj.ec.domain.EcDevicePlus;
|
||||||
|
import com.luqj.ec.service.IEcDeviceService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
import com.ruoyi.common.select.SelectItem;
|
||||||
|
/**
|
||||||
|
* 设备(手机设备)Service业务层处理
|
||||||
|
*
|
||||||
|
* @author luqj
|
||||||
|
* @date 2026-02-27
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class EcDeviceServiceImpl extends ServiceImpl<EcDeviceMapper, EcDevicePlus> implements IEcDeviceService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private EcDeviceMapper ecDeviceMapper;
|
||||||
|
@Autowired
|
||||||
|
private JdbcTemplate jdbcTemplate;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EcDevicePlus> getByIds(List<Long> ids, SFunction<EcDevicePlus, ?>... columns) {
|
||||||
|
LambdaQueryWrapper<EcDevicePlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcDevicePlus>()
|
||||||
|
.select(columns).in(EcDevicePlus::getId, ids);
|
||||||
|
return this.list(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<SelectItem> select(String keyword) {
|
||||||
|
LambdaQueryWrapper<EcDevicePlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcDevicePlus>()
|
||||||
|
.select(EcDevicePlus::getId, EcDevicePlus::getDeviceCode)
|
||||||
|
.like(EcDevicePlus::getDeviceCode, keyword);
|
||||||
|
List<EcDevicePlus> list = this.list(lambdaQueryWrapper);
|
||||||
|
List<SelectItem> result =new ArrayList<>();
|
||||||
|
for (EcDevicePlus item : list){
|
||||||
|
SelectItem selectItem = new SelectItem();
|
||||||
|
selectItem.setName(item.getDeviceCode());
|
||||||
|
selectItem.setId(item.getId());
|
||||||
|
result.add(selectItem);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public EcDevicePlus getById(Long id, SFunction<EcDevicePlus, ?>... columns) {
|
||||||
|
LambdaQueryWrapper<EcDevicePlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcDevicePlus>()
|
||||||
|
.select(columns).eq(EcDevicePlus::getId, id);
|
||||||
|
return baseMapper.selectOne(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Long, EcDevicePlus> getMapByIds(List<Long> ids, SFunction<EcDevicePlus, ?>... columns) {
|
||||||
|
List<EcDevicePlus> list = this.getByIds(ids, columns);
|
||||||
|
Map<Long, EcDevicePlus> map = new HashMap<>();
|
||||||
|
for (EcDevicePlus item : list) {
|
||||||
|
map.put(item.getId(), item);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Long, EcDevicePlus> getMapByIds(List<Long> ids) {
|
||||||
|
List<EcDevicePlus> list = this.getByIds(ids);
|
||||||
|
Map<Long, EcDevicePlus> map = new HashMap<>();
|
||||||
|
for (EcDevicePlus item : list) {
|
||||||
|
map.put(item.getId(), item);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EcDevicePlus> getByIds(List<Long> ids) {
|
||||||
|
LambdaQueryWrapper<EcDevicePlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcDevicePlus>().in(EcDevicePlus::getId, ids);
|
||||||
|
return this.list(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> T sum(String field, String where, Class<T> tClass) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append("select ");
|
||||||
|
stringBuffer.append(" sum(" + field + ") as total ");
|
||||||
|
stringBuffer.append(" from ec_device ");
|
||||||
|
if (StringUtils.isNotBlank(where)) {
|
||||||
|
stringBuffer.append(" where ");
|
||||||
|
stringBuffer.append(where);
|
||||||
|
}
|
||||||
|
T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long count(String where) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append("select ");
|
||||||
|
stringBuffer.append(" count(1)");
|
||||||
|
stringBuffer.append(" from ");
|
||||||
|
stringBuffer.append(" ec_device ");
|
||||||
|
if (StringUtils.isNotBlank(where)) {
|
||||||
|
stringBuffer.append(" where ");
|
||||||
|
stringBuffer.append(where);
|
||||||
|
}
|
||||||
|
Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append("select ");
|
||||||
|
stringBuffer.append(select);
|
||||||
|
stringBuffer.append(" from ");
|
||||||
|
stringBuffer.append(" ec_device ");
|
||||||
|
if (StringUtils.isNotBlank(where)) {
|
||||||
|
stringBuffer.append(" where ");
|
||||||
|
stringBuffer.append(where);
|
||||||
|
}
|
||||||
|
stringBuffer.append(" group by ");
|
||||||
|
stringBuffer.append(groupby);
|
||||||
|
List result = jdbcTemplate.queryForList(stringBuffer.toString());
|
||||||
|
List<T> tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass);
|
||||||
|
return tList;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查询设备(手机设备)
|
||||||
|
*
|
||||||
|
* @param id 设备(手机设备)ID
|
||||||
|
* @return 设备(手机设备)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public EcDevice selectEcDeviceById(Long id)
|
||||||
|
{
|
||||||
|
return ecDeviceMapper.selectEcDeviceById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备(手机设备)列表
|
||||||
|
*
|
||||||
|
* @param ecDevice 设备(手机设备)
|
||||||
|
* @return 设备(手机设备)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<EcDevice> selectEcDeviceList(EcDevice ecDevice)
|
||||||
|
{
|
||||||
|
return ecDeviceMapper.selectEcDeviceList(ecDevice);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备(手机设备)
|
||||||
|
*
|
||||||
|
* @param ecDevice 设备(手机设备)
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertEcDevice(EcDevice ecDevice)
|
||||||
|
{
|
||||||
|
return ecDeviceMapper.insertEcDevice(ecDevice);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备(手机设备)
|
||||||
|
*
|
||||||
|
* @param ecDevice 设备(手机设备)
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateEcDevice(EcDevice ecDevice)
|
||||||
|
{
|
||||||
|
return ecDeviceMapper.updateEcDevice(ecDevice);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除设备(手机设备)
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的设备(手机设备)ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteEcDeviceByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return ecDeviceMapper.deleteEcDeviceByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备(手机设备)信息
|
||||||
|
*
|
||||||
|
* @param id 设备(手机设备)ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteEcDeviceById(Long id)
|
||||||
|
{
|
||||||
|
return ecDeviceMapper.deleteEcDeviceById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,205 @@
|
|||||||
|
package com.luqj.ec.service.impl;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.luqj.ec.mapper.EcDeviceStatusMapper;
|
||||||
|
import com.luqj.ec.domain.EcDeviceStatus;
|
||||||
|
import com.luqj.ec.domain.EcDeviceStatusPlus;
|
||||||
|
import com.luqj.ec.service.IEcDeviceStatusService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
import com.ruoyi.common.select.SelectItem;
|
||||||
|
/**
|
||||||
|
* 设备心跳 & 状态(高频)Service业务层处理
|
||||||
|
*
|
||||||
|
* @author luqj
|
||||||
|
* @date 2026-02-27
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class EcDeviceStatusServiceImpl extends ServiceImpl<EcDeviceStatusMapper, EcDeviceStatusPlus> implements IEcDeviceStatusService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private EcDeviceStatusMapper ecDeviceStatusMapper;
|
||||||
|
@Autowired
|
||||||
|
private JdbcTemplate jdbcTemplate;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EcDeviceStatusPlus> getByIds(List<Long> ids, SFunction<EcDeviceStatusPlus, ?>... columns) {
|
||||||
|
LambdaQueryWrapper<EcDeviceStatusPlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcDeviceStatusPlus>()
|
||||||
|
.select(columns).in(EcDeviceStatusPlus::getId, ids);
|
||||||
|
return this.list(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<SelectItem> select(String keyword) {
|
||||||
|
LambdaQueryWrapper<EcDeviceStatusPlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcDeviceStatusPlus>()
|
||||||
|
.select(EcDeviceStatusPlus::getId, EcDeviceStatusPlus::getDeviceId)
|
||||||
|
.like(EcDeviceStatusPlus::getDeviceId, keyword);
|
||||||
|
List<EcDeviceStatusPlus> list = this.list(lambdaQueryWrapper);
|
||||||
|
List<SelectItem> result =new ArrayList<>();
|
||||||
|
for (EcDeviceStatusPlus item : list){
|
||||||
|
SelectItem selectItem = new SelectItem();
|
||||||
|
selectItem.setName(item.getDeviceId()+"");
|
||||||
|
selectItem.setId(item.getId());
|
||||||
|
result.add(selectItem);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public EcDeviceStatusPlus getById(Long id, SFunction<EcDeviceStatusPlus, ?>... columns) {
|
||||||
|
LambdaQueryWrapper<EcDeviceStatusPlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcDeviceStatusPlus>()
|
||||||
|
.select(columns).eq(EcDeviceStatusPlus::getId, id);
|
||||||
|
return baseMapper.selectOne(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Long, EcDeviceStatusPlus> getMapByIds(List<Long> ids, SFunction<EcDeviceStatusPlus, ?>... columns) {
|
||||||
|
List<EcDeviceStatusPlus> list = this.getByIds(ids, columns);
|
||||||
|
Map<Long, EcDeviceStatusPlus> map = new HashMap<>();
|
||||||
|
for (EcDeviceStatusPlus item : list) {
|
||||||
|
map.put(item.getId(), item);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Long, EcDeviceStatusPlus> getMapByIds(List<Long> ids) {
|
||||||
|
List<EcDeviceStatusPlus> list = this.getByIds(ids);
|
||||||
|
Map<Long, EcDeviceStatusPlus> map = new HashMap<>();
|
||||||
|
for (EcDeviceStatusPlus item : list) {
|
||||||
|
map.put(item.getId(), item);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EcDeviceStatusPlus> getByIds(List<Long> ids) {
|
||||||
|
LambdaQueryWrapper<EcDeviceStatusPlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcDeviceStatusPlus>().in(EcDeviceStatusPlus::getId, ids);
|
||||||
|
return this.list(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> T sum(String field, String where, Class<T> tClass) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append("select ");
|
||||||
|
stringBuffer.append(" sum(" + field + ") as total ");
|
||||||
|
stringBuffer.append(" from ec_device_status ");
|
||||||
|
if (StringUtils.isNotBlank(where)) {
|
||||||
|
stringBuffer.append(" where ");
|
||||||
|
stringBuffer.append(where);
|
||||||
|
}
|
||||||
|
T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long count(String where) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append("select ");
|
||||||
|
stringBuffer.append(" count(1)");
|
||||||
|
stringBuffer.append(" from ");
|
||||||
|
stringBuffer.append(" ec_device_status ");
|
||||||
|
if (StringUtils.isNotBlank(where)) {
|
||||||
|
stringBuffer.append(" where ");
|
||||||
|
stringBuffer.append(where);
|
||||||
|
}
|
||||||
|
Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append("select ");
|
||||||
|
stringBuffer.append(select);
|
||||||
|
stringBuffer.append(" from ");
|
||||||
|
stringBuffer.append(" ec_device_status ");
|
||||||
|
if (StringUtils.isNotBlank(where)) {
|
||||||
|
stringBuffer.append(" where ");
|
||||||
|
stringBuffer.append(where);
|
||||||
|
}
|
||||||
|
stringBuffer.append(" group by ");
|
||||||
|
stringBuffer.append(groupby);
|
||||||
|
List result = jdbcTemplate.queryForList(stringBuffer.toString());
|
||||||
|
List<T> tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass);
|
||||||
|
return tList;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查询设备心跳 & 状态(高频)
|
||||||
|
*
|
||||||
|
* @param id 设备心跳 & 状态(高频)ID
|
||||||
|
* @return 设备心跳 & 状态(高频)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public EcDeviceStatus selectEcDeviceStatusById(Long id)
|
||||||
|
{
|
||||||
|
return ecDeviceStatusMapper.selectEcDeviceStatusById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备心跳 & 状态(高频)列表
|
||||||
|
*
|
||||||
|
* @param ecDeviceStatus 设备心跳 & 状态(高频)
|
||||||
|
* @return 设备心跳 & 状态(高频)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<EcDeviceStatus> selectEcDeviceStatusList(EcDeviceStatus ecDeviceStatus)
|
||||||
|
{
|
||||||
|
return ecDeviceStatusMapper.selectEcDeviceStatusList(ecDeviceStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备心跳 & 状态(高频)
|
||||||
|
*
|
||||||
|
* @param ecDeviceStatus 设备心跳 & 状态(高频)
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertEcDeviceStatus(EcDeviceStatus ecDeviceStatus)
|
||||||
|
{
|
||||||
|
return ecDeviceStatusMapper.insertEcDeviceStatus(ecDeviceStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备心跳 & 状态(高频)
|
||||||
|
*
|
||||||
|
* @param ecDeviceStatus 设备心跳 & 状态(高频)
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateEcDeviceStatus(EcDeviceStatus ecDeviceStatus)
|
||||||
|
{
|
||||||
|
return ecDeviceStatusMapper.updateEcDeviceStatus(ecDeviceStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除设备心跳 & 状态(高频)
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的设备心跳 & 状态(高频)ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteEcDeviceStatusByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return ecDeviceStatusMapper.deleteEcDeviceStatusByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备心跳 & 状态(高频)信息
|
||||||
|
*
|
||||||
|
* @param id 设备心跳 & 状态(高频)ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteEcDeviceStatusById(Long id)
|
||||||
|
{
|
||||||
|
return ecDeviceStatusMapper.deleteEcDeviceStatusById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,205 @@
|
|||||||
|
package com.luqj.ec.service.impl;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.luqj.ec.mapper.EcTaskCommandMapper;
|
||||||
|
import com.luqj.ec.domain.EcTaskCommand;
|
||||||
|
import com.luqj.ec.domain.EcTaskCommandPlus;
|
||||||
|
import com.luqj.ec.service.IEcTaskCommandService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
import com.ruoyi.common.select.SelectItem;
|
||||||
|
/**
|
||||||
|
* 任务指令明细(一个任务多条指令)Service业务层处理
|
||||||
|
*
|
||||||
|
* @author luqj
|
||||||
|
* @date 2026-02-27
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class EcTaskCommandServiceImpl extends ServiceImpl<EcTaskCommandMapper, EcTaskCommandPlus> implements IEcTaskCommandService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private EcTaskCommandMapper ecTaskCommandMapper;
|
||||||
|
@Autowired
|
||||||
|
private JdbcTemplate jdbcTemplate;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EcTaskCommandPlus> getByIds(List<Long> ids, SFunction<EcTaskCommandPlus, ?>... columns) {
|
||||||
|
LambdaQueryWrapper<EcTaskCommandPlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcTaskCommandPlus>()
|
||||||
|
.select(columns).in(EcTaskCommandPlus::getId, ids);
|
||||||
|
return this.list(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<SelectItem> select(String keyword) {
|
||||||
|
LambdaQueryWrapper<EcTaskCommandPlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcTaskCommandPlus>()
|
||||||
|
.select(EcTaskCommandPlus::getId, EcTaskCommandPlus::getCommandType)
|
||||||
|
.like(EcTaskCommandPlus::getCommandType, keyword);
|
||||||
|
List<EcTaskCommandPlus> list = this.list(lambdaQueryWrapper);
|
||||||
|
List<SelectItem> result =new ArrayList<>();
|
||||||
|
for (EcTaskCommandPlus item : list){
|
||||||
|
SelectItem selectItem = new SelectItem();
|
||||||
|
selectItem.setName(item.getCommandType());
|
||||||
|
selectItem.setId(item.getId());
|
||||||
|
result.add(selectItem);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public EcTaskCommandPlus getById(Long id, SFunction<EcTaskCommandPlus, ?>... columns) {
|
||||||
|
LambdaQueryWrapper<EcTaskCommandPlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcTaskCommandPlus>()
|
||||||
|
.select(columns).eq(EcTaskCommandPlus::getId, id);
|
||||||
|
return baseMapper.selectOne(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Long, EcTaskCommandPlus> getMapByIds(List<Long> ids, SFunction<EcTaskCommandPlus, ?>... columns) {
|
||||||
|
List<EcTaskCommandPlus> list = this.getByIds(ids, columns);
|
||||||
|
Map<Long, EcTaskCommandPlus> map = new HashMap<>();
|
||||||
|
for (EcTaskCommandPlus item : list) {
|
||||||
|
map.put(item.getId(), item);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Long, EcTaskCommandPlus> getMapByIds(List<Long> ids) {
|
||||||
|
List<EcTaskCommandPlus> list = this.getByIds(ids);
|
||||||
|
Map<Long, EcTaskCommandPlus> map = new HashMap<>();
|
||||||
|
for (EcTaskCommandPlus item : list) {
|
||||||
|
map.put(item.getId(), item);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EcTaskCommandPlus> getByIds(List<Long> ids) {
|
||||||
|
LambdaQueryWrapper<EcTaskCommandPlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcTaskCommandPlus>().in(EcTaskCommandPlus::getId, ids);
|
||||||
|
return this.list(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> T sum(String field, String where, Class<T> tClass) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append("select ");
|
||||||
|
stringBuffer.append(" sum(" + field + ") as total ");
|
||||||
|
stringBuffer.append(" from ec_task_command ");
|
||||||
|
if (StringUtils.isNotBlank(where)) {
|
||||||
|
stringBuffer.append(" where ");
|
||||||
|
stringBuffer.append(where);
|
||||||
|
}
|
||||||
|
T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long count(String where) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append("select ");
|
||||||
|
stringBuffer.append(" count(1)");
|
||||||
|
stringBuffer.append(" from ");
|
||||||
|
stringBuffer.append(" ec_task_command ");
|
||||||
|
if (StringUtils.isNotBlank(where)) {
|
||||||
|
stringBuffer.append(" where ");
|
||||||
|
stringBuffer.append(where);
|
||||||
|
}
|
||||||
|
Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append("select ");
|
||||||
|
stringBuffer.append(select);
|
||||||
|
stringBuffer.append(" from ");
|
||||||
|
stringBuffer.append(" ec_task_command ");
|
||||||
|
if (StringUtils.isNotBlank(where)) {
|
||||||
|
stringBuffer.append(" where ");
|
||||||
|
stringBuffer.append(where);
|
||||||
|
}
|
||||||
|
stringBuffer.append(" group by ");
|
||||||
|
stringBuffer.append(groupby);
|
||||||
|
List result = jdbcTemplate.queryForList(stringBuffer.toString());
|
||||||
|
List<T> tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass);
|
||||||
|
return tList;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查询任务指令明细(一个任务多条指令)
|
||||||
|
*
|
||||||
|
* @param id 任务指令明细(一个任务多条指令)ID
|
||||||
|
* @return 任务指令明细(一个任务多条指令)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public EcTaskCommand selectEcTaskCommandById(Long id)
|
||||||
|
{
|
||||||
|
return ecTaskCommandMapper.selectEcTaskCommandById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询任务指令明细(一个任务多条指令)列表
|
||||||
|
*
|
||||||
|
* @param ecTaskCommand 任务指令明细(一个任务多条指令)
|
||||||
|
* @return 任务指令明细(一个任务多条指令)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<EcTaskCommand> selectEcTaskCommandList(EcTaskCommand ecTaskCommand)
|
||||||
|
{
|
||||||
|
return ecTaskCommandMapper.selectEcTaskCommandList(ecTaskCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增任务指令明细(一个任务多条指令)
|
||||||
|
*
|
||||||
|
* @param ecTaskCommand 任务指令明细(一个任务多条指令)
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertEcTaskCommand(EcTaskCommand ecTaskCommand)
|
||||||
|
{
|
||||||
|
return ecTaskCommandMapper.insertEcTaskCommand(ecTaskCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改任务指令明细(一个任务多条指令)
|
||||||
|
*
|
||||||
|
* @param ecTaskCommand 任务指令明细(一个任务多条指令)
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateEcTaskCommand(EcTaskCommand ecTaskCommand)
|
||||||
|
{
|
||||||
|
return ecTaskCommandMapper.updateEcTaskCommand(ecTaskCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除任务指令明细(一个任务多条指令)
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的任务指令明细(一个任务多条指令)ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteEcTaskCommandByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return ecTaskCommandMapper.deleteEcTaskCommandByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除任务指令明细(一个任务多条指令)信息
|
||||||
|
*
|
||||||
|
* @param id 任务指令明细(一个任务多条指令)ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteEcTaskCommandById(Long id)
|
||||||
|
{
|
||||||
|
return ecTaskCommandMapper.deleteEcTaskCommandById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,205 @@
|
|||||||
|
package com.luqj.ec.service.impl;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.luqj.ec.mapper.EcTaskDeviceMapper;
|
||||||
|
import com.luqj.ec.domain.EcTaskDevice;
|
||||||
|
import com.luqj.ec.domain.EcTaskDevicePlus;
|
||||||
|
import com.luqj.ec.service.IEcTaskDeviceService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
import com.ruoyi.common.select.SelectItem;
|
||||||
|
/**
|
||||||
|
* 任务-设备关联(一任务多设备)Service业务层处理
|
||||||
|
*
|
||||||
|
* @author luqj
|
||||||
|
* @date 2026-02-27
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class EcTaskDeviceServiceImpl extends ServiceImpl<EcTaskDeviceMapper, EcTaskDevicePlus> implements IEcTaskDeviceService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private EcTaskDeviceMapper ecTaskDeviceMapper;
|
||||||
|
@Autowired
|
||||||
|
private JdbcTemplate jdbcTemplate;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EcTaskDevicePlus> getByIds(List<Long> ids, SFunction<EcTaskDevicePlus, ?>... columns) {
|
||||||
|
LambdaQueryWrapper<EcTaskDevicePlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcTaskDevicePlus>()
|
||||||
|
.select(columns).in(EcTaskDevicePlus::getId, ids);
|
||||||
|
return this.list(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<SelectItem> select(String keyword) {
|
||||||
|
LambdaQueryWrapper<EcTaskDevicePlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcTaskDevicePlus>()
|
||||||
|
.select(EcTaskDevicePlus::getId, EcTaskDevicePlus::getStatus)
|
||||||
|
.like(EcTaskDevicePlus::getStatus, keyword);
|
||||||
|
List<EcTaskDevicePlus> list = this.list(lambdaQueryWrapper);
|
||||||
|
List<SelectItem> result =new ArrayList<>();
|
||||||
|
for (EcTaskDevicePlus item : list){
|
||||||
|
SelectItem selectItem = new SelectItem();
|
||||||
|
selectItem.setName(item.getStatus()+"");
|
||||||
|
selectItem.setId(item.getId());
|
||||||
|
result.add(selectItem);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public EcTaskDevicePlus getById(Long id, SFunction<EcTaskDevicePlus, ?>... columns) {
|
||||||
|
LambdaQueryWrapper<EcTaskDevicePlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcTaskDevicePlus>()
|
||||||
|
.select(columns).eq(EcTaskDevicePlus::getId, id);
|
||||||
|
return baseMapper.selectOne(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Long, EcTaskDevicePlus> getMapByIds(List<Long> ids, SFunction<EcTaskDevicePlus, ?>... columns) {
|
||||||
|
List<EcTaskDevicePlus> list = this.getByIds(ids, columns);
|
||||||
|
Map<Long, EcTaskDevicePlus> map = new HashMap<>();
|
||||||
|
for (EcTaskDevicePlus item : list) {
|
||||||
|
map.put(item.getId(), item);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Long, EcTaskDevicePlus> getMapByIds(List<Long> ids) {
|
||||||
|
List<EcTaskDevicePlus> list = this.getByIds(ids);
|
||||||
|
Map<Long, EcTaskDevicePlus> map = new HashMap<>();
|
||||||
|
for (EcTaskDevicePlus item : list) {
|
||||||
|
map.put(item.getId(), item);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EcTaskDevicePlus> getByIds(List<Long> ids) {
|
||||||
|
LambdaQueryWrapper<EcTaskDevicePlus> lambdaQueryWrapper = new LambdaQueryWrapper<EcTaskDevicePlus>().in(EcTaskDevicePlus::getId, ids);
|
||||||
|
return this.list(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> T sum(String field, String where, Class<T> tClass) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append("select ");
|
||||||
|
stringBuffer.append(" sum(" + field + ") as total ");
|
||||||
|
stringBuffer.append(" from ec_task_device ");
|
||||||
|
if (StringUtils.isNotBlank(where)) {
|
||||||
|
stringBuffer.append(" where ");
|
||||||
|
stringBuffer.append(where);
|
||||||
|
}
|
||||||
|
T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long count(String where) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append("select ");
|
||||||
|
stringBuffer.append(" count(1)");
|
||||||
|
stringBuffer.append(" from ");
|
||||||
|
stringBuffer.append(" ec_task_device ");
|
||||||
|
if (StringUtils.isNotBlank(where)) {
|
||||||
|
stringBuffer.append(" where ");
|
||||||
|
stringBuffer.append(where);
|
||||||
|
}
|
||||||
|
Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append("select ");
|
||||||
|
stringBuffer.append(select);
|
||||||
|
stringBuffer.append(" from ");
|
||||||
|
stringBuffer.append(" ec_task_device ");
|
||||||
|
if (StringUtils.isNotBlank(where)) {
|
||||||
|
stringBuffer.append(" where ");
|
||||||
|
stringBuffer.append(where);
|
||||||
|
}
|
||||||
|
stringBuffer.append(" group by ");
|
||||||
|
stringBuffer.append(groupby);
|
||||||
|
List result = jdbcTemplate.queryForList(stringBuffer.toString());
|
||||||
|
List<T> tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass);
|
||||||
|
return tList;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查询任务-设备关联(一任务多设备)
|
||||||
|
*
|
||||||
|
* @param id 任务-设备关联(一任务多设备)ID
|
||||||
|
* @return 任务-设备关联(一任务多设备)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public EcTaskDevice selectEcTaskDeviceById(Long id)
|
||||||
|
{
|
||||||
|
return ecTaskDeviceMapper.selectEcTaskDeviceById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询任务-设备关联(一任务多设备)列表
|
||||||
|
*
|
||||||
|
* @param ecTaskDevice 任务-设备关联(一任务多设备)
|
||||||
|
* @return 任务-设备关联(一任务多设备)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<EcTaskDevice> selectEcTaskDeviceList(EcTaskDevice ecTaskDevice)
|
||||||
|
{
|
||||||
|
return ecTaskDeviceMapper.selectEcTaskDeviceList(ecTaskDevice);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增任务-设备关联(一任务多设备)
|
||||||
|
*
|
||||||
|
* @param ecTaskDevice 任务-设备关联(一任务多设备)
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertEcTaskDevice(EcTaskDevice ecTaskDevice)
|
||||||
|
{
|
||||||
|
return ecTaskDeviceMapper.insertEcTaskDevice(ecTaskDevice);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改任务-设备关联(一任务多设备)
|
||||||
|
*
|
||||||
|
* @param ecTaskDevice 任务-设备关联(一任务多设备)
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateEcTaskDevice(EcTaskDevice ecTaskDevice)
|
||||||
|
{
|
||||||
|
return ecTaskDeviceMapper.updateEcTaskDevice(ecTaskDevice);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除任务-设备关联(一任务多设备)
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的任务-设备关联(一任务多设备)ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteEcTaskDeviceByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return ecTaskDeviceMapper.deleteEcTaskDeviceByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除任务-设备关联(一任务多设备)信息
|
||||||
|
*
|
||||||
|
* @param id 任务-设备关联(一任务多设备)ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteEcTaskDeviceById(Long id)
|
||||||
|
{
|
||||||
|
return ecTaskDeviceMapper.deleteEcTaskDeviceById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.luqj.ec.mapper.EcCommandResultMapper">
|
||||||
|
|
||||||
|
<resultMap type="EcCommandResult" id="EcCommandResultResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="commandId" column="command_id" />
|
||||||
|
<result property="deviceId" column="device_id" />
|
||||||
|
<result property="result" column="result" />
|
||||||
|
<result property="errorMsg" column="error_msg" />
|
||||||
|
<result property="responseData" column="response_data" />
|
||||||
|
<result property="createdAt" column="created_at" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectEcCommandResultVo">
|
||||||
|
select id, command_id, device_id, result, error_msg, response_data, created_at from ec_command_result
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectEcCommandResultList" parameterType="EcCommandResult" resultMap="EcCommandResultResult">
|
||||||
|
<include refid="selectEcCommandResultVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="commandId != null "> and command_id = #{commandId}</if>
|
||||||
|
<if test="deviceId != null "> and device_id = #{deviceId}</if>
|
||||||
|
<if test="result != null "> and result = #{result}</if>
|
||||||
|
<if test="errorMsg != null and errorMsg != ''"> and error_msg like concat('%', #{errorMsg}, '%')</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectEcCommandResultById" parameterType="Long" resultMap="EcCommandResultResult">
|
||||||
|
<include refid="selectEcCommandResultVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertEcCommandResult" parameterType="EcCommandResult" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into ec_command_result
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="commandId != null">command_id,</if>
|
||||||
|
<if test="deviceId != null">device_id,</if>
|
||||||
|
<if test="result != null">result,</if>
|
||||||
|
<if test="errorMsg != null">error_msg,</if>
|
||||||
|
<if test="responseData != null">response_data,</if>
|
||||||
|
<if test="createdAt != null">created_at,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="commandId != null">#{commandId},</if>
|
||||||
|
<if test="deviceId != null">#{deviceId},</if>
|
||||||
|
<if test="result != null">#{result},</if>
|
||||||
|
<if test="errorMsg != null">#{errorMsg},</if>
|
||||||
|
<if test="responseData != null">#{responseData},</if>
|
||||||
|
<if test="createdAt != null">#{createdAt},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateEcCommandResult" parameterType="EcCommandResult">
|
||||||
|
update ec_command_result
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="commandId != null">command_id = #{commandId},</if>
|
||||||
|
<if test="deviceId != null">device_id = #{deviceId},</if>
|
||||||
|
<if test="result != null">result = #{result},</if>
|
||||||
|
<if test="errorMsg != null">error_msg = #{errorMsg},</if>
|
||||||
|
<if test="responseData != null">response_data = #{responseData},</if>
|
||||||
|
<if test="createdAt != null">created_at = #{createdAt},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteEcCommandResultById" parameterType="Long">
|
||||||
|
delete from ec_command_result where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteEcCommandResultByIds" parameterType="String">
|
||||||
|
delete from ec_command_result where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.luqj.ec.mapper.EcControlTaskMapper">
|
||||||
|
|
||||||
|
<resultMap type="EcControlTask" id="EcControlTaskResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="taskName" column="task_name" />
|
||||||
|
<result property="taskType" column="task_type" />
|
||||||
|
<result property="userId" column="user_id" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="createdAt" column="created_at" />
|
||||||
|
<result property="updatedAt" column="updated_at" />
|
||||||
|
<result property="appId" column="app_id" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectEcControlTaskVo">
|
||||||
|
select id, task_name, task_type, user_id, status, created_at, updated_at, app_id from ec_control_task
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectEcControlTaskList" parameterType="EcControlTask" resultMap="EcControlTaskResult">
|
||||||
|
<include refid="selectEcControlTaskVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="taskName != null and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</if>
|
||||||
|
<if test="taskType != null "> and task_type = #{taskType}</if>
|
||||||
|
<if test="userId != null "> and user_id = #{userId}</if>
|
||||||
|
<if test="status != null "> and status = #{status}</if>
|
||||||
|
<if test="appId != null "> and app_id = #{appId}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectEcControlTaskById" parameterType="Long" resultMap="EcControlTaskResult">
|
||||||
|
<include refid="selectEcControlTaskVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertEcControlTask" parameterType="EcControlTask" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into ec_control_task
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="taskName != null">task_name,</if>
|
||||||
|
<if test="taskType != null">task_type,</if>
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
<if test="createdAt != null">created_at,</if>
|
||||||
|
<if test="updatedAt != null">updated_at,</if>
|
||||||
|
<if test="appId != null">app_id,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="taskName != null">#{taskName},</if>
|
||||||
|
<if test="taskType != null">#{taskType},</if>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="createdAt != null">#{createdAt},</if>
|
||||||
|
<if test="updatedAt != null">#{updatedAt},</if>
|
||||||
|
<if test="appId != null">#{appId},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateEcControlTask" parameterType="EcControlTask">
|
||||||
|
update ec_control_task
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="taskName != null">task_name = #{taskName},</if>
|
||||||
|
<if test="taskType != null">task_type = #{taskType},</if>
|
||||||
|
<if test="userId != null">user_id = #{userId},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="createdAt != null">created_at = #{createdAt},</if>
|
||||||
|
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
|
||||||
|
<if test="appId != null">app_id = #{appId},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteEcControlTaskById" parameterType="Long">
|
||||||
|
delete from ec_control_task where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteEcControlTaskByIds" parameterType="String">
|
||||||
|
delete from ec_control_task where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.luqj.ec.mapper.EcDeviceCommandMapper">
|
||||||
|
|
||||||
|
<resultMap type="EcDeviceCommand" id="EcDeviceCommandResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="deviceId" column="device_id" />
|
||||||
|
<result property="commandType" column="command_type" />
|
||||||
|
<result property="commandContent" column="command_content" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="sendTime" column="send_time" />
|
||||||
|
<result property="executeTime" column="execute_time" />
|
||||||
|
<result property="finishTime" column="finish_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectEcDeviceCommandVo">
|
||||||
|
select id, device_id, command_type, command_content, status, send_time, execute_time, finish_time from ec_device_command
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectEcDeviceCommandList" parameterType="EcDeviceCommand" resultMap="EcDeviceCommandResult">
|
||||||
|
<include refid="selectEcDeviceCommandVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="deviceId != null "> and device_id = #{deviceId}</if>
|
||||||
|
<if test="commandType != null and commandType != ''"> and command_type = #{commandType}</if>
|
||||||
|
<if test="status != null "> and status = #{status}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectEcDeviceCommandById" parameterType="Long" resultMap="EcDeviceCommandResult">
|
||||||
|
<include refid="selectEcDeviceCommandVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertEcDeviceCommand" parameterType="EcDeviceCommand" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into ec_device_command
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="deviceId != null">device_id,</if>
|
||||||
|
<if test="commandType != null">command_type,</if>
|
||||||
|
<if test="commandContent != null">command_content,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
<if test="sendTime != null">send_time,</if>
|
||||||
|
<if test="executeTime != null">execute_time,</if>
|
||||||
|
<if test="finishTime != null">finish_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="deviceId != null">#{deviceId},</if>
|
||||||
|
<if test="commandType != null">#{commandType},</if>
|
||||||
|
<if test="commandContent != null">#{commandContent},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="sendTime != null">#{sendTime},</if>
|
||||||
|
<if test="executeTime != null">#{executeTime},</if>
|
||||||
|
<if test="finishTime != null">#{finishTime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateEcDeviceCommand" parameterType="EcDeviceCommand">
|
||||||
|
update ec_device_command
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="deviceId != null">device_id = #{deviceId},</if>
|
||||||
|
<if test="commandType != null">command_type = #{commandType},</if>
|
||||||
|
<if test="commandContent != null">command_content = #{commandContent},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="sendTime != null">send_time = #{sendTime},</if>
|
||||||
|
<if test="executeTime != null">execute_time = #{executeTime},</if>
|
||||||
|
<if test="finishTime != null">finish_time = #{finishTime},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteEcDeviceCommandById" parameterType="Long">
|
||||||
|
delete from ec_device_command where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteEcDeviceCommandByIds" parameterType="String">
|
||||||
|
delete from ec_device_command where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.luqj.ec.mapper.EcDeviceMapper">
|
||||||
|
|
||||||
|
<resultMap type="EcDevice" id="EcDeviceResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="deviceCode" column="device_code" />
|
||||||
|
<result property="brand" column="brand" />
|
||||||
|
<result property="model" column="model" />
|
||||||
|
<result property="osType" column="os_type" />
|
||||||
|
<result property="osVersion" column="os_version" />
|
||||||
|
<result property="appVersion" column="app_version" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="lastOnlineTime" column="last_online_time" />
|
||||||
|
<result property="createdAt" column="created_at" />
|
||||||
|
<result property="updatedAt" column="updated_at" />
|
||||||
|
<result property="ipAddress" column="ip_address" />
|
||||||
|
<result property="lastScreenPic" column="last_screen_pic" />
|
||||||
|
<result property="widthNum" column="width_num" />
|
||||||
|
<result property="heightNum" column="height_num" />
|
||||||
|
<result property="controlType" column="control_type" />
|
||||||
|
<result property="appId" column="app_id" />
|
||||||
|
<result property="userId" column="user_id" />
|
||||||
|
<result property="secretKey" column="secret_key" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectEcDeviceVo">
|
||||||
|
select id, device_code, brand, model, os_type, os_version, app_version, status, last_online_time, created_at, updated_at, ip_address, last_screen_pic, width_num, height_num, control_type, app_id, user_id, secret_key from ec_device
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectEcDeviceList" parameterType="EcDevice" resultMap="EcDeviceResult">
|
||||||
|
<include refid="selectEcDeviceVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="deviceCode != null and deviceCode != ''"> and device_code = #{deviceCode}</if>
|
||||||
|
<if test="osType != null and osType != ''"> and os_type = #{osType}</if>
|
||||||
|
<if test="status != null "> and status = #{status}</if>
|
||||||
|
<if test="controlType != null "> and control_type = #{controlType}</if>
|
||||||
|
<if test="appId != null "> and app_id = #{appId}</if>
|
||||||
|
<if test="userId != null "> and user_id = #{userId}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectEcDeviceById" parameterType="Long" resultMap="EcDeviceResult">
|
||||||
|
<include refid="selectEcDeviceVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertEcDevice" parameterType="EcDevice" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into ec_device
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="deviceCode != null">device_code,</if>
|
||||||
|
<if test="brand != null">brand,</if>
|
||||||
|
<if test="model != null">model,</if>
|
||||||
|
<if test="osType != null">os_type,</if>
|
||||||
|
<if test="osVersion != null">os_version,</if>
|
||||||
|
<if test="appVersion != null">app_version,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
<if test="lastOnlineTime != null">last_online_time,</if>
|
||||||
|
<if test="createdAt != null">created_at,</if>
|
||||||
|
<if test="updatedAt != null">updated_at,</if>
|
||||||
|
<if test="ipAddress != null">ip_address,</if>
|
||||||
|
<if test="lastScreenPic != null">last_screen_pic,</if>
|
||||||
|
<if test="widthNum != null">width_num,</if>
|
||||||
|
<if test="heightNum != null">height_num,</if>
|
||||||
|
<if test="controlType != null">control_type,</if>
|
||||||
|
<if test="appId != null">app_id,</if>
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="secretKey != null">secret_key,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="deviceCode != null">#{deviceCode},</if>
|
||||||
|
<if test="brand != null">#{brand},</if>
|
||||||
|
<if test="model != null">#{model},</if>
|
||||||
|
<if test="osType != null">#{osType},</if>
|
||||||
|
<if test="osVersion != null">#{osVersion},</if>
|
||||||
|
<if test="appVersion != null">#{appVersion},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="lastOnlineTime != null">#{lastOnlineTime},</if>
|
||||||
|
<if test="createdAt != null">#{createdAt},</if>
|
||||||
|
<if test="updatedAt != null">#{updatedAt},</if>
|
||||||
|
<if test="ipAddress != null">#{ipAddress},</if>
|
||||||
|
<if test="lastScreenPic != null">#{lastScreenPic},</if>
|
||||||
|
<if test="widthNum != null">#{widthNum},</if>
|
||||||
|
<if test="heightNum != null">#{heightNum},</if>
|
||||||
|
<if test="controlType != null">#{controlType},</if>
|
||||||
|
<if test="appId != null">#{appId},</if>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="secretKey != null">#{secretKey},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateEcDevice" parameterType="EcDevice">
|
||||||
|
update ec_device
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="deviceCode != null">device_code = #{deviceCode},</if>
|
||||||
|
<if test="brand != null">brand = #{brand},</if>
|
||||||
|
<if test="model != null">model = #{model},</if>
|
||||||
|
<if test="osType != null">os_type = #{osType},</if>
|
||||||
|
<if test="osVersion != null">os_version = #{osVersion},</if>
|
||||||
|
<if test="appVersion != null">app_version = #{appVersion},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="lastOnlineTime != null">last_online_time = #{lastOnlineTime},</if>
|
||||||
|
<if test="createdAt != null">created_at = #{createdAt},</if>
|
||||||
|
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
|
||||||
|
<if test="ipAddress != null">ip_address = #{ipAddress},</if>
|
||||||
|
<if test="lastScreenPic != null">last_screen_pic = #{lastScreenPic},</if>
|
||||||
|
<if test="widthNum != null">width_num = #{widthNum},</if>
|
||||||
|
<if test="heightNum != null">height_num = #{heightNum},</if>
|
||||||
|
<if test="controlType != null">control_type = #{controlType},</if>
|
||||||
|
<if test="appId != null">app_id = #{appId},</if>
|
||||||
|
<if test="userId != null">user_id = #{userId},</if>
|
||||||
|
<if test="secretKey != null">secret_key = #{secretKey},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteEcDeviceById" parameterType="Long">
|
||||||
|
delete from ec_device where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteEcDeviceByIds" parameterType="String">
|
||||||
|
delete from ec_device where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.luqj.ec.mapper.EcDeviceStatusMapper">
|
||||||
|
|
||||||
|
<resultMap type="EcDeviceStatus" id="EcDeviceStatusResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="deviceId" column="device_id" />
|
||||||
|
<result property="battery" column="battery" />
|
||||||
|
<result property="networkType" column="network_type" />
|
||||||
|
<result property="cpuUsage" column="cpu_usage" />
|
||||||
|
<result property="memoryUsage" column="memory_usage" />
|
||||||
|
<result property="screenOn" column="screen_on" />
|
||||||
|
<result property="createdAt" column="created_at" />
|
||||||
|
<result property="updatedAt" column="updated_at" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectEcDeviceStatusVo">
|
||||||
|
select id, device_id, battery, network_type, cpu_usage, memory_usage, screen_on, created_at, updated_at from ec_device_status
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectEcDeviceStatusList" parameterType="EcDeviceStatus" resultMap="EcDeviceStatusResult">
|
||||||
|
<include refid="selectEcDeviceStatusVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="deviceId != null "> and device_id = #{deviceId}</if>
|
||||||
|
<if test="networkType != null and networkType != ''"> and network_type = #{networkType}</if>
|
||||||
|
<if test="screenOn != null "> and screen_on = #{screenOn}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectEcDeviceStatusById" parameterType="Long" resultMap="EcDeviceStatusResult">
|
||||||
|
<include refid="selectEcDeviceStatusVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertEcDeviceStatus" parameterType="EcDeviceStatus" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into ec_device_status
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="deviceId != null">device_id,</if>
|
||||||
|
<if test="battery != null">battery,</if>
|
||||||
|
<if test="networkType != null">network_type,</if>
|
||||||
|
<if test="cpuUsage != null">cpu_usage,</if>
|
||||||
|
<if test="memoryUsage != null">memory_usage,</if>
|
||||||
|
<if test="screenOn != null">screen_on,</if>
|
||||||
|
<if test="createdAt != null">created_at,</if>
|
||||||
|
<if test="updatedAt != null">updated_at,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="deviceId != null">#{deviceId},</if>
|
||||||
|
<if test="battery != null">#{battery},</if>
|
||||||
|
<if test="networkType != null">#{networkType},</if>
|
||||||
|
<if test="cpuUsage != null">#{cpuUsage},</if>
|
||||||
|
<if test="memoryUsage != null">#{memoryUsage},</if>
|
||||||
|
<if test="screenOn != null">#{screenOn},</if>
|
||||||
|
<if test="createdAt != null">#{createdAt},</if>
|
||||||
|
<if test="updatedAt != null">#{updatedAt},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateEcDeviceStatus" parameterType="EcDeviceStatus">
|
||||||
|
update ec_device_status
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="deviceId != null">device_id = #{deviceId},</if>
|
||||||
|
<if test="battery != null">battery = #{battery},</if>
|
||||||
|
<if test="networkType != null">network_type = #{networkType},</if>
|
||||||
|
<if test="cpuUsage != null">cpu_usage = #{cpuUsage},</if>
|
||||||
|
<if test="memoryUsage != null">memory_usage = #{memoryUsage},</if>
|
||||||
|
<if test="screenOn != null">screen_on = #{screenOn},</if>
|
||||||
|
<if test="createdAt != null">created_at = #{createdAt},</if>
|
||||||
|
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteEcDeviceStatusById" parameterType="Long">
|
||||||
|
delete from ec_device_status where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteEcDeviceStatusByIds" parameterType="String">
|
||||||
|
delete from ec_device_status where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.luqj.ec.mapper.EcTaskCommandMapper">
|
||||||
|
|
||||||
|
<resultMap type="EcTaskCommand" id="EcTaskCommandResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="taskId" column="task_id" />
|
||||||
|
<result property="stepOrder" column="step_order" />
|
||||||
|
<result property="commandType" column="command_type" />
|
||||||
|
<result property="commandContent" column="command_content" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectEcTaskCommandVo">
|
||||||
|
select id, task_id, step_order, command_type, command_content from ec_task_command
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectEcTaskCommandList" parameterType="EcTaskCommand" resultMap="EcTaskCommandResult">
|
||||||
|
<include refid="selectEcTaskCommandVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="taskId != null "> and task_id = #{taskId}</if>
|
||||||
|
<if test="commandType != null and commandType != ''"> and command_type = #{commandType}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectEcTaskCommandById" parameterType="Long" resultMap="EcTaskCommandResult">
|
||||||
|
<include refid="selectEcTaskCommandVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertEcTaskCommand" parameterType="EcTaskCommand" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into ec_task_command
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="taskId != null">task_id,</if>
|
||||||
|
<if test="stepOrder != null">step_order,</if>
|
||||||
|
<if test="commandType != null">command_type,</if>
|
||||||
|
<if test="commandContent != null">command_content,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="taskId != null">#{taskId},</if>
|
||||||
|
<if test="stepOrder != null">#{stepOrder},</if>
|
||||||
|
<if test="commandType != null">#{commandType},</if>
|
||||||
|
<if test="commandContent != null">#{commandContent},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateEcTaskCommand" parameterType="EcTaskCommand">
|
||||||
|
update ec_task_command
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="taskId != null">task_id = #{taskId},</if>
|
||||||
|
<if test="stepOrder != null">step_order = #{stepOrder},</if>
|
||||||
|
<if test="commandType != null">command_type = #{commandType},</if>
|
||||||
|
<if test="commandContent != null">command_content = #{commandContent},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteEcTaskCommandById" parameterType="Long">
|
||||||
|
delete from ec_task_command where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteEcTaskCommandByIds" parameterType="String">
|
||||||
|
delete from ec_task_command where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.luqj.ec.mapper.EcTaskDeviceMapper">
|
||||||
|
|
||||||
|
<resultMap type="EcTaskDevice" id="EcTaskDeviceResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="taskId" column="task_id" />
|
||||||
|
<result property="deviceId" column="device_id" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="updatedAt" column="updated_at" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectEcTaskDeviceVo">
|
||||||
|
select id, task_id, device_id, status, updated_at from ec_task_device
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectEcTaskDeviceList" parameterType="EcTaskDevice" resultMap="EcTaskDeviceResult">
|
||||||
|
<include refid="selectEcTaskDeviceVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="taskId != null "> and task_id = #{taskId}</if>
|
||||||
|
<if test="deviceId != null "> and device_id = #{deviceId}</if>
|
||||||
|
<if test="status != null "> and status = #{status}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectEcTaskDeviceById" parameterType="Long" resultMap="EcTaskDeviceResult">
|
||||||
|
<include refid="selectEcTaskDeviceVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertEcTaskDevice" parameterType="EcTaskDevice" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into ec_task_device
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="taskId != null">task_id,</if>
|
||||||
|
<if test="deviceId != null">device_id,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
<if test="updatedAt != null">updated_at,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="taskId != null">#{taskId},</if>
|
||||||
|
<if test="deviceId != null">#{deviceId},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="updatedAt != null">#{updatedAt},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateEcTaskDevice" parameterType="EcTaskDevice">
|
||||||
|
update ec_task_device
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="taskId != null">task_id = #{taskId},</if>
|
||||||
|
<if test="deviceId != null">device_id = #{deviceId},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteEcTaskDeviceById" parameterType="Long">
|
||||||
|
delete from ec_task_device where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteEcTaskDeviceByIds" parameterType="String">
|
||||||
|
delete from ec_task_device where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>org.adminframework.boot</groupId>
|
||||||
|
<artifactId>luqj-plugin-demo</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>luqj-plugin-demo</name>
|
||||||
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<plugin.dir>D:\luqj-plugins\plugin-demo\1.0.0</plugin.dir>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.adminframework.boot</groupId>
|
||||||
|
<artifactId>luqj-plugin-interface</artifactId>
|
||||||
|
<version>2.3.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>luqj-plugin</artifactId>
|
||||||
|
<version>3.4.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ant-contrib</groupId>
|
||||||
|
<artifactId>ant-contrib</artifactId>
|
||||||
|
<version>1.0b3</version>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-antrun-plugin</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>copy</id>
|
||||||
|
<phase>install</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>run</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<target>
|
||||||
|
|
||||||
|
<!-- antcontrib 支持 -->
|
||||||
|
<taskdef resource="net/sf/antcontrib/antcontrib.properties"
|
||||||
|
classpathref="maven.runtime.classpath"/>
|
||||||
|
|
||||||
|
<if>
|
||||||
|
<contains string="${os.name}" substring="Windows"/>
|
||||||
|
<then>
|
||||||
|
<echo>copying handler.jar to plugin dir ...</echo>
|
||||||
|
<sleep seconds="5"/>
|
||||||
|
<copy
|
||||||
|
tofile="${plugin.dir}/${project.artifactId}-${project.version}.jar"
|
||||||
|
file="${project.basedir}/target/${project.artifactId}-${project.version}.jar"/>
|
||||||
|
</then>
|
||||||
|
<else>
|
||||||
|
<echo>current os is ${os.name}, will not copy handler.jar to plugin dir</echo>
|
||||||
|
</else>
|
||||||
|
</if>
|
||||||
|
|
||||||
|
</target>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package org.code.modules.plugin.demo;
|
||||||
|
|
||||||
|
import org.code.modules.plugins.annotation.PluginBean;
|
||||||
|
import org.code.modules.plugins.annotation.PluginType;
|
||||||
|
import org.code.modules.plugins.service.IPluginTest;
|
||||||
|
@PluginBean(name = "pluginDemo", beanType = PluginType.DB_PLUGIN)
|
||||||
|
public class PluginTestService implements IPluginTest {
|
||||||
|
@Override
|
||||||
|
public String funcExec(String str) {
|
||||||
|
return "hahah";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
isLoad=true
|
||||||
|
jarName=lu-admin-plugin-demo-1.0.jar
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>org.adminframework.boot</groupId>
|
||||||
|
<artifactId>luqj-plugin-interface</artifactId>
|
||||||
|
<version>2.3.0</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>luqj-plugin-interface</name>
|
||||||
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package org.code.modules.plugins.service;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public interface FormulaPluginHelp {
|
||||||
|
Set<String> parseFieldList(String var1);
|
||||||
|
|
||||||
|
Object execFormula(String var1, Map<String, Object> var2);
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package org.code.modules.plugins.service;
|
||||||
|
|
||||||
|
public interface IPluginTest {
|
||||||
|
String funcExec(String str);
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi</artifactId>
|
||||||
|
<version>3.4.0</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>luqj-plugin</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>luqj-plugin</name>
|
||||||
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.sf.json-lib</groupId>
|
||||||
|
<artifactId>json-lib</artifactId>
|
||||||
|
<version>2.3</version>
|
||||||
|
<classifier>jdk13</classifier>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
<version>2.6</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<version>33.0.0-jre</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>luqj-common</artifactId>
|
||||||
|
<version>3.4.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,142 @@
|
|||||||
|
package org.code.modules.plugins;
|
||||||
|
|
||||||
|
import com.luqj.util.log.LogUtil;
|
||||||
|
import com.luqj.util.reflect.ClassUtils;
|
||||||
|
import com.luqj.util.reflect.GSetterUtil;
|
||||||
|
import org.code.modules.plugins.service.IBeanFactory;
|
||||||
|
import org.code.modules.plugins.service.IPluginRegistry;
|
||||||
|
import org.code.modules.plugins.service.IllegalPluginException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.context.annotation.DependsOn;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
@DependsOn(value = "defPluginRegistry")
|
||||||
|
@Component(value = "pluginBeanFactory")
|
||||||
|
public class PluginBeanFactory implements IBeanFactory {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(PluginBeanFactory.class);
|
||||||
|
@Autowired
|
||||||
|
private IPluginRegistry pluginRegistry;
|
||||||
|
@Autowired
|
||||||
|
@Qualifier("springBeanFactory")
|
||||||
|
private IBeanFactory springBeanFactory;
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
pluginRegistry.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> T getBean(String beanName, Class<T> beanClass) {
|
||||||
|
if (beanName.endsWith("Action")) {
|
||||||
|
LOGGER.debug("获取bean: {}", beanName);
|
||||||
|
}
|
||||||
|
return getBean(beanName, "def", beanClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> T getBean(String beanName, String version, Class<T> beanClass) {
|
||||||
|
try {
|
||||||
|
T obj = pluginRegistry.instancePluginBean(beanName, version, beanClass);
|
||||||
|
if (obj != null) {
|
||||||
|
injectBean(obj);
|
||||||
|
return obj;
|
||||||
|
} else {
|
||||||
|
if (this.springBeanFactory.containsBean(beanName)) {
|
||||||
|
return this.springBeanFactory.getBean(beanName, beanClass);
|
||||||
|
} else {
|
||||||
|
LOGGER.debug("找不到指定的bean[{}]", beanName);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
|
||||||
|
LOGGER.error(LogUtil.exceptionMsg("bean[" + beanName + ":" + version + "],加载异常", e), e);
|
||||||
|
new IllegalPluginException(LogUtil.exceptionMsg("bean[" + beanName + ":" + version + "],加载异常", e), e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getBean(String beanName) {
|
||||||
|
return getBean(beanName, Object.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void injectBean(Object obj, String version) {
|
||||||
|
Class<?> classType = obj.getClass();
|
||||||
|
Field[] fields = ClassUtils.getDeclaredFields(classType);
|
||||||
|
for (Field field : fields) {
|
||||||
|
try {
|
||||||
|
if (this.springBeanFactory.containsBean(field.getName())) {
|
||||||
|
if (GSetterUtil.existSetter(classType, field)) {
|
||||||
|
if (LOGGER.isTraceEnabled()) {
|
||||||
|
LOGGER.trace(classType.getSimpleName() + "." + field.getName() + "spring注入成功!");
|
||||||
|
}
|
||||||
|
GSetterUtil.setValueBySetter(obj, field, this.springBeanFactory.getBean(field.getName()));
|
||||||
|
}
|
||||||
|
} else if (this.pluginRegistry.containsPluginBean(field.getName())
|
||||||
|
&& GSetterUtil.getValueByGetter(obj, field) == null) {//有值不注入
|
||||||
|
Object fBean = this.getBean(field.getName(), Object.class);
|
||||||
|
injectBean(fBean, version);
|
||||||
|
GSetterUtil.setValueBySetter(obj, field, fBean);
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
LOGGER.error(classType.getSimpleName() + "." + field.getName() +
|
||||||
|
"注入异常,异常消息[" + e.getMessage() + "]", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void injectBean(Object obj) {
|
||||||
|
Class<?> classType = obj.getClass();
|
||||||
|
Field[] fields = ClassUtils.getDeclaredFields(classType);
|
||||||
|
for (Field field : fields) {
|
||||||
|
try {
|
||||||
|
if (this.springBeanFactory.containsBean(field.getName())) {
|
||||||
|
if (GSetterUtil.existSetter(classType, field)) {
|
||||||
|
if (LOGGER.isTraceEnabled()) {
|
||||||
|
LOGGER.trace(classType.getSimpleName() + "." + field.getName() + "spring注入成功!");
|
||||||
|
}
|
||||||
|
GSetterUtil.setValueBySetter(obj, field, this.springBeanFactory.getBean(field.getName()));
|
||||||
|
}
|
||||||
|
} else if (this.pluginRegistry.containsPluginBean(field.getName())
|
||||||
|
&& GSetterUtil.getValueByGetter(obj, field) == null) {//有值不注入
|
||||||
|
Object fBean = this.getBean(field.getName());
|
||||||
|
injectBean(fBean);
|
||||||
|
GSetterUtil.setValueBySetter(obj, field, fBean);
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
LOGGER.error(classType.getSimpleName() + "." + field.getName() +
|
||||||
|
"注入异常,异常消息[" + e.getMessage() + "]", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean containsBean(String beanName) {
|
||||||
|
return pluginRegistry.containsPluginBean(beanName)
|
||||||
|
|| springBeanFactory.containsBean(beanName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void autowireComponent(Object bean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public IPluginRegistry getPluginRegistry() {
|
||||||
|
return pluginRegistry;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPluginRegistry(IPluginRegistry pluginRegistry) {
|
||||||
|
this.pluginRegistry = pluginRegistry;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package org.code.modules.plugins;;
|
||||||
|
|
||||||
|
import com.luqj.util.assertion.Assert;
|
||||||
|
import org.code.modules.plugins.service.IBeanFactory;
|
||||||
|
import org.springframework.beans.BeansException;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.ApplicationContextAware;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component(value = "springBeanFactory")
|
||||||
|
public class SpringBeanFactory implements ApplicationContextAware, IBeanFactory {
|
||||||
|
private static ApplicationContext applicationContext;
|
||||||
|
|
||||||
|
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||||
|
if (SpringBeanFactory.applicationContext == null) {
|
||||||
|
SpringBeanFactory.applicationContext = applicationContext;
|
||||||
|
}
|
||||||
|
System.out.println("========ApplicationContext配置成功========");
|
||||||
|
System.out.println("========在普通类可以通过调用SpringUtils.getAppContext()获取applicationContext对象========");
|
||||||
|
System.out.println("========applicationContext=" + SpringBeanFactory.applicationContext + "========");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取applicationContext
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static ApplicationContext getApplicationContext() {
|
||||||
|
return applicationContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean containsBean(String beanName) {
|
||||||
|
return this.applicationContext.containsBean(beanName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> T getBean(String beanName, Class<T> beanClass) {
|
||||||
|
return applicationContext.getBean(beanName, beanClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getBean(String beanName) {
|
||||||
|
return applicationContext.getBean(beanName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void injectBean(Object obj) {
|
||||||
|
Assert.fail("此类禁用此方法");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void injectBean(Object obj, String version) {
|
||||||
|
Assert.fail("此类禁用此方法");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void autowireComponent(Object bean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> T getBean(String beanName, String version, Class<T> beanClass) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return getBean(beanName, beanClass);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package org.code.modules.plugins.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.TYPE)
|
||||||
|
public @interface DBTypeMapping {
|
||||||
|
|
||||||
|
String name();
|
||||||
|
|
||||||
|
String dbType();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package org.code.modules.plugins.annotation;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
@Target({ElementType.TYPE})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
@Component
|
||||||
|
public @interface EtlApiDubboService {
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package org.code.modules.plugins.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface EtlApiSave {
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package org.code.modules.plugins.annotation;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
@Target({ElementType.TYPE})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
@Component
|
||||||
|
public @interface EtlApiService {
|
||||||
|
String pluginCode();
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package org.code.modules.plugins.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by chenzm on 2016/12/27.
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.FIELD)
|
||||||
|
public @interface PluginAttribute {
|
||||||
|
String code() default "";
|
||||||
|
String name();
|
||||||
|
String type() default "";
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package org.code.modules.plugins.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实现数据备份所需的插件
|
||||||
|
* @author xufm
|
||||||
|
* @date 2018/4/2
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.TYPE)
|
||||||
|
public @interface PluginBackup {
|
||||||
|
/**
|
||||||
|
* 别名
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String name() default "";
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
package org.code.modules.plugins.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.TYPE)
|
||||||
|
public @interface PluginBean {
|
||||||
|
/**
|
||||||
|
* 插件名称
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String name() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 别名
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String aliasName() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插件类
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PluginEnum clazz() default PluginEnum.DEFAULT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插件所属分类
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String pluginClassify() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插件类型
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PluginType beanType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分区模式
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String partitionPattern() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线程模式
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String workThreadPattern() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分区
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PluginPartition[] partitions() default {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行模式
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
EnumExecuteMod executeMod() default EnumExecuteMod.NOTHING;
|
||||||
|
|
||||||
|
|
||||||
|
enum EnumExecuteMod {
|
||||||
|
/**
|
||||||
|
* 表示不显示
|
||||||
|
*/
|
||||||
|
NOTHING(""),
|
||||||
|
/**
|
||||||
|
* ETL显示
|
||||||
|
*/
|
||||||
|
ETL("1"),
|
||||||
|
/**
|
||||||
|
* 魔方显示
|
||||||
|
*/
|
||||||
|
MF("2"),
|
||||||
|
/**
|
||||||
|
* 所有都显示
|
||||||
|
*/
|
||||||
|
ALL("3");
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
EnumExecuteMod(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package org.code.modules.plugins.annotation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插件类型
|
||||||
|
* Created by chenzm on 2017/1/12.
|
||||||
|
*/
|
||||||
|
public enum PluginEnum {
|
||||||
|
INPUT_PLUGIN("输入插件", "org.code.modules.plugin.common.InputTransPlugin"),
|
||||||
|
|
||||||
|
OUTPUT_PLUGIN("输出插件", "org.code.modules.plugin.common.OutputTransPlugin"),
|
||||||
|
|
||||||
|
TRANSFORM_PLUGIN("转换插件", "org.code.modules.plugin.common.TransformPlugin"),
|
||||||
|
|
||||||
|
BATCH_TRANSFORM_PLUGIN("批量转换插件", "org.code.modules.plugin.common.BatchTransformPlugin"),
|
||||||
|
|
||||||
|
SAVEPOINT_PLUGIN("增量输出插件", "org.code.modules.plugin.common.SavePointTransformPlugin"),
|
||||||
|
|
||||||
|
AGGREGATOR_PLUGIN("聚合插件", "org.code.modules.plugin.common.AggregatorPlugin"),
|
||||||
|
|
||||||
|
DEFAULT("", "");
|
||||||
|
|
||||||
|
public String name;
|
||||||
|
|
||||||
|
public String javaClass;
|
||||||
|
|
||||||
|
PluginEnum(String name, String javaClass) {
|
||||||
|
this.name = name;
|
||||||
|
this.javaClass = javaClass;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package org.code.modules.plugins.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分区注解
|
||||||
|
* Created by chenzm on 2016/12/27.
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.TYPE)
|
||||||
|
public @interface PluginPartition {
|
||||||
|
String code() default "";
|
||||||
|
|
||||||
|
String name();
|
||||||
|
|
||||||
|
String type();
|
||||||
|
|
||||||
|
String pattern();
|
||||||
|
|
||||||
|
String javaClass();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否默认分区
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean isDefaultPartition() default false;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package org.code.modules.plugins.annotation;
|
||||||
|
|
||||||
|
public enum PluginType {
|
||||||
|
DB_PLUGIN,
|
||||||
|
ETL_TRANS_PLUGIN,
|
||||||
|
BS_PLUGIN,
|
||||||
|
ETL_TRANS_EXP,
|
||||||
|
//ETL的VO对象
|
||||||
|
ETL_TRANS_META,
|
||||||
|
FUNC,
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package org.code.modules.plugins.annotation;
|
||||||
|
|
||||||
|
import org.code.modules.plugins.types.TypeEnum;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
public @interface TransNonStandard {
|
||||||
|
|
||||||
|
TypeEnum stdType();
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package org.code.modules.plugins.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
public @interface TransStandard {
|
||||||
|
|
||||||
|
String typeCode();
|
||||||
|
}
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
package org.code.modules.plugins.annotation.function;
|
||||||
|
|
||||||
|
public @interface Asscocation {
|
||||||
|
String relationName();
|
||||||
|
|
||||||
|
Asscocation.RefType refType() default Asscocation.RefType.aggregation;
|
||||||
|
|
||||||
|
public static enum RefType {
|
||||||
|
aggregation,
|
||||||
|
composite;
|
||||||
|
|
||||||
|
private RefType() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package org.code.modules.plugins.annotation.function;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target({ElementType.FIELD})
|
||||||
|
public @interface Feature {
|
||||||
|
Feature.RefType refType() default Feature.RefType.aggregation;
|
||||||
|
|
||||||
|
Feature.HandlerType handler() default Feature.HandlerType.HANDLER;
|
||||||
|
|
||||||
|
public static enum RefType {
|
||||||
|
aggregation,
|
||||||
|
composite;
|
||||||
|
|
||||||
|
private RefType() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static enum HandlerType {
|
||||||
|
IGNORE,
|
||||||
|
HANDLER;
|
||||||
|
|
||||||
|
private HandlerType() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package org.code.modules.plugins.annotation.function;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target({ElementType.TYPE})
|
||||||
|
public @interface Meta {
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package org.code.modules.plugins.annotation.function;
|
||||||
|
|
||||||
|
public @interface Relation {
|
||||||
|
String relationName();
|
||||||
|
|
||||||
|
Relation.RefType refType() default Relation.RefType.aggregation;
|
||||||
|
|
||||||
|
public static enum RefType {
|
||||||
|
aggregation,
|
||||||
|
composite;
|
||||||
|
|
||||||
|
private RefType() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
package org.code.modules.plugins.data;
|
||||||
|
|
||||||
|
|
||||||
|
import com.luqj.util.LinkedMultiValueMap;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import org.code.modules.plugins.plugin.IIdentifierGenerator;
|
||||||
|
import org.code.modules.plugins.plugin.IRow;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据行
|
||||||
|
* Created by chenzm on 2017/1/6.
|
||||||
|
*/
|
||||||
|
public class RowData extends LinkedMultiValueMap<String, Object> implements IRow<String, Object> {
|
||||||
|
|
||||||
|
private static final String IS_END_ROW = "$D_IS_END_ROW";
|
||||||
|
|
||||||
|
private transient IIdentifierGenerator identifierGenerator = DEFAULT_GENERATOR;
|
||||||
|
|
||||||
|
private boolean isLastRowForDataSet=false;
|
||||||
|
|
||||||
|
private String rowId;
|
||||||
|
|
||||||
|
private String sourceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认的ID生成器
|
||||||
|
*/
|
||||||
|
private transient static final IIdentifierGenerator DEFAULT_GENERATOR = new IIdentifierGenerator() {
|
||||||
|
@Override
|
||||||
|
public String generate(IRow<String, Object> row) {
|
||||||
|
return UUID.randomUUID().toString();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public RowData() {
|
||||||
|
}
|
||||||
|
public RowData(Map<String, List<Object>> row){
|
||||||
|
this.putAll(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RowData(IIdentifierGenerator generator) {
|
||||||
|
this.identifierGenerator = generator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RowData(boolean isEndRow) {
|
||||||
|
this.set(IS_END_ROW, isEndRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset(Map<String, List<Object>> row) {
|
||||||
|
this.clear();
|
||||||
|
this.putAll(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String rowId() {
|
||||||
|
if (StringUtils.isBlank(rowId)) {
|
||||||
|
if(identifierGenerator==null){
|
||||||
|
this.rowId=StringUtils.uuid();
|
||||||
|
}else{
|
||||||
|
this.rowId=identifierGenerator.generate(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this.rowId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否结束行
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isEndRow() {
|
||||||
|
if(!this.containsKey(IS_END_ROW) || this.getFirst(IS_END_ROW) == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return (Boolean) this.getFirst(IS_END_ROW);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isLastRowForDataSet() {
|
||||||
|
return this.isLastRowForDataSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSourceId() {
|
||||||
|
|
||||||
|
return this.sourceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void markLastRowForDataSet(){
|
||||||
|
this.isLastRowForDataSet=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setIdentifierGenerator(IIdentifierGenerator generator) {
|
||||||
|
this.identifierGenerator = generator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndRow(boolean endRow) {
|
||||||
|
this.set(IS_END_ROW, endRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IIdentifierGenerator getIdentifierGenerator() {
|
||||||
|
return identifierGenerator;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,210 @@
|
|||||||
|
package org.code.modules.plugins.function;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内置函数枚举类型
|
||||||
|
*
|
||||||
|
* @author chenzm
|
||||||
|
*/
|
||||||
|
public enum FuncEnum {
|
||||||
|
BAG("BAG", 0, "包函数对参数不进行任何的计算直接返回参数 (系统级函数,NULL-OBJECT模式)", "org.code.modules.plugins.function.method.BagFunc"),
|
||||||
|
|
||||||
|
REVERSE_LONG_TO_DATE("REVERSE_LONG_TO_DATE", 0, "数字转时间格式", "com.code.std.function.method.datetime.ReverseLongToDateFunc"),
|
||||||
|
TO_DATE("CHAR_TO_DATE", 0, "字符串转时间格式", "com.code.std.function.method.datetime.ToDateFunc"),
|
||||||
|
TO_CHAR("DATE_TO_CHAR", 0, "时间转字符串格式", "com.code.std.function.method.datetime.ToCharFunc"),
|
||||||
|
SYS_TIME("SYS_TIME", 0, "获取系统时间", "com.code.std.function.method.datetime.SysTimeFunc"),
|
||||||
|
MILLISECONDS("MILLISECONDS", 0, "获取毫秒数", "com.code.std.function.method.datetime.MilliSeconds"),
|
||||||
|
DATE_ADD("DATE_ADD", 0, "时间添加函数", "com.code.std.function.method.date.AddDayFunc"),
|
||||||
|
|
||||||
|
|
||||||
|
MAX("MAX", 0, "从一组数字中返回最大值", "com.code.std.function.method.mathematical.MaxFunc"),
|
||||||
|
MIN("MIN", 0, "从一组数字中返回最小值", "com.code.std.function.method.mathematical.MinFunc"),
|
||||||
|
AVG("AVG", 0, "从一组数字获取平均值", "com.code.std.function.method.mathematical.AvgFunc"),
|
||||||
|
SUM("SUM", 0, "一组数字的总和", "com.code.std.function.method.mathematical.SumFunc"),
|
||||||
|
CHAR_TO_NUMBER("CHAR_TO_NUMBER", 0, "文本转成数字", "com.code.std.function.method.mathematical.ToNumberFunc"),
|
||||||
|
NUMBER_TO_CHAR("NUMBER_TO_CHAR", 0, "数字转成文本", "com.code.std.function.method.text.ToCharFunc"),
|
||||||
|
POW("POW", 0, "求平方数", "com.code.std.function.method.mathematical.PowFunc"),
|
||||||
|
|
||||||
|
RAVG("RAVG", 1, "数据集间求平均值", "com.code.std.function.method.mathematical.dataset.RAvgFunc"),
|
||||||
|
RMASS("RMASS", 1, "数据集间求众数", "com.code.std.function.method.mathematical.dataset.RMassFunc"),
|
||||||
|
RMAX("RMAX", 1, "数据集间求最大值", "com.code.std.function.method.mathematical.dataset.RMaxFunc"),
|
||||||
|
RMAX_LENGTH("RMAX_LENGTH", 1, "数据集间求最长值", "com.code.std.function.method.mathematical.dataset.RMaxLengthFunc"),
|
||||||
|
RMAX_MIDVALUE("RMAX_MIDVALUE", 1, "数据集间求中位数", "com.code.std.function.method.mathematical.dataset.RMidValueFunc"),
|
||||||
|
RMIN("RMIN", 1, "数据集间求最小值", "com.code.std.function.method.mathematical.dataset.RMinFunc"),
|
||||||
|
RMIN_LENGTH("RMIN_LENGTH", 1, "数据集间求最短值", "com.code.std.function.method.mathematical.dataset.RMinLengthFunc"),
|
||||||
|
RQTR3("RQTR3", 1, "数据集间求四分位数Q3", "com.code.std.function.method.mathematical.dataset.RQtr3Func"),
|
||||||
|
RQTR("RQTR", 1, "数据集间求四分位数Q1", "com.code.std.function.method.mathematical.dataset.RQtrFunc"),
|
||||||
|
RQTR_MINUS("RQTR_MINUS", 1, "数据集间求四分位数极差", "com.code.std.function.method.mathematical.dataset.RQtrMinusFunc"),
|
||||||
|
RRANGE("RRANGE", 1, "数据集间求极差", "com.code.std.function.method.mathematical.dataset.RRangeFunc"),
|
||||||
|
RSTDDEV("RSTDDEV", 1, "数据集间求标准差", "com.code.std.function.method.mathematical.dataset.RStdDevFunc"),
|
||||||
|
RVALUERANGE("RVALUERANGE", 1, "数据集间求值分布", "com.code.std.function.method.mathematical.dataset.RValueRangeFunc"),
|
||||||
|
RVARIANCE("RVARIANCE", 1, "数据集间求方差", "com.code.std.function.method.mathematical.dataset.RVarianceFunc"),
|
||||||
|
RVALSTA("RVALSTA", 1, "值统计", "com.code.std.function.method.mathematical.dataset.RValStaFunc"),
|
||||||
|
RSUM("RSUM", 1, "数据集间求和", "com.code.std.function.method.mathematical.dataset.RSumFunc"),
|
||||||
|
|
||||||
|
|
||||||
|
TRUE("TRUE", 0, "返回常数true值", "com.code.std.function.method.logical.TrueFunc"),
|
||||||
|
OR("OR", 0, "计算一组布尔参数的逻辑或", "com.code.std.function.method.logical.OrFunc"),
|
||||||
|
AND("AND", 0, "计算一组布尔参数的逻辑 与", "com.code.std.function.method.logical.AndFunc"),
|
||||||
|
IF("IF", 0, "返回两个值中的一个,根据条件", "com.code.std.function.method.logical.IfFunc"),
|
||||||
|
EQ("EQ", 0, "两个数值参数间的逻辑比较是否相等", "com.code.std.function.method.logical.EqFunc"),
|
||||||
|
GT("GT", 0, "两个数值参数间的逻辑比较是否大于", "com.code.std.function.method.logical.GtFunc"),
|
||||||
|
GTE("GTE", 0, "两个数值参数间的逻辑比较是否大于等于", "com.code.std.function.method.logical.GteFunc"),
|
||||||
|
LT("LT", 0, "两个数值参数间的逻辑比较是否小于", "com.code.std.function.method.logical.LtFunc"),
|
||||||
|
LTE("LTE", 0, "两个数值参数间的逻辑比较是否小于等于", "com.code.std.function.method.logical.LteFunc"),
|
||||||
|
NOT("NOT", 0, "计算逻辑NOT", "com.code.std.function.method.logical.NotFunc"),
|
||||||
|
XOR("XOR", 0, "计算逻辑XOR", "com.code.std.function.method.logical.XorFunc"),
|
||||||
|
MATCH("MATCH", 0, "逻辑匹配函数", "com.code.std.function.method.logical.MatchFunc"),
|
||||||
|
|
||||||
|
CHOOSE("CHOOSE", 0, "使用索引从值的列表返回一个值", "com.code.std.function.method.information.ChooseFunc"),
|
||||||
|
ISBLANK("ISBLANK", 0, "如果参数值为空返回TRUE,否则返回FALSE", "com.code.std.function.method.information.IsBlankFunc"),
|
||||||
|
ISNUMBER("ISNUMBER", 0, "如果参数值为数字返回TRUE,否则返回FALSE", "com.code.std.function.method.information.IsNumberFunc"),
|
||||||
|
ISTEXT("ISTEXT", 0, "如果参数值为文本返回TRUE,否则返回FALSE", "com.code.std.function.method.information.IsTextFunc"),
|
||||||
|
|
||||||
|
TEXT("TEXT", 0, "返回转换为文本的值", "com.code.std.function.method.text.TextFunc"),
|
||||||
|
TRIM("TRIM", 0, "返回文本去空后的值", "com.code.std.function.method.text.TrimFunc"),
|
||||||
|
UPPER("UPPER", 0, "小写字母转换为大写字母", "com.code.std.function.method.text.UpperFunc"),
|
||||||
|
LEN("LEN", 0, "返回文本的长度", "com.code.std.function.method.text.LenFunc"),
|
||||||
|
LOWER("LOWER", 0, "大写字母转换为小写字母", "com.code.std.function.method.text.LowerFunc"),
|
||||||
|
SUBSTRING("SUBSTRING", 0, "文本截取函数", "com.code.std.function.method.text.SubstringFunc"),
|
||||||
|
REPLACE("REPLACE", 0, "文本替换函数", "com.code.std.function.method.text.ReplaceFunc"),
|
||||||
|
EXACT("EXACT", 0, "比较两个字符串是否一致", "com.code.std.function.method.text.ExactFunc"),
|
||||||
|
FIND("FIND", 0, "查找字符串的位置", "com.code.std.function.method.text.FindFunc"),
|
||||||
|
CONCAT("CONCAT", 0, "字符串连接函数", "com.code.std.function.method.text.ConcatFunc"),
|
||||||
|
CONCAT_MULTI("CONCAT_MULTI", 0, "字符串连接函数(可变长参数)", "com.code.std.function.method.text.ConcatFunc"),
|
||||||
|
SPLITROW("SPLITROW", 0, "一行拆分成多行", "com.code.std.function.method.text.SplitIntoMultiRows"),
|
||||||
|
JSONPARSE("JSONPARSE", 0, "JSON解析", "com.code.std.function.method.text.JsonParseFunc"),
|
||||||
|
SPLIT("SPLIT", 0, "文本切分", "com.code.std.function.method.text.SplitFunc"),
|
||||||
|
INCLUDE("INCLUDE", 0, "包含函数", "com.code.std.function.method.text.IncludeFunc"),
|
||||||
|
|
||||||
|
DECODE("DECODE", 0, "decode函数解析", "com.code.std.function.method.text.DecodeFunc"),
|
||||||
|
TO_ARRAY("TO_ARRAY", 0, "字符串转数组", "com.code.std.function.method.text.ToArrayFunc"),
|
||||||
|
|
||||||
|
BIZ_IDCARD_GENDER("BIZ_IDCARD_GENDER", 0, "身份证查询性别函数", "com.code.std.function.method.biz.IdCardGenderFunc"),
|
||||||
|
BIZ_IDCARD_BIRTH("BIZ_IDCARD_BIRTH", 0, "身份证查询日期函数", "com.code.std.function.method.biz.IdCardBirthDay"),
|
||||||
|
BIZ_KEYPERSON_FILTER("BIZ_KEYPERSON_FILTER", 0, "前科人员筛选函数", "com.code.std.function.method.biz.KeyPersonFilterFunc"),
|
||||||
|
BIZ_MERGE_KEYPERSON("BIZ_MERGE_KEYPERSON", 0, "前科人员合并函数", "com.code.std.function.method.biz.MergeKeyPersonFunc"),
|
||||||
|
|
||||||
|
DATA_COMPARISON("DATA_COMPARISON", 0, "数据比对", ""),
|
||||||
|
REDIS_DELETE("REDIS_DELETE", 0, "redis数据删除", ""),
|
||||||
|
REDIS_VALUES("REDIS_VALUES", 0, "redis取值", ""),
|
||||||
|
QUERY_CACHE("QUERY_CACHE", 0, "redis缓存查询", ""),
|
||||||
|
|
||||||
|
|
||||||
|
BERNOULLI_SAMPLER("BERNOULLI_SAMPLER", 0, "伯努利数据抽样", ""),
|
||||||
|
POISSON_SAMPLER("POISSON_SAMPLER", 0, "泊松数据抽样", ""),
|
||||||
|
RESERVOIR_SAMPLER("RESERVOIR_SAMPLER", 0, "水塘抽样", " "),
|
||||||
|
|
||||||
|
|
||||||
|
TEMPLATE_FUNCTION_A("TEMPLATE_FUNCTION_A", 0, "空模板", "com.code.std.function.method.biz.TemplateFunctionA"),
|
||||||
|
|
||||||
|
REDUCE_BY_COUNT("REDUCE_BY_COUNT", 0, "reduce统计函数", "com.code.std.function.method.reduce.CountNumberFunc"),
|
||||||
|
|
||||||
|
PLATENO_FILTER("PLATENO_FILTER", 0, "过滤数据", "com.code.std.function.method.fatePlate.PlateNOFilterFunc"),
|
||||||
|
PLATENO_TEST("PLATENO_TEST", 0, "车牌测试数据", "com.code.std.function.method.fatePlate.PlateNOTestFunc"),
|
||||||
|
|
||||||
|
//fakePlate
|
||||||
|
STR_CONTAINS("STR_CONTAINS", 0, "判断是否包含字符串", "com.code.std.function.method.fatePlate.StrContainsFunc"),
|
||||||
|
UTC_DATE_PARSE("UTC_DATE_PARSE", 0, "转换东八区时间", "com.code.std.function.method.fatePlate.UTCDateParseFunc"),
|
||||||
|
DISTINCT_SORT_VEHICLE("DISTINCT_SORT_VEHICLE", 0, "去重并排序卡口", "com.code.std.function.method.fatePlate.DistinctSortVehicleFunc"),
|
||||||
|
SPLIT_VEHICLE_TUPPLE("SPLIT_VEHICLE_TUPPLE", 0, "拆分卡口元组", "com.code.std.function.method.fatePlate.SplitVehicleTuppleFunc"),
|
||||||
|
SUSPECT_FAKE("SUSPECT_FAKE", 0, "嫌疑车查找", "com.code.std.function.method.fatePlate.SuspectFakeFunc"),
|
||||||
|
// MINUTES_DIFF("MINUTES_DIFF", 0, "时间差,返回分钟", "com.code.std.function.method.fatePlate.MinutesDiffFunc"),
|
||||||
|
MINUTES_COMPARE("MINUTES_COMPARE", 0, "时间差(单位:分钟)和某一阈值的比较", "com.code.std.function.method.fatePlate.MinutesCompareFunc"),
|
||||||
|
NUM_KEY_SORT("NUM_KEY_SORT", 0, "针对数字类型列排序", "com.code.std.function.method.fatePlate.NumKeySortFunc"),
|
||||||
|
NUM_KEY_SORT_DISTINCT("NUM_KEY_SORT_DISTINCT", 0, "针对数字类型列排序,并去重", "com.code.std.function.method.fatePlate.NumKeySortDistinctFunc"),
|
||||||
|
SPLIT_TUPPLE("SPLIT_TUPPLE", 0, "划分二元组", "com.code.std.function.method.fatePlate.SplitTuppleFunc"),
|
||||||
|
// NUM_COMPARE("NUM_COMPARE", 0, "数值比较", "com.code.std.function.method.fatePlate.NumCompareFunc"),
|
||||||
|
MILLIS_TO_STRING("MILLIS_TO_STRING", 0, "时间戳转字符串", "com.code.std.function.method.fatePlate.MillisToString"),
|
||||||
|
STR_KEY_SORT("STR_KEY_SORT", 0, "针对字符串类型列排序", "com.code.std.function.method.sort.StrKeySortFunc"),
|
||||||
|
STR_KEY_SORT_DISTINCT("STR_KEY_SORT_DISTINCT", 0, "针对字符串类型列排序,并去重", "com.code.std.function.method.sort.StrKeySortDistinctFunc"),
|
||||||
|
DAYS_COMPARE("DAYS_COMPARE", 0, "时间差(单位:天数)和某一阈值比较", "com.code.std.function.method.date.DaysCompareFunc"),
|
||||||
|
DAYS_DIFF("DAYS_DIFF", 0, "时间差,返回天数", "com.code.std.function.method.date.DaysDiffFunc"),
|
||||||
|
HOURS_COMPARE("HOURS_COMPARE", 0, "时间差(单位:小时)和某一阈值比较", "com.code.std.function.method.date.HoursCompareFunc"),
|
||||||
|
HOURS_DIFF("HOURS_DIFF", 0, "时间差,返回小时", "com.code.std.function.method.date.HoursDiffFunc"),
|
||||||
|
SECONDS_COMPARE("SECONDS_COMPARE", 0, "时间差(单位:秒)和某一阈值比较", "com.code.std.function.method.date.SecondsCompareFunc"),
|
||||||
|
SECONDS_DIFF("SECONDS_DIFF", 0, "时间差,返回秒", "com.code.std.function.method.date.SecondsDiffFunc"),
|
||||||
|
MD5("MD5", 0, "MD5加密", "com.code.std.function.method.encrypt.MD5Func"),
|
||||||
|
CEIL("CEIL", 0, "大于输入数的整数", "com.code.std.function.method.mathematical.CeilFunc"),
|
||||||
|
// FLOOR("FLOOR", 0, "不小于输入数的整数", "com.code.std.function.method.mathematical.FloorFunc"),
|
||||||
|
// ROUND("ROUND", 0, "四舍五入", "com.code.std.function.method.mathematical.RoundFunc"),
|
||||||
|
SYS_GUID("SYS_GUID", 0, "生成唯一主键,不传参默认生成32位,传入指定数字生成指定位数的主键", "com.code.std.function.method.encrypt.SysGUIDFunc"),
|
||||||
|
REDUCE_DISTINCT("REDUCE_DISTINCT",0,"数据去重","com.code.std.function.method.distinctSort.ReduceDistinctFunc"),
|
||||||
|
REDUCE_STR_KEY_ASC_DISTINCT("REDUCE_STR_KEY_ASC_DISTINCT",0,"字符串排序并去重","com.code.std.function.method.distinctSort.ReduceStrKeyAscDistinctFunc"),
|
||||||
|
REDUCE_NUM_KEY_ASC_DISTINCT("REDUCE_NUM_KEY_ASC_DISTINCT",0,"数字排序并去重","com.code.std.function.method.distinctSort.ReduceNumKeyAscDistinctFunc"),
|
||||||
|
REDUCE_STR_KEY_ASC("REDUCE_STR_KEY_ASC",0,"字符串排序","com.code.std.function.method.distinctSort.ReduceStrKeyAscFunc"),
|
||||||
|
REDUCE_NUM_KEY_ASC("REDUCE_NUM_KEY_ASC",0,"数字排序","com.code.std.function.method.distinctSort.ReduceNumKeyAscFunc"),
|
||||||
|
LONG_LAT_DISTANCE("LONG_LAT_DISTANCE",0,"计算经纬度","com.code.std.function.method.mathematical.LongLatDistanceFunc"),
|
||||||
|
CACHING_FAKE("CACHING_FAKE",0,"福州卡口对比函数","com.code.std.function.method.caching.CachingFakeFunc"),
|
||||||
|
|
||||||
|
//异常处理类
|
||||||
|
TRY_CATCH("TRY_CATCH", 0, "异常处理类", "com.code.std.function.method.exception.TryCatchFunc"),
|
||||||
|
|
||||||
|
CACHING_APPLY("CACHING_APPLY", 0, "缓存迭代计算", "com.code.std.function.method.caching.CachingApply"),
|
||||||
|
|
||||||
|
DATE_WINDOW_EXPAND("DATE_WINDOW_EXPAND", 0, "时间戳函数", "com.code.std.function.method.reduce.DateWindowExpandFunc"),
|
||||||
|
MERGE_VALUE("MERGE_VALUE", 0, "合并数据", "com.code.std.function.method.reduce.MergeValFunc"),
|
||||||
|
|
||||||
|
REDUCE_MAP("REDUCE_MAP", 0, "REDUCE_MAP函数", "com.code.std.function.method.reduce.ReduceMapFunc"),
|
||||||
|
|
||||||
|
FREQ_STA("FREQ_STA", 0, "今日频率统计与之前N天频率比较", "com.code.std.function.method.biz.FreqStaFunc");
|
||||||
|
|
||||||
|
String code;
|
||||||
|
String name;
|
||||||
|
int dataform;
|
||||||
|
String clazz;
|
||||||
|
|
||||||
|
FuncEnum(String code, int dataform, String name, String clazz) {
|
||||||
|
this.code = code;
|
||||||
|
this.dataform = dataform;
|
||||||
|
this.name = name;
|
||||||
|
this.clazz = clazz;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClazz() {
|
||||||
|
return clazz;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClazz(String clazz) {
|
||||||
|
this.clazz = clazz;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDataform() {
|
||||||
|
return dataform;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataform(int dataform) {
|
||||||
|
this.dataform = dataform;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static Set<String> funcSet = new HashSet<String>(FuncEnum.values().length);
|
||||||
|
|
||||||
|
public static Set<String> funcSet() {
|
||||||
|
if (funcSet.size() > 0) {
|
||||||
|
return funcSet;
|
||||||
|
}
|
||||||
|
for (FuncEnum func : FuncEnum.values()) {
|
||||||
|
funcSet.add(func.getCode());
|
||||||
|
}
|
||||||
|
return funcSet;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loaded 100 of 308 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user