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.
91 lines
3.3 KiB
Plaintext
91 lines
3.3 KiB
Plaintext
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
|
|
|
<%@ page import="weaver.general.Util,weaver.conn.RecordSet" %>
|
|
<%@ page import="weaver.hrm.HrmUserVarify" %>
|
|
<%@ page import="weaver.hrm.User" %>
|
|
<%@ page import="java.nio.charset.StandardCharsets" %>
|
|
<%@ page import="javax.crypto.spec.SecretKeySpec" %>
|
|
<%@ page import="javax.xml.bind.DatatypeConverter" %>
|
|
<%@ page import="java.security.NoSuchAlgorithmException" %>
|
|
<%@ page import="java.security.InvalidKeyException" %>
|
|
<%@ page import="javax.crypto.*" %>
|
|
<%@ page import="org.apache.commons.lang3.StringUtils" %>
|
|
<jsp:useBean id="ResourceComInfo" class="weaver.hrm.resource.ResourceComInfo" scope="page"/>
|
|
<%
|
|
String secretKey = "httpsoanjycjtcom";
|
|
|
|
User user = HrmUserVarify.getUser (request,response);
|
|
RecordSet rs = new RecordSet();
|
|
|
|
String pcurlsrc = "";
|
|
String userid = user.getUID()+"";
|
|
String workcode = ResourceComInfo.getWorkcode(userid);
|
|
String tododataid = request.getParameter("tododataid");
|
|
String isremark = request.getParameter("isremark");
|
|
|
|
if( "0".equals(isremark) || "8".equals(isremark)){
|
|
rs.executeQuery("select * from ofs_todo_data where id = ?",tododataid);
|
|
rs.next();
|
|
pcurlsrc = Util.null2String(rs.getString("pcurlsrc"));
|
|
}else{
|
|
rs.executeQuery("select * from ofs_done_data where id = ?",tododataid);
|
|
rs.next();
|
|
pcurlsrc = Util.null2String(rs.getString("pcurlsrc"));
|
|
}
|
|
|
|
String token = "";
|
|
if(StringUtils.isNotBlank(workcode)){
|
|
token = encryptAES(secretKey,workcode);
|
|
}
|
|
|
|
if(StringUtils.isNotBlank(token)){
|
|
if(pcurlsrc.contains("#")) {
|
|
String[] split = pcurlsrc.split("#");
|
|
if(split[0].contains("?")){
|
|
pcurlsrc = split[0] + "&Token=" + token + "#" + split[1];
|
|
}else{
|
|
pcurlsrc = split[0] + "?Token=" + token + "#" + split[1];
|
|
}
|
|
}else if(pcurlsrc.contains("?")){
|
|
pcurlsrc = pcurlsrc + "&Token=" + token ;
|
|
}else{
|
|
pcurlsrc = pcurlsrc + "?Token=" + token ;
|
|
}
|
|
}
|
|
%>
|
|
<script type="text/javascript">
|
|
location.replace('<%=pcurlsrc%>');
|
|
</script>
|
|
|
|
|
|
<%!
|
|
/**
|
|
* AES加密字符串
|
|
* @return 加密后内容
|
|
*/
|
|
public String encryptAES(String password,String data) {
|
|
String ALGORITHM = "AES";
|
|
String encrtptData = "" ;
|
|
try {
|
|
byte[] keyBytes = password.getBytes(StandardCharsets.UTF_8); // 生成随机的16字节密钥
|
|
SecretKey secretKey = new SecretKeySpec(keyBytes, ALGORITHM); // 创建SecretKey对象
|
|
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
|
|
cipher.init(Cipher.ENCRYPT_MODE, secretKey); // 初始化加密器
|
|
byte[] encryptedBytes = cipher.doFinal(data.getBytes());
|
|
encrtptData = DatatypeConverter.printHexBinary(encryptedBytes);
|
|
} catch (NoSuchAlgorithmException e) {
|
|
e.printStackTrace();
|
|
} catch (NoSuchPaddingException e) {
|
|
e.printStackTrace();
|
|
}catch (InvalidKeyException e) {
|
|
e.printStackTrace();
|
|
} catch (IllegalBlockSizeException e) {
|
|
e.printStackTrace();
|
|
} catch (BadPaddingException e) {
|
|
e.printStackTrace();
|
|
}
|
|
return encrtptData ;
|
|
}
|
|
%>
|
|
|