no message

master
rengp 2 years ago
commit 836f2b40af

@ -0,0 +1,641 @@
<%--
Created by IntelliJ IDEA.
User: xvshanshan
Date: 2023/7/3
Time: 9:23
To change this template use File | Settings | File Templates.
--%>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page import="java.util.regex.Pattern" %>
<%@ page import="java.util.regex.Matcher" %>
<%@ page import="java.io.*" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ page import="org.apache.http.impl.client.CloseableHttpClient" %>
<%@ page import="org.apache.http.impl.client.HttpClients" %>
<%@ page import="org.apache.http.client.methods.HttpPost" %>
<%@ page import="com.alibaba.fastjson.JSON" %>
<%@ page import="org.apache.http.entity.StringEntity" %>
<%@ page import="org.apache.http.client.methods.CloseableHttpResponse" %>
<%@ page import="org.apache.http.HttpStatus" %>
<%@ page import="org.apache.http.HttpEntity" %>
<%@ page import="org.apache.http.util.EntityUtils" %>
<%@ page import="org.apache.http.client.ClientProtocolException" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="java.net.URL" %>
<%@ page import="java.net.HttpURLConnection" %>
<%@ page import="org.apache.http.HttpException" %>
<%@ page import="org.apache.http.client.HttpClient" %>
<%@ page import="org.apache.commons.httpclient.methods.PostMethod" %>
<%@ page import="org.apache.commons.httpclient.params.HttpMethodParams" %>
<%@ page import="org.apache.http.NameValuePair" %>
<%@ page import="org.apache.http.message.BasicNameValuePair" %>
<%@ page import="org.apache.http.client.entity.UrlEncodedFormEntity" %>
<%@ page import="weaver.rsa.security.RSA" %>
<%@ page import="java.security.interfaces.RSAPublicKey" %>
<%@ page import="java.security.KeyFactory" %>
<%@ page import="java.security.spec.X509EncodedKeySpec" %>
<%@ page import="javax.crypto.Cipher" %>
<%@ page import="org.apache.commons.codec.binary.Base64" %>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ page import="org.apache.http.impl.client.HttpClientBuilder" %>
<%@ page import="org.apache.http.client.methods.HttpGet" %>
<%!
//获取分页sql
public static String getPaginationSql(String sql, String orderby, int pageNo, int pageSize) {
String execSql = "";
RecordSet rs = new RecordSet();
String dbType = rs.getDBType();
// String dbType = "oracle";
// String dbType = "sqlserver";
int firstResult = 0;
int endResult = 0;
// 返回分页sql
if("oracle".equals(dbType)){ // rownum
firstResult = pageNo * pageSize + 1;
endResult = (pageNo - 1) * pageSize;
execSql = " select * from ( select tabUN2.*,rownum as my_rownum from ( select tableUN.*,rownum as r from ( " + sql
+ orderby + ") tableUN " + ") tabUN2 where r < " + firstResult + " ) where my_rownum > " + endResult;
}else if("sqlserver".equals(dbType)){
sql="select *,row_number()OVER("+orderby+") as rn from ("+sql+") newt";
execSql = "select * from ( " +
sql+")fy " +
" where rn between ("+pageNo+"-1)*"+pageSize+"+1 and "+pageNo+"*"+pageSize+" ";
}else { // 使用 ROW_NUMBER OVER()分页
firstResult = pageNo * pageSize + 1;
endResult = (pageNo - 1) * pageSize;
execSql = " select * from ( select tabUN2.*,rownum as my_rownum from ( select tableUN.*,rownum as r from ( " + sql
+ orderby +") tableUN ) tabUN2 where r < " + firstResult + " ) where my_rownum > " + endResult;
}
rs.writeLog("execSql---->"+execSql);
return execSql;
}
private boolean isEmpty(String str) {
if ("".equals(str) ||"(null)".equals(str) || str == null) {
return true;
} else {
return false;
}
}
/**
* 获取指定类型的src值的集合
* @param htmlStr
* @param type 标签名称
* @return
*/
public static Set<String> getSrcStr(String htmlStr, String type) {
Set<String> srcs = new HashSet<String>();
String src = "";
Pattern p_src;
Matcher m_src;
// String regEx_img = "<img.*src=(.*?)[^>]*?>"; //图片链接地址
String regEx_src = "<"+type+".*src\\s*=\\s*(.*?)[^>]*?>";
p_src = Pattern.compile
(regEx_src, Pattern.CASE_INSENSITIVE);
m_src = p_src.matcher(htmlStr);
while (m_src.find()) {
// 得到<img />数据
src = m_src.group();
// 匹配<img>中的src数据
Matcher m = Pattern.compile("src\\s*=\\s*\"?(.*?)(\"|>|\\s+)").matcher(src);
while (m.find()) {
srcs.add(m.group(1));
}
}
return srcs;
}
public User getUser(int uid){
User user = new User();
RecordSet rs = new RecordSet();
if (uid == 1)
rs.executeQuery("select * from hrmresourcemanager where id=?", uid);
else {
rs.executeQuery("select * from hrmresource where id=?", uid);
}
String userid = "";
if (rs.next()) {
userid = rs.getString("id");
user.setUid(rs.getInt("id"));
user.setLogintype("1");
user.setLoginid(rs.getString("loginid"));
user.setFirstname(rs.getString("firstname"));
user.setLastname(rs.getString("lastname"));
user.setAliasname(rs.getString("aliasname"));
user.setTitle(rs.getString("title"));
user.setTitlelocation(rs.getString("titlelocation"));
user.setSex(rs.getString("sex"));
String langid = rs.getString("systemlanguage");
user.setLanguage(Util.getIntValue(langid, 0));
user.setTelephone(rs.getString("telephone"));
user.setMobile(rs.getString("mobile"));
user.setMobilecall(rs.getString("mobilecall"));
user.setEmail(rs.getString("email"));
user.setCountryid(rs.getString("countryid"));
user.setLocationid(rs.getString("locationid"));
user.setResourcetype(rs.getString("resourcetype"));
user.setStartdate(rs.getString("startdate"));
user.setEnddate(rs.getString("enddate"));
user.setContractdate(rs.getString("contractdate"));
user.setJobtitle(rs.getString("jobtitle"));
user.setJobgroup(rs.getString("jobgroup"));
user.setJobactivity(rs.getString("jobactivity"));
user.setJoblevel(rs.getString("joblevel"));
user.setSeclevel(rs.getString("seclevel"));
user.setUserDepartment(Util.getIntValue(rs.getString("departmentid"),0));
user.setUserSubCompany1(Util.getIntValue(rs.getString("subcompanyid1"),0));
user.setUserSubCompany2(Util.getIntValue(rs.getString("subcompanyid2"),0));
user.setUserSubCompany3(Util.getIntValue(rs.getString("subcompanyid3"),0));
user.setUserSubCompany4(Util.getIntValue(rs.getString("subcompanyid4"),0));
user.setManagerid(rs.getString("managerid"));
user.setAssistantid(rs.getString("assistantid"));
user.setPurchaselimit(rs.getString("purchaselimit"));
user.setCurrencyid(rs.getString("currencyid"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String lastLoginDate = sdf.format(new Date());
user.setLastlogindate(lastLoginDate);
user.setLogintype("1");
user.setAccount(rs.getString("account"));
}
return user;
}
public String httpPostRequest(String param,String url,String token){
BaseBean baseBean = new BaseBean();
JSONObject jsonObject = new JSONObject();
String responseBody="";
try {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(url);
JSONObject jsonString = JSON.parseObject(param);
//设置请求体参数
StringEntity entity = new StringEntity(param,"utf-8");
baseBean.writeLog("entity-param->"+param);
baseBean.writeLog("entity-->"+entity);
entity.setContentEncoding("utf-8");
baseBean.writeLog("entity-utf-8->"+entity);
httpPost.setEntity(entity);
//设置请求头部
httpPost.setHeader("Content-Type", "application/json");
if(token != null && !"".equals(token)){
httpPost.setHeader("Authorization",token);
}
//执行请求,返回请求响应
CloseableHttpResponse response = httpClient.execute(httpPost);
//请求返回状态码
int statusCode = response.getStatusLine().getStatusCode();
baseBean.writeLog("statusCode状态码->"+statusCode);
//请求成功
if (statusCode == HttpStatus.SC_OK && statusCode <= HttpStatus.SC_TEMPORARY_REDIRECT) {
//取出响应体
HttpEntity entity2 = response.getEntity();
//从响应体中解析出token
responseBody = EntityUtils.toString(entity2, "utf-8");
// jsonObject = JSONObject.parseObject(responseBody);
baseBean.writeLog("responseBody->"+responseBody);
// baseBean.writeLog("jsonObject->"+jsonObject);
//token = jsonObject.getString("access_token");
} else {
//请求失败
throw new ClientProtocolException("请求失败,响应码为:" + statusCode);
}
} catch (Exception e) {
e.printStackTrace();
}
return responseBody;
}
/**
* 发送http get请求
*/
public static String httpGet(String url,Map<String,String> headers,String encode){
BaseBean bb = new BaseBean();
if(encode == null){
encode = "utf-8";
}
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
String content = null;
//since 4.3 不再使用 DefaultHttpClient
try {
closeableHttpClient = HttpClientBuilder.create().build();
HttpGet httpGet = new HttpGet(url);
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpGet.setHeader(entry.getKey(),entry.getValue());
}
}
bb.writeLog("url="+url+"header="+headers+"encode="+encode);
httpResponse = closeableHttpClient.execute(httpGet);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
/**
* 向指定 URL 发送POST方法的请求
*
* @param url 发送请求的 URL
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @return 所代表远程资源的响应结果
*/
public static String sendPost(String url, String param) {
BaseBean bb = new BaseBean();
String result = "";
PrintWriter out = null;
BufferedReader in = null;
HttpURLConnection connection = null;
try {
URL postUrl = new URL(url);
bb.writeLog("getUrl-->"+postUrl);
// 打开和URL之间的连接
connection = (HttpURLConnection) postUrl.openConnection();
// 在connect之前设置通用的请求属性
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.setRequestProperty("Charsert", "UTF-8");
connection.setConnectTimeout(15000);
connection.setReadTimeout(60000);
// 发送POST请求必须设置如下两行参数要放在http正文内
connection.setDoOutput(true);
connection.setDoInput(true);
// 默认是 GET方式
connection.setRequestMethod("POST");
// Post 请求不使用缓存
connection.setUseCaches(false);
// 配置本次连接的Content-typeform表单是"application/x-www-form-urlencoded"json是"application/json"等
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.connect();
// 参数要放在http正文内
//1.获取URLConnection对象对应的输出流
out = new PrintWriter(connection.getOutputStream());
//2.中文有乱码的需要将PrintWriter改为如下
//out=new OutputStreamWriter(conn.getOutputStream(),"UTF-8")
out.print(param);
out.flush();
//也可以使用DataOutputStream
// DataOutputStream dos=new DataOutputStream(httpConn.getOutputStream());
// dos.writeBytes(param);
// dos.flush();
// dos.close();
// 定义BufferedReader输入流来读取URL的响应
if (connection.getResponseCode() == 200) {
in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
}
} catch (Exception e) {
bb.writeLog("发送 POST 请求出现异常!" + e);
e.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
if (connection != null) {
//关闭连接
connection.disconnect();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return result;
}
/**
* 发送 http post 请求参数以form表单键值对的形式提交。
*/
public static String httpPostForm(String url,Map<String,String> params, Map<String,String> headers,String encode){
BaseBean bb = new BaseBean();
if(encode == null){
encode = "utf-8";
}
String content = null;
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
try {
closeableHttpClient = HttpClients.createDefault();
HttpPost httpost = new HttpPost(url);
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpost.setHeader(entry.getKey(),entry.getValue());
}
}
bb.writeLog("url="+url+"header="+headers+"encode="+encode);
bb.writeLog("params="+params);
//组织请求参数
List<NameValuePair> paramList = new ArrayList <NameValuePair>();
if(params != null && params.size() > 0){
Set<String> keySet = params.keySet();
for(String key : keySet) {
paramList.add(new BasicNameValuePair(key, params.get(key)));
}
}
httpost.setEntity(new UrlEncodedFormEntity(paramList, encode));
httpResponse = closeableHttpClient.execute(httpost);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
/**
* 公钥加密
*
* @param content 内容
* @param publicKey 公钥
* @return 加密后的密文
* @throws Exception 异常信息
*/
public static String encrypt(String content, String publicKey) throws Exception {
//base64编码的公钥
byte[] decoded = org.apache.commons.codec.binary.Base64.decodeBase64(publicKey);
RSAPublicKey pubKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded));
//RSA加密
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, pubKey);
return Base64.encodeBase64String(cipher.doFinal(content.getBytes(StandardCharsets.UTF_8)));
}
public static String getPublicKey(String str){
BaseBean bb = new BaseBean();
String publicKey ="";
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));
//请求获取publicKey接口
Map<String,String> headers = new HashMap<>();
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","publicKeyUrl"));
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID",str);
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
String msg = httpGet(url,headers,null);
bb.writeLog("===获取publickey返回值===="+msg);
try {
org.json.JSONObject resMsg = new org.json.JSONObject(msg);
bb.writeLog("===获取publickey返回值===="+resMsg);
if(resMsg.has("pubKey")){
publicKey = Util.null2String(resMsg.get("pubKey").toString());
}
}catch (Exception e){
e.getMessage();
}
return publicKey;
}
//获取TG
public static String getST(String tgt,String emobileUrl,String id){
BaseBean bb = new BaseBean();
String ST = "";
String retMsg = "";
Map<String,String> params = new HashMap<>();//参数
Map<String,String> headers = new HashMap<>();//headers
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));
//请求获取TG接口
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","stUrl"));
bb.writeLog("==获取TG=="+url);
//移动端首页地址
bb.writeLog("==移动端首页地址=="+emobileUrl);
String str = "1510"+id+"015";
//获取TGT
params = new HashMap<>();//参数
params.put("tgt",tgt);
params.put("service",emobileUrl);
bb.writeLog("==STparams=="+params);
headers = new HashMap<>();//headers
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID",str);
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
try {
retMsg = httpPostForm(url,params,headers,null);
bb.writeLog("===获取ST返回值===="+retMsg);
org.json.JSONObject resMsg = new org.json.JSONObject(retMsg);
bb.writeLog("===获取ST返回值resMsg===="+resMsg);
if(resMsg.has("ST")){
ST = Util.null2String(resMsg.get("ST").toString());
}
bb.writeLog("===获取ST===="+ST);
}catch(Exception e){
throw new RuntimeException(e);
}
return retMsg;
}
%>
<%
RecordSet rs = new RecordSet();
BaseBean bb=new BaseBean();
RSA rsa = new RSA();
Map<String,String> params = new HashMap<>();//参数
Map<String,String> headers = new HashMap<>();//headers
JSONArray array = new JSONArray();
List<String> decriptList = new ArrayList<>();
String ST ="";//获取ST
bb.writeLog("进入getCockpit.jap-->");
String login_id = "";
String user_password = "";
User user = HrmUserVarify.getUser(request, response);
int uid = user.getUID();
bb.writeLog("uid-->"+uid);
String loginIdd = user.getLoginid();
bb.writeLog("loginIdd-->"+loginIdd);
rs.executeQuery("select id,loginid,password,createtime from EmobileLoginDetail where id=?", uid);
if(rs.next()){
login_id = Util.null2String(rs.getString("loginid"));
user_password = Util.null2String(rs.getString("password"));
}
bb.writeLog("login_id-->"+login_id);
bb.writeLog("user_password-->"+user_password);
//获取session
session = request.getSession(true);
String certified_token = Util.null2String(session.getAttribute("certified_token"));
bb.writeLog("获取sessionTGT=="+certified_token);
//获取cookie
Cookie[] cookies = request.getCookies();
bb.writeLog("获取cookies=="+cookies);
String idd = "";
if(cookies != null){
for(Cookie cookie:cookies){
bb.writeLog("获取cookiesName=="+cookie.getName());
if(cookie.getName().equals("loginidweaver")){
idd = cookie.getValue();
bb.writeLog("获取idd=="+idd);
}
}
}
//查询
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));//publicKey
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","stUrl"));//获取ST的url
String cockpitUrl = Util.null2String(bb.getPropValue("tjbankEMobileSSO","cockpitUrl"));
String tgturl = Util.null2String(bb.getPropValue("tjbankEMobileSSO","tgtUrl"));//请求获取TGT地址
//获取ST带着下游系统
// if (!isEmpty(certified_token)){
// String responseInfo = getST(certified_token,cockpitUrl,loginIdd);
// bb.writeLog("进入responseInfo-->"+responseInfo);
// if (isEmpty(responseInfo)){
// out.print("单点系统接口返回值为null");
// return;
// }else {
// org.json.JSONObject stMsg = new org.json.JSONObject(responseInfo);
// if(stMsg.has("ST")){
// ST = Util.null2String(stMsg.get("ST").toString());
// }else{
// out.print(Util.null2String(stMsg.getString("message")));
// return;
// }
//
// String loginUrl = "";
// boolean isEm = Util.null2String(request.getHeader("user-agent")).indexOf("E-Mobile") > -1;
// if(isEm == true){
// // loginUrl="https://jiashicang.bankoftianjin.com:8080/bi/APPFW?download=false&showToolbar=false&ticket="+ST;
// loginUrl="https://jiashicang.bankoftianjin.com:8080/bi/APPFW?proc=1&action=viewer&hback=true&db=%E6%99%BA%E6%85%A7%E6%96%B9%E7%95%A5/%E7%BB%8F%E8%90%A5%E6%8A%A5%E8%A1%A8.db&ticket="+ST;
// }
//
// //loginUrl = "https://www.baidu.com/";
// bb.writeLog("loginUrl-->"+loginUrl);
// out.print("跳转路径-->"+loginUrl);
// out.print("进入驾驶舱成功");
// response.sendRedirect(loginUrl);
// // return;
// }
// }else {
String TGT ="";
String passWord ="";
String retMsg ="";
decriptList.add(login_id);
decriptList.add(user_password);
List<String> resultList = rsa.decryptList(request, decriptList);
String loginId = resultList.get(0);
String userPassword = resultList.get(1);
String str = "1510"+login_id+"015";
String publicKey = getPublicKey(str);
passWord = encrypt(user_password, publicKey);
params = new HashMap<>();//参数
params.put("username",loginId);
params.put("password",passWord);
bb.writeLog("==STparams=="+params);
headers = new HashMap<>();//headers
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID",str);
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
retMsg = httpPostForm(tgturl,params,headers,null);
bb.writeLog("===获取TGT返回值retMsg===="+retMsg);
org.json.JSONObject resMsg = new org.json.JSONObject(retMsg);
bb.writeLog("===获取TGT返回值===="+resMsg);
if(resMsg.has("TGT")){
TGT = Util.null2String(resMsg.get("TGT").toString());
}
String responseInfo = getST(TGT,cockpitUrl,login_id);
if (isEmpty(responseInfo)){
out.print("单点系统接口返回值为null");
return;
}else {
org.json.JSONObject stMsg = new org.json.JSONObject(responseInfo);
if(stMsg.has("ST")){
ST = Util.null2String(stMsg.get("ST").toString());
}else{
out.print(Util.null2String(stMsg.getString("message")));
return;
}
String loginUrl = "";
boolean isEm = Util.null2String(request.getHeader("user-agent")).indexOf("E-Mobile") > -1;
if(isEm == true){
// loginUrl="https://jiashicang.bankoftianjin.com:8080/bi/APPFW?download=false&showToolbar=false&ticket="+ST;
loginUrl="https://jiashicang.bankoftianjin.com:8080/bi/APPFW?proc=1&action=viewer&hback=true&db=%E6%99%BA%E6%85%A7%E6%96%B9%E7%95%A5/%E7%BB%8F%E8%90%A5%E6%8A%A5%E8%A1%A8.db&ticket="+ST;
//loginUrl="http://123.151.115.199:8080/bi/PCFW?proc=1&action=viewer&hback=true&db=%E6%99%BA%E6%85%A7%E6%96%B9%E7%95%A5/%E5%89%8D%E7%BD%AE%E9%A1%B5.db&ticket="+ST;
}
bb.writeLog("loginUrl-->"+loginUrl);
out.print("跳转路径-->"+loginUrl);
out.print("进入驾驶舱成功");
response.sendRedirect(loginUrl);
// }
// out.print("进入驾驶舱系统失败,请先获取标识");
//return;
}
%>
 <script type="text/javascript">
<%--<%=httpPostRequest%>;--%>
// alert("00000");
// next();
//   function next(){
// alert("2222");
// console.log("111111111");
<%--console.log("http://10.16.103.18:9900/coremail/main.jsp?sid="+<%=sid%>);--%>
<%--console.log("sid="+<%=sid%>);--%>
<%--window.location.href= "http://10.16.103.18:9900/coremail/main.jsp?sid="+<%=sid%>;--%>
//   window.location.href= "https://www.baidu.com/";
<%--   }--%>
 </script>

@ -0,0 +1,651 @@
<%--
Created by IntelliJ IDEA.
User: xvshanshan
Date: 2023/7/3
Time: 9:23
To change this template use File | Settings | File Templates.
--%>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page import="java.util.regex.Pattern" %>
<%@ page import="java.util.regex.Matcher" %>
<%@ page import="java.io.*" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ page import="org.apache.http.impl.client.CloseableHttpClient" %>
<%@ page import="org.apache.http.impl.client.HttpClients" %>
<%@ page import="org.apache.http.client.methods.HttpPost" %>
<%@ page import="com.alibaba.fastjson.JSON" %>
<%@ page import="org.apache.http.entity.StringEntity" %>
<%@ page import="org.apache.http.client.methods.CloseableHttpResponse" %>
<%@ page import="org.apache.http.HttpStatus" %>
<%@ page import="org.apache.http.HttpEntity" %>
<%@ page import="org.apache.http.util.EntityUtils" %>
<%@ page import="org.apache.http.client.ClientProtocolException" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="java.net.URL" %>
<%@ page import="java.net.HttpURLConnection" %>
<%@ page import="org.apache.http.HttpException" %>
<%@ page import="org.apache.http.client.HttpClient" %>
<%@ page import="org.apache.commons.httpclient.methods.PostMethod" %>
<%@ page import="org.apache.commons.httpclient.params.HttpMethodParams" %>
<%@ page import="org.apache.http.NameValuePair" %>
<%@ page import="org.apache.http.message.BasicNameValuePair" %>
<%@ page import="org.apache.http.client.entity.UrlEncodedFormEntity" %>
<%@ page import="weaver.rsa.security.RSA" %>
<%@ page import="java.security.interfaces.RSAPublicKey" %>
<%@ page import="java.security.KeyFactory" %>
<%@ page import="java.security.spec.X509EncodedKeySpec" %>
<%@ page import="javax.crypto.Cipher" %>
<%@ page import="org.apache.commons.codec.binary.Base64" %>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ page import="org.apache.http.impl.client.HttpClientBuilder" %>
<%@ page import="org.apache.http.client.methods.HttpGet" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%!
//获取分页sql
public static String getPaginationSql(String sql, String orderby, int pageNo, int pageSize) {
String execSql = "";
RecordSet rs = new RecordSet();
String dbType = rs.getDBType();
// String dbType = "oracle";
// String dbType = "sqlserver";
int firstResult = 0;
int endResult = 0;
// 返回分页sql
if("oracle".equals(dbType)){ // rownum
firstResult = pageNo * pageSize + 1;
endResult = (pageNo - 1) * pageSize;
execSql = " select * from ( select tabUN2.*,rownum as my_rownum from ( select tableUN.*,rownum as r from ( " + sql
+ orderby + ") tableUN " + ") tabUN2 where r < " + firstResult + " ) where my_rownum > " + endResult;
}else if("sqlserver".equals(dbType)){
sql="select *,row_number()OVER("+orderby+") as rn from ("+sql+") newt";
execSql = "select * from ( " +
sql+")fy " +
" where rn between ("+pageNo+"-1)*"+pageSize+"+1 and "+pageNo+"*"+pageSize+" ";
}else { // 使用 ROW_NUMBER OVER()分页
firstResult = pageNo * pageSize + 1;
endResult = (pageNo - 1) * pageSize;
execSql = " select * from ( select tabUN2.*,rownum as my_rownum from ( select tableUN.*,rownum as r from ( " + sql
+ orderby +") tableUN ) tabUN2 where r < " + firstResult + " ) where my_rownum > " + endResult;
}
rs.writeLog("execSql---->"+execSql);
return execSql;
}
private boolean isEmpty(String str) {
if ("".equals(str) ||"(null)".equals(str) || str == null) {
return true;
} else {
return false;
}
}
/**
* 获取指定类型的src值的集合
* @param htmlStr
* @param type 标签名称
* @return
* 简历
*/
public static Set<String> getSrcStr(String htmlStr, String type) {
Set<String> srcs = new HashSet<String>();
String src = "";
Pattern p_src;
Matcher m_src;
// String regEx_img = "<img.*src=(.*?)[^>]*?>"; //图片链接地址
String regEx_src = "<"+type+".*src\\s*=\\s*(.*?)[^>]*?>";
p_src = Pattern.compile
(regEx_src, Pattern.CASE_INSENSITIVE);
m_src = p_src.matcher(htmlStr);
while (m_src.find()) {
// 得到<img />数据
src = m_src.group();
// 匹配<img>中的src数据
Matcher m = Pattern.compile("src\\s*=\\s*\"?(.*?)(\"|>|\\s+)").matcher(src);
while (m.find()) {
srcs.add(m.group(1));
}
}
return srcs;
}
public User getUser(int uid){
User user = new User();
RecordSet rs = new RecordSet();
if (uid == 1)
rs.executeQuery("select * from hrmresourcemanager where id=?", uid);
else {
rs.executeQuery("select * from hrmresource where id=?", uid);
}
String userid = "";
if (rs.next()) {
userid = rs.getString("id");
user.setUid(rs.getInt("id"));
user.setLogintype("1");
user.setLoginid(rs.getString("loginid"));
user.setFirstname(rs.getString("firstname"));
user.setLastname(rs.getString("lastname"));
user.setAliasname(rs.getString("aliasname"));
user.setTitle(rs.getString("title"));
user.setTitlelocation(rs.getString("titlelocation"));
user.setSex(rs.getString("sex"));
String langid = rs.getString("systemlanguage");
user.setLanguage(Util.getIntValue(langid, 0));
user.setTelephone(rs.getString("telephone"));
user.setMobile(rs.getString("mobile"));
user.setMobilecall(rs.getString("mobilecall"));
user.setEmail(rs.getString("email"));
user.setCountryid(rs.getString("countryid"));
user.setLocationid(rs.getString("locationid"));
user.setResourcetype(rs.getString("resourcetype"));
user.setStartdate(rs.getString("startdate"));
user.setEnddate(rs.getString("enddate"));
user.setContractdate(rs.getString("contractdate"));
user.setJobtitle(rs.getString("jobtitle"));
user.setJobgroup(rs.getString("jobgroup"));
user.setJobactivity(rs.getString("jobactivity"));
user.setJoblevel(rs.getString("joblevel"));
user.setSeclevel(rs.getString("seclevel"));
user.setUserDepartment(Util.getIntValue(rs.getString("departmentid"),0));
user.setUserSubCompany1(Util.getIntValue(rs.getString("subcompanyid1"),0));
user.setUserSubCompany2(Util.getIntValue(rs.getString("subcompanyid2"),0));
user.setUserSubCompany3(Util.getIntValue(rs.getString("subcompanyid3"),0));
user.setUserSubCompany4(Util.getIntValue(rs.getString("subcompanyid4"),0));
user.setManagerid(rs.getString("managerid"));
user.setAssistantid(rs.getString("assistantid"));
user.setPurchaselimit(rs.getString("purchaselimit"));
user.setCurrencyid(rs.getString("currencyid"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String lastLoginDate = sdf.format(new Date());
user.setLastlogindate(lastLoginDate);
user.setLogintype("1");
user.setAccount(rs.getString("account"));
}
return user;
}
public String httpPostRequest(String param,String url,String token){
BaseBean baseBean = new BaseBean();
JSONObject jsonObject = new JSONObject();
String responseBody="";
try {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(url);
JSONObject jsonString = JSON.parseObject(param);
//设置请求体参数
StringEntity entity = new StringEntity(param,"utf-8");
baseBean.writeLog("entity-param->"+param);
baseBean.writeLog("entity-->"+entity);
entity.setContentEncoding("utf-8");
baseBean.writeLog("entity-utf-8->"+entity);
httpPost.setEntity(entity);
//设置请求头部
httpPost.setHeader("Content-Type", "application/json");
if(token != null && !"".equals(token)){
httpPost.setHeader("Authorization",token);
}
//执行请求,返回请求响应
CloseableHttpResponse response = httpClient.execute(httpPost);
//请求返回状态码
int statusCode = response.getStatusLine().getStatusCode();
baseBean.writeLog("statusCode状态码->"+statusCode);
//请求成功
if (statusCode == HttpStatus.SC_OK && statusCode <= HttpStatus.SC_TEMPORARY_REDIRECT) {
//取出响应体
HttpEntity entity2 = response.getEntity();
//从响应体中解析出token
responseBody = EntityUtils.toString(entity2, "utf-8");
// jsonObject = JSONObject.parseObject(responseBody);
baseBean.writeLog("responseBody->"+responseBody);
// baseBean.writeLog("jsonObject->"+jsonObject);
//token = jsonObject.getString("access_token");
} else {
//请求失败
throw new ClientProtocolException("请求失败,响应码为:" + statusCode);
}
} catch (Exception e) {
e.printStackTrace();
}
return responseBody;
}
/**
* 发送http get请求
*/
public static String httpGet(String url,Map<String,String> headers,String encode){
BaseBean bb = new BaseBean();
if(encode == null){
encode = "utf-8";
}
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
String content = null;
//since 4.3 不再使用 DefaultHttpClient
try {
closeableHttpClient = HttpClientBuilder.create().build();
HttpGet httpGet = new HttpGet(url);
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpGet.setHeader(entry.getKey(),entry.getValue());
}
}
bb.writeLog("url="+url+"header="+headers+"encode="+encode);
httpResponse = closeableHttpClient.execute(httpGet);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
/**
* 向指定 URL 发送POST方法的请求
*
* @param url 发送请求的 URL
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @return 所代表远程资源的响应结果
*/
public static String sendPost(String url, String param) {
BaseBean bb = new BaseBean();
String result = "";
PrintWriter out = null;
BufferedReader in = null;
HttpURLConnection connection = null;
try {
URL postUrl = new URL(url);
bb.writeLog("getUrl-->"+postUrl);
// 打开和URL之间的连接
connection = (HttpURLConnection) postUrl.openConnection();
// 在connect之前设置通用的请求属性
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.setRequestProperty("Charsert", "UTF-8");
connection.setConnectTimeout(15000);
connection.setReadTimeout(60000);
// 发送POST请求必须设置如下两行参数要放在http正文内
connection.setDoOutput(true);
connection.setDoInput(true);
// 默认是 GET方式
connection.setRequestMethod("POST");
// Post 请求不使用缓存
connection.setUseCaches(false);
// 配置本次连接的Content-typeform表单是"application/x-www-form-urlencoded"json是"application/json"等
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.connect();
// 参数要放在http正文内
//1.获取URLConnection对象对应的输出流
out = new PrintWriter(connection.getOutputStream());
//2.中文有乱码的需要将PrintWriter改为如下
//out=new OutputStreamWriter(conn.getOutputStream(),"UTF-8")
out.print(param);
out.flush();
//也可以使用DataOutputStream
// DataOutputStream dos=new DataOutputStream(httpConn.getOutputStream());
// dos.writeBytes(param);
// dos.flush();
// dos.close();
// 定义BufferedReader输入流来读取URL的响应
if (connection.getResponseCode() == 200) {
in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
}
} catch (Exception e) {
bb.writeLog("发送 POST 请求出现异常!" + e);
e.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
if (connection != null) {
//关闭连接
connection.disconnect();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return result;
}
/**
* 发送 http post 请求参数以form表单键值对的形式提交。
*/
public static String httpPostForm(String url,Map<String,String> params, Map<String,String> headers,String encode){
BaseBean bb = new BaseBean();
if(encode == null){
encode = "utf-8";
}
String content = null;
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
try {
closeableHttpClient = HttpClients.createDefault();
HttpPost httpost = new HttpPost(url);
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpost.setHeader(entry.getKey(),entry.getValue());
}
}
bb.writeLog("url="+url+"header="+headers+"encode="+encode);
bb.writeLog("params="+params);
//组织请求参数
List<NameValuePair> paramList = new ArrayList <NameValuePair>();
if(params != null && params.size() > 0){
Set<String> keySet = params.keySet();
for(String key : keySet) {
paramList.add(new BasicNameValuePair(key, params.get(key)));
}
}
httpost.setEntity(new UrlEncodedFormEntity(paramList, encode));
httpResponse = closeableHttpClient.execute(httpost);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
/**
* 公钥加密
*
* @param content 内容
* @param publicKey 公钥
* @return 加密后的密文
* @throws Exception 异常信息
*/
public static String encrypt(String content, String publicKey) throws Exception {
//base64编码的公钥
byte[] decoded = org.apache.commons.codec.binary.Base64.decodeBase64(publicKey);
RSAPublicKey pubKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded));
//RSA加密
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, pubKey);
return Base64.encodeBase64String(cipher.doFinal(content.getBytes(StandardCharsets.UTF_8)));
}
public static String getPublicKey(){
BaseBean bb = new BaseBean();
String publicKey ="";
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));
//请求获取publicKey接口
Map<String,String> headers = new HashMap<>();
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","publicKeyUrl"));
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID","123");
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
String msg = httpGet(url,headers,null);
bb.writeLog("===获取publickey返回值===="+msg);
try {
org.json.JSONObject resMsg = new org.json.JSONObject(msg);
bb.writeLog("===获取publickey返回值===="+resMsg);
if(resMsg.has("pubKey")){
publicKey = Util.null2String(resMsg.get("pubKey").toString());
}
}catch (Exception e){
e.getMessage();
}
return publicKey;
}
//获取TG
public static String getST(String tgt,String emobileUrl){
BaseBean bb = new BaseBean();
String ST = "";
String retMsg = "";
Map<String,String> params = new HashMap<>();//参数
Map<String,String> headers = new HashMap<>();//headers
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));
//请求获取TG接口
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","stUrl"));
bb.writeLog("==获取TG=="+url);
//移动端首页地址
bb.writeLog("==移动端首页地址=="+emobileUrl);
//获取TGT
params = new HashMap<>();//参数
params.put("tgt",tgt);
params.put("service",emobileUrl);
bb.writeLog("==STparams=="+params);
headers = new HashMap<>();//headers
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID","123");
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
try {
retMsg = httpPostForm(url,params,headers,null);
bb.writeLog("===获取ST返回值===="+retMsg);
org.json.JSONObject resMsg = new org.json.JSONObject(retMsg);
bb.writeLog("===获取ST返回值resMsg===="+resMsg);
if(resMsg.has("ST")){
ST = Util.null2String(resMsg.get("ST").toString());
}
bb.writeLog("===获取ST===="+ST);
}catch(Exception e){
throw new RuntimeException(e);
}
return retMsg;
}
%>
<%
RecordSet rs = new RecordSet();
BaseBean bb=new BaseBean();
RSA rsa = new RSA();
Map<String,String> params = new HashMap<>();//参数
Map<String,String> headers = new HashMap<>();//headers
JSONArray array = new JSONArray();
List<String> decriptList = new ArrayList<>();
String ST ="";//获取ST
bb.writeLog("进入获取简历jsp-->");
String login_id = "";
String user_password = "";
User user = HrmUserVarify.getUser(request, response);
int uid = user.getUID();
bb.writeLog("uid-->"+uid);
rs.executeQuery("select id,loginid,password,createtime from EmobileLoginDetail where id=?", uid);
if(rs.next()){
login_id = Util.null2String(rs.getString("loginid"));
user_password = Util.null2String(rs.getString("password"));
}
bb.writeLog("login_id-->"+login_id);
bb.writeLog("user_password-->"+user_password);
//获取session
session = request.getSession(true);
String certified_token = Util.null2String(session.getAttribute("certified_token"));
bb.writeLog("获取sessionTGT=="+certified_token);
//获取cookie
Cookie[] cookies = request.getCookies();
bb.writeLog("获取cookies=="+cookies);
String idd = "";
if(cookies != null){
for(Cookie cookie:cookies){
bb.writeLog("获取cookiesName=="+cookie.getName());
if(cookie.getName().equals("loginidweaver")){
idd = cookie.getValue();
bb.writeLog("获取idd=="+idd);
}
}
}
//查询人员工号
RecordSet recordSet = new RecordSet();
String requestURI = request.getRequestURI();
bb.writeLog("请求路径="+requestURI);
Map<String, Object> useridMap = ParamUtil.request2Map(request);
bb.writeLog("人员id="+useridMap.get("userid"));
recordSet.executeQuery("select WORKCODE from HRMRESOURCE where id=?", Util.null2String(useridMap.get("userid")));
String workcode = "";
if (recordSet.next()){
workcode = Util.null2String(recordSet.getString("WORKCODE"));
}
bb.writeLog("人员workcode="+useridMap.get("workcode"));
//查询
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));//publicKey
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","stUrl"));//获取ST的url
String cockpitUrl = Util.null2String(bb.getPropValue("tjbankEMobileSSO","cockpitUrl"));
String tgturl = Util.null2String(bb.getPropValue("tjbankEMobileSSO","tgtUrl"));//请求获取TGT地址
//获取ST带着下游系统
// if (!isEmpty(certified_token)){
// String responseInfo = getST(certified_token,cockpitUrl);
// bb.writeLog("进入responseInfo-->"+responseInfo);
// if (isEmpty(responseInfo)){
// out.print("单点系统接口返回值为null");
// return;
// }else {
// org.json.JSONObject stMsg = new org.json.JSONObject(responseInfo);
// if(stMsg.has("ST")){
// ST = Util.null2String(stMsg.get("ST").toString());
// }else{
// out.print(Util.null2String(stMsg.getString("message")));
// return;
// }
//
// String loginUrl = "";
// String remuseUrl = bb.getPropValue("tjbkremuse", "hbUrl");
// boolean isEm = Util.null2String(request.getHeader("user-agent")).indexOf("E-Mobile") > -1;
// if(isEm == true){
// loginUrl=remuseUrl+"&ticket="+ST;
// }
//
// //loginUrl = "https://www.baidu.com/";
// bb.writeLog("loginUrl-->"+loginUrl);
// out.print("跳转路径-->"+loginUrl);
// out.print("进入驾驶舱成功");
// response.sendRedirect(loginUrl);
// // return;
// }
// }else {
String TGT ="";
String passWord ="";
String retMsg ="";
decriptList.add(login_id);
decriptList.add(user_password);
List<String> resultList = rsa.decryptList(request, decriptList);
String loginId = resultList.get(0);
String userPassword = resultList.get(1);
String publicKey = getPublicKey();
passWord = encrypt(user_password, publicKey);
params = new HashMap<>();//参数
params.put("username",loginId);
params.put("password",passWord);
bb.writeLog("==STparams=="+params);
headers = new HashMap<>();//headers
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID","123");
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
retMsg = httpPostForm(tgturl,params,headers,null);
bb.writeLog("===获取TGT返回值retMsg===="+retMsg);
org.json.JSONObject resMsg = new org.json.JSONObject(retMsg);
bb.writeLog("===获取TGT返回值===="+resMsg);
if(resMsg.has("TGT")){
TGT = Util.null2String(resMsg.get("TGT").toString());
}
String responseInfo = getST(TGT,cockpitUrl);
if (isEmpty(responseInfo)){
out.print("单点系统接口返回值为null");
return;
}else {
org.json.JSONObject stMsg = new org.json.JSONObject(responseInfo);
if(stMsg.has("ST")){
ST = Util.null2String(stMsg.get("ST").toString());
}else{
out.print(Util.null2String(stMsg.getString("message")));
return;
}
String loginUrl = "";
String remuseUrl = bb.getPropValue("tjbkremuse", "hbUrl");
boolean isEm = Util.null2String(request.getHeader("user-agent")).indexOf("E-Mobile") > -1;
if(isEm == true){
loginUrl=remuseUrl+"&ticket="+ST;
//loginUrl="http://123.151.115.199:8080/bi/PCFW?proc=1&action=viewer&hback=true&db=%E6%99%BA%E6%85%A7%E6%96%B9%E7%95%A5/%E5%89%8D%E7%BD%AE%E9%A1%B5.db&ticket="+ST;
}
bb.writeLog("loginUrl-->"+loginUrl);
out.print("跳转路径-->"+loginUrl);
out.print("进入驾驶舱成功");
response.sendRedirect(loginUrl);
// }
// out.print("进入驾驶舱系统失败,请先获取标识");
//return;
}
%>
 <script type="text/javascript">
<%--<%=httpPostRequest%>;--%>
// alert("00000");
// next();
//   function next(){
// alert("2222");
// console.log("111111111");
<%--console.log("http://10.16.103.18:9900/coremail/main.jsp?sid="+<%=sid%>);--%>
<%--console.log("sid="+<%=sid%>);--%>
<%--window.location.href= "http://10.16.103.18:9900/coremail/main.jsp?sid="+<%=sid%>;--%>
//   window.location.href= "https://www.baidu.com/";
<%--   }--%>
 </script>

@ -0,0 +1,641 @@
<%--
Created by IntelliJ IDEA.
User: xvshanshan
Date: 2023/7/3
Time: 9:23
To change this template use File | Settings | File Templates.
--%>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page import="java.util.regex.Pattern" %>
<%@ page import="java.util.regex.Matcher" %>
<%@ page import="java.io.*" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ page import="org.apache.http.impl.client.CloseableHttpClient" %>
<%@ page import="org.apache.http.impl.client.HttpClients" %>
<%@ page import="org.apache.http.client.methods.HttpPost" %>
<%@ page import="com.alibaba.fastjson.JSON" %>
<%@ page import="org.apache.http.entity.StringEntity" %>
<%@ page import="org.apache.http.client.methods.CloseableHttpResponse" %>
<%@ page import="org.apache.http.HttpStatus" %>
<%@ page import="org.apache.http.HttpEntity" %>
<%@ page import="org.apache.http.util.EntityUtils" %>
<%@ page import="org.apache.http.client.ClientProtocolException" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="java.net.URL" %>
<%@ page import="java.net.HttpURLConnection" %>
<%@ page import="org.apache.http.HttpException" %>
<%@ page import="org.apache.http.client.HttpClient" %>
<%@ page import="org.apache.commons.httpclient.methods.PostMethod" %>
<%@ page import="org.apache.commons.httpclient.params.HttpMethodParams" %>
<%@ page import="org.apache.http.NameValuePair" %>
<%@ page import="org.apache.http.message.BasicNameValuePair" %>
<%@ page import="org.apache.http.client.entity.UrlEncodedFormEntity" %>
<%@ page import="weaver.rsa.security.RSA" %>
<%@ page import="java.security.interfaces.RSAPublicKey" %>
<%@ page import="java.security.KeyFactory" %>
<%@ page import="java.security.spec.X509EncodedKeySpec" %>
<%@ page import="javax.crypto.Cipher" %>
<%@ page import="org.apache.commons.codec.binary.Base64" %>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ page import="org.apache.http.impl.client.HttpClientBuilder" %>
<%@ page import="org.apache.http.client.methods.HttpGet" %>
<%!
//获取分页sql
public static String getPaginationSql(String sql, String orderby, int pageNo, int pageSize) {
String execSql = "";
RecordSet rs = new RecordSet();
String dbType = rs.getDBType();
// String dbType = "oracle";
// String dbType = "sqlserver";
int firstResult = 0;
int endResult = 0;
// 返回分页sql
if("oracle".equals(dbType)){ // rownum
firstResult = pageNo * pageSize + 1;
endResult = (pageNo - 1) * pageSize;
execSql = " select * from ( select tabUN2.*,rownum as my_rownum from ( select tableUN.*,rownum as r from ( " + sql
+ orderby + ") tableUN " + ") tabUN2 where r < " + firstResult + " ) where my_rownum > " + endResult;
}else if("sqlserver".equals(dbType)){
sql="select *,row_number()OVER("+orderby+") as rn from ("+sql+") newt";
execSql = "select * from ( " +
sql+")fy " +
" where rn between ("+pageNo+"-1)*"+pageSize+"+1 and "+pageNo+"*"+pageSize+" ";
}else { // 使用 ROW_NUMBER OVER()分页
firstResult = pageNo * pageSize + 1;
endResult = (pageNo - 1) * pageSize;
execSql = " select * from ( select tabUN2.*,rownum as my_rownum from ( select tableUN.*,rownum as r from ( " + sql
+ orderby +") tableUN ) tabUN2 where r < " + firstResult + " ) where my_rownum > " + endResult;
}
rs.writeLog("execSql---->"+execSql);
return execSql;
}
private boolean isEmpty(String str) {
if ("".equals(str) ||"(null)".equals(str) || str == null) {
return true;
} else {
return false;
}
}
/**
* 获取指定类型的src值的集合
* @param htmlStr
* @param type 标签名称
* @return
*/
public static Set<String> getSrcStr(String htmlStr, String type) {
Set<String> srcs = new HashSet<String>();
String src = "";
Pattern p_src;
Matcher m_src;
// String regEx_img = "<img.*src=(.*?)[^>]*?>"; //图片链接地址
String regEx_src = "<"+type+".*src\\s*=\\s*(.*?)[^>]*?>";
p_src = Pattern.compile
(regEx_src, Pattern.CASE_INSENSITIVE);
m_src = p_src.matcher(htmlStr);
while (m_src.find()) {
// 得到<img />数据
src = m_src.group();
// 匹配<img>中的src数据
Matcher m = Pattern.compile("src\\s*=\\s*\"?(.*?)(\"|>|\\s+)").matcher(src);
while (m.find()) {
srcs.add(m.group(1));
}
}
return srcs;
}
public User getUser(int uid){
User user = new User();
RecordSet rs = new RecordSet();
if (uid == 1)
rs.executeQuery("select * from hrmresourcemanager where id=?", uid);
else {
rs.executeQuery("select * from hrmresource where id=?", uid);
}
String userid = "";
if (rs.next()) {
userid = rs.getString("id");
user.setUid(rs.getInt("id"));
user.setLogintype("1");
user.setLoginid(rs.getString("loginid"));
user.setFirstname(rs.getString("firstname"));
user.setLastname(rs.getString("lastname"));
user.setAliasname(rs.getString("aliasname"));
user.setTitle(rs.getString("title"));
user.setTitlelocation(rs.getString("titlelocation"));
user.setSex(rs.getString("sex"));
String langid = rs.getString("systemlanguage");
user.setLanguage(Util.getIntValue(langid, 0));
user.setTelephone(rs.getString("telephone"));
user.setMobile(rs.getString("mobile"));
user.setMobilecall(rs.getString("mobilecall"));
user.setEmail(rs.getString("email"));
user.setCountryid(rs.getString("countryid"));
user.setLocationid(rs.getString("locationid"));
user.setResourcetype(rs.getString("resourcetype"));
user.setStartdate(rs.getString("startdate"));
user.setEnddate(rs.getString("enddate"));
user.setContractdate(rs.getString("contractdate"));
user.setJobtitle(rs.getString("jobtitle"));
user.setJobgroup(rs.getString("jobgroup"));
user.setJobactivity(rs.getString("jobactivity"));
user.setJoblevel(rs.getString("joblevel"));
user.setSeclevel(rs.getString("seclevel"));
user.setUserDepartment(Util.getIntValue(rs.getString("departmentid"),0));
user.setUserSubCompany1(Util.getIntValue(rs.getString("subcompanyid1"),0));
user.setUserSubCompany2(Util.getIntValue(rs.getString("subcompanyid2"),0));
user.setUserSubCompany3(Util.getIntValue(rs.getString("subcompanyid3"),0));
user.setUserSubCompany4(Util.getIntValue(rs.getString("subcompanyid4"),0));
user.setManagerid(rs.getString("managerid"));
user.setAssistantid(rs.getString("assistantid"));
user.setPurchaselimit(rs.getString("purchaselimit"));
user.setCurrencyid(rs.getString("currencyid"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String lastLoginDate = sdf.format(new Date());
user.setLastlogindate(lastLoginDate);
user.setLogintype("1");
user.setAccount(rs.getString("account"));
}
return user;
}
public String httpPostRequest(String param,String url,String token){
BaseBean baseBean = new BaseBean();
JSONObject jsonObject = new JSONObject();
String responseBody="";
try {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(url);
JSONObject jsonString = JSON.parseObject(param);
//设置请求体参数
StringEntity entity = new StringEntity(param,"utf-8");
baseBean.writeLog("entity-param->"+param);
baseBean.writeLog("entity-->"+entity);
entity.setContentEncoding("utf-8");
baseBean.writeLog("entity-utf-8->"+entity);
httpPost.setEntity(entity);
//设置请求头部
httpPost.setHeader("Content-Type", "application/json");
if(token != null && !"".equals(token)){
httpPost.setHeader("Authorization",token);
}
//执行请求,返回请求响应
CloseableHttpResponse response = httpClient.execute(httpPost);
//请求返回状态码
int statusCode = response.getStatusLine().getStatusCode();
baseBean.writeLog("statusCode状态码->"+statusCode);
//请求成功
if (statusCode == HttpStatus.SC_OK && statusCode <= HttpStatus.SC_TEMPORARY_REDIRECT) {
//取出响应体
HttpEntity entity2 = response.getEntity();
//从响应体中解析出token
responseBody = EntityUtils.toString(entity2, "utf-8");
// jsonObject = JSONObject.parseObject(responseBody);
baseBean.writeLog("responseBody->"+responseBody);
// baseBean.writeLog("jsonObject->"+jsonObject);
//token = jsonObject.getString("access_token");
} else {
//请求失败
throw new ClientProtocolException("请求失败,响应码为:" + statusCode);
}
} catch (Exception e) {
e.printStackTrace();
}
return responseBody;
}
/**
* 发送http get请求
*/
public static String httpGet(String url,Map<String,String> headers,String encode){
BaseBean bb = new BaseBean();
if(encode == null){
encode = "utf-8";
}
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
String content = null;
//since 4.3 不再使用 DefaultHttpClient
try {
closeableHttpClient = HttpClientBuilder.create().build();
HttpGet httpGet = new HttpGet(url);
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpGet.setHeader(entry.getKey(),entry.getValue());
}
}
bb.writeLog("url="+url+"header="+headers+"encode="+encode);
httpResponse = closeableHttpClient.execute(httpGet);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
/**
* 向指定 URL 发送POST方法的请求
*
* @param url 发送请求的 URL
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @return 所代表远程资源的响应结果
*/
public static String sendPost(String url, String param) {
BaseBean bb = new BaseBean();
String result = "";
PrintWriter out = null;
BufferedReader in = null;
HttpURLConnection connection = null;
try {
URL postUrl = new URL(url);
bb.writeLog("getUrl-->"+postUrl);
// 打开和URL之间的连接
connection = (HttpURLConnection) postUrl.openConnection();
// 在connect之前设置通用的请求属性
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.setRequestProperty("Charsert", "UTF-8");
connection.setConnectTimeout(15000);
connection.setReadTimeout(60000);
// 发送POST请求必须设置如下两行参数要放在http正文内
connection.setDoOutput(true);
connection.setDoInput(true);
// 默认是 GET方式
connection.setRequestMethod("POST");
// Post 请求不使用缓存
connection.setUseCaches(false);
// 配置本次连接的Content-typeform表单是"application/x-www-form-urlencoded"json是"application/json"等
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.connect();
// 参数要放在http正文内
//1.获取URLConnection对象对应的输出流
out = new PrintWriter(connection.getOutputStream());
//2.中文有乱码的需要将PrintWriter改为如下
//out=new OutputStreamWriter(conn.getOutputStream(),"UTF-8")
out.print(param);
out.flush();
//也可以使用DataOutputStream
// DataOutputStream dos=new DataOutputStream(httpConn.getOutputStream());
// dos.writeBytes(param);
// dos.flush();
// dos.close();
// 定义BufferedReader输入流来读取URL的响应
if (connection.getResponseCode() == 200) {
in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
}
} catch (Exception e) {
bb.writeLog("发送 POST 请求出现异常!" + e);
e.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
if (connection != null) {
//关闭连接
connection.disconnect();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return result;
}
/**
* 发送 http post 请求参数以form表单键值对的形式提交。
*/
public static String httpPostForm(String url,Map<String,String> params, Map<String,String> headers,String encode){
BaseBean bb = new BaseBean();
if(encode == null){
encode = "utf-8";
}
String content = null;
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
try {
closeableHttpClient = HttpClients.createDefault();
HttpPost httpost = new HttpPost(url);
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpost.setHeader(entry.getKey(),entry.getValue());
}
}
bb.writeLog("url="+url+"header="+headers+"encode="+encode);
bb.writeLog("params="+params);
//组织请求参数
List<NameValuePair> paramList = new ArrayList <NameValuePair>();
if(params != null && params.size() > 0){
Set<String> keySet = params.keySet();
for(String key : keySet) {
paramList.add(new BasicNameValuePair(key, params.get(key)));
}
}
httpost.setEntity(new UrlEncodedFormEntity(paramList, encode));
httpResponse = closeableHttpClient.execute(httpost);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
/**
* 公钥加密
*
* @param content 内容
* @param publicKey 公钥
* @return 加密后的密文
* @throws Exception 异常信息
*/
public static String encrypt(String content, String publicKey) throws Exception {
//base64编码的公钥
byte[] decoded = org.apache.commons.codec.binary.Base64.decodeBase64(publicKey);
RSAPublicKey pubKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded));
//RSA加密
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, pubKey);
return Base64.encodeBase64String(cipher.doFinal(content.getBytes(StandardCharsets.UTF_8)));
}
public static String getPublicKey(String str){
BaseBean bb = new BaseBean();
String publicKey ="";
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));
//请求获取publicKey接口
Map<String,String> headers = new HashMap<>();
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","publicKeyUrl"));
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID",str);
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
String msg = httpGet(url,headers,null);
bb.writeLog("===获取publickey返回值===="+msg);
try {
org.json.JSONObject resMsg = new org.json.JSONObject(msg);
bb.writeLog("===获取publickey返回值===="+resMsg);
if(resMsg.has("pubKey")){
publicKey = Util.null2String(resMsg.get("pubKey").toString());
}
}catch (Exception e){
e.getMessage();
}
return publicKey;
}
//获取TG
public static String getST(String tgt,String emobileUrl,String id){
BaseBean bb = new BaseBean();
String ST = "";
String retMsg = "";
Map<String,String> params = new HashMap<>();//参数
Map<String,String> headers = new HashMap<>();//headers
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));
//请求获取TG接口
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","stUrl"));
bb.writeLog("==获取TG=="+url);
//移动端首页地址
bb.writeLog("==移动端首页地址=="+emobileUrl);
String str = "1510"+id+"015";
//获取TGT
params = new HashMap<>();//参数
params.put("tgt",tgt);
params.put("service",emobileUrl);
bb.writeLog("==STparams=="+params);
headers = new HashMap<>();//headers
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID",str);
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
try {
retMsg = httpPostForm(url,params,headers,null);
bb.writeLog("===获取ST返回值===="+retMsg);
org.json.JSONObject resMsg = new org.json.JSONObject(retMsg);
bb.writeLog("===获取ST返回值resMsg===="+resMsg);
if(resMsg.has("ST")){
ST = Util.null2String(resMsg.get("ST").toString());
}
bb.writeLog("===获取ST===="+ST);
}catch(Exception e){
throw new RuntimeException(e);
}
return retMsg;
}
%>
<%
RecordSet rs = new RecordSet();
BaseBean bb=new BaseBean();
RSA rsa = new RSA();
Map<String,String> params = new HashMap<>();//参数
Map<String,String> headers = new HashMap<>();//headers
JSONArray array = new JSONArray();
List<String> decriptList = new ArrayList<>();
String ST ="";//获取ST
bb.writeLog("进入getCockpit.jap-->");
String login_id = "";
String user_password = "";
User user = HrmUserVarify.getUser(request, response);
int uid = user.getUID();
bb.writeLog("uid-->"+uid);
String loginIdd = user.getLoginid();
bb.writeLog("loginIdd-->"+loginIdd);
rs.executeQuery("select id,loginid,password,createtime from EmobileLoginDetail where id=?", uid);
if(rs.next()){
login_id = Util.null2String(rs.getString("loginid"));
user_password = Util.null2String(rs.getString("password"));
}
bb.writeLog("login_id-->"+login_id);
bb.writeLog("user_password-->"+user_password);
//获取session
session = request.getSession(true);
String certified_token = Util.null2String(session.getAttribute("certified_token"));
bb.writeLog("获取sessionTGT=="+certified_token);
//获取cookie
Cookie[] cookies = request.getCookies();
bb.writeLog("获取cookies=="+cookies);
String idd = "";
if(cookies != null){
for(Cookie cookie:cookies){
bb.writeLog("获取cookiesName=="+cookie.getName());
if(cookie.getName().equals("loginidweaver")){
idd = cookie.getValue();
bb.writeLog("获取idd=="+idd);
}
}
}
//查询
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));//publicKey
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","stUrl"));//获取ST的url
String cockpitUrl = Util.null2String(bb.getPropValue("tjbankEMobileSSO","cockpitUrl"));
String tgturl = Util.null2String(bb.getPropValue("tjbankEMobileSSO","tgtUrl"));//请求获取TGT地址
//获取ST带着下游系统
// if (!isEmpty(certified_token)){
// String responseInfo = getST(certified_token,cockpitUrl,loginIdd);
// bb.writeLog("进入responseInfo-->"+responseInfo);
// if (isEmpty(responseInfo)){
// out.print("单点系统接口返回值为null");
// return;
// }else {
// org.json.JSONObject stMsg = new org.json.JSONObject(responseInfo);
// if(stMsg.has("ST")){
// ST = Util.null2String(stMsg.get("ST").toString());
// }else{
// out.print(Util.null2String(stMsg.getString("message")));
// return;
// }
//
// String loginUrl = "";
// boolean isEm = Util.null2String(request.getHeader("user-agent")).indexOf("E-Mobile") > -1;
// if(isEm == true){
// // loginUrl="https://jiashicang.bankoftianjin.com:8080/bi/APPFW?download=false&showToolbar=false&ticket="+ST;
// loginUrl="https://jiashicang.bankoftianjin.com:8080/bi/APPFW?proc=1&action=viewer&hback=true&db=%E6%99%BA%E6%85%A7%E6%96%B9%E7%95%A5/%E6%99%BA%E6%85%A7HR.db&ticket="+ST;
// }
//
// //loginUrl = "https://www.baidu.com/";
// bb.writeLog("loginUrl-->"+loginUrl);
// out.print("跳转路径-->"+loginUrl);
// out.print("进入驾驶舱成功");
// response.sendRedirect(loginUrl);
// // return;
// }
// }else {
String TGT ="";
String passWord ="";
String retMsg ="";
decriptList.add(login_id);
decriptList.add(user_password);
List<String> resultList = rsa.decryptList(request, decriptList);
String loginId = resultList.get(0);
String userPassword = resultList.get(1);
String str = "1510"+login_id+"015";
String publicKey = getPublicKey(str);
passWord = encrypt(user_password, publicKey);
params = new HashMap<>();//参数
params.put("username",loginId);
params.put("password",passWord);
bb.writeLog("==STparams=="+params);
headers = new HashMap<>();//headers
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID",str);
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
retMsg = httpPostForm(tgturl,params,headers,null);
bb.writeLog("===获取TGT返回值retMsg===="+retMsg);
org.json.JSONObject resMsg = new org.json.JSONObject(retMsg);
bb.writeLog("===获取TGT返回值===="+resMsg);
if(resMsg.has("TGT")){
TGT = Util.null2String(resMsg.get("TGT").toString());
}
String responseInfo = getST(TGT,cockpitUrl,login_id);
if (isEmpty(responseInfo)){
out.print("单点系统接口返回值为null");
return;
}else {
org.json.JSONObject stMsg = new org.json.JSONObject(responseInfo);
if(stMsg.has("ST")){
ST = Util.null2String(stMsg.get("ST").toString());
}else{
out.print(Util.null2String(stMsg.getString("message")));
return;
}
String loginUrl = "";
boolean isEm = Util.null2String(request.getHeader("user-agent")).indexOf("E-Mobile") > -1;
if(isEm == true){
// loginUrl="https://jiashicang.bankoftianjin.com:8080/bi/APPFW?download=false&showToolbar=false&ticket="+ST;
loginUrl="https://jiashicang.bankoftianjin.com:8080/bi/APPFW?proc=1&action=viewer&hback=true&db=%E6%99%BA%E6%85%A7%E6%96%B9%E7%95%A5/%E6%99%BA%E6%85%A7HR.db&ticket="+ST;
//loginUrl="http://123.151.115.199:8080/bi/PCFW?proc=1&action=viewer&hback=true&db=%E6%99%BA%E6%85%A7%E6%96%B9%E7%95%A5/%E5%89%8D%E7%BD%AE%E9%A1%B5.db&ticket="+ST;
}
bb.writeLog("loginUrl-->"+loginUrl);
out.print("跳转路径-->"+loginUrl);
out.print("进入驾驶舱成功");
response.sendRedirect(loginUrl);
// }
// out.print("进入驾驶舱系统失败,请先获取标识");
//return;
}
%>
 <script type="text/javascript">
<%--<%=httpPostRequest%>;--%>
// alert("00000");
// next();
//   function next(){
// alert("2222");
// console.log("111111111");
<%--console.log("http://10.16.103.18:9900/coremail/main.jsp?sid="+<%=sid%>);--%>
<%--console.log("sid="+<%=sid%>);--%>
<%--window.location.href= "http://10.16.103.18:9900/coremail/main.jsp?sid="+<%=sid%>;--%>
//   window.location.href= "https://www.baidu.com/";
<%--   }--%>
 </script>

@ -0,0 +1,651 @@
<%--
Created by IntelliJ IDEA.
User: xvshanshan
Date: 2023/7/3
Time: 9:23
To change this template use File | Settings | File Templates.
--%>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page import="java.util.regex.Pattern" %>
<%@ page import="java.util.regex.Matcher" %>
<%@ page import="java.io.*" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ page import="org.apache.http.impl.client.CloseableHttpClient" %>
<%@ page import="org.apache.http.impl.client.HttpClients" %>
<%@ page import="org.apache.http.client.methods.HttpPost" %>
<%@ page import="com.alibaba.fastjson.JSON" %>
<%@ page import="org.apache.http.entity.StringEntity" %>
<%@ page import="org.apache.http.client.methods.CloseableHttpResponse" %>
<%@ page import="org.apache.http.HttpStatus" %>
<%@ page import="org.apache.http.HttpEntity" %>
<%@ page import="org.apache.http.util.EntityUtils" %>
<%@ page import="org.apache.http.client.ClientProtocolException" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="java.net.URL" %>
<%@ page import="java.net.HttpURLConnection" %>
<%@ page import="org.apache.http.HttpException" %>
<%@ page import="org.apache.http.client.HttpClient" %>
<%@ page import="org.apache.commons.httpclient.methods.PostMethod" %>
<%@ page import="org.apache.commons.httpclient.params.HttpMethodParams" %>
<%@ page import="org.apache.http.NameValuePair" %>
<%@ page import="org.apache.http.message.BasicNameValuePair" %>
<%@ page import="org.apache.http.client.entity.UrlEncodedFormEntity" %>
<%@ page import="weaver.rsa.security.RSA" %>
<%@ page import="java.security.interfaces.RSAPublicKey" %>
<%@ page import="java.security.KeyFactory" %>
<%@ page import="java.security.spec.X509EncodedKeySpec" %>
<%@ page import="javax.crypto.Cipher" %>
<%@ page import="org.apache.commons.codec.binary.Base64" %>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ page import="org.apache.http.impl.client.HttpClientBuilder" %>
<%@ page import="org.apache.http.client.methods.HttpGet" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%!
//获取分页sql
public static String getPaginationSql(String sql, String orderby, int pageNo, int pageSize) {
String execSql = "";
RecordSet rs = new RecordSet();
String dbType = rs.getDBType();
// String dbType = "oracle";
// String dbType = "sqlserver";
int firstResult = 0;
int endResult = 0;
// 返回分页sql
if("oracle".equals(dbType)){ // rownum
firstResult = pageNo * pageSize + 1;
endResult = (pageNo - 1) * pageSize;
execSql = " select * from ( select tabUN2.*,rownum as my_rownum from ( select tableUN.*,rownum as r from ( " + sql
+ orderby + ") tableUN " + ") tabUN2 where r < " + firstResult + " ) where my_rownum > " + endResult;
}else if("sqlserver".equals(dbType)){
sql="select *,row_number()OVER("+orderby+") as rn from ("+sql+") newt";
execSql = "select * from ( " +
sql+")fy " +
" where rn between ("+pageNo+"-1)*"+pageSize+"+1 and "+pageNo+"*"+pageSize+" ";
}else { // 使用 ROW_NUMBER OVER()分页
firstResult = pageNo * pageSize + 1;
endResult = (pageNo - 1) * pageSize;
execSql = " select * from ( select tabUN2.*,rownum as my_rownum from ( select tableUN.*,rownum as r from ( " + sql
+ orderby +") tableUN ) tabUN2 where r < " + firstResult + " ) where my_rownum > " + endResult;
}
rs.writeLog("execSql---->"+execSql);
return execSql;
}
private boolean isEmpty(String str) {
if ("".equals(str) ||"(null)".equals(str) || str == null) {
return true;
} else {
return false;
}
}
/**
* 获取指定类型的src值的集合
* @param htmlStr
* @param type 标签名称
* @return
* 简历
*/
public static Set<String> getSrcStr(String htmlStr, String type) {
Set<String> srcs = new HashSet<String>();
String src = "";
Pattern p_src;
Matcher m_src;
// String regEx_img = "<img.*src=(.*?)[^>]*?>"; //图片链接地址
String regEx_src = "<"+type+".*src\\s*=\\s*(.*?)[^>]*?>";
p_src = Pattern.compile
(regEx_src, Pattern.CASE_INSENSITIVE);
m_src = p_src.matcher(htmlStr);
while (m_src.find()) {
// 得到<img />数据
src = m_src.group();
// 匹配<img>中的src数据
Matcher m = Pattern.compile("src\\s*=\\s*\"?(.*?)(\"|>|\\s+)").matcher(src);
while (m.find()) {
srcs.add(m.group(1));
}
}
return srcs;
}
public User getUser(int uid){
User user = new User();
RecordSet rs = new RecordSet();
if (uid == 1)
rs.executeQuery("select * from hrmresourcemanager where id=?", uid);
else {
rs.executeQuery("select * from hrmresource where id=?", uid);
}
String userid = "";
if (rs.next()) {
userid = rs.getString("id");
user.setUid(rs.getInt("id"));
user.setLogintype("1");
user.setLoginid(rs.getString("loginid"));
user.setFirstname(rs.getString("firstname"));
user.setLastname(rs.getString("lastname"));
user.setAliasname(rs.getString("aliasname"));
user.setTitle(rs.getString("title"));
user.setTitlelocation(rs.getString("titlelocation"));
user.setSex(rs.getString("sex"));
String langid = rs.getString("systemlanguage");
user.setLanguage(Util.getIntValue(langid, 0));
user.setTelephone(rs.getString("telephone"));
user.setMobile(rs.getString("mobile"));
user.setMobilecall(rs.getString("mobilecall"));
user.setEmail(rs.getString("email"));
user.setCountryid(rs.getString("countryid"));
user.setLocationid(rs.getString("locationid"));
user.setResourcetype(rs.getString("resourcetype"));
user.setStartdate(rs.getString("startdate"));
user.setEnddate(rs.getString("enddate"));
user.setContractdate(rs.getString("contractdate"));
user.setJobtitle(rs.getString("jobtitle"));
user.setJobgroup(rs.getString("jobgroup"));
user.setJobactivity(rs.getString("jobactivity"));
user.setJoblevel(rs.getString("joblevel"));
user.setSeclevel(rs.getString("seclevel"));
user.setUserDepartment(Util.getIntValue(rs.getString("departmentid"),0));
user.setUserSubCompany1(Util.getIntValue(rs.getString("subcompanyid1"),0));
user.setUserSubCompany2(Util.getIntValue(rs.getString("subcompanyid2"),0));
user.setUserSubCompany3(Util.getIntValue(rs.getString("subcompanyid3"),0));
user.setUserSubCompany4(Util.getIntValue(rs.getString("subcompanyid4"),0));
user.setManagerid(rs.getString("managerid"));
user.setAssistantid(rs.getString("assistantid"));
user.setPurchaselimit(rs.getString("purchaselimit"));
user.setCurrencyid(rs.getString("currencyid"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String lastLoginDate = sdf.format(new Date());
user.setLastlogindate(lastLoginDate);
user.setLogintype("1");
user.setAccount(rs.getString("account"));
}
return user;
}
public String httpPostRequest(String param,String url,String token){
BaseBean baseBean = new BaseBean();
JSONObject jsonObject = new JSONObject();
String responseBody="";
try {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(url);
JSONObject jsonString = JSON.parseObject(param);
//设置请求体参数
StringEntity entity = new StringEntity(param,"utf-8");
baseBean.writeLog("entity-param->"+param);
baseBean.writeLog("entity-->"+entity);
entity.setContentEncoding("utf-8");
baseBean.writeLog("entity-utf-8->"+entity);
httpPost.setEntity(entity);
//设置请求头部
httpPost.setHeader("Content-Type", "application/json");
if(token != null && !"".equals(token)){
httpPost.setHeader("Authorization",token);
}
//执行请求,返回请求响应
CloseableHttpResponse response = httpClient.execute(httpPost);
//请求返回状态码
int statusCode = response.getStatusLine().getStatusCode();
baseBean.writeLog("statusCode状态码->"+statusCode);
//请求成功
if (statusCode == HttpStatus.SC_OK && statusCode <= HttpStatus.SC_TEMPORARY_REDIRECT) {
//取出响应体
HttpEntity entity2 = response.getEntity();
//从响应体中解析出token
responseBody = EntityUtils.toString(entity2, "utf-8");
// jsonObject = JSONObject.parseObject(responseBody);
baseBean.writeLog("responseBody->"+responseBody);
// baseBean.writeLog("jsonObject->"+jsonObject);
//token = jsonObject.getString("access_token");
} else {
//请求失败
throw new ClientProtocolException("请求失败,响应码为:" + statusCode);
}
} catch (Exception e) {
e.printStackTrace();
}
return responseBody;
}
/**
* 发送http get请求
*/
public static String httpGet(String url,Map<String,String> headers,String encode){
BaseBean bb = new BaseBean();
if(encode == null){
encode = "utf-8";
}
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
String content = null;
//since 4.3 不再使用 DefaultHttpClient
try {
closeableHttpClient = HttpClientBuilder.create().build();
HttpGet httpGet = new HttpGet(url);
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpGet.setHeader(entry.getKey(),entry.getValue());
}
}
bb.writeLog("url="+url+"header="+headers+"encode="+encode);
httpResponse = closeableHttpClient.execute(httpGet);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
/**
* 向指定 URL 发送POST方法的请求
*
* @param url 发送请求的 URL
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @return 所代表远程资源的响应结果
*/
public static String sendPost(String url, String param) {
BaseBean bb = new BaseBean();
String result = "";
PrintWriter out = null;
BufferedReader in = null;
HttpURLConnection connection = null;
try {
URL postUrl = new URL(url);
bb.writeLog("getUrl-->"+postUrl);
// 打开和URL之间的连接
connection = (HttpURLConnection) postUrl.openConnection();
// 在connect之前设置通用的请求属性
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.setRequestProperty("Charsert", "UTF-8");
connection.setConnectTimeout(15000);
connection.setReadTimeout(60000);
// 发送POST请求必须设置如下两行参数要放在http正文内
connection.setDoOutput(true);
connection.setDoInput(true);
// 默认是 GET方式
connection.setRequestMethod("POST");
// Post 请求不使用缓存
connection.setUseCaches(false);
// 配置本次连接的Content-typeform表单是"application/x-www-form-urlencoded"json是"application/json"等
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.connect();
// 参数要放在http正文内
//1.获取URLConnection对象对应的输出流
out = new PrintWriter(connection.getOutputStream());
//2.中文有乱码的需要将PrintWriter改为如下
//out=new OutputStreamWriter(conn.getOutputStream(),"UTF-8")
out.print(param);
out.flush();
//也可以使用DataOutputStream
// DataOutputStream dos=new DataOutputStream(httpConn.getOutputStream());
// dos.writeBytes(param);
// dos.flush();
// dos.close();
// 定义BufferedReader输入流来读取URL的响应
if (connection.getResponseCode() == 200) {
in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
}
} catch (Exception e) {
bb.writeLog("发送 POST 请求出现异常!" + e);
e.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
if (connection != null) {
//关闭连接
connection.disconnect();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return result;
}
/**
* 发送 http post 请求参数以form表单键值对的形式提交。
*/
public static String httpPostForm(String url,Map<String,String> params, Map<String,String> headers,String encode){
BaseBean bb = new BaseBean();
if(encode == null){
encode = "utf-8";
}
String content = null;
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
try {
closeableHttpClient = HttpClients.createDefault();
HttpPost httpost = new HttpPost(url);
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpost.setHeader(entry.getKey(),entry.getValue());
}
}
bb.writeLog("url="+url+"header="+headers+"encode="+encode);
bb.writeLog("params="+params);
//组织请求参数
List<NameValuePair> paramList = new ArrayList <NameValuePair>();
if(params != null && params.size() > 0){
Set<String> keySet = params.keySet();
for(String key : keySet) {
paramList.add(new BasicNameValuePair(key, params.get(key)));
}
}
httpost.setEntity(new UrlEncodedFormEntity(paramList, encode));
httpResponse = closeableHttpClient.execute(httpost);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
/**
* 公钥加密
*
* @param content 内容
* @param publicKey 公钥
* @return 加密后的密文
* @throws Exception 异常信息
*/
public static String encrypt(String content, String publicKey) throws Exception {
//base64编码的公钥
byte[] decoded = org.apache.commons.codec.binary.Base64.decodeBase64(publicKey);
RSAPublicKey pubKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded));
//RSA加密
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, pubKey);
return Base64.encodeBase64String(cipher.doFinal(content.getBytes(StandardCharsets.UTF_8)));
}
public static String getPublicKey(){
BaseBean bb = new BaseBean();
String publicKey ="";
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));
//请求获取publicKey接口
Map<String,String> headers = new HashMap<>();
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","publicKeyUrl"));
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID","123");
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
String msg = httpGet(url,headers,null);
bb.writeLog("===获取publickey返回值===="+msg);
try {
org.json.JSONObject resMsg = new org.json.JSONObject(msg);
bb.writeLog("===获取publickey返回值===="+resMsg);
if(resMsg.has("pubKey")){
publicKey = Util.null2String(resMsg.get("pubKey").toString());
}
}catch (Exception e){
e.getMessage();
}
return publicKey;
}
//获取TG
public static String getST(String tgt,String emobileUrl){
BaseBean bb = new BaseBean();
String ST = "";
String retMsg = "";
Map<String,String> params = new HashMap<>();//参数
Map<String,String> headers = new HashMap<>();//headers
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));
//请求获取TG接口
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","stUrl"));
bb.writeLog("==获取TG=="+url);
//移动端首页地址
bb.writeLog("==移动端首页地址=="+emobileUrl);
//获取TGT
params = new HashMap<>();//参数
params.put("tgt",tgt);
params.put("service",emobileUrl);
bb.writeLog("==STparams=="+params);
headers = new HashMap<>();//headers
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID","123");
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
try {
retMsg = httpPostForm(url,params,headers,null);
bb.writeLog("===获取ST返回值===="+retMsg);
org.json.JSONObject resMsg = new org.json.JSONObject(retMsg);
bb.writeLog("===获取ST返回值resMsg===="+resMsg);
if(resMsg.has("ST")){
ST = Util.null2String(resMsg.get("ST").toString());
}
bb.writeLog("===获取ST===="+ST);
}catch(Exception e){
throw new RuntimeException(e);
}
return retMsg;
}
%>
<%
RecordSet rs = new RecordSet();
BaseBean bb=new BaseBean();
RSA rsa = new RSA();
Map<String,String> params = new HashMap<>();//参数
Map<String,String> headers = new HashMap<>();//headers
JSONArray array = new JSONArray();
List<String> decriptList = new ArrayList<>();
String ST ="";//获取ST
bb.writeLog("进入获取简历jsp-->");
String login_id = "";
String user_password = "";
User user = HrmUserVarify.getUser(request, response);
int uid = user.getUID();
bb.writeLog("uid-->"+uid);
rs.executeQuery("select id,loginid,password,createtime from EmobileLoginDetail where id=?", uid);
if(rs.next()){
login_id = Util.null2String(rs.getString("loginid"));
user_password = Util.null2String(rs.getString("password"));
}
bb.writeLog("login_id-->"+login_id);
bb.writeLog("user_password-->"+user_password);
//获取session
session = request.getSession(true);
String certified_token = Util.null2String(session.getAttribute("certified_token"));
bb.writeLog("获取sessionTGT=="+certified_token);
//获取cookie
Cookie[] cookies = request.getCookies();
bb.writeLog("获取cookies=="+cookies);
String idd = "";
if(cookies != null){
for(Cookie cookie:cookies){
bb.writeLog("获取cookiesName=="+cookie.getName());
if(cookie.getName().equals("loginidweaver")){
idd = cookie.getValue();
bb.writeLog("获取idd=="+idd);
}
}
}
//查询人员工号
RecordSet recordSet = new RecordSet();
String requestURI = request.getRequestURI();
bb.writeLog("请求路径="+requestURI);
Map<String, Object> useridMap = ParamUtil.request2Map(request);
bb.writeLog("人员id="+useridMap.get("userid"));
recordSet.executeQuery("select WORKCODE from HRMRESOURCE where id=?", Util.null2String(useridMap.get("userid")));
String workcode = "";
if (recordSet.next()){
workcode = Util.null2String(recordSet.getString("WORKCODE"));
}
bb.writeLog("人员workcode="+useridMap.get("workcode"));
//查询
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));//publicKey
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","stUrl"));//获取ST的url
String cockpitUrl = Util.null2String(bb.getPropValue("tjbankEMobileSSO","cockpitUrl"));
String tgturl = Util.null2String(bb.getPropValue("tjbankEMobileSSO","tgtUrl"));//请求获取TGT地址
//获取ST带着下游系统
// if (!isEmpty(certified_token)){
// String responseInfo = getST(certified_token,cockpitUrl);
// bb.writeLog("进入responseInfo-->"+responseInfo);
// if (isEmpty(responseInfo)){
// out.print("单点系统接口返回值为null");
// return;
// }else {
// org.json.JSONObject stMsg = new org.json.JSONObject(responseInfo);
// if(stMsg.has("ST")){
// ST = Util.null2String(stMsg.get("ST").toString());
// }else{
// out.print(Util.null2String(stMsg.getString("message")));
// return;
// }
//
// String loginUrl = "";
// String remuseUrl = bb.getPropValue("tjbkremuse", "hyzxUrl");
// boolean isEm = Util.null2String(request.getHeader("user-agent")).indexOf("E-Mobile") > -1;
// if(isEm == true){
// loginUrl=remuseUrl+"&ticket="+ST;
// }
//
// //loginUrl = "https://www.baidu.com/";
// bb.writeLog("loginUrl-->"+loginUrl);
// out.print("跳转路径-->"+loginUrl);
// out.print("进入驾驶舱成功");
// response.sendRedirect(loginUrl);
// // return;
// }
// }else {
String TGT ="";
String passWord ="";
String retMsg ="";
decriptList.add(login_id);
decriptList.add(user_password);
List<String> resultList = rsa.decryptList(request, decriptList);
String loginId = resultList.get(0);
String userPassword = resultList.get(1);
String publicKey = getPublicKey();
passWord = encrypt(user_password, publicKey);
params = new HashMap<>();//参数
params.put("username",loginId);
params.put("password",passWord);
bb.writeLog("==STparams=="+params);
headers = new HashMap<>();//headers
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID","123");
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
retMsg = httpPostForm(tgturl,params,headers,null);
bb.writeLog("===获取TGT返回值retMsg===="+retMsg);
org.json.JSONObject resMsg = new org.json.JSONObject(retMsg);
bb.writeLog("===获取TGT返回值===="+resMsg);
if(resMsg.has("TGT")){
TGT = Util.null2String(resMsg.get("TGT").toString());
}
String responseInfo = getST(TGT,cockpitUrl);
if (isEmpty(responseInfo)){
out.print("单点系统接口返回值为null");
return;
}else {
org.json.JSONObject stMsg = new org.json.JSONObject(responseInfo);
if(stMsg.has("ST")){
ST = Util.null2String(stMsg.get("ST").toString());
}else{
out.print(Util.null2String(stMsg.getString("message")));
return;
}
String loginUrl = "";
String remuseUrl = bb.getPropValue("tjbkremuse", "hyzxUrl");
boolean isEm = Util.null2String(request.getHeader("user-agent")).indexOf("E-Mobile") > -1;
if(isEm == true){
loginUrl=remuseUrl+"&ticket="+ST;
//loginUrl="http://123.151.115.199:8080/bi/PCFW?proc=1&action=viewer&hback=true&db=%E6%99%BA%E6%85%A7%E6%96%B9%E7%95%A5/%E5%89%8D%E7%BD%AE%E9%A1%B5.db&ticket="+ST;
}
bb.writeLog("loginUrl-->"+loginUrl);
out.print("跳转路径-->"+loginUrl);
out.print("进入驾驶舱成功");
response.sendRedirect(loginUrl);
// }
// out.print("进入驾驶舱系统失败,请先获取标识");
//return;
}
%>
 <script type="text/javascript">
<%--<%=httpPostRequest%>;--%>
// alert("00000");
// next();
//   function next(){
// alert("2222");
// console.log("111111111");
<%--console.log("http://10.16.103.18:9900/coremail/main.jsp?sid="+<%=sid%>);--%>
<%--console.log("sid="+<%=sid%>);--%>
<%--window.location.href= "http://10.16.103.18:9900/coremail/main.jsp?sid="+<%=sid%>;--%>
//   window.location.href= "https://www.baidu.com/";
<%--   }--%>
 </script>

@ -0,0 +1,651 @@
<%--
Created by IntelliJ IDEA.
User: xvshanshan
Date: 2023/7/3
Time: 9:23
To change this template use File | Settings | File Templates.
--%>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page import="java.util.regex.Pattern" %>
<%@ page import="java.util.regex.Matcher" %>
<%@ page import="java.io.*" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ page import="org.apache.http.impl.client.CloseableHttpClient" %>
<%@ page import="org.apache.http.impl.client.HttpClients" %>
<%@ page import="org.apache.http.client.methods.HttpPost" %>
<%@ page import="com.alibaba.fastjson.JSON" %>
<%@ page import="org.apache.http.entity.StringEntity" %>
<%@ page import="org.apache.http.client.methods.CloseableHttpResponse" %>
<%@ page import="org.apache.http.HttpStatus" %>
<%@ page import="org.apache.http.HttpEntity" %>
<%@ page import="org.apache.http.util.EntityUtils" %>
<%@ page import="org.apache.http.client.ClientProtocolException" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="java.net.URL" %>
<%@ page import="java.net.HttpURLConnection" %>
<%@ page import="org.apache.http.HttpException" %>
<%@ page import="org.apache.http.client.HttpClient" %>
<%@ page import="org.apache.commons.httpclient.methods.PostMethod" %>
<%@ page import="org.apache.commons.httpclient.params.HttpMethodParams" %>
<%@ page import="org.apache.http.NameValuePair" %>
<%@ page import="org.apache.http.message.BasicNameValuePair" %>
<%@ page import="org.apache.http.client.entity.UrlEncodedFormEntity" %>
<%@ page import="weaver.rsa.security.RSA" %>
<%@ page import="java.security.interfaces.RSAPublicKey" %>
<%@ page import="java.security.KeyFactory" %>
<%@ page import="java.security.spec.X509EncodedKeySpec" %>
<%@ page import="javax.crypto.Cipher" %>
<%@ page import="org.apache.commons.codec.binary.Base64" %>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ page import="org.apache.http.impl.client.HttpClientBuilder" %>
<%@ page import="org.apache.http.client.methods.HttpGet" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%!
//获取分页sql
public static String getPaginationSql(String sql, String orderby, int pageNo, int pageSize) {
String execSql = "";
RecordSet rs = new RecordSet();
String dbType = rs.getDBType();
// String dbType = "oracle";
// String dbType = "sqlserver";
int firstResult = 0;
int endResult = 0;
// 返回分页sql
if("oracle".equals(dbType)){ // rownum
firstResult = pageNo * pageSize + 1;
endResult = (pageNo - 1) * pageSize;
execSql = " select * from ( select tabUN2.*,rownum as my_rownum from ( select tableUN.*,rownum as r from ( " + sql
+ orderby + ") tableUN " + ") tabUN2 where r < " + firstResult + " ) where my_rownum > " + endResult;
}else if("sqlserver".equals(dbType)){
sql="select *,row_number()OVER("+orderby+") as rn from ("+sql+") newt";
execSql = "select * from ( " +
sql+")fy " +
" where rn between ("+pageNo+"-1)*"+pageSize+"+1 and "+pageNo+"*"+pageSize+" ";
}else { // 使用 ROW_NUMBER OVER()分页
firstResult = pageNo * pageSize + 1;
endResult = (pageNo - 1) * pageSize;
execSql = " select * from ( select tabUN2.*,rownum as my_rownum from ( select tableUN.*,rownum as r from ( " + sql
+ orderby +") tableUN ) tabUN2 where r < " + firstResult + " ) where my_rownum > " + endResult;
}
rs.writeLog("execSql---->"+execSql);
return execSql;
}
private boolean isEmpty(String str) {
if ("".equals(str) ||"(null)".equals(str) || str == null) {
return true;
} else {
return false;
}
}
/**
* 获取指定类型的src值的集合
* @param htmlStr
* @param type 标签名称
* @return
* 简历
*/
public static Set<String> getSrcStr(String htmlStr, String type) {
Set<String> srcs = new HashSet<String>();
String src = "";
Pattern p_src;
Matcher m_src;
// String regEx_img = "<img.*src=(.*?)[^>]*?>"; //图片链接地址
String regEx_src = "<"+type+".*src\\s*=\\s*(.*?)[^>]*?>";
p_src = Pattern.compile
(regEx_src, Pattern.CASE_INSENSITIVE);
m_src = p_src.matcher(htmlStr);
while (m_src.find()) {
// 得到<img />数据
src = m_src.group();
// 匹配<img>中的src数据
Matcher m = Pattern.compile("src\\s*=\\s*\"?(.*?)(\"|>|\\s+)").matcher(src);
while (m.find()) {
srcs.add(m.group(1));
}
}
return srcs;
}
public User getUser(int uid){
User user = new User();
RecordSet rs = new RecordSet();
if (uid == 1)
rs.executeQuery("select * from hrmresourcemanager where id=?", uid);
else {
rs.executeQuery("select * from hrmresource where id=?", uid);
}
String userid = "";
if (rs.next()) {
userid = rs.getString("id");
user.setUid(rs.getInt("id"));
user.setLogintype("1");
user.setLoginid(rs.getString("loginid"));
user.setFirstname(rs.getString("firstname"));
user.setLastname(rs.getString("lastname"));
user.setAliasname(rs.getString("aliasname"));
user.setTitle(rs.getString("title"));
user.setTitlelocation(rs.getString("titlelocation"));
user.setSex(rs.getString("sex"));
String langid = rs.getString("systemlanguage");
user.setLanguage(Util.getIntValue(langid, 0));
user.setTelephone(rs.getString("telephone"));
user.setMobile(rs.getString("mobile"));
user.setMobilecall(rs.getString("mobilecall"));
user.setEmail(rs.getString("email"));
user.setCountryid(rs.getString("countryid"));
user.setLocationid(rs.getString("locationid"));
user.setResourcetype(rs.getString("resourcetype"));
user.setStartdate(rs.getString("startdate"));
user.setEnddate(rs.getString("enddate"));
user.setContractdate(rs.getString("contractdate"));
user.setJobtitle(rs.getString("jobtitle"));
user.setJobgroup(rs.getString("jobgroup"));
user.setJobactivity(rs.getString("jobactivity"));
user.setJoblevel(rs.getString("joblevel"));
user.setSeclevel(rs.getString("seclevel"));
user.setUserDepartment(Util.getIntValue(rs.getString("departmentid"),0));
user.setUserSubCompany1(Util.getIntValue(rs.getString("subcompanyid1"),0));
user.setUserSubCompany2(Util.getIntValue(rs.getString("subcompanyid2"),0));
user.setUserSubCompany3(Util.getIntValue(rs.getString("subcompanyid3"),0));
user.setUserSubCompany4(Util.getIntValue(rs.getString("subcompanyid4"),0));
user.setManagerid(rs.getString("managerid"));
user.setAssistantid(rs.getString("assistantid"));
user.setPurchaselimit(rs.getString("purchaselimit"));
user.setCurrencyid(rs.getString("currencyid"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String lastLoginDate = sdf.format(new Date());
user.setLastlogindate(lastLoginDate);
user.setLogintype("1");
user.setAccount(rs.getString("account"));
}
return user;
}
public String httpPostRequest(String param,String url,String token){
BaseBean baseBean = new BaseBean();
JSONObject jsonObject = new JSONObject();
String responseBody="";
try {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(url);
JSONObject jsonString = JSON.parseObject(param);
//设置请求体参数
StringEntity entity = new StringEntity(param,"utf-8");
baseBean.writeLog("entity-param->"+param);
baseBean.writeLog("entity-->"+entity);
entity.setContentEncoding("utf-8");
baseBean.writeLog("entity-utf-8->"+entity);
httpPost.setEntity(entity);
//设置请求头部
httpPost.setHeader("Content-Type", "application/json");
if(token != null && !"".equals(token)){
httpPost.setHeader("Authorization",token);
}
//执行请求,返回请求响应
CloseableHttpResponse response = httpClient.execute(httpPost);
//请求返回状态码
int statusCode = response.getStatusLine().getStatusCode();
baseBean.writeLog("statusCode状态码->"+statusCode);
//请求成功
if (statusCode == HttpStatus.SC_OK && statusCode <= HttpStatus.SC_TEMPORARY_REDIRECT) {
//取出响应体
HttpEntity entity2 = response.getEntity();
//从响应体中解析出token
responseBody = EntityUtils.toString(entity2, "utf-8");
// jsonObject = JSONObject.parseObject(responseBody);
baseBean.writeLog("responseBody->"+responseBody);
// baseBean.writeLog("jsonObject->"+jsonObject);
//token = jsonObject.getString("access_token");
} else {
//请求失败
throw new ClientProtocolException("请求失败,响应码为:" + statusCode);
}
} catch (Exception e) {
e.printStackTrace();
}
return responseBody;
}
/**
* 发送http get请求
*/
public static String httpGet(String url,Map<String,String> headers,String encode){
BaseBean bb = new BaseBean();
if(encode == null){
encode = "utf-8";
}
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
String content = null;
//since 4.3 不再使用 DefaultHttpClient
try {
closeableHttpClient = HttpClientBuilder.create().build();
HttpGet httpGet = new HttpGet(url);
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpGet.setHeader(entry.getKey(),entry.getValue());
}
}
bb.writeLog("url="+url+"header="+headers+"encode="+encode);
httpResponse = closeableHttpClient.execute(httpGet);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
/**
* 向指定 URL 发送POST方法的请求
*
* @param url 发送请求的 URL
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @return 所代表远程资源的响应结果
*/
public static String sendPost(String url, String param) {
BaseBean bb = new BaseBean();
String result = "";
PrintWriter out = null;
BufferedReader in = null;
HttpURLConnection connection = null;
try {
URL postUrl = new URL(url);
bb.writeLog("getUrl-->"+postUrl);
// 打开和URL之间的连接
connection = (HttpURLConnection) postUrl.openConnection();
// 在connect之前设置通用的请求属性
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.setRequestProperty("Charsert", "UTF-8");
connection.setConnectTimeout(15000);
connection.setReadTimeout(60000);
// 发送POST请求必须设置如下两行参数要放在http正文内
connection.setDoOutput(true);
connection.setDoInput(true);
// 默认是 GET方式
connection.setRequestMethod("POST");
// Post 请求不使用缓存
connection.setUseCaches(false);
// 配置本次连接的Content-typeform表单是"application/x-www-form-urlencoded"json是"application/json"等
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.connect();
// 参数要放在http正文内
//1.获取URLConnection对象对应的输出流
out = new PrintWriter(connection.getOutputStream());
//2.中文有乱码的需要将PrintWriter改为如下
//out=new OutputStreamWriter(conn.getOutputStream(),"UTF-8")
out.print(param);
out.flush();
//也可以使用DataOutputStream
// DataOutputStream dos=new DataOutputStream(httpConn.getOutputStream());
// dos.writeBytes(param);
// dos.flush();
// dos.close();
// 定义BufferedReader输入流来读取URL的响应
if (connection.getResponseCode() == 200) {
in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
}
} catch (Exception e) {
bb.writeLog("发送 POST 请求出现异常!" + e);
e.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
if (connection != null) {
//关闭连接
connection.disconnect();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return result;
}
/**
* 发送 http post 请求参数以form表单键值对的形式提交。
*/
public static String httpPostForm(String url,Map<String,String> params, Map<String,String> headers,String encode){
BaseBean bb = new BaseBean();
if(encode == null){
encode = "utf-8";
}
String content = null;
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
try {
closeableHttpClient = HttpClients.createDefault();
HttpPost httpost = new HttpPost(url);
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpost.setHeader(entry.getKey(),entry.getValue());
}
}
bb.writeLog("url="+url+"header="+headers+"encode="+encode);
bb.writeLog("params="+params);
//组织请求参数
List<NameValuePair> paramList = new ArrayList <NameValuePair>();
if(params != null && params.size() > 0){
Set<String> keySet = params.keySet();
for(String key : keySet) {
paramList.add(new BasicNameValuePair(key, params.get(key)));
}
}
httpost.setEntity(new UrlEncodedFormEntity(paramList, encode));
httpResponse = closeableHttpClient.execute(httpost);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
/**
* 公钥加密
*
* @param content 内容
* @param publicKey 公钥
* @return 加密后的密文
* @throws Exception 异常信息
*/
public static String encrypt(String content, String publicKey) throws Exception {
//base64编码的公钥
byte[] decoded = org.apache.commons.codec.binary.Base64.decodeBase64(publicKey);
RSAPublicKey pubKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded));
//RSA加密
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, pubKey);
return Base64.encodeBase64String(cipher.doFinal(content.getBytes(StandardCharsets.UTF_8)));
}
public static String getPublicKey(){
BaseBean bb = new BaseBean();
String publicKey ="";
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));
//请求获取publicKey接口
Map<String,String> headers = new HashMap<>();
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","publicKeyUrl"));
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID","123");
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
String msg = httpGet(url,headers,null);
bb.writeLog("===获取publickey返回值===="+msg);
try {
org.json.JSONObject resMsg = new org.json.JSONObject(msg);
bb.writeLog("===获取publickey返回值===="+resMsg);
if(resMsg.has("pubKey")){
publicKey = Util.null2String(resMsg.get("pubKey").toString());
}
}catch (Exception e){
e.getMessage();
}
return publicKey;
}
//获取TG
public static String getST(String tgt,String emobileUrl){
BaseBean bb = new BaseBean();
String ST = "";
String retMsg = "";
Map<String,String> params = new HashMap<>();//参数
Map<String,String> headers = new HashMap<>();//headers
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));
//请求获取TG接口
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","stUrl"));
bb.writeLog("==获取TG=="+url);
//移动端首页地址
bb.writeLog("==移动端首页地址=="+emobileUrl);
//获取TGT
params = new HashMap<>();//参数
params.put("tgt",tgt);
params.put("service",emobileUrl);
bb.writeLog("==STparams=="+params);
headers = new HashMap<>();//headers
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID","123");
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
try {
retMsg = httpPostForm(url,params,headers,null);
bb.writeLog("===获取ST返回值===="+retMsg);
org.json.JSONObject resMsg = new org.json.JSONObject(retMsg);
bb.writeLog("===获取ST返回值resMsg===="+resMsg);
if(resMsg.has("ST")){
ST = Util.null2String(resMsg.get("ST").toString());
}
bb.writeLog("===获取ST===="+ST);
}catch(Exception e){
throw new RuntimeException(e);
}
return retMsg;
}
%>
<%
RecordSet rs = new RecordSet();
BaseBean bb=new BaseBean();
RSA rsa = new RSA();
Map<String,String> params = new HashMap<>();//参数
Map<String,String> headers = new HashMap<>();//headers
JSONArray array = new JSONArray();
List<String> decriptList = new ArrayList<>();
String ST ="";//获取ST
bb.writeLog("进入获取简历jsp-->");
String login_id = "";
String user_password = "";
User user = HrmUserVarify.getUser(request, response);
int uid = user.getUID();
bb.writeLog("uid-->"+uid);
rs.executeQuery("select id,loginid,password,createtime from EmobileLoginDetail where id=?", uid);
if(rs.next()){
login_id = Util.null2String(rs.getString("loginid"));
user_password = Util.null2String(rs.getString("password"));
}
bb.writeLog("login_id-->"+login_id);
bb.writeLog("user_password-->"+user_password);
//获取session
session = request.getSession(true);
String certified_token = Util.null2String(session.getAttribute("certified_token"));
bb.writeLog("获取sessionTGT=="+certified_token);
//获取cookie
Cookie[] cookies = request.getCookies();
bb.writeLog("获取cookies=="+cookies);
String idd = "";
if(cookies != null){
for(Cookie cookie:cookies){
bb.writeLog("获取cookiesName=="+cookie.getName());
if(cookie.getName().equals("loginidweaver")){
idd = cookie.getValue();
bb.writeLog("获取idd=="+idd);
}
}
}
//查询人员工号
RecordSet recordSet = new RecordSet();
String requestURI = request.getRequestURI();
bb.writeLog("请求路径="+requestURI);
Map<String, Object> useridMap = ParamUtil.request2Map(request);
bb.writeLog("人员id="+useridMap.get("userid"));
recordSet.executeQuery("select WORKCODE from HRMRESOURCE where id=?", Util.null2String(useridMap.get("userid")));
String workcode = "";
if (recordSet.next()){
workcode = Util.null2String(recordSet.getString("WORKCODE"));
}
bb.writeLog("人员workcode="+useridMap.get("workcode"));
//查询
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));//publicKey
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","stUrl"));//获取ST的url
String cockpitUrl = Util.null2String(bb.getPropValue("tjbankEMobileSSO","cockpitUrl"));
String tgturl = Util.null2String(bb.getPropValue("tjbankEMobileSSO","tgtUrl"));//请求获取TGT地址
//获取ST带着下游系统
// if (!isEmpty(certified_token)){
// String responseInfo = getST(certified_token,cockpitUrl);
// bb.writeLog("进入responseInfo-->"+responseInfo);
// if (isEmpty(responseInfo)){
// out.print("单点系统接口返回值为null");
// return;
// }else {
// org.json.JSONObject stMsg = new org.json.JSONObject(responseInfo);
// if(stMsg.has("ST")){
// ST = Util.null2String(stMsg.get("ST").toString());
// }else{
// out.print(Util.null2String(stMsg.getString("message")));
// return;
// }
//
// String loginUrl = "";
// String remuseUrl = bb.getPropValue("tjbkremuse", "url");
// boolean isEm = Util.null2String(request.getHeader("user-agent")).indexOf("E-Mobile") > -1;
// if(isEm == true){
// loginUrl=remuseUrl+workcode+"&ticket="+ST;
// }
//
// //loginUrl = "https://www.baidu.com/";
// bb.writeLog("loginUrl-->"+loginUrl);
// out.print("跳转路径-->"+loginUrl);
// out.print("进入驾驶舱成功");
// response.sendRedirect(loginUrl);
// // return;
// }
// }else {
String TGT ="";
String passWord ="";
String retMsg ="";
decriptList.add(login_id);
decriptList.add(user_password);
List<String> resultList = rsa.decryptList(request, decriptList);
String loginId = resultList.get(0);
String userPassword = resultList.get(1);
String publicKey = getPublicKey();
passWord = encrypt(user_password, publicKey);
params = new HashMap<>();//参数
params.put("username",loginId);
params.put("password",passWord);
bb.writeLog("==STparams=="+params);
headers = new HashMap<>();//headers
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID","123");
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
retMsg = httpPostForm(tgturl,params,headers,null);
bb.writeLog("===获取TGT返回值retMsg===="+retMsg);
org.json.JSONObject resMsg = new org.json.JSONObject(retMsg);
bb.writeLog("===获取TGT返回值===="+resMsg);
if(resMsg.has("TGT")){
TGT = Util.null2String(resMsg.get("TGT").toString());
}
String responseInfo = getST(TGT,cockpitUrl);
if (isEmpty(responseInfo)){
out.print("单点系统接口返回值为null");
return;
}else {
org.json.JSONObject stMsg = new org.json.JSONObject(responseInfo);
if(stMsg.has("ST")){
ST = Util.null2String(stMsg.get("ST").toString());
}else{
out.print(Util.null2String(stMsg.getString("message")));
return;
}
String loginUrl = "";
String remuseUrl = bb.getPropValue("tjbkremuse", "url");
boolean isEm = Util.null2String(request.getHeader("user-agent")).indexOf("E-Mobile") > -1;
if(isEm == true){
loginUrl=remuseUrl+workcode+"&ticket="+ST;
//loginUrl="http://123.151.115.199:8080/bi/PCFW?proc=1&action=viewer&hback=true&db=%E6%99%BA%E6%85%A7%E6%96%B9%E7%95%A5/%E5%89%8D%E7%BD%AE%E9%A1%B5.db&ticket="+ST;
}
bb.writeLog("loginUrl-->"+loginUrl);
out.print("跳转路径-->"+loginUrl);
out.print("进入驾驶舱成功");
response.sendRedirect(loginUrl);
// }
// out.print("进入驾驶舱系统失败,请先获取标识");
//return;
}
%>
 <script type="text/javascript">
<%--<%=httpPostRequest%>;--%>
// alert("00000");
// next();
//   function next(){
// alert("2222");
// console.log("111111111");
<%--console.log("http://10.16.103.18:9900/coremail/main.jsp?sid="+<%=sid%>);--%>
<%--console.log("sid="+<%=sid%>);--%>
<%--window.location.href= "http://10.16.103.18:9900/coremail/main.jsp?sid="+<%=sid%>;--%>
//   window.location.href= "https://www.baidu.com/";
<%--   }--%>
 </script>

@ -0,0 +1,85 @@
package com;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.Socket;
public class Client {
public static final int port = 8090;
public static final String host = "14.1.209.146";
// public static final String host = "127.0.0.1";
public static void main(String[] args) {
System.out.println("Client Start...");
// while (true) {
Socket socket = null;
try {
//创建一个流套接字并将其连接到指定主机上的指定端口号
socket = new Socket(host,port);
//读取服务器端数据
BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
//向服务器端发送数据
PrintStream out = new PrintStream(socket.getOutputStream());
// System.out.print("请输入: \t");
// String str = new BufferedReader(new InputStreamReader(System.in)).readLine();
String str = "00000656<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<Service>\n" +
" <Service_Header>\n" +
" <service_sn>1010157010000001812</service_sn>\n" +
" <system_id>0258</system_id>\n" +
" <requester_id>0157</requester_id>\n" +
" <branch_id>010231100</branch_id>\n" +
" <channel_id>01</channel_id>\n" +
" <service_time>20230621170408</service_time>\n" +
" <need_request>true</need_request>\n" +
" <SvcCd>500130004</SvcCd>\n" +
" <SvcScn>13</SvcScn>\n" +
" <BnkSrlNo>015720230621010000001812</BnkSrlNo>\n" +
" <FileFlg>0</FileFlg>\n" +
" <FilePath/>\n" +
" </Service_Header>\n" +
" <Service_Body>\n" +
" <request>\n" +
" <method>getCount</method>\n" +
" <path>todo</path>"+
" <args>\n" +
" <entry>\n" +
" <key>userNum</key>\n" +
" <value>10110039</value>\n" +
" </entry>\n" +
" </args>\n" +
" </request>\n" +
" </Service_Body>\n" +
"</Service>";
System.out.println(str.substring(8,str.length()-1));
System.out.println(str.length());
out.println(str);
String ret = input.readLine();
System.out.println("服务器端返回过来的是: " + ret);
// 如接收到 "OK" 则断开连接
if ("OK".equals(ret)) {
System.out.println("客户端将关闭连接");
Thread.sleep(500);
// break;
}
out.close();
input.close();
} catch (Exception e) {
System.out.println("客户端异常:" + e.getMessage());
} finally {
if (socket != null) {
try {
socket.close();
} catch (IOException e) {
socket = null;
System.out.println("客户端 finally 异常:" + e.getMessage());
}
}
}
// }
}
}

@ -0,0 +1,10 @@
package com.api.tjbk;
import com.engine.web.ModeForm.ModeFormWeb;
import javax.ws.rs.Path;
@Path("/tjbkMF")
public class TJBKModeFormWeb extends ModeFormWeb {
}

@ -0,0 +1,11 @@
package com.api.tjbk;
import com.engine.web.tjbk.TJBKWorkFlow;
import javax.ws.rs.Path;
@Path("/tjbk")
public class TJBKWorkFlowWeb extends TJBKWorkFlow {
}

@ -0,0 +1,324 @@
package com.customization.cmd;
import com.alibaba.fastjson.JSON;
import com.cloudstore.dev.api.bean.MessageBean;
import com.engine.core.cfg.annotation.CommandDynamicProxy;
import com.engine.core.interceptor.AbstractCommandProxy;
import com.engine.core.interceptor.Command;
import com.engine.workflow.cmd.requestForm.MsgPush_GetMsgBeansCmd;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.StringUtil;
import weaver.general.Util;
import weaver.hrm.User;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@CommandDynamicProxy(target = MsgPush_GetMsgBeansCmd.class, desc = "流程数据推送消息cmd")
public class MsgPush_GetMsgBeansCmdProxyTitle extends AbstractCommandProxy<List<MessageBean>> {
//匹配${text}的占位符
private static final Pattern PLACEHOLDER_PATTERN = Pattern.compile("\\$\\{([^}]+)\\}");
private static final String getTitleAndFormsql = "select id,WFFORMNAME,TITLE from uf_gwtsth where WFID in( select id from workflow_base where activeversionid =( select activeversionid from workflow_base where id = ?))";
private static final String getdtFieldtype = "select FIELDNAME,TYPE from uf_gwtsth_dt1 where MAINID = ?";
BaseBean bean = new BaseBean();
@Override
public List<MessageBean> execute(Command<List<MessageBean>> command) {
BaseBean bb = new BaseBean();
MsgPush_GetMsgBeansCmd cmd = (MsgPush_GetMsgBeansCmd) command;
//获取MessageBeans
List<MessageBean> list = cmd.getMessageBeans();
if (!isOpen()) {
return list;
}
//业务对象 流程id
String targetId = "";
RecordSet rs = new RecordSet();
List<MessageBean> messageBeans = new ArrayList<>();
try {
for (int i = 0; i < list.size(); i++) {
String requestname = "";
String requestlevel = "";
Integer wfid = 0;
MessageBean messageBean = list.get(i);
targetId = messageBean.getTargetId();
if (targetId.indexOf("|") > 0) {
continue;
}
if (targetId.indexOf("_") > 0) {
// targetId = targetId.split("_")[0];
continue;
}
rs.execute("select requestlevel , workflowid ,requestname from workflow_requestbase where requestid = " + targetId);
if (rs.next()) {
requestname = rs.getString("requestname");
wfid = Util.getIntValue(rs.getString("workflowid"));
requestlevel = rs.getString("requestlevel");
}
bean.writeLog("流程wfid==="+wfid);
if (!isUpdateTitle(wfid)) {
//流程类型 3 是特急 2 是重要
if("3".equals(requestlevel)||"2".equals(requestlevel)){
messageBeans.add(messageBean);
}
continue;
}
rs.executeQuery(getTitleAndFormsql, wfid);
String formTable = "";
String title = "";
String mainid = "";
if (rs.next()) {
formTable = Util.null2String(rs.getString("WFFORMNAME"));
title = Util.null2String(rs.getString("TITLE"));
mainid = Util.null2String(rs.getString("id"));
}
Map<String, String> updateField = getUpdateField(mainid);
String newTitle = "";
if (updateField.size() > 0) {
Map<String, String> fieldValue = getFieldValue(formTable, targetId, updateField);
newTitle = replacePlaceholders(title, fieldValue);
} else {
newTitle = title;
}
messageBean.setTitle(newTitle);
messageBean.setBizTitle(null);
messageBean.setBizType(null);
//流程类型 3 是特急 2 是重要
if("3".equals(requestlevel)||"2".equals(requestlevel)){
messageBeans.add(messageBean);
}
}
} catch (Exception e) {
bb.writeLog("异常信息" + e.getMessage());
e.printStackTrace();
return list;
}
bb.writeLog("新组建的messageBeans" + list);
return list;
}
// 获取字段类型
private Map<String, String> getUpdateField(String id) {
HashMap<String, String> idTypeMap = new HashMap<>();
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(getdtFieldtype, id);
while (recordSet.next()) {
String field = Util.null2String(recordSet.getString("FIELDNAME"));
String type = Util.null2String(recordSet.getString("TYPE"));
idTypeMap.put(field, type);
}
return idTypeMap;
}
//根据建模表查询是否需要更新标题
private boolean isUpdateTitle(int wfid) {
String sql = "select count(1) cnt from uf_gwtsth where wfid in( select id from workflow_base where activeversionid =( select activeversionid from workflow_base where id = ?))";
RecordSet rs = new RecordSet();
rs.executeQuery(sql, wfid);
int cnt = 0;
if (rs.next()) {
cnt = Util.getIntValue(rs.getString("cnt"), 0);
}
bean.writeLog("是否推送==="+cnt);
return cnt > 0;
}
//配置文件是否开启
private boolean isOpen() {
String isopen = new BaseBean().getPropValue("updateMsgTitle", "isopen");
return "1".equals(isopen);
// return true;
}
//替换占位符
public static String replacePlaceholders(String inputText, Map<String, String> placeholderValues) {
Matcher matcher = PLACEHOLDER_PATTERN.matcher(inputText);
StringBuffer result = new StringBuffer();
while (matcher.find()) {
String placeholder = matcher.group(1);
String replacement = placeholderValues.get(placeholder);
if (replacement != null) {
matcher.appendReplacement(result, replacement);
}
}
matcher.appendTail(result);
return result.toString();
}
// 获取字段对应的值
private Map<String, String> getFieldValue(String formName, String requestid, Map<String, String> fieldTypeMap) {
HashMap<String, String> FieldValue = new HashMap<>();
if (fieldTypeMap.size() == 0) {
return FieldValue;
}
String sql = "select " + String.join(", ", fieldTypeMap.keySet()) + " from " + formName + " where REQUESTID = ?";
RecordSet recordSet = new RecordSet();
RecordSet rs = new RecordSet();
recordSet.executeQuery(sql, requestid);
recordSet.next();
fieldTypeMap.forEach((key, value) -> {
//库里存的值
String fieldValue = Util.null2String(recordSet.getString(key));
//数据值 (防止在循环里创建recordSet对象,使用同一个recordSet对象)
String FieldrealValue = getFieldRealValue(fieldValue, value, rs, formName, key);
FieldValue.put(key, FieldrealValue);
});
return FieldValue;
}
private String getFieldRealValue(String fieldValue, String type, RecordSet rs, String formName, String fieldname) {
//为空或者类型等于0(文本)直接返回字段值
if (StringUtil.isEmpty(fieldValue) || StringUtil.isEmpty(type) || "0".equals(type)) {
return fieldValue;
}
String sql = "";
Boolean isMultiple = fieldValue.contains(",");
if ("1".equals(type)) { //人力资源
sql = "select lastName from HRMRESOURCE where id ";
if (!isMultiple) {
sql = sql + "= ?";
rs.executeQuery(sql, fieldValue);
if (rs.next()) {
return Util.null2String(rs.getString("lastName"));
}
} else {
sql = sql + "in ( " + fieldValue + " )";
ArrayList<String> fieldValues = new ArrayList<>();
rs.executeQuery(sql);
while (rs.next()) {
fieldValues.add(Util.null2String(rs.getString("lastName")));
}
return String.join(",", fieldValues);
}
} else if ("2".equals(type)) { //部门
sql = "select DEPARTMENTNAME from HRMDEPARTMENT where id";
if (!isMultiple) {
sql = sql + "= ?";
rs.executeQuery(sql, fieldValue);
if (rs.next()) {
return Util.null2String(rs.getString("DEPARTMENTNAME"));
}
} else {
sql = sql + "in ( " + fieldValue + " )";
ArrayList<String> fieldValues = new ArrayList<>();
rs.executeQuery(sql);
while (rs.next()) {
fieldValues.add(Util.null2String(rs.getString("DEPARTMENTNAME")));
}
return String.join(",", fieldValues);
}
} else if ("3".equals(type)) { //分部
sql = "select SUBCOMPANYNAME from HRMSUBCOMPANY where id";
if (!isMultiple) {
sql = sql + "= ?";
rs.executeQuery(sql, fieldValue);
if (rs.next()) {
return Util.null2String(rs.getString("SUBCOMPANYNAME"));
}
} else {
sql = sql + "in ( " + fieldValue + " )";
ArrayList<String> fieldValues = new ArrayList<>();
rs.executeQuery(sql);
while (rs.next()) {
fieldValues.add(Util.null2String(rs.getString("SUBCOMPANYNAME")));
}
return String.join(",", fieldValues);
}
} else if ("4".equals(type)) { //选择框
String fid = "";
sql = "select field.id fid from workflow_bill bill " +
"left join workflow_billfield field on bill.ID = field.BILLID " +
"where TABLENAME = ? and FIELDNAME = ? ";
rs.executeQuery(sql, formName, fieldname);
bean.writeLog("选择框sql" + sql + formName + fieldname);
if (rs.next()) {
fid = Util.null2String(rs.getString("fid"));
}
bean.writeLog("fid===" + fid);
sql = " select * from workflow_SelectItem where FIELDID = ? and SELECTVALUE ";
if (!isMultiple) {
sql = sql + "= ?";
rs.executeQuery(sql, fid, fieldValue);
bean.writeLog("选项sql===" + sql + fid + fieldValue);
if (rs.next()) {
return Util.null2String(rs.getString("SELECTNAME"));
}
} else {
sql = sql + "in ( " + fieldValue + " )";
ArrayList<String> fieldValues = new ArrayList<>();
rs.executeQuery(sql, fid);
while (rs.next()) {
fieldValues.add(Util.null2String(rs.getString("SELECTNAME")));
}
return String.join(",", fieldValues);
}
} else if ("5".equals(type)) { //自定义
String fid = "";
String ftype = "";
sql = "select field.id fid , FIELDDBTYPE ftype from workflow_bill bill " +
"left join workflow_billfield field on bill.ID = field.BILLID " +
"where TABLENAME = ? and FIELDNAME = ? ";
rs.executeQuery(sql, formName, fieldname);
bean.writeLog("选择框sql" + sql + formName + fieldname);
if (rs.next()) {
fid = Util.null2String(rs.getString("fid"));
ftype = Util.null2String(rs.getString("ftype"));
}
String[] browArr = ftype.split("\\.");
if (browArr.length != 2){
return "";
}
String brower = browArr[1];
sql = "select a.SHOWNAME ,a.SQLTEXT ,c.FIELDNAME from mode_browser a " +
" left join mode_custombrowserdspfield b on a.CUSTOMID = b.CUSTOMID " +
" left join workflow_billfield c on b.FIELDID = c.ID " +
" where b.ISTITLE > 0 and SHOWNAME = ? ";
rs.executeQuery(sql, brower);
bean.writeLog("选择框sql" + sql + "======"+brower);
String showName = "";
String sqltext = "";
String linkName = "";
if (rs.next()) {
showName = Util.null2String(rs.getString("SHOWNAME"));
sqltext = Util.null2String(rs.getString("SQLTEXT"));
linkName = Util.null2String(rs.getString("FIELDNAME"));
}
if (!isMultiple) {
sqltext = sqltext + " where id = ?";
rs.executeQuery(sqltext, fieldValue);
bean.writeLog("选项sql===" + sqltext + fid + fieldValue);
if (rs.next()) {
return Util.null2String(rs.getString(linkName));
}
} else {
sqltext = sqltext + " where id in ( " + fieldValue + " )";
ArrayList<String> fieldValues = new ArrayList<>();
rs.executeQuery(sql);
while (rs.next()) {
fieldValues.add(Util.null2String(rs.getString(linkName)));
}
return String.join(",", fieldValues);
}
}
return null;
}
}

@ -0,0 +1,251 @@
package com.customization.hrm.dept;
import com.api.hrm.service.HrmUserIconService;
import com.api.hrm.service.impl.HrmUserIconServiceImpl;
import com.engine.common.util.ServiceUtil;
import com.engine.hrm.cmd.emmanager.GetOrganizationInfoCmd;
import org.jsoup.helper.StringUtil;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import java.io.File;
import java.util.*;
import java.util.stream.Collectors;
import com.engine.core.cfg.annotation.CommandDynamicProxy;
import com.engine.core.interceptor.AbstractCommandProxy;
import com.engine.core.interceptor.Command;
import org.apache.log4j.Logger;
import weaver.general.GCONST;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.appdetach.AppDetachComInfo;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.job.JobTitlesComInfo;
import weaver.hrm.resource.ResourceComInfo;
@CommandDynamicProxy(target = GetOrganizationInfoCmd.class,desc="")
public class ProxyGetOrganizationInfoCmd extends AbstractCommandProxy<Map<String, Object>> {
private Logger log = Logger.getLogger(this.getClass());
@Override
public Map<String, Object> execute(Command<Map<String, Object>> targetCommand) {
GetOrganizationInfoCmd cmd = (GetOrganizationInfoCmd) targetCommand;
// new BaseBean().writeLog("");
Map<String, Object> result = nextExecute(targetCommand);
Map<String, Object> params = cmd.getParams();
Map<String, Object> resultNew = cmd.getParams();
long startTime=System.currentTimeMillis();
//writeLog("进入getOrganizationInfo方法时间===="+startTime);
String cmdType = Util.null2String(params.get("cmd"));
String fetch_mine = Util.null2String(params.get("fetch_mine"));
// new BaseBean().writeLog("fetch_mine",fetch_mine);
if(cmdType.equals("getOrganizationInfo") && "0".equals(fetch_mine)){
resultNew = this.extracted(params,result);;
}else {
resultNew = result;
}
return resultNew;
}
private Map<String, Object> extracted(Map<String, Object> params, Map<String, Object> result) {
try {
BaseBean baseBean = new BaseBean();
Map<String, Object> resultNew = result;
String id = Util.null2String(params.get("id"));//节点id
String userid = Util.null2String(params.get("userid"));//节点id
// int userid = Util.getIntValue(Util.null2String(params.get("userid")));
User user = new User(Integer.parseInt(userid));
String type = "";//节点类型 1 com2 subcom, 3 dept
String tmpStr = id;
if(id.length()>0) {
if (id.startsWith("-")) {
tmpStr = id.replace("-", "");
type = tmpStr.substring(0, 1);
id = "-" + tmpStr.substring(1, tmpStr.length());
} else {
type = tmpStr.substring(0, 1);
id = tmpStr.substring(1, tmpStr.length());
}
if (type.equals("1")) {
type = "com";
id="0";
}else{
type = type.equals("2") ? "com" : "dept";
}
}
RecordSet recordSet = new RecordSet();
ArrayList<String> idlist = new ArrayList<>();
Map<String,String> bmIdHrmMap = new HashMap<>();
ArrayList<String> branchDeptidList = new ArrayList<>();
//查询分部下
if ("com".equals(type)) {
recordSet.executeQuery("select BM,KJRY,FB from uf_txlbxsbm where fb = ?",id);
while (recordSet.next()){
String bm = Util.null2String(recordSet.getString("BM"));
String kjry = Util.null2String(recordSet.getString("KJRY"));
// String fb = Util.null2String(recordSet.getString("FB"));
idlist.add(bm);
bmIdHrmMap.put(bm,kjry);
}
}
//查询部门下
if ("dept".equals(type)) {
recordSet.executeQuery("select BM,KJRY,FB from uf_txlbxsbm where SJBM = ?",id);
while (recordSet.next()){
String bm = Util.null2String(recordSet.getString("BM"));
String kjry = Util.null2String(recordSet.getString("KJRY"));
// String fb = Util.null2String(recordSet.getString("FB"));
idlist.add(bm);
bmIdHrmMap.put(bm,kjry);
}
recordSet.executeQuery("select ZBM ,kjry from uf_branchdept t1 left join uf_branchdept_dt1 d1 on t1.id = d1.mainid " +
" where t1.DEPT = ?",id);
while (recordSet.next()){
String bm = Util.null2String(recordSet.getString("ZBM"));
String kjry = Util.null2String(recordSet.getString("KJRY"));
// String fb = Util.null2String(recordSet.getString("FB"));
idlist.add(bm);
bmIdHrmMap.put(bm,kjry);
branchDeptidList.add(bm);
}
}
List<Map<String,Object>> departmentList = (List<Map<String, Object>>)(resultNew.get("department"));
List<Map<String,Object>> departmentListNew = new ArrayList<>();
//过滤建模表里的部门
for (Map<String, Object> department : departmentList){
String deptid = department.get("id").toString() ;
deptid = deptid.substring(1, deptid.length());
if (!idlist.contains(deptid)){
departmentListNew.add(department);
}else {
String kjry = bmIdHrmMap.get(deptid);
List<String> kjrylist = Arrays.asList(kjry.split(","));
if (kjrylist.contains(userid)){
departmentListNew.add(department);
}
}
}
resultNew.put("department",departmentListNew);
//添加明细里部门的人员
List<Map<String,Object>> userlist = (List<Map<String, Object>>)(resultNew.get("userlist"));
// baseBean.writeLog("人员子部门====",branchDeptidList);
for (String deptid : branchDeptidList) {
List<Map<String,Object>> resourceList = this.getResourceList(deptid,user,params);
// baseBean.writeLog("子部门人员列表====",resourceList);
userlist.addAll(resourceList);
}
// 使用Comparator对List中的Map进行排序
Collections.sort(userlist, Comparator.comparingDouble(m -> (Double)m.get("showorder")));
resultNew.put("userlist",userlist);
return resultNew;
}catch (Exception e){
new BaseBean().writeLog(e.getMessage());
e.printStackTrace();
return result;
}
}
/***
*
* @param departmentId
* @return
*/
private List<Map<String,Object>> getResourceList(String departmentId , User user , Map<String, Object> params){
List<Map<String,Object>> resourceList = new ArrayList<>();
Map<String,Object> resourceInfo = null;
RecordSet rs = new RecordSet();
String sql = "";
try{
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
ResourceComInfo resourceComInfo = new ResourceComInfo();
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
boolean enable_main_account = "1".equals(Util.null2String(params.get("enable_main_account")).trim());
departmentComInfo.setTofirstRow();
AppDetachComInfo adci = new AppDetachComInfo(user);
sql = " select hr.id, hr.lastname, hr.sex, hr.managerid, hr.jobtitle, hr.status, hr.dsporder, hr.messagerurl, hr.pinyinlastname, hr.accounttype, hr.belongto "
+ " from hrmresource hr, hrmdepartment t2 "
+ " where hr.departmentid=t2.id and t2.id=?" ;
String sqlwhere =" and hr.status in (0,1,2,3)";
if(adci.isUseAppDetach()){
String appdetawhere = adci.getScopeSqlByHrmResourceSearch(user.getUID()+"",true,"resource_hr");
String tempstr= (appdetawhere!=null&&!"".equals(appdetawhere)?(" and " + appdetawhere):"");
sqlwhere+=tempstr;
}
if(sqlwhere.length()>0)sql+=sqlwhere;
sql += " order by hr.dsporder ";
rs.executeQuery(sql,departmentId);
while (rs.next()) {
String userid = rs.getString("id");
String lastname = Util.formatMultiLang(rs.getString("lastname"),""+user.getLanguage());
String accounttype = rs.getString("accounttype");
String belongto = "1".equals(accounttype)?Util.null2String(rs.getString("belongto")):"";
String belongto_name = Util.formatMultiLang(resourceComInfo.getLastname(belongto),""+user.getLanguage());
String pinyinlastname = Util.null2String(rs.getString("pinyinlastname"));
String sex = Util.null2String(rs.getString("sex"),"0");
String managerid = rs.getString("managerid");
String managername = Util.formatMultiLang(managerid.length() > 0 ? resourceComInfo.getResourcename(managerid) : "",""+user.getLanguage());
String jobtitle = rs.getString("jobtitle");
String jobtitlename = Util.formatMultiLang(jobTitlesComInfo.getJobTitlesname(jobtitle),""+user.getLanguage());
String status = rs.getString("status");
String showorder = Util.toDecimalDigits(rs.getString("dsporder"),2);
String messagerurl = rs.getString("messagerurl");
resourceInfo = new HashMap<>();
resourceInfo.put("userid",userid);
resourceInfo.put("name",lastname);
if(enable_main_account){
resourceInfo.put("main_base_user_id",belongto );
resourceInfo.put("main_base_user_name",belongto_name);
}
resourceInfo.put("manager_id",managerid);
resourceInfo.put("manager_name",managername);
resourceInfo.put("position",jobtitlename);
resourceInfo.put("status",status);
resourceInfo.put("showorder",showorder);
resourceInfo.put("gender",Util.getIntValue(sex));
resourceInfo.put("base_user_id",userid);
resourceInfo.put("base_user_name",lastname);
resourceInfo.put("name_simple_pingyin",pinyinlastname);
resourceInfo.put("name_full_pingyin",pinyinlastname);
resourceInfo.put("guangliyuanxiashu",pinyinlastname);
resourceInfo.put("base_name_simple_pingyin",pinyinlastname);
resourceInfo.put("base_name_full_pingyin",pinyinlastname);
Map<String,Object> avatar = new HashMap<>();//头像信息
params.put("userId",userid);
Map<String,Object> userIconInfo = ((HrmUserIconService) ServiceUtil.getService(HrmUserIconServiceImpl.class, user)).getUserIcon(params,user);
String media_id = userIconInfo.get("messagerurl").toString();
//这种格式得手机端显示不出来,取默认设置图片
if(media_id.startsWith("/weaver/weaver.file.FileDownload")){
media_id = userIconInfo.get("defaultmessagerurl").toString();
}else if(messagerurl.length()>0){
String filePath = GCONST.getRootPath() + media_id;
File file = new File(filePath);
if(!file.exists()){
media_id = userIconInfo.get("defaultmessagerurl").toString();
}
}
resourceInfo.put("avatar",avatar);
avatar.put("default","");
avatar.put("show_name", userIconInfo.get("shortname").toString());
avatar.put("show_color",userIconInfo.get("background").toString());
avatar.put("media_id",media_id);
resourceList.add(resourceInfo);
}
}catch (Exception e){
new BaseBean().writeLog(e);
}
// new BaseBean().writeLog("resourceList",resourceList);
return resourceList;
}
}

@ -0,0 +1,101 @@
package com.customization.hrm.dept.impl;
import com.alibaba.fastjson.JSON;
import com.wbi.util.ParamUtil;
import com.wbi.util.StringUtil;
import com.weaverboot.frame.ioc.anno.classAnno.WeaIocReplaceComponent;
import com.weaverboot.frame.ioc.anno.methodAnno.WeaReplaceAfter;
import com.weaverboot.frame.ioc.handler.replace.weaReplaceParam.impl.WeaAfterReplaceParam;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
@WeaIocReplaceComponent
public class Proxy {
@WeaReplaceAfter(
value = "/api/hrm/base/getHrmSearchTree",
order = 1,
description = "qwer"
)
public String after(WeaAfterReplaceParam weaAfterReplaceParam) {
HttpServletRequest request = weaAfterReplaceParam.getRequest();
HttpServletResponse response = weaAfterReplaceParam.getResponse();
String data = weaAfterReplaceParam.getData();
Map paramMap = ParamUtil.request2Map(request);
String type = Util.null2String(paramMap.get("type"));
String id = Util.null2String(paramMap.get("id"));
User user = HrmUserVarify.getUser(request, response);
int userID = user.getUID();
new BaseBean().writeLog("type===" + type);
if (!StringUtil.isBlank(type)){
Map<String, Object> result = extracted(paramMap, JSON.parseObject(data, Map.class),userID);
return JSON.toJSONString(result);
}else {
return data;
}
}
private Map<String, Object> extracted(Map<String, Object> params, Map<String, Object> result, int userID) {
try {
// Map<String, Object> resultNew = result;
String type = Util.null2String(params.get("type"));
String id = Util.null2String(params.get("id"));
RecordSet recordSet = new RecordSet();
ArrayList<String> idlist = new ArrayList<>();
Map<String,String> bmIdHrmMap = new HashMap<>();
if ("1".equals(type)) {
recordSet.executeQuery("select BM,KJRY,FB from uf_txlbxsbm where fb = ?",id);
while (recordSet.next()){
String bm = Util.null2String(recordSet.getString("BM"));
String kjry = Util.null2String(recordSet.getString("KJRY"));
// String fb = Util.null2String(recordSet.getString("FB"));
idlist.add(bm);
bmIdHrmMap.put(bm,kjry);
}
}
if ("2".equals(type)) {
recordSet.executeQuery("select BM,KJRY,FB from uf_txlbxsbm where SJBM = ?",id);
while (recordSet.next()){
String bm = Util.null2String(recordSet.getString("BM"));
String kjry = Util.null2String(recordSet.getString("KJRY"));
// String fb = Util.null2String(recordSet.getString("FB"));
idlist.add(bm);
bmIdHrmMap.put(bm,kjry);
}
}
List<Map<String,Object>> departmentList = (List<Map<String, Object>>)(result.get("datas"));
List<Map<String,Object>> departmentListNew = new ArrayList<>();
new BaseBean().writeLog(departmentList.toString());
new BaseBean().writeLog(idlist.toString());
new BaseBean().writeLog(bmIdHrmMap.toString());
for (Map<String, Object> department : departmentList){
String deptid = department.get("id").toString() ;
// deptid = deptid.substring(1, deptid.length());
if (!idlist.contains(deptid)){
departmentListNew.add(department);
}else {
String kjry = bmIdHrmMap.get(deptid);
List<String> kjrylist = Arrays.asList(kjry.split(","));
if (kjrylist.contains(userID+"")){
departmentListNew.add(department);
}
}
}
new BaseBean().writeLog(departmentListNew.toString());
result.put("datas",departmentListNew);
new BaseBean().writeLog(result.toString());
return result;
}catch (Exception e){
new BaseBean().writeLog(e.getMessage());
e.printStackTrace();
return result;
}
}
}

@ -0,0 +1,46 @@
package com.customization.wps.doc.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.wbi.util.ParamUtil;
import com.wbi.util.StringUtil;
import com.weaverboot.frame.ioc.anno.classAnno.WeaIocReplaceComponent;
import com.weaverboot.frame.ioc.anno.methodAnno.WeaReplaceAfter;
import com.weaverboot.frame.ioc.handler.replace.weaReplaceParam.impl.WeaAfterReplaceParam;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
@WeaIocReplaceComponent
public class FileInfoAvatarProxy {
@WeaReplaceAfter(
value = "/api/wps/doccenter/outter/v1/3rd/file/info",
order = 1,
description = "修改头像"
)
public String after(WeaAfterReplaceParam weaAfterReplaceParam) {
HttpServletRequest request = weaAfterReplaceParam.getRequest();
HttpServletResponse response = weaAfterReplaceParam.getResponse();
String data = weaAfterReplaceParam.getData();
Map paramMap = ParamUtil.request2Map(request);
// User user = HrmUserVarify.getUser(request, response);
BaseBean baseBean = new BaseBean();
baseBean.writeLog(paramMap);
baseBean.writeLog(data);
JSONObject result = JSON.parseObject(data);
if (result.containsKey("user")){
Map<String, String> user = JSONObject.parseObject(result.getString("user"), Map.class);
user.put("avatar_url","http://14.1.209.146:8080/mobilemode/piclibrary/02-E9_017afd/addressbook.png");
result.put("user",user);
baseBean.writeLog(JSONObject.toJSONString(result));
return JSONObject.toJSONString(result);
}
return data;
}
}

@ -0,0 +1,26 @@
package com.engine.custom.hg.corn;
import com.engine.custom.hg.service.TextDocFileService;
import weaver.general.BaseBean;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class OA2HGorn extends weaver.interfaces.schedule.BaseCronJob {
TextDocFileService service = new TextDocFileService();
BaseBean bean = new BaseBean();
@Override
public void execute() {
bean.writeLog("OA2HGorn====Begin========");
Date date = new Date();
// Calendar calendar = Calendar.getInstance();
// calendar.setTime(date);
// //把日期往后增加一天.整数往后推,负数往前移动(1:表示明天、-1表示昨天0表示今天)
// calendar.add(Calendar.DATE, -1);
// date = calendar.getTime();
SimpleDateFormat yyyyMMdd = new SimpleDateFormat("yyyyMMdd");
String format = yyyyMMdd.format(date);
service.genDocTxt(format,"HG");
}
}

@ -0,0 +1,119 @@
package com.engine.custom.hg.entity;
import java.util.List;
public class HGBean {
private Integer id;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
//流程
private Integer requestId;
//推送内容
private String content;
// 状态
private Integer zt;
// 到达时间
private String ddsj;
// 推送时间
private String tssj;
// 正文目录
private List<String> ml;
// 附件目录
private List<String> fjml;
//正文id
private String zwid;
//附件id
private String fjid;
public String getZwid() {
return zwid;
}
public void setZwid(String zwid) {
this.zwid = zwid;
}
public String getFjid() {
return fjid;
}
public void setFjid(String fjid) {
this.fjid = fjid;
}
public HGBean() {
}
public HGBean(Integer requestId, String content, Integer zt, String ddsj, String tssj, List<String> ml, List<String> fjml) {
this.requestId = requestId;
this.content = content;
this.zt = zt;
this.ddsj = ddsj;
this.tssj = tssj;
this.ml = ml;
this.fjml = fjml;
}
public Integer getRequestId() {
return requestId;
}
public void setRequestId(Integer requestId) {
this.requestId = requestId;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Integer getZt() {
return zt;
}
public void setZt(Integer zt) {
this.zt = zt;
}
public String getDdsj() {
return ddsj;
}
public void setDdsj(String ddsj) {
this.ddsj = ddsj;
}
public String getTssj() {
return tssj;
}
public void setTssj(String tssj) {
this.tssj = tssj;
}
public List<String> getMl() {
return ml;
}
public void setMl(List<String> ml) {
this.ml = ml;
}
public List<String> getFjml() {
return fjml;
}
public void setFjml(List<String> fjml) {
this.fjml = fjml;
}
}

@ -0,0 +1,324 @@
package com.engine.custom.hg.service;
import com.engine.custom.hg.entity.HGBean;
import com.engine.custom.hg.util.HgUtils;
import com.engine.custom.hg.util.ZipUtil;
import org.apache.tools.zip.ZipOutputStream;
import weaver.conn.RecordSet;
import weaver.file.ImageFileManager;
import weaver.general.BaseBean;
import weaver.general.Util;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
public class TextDocFileService {
private static ZipUtil zipUtil= new ZipUtil();
BaseBean bean = new BaseBean();
private final String filePath = bean.getPropValue("fjwz","filePath");
// private static final String filePath = "E:\\test";
//出巡时间内推送失败或未推送的数据
public static final String getrqBydatesql = "select * from uf_tohgLog where ddsj > ? and ddsj < ? and( zt = 0 or zt = 2)";
public static final String updatesql = "update uf_tohgLog set esbml = ? where id = ?";
public static final String updatetxtsql = "update uf_tohgLog set zt = 1 , esbtxtml = ? where id in (";
public void genDocTxt(String day, String tranCode) {
String dirDate = zipUtil.mkTemper(filePath);
RecordSet recordSet = new RecordSet();
bean.writeLog("dirDate====="+dirDate);
Date date = getDate(day);
// 获取当前时间的第一秒
SimpleDateFormat yyyyMMddHHmmss = new SimpleDateFormat("yyyy-MM-dd HH:mm");
String firstSecond = yyyyMMddHHmmss.format(getFirstSecondOfDate(date));
// 获取当前时间的最后一秒
String lastSecond =yyyyMMddHHmmss.format(getLastSecondOfDate(date));
File file = null;
List<HGBean> HGBeans = getData(firstSecond, lastSecond);
String dateDir = "tohg_" + new SimpleDateFormat("yyyyMMdd000000").format(date);
if ("HG".equals(tranCode)) {
file = zipUtil.crFile(dirDate + "/tohg_" + new SimpleDateFormat("yyyyMMdd000000").format(date));
bean.writeLog("推送合规系统"+file.getPath()+file.getName());
} else {
// log.info("无此系统" + tranCode + ",拒绝推送");
}
ArrayList<String> ids = new ArrayList<>();
if (HGBeans.size() == 0) {
// zipUtil.writeToTxt(file.getPath(), file.getName(), "", false);
}else{
for (HGBean hgBean : HGBeans) {
//生成TXT
// String s1 = new String(hgBean.getContent().getBytes(StandardCharsets.UTF_8));
zipUtil.writeToTxt(file.getPath(), file.getName(), hgBean.getContent() , true);
// zipUtil.writeToTxt(file.getPath(), file.getName(), s1 , true);
//生成附件
Map<String,String> fjIdName = new HashMap<String,String>();
Map<String,String> fjIdPath = new HashMap<String,String>();
Map<String,String> zwIdName = new HashMap<String,String>();
Map<String,String> zwIdPath = new HashMap<String,String>();
Map<String,String> fjIdimg = new HashMap<String,String>();
Map<String,String> zwIdimg = new HashMap<String,String>();
Map<String,String> reqESBpathMap = new HashMap<String,String>();
getIdPathName(hgBean.getFjid(),fjIdPath,fjIdName);
getIdPathName(hgBean.getZwid(),zwIdPath,zwIdName);
// bean.writeLog(fjIdName.toString());
// bean.writeLog(fjIdPath.toString());
// bean.writeLog(zwIdName.toString());
// bean.writeLog(zwIdPath.toString());
getIdIMIDName(hgBean.getFjid(),fjIdimg);
getIdIMIDName(hgBean.getZwid(),zwIdimg);
//压缩 =正文附件文件
bean.writeLog("压缩文件开始====="+file.getPath() + File.separator + hgBean.getRequestId()+".zip");
File filezip = new File(file.getPath() + File.separator + hgBean.getRequestId()+".zip");
ZipOutputStream zos =null;
try {
zos = new ZipOutputStream( new FileOutputStream(filezip));
// zos.setEncoding("gbk");
addFile2zip(file, hgBean, fjIdimg,1,zos);
addFile2zip(file, hgBean, zwIdimg,2,zos);
// } catch (UnsupportedEncodingException e) {
// bean.writeLog("压缩文件异常====="+file.getPath() + File.separator + hgBean.getRequestId()+".zip");
// bean.writeLog("压缩文件异常信息====="+e.getMessage());
// e.printStackTrace();
} catch ( FileNotFoundException e) {
bean.writeLog("压缩文件异常====="+file.getPath() + File.separator + hgBean.getRequestId()+".zip");
bean.writeLog("压缩文件异常信息====="+e.getMessage());
e.printStackTrace();
} finally {
try {
zos.close();
bean.writeLog("压缩文件结束====="+file.getPath() + File.separator + hgBean.getRequestId()+".zip");
} catch (IOException e) {
e.printStackTrace();
}
}
try {
bean.writeLog("filezip.getAbsolutePath()==="+filezip.getAbsolutePath());
bean.writeLog("hgBean.getRequestId()+\".zip\"==="+hgBean.getRequestId()+".zip");
//推送附件
// String s = HgUtils.putFile(filezip.getAbsolutePath(), dateDir+File.separator+hgBean.getRequestId() + ".zip");
String s = HgUtils.putFile(filezip.getAbsolutePath(), hgBean.getRequestId() + ".zip");
if (s.length()>0){
ids.add(hgBean.getId()+"");
recordSet.executeUpdate(updatesql,s,hgBean.getId());
}
bean.writeLog("ESB返回==="+s);
} catch (com.dcfs.fts.common.error.FtpException e) {
bean.writeLog("FTP异常==="+e.getMessage());
} catch (IOException e) {
bean.writeLog("FTP异常==="+e.getMessage());
e.printStackTrace();
}
}
// 压缩txt推送
File writename = new File(file.getPath() + File.separator+"tohg_" + new SimpleDateFormat("yyyyMMdd000000").format(date)+".txt");
File txtzip = new File(file.getPath() + File.separator + "tohg_" + new SimpleDateFormat("yyyyMMdd000000").format(date)+".zip");
bean.writeLog("writename ==== "+writename.getAbsolutePath() +"===="+ writename.getName());
bean.writeLog("txtzip ==== "+txtzip.getAbsolutePath() +"===="+ txtzip.getName());
try {
OutputStream outputStream = new FileOutputStream(txtzip);
ZipUtil.filesToZip(writename , outputStream ,"tohg_" + new SimpleDateFormat("yyyyMMdd000000").format(date)+File.separator+writename.getName());
// String s = HgUtils.putFile(txtzip.getAbsolutePath(), dateDir+File.separator+dateDir + ".zip");
String s = HgUtils.putFile(txtzip.getAbsolutePath(), dateDir + ".zip");
bean.writeLog("ESB返回==="+s);
if (s.length()>0){
String idstr = String.join(",",ids);
recordSet.executeUpdate(updatetxtsql+idstr+" )",s);
}
} catch (Exception e) {
bean.writeLog("FTP异常==="+e.getMessage());
e.printStackTrace();
}
}
}
private void addFile2zip(File file, HGBean hgBean, Map<String, String> Idimg, int type, ZipOutputStream zos) {
String fileType = "";
if (type == 1){
fileType = hgBean.getRequestId()+File.separator+"附件"+File.separator;
}else if(type == 2){
fileType = hgBean.getRequestId()+File.separator+"正文"+File.separator;
}
// String path = new String(fileType.getBytes(StandardCharsets.UTF_8));
// File filepath = zipUtil.crFile(file.getPath() + File.separator + hgBean.getRequestId());
String finalFileType = fileType;
ArrayList<String> fileNameList = new ArrayList<>();
Idimg.forEach((key, value) ->{
FileOutputStream fos = null;
try {
// fos = new FileOutputStream(filezip);
// org.apache.tools.zip.ZipOutputStream zos = new org.apache.tools.zip.ZipOutputStream(fos);
//
// zos.setEncoding("utf-8");
ImageFileManager ifm = new ImageFileManager();
ifm.getImageFileInfoById(Integer.parseInt(value));
//writeLogs("2622 downloadFlag=" + downloadFlag);
InputStream imagefile = ifm.getInputStream();
String filename = finalFileType +ifm.getImageFileName();
if (fileNameList.contains(filename)){
String tepName= filename.contains(".")? filename.substring(0, filename.indexOf(".")) : "";
if(tepName!=null&&!"".equals(tepName)){
String extNameTemp = filename.contains(".")? filename.substring(filename.lastIndexOf(".") + 1) : "";
filename = tepName + "_"+value+"."+extNameTemp;
}
}else {
fileNameList.add(filename);
}
bean.writeLog("filename===="+filename);
String filename2 = new String(filename.getBytes(StandardCharsets.UTF_8));
bean.writeLog("filename2===="+filename2);
ZipUtil.addInputStreamToZip(imagefile,zos,filename);
} catch (Exception e) {
e.printStackTrace();
}
});
}
// 1 附件 2 正文
private void addFile2Temp(Path tempFile, Map<String, String> IdPath, Map<String, String> IdName, int type) throws UnsupportedEncodingException {
String fileType = "";;
if (type == 1){
fileType = File.separator+"附件";
}else if(type == 2){
fileType = File.separator+"正文";
}
String finalFileType = new String(fileType.getBytes(StandardCharsets.UTF_8));
IdPath.forEach((key , value) ->{
// ZipUtil.zipToFolder(value,tempFile.toString()+ finalFileType,IdName.get(key) , );
});
}
private Date getDate(String day) {
Date date = new Date();
if (day != null) {
try {
date = new SimpleDateFormat("yyyyMMdd").parse(day);
} catch (ParseException e) {
// writeLog("时间格式错误,重新发送指定日期失败");
e.printStackTrace();
}
}
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
//把日期往后增加一天.整数往后推,负数往前移动(1:表示明天、-1表示昨天0表示今天)
calendar.add(Calendar.DATE, -1);
date = calendar.getTime();
return date;
}
private List<HGBean> getData(String startTime, String endTime){
bean.writeLog("获取推送合规系统数据start");
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(getrqBydatesql , startTime ,endTime);
bean.writeLog("getrqBydatesql=="+getrqBydatesql + startTime + endTime);
ArrayList<HGBean> hgBeans = new ArrayList<>();
while (recordSet.next()){
HGBean hgBean = new HGBean();
hgBean.setId(Util.getIntValue(recordSet.getString("id")));
hgBean.setRequestId(Util.getIntValue(recordSet.getString("request")));
hgBean.setContent(Util.null2String(recordSet.getString("content")));
hgBean.setZt(Util.getIntValue(recordSet.getString("zt")));
hgBean.setDdsj(Util.null2String(recordSet.getString("ddsj")));
hgBean.setTssj(Util.null2String(recordSet.getString("tssj")));
hgBean.setZwid(Util.null2String(recordSet.getString("zwid")));
hgBean.setFjid(Util.null2String(recordSet.getString("fjid")));
String ml = Util.null2String(recordSet.getString("ml"));
hgBean.setMl(Arrays.asList(ml.split(",")));
String fjml = Util.null2String(recordSet.getString("fjml"));
hgBean.setMl(Arrays.asList(fjml.split(",")));
hgBeans.add(hgBean);
}
bean.writeLog("数据条数=",hgBeans.size());
return hgBeans;
}
// 获取指定日期的第一秒
public static Date getFirstSecondOfDate(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTime();
}
// 获取指定日期的最后一秒
public static Date getLastSecondOfDate(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
calendar.set(Calendar.MILLISECOND, 999);
return calendar.getTime();
}
/**
*
* @param ids
* @return id
*/
public static void getIdPathName(String ids ,Map<String,String> idFilePathMap ,Map<String,String> idFileNameMap ){
String sql = "select docid,df.imagefilename filename,filerealpath filepath from docimagefile df left join imagefile imf on df.imagefileid = imf.imagefileid where DOCID in ("+ids+")";
RecordSet recordSet = new RecordSet();
recordSet.execute(sql);
while (recordSet.next()){
String docid = Util.null2String(recordSet.getString("docid"));
String filename = Util.null2String(recordSet.getString("filename"));
String filepath = Util.null2String(recordSet.getString("filepath"));
idFileNameMap.put(docid,filename);
idFilePathMap.put(docid,filepath);
}
};
public static void getIdIMIDName(String ids ,Map<String,String> idimageIDMap ){
String sql = "select docid,df.imagefileid imgid from docimagefile df left join imagefile imf on df.imagefileid = imf.imagefileid where DOCID in ("+ids+")";
RecordSet recordSet = new RecordSet();
recordSet.execute(sql);
while (recordSet.next()){
String docid = Util.null2String(recordSet.getString("docid"));
String imgid = Util.null2String(recordSet.getString("imgid"));
idimageIDMap.put(docid,imgid);
}
};
// public void put(String filenameL, String filenameR, String tranCode, int flg) throws FtpException {
// FtpClientConfig config = FtpClientConfig.getInstance();
// log.info("配置文件路径________________________________________________________________"+filePath);
// config.loadConf(filePath);
// FtpPut put = new FtpPut(filenameL, filenameR, tranCode, flg, config);
// log.info("PUT————————>response:[" + put.doPutFile() + "]");
// put.close();
// }
// public static String putFile(String localFileName, String remoteFileName, String tranCode) throws FtpException, IOException, com.dcfs.fts.common.error.FtpException {
// FtpClientConfig config = FtpClientConfig.getInstance();
// FtpPut ftpPut = new FtpPut(localFileName, remoteFileName, tranCode, true, true, config);
// String filePath = ftpPut.doPutFile();
// return filePath;
// }
}

@ -0,0 +1,23 @@
package com.engine.custom.hg.util;
import com.dcfs.fts.client.FtpClientConfig;
import com.dcfs.fts.client.upload.FtpPut;
import com.dcfs.fts.common.error.FtpException;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
public class HgUtils {
static String tranCode = "025801";
public static String putFile(String localFileName, String remoteFileName) throws FtpException, IOException, FtpException {
FtpClientConfig config = FtpClientConfig.getInstance("/opt/weaver/ecology/WEB-INF/prop/FtpClientConfig.properties");
FtpPut ftpPut = new FtpPut(localFileName, remoteFileName, tranCode, true, true, config);
String filePath = ftpPut.doPutFile();
return filePath;
}
}

@ -0,0 +1,222 @@
package com.engine.custom.hg.util;
import km.org.apache.poi.util.TempFile;
import org.apache.tools.zip.ZipEntry;
import org.apache.tools.zip.ZipFile;
import org.apache.tools.zip.ZipOutputStream;
import weaver.general.BaseBean;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Enumeration;
public class ZipUtil {
static final int BUFFER = 2048;
//创建文件夹
public File crFile(String pathName){
// bean.writeLog("创建文件夹==="+pathName);
File file=new File(pathName);
try {
// bean.writeLog("创建文件夹==="+file.exists());
if(!file.exists()){
file.mkdir();
}
}catch (Exception E){
// bean.writeLog("Exception"+E.getMessage());
}
return file;
}
public String mkTemper(String filePath){
crFile(filePath);
Date date = new Date();
SimpleDateFormat ft = new SimpleDateFormat ("yyyyMMdd");
crFile(filePath+"/"+ft.format(date));
return filePath+"/"+ft.format(date);
}
public void writeToTxt(String path,String title,String content,Boolean append){
try {
/* 写入Txt文件 */
File mkdirsName = new File(path);
// 相对路径
if(!mkdirsName.exists()){
mkdirsName.mkdirs();
}
File writename = new File(path+"/"+title+".txt");
// 存在即根据操作系统添加换行符
if(!writename.exists() && append==true) {
// 创建新文件
writename.createNewFile();
}else if("del".equals(content) && append==false){
writename.delete();
return;
}else if(!writename.exists() && append==false){
writename.createNewFile();
}else {
String osName = System.getProperties().getProperty("os.name");
System.out.println(osName);
if ("Linux".equals(osName)) {
content = "\r" + content;
} else {
content = "\r\n" + content;
}
}
// 如果是在原有基础上写入则append属性为true默认为false
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(writename, append), StandardCharsets.UTF_8));
// 写入TXT
out.write(content);
// 把缓存区内容压入文件
out.flush();
// 最后记得关闭文件
out.close();
} catch (Exception e) {
e.printStackTrace();
}
}
// /**
// *
// * @param ZIP_FILE_AFTER 压缩文件
// * @param ZIP_FILE_BEFORE 解压地址
// * @param fileName 重命名
// * @return
// */
// public static boolean zipToFolder(String ZIP_FILE_AFTER, String ZIP_FILE_BEFORE ,String fileName) {
// try {
// BaseBean bean = new BaseBean();
// ZipFile zipFile = new ZipFile(ZIP_FILE_AFTER);
// Enumeration emu = zipFile.entries();
// // bean.writeLog(ZIP_FILE_AFTER+"=="+ZIP_FILE_BEFORE+"=="+fileName);
// int i = 0;
// while (emu.hasMoreElements()) {
// ZipEntry entry = (ZipEntry) emu.nextElement();
// // bean.writeLog("entry.getName()"+entry.getName());
// // 会把目录作为一个file读出一次所以只建立目录就可以之下的文件还会被迭代到。
//
// if (entry.isDirectory()) {
// new File(ZIP_FILE_BEFORE + File.separator+new String(entry.getName().getBytes(StandardCharsets.UTF_8))).mkdirs();
// continue;
// }
//
// BufferedInputStream bis = new BufferedInputStream(zipFile
// .getInputStream(entry));
// InputStreamReader isr = new InputStreamReader(bis);
// // File file = new File(ZIP_FILE_BEFORE +File.separator+ entry.getName());
// String s = new String(entry.getName().getBytes(StandardCharsets.UTF_8));
// File file = new File(ZIP_FILE_BEFORE + File.separator + s );
// bean.writeLog("entry.getName()==="+s);
// // 加入这个的原因是zipfile读取文件是随机读取的这就造成可能先读取一个文件
// // 而这个文件所在的目录还没有出现过,所以要建出目录来。
// File parent = file.getParentFile();
// if (parent != null && (!parent.exists())) {
// parent.mkdirs();
// }
//
// FileOutputStream fos = new FileOutputStream(file);
// BufferedOutputStream bos = new BufferedOutputStream(fos, BUFFER);
// OutputStreamWriter osw = new OutputStreamWriter(bos);
//
// int count;
// char data[] = new char[BUFFER];
//
// while ((count = isr.read(data, 0, BUFFER)) != -1) {
// osw.write(data, 0, count);
// }
// bos.flush();
// bos.close();
// isr.close();
// }
// zipFile.close();
// System.out.println(1);
// } catch (Exception e) {
// e.printStackTrace();
// System.out.println(0);
// return false;
// }
// return true;
// }
public static void addFolderToZip(String folderPath, ZipOutputStream zos, String baseFolderPath) throws IOException {
File folder = new File(folderPath);
File[] files = folder.listFiles();
for (File file : files) {
if (file.isDirectory()) {
addFolderToZip(file.getAbsolutePath(), zos, baseFolderPath);
} else {
String entryName = file.getAbsolutePath().replace(baseFolderPath, "");
entryName = entryName.startsWith(File.separator) ? entryName.substring(1) : entryName;
ZipEntry zipEntry = new ZipEntry(entryName);
zos.putNextEntry(zipEntry);
FileInputStream fis = new FileInputStream(file);
byte[] buffer = new byte[1024];
int length;
while ((length = fis.read(buffer)) > 0) {
zos.write(buffer, 0, length);
}
fis.close();
zos.closeEntry();
}
}
}
public static void addInputStreamToZip(InputStream inputStream, ZipOutputStream zos, String entryName) throws IOException {
ZipEntry zipEntry = new ZipEntry(entryName);
zos.putNextEntry(zipEntry);
byte[] buffer = new byte[1024];
int length;
while ((length = inputStream.read(buffer)) > 0) {
zos.write(buffer, 0, length);
}
inputStream.close();
zos.closeEntry();
}
public static void filesToZip(File srcFile , OutputStream out , String fileName)throws RuntimeException {
long start = System.currentTimeMillis();
ZipOutputStream zos = null ;
try {
zos = new ZipOutputStream(out);
byte[] buf = new byte[BUFFER];
zos.putNextEntry(new ZipEntry(fileName));
int len;
FileInputStream in = new FileInputStream(srcFile);
while ((len = in.read(buf)) != -1){
zos.write(buf, 0, len);
}
zos.closeEntry();
in.close();
long end = System.currentTimeMillis();
} catch (Exception e) {
throw new RuntimeException("zip error from ZipUtils",e);
}finally{
if(zos != null){
try {
zos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}

@ -0,0 +1,8 @@
package com.engine.custom.hg.util;
public class test {
public static void main(String[] args) {
byte[] arr = new byte[1024];
String data = new String(arr, 0, -1);
}
}

@ -0,0 +1,10 @@
package com.engine.service.ModeForm;
import com.engine.service.entity.Result;
import java.util.Map;
public interface ModeFormService {
Result getDepartmentFormField(Map<String, Object> paramMap);
}

@ -0,0 +1,123 @@
package com.engine.service.ModeForm.impl;
import com.engine.service.entity.Result;
import com.engine.service.ModeForm.ModeFormService;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class ModeFormServiceImpl implements ModeFormService {
@Override
public Result getDepartmentFormField(Map<String, Object> paramMap) {
int level = Util.getIntValue((String) paramMap.get("level"),0);
int alllevel = Util.getIntValue((String)paramMap.get("alllevel"),0);
RecordSet recordSet = new RecordSet();
ArrayList<Map<String, String>> records = new ArrayList<>();
if (level == 1){ //点击分部
int id = Util.getIntValue((String) paramMap.get("id"), 0);
recordSet.executeQuery("select dept.id id , SUBCOMPANYID1 SUBCOMPANYID ,SUPDEPID, defined.FZXBSJB FZXBSJB,defined.SFYJZXYWBS SFYJZXYWBS from HRMDEPARTMENT dept " +
"left join hrmdepartmentdefined defined "+
"on dept.id = defined.DEPTID where dept.SUBCOMPANYID1 = ?",id);
while (recordSet.next()){
HashMap<String, String> record = new HashMap<>();
String deptid = Util.null2String(recordSet.getString("id"));
record.put("id",deptid);
//是否一级支行业务部室 0 是 1 否
String fzxbsjb = Util.null2String(recordSet.getString("FZXBSJB"));
record.put("fzxbsjb",fzxbsjb);
//分支行部室级别
String sfyjzxywbs = Util.null2String(recordSet.getString("SFYJZXYWBS"));
record.put("sfyjzxywbs",sfyjzxywbs);
String subcompanyid = Util.null2String(recordSet.getString("SUBCOMPANYID"));
record.put("subcompanyid",subcompanyid);
String supdepid = Util.null2String(recordSet.getString("SUPDEPID"));
record.put("supdepid",supdepid);
records.add(record);
}
return new Result(records,200);
}else if(level == 2 || level == 3 || level == 3){
int id = Util.getIntValue((String) paramMap.get("id"), 0);
recordSet.executeQuery("select dept.id id ,SUBCOMPANYID1 SUBCOMPANYID ,SUPDEPID, defined.FZXBSJB FZXBSJB,defined.SFYJZXYWBS SFYJZXYWBS from HRMDEPARTMENT dept " +
"left join hrmdepartmentdefined defined "+
"on dept.id = defined.DEPTID where dept.SUBCOMPANYID1 = (select SUBCOMPANYID1 from HRMDEPARTMENT where id = ? )",id);
while (recordSet.next()){
HashMap<String, String> record = new HashMap<>();
String deptid = Util.null2String(recordSet.getString("id"));
record.put("id",deptid);
//是否一级支行业务部室 0 是 1 否
String fzxbsjb = Util.null2String(recordSet.getString("FZXBSJB"));
record.put("fzxbsjb",fzxbsjb);
//分支行部室级别
String sfyjzxywbs = Util.null2String(recordSet.getString("SFYJZXYWBS"));
record.put("sfyjzxywbs",sfyjzxywbs);
String subcompanyid = Util.null2String(recordSet.getString("SUBCOMPANYID"));
record.put("subcompanyid",subcompanyid);
String supdepid = Util.null2String(recordSet.getString("SUPDEPID"));
record.put("supdepid",supdepid);
records.add(record);
}
return new Result(records,200);
}else if(alllevel ==1){
String types = Util.null2String(paramMap.get("types"));
String[] typeArr = null;
if (types.length() > 0){
typeArr = types.split(",");
}
ArrayList<String> deptList = new ArrayList<>();
ArrayList<String> subcomList = new ArrayList<>();
for (String type : typeArr) {
String[] item = type.split("\\|");
String itemType = item[0];
if ("subcom".equals(itemType)){
subcomList.add(item[1]);
}
if ("dept".equals(itemType)){
deptList.add(item[1]);
}
}
String a = String.join(",",subcomList);
String b = String.join(",",deptList);
String sql = "select distinct dept.id id ,SUBCOMPANYID1 SUBCOMPANYID ,SUPDEPID, defined.FZXBSJB FZXBSJB,defined.SFYJZXYWBS SFYJZXYWBS from HRMDEPARTMENT dept " +
"left join hrmdepartmentdefined defined "+
"on dept.id = defined.DEPTID where ";
if (subcomList.size() > 0){
sql = sql + "dept.SUBCOMPANYID1 in ("+a+")";
}
if(subcomList.size() > 0 && deptList.size() > 0){
sql = sql + " or ";
}
if (deptList.size() > 0){
sql = sql + " dept.SUBCOMPANYID1 in (select SUBCOMPANYID1 from HRMDEPARTMENT where id in ("+b+") )";
}
recordSet.executeQuery(sql);
new BaseBean().writeLog("select distinct dept.id id ,SUBCOMPANYID1 SUBCOMPANYID ,SUPDEPID, defined.FZXBSJB FZXBSJB,defined.SFYJZXYWBS SFYJZXYWBS from HRMDEPARTMENT dept " +
"left join hrmdepartmentdefined defined "+
"on dept.id = defined.DEPTID where dept.SUBCOMPANYID1 in ("+a+") or dept.SUPDEPID in (select SUBCOMPANYID1 from HRMDEPARTMENT where id in ("+b+") )");
while (recordSet.next()){
HashMap<String, String> record = new HashMap<>();
String deptid = Util.null2String(recordSet.getString("id"));
record.put("id",deptid);
//是否一级支行业务部室 0 是 1 否
String fzxbsjb = Util.null2String(recordSet.getString("FZXBSJB"));
record.put("fzxbsjb",fzxbsjb);
//分支行部室级别
String sfyjzxywbs = Util.null2String(recordSet.getString("SFYJZXYWBS"));
record.put("sfyjzxywbs",sfyjzxywbs);
String subcompanyid = Util.null2String(recordSet.getString("SUBCOMPANYID"));
record.put("subcompanyid",subcompanyid);
String supdepid = Util.null2String(recordSet.getString("SUPDEPID"));
record.put("supdepid",supdepid);
records.add(record);
}
new BaseBean().writeLog(records);
return new Result(records,200);
}
return new Result(null,500);
}
}

@ -0,0 +1,8 @@
package com.engine.service;
import java.util.Map;
public interface TJBKWorkFlowService {
Integer getToDoCount(Map<String,String> paramMap);
Integer getToReadCount(Map<String,String> paramMap);
}

@ -0,0 +1,47 @@
package com.engine.service.entity;
import java.util.Map;
public class Result {
public Object data;
public Integer code;
public String errMsg;
public Result() {
}
public Result(Object data, Integer code) {
this.data = data;
this.code = code;
}
public Result(Object data, Integer code, String errMsg) {
this.data = data;
this.code = code;
this.errMsg = errMsg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getErrMsg() {
return errMsg;
}
public void setErrMsg(String errMsg) {
this.errMsg = errMsg;
}
}

@ -0,0 +1,241 @@
package com.engine.service.impl;
import com.alibaba.druid.util.StringUtils;
import com.engine.service.TJBKWorkFlowService;
import com.engine.workflow.util.CommonUtil;
import com.icbc.api.internal.apache.http.impl.cookie.S;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.security.util.SecurityMethodUtil;
import weaver.wechat.util.Utils;
import weaver.workflow.request.todo.OfsSettingObject;
import weaver.workflow.request.todo.RequestUtil;
import weaver.workflow.webservices.WorkflowServiceImpl;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static weaver.security.util.SecurityMethodUtil.clearKeywordFromConditon;
public class TJBKWorkFlowServiceImpl implements TJBKWorkFlowService {
private static final String getIdByWorkCodesql = "SELECT id FROM HRMRESOURCE WHERE workcode = ? ";
private static final String getToReadwfidsql = "SELECT b.* from hpsetting_wfcenter a , workflowcentersettingdetail b where a.eid = b.eid and a.tabid = b.tabid and a.tabtitle = '我的待阅' and b.TYPE ='flowid'";
// private static final String getToReadwfidsql = "SELECT b.* from hpsetting_wfcenter a , workflowcentersettingdetail b where a.eid = b.eid and a.tabid = b.tabid";
private WorkflowServiceImpl workflowService = new WorkflowServiceImpl();
private RecordSet rs = new RecordSet();
@Override
public Integer getToDoCount(Map<String,String> paramMap) {
String value = paramMap.get("value");
String key = paramMap.get("key");
//User currentUser = null;
String userId = "";
try{
//验证工号是否为空
if (!StringUtils.isEmpty(value) && !StringUtils.isEmpty(key)){
// 获取用户
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(getIdByWorkCodesql,value);
if (recordSet.next()){
userId = Utils.null2String(recordSet.getString("id"));
//currentUser = new User(Integer.parseInt(userId));
}
}
// String[] strings = {};
// new RecordSet()
String conditionsql = getToDoWfidCondition();
// new BaseBean().writeLog("getToDoWfidCondition"+conditionsql);
String[] strings = {conditionsql};
int toDoWorkflowRequestCount = getToDoWorkflowRequestCount4OS(Integer.parseInt(userId), strings,true);
paramMap.put("status","COMPLETE");
paramMap.put("code","S000A000");
paramMap.put("desc","success");
//int toDoWorkflowRequestCount = workflowService.getToDoWorkflowRequestCount(Integer.parseInt("1"), strings);
return toDoWorkflowRequestCount;}catch (Exception E){
paramMap.put("status","FAIL");
paramMap.put("code","ESB-E-000002");
paramMap.put("desc","人员不存在");
return null;
}
}
@Override
public Integer getToReadCount(Map<String,String> paramMap) {
String value = paramMap.get("value");
String key = paramMap.get("key");
User currentUser = null;
String userId = "";
try {
//验证工号是否为空
if (!StringUtils.isEmpty(value) && !StringUtils.isEmpty(key)) {
// 获取用户
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(getIdByWorkCodesql, value);
if (recordSet.next()) {
userId = Utils.null2String(recordSet.getString("id"));
currentUser = new User(Integer.parseInt(userId));
}
}
String conditionsql = getToReadWfidCondition();
new BaseBean().writeLog("getToReadWfidCondition"+conditionsql);
String[] strings = {conditionsql};
int toBeReadWorkflowRequestCount = getToDoWorkflowRequestCount4OS(Integer.parseInt(userId), strings, true);
paramMap.put("status","COMPLETE");
paramMap.put("code","S000A000");
paramMap.put("desc","success");
//int toBeReadWorkflowRequestCount = workflowService.getToBeReadWorkflowRequestCount(Integer.parseInt("1"), strings, false);
return toBeReadWorkflowRequestCount;
}catch (Exception E){
paramMap.put("status","FAIL");
paramMap.put("code","ESB-E-000002");
paramMap.put("desc","人员不存在");
return null;
}
}
private String getToReadWfidCondition() {
RecordSet rs = new RecordSet();
boolean b = rs.executeQuery(getToReadwfidsql);
String[] arr = new String[rs.getCounts()];
StringBuilder sqlwhere = new StringBuilder();
int i = 0;
while (rs.next()){
String content = Util.null2String( rs.getString("content"));
if (!StringUtils.isEmpty(content)){
arr[i] = "t1.workflowid = "+content;
i++;
}
}
// 过滤掉空元素
List<String> nonNullElements = Arrays.stream(arr)
.filter(element -> element != null && !element.isEmpty())
.collect(Collectors.toList());
String result = String.join(" OR ", nonNullElements);
if (StringUtils.isEmpty(result)){return "";}
return "(" + result +")";
}
private String getToDoWfidCondition() {
RecordSet rs = new RecordSet();
boolean b = rs.executeQuery(getToReadwfidsql);
String[] arr = new String[rs.getCounts()];
StringBuilder sqlwhere = new StringBuilder();
int i = 0;
while (rs.next()){
String content = Util.null2String( rs.getString("content"));
if (!StringUtils.isEmpty(content)){
arr[i] = "t1.workflowid != " + content;
i++;
}
}
// 过滤掉空元素
List<String> nonNullElements = Arrays.stream(arr)
.filter(element -> element != null && !element.isEmpty())
.collect(Collectors.toList());
String result = String.join(" AND ", nonNullElements);
if (StringUtils.isEmpty(result)){return "";}
return "(" + result +")";
}
public int getToDoWorkflowRequestCount4OS(int var1, String[] var2, boolean var3) {
String var4 = " select distinct ";
String var5 = " t1.createdate,t1.createtime,t1.creater,t1.currentnodeid,t1.currentnodetype,t1.lastoperator,t1.creatertype,t1.lastoperatortype,t1.lastoperatedate,t1.lastoperatetime,t1.requestid,t1.requestname,t1.requestlevel,t1.workflowid,t2.receivedate,t2.receivetime ";
String var6 = " from workflow_requestbase t1,workflow_currentoperator t2 ";
String var7 = " where t1.requestid=t2.requestid ";
var7 = var7 + " and ((t2.isremark='0' and (t2.takisremark is null or t2.takisremark=0 )) or t2.isremark in('1','5','8','9','7','11')) and t2.islasttimes=1";
var7 = var7 + " and (isprocessing = '' or isprocessing is null) ";
var7 = var7 + " and t1.workflowid in(select id from workflow_base where (isvalid='1' or isvalid='3') and (activeversionid is null or activeversionid=0 or activeversionid in(select id from workflow_base where isvalid='1')) )";
var7 = var7 + this.sqldelete();
String var8 = var7;
var7 = " and t2.usertype = 0 and t2.userid = " + var1;
String var9 = CommonUtil.getDBJudgeNullFun((new RecordSet()).getDBType());
var7 = var7 + " and (" + var9 + "(t1.currentstatus,-1) = -1 or (" + var9 + "(t1.currentstatus,-1)=0 and t1.creater in (" + var1 + "))) ";
String var10 = "";
if (var2 != null) {
for(int var11 = 0; var11 < var2.length; ++var11) {
String var12 = var2[var11];
var12 = SecurityMethodUtil.clearKeywordFromConditon(var12);
var10 = var10 + (var12 != null && !"".equals(var12) ? " and " + var12 : "");
}
}
var7 = var7 + var10;
RequestUtil var16 = new RequestUtil();
OfsSettingObject var17 = var16.getOfsSetting();
boolean var13 = var17.getIsuse() == 1;
String var14 = "";
if (var3 && var13) {
String var15 = " select createdate,createtime,creatorid as creater,-1 as currentnodeid,'' as currentnodetype,-1 as lastoperator,0 as creatertype,0 as lastoperatortype,'' as lastoperatedate,'' as lastoperatetime,requestid,requestname,0 as requestlevel,workflowid,receivedate,receivetime from ofs_todo_data where islasttimes=1 and isremark in(0,8,9) and workflowid in (select workflowid from ofs_workflow where (cancel=0 or cancel is null)) and userid=" + var1 + var10.replaceAll("t2.", "").replaceAll("t1.", "");
var14 = this.getPaginationCountSql(var4, var5, var6, var7, var8, var15);
} else {
var14 = this.getPaginationCountSql(var4, var5, var6, var7, var8);
}
var14 = var14.replace("t1.deleted", "SpecialHandling");
return this.getWorkflowRequestCount(var14);
}
private String sqldelete() {
String deletesql = " and (t1.deleted<>1 or t1.deleted is null or t1.deleted='') ";
if (this.rs.getDBType().equalsIgnoreCase("postgresql")) {
deletesql = " and (t1.deleted<>1 or t1.deleted is null) ";
}
return deletesql;
}
private String getPaginationCountSql(String var1, String var2, String var3, String var4, String var5, String var6) {
return this.getPaginationCountSql(var1, var2, var3, var4, var5, var6, "");
}
private String getPaginationCountSql(String var1, String var2, String var3, String var4, String var5, String var6, String var7) {
var1 = Util.null2String(var1).replaceAll("(?i)(drop|insert|alter|truncate|delete|union|wait|xp_cmdshel|DBMS_PIPE|IIF|UTL_HTTP|SLEEP|net user|--|/\\*.*?\\*/)", "__SQLINJECTION__");
var2 = SecurityMethodUtil.clearKeywordFromConditon(var2);
var3 = SecurityMethodUtil.clearKeywordFromConditon(var3);
var4 = SecurityMethodUtil.clearKeywordFromConditon(var4);
var4 = var5 + var4;
String var8 = " select count(*) my_count from ( " + var1 + " " + var2 + " " + var3 + " " + var4 + " SpecialHandUN " + var6 + ("".equals(var7) ? "" : " SpecialHandUN " + var7) + " ) tableA ";
return var8;
}
private String getPaginationCountSql(String var1, String var2, String var3, String var4, String var5) {
var1 = Util.null2String(var1).replaceAll("(?i)(drop|insert|alter|truncate|delete|union|wait|xp_cmdshel|DBMS_PIPE|IIF|UTL_HTTP|SLEEP|net user|--|/\\*.*?\\*/)", "__SQLINJECTION__");
var2 = SecurityMethodUtil.clearKeywordFromConditon(var2);
var3 = SecurityMethodUtil.clearKeywordFromConditon(var3);
var4 = SecurityMethodUtil.clearKeywordFromConditon(var4);
var4 = var5 + var4;
String var6 = " select count(*) my_count from ( " + var1 + " " + var2 + " " + var3 + " " + var4 + " ) tableA ";
return var6;
}
private int getWorkflowRequestCount(String var1) {
RecordSet var2 = new RecordSet();
var1 = Util.null2String(var1).replaceAll("(?i)(drop|insert|alter|truncate|delete|union|wait|xp_cmdshel|DBMS_PIPE|IIF|UTL_HTTP|SLEEP|net user|--|/\\*.*?\\*/)", "__SQLINJECTION__");
var1 = var1.replace("SpecialHandling", "t1.deleted").replaceAll("SpecialHandUN", "union");
int var3 = 0;
try {
var2.executeSql(var1);
if (var2.next()) {
var3 = var2.getInt("my_count");
}
} catch (Exception var5) {
var5.printStackTrace();
new BaseBean().writeLog(var5);
}
return var3;
}
}

@ -0,0 +1,197 @@
package com.engine.util;
import com.alibaba.druid.util.StringUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.util.HashMap;
import java.util.Map;
public class XMLUtils {
//构建返回值
public static String count2XML(Map<String,String> headerParam,Integer todocount , Integer toreadcount ) {
try {
// 创建文档对象
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.newDocument();
// 创建根节点
Element rootElement = doc.createElement("Service");
doc.appendChild(rootElement);
addServiceHeader(doc,rootElement,headerParam);
// 创建Service_Body节点
Element serviceBodyElement = doc.createElement("Service_Body");
rootElement.appendChild(serviceBodyElement);
// 创建response节点
Element responseElement = doc.createElement("response");
serviceBodyElement.appendChild(responseElement);
// 创建todo节点
Element todoElement = doc.createElement("todo");
responseElement.appendChild(todoElement);
// 创建count节点并设置值
if(todocount != null) {
Element countElement = doc.createElement("count");
countElement.setTextContent(todocount + "");
todoElement.appendChild(countElement);
}
if(toreadcount != null){
Element countOneElement = doc.createElement("countOne");
countOneElement.setTextContent(toreadcount+"");
todoElement.appendChild(countOneElement);
}
// 将文档对象转换为XML字符串
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); // 设置不包含XML声明
DOMSource source = new DOMSource(doc);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
StreamResult result = new StreamResult(outputStream);
transformer.transform(source, result);
// 将XML结果转换为字符串
String xmlString = outputStream.toString("UTF-8");
//System.out.println(xmlString);
return xmlString;
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
private static void addServiceHeader(Document doc, Element rootElement, Map<String, String> headerParam) {
// 创建Service_Body节点
Element serviceHeaderElement = doc.createElement("Service_Header");
rootElement.appendChild(serviceHeaderElement);
//service_sn ESB服务流水号
if (!StringUtils.isEmpty(headerParam.get("service_sn"))){
Element serviceSnElement = doc.createElement("service_sn");
serviceSnElement.setTextContent(headerParam.get("service_sn"));
serviceHeaderElement.appendChild(serviceSnElement);
}
if (!StringUtils.isEmpty(headerParam.get("service_id"))){
Element serviceIdElement = doc.createElement("service_id");
serviceIdElement.setTextContent(headerParam.get("service_id"));
serviceHeaderElement.appendChild(serviceIdElement);
}
if (!StringUtils.isEmpty(headerParam.get("system_id"))){
Element systemIdElement = doc.createElement("system_id");
systemIdElement.setTextContent(headerParam.get("system_id"));
serviceHeaderElement.appendChild(systemIdElement);
}
if (!StringUtils.isEmpty(headerParam.get("requester_id"))){
Element requesterIdElement = doc.createElement("requester_id");
requesterIdElement.setTextContent(headerParam.get("requester_id"));
serviceHeaderElement.appendChild(requesterIdElement);
}
if (!StringUtils.isEmpty(headerParam.get("branch_id"))){
Element branchIdElement = doc.createElement("branch_id");
branchIdElement.setTextContent(headerParam.get("branch_id"));
serviceHeaderElement.appendChild(branchIdElement);
}
if (!StringUtils.isEmpty(headerParam.get("channel_id"))){
Element channelIdElement = doc.createElement("channel_id");
channelIdElement.setTextContent(headerParam.get("channel_id"));
serviceHeaderElement.appendChild(channelIdElement);
}
if (!StringUtils.isEmpty(headerParam.get("service_time"))){
Element serviceTimeElement = doc.createElement("requester_id");
serviceTimeElement.setTextContent(headerParam.get("service_time"));
serviceHeaderElement.appendChild(serviceTimeElement);
}
if (!StringUtils.isEmpty(headerParam.get("BnkSrlNo"))){
Element BnkSrlNoElement = doc.createElement("BnkSrlNo");
BnkSrlNoElement.setTextContent(headerParam.get("BnkSrlNo"));
serviceHeaderElement.appendChild(BnkSrlNoElement);
}
// if (!StringUtils.isEmpty(headerParam.get("FileFlg"))){
Element FileFlgElement = doc.createElement("FileFlg");
FileFlgElement.setTextContent("0");
serviceHeaderElement.appendChild(FileFlgElement);
// }
if (!StringUtils.isEmpty(headerParam.get("SvcCd"))){
Element SvcCdElement = doc.createElement("SvcCd");
SvcCdElement.setTextContent(headerParam.get("SvcCd"));
serviceHeaderElement.appendChild(SvcCdElement);
}
if (!StringUtils.isEmpty(headerParam.get("SvcScn"))){
Element SvcScnElement = doc.createElement("SvcScn");
SvcScnElement.setTextContent(headerParam.get("SvcScn"));
serviceHeaderElement.appendChild(SvcScnElement);
}
// 响应码
Element service_responseElement = doc.createElement("service_response");
serviceHeaderElement.appendChild(service_responseElement);
if (!StringUtils.isEmpty(headerParam.get("status"))){
Element statusElement = doc.createElement("status");
statusElement.setTextContent(headerParam.get("status"));
service_responseElement.appendChild(statusElement);
}
if (!StringUtils.isEmpty(headerParam.get("code"))){
Element codeElement = doc.createElement("code");
codeElement.setTextContent(headerParam.get("code"));
service_responseElement.appendChild(codeElement);
}
if (!StringUtils.isEmpty(headerParam.get("desc"))){
Element descElement = doc.createElement("desc");
descElement.setTextContent(headerParam.get("desc"));
service_responseElement.appendChild(descElement);
}
}
public static Map<String, String> parseXMLToMap(String xmlString) {
Map<String, String> resultMap = new HashMap<>();
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(new ByteArrayInputStream(xmlString.getBytes()));
Element rootElement = document.getDocumentElement();
extractValues(rootElement, resultMap);
} catch (Exception e) {
e.printStackTrace();
}
return resultMap;
}
private static void extractValues(Element element, Map<String, String> resultMap) {
NodeList childNodes = element.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
if (childNodes.item(i) instanceof Element) {
Element childElement = (Element) childNodes.item(i);
String nodeName = childElement.getNodeName();
String nodeValue = childElement.getTextContent();
resultMap.put(nodeName, nodeValue);
extractValues(childElement, resultMap);
}
}
}
public static void main(String[] args) {
}
}

@ -0,0 +1,103 @@
package com.engine.web.ModeForm;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.util.ParamUtil;
import com.engine.service.ModeForm.ModeFormService;
import com.engine.service.ModeForm.impl.ModeFormServiceImpl;
import com.google.gson.JsonObject;
import com.icbc.api.internal.apache.http.impl.cookie.S;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.wechat.util.Utils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.Context;
import java.util.HashMap;
import java.util.Map;
public class ModeFormWeb {
private static final String nodeCountsql = "select count(1) num from uf_qzsxqp t1 left join " +
" uf_qzsxqp_dt1 d1 on t1.id = d1.mainid where lc = ? and jdmc = ?";
@Path("/gethld")
@GET
public String getDataById(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
Map<String, Object> map = ParamUtil.request2Map(request);
// String dataTable = (String) map.get("dataTable");
RecordSet recordSet = new RecordSet();
recordSet.executeQuery("select * from uf_View_resume_perm where sfqy = 0");
StringBuilder s = new StringBuilder();
while (recordSet.next()){
String xld = Utils.null2String(recordSet.getString("xld"));
s.append(xld).append(",");
}
HashMap<String, String> result = new HashMap<>();
if (s.length()>0){
result.put("data",s.toString().substring(0, s.length()-1));
}else {
result.put("data","");
}
result.put("code","200");
return JSONObject.toJSONString(result);
}catch (Exception e){
e.printStackTrace();
HashMap<String, String> result = new HashMap<>();
result.put("data",e.getMessage());
result.put("code","500");
return JSONObject.toJSONString(result);
}
}
@Path("/getDepartmentFormField")
@GET
public String getDepartmentFormField(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
Map<String, Object> paramMap = ParamUtil.request2Map(request);
ModeFormService service = new ModeFormServiceImpl();
return JSONObject.toJSONString(service.getDepartmentFormField(paramMap));
}catch (Exception e){
e.printStackTrace();
HashMap<String, String> result = new HashMap<>();
result.put("data",e.getMessage());
result.put("code","500");
return JSONObject.toJSONString(result);
}
}
@Path("/getSignByid")
@GET
public String getSignByid(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
Map<String, Object> paramMap = ParamUtil.request2Map(request);
Object wfid = paramMap.get("wfid");
Object nodeid = paramMap.get("nodeid");
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(nodeCountsql,wfid,nodeid);
int num = 0;
if(recordSet.next()){
num = Util.getIntValue(recordSet.getString("num"),0) ;
}
HashMap<String, Object> result = new HashMap<>();
result.put("flag",num > 0);
result.put("code","200");
return JSONObject.toJSONString(result);
}catch (Exception e){
e.printStackTrace();
HashMap<String, String> result = new HashMap<>();
result.put("data",e.getMessage());
result.put("code","500");
return JSONObject.toJSONString(result);
}
}
}

@ -0,0 +1,125 @@
package com.engine.web.tjbk;
import com.alibaba.druid.util.StringUtils;
import com.engine.common.util.ParamUtil;
import com.engine.service.TJBKWorkFlowService;
import com.engine.service.impl.TJBKWorkFlowServiceImpl;
import com.engine.util.XMLUtils;
import com.icbc.api.internal.apache.http.impl.cookie.S;
import weaver.general.BaseBean;
import weaver.general.StringUtil;
import weaver.security.rsa.IOUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.Context;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
public class TJBKWorkFlow {
private TJBKWorkFlowService tjbkWorkFlowService = new TJBKWorkFlowServiceImpl();
@Path("/workflow/getToDoCount")
@POST
public String getToDoCount(@Context HttpServletRequest request, @Context HttpServletResponse response) {
Map<String, Object> stringObjectMap = ParamUtil.request2Map(request);
String result = "";
String requestBody = "";
try {
requestBody = IOUtils.toString(request.getReader());
} catch (IOException e) {
e.printStackTrace();
}
// new BaseBean().writeLog("请求参数为" + requestBody);
// if (StringUtil.isEmpty(requestBody)) {
// result =XMLUtils.count2XML(paramMap,null,null);
// return "参数为空";
// }
Map<String, String> paramMap = null;
try {
paramMap = XMLUtils.parseXMLToMap(requestBody);
String path = paramMap.get("path");
String method = paramMap.get("method");
//待办
if (StringUtils.equals("todo", path) && StringUtils.equals("getCount", method)) {
Integer toDoCount = tjbkWorkFlowService.getToDoCount(paramMap);
result = XMLUtils.count2XML(paramMap, toDoCount, null);
} else if (StringUtils.equals("todo", path) && StringUtils.equals("getCount2", method)) {
//代办和代阅
Integer toDoCount = tjbkWorkFlowService.getToDoCount(paramMap);
Integer toReadCount = tjbkWorkFlowService.getToReadCount(paramMap);
result = XMLUtils.count2XML(paramMap, toDoCount, toReadCount);
} else {
paramMap.put("status", "FAIL");
paramMap.put("code", "ESB-E-000002");
paramMap.put("desc", "参数解析异常");
return XMLUtils.count2XML(paramMap, null, null);
}
return result;
}catch ( Exception E){
paramMap.put("status", "FAIL");
paramMap.put("code", "ESB-E-000002");
paramMap.put("desc", "未知错误");
return XMLUtils.count2XML(paramMap, null, null);
}
}
public String getToDoCount(String param) {
// new BaseBean().writeLog("请求参数为" + param);
// if (StringUtil.isEmpty(requestBody)) {
// result =XMLUtils.count2XML(paramMap,null,null);
// return "参数为空";
// }
Map<String, String> paramMap = null;
String result = "";
try {
String substring = param.substring(8, param.length());
// new BaseBean().writeLog("xml报文"+substring);
paramMap = XMLUtils.parseXMLToMap(substring);
String path = paramMap.get("path");
String method = paramMap.get("method");
//待办
if (StringUtils.equals("todo", path) && StringUtils.equals("getCount", method)) {
Integer toDoCount = tjbkWorkFlowService.getToDoCount(paramMap);
result = XMLUtils.count2XML(paramMap, toDoCount, null);
} else if (StringUtils.equals("todo", path) && StringUtils.equals("getCount2", method)) {
//代办和代阅
Integer toDoCount = tjbkWorkFlowService.getToDoCount(paramMap);
Integer toReadCount = tjbkWorkFlowService.getToReadCount(paramMap);
result = XMLUtils.count2XML(paramMap, toDoCount, toReadCount);
} else {
paramMap.put("status", "FAIL");
paramMap.put("code", "ESB-E-000002");
paramMap.put("desc", "参数解析异常");
String xmlStr = XMLUtils.count2XML(paramMap, null, null);
int length = xmlStr.length();
String format = String.format("%08d", length);
// new BaseBean().writeLog("响应报文"+format+result);
return format+xmlStr;
}
int length = result.length();
String format = String.format("%08d", length);
// new BaseBean().writeLog("响应报文"+format+result);
return format+result;
}catch ( Exception E){
// new BaseBean().writeLog("未知错误"+E.getMessage());
paramMap.put("status", "FAIL");
paramMap.put("code", "ESB-E-000002");
paramMap.put("desc", "未知错误");
String xmlStr = XMLUtils.count2XML(paramMap, null, null);
int length = xmlStr.length();
String format = String.format("%08d", length);
return format+xmlStr;
}
}
}

@ -0,0 +1,136 @@
package com.engine.web.tjbk;
import weaver.general.BaseBean;
import weaver.general.StringUtil;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
public class TjbkServerSocket implements ServletContextListener {
private SocketThread socketThread;
@Override
public void contextDestroyed(ServletContextEvent arg0) {
// TODO Auto-generated method stub
if (socketThread != null && socketThread.isInterrupted()) {
socketThread.closeServerSocket();
socketThread.interrupt();
}
}
@Override
public void contextInitialized(ServletContextEvent arg0) {
// TODO Auto-generated method stub
ServletContext servletContext = arg0.getServletContext();
if (socketThread == null) {
socketThread = new SocketThread(null, servletContext);
socketThread.start(); // servlet上下文初始化时启动socket服务端线程
}
}
}
class SocketThread extends Thread {
private ServletContext servletContext;
private ServerSocket serverSocket;
public SocketThread(ServerSocket serverSocket, ServletContext servletContext) {
this.servletContext = servletContext;
// 从web.xml中context-param节点获取socket端口
String port = this.servletContext.getInitParameter("socketPort");
if (serverSocket == null) {
try {
this.serverSocket = new ServerSocket(Integer.parseInt(port));
} catch (IOException e) {
e.printStackTrace();
}
}
}
@Override
public void run() {
while (!this.isInterrupted()) { // 线程未中断执行循环
try {
Socket socket = serverSocket.accept();
if (socket != null) {
new ProcessSocketData(socket, this.servletContext).start();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
public void closeServerSocket() {
try {
if (serverSocket != null && !serverSocket.isClosed()) {
serverSocket.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
class ProcessSocketData extends Thread {
private Socket socket;
private ServletContext servletContext;
public ProcessSocketData() {
super();
}
public ProcessSocketData(Socket socket, ServletContext servletContext) {
this.socket = socket;
this.servletContext = servletContext;
}
@Override
public void run() {
try {
// BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
// new BaseBean().writeLog("ServerSocket线程启动");
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(socket.getOutputStream(), StandardCharsets.UTF_8);
PrintWriter pw = new PrintWriter(outputStreamWriter);
InputStream inputStream = socket.getInputStream();
// byte[] arr = new byte[1024];
// int length = inputStream.read(arr);//返回有效数据长度
byte[] arr = new byte[1024];
int bytesRead;
StringBuilder stringBuilder = new StringBuilder();
while ((bytesRead = inputStream.read(arr)) != -1) {
// bytesRead contains the number of bytes read from the input stream
stringBuilder.append(new String(arr, 0, bytesRead, StandardCharsets.UTF_8));
}
// String data = new String(arr, 0, length);
String requestData = stringBuilder.toString();
String s = "";
if (!StringUtil.isEmpty(requestData)) {
s = new TJBKWorkFlow().getToDoCount(requestData);
}
// 执行自定义的请求解析方法生成响应response
pw.println(s);
pw.flush(); // 刷新缓冲区
pw.close();
socket.close();
// System.out.println(sb);
} catch (IOException e) {
e.printStackTrace();
System.out.println(e);
}
}
}

@ -0,0 +1,108 @@
package com.engine.web.tjbk;
import com.alibaba.druid.util.StringUtils;
import weaver.general.BaseBean;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.ServerSocket;
import java.net.Socket;
public class TjbkWebSocket implements ServletContextListener {
public static final int port = 8090;//监听的端口号
public static void main(String[] args) {
System.out.println("Server...\n");
TjbkWebSocket server = new TjbkWebSocket();
server.init();
}
public void init() {
try {
System.out.println("new ServerSocket");
//创建一个ServerSocket这里可以指定连接请求的队列长度
//new ServerSocket(port,3);意味着当队列中有3个连接请求是如果Client再请求连接就会被Server拒绝
ServerSocket serverSocket = new ServerSocket(port);
while (true) {
//从请求队列中取出一个连接
Socket client = serverSocket.accept();
// 处理这次连接
new HandlerThread(client);
}
} catch (Exception e) {
System.out.println("服务器异常: " + e.getMessage());
}
}
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
new Thread(new Runnable(){
@Override
public void run() {
TjbkWebSocket server = new TjbkWebSocket();
server.init();
}
}).start();
}
@Override
public void contextDestroyed(ServletContextEvent servletContextEvent) {
}
private class HandlerThread implements Runnable {
private Socket socket;
public HandlerThread(Socket client) {
socket = client;
new Thread(this).start();
}
@Override
public void run() {
try {
// 读取客户端数据
BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
StringBuilder sb = new StringBuilder();
String line = "";//这里要注意和客户端输出流的写方法对应,否则会抛 EOFException
while ((line = input.readLine()) != null || StringUtils.isEmpty(line)) {
// 处理每一行数据
sb = sb.append(line);
}
// byte[] buffer = new byte[1024];
// int bytesRead;
// while ((bytesRead = input.read(buffer)) != -1) {
// // 将读取的数据追加到 StringBuilder
// sb.append(new String(buffer, 0, bytesRead));
// }
// 处理客户端数据
new BaseBean().writeLog("客户端发过来的内容:" + sb);
// 业务处理
// 向客户端回复信息
PrintStream out = new PrintStream(socket.getOutputStream());
// 发送键盘输入的一行
// String s = new BufferedReader(new InputStreamReader(System.in)).readLine();
String s = new TJBKWorkFlow().getToDoCount(sb.toString());
out.println(s);
out.close();
input.close();
} catch (Exception e) {
System.out.println("服务器 run 异常: " + e.getMessage());
} finally {
if (socket != null) {
try {
socket.close();
} catch (Exception e) {
socket = null;
System.out.println("服务端 finally 异常:" + e.getMessage());
}
}
}
}
}
}

@ -0,0 +1,925 @@
// package com.engine.workflow.cmd.mobileCenter;
//
// import com.alibaba.fastjson.JSON;
// import com.alibaba.fastjson.JSONObject;
// import com.api.browser.bean.Checkboxpopedom;
// import com.api.browser.bean.SplitTableBean;
// import com.api.browser.bean.SplitTableColBean;
// import com.api.browser.util.*;
// import com.cloudstore.dev.api.bean.SplitMobileDataBean;
// import com.engine.common.biz.AbstractCommonCommand;
// import com.engine.common.entity.BizLogContext;
// import com.engine.common.util.ParamUtil;
// import com.engine.core.interceptor.CommandContext;
// import com.engine.workflow.biz.RequestQuickSearchBiz;
// import com.engine.workflow.biz.mobileCenter.MobileDimensionsBiz;
// import com.engine.workflow.biz.mobileCenter.WorkflowCenterTabBiz;
// import com.engine.workflow.biz.requestList.GenerateDataInfoBiz;
// import com.engine.workflow.biz.requestList.RequestListBiz;
// import com.engine.workflow.constant.PageUidConst;
// import com.engine.workflow.entity.RequestListDataInfoEntity;
// import com.engine.workflow.entity.requestList.ListInfoEntity;
// import com.engine.workflow.util.GetCustomLevelUtil;
// import com.engine.workflow.util.OrderByListUtil;
// import weaver.conn.RecordSet;
// import weaver.crm.Maint.CustomerInfoComInfo;
// import weaver.fullsearch.util.SearchBrowserUtils;
// import weaver.general.BaseBean;
// import weaver.general.Util;
// import weaver.hrm.User;
// import weaver.hrm.resource.ResourceComInfo;
// import weaver.system.RequestDefaultComInfo;
// import weaver.systeminfo.SystemEnv;
// import weaver.workflow.request.todo.OfsSettingObject;
// import weaver.workflow.request.todo.RequestUtil;
// import weaver.workflow.workflow.WorkflowConfigComInfo;
//
// import javax.servlet.http.HttpServletRequest;
// import java.util.*;
//
// /**
// * 移动端-流程中心列表数据
// * @author liuzy 2018-08-10
// */
// public class GetListResultCmd extends AbstractCommonCommand<Map<String,Object>>{
//
// private HttpServletRequest request;
// private CustomerInfoComInfo cci = null;
// private ResourceComInfo rc = null;
// private RequestDefaultComInfo requestDefaultComInfo = new RequestDefaultComInfo();
//
//
// /**ƒ
// * 列表上一些可以个性化的信息, 供个性化使用(后续可继续完善)
// */
// private ListInfoEntity listInfoEntity;
//
// public GetListResultCmd(HttpServletRequest request, User user){
// this.request = request;
// this.user = user;
// this.listInfoEntity = new ListInfoEntity();
//
// try {
// this.cci = new CustomerInfoComInfo();
// this.rc = new ResourceComInfo();
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
//
// @Override
// public Map<String, Object> execute(CommandContext commandContext) {
// Map<String,Object> result = new HashMap<String,Object>();
// try {
// RequestListDataInfoEntity bean = new GenerateDataInfoBiz().generateEntity(request, user);
// result = this.getResult(bean);
// } catch (Exception e) {
// e.printStackTrace();
// }
// return result;
// }
//
// @Override
// public BizLogContext getLogContext() {
// return null;
// }
//
//
// private Map<String,Object> getResult(RequestListDataInfoEntity bean) throws Exception {
// Map<String,Object> apidatas = new HashMap<String,Object>();
// RecordSet RecordSet = new RecordSet();
// RequestUtil requestutil = new RequestUtil();
// OfsSettingObject ofso = requestutil.getOfsSetting();
// boolean isopenos = ofso.getIsuse() == 1;// 是否开启异构系统待办
// boolean showdone = "1".equals(ofso.getShowdone());//异构系统是否显示已办数据
// WorkflowConfigComInfo wfconfig = new WorkflowConfigComInfo();
// int usequicksearch = Util.getIntValue(wfconfig.getValue("use_quicksearch_wflist"));//流程入口,是否使用微搜
// if(usequicksearch == 1 && false && this.supportQuickSerach(isopenos)){//满足微搜条件调用微搜
// return new RequestQuickSearchBiz().getRequestList4WfList(ParamUtil.request2Map(request), user,true);
// }
// //流程名称反射方法(兼容E8)
// String workflownamereflectmethod = "weaver.workflow.workflow.WorkflowComInfo.getWorkflowname";
// if(isopenos)
// workflownamereflectmethod = "weaver.general.WorkFlowTransMethod.getWorkflowname";
// String requestnamereflectclass = "com.api.workflow.util.WorkFlowSPATransMethod";
// Map<String,String> reqparams = bean.getReqparams();
// boolean showBatchSubmit = bean.isShowBatchSubmit();
// boolean isMergeShow = bean.isMergeShow();
// String CurrentUser = bean.getCurrentUser();
// String userIDAll = bean.getUserIDAll();
// if(!isMergeShow){
// userIDAll=""+user.getUID();
// }
// reqparams.put("isMergeShow",isMergeShow && !userIDAll.equals(String.valueOf(user.getUID()))?"1":"0");//设置开启并且有次账号
// boolean isQueryByNewTable = RequestListBiz.isQueryByNewTable(user,reqparams);
// apidatas.put("isQueryByNewTable",isQueryByNewTable);
// String orderby = bean.getOrderclause();
// String orderbyos = bean.getOrderclause_os();
// String sqlwhere = bean.getWhereclause();
// String sqlwhereos = bean.getWhereclause_os();
// String sqlwhereosDone = bean.getWhereclause_osDone();
// /* 处理流程中心 待办-已办tab页*/
// String mobileTabId = Util.null2String(request.getParameter("mobileTabId"));
// boolean isFormWfCenter = false;
// boolean isTransWfCenterOrder = true;
// if(!"".equals(mobileTabId)){
// isFormWfCenter = true;
// Map<String,String> wfCenterInfo = null;
// HashMap<String,Object> wfCenterParams = new HashMap<String,Object>();
// wfCenterParams.put("mobileTabId", mobileTabId);
// wfCenterParams.put("viewType", Util.null2String(request.getParameter("viewType")));
// wfCenterParams.put("menuid", Util.null2String(request.getParameter("menuid")));
// String wfCenterJsonstr = WorkflowCenterTabBiz.getWfCenterTabWhere(wfCenterParams);
// if(wfCenterJsonstr != null && !"".equals(wfCenterJsonstr)){
// Map<String,Object> jsonparams = JSON.parseObject(wfCenterJsonstr, Map.class);
// wfCenterInfo = WorkflowCenterTabBiz.getDefTabWhere(jsonparams);
// if(wfCenterInfo!=null){
// String wfsqlwhere = Util.null2String(wfCenterInfo.get("whereclause"));
// String wfsqlwhere_os = Util.null2String(wfCenterInfo.get("whereclause_os"));
// String wforderby = Util.null2String(wfCenterInfo.get("orderby"));
// if(!"".equals(wfsqlwhere)){
// sqlwhere += wfsqlwhere;
// }
// if(!"".equals(wfsqlwhere_os)){
// sqlwhereos += wfsqlwhere_os.replaceAll("ofs_todo.", "");
// sqlwhereosDone += wfsqlwhere_os.replaceAll("ofs_todo.","");
// }
// if(!"".equals(wforderby)){
// isTransWfCenterOrder = false;
// orderby = wforderby;
// orderbyos = wforderby.replaceAll("t1.", "").replaceAll("t2.", "");
// }
// }
// new BaseBean().writeLog("--获取的 流程中心 参数:" + JSONObject.toJSONString(wfCenterInfo));
// }
// }
// /* 处理流程中心 待办-已办tab页*/
// int userid = user.getUID();
// int usertype = "2".equals(user.getLogintype()) ? 1 : 0;
// String scope = Util.null2String(reqparams.get("viewScope"));
// if(scope == null || "".equals(scope.trim())) {
// scope = Util.null2String(reqparams.get("mobileDimensionScope"));
// }
// int sysId = Util.getIntValue(reqparams.get("sysId"), 0);
// boolean isDoing = "doing".equals(scope);
// String myorderby = "",colname="",isordertype="";
// OrderByListUtil obu = new OrderByListUtil(this.user);
// if(isDoing) {
// myorderby = obu.getMyOrderByStr(this.user.getUID(), PageUidConst.WF_LIST_DOING);
// if("".equals(myorderby)) {//如果为空,首选需要区分是初始未设置,还是用户清空数据了?
// myorderby += " receivedate desc, receivetime desc";
// }
// }
//
// // 处理已办排序 start
// String operateDateTimeFieldSql0 = "";
// String operateDateTimeFieldSql = "";
// String operateDateTimeFieldSqlOs = "";
// String tableOrderStr = isopenos ? orderbyos : orderby;
// if (tableOrderStr.toLowerCase().indexOf("operatedate") != -1) {
// operateDateTimeFieldSql0 = ",operatedate";
// operateDateTimeFieldSql = ", (case WHEN t2.operatedate IS NULL THEN t2.receivedate ELSE t2.operatedate END) operatedate ";
// operateDateTimeFieldSqlOs = ", (case WHEN operatedate IS NULL THEN receivedate ELSE operatedate END) operatedate ";
// }
//
// if (tableOrderStr.toLowerCase().indexOf("operatetime") != -1) {
// operateDateTimeFieldSql0 += ",operatetime";
// operateDateTimeFieldSql += ", (case WHEN t2.operatetime IS NULL THEN t2.receivetime ELSE t2.operatetime END) operatetime ";
// operateDateTimeFieldSqlOs += ", (case WHEN operatetime IS NULL THEN receivetime ELSE operatetime END) operatetime ";
// }
// // 处理已办排序 end
// // 最外层查询字段
// String backfields0 = " sysid,appurl,requestid,requestmark,createdate, createtime,creater, creatertype, workflowid, requestname, requestnamenew, " +
// "status,requestlevel,currentnodeid,viewtype,userid,receivedate,receivetime,isremark,nodeid,agentorbyagentid,agenttype,isprocessed "
// + operateDateTimeFieldSql0 + ",systype,workflowtype";
// // 原始查询字段
// String backfields = " 0 as sysid,t1.requestid as appurl,t1.requestid,t1.requestmark,t1.createdate, t1.createtime,t1.creater, t1.creatertype, t1.workflowid, t1.requestname, t1.requestnamenew," +
// " t1.status,t1.requestlevel,t1.currentnodeid,t2.viewtype,t2.userid,t2.usertype,t2.receivedate,t2.receivetime,t2.isremark,t2.nodeid,t2.agentorbyagentid,t2.agenttype,t2.isprocessed "
// + operateDateTimeFieldSql + " ,'0' as systype,t2.workflowtype";
// // 异构系统查询字段
// String backfieldsOs = " sysid,requestid as appurl,requestid,'' as requestmark,createdate, createtime,creatorid as creater, 0 as creatertype, workflowid, requestname, requestname as requestnamenew, " +
// "'' as status,requestlevel,-1 as currentnodeid,viewtype,userid,0 as usertype,receivedate,receivetime,isremark,0 as nodeid, -1 as agentorbyagentid,'0' as agenttype,'0' as isprocessed "
// + operateDateTimeFieldSqlOs + ",'1' as systype, sysid as workflowtype";
// //反馈黄点提示字段
// backfields0 += ",viewDate,viewTime,lastFeedBackDate,lastFeedBackTime,needwfback,lastFeedBackOperator";
// backfields += ",t2.viewDate,t2.viewTime,t1.lastFeedBackDate,t1.lastFeedBackTime,t2.needwfback,t1.lastFeedBackOperator";
// backfieldsOs += ",'' as viewDate,'' as viewTime,'' as lastFeedBackDate,'' as lastFeedBackTime,'' as needwfback,0 as lastFeedBackOperator";
// //反馈黄点提示字段
// String fromSql = " from workflow_requestbase t1,workflow_currentoperator t2,workflow_base t3 ";
//
// String para2 = "column:requestid+column:workflowid+column:viewtype+0+" + user.getLanguage()
// + "+column:nodeid+column:isremark+" + user.getUID()
// + "+column:agentorbyagentid+column:agenttype+column:isprocessed+column:userid+0+column:creater+" + userIDAll;
// String para4 = user.getLanguage() + "+" + user.getUID() + "+column:userid";
//
// para2 = "S+column:viewDate+column:viewTime+column:lastFeedBackDate+column:lastFeedBackTime+column:needwfback+column:lastFeedBackOperator+column:userid+S+" + para2;
//
// //配置参数
// SplitTableBean tableBean = new SplitTableBean();
// tableBean.setPageID("");
// tableBean.setPageUID("");
// tableBean.setPagesize("");
//
// tableBean.setBackfields(backfields);
// tableBean.setSqlform(fromSql);
// tableBean.setSqlorderby(orderby);
//
//
// if (isopenos) {
// orderby = orderbyos;
// String orderyOsDone = "";
// // if ("done".equals(scope)) {
// // orderby = "";
// // orderby = " ORDER BY " +
// // "operatedate DESC," +
// // "operatetime DESC ";
// // //orderyOsDone="";
// // }
//
// para2 = "column:requestid+column:workflowid+column:viewtype+0+" + user.getLanguage()
// + "+column:nodeid+column:isremark+" + user.getUID()
// + "+column:agentorbyagentid+column:agenttype+column:isprocessed+" +
// "column:userid+0+column:creater+" + userIDAll + "+column:systype+column:workflowtype";
// para2 = "S+column:viewDate+column:viewTime+column:lastFeedBackDate+column:lastFeedBackTime+column:needwfback+column:lastFeedBackOperator+column:userid+S+" + para2;
// if(isDoing) {//需要特殊处理
// backfields0 = this.getOrderBy() + backfields0;
// if(!isFormWfCenter || isTransWfCenterOrder){
// orderby = myorderby;
// }
// if(orderby.contains("overtime")){ // 处理移动端流程中心优先显示 超时流程
// backfields0 = backfields0 + ",overtime ";
// backfields = backfields + ",case when ((t2.isremark='0' and (t2.isprocessed='0' or t2.isprocessed='3' or t2.isprocessed='2')) or t2.isremark='5') then '1' else '0' end as overtime ";
// backfieldsOs = backfieldsOs + ",'0' as overtime ";
// }
// fromSql = " from (select " + backfields0 + " from (select " + backfields + " " + fromSql + "" + sqlwhere
// + " union (select distinct " + backfieldsOs + " from ofs_todo_data " + sqlwhereos + ") " + " ) t1 ) t1 ";
// } else if("done".equals(scope)){//异构系统不显示已办可以直接不查已办表
// if(showdone){
// fromSql = " from (select " + backfields0 + " from (select " + backfields + " " + fromSql + "" + sqlwhere
// + " union (select distinct " + backfieldsOs + " from ofs_done_data " + sqlwhereosDone + ") " + " ) t1 ) t1 ";
// }else{
// fromSql = " from (select " + backfields0 + " from (select " + backfields + " " + fromSql + "" + sqlwhere + " ) t1 ) t1 ";
// }
// } else if("mine".equals(scope)){ // 我的请求 默认排序条件 创建日期 创建时间
// if(showdone){//异构系统不显示已办时我的请求sql和待办sql一致
// fromSql = " from (select " + backfields0 + " from (select " + backfields + " " + fromSql + "" + sqlwhere
// + " union (select distinct " + backfieldsOs + " from ofs_todo_data " + sqlwhereos + ") union (select distinct " + backfieldsOs + " from ofs_done_data" + sqlwhereosDone + ") ) t1 ) t1 ";
// }else{
// fromSql = " from (select " + backfields0 + " from (select " + backfields + " " + fromSql + "" + sqlwhere
// + " union (select distinct " + backfieldsOs + " from ofs_todo_data " + sqlwhereos + ") " + " ) t1 ) t1 ";
// }
// if(orderby==null || "".equals(orderby)){
// orderby = " receivedate,receivetime ";
// }
// } else{
// orderby = " receivedate,receivetime ";
// }
// //orderby = " receivedate,receivetime ";
//
// tableBean.setBackfields(backfields0);
// tableBean.setSqlwhere("");
// } else {
// if((orderby.toLowerCase().indexOf("operatedate") != -1 || orderby.toLowerCase().indexOf("operatetime") != -1) && (isTransWfCenterOrder || !isFormWfCenter)){
// //已办含case when情况排序特殊处理
// fromSql = " from (select " + backfields + " " + fromSql + "" + sqlwhere + ") t1 ";
// orderby = orderby.replace("t2.", "t1.");
// tableBean.setBackfields(backfields0);
// tableBean.setSqlwhere("");
// }else{
// if(isDoing) {//需要特殊处理
// backfields = this.getOrderBy() + backfields;
// if(!isFormWfCenter || isTransWfCenterOrder){ // 移动端流程中心 -待办 走应用配置的排序
// orderby = myorderby;
// }else if(orderby.contains("overtime")){ // 处理 overtime 条件
// backfields = backfields + ",case when ((t2.isremark='0' and (t2.isprocessed='0' or t2.isprocessed='3' or t2.isprocessed='2')) or t2.isremark='5') then '1' else '0' end as overtime ";
// }
// }
// orderby = OrderByListUtil.appendRequestIdOrderBy(orderby,"t1");
// tableBean.setBackfields(backfields);
// tableBean.setSqlwhere((sqlwhere));
// }
// }
// tableBean.setSqlform(isQueryByNewTable ? RequestListBiz.transNewTable(user,fromSql) : fromSql);
// orderby = OrderByListUtil.appendRequestIdOrderBy(orderby);
//
// String firstFloor = bean.getFirstFloor();//建模表类型对应的数据id,根据这个id来获取这类流程需要额外展示的字段列
// String orderrule = "";//0--升序 1--降序
// String sysorder = "";//排序系统字段 0-紧急程度 1-创建日期 2-接收日期 3-操作时间 4-流程编号
// String order_qc = "";
// String order_by = "";
// if (!"".equals(firstFloor)) {
// RecordSet.executeQuery("select orderrule,sysorder from uf_treelistsetting where id = ?", Util.getIntValue(firstFloor));
// if (RecordSet.next()){
// orderrule = RecordSet.getString("orderrule");
// if ("0".equals(orderrule)){
// order_by = "asc";
// }
// if ("1".equals(orderrule)){
// order_by = "desc";
// }
// sysorder = RecordSet.getString("sysorder");
// }
// }
// if (!"".equals(firstFloor) && !"".equals(sysorder)) {
// String[] orderArr = sysorder.split(",");
// for (String id : orderArr){
// if ("0".equals(id)){
// order_qc += ",requestlevel " + order_by ;
// }
// if ("1".equals(id)){
// order_qc += ",createdate " + order_by + ",createtime " + order_by ;
// }
// if ("2".equals(id)){
// order_qc += ",receivedate " + order_by + ",receivetime " + order_by ;
// }
// if ("3".equals(id)){
// order_qc += ",operatedate " + order_by + ",operatetime " + order_by ;
// }
// if ("4".equals(id)){
// order_qc += ",requestmark " + order_by ;
// }
// }
// orderby = order_qc;
// if (orderby.startsWith(",")){
// orderby = orderby.substring(1);
// }
//
// }
//
//
// tableBean.setSqlorderby(orderby);
// tableBean.setSqlprimarykey("requestid");
// tableBean.setSqlsortway("Desc");
// tableBean.setSqlisdistinct("false");
//
//
// List<SplitTableColBean> cols=new ArrayList<>();
// //top
// SplitTableColBean topCol=new SplitTableColBean();
// topCol.setColumn("requestname");
// topCol.setText(SystemEnv.getHtmlLabelName(1334, user.getLanguage()));
// topCol.setMobiletransmethod(requestnamereflectclass + ".getTitle4Mobile_AttentionTag");
// topCol.setMobileotherpara(para2);
// topCol.setMobileviewtype(MobileViewTypeAttr.HIGHLIGHT);
// topCol.setBelong(BelongAttr.PCMOBILE);
// cols.add(topCol);
//
// SplitTableColBean leftCol=new SplitTableColBean();
//
// if ("doing".equals(scope)) {
// leftCol.setColumn("receivedate");
// leftCol.setText(SystemEnv.getHtmlLabelName(17994, user.getLanguage()));//17994 388137
// //.setWidth("65%")
// leftCol.setMobiletransmethod("weaver.general.WorkFlowTransMethod.getWFSearchResultCreateTime");
// leftCol.setMobileotherpara("column:receivetime");
// leftCol.setMobileviewtype(MobileViewTypeAttr.DETAIL);
// leftCol.setBelong(BelongAttr.PCMOBILE);
//
// new BaseBean().writeLog("com.engine.workflow.cmd.mobileCenter.GetListResultCmd 这是代办");
// } else if ("done".equals(scope)) {
// leftCol.setColumn("operatedate");
// leftCol.setText(SystemEnv.getHtmlLabelName(15502, user.getLanguage()));//17994 388137
// //.setWidth("65%")
// leftCol.setMobiletransmethod("weaver.general.WorkFlowTransMethod.getWFSearchResultCreateTime");
// leftCol.setMobileotherpara("column:operatetime");
// leftCol.setMobileviewtype(MobileViewTypeAttr.DETAIL);
// leftCol.setBelong(BelongAttr.PCMOBILE);
//
// new BaseBean().writeLog("com.engine.workflow.cmd.mobileCenter.GetListResultCmd 这是已办");
// }
// //left
// cols.add(leftCol);
// //right
// SplitTableColBean rightCol=new SplitTableColBean();
// rightCol.setColumn("workflowid");
// rightCol.setText(SystemEnv.getHtmlLabelName(259, user.getLanguage()));
// rightCol.setMobiletransmethod(workflownamereflectmethod);
// if(isopenos){
// rightCol.setMobileotherpara("column:sysid"); // 20190906 wwp
// }
//
// //rightCol.setTransmethod(workflownamereflectmethod);
// rightCol.setBelong(BelongAttr.PCMOBILE);
// cols.add(rightCol);
//
//
// SplitTableColBean requestidCol=new SplitTableColBean();
// requestidCol.setColumn("requestid");
// //rightCol.setTransmethod(workflownamereflectmethod);
// requestidCol.setBelong(BelongAttr.PCMOBILE);
// cols.add(requestidCol);
//
// //zzw
// int menuid = Util.getIntValue(reqparams.get("menuid"),-1);
// MobileDimensionsBiz mdb = new MobileDimensionsBiz();
// if(!"mine".equals(mdb.getScope(menuid)) && !"mine".equals(scope)){
// SplitTableColBean createrCol = new SplitTableColBean();
// createrCol.setColumn("creater");
// createrCol.setMobileotherpara("column:creatertype");
// createrCol.setMobiletransmethod("com.engine.workflow.cmd.mobileCenter.GetListResultCmd.getWFSearchResultName");
// createrCol.setBelong(BelongAttr.PCMOBILE);
// cols.add(createrCol);
// }
//
// //appurl---start
// SplitTableColBean appurlCol = new SplitTableColBean();
// appurlCol.setColumn("appurl");
// appurlCol.setMobileotherpara("column:sysid+column:workflowid+column:userid+1");
// appurlCol.setMobiletransmethod("weaver.general.WorkFlowTransMethod.getAppUrl");
// appurlCol.setBelong(BelongAttr.PCMOBILE);
// cols.add(appurlCol);
// //appurl---end
//
// //钉钉、企业微信pc客户端以默认浏览器打开流程
// SplitTableColBean openByDefaultBrowserCol = new SplitTableColBean();
// openByDefaultBrowserCol.setColumn("requestid");
// openByDefaultBrowserCol.setKey("openByDefaultBrowser");
// openByDefaultBrowserCol.setMobiletransmethod(requestnamereflectclass+".getOpenByDefaultBrowserFlag");
// openByDefaultBrowserCol.setBelong(BelongAttr.MOBILE);
// cols.add(openByDefaultBrowserCol);
//
// //移动端打开异构系统流程,是否启动监听时间,当异构系统流程提交后自动刷新列表
// SplitTableColBean autoReloadWfListTimeCol = new SplitTableColBean();
// autoReloadWfListTimeCol.setColumn("requestid");
// autoReloadWfListTimeCol.setMobileotherpara("1");
// autoReloadWfListTimeCol.setKey("autoReloadWfListTime");
// autoReloadWfListTimeCol.setMobiletransmethod(RequestListBiz.class.getName()+".getAutoReloadWfListTime");
// autoReloadWfListTimeCol.setBelong(BelongAttr.MOBILE);
// cols.add(autoReloadWfListTimeCol);
//
// //userid
// SplitTableColBean useridCol = new SplitTableColBean();
// useridCol.setColumn("userid");
// // useridCol.setMobileotherpara("column:usertype");
// // useridCol.setMobiletransmethod(requestnamereflectclass+".getMobileUseridStr");
// useridCol.setBelong(BelongAttr.PCMOBILE);
// cols.add(useridCol);
//
// SplitTableColBean userType = new SplitTableColBean();
// userType.setColumn("usertype");
// // useridCol.setMobileotherpara("column:usertype");
// // useridCol.setMobiletransmethod(requestnamereflectclass+".getMobileUseridStr");
// userType.setBelong(BelongAttr.MOBILE);
// cols.add(userType);
// //userid
// SplitTableColBean primaryCol = new SplitTableColBean();
// primaryCol.setColumn("primarykey");
// //getprimaryKey
// primaryCol.setMobiletransmethod(requestnamereflectclass + ".getprimaryKey");
// primaryCol.setMobileotherpara("column:requestid+column:userid");
// primaryCol.setBelong(BelongAttr.PCMOBILE);
// primaryCol.setIsPrimarykey(BoolAttr.TRUE);
// primaryCol.setHide("true");
// cols.add(primaryCol);
//
//
// SplitTableColBean ciCol = new SplitTableColBean();
// ciCol.setColumn("primaryInfo");
// //getprimaryKey
// ciCol.setMobiletransmethod(requestnamereflectclass + ".getprimaryInfo");
// ciCol.setMobileotherpara("column:userid+" + userIDAll);
// ciCol.setBelong(BelongAttr.MOBILE);
// ciCol.setIsPrimarykey(BoolAttr.TRUE);
// ciCol.setHide("true");
// cols.add(ciCol);
//
//
//
// tableBean.setCols(cols);
// tableBean.setTableType("checkbox");
// List list1 = new ArrayList();
// if(!"mine".equals(mdb.getScope(menuid)) && !"mine".equals(scope)){
// if ("done".equals(scope)) {
// list1 = JSON.parseArray(JSON_CONFIG2_DONE, SplitMobileDataBean.class);
// new BaseBean().writeLog("com.engine.workflow.cmd.mobileCenter.GetListResultCmd 进入 JSON_CONFIG2_DONE ");
// } else {
// list1 = JSON.parseArray(JSON_CONFIG2, SplitMobileDataBean.class);
// }
// }else{
// if ("done".equals(scope)) {
// list1 = JSON.parseArray(JSON_CONFIG2_MOBILE_DONE, SplitMobileDataBean.class);
// new BaseBean().writeLog("com.engine.workflow.cmd.mobileCenter.GetListResultCmd 进入 JSON_CONFIG2_MOBILE_DONE ");
// } else {
// list1 = JSON.parseArray(JSON_CONFIG2_MOBILE, SplitMobileDataBean.class);
// }
// }
// tableBean.createMobileTemplate(list1);
//
//
// List<Checkboxpopedom> checkBoxList = new ArrayList<Checkboxpopedom>();
//
//
//
// //可提交
// if(isDoing ||(showBatchSubmit&&menuid>0)){
// Checkboxpopedom checkboxpopedom =new Checkboxpopedom();
// checkboxpopedom.setId("batchSubmit");
// String multSubmitParam = this.listInfoEntity.getListOperateInfoEntity().getMultSubmitParam();
// String multSubmitMethod = this.listInfoEntity.getListOperateInfoEntity().getMultSubmitMethod();
// checkboxpopedom.setShowmethod(multSubmitMethod);
// checkboxpopedom.setPopedompara(multSubmitParam);
//
// checkBoxList.add(checkboxpopedom);
// }
//
// //批量督办,批量关注
// if("done".equals(scope) || "mine".equals(scope) || isDoing){
// //批量督办
// Checkboxpopedom checkboxpopedom =new Checkboxpopedom();
// checkboxpopedom.setId("batchSupervise");
// String multSubmitParam = "column:requestid+column:userid+column:workflowid";
// String multSubmitMethod = "com.engine.workflow.cmd.requestList.GetListResultCmd.getBatchSupervisorCheckbox";
// checkboxpopedom.setShowmethod(multSubmitMethod);
// checkboxpopedom.setPopedompara(multSubmitParam);
// checkBoxList.add(checkboxpopedom);
//
// //批量关注
// Checkboxpopedom checkboxpopedom2 =new Checkboxpopedom();
// checkboxpopedom2.setId("batchAttention");
// String multSubmitParam2 = "column:requestid+column:userid+column:workflowid";
// String multSubmitMethod2 = "com.engine.workflow.cmd.requestList.GetListResultCmd.getBatchAttentionCheckbox";
// checkboxpopedom2.setShowmethod(multSubmitMethod2);
// checkboxpopedom2.setPopedompara(multSubmitParam2);
// checkBoxList.add(checkboxpopedom2);
// }
//
// //批量转发
// Checkboxpopedom checkboxpopedom3 =new Checkboxpopedom();
// checkboxpopedom3.setId("batchForward");
// String multSubmitParam = "column:requestid+column:userid+column:workflowid+"+usertype;
// String multSubmitMethod = "com.engine.workflow.cmd.requestList.GetListResultCmd.getBatchForwardCheckbox";
// checkboxpopedom3.setShowmethod(multSubmitMethod);
// checkboxpopedom3.setPopedompara(multSubmitParam);
// checkBoxList.add(checkboxpopedom3);
//
// tableBean.setCheckboxList(checkBoxList);
//
//
// //显示多列
// tableBean.setMobileshowtype(MobileShowTypeAttr.ListView);
// //String sessionkey = "workflow_"+scope+"_"+Util.getEncrypt(Util.getRandom());
// apidatas.putAll(SplitTableUtil.makeListDataResult(tableBean));
//
// //批量提交是否需要签字意见
// int multisubmitnotinputsign = 0;
// if(showBatchSubmit && isDoing){
// RecordSet.executeQuery("select multisubmitnotinputsign from workflow_RequestUserDefault where userId=?", userid);
// if(RecordSet.next())
// multisubmitnotinputsign = Util.getIntValue(Util.null2String(RecordSet.getString("multisubmitnotinputsign")), 0);
// }
// if(showBatchSubmit && isDoing && sysId != 5 && sysId != 8)
// apidatas.put("hasBatchSubmitBtn", "true");
// apidatas.put("multisubmitnotinputsign", multisubmitnotinputsign);
// RequestListBiz.removeRecord(user);//钉钉、企业微信以默认浏览器打开流程,刷新时清空客户端和浏览器交互数据
// //开启连续处理
// boolean isOpenContinuationProcess = "1".equals(requestDefaultComInfo.getIsOpenContinnuationProcess(userid+""));
// apidatas.put("isOpenContinuationProcess", "doing".equals(scope) && isOpenContinuationProcess);
// return apidatas;
// }
//
// /**
// * 使用case...when的方式进行设置orderby
// * @return
// */
// private String getOrderBy() {
// List<Map<String, Object>> list= GetCustomLevelUtil.getAllLevel(null, this.user.getLanguage());
//
// StringBuffer sb = new StringBuffer(" (case requestlevel ");
// StringBuffer sb1 = new StringBuffer("");
// for(Map<String, Object> map : list) {
// sb1.append(" when "+map.get("id") +" then "+map.get("showorder")) ;
// }
// if("".equals(sb1.toString().trim())) {//判断有无数据没有数据则不拼接
// return "";
// }
// sb.append(sb1);
// sb.append(" else -1 end ) as requestlevelorder, ");
// return sb.toString();
// }
//
// public HttpServletRequest getRequest() {
// return request;
// }
//
// public void setRequest(HttpServletRequest request) {
// this.request = request;
// }
//
// public ListInfoEntity getListInfoEntity() {
// return listInfoEntity;
// }
//
// public void setListInfoEntity(ListInfoEntity listInfoEntity) {
// this.listInfoEntity = listInfoEntity;
// }
//
// public String getWFSearchResultName(String id, String type) {
// String returnStr = "";
// if ("1".equals(type)) { //外部
// returnStr = cci.getCustomerInfoname(id) + " ";
//
// } else { //内部
// returnStr = rc.getResourcename(id) + " ";
// }
// return returnStr;
// }
//
//
// public GetListResultCmd() {
// try {
// this.cci = new CustomerInfoComInfo();
// this.rc = new ResourceComInfo();
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
//
// //列表是否满足走微搜条件判断
// private boolean supportQuickSerach(boolean isopenos){
// int viewcondition = Util.getIntValue(Util.null2String(request.getParameter("viewcondition")), 0);
// List<Integer> supportViewconList = Arrays.asList(41,46,51);
// if(!isopenos && "".equals(Util.null2String(request.getParameter("resourceid"))) && "".equals(Util.null2String(request.getParameter("tabkeys"))) && supportViewconList.contains(viewcondition)){//满足微搜条件调用微搜
// RecordSet rs = new RecordSet();
// rs.executeQuery("select * from HrmUserSetting where resourceId=?", user.getUID());//主次账号统一显示不走微搜因为微搜暂时无法传给transmethod对应的userid
// String belongtoshow = "";
// if(rs.next()){
// belongtoshow = Util.null2String(rs.getString("belongtoshow"));
// }
// String Belongtoids = user.getBelongtoids();
// String scope = Util.null2String(request.getParameter("viewScope"));
// String recievedateselect = Util.null2String(request.getParameter("recievedateselect"));
// String operatedateselect = Util.null2String(request.getParameter("operatedateselect"));
// String hrmcreaterid = Util.null2String(request.getParameter("hrmcreaterid"));
// if((!"1".equals(belongtoshow) || ("1".equals(belongtoshow) && "".equals(Belongtoids))) && "mine".equals(scope) && ("".equals(recievedateselect) || "0".equals(recievedateselect))
// && ("".equals(operatedateselect) || "0".equals(operatedateselect)) && "".equals(hrmcreaterid)){//暂时只放出我的请求,相当于支持我的请求高级搜索的标题,路径,归档状态和流程状态默认值
// return (SearchBrowserUtils.quickSearchValidate("WFSEARCH",user.getLanguage() + "") && SearchBrowserUtils.isSupportWfRemarkStatus());
// }
// }
// return false;
// }
//
// final String JSON_CONFIG = "[" +
// " {" +
// " \"configs\": [" +
// " {" +
// " \"configs\": [" +
// " {" +
// " \"key\": \"requestname\"" +
// " }" +
// " ]," +
// " \"key\": \"col1_row1\"" +
// " }," +
// " {" +
// " \"configs\": [" +
// " {" +
// " \"key\": \"receivedate\"" +
// " }," +
// " {" +
// " \"style\": {" +
// " \"float\": \"right\"" +
// " }," +
// " \"key\": \"workflowid,\"" +
// " \"class\": \"workflowid\"" +
// " }" +
// " ]," +
// " \"key\": \"col1_row2\"" +
// " }" +
// " ]," +
// " \"key\": \"col1\"" +
// " }" +
// "]";
//
// String JSON_CONFIG3 = "[\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"key\": \"requestname\",\n" +
// " \"style\": {\n" +
// " \"fontWeight\": \"inherit\",\"color\": \"#000\",\"width\": \"96%\"" +
// " }\n" +
// " },{\"key\":\"primaryInfo\"}\n" +
// " ],\n" +
// " \"key\": \"col1_row1\"\n" +
// " },\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"key\": \"creater\",\n" +
// " \"style\": {\n" +
// " \"marginRight\": \"5px\"\n" +
// " },\n" +
// // " \"className\": \"workflowid\"" +
// " },\n" +
// " {\n" +
// " \"key\": \"receivedate\",\n" +
// // " \"className\": \"wf-center-list-createdate\"" +
// " },\n" +
// " {\n" +
// // " \"style\": {\n" +
// // " \"float\": \"right\"\n" +
// // " },\n" +
// " \"key\": \"workflowid\",\n" +
// // " \"className\": \"wf-center-list-workflowid\"" +
// " }\n" +
// " ],\n" +
// " \"key\": \"col1_row2\"\n" +
// " }\n" +
// " ],\n" +
// " \"key\": \"col1\"\n" +
// " }\n" +
// "]";
//
// public static final String JSON_CONFIG2 = "[\n" +
//
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"key\": \"requestname\",\n" +
// " \"style\": {\n" +
// " \"fontWeight\": \"inherit\",\"color\": \"#000\",\"width\": \"96%\"" +
// " }\n" +
// " },{\"key\":\"primaryInfo\"}\n" +
// " ],\n" +
// " \"key\": \"col1_row1\"\n" +
// " },\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"key\": \"workflowid\",\n" +
// " \"style\": {\n" +
// " \"textOverflow\": \"ellipsis\",\n" +
// " \"overflow\": \"hidden\",\n" +
// " \"whiteSpace\": \"nowrap\",\n" +
// " \"width\": \"90%\",\n" +
// " },\n" +
// " },\n" +
// " ],\n" +
// " \"key\": \"col1_row2\"\n" +
// " },\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"key\": \"creater\",\n" +
// " \"style\": {\n" +
// " \"marginRight\": \"5px\"\n" +
// " },\n" +
// " },\n" +
// " {\n" +
// " \"key\": \"createdate\",\n" +
// " \"style\": {\n" +
// " \"marginRight\": \"5px\"\n" +
// " },\n" +
// " },\n" +
// " ],\n" +
// " \"key\": \"col1_row3\"\n" +
// " },\n" +
// " ],\n" +
// " \"key\": \"col1\"\n" +
// " }\n" +
// "]";
//
// public static final String JSON_CONFIG2_MOBILE = "[\n" +
//
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"key\": \"requestname\",\n" +
// " \"style\": {\n" +
// " \"fontWeight\": \"inherit\",\"color\": \"#000\",\"width\": \"96%\"" +
// " }\n" +
// " },{\"key\":\"primaryInfo\"}\n" +
// " ],\n" +
// " \"key\": \"col1_row1\"\n" +
// " },\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"key\": \"workflowid\",\n" +
// " \"style\": {\n" +
// " \"textOverflow\": \"ellipsis\",\n" +
// " \"overflow\": \"hidden\",\n" +
// " \"whiteSpace\": \"nowrap\",\n" +
// " \"width\": \"90%\",\n" +
// " },\n" +
// " },\n" +
// " ],\n" +
// " \"key\": \"col1_row2\"\n" +
// " },\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"key\":\"createdate\",\n" +
// " \"style\": {\n" +
// " \"marginRight\": \"5px\"\n" +
// " },\n" +
// " },\n" +
// " ],\n" +
// " \"key\": \"col1_row3\"\n" +
// " },\n" +
// " ],\n" +
// " \"key\": \"col1\"\n" +
// " }\n" +
// "]";
//
// public static final String JSON_CONFIG2_DONE = "[\n" +
//
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"key\": \"requestname\",\n" +
// " \"style\": {\n" +
// " \"fontWeight\": \"inherit\",\"color\": \"#000\",\"width\": \"96%\"" +
// " }\n" +
// " },{\"key\":\"primaryInfo\"}\n" +
// " ],\n" +
// " \"key\": \"col1_row1\"\n" +
// " },\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"key\": \"workflowid\",\n" +
// " \"style\": {\n" +
// " \"textOverflow\": \"ellipsis\",\n" +
// " \"overflow\": \"hidden\",\n" +
// " \"whiteSpace\": \"nowrap\",\n" +
// " \"width\": \"90%\",\n" +
// " },\n" +
// " },\n" +
// " ],\n" +
// " \"key\": \"col1_row2\"\n" +
// " },\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"key\": \"creater\",\n" +
// " \"style\": {\n" +
// " \"marginRight\": \"5px\"\n" +
// " },\n" +
// " },\n" +
// " {\n" +
// " \"key\": \"operatedate\",\n" +
// " \"style\": {\n" +
// " \"marginRight\": \"5px\"\n" +
// " },\n" +
// " },\n" +
// " ],\n" +
// " \"key\": \"col1_row3\"\n" +
// " },\n" +
// " ],\n" +
// " \"key\": \"col1\"\n" +
// " }\n" +
// "]";
//
// public static final String JSON_CONFIG2_MOBILE_DONE = "[\n" +
//
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"key\": \"requestname\",\n" +
// " \"style\": {\n" +
// " \"fontWeight\": \"inherit\",\"color\": \"#000\",\"width\": \"96%\"" +
// " }\n" +
// " },{\"key\":\"primaryInfo\"}\n" +
// " ],\n" +
// " \"key\": \"col1_row1\"\n" +
// " },\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"key\": \"workflowid\",\n" +
// " \"style\": {\n" +
// " \"textOverflow\": \"ellipsis\",\n" +
// " \"overflow\": \"hidden\",\n" +
// " \"whiteSpace\": \"nowrap\",\n" +
// " \"width\": \"90%\",\n" +
// " },\n" +
// " },\n" +
// " ],\n" +
// " \"key\": \"col1_row2\"\n" +
// " },\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"key\":\"operatedate\",\n" +
// " \"style\": {\n" +
// " \"marginRight\": \"5px\"\n" +
// " },\n" +
// " },\n" +
// " ],\n" +
// " \"key\": \"col1_row3\"\n" +
// " },\n" +
// " ],\n" +
// " \"key\": \"col1\"\n" +
// " }\n" +
// "]";
// }

@ -0,0 +1,806 @@
// package com.engine.workflow.cmd.mobileCenter;
//
// import java.util.*;
//
// import javax.servlet.http.HttpServletRequest;
//
// import com.alibaba.fastjson.JSON;
// import com.alibaba.fastjson.JSONObject;
// import com.api.browser.bean.Checkboxpopedom;
// import com.api.browser.bean.SplitTableBean;
// import com.api.browser.bean.SplitTableColBean;
// import com.api.browser.util.*;
// import com.cloudstore.dev.api.bean.SplitMobileDataBean;
// import com.engine.common.util.ParamUtil;
// import com.engine.workflow.biz.RequestQuickSearchBiz;
// import com.engine.workflow.biz.mobileCenter.MobileDimensionsBiz;
// import com.engine.workflow.biz.mobileCenter.WorkflowCenterTabBiz;
// import com.engine.workflow.biz.requestList.RequestListBiz;
// import com.engine.workflow.constant.PageUidConst;
// import com.engine.workflow.entity.requestList.ListInfoEntity;
// import com.engine.workflow.util.GetCustomLevelUtil;
// import com.engine.workflow.util.OrderByListUtil;
// import weaver.conn.RecordSet;
// import weaver.crm.Maint.CustomerInfoComInfo;
// import weaver.fullsearch.util.SearchBrowserUtils;
// import weaver.general.BaseBean;
// import weaver.general.Util;
// import weaver.hrm.User;
// import weaver.hrm.resource.ResourceComInfo;
// import weaver.system.RequestDefaultComInfo;
// import weaver.systeminfo.SystemEnv;
//
// import com.engine.common.biz.AbstractCommonCommand;
// import com.engine.common.entity.BizLogContext;
// import com.engine.core.interceptor.CommandContext;
// import com.engine.workflow.biz.requestList.GenerateDataInfoBiz;
// import com.engine.workflow.entity.RequestListDataInfoEntity;
// import weaver.workflow.request.todo.OfsSettingObject;
// import weaver.workflow.request.todo.RequestUtil;
// import weaver.workflow.workflow.WorkflowConfigComInfo;
//
// /**
// * 移动端-流程中心列表数据
// * @author liuzy 2018-08-10
// */
// public class GetListResultCmdBak extends AbstractCommonCommand<Map<String,Object>>{
//
// private HttpServletRequest request;
// private CustomerInfoComInfo cci = null;
// private ResourceComInfo rc = null;
// private RequestDefaultComInfo requestDefaultComInfo = new RequestDefaultComInfo();
//
//
// /**ƒ
// * 列表上一些可以个性化的信息, 供个性化使用(后续可继续完善)
// */
// private ListInfoEntity listInfoEntity;
//
// public GetListResultCmdBak(HttpServletRequest request, User user){
// this.request = request;
// this.user = user;
// this.listInfoEntity = new ListInfoEntity();
//
// try {
// this.cci = new CustomerInfoComInfo();
// this.rc = new ResourceComInfo();
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
//
// @Override
// public Map<String, Object> execute(CommandContext commandContext) {
// Map<String,Object> result = new HashMap<String,Object>();
// try {
// RequestListDataInfoEntity bean = new GenerateDataInfoBiz().generateEntity(request, user);
// result = this.getResult(bean);
// } catch (Exception e) {
// e.printStackTrace();
// }
// return result;
// }
//
// @Override
// public BizLogContext getLogContext() {
// return null;
// }
//
//
// private Map<String,Object> getResult(RequestListDataInfoEntity bean) throws Exception {
// Map<String,Object> apidatas = new HashMap<String,Object>();
// RecordSet RecordSet = new RecordSet();
// RequestUtil requestutil = new RequestUtil();
// OfsSettingObject ofso = requestutil.getOfsSetting();
// boolean isopenos = ofso.getIsuse() == 1;// 是否开启异构系统待办
// boolean showdone = "1".equals(ofso.getShowdone());//异构系统是否显示已办数据
// WorkflowConfigComInfo wfconfig = new WorkflowConfigComInfo();
// int usequicksearch = Util.getIntValue(wfconfig.getValue("use_quicksearch_wflist"));//流程入口,是否使用微搜
// if(usequicksearch == 1 && false && this.supportQuickSerach(isopenos)){//满足微搜条件调用微搜
// return new RequestQuickSearchBiz().getRequestList4WfList(ParamUtil.request2Map(request), user,true);
// }
// //流程名称反射方法(兼容E8)
// String workflownamereflectmethod = "weaver.workflow.workflow.WorkflowComInfo.getWorkflowname";
// if(isopenos)
// workflownamereflectmethod = "weaver.general.WorkFlowTransMethod.getWorkflowname";
// String requestnamereflectclass = "com.api.workflow.util.WorkFlowSPATransMethod";
// Map<String,String> reqparams = bean.getReqparams();
// boolean showBatchSubmit = bean.isShowBatchSubmit();
// boolean isMergeShow = bean.isMergeShow();
// String CurrentUser = bean.getCurrentUser();
// String userIDAll = bean.getUserIDAll();
// if(!isMergeShow){
// userIDAll=""+user.getUID();
// }
// reqparams.put("isMergeShow",isMergeShow && !userIDAll.equals(String.valueOf(user.getUID()))?"1":"0");//设置开启并且有次账号
// boolean isQueryByNewTable = RequestListBiz.isQueryByNewTable(user,reqparams);
// apidatas.put("isQueryByNewTable",isQueryByNewTable);
// String orderby = bean.getOrderclause();
// String orderbyos = bean.getOrderclause_os();
// String sqlwhere = bean.getWhereclause();
// String sqlwhereos = bean.getWhereclause_os();
// String sqlwhereosDone = bean.getWhereclause_osDone();
// /* 处理流程中心 待办-已办tab页*/
// String mobileTabId = Util.null2String(request.getParameter("mobileTabId"));
// boolean isFormWfCenter = false;
// boolean isTransWfCenterOrder = true;
// if(!"".equals(mobileTabId)){
// isFormWfCenter = true;
// Map<String,String> wfCenterInfo = null;
// HashMap<String,Object> wfCenterParams = new HashMap<String,Object>();
// wfCenterParams.put("mobileTabId", mobileTabId);
// wfCenterParams.put("viewType", Util.null2String(request.getParameter("viewType")));
// wfCenterParams.put("menuid", Util.null2String(request.getParameter("menuid")));
// String wfCenterJsonstr = WorkflowCenterTabBiz.getWfCenterTabWhere(wfCenterParams);
// if(wfCenterJsonstr != null && !"".equals(wfCenterJsonstr)){
// Map<String,Object> jsonparams = JSON.parseObject(wfCenterJsonstr, Map.class);
// wfCenterInfo = WorkflowCenterTabBiz.getDefTabWhere(jsonparams);
// if(wfCenterInfo!=null){
// String wfsqlwhere = Util.null2String(wfCenterInfo.get("whereclause"));
// String wfsqlwhere_os = Util.null2String(wfCenterInfo.get("whereclause_os"));
// String wforderby = Util.null2String(wfCenterInfo.get("orderby"));
// if(!"".equals(wfsqlwhere)){
// sqlwhere += wfsqlwhere;
// }
// if(!"".equals(wfsqlwhere_os)){
// sqlwhereos += wfsqlwhere_os.replaceAll("ofs_todo.", "");
// sqlwhereosDone += wfsqlwhere_os.replaceAll("ofs_todo.","");
// }
// if(!"".equals(wforderby)){
// isTransWfCenterOrder = false;
// orderby = wforderby;
// orderbyos = wforderby.replaceAll("t1.", "").replaceAll("t2.", "");
// }
// }
// new BaseBean().writeLog("--获取的 流程中心 参数:" + JSONObject.toJSONString(wfCenterInfo));
// }
// }
// /* 处理流程中心 待办-已办tab页*/
// int userid = user.getUID();
// int usertype = "2".equals(user.getLogintype()) ? 1 : 0;
// String scope = Util.null2String(reqparams.get("viewScope"));
// if(scope == null || "".equals(scope.trim())) {
// scope = Util.null2String(reqparams.get("mobileDimensionScope"));
// }
// int sysId = Util.getIntValue(reqparams.get("sysId"), 0);
// boolean isDoing = "doing".equals(scope);
// String myorderby = "",colname="",isordertype="";
// OrderByListUtil obu = new OrderByListUtil(this.user);
// if(isDoing) {
// myorderby = obu.getMyOrderByStr(this.user.getUID(), PageUidConst.WF_LIST_DOING);
// if("".equals(myorderby)) {//如果为空,首选需要区分是初始未设置,还是用户清空数据了?
// myorderby += " receivedate desc, receivetime desc";
// }
// }
//
// // 处理已办排序 start
// String operateDateTimeFieldSql0 = "";
// String operateDateTimeFieldSql = "";
// String operateDateTimeFieldSqlOs = "";
// String tableOrderStr = isopenos ? orderbyos : orderby;
// if (tableOrderStr.toLowerCase().indexOf("operatedate") != -1) {
// operateDateTimeFieldSql0 = ",operatedate";
// operateDateTimeFieldSql = ", (case WHEN t2.operatedate IS NULL THEN t2.receivedate ELSE t2.operatedate END) operatedate ";
// operateDateTimeFieldSqlOs = ", (case WHEN operatedate IS NULL THEN receivedate ELSE operatedate END) operatedate ";
// }
//
// if (tableOrderStr.toLowerCase().indexOf("operatetime") != -1) {
// operateDateTimeFieldSql0 += ",operatetime";
// operateDateTimeFieldSql += ", (case WHEN t2.operatetime IS NULL THEN t2.receivetime ELSE t2.operatetime END) operatetime ";
// operateDateTimeFieldSqlOs += ", (case WHEN operatetime IS NULL THEN receivetime ELSE operatetime END) operatetime ";
// }
// // 处理已办排序 end
// // 最外层查询字段
// String backfields0 = " sysid,appurl,requestid,requestmark,createdate, createtime,creater, creatertype, workflowid, requestname, requestnamenew, " +
// "status,requestlevel,currentnodeid,viewtype,userid,receivedate,receivetime,isremark,nodeid,agentorbyagentid,agenttype,isprocessed "
// + operateDateTimeFieldSql0 + ",systype,workflowtype";
// // 原始查询字段
// String backfields = " 0 as sysid,t1.requestid as appurl,t1.requestid,t1.requestmark,t1.createdate, t1.createtime,t1.creater, t1.creatertype, t1.workflowid, t1.requestname, t1.requestnamenew," +
// " t1.status,t1.requestlevel,t1.currentnodeid,t2.viewtype,t2.userid,t2.usertype,t2.receivedate,t2.receivetime,t2.isremark,t2.nodeid,t2.agentorbyagentid,t2.agenttype,t2.isprocessed "
// + operateDateTimeFieldSql + " ,'0' as systype,t2.workflowtype";
// // 异构系统查询字段
// String backfieldsOs = " sysid,requestid as appurl,requestid,'' as requestmark,createdate, createtime,creatorid as creater, 0 as creatertype, workflowid, requestname, requestname as requestnamenew, " +
// "'' as status,requestlevel,-1 as currentnodeid,viewtype,userid,0 as usertype,receivedate,receivetime,isremark,0 as nodeid, -1 as agentorbyagentid,'0' as agenttype,'0' as isprocessed "
// + operateDateTimeFieldSqlOs + ",'1' as systype, sysid as workflowtype";
// //反馈黄点提示字段
// backfields0 += ",viewDate,viewTime,lastFeedBackDate,lastFeedBackTime,needwfback,lastFeedBackOperator";
// backfields += ",t2.viewDate,t2.viewTime,t1.lastFeedBackDate,t1.lastFeedBackTime,t2.needwfback,t1.lastFeedBackOperator";
// backfieldsOs += ",'' as viewDate,'' as viewTime,'' as lastFeedBackDate,'' as lastFeedBackTime,'' as needwfback,0 as lastFeedBackOperator";
// //反馈黄点提示字段
// String fromSql = " from workflow_requestbase t1,workflow_currentoperator t2,workflow_base t3 ";
//
// String para2 = "column:requestid+column:workflowid+column:viewtype+0+" + user.getLanguage()
// + "+column:nodeid+column:isremark+" + user.getUID()
// + "+column:agentorbyagentid+column:agenttype+column:isprocessed+column:userid+0+column:creater+" + userIDAll;
// String para4 = user.getLanguage() + "+" + user.getUID() + "+column:userid";
//
// para2 = "S+column:viewDate+column:viewTime+column:lastFeedBackDate+column:lastFeedBackTime+column:needwfback+column:lastFeedBackOperator+column:userid+S+" + para2;
//
// //配置参数
// SplitTableBean tableBean = new SplitTableBean();
// tableBean.setPageID("");
// tableBean.setPageUID("");
// tableBean.setPagesize("");
//
// tableBean.setBackfields(backfields);
// tableBean.setSqlform(fromSql);
// tableBean.setSqlorderby(orderby);
//
//
// if (isopenos) {
// orderby = orderbyos;
// String orderyOsDone = "";
// // if ("done".equals(scope)) {
// // orderby = "";
// // orderby = " ORDER BY " +
// // "operatedate DESC," +
// // "operatetime DESC ";
// // //orderyOsDone="";
// // }
//
// para2 = "column:requestid+column:workflowid+column:viewtype+0+" + user.getLanguage()
// + "+column:nodeid+column:isremark+" + user.getUID()
// + "+column:agentorbyagentid+column:agenttype+column:isprocessed+" +
// "column:userid+0+column:creater+" + userIDAll + "+column:systype+column:workflowtype";
// para2 = "S+column:viewDate+column:viewTime+column:lastFeedBackDate+column:lastFeedBackTime+column:needwfback+column:lastFeedBackOperator+column:userid+S+" + para2;
// if(isDoing) {//需要特殊处理
// backfields0 = this.getOrderBy() + backfields0;
// if(!isFormWfCenter || isTransWfCenterOrder){
// orderby = myorderby;
// }
// if(orderby.contains("overtime")){ // 处理移动端流程中心优先显示 超时流程
// backfields0 = backfields0 + ",overtime ";
// backfields = backfields + ",case when ((t2.isremark='0' and (t2.isprocessed='0' or t2.isprocessed='3' or t2.isprocessed='2')) or t2.isremark='5') then '1' else '0' end as overtime ";
// backfieldsOs = backfieldsOs + ",'0' as overtime ";
// }
// fromSql = " from (select " + backfields0 + " from (select " + backfields + " " + fromSql + "" + sqlwhere
// + " union (select distinct " + backfieldsOs + " from ofs_todo_data " + sqlwhereos + ") " + " ) t1 ) t1 ";
// } else if("done".equals(scope)){//异构系统不显示已办可以直接不查已办表
// if(showdone){
// fromSql = " from (select " + backfields0 + " from (select " + backfields + " " + fromSql + "" + sqlwhere
// + " union (select distinct " + backfieldsOs + " from ofs_done_data " + sqlwhereosDone + ") " + " ) t1 ) t1 ";
// }else{
// fromSql = " from (select " + backfields0 + " from (select " + backfields + " " + fromSql + "" + sqlwhere + " ) t1 ) t1 ";
// }
// } else if("mine".equals(scope)){ // 我的请求 默认排序条件 创建日期 创建时间
// if(showdone){//异构系统不显示已办时我的请求sql和待办sql一致
// fromSql = " from (select " + backfields0 + " from (select " + backfields + " " + fromSql + "" + sqlwhere
// + " union (select distinct " + backfieldsOs + " from ofs_todo_data " + sqlwhereos + ") union (select distinct " + backfieldsOs + " from ofs_done_data" + sqlwhereosDone + ") ) t1 ) t1 ";
// }else{
// fromSql = " from (select " + backfields0 + " from (select " + backfields + " " + fromSql + "" + sqlwhere
// + " union (select distinct " + backfieldsOs + " from ofs_todo_data " + sqlwhereos + ") " + " ) t1 ) t1 ";
// }
// if(orderby==null || "".equals(orderby)){
// orderby = " receivedate,receivetime ";
// }
// } else{
// orderby = " receivedate,receivetime ";
// }
// //orderby = " receivedate,receivetime ";
//
// tableBean.setBackfields(backfields0);
// tableBean.setSqlwhere("");
// } else {
// if((orderby.toLowerCase().indexOf("operatedate") != -1 || orderby.toLowerCase().indexOf("operatetime") != -1) && (isTransWfCenterOrder || !isFormWfCenter)){
// //已办含case when情况排序特殊处理
// fromSql = " from (select " + backfields + " " + fromSql + "" + sqlwhere + ") t1 ";
// orderby = orderby.replace("t2.", "t1.");
// tableBean.setBackfields(backfields0);
// tableBean.setSqlwhere("");
// }else{
// if(isDoing) {//需要特殊处理
// backfields = this.getOrderBy() + backfields;
// if(!isFormWfCenter || isTransWfCenterOrder){ // 移动端流程中心 -待办 走应用配置的排序
// orderby = myorderby;
// }else if(orderby.contains("overtime")){ // 处理 overtime 条件
// backfields = backfields + ",case when ((t2.isremark='0' and (t2.isprocessed='0' or t2.isprocessed='3' or t2.isprocessed='2')) or t2.isremark='5') then '1' else '0' end as overtime ";
// }
// }
// orderby = OrderByListUtil.appendRequestIdOrderBy(orderby,"t1");
// tableBean.setBackfields(backfields);
// tableBean.setSqlwhere((sqlwhere));
// }
// }
// tableBean.setSqlform(isQueryByNewTable ? RequestListBiz.transNewTable(user,fromSql) : fromSql);
// orderby = OrderByListUtil.appendRequestIdOrderBy(orderby);
//
// String firstFloor = bean.getFirstFloor();//建模表类型对应的数据id,根据这个id来获取这类流程需要额外展示的字段列
// String orderrule = "";//0--升序 1--降序
// String sysorder = "";//排序系统字段 0-紧急程度 1-创建日期 2-接收日期 3-操作时间 4-流程编号
// String order_qc = "";
// String order_by = "";
// if (!"".equals(firstFloor)) {
// RecordSet.executeQuery("select orderrule,sysorder from uf_treelistsetting where id = ?", Util.getIntValue(firstFloor));
// if (RecordSet.next()){
// orderrule = RecordSet.getString("orderrule");
// if ("0".equals(orderrule)){
// order_by = "asc";
// }
// if ("1".equals(orderrule)){
// order_by = "desc";
// }
// sysorder = RecordSet.getString("sysorder");
// }
// }
// if (!"".equals(firstFloor) && !"".equals(sysorder)) {
// String[] orderArr = sysorder.split(",");
// for (String id : orderArr){
// if ("0".equals(id)){
// order_qc += ",requestlevel " + order_by ;
// }
// if ("1".equals(id)){
// order_qc += ",createdate " + order_by + ",createtime " + order_by ;
// }
// if ("2".equals(id)){
// order_qc += ",receivedate " + order_by + ",receivetime " + order_by ;
// }
// if ("3".equals(id)){
// order_qc += ",operatedate " + order_by + ",operatetime " + order_by ;
// }
// if ("4".equals(id)){
// order_qc += ",requestmark " + order_by ;
// }
// }
// orderby = order_qc;
// if (orderby.startsWith(",")){
// orderby = orderby.substring(1);
// }
//
// }
//
//
// tableBean.setSqlorderby(orderby);
// tableBean.setSqlprimarykey("requestid");
// tableBean.setSqlsortway("Desc");
// tableBean.setSqlisdistinct("false");
//
//
// List<SplitTableColBean> cols=new ArrayList<>();
// //top
// SplitTableColBean topCol=new SplitTableColBean();
// topCol.setColumn("requestname");
// topCol.setText(SystemEnv.getHtmlLabelName(1334, user.getLanguage()));
// topCol.setMobiletransmethod(requestnamereflectclass + ".getTitle4Mobile_AttentionTag");
// topCol.setMobileotherpara(para2);
// topCol.setMobileviewtype(MobileViewTypeAttr.HIGHLIGHT);
// topCol.setBelong(BelongAttr.PCMOBILE);
// cols.add(topCol);
//
// SplitTableColBean leftCol=new SplitTableColBean();
// leftCol.setColumn("createdate");
// leftCol .setText(SystemEnv.getHtmlLabelName(722, user.getLanguage()));
// //.setWidth("65%")
// leftCol.setMobiletransmethod("weaver.general.WorkFlowTransMethod.getWFSearchResultCreateTime");
// leftCol .setMobileotherpara("column:createtime");
// leftCol .setMobileviewtype(MobileViewTypeAttr.DETAIL);
// leftCol.setBelong(BelongAttr.PCMOBILE);
// //left
// cols.add(leftCol);
// //right
// SplitTableColBean rightCol=new SplitTableColBean();
// rightCol.setColumn("workflowid");
// rightCol.setText(SystemEnv.getHtmlLabelName(259, user.getLanguage()));
// rightCol.setMobiletransmethod(workflownamereflectmethod);
// if(isopenos){
// rightCol.setMobileotherpara("column:sysid"); // 20190906 wwp
// }
//
// //rightCol.setTransmethod(workflownamereflectmethod);
// rightCol.setBelong(BelongAttr.PCMOBILE);
// cols.add(rightCol);
//
//
// SplitTableColBean requestidCol=new SplitTableColBean();
// requestidCol.setColumn("requestid");
// //rightCol.setTransmethod(workflownamereflectmethod);
// requestidCol.setBelong(BelongAttr.PCMOBILE);
// cols.add(requestidCol);
//
// //zzw
// int menuid = Util.getIntValue(reqparams.get("menuid"),-1);
// MobileDimensionsBiz mdb = new MobileDimensionsBiz();
// if(!"mine".equals(mdb.getScope(menuid)) && !"mine".equals(scope)){
// SplitTableColBean createrCol = new SplitTableColBean();
// createrCol.setColumn("creater");
// createrCol.setMobileotherpara("column:creatertype");
// createrCol.setMobiletransmethod("com.engine.workflow.cmd.mobileCenter.GetListResultCmd.getWFSearchResultName");
// createrCol.setBelong(BelongAttr.PCMOBILE);
// cols.add(createrCol);
// }
//
// //appurl---start
// SplitTableColBean appurlCol = new SplitTableColBean();
// appurlCol.setColumn("appurl");
// appurlCol.setMobileotherpara("column:sysid+column:workflowid+column:userid+1");
// appurlCol.setMobiletransmethod("weaver.general.WorkFlowTransMethod.getAppUrl");
// appurlCol.setBelong(BelongAttr.PCMOBILE);
// cols.add(appurlCol);
// //appurl---end
//
// //钉钉、企业微信pc客户端以默认浏览器打开流程
// SplitTableColBean openByDefaultBrowserCol = new SplitTableColBean();
// openByDefaultBrowserCol.setColumn("requestid");
// openByDefaultBrowserCol.setKey("openByDefaultBrowser");
// openByDefaultBrowserCol.setMobiletransmethod(requestnamereflectclass+".getOpenByDefaultBrowserFlag");
// openByDefaultBrowserCol.setBelong(BelongAttr.MOBILE);
// cols.add(openByDefaultBrowserCol);
//
// //移动端打开异构系统流程,是否启动监听时间,当异构系统流程提交后自动刷新列表
// SplitTableColBean autoReloadWfListTimeCol = new SplitTableColBean();
// autoReloadWfListTimeCol.setColumn("requestid");
// autoReloadWfListTimeCol.setMobileotherpara("1");
// autoReloadWfListTimeCol.setKey("autoReloadWfListTime");
// autoReloadWfListTimeCol.setMobiletransmethod(RequestListBiz.class.getName()+".getAutoReloadWfListTime");
// autoReloadWfListTimeCol.setBelong(BelongAttr.MOBILE);
// cols.add(autoReloadWfListTimeCol);
//
// //userid
// SplitTableColBean useridCol = new SplitTableColBean();
// useridCol.setColumn("userid");
// // useridCol.setMobileotherpara("column:usertype");
// // useridCol.setMobiletransmethod(requestnamereflectclass+".getMobileUseridStr");
// useridCol.setBelong(BelongAttr.PCMOBILE);
// cols.add(useridCol);
//
// SplitTableColBean userType = new SplitTableColBean();
// userType.setColumn("usertype");
// // useridCol.setMobileotherpara("column:usertype");
// // useridCol.setMobiletransmethod(requestnamereflectclass+".getMobileUseridStr");
// userType.setBelong(BelongAttr.MOBILE);
// cols.add(userType);
// //userid
// SplitTableColBean primaryCol = new SplitTableColBean();
// primaryCol.setColumn("primarykey");
// //getprimaryKey
// primaryCol.setMobiletransmethod(requestnamereflectclass + ".getprimaryKey");
// primaryCol.setMobileotherpara("column:requestid+column:userid");
// primaryCol.setBelong(BelongAttr.PCMOBILE);
// primaryCol.setIsPrimarykey(BoolAttr.TRUE);
// primaryCol.setHide("true");
// cols.add(primaryCol);
//
//
// SplitTableColBean ciCol = new SplitTableColBean();
// ciCol.setColumn("primaryInfo");
// //getprimaryKey
// ciCol.setMobiletransmethod(requestnamereflectclass + ".getprimaryInfo");
// ciCol.setMobileotherpara("column:userid+" + userIDAll);
// ciCol.setBelong(BelongAttr.MOBILE);
// ciCol.setIsPrimarykey(BoolAttr.TRUE);
// ciCol.setHide("true");
// cols.add(ciCol);
//
//
//
// tableBean.setCols(cols);
// tableBean.setTableType("checkbox");
// List list1 = new ArrayList();
// if(!"mine".equals(mdb.getScope(menuid)) && !"mine".equals(scope)){
// list1 = JSON.parseArray(JSON_CONFIG2, SplitMobileDataBean.class);
// }else{
// list1 = JSON.parseArray(JSON_CONFIG2_MOBILE, SplitMobileDataBean.class);
// }
// tableBean.createMobileTemplate(list1);
//
//
// List<Checkboxpopedom> checkBoxList = new ArrayList<Checkboxpopedom>();
//
//
//
// //可提交
// if(isDoing ||(showBatchSubmit&&menuid>0)){
// Checkboxpopedom checkboxpopedom =new Checkboxpopedom();
// checkboxpopedom.setId("batchSubmit");
// String multSubmitParam = this.listInfoEntity.getListOperateInfoEntity().getMultSubmitParam();
// String multSubmitMethod = this.listInfoEntity.getListOperateInfoEntity().getMultSubmitMethod();
// checkboxpopedom.setShowmethod(multSubmitMethod);
// checkboxpopedom.setPopedompara(multSubmitParam);
//
// checkBoxList.add(checkboxpopedom);
// }
//
// //批量督办,批量关注
// if("done".equals(scope) || "mine".equals(scope) || isDoing){
// //批量督办
// Checkboxpopedom checkboxpopedom =new Checkboxpopedom();
// checkboxpopedom.setId("batchSupervise");
// String multSubmitParam = "column:requestid+column:userid+column:workflowid";
// String multSubmitMethod = "com.engine.workflow.cmd.requestList.GetListResultCmd.getBatchSupervisorCheckbox";
// checkboxpopedom.setShowmethod(multSubmitMethod);
// checkboxpopedom.setPopedompara(multSubmitParam);
// checkBoxList.add(checkboxpopedom);
//
// //批量关注
// Checkboxpopedom checkboxpopedom2 =new Checkboxpopedom();
// checkboxpopedom2.setId("batchAttention");
// String multSubmitParam2 = "column:requestid+column:userid+column:workflowid";
// String multSubmitMethod2 = "com.engine.workflow.cmd.requestList.GetListResultCmd.getBatchAttentionCheckbox";
// checkboxpopedom2.setShowmethod(multSubmitMethod2);
// checkboxpopedom2.setPopedompara(multSubmitParam2);
// checkBoxList.add(checkboxpopedom2);
// }
//
// //批量转发
// Checkboxpopedom checkboxpopedom3 =new Checkboxpopedom();
// checkboxpopedom3.setId("batchForward");
// String multSubmitParam = "column:requestid+column:userid+column:workflowid+"+usertype;
// String multSubmitMethod = "com.engine.workflow.cmd.requestList.GetListResultCmd.getBatchForwardCheckbox";
// checkboxpopedom3.setShowmethod(multSubmitMethod);
// checkboxpopedom3.setPopedompara(multSubmitParam);
// checkBoxList.add(checkboxpopedom3);
//
// tableBean.setCheckboxList(checkBoxList);
//
//
// //显示多列
// tableBean.setMobileshowtype(MobileShowTypeAttr.ListView);
// //String sessionkey = "workflow_"+scope+"_"+Util.getEncrypt(Util.getRandom());
// apidatas.putAll(SplitTableUtil.makeListDataResult(tableBean));
//
// //批量提交是否需要签字意见
// int multisubmitnotinputsign = 0;
// if(showBatchSubmit && isDoing){
// RecordSet.executeQuery("select multisubmitnotinputsign from workflow_RequestUserDefault where userId=?", userid);
// if(RecordSet.next())
// multisubmitnotinputsign = Util.getIntValue(Util.null2String(RecordSet.getString("multisubmitnotinputsign")), 0);
// }
// if(showBatchSubmit && isDoing && sysId != 5 && sysId != 8)
// apidatas.put("hasBatchSubmitBtn", "true");
// apidatas.put("multisubmitnotinputsign", multisubmitnotinputsign);
// RequestListBiz.removeRecord(user);//钉钉、企业微信以默认浏览器打开流程,刷新时清空客户端和浏览器交互数据
// //开启连续处理
// boolean isOpenContinuationProcess = "1".equals(requestDefaultComInfo.getIsOpenContinnuationProcess(userid+""));
// apidatas.put("isOpenContinuationProcess", "doing".equals(scope) && isOpenContinuationProcess);
// return apidatas;
// }
//
// /**
// * 使用case...when的方式进行设置orderby
// * @return
// */
// private String getOrderBy() {
// List<Map<String, Object>> list= GetCustomLevelUtil.getAllLevel(null, this.user.getLanguage());
//
// StringBuffer sb = new StringBuffer(" (case requestlevel ");
// StringBuffer sb1 = new StringBuffer("");
// for(Map<String, Object> map : list) {
// sb1.append(" when "+map.get("id") +" then "+map.get("showorder")) ;
// }
// if("".equals(sb1.toString().trim())) {//判断有无数据没有数据则不拼接
// return "";
// }
// sb.append(sb1);
// sb.append(" else -1 end ) as requestlevelorder, ");
// return sb.toString();
// }
//
// public HttpServletRequest getRequest() {
// return request;
// }
//
// public void setRequest(HttpServletRequest request) {
// this.request = request;
// }
//
// public ListInfoEntity getListInfoEntity() {
// return listInfoEntity;
// }
//
// public void setListInfoEntity(ListInfoEntity listInfoEntity) {
// this.listInfoEntity = listInfoEntity;
// }
//
// public String getWFSearchResultName(String id, String type) {
// String returnStr = "";
// if ("1".equals(type)) { //外部
// returnStr = cci.getCustomerInfoname(id) + " ";
//
// } else { //内部
// returnStr = rc.getResourcename(id) + " ";
// }
// return returnStr;
// }
//
//
// public GetListResultCmdBak() {
// try {
// this.cci = new CustomerInfoComInfo();
// this.rc = new ResourceComInfo();
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
//
// //列表是否满足走微搜条件判断
// private boolean supportQuickSerach(boolean isopenos){
// int viewcondition = Util.getIntValue(Util.null2String(request.getParameter("viewcondition")), 0);
// List<Integer> supportViewconList = Arrays.asList(41,46,51);
// if(!isopenos && "".equals(Util.null2String(request.getParameter("resourceid"))) && "".equals(Util.null2String(request.getParameter("tabkeys"))) && supportViewconList.contains(viewcondition)){//满足微搜条件调用微搜
// RecordSet rs = new RecordSet();
// rs.executeQuery("select * from HrmUserSetting where resourceId=?", user.getUID());//主次账号统一显示不走微搜因为微搜暂时无法传给transmethod对应的userid
// String belongtoshow = "";
// if(rs.next()){
// belongtoshow = Util.null2String(rs.getString("belongtoshow"));
// }
// String Belongtoids = user.getBelongtoids();
// String scope = Util.null2String(request.getParameter("viewScope"));
// String recievedateselect = Util.null2String(request.getParameter("recievedateselect"));
// String operatedateselect = Util.null2String(request.getParameter("operatedateselect"));
// String hrmcreaterid = Util.null2String(request.getParameter("hrmcreaterid"));
// if((!"1".equals(belongtoshow) || ("1".equals(belongtoshow) && "".equals(Belongtoids))) && "mine".equals(scope) && ("".equals(recievedateselect) || "0".equals(recievedateselect))
// && ("".equals(operatedateselect) || "0".equals(operatedateselect)) && "".equals(hrmcreaterid)){//暂时只放出我的请求,相当于支持我的请求高级搜索的标题,路径,归档状态和流程状态默认值
// return (SearchBrowserUtils.quickSearchValidate("WFSEARCH",user.getLanguage() + "") && SearchBrowserUtils.isSupportWfRemarkStatus());
// }
// }
// return false;
// }
//
// final String JSON_CONFIG = "[" +
// " {" +
// " \"configs\": [" +
// " {" +
// " \"configs\": [" +
// " {" +
// " \"key\": \"requestname\"" +
// " }" +
// " ]," +
// " \"key\": \"col1_row1\"" +
// " }," +
// " {" +
// " \"configs\": [" +
// " {" +
// " \"key\": \"createdate\"" +
// " }," +
// " {" +
// " \"style\": {" +
// " \"float\": \"right\"" +
// " }," +
// " \"key\": \"workflowid,\"" +
// " \"class\": \"workflowid\"" +
// " }" +
// " ]," +
// " \"key\": \"col1_row2\"" +
// " }" +
// " ]," +
// " \"key\": \"col1\"" +
// " }" +
// "]";
//
// String JSON_CONFIG3 = "[\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"key\": \"requestname\",\n" +
// " \"style\": {\n" +
// " \"fontWeight\": \"inherit\",\"color\": \"#000\",\"width\": \"96%\"" +
// " }\n" +
// " },{\"key\":\"primaryInfo\"}\n" +
// " ],\n" +
// " \"key\": \"col1_row1\"\n" +
// " },\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"key\": \"creater\",\n" +
// " \"style\": {\n" +
// " \"marginRight\": \"5px\"\n" +
// " },\n" +
// // " \"className\": \"workflowid\"" +
// " },\n" +
// " {\n" +
// " \"key\": \"createdate\",\n" +
// // " \"className\": \"wf-center-list-createdate\"" +
// " },\n" +
// " {\n" +
// // " \"style\": {\n" +
// // " \"float\": \"right\"\n" +
// // " },\n" +
// " \"key\": \"workflowid\",\n" +
// // " \"className\": \"wf-center-list-workflowid\"" +
// " }\n" +
// " ],\n" +
// " \"key\": \"col1_row2\"\n" +
// " }\n" +
// " ],\n" +
// " \"key\": \"col1\"\n" +
// " }\n" +
// "]";
//
// public static final String JSON_CONFIG2 = "[\n" +
//
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"key\": \"requestname\",\n" +
// " \"style\": {\n" +
// " \"fontWeight\": \"inherit\",\"color\": \"#000\",\"width\": \"96%\"" +
// " }\n" +
// " },{\"key\":\"primaryInfo\"}\n" +
// " ],\n" +
// " \"key\": \"col1_row1\"\n" +
// " },\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"key\": \"workflowid\",\n" +
// " \"style\": {\n" +
// " \"textOverflow\": \"ellipsis\",\n" +
// " \"overflow\": \"hidden\",\n" +
// " \"whiteSpace\": \"nowrap\",\n" +
// " \"width\": \"90%\",\n" +
// " },\n" +
// " },\n" +
// " ],\n" +
// " \"key\": \"col1_row2\"\n" +
// " },\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"key\": \"creater\",\n" +
// " \"style\": {\n" +
// " \"marginRight\": \"5px\"\n" +
// " },\n" +
// " },\n" +
// " {\n" +
// " \"key\": \"createdate\",\n" +
// " \"style\": {\n" +
// " \"marginRight\": \"5px\"\n" +
// " },\n" +
// " },\n" +
// " ],\n" +
// " \"key\": \"col1_row3\"\n" +
// " },\n" +
// " ],\n" +
// " \"key\": \"col1\"\n" +
// " }\n" +
// "]";
//
// public static final String JSON_CONFIG2_MOBILE = "[\n" +
//
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"key\": \"requestname\",\n" +
// " \"style\": {\n" +
// " \"fontWeight\": \"inherit\",\"color\": \"#000\",\"width\": \"96%\"" +
// " }\n" +
// " },{\"key\":\"primaryInfo\"}\n" +
// " ],\n" +
// " \"key\": \"col1_row1\"\n" +
// " },\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"key\": \"workflowid\",\n" +
// " \"style\": {\n" +
// " \"textOverflow\": \"ellipsis\",\n" +
// " \"overflow\": \"hidden\",\n" +
// " \"whiteSpace\": \"nowrap\",\n" +
// " \"width\": \"90%\",\n" +
// " },\n" +
// " },\n" +
// " ],\n" +
// " \"key\": \"col1_row2\"\n" +
// " },\n" +
// " {\n" +
// " \"configs\": [\n" +
// " {\n" +
// " \"key\":\"createdate\",\n" +
// " \"style\": {\n" +
// " \"marginRight\": \"5px\"\n" +
// " },\n" +
// " },\n" +
// " ],\n" +
// " \"key\": \"col1_row3\"\n" +
// " },\n" +
// " ],\n" +
// " \"key\": \"col1\"\n" +
// " }\n" +
// "]";
// }

@ -0,0 +1,52 @@
<%@ page import="weaver.integration.entrance.bean.OutterLoginBean" %>
<%@ page import="weaver.integration.entrance.service.EntranceService" %>
<%@ page import="weaver.integration.entrance.service.IEntranceService" %>
<%@ page import="weaver.integration.entrance.service.IOutterSysServer" %>
<%@ page import="weaver.integration.entrance.service.impl.NcServer" %>
<%@ page import="weaver.integration.entrance.service.permission.IPermissionService" %>
<%@ page import="weaver.integration.entrance.service.permission.PermissionService" %>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%--<%@ include file="/systeminfo/init_wev8.jsp" %>--%>
<%@ page import="weaver.integration.logging.LoggerFactory" %>
<%@ page import="weaver.integration.logging.Logger" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.Objects" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="weaver.interfaces.encode.AES_IV" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%@ page import="com.icbc.api.internal.apache.http.impl.cookie.S" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="RecordSet1" class="weaver.conn.RecordSet" scope="page" />
<%
Logger integration_logger = LoggerFactory.getLogger();
BaseBean bb = new BaseBean();
String mhurl = "";
String encodeResultStr = "";
try {
User user = HrmUserVarify.getUser(request,response);
String loginid = user.getLoginid();
Map<String, Object> paramMap = ParamUtil.request2Map(request);
mhurl = (String) paramMap.get("mhurl");
// out.println(mhurl);
AES_IV aesIV = new AES_IV();
// AES的密钥长度最好是16位(不是必须)
String password = "ecology_nsh_2021";
// AES的向量长度必须为16位
String iv = "weaver_nsyh_2021";
aesIV.setPwd(password);
aesIV.setIv(iv);
// 加密
encodeResultStr = aesIV.encode(loginid);
// out.println(mhurl);
response.sendRedirect(mhurl+"?loginid="+encodeResultStr);
}catch (Exception E){
bb.writeLog("mhxxerror====>"+E.getMessage());
response.sendRedirect(mhurl);
}
%>

File diff suppressed because one or more lines are too long

@ -0,0 +1,653 @@
<%--
Created by IntelliJ IDEA.
User: xvshanshan
Date: 2023/7/3
Time: 9:23
To change this template use File | Settings | File Templates.
--%>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page import="java.util.regex.Pattern" %>
<%@ page import="java.util.regex.Matcher" %>
<%@ page import="java.io.*" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ page import="org.apache.http.impl.client.CloseableHttpClient" %>
<%@ page import="org.apache.http.impl.client.HttpClients" %>
<%@ page import="org.apache.http.client.methods.HttpPost" %>
<%@ page import="com.alibaba.fastjson.JSON" %>
<%@ page import="org.apache.http.entity.StringEntity" %>
<%@ page import="org.apache.http.client.methods.CloseableHttpResponse" %>
<%@ page import="org.apache.http.HttpStatus" %>
<%@ page import="org.apache.http.HttpEntity" %>
<%@ page import="org.apache.http.util.EntityUtils" %>
<%@ page import="org.apache.http.client.ClientProtocolException" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="java.net.URL" %>
<%@ page import="java.net.HttpURLConnection" %>
<%@ page import="org.apache.http.HttpException" %>
<%@ page import="org.apache.http.client.HttpClient" %>
<%@ page import="org.apache.commons.httpclient.methods.PostMethod" %>
<%@ page import="org.apache.commons.httpclient.params.HttpMethodParams" %>
<%@ page import="org.apache.http.NameValuePair" %>
<%@ page import="org.apache.http.message.BasicNameValuePair" %>
<%@ page import="org.apache.http.client.entity.UrlEncodedFormEntity" %>
<%@ page import="weaver.rsa.security.RSA" %>
<%@ page import="java.security.interfaces.RSAPublicKey" %>
<%@ page import="java.security.KeyFactory" %>
<%@ page import="java.security.spec.X509EncodedKeySpec" %>
<%@ page import="javax.crypto.Cipher" %>
<%@ page import="org.apache.commons.codec.binary.Base64" %>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ page import="org.apache.http.impl.client.HttpClientBuilder" %>
<%@ page import="org.apache.http.client.methods.HttpGet" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%!
//获取分页sql
public static String getPaginationSql(String sql, String orderby, int pageNo, int pageSize) {
String execSql = "";
RecordSet rs = new RecordSet();
String dbType = rs.getDBType();
// String dbType = "oracle";
// String dbType = "sqlserver";
int firstResult = 0;
int endResult = 0;
// 返回分页sql
if("oracle".equals(dbType)){ // rownum
firstResult = pageNo * pageSize + 1;
endResult = (pageNo - 1) * pageSize;
execSql = " select * from ( select tabUN2.*,rownum as my_rownum from ( select tableUN.*,rownum as r from ( " + sql
+ orderby + ") tableUN " + ") tabUN2 where r < " + firstResult + " ) where my_rownum > " + endResult;
}else if("sqlserver".equals(dbType)){
sql="select *,row_number()OVER("+orderby+") as rn from ("+sql+") newt";
execSql = "select * from ( " +
sql+")fy " +
" where rn between ("+pageNo+"-1)*"+pageSize+"+1 and "+pageNo+"*"+pageSize+" ";
}else { // 使用 ROW_NUMBER OVER()分页
firstResult = pageNo * pageSize + 1;
endResult = (pageNo - 1) * pageSize;
execSql = " select * from ( select tabUN2.*,rownum as my_rownum from ( select tableUN.*,rownum as r from ( " + sql
+ orderby +") tableUN ) tabUN2 where r < " + firstResult + " ) where my_rownum > " + endResult;
}
rs.writeLog("execSql---->"+execSql);
return execSql;
}
private boolean isEmpty(String str) {
if ("".equals(str) ||"(null)".equals(str) || str == null) {
return true;
} else {
return false;
}
}
/**
* 获取指定类型的src值的集合
* @param htmlStr
* @param type 标签名称
* @return
* 简历
*/
public static Set<String> getSrcStr(String htmlStr, String type) {
Set<String> srcs = new HashSet<String>();
String src = "";
Pattern p_src;
Matcher m_src;
// String regEx_img = "<img.*src=(.*?)[^>]*?>"; //图片链接地址
String regEx_src = "<"+type+".*src\\s*=\\s*(.*?)[^>]*?>";
p_src = Pattern.compile
(regEx_src, Pattern.CASE_INSENSITIVE);
m_src = p_src.matcher(htmlStr);
while (m_src.find()) {
// 得到<img />数据
src = m_src.group();
// 匹配<img>中的src数据
Matcher m = Pattern.compile("src\\s*=\\s*\"?(.*?)(\"|>|\\s+)").matcher(src);
while (m.find()) {
srcs.add(m.group(1));
}
}
return srcs;
}
public User getUser(int uid){
User user = new User();
RecordSet rs = new RecordSet();
if (uid == 1)
rs.executeQuery("select * from hrmresourcemanager where id=?", uid);
else {
rs.executeQuery("select * from hrmresource where id=?", uid);
}
String userid = "";
if (rs.next()) {
userid = rs.getString("id");
user.setUid(rs.getInt("id"));
user.setLogintype("1");
user.setLoginid(rs.getString("loginid"));
user.setFirstname(rs.getString("firstname"));
user.setLastname(rs.getString("lastname"));
user.setAliasname(rs.getString("aliasname"));
user.setTitle(rs.getString("title"));
user.setTitlelocation(rs.getString("titlelocation"));
user.setSex(rs.getString("sex"));
String langid = rs.getString("systemlanguage");
user.setLanguage(Util.getIntValue(langid, 0));
user.setTelephone(rs.getString("telephone"));
user.setMobile(rs.getString("mobile"));
user.setMobilecall(rs.getString("mobilecall"));
user.setEmail(rs.getString("email"));
user.setCountryid(rs.getString("countryid"));
user.setLocationid(rs.getString("locationid"));
user.setResourcetype(rs.getString("resourcetype"));
user.setStartdate(rs.getString("startdate"));
user.setEnddate(rs.getString("enddate"));
user.setContractdate(rs.getString("contractdate"));
user.setJobtitle(rs.getString("jobtitle"));
user.setJobgroup(rs.getString("jobgroup"));
user.setJobactivity(rs.getString("jobactivity"));
user.setJoblevel(rs.getString("joblevel"));
user.setSeclevel(rs.getString("seclevel"));
user.setUserDepartment(Util.getIntValue(rs.getString("departmentid"),0));
user.setUserSubCompany1(Util.getIntValue(rs.getString("subcompanyid1"),0));
user.setUserSubCompany2(Util.getIntValue(rs.getString("subcompanyid2"),0));
user.setUserSubCompany3(Util.getIntValue(rs.getString("subcompanyid3"),0));
user.setUserSubCompany4(Util.getIntValue(rs.getString("subcompanyid4"),0));
user.setManagerid(rs.getString("managerid"));
user.setAssistantid(rs.getString("assistantid"));
user.setPurchaselimit(rs.getString("purchaselimit"));
user.setCurrencyid(rs.getString("currencyid"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String lastLoginDate = sdf.format(new Date());
user.setLastlogindate(lastLoginDate);
user.setLogintype("1");
user.setAccount(rs.getString("account"));
}
return user;
}
public String httpPostRequest(String param,String url,String token){
BaseBean baseBean = new BaseBean();
JSONObject jsonObject = new JSONObject();
String responseBody="";
try {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(url);
JSONObject jsonString = JSON.parseObject(param);
//设置请求体参数
StringEntity entity = new StringEntity(param,"utf-8");
baseBean.writeLog("entity-param->"+param);
baseBean.writeLog("entity-->"+entity);
entity.setContentEncoding("utf-8");
baseBean.writeLog("entity-utf-8->"+entity);
httpPost.setEntity(entity);
//设置请求头部
httpPost.setHeader("Content-Type", "application/json");
if(token != null && !"".equals(token)){
httpPost.setHeader("Authorization",token);
}
//执行请求,返回请求响应
CloseableHttpResponse response = httpClient.execute(httpPost);
//请求返回状态码
int statusCode = response.getStatusLine().getStatusCode();
baseBean.writeLog("statusCode状态码->"+statusCode);
//请求成功
if (statusCode == HttpStatus.SC_OK && statusCode <= HttpStatus.SC_TEMPORARY_REDIRECT) {
//取出响应体
HttpEntity entity2 = response.getEntity();
//从响应体中解析出token
responseBody = EntityUtils.toString(entity2, "utf-8");
// jsonObject = JSONObject.parseObject(responseBody);
baseBean.writeLog("responseBody->"+responseBody);
// baseBean.writeLog("jsonObject->"+jsonObject);
//token = jsonObject.getString("access_token");
} else {
//请求失败
throw new ClientProtocolException("请求失败,响应码为:" + statusCode);
}
} catch (Exception e) {
e.printStackTrace();
}
return responseBody;
}
/**
* 发送http get请求
*/
public static String httpGet(String url,Map<String,String> headers,String encode){
BaseBean bb = new BaseBean();
if(encode == null){
encode = "utf-8";
}
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
String content = null;
//since 4.3 不再使用 DefaultHttpClient
try {
closeableHttpClient = HttpClientBuilder.create().build();
HttpGet httpGet = new HttpGet(url);
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpGet.setHeader(entry.getKey(),entry.getValue());
}
}
bb.writeLog("url="+url+"header="+headers+"encode="+encode);
httpResponse = closeableHttpClient.execute(httpGet);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
/**
* 向指定 URL 发送POST方法的请求
*
* @param url 发送请求的 URL
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @return 所代表远程资源的响应结果
*/
public static String sendPost(String url, String param) {
BaseBean bb = new BaseBean();
String result = "";
PrintWriter out = null;
BufferedReader in = null;
HttpURLConnection connection = null;
try {
URL postUrl = new URL(url);
bb.writeLog("getUrl-->"+postUrl);
// 打开和URL之间的连接
connection = (HttpURLConnection) postUrl.openConnection();
// 在connect之前设置通用的请求属性
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.setRequestProperty("Charsert", "UTF-8");
connection.setConnectTimeout(15000);
connection.setReadTimeout(60000);
// 发送POST请求必须设置如下两行参数要放在http正文内
connection.setDoOutput(true);
connection.setDoInput(true);
// 默认是 GET方式
connection.setRequestMethod("POST");
// Post 请求不使用缓存
connection.setUseCaches(false);
// 配置本次连接的Content-typeform表单是"application/x-www-form-urlencoded"json是"application/json"等
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.connect();
// 参数要放在http正文内
//1.获取URLConnection对象对应的输出流
out = new PrintWriter(connection.getOutputStream());
//2.中文有乱码的需要将PrintWriter改为如下
//out=new OutputStreamWriter(conn.getOutputStream(),"UTF-8")
out.print(param);
out.flush();
//也可以使用DataOutputStream
// DataOutputStream dos=new DataOutputStream(httpConn.getOutputStream());
// dos.writeBytes(param);
// dos.flush();
// dos.close();
// 定义BufferedReader输入流来读取URL的响应
if (connection.getResponseCode() == 200) {
in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
}
} catch (Exception e) {
bb.writeLog("发送 POST 请求出现异常!" + e);
e.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
if (connection != null) {
//关闭连接
connection.disconnect();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return result;
}
/**
* 发送 http post 请求参数以form表单键值对的形式提交。
*/
public static String httpPostForm(String url,Map<String,String> params, Map<String,String> headers,String encode){
BaseBean bb = new BaseBean();
if(encode == null){
encode = "utf-8";
}
String content = null;
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
try {
closeableHttpClient = HttpClients.createDefault();
HttpPost httpost = new HttpPost(url);
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpost.setHeader(entry.getKey(),entry.getValue());
}
}
bb.writeLog("url="+url+"header="+headers+"encode="+encode);
bb.writeLog("params="+params);
//组织请求参数
List<NameValuePair> paramList = new ArrayList <NameValuePair>();
if(params != null && params.size() > 0){
Set<String> keySet = params.keySet();
for(String key : keySet) {
paramList.add(new BasicNameValuePair(key, params.get(key)));
}
}
httpost.setEntity(new UrlEncodedFormEntity(paramList, encode));
httpResponse = closeableHttpClient.execute(httpost);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
/**
* 公钥加密
*
* @param content 内容
* @param publicKey 公钥
* @return 加密后的密文
* @throws Exception 异常信息
*/
public static String encrypt(String content, String publicKey) throws Exception {
//base64编码的公钥
byte[] decoded = org.apache.commons.codec.binary.Base64.decodeBase64(publicKey);
RSAPublicKey pubKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded));
//RSA加密
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, pubKey);
return Base64.encodeBase64String(cipher.doFinal(content.getBytes(StandardCharsets.UTF_8)));
}
public static String getPublicKey(){
BaseBean bb = new BaseBean();
String publicKey ="";
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));
//请求获取publicKey接口
Map<String,String> headers = new HashMap<>();
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","publicKeyUrl"));
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID","123");
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
String msg = httpGet(url,headers,null);
bb.writeLog("===获取publickey返回值===="+msg);
try {
org.json.JSONObject resMsg = new org.json.JSONObject(msg);
bb.writeLog("===获取publickey返回值===="+resMsg);
if(resMsg.has("pubKey")){
publicKey = Util.null2String(resMsg.get("pubKey").toString());
}
}catch (Exception e){
e.getMessage();
}
return publicKey;
}
//获取TG
public static String getST(String tgt,String emobileUrl){
BaseBean bb = new BaseBean();
String ST = "";
String retMsg = "";
Map<String,String> params = new HashMap<>();//参数
Map<String,String> headers = new HashMap<>();//headers
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));
//请求获取TG接口
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","stUrl"));
bb.writeLog("==获取TG=="+url);
//移动端首页地址
bb.writeLog("==移动端首页地址=="+emobileUrl);
//获取TGT
params = new HashMap<>();//参数
params.put("tgt",tgt);
params.put("service",emobileUrl);
bb.writeLog("==STparams=="+params);
headers = new HashMap<>();//headers
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID","123");
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
try {
retMsg = httpPostForm(url,params,headers,null);
bb.writeLog("===获取ST返回值===="+retMsg);
org.json.JSONObject resMsg = new org.json.JSONObject(retMsg);
bb.writeLog("===获取ST返回值resMsg===="+resMsg);
if(resMsg.has("ST")){
ST = Util.null2String(resMsg.get("ST").toString());
}
bb.writeLog("===获取ST===="+ST);
}catch(Exception e){
throw new RuntimeException(e);
}
return retMsg;
}
%>
<%
RecordSet rs = new RecordSet();
BaseBean bb=new BaseBean();
RSA rsa = new RSA();
Map<String,String> params = new HashMap<>();//参数
Map<String,String> headers = new HashMap<>();//headers
JSONArray array = new JSONArray();
List<String> decriptList = new ArrayList<>();
String ST ="";//获取ST
bb.writeLog("进入获取简历jsp-->");
String login_id = "";
String user_password = "";
User user = HrmUserVarify.getUser(request, response);
int uid = user.getUID();
bb.writeLog("uid-->"+uid);
rs.executeQuery("select id,loginid,password,createtime from EmobileLoginDetail where id=?", uid);
if(rs.next()){
login_id = Util.null2String(rs.getString("loginid"));
user_password = Util.null2String(rs.getString("password"));
}
bb.writeLog("login_id-->"+login_id);
bb.writeLog("user_password-->"+user_password);
//获取session
session = request.getSession(true);
String certified_token = Util.null2String(session.getAttribute("certified_token"));
bb.writeLog("获取sessionTGT=="+certified_token);
//获取cookie
Cookie[] cookies = request.getCookies();
bb.writeLog("获取cookies=="+cookies);
String idd = "";
if(cookies != null){
for(Cookie cookie:cookies){
bb.writeLog("获取cookiesName=="+cookie.getName());
if(cookie.getName().equals("loginidweaver")){
idd = cookie.getValue();
bb.writeLog("获取idd=="+idd);
}
}
}
//查询人员工号
RecordSet recordSet = new RecordSet();
String requestURI = request.getRequestURI();
bb.writeLog("请求路径="+requestURI);
Map<String, Object> useridMap = ParamUtil.request2Map(request);
bb.writeLog("人员id="+useridMap.get("userid"));
recordSet.executeQuery("select WORKCODE from HRMRESOURCE where id=?", Util.null2String(useridMap.get("userid")));
String workcode = "";
if (recordSet.next()){
workcode = Util.null2String(recordSet.getString("WORKCODE"));
}
bb.writeLog("人员workcode="+useridMap.get("workcode"));
//查询
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));//publicKey
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","stUrl"));//获取ST的url
String cockpitUrl = Util.null2String(bb.getPropValue("tjbankEMobileSSO","cockpitUrl"));
String tgturl = Util.null2String(bb.getPropValue("tjbankEMobileSSO","tgtUrl"));//请求获取TGT地址
//获取ST带着下游系统
if (!isEmpty(certified_token)){
String responseInfo = getST(certified_token,cockpitUrl);
bb.writeLog("进入responseInfo-->"+responseInfo);
if (isEmpty(responseInfo)){
out.print("单点系统接口返回值为null");
return;
}else {
org.json.JSONObject stMsg = new org.json.JSONObject(responseInfo);
if(stMsg.has("ST")){
ST = Util.null2String(stMsg.get("ST").toString());
}else{
out.print(Util.null2String(stMsg.getString("message")));
return;
}
String loginUrl = "";
String remuseUrl = bb.getPropValue("tjbkremuse", "hbUrl");
boolean isEm = Util.null2String(request.getHeader("user-agent")).indexOf("E-Mobile") > -1;
if(isEm == true){
loginUrl=remuseUrl+"&ticket="+ST;
}
//loginUrl = "https://www.baidu.com/";
bb.writeLog("loginUrl-->"+loginUrl);
out.print("跳转路径-->"+loginUrl);
out.print("进入驾驶舱成功");
response.sendRedirect(loginUrl);
// request.getRequestDispatcher("loginUrl").forward(request,response);
// return;
}
}else {
String TGT ="";
String passWord ="";
String retMsg ="";
decriptList.add(login_id);
decriptList.add(user_password);
List<String> resultList = rsa.decryptList(request, decriptList);
String loginId = resultList.get(0);
String userPassword = resultList.get(1);
String publicKey = getPublicKey();
passWord = encrypt(user_password, publicKey);
params = new HashMap<>();//参数
params.put("username",loginId);
params.put("password",passWord);
bb.writeLog("==STparams=="+params);
headers = new HashMap<>();//headers
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID","123");
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
retMsg = httpPostForm(tgturl,params,headers,null);
bb.writeLog("===获取TGT返回值retMsg===="+retMsg);
org.json.JSONObject resMsg = new org.json.JSONObject(retMsg);
bb.writeLog("===获取TGT返回值===="+resMsg);
if(resMsg.has("TGT")){
TGT = Util.null2String(resMsg.get("TGT").toString());
}
String responseInfo = getST(TGT,cockpitUrl);
if (isEmpty(responseInfo)){
out.print("单点系统接口返回值为null");
return;
}else {
org.json.JSONObject stMsg = new org.json.JSONObject(responseInfo);
if(stMsg.has("ST")){
ST = Util.null2String(stMsg.get("ST").toString());
}else{
out.print(Util.null2String(stMsg.getString("message")));
return;
}
String loginUrl = "";
String remuseUrl = bb.getPropValue("tjbkremuse", "hbUrl");
boolean isEm = Util.null2String(request.getHeader("user-agent")).indexOf("E-Mobile") > -1;
if(isEm == true){
loginUrl=remuseUrl+"&ticket="+ST;
//loginUrl="http://123.151.115.199:8080/bi/PCFW?proc=1&action=viewer&hback=true&db=%E6%99%BA%E6%85%A7%E6%96%B9%E7%95%A5/%E5%89%8D%E7%BD%AE%E9%A1%B5.db&ticket="+ST;
}
bb.writeLog("loginUrl-->"+loginUrl);
out.print("跳转路径-->"+loginUrl);
out.print("进入驾驶舱成功");
response.sendRedirect(loginUrl);
// request.getRequestDispatcher("loginUrl").forward(request,response);
}
// out.print("进入驾驶舱系统失败,请先获取标识");
//return;
}
%>
 <script type="text/javascript">
<%--<%=httpPostRequest%>;--%>
// alert("00000");
// next();
//   function next(){
// alert("2222");
// console.log("111111111");
<%--console.log("http://10.16.103.18:9900/coremail/main.jsp?sid="+<%=sid%>);--%>
<%--console.log("sid="+<%=sid%>);--%>
<%--window.location.href= "http://10.16.103.18:9900/coremail/main.jsp?sid="+<%=sid%>;--%>
//   window.location.href= "https://www.baidu.com/";
<%--   }--%>
 </script>

@ -0,0 +1,651 @@
<%--
Created by IntelliJ IDEA.
User: xvshanshan
Date: 2023/7/3
Time: 9:23
To change this template use File | Settings | File Templates.
--%>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page import="java.util.regex.Pattern" %>
<%@ page import="java.util.regex.Matcher" %>
<%@ page import="java.io.*" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ page import="org.apache.http.impl.client.CloseableHttpClient" %>
<%@ page import="org.apache.http.impl.client.HttpClients" %>
<%@ page import="org.apache.http.client.methods.HttpPost" %>
<%@ page import="com.alibaba.fastjson.JSON" %>
<%@ page import="org.apache.http.entity.StringEntity" %>
<%@ page import="org.apache.http.client.methods.CloseableHttpResponse" %>
<%@ page import="org.apache.http.HttpStatus" %>
<%@ page import="org.apache.http.HttpEntity" %>
<%@ page import="org.apache.http.util.EntityUtils" %>
<%@ page import="org.apache.http.client.ClientProtocolException" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="java.net.URL" %>
<%@ page import="java.net.HttpURLConnection" %>
<%@ page import="org.apache.http.HttpException" %>
<%@ page import="org.apache.http.client.HttpClient" %>
<%@ page import="org.apache.commons.httpclient.methods.PostMethod" %>
<%@ page import="org.apache.commons.httpclient.params.HttpMethodParams" %>
<%@ page import="org.apache.http.NameValuePair" %>
<%@ page import="org.apache.http.message.BasicNameValuePair" %>
<%@ page import="org.apache.http.client.entity.UrlEncodedFormEntity" %>
<%@ page import="weaver.rsa.security.RSA" %>
<%@ page import="java.security.interfaces.RSAPublicKey" %>
<%@ page import="java.security.KeyFactory" %>
<%@ page import="java.security.spec.X509EncodedKeySpec" %>
<%@ page import="javax.crypto.Cipher" %>
<%@ page import="org.apache.commons.codec.binary.Base64" %>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ page import="org.apache.http.impl.client.HttpClientBuilder" %>
<%@ page import="org.apache.http.client.methods.HttpGet" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%!
//获取分页sql
public static String getPaginationSql(String sql, String orderby, int pageNo, int pageSize) {
String execSql = "";
RecordSet rs = new RecordSet();
String dbType = rs.getDBType();
// String dbType = "oracle";
// String dbType = "sqlserver";
int firstResult = 0;
int endResult = 0;
// 返回分页sql
if("oracle".equals(dbType)){ // rownum
firstResult = pageNo * pageSize + 1;
endResult = (pageNo - 1) * pageSize;
execSql = " select * from ( select tabUN2.*,rownum as my_rownum from ( select tableUN.*,rownum as r from ( " + sql
+ orderby + ") tableUN " + ") tabUN2 where r < " + firstResult + " ) where my_rownum > " + endResult;
}else if("sqlserver".equals(dbType)){
sql="select *,row_number()OVER("+orderby+") as rn from ("+sql+") newt";
execSql = "select * from ( " +
sql+")fy " +
" where rn between ("+pageNo+"-1)*"+pageSize+"+1 and "+pageNo+"*"+pageSize+" ";
}else { // 使用 ROW_NUMBER OVER()分页
firstResult = pageNo * pageSize + 1;
endResult = (pageNo - 1) * pageSize;
execSql = " select * from ( select tabUN2.*,rownum as my_rownum from ( select tableUN.*,rownum as r from ( " + sql
+ orderby +") tableUN ) tabUN2 where r < " + firstResult + " ) where my_rownum > " + endResult;
}
rs.writeLog("execSql---->"+execSql);
return execSql;
}
private boolean isEmpty(String str) {
if ("".equals(str) ||"(null)".equals(str) || str == null) {
return true;
} else {
return false;
}
}
/**
* 获取指定类型的src值的集合
* @param htmlStr
* @param type 标签名称
* @return
* 简历
*/
public static Set<String> getSrcStr(String htmlStr, String type) {
Set<String> srcs = new HashSet<String>();
String src = "";
Pattern p_src;
Matcher m_src;
// String regEx_img = "<img.*src=(.*?)[^>]*?>"; //图片链接地址
String regEx_src = "<"+type+".*src\\s*=\\s*(.*?)[^>]*?>";
p_src = Pattern.compile
(regEx_src, Pattern.CASE_INSENSITIVE);
m_src = p_src.matcher(htmlStr);
while (m_src.find()) {
// 得到<img />数据
src = m_src.group();
// 匹配<img>中的src数据
Matcher m = Pattern.compile("src\\s*=\\s*\"?(.*?)(\"|>|\\s+)").matcher(src);
while (m.find()) {
srcs.add(m.group(1));
}
}
return srcs;
}
public User getUser(int uid){
User user = new User();
RecordSet rs = new RecordSet();
if (uid == 1)
rs.executeQuery("select * from hrmresourcemanager where id=?", uid);
else {
rs.executeQuery("select * from hrmresource where id=?", uid);
}
String userid = "";
if (rs.next()) {
userid = rs.getString("id");
user.setUid(rs.getInt("id"));
user.setLogintype("1");
user.setLoginid(rs.getString("loginid"));
user.setFirstname(rs.getString("firstname"));
user.setLastname(rs.getString("lastname"));
user.setAliasname(rs.getString("aliasname"));
user.setTitle(rs.getString("title"));
user.setTitlelocation(rs.getString("titlelocation"));
user.setSex(rs.getString("sex"));
String langid = rs.getString("systemlanguage");
user.setLanguage(Util.getIntValue(langid, 0));
user.setTelephone(rs.getString("telephone"));
user.setMobile(rs.getString("mobile"));
user.setMobilecall(rs.getString("mobilecall"));
user.setEmail(rs.getString("email"));
user.setCountryid(rs.getString("countryid"));
user.setLocationid(rs.getString("locationid"));
user.setResourcetype(rs.getString("resourcetype"));
user.setStartdate(rs.getString("startdate"));
user.setEnddate(rs.getString("enddate"));
user.setContractdate(rs.getString("contractdate"));
user.setJobtitle(rs.getString("jobtitle"));
user.setJobgroup(rs.getString("jobgroup"));
user.setJobactivity(rs.getString("jobactivity"));
user.setJoblevel(rs.getString("joblevel"));
user.setSeclevel(rs.getString("seclevel"));
user.setUserDepartment(Util.getIntValue(rs.getString("departmentid"),0));
user.setUserSubCompany1(Util.getIntValue(rs.getString("subcompanyid1"),0));
user.setUserSubCompany2(Util.getIntValue(rs.getString("subcompanyid2"),0));
user.setUserSubCompany3(Util.getIntValue(rs.getString("subcompanyid3"),0));
user.setUserSubCompany4(Util.getIntValue(rs.getString("subcompanyid4"),0));
user.setManagerid(rs.getString("managerid"));
user.setAssistantid(rs.getString("assistantid"));
user.setPurchaselimit(rs.getString("purchaselimit"));
user.setCurrencyid(rs.getString("currencyid"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String lastLoginDate = sdf.format(new Date());
user.setLastlogindate(lastLoginDate);
user.setLogintype("1");
user.setAccount(rs.getString("account"));
}
return user;
}
public String httpPostRequest(String param,String url,String token){
BaseBean baseBean = new BaseBean();
JSONObject jsonObject = new JSONObject();
String responseBody="";
try {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(url);
JSONObject jsonString = JSON.parseObject(param);
//设置请求体参数
StringEntity entity = new StringEntity(param,"utf-8");
baseBean.writeLog("entity-param->"+param);
baseBean.writeLog("entity-->"+entity);
entity.setContentEncoding("utf-8");
baseBean.writeLog("entity-utf-8->"+entity);
httpPost.setEntity(entity);
//设置请求头部
httpPost.setHeader("Content-Type", "application/json");
if(token != null && !"".equals(token)){
httpPost.setHeader("Authorization",token);
}
//执行请求,返回请求响应
CloseableHttpResponse response = httpClient.execute(httpPost);
//请求返回状态码
int statusCode = response.getStatusLine().getStatusCode();
baseBean.writeLog("statusCode状态码->"+statusCode);
//请求成功
if (statusCode == HttpStatus.SC_OK && statusCode <= HttpStatus.SC_TEMPORARY_REDIRECT) {
//取出响应体
HttpEntity entity2 = response.getEntity();
//从响应体中解析出token
responseBody = EntityUtils.toString(entity2, "utf-8");
// jsonObject = JSONObject.parseObject(responseBody);
baseBean.writeLog("responseBody->"+responseBody);
// baseBean.writeLog("jsonObject->"+jsonObject);
//token = jsonObject.getString("access_token");
} else {
//请求失败
throw new ClientProtocolException("请求失败,响应码为:" + statusCode);
}
} catch (Exception e) {
e.printStackTrace();
}
return responseBody;
}
/**
* 发送http get请求
*/
public static String httpGet(String url,Map<String,String> headers,String encode){
BaseBean bb = new BaseBean();
if(encode == null){
encode = "utf-8";
}
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
String content = null;
//since 4.3 不再使用 DefaultHttpClient
try {
closeableHttpClient = HttpClientBuilder.create().build();
HttpGet httpGet = new HttpGet(url);
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpGet.setHeader(entry.getKey(),entry.getValue());
}
}
bb.writeLog("url="+url+"header="+headers+"encode="+encode);
httpResponse = closeableHttpClient.execute(httpGet);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
/**
* 向指定 URL 发送POST方法的请求
*
* @param url 发送请求的 URL
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @return 所代表远程资源的响应结果
*/
public static String sendPost(String url, String param) {
BaseBean bb = new BaseBean();
String result = "";
PrintWriter out = null;
BufferedReader in = null;
HttpURLConnection connection = null;
try {
URL postUrl = new URL(url);
bb.writeLog("getUrl-->"+postUrl);
// 打开和URL之间的连接
connection = (HttpURLConnection) postUrl.openConnection();
// 在connect之前设置通用的请求属性
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.setRequestProperty("Charsert", "UTF-8");
connection.setConnectTimeout(15000);
connection.setReadTimeout(60000);
// 发送POST请求必须设置如下两行参数要放在http正文内
connection.setDoOutput(true);
connection.setDoInput(true);
// 默认是 GET方式
connection.setRequestMethod("POST");
// Post 请求不使用缓存
connection.setUseCaches(false);
// 配置本次连接的Content-typeform表单是"application/x-www-form-urlencoded"json是"application/json"等
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.connect();
// 参数要放在http正文内
//1.获取URLConnection对象对应的输出流
out = new PrintWriter(connection.getOutputStream());
//2.中文有乱码的需要将PrintWriter改为如下
//out=new OutputStreamWriter(conn.getOutputStream(),"UTF-8")
out.print(param);
out.flush();
//也可以使用DataOutputStream
// DataOutputStream dos=new DataOutputStream(httpConn.getOutputStream());
// dos.writeBytes(param);
// dos.flush();
// dos.close();
// 定义BufferedReader输入流来读取URL的响应
if (connection.getResponseCode() == 200) {
in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
}
} catch (Exception e) {
bb.writeLog("发送 POST 请求出现异常!" + e);
e.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
if (connection != null) {
//关闭连接
connection.disconnect();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return result;
}
/**
* 发送 http post 请求参数以form表单键值对的形式提交。
*/
public static String httpPostForm(String url,Map<String,String> params, Map<String,String> headers,String encode){
BaseBean bb = new BaseBean();
if(encode == null){
encode = "utf-8";
}
String content = null;
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
try {
closeableHttpClient = HttpClients.createDefault();
HttpPost httpost = new HttpPost(url);
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpost.setHeader(entry.getKey(),entry.getValue());
}
}
bb.writeLog("url="+url+"header="+headers+"encode="+encode);
bb.writeLog("params="+params);
//组织请求参数
List<NameValuePair> paramList = new ArrayList <NameValuePair>();
if(params != null && params.size() > 0){
Set<String> keySet = params.keySet();
for(String key : keySet) {
paramList.add(new BasicNameValuePair(key, params.get(key)));
}
}
httpost.setEntity(new UrlEncodedFormEntity(paramList, encode));
httpResponse = closeableHttpClient.execute(httpost);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
/**
* 公钥加密
*
* @param content 内容
* @param publicKey 公钥
* @return 加密后的密文
* @throws Exception 异常信息
*/
public static String encrypt(String content, String publicKey) throws Exception {
//base64编码的公钥
byte[] decoded = org.apache.commons.codec.binary.Base64.decodeBase64(publicKey);
RSAPublicKey pubKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded));
//RSA加密
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, pubKey);
return Base64.encodeBase64String(cipher.doFinal(content.getBytes(StandardCharsets.UTF_8)));
}
public static String getPublicKey(){
BaseBean bb = new BaseBean();
String publicKey ="";
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));
//请求获取publicKey接口
Map<String,String> headers = new HashMap<>();
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","publicKeyUrl"));
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID","123");
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
String msg = httpGet(url,headers,null);
bb.writeLog("===获取publickey返回值===="+msg);
try {
org.json.JSONObject resMsg = new org.json.JSONObject(msg);
bb.writeLog("===获取publickey返回值===="+resMsg);
if(resMsg.has("pubKey")){
publicKey = Util.null2String(resMsg.get("pubKey").toString());
}
}catch (Exception e){
e.getMessage();
}
return publicKey;
}
//获取TG
public static String getST(String tgt,String emobileUrl){
BaseBean bb = new BaseBean();
String ST = "";
String retMsg = "";
Map<String,String> params = new HashMap<>();//参数
Map<String,String> headers = new HashMap<>();//headers
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));
//请求获取TG接口
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","stUrl"));
bb.writeLog("==获取TG=="+url);
//移动端首页地址
bb.writeLog("==移动端首页地址=="+emobileUrl);
//获取TGT
params = new HashMap<>();//参数
params.put("tgt",tgt);
params.put("service",emobileUrl);
bb.writeLog("==STparams=="+params);
headers = new HashMap<>();//headers
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID","123");
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
try {
retMsg = httpPostForm(url,params,headers,null);
bb.writeLog("===获取ST返回值===="+retMsg);
org.json.JSONObject resMsg = new org.json.JSONObject(retMsg);
bb.writeLog("===获取ST返回值resMsg===="+resMsg);
if(resMsg.has("ST")){
ST = Util.null2String(resMsg.get("ST").toString());
}
bb.writeLog("===获取ST===="+ST);
}catch(Exception e){
throw new RuntimeException(e);
}
return retMsg;
}
%>
<%
RecordSet rs = new RecordSet();
BaseBean bb=new BaseBean();
RSA rsa = new RSA();
Map<String,String> params = new HashMap<>();//参数
Map<String,String> headers = new HashMap<>();//headers
JSONArray array = new JSONArray();
List<String> decriptList = new ArrayList<>();
String ST ="";//获取ST
bb.writeLog("进入获取简历jsp-->");
String login_id = "";
String user_password = "";
User user = HrmUserVarify.getUser(request, response);
int uid = user.getUID();
bb.writeLog("uid-->"+uid);
rs.executeQuery("select id,loginid,password,createtime from EmobileLoginDetail where id=?", uid);
if(rs.next()){
login_id = Util.null2String(rs.getString("loginid"));
user_password = Util.null2String(rs.getString("password"));
}
bb.writeLog("login_id-->"+login_id);
bb.writeLog("user_password-->"+user_password);
//获取session
session = request.getSession(true);
String certified_token = Util.null2String(session.getAttribute("certified_token"));
bb.writeLog("获取sessionTGT=="+certified_token);
//获取cookie
Cookie[] cookies = request.getCookies();
bb.writeLog("获取cookies=="+cookies);
String idd = "";
if(cookies != null){
for(Cookie cookie:cookies){
bb.writeLog("获取cookiesName=="+cookie.getName());
if(cookie.getName().equals("loginidweaver")){
idd = cookie.getValue();
bb.writeLog("获取idd=="+idd);
}
}
}
//查询人员工号
RecordSet recordSet = new RecordSet();
String requestURI = request.getRequestURI();
bb.writeLog("请求路径="+requestURI);
Map<String, Object> useridMap = ParamUtil.request2Map(request);
bb.writeLog("人员id="+useridMap.get("userid"));
recordSet.executeQuery("select WORKCODE from HRMRESOURCE where id=?", Util.null2String(useridMap.get("userid")));
String workcode = "";
if (recordSet.next()){
workcode = Util.null2String(recordSet.getString("WORKCODE"));
}
bb.writeLog("人员workcode="+useridMap.get("workcode"));
//查询
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));//publicKey
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","stUrl"));//获取ST的url
String cockpitUrl = Util.null2String(bb.getPropValue("tjbankEMobileSSO","cockpitUrl"));
String tgturl = Util.null2String(bb.getPropValue("tjbankEMobileSSO","tgtUrl"));//请求获取TGT地址
//获取ST带着下游系统
if (!isEmpty(certified_token)){
String responseInfo = getST(certified_token,cockpitUrl);
bb.writeLog("进入responseInfo-->"+responseInfo);
if (isEmpty(responseInfo)){
out.print("单点系统接口返回值为null");
return;
}else {
org.json.JSONObject stMsg = new org.json.JSONObject(responseInfo);
if(stMsg.has("ST")){
ST = Util.null2String(stMsg.get("ST").toString());
}else{
out.print(Util.null2String(stMsg.getString("message")));
return;
}
String loginUrl = "";
String remuseUrl = bb.getPropValue("tjbkremuse", "hyzxUrl");
boolean isEm = Util.null2String(request.getHeader("user-agent")).indexOf("E-Mobile") > -1;
if(isEm == true){
loginUrl=remuseUrl+"&ticket="+ST;
}
//loginUrl = "https://www.baidu.com/";
bb.writeLog("loginUrl-->"+loginUrl);
out.print("跳转路径-->"+loginUrl);
out.print("进入驾驶舱成功");
response.sendRedirect(loginUrl);
// return;
}
}else {
String TGT ="";
String passWord ="";
String retMsg ="";
decriptList.add(login_id);
decriptList.add(user_password);
List<String> resultList = rsa.decryptList(request, decriptList);
String loginId = resultList.get(0);
String userPassword = resultList.get(1);
String publicKey = getPublicKey();
passWord = encrypt(user_password, publicKey);
params = new HashMap<>();//参数
params.put("username",loginId);
params.put("password",passWord);
bb.writeLog("==STparams=="+params);
headers = new HashMap<>();//headers
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID","123");
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
retMsg = httpPostForm(tgturl,params,headers,null);
bb.writeLog("===获取TGT返回值retMsg===="+retMsg);
org.json.JSONObject resMsg = new org.json.JSONObject(retMsg);
bb.writeLog("===获取TGT返回值===="+resMsg);
if(resMsg.has("TGT")){
TGT = Util.null2String(resMsg.get("TGT").toString());
}
String responseInfo = getST(TGT,cockpitUrl);
if (isEmpty(responseInfo)){
out.print("单点系统接口返回值为null");
return;
}else {
org.json.JSONObject stMsg = new org.json.JSONObject(responseInfo);
if(stMsg.has("ST")){
ST = Util.null2String(stMsg.get("ST").toString());
}else{
out.print(Util.null2String(stMsg.getString("message")));
return;
}
String loginUrl = "";
String remuseUrl = bb.getPropValue("tjbkremuse", "hyzxUrl");
boolean isEm = Util.null2String(request.getHeader("user-agent")).indexOf("E-Mobile") > -1;
if(isEm == true){
loginUrl=remuseUrl+"&ticket="+ST;
//loginUrl="http://123.151.115.199:8080/bi/PCFW?proc=1&action=viewer&hback=true&db=%E6%99%BA%E6%85%A7%E6%96%B9%E7%95%A5/%E5%89%8D%E7%BD%AE%E9%A1%B5.db&ticket="+ST;
}
bb.writeLog("loginUrl-->"+loginUrl);
out.print("跳转路径-->"+loginUrl);
out.print("进入驾驶舱成功");
response.sendRedirect(loginUrl);
}
// out.print("进入驾驶舱系统失败,请先获取标识");
//return;
}
%>
 <script type="text/javascript">
<%--<%=httpPostRequest%>;--%>
// alert("00000");
// next();
//   function next(){
// alert("2222");
// console.log("111111111");
<%--console.log("http://10.16.103.18:9900/coremail/main.jsp?sid="+<%=sid%>);--%>
<%--console.log("sid="+<%=sid%>);--%>
<%--window.location.href= "http://10.16.103.18:9900/coremail/main.jsp?sid="+<%=sid%>;--%>
//   window.location.href= "https://www.baidu.com/";
<%--   }--%>
 </script>

@ -0,0 +1,651 @@
<%--
Created by IntelliJ IDEA.
User: xvshanshan
Date: 2023/7/3
Time: 9:23
To change this template use File | Settings | File Templates.
--%>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page import="java.util.regex.Pattern" %>
<%@ page import="java.util.regex.Matcher" %>
<%@ page import="java.io.*" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ page import="org.apache.http.impl.client.CloseableHttpClient" %>
<%@ page import="org.apache.http.impl.client.HttpClients" %>
<%@ page import="org.apache.http.client.methods.HttpPost" %>
<%@ page import="com.alibaba.fastjson.JSON" %>
<%@ page import="org.apache.http.entity.StringEntity" %>
<%@ page import="org.apache.http.client.methods.CloseableHttpResponse" %>
<%@ page import="org.apache.http.HttpStatus" %>
<%@ page import="org.apache.http.HttpEntity" %>
<%@ page import="org.apache.http.util.EntityUtils" %>
<%@ page import="org.apache.http.client.ClientProtocolException" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="java.net.URL" %>
<%@ page import="java.net.HttpURLConnection" %>
<%@ page import="org.apache.http.HttpException" %>
<%@ page import="org.apache.http.client.HttpClient" %>
<%@ page import="org.apache.commons.httpclient.methods.PostMethod" %>
<%@ page import="org.apache.commons.httpclient.params.HttpMethodParams" %>
<%@ page import="org.apache.http.NameValuePair" %>
<%@ page import="org.apache.http.message.BasicNameValuePair" %>
<%@ page import="org.apache.http.client.entity.UrlEncodedFormEntity" %>
<%@ page import="weaver.rsa.security.RSA" %>
<%@ page import="java.security.interfaces.RSAPublicKey" %>
<%@ page import="java.security.KeyFactory" %>
<%@ page import="java.security.spec.X509EncodedKeySpec" %>
<%@ page import="javax.crypto.Cipher" %>
<%@ page import="org.apache.commons.codec.binary.Base64" %>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ page import="org.apache.http.impl.client.HttpClientBuilder" %>
<%@ page import="org.apache.http.client.methods.HttpGet" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%!
//获取分页sql
public static String getPaginationSql(String sql, String orderby, int pageNo, int pageSize) {
String execSql = "";
RecordSet rs = new RecordSet();
String dbType = rs.getDBType();
// String dbType = "oracle";
// String dbType = "sqlserver";
int firstResult = 0;
int endResult = 0;
// 返回分页sql
if("oracle".equals(dbType)){ // rownum
firstResult = pageNo * pageSize + 1;
endResult = (pageNo - 1) * pageSize;
execSql = " select * from ( select tabUN2.*,rownum as my_rownum from ( select tableUN.*,rownum as r from ( " + sql
+ orderby + ") tableUN " + ") tabUN2 where r < " + firstResult + " ) where my_rownum > " + endResult;
}else if("sqlserver".equals(dbType)){
sql="select *,row_number()OVER("+orderby+") as rn from ("+sql+") newt";
execSql = "select * from ( " +
sql+")fy " +
" where rn between ("+pageNo+"-1)*"+pageSize+"+1 and "+pageNo+"*"+pageSize+" ";
}else { // 使用 ROW_NUMBER OVER()分页
firstResult = pageNo * pageSize + 1;
endResult = (pageNo - 1) * pageSize;
execSql = " select * from ( select tabUN2.*,rownum as my_rownum from ( select tableUN.*,rownum as r from ( " + sql
+ orderby +") tableUN ) tabUN2 where r < " + firstResult + " ) where my_rownum > " + endResult;
}
rs.writeLog("execSql---->"+execSql);
return execSql;
}
private boolean isEmpty(String str) {
if ("".equals(str) ||"(null)".equals(str) || str == null) {
return true;
} else {
return false;
}
}
/**
* 获取指定类型的src值的集合
* @param htmlStr
* @param type 标签名称
* @return
* 简历
*/
public static Set<String> getSrcStr(String htmlStr, String type) {
Set<String> srcs = new HashSet<String>();
String src = "";
Pattern p_src;
Matcher m_src;
// String regEx_img = "<img.*src=(.*?)[^>]*?>"; //图片链接地址
String regEx_src = "<"+type+".*src\\s*=\\s*(.*?)[^>]*?>";
p_src = Pattern.compile
(regEx_src, Pattern.CASE_INSENSITIVE);
m_src = p_src.matcher(htmlStr);
while (m_src.find()) {
// 得到<img />数据
src = m_src.group();
// 匹配<img>中的src数据
Matcher m = Pattern.compile("src\\s*=\\s*\"?(.*?)(\"|>|\\s+)").matcher(src);
while (m.find()) {
srcs.add(m.group(1));
}
}
return srcs;
}
public User getUser(int uid){
User user = new User();
RecordSet rs = new RecordSet();
if (uid == 1)
rs.executeQuery("select * from hrmresourcemanager where id=?", uid);
else {
rs.executeQuery("select * from hrmresource where id=?", uid);
}
String userid = "";
if (rs.next()) {
userid = rs.getString("id");
user.setUid(rs.getInt("id"));
user.setLogintype("1");
user.setLoginid(rs.getString("loginid"));
user.setFirstname(rs.getString("firstname"));
user.setLastname(rs.getString("lastname"));
user.setAliasname(rs.getString("aliasname"));
user.setTitle(rs.getString("title"));
user.setTitlelocation(rs.getString("titlelocation"));
user.setSex(rs.getString("sex"));
String langid = rs.getString("systemlanguage");
user.setLanguage(Util.getIntValue(langid, 0));
user.setTelephone(rs.getString("telephone"));
user.setMobile(rs.getString("mobile"));
user.setMobilecall(rs.getString("mobilecall"));
user.setEmail(rs.getString("email"));
user.setCountryid(rs.getString("countryid"));
user.setLocationid(rs.getString("locationid"));
user.setResourcetype(rs.getString("resourcetype"));
user.setStartdate(rs.getString("startdate"));
user.setEnddate(rs.getString("enddate"));
user.setContractdate(rs.getString("contractdate"));
user.setJobtitle(rs.getString("jobtitle"));
user.setJobgroup(rs.getString("jobgroup"));
user.setJobactivity(rs.getString("jobactivity"));
user.setJoblevel(rs.getString("joblevel"));
user.setSeclevel(rs.getString("seclevel"));
user.setUserDepartment(Util.getIntValue(rs.getString("departmentid"),0));
user.setUserSubCompany1(Util.getIntValue(rs.getString("subcompanyid1"),0));
user.setUserSubCompany2(Util.getIntValue(rs.getString("subcompanyid2"),0));
user.setUserSubCompany3(Util.getIntValue(rs.getString("subcompanyid3"),0));
user.setUserSubCompany4(Util.getIntValue(rs.getString("subcompanyid4"),0));
user.setManagerid(rs.getString("managerid"));
user.setAssistantid(rs.getString("assistantid"));
user.setPurchaselimit(rs.getString("purchaselimit"));
user.setCurrencyid(rs.getString("currencyid"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String lastLoginDate = sdf.format(new Date());
user.setLastlogindate(lastLoginDate);
user.setLogintype("1");
user.setAccount(rs.getString("account"));
}
return user;
}
public String httpPostRequest(String param,String url,String token){
BaseBean baseBean = new BaseBean();
JSONObject jsonObject = new JSONObject();
String responseBody="";
try {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(url);
JSONObject jsonString = JSON.parseObject(param);
//设置请求体参数
StringEntity entity = new StringEntity(param,"utf-8");
baseBean.writeLog("entity-param->"+param);
baseBean.writeLog("entity-->"+entity);
entity.setContentEncoding("utf-8");
baseBean.writeLog("entity-utf-8->"+entity);
httpPost.setEntity(entity);
//设置请求头部
httpPost.setHeader("Content-Type", "application/json");
if(token != null && !"".equals(token)){
httpPost.setHeader("Authorization",token);
}
//执行请求,返回请求响应
CloseableHttpResponse response = httpClient.execute(httpPost);
//请求返回状态码
int statusCode = response.getStatusLine().getStatusCode();
baseBean.writeLog("statusCode状态码->"+statusCode);
//请求成功
if (statusCode == HttpStatus.SC_OK && statusCode <= HttpStatus.SC_TEMPORARY_REDIRECT) {
//取出响应体
HttpEntity entity2 = response.getEntity();
//从响应体中解析出token
responseBody = EntityUtils.toString(entity2, "utf-8");
// jsonObject = JSONObject.parseObject(responseBody);
baseBean.writeLog("responseBody->"+responseBody);
// baseBean.writeLog("jsonObject->"+jsonObject);
//token = jsonObject.getString("access_token");
} else {
//请求失败
throw new ClientProtocolException("请求失败,响应码为:" + statusCode);
}
} catch (Exception e) {
e.printStackTrace();
}
return responseBody;
}
/**
* 发送http get请求
*/
public static String httpGet(String url,Map<String,String> headers,String encode){
BaseBean bb = new BaseBean();
if(encode == null){
encode = "utf-8";
}
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
String content = null;
//since 4.3 不再使用 DefaultHttpClient
try {
closeableHttpClient = HttpClientBuilder.create().build();
HttpGet httpGet = new HttpGet(url);
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpGet.setHeader(entry.getKey(),entry.getValue());
}
}
bb.writeLog("url="+url+"header="+headers+"encode="+encode);
httpResponse = closeableHttpClient.execute(httpGet);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
/**
* 向指定 URL 发送POST方法的请求
*
* @param url 发送请求的 URL
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @return 所代表远程资源的响应结果
*/
public static String sendPost(String url, String param) {
BaseBean bb = new BaseBean();
String result = "";
PrintWriter out = null;
BufferedReader in = null;
HttpURLConnection connection = null;
try {
URL postUrl = new URL(url);
bb.writeLog("getUrl-->"+postUrl);
// 打开和URL之间的连接
connection = (HttpURLConnection) postUrl.openConnection();
// 在connect之前设置通用的请求属性
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.setRequestProperty("Charsert", "UTF-8");
connection.setConnectTimeout(15000);
connection.setReadTimeout(60000);
// 发送POST请求必须设置如下两行参数要放在http正文内
connection.setDoOutput(true);
connection.setDoInput(true);
// 默认是 GET方式
connection.setRequestMethod("POST");
// Post 请求不使用缓存
connection.setUseCaches(false);
// 配置本次连接的Content-typeform表单是"application/x-www-form-urlencoded"json是"application/json"等
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.connect();
// 参数要放在http正文内
//1.获取URLConnection对象对应的输出流
out = new PrintWriter(connection.getOutputStream());
//2.中文有乱码的需要将PrintWriter改为如下
//out=new OutputStreamWriter(conn.getOutputStream(),"UTF-8")
out.print(param);
out.flush();
//也可以使用DataOutputStream
// DataOutputStream dos=new DataOutputStream(httpConn.getOutputStream());
// dos.writeBytes(param);
// dos.flush();
// dos.close();
// 定义BufferedReader输入流来读取URL的响应
if (connection.getResponseCode() == 200) {
in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
}
} catch (Exception e) {
bb.writeLog("发送 POST 请求出现异常!" + e);
e.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
if (connection != null) {
//关闭连接
connection.disconnect();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return result;
}
/**
* 发送 http post 请求参数以form表单键值对的形式提交。
*/
public static String httpPostForm(String url,Map<String,String> params, Map<String,String> headers,String encode){
BaseBean bb = new BaseBean();
if(encode == null){
encode = "utf-8";
}
String content = null;
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
try {
closeableHttpClient = HttpClients.createDefault();
HttpPost httpost = new HttpPost(url);
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpost.setHeader(entry.getKey(),entry.getValue());
}
}
bb.writeLog("url="+url+"header="+headers+"encode="+encode);
bb.writeLog("params="+params);
//组织请求参数
List<NameValuePair> paramList = new ArrayList <NameValuePair>();
if(params != null && params.size() > 0){
Set<String> keySet = params.keySet();
for(String key : keySet) {
paramList.add(new BasicNameValuePair(key, params.get(key)));
}
}
httpost.setEntity(new UrlEncodedFormEntity(paramList, encode));
httpResponse = closeableHttpClient.execute(httpost);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
/**
* 公钥加密
*
* @param content 内容
* @param publicKey 公钥
* @return 加密后的密文
* @throws Exception 异常信息
*/
public static String encrypt(String content, String publicKey) throws Exception {
//base64编码的公钥
byte[] decoded = org.apache.commons.codec.binary.Base64.decodeBase64(publicKey);
RSAPublicKey pubKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded));
//RSA加密
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, pubKey);
return Base64.encodeBase64String(cipher.doFinal(content.getBytes(StandardCharsets.UTF_8)));
}
public static String getPublicKey(){
BaseBean bb = new BaseBean();
String publicKey ="";
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));
//请求获取publicKey接口
Map<String,String> headers = new HashMap<>();
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","publicKeyUrl"));
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID","123");
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
String msg = httpGet(url,headers,null);
bb.writeLog("===获取publickey返回值===="+msg);
try {
org.json.JSONObject resMsg = new org.json.JSONObject(msg);
bb.writeLog("===获取publickey返回值===="+resMsg);
if(resMsg.has("pubKey")){
publicKey = Util.null2String(resMsg.get("pubKey").toString());
}
}catch (Exception e){
e.getMessage();
}
return publicKey;
}
//获取TG
public static String getST(String tgt,String emobileUrl){
BaseBean bb = new BaseBean();
String ST = "";
String retMsg = "";
Map<String,String> params = new HashMap<>();//参数
Map<String,String> headers = new HashMap<>();//headers
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));
//请求获取TG接口
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","stUrl"));
bb.writeLog("==获取TG=="+url);
//移动端首页地址
bb.writeLog("==移动端首页地址=="+emobileUrl);
//获取TGT
params = new HashMap<>();//参数
params.put("tgt",tgt);
params.put("service",emobileUrl);
bb.writeLog("==STparams=="+params);
headers = new HashMap<>();//headers
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID","123");
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
try {
retMsg = httpPostForm(url,params,headers,null);
bb.writeLog("===获取ST返回值===="+retMsg);
org.json.JSONObject resMsg = new org.json.JSONObject(retMsg);
bb.writeLog("===获取ST返回值resMsg===="+resMsg);
if(resMsg.has("ST")){
ST = Util.null2String(resMsg.get("ST").toString());
}
bb.writeLog("===获取ST===="+ST);
}catch(Exception e){
throw new RuntimeException(e);
}
return retMsg;
}
%>
<%
RecordSet rs = new RecordSet();
BaseBean bb=new BaseBean();
RSA rsa = new RSA();
Map<String,String> params = new HashMap<>();//参数
Map<String,String> headers = new HashMap<>();//headers
JSONArray array = new JSONArray();
List<String> decriptList = new ArrayList<>();
String ST ="";//获取ST
bb.writeLog("进入获取简历jsp-->");
String login_id = "";
String user_password = "";
User user = HrmUserVarify.getUser(request, response);
int uid = user.getUID();
bb.writeLog("uid-->"+uid);
rs.executeQuery("select id,loginid,password,createtime from EmobileLoginDetail where id=?", uid);
if(rs.next()){
login_id = Util.null2String(rs.getString("loginid"));
user_password = Util.null2String(rs.getString("password"));
}
bb.writeLog("login_id-->"+login_id);
bb.writeLog("user_password-->"+user_password);
//获取session
session = request.getSession(true);
String certified_token = Util.null2String(session.getAttribute("certified_token"));
bb.writeLog("获取sessionTGT=="+certified_token);
//获取cookie
Cookie[] cookies = request.getCookies();
bb.writeLog("获取cookies=="+cookies);
String idd = "";
if(cookies != null){
for(Cookie cookie:cookies){
bb.writeLog("获取cookiesName=="+cookie.getName());
if(cookie.getName().equals("loginidweaver")){
idd = cookie.getValue();
bb.writeLog("获取idd=="+idd);
}
}
}
//查询人员工号
RecordSet recordSet = new RecordSet();
String requestURI = request.getRequestURI();
bb.writeLog("请求路径="+requestURI);
Map<String, Object> useridMap = ParamUtil.request2Map(request);
bb.writeLog("人员id="+useridMap.get("userid"));
recordSet.executeQuery("select WORKCODE from HRMRESOURCE where id=?", Util.null2String(useridMap.get("userid")));
String workcode = "";
if (recordSet.next()){
workcode = Util.null2String(recordSet.getString("WORKCODE"));
}
bb.writeLog("人员workcode="+useridMap.get("workcode"));
//查询
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));//publicKey
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","stUrl"));//获取ST的url
String cockpitUrl = Util.null2String(bb.getPropValue("tjbankEMobileSSO","cockpitUrl"));
String tgturl = Util.null2String(bb.getPropValue("tjbankEMobileSSO","tgtUrl"));//请求获取TGT地址
//获取ST带着下游系统
if (!isEmpty(certified_token)){
String responseInfo = getST(certified_token,cockpitUrl);
bb.writeLog("进入responseInfo-->"+responseInfo);
if (isEmpty(responseInfo)){
out.print("单点系统接口返回值为null");
return;
}else {
org.json.JSONObject stMsg = new org.json.JSONObject(responseInfo);
if(stMsg.has("ST")){
ST = Util.null2String(stMsg.get("ST").toString());
}else{
out.print(Util.null2String(stMsg.getString("message")));
return;
}
String loginUrl = "";
String remuseUrl = bb.getPropValue("tjbkremuse", "url");
boolean isEm = Util.null2String(request.getHeader("user-agent")).indexOf("E-Mobile") > -1;
if(isEm == true){
loginUrl=remuseUrl+workcode+"&ticket="+ST;
}
//loginUrl = "https://www.baidu.com/";
bb.writeLog("loginUrl-->"+loginUrl);
out.print("跳转路径-->"+loginUrl);
out.print("进入驾驶舱成功");
response.sendRedirect(loginUrl);
// return;
}
}else {
String TGT ="";
String passWord ="";
String retMsg ="";
decriptList.add(login_id);
decriptList.add(user_password);
List<String> resultList = rsa.decryptList(request, decriptList);
String loginId = resultList.get(0);
String userPassword = resultList.get(1);
String publicKey = getPublicKey();
passWord = encrypt(user_password, publicKey);
params = new HashMap<>();//参数
params.put("username",loginId);
params.put("password",passWord);
bb.writeLog("==STparams=="+params);
headers = new HashMap<>();//headers
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID","123");
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
retMsg = httpPostForm(tgturl,params,headers,null);
bb.writeLog("===获取TGT返回值retMsg===="+retMsg);
org.json.JSONObject resMsg = new org.json.JSONObject(retMsg);
bb.writeLog("===获取TGT返回值===="+resMsg);
if(resMsg.has("TGT")){
TGT = Util.null2String(resMsg.get("TGT").toString());
}
String responseInfo = getST(TGT,cockpitUrl);
if (isEmpty(responseInfo)){
out.print("单点系统接口返回值为null");
return;
}else {
org.json.JSONObject stMsg = new org.json.JSONObject(responseInfo);
if(stMsg.has("ST")){
ST = Util.null2String(stMsg.get("ST").toString());
}else{
out.print(Util.null2String(stMsg.getString("message")));
return;
}
String loginUrl = "";
String remuseUrl = bb.getPropValue("tjbkremuse", "url");
boolean isEm = Util.null2String(request.getHeader("user-agent")).indexOf("E-Mobile") > -1;
if(isEm == true){
loginUrl=remuseUrl+workcode+"&ticket="+ST;
//loginUrl="http://123.151.115.199:8080/bi/PCFW?proc=1&action=viewer&hback=true&db=%E6%99%BA%E6%85%A7%E6%96%B9%E7%95%A5/%E5%89%8D%E7%BD%AE%E9%A1%B5.db&ticket="+ST;
}
bb.writeLog("loginUrl-->"+loginUrl);
out.print("跳转路径-->"+loginUrl);
out.print("进入驾驶舱成功");
response.sendRedirect(loginUrl);
}
// out.print("进入驾驶舱系统失败,请先获取标识");
//return;
}
%>
 <script type="text/javascript">
<%--<%=httpPostRequest%>;--%>
// alert("00000");
// next();
//   function next(){
// alert("2222");
// console.log("111111111");
<%--console.log("http://10.16.103.18:9900/coremail/main.jsp?sid="+<%=sid%>);--%>
<%--console.log("sid="+<%=sid%>);--%>
<%--window.location.href= "http://10.16.103.18:9900/coremail/main.jsp?sid="+<%=sid%>;--%>
//   window.location.href= "https://www.baidu.com/";
<%--   }--%>
 </script>

@ -0,0 +1,687 @@
<%--
Created by IntelliJ IDEA.
User: xvshanshan
Date: 2023/7/3
Time: 9:23
To change this template use File | Settings | File Templates.
--%>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page import="java.util.regex.Pattern" %>
<%@ page import="java.util.regex.Matcher" %>
<%@ page import="java.io.*" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ page import="org.apache.http.impl.client.CloseableHttpClient" %>
<%@ page import="org.apache.http.impl.client.HttpClients" %>
<%@ page import="org.apache.http.client.methods.HttpPost" %>
<%@ page import="com.alibaba.fastjson.JSON" %>
<%@ page import="org.apache.http.entity.StringEntity" %>
<%@ page import="org.apache.http.client.methods.CloseableHttpResponse" %>
<%@ page import="org.apache.http.HttpStatus" %>
<%@ page import="org.apache.http.HttpEntity" %>
<%@ page import="org.apache.http.util.EntityUtils" %>
<%@ page import="org.apache.http.client.ClientProtocolException" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="java.net.URL" %>
<%@ page import="java.net.HttpURLConnection" %>
<%@ page import="org.apache.http.HttpException" %>
<%@ page import="org.apache.http.client.HttpClient" %>
<%@ page import="org.apache.commons.httpclient.methods.PostMethod" %>
<%@ page import="org.apache.commons.httpclient.params.HttpMethodParams" %>
<%@ page import="org.apache.http.NameValuePair" %>
<%@ page import="org.apache.http.message.BasicNameValuePair" %>
<%@ page import="org.apache.http.client.entity.UrlEncodedFormEntity" %>
<%@ page import="weaver.rsa.security.RSA" %>
<%@ page import="java.security.interfaces.RSAPublicKey" %>
<%@ page import="java.security.KeyFactory" %>
<%@ page import="java.security.spec.X509EncodedKeySpec" %>
<%@ page import="javax.crypto.Cipher" %>
<%@ page import="org.apache.commons.codec.binary.Base64" %>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ page import="org.apache.http.impl.client.HttpClientBuilder" %>
<%@ page import="org.apache.http.client.methods.HttpGet" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%@ page import="com.wbi.util.StringUtil" %>
<%!
//获取分页sql
public static String getPaginationSql(String sql, String orderby, int pageNo, int pageSize) {
String execSql = "";
RecordSet rs = new RecordSet();
String dbType = rs.getDBType();
// String dbType = "oracle";
// String dbType = "sqlserver";
int firstResult = 0;
int endResult = 0;
// 返回分页sql
if("oracle".equals(dbType)){ // rownum
firstResult = pageNo * pageSize + 1;
endResult = (pageNo - 1) * pageSize;
execSql = " select * from ( select tabUN2.*,rownum as my_rownum from ( select tableUN.*,rownum as r from ( " + sql
+ orderby + ") tableUN " + ") tabUN2 where r < " + firstResult + " ) where my_rownum > " + endResult;
}else if("sqlserver".equals(dbType)){
sql="select *,row_number()OVER("+orderby+") as rn from ("+sql+") newt";
execSql = "select * from ( " +
sql+")fy " +
" where rn between ("+pageNo+"-1)*"+pageSize+"+1 and "+pageNo+"*"+pageSize+" ";
}else { // 使用 ROW_NUMBER OVER()分页
firstResult = pageNo * pageSize + 1;
endResult = (pageNo - 1) * pageSize;
execSql = " select * from ( select tabUN2.*,rownum as my_rownum from ( select tableUN.*,rownum as r from ( " + sql
+ orderby +") tableUN ) tabUN2 where r < " + firstResult + " ) where my_rownum > " + endResult;
}
rs.writeLog("execSql---->"+execSql);
return execSql;
}
private boolean isEmpty(String str) {
if ("".equals(str) ||"(null)".equals(str) || str == null) {
return true;
} else {
return false;
}
}
/**
* 获取指定类型的src值的集合
* @param htmlStr
* @param type 标签名称
* @return
* 简历
*/
public static Set<String> getSrcStr(String htmlStr, String type) {
Set<String> srcs = new HashSet<String>();
String src = "";
Pattern p_src;
Matcher m_src;
// String regEx_img = "<img.*src=(.*?)[^>]*?>"; //图片链接地址
String regEx_src = "<"+type+".*src\\s*=\\s*(.*?)[^>]*?>";
p_src = Pattern.compile
(regEx_src, Pattern.CASE_INSENSITIVE);
m_src = p_src.matcher(htmlStr);
while (m_src.find()) {
// 得到<img />数据
src = m_src.group();
// 匹配<img>中的src数据
Matcher m = Pattern.compile("src\\s*=\\s*\"?(.*?)(\"|>|\\s+)").matcher(src);
while (m.find()) {
srcs.add(m.group(1));
}
}
return srcs;
}
public User getUser(int uid){
User user = new User();
RecordSet rs = new RecordSet();
if (uid == 1)
rs.executeQuery("select * from hrmresourcemanager where id=?", uid);
else {
rs.executeQuery("select * from hrmresource where id=?", uid);
}
String userid = "";
if (rs.next()) {
userid = rs.getString("id");
user.setUid(rs.getInt("id"));
user.setLogintype("1");
user.setLoginid(rs.getString("loginid"));
user.setFirstname(rs.getString("firstname"));
user.setLastname(rs.getString("lastname"));
user.setAliasname(rs.getString("aliasname"));
user.setTitle(rs.getString("title"));
user.setTitlelocation(rs.getString("titlelocation"));
user.setSex(rs.getString("sex"));
String langid = rs.getString("systemlanguage");
user.setLanguage(Util.getIntValue(langid, 0));
user.setTelephone(rs.getString("telephone"));
user.setMobile(rs.getString("mobile"));
user.setMobilecall(rs.getString("mobilecall"));
user.setEmail(rs.getString("email"));
user.setCountryid(rs.getString("countryid"));
user.setLocationid(rs.getString("locationid"));
user.setResourcetype(rs.getString("resourcetype"));
user.setStartdate(rs.getString("startdate"));
user.setEnddate(rs.getString("enddate"));
user.setContractdate(rs.getString("contractdate"));
user.setJobtitle(rs.getString("jobtitle"));
user.setJobgroup(rs.getString("jobgroup"));
user.setJobactivity(rs.getString("jobactivity"));
user.setJoblevel(rs.getString("joblevel"));
user.setSeclevel(rs.getString("seclevel"));
user.setUserDepartment(Util.getIntValue(rs.getString("departmentid"),0));
user.setUserSubCompany1(Util.getIntValue(rs.getString("subcompanyid1"),0));
user.setUserSubCompany2(Util.getIntValue(rs.getString("subcompanyid2"),0));
user.setUserSubCompany3(Util.getIntValue(rs.getString("subcompanyid3"),0));
user.setUserSubCompany4(Util.getIntValue(rs.getString("subcompanyid4"),0));
user.setManagerid(rs.getString("managerid"));
user.setAssistantid(rs.getString("assistantid"));
user.setPurchaselimit(rs.getString("purchaselimit"));
user.setCurrencyid(rs.getString("currencyid"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String lastLoginDate = sdf.format(new Date());
user.setLastlogindate(lastLoginDate);
user.setLogintype("1");
user.setAccount(rs.getString("account"));
}
return user;
}
public String httpPostRequest(String param,String url,String token){
BaseBean baseBean = new BaseBean();
JSONObject jsonObject = new JSONObject();
String responseBody="";
try {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(url);
JSONObject jsonString = JSON.parseObject(param);
//设置请求体参数
StringEntity entity = new StringEntity(param,"utf-8");
baseBean.writeLog("entity-param->"+param);
baseBean.writeLog("entity-->"+entity);
entity.setContentEncoding("utf-8");
baseBean.writeLog("entity-utf-8->"+entity);
httpPost.setEntity(entity);
//设置请求头部
httpPost.setHeader("Content-Type", "application/json");
if(token != null && !"".equals(token)){
httpPost.setHeader("Authorization",token);
}
//执行请求,返回请求响应
CloseableHttpResponse response = httpClient.execute(httpPost);
//请求返回状态码
int statusCode = response.getStatusLine().getStatusCode();
baseBean.writeLog("statusCode状态码->"+statusCode);
//请求成功
if (statusCode == HttpStatus.SC_OK && statusCode <= HttpStatus.SC_TEMPORARY_REDIRECT) {
//取出响应体
HttpEntity entity2 = response.getEntity();
//从响应体中解析出token
responseBody = EntityUtils.toString(entity2, "utf-8");
// jsonObject = JSONObject.parseObject(responseBody);
baseBean.writeLog("responseBody->"+responseBody);
// baseBean.writeLog("jsonObject->"+jsonObject);
//token = jsonObject.getString("access_token");
} else {
//请求失败
throw new ClientProtocolException("请求失败,响应码为:" + statusCode);
}
} catch (Exception e) {
e.printStackTrace();
}
return responseBody;
}
/**
* 发送http get请求
*/
public static String httpGet(String url,Map<String,String> headers,String encode){
BaseBean bb = new BaseBean();
if(encode == null){
encode = "utf-8";
}
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
String content = null;
//since 4.3 不再使用 DefaultHttpClient
try {
closeableHttpClient = HttpClientBuilder.create().build();
HttpGet httpGet = new HttpGet(url);
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpGet.setHeader(entry.getKey(),entry.getValue());
}
}
bb.writeLog("url="+url+"header="+headers+"encode="+encode);
httpResponse = closeableHttpClient.execute(httpGet);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
/**
* 向指定 URL 发送POST方法的请求
*
* @param url 发送请求的 URL
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @return 所代表远程资源的响应结果
*/
public static String sendPost(String url, String param) {
BaseBean bb = new BaseBean();
String result = "";
PrintWriter out = null;
BufferedReader in = null;
HttpURLConnection connection = null;
try {
URL postUrl = new URL(url);
bb.writeLog("getUrl-->"+postUrl);
// 打开和URL之间的连接
connection = (HttpURLConnection) postUrl.openConnection();
// 在connect之前设置通用的请求属性
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.setRequestProperty("Charsert", "UTF-8");
connection.setConnectTimeout(15000);
connection.setReadTimeout(60000);
// 发送POST请求必须设置如下两行参数要放在http正文内
connection.setDoOutput(true);
connection.setDoInput(true);
// 默认是 GET方式
connection.setRequestMethod("POST");
// Post 请求不使用缓存
connection.setUseCaches(false);
// 配置本次连接的Content-typeform表单是"application/x-www-form-urlencoded"json是"application/json"等
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.connect();
// 参数要放在http正文内
//1.获取URLConnection对象对应的输出流
out = new PrintWriter(connection.getOutputStream());
//2.中文有乱码的需要将PrintWriter改为如下
//out=new OutputStreamWriter(conn.getOutputStream(),"UTF-8")
out.print(param);
out.flush();
//也可以使用DataOutputStream
// DataOutputStream dos=new DataOutputStream(httpConn.getOutputStream());
// dos.writeBytes(param);
// dos.flush();
// dos.close();
// 定义BufferedReader输入流来读取URL的响应
if (connection.getResponseCode() == 200) {
in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
}
} catch (Exception e) {
bb.writeLog("发送 POST 请求出现异常!" + e);
e.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
if (connection != null) {
//关闭连接
connection.disconnect();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return result;
}
/**
* 发送 http post 请求参数以form表单键值对的形式提交。
*/
public static String httpPostForm(String url,Map<String,String> params, Map<String,String> headers,String encode){
BaseBean bb = new BaseBean();
if(encode == null){
encode = "utf-8";
}
String content = null;
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
try {
closeableHttpClient = HttpClients.createDefault();
HttpPost httpost = new HttpPost(url);
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpost.setHeader(entry.getKey(),entry.getValue());
}
}
bb.writeLog("url="+url+"header="+headers+"encode="+encode);
bb.writeLog("params="+params);
//组织请求参数
List<NameValuePair> paramList = new ArrayList <NameValuePair>();
if(params != null && params.size() > 0){
Set<String> keySet = params.keySet();
for(String key : keySet) {
paramList.add(new BasicNameValuePair(key, params.get(key)));
}
}
httpost.setEntity(new UrlEncodedFormEntity(paramList, encode));
httpResponse = closeableHttpClient.execute(httpost);
HttpEntity entity = httpResponse.getEntity();
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
httpResponse.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try { //关闭连接、释放资源
closeableHttpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
return content;
}
/**
* 公钥加密
*
* @param content 内容
* @param publicKey 公钥
* @return 加密后的密文
* @throws Exception 异常信息
*/
public static String encrypt(String content, String publicKey) throws Exception {
//base64编码的公钥
byte[] decoded = org.apache.commons.codec.binary.Base64.decodeBase64(publicKey);
RSAPublicKey pubKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded));
//RSA加密
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, pubKey);
return Base64.encodeBase64String(cipher.doFinal(content.getBytes(StandardCharsets.UTF_8)));
}
public static String getPublicKey(){
BaseBean bb = new BaseBean();
String publicKey ="";
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));
//请求获取publicKey接口
Map<String,String> headers = new HashMap<>();
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","publicKeyUrl"));
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID","123");
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
String msg = httpGet(url,headers,null);
bb.writeLog("===获取publickey返回值===="+msg);
try {
org.json.JSONObject resMsg = new org.json.JSONObject(msg);
bb.writeLog("===获取publickey返回值===="+resMsg);
if(resMsg.has("pubKey")){
publicKey = Util.null2String(resMsg.get("pubKey").toString());
}
}catch (Exception e){
e.getMessage();
}
return publicKey;
}
//获取TG
public static String getST(String tgt,String emobileUrl){
BaseBean bb = new BaseBean();
String ST = "";
String retMsg = "";
Map<String,String> params = new HashMap<>();//参数
Map<String,String> headers = new HashMap<>();//headers
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));
//请求获取TG接口
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","stUrl"));
bb.writeLog("==获取TG=="+url);
//移动端首页地址
bb.writeLog("==移动端首页地址=="+emobileUrl);
//获取TGT
params = new HashMap<>();//参数
params.put("tgt",tgt);
params.put("service",emobileUrl);
bb.writeLog("==STparams=="+params);
headers = new HashMap<>();//headers
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID","123");
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
try {
retMsg = httpPostForm(url,params,headers,null);
bb.writeLog("===获取ST返回值===="+retMsg);
org.json.JSONObject resMsg = new org.json.JSONObject(retMsg);
bb.writeLog("===获取ST返回值resMsg===="+resMsg);
if(resMsg.has("ST")){
ST = Util.null2String(resMsg.get("ST").toString());
}
bb.writeLog("===获取ST===="+ST);
}catch(Exception e){
throw new RuntimeException(e);
}
return retMsg;
}
public static String getSysUrl(String sysid){
RecordSet rs = new RecordSet();
String url = "-1";
//查询建模
rs.executeQuery("select * from uf_otherSysInfo where id = ?" ,sysid);
if (rs.next()){
url = Util.null2String(rs.getString("xtdz"));
}else {
return "-1";
}
url = url.trim();
if (!StringUtil.isBlank(url)){
//判断是否带?号
if (url.indexOf("?") == -1){
url = url+"?";
}else{
url = url+"&";
}
};
return url;
}
%>
<%
RecordSet rs = new RecordSet();
BaseBean bb=new BaseBean();
RSA rsa = new RSA();
Map<String,String> params = new HashMap<>();//参数
Map<String,String> headers = new HashMap<>();//headers
JSONArray array = new JSONArray();
List<String> decriptList = new ArrayList<>();
String ST ="";//获取ST
bb.writeLog("进入获取简历jsp-->");
Map<String, Object> paramsMap = ParamUtil.request2Map(request);
String sysid = (String) paramsMap.get("sysid");
if (StringUtil.isBlank(sysid)){
out.print("sysid为空");
return;
}
String sysUrl = getSysUrl(sysid);
if ("-1".equals(sysUrl)){
out.print("系统url为空");
return;
}
String login_id = "";
String user_password = "";
User user = HrmUserVarify.getUser(request, response);
int uid = user.getUID();
bb.writeLog("uid-->"+uid);
rs.executeQuery("select id,loginid,password,createtime from EmobileLoginDetail where id=?", uid);
if(rs.next()){
login_id = Util.null2String(rs.getString("loginid"));
user_password = Util.null2String(rs.getString("password"));
}
bb.writeLog("login_id-->"+login_id);
bb.writeLog("user_password-->"+user_password);
//获取session
session = request.getSession(true);
String certified_token = Util.null2String(session.getAttribute("certified_token"));
bb.writeLog("获取sessionTGT=="+certified_token);
//获取cookie
Cookie[] cookies = request.getCookies();
bb.writeLog("获取cookies=="+cookies);
String idd = "";
if(cookies != null){
for(Cookie cookie:cookies){
bb.writeLog("获取cookiesName=="+cookie.getName());
if(cookie.getName().equals("loginidweaver")){
idd = cookie.getValue();
bb.writeLog("获取idd=="+idd);
}
}
}
//查询人员工号
RecordSet recordSet = new RecordSet();
String requestURI = request.getRequestURI();
bb.writeLog("请求路径="+requestURI);
Map<String, Object> useridMap = ParamUtil.request2Map(request);
bb.writeLog("人员id="+useridMap.get("userid"));
recordSet.executeQuery("select WORKCODE from HRMRESOURCE where id=?", Util.null2String(useridMap.get("userid")));
String workcode = "";
if (recordSet.next()){
workcode = Util.null2String(recordSet.getString("WORKCODE"));
}
bb.writeLog("人员workcode="+useridMap.get("workcode"));
//查询
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));//publicKey
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","stUrl"));//获取ST的url
String cockpitUrl = Util.null2String(bb.getPropValue("tjbankEMobileSSO","cockpitUrl"));
String tgturl = Util.null2String(bb.getPropValue("tjbankEMobileSSO","tgtUrl"));//请求获取TGT地址
//获取ST带着下游系统
if (!isEmpty(certified_token)){
String responseInfo = getST(certified_token,cockpitUrl);
bb.writeLog("进入responseInfo-->"+responseInfo);
if (isEmpty(responseInfo)){
out.print("单点系统接口返回值为null");
return;
}else {
org.json.JSONObject stMsg = new org.json.JSONObject(responseInfo);
if(stMsg.has("ST")){
ST = Util.null2String(stMsg.get("ST").toString());
}else{
out.print(Util.null2String(stMsg.getString("message")));
return;
}
String loginUrl = "";
// String remuseUrl = bb.getPropValue("tjbkremuse", "hbUrl");
String remuseUrl = sysUrl;
boolean isEm = Util.null2String(request.getHeader("user-agent")).indexOf("E-Mobile") > -1;
if(isEm == true){
loginUrl=remuseUrl+"ticket="+ST;
}
//loginUrl = "https://www.baidu.com/";
bb.writeLog("loginUrl-->"+loginUrl);
out.print("跳转路径-->"+loginUrl);
out.print("进入驾驶舱成功");
response.sendRedirect(loginUrl);
// request.getRequestDispatcher("loginUrl").forward(request,response);
// return;
}
}else {
String TGT ="";
String passWord ="";
String retMsg ="";
decriptList.add(login_id);
decriptList.add(user_password);
List<String> resultList = rsa.decryptList(request, decriptList);
String loginId = resultList.get(0);
String userPassword = resultList.get(1);
String publicKey = getPublicKey();
passWord = encrypt(user_password, publicKey);
params = new HashMap<>();//参数
params.put("username",loginId);
params.put("password",passWord);
bb.writeLog("==STparams=="+params);
headers = new HashMap<>();//headers
headers.put("API_KEY",API_KEY);
headers.put("MACH_ID","123");
headers.put("MACH_TYPE","0");
headers.put("MACH_IP","127.0.0.1");
retMsg = httpPostForm(tgturl,params,headers,null);
bb.writeLog("===获取TGT返回值retMsg===="+retMsg);
org.json.JSONObject resMsg = new org.json.JSONObject(retMsg);
bb.writeLog("===获取TGT返回值===="+resMsg);
if(resMsg.has("TGT")){
TGT = Util.null2String(resMsg.get("TGT").toString());
}
String responseInfo = getST(TGT,cockpitUrl);
if (isEmpty(responseInfo)){
out.print("单点系统接口返回值为null");
return;
}else {
org.json.JSONObject stMsg = new org.json.JSONObject(responseInfo);
if(stMsg.has("ST")){
ST = Util.null2String(stMsg.get("ST").toString());
}else{
out.print(Util.null2String(stMsg.getString("message")));
return;
}
String loginUrl = "";
// String remuseUrl = bb.getPropValue("tjbkremuse", "hbUrl");
String remuseUrl = sysUrl;
boolean isEm = Util.null2String(request.getHeader("user-agent")).indexOf("E-Mobile") > -1;
if(isEm == true){
loginUrl=remuseUrl+"ticket="+ST;
//loginUrl="http://123.151.115.199:8080/bi/PCFW?proc=1&action=viewer&hback=true&db=%E6%99%BA%E6%85%A7%E6%96%B9%E7%95%A5/%E5%89%8D%E7%BD%AE%E9%A1%B5.db&ticket="+ST;
}
bb.writeLog("loginUrl-->"+loginUrl);
out.print("跳转路径-->"+loginUrl);
out.print("进入驾驶舱成功");
response.sendRedirect(loginUrl);
// request.getRequestDispatcher("loginUrl").forward(request,response);
}
// out.print("进入驾驶舱系统失败,请先获取标识");
//return;
}
%>
 <script type="text/javascript">
<%--<%=httpPostRequest%>;--%>
// alert("00000");
// next();
//   function next(){
// alert("2222");
// console.log("111111111");
<%--console.log("http://10.16.103.18:9900/coremail/main.jsp?sid="+<%=sid%>);--%>
<%--console.log("sid="+<%=sid%>);--%>
<%--window.location.href= "http://10.16.103.18:9900/coremail/main.jsp?sid="+<%=sid%>;--%>
//   window.location.href= "https://www.baidu.com/";
<%--   }--%>
 </script>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,5 @@
appKey=obk_TIANJINBANK
appSecurity=fY2_k6|g$MoMR_uDNC1nFiep
url=https://ct.ctrip.com/SwitchAPI/Order/Ticket
orderurl=https://ct.ctrip.com/switchapi/Order/SearchOrder
workflowId=272

File diff suppressed because it is too large Load Diff

@ -0,0 +1,24 @@
package weaver.file;
import weaver.interfaces.encode.AES_IV;
public class test {
public static void main(String[] args) {
String loginid = "32715F3A426667E9FF2BA698555B94C9";
AES_IV aesIV = new AES_IV();
// AES的密钥长度最好是16位(不是必须)
String password = "ecology_nsh_2021";
// AES的向量长度必须为16位
String iv = "weaver_nsyh_2021";
aesIV.setPwd(password);
aesIV.setIv(iv);
// 加密
// System.out.println("加密前:" + loginid);
// String encodeResultStr = aesIV.encode(loginid);
//System.out.println("加密后:" + encodeResultStr);
// 解密
String decodeResultStr = aesIV.decode(loginid);
System.out.println(decodeResultStr);
}
}

@ -0,0 +1,199 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.integration.entrance.bean.OutterLoginBean" %>
<%@ page import="weaver.integration.entrance.service.EntranceService" %>
<%@ page import="weaver.integration.entrance.service.IOutterSysServer" %>
<%@ page import="weaver.integration.entrance.service.OutterSysServer" %>
<%@ page import="weaver.integration.entrance.service.permission.IPermissionService" %>
<%@ page import="weaver.integration.entrance.service.permission.PermissionService" %>
<%@ page import="weaver.integration.entrance.utils.StringUtils" %>
<%@ page import="weaver.integration.entrance.exceptions.OtherParamsEncryptException" %>
<%@ page import="weaver.integration.entrance.exceptions.AccountOrPasswordEncryptException" %>
<%@ page import="weaver.integration.logging.LoggerFactory" %>
<%@ page import="weaver.integration.logging.Logger" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="weaver.systeminfo.SystemEnv" %>
<%@ page import="java.util.Objects" %>
<%@ page import="cn.hutool.core.map.MapUtil" %>
<%@ page import="weaver.general.BaseBean" %>
<%--<script type="text/javascript" src="/js/jquery/jquery_wev8.js"></script>--%>
<%--<script src="http://libs.baidu.com/jquery/2.0.0/jquery.js"></script>--%>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<script language=javascript src="<%=weaver.general.GCONST.getContextPath()%>/wui/theme/ecology8/jquery/js/zDialog_wev8.js"></script>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page"/>
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page"/>
<jsp:useBean id="RecordSet1" class="weaver.conn.RecordSet" scope="page"/>
<%
Logger integration_logger = LoggerFactory.getLogger();
BaseBean bb = new BaseBean();
User this_user = HrmUserVarify.getUser(request,response);
//企业微信集成时构造的用户session会缺少loginid导致在企业微信中引用集成登录时因获取不到用户名导致无法单点登录。
if(Util.null2String(this_user.getLoginid()).equals("")){
//查询loginid
RecordSet.executeSql("select loginid from HrmResource where id="+this_user.getUID());
if(RecordSet.next()){
this_user.setLoginid(Util.null2String(RecordSet.getString("loginid")));
}
//重新设置用户session
request.getSession(true).setAttribute("weaver_user@bean", this_user);
}
IPermissionService permissionService=new PermissionService();
String operationType = permissionService.getOperationType(request);
String sysid = Util.null2String(request.getParameter("id"));// 系统标识
String coremailPath = Util.null2String(request.getParameter("coremailPath"));
integration_logger.info("sysid=========================" + sysid);
integration_logger.info("operationType=========================" + operationType);
integration_logger.info("coremailPath=========================" + coremailPath);
if ("".equals(operationType)) {
// 权限判断
// 得到有权限查看的集成登录
String access = permissionService.isAccess(sysid, request, response);
integration_logger.info("access=========================" + access);
baseBean.writeLog("access状态码->"+access);
if (!StringUtils.isBlank(access)){
if(access.startsWith("/")&&!access.startsWith(weaver.general.GCONST.getContextPath())){
access = weaver.general.GCONST.getContextPath()+access;
}
response.sendRedirect(access);
return;
}
}
EntranceService entranceService = new EntranceService();
IOutterSysServer outterSysServer = new OutterSysServer();
OutterLoginBean loginBean = null;
Map<String, Object> map = new HashMap<String, Object>();
try {
loginBean = entranceService.getLoginBean(outterSysServer, sysid, operationType, request, response);
map = entranceService.getUrl(outterSysServer, loginBean, operationType, request, response);
//coremail 特殊处理
if (!StringUtils.isEmpty(coremailPath)) {
integration_logger.info("处理coremailPath" + coremailPath);
String redirectUrl = MapUtil.getStr(map, "redirectUrl");
String isRedirect = MapUtil.getStr(map, "isRedirect");
integration_logger.info("处理coremail redirectUrl" + redirectUrl);
integration_logger.info("处理coremail isRedirect" + isRedirect);
if (!StringUtils.isEmpty(redirectUrl) && "true".equalsIgnoreCase(isRedirect)) {
String replaceUrl = redirectUrl.replace("#mail.list|{\"fid\":1}", coremailPath);
integration_logger.info("处理coremail replaceUrl" + replaceUrl);
map.put("redirectUrl", replaceUrl);
}
}
integration_logger.info("map=========================" + JSONObject.toJSONString(map));
} catch (ClassNotFoundException e) {
%>
<script language=javascript>
top.Dialog.alert("<%= SystemEnv.getHtmlLabelNames("508601",this_user.getLanguage()) %>", function () {
window.close();
}, 420, 130);
</script>
<%
}catch (NoSuchMethodException e){
e.printStackTrace();
%>
<script language=javascript>
top.Dialog.alert("<%= SystemEnv.getHtmlLabelNames("508602",this_user.getLanguage()) %>", function () {
window.close();
}, 420, 130);
</script>
<%
}catch (IllegalAccessException e){
%>
<script language=javascript>
top.Dialog.alert("<%=SystemEnv.getHtmlLabelNames("508603",this_user.getLanguage()) %>", function () {
window.close();
}, 420, 130);
</script>
<%
}catch (InstantiationException e){
%>
<script language=javascript>
top.Dialog.alert("<%= SystemEnv.getHtmlLabelNames("508604",this_user.getLanguage())%>", function () {
window.close();
}, 420, 130);
</script>
<%
}catch (NoClassDefFoundError e){
%>
<script language=javascript>
top.Dialog.alert("<%= SystemEnv.getHtmlLabelNames("508605",this_user.getLanguage())%>", function () {
window.close();
}, 420, 130);
</script>
<%
}catch (OtherParamsEncryptException e) {
%>
<script language=javascript>
top.Dialog.alert("<%= SystemEnv.getHtmlLabelNames("508614",this_user.getLanguage())%>", function () {
window.close();
}, 420, 130);
</script>
<%
} catch (AccountOrPasswordEncryptException e) {
%>
<script language=javascript>
top.Dialog.alert("<%= SystemEnv.getHtmlLabelNames("508615",this_user.getLanguage())%>", function () {
window.close();
}, 420, 130);
</script>
<%
}catch (Exception e){
%>
<script language=javascript>
top.Dialog.alert("系统异常,请联系管理员", function () {
window.close();
}, 420, 130);
</script>
<%
}
if (Objects.nonNull(map)){
if (map.get("isError")!= null&&"true".equals(map.get("isError"))){
%>
<script language=javascript>
top.Dialog.alert("<%= map.get("errorMsg") %>", function () {
window.close();
}, 420, 130);
</script>
<%
return;
}
baseBean.writeLog("进入前");
if (map.get("isRedirect")!=null && "true".equals(map.get("isRedirect"))){
baseBean.writeLog("redirectUrl111111=========================");
integration_logger.info("redirectUrl111111=========================");
response.sendRedirect(map.get("redirectUrl").toString());
return;
}
if (map.get("isRedirect")!=null && "false".equals(map.get("isRedirect"))){
out.println(map.get("redirectUrl").toString());
return;
}
}else {
integration_logger.error("map is null ====================================================");
}
%>

@ -0,0 +1,52 @@
<%@ page import="weaver.integration.entrance.bean.OutterLoginBean" %>
<%@ page import="weaver.integration.entrance.service.EntranceService" %>
<%@ page import="weaver.integration.entrance.service.IEntranceService" %>
<%@ page import="weaver.integration.entrance.service.IOutterSysServer" %>
<%@ page import="weaver.integration.entrance.service.impl.NcServer" %>
<%@ page import="weaver.integration.entrance.service.permission.IPermissionService" %>
<%@ page import="weaver.integration.entrance.service.permission.PermissionService" %>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%--<%@ include file="/systeminfo/init_wev8.jsp" %>--%>
<%@ page import="weaver.integration.logging.LoggerFactory" %>
<%@ page import="weaver.integration.logging.Logger" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.Objects" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="weaver.interfaces.encode.AES_IV" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%@ page import="com.icbc.api.internal.apache.http.impl.cookie.S" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="RecordSet1" class="weaver.conn.RecordSet" scope="page" />
<%
Logger integration_logger = LoggerFactory.getLogger();
BaseBean bb = new BaseBean();
String mhurl = "";
String encodeResultStr = "";
try {
User user = HrmUserVarify.getUser(request,response);
String loginid = user.getLoginid();
Map<String, Object> paramMap = ParamUtil.request2Map(request);
mhurl = (String) paramMap.get("mhurl");
AES_IV aesIV = new AES_IV();
// AES的密钥长度最好是16位(不是必须)
String password = "ecology_nsh_2021";
// AES的向量长度必须为16位
String iv = "weaver_nsyh_2021";
aesIV.setPwd(password);
aesIV.setIv(iv);
// 加密
encodeResultStr = aesIV.encode(loginid);
// out.println(mhurl);
response.sendRedirect(mhurl+"?loginid="+encodeResultStr);
}catch (Exception E){
bb.writeLog("mhxxerror====>"+E.getMessage());
response.sendRedirect(mhurl);
}
%>

@ -0,0 +1,268 @@
<html style="font-size: 100px;"><head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>敬请期待</title>
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<style>
* {margin: 0;padding: 0;/* -webkit-box-sizing: border-box;box-sizing: border-box; */}
body,html{-webkit-tap-highlight-color:transparent;-webkit-text-size-adjust:100%;}
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section, footer{display: block}
body{font-family:-apple-system-font,Helvetica Neue,Helvetica,sans-serif;}
i,ul{list-style:none;font-style: normal;}
.show { display: block!important}
.hidden{display: none!important}
a{ text-decoration:none; cursor:pointer;}
.k_border-radius{border: 1px solid #e0e0e0;-webkit-box-align:center;border-radius: 10px; }
@media only screen and (-webkit-min-device-pixel-ratio: 2) {
.k_border-radius{
position: relative;
border: 0;
}
.k_border-radius:before {
content: "";
width: 200%;
height: 200%;
position: absolute;
top: 0;
left: 0;
/*background: #f00;margin-bottom: 20px;*/
border: 1px solid #e0e0e0;
-webkit-transform: scale(0.5);
-webkit-transform-origin: 0 0;
padding: 1px;
border-radius: 10px;
pointer-events: none
}
}
.border_bottom{height: 1px;position: relative;margin-top: 3px;margin-bottom: 3px;}
.border_bottom:after{content: " ";
position: absolute;
bottom: 0;
height: 1px;
border-bottom: 1px solid #E5E5E5;
color: #E5E5E5;
-webkit-transform-origin: 0 100%;
transform-origin: 0 100%;
-webkit-transform: scaleY(0.5);
transform: scaleY(0.5);
left: 10px; right:10px}
.k_col_red {color: #dd5348;}
.k_col_green {color: #57ab53;}
.btn {
display: inline-block;
padding: 6px 12px;
margin-bottom: 0;
font-size: 14px;
font-weight: normal;
line-height: 1.5;
text-align: center;
white-space: nowrap;
vertical-align: middle;
-ms-touch-action: manipulation;
touch-action: manipulation;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-image: none;
border: 1px solid transparent;
border-radius: 4px
}
.button {
color: #666;
background-color: #EEE;
border-color: #EEE;
font-weight: 300;
font-size: 16px;
font-family: "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
text-decoration: none;
text-align: center;
line-height: 40px;
height: 40px;
padding: 0 40px;
margin: 0;
display: inline-block;
appearance: none;
cursor: pointer;
border: none;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-transition-property: all;
transition-property: all;
-webkit-transition-duration: .3s;
transition-duration: .3s;
}
.button-pill {
position: relative;top: 0;
border-radius: 200px;
background-color: #A5DE37;
border-color: #A5DE37;
color: #FFF;
-webkit-box-shadow: 0 7px 0 #8bc220, 0 8px 3px rgba(0, 0, 0, 0.3);
box-shadow: 0 7px 0 #8bc220, 0 8px 3px rgba(0, 0, 0, 0.3);
}
.layer-anim {
-webkit-animation-name: layer-bounceIn;
animation-name: layer-bounceIn
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-animation-duration: .3s;
animation-duration: .3s;
}
@-webkit-keyframes layer-bounceIn {
0% {
opacity: 0;
-webkit-transform: scale(.5);
transform: scale(.5)
}
100% {
opacity: 1;
-webkit-transform: scale(1);
transform: scale(1)
}
}
@keyframes layer-bounceIn {
0% {
opacity: 0;
-webkit-transform: scale(.5);
-ms-transform: scale(.5);
transform: scale(.5)
}
100% {
opacity: 1;
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1)
}
}
@-webkit-keyframes layer-bounceOut {
100% {
opacity: 0;
-webkit-transform: scale(.7);
transform: scale(.7)
}
30% {
-webkit-transform: scale(1.05);
transform: scale(1.05)
}
0% {
-webkit-transform: scale(1);
transform: scale(1)
}
}
@keyframes layer-bounceOut {
100% {
opacity: 0;
-webkit-transform: scale(.7);
-ms-transform: scale(.7);
transform: scale(.7)
}
30% {
-webkit-transform: scale(1.05);
-ms-transform: scale(1.05);
transform: scale(1.05)
}
0% {
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1)
}
}
.layer-anim-close {
-webkit-animation-name: layer-bounceOut;
animation-name: layer-bounceOut;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-animation-duration: .2s;
animation-duration: .2s
}
@media only screen and (min-width: 375px){
}
.verticalnext{
-webkit-animation: verticalnext 0.5s linear alternate infinite;
animation: verticalnext 0.5s linear alternate infinite;
}
@-webkit-keyframes verticalnext{
0%{-webkit-transform:scale(0.9);}
100%{-webkit-transform:scale(1);}
}
@keyframes verticalnext{
0%{transform:scale(0.9);}
100%{transform:scale(1);}
}
/* .container{background: #f1f0f6; position: relative;height: 100%;overflow: auto;font-size: 0.28rem;color: #222121;}
.container .iconfont{font-size: 0.16rem;}
*/
.mb_15{margin-bottom: 0.15rem}
.mb_20{margin-bottom: 0.2rem}
html,body{height: 100%;}
.ltgwx_warp{position: relative;background: #fff;height: 100%;overflow-y: auto;font-size: 0.16rem;-webkit-overflow-scrolling: touch;}
.ltgwx_tu{width: 100%;}
.ltgwx_tu > img{display: block;width: 100%;height: 100%;}
.jsy_n-bj{width: 3.72rem;height: 2.64rem;position: absolute;top: 30%;left: 50%;margin-left: -1.85rem;background: url('./error.png') no-repeat center center;background-size: contain;}
.jys_n-text{width: 100%;position: absolute;bottom: 0;right: 0;left: 0;padding-bottom: 1.3rem;text-align: center;}
.btn_s{display: inline-block;width: 4.2rem;height: 0.66rem;border: 1px solid #e0e0e0;line-height: 0.66rem;border-radius: 0.33rem;margin-bottom:0.3rem ;}
.btn_text{font-size: 0.64rem;font-weight: bold;color: #007bce;}
</style>
<script>
(function (doc, win) {
var docEl = doc.documentElement;
var resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize';
if (doc.documentElement.clientWidth > 750) {
docEl.style.fontSize = 50 * 2 + 'px';
return;
}
var recalc = function () {
var clientWidth = docEl.clientWidth;
if (!clientWidth) return;
docEl.style.fontSize = 50 * (clientWidth / 375) + 'px';
};
if (!doc.addEventListener) return;
win.addEventListener(resizeEvt, recalc, false);
doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window);
</script>
</head>
<body>
<div class="ltgwx_warp">
<div class="jsy_n-bj"></div>
<div class="jys_n-text">
<!-- <span class="btn_s">更多内容正在开发中</span> -->
<div class="jys_n-h1">
<span class="btn_text">请在PC端查看</span>
</div>
</div>
</div>
</body></html>

@ -0,0 +1,140 @@
package weaver.interfaces.workflow.action.javacode;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.company.DepartmentComInfo;
import weaver.interfaces.workflow.action.Action;
import weaver.general.BaseBean;
import weaver.soa.workflow.request.RequestInfo;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
/**
* Online custom action interface
*/
public class Action20230823041216 extends BaseBean implements Action {
/**
* After selecting aciton after the process path node, this method will be executed after the node is submitted.
*/
@Override
public String execute(RequestInfo request) {
try {
String insertsql = "INSERT INTO uf_tohgLog(REQUEST, CONTENT, ZT, ML, DDSJ, TSSJ, FJML, ZWID, FJID) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ? )";
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
//公文标题
String requestname = request.getRequestManager().getRequestname();
String requestId = request.getRequestid();
// 4获取表单名称
String tablename = request.getRequestManager().getBillTableName();
// 5查找表单内容
RecordSet rs = new RecordSet();
rs.execute("select * from " + tablename + " where requestid = " + requestId);
rs.next();
//是否推送合规 0 - 否 1 - 是
int isTohg = Util.getIntValue(rs.getString("tohg"), 1);
if (isTohg == 0){
return Action.SUCCESS;
}
//id表单主键
String mainid = rs.getString("id");
//公文编号
String fwwh = rs.getString("bh");
//发文部门名称
String ngbm = rs.getString("ngbm");
//成文时间
String cwrq = rs.getString("cwrq");
String ngr = rs.getString("ngr");
// String zw = rs.getString("zw"); //word格式
//生成的pdf
String zw = rs.getString("dwd");
String fj = rs.getString("fj");
User user = new User(Integer.parseInt(ngr));
//拼接数据
String subcompanyid = departmentComInfo.getSubcompanyid1(ngbm);
String departmentNames = departmentComInfo.getAllParentDepartmentBlankNames(ngbm, subcompanyid, "-");
departmentNames = "天津银行股份有限公司-"+departmentNames;
String context = "";
String flag = "|";
context = requestname + flag + fwwh + flag +departmentNames + flag + cwrq +flag+ user.getLoginid()+flag+user.getLastname()+flag;
//获取文件命
Map<String, String> fjName = getIdIMIDName(fj);
Map<String, String> zwName = getIdIMIDName(zw);
String fjStr = "";
String zwStr = "";
//附件
ArrayList<String> fileNameList = new ArrayList<>();
Set<Map.Entry<String, String>> entries = fjName.entrySet();
for (Map.Entry<String, String> entry : entries) {
String filename = entry.getValue();
if (fileNameList.contains(filename)){
String tepName= filename.contains(".")? filename.substring(0, filename.indexOf(".")) : "";
if(tepName!=null&&!"".equals(tepName)){
String extNameTemp = filename.contains(".")? filename.substring(filename.lastIndexOf(".") + 1) : "";
filename = tepName + "_"+entry.getKey()+"."+extNameTemp;
}
}else {
fileNameList.add(filename);
}
fjStr = fjStr + "&&"+ filename;
}
if (fjStr.startsWith("&&")){
fjStr = fjStr.substring(2);
}
fileNameList.clear();
//正文
Set<Map.Entry<String, String>> zwEntries = zwName.entrySet();
for (Map.Entry<String, String> entry : zwEntries) {
String filename = entry.getValue();
if (fileNameList.contains(filename)){
String tepName= filename.contains(".")? filename.substring(0, filename.indexOf(".")) : "";
if(tepName!=null&&!"".equals(tepName)){
String extNameTemp = filename.contains(".")? filename.substring(filename.lastIndexOf(".") + 1) : "";
filename = tepName + "_"+entry.getKey()+"."+extNameTemp;
}
}else {
fileNameList.add(filename);
}
zwStr = zwStr + "&&" + filename;
}
if (zwStr.startsWith("&&")){
zwStr = zwStr.substring(2);
}
context = context+zwStr+flag+fjStr+flag+requestId+flag;
Date date = new Date();
String time = new SimpleDateFormat("yyyy-MM-dd hh:mm").format(date);
rs.executeUpdate(insertsql,requestId,context,0,null,time,null,null,zw,fj);
} catch (Exception e) {
writeLog(e.getMessage()+ "||||||异常流程id==="+request.getRequestid());
e.printStackTrace();
//不管是否推送成功,都返回成功,不影响流程流转
return Action.SUCCESS;
}
// boolean error = false;
// if (error) {
// request.getRequestManager().setMessageid("90001");
// request.getRequestManager().setMessagecontent("System Abnormal Termination Process Submission");
// }
return Action.SUCCESS;
}
public static Map<String,String> getIdIMIDName(String ids ){
Map<String,String> idimageIDMap = new HashMap<>();
String sql = "select docid,df.imagefilename filename from docimagefile df left join imagefile imf on df.imagefileid = imf.imagefileid where DOCID in ("+ids+")";
RecordSet recordSet = new RecordSet();
recordSet.execute(sql);
while (recordSet.next()){
String docid = Util.null2String(recordSet.getString("docid"));
String filename = Util.null2String(recordSet.getString("filename"));
idimageIDMap.put(docid,filename);
}
return idimageIDMap;
};
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save