feat:修改文件视频处理类型

dev
wangxy 8 months ago
parent e6395c3828
commit fc5784e92c

@ -1,82 +1,82 @@
/* */ package com.archive.common.constant;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class GenConstants
/* */ {
/* */ public static final String TPL_CRUD = "crud";
/* */ public static final String TPL_TREE = "tree";
/* */ public static final String TPL_SUB = "sub";
/* */ public static final String TREE_CODE = "treeCode";
/* */ public static final String TREE_PARENT_CODE = "treeParentCode";
/* */ public static final String TREE_NAME = "treeName";
/* */ public static final String PARENT_MENU_ID = "parentMenuId";
/* */ public static final String PARENT_MENU_NAME = "parentMenuName";
/* 35 */ public static final String[] COLUMNTYPE_STR = new String[] { "char", "varchar", "nvarchar", "varchar2" };
/* */
/* */
/* 38 */ public static final String[] COLUMNTYPE_TEXT = new String[] { "tinytext", "text", "mediumtext", "longtext" };
/* */
/* */
/* 41 */ public static final String[] COLUMNTYPE_TIME = new String[] { "datetime", "time", "date", "timestamp" };
/* */
/* */
/* 44 */ public static final String[] COLUMNTYPE_NUMBER = new String[] { "tinyint", "smallint", "mediumint", "int", "number", "integer", "bit", "bigint", "float", "double", "decimal" };
/* */
/* */
/* */
/* 48 */ public static final String[] COLUMNNAME_NOT_EDIT = new String[] { "id", "create_by", "create_time", "del_flag" };
/* */
/* */
/* 51 */ public static final String[] COLUMNNAME_NOT_LIST = new String[] { "id", "create_by", "create_time", "del_flag", "update_by", "update_time" };
/* */
/* */
/* */
/* 55 */ public static final String[] COLUMNNAME_NOT_QUERY = new String[] { "id", "create_by", "create_time", "del_flag", "update_by", "update_time", "remark" };
/* */
/* */
/* */
/* 59 */ public static final String[] BASE_ENTITY = new String[] { "createBy", "createTime", "updateBy", "updateTime", "remark" };
/* */
/* */
/* 62 */ public static final String[] TREE_ENTITY = new String[] { "parentName", "parentId", "orderNum", "ancestors" };
/* */ public static final String HTML_INPUT = "input";
/* */ public static final String HTML_TEXTAREA = "textarea";
/* */ public static final String HTML_SELECT = "select";
/* */ public static final String HTML_RADIO = "radio";
/* */ public static final String HTML_CHECKBOX = "checkbox";
/* */ public static final String HTML_DATETIME = "datetime";
/* */ public static final String HTML_UPLOAD = "upload";
/* */ public static final String HTML_SUMMERNOTE = "summernote";
/* */ public static final String TYPE_STRING = "String";
/* */ public static final String TYPE_INTEGER = "Integer";
/* */ public static final String TYPE_LONG = "Long";
/* */ public static final String TYPE_DOUBLE = "Double";
/* */ public static final String TYPE_BIGDECIMAL = "BigDecimal";
/* */ public static final String TYPE_DATE = "Date";
/* */ public static final String QUERY_LIKE = "LIKE";
/* */ public static final String REQUIRE = "1";
/* */ }
package com.archive.common.constant;
public class GenConstants
{
public static final String TPL_CRUD = "crud";
public static final String TPL_TREE = "tree";
public static final String TPL_SUB = "sub";
public static final String TREE_CODE = "treeCode";
public static final String TREE_PARENT_CODE = "treeParentCode";
public static final String TREE_NAME = "treeName";
public static final String PARENT_MENU_ID = "parentMenuId";
public static final String PARENT_MENU_NAME = "parentMenuName";
public static final String[] COLUMNTYPE_STR = new String[] { "char", "varchar", "nvarchar", "varchar2" };
public static final String[] COLUMNTYPE_TEXT = new String[] { "tinytext", "text", "mediumtext", "longtext" };
public static final String[] COLUMNTYPE_TIME = new String[] { "datetime", "time", "date", "timestamp" };
public static final String[] COLUMNTYPE_NUMBER = new String[] { "tinyint", "smallint", "mediumint", "int", "number", "integer", "bit", "bigint", "float", "double", "decimal" };
public static final String[] COLUMNNAME_NOT_EDIT = new String[] { "id", "create_by", "create_time", "del_flag" };
public static final String[] COLUMNNAME_NOT_LIST = new String[] { "id", "create_by", "create_time", "del_flag", "update_by", "update_time" };
public static final String[] COLUMNNAME_NOT_QUERY = new String[] { "id", "create_by", "create_time", "del_flag", "update_by", "update_time", "remark" };
public static final String[] BASE_ENTITY = new String[] { "createBy", "createTime", "updateBy", "updateTime", "remark" };
public static final String[] TREE_ENTITY = new String[] { "parentName", "parentId", "orderNum", "ancestors" };
public static final String HTML_INPUT = "input";
public static final String HTML_TEXTAREA = "textarea";
public static final String HTML_SELECT = "select";
public static final String HTML_RADIO = "radio";
public static final String HTML_CHECKBOX = "checkbox";
public static final String HTML_DATETIME = "datetime";
public static final String HTML_UPLOAD = "upload";
public static final String HTML_SUMMERNOTE = "summernote";
public static final String TYPE_STRING = "String";
public static final String TYPE_INTEGER = "Integer";
public static final String TYPE_LONG = "Long";
public static final String TYPE_DOUBLE = "Double";
public static final String TYPE_BIGDECIMAL = "BigDecimal";
public static final String TYPE_DATE = "Date";
public static final String QUERY_LIKE = "LIKE";
public static final String REQUIRE = "1";
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\constant\GenConstants.class

@ -1,53 +1,53 @@
/* */ package com.archive.common.convert;
/* */
/* */ import java.io.File;
/* */ import java.io.FileOutputStream;
/* */ import java.io.OutputStream;
/* */ import org.xhtmlrenderer.pdf.ITextFontResolver;
/* */ import org.xhtmlrenderer.pdf.ITextRenderer;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class HtmlToPdf
/* */ {
/* */ public static void html2pdf(String htmlFile, String pdfFile) throws Exception {
/* 21 */ String url = (new File(htmlFile)).toURI().toURL().toString();
/* 22 */ System.out.println(url);
/* */
/* 24 */ OutputStream os = new FileOutputStream(pdfFile);
/* 25 */ ITextRenderer renderer = new ITextRenderer();
/* 26 */ renderer.setDocument(url);
/* */
/* */
/* 29 */ ITextFontResolver fontResolver = renderer.getFontResolver();
/* 30 */ if ("linux".equals(getCurrentOperatingSystem())) {
/* 31 */ fontResolver.addFont("/usr/share/fonts/chiness/simsun.ttc", "Identity-H", true);
/* */ } else {
/* 33 */ fontResolver.addFont("c:/Windows/Fonts/simsun.ttc", "Identity-H", false);
/* */ }
/* */
/* 36 */ renderer.layout();
/* 37 */ renderer.createPDF(os);
/* 38 */ os.close();
/* */
/* 40 */ System.out.println("create pdf done!!");
/* */ }
/* */
/* */
/* */ public static String getCurrentOperatingSystem() {
/* 45 */ String os = System.getProperty("os.name").toLowerCase();
/* 46 */ System.out.println("---------当前操作系统是-----------" + os);
/* 47 */ return os;
/* */ }
/* */ }
package com.archive.common.convert;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import org.xhtmlrenderer.pdf.ITextFontResolver;
import org.xhtmlrenderer.pdf.ITextRenderer;
public class HtmlToPdf
{
public static void html2pdf(String htmlFile, String pdfFile) throws Exception {
String url = (new File(htmlFile)).toURI().toURL().toString();
System.out.println(url);
OutputStream os = new FileOutputStream(pdfFile);
ITextRenderer renderer = new ITextRenderer();
renderer.setDocument(url);
ITextFontResolver fontResolver = renderer.getFontResolver();
if ("linux".equals(getCurrentOperatingSystem())) {
fontResolver.addFont("/usr/share/fonts/chiness/simsun.ttc", "Identity-H", true);
} else {
fontResolver.addFont("c:/Windows/Fonts/simsun.ttc", "Identity-H", false);
}
renderer.layout();
renderer.createPDF(os);
os.close();
System.out.println("create pdf done!!");
}
public static String getCurrentOperatingSystem() {
String os = System.getProperty("os.name").toLowerCase();
System.out.println("---------当前操作系统是-----------" + os);
return os;
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\convert\HtmlToPdf.class

@ -1,393 +1,393 @@
/* */ package com.archive.common.convert;
/* */
/* */ import com.lowagie.text.Document;
/* */ import com.lowagie.text.Element;
/* */ import com.lowagie.text.Image;
/* */ import com.lowagie.text.Rectangle;
/* */ import com.lowagie.text.pdf.PdfWriter;
/* */ import java.awt.AlphaComposite;
/* */ import java.awt.Color;
/* */ import java.awt.Font;
/* */ import java.awt.Graphics;
/* */ import java.awt.Graphics2D;
/* */
/* */ import java.awt.RenderingHints;
/* */ import java.awt.image.BufferedImage;
/* */ import java.io.File;
/* */ import java.io.FileOutputStream;
/* */ import java.io.IOException;
/* */ import java.text.DecimalFormat;
/* */ import java.util.ArrayList;
/* */ import java.util.Arrays;
/* */ import javax.imageio.ImageIO;
/* */ import javax.swing.ImageIcon;
/* */
/* */ public class ImgConvert
/* */ {
/* */ public static void ImagesToPdf(String imageFolderPath, String pdfPath) {
/* */ try {
/* 29 */ long start = System.currentTimeMillis();
/* 30 */ ArrayList<String> list = new ArrayList<>();
/* */
/* 32 */ String imagePath = null;
/* 33 */ FileOutputStream fos = new FileOutputStream(pdfPath);
/* */
/* 35 */ Document doc = new Document(null, 20.0F, 20.0F, 20.0F, 20.0F);
/* */
/* 37 */ PdfWriter.getInstance(doc, fos);
/* */
/* */
/* */
/* */
/* */
/* 43 */ File file = new File(imageFolderPath);
/* 44 */ File[] files = file.listFiles();
/* */
/* 46 */ for (File file1 : files) {
/* 47 */ if (file1.getName().endsWith(".png") || file1.getName().endsWith(".jpg") || file1.getName().endsWith(".gif") || file1
/* 48 */ .getName().endsWith(".jpeg") || file1.getName().endsWith(".tif")) {
/* 49 */ imagePath = imageFolderPath + File.separator + file1.getName();
/* 50 */ list.add(file1.getName());
/* */
/* 52 */ BufferedImage img = ImageIO.read(new File(imagePath));
/* */
/* 54 */ doc.setPageSize(new Rectangle(img.getWidth(), img.getHeight()));
/* */
/* 56 */ Image image = Image.getInstance(imagePath);
/* */
/* 58 */ doc.open();
/* 59 */ doc.add((Element)image);
/* */ }
/* */ }
/* */
/* */
/* 64 */ doc.close();
/* 65 */ long endTime = System.currentTimeMillis();
/* 66 */ int time = (int)((endTime - start) / 1000L);
/* 67 */ System.out.println("用时:{" + time + "}:秒!");
/* 68 */ } catch (Exception e) {
/* 69 */ e.printStackTrace();
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static void ImgToPdf(String imagePath, String pdfPath) {
/* */ try {
/* 81 */ long start = System.currentTimeMillis();
/* 82 */ ArrayList<String> list = new ArrayList<>();
/* */
/* */
/* 85 */ FileOutputStream fos = new FileOutputStream(pdfPath);
/* */
/* 87 */ Document doc = new Document(null, 20.0F, 20.0F, 20.0F, 20.0F);
/* */
/* 89 */ PdfWriter.getInstance(doc, fos);
/* */
/* */
/* */
/* */
/* */
/* 95 */ BufferedImage img = ImageIO.read(new File(imagePath));
/* */
/* 97 */ doc.setPageSize(new Rectangle(img.getWidth(), img.getHeight()));
/* */
/* 99 */ Image image = Image.getInstance(imagePath);
/* */
/* 101 */ doc.open();
/* 102 */ doc.add((Element)image);
/* */
/* */
/* */
/* 106 */ doc.close();
/* 107 */ long endTime = System.currentTimeMillis();
/* 108 */ int time = (int)((endTime - start) / 1000L);
/* 109 */ System.out.println("用时:{" + time + "}:秒!");
/* 110 */ } catch (Exception e) {
/* 111 */ e.printStackTrace();
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static void PngToJpg(String pngPath, String jpgPath) {
/* */ try {
/* 125 */ BufferedImage bufferedImage = ImageIO.read(new File(pngPath));
/* 126 */ BufferedImage newBufferedImage = new BufferedImage(bufferedImage.getWidth(), bufferedImage.getHeight(), 1);
/* 127 */ newBufferedImage.createGraphics().drawImage(bufferedImage, 0, 0, Color.white, null);
/* 128 */ ImageIO.write(newBufferedImage, "jpg", new File(jpgPath));
/* 129 */ } catch (Exception e) {
/* 130 */ System.out.println("ERROR:png转jpg出现异常:" + e.getMessage());
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static void JpgToPng(String jpgPath, String pngPath) {
/* */ try {
/* 144 */ BufferedImage bufferedImage = ImageIO.read(new File(jpgPath));
/* 145 */ BufferedImage newBufferedImage = new BufferedImage(bufferedImage.getWidth(), bufferedImage.getHeight(), 1);
/* 146 */ newBufferedImage.createGraphics().drawImage(bufferedImage, 0, 0, Color.white, null);
/* 147 */ ImageIO.write(newBufferedImage, "png", new File(pngPath));
/* 148 */ } catch (Exception e) {
/* 149 */ System.out.println("ERROR:jpg转png出现异常:" + e.getMessage());
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static BufferedImage waterMarkByText(int width, int heigth, String text, Color color, Font font, Double degree, float alpha) {
/* 167 */ BufferedImage buffImg = new BufferedImage(width, heigth, 1);
/* */
/* 169 */ Graphics2D g2d = buffImg.createGraphics();
/* */
/* */
/* 172 */ buffImg = g2d.getDeviceConfiguration().createCompatibleImage(width, heigth, 3);
/* 173 */ g2d.dispose();
/* 174 */ g2d = buffImg.createGraphics();
/* */
/* */
/* */
/* 178 */ g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* 186 */ if (null != degree)
/* */ {
/* */
/* 189 */ g2d.rotate(Math.toRadians(degree.doubleValue()), buffImg.getWidth() / 2.0D, buffImg
/* 190 */ .getHeight() / 2.0D);
/* */ }
/* */
/* */
/* 194 */ g2d.setColor(color);
/* */
/* */
/* 197 */ g2d.setFont(font);
/* */
/* */
/* 200 */ g2d.setComposite(AlphaComposite.getInstance(3, alpha));
/* */
/* 202 */ float realWidth = getRealFontWidth(text);
/* 203 */ float fontSize = font.getSize();
/* */
/* */
/* 206 */ float x = 0.5F * width - 0.5F * fontSize * realWidth;
/* 207 */ float y = 0.5F * heigth + 0.5F * fontSize;
/* */
/* 209 */ g2d.drawString(text, x, y);
/* */
/* 211 */ g2d.dispose();
/* */
/* 213 */ return buffImg;
/* */ }
/* */
/* */
/* */
/* */ public static BufferedImage waterMarkByText(int width, int heigth, String text, Color color, float alpha) {
/* 219 */ Font font = new Font("Dialog", 0, 33);
/* 220 */ return waterMarkByText(width, heigth, text, color, font, Double.valueOf(-30.0D), alpha);
/* */ }
/* */
/* */ public static BufferedImage waterMarkByText(int width, int heigth, String text, float alpha) {
/* 224 */ return waterMarkByText(width, heigth, text, Color.GRAY, alpha);
/* */ }
/* */
/* */
/* */ public static BufferedImage waterMarkByText(int width, int heigth, String text) {
/* 229 */ return waterMarkByText(width, heigth, text, 0.2F);
/* */ }
/* */
/* */ public static BufferedImage waterMarkByText(String text) {
/* 233 */ return waterMarkByText(200, 150, text);
/* */ }
/* */
/* */
/* */
/* */
/* */ private static float getRealFontWidth(String text) {
/* 240 */ int len = text.length();
/* 241 */ float width = 0.0F;
/* 242 */ for (int i = 0; i < len; i++) {
/* 243 */ if (text.charAt(i) < 'Ā') {
/* 244 */ width += 0.5F;
/* */ } else {
/* 246 */ width++;
/* */ }
/* */ }
/* 249 */ return width;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static void changeImgColor(String path, String newPath) throws IOException {
/* 263 */ File file = new File(path);
/* 264 */ BufferedImage bi = ImageIO.read(file);
/* 265 */ java.awt.Image image = bi;
/* */
/* 267 */ ImageIcon imageIcon = new ImageIcon(image);
/* 268 */ int width = imageIcon.getIconWidth();
/* 269 */ int height = imageIcon.getIconHeight();
/* */
/* 271 */ BufferedImage bufferedImage = new BufferedImage(width, height, 6);
/* 272 */ Graphics2D graphics2D = (Graphics2D)bufferedImage.getGraphics();
/* 273 */ graphics2D.drawImage(imageIcon.getImage(), 0, 0, imageIcon.getImageObserver());
/* 274 */ int alpha = 255;
/* */
/* 276 */ int RGB = bufferedImage.getRGB(width - 1, height - 1);
/* 277 */ for (int i = bufferedImage.getMinX(); i < width; i++) {
/* 278 */ for (int j = bufferedImage.getMinY(); j < height; j++) {
/* 279 */ int rgb = bufferedImage.getRGB(i, j);
/* 280 */ int r = (rgb & 0xFF0000) >> 16;
/* 281 */ int g = (rgb & 0xFF00) >> 8;
/* 282 */ int b = rgb & 0xFF;
/* 283 */ int R = (RGB & 0xFF0000) >> 16;
/* 284 */ int G = (RGB & 0xFF00) >> 8;
/* 285 */ int B = RGB & 0xFF;
/* */
/* 287 */ int a = 45;
/* 288 */ if (Math.abs(R - r) < a && Math.abs(G - g) < a && Math.abs(B - b) < a) {
/* 289 */ alpha = 0;
/* */ } else {
/* 291 */ alpha = 255;
/* */ }
/* 293 */ rgb = alpha << 24 | rgb & 0xFFFFFF;
/* 294 */ bufferedImage.setRGB(i, j, rgb);
/* */ }
/* */ }
/* 297 */ ImageIO.write(bufferedImage, "png", new File(newPath));
/* */ }
/* */
/* */ public static String convertRgbStr(int color) {
/* 301 */ int red = (color & 0xFF0000) >> 16;
/* 302 */ int green = (color & 0xFF00) >> 8;
/* 303 */ int blue = color & 0xFF;
/* 304 */ return red + "," + green + "," + blue;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static String thumbnailImage(String imagePath, int w, int h, String prevfix, boolean force) {
/* 317 */ File imgFile = new File(imagePath);
/* 318 */ String newPath = "";
/* 319 */ if (imgFile.exists()) {
/* */
/* */ try {
/* 322 */ String types = Arrays.toString((Object[])ImageIO.getReaderFormatNames());
/* 323 */ String suffix = null;
/* */
/* 325 */ if (imgFile.getName().indexOf(".") > -1) {
/* 326 */ suffix = imgFile.getName().substring(imgFile.getName().lastIndexOf(".") + 1);
/* */ }
/* */
/* 329 */ if (suffix == null || types.toLowerCase().indexOf(suffix.toLowerCase()) < 0) {
/* 330 */ System.out.println("Sorry, the image suffix is illegal. the standard image suffix is {}." + types);
/* 331 */ return newPath;
/* */ }
/* 333 */ System.out.println("target image's size, width:{" + w + "}, height:{" + h + "}.");
/* 334 */ java.awt.Image img = ImageIO.read(imgFile);
/* 335 */ if (!force) {
/* */
/* 337 */ int width = img.getWidth(null);
/* 338 */ int height = img.getHeight(null);
/* 339 */ if (width * 1.0D / w < height * 1.0D / h) {
/* 340 */ if (width > w) {
/* 341 */ h = Integer.parseInt((new DecimalFormat("0")).format((height * w) / width * 1.0D));
/* 342 */ System.out.println("change image's height, width:{" + w + "}, height:{" + h + "}.");
/* */ }
/* */
/* 345 */ } else if (height > h) {
/* 346 */ w = Integer.parseInt((new DecimalFormat("0")).format((width * h) / height * 1.0D));
/* 347 */ System.out.println("change image's width, width:{" + w + "}, height:{" + h + "}.");
/* */ }
/* */ }
/* */
/* 351 */ BufferedImage bi = new BufferedImage(w, h, 1);
/* 352 */ Graphics g = bi.getGraphics();
/* 353 */ g.drawImage(img, 0, 0, w, h, Color.LIGHT_GRAY, null);
/* 354 */ g.dispose();
/* 355 */ String p = imgFile.getPath();
/* */
/* 357 */ newPath = p.substring(0, p.lastIndexOf(File.separator)) + File.separator + prevfix + imgFile.getName();
/* 358 */ ImageIO.write(bi, suffix, new File(newPath));
/* 359 */ System.out.println("缩略图在原路径下生成成功");
/* 360 */ } catch (IOException e) {
/* 361 */ System.out.println("generate thumbnail image failed." + e);
/* */ }
/* */ } else {
/* 364 */ System.out.println("the image is not exist.");
/* */ }
/* 366 */ return newPath;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static void main(String[] args) {
/* */ try {
/* 383 */ changeImgColor("F:\\FFOutput\\profile.png", "F:\\FFOutput\\profile1.png");
/* 384 */ } catch (IOException e) {
/* 385 */ e.printStackTrace();
/* */ }
/* */ }
/* */ }
package com.archive.common.convert;
import com.lowagie.text.Document;
import com.lowagie.text.Element;
import com.lowagie.text.Image;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.PdfWriter;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
public class ImgConvert
{
public static void ImagesToPdf(String imageFolderPath, String pdfPath) {
try {
long start = System.currentTimeMillis();
ArrayList<String> list = new ArrayList<>();
String imagePath = null;
FileOutputStream fos = new FileOutputStream(pdfPath);
Document doc = new Document(null, 20.0F, 20.0F, 20.0F, 20.0F);
PdfWriter.getInstance(doc, fos);
File file = new File(imageFolderPath);
File[] files = file.listFiles();
for (File file1 : files) {
if (file1.getName().endsWith(".png") || file1.getName().endsWith(".jpg") || file1.getName().endsWith(".gif") || file1
.getName().endsWith(".jpeg") || file1.getName().endsWith(".tif")) {
imagePath = imageFolderPath + File.separator + file1.getName();
list.add(file1.getName());
BufferedImage img = ImageIO.read(new File(imagePath));
doc.setPageSize(new Rectangle(img.getWidth(), img.getHeight()));
Image image = Image.getInstance(imagePath);
doc.open();
doc.add((Element)image);
}
}
doc.close();
long endTime = System.currentTimeMillis();
int time = (int)((endTime - start) / 1000L);
System.out.println("用时:{" + time + "}:秒!");
} catch (Exception e) {
e.printStackTrace();
}
}
public static void ImgToPdf(String imagePath, String pdfPath) {
try {
long start = System.currentTimeMillis();
ArrayList<String> list = new ArrayList<>();
FileOutputStream fos = new FileOutputStream(pdfPath);
Document doc = new Document(null, 20.0F, 20.0F, 20.0F, 20.0F);
PdfWriter.getInstance(doc, fos);
BufferedImage img = ImageIO.read(new File(imagePath));
doc.setPageSize(new Rectangle(img.getWidth(), img.getHeight()));
Image image = Image.getInstance(imagePath);
doc.open();
doc.add((Element)image);
doc.close();
long endTime = System.currentTimeMillis();
int time = (int)((endTime - start) / 1000L);
System.out.println("用时:{" + time + "}:秒!");
} catch (Exception e) {
e.printStackTrace();
}
}
public static void PngToJpg(String pngPath, String jpgPath) {
try {
BufferedImage bufferedImage = ImageIO.read(new File(pngPath));
BufferedImage newBufferedImage = new BufferedImage(bufferedImage.getWidth(), bufferedImage.getHeight(), 1);
newBufferedImage.createGraphics().drawImage(bufferedImage, 0, 0, Color.white, null);
ImageIO.write(newBufferedImage, "jpg", new File(jpgPath));
} catch (Exception e) {
System.out.println("ERROR:png转jpg出现异常:" + e.getMessage());
}
}
public static void JpgToPng(String jpgPath, String pngPath) {
try {
BufferedImage bufferedImage = ImageIO.read(new File(jpgPath));
BufferedImage newBufferedImage = new BufferedImage(bufferedImage.getWidth(), bufferedImage.getHeight(), 1);
newBufferedImage.createGraphics().drawImage(bufferedImage, 0, 0, Color.white, null);
ImageIO.write(newBufferedImage, "png", new File(pngPath));
} catch (Exception e) {
System.out.println("ERROR:jpg转png出现异常:" + e.getMessage());
}
}
public static BufferedImage waterMarkByText(int width, int heigth, String text, Color color, Font font, Double degree, float alpha) {
BufferedImage buffImg = new BufferedImage(width, heigth, 1);
Graphics2D g2d = buffImg.createGraphics();
buffImg = g2d.getDeviceConfiguration().createCompatibleImage(width, heigth, 3);
g2d.dispose();
g2d = buffImg.createGraphics();
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
if (null != degree)
{
g2d.rotate(Math.toRadians(degree.doubleValue()), buffImg.getWidth() / 2.0D, buffImg
.getHeight() / 2.0D);
}
g2d.setColor(color);
g2d.setFont(font);
g2d.setComposite(AlphaComposite.getInstance(3, alpha));
float realWidth = getRealFontWidth(text);
float fontSize = font.getSize();
float x = 0.5F * width - 0.5F * fontSize * realWidth;
float y = 0.5F * heigth + 0.5F * fontSize;
g2d.drawString(text, x, y);
g2d.dispose();
return buffImg;
}
public static BufferedImage waterMarkByText(int width, int heigth, String text, Color color, float alpha) {
Font font = new Font("Dialog", 0, 33);
return waterMarkByText(width, heigth, text, color, font, Double.valueOf(-30.0D), alpha);
}
public static BufferedImage waterMarkByText(int width, int heigth, String text, float alpha) {
return waterMarkByText(width, heigth, text, Color.GRAY, alpha);
}
public static BufferedImage waterMarkByText(int width, int heigth, String text) {
return waterMarkByText(width, heigth, text, 0.2F);
}
public static BufferedImage waterMarkByText(String text) {
return waterMarkByText(200, 150, text);
}
private static float getRealFontWidth(String text) {
int len = text.length();
float width = 0.0F;
for (int i = 0; i < len; i++) {
if (text.charAt(i) < 'Ā') {
width += 0.5F;
} else {
width++;
}
}
return width;
}
public static void changeImgColor(String path, String newPath) throws IOException {
File file = new File(path);
BufferedImage bi = ImageIO.read(file);
java.awt.Image image = bi;
ImageIcon imageIcon = new ImageIcon(image);
int width = imageIcon.getIconWidth();
int height = imageIcon.getIconHeight();
BufferedImage bufferedImage = new BufferedImage(width, height, 6);
Graphics2D graphics2D = (Graphics2D)bufferedImage.getGraphics();
graphics2D.drawImage(imageIcon.getImage(), 0, 0, imageIcon.getImageObserver());
int alpha = 255;
int RGB = bufferedImage.getRGB(width - 1, height - 1);
for (int i = bufferedImage.getMinX(); i < width; i++) {
for (int j = bufferedImage.getMinY(); j < height; j++) {
int rgb = bufferedImage.getRGB(i, j);
int r = (rgb & 0xFF0000) >> 16;
int g = (rgb & 0xFF00) >> 8;
int b = rgb & 0xFF;
int R = (RGB & 0xFF0000) >> 16;
int G = (RGB & 0xFF00) >> 8;
int B = RGB & 0xFF;
int a = 45;
if (Math.abs(R - r) < a && Math.abs(G - g) < a && Math.abs(B - b) < a) {
alpha = 0;
} else {
alpha = 255;
}
rgb = alpha << 24 | rgb & 0xFFFFFF;
bufferedImage.setRGB(i, j, rgb);
}
}
ImageIO.write(bufferedImage, "png", new File(newPath));
}
public static String convertRgbStr(int color) {
int red = (color & 0xFF0000) >> 16;
int green = (color & 0xFF00) >> 8;
int blue = color & 0xFF;
return red + "," + green + "," + blue;
}
public static String thumbnailImage(String imagePath, int w, int h, String prevfix, boolean force) {
File imgFile = new File(imagePath);
String newPath = "";
if (imgFile.exists()) {
try {
String types = Arrays.toString((Object[])ImageIO.getReaderFormatNames());
String suffix = null;
if (imgFile.getName().indexOf(".") > -1) {
suffix = imgFile.getName().substring(imgFile.getName().lastIndexOf(".") + 1);
}
if (suffix == null || types.toLowerCase().indexOf(suffix.toLowerCase()) < 0) {
System.out.println("Sorry, the image suffix is illegal. the standard image suffix is {}." + types);
return newPath;
}
System.out.println("target image's size, width:{" + w + "}, height:{" + h + "}.");
java.awt.Image img = ImageIO.read(imgFile);
if (!force) {
int width = img.getWidth(null);
int height = img.getHeight(null);
if (width * 1.0D / w < height * 1.0D / h) {
if (width > w) {
h = Integer.parseInt((new DecimalFormat("0")).format((height * w) / width * 1.0D));
System.out.println("change image's height, width:{" + w + "}, height:{" + h + "}.");
}
} else if (height > h) {
w = Integer.parseInt((new DecimalFormat("0")).format((width * h) / height * 1.0D));
System.out.println("change image's width, width:{" + w + "}, height:{" + h + "}.");
}
}
BufferedImage bi = new BufferedImage(w, h, 1);
Graphics g = bi.getGraphics();
g.drawImage(img, 0, 0, w, h, Color.LIGHT_GRAY, null);
g.dispose();
String p = imgFile.getPath();
newPath = p.substring(0, p.lastIndexOf(File.separator)) + File.separator + prevfix + imgFile.getName();
ImageIO.write(bi, suffix, new File(newPath));
System.out.println("缩略图在原路径下生成成功");
} catch (IOException e) {
System.out.println("generate thumbnail image failed." + e);
}
} else {
System.out.println("the image is not exist.");
}
return newPath;
}
public static void main(String[] args) {
try {
changeImgColor("F:\\FFOutput\\profile.png", "F:\\FFOutput\\profile1.png");
} catch (IOException e) {
e.printStackTrace();
}
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\convert\ImgConvert.class

@ -1,21 +1,21 @@
/* */ package com.archive.common.exception.file;
/* */
/* */ import com.archive.common.exception.base.BaseException;
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class FileException
/* */ extends BaseException
/* */ {
/* */ private static final long serialVersionUID = 1L;
/* */
/* */ public FileException(String code, Object[] args) {
/* 16 */ super("file", code, args, null);
/* */ }
/* */ }
package com.archive.common.exception.file;
import com.archive.common.exception.base.BaseException;
public class FileException
extends BaseException
{
private static final long serialVersionUID = 1L;
public FileException(String code, Object[] args) {
super("file", code, args, null);
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exception\file\FileException.class

@ -1,19 +1,19 @@
/* */ package com.archive.common.exception.file;
/* */
/* */ import com.archive.common.exception.file.FileException;
/* */
/* */
/* */
/* */
/* */ public class FileNameLengthLimitExceededException
/* */ extends FileException
/* */ {
/* */ private static final long serialVersionUID = 1L;
/* */
/* */ public FileNameLengthLimitExceededException(int defaultFileNameLength) {
/* 14 */ super("upload.filename.exceed.length", new Object[] { Integer.valueOf(defaultFileNameLength) });
/* */ }
/* */ }
package com.archive.common.exception.file;
import com.archive.common.exception.file.FileException;
public class FileNameLengthLimitExceededException
extends FileException
{
private static final long serialVersionUID = 1L;
public FileNameLengthLimitExceededException(int defaultFileNameLength) {
super("upload.filename.exceed.length", new Object[] { Integer.valueOf(defaultFileNameLength) });
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exception\file\FileNameLengthLimitExceededException.class

@ -1,19 +1,19 @@
/* */ package com.archive.common.exception.file;
/* */
/* */ import com.archive.common.exception.file.FileException;
/* */
/* */
/* */
/* */
/* */ public class FileSizeLimitExceededException
/* */ extends FileException
/* */ {
/* */ private static final long serialVersionUID = 1L;
/* */
/* */ public FileSizeLimitExceededException(long defaultMaxSize) {
/* 14 */ super("upload.exceed.maxSize", new Object[] { Long.valueOf(defaultMaxSize) });
/* */ }
/* */ }
package com.archive.common.exception.file;
import com.archive.common.exception.file.FileException;
public class FileSizeLimitExceededException
extends FileException
{
private static final long serialVersionUID = 1L;
public FileSizeLimitExceededException(long defaultMaxSize) {
super("upload.exceed.maxSize", new Object[] { Long.valueOf(defaultMaxSize) });
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exception\file\FileSizeLimitExceededException.class

@ -1,44 +1,44 @@
/* */ package com.archive.common.exception.file;
/* */
/* */ import java.util.Arrays;
/* */ import org.apache.commons.fileupload.FileUploadException;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class InvalidExtensionException
/* */ extends FileUploadException
/* */ {
/* */ private static final long serialVersionUID = 1L;
/* */ private String[] allowedExtension;
/* */ private String extension;
/* */ private String filename;
/* */
/* */ public InvalidExtensionException(String[] allowedExtension, String extension, String filename) {
/* 21 */ super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : [" + Arrays.toString((Object[])allowedExtension) + "]");
/* 22 */ this.allowedExtension = allowedExtension;
/* 23 */ this.extension = extension;
/* 24 */ this.filename = filename;
/* */ }
/* */
/* */
/* */ public String[] getAllowedExtension() {
/* 29 */ return this.allowedExtension;
/* */ }
/* */
/* */
/* */ public String getExtension() {
/* 34 */ return this.extension;
/* */ }
/* */
/* */
/* */ public String getFilename() {
/* 39 */ return this.filename;
/* */ }
/* */ }
package com.archive.common.exception.file;
import java.util.Arrays;
import org.apache.commons.fileupload.FileUploadException;
public class InvalidExtensionException
extends FileUploadException
{
private static final long serialVersionUID = 1L;
private String[] allowedExtension;
private String extension;
private String filename;
public InvalidExtensionException(String[] allowedExtension, String extension, String filename) {
super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : [" + Arrays.toString((Object[])allowedExtension) + "]");
this.allowedExtension = allowedExtension;
this.extension = extension;
this.filename = filename;
}
public String[] getAllowedExtension() {
return this.allowedExtension;
}
public String getExtension() {
return this.extension;
}
public String getFilename() {
return this.filename;
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exception\file\InvalidExtensionException.class

@ -1,53 +1,53 @@
/* */ package com.archive.common.exception.file;
/* */
/* */ import com.archive.common.exception.file.InvalidExtensionException;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class InvalidImageExtensionException
/* */ extends InvalidExtensionException
/* */ {
/* */ private static final long serialVersionUID = 1L;
/* */
/* */ public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename) {
/* 48 */ super(allowedExtension, extension, filename);
/* */ }
/* */ }
package com.archive.common.exception.file;
import com.archive.common.exception.file.InvalidExtensionException;
public class InvalidImageExtensionException
extends InvalidExtensionException
{
private static final long serialVersionUID = 1L;
public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename) {
super(allowedExtension, extension, filename);
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exception\file\InvalidExtensionException$InvalidImageExtensionException.class

@ -1,73 +1,73 @@
/* */ package com.archive.common.exception.file;
/* */
/* */ import com.archive.common.exception.file.InvalidExtensionException;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class InvalidMediaExtensionException
/* */ extends InvalidExtensionException
/* */ {
/* */ private static final long serialVersionUID = 1L;
/* */
/* */ public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename) {
/* 68 */ super(allowedExtension, extension, filename);
/* */ }
/* */ }
package com.archive.common.exception.file;
import com.archive.common.exception.file.InvalidExtensionException;
public class InvalidMediaExtensionException
extends InvalidExtensionException
{
private static final long serialVersionUID = 1L;
public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename) {
super(allowedExtension, extension, filename);
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exception\file\InvalidExtensionException$InvalidMediaExtensionException.class

@ -1,83 +1,83 @@
/* */ package com.archive.common.exception.file;
/* */
/* */ import com.archive.common.exception.file.InvalidExtensionException;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class InvalidVideoExtensionException
/* */ extends InvalidExtensionException
/* */ {
/* */ private static final long serialVersionUID = 1L;
/* */
/* */ public InvalidVideoExtensionException(String[] allowedExtension, String extension, String filename) {
/* 78 */ super(allowedExtension, extension, filename);
/* */ }
/* */ }
package com.archive.common.exception.file;
import com.archive.common.exception.file.InvalidExtensionException;
public class InvalidVideoExtensionException
extends InvalidExtensionException
{
private static final long serialVersionUID = 1L;
public InvalidVideoExtensionException(String[] allowedExtension, String extension, String filename) {
super(allowedExtension, extension, filename);
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\exception\file\InvalidExtensionException$InvalidVideoExtensionException.class

@ -1,58 +1,58 @@
/* */ package com.archive.common.ocr;
/* */
/* */ import com.archive.common.convert.ImgConvert;
/* */ import java.io.File;
/* */ import net.sourceforge.tess4j.Tesseract;
/* */ import net.sourceforge.tess4j.util.LoadLibs;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class ImageOcr
/* */ {
/* */ public static String ImageOcr(String imagPath) {
/* 18 */ String res = "";
/* */ try {
/* 20 */ String pngPath = "";
/* */
/* 22 */ if (imagPath.contains(".jpg") || imagPath.contains(".jpeg")) {
/* 23 */ File fil = new File(imagPath);
/* */
/* 25 */ pngPath = fil.getParentFile().getPath() + File.separator + fil.getName().replace(".jpg", ".png").replace(".jpeg", ".png");
/* 26 */ ImgConvert.JpgToPng(imagPath, pngPath);
/* */ }
/* */
/* */
/* 30 */ Tesseract tesseract = new Tesseract();
/* */
/* 32 */ File tessDataFolder = LoadLibs.extractTessResources("tessdata");
/* 33 */ tesseract.setDatapath(tessDataFolder.getAbsolutePath());
/* */
/* 35 */ tesseract.setLanguage("chi_sim");
/* */
/* 37 */ String result = "";
/* 38 */ if (pngPath.equals("")) {
/* 39 */ result = tesseract.doOCR(new File(imagPath));
/* */ } else {
/* 41 */ result = tesseract.doOCR(new File(pngPath));
/* */ }
/* */
/* 44 */ res = result.replaceAll("\\r|\\n", "-").replaceAll(" ", "");
/* 45 */ } catch (Exception ex) {
/* 46 */ System.out.println("图片OCR出现异常:" + ex.getMessage());
/* */
/* */
/* 49 */ if (ex.getMessage().equals("javax.imageio.IIOException: JFIF APP0 must be first marker after SOI"));
/* */ }
/* */
/* */
/* 53 */ return res;
/* */ }
/* */ }
package com.archive.common.ocr;
import com.archive.common.convert.ImgConvert;
import java.io.File;
import net.sourceforge.tess4j.Tesseract;
import net.sourceforge.tess4j.util.LoadLibs;
public class ImageOcr
{
public static String ImageOcr(String imagPath) {
String res = "";
try {
String pngPath = "";
if (imagPath.contains(".jpg") || imagPath.contains(".jpeg")) {
File fil = new File(imagPath);
pngPath = fil.getParentFile().getPath() + File.separator + fil.getName().replace(".jpg", ".png").replace(".jpeg", ".png");
ImgConvert.JpgToPng(imagPath, pngPath);
}
Tesseract tesseract = new Tesseract();
File tessDataFolder = LoadLibs.extractTessResources("tessdata");
tesseract.setDatapath(tessDataFolder.getAbsolutePath());
tesseract.setLanguage("chi_sim");
String result = "";
if (pngPath.equals("")) {
result = tesseract.doOCR(new File(imagPath));
} else {
result = tesseract.doOCR(new File(pngPath));
}
res = result.replaceAll("\\r|\\n", "-").replaceAll(" ", "");
} catch (Exception ex) {
System.out.println("图片OCR出现异常:" + ex.getMessage());
if (ex.getMessage().equals("javax.imageio.IIOException: JFIF APP0 must be first marker after SOI"));
}
return res;
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\common\ocr\ImageOcr.class

@ -1,79 +1,79 @@
/* */ package com.archive.common.utils.file;
/* */
/* */ import java.io.File;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class FileTypeUtils
/* */ {
/* */ public static String getFileType(File file) {
/* 23 */ if (null == file)
/* */ {
/* 25 */ return "";
/* */ }
/* 27 */ return getFileType(file.getName());
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static String getFileType(String fileName) {
/* 40 */ int separatorIndex = fileName.lastIndexOf(".");
/* 41 */ if (separatorIndex < 0)
/* */ {
/* 43 */ return "";
/* */ }
/* 45 */ return fileName.substring(separatorIndex + 1).toLowerCase();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static String getFileExtendName(byte[] photoByte) {
/* 56 */ String strFileExtendName = "JPG";
/* 57 */ if (photoByte[0] == 71 && photoByte[1] == 73 && photoByte[2] == 70 && photoByte[3] == 56 && (photoByte[4] == 55 || photoByte[4] == 57) && photoByte[5] == 97) {
/* */
/* */
/* 60 */ strFileExtendName = "GIF";
/* */ }
/* 62 */ else if (photoByte[6] == 74 && photoByte[7] == 70 && photoByte[8] == 73 && photoByte[9] == 70) {
/* */
/* 64 */ strFileExtendName = "JPG";
/* */ }
/* 66 */ else if (photoByte[0] == 66 && photoByte[1] == 77) {
/* */
/* 68 */ strFileExtendName = "BMP";
/* */ }
/* 70 */ else if (photoByte[1] == 80 && photoByte[2] == 78 && photoByte[3] == 71) {
/* */
/* 72 */ strFileExtendName = "PNG";
/* */ }
/* 74 */ return strFileExtendName;
/* */ }
/* */ }
package com.archive.common.utils.file;
import java.io.File;
public class FileTypeUtils
{
public static String getFileType(File file) {
if (null == file)
{
return "";
}
return getFileType(file.getName());
}
public static String getFileType(String fileName) {
int separatorIndex = fileName.lastIndexOf(".");
if (separatorIndex < 0)
{
return "";
}
return fileName.substring(separatorIndex + 1).toLowerCase();
}
public static String getFileExtendName(byte[] photoByte) {
String strFileExtendName = "JPG";
if (photoByte[0] == 71 && photoByte[1] == 73 && photoByte[2] == 70 && photoByte[3] == 56 && (photoByte[4] == 55 || photoByte[4] == 57) && photoByte[5] == 97) {
strFileExtendName = "GIF";
}
else if (photoByte[6] == 74 && photoByte[7] == 70 && photoByte[8] == 73 && photoByte[9] == 70) {
strFileExtendName = "JPG";
}
else if (photoByte[0] == 66 && photoByte[1] == 77) {
strFileExtendName = "BMP";
}
else if (photoByte[1] == 80 && photoByte[2] == 78 && photoByte[3] == 71) {
strFileExtendName = "PNG";
}
return strFileExtendName;
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\file\FileTypeUtils.class

@ -1,207 +1,207 @@
/* */ package com.archive.common.utils.file;
/* */
/* */ import com.archive.common.utils.StringUtils;
/* */
/* */ import java.io.File;
/* */ import java.io.FileInputStream;
/* */ import java.io.IOException;
/* */ import java.io.OutputStream;
/* */ import java.io.UnsupportedEncodingException;
/* */ import java.net.URLEncoder;
/* */ import java.nio.charset.StandardCharsets;
/* */ import javax.servlet.http.HttpServletRequest;
/* */ import javax.servlet.http.HttpServletResponse;
/* */ import org.apache.commons.lang3.ArrayUtils;
/* */
/* */
/* */
/* */ public class FileUtils
/* */
/* */ {
/* 23 */ public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+";
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static void writeBytes(String filePath, OutputStream os) throws IOException {
/* 34 */ FileInputStream fis = null;
/* */
/* */ try {
/* 37 */ File file = new File(filePath);
/* 38 */ if (!file.exists())
/* */ {
/* 40 */ if (!(new File(file.getParent())).exists()) {
/* 41 */ (new File(file.getParent())).mkdirs();
/* */ }
/* */ }
/* */
/* 45 */ fis = new FileInputStream(file);
/* 46 */ byte[] b = new byte[1024];
/* */ int length;
/* 48 */ while ((length = fis.read(b)) > 0)
/* */ {
/* 50 */ os.write(b, 0, length);
/* */ }
/* */ }
/* 53 */ catch (IOException e) {
/* */
/* 55 */ throw e;
/* */ }
/* */ finally {
/* */
/* 59 */ if (os != null) {
/* */
/* */ try {
/* */
/* 63 */ os.close();
/* */ }
/* 65 */ catch (IOException e1) {
/* */
/* 67 */ e1.printStackTrace();
/* */ }
/* */ }
/* 70 */ if (fis != null) {
/* */
/* */ try {
/* */
/* 74 */ fis.close();
/* */ }
/* 76 */ catch (IOException e1) {
/* */
/* 78 */ e1.printStackTrace();
/* */ }
/* */ }
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static boolean deleteFile(String filePath) {
/* 92 */ boolean flag = false;
/* 93 */ File file = new File(filePath);
/* */
/* 95 */ if (file.isFile() && file.exists()) {
/* */
/* 97 */ file.delete();
/* 98 */ flag = true;
/* */ }
/* 100 */ return flag;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static boolean isValidFilename(String filename) {
/* 111 */ return filename.matches(FILENAME_PATTERN);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static boolean checkAllowDownload(String resource) {
/* 123 */ if (StringUtils.contains(resource, ".."))
/* */ {
/* 125 */ return false;
/* */ }
/* */
/* */
/* 129 */ if (ArrayUtils.contains((Object[])MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION, FileTypeUtils.getFileType(resource)))
/* */ {
/* 131 */ return true;
/* */ }
/* */
/* */
/* 135 */ return false;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static String setFileDownloadHeader(HttpServletRequest request, String fileName) throws UnsupportedEncodingException {
/* 147 */ String agent = request.getHeader("USER-AGENT");
/* 148 */ String filename = fileName;
/* 149 */ if (agent.contains("MSIE")) {
/* */
/* */
/* 152 */ filename = URLEncoder.encode(filename, "utf-8");
/* 153 */ filename = filename.replace("+", " ");
/* */ }
/* 155 */ else if (agent.contains("Firefox")) {
/* */
/* */
/* 158 */ filename = new String(fileName.getBytes(), "ISO8859-1");
/* */ }
/* 160 */ else if (agent.contains("Chrome")) {
/* */
/* */
/* 163 */ filename = URLEncoder.encode(filename, "utf-8");
/* */
/* */ }
/* */ else {
/* */
/* 168 */ filename = URLEncoder.encode(filename, "utf-8");
/* */ }
/* 170 */ return filename;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName) throws UnsupportedEncodingException {
/* 182 */ String percentEncodedFileName = percentEncode(realFileName);
/* */
/* 184 */ StringBuilder contentDispositionValue = new StringBuilder();
/* 185 */ contentDispositionValue.append("attachment; filename=")
/* 186 */ .append(percentEncodedFileName)
/* 187 */ .append(";")
/* 188 */ .append("filename*=")
/* 189 */ .append("utf-8''")
/* 190 */ .append(percentEncodedFileName);
/* */
/* 192 */ response.setHeader("Content-disposition", contentDispositionValue.toString());
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static String percentEncode(String s) throws UnsupportedEncodingException {
/* 203 */ String encode = URLEncoder.encode(s, StandardCharsets.UTF_8.toString());
/* 204 */ return encode.replaceAll("\\+", "%20");
/* */ }
/* */ }
package com.archive.common.utils.file;
import com.archive.common.utils.StringUtils;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.ArrayUtils;
public class FileUtils
{
public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+";
public static void writeBytes(String filePath, OutputStream os) throws IOException {
FileInputStream fis = null;
try {
File file = new File(filePath);
if (!file.exists())
{
if (!(new File(file.getParent())).exists()) {
(new File(file.getParent())).mkdirs();
}
}
fis = new FileInputStream(file);
byte[] b = new byte[1024];
int length;
while ((length = fis.read(b)) > 0)
{
os.write(b, 0, length);
}
}
catch (IOException e) {
throw e;
}
finally {
if (os != null) {
try {
os.close();
}
catch (IOException e1) {
e1.printStackTrace();
}
}
if (fis != null) {
try {
fis.close();
}
catch (IOException e1) {
e1.printStackTrace();
}
}
}
}
public static boolean deleteFile(String filePath) {
boolean flag = false;
File file = new File(filePath);
if (file.isFile() && file.exists()) {
file.delete();
flag = true;
}
return flag;
}
public static boolean isValidFilename(String filename) {
return filename.matches(FILENAME_PATTERN);
}
public static boolean checkAllowDownload(String resource) {
if (StringUtils.contains(resource, ".."))
{
return false;
}
if (ArrayUtils.contains((Object[])MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION, FileTypeUtils.getFileType(resource)))
{
return true;
}
return false;
}
public static String setFileDownloadHeader(HttpServletRequest request, String fileName) throws UnsupportedEncodingException {
String agent = request.getHeader("USER-AGENT");
String filename = fileName;
if (agent.contains("MSIE")) {
filename = URLEncoder.encode(filename, "utf-8");
filename = filename.replace("+", " ");
}
else if (agent.contains("Firefox")) {
filename = new String(fileName.getBytes(), "ISO8859-1");
}
else if (agent.contains("Chrome")) {
filename = URLEncoder.encode(filename, "utf-8");
}
else {
filename = URLEncoder.encode(filename, "utf-8");
}
return filename;
}
public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName) throws UnsupportedEncodingException {
String percentEncodedFileName = percentEncode(realFileName);
StringBuilder contentDispositionValue = new StringBuilder();
contentDispositionValue.append("attachment; filename=")
.append(percentEncodedFileName)
.append(";")
.append("filename*=")
.append("utf-8''")
.append(percentEncodedFileName);
response.setHeader("Content-disposition", contentDispositionValue.toString());
}
public static String percentEncode(String s) throws UnsupportedEncodingException {
String encode = URLEncoder.encode(s, StandardCharsets.UTF_8.toString());
return encode.replaceAll("\\+", "%20");
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\file\FileUtils.class

@ -1,103 +1,103 @@
/* */ package com.archive.common.utils.file;
/* */
/* */ import com.archive.common.utils.StringUtils;
/* */ import com.archive.framework.config.ArchiveConfig;
/* */ import java.io.ByteArrayInputStream;
/* */ import java.io.ByteArrayOutputStream;
/* */ import java.io.FileInputStream;
/* */ import java.io.InputStream;
/* */ import java.net.URL;
/* */ import java.net.URLConnection;
/* */ import java.util.Arrays;
/* */ import org.apache.poi.util.IOUtils;
/* */ import org.slf4j.Logger;
/* */ import org.slf4j.LoggerFactory;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class ImageUtils
/* */ {
/* 24 */ private static final Logger log = LoggerFactory.getLogger(com.archive.common.utils.file.ImageUtils.class);
/* */
/* */
/* */ public static byte[] getImage(String imagePath) {
/* 28 */ InputStream is = getFile(imagePath);
/* */
/* */ try {
/* 31 */ return IOUtils.toByteArray(is);
/* */ }
/* 33 */ catch (Exception e) {
/* */
/* 35 */ log.error("图片加载异常 {}", e);
/* 36 */ return null;
/* */ }
/* */ finally {
/* */
/* 40 */ IOUtils.closeQuietly(is);
/* */ }
/* */ }
/* */
/* */
/* */
/* */ public static InputStream getFile(String imagePath) {
/* */ try {
/* 48 */ byte[] result = readFile(imagePath);
/* 49 */ result = Arrays.copyOf(result, result.length);
/* 50 */ return new ByteArrayInputStream(result);
/* */ }
/* 52 */ catch (Exception e) {
/* */
/* 54 */ log.error("获取图片异常 {}", e);
/* */
/* 56 */ return null;
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static byte[] readFile(String url) {
/* 67 */ InputStream in = null;
/* 68 */ ByteArrayOutputStream baos = null;
/* */
/* */ try {
/* 71 */ if (url.startsWith("http")) {
/* */
/* */
/* 74 */ URL urlObj = new URL(url);
/* 75 */ URLConnection urlConnection = urlObj.openConnection();
/* 76 */ urlConnection.setConnectTimeout(30000);
/* 77 */ urlConnection.setReadTimeout(60000);
/* 78 */ urlConnection.setDoInput(true);
/* 79 */ in = urlConnection.getInputStream();
/* */
/* */ }
/* */ else {
/* */
/* 84 */ String localPath = ArchiveConfig.getInstance().getProfile();
/* 85 */ String downloadPath = localPath + StringUtils.substringAfter(url, "/profile");
/* 86 */ in = new FileInputStream(downloadPath);
/* */ }
/* 88 */ return IOUtils.toByteArray(in);
/* */ }
/* 90 */ catch (Exception e) {
/* */
/* 92 */ log.error("获取文件路径异常 {}", e);
/* 93 */ return null;
/* */ }
/* */ finally {
/* */
/* 97 */ IOUtils.closeQuietly(baos);
/* */ }
/* */ }
/* */ }
package com.archive.common.utils.file;
import com.archive.common.utils.StringUtils;
import com.archive.framework.config.ArchiveConfig;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.Arrays;
import org.apache.poi.util.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ImageUtils
{
private static final Logger log = LoggerFactory.getLogger(com.archive.common.utils.file.ImageUtils.class);
public static byte[] getImage(String imagePath) {
InputStream is = getFile(imagePath);
try {
return IOUtils.toByteArray(is);
}
catch (Exception e) {
log.error("图片加载异常 {}", e);
return null;
}
finally {
IOUtils.closeQuietly(is);
}
}
public static InputStream getFile(String imagePath) {
try {
byte[] result = readFile(imagePath);
result = Arrays.copyOf(result, result.length);
return new ByteArrayInputStream(result);
}
catch (Exception e) {
log.error("获取图片异常 {}", e);
return null;
}
}
public static byte[] readFile(String url) {
InputStream in = null;
ByteArrayOutputStream baos = null;
try {
if (url.startsWith("http")) {
URL urlObj = new URL(url);
URLConnection urlConnection = urlObj.openConnection();
urlConnection.setConnectTimeout(30000);
urlConnection.setReadTimeout(60000);
urlConnection.setDoInput(true);
in = urlConnection.getInputStream();
}
else {
String localPath = ArchiveConfig.getInstance().getProfile();
String downloadPath = localPath + StringUtils.substringAfter(url, "/profile");
in = new FileInputStream(downloadPath);
}
return IOUtils.toByteArray(in);
}
catch (Exception e) {
log.error("获取文件路径异常 {}", e);
return null;
}
finally {
IOUtils.closeQuietly(baos);
}
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\file\ImageUtils.class

File diff suppressed because it is too large Load Diff

@ -1,264 +1,264 @@
/* */ package com.archive.common.utils.http;
/* */
/* */ import com.archive.common.utils.http.HttpUtils;
/* */ import javax.net.ssl.HostnameVerifier;
/* */ import javax.net.ssl.SSLSession;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ class TrustAnyHostnameVerifier
/* */ implements HostnameVerifier
/* */ {
/* */ TrustAnyHostnameVerifier() {}
/* */
/* */ public boolean verify(String hostname, SSLSession session) {
/* 259 */ return true;
/* */ }
/* */ }
package com.archive.common.utils.http;
import com.archive.common.utils.http.HttpUtils;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSession;
class TrustAnyHostnameVerifier
implements HostnameVerifier
{
TrustAnyHostnameVerifier() {}
public boolean verify(String hostname, SSLSession session) {
return true;
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\http\HttpUtils$TrustAnyHostnameVerifier.class

@ -1,255 +1,255 @@
/* */ package com.archive.common.utils.http;
/* */
/* */ import com.archive.common.utils.http.HttpUtils;
/* */ import java.security.cert.X509Certificate;
/* */ import javax.net.ssl.X509TrustManager;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ class TrustAnyTrustManager
/* */ implements X509TrustManager
/* */ {
/* */ TrustAnyTrustManager() {}
/* */
/* */ public void checkClientTrusted(X509Certificate[] chain, String authType) {}
/* */
/* */ public void checkServerTrusted(X509Certificate[] chain, String authType) {}
/* */
/* */ public X509Certificate[] getAcceptedIssuers() {
/* 250 */ return new X509Certificate[0];
/* */ }
/* */ }
package com.archive.common.utils.http;
import com.archive.common.utils.http.HttpUtils;
import java.security.cert.X509Certificate;
import javax.net.ssl.X509TrustManager;
class TrustAnyTrustManager
implements X509TrustManager
{
TrustAnyTrustManager() {}
public void checkClientTrusted(X509Certificate[] chain, String authType) {}
public void checkServerTrusted(X509Certificate[] chain, String authType) {}
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\http\HttpUtils$TrustAnyTrustManager.class

@ -1,286 +1,286 @@
/* */ package com.archive.common.utils.http;
/* */
/* */ import java.io.BufferedReader;
/* */ import java.io.IOException;
/* */ import java.io.InputStream;
/* */ import java.io.InputStreamReader;
/* */ import java.io.PrintWriter;
/* */ import java.net.ConnectException;
/* */ import java.net.SocketTimeoutException;
/* */ import java.net.URL;
/* */ import java.net.URLConnection;
/* */ import java.security.SecureRandom;
/* */ import javax.net.ssl.HostnameVerifier;
/* */ import javax.net.ssl.HttpsURLConnection;
/* */ import javax.net.ssl.SSLContext;
/* */ import javax.net.ssl.TrustManager;
/* */ import org.slf4j.Logger;
/* */ import org.slf4j.LoggerFactory;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class HttpUtils
/* */ {
/* 30 */ private static final Logger log = LoggerFactory.getLogger(com.archive.common.utils.http.HttpUtils.class);
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static String sendGet(String url, String param) {
/* 41 */ return sendGet(url, param, "UTF-8");
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static String sendGet(String url, String param, String contentType) {
/* 54 */ StringBuilder result = new StringBuilder();
/* 55 */ BufferedReader in = null;
/* */
/* */ try {
/* 58 */ String urlNameString = url + "?" + param;
/* 59 */ log.info("sendGet - {}", urlNameString);
/* 60 */ URL realUrl = new URL(urlNameString);
/* 61 */ URLConnection connection = realUrl.openConnection();
/* 62 */ connection.setRequestProperty("accept", "*/*");
/* 63 */ connection.setRequestProperty("connection", "Keep-Alive");
/* 64 */ connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
/* 65 */ connection.connect();
/* 66 */ in = new BufferedReader(new InputStreamReader(connection.getInputStream(), contentType));
/* */ String line;
/* 68 */ while ((line = in.readLine()) != null)
/* */ {
/* 70 */ result.append(line);
/* */ }
/* 72 */ log.info("recv - {}", result);
/* */ }
/* 74 */ catch (ConnectException e) {
/* */
/* 76 */ log.error("调用HttpUtils.sendGet ConnectException, url=" + url + ",param=" + param, e);
/* */ }
/* 78 */ catch (SocketTimeoutException e) {
/* */
/* 80 */ log.error("调用HttpUtils.sendGet SocketTimeoutException, url=" + url + ",param=" + param, e);
/* */ }
/* 82 */ catch (IOException e) {
/* */
/* 84 */ log.error("调用HttpUtils.sendGet IOException, url=" + url + ",param=" + param, e);
/* */ }
/* 86 */ catch (Exception e) {
/* */
/* 88 */ log.error("调用HttpsUtil.sendGet Exception, url=" + url + ",param=" + param, e);
/* */ } finally {
/* */
/* */
/* */ try {
/* */
/* 94 */ if (in != null)
/* */ {
/* 96 */ in.close();
/* */ }
/* */ }
/* 99 */ catch (Exception ex) {
/* */
/* 101 */ log.error("调用in.close Exception, url=" + url + ",param=" + param, ex);
/* */ }
/* */ }
/* 104 */ return result.toString();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static String sendPost(String url, String param) {
/* 116 */ PrintWriter out = null;
/* 117 */ BufferedReader in = null;
/* 118 */ StringBuilder result = new StringBuilder();
/* */
/* */ try {
/* 121 */ String urlNameString = url;
/* 122 */ log.info("sendPost - {}", urlNameString);
/* 123 */ URL realUrl = new URL(urlNameString);
/* 124 */ URLConnection conn = realUrl.openConnection();
/* 125 */ conn.setRequestProperty("accept", "*/*");
/* 126 */ conn.setRequestProperty("connection", "Keep-Alive");
/* 127 */ conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
/* 128 */ conn.setRequestProperty("Accept-Charset", "utf-8");
/* 129 */ conn.setRequestProperty("contentType", "utf-8");
/* 130 */ conn.setDoOutput(true);
/* 131 */ conn.setDoInput(true);
/* 132 */ out = new PrintWriter(conn.getOutputStream());
/* 133 */ out.print(param);
/* 134 */ out.flush();
/* 135 */ in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
/* */ String line;
/* 137 */ while ((line = in.readLine()) != null)
/* */ {
/* 139 */ result.append(line);
/* */ }
/* 141 */ log.info("recv - {}", result);
/* */ }
/* 143 */ catch (ConnectException e) {
/* */
/* 145 */ log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e);
/* */ }
/* 147 */ catch (SocketTimeoutException e) {
/* */
/* 149 */ log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e);
/* */ }
/* 151 */ catch (IOException e) {
/* */
/* 153 */ log.error("调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e);
/* */ }
/* 155 */ catch (Exception e) {
/* */
/* 157 */ log.error("调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e);
/* */ } finally {
/* */
/* */
/* */ try {
/* */
/* 163 */ if (out != null)
/* */ {
/* 165 */ out.close();
/* */ }
/* 167 */ if (in != null)
/* */ {
/* 169 */ in.close();
/* */ }
/* */ }
/* 172 */ catch (IOException ex) {
/* */
/* 174 */ log.error("调用in.close Exception, url=" + url + ",param=" + param, ex);
/* */ }
/* */ }
/* 177 */ return result.toString();
/* */ }
/* */
/* */
/* */ public static String sendSSLPost(String url, String param) {
/* 182 */ StringBuilder result = new StringBuilder();
/* 183 */ String urlNameString = url + "?" + param;
/* */
/* */ try {
/* 186 */ log.info("sendSSLPost - {}", urlNameString);
/* 187 */ SSLContext sc = SSLContext.getInstance("SSL");
/* 188 */ sc.init(null, new TrustManager[] { new TrustAnyTrustManager() }, new java.security.SecureRandom());
/* 189 */ URL console = new URL(urlNameString);
/* 190 */ HttpsURLConnection conn = (HttpsURLConnection)console.openConnection();
/* 191 */ conn.setRequestProperty("accept", "*/*");
/* 192 */ conn.setRequestProperty("connection", "Keep-Alive");
/* 193 */ conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
/* 194 */ conn.setRequestProperty("Accept-Charset", "utf-8");
/* 195 */ conn.setRequestProperty("contentType", "utf-8");
/* 196 */ conn.setDoOutput(true);
/* 197 */ conn.setDoInput(true);
/* */
/* 199 */ conn.setSSLSocketFactory(sc.getSocketFactory());
/* 200 */ conn.setHostnameVerifier(new TrustAnyHostnameVerifier());
/* 201 */ conn.connect();
/* 202 */ InputStream is = conn.getInputStream();
/* 203 */ BufferedReader br = new BufferedReader(new InputStreamReader(is));
/* 204 */ String ret = "";
/* 205 */ while ((ret = br.readLine()) != null) {
/* */
/* 207 */ if (ret != null && !ret.trim().equals(""))
/* */ {
/* 209 */ result.append(new String(ret.getBytes("ISO-8859-1"), "utf-8"));
/* */ }
/* */ }
/* 212 */ log.info("recv - {}", result);
/* 213 */ conn.disconnect();
/* 214 */ br.close();
/* */ }
/* 216 */ catch (ConnectException e) {
/* */
/* 218 */ log.error("调用HttpUtils.sendSSLPost ConnectException, url=" + url + ",param=" + param, e);
/* */ }
/* 220 */ catch (SocketTimeoutException e) {
/* */
/* 222 */ log.error("调用HttpUtils.sendSSLPost SocketTimeoutException, url=" + url + ",param=" + param, e);
/* */ }
/* 224 */ catch (IOException e) {
/* */
/* 226 */ log.error("调用HttpUtils.sendSSLPost IOException, url=" + url + ",param=" + param, e);
/* */ }
/* 228 */ catch (Exception e) {
/* */
/* 230 */ log.error("调用HttpsUtil.sendSSLPost Exception, url=" + url + ",param=" + param, e);
/* */ }
/* 232 */ return result.toString();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static boolean urlWhetherReachable(String urlString, int timeOutMillSeconds) {
/* 270 */ boolean flag = true;
/* */
/* */ try {
/* 273 */ URL url = new URL(urlString);
/* 274 */ URLConnection co = url.openConnection();
/* 275 */ co.setConnectTimeout(timeOutMillSeconds);
/* 276 */ co.connect();
/* 277 */ } catch (Exception e1) {
/* 278 */ System.out.println(urlString + "连接请求超时!");
/* 279 */ flag = false;
/* */ }
/* 281 */ return flag;
/* */ }
/* */ }
package com.archive.common.utils.http;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ConnectException;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.URLConnection;
import java.security.SecureRandom;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HttpUtils
{
private static final Logger log = LoggerFactory.getLogger(com.archive.common.utils.http.HttpUtils.class);
public static String sendGet(String url, String param) {
return sendGet(url, param, "UTF-8");
}
public static String sendGet(String url, String param, String contentType) {
StringBuilder result = new StringBuilder();
BufferedReader in = null;
try {
String urlNameString = url + "?" + param;
log.info("sendGet - {}", urlNameString);
URL realUrl = new URL(urlNameString);
URLConnection connection = realUrl.openConnection();
connection.setRequestProperty("accept", "*/*");
connection.setRequestProperty("connection", "Keep-Alive");
connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
connection.connect();
in = new BufferedReader(new InputStreamReader(connection.getInputStream(), contentType));
String line;
while ((line = in.readLine()) != null)
{
result.append(line);
}
log.info("recv - {}", result);
}
catch (ConnectException e) {
log.error("调用HttpUtils.sendGet ConnectException, url=" + url + ",param=" + param, e);
}
catch (SocketTimeoutException e) {
log.error("调用HttpUtils.sendGet SocketTimeoutException, url=" + url + ",param=" + param, e);
}
catch (IOException e) {
log.error("调用HttpUtils.sendGet IOException, url=" + url + ",param=" + param, e);
}
catch (Exception e) {
log.error("调用HttpsUtil.sendGet Exception, url=" + url + ",param=" + param, e);
} finally {
try {
if (in != null)
{
in.close();
}
}
catch (Exception ex) {
log.error("调用in.close Exception, url=" + url + ",param=" + param, ex);
}
}
return result.toString();
}
public static String sendPost(String url, String param) {
PrintWriter out = null;
BufferedReader in = null;
StringBuilder result = new StringBuilder();
try {
String urlNameString = url;
log.info("sendPost - {}", urlNameString);
URL realUrl = new URL(urlNameString);
URLConnection conn = realUrl.openConnection();
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
conn.setRequestProperty("Accept-Charset", "utf-8");
conn.setRequestProperty("contentType", "utf-8");
conn.setDoOutput(true);
conn.setDoInput(true);
out = new PrintWriter(conn.getOutputStream());
out.print(param);
out.flush();
in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
String line;
while ((line = in.readLine()) != null)
{
result.append(line);
}
log.info("recv - {}", result);
}
catch (ConnectException e) {
log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e);
}
catch (SocketTimeoutException e) {
log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e);
}
catch (IOException e) {
log.error("调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e);
}
catch (Exception e) {
log.error("调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e);
} finally {
try {
if (out != null)
{
out.close();
}
if (in != null)
{
in.close();
}
}
catch (IOException ex) {
log.error("调用in.close Exception, url=" + url + ",param=" + param, ex);
}
}
return result.toString();
}
public static String sendSSLPost(String url, String param) {
StringBuilder result = new StringBuilder();
String urlNameString = url + "?" + param;
try {
log.info("sendSSLPost - {}", urlNameString);
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, new TrustManager[] { new TrustAnyTrustManager() }, new java.security.SecureRandom());
URL console = new URL(urlNameString);
HttpsURLConnection conn = (HttpsURLConnection)console.openConnection();
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
conn.setRequestProperty("Accept-Charset", "utf-8");
conn.setRequestProperty("contentType", "utf-8");
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setSSLSocketFactory(sc.getSocketFactory());
conn.setHostnameVerifier(new TrustAnyHostnameVerifier());
conn.connect();
InputStream is = conn.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String ret = "";
while ((ret = br.readLine()) != null) {
if (ret != null && !ret.trim().equals(""))
{
result.append(new String(ret.getBytes("ISO-8859-1"), "utf-8"));
}
}
log.info("recv - {}", result);
conn.disconnect();
br.close();
}
catch (ConnectException e) {
log.error("调用HttpUtils.sendSSLPost ConnectException, url=" + url + ",param=" + param, e);
}
catch (SocketTimeoutException e) {
log.error("调用HttpUtils.sendSSLPost SocketTimeoutException, url=" + url + ",param=" + param, e);
}
catch (IOException e) {
log.error("调用HttpUtils.sendSSLPost IOException, url=" + url + ",param=" + param, e);
}
catch (Exception e) {
log.error("调用HttpsUtil.sendSSLPost Exception, url=" + url + ",param=" + param, e);
}
return result.toString();
}
public static boolean urlWhetherReachable(String urlString, int timeOutMillSeconds) {
boolean flag = true;
try {
URL url = new URL(urlString);
URLConnection co = url.openConnection();
co.setConnectTimeout(timeOutMillSeconds);
co.connect();
} catch (Exception e1) {
System.out.println(urlString + "连接请求超时!");
flag = false;
}
return flag;
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\http\HttpUtils.class

@ -1,52 +1,52 @@
/* */ package com.archive.common.utils.uuid;
/* */
/* */ import com.archive.common.utils.uuid.UUID;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class IdUtils
/* */ {
/* */ public static String randomUUID() {
/* 17 */ return UUID.randomUUID().toString();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static String simpleUUID() {
/* 27 */ return UUID.randomUUID().toString(true);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static String fastUUID() {
/* 37 */ return UUID.fastUUID().toString();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static String fastSimpleUUID() {
/* 47 */ return UUID.fastUUID().toString(true);
/* */ }
/* */ }
package com.archive.common.utils.uuid;
import com.archive.common.utils.uuid.UUID;
public class IdUtils
{
public static String randomUUID() {
return UUID.randomUUID().toString();
}
public static String simpleUUID() {
return UUID.randomUUID().toString(true);
}
public static String fastUUID() {
return UUID.fastUUID().toString();
}
public static String fastSimpleUUID() {
return UUID.fastUUID().toString(true);
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\util\\uuid\IdUtils.class

@ -1,51 +1,51 @@
/* */ package com.archive.framework.config
package com.archive.framework.config
;
/* */
/* */ import com.archive.common.utils.StringUtils;
/* */ import com.archive.common.xss.XssFilter;
/* */ import com.google.common.collect.Maps;
/* */ import java.util.Map;
/* */ import javax.servlet.DispatcherType;
/* */ import javax.servlet.Filter;
/* */ import org.springframework.beans.factory.annotation.Value;
/* */ import org.springframework.boot.web.servlet.FilterRegistrationBean;
/* */ import org.springframework.context.annotation.Bean;
/* */ import org.springframework.context.annotation.Configuration;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @Configuration
/* */ public class FilterConfig
/* */ {
/* */ @Value("${xss.enabled}")
/* */ private String enabled;
/* */ @Value("${xss.excludes}")
/* */ private String excludes;
/* */ @Value("${xss.urlPatterns}")
/* */ private String urlPatterns;
/* */
/* */ @Bean
/* */ public FilterRegistrationBean xssFilterRegistration() {
/* 34 */ FilterRegistrationBean registration = new FilterRegistrationBean();
/* 35 */ registration.setDispatcherTypes(DispatcherType.REQUEST, new DispatcherType[0]);
/* 36 */ registration.setFilter((Filter)new XssFilter());
/* 37 */ registration.addUrlPatterns(StringUtils.split(this.urlPatterns, ","));
/* 38 */ registration.setName("xssFilter");
/* 39 */ registration.setOrder(2147483647);
/* 40 */ Map<String, String> initParameters = Maps.newHashMap();
/* 41 */ initParameters.put("excludes", this.excludes);
/* 42 */ initParameters.put("enabled", this.enabled);
/* 43 */ registration.setInitParameters(initParameters);
/* 44 */ return registration;
/* */ }
/* */ }
import com.archive.common.utils.StringUtils;
import com.archive.common.xss.XssFilter;
import com.google.common.collect.Maps;
import java.util.Map;
import javax.servlet.DispatcherType;
import javax.servlet.Filter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class FilterConfig
{
@Value("${xss.enabled}")
private String enabled;
@Value("${xss.excludes}")
private String excludes;
@Value("${xss.urlPatterns}")
private String urlPatterns;
@Bean
public FilterRegistrationBean xssFilterRegistration() {
FilterRegistrationBean registration = new FilterRegistrationBean();
registration.setDispatcherTypes(DispatcherType.REQUEST, new DispatcherType[0]);
registration.setFilter((Filter)new XssFilter());
registration.addUrlPatterns(StringUtils.split(this.urlPatterns, ","));
registration.setName("xssFilter");
registration.setOrder(2147483647);
Map<String, String> initParameters = Maps.newHashMap();
initParameters.put("excludes", this.excludes);
initParameters.put("enabled", this.enabled);
registration.setInitParameters(initParameters);
return registration;
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\framework\config\FilterConfig.class

@ -1,71 +1,71 @@
/* */ package com.archive.framework.config
package com.archive.framework.config
;
/* */
/* */ import org.springframework.boot.context.properties.ConfigurationProperties;
/* */ import org.springframework.stereotype.Component;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @Component
/* */ @ConfigurationProperties(prefix = "gen")
/* */ public class GenConfig
/* */ {
/* */ public static String author;
/* */ public static String packageName;
/* */ public static boolean autoRemovePre;
/* */ public static String tablePrefix;
/* */
/* */ public static String getAuthor() {
/* 29 */ return author;
/* */ }
/* */
/* */
/* */ public void setAuthor(String author) {
/* 34 */ com.archive.framework.config.GenConfig.author = author;
/* */ }
/* */
/* */
/* */ public static String getPackageName() {
/* 39 */ return packageName;
/* */ }
/* */
/* */
/* */ public void setPackageName(String packageName) {
/* 44 */ com.archive.framework.config.GenConfig.packageName = packageName;
/* */ }
/* */
/* */
/* */ public static boolean getAutoRemovePre() {
/* 49 */ return autoRemovePre;
/* */ }
/* */
/* */
/* */ public void setAutoRemovePre(boolean autoRemovePre) {
/* 54 */ com.archive.framework.config.GenConfig.autoRemovePre = autoRemovePre;
/* */ }
/* */
/* */
/* */ public static String getTablePrefix() {
/* 59 */ return tablePrefix;
/* */ }
/* */
/* */
/* */ public void setTablePrefix(String tablePrefix) {
/* 64 */ com.archive.framework.config.GenConfig.tablePrefix = tablePrefix;
/* */ }
/* */ }
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "gen")
public class GenConfig
{
public static String author;
public static String packageName;
public static boolean autoRemovePre;
public static String tablePrefix;
public static String getAuthor() {
return author;
}
public void setAuthor(String author) {
com.archive.framework.config.GenConfig.author = author;
}
public static String getPackageName() {
return packageName;
}
public void setPackageName(String packageName) {
com.archive.framework.config.GenConfig.packageName = packageName;
}
public static boolean getAutoRemovePre() {
return autoRemovePre;
}
public void setAutoRemovePre(boolean autoRemovePre) {
com.archive.framework.config.GenConfig.autoRemovePre = autoRemovePre;
}
public static String getTablePrefix() {
return tablePrefix;
}
public void setTablePrefix(String tablePrefix) {
com.archive.framework.config.GenConfig.tablePrefix = tablePrefix;
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\framework\config\GenConfig.class

@ -1,47 +1,47 @@
/* */ package com.archive.framework.config
package com.archive.framework.config
;
/* */
/* */ import java.util.Locale;
/* */ import org.springframework.context.annotation.Bean;
/* */ import org.springframework.context.annotation.Configuration;
/* */ import org.springframework.web.servlet.HandlerInterceptor;
/* */ import org.springframework.web.servlet.LocaleResolver;
/* */ import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
/* */ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/* */ import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
/* */ import org.springframework.web.servlet.i18n.SessionLocaleResolver;
/* */
/* */
/* */
/* */
/* */
/* */ @Configuration
/* */ public class I18nConfig
/* */ implements WebMvcConfigurer
/* */ {
/* */ @Bean
/* */ public LocaleResolver localeResolver() {
/* 23 */ SessionLocaleResolver slr = new SessionLocaleResolver();
/* */
/* 25 */ slr.setDefaultLocale(Locale.SIMPLIFIED_CHINESE);
/* 26 */ return (LocaleResolver)slr;
/* */ }
/* */
/* */
/* */ @Bean
/* */ public LocaleChangeInterceptor localeChangeInterceptor() {
/* 32 */ LocaleChangeInterceptor lci = new LocaleChangeInterceptor();
/* */
/* 34 */ lci.setParamName("lang");
/* 35 */ return lci;
/* */ }
/* */
/* */
/* */
/* */ public void addInterceptors(InterceptorRegistry registry) {
/* 41 */ registry.addInterceptor((HandlerInterceptor)localeChangeInterceptor());
/* */ }
/* */ }
import java.util.Locale;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
import org.springframework.web.servlet.i18n.SessionLocaleResolver;
@Configuration
public class I18nConfig
implements WebMvcConfigurer
{
@Bean
public LocaleResolver localeResolver() {
SessionLocaleResolver slr = new SessionLocaleResolver();
slr.setDefaultLocale(Locale.SIMPLIFIED_CHINESE);
return (LocaleResolver)slr;
}
@Bean
public LocaleChangeInterceptor localeChangeInterceptor() {
LocaleChangeInterceptor lci = new LocaleChangeInterceptor();
lci.setParamName("lang");
return lci;
}
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor((HandlerInterceptor)localeChangeInterceptor());
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\framework\config\I18nConfig.class

@ -1,121 +1,121 @@
/* */ package com.archive.framework.web.exception
package com.archive.framework.web.exception
;
/* */
/* */ import com.archive.common.exception.BusinessException;
/* */ import com.archive.common.exception.DemoModeException;
/* */ import com.archive.common.utils.ServletUtils;
/* */ import com.archive.common.utils.security.PermissionUtils;
/* */ import com.archive.framework.web.domain.AjaxResult;
/* */ import javax.servlet.http.HttpServletRequest;
/* */ import org.apache.shiro.authz.AuthorizationException;
/* */ import org.slf4j.Logger;
/* */ import org.slf4j.LoggerFactory;
/* */ import org.springframework.validation.BindException;
/* */ import org.springframework.validation.ObjectError;
/* */ import org.springframework.web.HttpRequestMethodNotSupportedException;
/* */ import org.springframework.web.bind.annotation.ExceptionHandler;
/* */ import org.springframework.web.bind.annotation.RestControllerAdvice;
/* */ import org.springframework.web.servlet.ModelAndView;
/* */
/* */
/* */
/* */
/* */
/* */ @RestControllerAdvice
/* */ public class GlobalExceptionHandler
/* */ {
/* 26 */ private static final Logger log = LoggerFactory.getLogger(com.archive.framework.web.exception.GlobalExceptionHandler.class);
/* */
/* */
/* */
/* */
/* */
/* */ @ExceptionHandler({AuthorizationException.class})
/* */ public Object handleAuthorizationException(HttpServletRequest request, AuthorizationException e) {
/* 34 */ log.error(e.getMessage(), (Throwable)e);
/* 35 */ if (ServletUtils.isAjaxRequest(request))
/* */ {
/* 37 */ return AjaxResult.error(PermissionUtils.getMsg(e.getMessage()));
/* */ }
/* */
/* */
/* 41 */ ModelAndView modelAndView = new ModelAndView();
/* 42 */ modelAndView.setViewName("error/unauth");
/* 43 */ return modelAndView;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @ExceptionHandler({HttpRequestMethodNotSupportedException.class})
/* */ public AjaxResult handleException(HttpRequestMethodNotSupportedException e) {
/* 53 */ log.error(e.getMessage(), (Throwable)e);
/* 54 */ return AjaxResult.error("不支持' " + e.getMethod() + "'请求");
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ @ExceptionHandler({RuntimeException.class})
/* */ public AjaxResult notFount(RuntimeException e) {
/* 63 */ log.error("运行时异常:", e);
/* 64 */ return AjaxResult.error("运行时异常:" + e.getMessage());
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ @ExceptionHandler({Exception.class})
/* */ public AjaxResult handleException(Exception e) {
/* 73 */ log.error(e.getMessage(), e);
/* 74 */ return AjaxResult.error("服务器错误,请联系管理员");
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ @ExceptionHandler({BusinessException.class})
/* */ public Object businessException(HttpServletRequest request, BusinessException e) {
/* 83 */ log.error(e.getMessage(), (Throwable)e);
/* 84 */ if (ServletUtils.isAjaxRequest(request))
/* */ {
/* 86 */ return AjaxResult.error(e.getMessage());
/* */ }
/* */
/* */
/* 90 */ ModelAndView modelAndView = new ModelAndView();
/* 91 */ modelAndView.addObject("errorMessage", e.getMessage());
/* 92 */ modelAndView.setViewName("error/business");
/* 93 */ return modelAndView;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @ExceptionHandler({BindException.class})
/* */ public AjaxResult validatedBindException(BindException e) {
/* 103 */ log.error(e.getMessage(), (Throwable)e);
/* 104 */ String message = ((ObjectError)e.getAllErrors().get(0)).getDefaultMessage();
/* 105 */ return AjaxResult.error(message);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ @ExceptionHandler({DemoModeException.class})
/* */ public AjaxResult demoModeException(DemoModeException e) {
/* 114 */ return AjaxResult.error("演示模式,不允许操作");
/* */ }
/* */ }
import com.archive.common.exception.BusinessException;
import com.archive.common.exception.DemoModeException;
import com.archive.common.utils.ServletUtils;
import com.archive.common.utils.security.PermissionUtils;
import com.archive.framework.web.domain.AjaxResult;
import javax.servlet.http.HttpServletRequest;
import org.apache.shiro.authz.AuthorizationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.BindException;
import org.springframework.validation.ObjectError;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.ModelAndView;
@RestControllerAdvice
public class GlobalExceptionHandler
{
private static final Logger log = LoggerFactory.getLogger(com.archive.framework.web.exception.GlobalExceptionHandler.class);
@ExceptionHandler({AuthorizationException.class})
public Object handleAuthorizationException(HttpServletRequest request, AuthorizationException e) {
log.error(e.getMessage(), (Throwable)e);
if (ServletUtils.isAjaxRequest(request))
{
return AjaxResult.error(PermissionUtils.getMsg(e.getMessage()));
}
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("error/unauth");
return modelAndView;
}
@ExceptionHandler({HttpRequestMethodNotSupportedException.class})
public AjaxResult handleException(HttpRequestMethodNotSupportedException e) {
log.error(e.getMessage(), (Throwable)e);
return AjaxResult.error("不支持' " + e.getMethod() + "'请求");
}
@ExceptionHandler({RuntimeException.class})
public AjaxResult notFount(RuntimeException e) {
log.error("运行时异常:", e);
return AjaxResult.error("运行时异常:" + e.getMessage());
}
@ExceptionHandler({Exception.class})
public AjaxResult handleException(Exception e) {
log.error(e.getMessage(), e);
return AjaxResult.error("服务器错误,请联系管理员");
}
@ExceptionHandler({BusinessException.class})
public Object businessException(HttpServletRequest request, BusinessException e) {
log.error(e.getMessage(), (Throwable)e);
if (ServletUtils.isAjaxRequest(request))
{
return AjaxResult.error(e.getMessage());
}
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("errorMessage", e.getMessage());
modelAndView.setViewName("error/business");
return modelAndView;
}
@ExceptionHandler({BindException.class})
public AjaxResult validatedBindException(BindException e) {
log.error(e.getMessage(), (Throwable)e);
String message = ((ObjectError)e.getAllErrors().get(0)).getDefaultMessage();
return AjaxResult.error(message);
}
@ExceptionHandler({DemoModeException.class})
public AjaxResult demoModeException(DemoModeException e) {
return AjaxResult.error("演示模式,不允许操作");
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\framework\web\exception\GlobalExceptionHandler.class

@ -1,102 +1,102 @@
/* */ package com.archive.project.common.service
package com.archive.project.common.service
;
/* */
/* */ import com.archive.common.utils.StringUtils;
/* */ import com.archive.project.common.mapper.ExecuteSqlMapper;
/* */ import com.archive.project.common.service.IExecuteSqlService;
/* */ import java.util.LinkedHashMap;
/* */ import java.util.List;
/* */ import org.springframework.beans.factory.annotation.Autowired;
/* */ import org.springframework.jdbc.core.JdbcTemplate;
/* */ import org.springframework.stereotype.Service;
/* */
/* */ @Service
/* */ public class ExecuteSqlServiceImpl
/* */ implements IExecuteSqlService
/* */ {
/* */ @Autowired
/* */ private ExecuteSqlMapper executeSqlMapper;
/* */ @Autowired
/* */ public JdbcTemplate jdbcTemplate;
/* */
/* */ public String getSingle(String sql) {
/* 22 */ List<LinkedHashMap<String, Object>> selectResult = this.executeSqlMapper.select(sql);
/* 23 */ if (selectResult.isEmpty() || selectResult.get(0) == null) {
/* 24 */ return "";
/* */ }
/* 26 */ return ((LinkedHashMap)selectResult.get(0)).values().iterator().next().toString();
/* */ }
/* */
/* */
/* */
/* */ public List<LinkedHashMap<String, Object>> queryList(String sql) {
/* 32 */ return this.executeSqlMapper.select(sql);
/* */ }
/* */
/* */
/* */ public LinkedHashMap<String, Object> getOne(String sql) {
/* 37 */ return this.executeSqlMapper.select(sql).get(0);
/* */ }
/* */
/* */
/* */ public boolean insert(String sql) {
/* */ try {
/* 43 */ this.executeSqlMapper.insert(sql);
/* 44 */ return true;
/* 45 */ } catch (Exception e) {
/* 46 */ e.printStackTrace();
/* 47 */ return false;
/* */ }
/* */ }
/* */
/* */
/* */ public boolean batchInsert(List<String> sql) {
/* 53 */ return insert(StringUtils.join(sql, ';'));
/* */ }
/* */
/* */
/* */ public boolean update(String sql) {
/* */ try {
/* 59 */ this.executeSqlMapper.update(sql);
/* 60 */ return true;
/* 61 */ } catch (Exception e) {
/* 62 */ e.printStackTrace();
/* 63 */ return false;
/* */ }
/* */ }
/* */
/* */
/* */ public boolean batchUpdate(List<String> sql) {
/* 69 */ return update(StringUtils.join(sql, ';'));
/* */ }
/* */
/* */
/* */ public boolean delete(String sql) {
/* */ try {
/* 75 */ this.executeSqlMapper.delete(sql);
/* 76 */ return true;
/* 77 */ } catch (Exception e) {
/* 78 */ e.printStackTrace();
/* 79 */ return false;
/* */ }
/* */ }
/* */
/* */
/* */ public boolean batchDelete(List<String> sql) {
/* 85 */ return delete(StringUtils.join(sql, ';'));
/* */ }
/* */
/* */
/* */ public void jdbcTemplateExecute(String sql) throws Exception {
/* 90 */ this.jdbcTemplate.execute(sql);
/* */ }
/* */
/* */
/* */ public Integer jdbcTemplateQueryCount(String sql) {
/* 95 */ return (Integer)this.jdbcTemplate.queryForObject(sql, Integer.class);
/* */ }
/* */ }
import com.archive.common.utils.StringUtils;
import com.archive.project.common.mapper.ExecuteSqlMapper;
import com.archive.project.common.service.IExecuteSqlService;
import java.util.LinkedHashMap;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@Service
public class ExecuteSqlServiceImpl
implements IExecuteSqlService
{
@Autowired
private ExecuteSqlMapper executeSqlMapper;
@Autowired
public JdbcTemplate jdbcTemplate;
public String getSingle(String sql) {
List<LinkedHashMap<String, Object>> selectResult = this.executeSqlMapper.select(sql);
if (selectResult.isEmpty() || selectResult.get(0) == null) {
return "";
}
return ((LinkedHashMap)selectResult.get(0)).values().iterator().next().toString();
}
public List<LinkedHashMap<String, Object>> queryList(String sql) {
return this.executeSqlMapper.select(sql);
}
public LinkedHashMap<String, Object> getOne(String sql) {
return this.executeSqlMapper.select(sql).get(0);
}
public boolean insert(String sql) {
try {
this.executeSqlMapper.insert(sql);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public boolean batchInsert(List<String> sql) {
return insert(StringUtils.join(sql, ';'));
}
public boolean update(String sql) {
try {
this.executeSqlMapper.update(sql);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public boolean batchUpdate(List<String> sql) {
return update(StringUtils.join(sql, ';'));
}
public boolean delete(String sql) {
try {
this.executeSqlMapper.delete(sql);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public boolean batchDelete(List<String> sql) {
return delete(StringUtils.join(sql, ';'));
}
public void jdbcTemplateExecute(String sql) throws Exception {
this.jdbcTemplate.execute(sql);
}
public Integer jdbcTemplateQueryCount(String sql) {
return (Integer)this.jdbcTemplate.queryForObject(sql, Integer.class);
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\common\service\ExecuteSqlServiceImpl.class

@ -1,64 +1,64 @@
/* */ package com.archive.project.dajs.gsbdr.controller
package com.archive.project.dajs.gsbdr.controller
;
/* */
/* */ import com.archive.framework.web.controller.BaseController;
/* */ import com.archive.framework.web.page.TableDataInfo;
/* */ import com.archive.project.dajs.gsbdr.service.IGsbdrService;
/* */ import java.io.IOException;
/* */ import java.util.ArrayList;
/* */ import java.util.List;
/* */ import org.apache.shiro.authz.annotation.RequiresPermissions;
/* */ import org.springframework.beans.factory.annotation.Autowired;
/* */ import org.springframework.stereotype.Controller;
/* */ import org.springframework.ui.ModelMap;
/* */ import org.springframework.web.bind.annotation.GetMapping;
/* */ import org.springframework.web.bind.annotation.RequestMapping;
/* */ import org.springframework.web.bind.annotation.ResponseBody;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @Controller
/* */ @RequestMapping({"/dajs/gsbdr"})
/* */ public class GsbdrController
/* */ extends BaseController
/* */ {
/* 31 */ private String prefix = "dajs/gsbdr";
/* */
/* */
/* */ @Autowired
/* */ private IGsbdrService gsbdrService;
/* */
/* */
/* */
/* */ @RequiresPermissions({"dajs:gsbdr"})
/* */ @GetMapping
/* */ public String gsbdr(ModelMap mmap) {
/* 42 */ return this.prefix + "/gsbdr";
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @GetMapping({"/list"})
/* */ @ResponseBody
/* */ public TableDataInfo list(String key, int page, int size) throws IOException {
/* 54 */ startPage();
/* */
/* 56 */ List<Object> list = new ArrayList();
/* 57 */ return getDataTable(list);
/* */ }
/* */ }
import com.archive.framework.web.controller.BaseController;
import com.archive.framework.web.page.TableDataInfo;
import com.archive.project.dajs.gsbdr.service.IGsbdrService;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping({"/dajs/gsbdr"})
public class GsbdrController
extends BaseController
{
private String prefix = "dajs/gsbdr";
@Autowired
private IGsbdrService gsbdrService;
@RequiresPermissions({"dajs:gsbdr"})
@GetMapping
public String gsbdr(ModelMap mmap) {
return this.prefix + "/gsbdr";
}
@GetMapping({"/list"})
@ResponseBody
public TableDataInfo list(String key, int page, int size) throws IOException {
startPage();
List<Object> list = new ArrayList();
return getDataTable(list);
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\dajs\gsbdr\controller\GsbdrController.class

@ -1,164 +1,164 @@
/* */ package com.archive.project.system.user.controller
package com.archive.project.system.user.controller
;
/* */
/* */ import com.archive.common.utils.CookieUtils;
/* */ import com.archive.common.utils.DateUtils;
/* */ import com.archive.common.utils.ServletUtils;
/* */ import com.archive.common.utils.StringUtils;
/* */ import com.archive.common.utils.text.Convert;
/* */ import com.archive.framework.config.ArchiveConfig;
/* */ import com.archive.framework.shiro.service.PasswordService;
/* */ import com.archive.framework.web.controller.BaseController;
/* */ import com.archive.framework.web.domain.AjaxResult;
/* */ import com.archive.project.system.config.service.IConfigService;
/* */ import com.archive.project.system.menu.domain.Menu;
/* */ import com.archive.project.system.menu.service.IMenuService;
/* */ import com.archive.project.system.user.domain.User;
/* */ import java.util.Date;
/* */ import java.util.List;
/* */ import javax.servlet.http.Cookie;
/* */ import javax.servlet.http.HttpServletResponse;
/* */ import org.springframework.beans.factory.annotation.Autowired;
/* */ import org.springframework.stereotype.Controller;
/* */ import org.springframework.ui.ModelMap;
/* */ import org.springframework.web.bind.annotation.GetMapping;
/* */ import org.springframework.web.bind.annotation.PathVariable;
/* */ import org.springframework.web.bind.annotation.PostMapping;
/* */ import org.springframework.web.bind.annotation.ResponseBody;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @Controller
/* */ public class IndexController
/* */ extends BaseController
/* */ {
/* */ @Autowired
/* */ private IMenuService menuService;
/* */ @Autowired
/* */ private IConfigService configService;
/* */ @Autowired
/* */ private PasswordService passwordService;
/* */ @Autowired
/* */ private ArchiveConfig archiveConfig;
/* */
/* */ @GetMapping({"/index"})
/* */ public String index(ModelMap mmap) {
/* 53 */ String systemName = this.configService.selectConfigByKey("archive.SystemName");
/* */
/* 55 */ User user = getSysUser();
/* */
/* 57 */ List<Menu> menus = this.menuService.selectMenusByUser(user);
/* 58 */ mmap.put("menus", menus);
/* 59 */ mmap.put("user", user);
/* 60 */ mmap.put("sideTheme", this.configService.selectConfigByKey("sys.index.sideTheme"));
/* 61 */ mmap.put("skinName", this.configService.selectConfigByKey("sys.index.skinName"));
/* 62 */ mmap.put("ignoreFooter", this.configService.selectConfigByKey("sys.index.ignoreFooter"));
/* 63 */ mmap.put("copyrightYear", this.archiveConfig.getCopyrightYear());
/* 64 */ mmap.put("demoEnabled", Boolean.valueOf(this.archiveConfig.isDemoEnabled()));
/* 65 */ mmap.put("isDefaultModifyPwd", Boolean.valueOf(initPasswordIsModify(user.getPwdUpdateDate())));
/* 66 */ mmap.put("isPasswordExpired", Boolean.valueOf(passwordIsExpiration(user.getPwdUpdateDate())));
/* 67 */ mmap.put("SystemName", systemName);
/* */
/* 69 */ String menuStyle = this.configService.selectConfigByKey("sys.index.menuStyle");
/* */
/* 71 */ String indexStyle = ServletUtils.checkAgentIsMobile(ServletUtils.getRequest().getHeader("User-Agent")) ? "index" : menuStyle;
/* */
/* */
/* 74 */ Cookie[] cookies = ServletUtils.getRequest().getCookies();
/* 75 */ for (Cookie cookie : cookies) {
/* */
/* 77 */ if (StringUtils.isNotEmpty(cookie.getName()) && "nav-style".equalsIgnoreCase(cookie.getName())) {
/* */
/* 79 */ indexStyle = cookie.getValue();
/* */ break;
/* */ }
/* */ }
/* 83 */ String webIndex = "topnav".equalsIgnoreCase(indexStyle) ? "index-topnav" : "index";
/* 84 */ return webIndex;
/* */ }
/* */
/* */
/* */
/* */ @GetMapping({"/lockscreen"})
/* */ public String lockscreen(ModelMap mmap) {
/* 91 */ mmap.put("user", getSysUser());
/* 92 */ ServletUtils.getSession().setAttribute("lockscreen", Boolean.valueOf(true));
/* 93 */ return "lock";
/* */ }
/* */
/* */
/* */
/* */ @PostMapping({"/unlockscreen"})
/* */ @ResponseBody
/* */ public AjaxResult unlockscreen(String password) {
/* 101 */ User user = getSysUser();
/* 102 */ if (StringUtils.isNull(user))
/* */ {
/* 104 */ return AjaxResult.error("服务器超时,请重新登陆");
/* */ }
/* 106 */ if (this.passwordService.matches(user, password)) {
/* */
/* 108 */ ServletUtils.getSession().removeAttribute("lockscreen");
/* 109 */ return AjaxResult.success();
/* */ }
/* 111 */ return AjaxResult.error("密码不正确,请重新输入。");
/* */ }
/* */
/* */
/* */
/* */ @GetMapping({"/system/switchSkin"})
/* */ public String switchSkin() {
/* 118 */ return "skin";
/* */ }
/* */
/* */
/* */
/* */ @GetMapping({"/system/menuStyle/{style}"})
/* */ public void menuStyle(@PathVariable String style, HttpServletResponse response) {
/* 125 */ CookieUtils.setCookie(response, "nav-style", style);
/* */ }
/* */
/* */
/* */
/* */ @GetMapping({"/system/main"})
/* */ public String main(ModelMap mmap) {
/* 132 */ mmap.put("version", this.archiveConfig.getVersion());
/* 133 */ return "main";
/* */ }
/* */
/* */
/* */
/* */ public boolean initPasswordIsModify(Date pwdUpdateDate) {
/* 139 */ Integer initPasswordModify = Convert.toInt(this.configService.selectConfigByKey("sys.account.initPasswordModify"));
/* 140 */ return (initPasswordModify != null && initPasswordModify.intValue() == 1 && pwdUpdateDate == null);
/* */ }
/* */
/* */
/* */
/* */ public boolean passwordIsExpiration(Date pwdUpdateDate) {
/* 146 */ Integer passwordValidateDays = Convert.toInt(this.configService.selectConfigByKey("sys.account.passwordValidateDays"));
/* 147 */ if (passwordValidateDays != null && passwordValidateDays.intValue() > 0) {
/* */
/* 149 */ if (StringUtils.isNull(pwdUpdateDate))
/* */ {
/* */
/* 152 */ return true;
/* */ }
/* 154 */ Date nowDate = DateUtils.getNowDate();
/* 155 */ return (DateUtils.differentDaysByMillisecond(nowDate, pwdUpdateDate) > passwordValidateDays.intValue());
/* */ }
/* 157 */ return false;
/* */ }
/* */ }
import com.archive.common.utils.CookieUtils;
import com.archive.common.utils.DateUtils;
import com.archive.common.utils.ServletUtils;
import com.archive.common.utils.StringUtils;
import com.archive.common.utils.text.Convert;
import com.archive.framework.config.ArchiveConfig;
import com.archive.framework.shiro.service.PasswordService;
import com.archive.framework.web.controller.BaseController;
import com.archive.framework.web.domain.AjaxResult;
import com.archive.project.system.config.service.IConfigService;
import com.archive.project.system.menu.domain.Menu;
import com.archive.project.system.menu.service.IMenuService;
import com.archive.project.system.user.domain.User;
import java.util.Date;
import java.util.List;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class IndexController
extends BaseController
{
@Autowired
private IMenuService menuService;
@Autowired
private IConfigService configService;
@Autowired
private PasswordService passwordService;
@Autowired
private ArchiveConfig archiveConfig;
@GetMapping({"/index"})
public String index(ModelMap mmap) {
String systemName = this.configService.selectConfigByKey("archive.SystemName");
User user = getSysUser();
List<Menu> menus = this.menuService.selectMenusByUser(user);
mmap.put("menus", menus);
mmap.put("user", user);
mmap.put("sideTheme", this.configService.selectConfigByKey("sys.index.sideTheme"));
mmap.put("skinName", this.configService.selectConfigByKey("sys.index.skinName"));
mmap.put("ignoreFooter", this.configService.selectConfigByKey("sys.index.ignoreFooter"));
mmap.put("copyrightYear", this.archiveConfig.getCopyrightYear());
mmap.put("demoEnabled", Boolean.valueOf(this.archiveConfig.isDemoEnabled()));
mmap.put("isDefaultModifyPwd", Boolean.valueOf(initPasswordIsModify(user.getPwdUpdateDate())));
mmap.put("isPasswordExpired", Boolean.valueOf(passwordIsExpiration(user.getPwdUpdateDate())));
mmap.put("SystemName", systemName);
String menuStyle = this.configService.selectConfigByKey("sys.index.menuStyle");
String indexStyle = ServletUtils.checkAgentIsMobile(ServletUtils.getRequest().getHeader("User-Agent")) ? "index" : menuStyle;
Cookie[] cookies = ServletUtils.getRequest().getCookies();
for (Cookie cookie : cookies) {
if (StringUtils.isNotEmpty(cookie.getName()) && "nav-style".equalsIgnoreCase(cookie.getName())) {
indexStyle = cookie.getValue();
break;
}
}
String webIndex = "topnav".equalsIgnoreCase(indexStyle) ? "index-topnav" : "index";
return webIndex;
}
@GetMapping({"/lockscreen"})
public String lockscreen(ModelMap mmap) {
mmap.put("user", getSysUser());
ServletUtils.getSession().setAttribute("lockscreen", Boolean.valueOf(true));
return "lock";
}
@PostMapping({"/unlockscreen"})
@ResponseBody
public AjaxResult unlockscreen(String password) {
User user = getSysUser();
if (StringUtils.isNull(user))
{
return AjaxResult.error("服务器超时,请重新登陆");
}
if (this.passwordService.matches(user, password)) {
ServletUtils.getSession().removeAttribute("lockscreen");
return AjaxResult.success();
}
return AjaxResult.error("密码不正确,请重新输入。");
}
@GetMapping({"/system/switchSkin"})
public String switchSkin() {
return "skin";
}
@GetMapping({"/system/menuStyle/{style}"})
public void menuStyle(@PathVariable String style, HttpServletResponse response) {
CookieUtils.setCookie(response, "nav-style", style);
}
@GetMapping({"/system/main"})
public String main(ModelMap mmap) {
mmap.put("version", this.archiveConfig.getVersion());
return "main";
}
public boolean initPasswordIsModify(Date pwdUpdateDate) {
Integer initPasswordModify = Convert.toInt(this.configService.selectConfigByKey("sys.account.initPasswordModify"));
return (initPasswordModify != null && initPasswordModify.intValue() == 1 && pwdUpdateDate == null);
}
public boolean passwordIsExpiration(Date pwdUpdateDate) {
Integer passwordValidateDays = Convert.toInt(this.configService.selectConfigByKey("sys.account.passwordValidateDays"));
if (passwordValidateDays != null && passwordValidateDays.intValue() > 0) {
if (StringUtils.isNull(pwdUpdateDate))
{
return true;
}
Date nowDate = DateUtils.getNowDate();
return (DateUtils.differentDaysByMillisecond(nowDate, pwdUpdateDate) > passwordValidateDays.intValue());
}
return false;
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\syste\\user\controller\IndexController.class

@ -1,256 +1,256 @@
/* */ package com.archive.project.tool.gen.controller
package com.archive.project.tool.gen.controller
;
/* */
/* */ import com.alibaba.fastjson.JSON;
/* */ import com.archive.common.utils.StringUtils;
/* */ import com.archive.common.utils.text.Convert;
/* */ import com.archive.framework.aspectj.lang.annotation.Log;
/* */ import com.archive.framework.aspectj.lang.enums.BusinessType;
/* */ import com.archive.framework.web.controller.BaseController;
/* */ import com.archive.framework.web.domain.AjaxResult;
/* */ import com.archive.framework.web.domain.CxSelect;
/* */ import com.archive.framework.web.page.TableDataInfo;
/* */ import com.archive.project.tool.gen.domain.GenTable;
/* */ import com.archive.project.tool.gen.domain.GenTableColumn;
/* */ import com.archive.project.tool.gen.service.IGenTableColumnService;
/* */ import com.archive.project.tool.gen.service.IGenTableService;
/* */ import java.io.IOException;
/* */ import java.io.OutputStream;
/* */ import java.util.ArrayList;
/* */ import java.util.List;
/* */ import java.util.Map;
/* */ import javax.servlet.http.HttpServletResponse;
/* */ import org.apache.commons.io.IOUtils;
/* */ import org.apache.shiro.authz.annotation.RequiresPermissions;
/* */ import org.springframework.beans.factory.annotation.Autowired;
/* */ import org.springframework.stereotype.Controller;
/* */ import org.springframework.ui.ModelMap;
/* */ import org.springframework.validation.annotation.Validated;
/* */ import org.springframework.web.bind.annotation.GetMapping;
/* */ import org.springframework.web.bind.annotation.PathVariable;
/* */ import org.springframework.web.bind.annotation.PostMapping;
/* */ import org.springframework.web.bind.annotation.RequestMapping;
/* */ import org.springframework.web.bind.annotation.ResponseBody;
/* */
/* */
/* */
/* */
/* */ @Controller
/* */ @RequestMapping({"/tool/gen"})
/* */ public class GenController
/* */ extends BaseController
/* */ {
/* 42 */ private String prefix = "tool/gen";
/* */
/* */ @Autowired
/* */ private IGenTableService genTableService;
/* */
/* */ @Autowired
/* */ private IGenTableColumnService genTableColumnService;
/* */
/* */
/* */ @RequiresPermissions({"tool:gen:view"})
/* */ @GetMapping
/* */ public String gen() {
/* 54 */ return this.prefix + "/gen";
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ @RequiresPermissions({"tool:gen:list"})
/* */ @PostMapping({"/list"})
/* */ @ResponseBody
/* */ public TableDataInfo genList(GenTable genTable) {
/* 65 */ startPage();
/* 66 */ List<GenTable> list = this.genTableService.selectGenTableList(genTable);
/* 67 */ return getDataTable(list);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ @RequiresPermissions({"tool:gen:list"})
/* */ @PostMapping({"/db/list"})
/* */ @ResponseBody
/* */ public TableDataInfo dataList(GenTable genTable) {
/* 78 */ startPage();
/* 79 */ List<GenTable> list = this.genTableService.selectDbTableList(genTable);
/* 80 */ return getDataTable(list);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ @RequiresPermissions({"tool:gen:list"})
/* */ @PostMapping({"/column/list"})
/* */ @ResponseBody
/* */ public TableDataInfo columnList(GenTableColumn genTableColumn) {
/* 91 */ TableDataInfo dataInfo = new TableDataInfo();
/* 92 */ List<GenTableColumn> list = this.genTableColumnService.selectGenTableColumnListByTableId(genTableColumn);
/* 93 */ dataInfo.setRows(list);
/* 94 */ dataInfo.setTotal(list.size());
/* 95 */ return dataInfo;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ @RequiresPermissions({"tool:gen:list"})
/* */ @GetMapping({"/importTable"})
/* */ public String importTable() {
/* 105 */ return this.prefix + "/importTable";
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ @RequiresPermissions({"tool:gen:list"})
/* */ @Log(title = "代码生成", businessType = BusinessType.IMPORT)
/* */ @PostMapping({"/importTable"})
/* */ @ResponseBody
/* */ public AjaxResult importTableSave(String tables) {
/* 117 */ String[] tableNames = Convert.toStrArray(tables);
/* */
/* 119 */ List<GenTable> tableList = this.genTableService.selectDbTableListByNames(tableNames);
/* 120 */ this.genTableService.importGenTable(tableList);
/* 121 */ return AjaxResult.success();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ @GetMapping({"/edit/{tableId}"})
/* */ public String edit(@PathVariable("tableId") Long tableId, ModelMap mmap) {
/* 130 */ GenTable table = this.genTableService.selectGenTableById(tableId);
/* 131 */ List<GenTable> genTables = this.genTableService.selectGenTableAll();
/* 132 */ List<CxSelect> cxSelect = new ArrayList<>();
/* 133 */ for (GenTable genTable : genTables) {
/* */
/* 135 */ if (!StringUtils.equals(table.getTableName(), genTable.getTableName())) {
/* */
/* 137 */ CxSelect cxTable = new CxSelect(genTable.getTableName(), genTable.getTableName() + '' + genTable.getTableComment());
/* 138 */ List<CxSelect> cxColumns = new ArrayList<>();
/* 139 */ for (GenTableColumn tableColumn : genTable.getColumns())
/* */ {
/* 141 */ cxColumns.add(new CxSelect(tableColumn.getColumnName(), tableColumn.getColumnName() + '' + tableColumn.getColumnComment()));
/* */ }
/* 143 */ cxTable.setS(cxColumns);
/* 144 */ cxSelect.add(cxTable);
/* */ }
/* */ }
/* 147 */ mmap.put("table", table);
/* 148 */ mmap.put("data", JSON.toJSON(cxSelect));
/* 149 */ return this.prefix + "/edit";
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ @RequiresPermissions({"tool:gen:edit"})
/* */ @Log(title = "代码生成", businessType = BusinessType.UPDATE)
/* */ @PostMapping({"/edit"})
/* */ @ResponseBody
/* */ public AjaxResult editSave(@Validated GenTable genTable) {
/* 161 */ this.genTableService.validateEdit(genTable);
/* 162 */ this.genTableService.updateGenTable(genTable);
/* 163 */ return AjaxResult.success();
/* */ }
/* */
/* */
/* */ @RequiresPermissions({"tool:gen:remove"})
/* */ @Log(title = "代码生成", businessType = BusinessType.DELETE)
/* */ @PostMapping({"/remove"})
/* */ @ResponseBody
/* */ public AjaxResult remove(String ids) {
/* 172 */ this.genTableService.deleteGenTableByIds(ids);
/* 173 */ return AjaxResult.success();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ @RequiresPermissions({"tool:gen:preview"})
/* */ @GetMapping({"/preview/{tableId}"})
/* */ @ResponseBody
/* */ public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException {
/* 184 */ Map<String, String> dataMap = this.genTableService.previewCode(tableId);
/* 185 */ return AjaxResult.success(dataMap);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ @RequiresPermissions({"tool:gen:code"})
/* */ @Log(title = "代码生成", businessType = BusinessType.GENCODE)
/* */ @GetMapping({"/download/{tableName}"})
/* */ public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException {
/* 196 */ byte[] data = this.genTableService.downloadCode(tableName);
/* 197 */ genCode(response, data);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ @RequiresPermissions({"tool:gen:code"})
/* */ @Log(title = "代码生成", businessType = BusinessType.GENCODE)
/* */ @GetMapping({"/genCode/{tableName}"})
/* */ @ResponseBody
/* */ public AjaxResult genCode(@PathVariable("tableName") String tableName) {
/* 209 */ this.genTableService.generatorCode(tableName);
/* 210 */ return AjaxResult.success();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ @RequiresPermissions({"tool:gen:edit"})
/* */ @Log(title = "代码生成", businessType = BusinessType.UPDATE)
/* */ @GetMapping({"/synchDb/{tableName}"})
/* */ @ResponseBody
/* */ public AjaxResult synchDb(@PathVariable("tableName") String tableName) {
/* 222 */ this.genTableService.synchDb(tableName);
/* 223 */ return AjaxResult.success();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ @RequiresPermissions({"tool:gen:code"})
/* */ @Log(title = "代码生成", businessType = BusinessType.GENCODE)
/* */ @GetMapping({"/batchGenCode"})
/* */ @ResponseBody
/* */ public void batchGenCode(HttpServletResponse response, String tables) throws IOException {
/* 235 */ String[] tableNames = Convert.toStrArray(tables);
/* 236 */ byte[] data = this.genTableService.downloadCode(tableNames);
/* 237 */ genCode(response, data);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ private void genCode(HttpServletResponse response, byte[] data) throws IOException {
/* 245 */ response.reset();
/* 246 */ response.setHeader("Content-Disposition", "attachment; filename=\"archive.zip\"");
/* 247 */ response.addHeader("Content-Length", "" + data.length);
/* 248 */ response.setContentType("application/octet-stream; charset=UTF-8");
/* 249 */ IOUtils.write(data, (OutputStream)response.getOutputStream());
/* */ }
/* */ }
import com.alibaba.fastjson.JSON;
import com.archive.common.utils.StringUtils;
import com.archive.common.utils.text.Convert;
import com.archive.framework.aspectj.lang.annotation.Log;
import com.archive.framework.aspectj.lang.enums.BusinessType;
import com.archive.framework.web.controller.BaseController;
import com.archive.framework.web.domain.AjaxResult;
import com.archive.framework.web.domain.CxSelect;
import com.archive.framework.web.page.TableDataInfo;
import com.archive.project.tool.gen.domain.GenTable;
import com.archive.project.tool.gen.domain.GenTableColumn;
import com.archive.project.tool.gen.service.IGenTableColumnService;
import com.archive.project.tool.gen.service.IGenTableService;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping({"/tool/gen"})
public class GenController
extends BaseController
{
private String prefix = "tool/gen";
@Autowired
private IGenTableService genTableService;
@Autowired
private IGenTableColumnService genTableColumnService;
@RequiresPermissions({"tool:gen:view"})
@GetMapping
public String gen() {
return this.prefix + "/gen";
}
@RequiresPermissions({"tool:gen:list"})
@PostMapping({"/list"})
@ResponseBody
public TableDataInfo genList(GenTable genTable) {
startPage();
List<GenTable> list = this.genTableService.selectGenTableList(genTable);
return getDataTable(list);
}
@RequiresPermissions({"tool:gen:list"})
@PostMapping({"/db/list"})
@ResponseBody
public TableDataInfo dataList(GenTable genTable) {
startPage();
List<GenTable> list = this.genTableService.selectDbTableList(genTable);
return getDataTable(list);
}
@RequiresPermissions({"tool:gen:list"})
@PostMapping({"/column/list"})
@ResponseBody
public TableDataInfo columnList(GenTableColumn genTableColumn) {
TableDataInfo dataInfo = new TableDataInfo();
List<GenTableColumn> list = this.genTableColumnService.selectGenTableColumnListByTableId(genTableColumn);
dataInfo.setRows(list);
dataInfo.setTotal(list.size());
return dataInfo;
}
@RequiresPermissions({"tool:gen:list"})
@GetMapping({"/importTable"})
public String importTable() {
return this.prefix + "/importTable";
}
@RequiresPermissions({"tool:gen:list"})
@Log(title = "代码生成", businessType = BusinessType.IMPORT)
@PostMapping({"/importTable"})
@ResponseBody
public AjaxResult importTableSave(String tables) {
String[] tableNames = Convert.toStrArray(tables);
List<GenTable> tableList = this.genTableService.selectDbTableListByNames(tableNames);
this.genTableService.importGenTable(tableList);
return AjaxResult.success();
}
@GetMapping({"/edit/{tableId}"})
public String edit(@PathVariable("tableId") Long tableId, ModelMap mmap) {
GenTable table = this.genTableService.selectGenTableById(tableId);
List<GenTable> genTables = this.genTableService.selectGenTableAll();
List<CxSelect> cxSelect = new ArrayList<>();
for (GenTable genTable : genTables) {
if (!StringUtils.equals(table.getTableName(), genTable.getTableName())) {
CxSelect cxTable = new CxSelect(genTable.getTableName(), genTable.getTableName() + '' + genTable.getTableComment());
List<CxSelect> cxColumns = new ArrayList<>();
for (GenTableColumn tableColumn : genTable.getColumns())
{
cxColumns.add(new CxSelect(tableColumn.getColumnName(), tableColumn.getColumnName() + '' + tableColumn.getColumnComment()));
}
cxTable.setS(cxColumns);
cxSelect.add(cxTable);
}
}
mmap.put("table", table);
mmap.put("data", JSON.toJSON(cxSelect));
return this.prefix + "/edit";
}
@RequiresPermissions({"tool:gen:edit"})
@Log(title = "代码生成", businessType = BusinessType.UPDATE)
@PostMapping({"/edit"})
@ResponseBody
public AjaxResult editSave(@Validated GenTable genTable) {
this.genTableService.validateEdit(genTable);
this.genTableService.updateGenTable(genTable);
return AjaxResult.success();
}
@RequiresPermissions({"tool:gen:remove"})
@Log(title = "代码生成", businessType = BusinessType.DELETE)
@PostMapping({"/remove"})
@ResponseBody
public AjaxResult remove(String ids) {
this.genTableService.deleteGenTableByIds(ids);
return AjaxResult.success();
}
@RequiresPermissions({"tool:gen:preview"})
@GetMapping({"/preview/{tableId}"})
@ResponseBody
public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException {
Map<String, String> dataMap = this.genTableService.previewCode(tableId);
return AjaxResult.success(dataMap);
}
@RequiresPermissions({"tool:gen:code"})
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
@GetMapping({"/download/{tableName}"})
public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException {
byte[] data = this.genTableService.downloadCode(tableName);
genCode(response, data);
}
@RequiresPermissions({"tool:gen:code"})
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
@GetMapping({"/genCode/{tableName}"})
@ResponseBody
public AjaxResult genCode(@PathVariable("tableName") String tableName) {
this.genTableService.generatorCode(tableName);
return AjaxResult.success();
}
@RequiresPermissions({"tool:gen:edit"})
@Log(title = "代码生成", businessType = BusinessType.UPDATE)
@GetMapping({"/synchDb/{tableName}"})
@ResponseBody
public AjaxResult synchDb(@PathVariable("tableName") String tableName) {
this.genTableService.synchDb(tableName);
return AjaxResult.success();
}
@RequiresPermissions({"tool:gen:code"})
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
@GetMapping({"/batchGenCode"})
@ResponseBody
public void batchGenCode(HttpServletResponse response, String tables) throws IOException {
String[] tableNames = Convert.toStrArray(tables);
byte[] data = this.genTableService.downloadCode(tableNames);
genCode(response, data);
}
private void genCode(HttpServletResponse response, byte[] data) throws IOException {
response.reset();
response.setHeader("Content-Disposition", "attachment; filename=\"archive.zip\"");
response.addHeader("Content-Length", "" + data.length);
response.setContentType("application/octet-stream; charset=UTF-8");
IOUtils.write(data, (OutputStream)response.getOutputStream());
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\tool\gen\controller\GenController.class

@ -1,377 +1,377 @@
/* */ package com.archive.project.tool.gen.domain
package com.archive.project.tool.gen.domain
;
/* */
/* */ import com.archive.common.constant.GenConstants;
/* */ import com.archive.common.utils.StringUtils;
/* */ import com.archive.framework.web.domain.BaseEntity;
/* */ import com.archive.project.tool.gen.domain.GenTableColumn;
/* */ import java.util.List;
/* */ import javax.validation.Valid;
/* */ import javax.validation.constraints.NotBlank;
/* */ import org.apache.commons.lang3.ArrayUtils;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class GenTable
/* */ extends BaseEntity
/* */ {
/* */ private static final long serialVersionUID = 1L;
/* */ private Long tableId;
/* */ @NotBlank(message = "表名称不能为空")
/* */ private String tableName;
/* */ @NotBlank(message = "表描述不能为空")
/* */ private String tableComment;
/* */ private String subTableName;
/* */ private String subTableFkName;
/* */ @NotBlank(message = "实体类名称不能为空")
/* */ private String className;
/* */ private String tplCategory;
/* */ @NotBlank(message = "生成包路径不能为空")
/* */ private String packageName;
/* */ @NotBlank(message = "生成模块名不能为空")
/* */ private String moduleName;
/* */ @NotBlank(message = "生成业务名不能为空")
/* */ private String businessName;
/* */ @NotBlank(message = "生成功能名不能为空")
/* */ private String functionName;
/* */ @NotBlank(message = "作者不能为空")
/* */ private String functionAuthor;
/* */ private String genType;
/* */ private String genPath;
/* */ private GenTableColumn pkColumn;
/* */ private com.archive.project.tool.gen.domain.GenTable subTable;
/* */ @Valid
/* */ private List<GenTableColumn> columns;
/* */ private String options;
/* */ private String treeCode;
/* */ private String treeParentCode;
/* */ private String treeName;
/* */ private String parentMenuId;
/* */ private String parentMenuName;
/* */
/* */ public Long getTableId() {
/* 100 */ return this.tableId;
/* */ }
/* */
/* */
/* */ public void setTableId(Long tableId) {
/* 105 */ this.tableId = tableId;
/* */ }
/* */
/* */
/* */ public String getTableName() {
/* 110 */ return this.tableName;
/* */ }
/* */
/* */
/* */ public void setTableName(String tableName) {
/* 115 */ this.tableName = tableName;
/* */ }
/* */
/* */
/* */ public String getTableComment() {
/* 120 */ return this.tableComment;
/* */ }
/* */
/* */
/* */ public void setTableComment(String tableComment) {
/* 125 */ this.tableComment = tableComment;
/* */ }
/* */
/* */
/* */ public String getSubTableName() {
/* 130 */ return this.subTableName;
/* */ }
/* */
/* */
/* */ public void setSubTableName(String subTableName) {
/* 135 */ this.subTableName = subTableName;
/* */ }
/* */
/* */
/* */ public String getSubTableFkName() {
/* 140 */ return this.subTableFkName;
/* */ }
/* */
/* */
/* */ public void setSubTableFkName(String subTableFkName) {
/* 145 */ this.subTableFkName = subTableFkName;
/* */ }
/* */
/* */
/* */ public String getClassName() {
/* 150 */ return this.className;
/* */ }
/* */
/* */
/* */ public void setClassName(String className) {
/* 155 */ this.className = className;
/* */ }
/* */
/* */
/* */ public String getTplCategory() {
/* 160 */ return this.tplCategory;
/* */ }
/* */
/* */
/* */ public void setTplCategory(String tplCategory) {
/* 165 */ this.tplCategory = tplCategory;
/* */ }
/* */
/* */
/* */ public String getPackageName() {
/* 170 */ return this.packageName;
/* */ }
/* */
/* */
/* */ public void setPackageName(String packageName) {
/* 175 */ this.packageName = packageName;
/* */ }
/* */
/* */
/* */ public String getModuleName() {
/* 180 */ return this.moduleName;
/* */ }
/* */
/* */
/* */ public void setModuleName(String moduleName) {
/* 185 */ this.moduleName = moduleName;
/* */ }
/* */
/* */
/* */ public String getBusinessName() {
/* 190 */ return this.businessName;
/* */ }
/* */
/* */
/* */ public void setBusinessName(String businessName) {
/* 195 */ this.businessName = businessName;
/* */ }
/* */
/* */
/* */ public String getFunctionName() {
/* 200 */ return this.functionName;
/* */ }
/* */
/* */
/* */ public void setFunctionName(String functionName) {
/* 205 */ this.functionName = functionName;
/* */ }
/* */
/* */
/* */ public String getFunctionAuthor() {
/* 210 */ return this.functionAuthor;
/* */ }
/* */
/* */
/* */ public void setFunctionAuthor(String functionAuthor) {
/* 215 */ this.functionAuthor = functionAuthor;
/* */ }
/* */
/* */
/* */ public String getGenType() {
/* 220 */ return this.genType;
/* */ }
/* */
/* */
/* */ public void setGenType(String genType) {
/* 225 */ this.genType = genType;
/* */ }
/* */
/* */
/* */ public String getGenPath() {
/* 230 */ return this.genPath;
/* */ }
/* */
/* */
/* */ public void setGenPath(String genPath) {
/* 235 */ this.genPath = genPath;
/* */ }
/* */
/* */
/* */ public GenTableColumn getPkColumn() {
/* 240 */ return this.pkColumn;
/* */ }
/* */
/* */
/* */ public void setPkColumn(GenTableColumn pkColumn) {
/* 245 */ this.pkColumn = pkColumn;
/* */ }
/* */
/* */
/* */ public com.archive.project.tool.gen.domain.GenTable getSubTable() {
/* 250 */ return this.subTable;
/* */ }
/* */
/* */
/* */ public void setSubTable(com.archive.project.tool.gen.domain.GenTable subTable) {
/* 255 */ this.subTable = subTable;
/* */ }
/* */
/* */
/* */ public List<GenTableColumn> getColumns() {
/* 260 */ return this.columns;
/* */ }
/* */
/* */
/* */ public void setColumns(List<GenTableColumn> columns) {
/* 265 */ this.columns = columns;
/* */ }
/* */
/* */
/* */ public String getOptions() {
/* 270 */ return this.options;
/* */ }
/* */
/* */
/* */ public void setOptions(String options) {
/* 275 */ this.options = options;
/* */ }
/* */
/* */
/* */ public String getTreeCode() {
/* 280 */ return this.treeCode;
/* */ }
/* */
/* */
/* */ public void setTreeCode(String treeCode) {
/* 285 */ this.treeCode = treeCode;
/* */ }
/* */
/* */
/* */ public String getTreeParentCode() {
/* 290 */ return this.treeParentCode;
/* */ }
/* */
/* */
/* */ public void setTreeParentCode(String treeParentCode) {
/* 295 */ this.treeParentCode = treeParentCode;
/* */ }
/* */
/* */
/* */ public String getTreeName() {
/* 300 */ return this.treeName;
/* */ }
/* */
/* */
/* */ public void setTreeName(String treeName) {
/* 305 */ this.treeName = treeName;
/* */ }
/* */
/* */
/* */ public String getParentMenuId() {
/* 310 */ return this.parentMenuId;
/* */ }
/* */
/* */
/* */ public void setParentMenuId(String parentMenuId) {
/* 315 */ this.parentMenuId = parentMenuId;
/* */ }
/* */
/* */
/* */ public String getParentMenuName() {
/* 320 */ return this.parentMenuName;
/* */ }
/* */
/* */
/* */ public void setParentMenuName(String parentMenuName) {
/* 325 */ this.parentMenuName = parentMenuName;
/* */ }
/* */
/* */
/* */ public boolean isSub() {
/* 330 */ return isSub(this.tplCategory);
/* */ }
/* */
/* */
/* */ public static boolean isSub(String tplCategory) {
/* 335 */ return (tplCategory != null && StringUtils.equals("sub", tplCategory));
/* */ }
/* */
/* */
/* */ public boolean isTree() {
/* 340 */ return isTree(this.tplCategory);
/* */ }
/* */
/* */
/* */ public static boolean isTree(String tplCategory) {
/* 345 */ return (tplCategory != null && StringUtils.equals("tree", tplCategory));
/* */ }
/* */
/* */
/* */ public boolean isCrud() {
/* 350 */ return isCrud(this.tplCategory);
/* */ }
/* */
/* */
/* */ public static boolean isCrud(String tplCategory) {
/* 355 */ return (tplCategory != null && StringUtils.equals("crud", tplCategory));
/* */ }
/* */
/* */
/* */ public boolean isSuperColumn(String javaField) {
/* 360 */ return isSuperColumn(this.tplCategory, javaField);
/* */ }
/* */
/* */
/* */ public static boolean isSuperColumn(String tplCategory, String javaField) {
/* 365 */ if (isTree(tplCategory))
/* */ {
/* 367 */ return StringUtils.equalsAnyIgnoreCase(javaField,
/* 368 */ (CharSequence[])ArrayUtils.addAll((Object[])GenConstants.TREE_ENTITY, (Object[])GenConstants.BASE_ENTITY));
/* */ }
/* 370 */ return StringUtils.equalsAnyIgnoreCase(javaField, (CharSequence[])GenConstants.BASE_ENTITY);
/* */ }
/* */ }
import com.archive.common.constant.GenConstants;
import com.archive.common.utils.StringUtils;
import com.archive.framework.web.domain.BaseEntity;
import com.archive.project.tool.gen.domain.GenTableColumn;
import java.util.List;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import org.apache.commons.lang3.ArrayUtils;
public class GenTable
extends BaseEntity
{
private static final long serialVersionUID = 1L;
private Long tableId;
@NotBlank(message = "表名称不能为空")
private String tableName;
@NotBlank(message = "表描述不能为空")
private String tableComment;
private String subTableName;
private String subTableFkName;
@NotBlank(message = "实体类名称不能为空")
private String className;
private String tplCategory;
@NotBlank(message = "生成包路径不能为空")
private String packageName;
@NotBlank(message = "生成模块名不能为空")
private String moduleName;
@NotBlank(message = "生成业务名不能为空")
private String businessName;
@NotBlank(message = "生成功能名不能为空")
private String functionName;
@NotBlank(message = "作者不能为空")
private String functionAuthor;
private String genType;
private String genPath;
private GenTableColumn pkColumn;
private com.archive.project.tool.gen.domain.GenTable subTable;
@Valid
private List<GenTableColumn> columns;
private String options;
private String treeCode;
private String treeParentCode;
private String treeName;
private String parentMenuId;
private String parentMenuName;
public Long getTableId() {
return this.tableId;
}
public void setTableId(Long tableId) {
this.tableId = tableId;
}
public String getTableName() {
return this.tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public String getTableComment() {
return this.tableComment;
}
public void setTableComment(String tableComment) {
this.tableComment = tableComment;
}
public String getSubTableName() {
return this.subTableName;
}
public void setSubTableName(String subTableName) {
this.subTableName = subTableName;
}
public String getSubTableFkName() {
return this.subTableFkName;
}
public void setSubTableFkName(String subTableFkName) {
this.subTableFkName = subTableFkName;
}
public String getClassName() {
return this.className;
}
public void setClassName(String className) {
this.className = className;
}
public String getTplCategory() {
return this.tplCategory;
}
public void setTplCategory(String tplCategory) {
this.tplCategory = tplCategory;
}
public String getPackageName() {
return this.packageName;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}
public String getModuleName() {
return this.moduleName;
}
public void setModuleName(String moduleName) {
this.moduleName = moduleName;
}
public String getBusinessName() {
return this.businessName;
}
public void setBusinessName(String businessName) {
this.businessName = businessName;
}
public String getFunctionName() {
return this.functionName;
}
public void setFunctionName(String functionName) {
this.functionName = functionName;
}
public String getFunctionAuthor() {
return this.functionAuthor;
}
public void setFunctionAuthor(String functionAuthor) {
this.functionAuthor = functionAuthor;
}
public String getGenType() {
return this.genType;
}
public void setGenType(String genType) {
this.genType = genType;
}
public String getGenPath() {
return this.genPath;
}
public void setGenPath(String genPath) {
this.genPath = genPath;
}
public GenTableColumn getPkColumn() {
return this.pkColumn;
}
public void setPkColumn(GenTableColumn pkColumn) {
this.pkColumn = pkColumn;
}
public com.archive.project.tool.gen.domain.GenTable getSubTable() {
return this.subTable;
}
public void setSubTable(com.archive.project.tool.gen.domain.GenTable subTable) {
this.subTable = subTable;
}
public List<GenTableColumn> getColumns() {
return this.columns;
}
public void setColumns(List<GenTableColumn> columns) {
this.columns = columns;
}
public String getOptions() {
return this.options;
}
public void setOptions(String options) {
this.options = options;
}
public String getTreeCode() {
return this.treeCode;
}
public void setTreeCode(String treeCode) {
this.treeCode = treeCode;
}
public String getTreeParentCode() {
return this.treeParentCode;
}
public void setTreeParentCode(String treeParentCode) {
this.treeParentCode = treeParentCode;
}
public String getTreeName() {
return this.treeName;
}
public void setTreeName(String treeName) {
this.treeName = treeName;
}
public String getParentMenuId() {
return this.parentMenuId;
}
public void setParentMenuId(String parentMenuId) {
this.parentMenuId = parentMenuId;
}
public String getParentMenuName() {
return this.parentMenuName;
}
public void setParentMenuName(String parentMenuName) {
this.parentMenuName = parentMenuName;
}
public boolean isSub() {
return isSub(this.tplCategory);
}
public static boolean isSub(String tplCategory) {
return (tplCategory != null && StringUtils.equals("sub", tplCategory));
}
public boolean isTree() {
return isTree(this.tplCategory);
}
public static boolean isTree(String tplCategory) {
return (tplCategory != null && StringUtils.equals("tree", tplCategory));
}
public boolean isCrud() {
return isCrud(this.tplCategory);
}
public static boolean isCrud(String tplCategory) {
return (tplCategory != null && StringUtils.equals("crud", tplCategory));
}
public boolean isSuperColumn(String javaField) {
return isSuperColumn(this.tplCategory, javaField);
}
public static boolean isSuperColumn(String tplCategory, String javaField) {
if (isTree(tplCategory))
{
return StringUtils.equalsAnyIgnoreCase(javaField,
(CharSequence[])ArrayUtils.addAll((Object[])GenConstants.TREE_ENTITY, (Object[])GenConstants.BASE_ENTITY));
}
return StringUtils.equalsAnyIgnoreCase(javaField, (CharSequence[])GenConstants.BASE_ENTITY);
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\tool\gen\domain\GenTable.class

@ -1,377 +1,377 @@
/* */ package com.archive.project.tool.gen.domain
package com.archive.project.tool.gen.domain
;
/* */
/* */ import com.archive.common.utils.StringUtils;
/* */ import com.archive.framework.web.domain.BaseEntity;
/* */ import javax.validation.constraints.NotBlank;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class GenTableColumn
/* */ extends BaseEntity
/* */ {
/* */ private static final long serialVersionUID = 1L;
/* */ private Long columnId;
/* */ private Long tableId;
/* */ private String columnName;
/* */ private String columnComment;
/* */ private String columnType;
/* */ private String javaType;
/* */ @NotBlank(message = "Java属性不能为空")
/* */ private String javaField;
/* */ private String isPk;
/* */ private String isIncrement;
/* */ private String isRequired;
/* */ private String isInsert;
/* */ private String isEdit;
/* */ private String isList;
/* */ private String isQuery;
/* */ private String queryType;
/* */ private String htmlType;
/* */ private String dictType;
/* */ private Integer sort;
/* */
/* */ public void setColumnId(Long columnId) {
/* 73 */ this.columnId = columnId;
/* */ }
/* */
/* */
/* */ public Long getColumnId() {
/* 78 */ return this.columnId;
/* */ }
/* */
/* */
/* */ public void setTableId(Long tableId) {
/* 83 */ this.tableId = tableId;
/* */ }
/* */
/* */
/* */ public Long getTableId() {
/* 88 */ return this.tableId;
/* */ }
/* */
/* */
/* */ public void setColumnName(String columnName) {
/* 93 */ this.columnName = columnName;
/* */ }
/* */
/* */
/* */ public String getColumnName() {
/* 98 */ return this.columnName;
/* */ }
/* */
/* */
/* */ public void setColumnComment(String columnComment) {
/* 103 */ this.columnComment = columnComment;
/* */ }
/* */
/* */
/* */ public String getColumnComment() {
/* 108 */ return this.columnComment;
/* */ }
/* */
/* */
/* */ public void setColumnType(String columnType) {
/* 113 */ this.columnType = columnType;
/* */ }
/* */
/* */
/* */ public String getColumnType() {
/* 118 */ return this.columnType;
/* */ }
/* */
/* */
/* */ public void setJavaType(String javaType) {
/* 123 */ this.javaType = javaType;
/* */ }
/* */
/* */
/* */ public String getJavaType() {
/* 128 */ return this.javaType;
/* */ }
/* */
/* */
/* */ public void setJavaField(String javaField) {
/* 133 */ this.javaField = javaField;
/* */ }
/* */
/* */
/* */ public String getJavaField() {
/* 138 */ return this.javaField;
/* */ }
/* */
/* */
/* */ public String getCapJavaField() {
/* 143 */ return StringUtils.capitalize(this.javaField);
/* */ }
/* */
/* */
/* */ public void setIsPk(String isPk) {
/* 148 */ this.isPk = isPk;
/* */ }
/* */
/* */
/* */ public String getIsPk() {
/* 153 */ return this.isPk;
/* */ }
/* */
/* */
/* */ public boolean isPk() {
/* 158 */ return isPk(this.isPk);
/* */ }
/* */
/* */
/* */ public boolean isPk(String isPk) {
/* 163 */ return (isPk != null && StringUtils.equals("1", isPk));
/* */ }
/* */
/* */
/* */ public String getIsIncrement() {
/* 168 */ return this.isIncrement;
/* */ }
/* */
/* */
/* */ public void setIsIncrement(String isIncrement) {
/* 173 */ this.isIncrement = isIncrement;
/* */ }
/* */
/* */
/* */ public boolean isIncrement() {
/* 178 */ return isIncrement(this.isIncrement);
/* */ }
/* */
/* */
/* */ public boolean isIncrement(String isIncrement) {
/* 183 */ return (isIncrement != null && StringUtils.equals("1", isIncrement));
/* */ }
/* */
/* */
/* */ public void setIsRequired(String isRequired) {
/* 188 */ this.isRequired = isRequired;
/* */ }
/* */
/* */
/* */ public String getIsRequired() {
/* 193 */ return this.isRequired;
/* */ }
/* */
/* */
/* */ public boolean isRequired() {
/* 198 */ return isRequired(this.isRequired);
/* */ }
/* */
/* */
/* */ public boolean isRequired(String isRequired) {
/* 203 */ return (isRequired != null && StringUtils.equals("1", isRequired));
/* */ }
/* */
/* */
/* */ public void setIsInsert(String isInsert) {
/* 208 */ this.isInsert = isInsert;
/* */ }
/* */
/* */
/* */ public String getIsInsert() {
/* 213 */ return this.isInsert;
/* */ }
/* */
/* */
/* */ public boolean isInsert() {
/* 218 */ return isInsert(this.isInsert);
/* */ }
/* */
/* */
/* */ public boolean isInsert(String isInsert) {
/* 223 */ return (isInsert != null && StringUtils.equals("1", isInsert));
/* */ }
/* */
/* */
/* */ public void setIsEdit(String isEdit) {
/* 228 */ this.isEdit = isEdit;
/* */ }
/* */
/* */
/* */ public String getIsEdit() {
/* 233 */ return this.isEdit;
/* */ }
/* */
/* */
/* */ public boolean isEdit() {
/* 238 */ return isInsert(this.isEdit);
/* */ }
/* */
/* */
/* */ public boolean isEdit(String isEdit) {
/* 243 */ return (isEdit != null && StringUtils.equals("1", isEdit));
/* */ }
/* */
/* */
/* */ public void setIsList(String isList) {
/* 248 */ this.isList = isList;
/* */ }
/* */
/* */
/* */ public String getIsList() {
/* 253 */ return this.isList;
/* */ }
/* */
/* */
/* */ public boolean isList() {
/* 258 */ return isList(this.isList);
/* */ }
/* */
/* */
/* */ public boolean isList(String isList) {
/* 263 */ return (isList != null && StringUtils.equals("1", isList));
/* */ }
/* */
/* */
/* */ public void setIsQuery(String isQuery) {
/* 268 */ this.isQuery = isQuery;
/* */ }
/* */
/* */
/* */ public String getIsQuery() {
/* 273 */ return this.isQuery;
/* */ }
/* */
/* */
/* */ public boolean isQuery() {
/* 278 */ return isQuery(this.isQuery);
/* */ }
/* */
/* */
/* */ public boolean isQuery(String isQuery) {
/* 283 */ return (isQuery != null && StringUtils.equals("1", isQuery));
/* */ }
/* */
/* */
/* */ public void setQueryType(String queryType) {
/* 288 */ this.queryType = queryType;
/* */ }
/* */
/* */
/* */ public String getQueryType() {
/* 293 */ return this.queryType;
/* */ }
/* */
/* */
/* */ public String getHtmlType() {
/* 298 */ return this.htmlType;
/* */ }
/* */
/* */
/* */ public void setHtmlType(String htmlType) {
/* 303 */ this.htmlType = htmlType;
/* */ }
/* */
/* */
/* */ public void setDictType(String dictType) {
/* 308 */ this.dictType = dictType;
/* */ }
/* */
/* */
/* */ public String getDictType() {
/* 313 */ return this.dictType;
/* */ }
/* */
/* */
/* */ public void setSort(Integer sort) {
/* 318 */ this.sort = sort;
/* */ }
/* */
/* */
/* */ public Integer getSort() {
/* 323 */ return this.sort;
/* */ }
/* */
/* */
/* */ public boolean isSuperColumn() {
/* 328 */ return isSuperColumn(this.javaField);
/* */ }
/* */
/* */
/* */ public static boolean isSuperColumn(String javaField) {
/* 333 */ return StringUtils.equalsAnyIgnoreCase(javaField, new CharSequence[] { "createBy", "createTime", "updateBy", "updateTime", "remark", "parentName", "parentId", "orderNum", "ancestors" });
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public boolean isUsableColumn() {
/* 342 */ return isUsableColumn(this.javaField);
/* */ }
/* */
/* */
/* */
/* */ public static boolean isUsableColumn(String javaField) {
/* 348 */ return StringUtils.equalsAnyIgnoreCase(javaField, new CharSequence[] { "parentId", "orderNum", "remark" });
/* */ }
/* */
/* */
/* */ public String readConverterExp() {
/* 353 */ String remarks = StringUtils.substringBetween(this.columnComment, "", "");
/* 354 */ StringBuffer sb = new StringBuffer();
/* 355 */ if (StringUtils.isNotEmpty(remarks)) {
/* */
/* 357 */ for (String value : remarks.split(" ")) {
/* */
/* 359 */ if (StringUtils.isNotEmpty(value)) {
/* */
/* 361 */ Object startStr = value.subSequence(0, 1);
/* 362 */ String endStr = value.substring(1);
/* 363 */ sb.append("").append(startStr).append("=").append(endStr).append(",");
/* */ }
/* */ }
/* 366 */ return sb.deleteCharAt(sb.length() - 1).toString();
/* */ }
/* */
/* */
/* 370 */ return this.columnComment;
/* */ }
/* */ }
import com.archive.common.utils.StringUtils;
import com.archive.framework.web.domain.BaseEntity;
import javax.validation.constraints.NotBlank;
public class GenTableColumn
extends BaseEntity
{
private static final long serialVersionUID = 1L;
private Long columnId;
private Long tableId;
private String columnName;
private String columnComment;
private String columnType;
private String javaType;
@NotBlank(message = "Java属性不能为空")
private String javaField;
private String isPk;
private String isIncrement;
private String isRequired;
private String isInsert;
private String isEdit;
private String isList;
private String isQuery;
private String queryType;
private String htmlType;
private String dictType;
private Integer sort;
public void setColumnId(Long columnId) {
this.columnId = columnId;
}
public Long getColumnId() {
return this.columnId;
}
public void setTableId(Long tableId) {
this.tableId = tableId;
}
public Long getTableId() {
return this.tableId;
}
public void setColumnName(String columnName) {
this.columnName = columnName;
}
public String getColumnName() {
return this.columnName;
}
public void setColumnComment(String columnComment) {
this.columnComment = columnComment;
}
public String getColumnComment() {
return this.columnComment;
}
public void setColumnType(String columnType) {
this.columnType = columnType;
}
public String getColumnType() {
return this.columnType;
}
public void setJavaType(String javaType) {
this.javaType = javaType;
}
public String getJavaType() {
return this.javaType;
}
public void setJavaField(String javaField) {
this.javaField = javaField;
}
public String getJavaField() {
return this.javaField;
}
public String getCapJavaField() {
return StringUtils.capitalize(this.javaField);
}
public void setIsPk(String isPk) {
this.isPk = isPk;
}
public String getIsPk() {
return this.isPk;
}
public boolean isPk() {
return isPk(this.isPk);
}
public boolean isPk(String isPk) {
return (isPk != null && StringUtils.equals("1", isPk));
}
public String getIsIncrement() {
return this.isIncrement;
}
public void setIsIncrement(String isIncrement) {
this.isIncrement = isIncrement;
}
public boolean isIncrement() {
return isIncrement(this.isIncrement);
}
public boolean isIncrement(String isIncrement) {
return (isIncrement != null && StringUtils.equals("1", isIncrement));
}
public void setIsRequired(String isRequired) {
this.isRequired = isRequired;
}
public String getIsRequired() {
return this.isRequired;
}
public boolean isRequired() {
return isRequired(this.isRequired);
}
public boolean isRequired(String isRequired) {
return (isRequired != null && StringUtils.equals("1", isRequired));
}
public void setIsInsert(String isInsert) {
this.isInsert = isInsert;
}
public String getIsInsert() {
return this.isInsert;
}
public boolean isInsert() {
return isInsert(this.isInsert);
}
public boolean isInsert(String isInsert) {
return (isInsert != null && StringUtils.equals("1", isInsert));
}
public void setIsEdit(String isEdit) {
this.isEdit = isEdit;
}
public String getIsEdit() {
return this.isEdit;
}
public boolean isEdit() {
return isInsert(this.isEdit);
}
public boolean isEdit(String isEdit) {
return (isEdit != null && StringUtils.equals("1", isEdit));
}
public void setIsList(String isList) {
this.isList = isList;
}
public String getIsList() {
return this.isList;
}
public boolean isList() {
return isList(this.isList);
}
public boolean isList(String isList) {
return (isList != null && StringUtils.equals("1", isList));
}
public void setIsQuery(String isQuery) {
this.isQuery = isQuery;
}
public String getIsQuery() {
return this.isQuery;
}
public boolean isQuery() {
return isQuery(this.isQuery);
}
public boolean isQuery(String isQuery) {
return (isQuery != null && StringUtils.equals("1", isQuery));
}
public void setQueryType(String queryType) {
this.queryType = queryType;
}
public String getQueryType() {
return this.queryType;
}
public String getHtmlType() {
return this.htmlType;
}
public void setHtmlType(String htmlType) {
this.htmlType = htmlType;
}
public void setDictType(String dictType) {
this.dictType = dictType;
}
public String getDictType() {
return this.dictType;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Integer getSort() {
return this.sort;
}
public boolean isSuperColumn() {
return isSuperColumn(this.javaField);
}
public static boolean isSuperColumn(String javaField) {
return StringUtils.equalsAnyIgnoreCase(javaField, new CharSequence[] { "createBy", "createTime", "updateBy", "updateTime", "remark", "parentName", "parentId", "orderNum", "ancestors" });
}
public boolean isUsableColumn() {
return isUsableColumn(this.javaField);
}
public static boolean isUsableColumn(String javaField) {
return StringUtils.equalsAnyIgnoreCase(javaField, new CharSequence[] { "parentId", "orderNum", "remark" });
}
public String readConverterExp() {
String remarks = StringUtils.substringBetween(this.columnComment, "", "");
StringBuffer sb = new StringBuffer();
if (StringUtils.isNotEmpty(remarks)) {
for (String value : remarks.split(" ")) {
if (StringUtils.isNotEmpty(value)) {
Object startStr = value.subSequence(0, 1);
String endStr = value.substring(1);
sb.append("").append(startStr).append("=").append(endStr).append(",");
}
}
return sb.deleteCharAt(sb.length() - 1).toString();
}
return this.columnComment;
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\tool\gen\domain\GenTableColumn.class

@ -1,73 +1,73 @@
/* */ package com.archive.project.tool.gen.service
package com.archive.project.tool.gen.service
;
/* */
/* */ import com.archive.common.utils.text.Convert;
/* */ import com.archive.project.tool.gen.domain.GenTableColumn;
/* */ import com.archive.project.tool.gen.mapper.GenTableColumnMapper;
/* */ import com.archive.project.tool.gen.service.IGenTableColumnService;
/* */ import java.util.List;
/* */ import org.springframework.beans.factory.annotation.Autowired;
/* */ import org.springframework.stereotype.Service;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @Service
/* */ public class GenTableColumnServiceImpl
/* */ implements IGenTableColumnService
/* */ {
/* */ @Autowired
/* */ private GenTableColumnMapper genTableColumnMapper;
/* */
/* */ public List<GenTableColumn> selectGenTableColumnListByTableId(GenTableColumn genTableColumn) {
/* 30 */ return this.genTableColumnMapper.selectGenTableColumnListByTableId(genTableColumn);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public int insertGenTableColumn(GenTableColumn genTableColumn) {
/* 42 */ return this.genTableColumnMapper.insertGenTableColumn(genTableColumn);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public int updateGenTableColumn(GenTableColumn genTableColumn) {
/* 54 */ return this.genTableColumnMapper.updateGenTableColumn(genTableColumn);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public int deleteGenTableColumnByIds(String ids) {
/* 66 */ return this.genTableColumnMapper.deleteGenTableColumnByIds(Convert.toLongArray(ids));
/* */ }
/* */ }
import com.archive.common.utils.text.Convert;
import com.archive.project.tool.gen.domain.GenTableColumn;
import com.archive.project.tool.gen.mapper.GenTableColumnMapper;
import com.archive.project.tool.gen.service.IGenTableColumnService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class GenTableColumnServiceImpl
implements IGenTableColumnService
{
@Autowired
private GenTableColumnMapper genTableColumnMapper;
public List<GenTableColumn> selectGenTableColumnListByTableId(GenTableColumn genTableColumn) {
return this.genTableColumnMapper.selectGenTableColumnListByTableId(genTableColumn);
}
public int insertGenTableColumn(GenTableColumn genTableColumn) {
return this.genTableColumnMapper.insertGenTableColumn(genTableColumn);
}
public int updateGenTableColumn(GenTableColumn genTableColumn) {
return this.genTableColumnMapper.updateGenTableColumn(genTableColumn);
}
public int deleteGenTableColumnByIds(String ids) {
return this.genTableColumnMapper.deleteGenTableColumnByIds(Convert.toLongArray(ids));
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\tool\gen\service\GenTableColumnServiceImpl.class

@ -1,257 +1,257 @@
/* */ package com.archive.project.tool.gen.util
package com.archive.project.tool.gen.util
;
/* */
/* */ import com.archive.common.constant.GenConstants;
/* */ import com.archive.common.utils.StringUtils;
/* */ import com.archive.framework.config.GenConfig;
/* */ import com.archive.project.tool.gen.domain.GenTable;
/* */ import com.archive.project.tool.gen.domain.GenTableColumn;
/* */ import java.util.Arrays;
/* */ import org.apache.commons.lang3.RegExUtils;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class GenUtils
/* */ {
/* */ public static void initTable(GenTable genTable, String operName) {
/* 23 */ genTable.setClassName(convertClassName(genTable.getTableName()));
/* 24 */ genTable.setPackageName(GenConfig.getPackageName());
/* 25 */ genTable.setModuleName(getModuleName(GenConfig.getPackageName()));
/* 26 */ genTable.setBusinessName(getBusinessName(genTable.getTableName()));
/* 27 */ genTable.setFunctionName(replaceText(genTable.getTableComment()));
/* 28 */ genTable.setFunctionAuthor(GenConfig.getAuthor());
/* 29 */ genTable.setCreateBy(operName);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public static void initColumnField(GenTableColumn column, GenTable table) {
/* 37 */ String dataType = getDbType(column.getColumnType());
/* 38 */ String columnName = column.getColumnName();
/* 39 */ column.setTableId(table.getTableId());
/* 40 */ column.setCreateBy(table.getCreateBy());
/* */
/* 42 */ column.setJavaField(StringUtils.toCamelCase(columnName));
/* */
/* 44 */ column.setJavaType("String");
/* */
/* 46 */ if (arraysContains(GenConstants.COLUMNTYPE_STR, dataType) || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType)) {
/* */
/* */
/* 49 */ Integer columnLength = getColumnLength(column.getColumnType());
/* 50 */ String htmlType = (columnLength.intValue() >= 500 || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType)) ? "textarea" : "input";
/* 51 */ column.setHtmlType(htmlType);
/* */ }
/* 53 */ else if (arraysContains(GenConstants.COLUMNTYPE_TIME, dataType)) {
/* */
/* 55 */ column.setJavaType("Date");
/* 56 */ column.setHtmlType("datetime");
/* */ }
/* 58 */ else if (arraysContains(GenConstants.COLUMNTYPE_NUMBER, dataType)) {
/* */
/* 60 */ column.setHtmlType("input");
/* */
/* */
/* 63 */ String[] str = StringUtils.split(StringUtils.substringBetween(column.getColumnType(), "(", ")"), ",");
/* 64 */ if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0) {
/* */
/* 66 */ column.setJavaType("BigDecimal");
/* */
/* */ }
/* 69 */ else if (str != null && str.length == 1 && Integer.parseInt(str[0]) <= 10) {
/* */
/* 71 */ column.setJavaType("Integer");
/* */
/* */ }
/* */ else {
/* */
/* 76 */ column.setJavaType("Long");
/* */ }
/* */ }
/* */
/* */
/* 81 */ column.setIsInsert("1");
/* */
/* */
/* 84 */ if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName) && !column.isPk())
/* */ {
/* 86 */ column.setIsEdit("1");
/* */ }
/* */
/* 89 */ if (!arraysContains(GenConstants.COLUMNNAME_NOT_LIST, columnName) && !column.isPk())
/* */ {
/* 91 */ column.setIsList("1");
/* */ }
/* */
/* 94 */ if (!arraysContains(GenConstants.COLUMNNAME_NOT_QUERY, columnName) && !column.isPk())
/* */ {
/* 96 */ column.setIsQuery("1");
/* */ }
/* */
/* */
/* 100 */ if (StringUtils.endsWithIgnoreCase(columnName, "name"))
/* */ {
/* 102 */ column.setQueryType("LIKE");
/* */ }
/* */
/* 105 */ if (StringUtils.endsWithIgnoreCase(columnName, "status")) {
/* */
/* 107 */ column.setHtmlType("radio");
/* */
/* */ }
/* 110 */ else if (StringUtils.endsWithIgnoreCase(columnName, "type") ||
/* 111 */ StringUtils.endsWithIgnoreCase(columnName, "sex")) {
/* */
/* 113 */ column.setHtmlType("select");
/* */
/* */ }
/* 116 */ else if (StringUtils.endsWithIgnoreCase(columnName, "file")) {
/* */
/* 118 */ column.setHtmlType("upload");
/* */
/* */ }
/* 121 */ else if (StringUtils.endsWithIgnoreCase(columnName, "content")) {
/* */
/* 123 */ column.setHtmlType("summernote");
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static boolean arraysContains(String[] arr, String targetValue) {
/* 136 */ return Arrays.<String>asList(arr).contains(targetValue);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static String getModuleName(String packageName) {
/* 147 */ int lastIndex = packageName.lastIndexOf(".");
/* 148 */ int nameLength = packageName.length();
/* 149 */ String moduleName = StringUtils.substring(packageName, lastIndex + 1, nameLength);
/* 150 */ return moduleName;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static String getBusinessName(String tableName) {
/* 161 */ int lastIndex = tableName.lastIndexOf("_");
/* 162 */ int nameLength = tableName.length();
/* 163 */ String businessName = StringUtils.substring(tableName, lastIndex + 1, nameLength);
/* 164 */ return businessName;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static String convertClassName(String tableName) {
/* 175 */ boolean autoRemovePre = GenConfig.getAutoRemovePre();
/* 176 */ String tablePrefix = GenConfig.getTablePrefix();
/* 177 */ if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) {
/* */
/* 179 */ String[] searchList = StringUtils.split(tablePrefix, ",");
/* 180 */ tableName = replaceFirst(tableName, searchList);
/* */ }
/* 182 */ return StringUtils.convertToCamelCase(tableName);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static String replaceFirst(String replacementm, String[] searchList) {
/* 194 */ String text = replacementm;
/* 195 */ for (String searchString : searchList) {
/* */
/* 197 */ if (replacementm.startsWith(searchString)) {
/* */
/* 199 */ text = replacementm.replaceFirst(searchString, "");
/* */ break;
/* */ }
/* */ }
/* 203 */ return text;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static String replaceText(String text) {
/* 214 */ return RegExUtils.replaceAll(text, "(?:表|Tale)", "");
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static String getDbType(String columnType) {
/* 225 */ if (StringUtils.indexOf(columnType, "(") > 0)
/* */ {
/* 227 */ return StringUtils.substringBefore(columnType, "(");
/* */ }
/* */
/* */
/* 231 */ return columnType;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static Integer getColumnLength(String columnType) {
/* 243 */ if (StringUtils.indexOf(columnType, "(") > 0) {
/* */
/* 245 */ String length = StringUtils.substringBetween(columnType, "(", ")");
/* 246 */ return Integer.valueOf(length);
/* */ }
/* */
/* */
/* 250 */ return Integer.valueOf(0);
/* */ }
/* */ }
import com.archive.common.constant.GenConstants;
import com.archive.common.utils.StringUtils;
import com.archive.framework.config.GenConfig;
import com.archive.project.tool.gen.domain.GenTable;
import com.archive.project.tool.gen.domain.GenTableColumn;
import java.util.Arrays;
import org.apache.commons.lang3.RegExUtils;
public class GenUtils
{
public static void initTable(GenTable genTable, String operName) {
genTable.setClassName(convertClassName(genTable.getTableName()));
genTable.setPackageName(GenConfig.getPackageName());
genTable.setModuleName(getModuleName(GenConfig.getPackageName()));
genTable.setBusinessName(getBusinessName(genTable.getTableName()));
genTable.setFunctionName(replaceText(genTable.getTableComment()));
genTable.setFunctionAuthor(GenConfig.getAuthor());
genTable.setCreateBy(operName);
}
public static void initColumnField(GenTableColumn column, GenTable table) {
String dataType = getDbType(column.getColumnType());
String columnName = column.getColumnName();
column.setTableId(table.getTableId());
column.setCreateBy(table.getCreateBy());
column.setJavaField(StringUtils.toCamelCase(columnName));
column.setJavaType("String");
if (arraysContains(GenConstants.COLUMNTYPE_STR, dataType) || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType)) {
Integer columnLength = getColumnLength(column.getColumnType());
String htmlType = (columnLength.intValue() >= 500 || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType)) ? "textarea" : "input";
column.setHtmlType(htmlType);
}
else if (arraysContains(GenConstants.COLUMNTYPE_TIME, dataType)) {
column.setJavaType("Date");
column.setHtmlType("datetime");
}
else if (arraysContains(GenConstants.COLUMNTYPE_NUMBER, dataType)) {
column.setHtmlType("input");
String[] str = StringUtils.split(StringUtils.substringBetween(column.getColumnType(), "(", ")"), ",");
if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0) {
column.setJavaType("BigDecimal");
}
else if (str != null && str.length == 1 && Integer.parseInt(str[0]) <= 10) {
column.setJavaType("Integer");
}
else {
column.setJavaType("Long");
}
}
column.setIsInsert("1");
if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName) && !column.isPk())
{
column.setIsEdit("1");
}
if (!arraysContains(GenConstants.COLUMNNAME_NOT_LIST, columnName) && !column.isPk())
{
column.setIsList("1");
}
if (!arraysContains(GenConstants.COLUMNNAME_NOT_QUERY, columnName) && !column.isPk())
{
column.setIsQuery("1");
}
if (StringUtils.endsWithIgnoreCase(columnName, "name"))
{
column.setQueryType("LIKE");
}
if (StringUtils.endsWithIgnoreCase(columnName, "status")) {
column.setHtmlType("radio");
}
else if (StringUtils.endsWithIgnoreCase(columnName, "type") ||
StringUtils.endsWithIgnoreCase(columnName, "sex")) {
column.setHtmlType("select");
}
else if (StringUtils.endsWithIgnoreCase(columnName, "file")) {
column.setHtmlType("upload");
}
else if (StringUtils.endsWithIgnoreCase(columnName, "content")) {
column.setHtmlType("summernote");
}
}
public static boolean arraysContains(String[] arr, String targetValue) {
return Arrays.<String>asList(arr).contains(targetValue);
}
public static String getModuleName(String packageName) {
int lastIndex = packageName.lastIndexOf(".");
int nameLength = packageName.length();
String moduleName = StringUtils.substring(packageName, lastIndex + 1, nameLength);
return moduleName;
}
public static String getBusinessName(String tableName) {
int lastIndex = tableName.lastIndexOf("_");
int nameLength = tableName.length();
String businessName = StringUtils.substring(tableName, lastIndex + 1, nameLength);
return businessName;
}
public static String convertClassName(String tableName) {
boolean autoRemovePre = GenConfig.getAutoRemovePre();
String tablePrefix = GenConfig.getTablePrefix();
if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) {
String[] searchList = StringUtils.split(tablePrefix, ",");
tableName = replaceFirst(tableName, searchList);
}
return StringUtils.convertToCamelCase(tableName);
}
public static String replaceFirst(String replacementm, String[] searchList) {
String text = replacementm;
for (String searchString : searchList) {
if (replacementm.startsWith(searchString)) {
text = replacementm.replaceFirst(searchString, "");
break;
}
}
return text;
}
public static String replaceText(String text) {
return RegExUtils.replaceAll(text, "(?:表|Tale)", "");
}
public static String getDbType(String columnType) {
if (StringUtils.indexOf(columnType, "(") > 0)
{
return StringUtils.substringBefore(columnType, "(");
}
return columnType;
}
public static Integer getColumnLength(String columnType) {
if (StringUtils.indexOf(columnType, "(") > 0) {
String length = StringUtils.substringBetween(columnType, "(", ")");
return Integer.valueOf(length);
}
return Integer.valueOf(0);
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\tool\ge\\util\GenUtils.class

Loading…
Cancel
Save