Commit d367dd7b authored by yanzg's avatar yanzg

消除成功接收处理

parent 4d5ca41b
...@@ -311,7 +311,7 @@ public class ObjectHelper { ...@@ -311,7 +311,7 @@ public class ObjectHelper {
} }
String methodNameSource = method.getName(); String methodNameSource = method.getName();
String methodNameSimple = methodNameSource.toLowerCase(); String methodNameSimple = methodNameSource.toLowerCase();
if (methodNameSource.equals("getClass")) { if ("getClass".equals(methodNameSource)) {
continue; continue;
} else if (methodNameSimple.startsWith("set")) { } else if (methodNameSimple.startsWith("set")) {
if (method.getParameterTypes().length != 1) { if (method.getParameterTypes().length != 1) {
......
...@@ -230,7 +230,7 @@ public class MemoryCache<T> { ...@@ -230,7 +230,7 @@ public class MemoryCache<T> {
* @throws Throwable * @throws Throwable
*/ */
@Override @Override
protected void finalize() throws Throwable { protected void finalize(){
this.close(); this.close();
} }
} }
...@@ -2,7 +2,7 @@ package com.yanzuoguang.util.cache; ...@@ -2,7 +2,7 @@ package com.yanzuoguang.util.cache;
import com.yanzuoguang.util.extend.ConfigBase; import com.yanzuoguang.util.extend.ConfigBase;
import com.yanzuoguang.util.thread.ThreadHelper; import com.yanzuoguang.util.thread.ThreadHelper;
import com.yanzuoguang.util.thread.ThreadList; import com.yanzuoguang.util.thread.AbstractThreadList;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
...@@ -32,7 +32,7 @@ public class MemoryCacheCenter { ...@@ -32,7 +32,7 @@ public class MemoryCacheCenter {
do { do {
clear(); clear();
// 等待1秒 // 等待1秒
ThreadHelper.sleep(ConfigBase.MemoryClearTimeout); ThreadHelper.sleep(ConfigBase.MEMORY_CLEAR_TIMEOUT);
} while (true); } while (true);
} }
}); });
...@@ -44,7 +44,7 @@ public class MemoryCacheCenter { ...@@ -44,7 +44,7 @@ public class MemoryCacheCenter {
private static void clear() { private static void clear() {
// todo: 需要修改 // todo: 需要修改
// 死循环处理 // 死循环处理
ThreadList<MemoryCache> threadList = new ThreadList<MemoryCache>(1) { AbstractThreadList<MemoryCache> threadList = new AbstractThreadList<MemoryCache>(1) {
@Override @Override
public void run(MemoryCache item) { public void run(MemoryCache item) {
item.clearTimeout(); item.clearTimeout();
......
...@@ -10,12 +10,12 @@ public class ConfigBase { ...@@ -10,12 +10,12 @@ public class ConfigBase {
/** /**
* 打印线程相关参数 * 打印线程相关参数
*/ */
public static final boolean PrintThread = false; public static final boolean PRINT_THREAD = false;
/** /**
* 内存缓存自动清除时间 * 内存缓存自动清除时间
*/ */
public static final int MemoryClearTimeout = 5 * 1000; public static final int MEMORY_CLEAR_TIMEOUT = 5 * 1000;
/** /**
* 写入日志对象 * 写入日志对象
......
...@@ -17,7 +17,6 @@ public class DateHelper { ...@@ -17,7 +17,6 @@ public class DateHelper {
private static final String FORMAT_DAY_STRING = "yyyy-MM-dd"; private static final String FORMAT_DAY_STRING = "yyyy-MM-dd";
private static final String FORMAT_SECOND_STRING = "yyyy-MM-dd HH:mm:ss"; private static final String FORMAT_SECOND_STRING = "yyyy-MM-dd HH:mm:ss";
private static SimpleDateFormat FORMAT_DAY = new SimpleDateFormat(FORMAT_DAY_STRING);
/** /**
* 获取时间 * 获取时间
...@@ -423,12 +422,12 @@ public class DateHelper { ...@@ -423,12 +422,12 @@ public class DateHelper {
public static String getWeekName1(Date date) { public static String getWeekName1(Date date) {
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.setTime(date); cal.setTime(date);
int week_index = cal.get(Calendar.DAY_OF_WEEK) - 1; int weekIndex = cal.get(Calendar.DAY_OF_WEEK) - 1;
if (week_index < 0) { if (weekIndex < 0) {
week_index = 0; weekIndex = 0;
} }
String[] weeks = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"}; String[] weeks = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
return weeks[week_index]; return weeks[weekIndex];
} }
/** /**
...@@ -574,7 +573,8 @@ public class DateHelper { ...@@ -574,7 +573,8 @@ public class DateHelper {
return from; return from;
} }
try { try {
return FORMAT_DAY.format(FORMAT_DAY.parse(from)); SimpleDateFormat format = new SimpleDateFormat(FORMAT_DAY_STRING);
return format.format(format.parse(from));
} catch (ParseException e) { } catch (ParseException e) {
ExceptionHelper.handleException(DateHelper.class, e, from); ExceptionHelper.handleException(DateHelper.class, e, from);
} }
...@@ -588,7 +588,8 @@ public class DateHelper { ...@@ -588,7 +588,8 @@ public class DateHelper {
* @return 获取到的日期字符串 * @return 获取到的日期字符串
*/ */
public static String toDay(Date date) { public static String toDay(Date date) {
return FORMAT_DAY.format(date); SimpleDateFormat format = new SimpleDateFormat(FORMAT_DAY_STRING);
return format.format(date);
} }
/** /**
...@@ -598,7 +599,8 @@ public class DateHelper { ...@@ -598,7 +599,8 @@ public class DateHelper {
* @return 获取到的日期字符串 * @return 获取到的日期字符串
*/ */
public static String toDay(long date) { public static String toDay(long date) {
return FORMAT_DAY.format(new Date(date)); SimpleDateFormat format = new SimpleDateFormat(FORMAT_DAY_STRING);
return format.format(new Date(date));
} }
/** /**
......
...@@ -57,7 +57,7 @@ public class EnumHelper { ...@@ -57,7 +57,7 @@ public class EnumHelper {
Method[] vMets = vType.getMethods(); Method[] vMets = vType.getMethods();
for (Method vMet : vMets) { for (Method vMet : vMets) {
String vName = vMet.getName(); String vName = vMet.getName();
if (vName.equals("forValue") if ("forValue".equals(vName)
&& vMet.getParameterTypes().length == 1) { && vMet.getParameterTypes().length == 1) {
Class vTempType = vMet.getParameterTypes()[0]; Class vTempType = vMet.getParameterTypes()[0];
Object obj = vMet.invoke(null, i); Object obj = vMet.invoke(null, i);
......
...@@ -9,8 +9,10 @@ import java.util.List; ...@@ -9,8 +9,10 @@ import java.util.List;
* @param <T> * @param <T>
*/ */
public class Event<T> { public class Event<T> {
// 事件列表 /**
private List<T> m_List = new ArrayList<>(); * 事件列表
*/
private List<T> list = new ArrayList<>();
/** /**
* 添加处理对象 * 添加处理对象
...@@ -19,7 +21,7 @@ public class Event<T> { ...@@ -19,7 +21,7 @@ public class Event<T> {
*/ */
public void add(T t) { public void add(T t) {
if (t != null) { if (t != null) {
m_List.add(t); list.add(t);
} }
} }
...@@ -31,8 +33,8 @@ public class Event<T> { ...@@ -31,8 +33,8 @@ public class Event<T> {
* @throws Exception * @throws Exception
*/ */
public <M extends EventRun<T>> void exeucte(M m) throws Exception { public <M extends EventRun<T>> void exeucte(M m) throws Exception {
for (T item : m_List) { for (T item : list) {
m.Execute(item); m.run(item);
} }
} }
...@@ -44,7 +46,7 @@ public class Event<T> { ...@@ -44,7 +46,7 @@ public class Event<T> {
*/ */
public boolean remove(T t) { public boolean remove(T t) {
if (t != null) { if (t != null) {
return m_List.remove(t); return list.remove(t);
} }
return false; return false;
} }
...@@ -53,7 +55,7 @@ public class Event<T> { ...@@ -53,7 +55,7 @@ public class Event<T> {
* 清除所有事件 * 清除所有事件
*/ */
public void clear() { public void clear() {
m_List.clear(); list.clear();
} }
/** /**
...@@ -64,7 +66,7 @@ public class Event<T> { ...@@ -64,7 +66,7 @@ public class Event<T> {
*/ */
public boolean contants(T t) { public boolean contants(T t) {
if (t != null) { if (t != null) {
return m_List.contains(t); return list.contains(t);
} }
return false; return false;
} }
...@@ -75,7 +77,7 @@ public class Event<T> { ...@@ -75,7 +77,7 @@ public class Event<T> {
* @return 事件列表集合 * @return 事件列表集合
*/ */
public List<T> getList() { public List<T> getList() {
return m_List; return list;
} }
/** /**
...@@ -84,6 +86,6 @@ public class Event<T> { ...@@ -84,6 +86,6 @@ public class Event<T> {
* @return 长度 * @return 长度
*/ */
public int size() { public int size() {
return m_List.size(); return list.size();
} }
} }
...@@ -13,5 +13,5 @@ public interface EventRun<T> { ...@@ -13,5 +13,5 @@ public interface EventRun<T> {
* @param t 接口 * @param t 接口
* @throws Exception 异常错误 * @throws Exception 异常错误
*/ */
void Execute(T t) throws Exception; void run(T t) throws Exception;
} }
...@@ -258,7 +258,7 @@ public class StringHelper { ...@@ -258,7 +258,7 @@ public class StringHelper {
} else if (type.equals(vBase)) { } else if (type.equals(vBase)) {
return true; return true;
} }
if (type.toString().equals("System.Object")) { if ("System.Object".equals(type.toString())) {
return false; return false;
} else { } else {
return isType(type.getSuperclass(), vBase); return isType(type.getSuperclass(), vBase);
...@@ -467,10 +467,10 @@ public class StringHelper { ...@@ -467,10 +467,10 @@ public class StringHelper {
* @return 转换成功后的值 * @return 转换成功后的值
*/ */
public static double toDecimal(Object from) { public static double toDecimal(Object from) {
Double result = new Double(0); Double result = Double.valueOf(0);
try { try {
if (!isEmpty(from)) { if (!isEmpty(from)) {
result = new Double(from.toString()); result = Double.valueOf(from.toString());
} }
} catch (Exception ex) { } catch (Exception ex) {
ExceptionHelper.handleException(StringHelper.class, ex, from); ExceptionHelper.handleException(StringHelper.class, ex, from);
...@@ -768,7 +768,7 @@ public class StringHelper { ...@@ -768,7 +768,7 @@ public class StringHelper {
// 使用指定的字节数组更新摘要。 // 使用指定的字节数组更新摘要。
md.update(from.getBytes()); md.update(from.getBytes());
// 通过执行诸如填充之类的最终操作完成哈希计算。 // 通过执行诸如填充之类的最终操作完成哈希计算。
byte b[] = md.digest(); byte[] b = md.digest();
// 生成具体的md5密码到buf数组 // 生成具体的md5密码到buf数组
int i; int i;
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();
...@@ -882,7 +882,7 @@ public class StringHelper { ...@@ -882,7 +882,7 @@ public class StringHelper {
*/ */
public static String getCamelCase(String from) { public static String getCamelCase(String from) {
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
String a[] = from.split("_"); String[] a = from.split("_");
for (String s : a) { for (String s : a) {
if (result.length() == 0) { if (result.length() == 0) {
result.append(s.substring(0, 1).toLowerCase()); result.append(s.substring(0, 1).toLowerCase());
......
...@@ -62,7 +62,7 @@ public class UrlHelper { ...@@ -62,7 +62,7 @@ public class UrlHelper {
return ips.get(0); return ips.get(0);
} }
for (String ip : ips) { for (String ip : ips) {
if (ip.equals("127.0.0.1") || ip.equals("0.0.0.0")) { if ("127.0.0.1".equals(ip) || "0.0.0.0".equals(ip)) {
continue; continue;
} }
return ip; return ip;
...@@ -84,7 +84,8 @@ public class UrlHelper { ...@@ -84,7 +84,8 @@ public class UrlHelper {
Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses(); Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
while (inetAddresses.hasMoreElements()) { while (inetAddresses.hasMoreElements()) {
InetAddress inetAddress = inetAddresses.nextElement(); InetAddress inetAddress = inetAddresses.nextElement();
if (inetAddress != null && inetAddress instanceof Inet4Address) { // IPV4 // IPV4
if (inetAddress != null && inetAddress instanceof Inet4Address) {
String ip = inetAddress.getHostAddress(); String ip = inetAddress.getHostAddress();
ipList.add(ip); ipList.add(ip);
} }
......
...@@ -5,6 +5,8 @@ import java.util.List; ...@@ -5,6 +5,8 @@ import java.util.List;
/** /**
* 表格头 * 表格头
*
* @author 颜佐光
*/ */
public class TableHead { public class TableHead {
...@@ -12,61 +14,61 @@ public class TableHead { ...@@ -12,61 +14,61 @@ public class TableHead {
* 构造函数 * 构造函数
*/ */
public TableHead() { public TableHead() {
this.TotalColumn = 0; this.totalColumn = 0;
this.TotalRow = 0; this.totalRow = 0;
this.DataColumn = 0; this.dataColumn = 0;
this.Columns = new ArrayList<>(); this.columns = new ArrayList<>();
} }
/** /**
* 总行数 * 总行数
*/ */
private int TotalRow; private int totalRow;
/** /**
* 总列数 * 总列数
*/ */
private int TotalColumn; private int totalColumn;
/** /**
* 已添加数据列 * 已添加数据列
*/ */
private int DataColumn; private int dataColumn;
/** /**
* 列头数 * 列头数
*/ */
private List<TableHeadItem> Columns; private List<TableHeadItem> columns;
public int getTotalRow() { public int getTotalRow() {
return TotalRow; return totalRow;
} }
public void setTotalRow(int totalRow) { public void setTotalRow(int totalRow) {
TotalRow = totalRow; this.totalRow = totalRow;
} }
public int getTotalColumn() { public int getTotalColumn() {
return TotalColumn; return totalColumn;
} }
public void setTotalColumn(int totalColumn) { public void setTotalColumn(int totalColumn) {
TotalColumn = totalColumn; this.totalColumn = totalColumn;
} }
public int getDataColumn() { public int getDataColumn() {
return DataColumn; return dataColumn;
} }
public void setDataColumn(int dataColumn) { public void setDataColumn(int dataColumn) {
DataColumn = dataColumn; this.dataColumn = dataColumn;
} }
public List<TableHeadItem> getColumns() { public List<TableHeadItem> getColumns() {
return Columns; return columns;
} }
public void setColumns(List<TableHeadItem> columns) { public void setColumns(List<TableHeadItem> columns) {
Columns = columns; this.columns = columns;
} }
} }
...@@ -8,42 +8,42 @@ public class TableHeadItem { ...@@ -8,42 +8,42 @@ public class TableHeadItem {
/** /**
* 最高级别 * 最高级别
*/ */
private String Name; private String name;
/** /**
* 路径 * 路径
*/ */
private String Path; private String path;
/** /**
* 级别 * 级别
*/ */
private int Level; private int level;
/** /**
* 当前列的最大级别 * 当前列的最大级别
*/ */
private int LevelMax; private int levelMax;
/** /**
* 第几行 * 第几行
*/ */
private int Row; private int row;
/** /**
* 合并多少行 * 合并多少行
*/ */
private int RowCell; private int rowCell;
/** /**
* 第几列 * 第几列
*/ */
private int Column; private int column;
/** /**
* 合并多少列 * 合并多少列
*/ */
private int ColumnCell; private int columnCell;
/** /**
* 是否属于数据列 * 是否属于数据列
...@@ -51,67 +51,67 @@ public class TableHeadItem { ...@@ -51,67 +51,67 @@ public class TableHeadItem {
private boolean dataColumn; private boolean dataColumn;
public String getName() { public String getName() {
return Name; return name;
} }
public void setName(String name) { public void setName(String name) {
Name = name; this.name = name;
} }
public String getPath() { public String getPath() {
return Path; return path;
} }
public void setPath(String path) { public void setPath(String path) {
Path = path; this.path = path;
} }
public int getLevel() { public int getLevel() {
return Level; return level;
} }
public void setLevel(int level) { public void setLevel(int level) {
Level = level; this.level = level;
} }
public int getLevelMax() { public int getLevelMax() {
return LevelMax; return levelMax;
} }
public void setLevelMax(int levelMax) { public void setLevelMax(int levelMax) {
LevelMax = levelMax; this.levelMax = levelMax;
} }
public int getRow() { public int getRow() {
return Row; return row;
} }
public void setRow(int row) { public void setRow(int row) {
Row = row; this.row = row;
} }
public int getRowCell() { public int getRowCell() {
return RowCell; return rowCell;
} }
public void setRowCell(int rowCell) { public void setRowCell(int rowCell) {
RowCell = rowCell; this.rowCell = rowCell;
} }
public int getColumn() { public int getColumn() {
return Column; return column;
} }
public void setColumn(int column) { public void setColumn(int column) {
Column = column; this.column = column;
} }
public int getColumnCell() { public int getColumnCell() {
return ColumnCell; return columnCell;
} }
public void setColumnCell(int columnCell) { public void setColumnCell(int columnCell) {
ColumnCell = columnCell; this.columnCell = columnCell;
} }
public boolean isDataColumn() { public boolean isDataColumn() {
......
...@@ -3,17 +3,14 @@ package com.yanzuoguang.util.thread; ...@@ -3,17 +3,14 @@ package com.yanzuoguang.util.thread;
import com.yanzuoguang.util.helper.DateHelper; import com.yanzuoguang.util.helper.DateHelper;
import com.yanzuoguang.util.log.Log; import com.yanzuoguang.util.log.Log;
import java.util.Date; import java.util.*;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
* 多线程处理队列 * 多线程处理队列
*/ */
public abstract class ThreadList<T extends Object> implements ThreadWaitExecute { public abstract class AbstractThreadList<T extends Object> implements ThreadWaitExecute {
private long threadID; private long threadID;
/** /**
* 线程等待间隔 * 线程等待间隔
...@@ -60,7 +57,7 @@ public abstract class ThreadList<T extends Object> implements ThreadWaitExecute ...@@ -60,7 +57,7 @@ public abstract class ThreadList<T extends Object> implements ThreadWaitExecute
* *
* @param threadCount * @param threadCount
*/ */
public ThreadList(int threadCount) { public AbstractThreadList(int threadCount) {
this.threadID = Thread.currentThread().getId(); this.threadID = Thread.currentThread().getId();
threadCount = Math.max(threadCount, 0); threadCount = Math.max(threadCount, 0);
this.threadCount = threadCount; this.threadCount = threadCount;
...@@ -118,17 +115,8 @@ public abstract class ThreadList<T extends Object> implements ThreadWaitExecute ...@@ -118,17 +115,8 @@ public abstract class ThreadList<T extends Object> implements ThreadWaitExecute
* @param list * @param list
*/ */
public void add(T... list) { public void add(T... list) {
if (list == null || list.length == 0) { if (list != null) {
return; this.add(Arrays.asList(list));
}
int size = list.length;
this.initRowTotal(size);
for (int i = 0; i < size; i++) {
T item = list[i];
if (item == null) {
continue;
}
this.add(item);
} }
} }
...@@ -141,8 +129,14 @@ public abstract class ThreadList<T extends Object> implements ThreadWaitExecute ...@@ -141,8 +129,14 @@ public abstract class ThreadList<T extends Object> implements ThreadWaitExecute
if (list == null || list.size() == 0) { if (list == null || list.size() == 0) {
return; return;
} }
T[] to = (T[]) list.toArray(); int size = list.size();
this.add(to); this.initRowTotal(size);
for (T item : list) {
if (item == null) {
continue;
}
this.add(item);
}
} }
/** /**
...@@ -181,12 +175,12 @@ public abstract class ThreadList<T extends Object> implements ThreadWaitExecute ...@@ -181,12 +175,12 @@ public abstract class ThreadList<T extends Object> implements ThreadWaitExecute
public void run() { public void run() {
long threadID = Thread.currentThread().getId(); long threadID = Thread.currentThread().getId();
try { try {
if (threadID != ThreadList.this.threadID) { if (threadID != AbstractThreadList.this.threadID) {
Log.threadBegin(); Log.threadBegin();
} }
threadExecute(); threadExecute();
} finally { } finally {
if (threadID != ThreadList.this.threadID) { if (threadID != AbstractThreadList.this.threadID) {
Log.threadCommit(); Log.threadCommit();
} }
} }
...@@ -295,7 +289,7 @@ public abstract class ThreadList<T extends Object> implements ThreadWaitExecute ...@@ -295,7 +289,7 @@ public abstract class ThreadList<T extends Object> implements ThreadWaitExecute
threadListNum.addSuccess(); threadListNum.addSuccess();
} catch (RuntimeException ex) { } catch (RuntimeException ex) {
threadListNum.addError(); threadListNum.addError();
LogError(ex); logError(ex);
} }
} }
...@@ -321,7 +315,7 @@ public abstract class ThreadList<T extends Object> implements ThreadWaitExecute ...@@ -321,7 +315,7 @@ public abstract class ThreadList<T extends Object> implements ThreadWaitExecute
* @param log * @param log
*/ */
private void log(String log) { private void log(String log) {
Log.info(ThreadList.class, log); Log.info(AbstractThreadList.class, log);
} }
/** /**
...@@ -329,14 +323,14 @@ public abstract class ThreadList<T extends Object> implements ThreadWaitExecute ...@@ -329,14 +323,14 @@ public abstract class ThreadList<T extends Object> implements ThreadWaitExecute
* *
* @param ex * @param ex
*/ */
private void LogError(RuntimeException ex) { private void logError(RuntimeException ex) {
this.exception = ex; this.exception = ex;
} }
/** /**
* 抛出线程中的异常数据 * 抛出线程中的异常数据
*/ */
public ThreadList<T> throwThreadError() { public AbstractThreadList<T> throwThreadError() {
if (this.exception != null) { if (this.exception != null) {
throw this.exception; throw this.exception;
} }
......
...@@ -12,10 +12,9 @@ public class RunExecute implements EventRun<Runnable> { ...@@ -12,10 +12,9 @@ public class RunExecute implements EventRun<Runnable> {
* 执行时间 * 执行时间
* *
* @param t 接口 需要执行的对象 * @param t 接口 需要执行的对象
* @throws Exception 跑出异常
*/ */
@Override @Override
public void Execute(Runnable t) { public void run(Runnable t) {
t.run(); t.run();
} }
} }
...@@ -7,49 +7,49 @@ public class RunInterval { ...@@ -7,49 +7,49 @@ public class RunInterval {
/** /**
* 当前线程 * 当前线程
*/ */
private Thread Thread; private Thread thread;
/** /**
* 间隔时间,毫秒 * 间隔时间,毫秒
*/ */
private int Time; private int time;
/** /**
* 执行的代码 * 执行的代码
*/ */
private Runnable Code; private Runnable code;
/** /**
* 是否终端 * 是否终端
*/ */
private boolean Break; private boolean breakFlag;
public java.lang.Thread getThread() { public java.lang.Thread getThread() {
return Thread; return thread;
} }
public void setThread(java.lang.Thread thread) { public void setThread(java.lang.Thread thread) {
Thread = thread; this.thread = thread;
} }
public int getTime() { public int getTime() {
return Time; return time;
} }
public void setTime(int time) { public void setTime(int time) {
Time = time; this.time = time;
} }
public Runnable getCode() { public Runnable getCode() {
return Code; return code;
} }
public void setCode(Runnable code) { public void setCode(Runnable code) {
Code = code; this.code = code;
} }
public boolean isBreak() { public boolean isBreakFlag() {
return Break; return breakFlag;
} }
public void setBreak(boolean aBreak) { public void setBreakFlag(boolean breakFlag) {
Break = aBreak; this.breakFlag = breakFlag;
} }
} }
\ No newline at end of file
...@@ -12,17 +12,29 @@ import java.util.List; ...@@ -12,17 +12,29 @@ import java.util.List;
* 自动执行任务 * 自动执行任务
*/ */
public class RunPlan { public class RunPlan {
// 任务锁 /**
private Object m_Lock = new Object(); * 任务锁
// 任务队列 */
private List<RunPlanData> m_List = new ArrayList<>(); private Object lock = new Object();
// 增加时触发的事件队列 /**
* 任务队列
*/
private List<RunPlanData> list = new ArrayList<>();
/**
* 增加时触发的事件队列
*/
private Event<Runnable> onAdd = new Event<>(); private Event<Runnable> onAdd = new Event<>();
// 增加时触发的事件队列 /**
* 增加时触发的事件队列
*/
private Event<Runnable> onRemove = new Event<>(); private Event<Runnable> onRemove = new Event<>();
// 单项成功执行时的事件队列 /**
* 单项成功执行时的事件队列
*/
private Event<Runnable> onItemExecuted = new Event<>(); private Event<Runnable> onItemExecuted = new Event<>();
// 全部执行完时触发的事件队列 /**
* 全部执行完时触发的事件队列
*/
private Event<Runnable> onExecuted = new Event<>(); private Event<Runnable> onExecuted = new Event<>();
/** /**
...@@ -67,12 +79,12 @@ public class RunPlan { ...@@ -67,12 +79,12 @@ public class RunPlan {
* @param isRemove 执行完成是否删除 * @param isRemove 执行完成是否删除
* @param maxError 最大错误次数 * @param maxError 最大错误次数
*/ */
public final void Execute(boolean isRemove, int maxError) { public final void run(boolean isRemove, int maxError) {
for (int i = m_List.size() - 1; i >= 0; i--) { for (int i = list.size() - 1; i >= 0; i--) {
Date now = new Date(); Date now = new Date();
RunPlanData item; RunPlanData item;
synchronized (this.m_Lock) { synchronized (this.lock) {
item = m_List.size() > i ? m_List.get(i) : null; item = list.size() > i ? list.get(i) : null;
} }
if (item == null) { if (item == null) {
...@@ -110,8 +122,8 @@ public class RunPlan { ...@@ -110,8 +122,8 @@ public class RunPlan {
try { try {
if (isRemove) { if (isRemove) {
synchronized (this.m_Lock) { synchronized (this.lock) {
this.m_List.remove(i); this.list.remove(i);
this.triggerEvent(this.onRemove); this.triggerEvent(this.onRemove);
} }
} }
...@@ -130,15 +142,15 @@ public class RunPlan { ...@@ -130,15 +142,15 @@ public class RunPlan {
* @param vTime 间隔时间 * @param vTime 间隔时间
* @return 执行标志 * @return 执行标志
*/ */
public final String Set(Runnable run, int vTime) { public final String set(Runnable run, int vTime) {
// 创建临时任务数据 // 创建临时任务数据
RunPlanData temp = new RunPlanData(); RunPlanData temp = new RunPlanData();
temp.setFlag(StringHelper.getNewID()); temp.setFlag(StringHelper.getNewID());
temp.setExecute(run); temp.setExecute(run);
temp.setTime(vTime); temp.setTime(vTime);
synchronized (m_Lock) { synchronized (lock) {
m_List.add(temp); list.add(temp);
} }
this.triggerEvent(this.onAdd); this.triggerEvent(this.onAdd);
...@@ -151,10 +163,10 @@ public class RunPlan { ...@@ -151,10 +163,10 @@ public class RunPlan {
* @param flag 执行标志 * @param flag 执行标志
*/ */
public final void remove(String flag) { public final void remove(String flag) {
synchronized (m_Lock) { synchronized (lock) {
for (RunPlanData item : this.m_List) { for (RunPlanData item : this.list) {
if (item.getFlag().equals(flag)) { if (item.getFlag().equals(flag)) {
this.m_List.remove(item); this.list.remove(item);
this.triggerEvent(this.onRemove); this.triggerEvent(this.onRemove);
break; break;
} }
...@@ -168,10 +180,10 @@ public class RunPlan { ...@@ -168,10 +180,10 @@ public class RunPlan {
* @param run 执行的方法,注意有多个同样的方法时,只会清除第一个 * @param run 执行的方法,注意有多个同样的方法时,只会清除第一个
*/ */
public final void remove(Runnable run) { public final void remove(Runnable run) {
synchronized (m_Lock) { synchronized (lock) {
for (RunPlanData item : this.m_List) { for (RunPlanData item : this.list) {
if (item.getExecute().equals(run)) { if (item.getExecute().equals(run)) {
this.m_List.remove(item); this.list.remove(item);
this.triggerEvent(this.onRemove); this.triggerEvent(this.onRemove);
break; break;
} }
...@@ -200,6 +212,6 @@ public class RunPlan { ...@@ -200,6 +212,6 @@ public class RunPlan {
* @return 长度信息 * @return 长度信息
*/ */
public final int getCount() { public final int getCount() {
return this.m_List.size(); return this.list.size();
} }
} }
...@@ -5,7 +5,7 @@ import com.yanzuoguang.util.exception.CodeException; ...@@ -5,7 +5,7 @@ import com.yanzuoguang.util.exception.CodeException;
/** /**
* 根据指定的线程数量, 执行多个Runnable对象 * 根据指定的线程数量, 执行多个Runnable对象
*/ */
public class RunnableList extends ThreadList<Runnable> { public class RunnableList extends AbstractThreadList<Runnable> {
/** /**
* 线程数量 * 线程数量
* *
......
...@@ -24,8 +24,8 @@ public final class RunnableListAuto { ...@@ -24,8 +24,8 @@ public final class RunnableListAuto {
* *
* @param codes * @param codes
*/ */
public static ThreadList<RunnableListAutoItem> Execute(Runnable... codes) { public static AbstractThreadList<RunnableListAutoItem> run(Runnable... codes) {
return Execute(Arrays.asList(codes)); return run(Arrays.asList(codes));
} }
/** /**
...@@ -33,12 +33,12 @@ public final class RunnableListAuto { ...@@ -33,12 +33,12 @@ public final class RunnableListAuto {
* *
* @param codes * @param codes
*/ */
public static ThreadList<RunnableListAutoItem> Execute(List<Runnable> codes) { public static AbstractThreadList<RunnableListAutoItem> run(List<Runnable> codes) {
List<RunnableListAutoItem> autos = new ArrayList<RunnableListAutoItem>(); List<RunnableListAutoItem> autos = new ArrayList<RunnableListAutoItem>();
for (Runnable code : codes) { for (Runnable code : codes) {
autos.add(new RunnableListAutoItem(code)); autos.add(new RunnableListAutoItem(code));
} }
return ExecuteAuto(autos); return runAuto(autos);
} }
/** /**
...@@ -46,8 +46,8 @@ public final class RunnableListAuto { ...@@ -46,8 +46,8 @@ public final class RunnableListAuto {
* *
* @param methods * @param methods
*/ */
public static ThreadList<RunnableListAutoItem> ExecuteAuto(RunnableListAutoItem... methods) { public static AbstractThreadList<RunnableListAutoItem> runAuto(RunnableListAutoItem... methods) {
return ExecuteAuto(Arrays.asList(methods)); return runAuto(Arrays.asList(methods));
} }
/** /**
...@@ -55,7 +55,7 @@ public final class RunnableListAuto { ...@@ -55,7 +55,7 @@ public final class RunnableListAuto {
* *
* @param methods * @param methods
*/ */
public static ThreadList<RunnableListAutoItem> ExecuteAuto(List<RunnableListAutoItem> methods) { public static AbstractThreadList<RunnableListAutoItem> runAuto(List<RunnableListAutoItem> methods) {
// 获取历史执行时间 // 获取历史执行时间
int zeroCount = 0; int zeroCount = 0;
long totalAvg = 0; long totalAvg = 0;
...@@ -119,18 +119,18 @@ public final class RunnableListAuto { ...@@ -119,18 +119,18 @@ public final class RunnableListAuto {
continue; continue;
} }
RunnableListAutoItem toItem = cache.get(item.getKey()); RunnableListAutoItem toItem = cache.get(item.getKey());
WriteLog("上次执行时间", toItem, finalThreadCount); writeLog("上次执行时间", toItem, finalThreadCount);
} }
} }
// 开始线程列表 // 开始线程列表
ThreadList<RunnableListAutoItem> threadList = new ThreadList<RunnableListAutoItem>(finalThreadCount) { AbstractThreadList<RunnableListAutoItem> threadList = new AbstractThreadList<RunnableListAutoItem>(finalThreadCount) {
@Override @Override
public void run(RunnableListAutoItem item) { public void run(RunnableListAutoItem item) {
try { try {
item.execute(); item.execute();
if (IsLog) { if (IsLog) {
WriteLog("执行时间", item, finalThreadCount); writeLog("执行时间", item, finalThreadCount);
} }
} finally { } finally {
RunnableListAutoItem to = cache.get(item.getKey()); RunnableListAutoItem to = cache.get(item.getKey());
...@@ -147,7 +147,7 @@ public final class RunnableListAuto { ...@@ -147,7 +147,7 @@ public final class RunnableListAuto {
return threadList; return threadList;
} }
private static void WriteLog(String tag, RunnableListAutoItem item, int threadCount) { private static void writeLog(String tag, RunnableListAutoItem item, int threadCount) {
if (!IsLog) { if (!IsLog) {
return; return;
} }
......
...@@ -40,26 +40,26 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> { ...@@ -40,26 +40,26 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> {
if (name == null) { if (name == null) {
name = ""; name = "";
} }
this.ClassType = code.getClass(); this.classType = code.getClass();
this.Name = name; this.name = name;
this.code = code; this.code = code;
this.Key = StringHelper.getMD5Id(this.ClassType.getName() + ":" + name); this.key = StringHelper.getMD5Id(this.classType.getName() + ":" + name);
} }
/** /**
* 关键字 * 关键字
*/ */
private volatile String Key; private volatile String key;
/** /**
* 类型 * 类型
*/ */
private volatile Class<?> ClassType; private volatile Class<?> classType;
/** /**
* 名称 * 名称
*/ */
private volatile String Name; private volatile String name;
/** /**
* 执行代码 * 执行代码
...@@ -69,21 +69,21 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> { ...@@ -69,21 +69,21 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> {
/** /**
* 总执行时间 * 总执行时间
*/ */
private volatile long Time; private volatile long time;
/** /**
* 执行次数 * 执行次数
*/ */
private volatile int Count; private volatile int count;
/** /**
* 需要注意当达到 Time > Long.MaxValue / 2 或者 count > Integer.MaxValue /2 时 * 需要注意当达到 time > Long.MaxValue / 2 或者 count > Integer.MaxValue /2 时
* 则Time = Time/2, count = count/2; * 则Time = time/2, count = count/2;
*/ */
private synchronized void init() { private synchronized void init() {
if (this.Time > Long.MAX_VALUE / 2 || this.Count > Integer.MAX_VALUE / 2) { if (this.time > Long.MAX_VALUE / 2 || this.count > Integer.MAX_VALUE / 2) {
this.Time = this.Time / 2; this.time = this.time / 2;
this.Count = this.Count / 2; this.count = this.count / 2;
} }
} }
...@@ -93,11 +93,11 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> { ...@@ -93,11 +93,11 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> {
* @param to * @param to
*/ */
public synchronized void add(RunnableListAutoItem to) { public synchronized void add(RunnableListAutoItem to) {
if (this.ClassType != to.ClassType || !this.Name.equals(to.Name)) { if (this.classType != to.classType || !this.name.equals(to.name)) {
return; return;
} }
this.Time += to.Time; this.time += to.time;
this.Count += to.Count; this.count += to.count;
this.init(); this.init();
} }
...@@ -107,10 +107,10 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> { ...@@ -107,10 +107,10 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> {
* @return * @return
*/ */
public synchronized long getAvgTime() { public synchronized long getAvgTime() {
if (this.Count == 0) { if (this.count == 0) {
return 0; return 0;
} }
return this.Time / this.Count; return this.time / this.count;
} }
/** /**
...@@ -120,11 +120,11 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> { ...@@ -120,11 +120,11 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> {
*/ */
public synchronized RunnableListAutoItem newBase() { public synchronized RunnableListAutoItem newBase() {
RunnableListAutoItem to = new RunnableListAutoItem(); RunnableListAutoItem to = new RunnableListAutoItem();
to.Key = this.Key; to.key = this.key;
to.ClassType = this.ClassType; to.classType = this.classType;
to.Name = this.Name; to.name = this.name;
to.Count = this.Count; to.count = this.count;
to.Time = this.Time; to.time = this.time;
return to; return to;
} }
...@@ -139,10 +139,10 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> { ...@@ -139,10 +139,10 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> {
} }
this.code.run(); this.code.run();
} catch (Exception ex) { } catch (Exception ex) {
this.HandleException(ex); this.handleException(ex);
} finally { } finally {
this.Count++; this.count++;
this.Time += System.currentTimeMillis() - start.getTime(); this.time += System.currentTimeMillis() - start.getTime();
} }
} }
...@@ -151,7 +151,7 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> { ...@@ -151,7 +151,7 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> {
* *
* @param ex * @param ex
*/ */
private void HandleException(Throwable ex) { private void handleException(Throwable ex) {
if (ex instanceof RuntimeException) { if (ex instanceof RuntimeException) {
throw (RuntimeException) ex; throw (RuntimeException) ex;
} else { } else {
...@@ -165,15 +165,15 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> { ...@@ -165,15 +165,15 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> {
} }
public String getKey() { public String getKey() {
return Key; return key;
} }
public Class<?> getClassType() { public Class<?> getClassType() {
return ClassType; return classType;
} }
public String getName() { public String getName() {
return Name; return name;
} }
public Runnable getCode() { public Runnable getCode() {
...@@ -181,10 +181,10 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> { ...@@ -181,10 +181,10 @@ public class RunnableListAutoItem implements Comparable<RunnableListAutoItem> {
} }
public long getTime() { public long getTime() {
return Time; return time;
} }
public int getCount() { public int getCount() {
return Count; return count;
} }
} }
...@@ -17,7 +17,7 @@ public class ThreadHelper { ...@@ -17,7 +17,7 @@ public class ThreadHelper {
private static RunPlan timeout; private static RunPlan timeout;
private static RunPlan interval; private static RunPlan interval;
// 线程对象 // 线程对象
private static ExecutorService _ExecuteService = Executors.newCachedThreadPool(); private static ExecutorService executeService = Executors.newCachedThreadPool();
/** /**
* 初始化线程对象,需要调用该函数之后才能使用 * 初始化线程对象,需要调用该函数之后才能使用
...@@ -32,27 +32,27 @@ public class ThreadHelper { ...@@ -32,27 +32,27 @@ public class ThreadHelper {
Runnable addExecute = new Runnable() { Runnable addExecute = new Runnable() {
@Override @Override
public void run() { public void run() {
OnExecuteAdd(); onExecuteAdd();
} }
}; };
Runnable itemExecuted = new Runnable() { Runnable itemExecuted = new Runnable() {
@Override @Override
public void run() { public void run() {
OnItemExecuted(); onItemExecuted();
} }
}; };
timeout.getOnAdd().add(addExecute); timeout.getOnAdd().add(addExecute);
timeout.getOnItemExecuted().add(itemExecuted); timeout.getOnItemExecuted().add(itemExecuted);
interval.getOnAdd().add(addExecute); interval.getOnAdd().add(addExecute);
interval.getOnItemExecuted().add(itemExecuted); interval.getOnItemExecuted().add(itemExecuted);
StartMonitor(); startMonitor();
} }
private static void OnItemExecuted() { private static void onItemExecuted() {
threadDate = new Date(); threadDate = new Date();
} }
private static void OnExecuteAdd() { private static void onExecuteAdd() {
startThread(); startThread();
} }
...@@ -67,12 +67,12 @@ public class ThreadHelper { ...@@ -67,12 +67,12 @@ public class ThreadHelper {
threadIsRun = true; threadIsRun = true;
while (threadIsRun) { while (threadIsRun) {
try { try {
timeout.Execute(true, -1); timeout.run(true, -1);
} catch (Exception ex) { } catch (Exception ex) {
ExceptionHelper.handleException(ThreadHelper.class, ex); ExceptionHelper.handleException(ThreadHelper.class, ex);
} }
try { try {
interval.Execute(false, -1); interval.run(false, -1);
} catch (Exception ex) { } catch (Exception ex) {
ExceptionHelper.handleException(ThreadHelper.class, ex); ExceptionHelper.handleException(ThreadHelper.class, ex);
} }
...@@ -90,7 +90,7 @@ public class ThreadHelper { ...@@ -90,7 +90,7 @@ public class ThreadHelper {
/** /**
* 监控线程的方法,防止线程执行死机 * 监控线程的方法,防止线程执行死机
*/ */
private static void StartMonitor() { private static void startMonitor() {
runThread(new Runnable() { runThread(new Runnable() {
@Override @Override
public void run() { public void run() {
...@@ -120,7 +120,7 @@ public class ThreadHelper { ...@@ -120,7 +120,7 @@ public class ThreadHelper {
* @return 执行标志 * @return 执行标志
*/ */
public static String setTimeout(Runnable run, int vTime) { public static String setTimeout(Runnable run, int vTime) {
return timeout.Set(run, vTime); return timeout.set(run, vTime);
} }
/** /**
...@@ -149,7 +149,7 @@ public class ThreadHelper { ...@@ -149,7 +149,7 @@ public class ThreadHelper {
* @return 执行标志 * @return 执行标志
*/ */
public static String setInterval(Runnable run, int vTime) { public static String setInterval(Runnable run, int vTime) {
return interval.Set(run, vTime); return interval.set(run, vTime);
} }
/** /**
...@@ -202,7 +202,7 @@ public class ThreadHelper { ...@@ -202,7 +202,7 @@ public class ThreadHelper {
* @param run * @param run
*/ */
public static void runThread(final Runnable run) { public static void runThread(final Runnable run) {
_ExecuteService.execute(new Runnable() { executeService.execute(new Runnable() {
@Override @Override
public void run() { public void run() {
executeCatch(run); executeCatch(run);
...@@ -219,7 +219,7 @@ public class ThreadHelper { ...@@ -219,7 +219,7 @@ public class ThreadHelper {
runThread(new Runnable() { runThread(new Runnable() {
@Override @Override
public void run() { public void run() {
while (!run.isBreak()) { while (!run.isBreakFlag()) {
try { try {
run.getCode().run(); run.getCode().run();
} catch (Exception ex) { } catch (Exception ex) {
......
...@@ -57,7 +57,7 @@ public class ThreadWait { ...@@ -57,7 +57,7 @@ public class ThreadWait {
} }
this.stopPrint(); this.stopPrint();
} }
if (ConfigBase.PrintThread) { if (ConfigBase.PRINT_THREAD) {
Log.info(ThreadWait.class, "客户端结束时间"); Log.info(ThreadWait.class, "客户端结束时间");
} }
} }
...@@ -78,7 +78,7 @@ public class ThreadWait { ...@@ -78,7 +78,7 @@ public class ThreadWait {
public synchronized void finish() { public synchronized void finish() {
if (this.execute.isFinally()) { if (this.execute.isFinally()) {
this.notify(); this.notify();
if (ConfigBase.PrintThread) { if (ConfigBase.PRINT_THREAD) {
Log.info(ThreadWait.class, "客户端结束时间"); Log.info(ThreadWait.class, "客户端结束时间");
} }
} }
......
...@@ -41,7 +41,7 @@ public class BaseRequestAspect implements ThreadNext.Next { ...@@ -41,7 +41,7 @@ public class BaseRequestAspect implements ThreadNext.Next {
protected volatile LinkedBlockingQueue<LogVo> cache = new LinkedBlockingQueue<LogVo>(); protected volatile LinkedBlockingQueue<LogVo> cache = new LinkedBlockingQueue<LogVo>();
// 缓存的每次请求的结果 // 缓存的每次请求的结果
protected MemoryCache<RequestCacheResult> _cacheResult = new MemoryCache<>(cacheTime); protected MemoryCache<RequestCacheResult> cacheResult = new MemoryCache<>(cacheTime);
public BaseRequestAspect() { public BaseRequestAspect() {
ThreadNext.start(this, "save log error"); ThreadNext.start(this, "save log error");
......
...@@ -116,7 +116,7 @@ public class WebAspect extends BaseRequestAspect { ...@@ -116,7 +116,7 @@ public class WebAspect extends BaseRequestAspect {
reqId = StringHelper.getId(ObjectHelper.getString(firstArgs, "companyId"), reqId); reqId = StringHelper.getId(ObjectHelper.getString(firstArgs, "companyId"), reqId);
} }
String reqFull = StringHelper.getId(reqId, HttpAspectUtil.getHttpRequestUrl()); String reqFull = StringHelper.getId(reqId, HttpAspectUtil.getHttpRequestUrl());
RequestCacheResult req = _cacheResult.get(reqFull, new RequestCacheResult(reqFull)); RequestCacheResult req = cacheResult.get(reqFull, new RequestCacheResult(reqFull));
// 缓存的键值对 // 缓存的键值对
if (req.getResult() == null) { if (req.getResult() == null) {
synchronized (req) { synchronized (req) {
......
...@@ -4,48 +4,59 @@ package com.yanzuoguang.dao; ...@@ -4,48 +4,59 @@ package com.yanzuoguang.dao;
* created by yanzu on 2017/5/30. * created by yanzu on 2017/5/30.
*/ */
public class DaoConst { public class DaoConst {
public static final int OperatorTypeCreate = 0; /**
public static final int OperatorTypeUpdate = 1; * 创建操作
public static final int OperatorTypeRemove = 2; */
public static final int OperatorTypeLoad = 3; public static final int OPERATOR_TYPE_CREATE = 0;
/**
* 更新操作
*/
public static final int OPERATOR_TYPE_UPDATE = 1;
/**
* 删除操作
*/
public static final int OPERATOR_TYPE_REMOVE = 2;
/**
* 加载操作
*/
public static final int OPERATOR_TYPE_LOAD = 3;
/** /**
* 创建 * 创建
*/ */
public static final String Create = "create"; public static final String CREATE = "create";
/** /**
* 修改 * 修改
*/ */
public static final String Update = "update"; public static final String UPDATE = "update";
/** /**
* 删除 * 删除
*/ */
public static final String Remove = "remove"; public static final String REMOVE = "remove";
/** /**
* 加载 * 加载
*/ */
public static final String Load = "load"; public static final String LOAD = "load";
/** /**
* 查询 * 查询
*/ */
public static final String Query = "query"; public static final String QUERY = "query";
/** /**
* GROUP增加数据的SQL语句 * GROUP增加数据的SQL语句
*/ */
public static final String GroupAdd = "GroupAdd"; public static final String GROUP_ADD = "GroupAdd";
/** /**
* GROUP查询数据的SQL语句 * GROUP查询数据的SQL语句
*/ */
public static final String GroupQuery = "GroupQuery"; public static final String GROUP_QUERY = "GroupQuery";
/** /**
* 驼峰式命名 * 驼峰式命名
*/ */
public static final int RowNameTypeCamelCase = 0; public static final int ROW_NAME_TYPE_CAMEL_CASE = 0;
/** /**
* 原字段 * 原字段
*/ */
public static final int RowNameTypeNoChange = 1; public static final int ROW_NAME_TYPE_NO_CHANGE = 1;
} }
package com.yanzuoguang.dao.Impl; package com.yanzuoguang.dao.impl;
import com.yanzuoguang.dao.BaseDao; import com.yanzuoguang.dao.BaseDao;
import com.yanzuoguang.dao.DaoConst; import com.yanzuoguang.dao.DaoConst;
import com.yanzuoguang.db.Impl.AllBeanRowMapper; import com.yanzuoguang.db.impl.AllBeanRowMapper;
import com.yanzuoguang.util.base.ObjectHelper; import com.yanzuoguang.util.base.ObjectHelper;
import com.yanzuoguang.util.exception.CodeException; import com.yanzuoguang.util.exception.CodeException;
import com.yanzuoguang.util.helper.DateHelper; import com.yanzuoguang.util.helper.DateHelper;
...@@ -36,10 +36,10 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao { ...@@ -36,10 +36,10 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
* @return 获取主键名称 * @return 获取主键名称
*/ */
protected String getKey() { protected String getKey() {
if (this.Table == null) { if (this.table == null) {
throw new CodeException("类" + this.getClass().getName() + "未发现表结构"); throw new CodeException("类" + this.getClass().getName() + "未发现表结构");
} }
return this.Table.Table.getKeyName(); return this.table.table.getKeyName();
} }
/** /**
...@@ -103,7 +103,7 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao { ...@@ -103,7 +103,7 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
@Override @Override
public String create(Object model) { public String create(Object model) {
// 判断主键是字符串和需要生成主键 // 判断主键是字符串和需要生成主键
boolean isKeyString = this.Table.Table.getKeyType() == String.class; boolean isKeyString = this.table.table.getKeyType() == String.class;
String keyString = this.getKeyString(model); String keyString = this.getKeyString(model);
// 生成主键 // 生成主键
...@@ -113,10 +113,10 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao { ...@@ -113,10 +113,10 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
} }
// 检测数据合法性 // 检测数据合法性
this.check(DaoConst.OperatorTypeCreate, keyString, model); this.check(DaoConst.OPERATOR_TYPE_CREATE, keyString, model);
// 执行创建的SQL语句 // 执行创建的SQL语句
int ret = updateSql(DaoConst.Create, model); int ret = updateSql(DaoConst.CREATE, model);
// 判断是否需要获取自增编号(主键为整形) // 判断是否需要获取自增编号(主键为整形)
if (StringHelper.isEmpty(keyString) && !isKeyString) { if (StringHelper.isEmpty(keyString) && !isKeyString) {
keyString = this.getIdentity(); keyString = this.getIdentity();
...@@ -142,10 +142,10 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao { ...@@ -142,10 +142,10 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
public String update(Object model) { public String update(Object model) {
String keyString = this.getKeyString(model); String keyString = this.getKeyString(model);
if (StringHelper.isEmpty(keyString)) { if (StringHelper.isEmpty(keyString)) {
throw new CodeException("表" + this.Table.Table.getName() + "主键值为空时不能更新"); throw new CodeException("表" + this.table.table.getName() + "主键值为空时不能更新");
} }
this.check(DaoConst.OperatorTypeUpdate, keyString, model); this.check(DaoConst.OPERATOR_TYPE_UPDATE, keyString, model);
SqlData sqlData = this.getSql(DaoConst.Update); SqlData sqlData = this.getSql(DaoConst.UPDATE);
int ret = updateSql(sqlData, model); int ret = updateSql(sqlData, model);
String retVal = ret > 0 ? keyString : ""; String retVal = ret > 0 ? keyString : "";
return retVal; return retVal;
...@@ -198,21 +198,21 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao { ...@@ -198,21 +198,21 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
from = new HashMap<String, Object>(); from = new HashMap<String, Object>();
this.setKeyString(from, keyString); this.setKeyString(from, keyString);
// 调用删除日志 // 调用删除日志
this.check(DaoConst.OperatorTypeRemove, keyString, from); this.check(DaoConst.OPERATOR_TYPE_REMOVE, keyString, from);
} else { } else {
List<MapRow> rows = this.query(MapRow.class, DaoConst.Load, from); List<MapRow> rows = this.query(MapRow.class, DaoConst.LOAD, from);
for (MapRow row : rows) { for (MapRow row : rows) {
keyString = this.getKeyString(from); keyString = this.getKeyString(from);
if (StringHelper.isEmpty(keyString)) { if (StringHelper.isEmpty(keyString)) {
keyString = StringHelper.toString(AllBeanRowMapper.getLoweRowField(row, this.getKey())); keyString = StringHelper.toString(AllBeanRowMapper.getLoweRowField(row, this.getKey()));
} }
// 调用删除日志 // 调用删除日志
this.check(DaoConst.OperatorTypeRemove, keyString, row); this.check(DaoConst.OPERATOR_TYPE_REMOVE, keyString, row);
} }
} }
// 调用删除语句 // 调用删除语句
SqlData sqlData = this.getSql(DaoConst.Remove); SqlData sqlData = this.getSql(DaoConst.REMOVE);
return updateSql(sqlData, from); return updateSql(sqlData, from);
} }
...@@ -237,7 +237,7 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao { ...@@ -237,7 +237,7 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
} }
// 通过传入数据进行加载 // 通过传入数据进行加载
T to = this.queryFirst(cls, DaoConst.Load, from); T to = this.queryFirst(cls, DaoConst.LOAD, from);
if (to == null) { if (to == null) {
return to; return to;
} }
...@@ -247,7 +247,7 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao { ...@@ -247,7 +247,7 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
key = this.getKeyString(to); key = this.getKeyString(to);
} }
check(DaoConst.OperatorTypeLoad, key, to); check(DaoConst.OPERATOR_TYPE_LOAD, key, to);
return to; return to;
} }
...@@ -267,22 +267,22 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao { ...@@ -267,22 +267,22 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
} }
// 获取前台分组的MD5标识 // 获取前台分组的MD5标识
String md5 = this.getMd5(DaoConst.GroupQuery, model); String md5 = this.getMd5(DaoConst.GROUP_QUERY, model);
if (!StringHelper.isEmpty(this.Table.Table.getMD5KeyName())) { if (!StringHelper.isEmpty(this.table.table.getMD5KeyName())) {
ObjectHelper.set(model, this.Table.Table.getMD5KeyName(), md5); ObjectHelper.set(model, this.table.table.getMD5KeyName(), md5);
} }
// 获取标识的实体 // 获取标识的实体
T from; T from;
if (this.Table.Table.getKeyType() == String.class) { if (this.table.table.getKeyType() == String.class) {
from = model; from = model;
this.setKeyString(model, md5); this.setKeyString(model, md5);
} else if (!StringHelper.isEmpty(this.Table.Table.getMD5KeyName())) { } else if (!StringHelper.isEmpty(this.table.table.getMD5KeyName())) {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
map.put(this.Table.Table.getMD5KeyName(), md5); map.put(this.table.table.getMD5KeyName(), md5);
from = this.load(map, cls); from = this.load(map, cls);
} else { } else {
from = this.queryFirst(cls, DaoConst.GroupQuery, model); from = this.queryFirst(cls, DaoConst.GROUP_QUERY, model);
} }
// 当没有存在,则创建,否则 UpdateAdd // 当没有存在,则创建,否则 UpdateAdd
...@@ -295,7 +295,7 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao { ...@@ -295,7 +295,7 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
ObjectHelper.set(model, keyField, key); ObjectHelper.set(model, keyField, key);
// 执行更新SQL语句 // 执行更新SQL语句
SqlData sqlData = this.getSql(DaoConst.GroupAdd); SqlData sqlData = this.getSql(DaoConst.GROUP_ADD);
int ret = this.updateSql(sqlData, model); int ret = this.updateSql(sqlData, model);
if (ret < 1) { if (ret < 1) {
return this.create(model); return this.create(model);
......
package com.yanzuoguang.dao.Impl; package com.yanzuoguang.dao.impl;
import com.yanzuoguang.dao.TableAnnotation; import com.yanzuoguang.dao.TableAnnotation;
import com.yanzuoguang.db.DbExecute; import com.yanzuoguang.db.DbExecute;
import com.yanzuoguang.db.Impl.DbRow; import com.yanzuoguang.db.impl.DbRow;
import com.yanzuoguang.util.base.ObjectHelper; import com.yanzuoguang.util.base.ObjectHelper;
import com.yanzuoguang.util.cache.MemoryCache; import com.yanzuoguang.util.cache.MemoryCache;
import com.yanzuoguang.util.exception.CodeException; import com.yanzuoguang.util.exception.CodeException;
...@@ -36,7 +36,7 @@ public abstract class BaseDaoSql { ...@@ -36,7 +36,7 @@ public abstract class BaseDaoSql {
/** /**
* 当前Dao的表结构SQL语句信息 * 当前Dao的表结构SQL语句信息
*/ */
protected TableSqlCache Table = null; protected TableSqlCache table = null;
/** /**
* 缓存的表结构和SQL语句 * 缓存的表结构和SQL语句
...@@ -65,11 +65,11 @@ public abstract class BaseDaoSql { ...@@ -65,11 +65,11 @@ public abstract class BaseDaoSql {
private void initTable() { private void initTable() {
String cls = this.getClass().getName(); String cls = this.getClass().getName();
// 外检测,防止锁影响性能 // 外检测,防止锁影响性能
this.Table = Cache.get(cls); this.table = Cache.get(cls);
// 判断是否已经取到对象 // 判断是否已经取到对象
if (this.Table == null) { if (this.table == null) {
this.Table = new TableSqlCache(); this.table = new TableSqlCache();
Cache.put(cls, this.Table); Cache.put(cls, this.table);
this.init(); this.init();
} }
} }
...@@ -104,8 +104,8 @@ public abstract class BaseDaoSql { ...@@ -104,8 +104,8 @@ public abstract class BaseDaoSql {
// 生成表结构 // 生成表结构
TableStruct table = new TableStruct(tableName, clsModel); TableStruct table = new TableStruct(tableName, clsModel);
// 根据表结构生成基本的SQL语句 // 根据表结构生成基本的SQL语句
table.init(this.Table); table.init(this.table);
return this.Table; return this.table;
} }
/** /**
...@@ -125,10 +125,10 @@ public abstract class BaseDaoSql { ...@@ -125,10 +125,10 @@ public abstract class BaseDaoSql {
* @return 对应名称的SQL语句 * @return 对应名称的SQL语句
*/ */
protected SqlData getSql(String name, boolean isThrow) { protected SqlData getSql(String name, boolean isThrow) {
if (this.Table == null) { if (this.table == null) {
throw new CodeException("类" + this.getClass().getName() + "未发现表结构"); throw new CodeException("类" + this.getClass().getName() + "未发现表结构");
} }
SqlData sql = this.Table.Sqls.get(name); SqlData sql = this.table.Sqls.get(name);
if (isThrow && sql == null) { if (isThrow && sql == null) {
throw new CodeException("类" + this.getClass().getName() + "未发现SQL语句" + name); throw new CodeException("类" + this.getClass().getName() + "未发现SQL语句" + name);
} }
...@@ -155,7 +155,7 @@ public abstract class BaseDaoSql { ...@@ -155,7 +155,7 @@ public abstract class BaseDaoSql {
protected int updateSql(SqlData sqlData, Object model) { protected int updateSql(SqlData sqlData, Object model) {
List<Object> paras = new ArrayList<Object>(); List<Object> paras = new ArrayList<Object>();
String sql = this.getQueryPara(paras, sqlData, model); String sql = this.getQueryPara(paras, sqlData, model);
int ret = db.update(this.getClass(), sqlData.Name, sql, paras.toArray()); int ret = db.update(this.getClass(), sqlData.name, sql, paras.toArray());
this.onUpdateSql(model); this.onUpdateSql(model);
return ret; return ret;
} }
...@@ -183,7 +183,7 @@ public abstract class BaseDaoSql { ...@@ -183,7 +183,7 @@ public abstract class BaseDaoSql {
protected Object queryCell(SqlData sqlData, Object model) { protected Object queryCell(SqlData sqlData, Object model) {
List<Object> paras = new ArrayList<Object>(); List<Object> paras = new ArrayList<Object>();
String sql = this.getQueryPara(paras, sqlData, model); String sql = this.getQueryPara(paras, sqlData, model);
Object cell = this.queryCellWithCache(sql, sqlData.Name, paras.toArray()); Object cell = this.queryCellWithCache(sql, sqlData.name, paras.toArray());
return cell; return cell;
} }
...@@ -211,7 +211,7 @@ public abstract class BaseDaoSql { ...@@ -211,7 +211,7 @@ public abstract class BaseDaoSql {
protected <T extends Object> List<T> queryData(Class<T> cls, SqlData sqlData, Object model) { protected <T extends Object> List<T> queryData(Class<T> cls, SqlData sqlData, Object model) {
List<Object> paras = new ArrayList<Object>(); List<Object> paras = new ArrayList<Object>();
String sql = this.getQueryPara(paras, sqlData, model); String sql = this.getQueryPara(paras, sqlData, model);
List<T> list = this.queryWithCache(cls, sqlData.Name, sql, paras.toArray()); List<T> list = this.queryWithCache(cls, sqlData.name, sql, paras.toArray());
return list; return list;
} }
...@@ -227,7 +227,7 @@ public abstract class BaseDaoSql { ...@@ -227,7 +227,7 @@ public abstract class BaseDaoSql {
List<Object> paras = new ArrayList<Object>(); List<Object> paras = new ArrayList<Object>();
String sql = this.getQueryPara(paras, sqlData, model); String sql = this.getQueryPara(paras, sqlData, model);
// 查询数据 // 查询数据
db.query(this.getClass(), cls, handle, sqlData.Name, sql, paras); db.query(this.getClass(), cls, handle, sqlData.name, sql, paras);
} }
/** /**
...@@ -290,7 +290,7 @@ public abstract class BaseDaoSql { ...@@ -290,7 +290,7 @@ public abstract class BaseDaoSql {
SqlData from = this.getSql(sqlName); SqlData from = this.getSql(sqlName);
// 对SQL语句进行分页处理 // 对SQL语句进行分页处理
SqlData to = from.copy(); SqlData to = from.copy();
to.Sql = from.Sql; to.sql = from.sql;
to.addCode("{LIMIT}", " LIMIT " + pageSize.getPageStart() + "," + pageSize.getPageSize()); to.addCode("{LIMIT}", " LIMIT " + pageSize.getPageStart() + "," + pageSize.getPageSize());
return queryData(cls, to, model); return queryData(cls, to, model);
} }
...@@ -417,7 +417,7 @@ public abstract class BaseDaoSql { ...@@ -417,7 +417,7 @@ public abstract class BaseDaoSql {
String[] lastCode = new String[]{"{WHERE}", "{GROUP}", "{HAVING}", "{ORDER}", "{LIMIT}"}; String[] lastCode = new String[]{"{WHERE}", "{GROUP}", "{HAVING}", "{ORDER}", "{LIMIT}"};
// 将SQL语句进行代码片段追加 // 将SQL语句进行代码片段追加
String sql = sqlData.Sql; String sql = sqlData.sql;
for (String code : lastCode) { for (String code : lastCode) {
if (sql.indexOf(code) == -1) { if (sql.indexOf(code) == -1) {
sql += code; sql += code;
...@@ -449,7 +449,7 @@ public abstract class BaseDaoSql { ...@@ -449,7 +449,7 @@ public abstract class BaseDaoSql {
// 判断代码片段是否合法 // 判断代码片段是否合法
if (field.codes.size() % 2 == 1) { if (field.codes.size() % 2 == 1) {
throw new CodeException("代码片段" + this.getClass().getSimpleName() + ":" + sqlData.Name + ":" + field.paraName + "为单数"); throw new CodeException("代码片段" + this.getClass().getSimpleName() + ":" + sqlData.name + ":" + field.paraName + "为单数");
} }
// 处理代码片段 // 处理代码片段
for (int i = 0; i < field.codes.size(); i = i + 2) { for (int i = 0; i < field.codes.size(); i = i + 2) {
...@@ -475,16 +475,16 @@ public abstract class BaseDaoSql { ...@@ -475,16 +475,16 @@ public abstract class BaseDaoSql {
} }
} }
// 通过正则表达式处理参数 @Name 并替换SQL语句成 ? // 通过正则表达式处理参数 @name 并替换SQL语句成 ?
{ {
String regex = "@([a-zA-Z0-9_]+)"; String regex = "@([a-zA-Z0-9_]+)";
Pattern p = Pattern.compile(regex); Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(sql); Matcher m = p.matcher(sql);
// 寻找到的代码片段 不包含分括号 // 寻找到的代码片段 不包含分括号
while (m.find()) { while (m.find()) {
// SQL参数名称 @Name\s // SQL参数名称 @name\s
String name = m.group(); String name = m.group();
// 对应的前台输入字段 Name // 对应的前台输入字段 name
String field = m.group(1); String field = m.group(1);
// 根据输入字段从参数中取值 // 根据输入字段从参数中取值
Object val = ObjectHelper.get(model, field); Object val = ObjectHelper.get(model, field);
...@@ -593,19 +593,19 @@ public abstract class BaseDaoSql { ...@@ -593,19 +593,19 @@ public abstract class BaseDaoSql {
sb.append(","); sb.append(",");
} }
switch (from.getGroupType()) { switch (from.getGroupType()) {
case CaseSqlModel.GroupTypeSUM: case CaseSqlModel.GROUP_TYPE_SUM:
sb.append("SUM"); sb.append("SUM");
break; break;
case CaseSqlModel.GroupTypeCOUNT: case CaseSqlModel.GROUP_TYPE_COUNT:
sb.append("COUNT"); sb.append("COUNT");
break; break;
case CaseSqlModel.GroupTypeMAX: case CaseSqlModel.GROUP_TYPE_MAX:
sb.append("MAX"); sb.append("MAX");
break; break;
case CaseSqlModel.GroupTypeMIN: case CaseSqlModel.GROUP_TYPE_MIN:
sb.append("MIN"); sb.append("MIN");
break; break;
case CaseSqlModel.GroupTypeAVG: case CaseSqlModel.GROUP_TYPE_AVG:
sb.append("AVG"); sb.append("AVG");
break; break;
default: default:
......
package com.yanzuoguang.dao.Impl; package com.yanzuoguang.dao.impl;
/** /**
* 行转列实体 * 行转列实体
*
* @author 颜佐光
*/ */
public class CaseSqlModel { public class CaseSqlModel {
public final static int GroupTypeSUM = 0; public final static int GROUP_TYPE_SUM = 0;
public final static int GroupTypeCOUNT = 1; public final static int GROUP_TYPE_COUNT = 1;
public final static int GroupTypeAVG = 2; public final static int GROUP_TYPE_AVG = 2;
public final static int GroupTypeMIN = 3; public final static int GROUP_TYPE_MIN = 3;
public final static int GroupTypeMAX = 4; public final static int GROUP_TYPE_MAX = 4;
public CaseSqlModel(String caseField, String caseValue, String valueField, String toName) { public CaseSqlModel(String caseField, String caseValue, String valueField, String toName) {
this(GroupTypeSUM, caseField, caseValue, valueField, toName); this(GROUP_TYPE_SUM, caseField, caseValue, valueField, toName);
} }
public CaseSqlModel(int groupType, String caseField, String caseValue, String valueField, String toName) { public CaseSqlModel(int groupType, String caseField, String caseValue, String valueField, String toName) {
this.GroupType = groupType; this.groupType = groupType;
this.CaseField = caseField; this.caseField = caseField;
this.CaseValue = caseValue; this.caseValue = caseValue;
this.ValueField = valueField; this.valueField = valueField;
this.ToName = toName; this.toName = toName;
this.AndWhere = ""; this.andWhere = "";
} }
public CaseSqlModel(String caseField, String caseValue, Object value, String toName, String andWhere) { public CaseSqlModel(String caseField, String caseValue, Object value, String toName, String andWhere) {
this(GroupTypeSUM, caseField, caseValue, value, toName, andWhere); this(GROUP_TYPE_SUM, caseField, caseValue, value, toName, andWhere);
} }
public CaseSqlModel(int groupType, String caseField, String caseValue, Object value, String toName, String andWhere) { public CaseSqlModel(int groupType, String caseField, String caseValue, Object value, String toName, String andWhere) {
this.GroupType = groupType; this.groupType = groupType;
this.CaseField = caseField; this.caseField = caseField;
this.CaseValue = caseValue; this.caseValue = caseValue;
this.Value = value; this.value = value;
this.ToName = toName; this.toName = toName;
this.AndWhere = andWhere; this.andWhere = andWhere;
} }
public CaseSqlModel(String caseField, String caseValue, String valueField, String toName, String andWhere) { public CaseSqlModel(String caseField, String caseValue, String valueField, String toName, String andWhere) {
this(GroupTypeSUM, caseField, caseValue, valueField, toName, andWhere); this(GROUP_TYPE_SUM, caseField, caseValue, valueField, toName, andWhere);
} }
public CaseSqlModel(int groupType, String caseField, String caseValue, String valueField, String toName, String andWhere) { public CaseSqlModel(int groupType, String caseField, String caseValue, String valueField, String toName, String andWhere) {
this.GroupType = groupType; this.groupType = groupType;
this.CaseField = caseField; this.caseField = caseField;
this.CaseValue = caseValue; this.caseValue = caseValue;
this.ValueField = valueField; this.valueField = valueField;
this.ToName = toName; this.toName = toName;
this.AndWhere = andWhere; this.andWhere = andWhere;
} }
/** /**
* 统计纬度 * 统计纬度
*/ */
private int GroupType; private int groupType;
/** /**
* 需要判断的字段 * 需要判断的字段
*/ */
private String CaseField; private String caseField;
/** /**
* 需要判断的值 * 需要判断的值
*/ */
private String CaseValue; private String caseValue;
/** /**
* 需要统计的字段,和 Value 只能存在一个,ValueField优先级更高 * 需要统计的字段,和 value 只能存在一个,ValueField优先级更高
*/ */
private String ValueField; private String valueField;
/** /**
* 需要统计的值,和 ValueField只能存在一个,ValueField优先级更高 * 需要统计的值,和 ValueField只能存在一个,ValueField优先级更高
*/ */
private Object Value; private Object value;
/** /**
* 目标字段名称 * 目标字段名称
*/ */
private String ToName; private String toName;
/** /**
* 需要判断的CASE字段的附加条件 * 需要判断的CASE字段的附加条件
*/ */
private String AndWhere; private String andWhere;
public int getGroupType() { public int getGroupType() {
return GroupType; return groupType;
} }
public void setGroupType(int groupType) { public void setGroupType(int groupType) {
GroupType = groupType; this.groupType = groupType;
} }
public String getCaseField() { public String getCaseField() {
return CaseField; return caseField;
} }
public void setCaseField(String caseField) { public void setCaseField(String caseField) {
CaseField = caseField; this.caseField = caseField;
} }
public String getCaseValue() { public String getCaseValue() {
return CaseValue; return caseValue;
} }
public void setCaseValue(String caseValue) { public void setCaseValue(String caseValue) {
CaseValue = caseValue; this.caseValue = caseValue;
} }
public String getValueField() { public String getValueField() {
return ValueField; return valueField;
} }
public void setValueField(String valueField) { public void setValueField(String valueField) {
ValueField = valueField; this.valueField = valueField;
} }
public Object getValue() { public Object getValue() {
return Value; return value;
} }
public void setValue(Object value) { public void setValue(Object value) {
Value = value; this.value = value;
} }
public String getToName() { public String getToName() {
return ToName; return toName;
} }
public void setToName(String toName) { public void setToName(String toName) {
ToName = toName; this.toName = toName;
} }
public String getAndWhere() { public String getAndWhere() {
return AndWhere; return andWhere;
} }
public void setAndWhere(String andWhere) { public void setAndWhere(String andWhere) {
AndWhere = andWhere; this.andWhere = andWhere;
} }
} }
package com.yanzuoguang.dao.Impl; package com.yanzuoguang.dao.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -12,17 +12,17 @@ public class SqlData { ...@@ -12,17 +12,17 @@ public class SqlData {
/** /**
* 对应的参数顺序 * 对应的参数顺序
*/ */
public List<SqlDataField> sqlDataFields = new ArrayList<SqlDataField>(); private List<SqlDataField> sqlDataFields = new ArrayList<SqlDataField>();
/** /**
* SQL语句的名称 * SQL语句的名称
*/ */
public String Name; private String name;
/** /**
* SQL语句 * SQL语句
*/ */
public String Sql; private String sql;
/** /**
* 构造函数 * 构造函数
...@@ -31,6 +31,26 @@ public class SqlData { ...@@ -31,6 +31,26 @@ public class SqlData {
this("", ""); this("", "");
} }
public List<SqlDataField> getSqlDataFields() {
return sqlDataFields;
}
public void setSqlDataFields(List<SqlDataField> sqlDataFields) {
this.sqlDataFields = sqlDataFields;
}
public String getName() {
return name;
}
public String getSql() {
return sql;
}
public void setSql(String sql) {
this.sql = sql;
}
/** /**
* SQL语句的基本信息 * SQL语句的基本信息
* *
...@@ -39,8 +59,8 @@ public class SqlData { ...@@ -39,8 +59,8 @@ public class SqlData {
* @param paras SQL语句参数名称数组 * @param paras SQL语句参数名称数组
*/ */
public SqlData(String name, String sql, String... paras) { public SqlData(String name, String sql, String... paras) {
this.Name = name; this.name = name;
this.Sql = sql; this.sql = sql;
for (String input : paras) { for (String input : paras) {
this.add(input); this.add(input);
} }
...@@ -220,7 +240,7 @@ public class SqlData { ...@@ -220,7 +240,7 @@ public class SqlData {
* @return 复制的结果 * @return 复制的结果
*/ */
public SqlData copy() { public SqlData copy() {
SqlData to = new SqlData(this.Name, this.Sql); SqlData to = new SqlData(this.name, this.sql);
for (SqlDataField sqlDataField : this.sqlDataFields) { for (SqlDataField sqlDataField : this.sqlDataFields) {
to.sqlDataFields.add(sqlDataField.copy()); to.sqlDataFields.add(sqlDataField.copy());
} }
...@@ -234,7 +254,7 @@ public class SqlData { ...@@ -234,7 +254,7 @@ public class SqlData {
* @return * @return
*/ */
public SqlData setName(String name) { public SqlData setName(String name) {
this.Name = name; this.name = name;
return this; return this;
} }
} }
package com.yanzuoguang.dao.Impl; package com.yanzuoguang.dao.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
......
package com.yanzuoguang.dao.Impl; package com.yanzuoguang.dao.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* Created by yanzu on 2017/6/6. * Created by yanzu on 2017/6/6.
*
* @author 颜佐光
*/ */
public class TableFieldString { public class TableFieldString {
/** /**
* 其他字段 * 其他字段
*/ */
public List<String> Fields = new ArrayList<String>(); private List<String> fields = new ArrayList<>();
/** /**
* 构造函数 * 构造函数
...@@ -20,7 +22,7 @@ public class TableFieldString { ...@@ -20,7 +22,7 @@ public class TableFieldString {
*/ */
public TableFieldString(String... fields) { public TableFieldString(String... fields) {
for (String field : fields) { for (String field : fields) {
this.Fields.add(field); this.fields.add(field);
} }
} }
...@@ -31,7 +33,15 @@ public class TableFieldString { ...@@ -31,7 +33,15 @@ public class TableFieldString {
*/ */
public TableFieldString(List<String> fields) { public TableFieldString(List<String> fields) {
for (String field : fields) { for (String field : fields) {
this.Fields.add(field); this.fields.add(field);
} }
} }
public List<String> getFields() {
return fields;
}
public void setFields(List<String> fields) {
this.fields = fields;
}
} }
package com.yanzuoguang.dao.Impl; package com.yanzuoguang.dao.impl;
/** /**
* 表结构的基本信息 * 表结构的基本信息
......
package com.yanzuoguang.dao.Impl; package com.yanzuoguang.dao.impl;
import com.yanzuoguang.util.cache.MemoryCache; import com.yanzuoguang.util.cache.MemoryCache;
import com.yanzuoguang.util.exception.CodeException; import com.yanzuoguang.util.exception.CodeException;
...@@ -25,18 +25,18 @@ public class TableSqlCache { ...@@ -25,18 +25,18 @@ public class TableSqlCache {
/** /**
* 表信息 * 表信息
*/ */
public TableStruct Table; private TableStruct table;
/** /**
* 缓存的SQL信息 * 缓存的SQL信息
*/ */
public MemoryCache<SqlData> Sqls = new MemoryCache<SqlData>(); private MemoryCache<SqlData> sqls = new MemoryCache<SqlData>();
/** /**
* 构造函数 * 构造函数
*/ */
public TableSqlCache() { public TableSqlCache() {
this.Table = new TableStruct(); this.table = new TableStruct();
} }
/** /**
...@@ -57,7 +57,7 @@ public class TableSqlCache { ...@@ -57,7 +57,7 @@ public class TableSqlCache {
*/ */
public SqlData add(SqlData sql) { public SqlData add(SqlData sql) {
if (sql != null) { if (sql != null) {
this.Sqls.put(sql.Name, sql); this.sqls.put(sql.getName(), sql);
} }
return sql; return sql;
} }
...@@ -83,8 +83,8 @@ public class TableSqlCache { ...@@ -83,8 +83,8 @@ public class TableSqlCache {
*/ */
public SqlData addPageSize(SqlData from, String sql) { public SqlData addPageSize(SqlData from, String sql) {
SqlData to = from.copy(); SqlData to = from.copy();
to.Sql = sql; to.sql = sql;
to.Name += TableSqlCache.PAGE_SIZE_TAG; to.name += TableSqlCache.PAGE_SIZE_TAG;
return this.add(to); return this.add(to);
} }
...@@ -95,7 +95,7 @@ public class TableSqlCache { ...@@ -95,7 +95,7 @@ public class TableSqlCache {
* @param addField * @param addField
*/ */
public void addGroup(TableFieldString tableWhereField, TableFieldString addField) { public void addGroup(TableFieldString tableWhereField, TableFieldString addField) {
this.Table.addGroupSql(this, tableWhereField, addField); this.table.addGroupSql(this, tableWhereField, addField);
} }
...@@ -106,7 +106,7 @@ public class TableSqlCache { ...@@ -106,7 +106,7 @@ public class TableSqlCache {
* @param whereFields * @param whereFields
*/ */
public void addSaveWith(String sqlName, TableFieldString whereFields) { public void addSaveWith(String sqlName, TableFieldString whereFields) {
this.Table.addSaveWithSql(this, sqlName, whereFields); this.table.addSaveWithSql(this, sqlName, whereFields);
} }
/** /**
...@@ -146,48 +146,48 @@ public class TableSqlCache { ...@@ -146,48 +146,48 @@ public class TableSqlCache {
} }
// 2. 判断所有纬度字段是否已经存在 // 2. 判断所有纬度字段是否已经存在
for (String item : tableWhereField.Fields) { for (String item : tableWhereField.fields) {
String name = item.toLowerCase(); String name = item.toLowerCase();
if (!sqlFieldHas.containsKey(name)) { if (!sqlFieldHas.containsKey(name)) {
throw new CodeException("SQL语句" + item + "不存在纬度" + item); throw new CodeException("SQL语句" + item + "不存在纬度" + item);
} }
sqlFieldWhere.put(name, true); sqlFieldWhere.put(name, true);
} }
for (String item : addField.Fields) { for (String item : addField.fields) {
String name = item.toLowerCase(); String name = item.toLowerCase();
sqlFieldAdd.put(name, true); sqlFieldAdd.put(name, true);
} }
// 3. 生成SQL语句 // 3. 生成SQL语句
String selectModel = "SELECT {FromField} FROM ( {SQL} )t"; String selectModel = "SELECT {FromField} FROM ( {SQL} )t";
String initModel = "INSERT INTO {Table}( {CreateField} ) " + String initModel = "INSERT INTO {table}( {CreateField} ) " +
"SELECT {FromInitField} FROM( {SelectSQL} )a " + "SELECT {FromInitField} FROM( {SelectSQL} )a " +
"LEFT JOIN {Table} AS b ON a.{Key} = b.{Key} WHERE b.{Key} IS NULL"; "LEFT JOIN {table} AS b ON a.{Key} = b.{Key} WHERE b.{Key} IS NULL";
String addModel = "UPDATE {Table} AS a INNER JOIN ( {SelectSQL} ) AS b ON a.{Key} = b.{Key} SET {addConst} "; String addModel = "UPDATE {table} AS a INNER JOIN ( {SelectSQL} ) AS b ON a.{Key} = b.{Key} SET {addConst} ";
// 定义需要处理的SQL对象 // 定义需要处理的SQL对象
Map<String, StringBuilder> map = new HashMap<String, StringBuilder>(); Map<String, StringBuilder> map = new HashMap<String, StringBuilder>();
addString(map, "{SQL}", sql); addString(map, "{SQL}", sql);
addString(map, "{Table}", this.Table.getName()); addString(map, "{table}", this.table.getName());
if (this.Table.getKeyType() == String.class) { if (this.table.getKeyType() == String.class) {
addString(map, "{Key}", this.Table.getKeyName()); addString(map, "{Key}", this.table.getKeyName());
} else if (!StringHelper.isEmpty(this.Table.getMD5KeyName())) { } else if (!StringHelper.isEmpty(this.table.getMD5KeyName())) {
addString(map, "{Key}", this.Table.getMD5KeyName()); addString(map, "{Key}", this.table.getMD5KeyName());
} else { } else {
throw new CodeException("表中未包含MD5字段"); throw new CodeException("表中未包含MD5字段");
} }
String lowerKey = this.Table.getKeyName().toLowerCase(); String lowerKey = this.table.getKeyName().toLowerCase();
String lowerMD5Key = this.Table.getMD5KeyName().toLowerCase(); String lowerMD5Key = this.table.getMD5KeyName().toLowerCase();
List<TableFieldVo> allField = new ArrayList<TableFieldVo>(); List<TableFieldVo> allField = new ArrayList<TableFieldVo>();
allField.add(this.Table.getKey()); allField.add(this.table.getKey());
allField.addAll(this.Table.getFields()); allField.addAll(this.table.getFields());
for (TableFieldVo fieldVo : allField) { for (TableFieldVo fieldVo : allField) {
String fieldName = fieldVo.name; String fieldName = fieldVo.name;
String fieldLName = fieldVo.lName; String fieldLName = fieldVo.lName;
if (fieldLName.equals(lowerKey) && this.Table.getKeyType() != String.class) { if (fieldLName.equals(lowerKey) && this.table.getKeyType() != String.class) {
continue; continue;
} }
...@@ -202,7 +202,7 @@ public class TableSqlCache { ...@@ -202,7 +202,7 @@ public class TableSqlCache {
// 处理需要MD5的字段 // 处理需要MD5的字段
addString(map, "{FromField}", "MD5(CONCAT("); addString(map, "{FromField}", "MD5(CONCAT(");
int i = 0; int i = 0;
for (String whereField : tableWhereField.Fields) { for (String whereField : tableWhereField.fields) {
if (i > 0) { if (i > 0) {
addString(map, "{FromField}", ",':',"); addString(map, "{FromField}", ",':',");
} }
...@@ -231,7 +231,7 @@ public class TableSqlCache { ...@@ -231,7 +231,7 @@ public class TableSqlCache {
addString(map, "{FromInitField}", "0 AS " + fieldName); addString(map, "{FromInitField}", "0 AS " + fieldName);
} else { } else {
addString(map, "{FromInitField}", "a." + fieldName); addString(map, "{FromInitField}", "a." + fieldName);
System.err.println("纬度" + this.Table.getName() + "->" + sqlName + "->" + fieldName + "存在,但是没有统计"); System.err.println("纬度" + this.table.getName() + "->" + sqlName + "->" + fieldName + "存在,但是没有统计");
} }
} }
} }
...@@ -239,8 +239,8 @@ public class TableSqlCache { ...@@ -239,8 +239,8 @@ public class TableSqlCache {
// 最终SQL语句处理 // 最终SQL语句处理
selectModel = replaceString(map, selectModel); selectModel = replaceString(map, selectModel);
addString(map, "{SelectSQL}", selectModel); addString(map, "{SelectSQL}", selectModel);
sqlInit.Sql = replaceString(map, initModel); sqlInit.sql = replaceString(map, initModel);
sqlAdd.Sql = replaceString(map, addModel); sqlAdd.sql = replaceString(map, addModel);
this.add(sqlInit); this.add(sqlInit);
this.add(sqlAdd); this.add(sqlAdd);
...@@ -258,7 +258,7 @@ public class TableSqlCache { ...@@ -258,7 +258,7 @@ public class TableSqlCache {
* @param fields 字段 * @param fields 字段
*/ */
public void addExist(String sqlName, String... fields) { public void addExist(String sqlName, String... fields) {
this.Table.addExist(this, sqlName, fields); this.table.addExist(this, sqlName, fields);
} }
private void addString(Map<String, StringBuilder> map, String name, String value) { private void addString(Map<String, StringBuilder> map, String name, String value) {
...@@ -282,4 +282,20 @@ public class TableSqlCache { ...@@ -282,4 +282,20 @@ public class TableSqlCache {
} }
return sql; return sql;
} }
public TableStruct getTable() {
return table;
}
public void setTable(TableStruct table) {
this.table = table;
}
public MemoryCache<SqlData> getSqls() {
return sqls;
}
public void setSqls(MemoryCache<SqlData> sqls) {
this.sqls = sqls;
}
} }
package com.yanzuoguang.db; package com.yanzuoguang.db;
import com.yanzuoguang.db.Impl.DbRow; import com.yanzuoguang.db.impl.DbRow;
import com.yanzuoguang.util.vo.MapRow; import com.yanzuoguang.util.vo.MapRow;
import java.util.List; import java.util.List;
......
package com.yanzuoguang.db.Impl; package com.yanzuoguang.db.impl;
import com.yanzuoguang.dao.DaoConst; import com.yanzuoguang.dao.DaoConst;
import com.yanzuoguang.extend.ConfigDb; import com.yanzuoguang.extend.ConfigDb;
import com.yanzuoguang.util.base.ObjectHelper; import com.yanzuoguang.util.base.ObjectHelper;
import com.yanzuoguang.util.helper.DateHelper;
import com.yanzuoguang.util.helper.StringHelper; import com.yanzuoguang.util.helper.StringHelper;
import com.yanzuoguang.util.log.Log; import com.yanzuoguang.util.log.Log;
import com.yanzuoguang.util.vo.MapRow; import com.yanzuoguang.util.vo.MapRow;
...@@ -20,7 +19,6 @@ import java.lang.reflect.Modifier; ...@@ -20,7 +19,6 @@ import java.lang.reflect.Modifier;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.ResultSetMetaData; import java.sql.ResultSetMetaData;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -251,9 +249,9 @@ public class AllBeanRowMapper<T> implements RowMapper<T> { ...@@ -251,9 +249,9 @@ public class AllBeanRowMapper<T> implements RowMapper<T> {
*/ */
private String getCamelCase(String column) { private String getCamelCase(String column) {
switch (configDb.getRowNameType()) { switch (configDb.getRowNameType()) {
case DaoConst.RowNameTypeNoChange: case DaoConst.ROW_NAME_TYPE_NO_CHANGE:
break; break;
case DaoConst.RowNameTypeCamelCase: case DaoConst.ROW_NAME_TYPE_CAMEL_CASE:
default: default:
column = StringHelper.getCamelCase(column); column = StringHelper.getCamelCase(column);
break; break;
......
package com.yanzuoguang.db.Impl; package com.yanzuoguang.db.impl;
import com.yanzuoguang.db.DbExecute; import com.yanzuoguang.db.DbExecute;
import com.yanzuoguang.extend.ConfigDb; import com.yanzuoguang.extend.ConfigDb;
...@@ -14,7 +14,6 @@ import javax.annotation.Resource; ...@@ -14,7 +14,6 @@ import javax.annotation.Resource;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
......
package com.yanzuoguang.db.Impl; package com.yanzuoguang.db.impl;
import com.yanzuoguang.extend.ConfigDb; import com.yanzuoguang.extend.ConfigDb;
import com.yanzuoguang.util.helper.StringHelper; import com.yanzuoguang.util.helper.StringHelper;
......
package com.yanzuoguang.db.Impl; package com.yanzuoguang.db.impl;
/** /**
* 处理行数据 * 处理行数据
......
package com.yanzuoguang.service.Impl; package com.yanzuoguang.service.impl;
import com.yanzuoguang.dao.BaseDao; import com.yanzuoguang.dao.BaseDao;
import com.yanzuoguang.service.BaseService; import com.yanzuoguang.service.BaseService;
......
package com.yanzuoguang.mq.dao.impl; package com.yanzuoguang.mq.dao.impl;
import com.yanzuoguang.dao.DaoConst; import com.yanzuoguang.dao.DaoConst;
import com.yanzuoguang.dao.Impl.BaseDaoImpl; import com.yanzuoguang.dao.impl.BaseDaoImpl;
import com.yanzuoguang.dao.Impl.SqlData; import com.yanzuoguang.dao.impl.SqlData;
import com.yanzuoguang.mq.dao.MessageDao; import com.yanzuoguang.mq.dao.MessageDao;
import com.yanzuoguang.mq.vo.MessageVo; import com.yanzuoguang.mq.vo.MessageVo;
import com.yanzuoguang.util.vo.MapRow; import com.yanzuoguang.util.vo.MapRow;
...@@ -20,11 +20,11 @@ public class MessageDaoImpl extends BaseDaoImpl implements MessageDao { ...@@ -20,11 +20,11 @@ public class MessageDaoImpl extends BaseDaoImpl implements MessageDao {
protected void init() { protected void init() {
register(MessageVo.class); register(MessageVo.class);
Table.add(DaoConst.Query, "SELECT a.* FROM Queue_Message AS a WHERE 1=1 ") table.add(DaoConst.QUERY, "SELECT a.* FROM Queue_Message AS a WHERE 1=1 ")
.add("batchId", "AND a.batchId=?") .add("batchId", "AND a.batchId=?")
; ;
Table.add(UPDATE_BATCH_SQL, "UPDATE Queue_Message AS a " + table.add(UPDATE_BATCH_SQL, "UPDATE Queue_Message AS a " +
"INNER JOIN ( SELECT * FROM Queue_Message WHERE (HandleTime IS NULL OR HandleTime < NOW()) " + "INNER JOIN ( SELECT * FROM Queue_Message WHERE (HandleTime IS NULL OR HandleTime < NOW()) " +
"ORDER BY HandleTime ASC,MessageId ASC {LIMIT} ) AS b ON a.MessageId = b.MessageId " + "ORDER BY HandleTime ASC,MessageId ASC {LIMIT} ) AS b ON a.MessageId = b.MessageId " +
"SET a.BatchId = ?,a.HandleTime=DATE_ADD(NOW(),INTERVAL 5 MINUTE) ", "batchId"); "SET a.BatchId = ?,a.HandleTime=DATE_ADD(NOW(),INTERVAL 5 MINUTE) ", "batchId");
...@@ -57,6 +57,6 @@ public class MessageDaoImpl extends BaseDaoImpl implements MessageDao { ...@@ -57,6 +57,6 @@ public class MessageDaoImpl extends BaseDaoImpl implements MessageDao {
public List<MessageVo> getListByBatch(String batchId) { public List<MessageVo> getListByBatch(String batchId) {
MapRow row = new MapRow(); MapRow row = new MapRow();
row.put("batchId", batchId); row.put("batchId", batchId);
return this.query(MessageVo.class, DaoConst.Query, row); return this.query(MessageVo.class, DaoConst.QUERY, row);
} }
} }
package com.yanzuoguang.mq.dao.impl; package com.yanzuoguang.mq.dao.impl;
import com.yanzuoguang.dao.DaoConst; import com.yanzuoguang.dao.DaoConst;
import com.yanzuoguang.dao.Impl.BaseDaoImpl; import com.yanzuoguang.dao.impl.BaseDaoImpl;
import com.yanzuoguang.dao.Impl.TableFieldString; import com.yanzuoguang.dao.impl.TableFieldString;
import com.yanzuoguang.mq.dao.QueueDao; import com.yanzuoguang.mq.dao.QueueDao;
import com.yanzuoguang.mq.vo.QueueVo; import com.yanzuoguang.mq.vo.QueueVo;
import com.yanzuoguang.mq.vo.req.QueueQueryReqVo; import com.yanzuoguang.mq.vo.req.QueueQueryReqVo;
...@@ -24,9 +24,9 @@ public class QueueDaoImpl extends BaseDaoImpl implements QueueDao { ...@@ -24,9 +24,9 @@ public class QueueDaoImpl extends BaseDaoImpl implements QueueDao {
// 根据实体生成增删改查语句 // 根据实体生成增删改查语句
register(QueueVo.class); register(QueueVo.class);
Table.addSaveWith(SAVE_WITH_SQL, new TableFieldString("queueName", "exchangeName", "routeKey")); table.addSaveWith(SAVE_WITH_SQL, new TableFieldString("queueName", "exchangeName", "routeKey"));
Table.add(DaoConst.Query, "SELECT * FROM Queue_Queue WHERE 1=1 ") table.add(DaoConst.QUERY, "SELECT * FROM Queue_Queue WHERE 1=1 ")
.add("queueName", "AND ( QueueName LIKE CONCAT('%',?,'%') OR DelayQueueName LIKE CONCAT('%',?,'%') )") .add("queueName", "AND ( QueueName LIKE CONCAT('%',?,'%') OR DelayQueueName LIKE CONCAT('%',?,'%') )")
.add("exchangeName", "AND ( ExchangeName LIKE CONCAT('%',?,'%') OR DelayExchangeName LIKE CONCAT('%',?,'%') )") .add("exchangeName", "AND ( ExchangeName LIKE CONCAT('%',?,'%') OR DelayExchangeName LIKE CONCAT('%',?,'%') )")
.add("routeKey", "AND ( RouteKey LIKE CONCAT('%',?,'%') OR DelayRouteKey LIKE CONCAT('%',?,'%') )") .add("routeKey", "AND ( RouteKey LIKE CONCAT('%',?,'%') OR DelayRouteKey LIKE CONCAT('%',?,'%') )")
...@@ -53,7 +53,7 @@ public class QueueDaoImpl extends BaseDaoImpl implements QueueDao { ...@@ -53,7 +53,7 @@ public class QueueDaoImpl extends BaseDaoImpl implements QueueDao {
*/ */
@Override @Override
public PageSizeData<QueueVo> query(QueueQueryReqVo req) { public PageSizeData<QueueVo> query(QueueQueryReqVo req) {
return this.queryPage(QueueVo.class, req, DaoConst.Query, req); return this.queryPage(QueueVo.class, req, DaoConst.QUERY, req);
} }
/** /**
...@@ -63,6 +63,6 @@ public class QueueDaoImpl extends BaseDaoImpl implements QueueDao { ...@@ -63,6 +63,6 @@ public class QueueDaoImpl extends BaseDaoImpl implements QueueDao {
*/ */
@Override @Override
public List<QueueVo> list() { public List<QueueVo> list() {
return this.query(QueueVo.class, DaoConst.Query, null); return this.query(QueueVo.class, DaoConst.QUERY, null);
} }
} }
...@@ -48,7 +48,7 @@ public interface MqService { ...@@ -48,7 +48,7 @@ public interface MqService {
* @param req * @param req
* @return * @return
*/ */
String message_error(MessageVo req); String messageError(MessageVo req);
/** /**
* 消息收到确认 * 消息收到确认
......
...@@ -77,7 +77,7 @@ public class MqServiceImpl implements MqService { ...@@ -77,7 +77,7 @@ public class MqServiceImpl implements MqService {
* @return * @return
*/ */
@Override @Override
public String message_error(MessageVo req) { public String messageError(MessageVo req) {
req.check(); req.check();
return messageService.onError(req); return messageService.onError(req);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment