You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

132 lines
4.5 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<%@ page import="java.io.FileInputStream" %>
<%@ page import="java.net.URLEncoder" %>
<%@ page import="com.api.login.util.LoginUtil" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="com.icbc.api.internal.apache.http.impl.cookie.S" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="java.time.LocalDate" %>
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.general.StringUtil" %>
<%@ page import="java.security.MessageDigest" %>
<%@ page import="java.security.NoSuchAlgorithmException" %>
<%@ page import="weaver.systeminfo.SystemEnv" %>
<%@ page import="java.math.BigInteger" %>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.Timestamp" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
Map<String, Object> param = ParamUtil.request2Map(request);
String systemid = (String) param.get("systemid");
String d_password = (String) param.get("pwd");
//当前日期
String currentDate = getCurrentDate();
//当前时间
String currentTime = getCurrentTime();
//获取时间戳
String currentTimeTamp = getTimestamp();
String md5Source = systemid+d_password+currentTimeTamp;
String md5OfStr = getMD5Str(md5Source).toLowerCase();
out.print("currentDate : "+currentDate);
out.print(" \n");
out.print("currentTime : "+currentTime);
out.print(" \n");
out.print("systemid : "+systemid);
out.print(" \n");
out.print("d_password : "+d_password);
out.print(" \n");
out.print("currentTimeTamp : "+currentTimeTamp);
out.print(" \n");
out.print("md5OfStr : "+md5OfStr);
out.print(" \n");
%>
<%!
public String getMD5Str(String plainText){
//定义一个字节数组
byte[] secretBytes = null;
try {
// 生成一个MD5加密计算摘要
MessageDigest md = MessageDigest.getInstance("MD5");
//对字符串进行加密
md.update(plainText.getBytes());
//获得加密后的数据
secretBytes = md.digest();
} catch (NoSuchAlgorithmException e) {
//throw new RuntimeException("没有md5这个算法");
throw new RuntimeException(SystemEnv.getHtmlLabelName(517545,7));
}
//将加密后的数据转换为16进制数字
String md5code = new BigInteger(1, secretBytes).toString(16);
// 如果生成数字未满32位需要前面补0
// 不能把变量放到循环条件值改变之后会导致条件变化。如果生成30位 只能生成31位md5
int tempIndex = 32 - md5code.length();
for (int i = 0; i < tempIndex; i++) {
md5code = "0" + md5code;
}
return md5code;
}
public static String getCurrentTime() {
Date newdate = new Date();
long datetime = newdate.getTime();
Timestamp timestamp = new Timestamp(datetime);
String currenttime = (timestamp.toString()).substring(11, 13) + ":" + (timestamp.toString()).substring(14, 16) + ":"
+ (timestamp.toString()).substring(17, 19);
return currenttime;
}
public static String getCurrentDate() {
Date newdate = new Date();
long datetime = newdate.getTime();
Timestamp timestamp = new Timestamp(datetime);
String currentdate = (timestamp.toString()).substring(0, 4) + "-" + (timestamp.toString()).substring(5, 7) + "-"
+ (timestamp.toString()).substring(8, 10);
return currentdate;
}
/**
* 获取当前日期时间。 YYYY-MM-DD HH:MM:SS
* @return 当前日期时间
*/
public static String getCurDateTime() {
Date newdate = new Date();
long datetime = newdate.getTime();
Timestamp timestamp = new Timestamp(datetime);
return (timestamp.toString()).substring(0, 19);
}
/**
* 获取时间戳 格式如19990101235959
* @return
*/
public static String getTimestamp(){
return getCurDateTime().replace("-", "").replace(":", "").replace(" ", "");
}
public static int getIntValue(String v, int def) {
try {
return Integer.parseInt(v);
} catch (Exception ex) {
return def;
}
}
public static String null2String(Object s) {
return s == null ? "" : s.toString();
}
%>