diff --git a/common/src/main/java/com/jeesite/common/codec/AesUtils.java b/common/src/main/java/com/jeesite/common/codec/AesUtils.java index c6171da8..6e3dc5cf 100644 --- a/common/src/main/java/com/jeesite/common/codec/AesUtils.java +++ b/common/src/main/java/com/jeesite/common/codec/AesUtils.java @@ -201,18 +201,18 @@ public class AesUtils { } } - public static void main(String[] args) { - - String s = "hello word!"; - System.out.println(s); - - String k = genKeyString(); - System.out.println(k); - String ss = encode(s, k); - System.out.println(ss); - String sss = decode(ss, k); - System.out.println(sss); - - } +// public static void main(String[] args) { +// +// String s = "hello word!"; +// System.out.println(s); +// +// String k = genKeyString(); +// System.out.println(k); +// String ss = encode(s, k); +// System.out.println(ss); +// String sss = decode(ss, k); +// System.out.println(sss); +// +// } } \ No newline at end of file diff --git a/common/src/main/java/com/jeesite/common/idgen/IdGenerate.java b/common/src/main/java/com/jeesite/common/idgen/IdGenerate.java index 6524c352..a098cfcc 100644 --- a/common/src/main/java/com/jeesite/common/idgen/IdGenerate.java +++ b/common/src/main/java/com/jeesite/common/idgen/IdGenerate.java @@ -81,35 +81,35 @@ public class IdGenerate { return null; } - public static void main(String[] args) { - System.out.println(uuid()); - System.out.println(nextId()); - System.out.println(nextCode("8")); - System.out.println(nextCode("09")); - System.out.println(nextCode("009")); - System.out.println(nextCode("E09")); - System.out.println(nextCode("EC09")); - System.out.println(nextCode("EC0101")); - System.out.println(nextCode("EC0109")); - System.out.println(nextCode("EC02T03")); - System.out.println(nextCode("EC02T099")); - System.out.println(nextCode("EC02T100")); - System.out.println(nextCode("EC02T10A")); -// // 数值型ID重复验证测试 -// Set set = SetUtils.newHashSet(); -// try{ -// for (int i=0; i<100; i++){ -// String id = String.valueOf(nextId()); -// if (set.contains(id)){ -// throw new Exception(id + " exists"); -// } -// set.add(id); -// System.out.println(id); -// Thread.sleep(100); -// } -// }catch (Exception e) { -// e.printStackTrace(); -// } - } +// public static void main(String[] args) { +// System.out.println(uuid()); +// System.out.println(nextId()); +// System.out.println(nextCode("8")); +// System.out.println(nextCode("09")); +// System.out.println(nextCode("009")); +// System.out.println(nextCode("E09")); +// System.out.println(nextCode("EC09")); +// System.out.println(nextCode("EC0101")); +// System.out.println(nextCode("EC0109")); +// System.out.println(nextCode("EC02T03")); +// System.out.println(nextCode("EC02T099")); +// System.out.println(nextCode("EC02T100")); +// System.out.println(nextCode("EC02T10A")); +//// // 数值型ID重复验证测试 +//// Set set = SetUtils.newHashSet(); +//// try{ +//// for (int i=0; i<100; i++){ +//// String id = String.valueOf(nextId()); +//// if (set.contains(id)){ +//// throw new Exception(id + " exists"); +//// } +//// set.add(id); +//// System.out.println(id); +//// Thread.sleep(100); +//// } +//// }catch (Exception e) { +//// e.printStackTrace(); +//// } +// } } diff --git a/common/src/main/java/com/jeesite/common/idgen/IdWorker.java b/common/src/main/java/com/jeesite/common/idgen/IdWorker.java index 7d851d8f..13e92531 100644 --- a/common/src/main/java/com/jeesite/common/idgen/IdWorker.java +++ b/common/src/main/java/com/jeesite/common/idgen/IdWorker.java @@ -4,12 +4,6 @@ package com.jeesite.common.idgen; import java.util.Random; -import java.util.Set; -import java.util.concurrent.BrokenBarrierException; -import java.util.concurrent.CyclicBarrier; -import java.util.concurrent.TimeUnit; - -import com.jeesite.common.collect.SetUtils; /** * 来自于twitter项目snowflake的id产生方案,全局唯一,时间有序。 @@ -112,50 +106,50 @@ public class IdWorker { return System.currentTimeMillis(); } - //////////// test //////////// - - public static void main(String[] args) throws Exception { - final Set set = SetUtils.newHashSet(); - - final IdWorker w1 = new IdWorker(-1, -1); - final IdWorker w2 = new IdWorker(-1, -1); - final CyclicBarrier cdl = new CyclicBarrier(100); - - for (int i = 0; i < 1000; i++) { - new Thread(new Runnable() { - @Override - public void run() { - try { - cdl.await(); - } catch (InterruptedException e) { - e.printStackTrace(); - } catch (BrokenBarrierException e) { - e.printStackTrace(); - } - - // id - Long id = w1.nextId(); - if (set.contains(id)){ - System.out.println(id + " exists"); - } - set.add(id); - System.out.println(id); - - // id2 - Long id2 = w2.nextId(); - if (set.contains(id2)){ - System.out.println(id2 + " exists"); - } - set.add(id2); - System.out.println(id2); - } - }).start(); - } - try { - TimeUnit.SECONDS.sleep(5); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } +// //////////// test //////////// +// +// public static void main(String[] args) throws Exception { +// final Set set = SetUtils.newHashSet(); +// +// final IdWorker w1 = new IdWorker(-1, -1); +// final IdWorker w2 = new IdWorker(-1, -1); +// final CyclicBarrier cdl = new CyclicBarrier(100); +// +// for (int i = 0; i < 1000; i++) { +// new Thread(new Runnable() { +// @Override +// public void run() { +// try { +// cdl.await(); +// } catch (InterruptedException e) { +// e.printStackTrace(); +// } catch (BrokenBarrierException e) { +// e.printStackTrace(); +// } +// +// // id +// Long id = w1.nextId(); +// if (set.contains(id)){ +// System.out.println(id + " exists"); +// } +// set.add(id); +// System.out.println(id); +// +// // id2 +// Long id2 = w2.nextId(); +// if (set.contains(id2)){ +// System.out.println(id2 + " exists"); +// } +// set.add(id2); +// System.out.println(id2); +// } +// }).start(); +// } +// try { +// TimeUnit.SECONDS.sleep(5); +// } catch (InterruptedException e) { +// e.printStackTrace(); +// } +// } } \ No newline at end of file diff --git a/common/src/main/java/com/jeesite/common/image/CaptchaUtils.java b/common/src/main/java/com/jeesite/common/image/CaptchaUtils.java index 46cd9460..acf01438 100644 --- a/common/src/main/java/com/jeesite/common/image/CaptchaUtils.java +++ b/common/src/main/java/com/jeesite/common/image/CaptchaUtils.java @@ -6,7 +6,6 @@ package com.jeesite.common.image; import java.awt.Color; import java.awt.Graphics; import java.awt.image.BufferedImage; -import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.Random; @@ -171,12 +170,12 @@ public class CaptchaUtils { return s; } - public static void main(String[] args) throws IOException { - - FileOutputStream fos = new FileOutputStream("x:\\captcha.png"); - String s = generateCaptcha(fos); - System.out.println(s); - fos.close(); - - } +// public static void main(String[] args) throws IOException { +// +// FileOutputStream fos = new FileOutputStream("x:\\captcha.png"); +// String s = generateCaptcha(fos); +// System.out.println(s); +// fos.close(); +// +// } } diff --git a/common/src/main/java/com/jeesite/common/image/ImageGeo.java b/common/src/main/java/com/jeesite/common/image/ImageGeo.java index 5a84ee11..e134c4a8 100644 --- a/common/src/main/java/com/jeesite/common/image/ImageGeo.java +++ b/common/src/main/java/com/jeesite/common/image/ImageGeo.java @@ -57,9 +57,9 @@ public class ImageGeo { System.out.println(filename + ": (" + lat + ", " + lon + ")"); } - public static void main(String[] args) { - ImageGeo imageGeo = new ImageGeo(ImageGeo.class.getResource("IMAG0068.jpg").getFile()); - System.out.println(imageGeo.lon + "," + imageGeo.lat); - } +// public static void main(String[] args) { +// ImageGeo imageGeo = new ImageGeo(ImageGeo.class.getResource("IMAG0068.jpg").getFile()); +// System.out.println(imageGeo.lon + "," + imageGeo.lat); +// } } diff --git a/common/src/main/java/com/jeesite/common/image/ImageUtils.java b/common/src/main/java/com/jeesite/common/image/ImageUtils.java index 3e66fa83..55abaf25 100644 --- a/common/src/main/java/com/jeesite/common/image/ImageUtils.java +++ b/common/src/main/java/com/jeesite/common/image/ImageUtils.java @@ -8,7 +8,6 @@ import java.awt.image.BufferedImage; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; -import java.net.MalformedURLException; import java.net.URL; import javax.imageio.ImageIO; @@ -20,7 +19,7 @@ import com.sun.image.codec.jpeg.JPEGEncodeParam; import com.sun.image.codec.jpeg.JPEGImageEncoder; /** - * function: 缩放图片工具类,创建缩略图、伸缩图片比例 + * 缩放图片工具类,创建缩略图、伸缩图片比例 * @author hoojo * @createDate 2012-2-3 上午10:08:47 * @file ScaleImageUtils.java @@ -35,7 +34,7 @@ public abstract class ImageUtils { private static final String DEFAULT_FILE_PATH = FileUtils.getTempDirectoryPath(); /** - * function: 设置图片压缩质量枚举类; + * 设置图片压缩质量枚举类; * Some guidelines: 0.75 high quality、0.5 medium quality、0.25 low quality * @author hoojo * @createDate 2012-2-7 上午11:31:45 @@ -61,7 +60,7 @@ public abstract class ImageUtils { private static Image image; /** - * function: 通过目标对象的大小和标准(指定)大小计算出图片缩小的比例 + * 通过目标对象的大小和标准(指定)大小计算出图片缩小的比例 * @author hoojo * @createDate 2012-2-6 下午04:41:48 * @param targetWidth 目标的宽度 @@ -87,7 +86,7 @@ public abstract class ImageUtils { } /** - * function: 将Image的宽度、高度缩放到指定width、height,并保存在savePath目录 + * 将Image的宽度、高度缩放到指定width、height,并保存在savePath目录 * @author hoojo * @createDate 2012-2-6 下午04:54:35 * @param width 缩放的宽度 @@ -120,7 +119,7 @@ public abstract class ImageUtils { } /** - * function: 可以设置图片缩放质量,并且可以根据指定的宽高缩放图片 + * 可以设置图片缩放质量,并且可以根据指定的宽高缩放图片 * @author hoojo * @createDate 2012-2-7 上午11:01:27 * @param width 缩放的宽度 @@ -162,7 +161,7 @@ public abstract class ImageUtils { } /** - * function: 通过指定大小和图片的大小,计算出图片缩小的合适大小 + * 通过指定大小和图片的大小,计算出图片缩小的合适大小 * @author hoojo * @createDate 2012-2-6 下午05:53:10 * @param width 指定的宽度 @@ -180,7 +179,7 @@ public abstract class ImageUtils { } /** - * function: 通过指定的比例和图片对象,返回一个放大或缩小的宽度、高度 + * 通过指定的比例和图片对象,返回一个放大或缩小的宽度、高度 * @author hoojo * @createDate 2012-2-7 上午10:27:59 * @param scale 缩放比例 @@ -210,8 +209,7 @@ public abstract class ImageUtils { } /** - * - * function: 将指定的targetFile图片文件的宽度、高度大于指定width、height的图片缩小,并保存在savePath目录 + * 将指定的targetFile图片文件的宽度、高度大于指定width、height的图片缩小,并保存在savePath目录 * @author hoojo * @createDate 2012-2-6 下午04:57:02 * @param width 缩小的宽度 @@ -230,7 +228,7 @@ public abstract class ImageUtils { /** * - * function: 将指定的targetURL网络图片文件的宽度、高度大于指定width、height的图片缩小,并保存在savePath目录 + * 将指定的targetURL网络图片文件的宽度、高度大于指定width、height的图片缩小,并保存在savePath目录 * @author hoojo * @createDate 2012-2-6 下午04:57:07 * @param width 缩小的宽度 @@ -248,7 +246,7 @@ public abstract class ImageUtils { } /** - * function: 将一个本地的图片文件按照指定的比例进行缩放 + * 将一个本地的图片文件按照指定的比例进行缩放 * @author hoojo * @createDate 2012-2-7 上午10:29:18 * @param scale 缩放比例 @@ -265,7 +263,7 @@ public abstract class ImageUtils { } /** - * function: 将一个网络图片文件按照指定的比例进行缩放 + * 将一个网络图片文件按照指定的比例进行缩放 * @author hoojo * @createDate 2012-2-7 上午10:30:56 * @param scale 缩放比例 @@ -282,7 +280,7 @@ public abstract class ImageUtils { } /** - * function: 按照固定宽度进行等比缩放本地图片 + * 按照固定宽度进行等比缩放本地图片 * @author hoojo * @createDate 2012-2-7 上午10:49:56 * @param width 固定宽度 @@ -299,7 +297,7 @@ public abstract class ImageUtils { } /** - * function: 按照固定宽度进行等比缩放网络图片 + * 按照固定宽度进行等比缩放网络图片 * @author hoojo * @createDate 2012-2-7 上午10:50:52 * @param width 固定宽度 @@ -317,7 +315,7 @@ public abstract class ImageUtils { /** * - * function: 按照固定高度进行等比缩放本地图片 + * 按照固定高度进行等比缩放本地图片 * @author hoojo * @createDate 2012-2-7 上午10:51:17 * @param height 固定高度 @@ -334,7 +332,7 @@ public abstract class ImageUtils { } /** - * function: 按照固定高度进行等比缩放网络图片 + * 按照固定高度进行等比缩放网络图片 * @author hoojo * @createDate 2012-2-7 上午10:52:23 * @param height 固定高度 @@ -350,18 +348,10 @@ public abstract class ImageUtils { return resize(size[0], size[1], savePath, image); } - /** - * function: - * @author hoojo - * @createDate 2012-2-3 上午10:08:47 - * @param args - * @throws IOException - * @throws MalformedURLException - * @throws ImageFormatException - */ - public static void main(String[] args) throws ImageFormatException, MalformedURLException, IOException { - - System.out.println(ImageUtils.resize(140, 140, null, new URL("http://www.open-open.com/lib/images/logo.jpg"))); - ImageUtils.resize(100, 100, ImageQuality.high.getQuality(), null, ImageIO.read(new URL("http://www.open-open.com/lib/images/logo.jpg"))); - } +// public static void main(String[] args) throws ImageFormatException, MalformedURLException, IOException { +// +// System.out.println(ImageUtils.resize(140, 140, null, new URL("http://www.open-open.com/lib/images/logo.jpg"))); +// ImageUtils.resize(100, 100, ImageQuality.high.getQuality(), null, ImageIO.read(new URL("http://www.open-open.com/lib/images/logo.jpg"))); +// } + } \ No newline at end of file diff --git a/common/src/main/java/com/jeesite/common/image/ZxingUtils.java b/common/src/main/java/com/jeesite/common/image/ZxingUtils.java index c2c07477..10ada008 100644 --- a/common/src/main/java/com/jeesite/common/image/ZxingUtils.java +++ b/common/src/main/java/com/jeesite/common/image/ZxingUtils.java @@ -125,35 +125,32 @@ public class ZxingUtils { return null; } - /** - * @param args - */ - public static void main(String[] args) { - - // 条形码 - String imgPath = "target\\zxing_EAN13.png"; - String contents = "6923450657713"; - int width = 105, height = 50; - - ZxingUtils.encode(contents, width, height, imgPath); - System.out.println("finished zxing EAN-13 encode."); - - String decodeContent = ZxingUtils.decode(imgPath); - System.out.println("解码内容如下:" + decodeContent); - System.out.println("finished zxing EAN-13 decode."); - - // 二维码 - String imgPath2 = "target\\zxing.png"; - String contents2 = "Hello Gem, welcome to Zxing!" + "\nBlog [ http://thinkgem.iteye.com ]" + "\nEMail [ thinkgem@163.com ]"; - int width2 = 300, height2 = 300; - - ZxingUtils.encode2(contents2, width2, height2, imgPath2); - System.out.println("finished zxing encode."); - - String decodeContent2 = ZxingUtils.decode2(imgPath2); - System.out.println("解码内容如下:" + decodeContent2); - System.out.println("finished zxing decode."); - - } +// public static void main(String[] args) { +// +// // 条形码 +// String imgPath = "target\\zxing_EAN13.png"; +// String contents = "6923450657713"; +// int width = 105, height = 50; +// +// ZxingUtils.encode(contents, width, height, imgPath); +// System.out.println("finished zxing EAN-13 encode."); +// +// String decodeContent = ZxingUtils.decode(imgPath); +// System.out.println("解码内容如下:" + decodeContent); +// System.out.println("finished zxing EAN-13 decode."); +// +// // 二维码 +// String imgPath2 = "target\\zxing.png"; +// String contents2 = "Hello Gem, welcome to Zxing!" + "\nBlog [ http://thinkgem.iteye.com ]" + "\nEMail [ thinkgem@163.com ]"; +// int width2 = 300, height2 = 300; +// +// ZxingUtils.encode2(contents2, width2, height2, imgPath2); +// System.out.println("finished zxing encode."); +// +// String decodeContent2 = ZxingUtils.decode2(imgPath2); +// System.out.println("解码内容如下:" + decodeContent2); +// System.out.println("finished zxing decode."); +// +// } } \ No newline at end of file diff --git a/common/src/main/java/com/jeesite/common/lang/ByteUtils.java b/common/src/main/java/com/jeesite/common/lang/ByteUtils.java index a17361ae..de2d1f1b 100644 --- a/common/src/main/java/com/jeesite/common/lang/ByteUtils.java +++ b/common/src/main/java/com/jeesite/common/lang/ByteUtils.java @@ -87,16 +87,16 @@ public class ByteUtils { return String.format(formatStr, (size)) + "B"; } - public static void main(String[] args) { - System.out.println(ByteUtils.formatByteSize(1023)); - System.out.println(ByteUtils.formatByteSize(1L * UNIT)); - System.out.println(ByteUtils.formatByteSize(1L * UNIT * UNIT)); - System.out.println(ByteUtils.formatByteSize(1L * UNIT * 1023)); - System.out.println(ByteUtils.formatByteSize(1L * 1023 * 1023 * 1023)); - System.out.println(ByteUtils.formatByteSize(1L * UNIT * UNIT * UNIT)); - System.out.println(ByteUtils.formatByteSize(1L * UNIT * UNIT * UNIT * UNIT)); - System.out.println(ByteUtils.formatByteSize(1L * UNIT * UNIT * UNIT * UNIT * UNIT)); - System.out.println(ByteUtils.formatByteSize(1L * UNIT * UNIT * UNIT * UNIT * UNIT * UNIT)); - } +// public static void main(String[] args) { +// System.out.println(ByteUtils.formatByteSize(1023)); +// System.out.println(ByteUtils.formatByteSize(1L * UNIT)); +// System.out.println(ByteUtils.formatByteSize(1L * UNIT * UNIT)); +// System.out.println(ByteUtils.formatByteSize(1L * UNIT * 1023)); +// System.out.println(ByteUtils.formatByteSize(1L * 1023 * 1023 * 1023)); +// System.out.println(ByteUtils.formatByteSize(1L * UNIT * UNIT * UNIT)); +// System.out.println(ByteUtils.formatByteSize(1L * UNIT * UNIT * UNIT * UNIT)); +// System.out.println(ByteUtils.formatByteSize(1L * UNIT * UNIT * UNIT * UNIT * UNIT)); +// System.out.println(ByteUtils.formatByteSize(1L * UNIT * UNIT * UNIT * UNIT * UNIT * UNIT)); +// } } diff --git a/common/src/main/java/com/jeesite/common/lang/DateUtils.java b/common/src/main/java/com/jeesite/common/lang/DateUtils.java index 98e349d7..39ccd981 100644 --- a/common/src/main/java/com/jeesite/common/lang/DateUtils.java +++ b/common/src/main/java/com/jeesite/common/lang/DateUtils.java @@ -317,10 +317,6 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils { return new Date[]{beginDate, endDate}; } -// /** -// * @param args -// * @throws ParseException -// */ // public static void main(String[] args) throws ParseException { // System.out.println(formatDate(parseDate("2010/3/6"))); // System.out.println(getDate("yyyy年MM月dd日 E")); diff --git a/common/src/main/java/com/jeesite/common/lang/WorkDayUtils.java b/common/src/main/java/com/jeesite/common/lang/WorkDayUtils.java index 83519f43..1a2821ba 100644 --- a/common/src/main/java/com/jeesite/common/lang/WorkDayUtils.java +++ b/common/src/main/java/com/jeesite/common/lang/WorkDayUtils.java @@ -1,8 +1,6 @@ package com.jeesite.common.lang; -import java.text.SimpleDateFormat; import java.util.Calendar; -import java.util.Date; /** * 工作日计算工具类 @@ -109,28 +107,28 @@ public class WorkDayUtils { return this.getDaysBetween(d1, d2) - this.getWorkingDay(d1, d2); } - public static void main(String[] args) { - try { - String strDateStart = "2013-08-01"; - String strDateEnd = "2014-08-31"; - - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - Date date_start = sdf.parse(strDateStart); - Date date_end = sdf.parse(strDateEnd); - WorkDayUtils app = new WorkDayUtils(); - Calendar cal_start = Calendar.getInstance(); - Calendar cal_end = Calendar.getInstance(); - cal_start.setTime(date_start); - cal_end.setTime(date_end); - System.out.println("开始日:" + cal_start.get(Calendar.YEAR) + "-" + (cal_start.get(Calendar.MONTH) + 1) - + "-" + cal_start.get(Calendar.DAY_OF_MONTH) + " " + app.getChineseWeek(cal_start)); - System.out.println("结束日:" + cal_end.get(Calendar.YEAR) + "-" + (cal_end.get(Calendar.MONTH) + 1) - + "-" + cal_end.get(Calendar.DAY_OF_MONTH) + " " + app.getChineseWeek(cal_end)); - System.out.println("工作日:" + app.getWorkingDay(cal_start, cal_end)); - System.out.println("休息日:" + app.getHolidays(cal_start, cal_end)); - } catch (Exception e) { - e.printStackTrace(); - } - } +// public static void main(String[] args) { +// try { +// String strDateStart = "2013-08-01"; +// String strDateEnd = "2014-08-31"; +// +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); +// Date date_start = sdf.parse(strDateStart); +// Date date_end = sdf.parse(strDateEnd); +// WorkDayUtils app = new WorkDayUtils(); +// Calendar cal_start = Calendar.getInstance(); +// Calendar cal_end = Calendar.getInstance(); +// cal_start.setTime(date_start); +// cal_end.setTime(date_end); +// System.out.println("开始日:" + cal_start.get(Calendar.YEAR) + "-" + (cal_start.get(Calendar.MONTH) + 1) +// + "-" + cal_start.get(Calendar.DAY_OF_MONTH) + " " + app.getChineseWeek(cal_start)); +// System.out.println("结束日:" + cal_end.get(Calendar.YEAR) + "-" + (cal_end.get(Calendar.MONTH) + 1) +// + "-" + cal_end.get(Calendar.DAY_OF_MONTH) + " " + app.getChineseWeek(cal_end)); +// System.out.println("工作日:" + app.getWorkingDay(cal_start, cal_end)); +// System.out.println("休息日:" + app.getHolidays(cal_start, cal_end)); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } } diff --git a/common/src/main/java/com/jeesite/common/mapper/JsonMapper.java b/common/src/main/java/com/jeesite/common/mapper/JsonMapper.java index adad244b..b2cedef6 100644 --- a/common/src/main/java/com/jeesite/common/mapper/JsonMapper.java +++ b/common/src/main/java/com/jeesite/common/mapper/JsonMapper.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.util.JSONPObject; import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; import com.jeesite.common.collect.ListUtils; -import com.jeesite.common.collect.MapUtils; /** * 简单封装Jackson,实现JSON String<->Java Object的Mapper. @@ -248,32 +247,29 @@ public class JsonMapper extends ObjectMapper { return result; } - /** - * 测试 - */ - public static void main(String[] args) { - List> list = ListUtils.newArrayList(); - Map map = MapUtils.newHashMap(); - map.put("id", 1); - map.put("pId", -1); - map.put("name", "根节点"); - list.add(map); - map = MapUtils.newHashMap(); - map.put("id", 2); - map.put("pId", 1); - map.put("name", "你好"); - map.put("open", true); - list.add(map); - String json = JsonMapper.toJson(list); - System.out.println(json); - List> map2 = JsonMapper.fromJson(json, List.class); - System.out.println(map2); - Map map3 = JsonMapper.fromJson("{extendS1:{title:'站牌号'," - + "sort:1,type:'text',maxlength:0,maxlength:30},extendS2:{title:'规模分类'," - + "sort:2,type:'dict',dictType:'scope_category'}}", Map.class); - System.out.println(map3); - List list2 = fromJson("[1,2]", List.class); - System.out.println(list2); - } +// public static void main(String[] args) { +// List> list = ListUtils.newArrayList(); +// Map map = MapUtils.newHashMap(); +// map.put("id", 1); +// map.put("pId", -1); +// map.put("name", "根节点"); +// list.add(map); +// map = MapUtils.newHashMap(); +// map.put("id", 2); +// map.put("pId", 1); +// map.put("name", "你好"); +// map.put("open", true); +// list.add(map); +// String json = JsonMapper.toJson(list); +// System.out.println(json); +// List> map2 = JsonMapper.fromJson(json, List.class); +// System.out.println(map2); +// Map map3 = JsonMapper.fromJson("{extendS1:{title:'站牌号'," +// + "sort:1,type:'text',maxlength:0,maxlength:30},extendS2:{title:'规模分类'," +// + "sort:2,type:'dict',dictType:'scope_category'}}", Map.class); +// System.out.println(map3); +// List list2 = fromJson("[1,2]", List.class); +// System.out.println(list2); +// } } diff --git a/common/src/main/java/com/jeesite/common/mapper/XmlMapper.java b/common/src/main/java/com/jeesite/common/mapper/XmlMapper.java index 78a81ba8..ea39d863 100644 --- a/common/src/main/java/com/jeesite/common/mapper/XmlMapper.java +++ b/common/src/main/java/com/jeesite/common/mapper/XmlMapper.java @@ -3,9 +3,7 @@ */ package com.jeesite.common.mapper; -import java.io.File; import java.io.IOException; -import java.nio.charset.Charset; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; @@ -25,9 +23,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.fasterxml.jackson.databind.JavaType; -import com.jeesite.common.collect.ListUtils; -import com.jeesite.common.collect.MapUtils; -import com.jeesite.common.io.FileUtils; /** * XML <-> Map、Object @@ -269,38 +264,38 @@ public class XmlMapper extends com.fasterxml.jackson.dataformat.xml.XmlMapper{ return map; } - @SuppressWarnings("unchecked") - public static void main(String[] args) throws Exception { - - File file = new File(FileUtils.getProjectPath() - + "/../modules/core/src/main/resources/spring/spring-context-core.xml"); - String xml = FileUtils.readFileToString(file, Charset.defaultCharset()); - - System.out.println(xmlToMap(xml, true)); - System.out.println(xmlToMapWithAttr(xml, true)); - - XmlMapper m = XmlMapper.getInstance(); - System.out.println(m.readValue(xml, List.class)); - System.out.println(m.readValue(xml, Map.class)); - - List> list = ListUtils.newArrayList(); - Map map = MapUtils.newHashMap(); - map.put("id", 1); - map.put("pId", -1); - map.put("name", "根节点"); - list.add(map); - map = MapUtils.newHashMap(); - map.put("id", 2); - map.put("pId", 1); - map.put("name", "你好"); - map.put("open", true); - list.add(map); - - String s = XmlMapper.getInstance().writeValueAsString(list); - System.out.println(s); - - list = XmlMapper.getInstance().readValue(s, List.class); - System.out.println(list); - - } +// public static void main(String[] args) throws Exception { +// +// File file = new File(FileUtils.getProjectPath() +// + "/../modules/core/src/main/resources/spring/spring-context-core.xml"); +// String xml = FileUtils.readFileToString(file, Charset.defaultCharset()); +// +// System.out.println(xmlToMap(xml, true)); +// System.out.println(xmlToMapWithAttr(xml, true)); +// +// XmlMapper m = XmlMapper.getInstance(); +// System.out.println(m.readValue(xml, List.class)); +// System.out.println(m.readValue(xml, Map.class)); +// +// List> list = ListUtils.newArrayList(); +// Map map = MapUtils.newHashMap(); +// map.put("id", 1); +// map.put("pId", -1); +// map.put("name", "根节点"); +// list.add(map); +// map = MapUtils.newHashMap(); +// map.put("id", 2); +// map.put("pId", 1); +// map.put("name", "你好"); +// map.put("open", true); +// list.add(map); +// +// String s = XmlMapper.getInstance().writeValueAsString(list); +// System.out.println(s); +// +// list = XmlMapper.getInstance().readValue(s, List.class); +// System.out.println(list); +// +// } + } diff --git a/common/src/main/java/com/jeesite/common/media/VideoUtils.java b/common/src/main/java/com/jeesite/common/media/VideoUtils.java index 937186b2..db131d9e 100644 --- a/common/src/main/java/com/jeesite/common/media/VideoUtils.java +++ b/common/src/main/java/com/jeesite/common/media/VideoUtils.java @@ -471,22 +471,22 @@ public class VideoUtils { } } - public static void main(String[] args) { -// VideoUtils.setFfmpegFile("D:/EcodeSVN/ecodedp/tools/video/ffmpeg-4.9/bin/ffmpeg.exe"); - VideoUtils.setFfmpegFile("D:/EcodeSVN/ecodedp/tools/video/libav-10.6-win64/bin/avconv.exe"); - VideoUtils.setMencoderFile("D:/EcodeSVN/ecodedp/tools/video/mencoder-4.9/mencoder.exe"); - VideoUtils.setQtFaststartFile("D:/EcodeSVN/ecodedp/tools/video/qt-faststart/qt-faststart.exe"); - final VideoUtils v = new VideoUtils("e:/Users/Administrator/Desktop/mp4/20150001.mp4"); -// new Thread(new Runnable() { -// @Override -// public void run() { - System.out.println("img:转换" + (v.cutPic()?"成功":"失败")); - System.out.println("file:转换" + (v.convert()?"成功":"失败")); -// } -// }).start(); - System.out.println("inputFile: " + v.getInputFile()); - System.out.println("imageFile: " + v.getImgFile()); - System.out.println("outputFile: " + v.getOutputFile()); - } +// public static void main(String[] args) { +//// VideoUtils.setFfmpegFile("d:/tools/video/ffmpeg-4.9/bin/ffmpeg.exe"); +// VideoUtils.setFfmpegFile("d:/tools/video/libav-10.6-win64/bin/avconv.exe"); +// VideoUtils.setMencoderFile("d:/tools/video/mencoder-4.9/mencoder.exe"); +// VideoUtils.setQtFaststartFile("d:/tools/video/qt-faststart/qt-faststart.exe"); +// final VideoUtils v = new VideoUtils("e:/Users/Administrator/Desktop/mp4/20150001.mp4"); +//// new Thread(new Runnable() { +//// @Override +//// public void run() { +// System.out.println("img:转换" + (v.cutPic()?"成功":"失败")); +// System.out.println("file:转换" + (v.convert()?"成功":"失败")); +//// } +//// }).start(); +// System.out.println("inputFile: " + v.getInputFile()); +// System.out.println("imageFile: " + v.getImgFile()); +// System.out.println("outputFile: " + v.getOutputFile()); +// } } diff --git a/common/src/main/java/com/jeesite/common/text/DiffMatchPatchTest.java b/common/src/main/java/com/jeesite/common/text/DiffMatchPatchTest.java index 48655ac1..a9417705 100644 --- a/common/src/main/java/com/jeesite/common/text/DiffMatchPatchTest.java +++ b/common/src/main/java/com/jeesite/common/text/DiffMatchPatchTest.java @@ -27,7 +27,6 @@ import java.util.Map; import org.junit.Assert; -import com.jeesite.common.io.FileUtils; import com.jeesite.common.text.DiffMatchPatch.Diff; import com.jeesite.common.text.DiffMatchPatch.LinesToCharsResult; import com.jeesite.common.text.DiffMatchPatch.Patch; @@ -933,23 +932,23 @@ public class DiffMatchPatchTest { Assert.fail(message); } - public static void main(String[] args) { - -// DiffMatchPatchTest d = new DiffMatchPatchTest(); -// d.testDiffCleanupEfficiency(); -// d.testDiffPrettyHtml(); - - String text1 = "花一样的你,花一样的我,花一样的年华,花一样的世界,花一样的未来。"; - String text2 = "花样的你,花一样的年华,花一样的我,花一样的未来,花一样的世界。"; - - DiffMatchPatch dmp = new DiffMatchPatch(); - - LinkedList diffs = dmp.diff_main(text1, text2); - String result = dmp.diff_prettyHtml(diffs); - - FileUtils.writeToFile("x:\\test.html", result, false); - System.out.println(result); - - } +// public static void main(String[] args) { +// +//// DiffMatchPatchTest d = new DiffMatchPatchTest(); +//// d.testDiffCleanupEfficiency(); +//// d.testDiffPrettyHtml(); +// +// String text1 = "花一样的你,花一样的我,花一样的年华,花一样的世界,花一样的未来。"; +// String text2 = "花样的你,花一样的年华,花一样的我,花一样的未来,花一样的世界。"; +// +// DiffMatchPatch dmp = new DiffMatchPatch(); +// +// LinkedList diffs = dmp.diff_main(text1, text2); +// String result = dmp.diff_prettyHtml(diffs); +// +// FileUtils.writeToFile("x:\\test.html", result, false); +// System.out.println(result); +// +// } } diff --git a/common/src/main/java/com/jeesite/common/text/PinyinUtils.java b/common/src/main/java/com/jeesite/common/text/PinyinUtils.java index 03684150..94d6fb62 100644 --- a/common/src/main/java/com/jeesite/common/text/PinyinUtils.java +++ b/common/src/main/java/com/jeesite/common/text/PinyinUtils.java @@ -97,10 +97,10 @@ public class PinyinUtils { return pybf.toString(); } - public static void main(String[] args) { - String str = "你好,123,世界abc,~!#$_Sdf"; -// System.out.println(getPinyin(str)); - System.out.println(getFirstSpell(str)); - System.out.println(getFullSpell(str)); - } +// public static void main(String[] args) { +// String str = "你好,123,世界abc,~!#$_Sdf"; +//// System.out.println(getPinyin(str)); +// System.out.println(getFirstSpell(str)); +// System.out.println(getFullSpell(str)); +// } } diff --git a/common/src/main/java/com/jeesite/common/utils/excel/ExcelReader.java b/common/src/main/java/com/jeesite/common/utils/excel/ExcelReader.java index 825870b3..ee7d24ad 100644 --- a/common/src/main/java/com/jeesite/common/utils/excel/ExcelReader.java +++ b/common/src/main/java/com/jeesite/common/utils/excel/ExcelReader.java @@ -212,23 +212,23 @@ public abstract class ExcelReader extends DefaultHandler { */ public abstract void getRows(int sheetIndex, int curRow, List rowList); - /** - * 测试方法 - */ - public static void main(String[] args) throws Exception { - - String file = "E:/销售数据导入.xlsx"; - - ExcelReader reader = new ExcelReader() { - @Override - public void getRows(int sheetIndex, int curRow, List rowList) { - - System.out.println("Sheet:" + sheetIndex + ", Row:" + curRow + ", Data:" +rowList); - - } - }; - reader.process(file, 1); - - } +// /** +// * 测试方法 +// */ +// public static void main(String[] args) throws Exception { +// +// String file = "E:/销售数据导入.xlsx"; +// +// ExcelReader reader = new ExcelReader() { +// @Override +// public void getRows(int sheetIndex, int curRow, List rowList) { +// +// System.out.println("Sheet:" + sheetIndex + ", Row:" + curRow + ", Data:" +rowList); +// +// } +// }; +// reader.process(file, 1); +// +// } } diff --git a/common/src/main/java/com/jeesite/common/utils/excel/ExcelWriter.java b/common/src/main/java/com/jeesite/common/utils/excel/ExcelWriter.java index 0fad27fd..a22e29f2 100644 --- a/common/src/main/java/com/jeesite/common/utils/excel/ExcelWriter.java +++ b/common/src/main/java/com/jeesite/common/utils/excel/ExcelWriter.java @@ -284,42 +284,42 @@ public abstract class ExcelWriter { return buffer.toString(); } - /** - * 测试方法 - */ - public static void main(String[] args) throws Exception { - - String file = "E:/测试导出数据.xlsx"; - - ExcelWriter writer = new ExcelWriter() { - @Override - public void generate() throws Exception { - - // 电子表格开始 - this.beginSheet(); - - for (int rownum = 0; rownum < 100; rownum++) { - // 插入新行 - this.insertRow(rownum); - - // 建立新单元格,索引值从0开始,表示第一列 - this.createCell(0, "第 " + rownum + " 行"); - this.createCell(1, 34343.123456789); - this.createCell(2, "23.67%"); - this.createCell(3, "12:12:23"); - this.createCell(4, "2014-10-11 12:12:23"); - this.createCell(5, "true"); - this.createCell(6, "false"); - - // 结束行 - this.endRow(); - } - - // 电子表格结束 - this.endSheet(); - } - }; - writer.process(file); - } +// /** +// * 测试方法 +// */ +// public static void main(String[] args) throws Exception { +// +// String file = "E:/测试导出数据.xlsx"; +// +// ExcelWriter writer = new ExcelWriter() { +// @Override +// public void generate() throws Exception { +// +// // 电子表格开始 +// this.beginSheet(); +// +// for (int rownum = 0; rownum < 100; rownum++) { +// // 插入新行 +// this.insertRow(rownum); +// +// // 建立新单元格,索引值从0开始,表示第一列 +// this.createCell(0, "第 " + rownum + " 行"); +// this.createCell(1, 34343.123456789); +// this.createCell(2, "23.67%"); +// this.createCell(3, "12:12:23"); +// this.createCell(4, "2014-10-11 12:12:23"); +// this.createCell(5, "true"); +// this.createCell(6, "false"); +// +// // 结束行 +// this.endRow(); +// } +// +// // 电子表格结束 +// this.endSheet(); +// } +// }; +// writer.process(file); +// } } diff --git a/common/src/main/java/com/jeesite/common/utils/word/WordExport.java b/common/src/main/java/com/jeesite/common/utils/word/WordExport.java index 6e8c7dba..709114f1 100644 --- a/common/src/main/java/com/jeesite/common/utils/word/WordExport.java +++ b/common/src/main/java/com/jeesite/common/utils/word/WordExport.java @@ -5,7 +5,6 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.math.BigInteger; -import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -24,8 +23,6 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHeight; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTrPr; import org.w3c.dom.Node; -import com.jeesite.common.codec.EncodeUtils; - /** * 使用POI,进行Word相关的操作 * @author xuyu @@ -229,70 +226,67 @@ public class WordExport { } } - /** - * @param args - */ - public static void main(String[] args) { - long startTime = System.currentTimeMillis(); - WordExport changer = new WordExport(); - String fileName = WordExport.class.getResource("Word模版.docx").getFile(); - fileName = EncodeUtils.decodeUrl(fileName.substring(1)); - System.out.println(fileName); - - changer.setTemplate(fileName); - Map content = new HashMap(); - content.put("Principles", "格式规范、标准统一、利于阅览"); - content.put("Purpose", "规范会议操作、提高会议质量"); - content.put("Scope", "公司会议、部门之间业务协调会议"); - - content.put("customerName", "**有限公司"); - content.put("address", "机场路2号"); - content.put("userNo", "3021170207"); - content.put("tradeName", "水泥制造"); - content.put("price1", "1.085"); - content.put("price2", "0.906"); - content.put("price3", "0.433"); - content.put("numPrice", "0.675"); - - content.put("company_name", "**有限公司"); - content.put("company_address", "机场路2号"); - changer.replaceBookMark(content); - - //替换表格标签 - List> content2 = new ArrayList>(); - Map table1 = new HashMap(); - - table1.put("MONTH", "*月份"); - table1.put("SALE_DEP", "75分"); - table1.put("TECH_CENTER", "80分"); - table1.put("CUSTOMER_SERVICE", "85分"); - table1.put("HUMAN_RESOURCES", "90分"); - table1.put("FINANCIAL", "95分"); - table1.put("WORKSHOP", "80分"); - table1.put("TOTAL", "85分"); - - for (int i = 0; i < 3; i++) { - content2.add(table1); - } - changer.fillTableAtBookMark("Table", content2); - changer.fillTableAtBookMark("month", content2); - - //表格中文本的替换 - Map table = new HashMap(); - table.put("CUSTOMER_NAME", "**有限公司"); - table.put("ADDRESS", "机场路2号"); - table.put("USER_NO", "3021170207"); - table.put("tradeName", "水泥制造"); - table.put("PRICE_1", "1.085"); - table.put("PRICE_2", "0.906"); - table.put("PRICE_3", "0.433"); - table.put("NUM_PRICE", "0.675"); - changer.replaceText(table, "Table2"); - - //保存替换后的WORD - changer.saveAs(fileName + "_out.docx"); - System.out.println("time==" + (System.currentTimeMillis() - startTime)); - - } +// public static void main(String[] args) { +// long startTime = System.currentTimeMillis(); +// WordExport changer = new WordExport(); +// String fileName = WordExport.class.getResource("Word模版.docx").getFile(); +// fileName = EncodeUtils.decodeUrl(fileName.substring(1)); +// System.out.println(fileName); +// +// changer.setTemplate(fileName); +// Map content = new HashMap(); +// content.put("Principles", "格式规范、标准统一、利于阅览"); +// content.put("Purpose", "规范会议操作、提高会议质量"); +// content.put("Scope", "公司会议、部门之间业务协调会议"); +// +// content.put("customerName", "**有限公司"); +// content.put("address", "机场路2号"); +// content.put("userNo", "3021170207"); +// content.put("tradeName", "水泥制造"); +// content.put("price1", "1.085"); +// content.put("price2", "0.906"); +// content.put("price3", "0.433"); +// content.put("numPrice", "0.675"); +// +// content.put("company_name", "**有限公司"); +// content.put("company_address", "机场路2号"); +// changer.replaceBookMark(content); +// +// //替换表格标签 +// List> content2 = new ArrayList>(); +// Map table1 = new HashMap(); +// +// table1.put("MONTH", "*月份"); +// table1.put("SALE_DEP", "75分"); +// table1.put("TECH_CENTER", "80分"); +// table1.put("CUSTOMER_SERVICE", "85分"); +// table1.put("HUMAN_RESOURCES", "90分"); +// table1.put("FINANCIAL", "95分"); +// table1.put("WORKSHOP", "80分"); +// table1.put("TOTAL", "85分"); +// +// for (int i = 0; i < 3; i++) { +// content2.add(table1); +// } +// changer.fillTableAtBookMark("Table", content2); +// changer.fillTableAtBookMark("month", content2); +// +// //表格中文本的替换 +// Map table = new HashMap(); +// table.put("CUSTOMER_NAME", "**有限公司"); +// table.put("ADDRESS", "机场路2号"); +// table.put("USER_NO", "3021170207"); +// table.put("tradeName", "水泥制造"); +// table.put("PRICE_1", "1.085"); +// table.put("PRICE_2", "0.906"); +// table.put("PRICE_3", "0.433"); +// table.put("NUM_PRICE", "0.675"); +// changer.replaceText(table, "Table2"); +// +// //保存替换后的WORD +// changer.saveAs(fileName + "_out.docx"); +// System.out.println("time==" + (System.currentTimeMillis() - startTime)); +// +// } }