From fa00382db413a8489d07983b66f0869305b51a9a Mon Sep 17 00:00:00 2001 From: 81041 <81041@DESKTOP-025NVD9> Date: 星期五, 11 一月 2019 11:35:54 +0800 Subject: [PATCH] 批量读取系统参数 --- gx_tieta/src/com/fgkj/actions/ActionUtil.java | 64 ++++++++++++++++++++++++++++++- 1 files changed, 61 insertions(+), 3 deletions(-) diff --git a/gx_tieta/src/com/fgkj/actions/ActionUtil.java b/gx_tieta/src/com/fgkj/actions/ActionUtil.java index e1ae3c5..edb0b51 100644 --- a/gx_tieta/src/com/fgkj/actions/ActionUtil.java +++ b/gx_tieta/src/com/fgkj/actions/ActionUtil.java @@ -1,5 +1,6 @@ package com.fgkj.actions; +import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; @@ -32,6 +33,10 @@ public class ActionUtil extends ActionSupport{ public static String time_yyyyMMddHHmmss = "yyyy-MM-dd HH:mm:ss"; + + + + public String key; //璺ㄥ煙璇嗗埆鐮� /* * 鑾峰彇HttpServletRequest @@ -244,9 +249,6 @@ return new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss").format(c.getTime()); } - public static void main(String[] args) { - System.out.println(ActionUtil.EncryptionMD5("vip")); - } //鑾峰彇鏃堕棿鐨勫勾浠� public static int getDateYear(Date date){ @@ -473,4 +475,60 @@ return b; } + + /** + * 鍏佽璺ㄥ煙璇锋眰 + */ + public static void isAllowHeaders(){ + HttpServletResponse res = getResponse(); + res.setHeader("Access-Control-Allow-Origin", "*"); //鍏佽璺ㄥ煙璁块棶 + res.setHeader("Access-Control-Allow-Headers", "X-Requested-With,content-type,token"); + res.setHeader("Access-Control-Allow-Methods", "GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, PATCH"); + } + + + + public void setKey(String key) { + this.key = key; + } + + /** + * 鍒涘缓鎸囧畾鐨勬枃浠舵枃浠讹紝鑻ヤ笉瀛樺湪鍒欏厛鍒涘缓鎸囧畾鐨勬枃浠跺す鍐嶅垱寤烘寚瀹氱殑鏂囦欢 + * @param filePath + */ + public static void createFileRootIFNotExist(String filePath){ + File f = new File(filePath); + if(!f.exists()){ + if(!f.getParentFile().exists()){ + f.getParentFile().mkdirs(); + } + try { + f.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + /** + * 鍒涘缓鎸囧畾鐨勬枃浠舵枃浠讹紝鑻ヤ笉瀛樺湪鍒欏厛鍒涘缓鎸囧畾鐨勬枃浠跺す鍐嶅垱寤烘寚瀹氱殑鏂囦欢 + * @param filePath + */ + public static void createFilefolderIFNotExist(String filePath){ + File f = new File(filePath); + if(!f.exists()){ + if(!f.getParentFile().exists()){ + f.getParentFile().mkdirs(); + } + } + } + + + public static void main(String[] args) { + String str = "绂忓厜鐢靛瓙"; + //System.out.println(EncryptionMD5(EncryptionMD5(str))); + + + createFilefolderIFNotExist("d:/aaaa/aaaa/aaaa/aaaa/ddd.txt"); + } } -- Gitblit v1.9.1