微信消息推送
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.8 KiB

/*
* *
* * @Project HM OA
* * @Name DesEncrypt
* * @Author 张剑峰
* * @Date 18-4-15 下午11:02
* * @Version v1.0.0
* * @Copyright @ 2017 云南道睿科技有限公司 All rights reserved.
*
*/
package com.ynxbd.push.helper;
import java.io.File;
import java.util.regex.Matcher;
/**
* @author Administrator
* @version v1.0.0
* @date Oct 10, 2009 11:24:26 AM
*/
public class DesEncryptHelper {
private static final String KEY = "2018ynhm8321";
/**
* 加密
*
* @param s 加密的字符串
* @return 加密后的字符
*/
public static String enCode(String s) {
return new DesHelper().stringEnc(s, KEY);
}
/**
* 解密
*
* @param s 需要解密的字符串
* @return 解密后的内容
*/
public static String deCode(String s) {
return new DesHelper().stringDec(s, KEY);
}
/**
* 自定义key的加密
*
* @param s
* @param strKey 自定义的key
* @return
*/
public static String enCode(String s, String strKey) {
return new DesHelper().stringEnc(s, strKey);
}
/**
* 自定义key的解密
*
* @param s
* @param strKey 自定义的key
* @return
*/
public static String deCode(String s, String strKey) {
return new DesHelper().stringDec(s, strKey);
}
public static char[] enCodeChar(String s, String strKey) {
return new DesHelper().charEnc(s, strKey);
}
public static char[] deCodeChar(String s, String strKey) {
return new DesHelper().charDec(s, strKey);
}
public static void main(String[] args) {
String test = "昨日门诊:3697人次;非核酸门诊:2302人次;在院:1377人;入院:224人;出院:191人;危重:0人;手术:61人次;微创手术:16人次;四级手术:6人次;\\\\r\\\\n今年截至昨日门诊:794298人次;非核酸门诊:423528人次;出院:32130人;实际开放床:1224张;病床使用率:91.512;手术:8816人次,占比:28;四级手术占比:19.01;微创手术占比:17.35;";
System.out.println(test.replaceAll("\\\\\\\\r", "\\\\r"));
System.out.println(DesEncryptHelper.enCode("xbd_CVMS", KEY));
System.out.println(DesEncryptHelper.deCode("C23A7500D2C35F9A85B72795B86F02AFD62A5ECBD06DC050DF47EFA26AA846E3E3FF998FFA576283C021712DD1CAA7EEF74898A8CDFE9ABA8C06C1851574CB802FA096B4B0D8ED791559DEEDFE0BD497AC5365E6370223EF3D706F0BC2427619C762C77B776510D566A36F439CB579A5C55674435F0D800BC44B3299BF484B716D121601D32E26E2", KEY));
System.out.println("---");
System.out.println(DesEncryptHelper.enCode("永胜县人民医院"));
System.out.println("---------");
System.out.println(DesEncryptHelper.deCode(DesEncryptHelper.enCode("永胜县人民医院")));
}
}