diff --git a/com/api/tjbk/TJBKAvatarWeb.java b/com/api/tjbk/TJBKAvatarWeb.java new file mode 100644 index 0000000..46fca44 --- /dev/null +++ b/com/api/tjbk/TJBKAvatarWeb.java @@ -0,0 +1,19 @@ +package com.api.tjbk; + + + + + +import com.engine.web.Avatar.Avatar; + +import javax.ws.rs.Path; + + +@Path("/avatar") +public class TJBKAvatarWeb extends Avatar { + +} + + + + diff --git a/com/api/tjbk/TJBKMeetWeb.java b/com/api/tjbk/TJBKMeetWeb.java index 2b1f647..628127f 100644 --- a/com/api/tjbk/TJBKMeetWeb.java +++ b/com/api/tjbk/TJBKMeetWeb.java @@ -10,3 +10,4 @@ import javax.ws.rs.Path; public class TJBKMeetWeb extends NewMeet { } + diff --git a/com/engine/msgcenter/util/MsgECToEM.java b/com/engine/msgcenter/util/MsgECToEM.java index ce9cfaa..9a833dc 100644 --- a/com/engine/msgcenter/util/MsgECToEM.java +++ b/com/engine/msgcenter/util/MsgECToEM.java @@ -9,6 +9,7 @@ import com.cloudstore.eccom.common.WeaIndexManager; import com.engine.msgcenter.constant.MsgToEMConstant; import com.engine.msgcenter.entity.MsgDataItem; import com.engine.systeminfo.util.AppSyncUtil; +import com.icbc.api.internal.apache.http.E; import com.weaver.file.Prop; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; @@ -498,13 +499,23 @@ public class MsgECToEM { } //如果是此消息id是需要修改的消息则替换为空 String msgTypeId = (Util.null2String(Prop.getPropValue("QC2586804", "msgtype"))); - if (msgTypeId.contains(messageBean.getMessageGroupType())){ - title=title.replace(":","\u0020"); - // if (title.indexOf("-")>0){ - // title = title.split("-")[1]; - // } - // agentid = "87"; + new BaseBean().writeLog("msgTypeId===>"+msgTypeId); + new BaseBean().writeLog("messageBean===>"+JSONObject.toJSONString(messageBean)); + try { + if (msgTypeId.contains(messageBean.getMessageGroupType())){ + + title=title.replace(":","\u0020"); + // if (title.indexOf("-")>0){ + // title = title.split("-")[1]; + // } + // agentid = "87"; + } + }catch (Exception e){ + new BaseBean().writeLog("Exception===>"+e.getMessage()); + e.printStackTrace(); } + + new BaseBean().writeLog("messageBean===>"+JSONObject.toJSONString(messageBean)); return sendMsgDataItem(senderid, userids, msgtype, agentid, send_type, title, content, linkurl, linkurl_pc, opentype, opentype_pc, canforward, callbackurl, sharetype, shareid, sharetypename, messageBean.getEmParams()); } diff --git a/com/engine/web/Avatar/Avatar.java b/com/engine/web/Avatar/Avatar.java new file mode 100644 index 0000000..bfb9f1d --- /dev/null +++ b/com/engine/web/Avatar/Avatar.java @@ -0,0 +1,152 @@ +package com.engine.web.Avatar; + + +import com.alibaba.fastjson.JSONObject; +import com.engine.cube.util.InterfaceUtil; +import lombok.extern.slf4j.Slf4j; +import tebie.applib.api.O; +import weaver.conn.RecordSet; +import weaver.general.StringUtil; +import weaver.general.Util; + + +import javax.servlet.ServletInputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +@Slf4j +public class Avatar { + + private static Pattern pattern = Pattern.compile("^[0-9,]+$"); + + @Path("/getAvatarList") + @POST + @Produces("application/json") + public String newMeet(@Context HttpServletRequest request, @Context HttpServletResponse response) throws IOException { + try { + InterfaceUtil interfaceUtil = new InterfaceUtil(); + JSONObject requestJson = getJson(request); + log.error("请求参数"+requestJson); + //验证权限 + JSONObject header = requestJson.getJSONObject("header"); + RecordSet rs = new RecordSet(); + String interfaceConfigId = ""; + rs.executeQuery("select id from CubeInterfaceConfig where interfacePK=?", "getAvatarList"); + if (rs.next()) { + interfaceConfigId = rs.getString("id"); + } + interfaceUtil.checkHeaderNode(header, interfaceConfigId); + //验证权限完成,处理业务 + JSONObject body = requestJson.getJSONObject("body"); + log.error("请求参数body"+body); + String workcode = body.getString("workcode"); + if (StringUtil.isEmpty(workcode)) { + return getResultStr("1", "工号为空", null); + } + //判断下工号是否为数字,含其他字符报错,防止下sql注入 + if (!containsOnlyDigitsAndCommas(workcode)) { + return getResultStr("1", "工号只能为数字", null); + } + List workcodeList = Arrays.asList(workcode.split(",")); + List workcodeStrList = workcodeList.stream() + .map(item -> "'" + item + "'") + .collect(Collectors.toList()); + // 封装数据 + ArrayList> dataList = new ArrayList<>(); + rs.executeQuery("select WORKCODE ,LASTNAME ,MESSAGERURL from HRMRESOURCE where LOGINID in ( " + String.join(",",workcodeStrList) + ")"); + log.error("头像sql"+"select WORKCODE ,LASTNAME ,MESSAGERURL from HRMRESOURCE where LOGINID in ( " + String.join(",",workcodeStrList) + ")"); + + while (rs.next()) { + HashMap data = new HashMap<>(); + data.put("LASTNAME", Util.null2String(rs.getString("LASTNAME"))); + data.put("WORKCODE", Util.null2String(rs.getString("WORKCODE"))); + data.put("MESSAGERURL", Util.null2String(rs.getString("MESSAGERURL"))); + dataList.add(data); + } + return getResultStr("0", "", dataList); + } catch (Exception e) { + log.error("错误"+e.getMessage()); + e.printStackTrace(); + return getResultStr("0", e.getMessage(), null); + } + + } + + public static JSONObject getJson(HttpServletRequest request) throws IOException { + //从前端获取输入字节流 + ServletInputStream requestInputStream = request.getInputStream(); + //将字节流转换为字符流,并设置字符编码为utf-8 + InputStreamReader ir = new InputStreamReader(requestInputStream, "utf-8"); + //使用字符缓冲流进行读取 + BufferedReader br = new BufferedReader(ir); + StringBuilder sb = new StringBuilder(); + try { + //开始拼装json字符串 + String line = null; + + while ((line = br.readLine()) != null) { + sb.append(line); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + requestInputStream.close(); + ir.close(); + br.close(); + } + JSONObject json = JSONObject.parseObject(sb.toString()); + return json; + // StringBuilder stringBuilder = new StringBuilder(); + // BufferedReader reader = request.getReader(); + // try { + // String line; + // while ((line = reader.readLine()) != null) { + // stringBuilder.append(line).append('\n'); + // } + // } finally { + // reader.close(); + // } + // return JSONObject.parseObject(stringBuilder.toString()) ; + } + + // + public static String getResultStr(String status, String msg, List> list) { + HashMap result = new HashMap<>(); + result.put("status", status); + result.put("msg", msg); + if (list != null) { + result.put("data", list); + } + return JSONObject.toJSONString(result); + } + + + public static boolean containsOnlyDigitsAndCommas(String input) { + // 使用正则表达式来匹配只包含数字和英文逗号的字符串 + Matcher matcher = pattern.matcher(input); + return matcher.matches(); + } + + public static void main(String[] args) { + ArrayList> dataList = new ArrayList<>(); + HashMap data = new HashMap<>(); + data.put("LASTNAME", Util.null2String("LASTNAME")); + data.put("WORKCODE", Util.null2String("WORKCODE")); + data.put("MESSAGERURL", Util.null2String("MESSAGERURL")); + dataList.add(data); + + System.out.println(getResultStr("0","1111",dataList)); + } + +} diff --git a/weaver/interfaces/workflow/action/javacode/Action20231015024217.java b/weaver/interfaces/workflow/action/javacode/Action20231015024217.java index fac5258..8a3400c 100644 --- a/weaver/interfaces/workflow/action/javacode/Action20231015024217.java +++ b/weaver/interfaces/workflow/action/javacode/Action20231015024217.java @@ -160,6 +160,7 @@ public class Action20231015024217 extends BaseBean implements Action { String mainid = ""; String fj = ""; String spdfj = ""; + String spwhscpdfwj = ""; //表单数据 if (rs.next()) { mainid = rs.getString("id"); @@ -184,17 +185,26 @@ public class Action20231015024217 extends BaseBean implements Action { toEsbBean.setRemark(Util.null2String(rs.getString("bz"))); fj = Util.null2String(rs.getString("fj")); spdfj = Util.null2String(rs.getString("spdfj")); + spwhscpdfwj = Util.null2String(rs.getString("clspdpdffj")); // String formData = rs.getString("formData"); } // 封装文件数组 //现在是id - List fjids = new ArrayList<>( Arrays.asList(fj.split(","))); + List fjids; + if(!StringUtil.isEmpty(fj)){ + fjids = new ArrayList<>( Arrays.asList(fj.split(","))); + }else { + fjids = new ArrayList<>(); + } // writeLog("fjids"+fjids); try { if (!StringUtil.isEmpty(spdfj)){ fjids.add(spdfj); } + if (!StringUtil.isEmpty(spwhscpdfwj)){ + fjids.add(spwhscpdfwj); + } ArrayList acsryArray = new ArrayList<>(); for (String fjid : fjids) { acsryItem acsryItem = new acsryItem(); diff --git a/weaver/interfaces/workflow/action/javacode/Action20231027045935.java b/weaver/interfaces/workflow/action/javacode/Action20231027045935.java new file mode 100644 index 0000000..57e1f29 --- /dev/null +++ b/weaver/interfaces/workflow/action/javacode/Action20231027045935.java @@ -0,0 +1,54 @@ +package weaver.interfaces.workflow.action.javacode; + +import weaver.conn.RecordSet; +import weaver.conn.RecordSetTrans; +import weaver.general.StringUtil; +import weaver.interfaces.workflow.action.Action; +import weaver.general.BaseBean; +import weaver.soa.workflow.request.RequestInfo; +/** + * Online custom action interface + * 修改流程紧急程度(测试环境) + */ +public class Action20231027045935 extends BaseBean implements Action{ + /** + * After selecting aciton after the process path node, this method will be executed after the node is submitted. + */ + + public static final String updateReqLevel = "update workflow_requestbase set requestlevel = 2 where requestid= ?"; + public String execute(RequestInfo request) { + + + //1:Log + writeLog("in my online edited action"); + + //2:Exception + // boolean error=true; + // if(error) { + // request.getRequestManager().setMessageid("90001"); + // request.getRequestManager().setMessagecontent("System Abnormal Termination Process Submission!"); + // } + //3:Get requestid + String requestId = request.getRequestid(); + if(StringUtil.isEmpty(requestId)){ + return Action.SUCCESS; + } + RecordSetTrans rs = request.getRequestManager() .getRsTrans(); + try { + rs.setAutoCommit(false); + rs.executeUpdate(updateReqLevel,requestId); + int updateCount = rs.getUpdateCount(); + writeLog("更新条数==>",updateCount); + if(updateCount > 1){ + rs.rollback(); + }else{ + rs.commit(); + } + } catch (Exception e) { + rs.rollback(); + e.printStackTrace(); + } + + return Action.SUCCESS; + } +} diff --git a/weaver/interfaces/workflow/action/javacode/Action20231027060156.java b/weaver/interfaces/workflow/action/javacode/Action20231027060156.java new file mode 100644 index 0000000..a270ce0 --- /dev/null +++ b/weaver/interfaces/workflow/action/javacode/Action20231027060156.java @@ -0,0 +1,54 @@ +package weaver.interfaces.workflow.action.javacode; + +import weaver.conn.RecordSet; +import weaver.conn.RecordSetTrans; +import weaver.general.StringUtil; +import weaver.interfaces.workflow.action.Action; +import weaver.general.BaseBean; +import weaver.soa.workflow.request.RequestInfo; +/** + * Online custom action interface + * 修改流程紧急程度(测试环境) + */ +public class Action20231027060156 extends BaseBean implements Action{ + /** + * After selecting aciton after the process path node, this method will be executed after the node is submitted. + */ + + public static final String updateReqLevel = "update workflow_requestbase set requestlevel = 2 where requestid= ?"; + public String execute(RequestInfo request) { + + + //1:Log + writeLog("in my online edited action"); + + //2:Exception + // boolean error=true; + // if(error) { + // request.getRequestManager().setMessageid("90001"); + // request.getRequestManager().setMessagecontent("System Abnormal Termination Process Submission!"); + // } + //3:Get requestid + String requestId = request.getRequestid(); + if(StringUtil.isEmpty(requestId)){ + return Action.SUCCESS; + } + RecordSetTrans rs = request.getRequestManager() .getRsTrans(); + try { + rs.setAutoCommit(false); + rs.executeUpdate(updateReqLevel,requestId); + int updateCount = rs.getUpdateCount(); + writeLog("更新条数==>",updateCount); + if(updateCount > 1){ + rs.rollback(); + }else{ + rs.commit(); + } + } catch (Exception e) { + rs.rollback(); + e.printStackTrace(); + } + + return Action.SUCCESS; + } +} diff --git a/weavernorth/com/getCockpit.jsp b/weavernorth/com/getCockpit.jsp deleted file mode 100644 index 51441b3..0000000 --- a/weavernorth/com/getCockpit.jsp +++ /dev/null @@ -1,472 +0,0 @@ -<%-- - 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" %> -<%! - //获取分页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 getSrcStr(String htmlStr, String type) { - Set srcs = new HashSet(); - String src = ""; - Pattern p_src; - Matcher m_src; -// String regEx_img = "]*?>"; //图片链接地址 - 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()) { -// 得到数据 - src = m_src.group(); -// 匹配中的src数据 - Matcher m = Pattern.compile("src\\s*=\\s*\"?(.*?)(\"|>|\\s+)").matcher(src); - while (m.find()) { - srcs.add(m.group(1)); - } - } - return srcs; - } - - - 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; - } - - /** - * 向指定URL发送GET方法的请求 - * - * @param url 发送请求的URL - * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 - * @return URL 所代表远程资源的响应结果 - */ - public static String sendGet(String url, String param) { - BaseBean bb = new BaseBean(); - String result = ""; - String responseMessage=""; - BufferedReader in = null; - HttpURLConnection connection = null; - try { - URL getUrl = new URL(url + "?" + param); - bb.writeLog("getUrl-->"+getUrl); - // 打开和URL之间的连接 - connection = (HttpURLConnection) getUrl.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"); - - // 配置本次连接的Content-type,form表单是"application/x-www-form-urlencoded",json是"application/json"等 - // 根据需求自己调整Content-type - connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); - // 设置连接主机服务器的超时时间:15000毫秒 - connection.setConnectTimeout(15000); - // 设置读取远程返回的数据时间:60000毫秒 - connection.setReadTimeout(60000); - // 设置连接方式:get - connection.setRequestMethod("GET"); - // 建立实际的连接,可不写,注意connection.getOutputStream会隐含的进行connect。 - connection.connect(); - - // 获取所有响应头字段 - Map> map = connection.getHeaderFields(); - // 遍历所有的响应头字段 - for (String key : map.keySet()) { - bb.writeLog(key + "--->" + map.get(key)); - } - - - // 定义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("发送GET请求出现异常!" + e); - e.printStackTrace(); - } - // 使用finally块来关闭输入流 - finally { - try { - if (in != null) { - in.close(); - } - if (connection != null) { - //关闭连接 - connection.disconnect(); - } - } catch (Exception e2) { - e2.printStackTrace(); - } - } - return result; - } - - /** - * 向指定 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-type,form表单是"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 params, Map 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 entry : headers.entrySet()) { - httpost.setHeader(entry.getKey(),entry.getValue()); - } - } - bb.writeLog("url="+url+"header="+headers+"encode="+encode); - bb.writeLog("params="+params); - //组织请求参数 - List paramList = new ArrayList (); - if(params != null && params.size() > 0){ - Set 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; - } - -%> -<% - RecordSet rs = new RecordSet(); - BaseBean bb=new BaseBean(); - Map params = new HashMap<>();//参数 - Map headers = new HashMap<>();//headers - JSONArray array = new JSONArray(); - String ST ="";//获取ST - bb.writeLog("进入getCockpit.jap-->"); - - User user = HrmUserVarify.getUser(request, response); - int uid = user.getUID(); - session = request.getSession(true); - String certified_token = Util.null2String(session.getAttribute("certified_token")); - bb.writeLog("获取sessionTGT=="+certified_token); - bb.writeLog("uid-->"+uid); - //查询邮箱号 - //http://${单点系统地址}/sso_server/api/v1/thirdSystem/getList - -// String httpPostRequest="https://www.baidu.com/"; - String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key")); - String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO","stUrl"));//获取ST的url - String cockpitUrl = Util.null2String(bb.getPropValue("tjbankEMobileSSO","cockpitUrl")); - String thirdUrl = Util.null2String(bb.getPropValue("tjbankEMobileSSO","thirdUrl"));//获取下流系统 - //thirdUrl - //获取ST,带着下游系统 - if (!isEmpty(certified_token)){ - params = new HashMap<>();//参数 - params.put("tgt",certified_token); - - 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"); - String result = httpPostForm(thirdUrl,params,headers,null); - org.json.JSONObject thirdMsg = new org.json.JSONObject(result); - bb.writeLog("进入thirdMsg-->"+thirdMsg); - - //String addressUrl="http://${单点系统地址}/sso_server/api/v1/tickets/createST"; - params = new HashMap<>();//参数 - params.put("tgt",certified_token); - params.put("service",cockpitUrl); - 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"); -// String param="?user_at_domain%3D"+email; - String responseInfo = httpPostForm(url,params,headers,null); - bb.writeLog("进入TGT-->"+certified_token); - bb.writeLog("进入接口地址-->"+url); - 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){ - bb.writeLog("是否进来了"); - //loginUrl="http://123.151.115.199:8080/bi/APPFW?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; - loginUrl="http://168.5.72.9:8080/bi/APPFW?ticket="+ST; - bb.writeLog("是否进来了loginUrl=="+loginUrl); - } - } - //String loginUrl="http://10.16.103.18:9900/coremail/main.jsp?sid="+sid; -// httpPostRequest = httpPostRequest(null, loginUrl, null); - bb.writeLog("loginUrl-->"+loginUrl); -// bb.writeLog("跳转路径-->"+httpPostRequest); - out.print("跳转路径-->"+loginUrl); - out.print("进入驾驶舱成功"); - response.sendRedirect(loginUrl); -// return; - } - }else { - out.print("进入驾驶舱系统失败,请先获取标识"); -// response.sendRedirect(httpPostRequest); - return; - } - -%> - -  diff --git a/weavernorth/com/getCockpitBak.jsp b/weavernorth/com/getCockpitBak.jsp deleted file mode 100644 index 448d9f9..0000000 --- a/weavernorth/com/getCockpitBak.jsp +++ /dev/null @@ -1,61 +0,0 @@ -<%@ page import="weaver.conn.RecordSet" %> -<%@ page import="weaver.general.BaseBean" %> -<%@ page import="com.alibaba.fastjson.JSONObject" %> -<%@ page import="com.alibaba.fastjson.JSONArray" %> -<%@ page language="java" contentType="text/html; charset=UTF-8"%> -<%! - private boolean isEmpty(String str) { - if ("".equals(str) ||"(null)".equals(str) || str == null) { - return true; - } else { - return false; - } - } -%> -<% - RecordSet rs = new RecordSet(); - BaseBean bb=new BaseBean(); - JSONArray array = new JSONArray(); - JSONObject json = new JSONObject(); - bb.writeLog("进入getdeleCount.jsp-->"); - String resquestid=request.getParameter("resquestid"); - int count=0; - String mainWorkflowid = "0"; - String touchnodeid = "0"; - if (!isEmpty(resquestid)){ - String queryMainWorkflowidSql = "select workflowid from workflow_requestbase where requestid="+resquestid; - bb.writeLog("queryMainWorkflowidSql-->"+queryMainWorkflowidSql); - rs.execute(queryMainWorkflowidSql); - if(rs.next()){ - mainWorkflowid = rs.getString(1); - } - - String queryTouchNodeidSql = "select touchnodeid from uf_sczlc where workflowid="+mainWorkflowid; - bb.writeLog("queryTouchNodeidSql-->"+queryTouchNodeidSql); - rs.execute(queryTouchNodeidSql); - if(rs.next()){ - touchnodeid = rs.getString(1); - } - - String sql="select COUNT(*) as cnt from workflow_requestbase where mainrequestid="+resquestid+" and workflowid in (select workflowid subWorkflowId from workflow_requestbase where requestid in (select subrequestid from workflow_subwfrequest where subrequestid in (select requestid from workflow_requestbase where mainrequestid="+resquestid+" and triggernode = "+touchnodeid+")))"; - bb.writeLog("sql-->"+sql); - rs.execute(sql); - if (rs.next()){ - count=rs.getInt("cnt"); - json.put("code",0); - json.put("count",count); - array.add(json); - out.print(array.toJSONString()); - }else { - json.put("code",1); - json.put("errMsg","查无此resquestid"); - array.add(json); - out.print(array.toJSONString()); - } - }else { - json.put("code",1); - json.put("errMsg","resquestid为空"); - array.add(json); - out.print(array.toJSONString()); - } -%> diff --git a/weavernorth/com/getdeleCount.jsp b/weavernorth/com/getdeleCount.jsp index ce8c1ff..d2ecd5d 100644 --- a/weavernorth/com/getdeleCount.jsp +++ b/weavernorth/com/getdeleCount.jsp @@ -2,6 +2,7 @@ <%@ page import="weaver.general.BaseBean" %> <%@ page import="com.alibaba.fastjson.JSONObject" %> <%@ page import="com.alibaba.fastjson.JSONArray" %> +<%@ page import="java.util.ArrayList" %> <%@ page language="java" contentType="text/html; charset=UTF-8"%> <%! private boolean isEmpty(String str) { @@ -30,14 +31,17 @@ mainWorkflowid = rs.getString(1); } + ArrayList touchnodeids = new ArrayList<>(); String queryTouchNodeidSql = "select touchnodeid from uf_sczlc where workflowid="+mainWorkflowid; bb.writeLog("queryTouchNodeidSql-->"+queryTouchNodeidSql); rs.execute(queryTouchNodeidSql); if(rs.next()){ touchnodeid = rs.getString(1); + touchnodeids.add(touchnodeid); } - String sql="select COUNT(*) as cnt from workflow_requestbase where mainrequestid="+resquestid+" and workflowid in (select workflowid subWorkflowId from workflow_requestbase where requestid in (select subrequestid from workflow_subwfrequest where subrequestid in (select requestid from workflow_requestbase where mainrequestid="+resquestid+" and triggernode = "+touchnodeid+")))"; + // String sql="select COUNT(*) as cnt from workflow_requestbase where mainrequestid="+resquestid+" and workflowid in (select workflowid subWorkflowId from workflow_requestbase where requestid in (select subrequestid from workflow_subwfrequest where subrequestid in (select requestid from workflow_requestbase where mainrequestid="+resquestid+" and triggernode = "+touchnodeid+")))"; + String sql="select COUNT(*) as cnt from workflow_requestbase where mainrequestid="+resquestid+" and workflowid in (select workflowid subWorkflowId from workflow_requestbase where requestid in (select subrequestid from workflow_subwfrequest where subrequestid in (select requestid from workflow_requestbase where mainrequestid="+resquestid+" and triggernode in ( "+String.join(",",touchnodeids)+"))))"; bb.writeLog("sql-->"+sql); rs.execute(sql); if (rs.next()){