no message

master
rengp 2 years ago
parent dcfa4f526b
commit cca5205632

File diff suppressed because it is too large Load Diff

@ -0,0 +1,48 @@
package com.api.tjbk.Result;
public class Result {
private Object data;
private Integer code;
private String errMsg;
public Result(Object data, Integer code, String errMsg) {
this.data = data;
this.code = code;
this.errMsg = errMsg;
}
public Result(Object data) {
this.data = data;
this.code = 200;
}
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;
}
public Result(Integer code, String errMsg) {
this.code = code;
this.errMsg = errMsg;
}
}

@ -0,0 +1,156 @@
package com.api.tjbk;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import weaver.conn.RecordSet;
import weaver.general.StringUtil;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.Map;
/**
*
*
* @author wangj
* @version 1.00
* @Date 2022/8/22
*/
@Path("/tjbk/MsgTopDialog")
public class TJBKMsgTopDialog {
@GET
@Path("/getDialog")
@Produces(MediaType.TEXT_PLAIN)
public String getVersionInfo(@Context HttpServletRequest request, @Context HttpServletResponse response) {
Map<String, Object> apidatas = new HashMap<String, Object>();
try {
//获取当前用户
User user = HrmUserVarify.getUser(request, response);
RecordSet rs = new RecordSet();
RecordSet recordSet = new RecordSet();
JSONArray conArr = new JSONArray();
JSONObject dataObj = new JSONObject();
String userid = user.getUID() + "";
boolean isdialog = true;
LocalDate now = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String nowStr = now.format(formatter);
String id = "";
String title = "";
String btn = "";
String url = "";
String backgroundAddress = "";
String sql = "select * from uf_MsgTopDialog where startDate <= ? and endDate >= ? order by id desc";
rs.executeQuery(sql, nowStr, nowStr);
while (rs.next()) {
String dataid = Util.null2String(rs.getString("id"));
String scope = Util.null2String(rs.getString("scope"));
String role = Util.null2String(rs.getString("role"));
boolean isLatest = getLatestData(dataid, user, recordSet, scope, role);
if (isLatest) {
id = Util.null2String(rs.getString("id"));
title = Util.null2String(rs.getString("title"));
btn = Util.null2String(rs.getString("btn"));
url = Util.null2String(rs.getString("url"));
backgroundAddress = Util.null2String(rs.getString("backgroundAddress"));
break;
}
}
if (!"".equals(id)) {
sql = "select count(1) as sl from uf_MsgTopDialog_dt2 where mainid = '" + id + "' and hrmid = '" + userid + "'";
rs.execute(sql);
while (rs.next()) {
if (Util.getIntValue(rs.getString("sl")) > 0) {
isdialog = false;
}
}
} else {
isdialog = false;
}
if (isdialog){
dataObj.put("id", id);
dataObj.put("tilte", title);
dataObj.put("backgroundAddress", backgroundAddress);
dataObj.put("btn", btn);
dataObj.put("url", url);
}
apidatas.put("data", dataObj);
apidatas.put("api_status", true);
} catch (Exception e) {
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "getVersionInfo catch exception : " + e.getMessage());
}
return JSONObject.toJSONString(apidatas);
}
@GET
@Path("/addDialogUser")
@Produces(MediaType.TEXT_PLAIN)
public String addDialogUser(@Context HttpServletRequest request, @Context HttpServletResponse response) {
Map<String, Object> apidatas = new HashMap<String, Object>();
try {
//获取当前用户
User user = HrmUserVarify.getUser(request, response);
String userid = user.getUID() + "";
String mainid = Util.null2String(request.getParameter("id"));
String sql = "insert into uf_MsgTopDialog_dt2 (mainid,hrmid) values ('" + mainid + "','" + userid + "')";
RecordSet rs = new RecordSet();
boolean status = rs.execute(sql);
apidatas.put("status", status);
apidatas.put("api_status", true);
} catch (Exception e) {
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "addDialogUser catch exception : " + e.getMessage());
}
return JSONObject.toJSONString(apidatas);
}
private boolean getLatestData(String id, User user, RecordSet recordSet, String scope, String role) {
HrmUserVarify hrmUserVarify = new HrmUserVarify();
if ("0".equals(scope)) {
//角色
if (!StringUtil.isEmpty(role)) {
String[] roleArr = role.split(",");
for (String roleid : roleArr) {
boolean b = hrmUserVarify.checkUserRole(roleid, user, user.getUserDepartment() + "");
if(b){
return true;
}
}
}
} else if ("1".equals(scope)) {
//多人力
String sql = "select count(main.id) cnt from uf_MsgTopDialog main left join uf_MsgTopDialog_dt1 dt on main.id = dt.mainid where main.id = ? and dt.hrmid = ?";
recordSet.executeQuery(sql,id,user.getUID());
if(recordSet.next()){
int cnt = recordSet.getInt("cnt");
if(cnt > 0 ){
return true;
}
}
}
return false;
}
}

@ -0,0 +1,170 @@
package com.api.tjbk;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.api.tjbk.Result.Result;
import com.engine.common.util.ParamUtil;
import com.icbc.api.internal.apache.http.impl.cookie.S;
import weaver.conn.RecordSet;
import weaver.general.StringUtil;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.HashMap;
import java.util.Map;
/**
*
*
* @author wangj
* @version 1.00
* @Date 2022/8/22
*/
@Path("/tjbk/yearReport")
public class TJBKYearReport {
@GET
@Path("/getDetail")
public String getVersionInfo(@Context HttpServletRequest request, @Context HttpServletResponse response) {
Map<String, Object> apidatas = new HashMap<String, Object>();
Map<String, Object> paramMap = ParamUtil.request2Map(request);
RecordSet recordSet = new RecordSet();
String userId = (String) paramMap.get("userId");
// if (StringUtil.isEmpty(userId)){
// return JSONObject.toJSONString(new Result(500,"人员id为空"));
// }
String sql = "select * from uf_personreport where ry = ? and nd = ? order by id desc";
LocalDate now = LocalDate.now();
int year = now.getYear();
recordSet.executeQuery(sql,userId,year);
HashMap<String, String> firstMap = new HashMap<>();
String inputDateStr = "2023-08-07";
// 解析输入日期
LocalDate inputDate = LocalDate.parse(inputDateStr, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
// 转换格式
String outputDateStr = inputDate.format(DateTimeFormatter.ofPattern("yyyy年M月d日"));
// 计算距离今天的天数
LocalDate today = LocalDate.now();
long daysBetween = ChronoUnit.DAYS.between(inputDate, today);
// firstMap.put("ksrq",outputDateStr);
// firstMap.put("jjts",daysBetween+"");
System.out.println("距离今天的天数: " + daysBetween);
HashMap<String, String> secondMap = new HashMap<>();
HashMap<String, String> thirdMap = new HashMap<>();
HashMap<String, String> fourthMap = new HashMap<>();
HashMap<String, String> fifthMap = new HashMap<>();
HashMap<String, String> sixthMap = new HashMap<>();
HashMap<String, String> seventhMap = new HashMap<>();
HashMap<String, String> eighthMap = new HashMap<>();
HashMap<String, Object> ninthMap = new HashMap<>();
if(recordSet.next()){
secondMap.put("ksrq",outputDateStr);
secondMap.put("jjts",daysBetween+"");
secondMap.put("ddcs",Util.null2String(recordSet.getString("ddcs")));
secondMap.put("yygs",Util.null2String(recordSet.getString("yygs")));
secondMap.put("gwbllcxs",Util.null2String(recordSet.getString("gwbllcxs")));
secondMap.put("swsplcxs",Util.null2String(recordSet.getString("swsplcxs")));
thirdMap.put("tgwzzs",Util.null2String(recordSet.getString("tgwzzs")));
thirdMap.put("zshywz1",Util.null2String(recordSet.getString("zshywz1")));
thirdMap.put("zshywz2",Util.null2String(recordSet.getString("zshywz2")));
thirdMap.put("zshywz3",Util.null2String(recordSet.getString("zshywz3")));
fourthMap.put("jsxxzongshu",Util.null2String(recordSet.getString("jsxxzongshu")));
fourthMap.put("ysxljfqhycs",Util.null2String(recordSet.getString("ysxljfqhycs")));
fourthMap.put("grhycycs",Util.null2String(recordSet.getString("grhycycs")));
fourthMap.put("zjgxwd",Util.null2String(recordSet.getString("zjgxwd")));
fourthMap.put("grwdgx",Util.null2String(recordSet.getString("grwdgx")));
fourthMap.put("xwhycs",Util.null2String(recordSet.getString("xwhycs")));
fifthMap.put("sktxysfxs",Util.null2String(recordSet.getString("sktxysfxs")));
fifthMap.put("sktxcycs",Util.null2String(recordSet.getString("sktxysfxs")));
sixthMap.put("gczgw",Util.null2String(recordSet.getString("gczgw")));
sixthMap.put("ljjyzz",Util.null2String(recordSet.getString("ljjyzz")));
sixthMap.put("ljjp",Util.null2String(recordSet.getString("ljjp")));
sixthMap.put("jjrclgw",Util.null2String(recordSet.getString("jjrclgw")));
sixthMap.put("qnljclgw",Util.null2String(recordSet.getString("qnljclgw")));
sixthMap.put("cgbl",Util.null2String(recordSet.getString("cgbl")));
sixthMap.put("dycclgwrq",Util.null2String(recordSet.getString("dycclgwrq")));
seventhMap.put("ljsyslcs",Util.null2String(recordSet.getString("ljsyslcs")));
seventhMap.put("qgzydf",Util.null2String(recordSet.getString("qgzydf")));
seventhMap.put("swsplcgs",Util.null2String(recordSet.getString("swsplcgs")));
seventhMap.put("nddjlzgyy",Util.null2String(recordSet.getString("nddjlzgyy")));
seventhMap.put("ljdjcs",Util.null2String(recordSet.getString("ljdjcs")));
seventhMap.put("zaydyy",Util.null2String(recordSet.getString("zaydyy")));
eighthMap.put("pjmrzxrs",Util.null2String(recordSet.getString("pjmrzxrs")));
eighthMap.put("pjmrzxrszb",Util.null2String(recordSet.getString("pjmrzxrszb")));
eighthMap.put("ljdloacs",Util.null2String(recordSet.getString("ljdloacs")));
// eighthMap.put("dlcscgrszb",Util.null2String(recordSet.getString("dlcscgrszb")));
}
String gjc = Util.null2String(recordSet.getString("gjc"));
if ("统帅全局".equals(gjc)){
ninthMap.put("gjc","统帅全局");
ninthMap.put("filed1",Util.null2String(recordSet.getString("sktxcycs")));
ninthMap.put("filed2","2023-12-05 23:24:45");
}else if("天行守护者".equals(gjc)){
ninthMap.put("gjc","天行守护者");
ninthMap.put("filed1",Util.null2String(recordSet.getString("qnljclgw")));
ninthMap.put("filed2","2023-12-05");
ninthMap.put("filed3","27");
}else if("勇担重担实干家".equals(gjc)){
ninthMap.put("gjc","勇担重担实干家");
ninthMap.put("filed1",1356);
ninthMap.put("filed2","2023-12-05 23:24:45");
}else if("智慧OA最亲密的朋友".equals(gjc)){
ninthMap.put("gjc","智慧OA最亲密的朋友");
ninthMap.put("filed1",112);
ninthMap.put("filed2","90%");
}else if("社交天花板".equals(gjc)){
ninthMap.put("gjc","社交天花板");
ninthMap.put("filed1",112);
ninthMap.put("filed2","39");
ninthMap.put("filed3","90%");
}else if("人形公文处理机".equals(gjc)){
ninthMap.put("gjc","人形公文处理机");
ninthMap.put("filed1","547");
ninthMap.put("filed2","90%");
}else if("宝藏事务挖掘机".equals(gjc)){
ninthMap.put("gjc","宝藏事务挖掘机");
ninthMap.put("filed1","547");
ninthMap.put("filed2","90%");
}
ninthMap.put("url",getGJCUrl(gjc));
apidatas.put("first",firstMap);
apidatas.put("second",secondMap);
apidatas.put("third",thirdMap);
apidatas.put("fourth",fourthMap);
apidatas.put("fifth",fifthMap);
apidatas.put("sixth",sixthMap);
apidatas.put("seventh",seventhMap);
apidatas.put("eighth",eighthMap);
apidatas.put("ninth",ninthMap);
return JSONObject.toJSONString(new Result(apidatas)) ;
}
private String getGJCUrl(String gjc) {
RecordSet recordSet = new RecordSet();
recordSet.executeQuery("select * from uf_reportkeyword where name = ?" ,gjc);
recordSet.next();
return recordSet.getString("url");
}
}

@ -89,8 +89,6 @@ public class MsgPush_GetMsgBeansCmdProxyTitle extends AbstractCommandProxy<List<
newTitle = title;
}
messageBean.setTitle(newTitle);
messageBean.setBizTitle(null);
messageBean.setBizType(null);
//流程类型 3 是特急 2 是重要
if("3".equals(requestlevel)||"2".equals(requestlevel)){
messageBeans.add(messageBean);

@ -0,0 +1,15 @@
package com.engine.custom.corn.Thread;
import weaver.conn.RecordSet;
import weaver.conn.RecordSetDataSource;
public class YearReportThread implements Runnable {
@Override
public void run() {
RecordSetDataSource em7rs = new RecordSetDataSource("em7");
RecordSetDataSource emprs = new RecordSetDataSource("emp_msg");
RecordSet rs = new RecordSet();
}
}

@ -16,7 +16,9 @@ public class WeekReportCorn extends BaseCronJob {
BaseBean baseBean = new BaseBean();
@Override
public void execute() {
writeLog("年度报告开始执行");
RecordSet recordSet = new RecordSet();
deleteHistoryData(recordSet);
int startNum = 0;
int endNum = 0;
recordSet.executeQuery("select count(1) cnt from xlbb_grzbzz_xda");
@ -32,6 +34,10 @@ public class WeekReportCorn extends BaseCronJob {
sendMsg(startNum,endNum);
}
private void deleteHistoryData(RecordSet recordSet) {
recordSet.executeUpdate("delete uf_personreport where ry != 1");
}
private void writeLog(String log){
baseBean.writeLog(log);
}

@ -0,0 +1,198 @@
package com.engine.custom.corn;
import com.engine.custom.corn.util.ReportUtil;
import com.icbc.api.internal.apache.http.impl.cookie.S;
import com.wbi.util.Util;
import org.docx4j.wml.R;
import weaver.conn.RecordSet;
import weaver.conn.RecordSetDataSource;
import weaver.file.Prop;
import weaver.interfaces.schedule.BaseCronJob;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.DayOfWeek;
import java.util.*;
import java.util.stream.Collectors;
public class YearReportCorn extends BaseCronJob {
String insertSql = "INSERT INTO uf_personreport( RY, ND, DDCS, TGWZZS, ZSHYWZ1, ZSHYWZ2, ZSHYWZ3, YSXLJFQHYCS, GRHYCYCS, ZJGXWD, GRWDGX,SKTXYSFXS, SKTXCYCS, GCZGW, LJJYZZ, LJJP, JJRCLGW, QNLJCLGW, CGBL, LJSYSLCS, QGZYDF, NDDJLZGYY,LJDJCS, ZAYDYY, LJSYCS, PJMRZXRS, PJMRZXRSZB, LJDLOACS, DLCSCGRSZB, YYGS, GWBLLCXS, SWSPLCXS,JSXXZONGSHU, XWHYCS, SWSPLCGS,FORMMODEID)" +
"VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
@Override
public void execute() {
RecordSetDataSource em7rs = new RecordSetDataSource("em7");
RecordSetDataSource emprs = new RecordSetDataSource("emp_msg");
RecordSet rs = new RecordSet();
RecordSet rs2 = new RecordSet();
RecordSet rs3 = new RecordSet();
// 获取总人数
String sql = "select count(*) cnt from Hrmresource";
rs.executeQuery(sql);
Integer cnt = 0;
if (rs.next()){
cnt = rs.getInt("cnt");
}
//按照模板插入写死的值
Map<String, String> map = getConfigRecord();
int pageTotle = (int) Math.ceil(cnt/100);
String sqlhrm = "select * from Hrmresource ORDER BY id LIMIT 100 OFFSET ";
for (int i = 0; i < pageTotle; i++) {
String sqlhrmWhere = sqlhrm + i*100;
rs.executeQuery(sqlhrmWhere);
while (rs.next()){
String id = rs.getString("id");
rs2.executeUpdate(insertSql,id,map.get("ND"),map.get("DDCS"),map.get("TGWZZS"),map.get("ZSHYWZ1"),map.get("ZSHYWZ2"),map.get("ZSHYWZ3"),map.get("YSXLJFQHYCS"),map.get("GRHYCYCS"),map.get("ZJGXWD"),map.get("GRWDGX"),map.get("SKTXYSFXS"),map.get("SKTXCYCS"),map.get("GCZGW"),map.get("LJJYZZ"),map.get("LJJP"),map.get("JJRCLGW"),map.get("QNLJCLGW"),map.get("CGBL"),map.get("LJSYSLCS"),map.get("QGZYDF"),map.get("NDDJLZGYY"),map.get("LJDJCS"),map.get("ZAYDYY"),map.get("LJSYCS"),map.get("PJMRZXRS"),map.get("PJMRZXRSZB"),map.get("LJDLOACS"),map.get("DLCSCGRSZB"),map.get("YYGS"),map.get("GWBLLCXS"),map.get("SWSPLCXS"),map.get("JSXXZONGSHU"),map.get("XWHYCS"),map.get("SWSPLCGS"),map.get("FORMMODEID"));
}
}
//更新总行的数量
//消息总数
int msgCount = ReportUtil.getMsgCount();
//分享文档总数
int ShareDOCCount = ReportUtil.getShareDOCCount();
//会议总次数
int meetCount = ReportUtil.getMeetCount();
String updateTotalSql = "update uf_personreport set jsxxzongshu = ? ,zjgxwd = ? ,ysxljfqhycs = ? where ry != 1";
rs.executeUpdate(updateTotalSql,msgCount,ShareDOCCount,meetCount);
//获取节假日日期字符串查询条件
List<String> allWeekendsOfYear = getAllWeekendsOfYear(2023).stream()
.map(s -> "'" + s + "'")
.collect(Collectors.toList());;
String weekStr = String.join(",",allWeekendsOfYear);
String wfids = Prop.getPropValue("yearReport", "gwwfid");
String AffairsWfid = getAffairsWfid(rs);
String updateuserSql = "update uf_personreport set grhycycs = ? ,grwdgx = ? ,jjrclgw = ? ,qnljclgw = ?,cgbl = ? ,ljdloacs = ?,clgwzwrq = ?,grswsps = ?,grcylts = ?,grfsxxrs = ?,grfsxxqlss=? where ry = ?";
//开始更新个人的不同的数据
for (int i = 0; i < pageTotle; i++) {
String sqlhrmWhere = sqlhrm + i*100;
rs.executeQuery(sqlhrmWhere);
while (rs.next()){
String id = rs.getString("id");
int shareDocCnt = Util.getIntValue(ReportUtil.getShareDOCCountbyUserid(rs2, id)+"",0) ;
int personMeetCount = Util.getIntValue(ReportUtil.getMeetCountByUserid(rs2, id)+"",0) ;
int yearOfficialWfCount = Util.getIntValue(ReportUtil.getYearOfficialWfCount(rs2, id, wfids)+"",0) ;
int holidayOfficialWfCount = Util.getIntValue(ReportUtil.getHolidayOfficialWfCount(rs2, id, wfids,weekStr)+"",0) ;
int officialWfCountPercentage = Util.getIntValue(ReportUtil.getOfficialWfCountPercentage(rs2, id, wfids,weekStr,cnt)+"",0) ;
String lastTimeDate = Util.null2String(ReportUtil.getOfficialWflastTimeDate(rs2, id, wfids)) ;
int loginDayCount = Util.getIntValue(ReportUtil.getLoginDayCount(rs2, id)+"",0) ;
int AffairsWfCount = Util.getIntValue(ReportUtil.getYearAffairsWfCount(rs2, id, AffairsWfid)+"",0);
int MsgCount = Util.getIntValue(ReportUtil.getMsgCountByUserid(emprs, id)+"",0);
int PeopleCount = Util.getIntValue(ReportUtil.getMsgPeopleCountByUserid(emprs, id)+"",0);
int MsgGangHsienCount = Util.getIntValue(ReportUtil.getMsgGangHsienCountByUserid(emprs, id)+"",0);
rs.executeUpdate(updateuserSql,personMeetCount,shareDocCnt,holidayOfficialWfCount,yearOfficialWfCount,officialWfCountPercentage,loginDayCount,lastTimeDate,AffairsWfCount,MsgCount,PeopleCount,MsgGangHsienCount,id);
}
}
}
private String getAffairsWfid(RecordSet rs) {
String swspwftype = Prop.getPropValue("yearReport", "swspwftype");
rs.executeQuery("select id from workflow_base where workflowtype = ?" ,swspwftype);
ArrayList<String> wfids = new ArrayList<>();
while (rs.next()){
wfids.add(Util.null2String(rs.getString("id")));
}
return String.join(",",wfids);
}
/**
* ()
* @param year
* @return
*/
private static List<String> getAllWeekendsOfYear(int year) {
//将本年的周六周日加到list中
List<String> weekendDates = new ArrayList<>();
LocalDate date = LocalDate.of(year, 1, 1);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
while (date.getYear() == year) {
if (date.getDayOfWeek() == DayOfWeek.SATURDAY || date.getDayOfWeek() == DayOfWeek.SUNDAY) {
weekendDates.add(date.format(formatter));
}
date = date.plusDays(1);
}
//查询库里的节假日设置
RecordSet recordSet = new RecordSet();
// String groupid = Util.null2String(Prop.getPropValue("year_report_set", "groupid"),"24") ;
String groupid = "24" ;
recordSet.executeQuery("select changeType ,holidayDate from KQ_HolidaySet where groupid = ?",groupid);
//去掉调配工作日,加上公众假日和调配休息日
List<String> WorkDates = new ArrayList<>();
List<String> holidayDates = new ArrayList<>();
while (recordSet.next()){
String changeType = recordSet.getString("changeType");
String holidayDate = recordSet.getString("holidayDate");
if ("2".equals(changeType)){
WorkDates.add(holidayDate);
}else if("1".equals(changeType) || "3".equals(changeType)){
holidayDates.add(holidayDate);
}
}
weekendDates.removeAll(WorkDates);
HashSet<String> set = new HashSet<>();
set.addAll(weekendDates);
set.addAll(holidayDates);
return new ArrayList<>(set);
}
private Map<String, String> getConfigRecord(){
RecordSet recordSet = new RecordSet();
recordSet.executeQuery("select * from uf_personreport where ry = 1");
recordSet.next();
HashMap<String,String> map = new HashMap<>();
map.put("RY", Util.null2String(recordSet.getString("RY")));
map.put("ND", Util.null2String(recordSet.getString("ND")));
map.put("DDCS", Util.null2String(recordSet.getString("DDCS")));
map.put("TGWZZS", Util.null2String(recordSet.getString("TGWZZS")));
map.put("ZSHYWZ1", Util.null2String(recordSet.getString("ZSHYWZ1")));
map.put("ZSHYWZ2", Util.null2String(recordSet.getString("ZSHYWZ2")));
map.put("ZSHYWZ3", Util.null2String(recordSet.getString("ZSHYWZ3")));
map.put("YSXLJFQHYCS", Util.null2String(recordSet.getString("YSXLJFQHYCS")));
map.put("GRHYCYCS", Util.null2String(recordSet.getString("GRHYCYCS")));
map.put("ZJGXWD", Util.null2String(recordSet.getString("ZJGXWD")));
map.put("GRWDGX", Util.null2String(recordSet.getString("GRWDGX")));
map.put("SKTXYSFXS", Util.null2String(recordSet.getString("SKTXYSFXS")));
map.put("SKTXCYCS", Util.null2String(recordSet.getString("SKTXCYCS")));
map.put("GCZGW", Util.null2String(recordSet.getString("GCZGW")));
map.put("LJJYZZ", Util.null2String(recordSet.getString("LJJYZZ")));
map.put("LJJP", Util.null2String(recordSet.getString("LJJP")));
map.put("JJRCLGW", Util.null2String(recordSet.getString("JJRCLGW")));
map.put("QNLJCLGW", Util.null2String(recordSet.getString("QNLJCLGW")));
map.put("CGBL", Util.null2String(recordSet.getString("CGBL")));
map.put("LJSYSLCS", Util.null2String(recordSet.getString("LJSYSLCS")));
map.put("QGZYDF", Util.null2String(recordSet.getString("QGZYDF")));
map.put("NDDJLZGYY", Util.null2String(recordSet.getString("NDDJLZGYY")));
map.put("LJDJCS", Util.null2String(recordSet.getString("LJDJCS")));
map.put("ZAYDYY", Util.null2String(recordSet.getString("ZAYDYY")));
map.put("LJSYCS", Util.null2String(recordSet.getString("LJSYCS")));
map.put("PJMRZXRS", Util.null2String(recordSet.getString("PJMRZXRS")));
map.put("PJMRZXRSZB", Util.null2String(recordSet.getString("PJMRZXRSZB")));
map.put("LJDLOACS", Util.null2String(recordSet.getString("LJDLOACS")));
map.put("DLCSCGRSZB", Util.null2String(recordSet.getString("DLCSCGRSZB")));
map.put("FORMMODEID", Util.null2String(recordSet.getString("FORMMODEID")));
map.put("MODEDATACREATER", Util.null2String(recordSet.getString("MODEDATACREATER")));
map.put("MODEDATACREATERTYPE", Util.null2String(recordSet.getString("MODEDATACREATERTYPE")));
map.put("MODEDATACREATEDATE", Util.null2String(recordSet.getString("MODEDATACREATEDATE")));
map.put("MODEDATACREATETIME", Util.null2String(recordSet.getString("MODEDATACREATETIME")));
map.put("MODEDATAMODIFIER", Util.null2String(recordSet.getString("MODEDATAMODIFIER")));
map.put("MODEDATAMODIFYDATETIME", Util.null2String(recordSet.getString("MODEDATAMODIFYDATETIME")));
map.put("FORM_BIZ_ID", Util.null2String(recordSet.getString("FORM_BIZ_ID")));
map.put("MODEUUID", Util.null2String(recordSet.getString("MODEUUID")));
map.put("YYGS", Util.null2String(recordSet.getString("YYGS")));
map.put("GWBLLCXS", Util.null2String(recordSet.getString("GWBLLCXS")));
map.put("SWSPLCXS", Util.null2String(recordSet.getString("SWSPLCXS")));
map.put("JSXXZONGSHU", Util.null2String(recordSet.getString("JSXXZONGSHU")));
map.put("XWHYCS", Util.null2String(recordSet.getString("XWHYCS")));
map.put("SWSPLCGS", Util.null2String(recordSet.getString("SWSPLCGS")));
return map;
}
public static void main(String[] args) {
}
}

@ -0,0 +1,40 @@
package com.engine.custom.corn;
import com.engine.custom.corn.util.ReportUtil;
import com.wbi.util.Util;
import weaver.conn.RecordSet;
import weaver.conn.RecordSetDataSource;
import weaver.file.Prop;
import weaver.interfaces.schedule.BaseCronJob;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
public class YearReportGjcCorn extends BaseCronJob {
@Override
public void execute() {
// RecordSetDataSource em7rs = new RecordSetDataSource("em7");
// RecordSetDataSource emprs = new RecordSetDataSource("emp_msg");
// RecordSet rs = new RecordSet();
// RecordSet rs2 = new RecordSet();
// RecordSet rs3 = new RecordSet();
// String roleMember = ReportUtil.getRoleMember(rs);
// updateRoleGjc(rs,roleMember);
// updateRoleGjc(rs);
}
//
// private void updateRoleGjc(RecordSet rs, String roleMember) {
// rs.executeUpdate(" update uf_personreport set gjc = '统筹全局' where ry in ( " + roleMember + ")" );
// }
//
//
// private void update
//
// public static void main(String[] args) {
//
// }
}

@ -0,0 +1,324 @@
package com.engine.custom.corn.util;
import com.icbc.api.internal.apache.http.impl.cookie.S;
import weaver.conn.RecordSet;
import weaver.conn.RecordSetDataSource;
import weaver.general.BaseBean;
import weaver.general.Util;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
public class ReportUtil {
private static final BaseBean bb = new BaseBean();
/**
*
* @return
*/
public static int getMsgCount(){
String dateFormat = "yyyy-MM-dd HH:mm:ss.SSS";
String[] startEndOfYear = getStartEndOfYear(dateFormat);
System.out.println("Start of Year: " + startEndOfYear[0]);
System.out.println("End of Year: " + startEndOfYear[1]);
RecordSetDataSource rs = new RecordSetDataSource("emp_msg");
String getMsgCountSql = "select count(1) cnt from HISTORYMSG where DATETIME >= '"+ startEndOfYear[0] +"' and DATETIME <= '"+ startEndOfYear[1]+"'";
bb.writeLog("getMsgCount=="+getMsgCountSql);
rs.execute(getMsgCountSql);
rs.next();
return rs.getInt("cnt");
}
/**
*
* @param dateFormat
* @return
*/
public static String[] getStartEndOfYear(String dateFormat) {
LocalDateTime startOfYear = LocalDateTime.of(LocalDateTime.now().getYear(), 1, 1, 0, 0, 0, 0);
LocalDateTime endOfYear = LocalDateTime.of(LocalDateTime.now().getYear(), 12, 31, 23, 59, 59, 999000000);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateFormat);
String start = startOfYear.format(formatter);
String end = endOfYear.format(formatter);
return new String[] {start, end};
}
/**
*
* @return
*/
public static int getShareDOCCount(){
String dateFormat = "yyyy-MM-dd";
String[] startEndOfYear = getStartEndOfYear(dateFormat);
System.out.println("Start of Year: " + startEndOfYear[0]);
System.out.println("End of Year: " + startEndOfYear[1]);
RecordSet rs = new RecordSet();
String getMsgCountSql = "select count(1) cnt from DOCDETAIL where seccategory = 98 and doccreatedate >= '"+startEndOfYear[0]+"' and doccreatedate <= '"+startEndOfYear[1]+"'";
rs.execute(getMsgCountSql);
bb.writeLog("getShareDOCCount=="+getMsgCountSql);
rs.next();
return rs.getInt("cnt");
}
/**
*
* @return
*/
public static int getShareDOCCountbyUserid(RecordSet rs , String userid){
String dateFormat = "yyyy-MM-dd";
String[] startEndOfYear = getStartEndOfYear(dateFormat);
System.out.println("Start of Year: " + startEndOfYear[0]);
System.out.println("End of Year: " + startEndOfYear[1]);
String getMsgCountSql = "select count(1) cnt from DOCDETAIL where seccategory = 98 and doccreatedate >= '"+startEndOfYear[0]+"' and doccreatedate <= '"+startEndOfYear[1]+"' and doccreaterid = "+userid ;
rs.execute(getMsgCountSql);
bb.writeLog("getShareDOCCountbyUserid=="+getMsgCountSql);
rs.next();
return rs.getInt("cnt");
}
/**
*
* @return
*/
public static int getMeetCount(){
String dateFormat = "yyyy-MM-dd HH:mm";
String[] startEndOfYear = getStartEndOfYear(dateFormat);
System.out.println("Start of Year: " + startEndOfYear[0]);
System.out.println("End of Year: " + startEndOfYear[1]);
RecordSet rs = new RecordSet();
String getMsgCountSql = "select count(1) cnt from meeting_videolist where VIDEOMTBEGINDATE >= '"+startEndOfYear[0]+"' and VIDEOMTBEGINDATE <= '"+startEndOfYear[1]+"'";
rs.execute(getMsgCountSql);
bb.writeLog("getMeetCount=="+getMsgCountSql);
rs.next();
return rs.getInt("cnt");
}
/**
*
* @return
*/
public static int getMeetCountByUserid(RecordSet rs , String userid){
String dateFormat = "yyyy-MM-dd HH:mm";
String[] startEndOfYear = getStartEndOfYear(dateFormat);
System.out.println("Start of Year: " + startEndOfYear[0]);
System.out.println("End of Year: " + startEndOfYear[1]);
String getMsgCountSql = "select count(1) cnt from meeting_videolist where VIDEOMTBEGINDATE >= '"+startEndOfYear[0]+"' and VIDEOMTBEGINDATE <= '"+startEndOfYear[1]+"' and VIDEOMTCREATER = "+userid;
rs.execute(getMsgCountSql);
rs.next();
bb.writeLog("getMeetCountByUserid=="+getMsgCountSql);
return rs.getInt("cnt");
}
/**
*
* @param rs
* @param userid
* @return
*/
public static int getLastOfficialWfDate(RecordSet rs , String userid ,String OfficialWfid){
String getMsgCountSql = "select min(OPERATEDATE) from WORKFLOW_REQUESTLOG where OPERATOR = "+userid+" and workflowid in ( "+OfficialWfid+" )";
rs.execute(getMsgCountSql);
rs.next();
bb.writeLog("getMsgCountSql=="+getMsgCountSql);
return rs.getInt("cnt");
}
/**
*
* @param rs
* @param userid
* @return
*/
public static int getYearOfficialWfCount(RecordSet rs , String userid ,String OfficialWfid){
String dateFormat = "yyyy-MM-dd";
String[] startEndOfYear = getStartEndOfYear(dateFormat);
System.out.println("Start of Year: " + startEndOfYear[0]);
System.out.println("End of Year: " + startEndOfYear[1]);
String getMsgCountSql = "select count(1) cnt from WORKFLOW_REQUESTLOG where OPERATOR = "+userid+" and workflowid in ( "+OfficialWfid+" ) " +
" and OPERATEDATE >= '"+startEndOfYear[0]+"' and OPERATEDATE <= '"+startEndOfYear[1]+"'";
rs.execute(getMsgCountSql);
rs.next();
bb.writeLog("getYearOfficialWfCount=="+getMsgCountSql);
return rs.getInt("cnt");
}
/**
*
* @param rs
* @param userid
* @return
*/
public static int getHolidayOfficialWfCount(RecordSet rs , String userid ,String OfficialWfid ,String holidayStr){
String getMsgCountSql = "select count(1) cnt from WORKFLOW_REQUESTLOG where OPERATOR = "+userid+" and workflowid in ( "+OfficialWfid+" ) and OPERATEDATE in ( "+holidayStr+" )";
rs.execute(getMsgCountSql);
bb.writeLog("getHolidayOfficialWfCount=="+getMsgCountSql);
rs.next();
return rs.getInt("cnt");
}
/**
*
* @param rs
* @param userid
* @return
*/
public static int getOfficialWfCountPercentage(RecordSet rs , String userid ,String OfficialWfid ,String holidayStr,int total){
String dateFormat = "yyyy-MM-dd";
String[] startEndOfYear = getStartEndOfYear(dateFormat);
System.out.println("Start of Year: " + startEndOfYear[0]);
System.out.println("End of Year: " + startEndOfYear[1]);
String getMsgCountSql = "select rank from (select * , RANK() OVER (ORDER BY cnt DESC) AS rank from" +
" (select OPERATOR, count(1) cnt from WORKFLOW_REQUESTLOG" +
" where WORKFLOWID in ("+ OfficialWfid +") and OPERATEDATE >= '"+startEndOfYear[0]+"' and OPERATEDATE <= '"+startEndOfYear[1]+"' group by OPERATOR)) a where a.OPERATOR = "+ userid;
rs.execute(getMsgCountSql);
bb.writeLog("getOfficialWfCountPercentage=="+getMsgCountSql);
rs.next();
int rank = Util.getIntValue(rs.getInt("rank"));
if (0 == rank){
return 0;
}
return (int)(100.0 * (total - rank) / (total - 1));
}
/**
*
* @param rs
* @param userid
* @return
*/
public static String getOfficialWflastTimeDate(RecordSet rs , String userid , String OfficialWfid ){
String dateFormat = "yyyy-MM-dd";
String[] startEndOfYear = getStartEndOfYear(dateFormat);
System.out.println("Start of Year: " + startEndOfYear[0]);
System.out.println("End of Year: " + startEndOfYear[1]);
String getMsgCountSql = "SELECT * FROM ( " +
" SELECT * FROM WORKFLOW_REQUESTLOG where OPERATETIME <= '05:00:00' and WORKFLOWID in ("+ OfficialWfid +") " +
" and OPERATEDATE >= '"+startEndOfYear[0]+"' and OPERATEDATE <= '"+startEndOfYear[1]+"'"+
" and OPERATOR = "+ userid +
" ORDER BY OPERATETIME DESC" +
" )WHERE ROWNUM = 1";
rs.execute(getMsgCountSql);
bb.writeLog("getOfficialWflastTimeDate=="+getMsgCountSql);
rs.next();
int counts = rs.getCounts();
if (counts != 0){
return rs.getString("OPERATEDATE")+" "+rs.getString("OPERATETIME");
}else {
getMsgCountSql = "SELECT * FROM ( " +
" SELECT * FROM WORKFLOW_REQUESTLOG where WORKFLOWID in ("+ OfficialWfid +") " +
" and OPERATEDATE >= '"+startEndOfYear[0]+"' and OPERATEDATE <= '"+startEndOfYear[1]+"'"+
" and OPERATOR = "+ userid +
" ORDER BY OPERATETIME DESC" +
" )WHERE ROWNUM = 1";
rs.execute(getMsgCountSql);
bb.writeLog("getOfficialWflastTimeDate2=="+getMsgCountSql);
rs.next();
return rs.getString("OPERATEDATE")+" "+rs.getString("OPERATETIME");
}
}
//获取登录天数
public static int getLoginDayCount(RecordSet rs , String userid ){
String dateFormat = "yyyy-MM-dd";
String[] startEndOfYear = getStartEndOfYear(dateFormat);
System.out.println("Start of Year: " + startEndOfYear[0]);
System.out.println("End of Year: " + startEndOfYear[1]);
String getMsgCountSql = "select count(*) cnt from ( " +
" select OPERATEDATE from hrmsysmaintenancelog where RELATEDID = " + userid + ""+
" and OPERATEDATE >= '"+startEndOfYear[0]+"' and OPERATEDATE <= '"+startEndOfYear[1]+"'"+
" group by OPERATEDATE)";
rs.execute(getMsgCountSql);
bb.writeLog("getLoginDayCount=="+getMsgCountSql);
rs.next();
return rs.getInt("cnt");
}
//获取统筹全局角色的人员,返回,分割的字符串
public static String getRoleMember(RecordSet rs ){
String getMsgCountSql = "select RESOURCEID from hrmrolemembers mem left join hrmroles role on mem.ROLEID = role.ID where role.ROLESMARK = '统筹全局'";
rs.execute(getMsgCountSql);
bb.writeLog("getRoleMember=="+getMsgCountSql);
ArrayList<String> roleMember = new ArrayList<>();
while (rs.next()){
roleMember.add(Util.null2String(rs.getString("RESOURCEID")));
}
return String.join(",",roleMember);
}
/**
*
* @param rs
* @param userid
* @return
*/
public static int getYearAffairsWfCount(RecordSet rs , String userid ,String AffairsWfid){
String dateFormat = "yyyy-MM-dd";
String[] startEndOfYear = getStartEndOfYear(dateFormat);
System.out.println("Start of Year: " + startEndOfYear[0]);
System.out.println("End of Year: " + startEndOfYear[1]);
String getMsgCountSql = "select count(1) cnt from WORKFLOW_REQUESTLOG where OPERATOR = "+userid+" and workflowid in ( "+AffairsWfid+" ) " +
" and OPERATEDATE >= '"+startEndOfYear[0]+"' and OPERATEDATE <= '"+startEndOfYear[1]+"'";
rs.execute(getMsgCountSql);
rs.next();
bb.writeLog("getYearOfficialWfCount=="+getMsgCountSql);
return rs.getInt("cnt");
}
public static int getMsgCountByUserid(RecordSetDataSource rs,String userid){
String dateFormat = "yyyy-MM-dd HH:mm:ss.SSS";
String[] startEndOfYear = getStartEndOfYear(dateFormat);
System.out.println("Start of Year: " + startEndOfYear[0]);
System.out.println("End of Year: " + startEndOfYear[1]);
String getMsgCountSql = "select count(distinct TARGETID) cnt from HISTORYMSG where DATETIME >= '"+ startEndOfYear[0] +"' and DATETIME <= '"+ startEndOfYear[1]+"' and fromuserid = '"+ userid+"'";
bb.writeLog("getMsgCount=="+getMsgCountSql);
rs.execute(getMsgCountSql);
rs.next();
return rs.getInt("cnt");
}
public static int getMsgPeopleCountByUserid(RecordSetDataSource rs,String userid){
String dateFormat = "yyyy-MM-dd HH:mm:ss.SSS";
String[] startEndOfYear = getStartEndOfYear(dateFormat);
System.out.println("Start of Year: " + startEndOfYear[0]);
System.out.println("End of Year: " + startEndOfYear[1]);
String getMsgCountSql = "select count(distinct TARGETID) cnt from HISTORYMSG where TARGETTYPE = 1 and DATETIME >= '"+ startEndOfYear[0] +"' and DATETIME <= '"+ startEndOfYear[1]+"' and fromuserid = '"+ userid+"'";
bb.writeLog("getMsgCount=="+getMsgCountSql);
rs.execute(getMsgCountSql);
rs.next();
return rs.getInt("cnt");
}
public static int getMsgGangHsienCountByUserid(RecordSetDataSource rs,String userid){
String dateFormat = "yyyy-MM-dd HH:mm:ss.SSS";
String[] startEndOfYear = getStartEndOfYear(dateFormat);
System.out.println("Start of Year: " + startEndOfYear[0]);
System.out.println("End of Year: " + startEndOfYear[1]);
String getMsgCountSql = "select count(distinct TARGETID) cnt from HISTORYMSG where TARGETTYPE = 2 and DATETIME >= '"+ startEndOfYear[0] +"' and DATETIME <= '"+ startEndOfYear[1]+"' and fromuserid = '"+ userid+"'";
bb.writeLog("getMsgCount=="+getMsgCountSql);
rs.execute(getMsgCountSql);
rs.next();
return rs.getInt("cnt");
}
public static void main(String[] args) {
getMsgCount();
}
}

@ -499,17 +499,26 @@ public class MsgECToEM {
}
//如果是此消息id是需要修改的消息则替换为空
String msgTypeId = (Util.null2String(Prop.getPropValue("QC2586804", "msgtype")));
String msgTypeId2 = (Util.null2String(Prop.getPropValue("QC2586804", "msgtype2")));
new BaseBean().writeLog("msgTypeId===>"+msgTypeId);
new BaseBean().writeLog("messageBean===>"+JSONObject.toJSONString(messageBean));
try {
if (msgTypeId.contains(messageBean.getMessageGroupType())){
if(msgTypeId.length()>0){
String[] msgTypeIdArr = msgTypeId.split(",");
List<String> msgTypeIdList = Arrays.asList(msgTypeIdArr);
if (msgTypeIdList.contains(messageBean.getMessageGroupType())){
title=title.replace("","\u0020");
}
}
title=title.replace("","\u0020");
// if (title.indexOf("-")>0){
// title = title.split("-")[1];
// }
// agentid = "87";
if(msgTypeId2.length()>0){
String[] msgTypeIdArr = msgTypeId2.split(",");
List<String> msgTypeIdList = Arrays.asList(msgTypeIdArr);
if (msgTypeIdList.contains(messageBean.getMessageGroupType())){
title=title.replace("","-");
}
}
}catch (Exception e){
new BaseBean().writeLog("Exception===>"+e.getMessage());
e.printStackTrace();

@ -1,5 +1,8 @@
package com.engine.tjbankSocket.impl;
import com.cloudstore.dev.api.bean.MessageBean;
import com.cloudstore.dev.api.bean.MessageType;
import com.cloudstore.dev.api.util.Util_Message;
import com.engine.tjbankSocket.SocketExecute;
import com.engine.util.XMLUtils;
import com.icbc.api.internal.apache.http.impl.cookie.S;
@ -12,8 +15,11 @@ import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestService;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public class CWGLSocketExecute extends BaseBean implements SocketExecute {
@Override
@ -29,7 +35,7 @@ public class CWGLSocketExecute extends BaseBean implements SocketExecute {
Map<String, String> resultMap = null;
int userid = 0;
try {
resultMap = getBeanByOAnum(oaTrvlBnsExpnsAcctNo, "formtable_main_295");
resultMap = getBeanByOAnum(oaTrvlBnsExpnsAcctNo, "formtable_main_281");
} catch (Exception e) {
e.printStackTrace();
return XMLUtils.CW2XML(paramMap, "1", e.getMessage());
@ -66,6 +72,8 @@ public class CWGLSocketExecute extends BaseBean implements SocketExecute {
if (istrue) {
try {
updateStatus(requestid, flowStatus);
String sqr = getsqrbyBH(oaTrvlBnsExpnsAcctNo, "formtable_main_281");
sendMsgForSuccess(sqr);
} catch (Exception e) {
e.printStackTrace();
return XMLUtils.CW2XML(paramMap, "1", e.getMessage());
@ -76,10 +84,32 @@ public class CWGLSocketExecute extends BaseBean implements SocketExecute {
}
}
private void sendMsgForSuccess(String userid) {
MessageType messageType = MessageType.newInstance(1674); // 消息来源(见文档第四点补充 必填)
Set<String> userIdList = new HashSet<>(); // 接收人id 必填
String[] useridArr = userid.split(",");
for (String s : useridArr) {
userIdList.add(s);
}
String title = "补助提醒"; // 标题
String context = "您有新的差旅补助到账,请您查收";
String linkUrl = ""; // PC端链接
String linkMobileUrl = ""; // 移动端链接
try {
MessageBean messageBean = Util_Message.createMessage(messageType, userIdList, title, context, linkUrl, linkMobileUrl);
messageBean.setCreater(1);// 创建人id
//message.setBizState("0");// 需要修改消息为已处理等状态时传入,表示消息最初状态为待处理
//messageBean.setTargetId("121|22"); //消息来源code +“|”+业务id需要修改消息为已处理等状态时传入
Util_Message.store(messageBean);
} catch (IOException e) {
e.printStackTrace();
}
}
private void updateStatus(int requestid, String flowStatus) throws Exception {
try {
RecordSet recordSet = new RecordSet();
recordSet.executeUpdate("update formtable_main_295 set cwxtzt = ? where requestId = ?", flowStatus, requestid);
recordSet.executeUpdate("update formtable_main_281 set cwxtzt = ? where requestId = ?", flowStatus, requestid);
} catch (Exception e) {
throw new Exception("更新状态失败");
}
@ -100,6 +130,26 @@ public class CWGLSocketExecute extends BaseBean implements SocketExecute {
}
}
/**
*
* @param oaTrvlBnsExpnsAcctNo
* @param tableName
* @return
* @throws Exception
*/
public String getsqrbyBH(String oaTrvlBnsExpnsAcctNo, String tableName) throws Exception {
RecordSet recordSet = new RecordSet();
HashMap<String, String> resultMap = new HashMap<>();
String sql = "select jbrxm from " + tableName + " where djbh = ?";
recordSet.executeQuery(sql, oaTrvlBnsExpnsAcctNo);
if (recordSet.next()) {
return Util.null2String(recordSet.getString("jbrxm"));
} else {
throw new Exception("编号对应单据不存在");
}
}
public int getHrmidByWorkCode(String workcode) throws Exception {
RecordSet recordSet = new RecordSet();
String sql = "select id from HRMRESOURCE where workcode = ?";

@ -35,18 +35,27 @@ public class SocketClientUtil {
// PrintStream out = new PrintStream(new OutputStreamWriter(socket.getOutputStream(),StandardCharsets.UTF_8));
PrintWriter out = new PrintWriter(new OutputStreamWriter(socket.getOutputStream(),StandardCharsets.UTF_8),true);
out.println(request);
String ret = input.readLine();
System.out.println("服务器端返回过来的是: " + ret);
bs.writeLog("服务器端返回过来的是: " + ret);
char[] datalen=new char[8];//报文前八位为报文体总长度
input.read(datalen,0,8);
String lendata=new String (datalen);
int length=Integer.parseInt(lendata);
new BaseBean().writeLog("报文长度"+length);
char[] data=new char[length];
int datalength = input.read(data,0,length);
String requestData = new String(data);
new BaseBean().writeLog("requestData",requestData);
// String ret = input.readLine();
System.out.println("服务器端返回过来的是: " + requestData);
bs.writeLog("服务器端返回过来的是: " + requestData);
// 如接收到 "OK" 则断开连接
if (!StringUtil.isEmpty(ret)) {
if (!StringUtil.isEmpty(requestData)) {
bs.writeLog("客户端将关闭连接");
System.out.println("客户端将关闭连接: " + ret);
System.out.println("客户端将关闭连接: " + requestData);
Thread.sleep(500);
}
out.close();
input.close();
return ret;
return requestData;
} catch (Exception e) {
bs.writeLog("客户端异常:" + e.getMessage());
throw e;

File diff suppressed because it is too large Load Diff

@ -1,806 +0,0 @@
// 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" +
// "]";
// }

@ -224,6 +224,7 @@ public class FunctionManageCmd extends AbstractCommonCommand<Map<String,Object>>
RecordSet rs = new RecordSet();
String lcWorkflowid="";
String lcCurrentnodeid="";
String currentnodeid="";
//requestid,workflowid,currentnodeid
String query="select * from workflow_requestbase where requestid ="+requestid;
bb.writeLog("querysql-->"+query);
@ -233,12 +234,14 @@ public class FunctionManageCmd extends AbstractCommonCommand<Map<String,Object>>
if (rs.next()){
lcWorkflowid = Util.null2String(rs.getString("workflowid"));
lcCurrentnodeid = Util.null2String(rs.getString("lastnodeid"));
currentnodeid = Util.null2String(rs.getString("currentnodeid"));
}
}catch (Exception e){
e.printStackTrace();
}
bb.writeLog("lcWorkflowid-->"+lcWorkflowid);
bb.writeLog("lcCurrentnodeid-->"+lcCurrentnodeid);
bb.writeLog("currentnodeid-->"+currentnodeid);
if (!isEmpty(lcWorkflowid) && !isEmpty(lcCurrentnodeid)) {
bb.writeLog("查询出的workflowid和currentnodeid不为空");
int cnt = 0;
@ -254,11 +257,12 @@ public class FunctionManageCmd extends AbstractCommonCommand<Map<String,Object>>
while (rs.next()) {
int workflowid1 = rs.getInt("workflowid");
if(workflowid==workflowid1) {
// cnt = rs.getInt("cnt");
cnt++;
touchnodeid = rs.getInt("touchnodeid");
touchnodeids.add(touchnodeid);
int node = rs.getInt("touchnodeid");
bb.writeLog("node =-->"+node);
if(currentnodeid.equals(node+"")){
touchnodeid = node;
cnt++;
}
}
}
} catch (Exception e) {
@ -273,10 +277,7 @@ public class FunctionManageCmd extends AbstractCommonCommand<Map<String,Object>>
// select COUNT(*) as cnt from workflow_requestbase where mainrequestid=239239
List<Map<String, String>> subList = new ArrayList<>();
// String subWorkflowSql="select * from Workflow_SubwfSet where mainWorkflowId="+lcWorkflowid+" and triggerNodeId="+lcCurrentnodeid;
String result = touchnodeids.stream()
.map(String::valueOf)
.collect(Collectors.joining(", "));
String subworkflowsql1 = "select workflowid subWorkflowId from workflow_requestbase where requestid in (select subrequestid from workflow_subwfrequest where subrequestid in (select requestid from workflow_requestbase where mainrequestid="+requestid+" and triggernode in( "+result+" )))";
String subworkflowsql1 = "select workflowid subWorkflowId from workflow_requestbase where requestid in (select subrequestid from workflow_subwfrequest where subrequestid in (select requestid from workflow_requestbase where mainrequestid="+requestid+" and triggernode = "+touchnodeid+"))";
//String subWorkflowSql="select subWorkflowId from Workflow_SubwfSet where mainWorkflowId="+lcWorkflowid+" and triggerNodeId="+touchnodeid;
bb.writeLog("subWorkflowSql-->"+subworkflowsql1);
try {

@ -39,7 +39,7 @@ import java.util.Map;
/**
* Created by jhy on 2018/2/23.
*/
public class RequestFormServiceImpl extends Service implements RequestFormService {
public class RequestFormServiceImpl extends Service implements RequestFormService {
//流程测试选择人员后判断用户是否有创建权限
public Map<String,Object> judgeCreateRight(HttpServletRequest request){

@ -0,0 +1,66 @@
<%@ page import="java.io.FileInputStream" %>
<%@ page import="java.net.URLEncoder" %>
<%@ page import="com.api.login.util.LoginUtil" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="com.icbc.api.internal.apache.http.impl.cookie.S" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="java.time.LocalDate" %>
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.general.StringUtil" %>
<%@ page import="java.time.DayOfWeek" %>
<%@ page import="weaver.file.Prop" %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
List<String> weekends = getAllWeekendsOfYear(LocalDate.now().getYear());
for (String weekend : weekends) {
out.print(weekend+"<br>");
}
out.print(weekends.size());
%>
<%!
private static List<String> getAllWeekendsOfYear(int year) {
//将本年的周六周日加到list中
List<String> weekendDates = new ArrayList<>();
LocalDate date = LocalDate.of(year, 1, 1);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
while (date.getYear() == year) {
if (date.getDayOfWeek() == DayOfWeek.SATURDAY || date.getDayOfWeek() == DayOfWeek.SUNDAY) {
weekendDates.add(date.format(formatter));
}
date = date.plusDays(1);
}
//查询库里的节假日设置
RecordSet recordSet = new RecordSet();
// String groupid = Util.null2String(Prop.getPropValue("year_report_set", "groupid"),"24") ;
String groupid = "24" ;
recordSet.executeQuery("select changeType ,holidayDate from KQ_HolidaySet where groupid = ?",groupid);
//去掉调配工作日,加上公众假日和调配休息日
List<String> WorkDates = new ArrayList<>();
List<String> holidayDates = new ArrayList<>();
while (recordSet.next()){
String changeType = recordSet.getString("changeType");
String holidayDate = recordSet.getString("holidayDate");
if ("2".equals(changeType)){
WorkDates.add(holidayDate);
}else if("1".equals(changeType) || "3".equals(changeType)){
holidayDates.add(holidayDate);
}
}
weekendDates.removeAll(WorkDates);
HashSet<String> set = new HashSet<>();
set.addAll(weekendDates);
set.addAll(holidayDates);
return new ArrayList<>(set);
}
%>

@ -0,0 +1,62 @@
<%@ 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" %>
<%@ page import="org.json.JSONException" %>
<%@ page import="com.icbc.api.internal.apache.http.impl.cookie.S" %>
<%@ page import="okhttp3.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%!
%>
<
User user = HrmUserVarify.getUser(request, response);
JSONObject postBody = new JSONObject();
postBody.put("sysid","84df78883322432f90eb599899365c7b");
postBody.put("userids",user.getUID());
postBody.put("offline_type","1");
postBody.put("client_type","1,2,3");
String errmsg = EMExt(getEMToken(), postBody.toJSONString());
%>

@ -0,0 +1,783 @@
<%--
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" %>
<%@ page import="org.json.JSONException" %>
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="java.time.LocalDateTime" %>
<%@ page import="java.time.temporal.ChronoUnit" %>
<%!
//获取分页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(Map<String, String> MachInfo){
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");
headers.put("MACH_ID",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
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,Map<String, String> MachInfo){
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");
headers.put("MACH_ID",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
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;
}
public static String getsysSSOurl(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("hqdddz"));
}else {
return "-1";
}
new BaseBean().writeLog("hqdddz===="+url);
url = url.trim();
// if (!StringUtil.isBlank(url)){
// //判断是否带?号
// if (url.indexOf("?") == -1){
// url = url+"?";
// }else{
// url = url+"&";
// }
// };
return url;
}
/**
* 判断两个时间字符串相差的小时数是否大于给定的小时数。
*
* @param timeStr1 第一个时间字符串格式为yyyy-MM-dd HH:mm:ss
* @param timeStr2 第二个时间字符串格式为yyyy-MM-dd HH:mm:ss
* @param hours 给定的小时数
* @return 如果两个时间相差的小时数大于给定的小时数返回true否则返回false
*/
public static boolean isDifferenceGreaterThan(String timeStr1, String timeStr2, int hours) {
// 定义日期时间格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// 解析字符串为LocalDateTime对象
LocalDateTime time1 = LocalDateTime.parse(timeStr1, formatter);
LocalDateTime time2 = LocalDateTime.parse(timeStr2, formatter);
// 计算两个时间的差值(以小时为单位)
long hoursDifference = ChronoUnit.HOURS.between(time1, time2);
// 检查差值是否大于给定的小时数
return Math.abs(hoursDifference) > hours;
}
%>
<%
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-->");
try {
new BaseBean().writeLog("header====>" + JSONObject.toJSONString(request));
new BaseBean().writeLog("header====>" + request.getHeader("User-Agent"));
}catch (Exception e){
new BaseBean().writeLog("error===>"+e.getMessage());
}
Map<String, Object> paramsMap = ParamUtil.request2Map(request);
new BaseBean().writeLog("paramsMap===>"+JSONObject.toJSONString(paramsMap) );
String deviceId = Util.null2String(paramsMap.get("deviceId"));
String clientType = Util.null2String(paramsMap.get("clientType"));
if("2".equals(clientType)){
clientType = "0";
}else if("3".equals(clientType)){
clientType = "1";
}
String param_ip = Util.null2String(paramsMap.get("param_ip"));
new BaseBean().writeLog("paramsMap===>"+paramsMap );
new BaseBean().writeLog("deviceId===>"+deviceId );
new BaseBean().writeLog("clientType===>"+clientType );
HashMap<String, String> MachInfo = new HashMap<>();
MachInfo.put("deviceId",deviceId.isEmpty()?UUID.randomUUID().toString():deviceId);
MachInfo.put("clientType",clientType.isEmpty()?"1":clientType);
MachInfo.put("param_ip",param_ip.isEmpty()?"127.0.0.1":param_ip);
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);
String loginid = (String) paramsMap.get("loginid");
rs.executeQuery("select id,loginid,password,createtime from EmobileLoginDetail where loginid=?", loginid);
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"));
String certified_token_expires = Util.null2String(session.getAttribute("certified_token_expires"));
bb.writeLog("获取sessionTGT=="+certified_token);
bb.writeLog("获取certified_token_expires=="+certified_token_expires);
//获取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 cockpitUrl = getsysSSOurl(sysid);
String tgturl = Util.null2String(bb.getPropValue("tjbankEMobileSSO","tgtUrl"));//请求获取TGT地址
//获取ST带着下游系统
if (!isEmpty(certified_token)){
String responseInfo = getST(certified_token,cockpitUrl,MachInfo);
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(loginUrl);
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(MachInfo);
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", MachInfo.get("deviceId"));
headers.put("MACH_TYPE", MachInfo.get("clientType"));
headers.put("MACH_IP", MachInfo.get("param_ip"));
retMsg = httpPostForm(tgturl, params, headers, null);
bb.writeLog("===获取TGT返回值retMsg====" + retMsg);
org.json.JSONObject resMsg = new org.json.JSONObject(retMsg);
if (resMsg.has("TGT")) {
// out.print(resMsg);
TGT = Util.null2String(resMsg.get("TGT").toString());
} else {
out.print(resMsg.get("message"));
return;
}
String responseInfo = getST(TGT, cockpitUrl, MachInfo);
// out.print("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 {
bb.writeLog(stMsg);
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("进入驾驶舱成功");
out.print(loginUrl);
// 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,176 @@
<%@ page import="weaver.file.Prop" %>
<%@ page import="com.engine.custom.sl.entity.EsbRequestHeader" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="com.engine.custom.sl.entity.TravelToEsbBean" %>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ page import="com.engine.util.SocketClientUtil" %>
<%@ page import="com.engine.util.XMLUtils" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.soa.workflow.request.RequestInfo" %>
<%@ page import="weaver.hrm.company.DepartmentComInfo" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.interfaces.workflow.action.Action" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
// out.print(Prop.getPropValue("qwe","host"));
User user = HrmUserVarify.getUser(request, response);
if (user == null){
out.print("暂无权限");
}
if (!(1 == (user.getUID()))){
out.print("暂无权限");
return;
}
Map<String, Object> param = ParamUtil.request2Map(request);
String sql = "select main.*, base.REQUESTNAME from formtable_main_11 main " +
"left join uf_tohgLog log on log.REQUEST = main.REQUESTID " +
"left join WORKFLOW_REQUESTBASE base on base.REQUESTID = main.REQUESTID " +
" where log.zwid is null and main.tohg = 1 and log.id is not null ";
RecordSet recordSet = new RecordSet();
RecordSet rs = new RecordSet();
recordSet.executeQuery(sql);
StringBuilder execute = new StringBuilder();
int i = 0;
while (recordSet.next()){
String result = this.execute(recordSet, rs);
execute.append(result).append("\n");
i++;
}
out.print("共添加"+i+"条" +"\n");
out.print(execute.toString());
%>
<%!
public static String generateTimestamp() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
Date currentDate = new Date();
return dateFormat.format(currentDate);
}
public String execute(RecordSet recordSet, RecordSet rs) {
try {
String insertsql = "INSERT INTO uf_tohgLog(REQUEST, CONTENT, ZT, ML, DDSJ, TSSJ, FJML, ZWID, FJID) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ? )";
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
//公文标题
String requestname = recordSet.getString("REQUESTNAME");
String requestId = recordSet.getString("REQUESTID");
// 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 = recordSet.getString("id");
//公文编号
String fwwh = recordSet.getString("bh");
//发文部门名称
String ngbm = recordSet.getString("ngbm");
//成文时间
String cwrq = recordSet.getString("cwrq");
String ngr = recordSet.getString("ngr");
// String zw = rs.getString("zw"); //word格式
//生成的pdf
String zw = recordSet.getString("dwd");
String fj = recordSet.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);
return insertsql + "?"+ requestId + "|"+context + "|"+0 + "|"+null + "|"+time + "|"+null + "|"+null + "|"+zw + "|"+fj;
} catch (Exception e) {
// writeLog(e.getMessage()+ "||||||异常流程id==="+request.getRequestid());
e.printStackTrace();
//不管是否推送成功,都返回成功,不影响流程流转
return "error";
}
// 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;
};
%>

@ -0,0 +1,171 @@
<%@ page import="weaver.file.Prop" %>
<%@ page import="com.engine.custom.sl.entity.EsbRequestHeader" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="com.engine.custom.sl.entity.TravelToEsbBean" %>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ page import="com.engine.util.SocketClientUtil" %>
<%@ page import="com.engine.util.XMLUtils" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.soa.workflow.request.RequestInfo" %>
<%@ page import="weaver.hrm.company.DepartmentComInfo" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.interfaces.workflow.action.Action" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
// out.print(Prop.getPropValue("qwe","host"));
User user = HrmUserVarify.getUser(request, response);
if (user == null){
out.print("暂无权限");
}
// out.print(user.getUID());
if (!(1 == (user.getUID()))){
out.print("暂无权限");
return;
}
Map<String, Object> param = ParamUtil.request2Map(request);
String sql = "select main.*, base.REQUESTNAME from formtable_main_49 main " +
"left join uf_tohgLog log on log.REQUEST = main.REQUESTID " +
"left join WORKFLOW_REQUESTBASE base on base.REQUESTID = main.REQUESTID " +
" where log.ID is null and main.tohg = 1";
RecordSet recordSet = new RecordSet();
RecordSet rs = new RecordSet();
recordSet.executeQuery(sql);
StringBuilder execute = new StringBuilder();
int i = 0;
while (recordSet.next()){
String result = this.execute(recordSet, rs);
execute.append(result).append("\n");
i++;
}
out.print("共添加"+i+"条" +"\n");
out.print(execute.toString());
%>
<%!
public static String generateTimestamp() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
Date currentDate = new Date();
return dateFormat.format(currentDate);
}
public String execute(RecordSet recordSet, RecordSet rs) {
try {
String insertsql = "INSERT INTO uf_tohgLog(REQUEST, CONTENT, ZT, ML, DDSJ, TSSJ, FJML, ZWID, FJID) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ? )";
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
String requestname = recordSet.getString("REQUESTNAME");
String requestId = recordSet.getString("REQUESTID");
// 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 = recordSet.getString("bh");
//发文部门名称
String ngbm = recordSet.getString("ngbm");
//成文时间
String cwrq = recordSet.getString("cwrq");
String ngr = recordSet.getString("ngr");
// String zw = rs.getString("zw"); //word格式
//生成的pdf
String zw = recordSet.getString("dwd");
String fj = recordSet.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);
return insertsql + "?"+ requestId + "|"+context + "|"+0 + "|"+null + "|"+time + "|"+null + "|"+null + "|"+zw + "|"+fj;
} catch (Exception e) {
// writeLog(e.getMessage()+ "||||||异常流程id==="+request.getRequestid());
e.printStackTrace();
return e.getMessage();
//不管是否推送成功,都返回成功,不影响流程流转
// 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;
};
%>

@ -16,7 +16,7 @@
<%@ page import="weaver.hrm.User" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ 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" %>
@ -48,6 +48,12 @@
<%@ page import="org.apache.http.client.methods.HttpGet" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%@ page import="com.wbi.util.StringUtil" %>
<%@ page import="org.json.JSONException" %>
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="java.time.LocalDateTime" %>
<%@ page import="java.time.temporal.ChronoUnit" %>
<%@ page import="okhttp3.*" %>
<%@ page import="javax.servlet.http.Cookie" %>
<%!
//获取分页sql
public static String getPaginationSql(String sql, String orderby, int pageNo, int pageSize) {
@ -60,29 +66,29 @@
int firstResult = 0;
int endResult = 0;
// 返回分页sql
if("oracle".equals(dbType)){ // rownum
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";
} 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()分页
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;
+ orderby + ") tableUN ) tabUN2 where r < " + firstResult + " ) where my_rownum > " + endResult;
}
rs.writeLog("execSql---->"+execSql);
rs.writeLog("execSql---->" + execSql);
return execSql;
}
private boolean isEmpty(String str) {
if ("".equals(str) ||"(null)".equals(str) || str == null) {
if ("".equals(str) || "(null)".equals(str) || str == null) {
return true;
} else {
return false;
@ -102,7 +108,7 @@
Pattern p_src;
Matcher m_src;
// String regEx_img = "<img.*src=(.*?)[^>]*?>"; //图片链接地址
String regEx_src = "<"+type+".*src\\s*=\\s*(.*?)[^>]*?>";
String regEx_src = "<" + type + ".*src\\s*=\\s*(.*?)[^>]*?>";
p_src = Pattern.compile
(regEx_src, Pattern.CASE_INSENSITIVE);
m_src = p_src.matcher(htmlStr);
@ -118,7 +124,7 @@
return srcs;
}
public User getUser(int uid){
public User getUser(int uid) {
User user = new User();
RecordSet rs = new RecordSet();
if (uid == 1)
@ -155,11 +161,11 @@
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.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"));
@ -174,33 +180,32 @@
}
public String httpPostRequest(String param,String url,String token){
public String httpPostRequest(String param, String url, String token) {
BaseBean baseBean = new BaseBean();
JSONObject jsonObject = new JSONObject();
String responseBody="";
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);
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);
baseBean.writeLog("entity-utf-8->" + entity);
httpPost.setEntity(entity);
//设置请求头部
httpPost.setHeader("Content-Type", "application/json");
if(token != null && !"".equals(token)){
httpPost.setHeader("Authorization",token);
if (token != null && !"".equals(token)) {
httpPost.setHeader("Authorization", token);
}
//执行请求,返回请求响应
CloseableHttpResponse response = httpClient.execute(httpPost);
//请求返回状态码
int statusCode = response.getStatusLine().getStatusCode();
baseBean.writeLog("statusCode状态码->"+statusCode);
baseBean.writeLog("statusCode状态码->" + statusCode);
//请求成功
if (statusCode == HttpStatus.SC_OK && statusCode <= HttpStatus.SC_TEMPORARY_REDIRECT) {
//取出响应体
@ -208,7 +213,7 @@
//从响应体中解析出token
responseBody = EntityUtils.toString(entity2, "utf-8");
// jsonObject = JSONObject.parseObject(responseBody);
baseBean.writeLog("responseBody->"+responseBody);
baseBean.writeLog("responseBody->" + responseBody);
// baseBean.writeLog("jsonObject->"+jsonObject);
//token = jsonObject.getString("access_token");
} else {
@ -224,9 +229,9 @@
/**
* 发送http get请求
*/
public static String httpGet(String url,Map<String,String> headers,String encode){
public static String httpGet(String url, Map<String, String> headers, String encode) {
BaseBean bb = new BaseBean();
if(encode == null){
if (encode == null) {
encode = "utf-8";
}
CloseableHttpResponse httpResponse = null;
@ -239,17 +244,17 @@
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpGet.setHeader(entry.getKey(),entry.getValue());
httpGet.setHeader(entry.getKey(), entry.getValue());
}
}
bb.writeLog("url="+url+"header="+headers+"encode="+encode);
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{
} finally {
try {
httpResponse.close();
} catch (IOException e) {
@ -279,7 +284,7 @@
HttpURLConnection connection = null;
try {
URL postUrl = new URL(url);
bb.writeLog("getUrl-->"+postUrl);
bb.writeLog("getUrl-->" + postUrl);
// 打开和URL之间的连接
connection = (HttpURLConnection) postUrl.openConnection();
@ -349,14 +354,14 @@
/**
* 发送 http post 请求参数以form表单键值对的形式提交。
*/
public static String httpPostForm(String url,Map<String,String> params, Map<String,String> headers,String encode){
public static String httpPostForm(String url, Map<String, String> params, Map<String, String> headers, String encode) {
BaseBean bb = new BaseBean();
if(encode == null){
if (encode == null) {
encode = "utf-8";
}
String content = null;
CloseableHttpResponse httpResponse = null;
CloseableHttpResponse httpResponse = null;
CloseableHttpClient closeableHttpClient = null;
try {
@ -366,16 +371,16 @@
//设置header
if (headers != null && headers.size() > 0) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpost.setHeader(entry.getKey(),entry.getValue());
httpost.setHeader(entry.getKey(), entry.getValue());
}
}
bb.writeLog("url="+url+"header="+headers+"encode="+encode);
bb.writeLog("params="+params);
bb.writeLog("url=" + url + "header=" + headers + "encode=" + encode);
bb.writeLog("params=" + params);
//组织请求参数
List<NameValuePair> paramList = new ArrayList <NameValuePair>();
if(params != null && params.size() > 0){
List<NameValuePair> paramList = new ArrayList<NameValuePair>();
if (params != null && params.size() > 0) {
Set<String> keySet = params.keySet();
for(String key : keySet) {
for (String key : keySet) {
paramList.add(new BasicNameValuePair(key, params.get(key)));
}
}
@ -386,7 +391,7 @@
content = EntityUtils.toString(entity, encode);
} catch (Exception e) {
e.printStackTrace();
}finally{
} finally {
try {
httpResponse.close();
} catch (IOException e) {
@ -419,112 +424,229 @@
return Base64.encodeBase64String(cipher.doFinal(content.getBytes(StandardCharsets.UTF_8)));
}
public static String getPublicKey(){
public static String getPublicKey(Map<String, String> MachInfo) {
BaseBean bb = new BaseBean();
String publicKey ="";
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));
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);
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");
headers.put("MACH_ID", MachInfo.get("deviceId"));
headers.put("MACH_TYPE", MachInfo.get("clientType"));
headers.put("MACH_IP", MachInfo.get("param_ip"));
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")){
bb.writeLog("===获取publickey返回值====" + resMsg);
if (resMsg.has("pubKey")) {
publicKey = Util.null2String(resMsg.get("pubKey").toString());
}
}catch (Exception e){
} catch (Exception e) {
e.getMessage();
}
return publicKey;
}
//获取TG
public static String getST(String tgt,String emobileUrl){
public static String getST(String tgt, String emobileUrl, Map<String, String> MachInfo) {
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"));
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);
String url = Util.null2String(bb.getPropValue("tjbankEMobileSSO", "stUrl"));
bb.writeLog("==获取TG==" + url);
//移动端首页地址
bb.writeLog("==移动端首页地址=="+emobileUrl);
bb.writeLog("==移动端首页地址==" + emobileUrl);
//获取TGT
params = new HashMap<>();//参数
params.put("tgt",tgt);
params.put("service",emobileUrl);
bb.writeLog("==STparams=="+params);
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");
headers.put("API_KEY", API_KEY);
// headers.put("MACH_ID","123");
// headers.put("MACH_TYPE","0");
// headers.put("MACH_IP","127.0.0.1");
headers.put("MACH_ID", MachInfo.get("deviceId"));
headers.put("MACH_TYPE", MachInfo.get("clientType"));
headers.put("MACH_IP", MachInfo.get("param_ip"));
try {
retMsg = httpPostForm(url,params,headers,null);
bb.writeLog("===获取ST返回值===="+retMsg);
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")){
bb.writeLog("===获取ST返回值resMsg====" + resMsg);
if (resMsg.has("ST")) {
ST = Util.null2String(resMsg.get("ST").toString());
}
bb.writeLog("===获取ST===="+ST);
}catch(Exception e){
bb.writeLog("===获取ST====" + ST);
} catch (Exception e) {
throw new RuntimeException(e);
}
return retMsg;
}
public static String getSysUrl(String sysid){
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()){
rs.executeQuery("select * from uf_otherSysInfo where id = ?", sysid);
if (rs.next()) {
url = Util.null2String(rs.getString("xtdz"));
}else {
} else {
return "-1";
}
url = url.trim();
if (!StringUtil.isBlank(url)){
if (!StringUtil.isBlank(url)) {
//判断是否带?号
if (url.indexOf("?") == -1){
url = url+"?";
}else{
url = url+"&";
if (url.indexOf("?") == -1) {
url = url + "?";
} else {
url = url + "&";
}
};
}
;
return url;
}
public static String getsysSSOurl(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("hqdddz"));
} else {
return "-1";
}
new BaseBean().writeLog("hqdddz====" + url);
url = url.trim();
// if (!StringUtil.isBlank(url)){
// //判断是否带?号
// if (url.indexOf("?") == -1){
// url = url+"?";
// }else{
// url = url+"&";
// }
// };
return url;
}
public static boolean isDifferenceGreaterThan(String timeStr2, int hours) {
// 定义日期时间格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// 解析字符串为LocalDateTime对象
// LocalDateTime time1 = LocalDateTime.parse(timeStr1, formatter);
LocalDateTime now = LocalDateTime.now();
LocalDateTime time2 = LocalDateTime.parse(timeStr2, formatter);
// 计算两个时间的差值(以小时为单位)
// long hoursDifference = ChronoUnit.HOURS.between(time1, time2);
long hoursDifference = ChronoUnit.SECONDS.between(now, time2);
System.out.println(hoursDifference);
// 检查差值是否大于给定的小时数
return Math.abs(hoursDifference) > (long) hours * 60 * 60;
}
public String getEMToken() {
try {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("http://10.200.1.69:9001/emp/api/gettoken?corpid=t963B4AC53420B211F7B01CC29004FB03&corpsecret=0a99c695-bf19-4989-af15-1aa284f98a92")
.get()
.build();
Response response = client.newCall(request).execute();
String responseStr = response.body().string();
JSONObject responseJson = JSONObject.parseObject(responseStr);
if ("0".equals(responseJson.get("errcode")+"")){
return responseJson.getString("access_token");
}else {
return responseJson.getString("errmsg");
}
} catch (Exception e) {
return e.getMessage();
}
}
public String EMExt(String access_token,String jsonStr) {
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType,jsonStr);
Request request = new Request.Builder()
.url("http://10.200.1.69:9001/emp/api/integrate/func/offline?access_token="+access_token)
.post(body)
.addHeader("content-type", "application/json")
.build();
try {
Response response = client.newCall(request).execute();
String responseStr = response.body().string();
JSONObject responseJson = JSONObject.parseObject(responseStr);
if ("0".equals(responseJson.get("errcode"))){
return responseJson.getString("errmsg");
}else {
return responseJson.getString("errmsg");
}
} catch (Exception e) {
e.printStackTrace();
return e.getMessage();
}
}
%>
<%
RecordSet rs = new RecordSet();
BaseBean bb=new BaseBean();
BaseBean bb = new BaseBean();
RSA rsa = new RSA();
Map<String,String> params = new HashMap<>();//参数
Map<String,String> headers = new HashMap<>();//headers
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 ST = "";//获取ST
bb.writeLog("进入跳转异构系统jsp-->");
try {
new BaseBean().writeLog("header====>" + JSONObject.toJSONString(request));
new BaseBean().writeLog("header====>" + request.getHeader("User-Agent"));
} catch (Exception e) {
new BaseBean().writeLog("error===>" + e.getMessage());
}
Map<String, Object> paramsMap = ParamUtil.request2Map(request);
new BaseBean().writeLog("paramsMap===>" + JSONObject.toJSONString(paramsMap));
String deviceId = Util.null2String(paramsMap.get("deviceId"));
String clientType = Util.null2String(paramsMap.get("clientType"));
if ("2".equals(clientType)) {
clientType = "0";
} else if ("3".equals(clientType)) {
clientType = "1";
}
String param_ip = Util.null2String(paramsMap.get("param_ip"));
new BaseBean().writeLog("paramsMap===>" + paramsMap);
new BaseBean().writeLog("deviceId===>" + deviceId);
new BaseBean().writeLog("clientType===>" + clientType);
HashMap<String, String> MachInfo = new HashMap<>();
MachInfo.put("deviceId", deviceId.isEmpty() ? "123" : deviceId);
MachInfo.put("clientType", clientType.isEmpty() ? "1" : clientType);
MachInfo.put("param_ip", param_ip.isEmpty() ? "127.0.0.1" : param_ip);
String sysid = (String) paramsMap.get("sysid");
if (StringUtil.isBlank(sysid)){
if (StringUtil.isBlank(sysid)) {
out.print("sysid为空");
return;
}
String sysUrl = getSysUrl(sysid);
if ("-1".equals(sysUrl)){
if ("-1".equals(sysUrl)) {
out.print("系统url为空");
return;
}
@ -533,60 +655,64 @@
User user = HrmUserVarify.getUser(request, response);
int uid = user.getUID();
bb.writeLog("uid-->"+uid);
bb.writeLog("uid-->" + uid);
rs.executeQuery("select id,loginid,password,createtime from EmobileLoginDetail where id=?", uid);
if(rs.next()){
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);
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);
String certified_token_expires = Util.null2String(session.getAttribute("certified_token_expires"));
bb.writeLog("获取sessionTGT==" + certified_token);
//获取cookie
Cookie[] cookies = request.getCookies();
bb.writeLog("获取cookies=="+cookies);
bb.writeLog("获取cookies==" + cookies);
String idd = "";
if(cookies != null){
for(Cookie cookie:cookies){
bb.writeLog("获取cookiesName=="+cookie.getName());
if(cookie.getName().equals("loginidweaver")){
if (cookies != null) {
for (Cookie cookie : cookies) {
bb.writeLog("获取cookiesName==" + cookie.getName());
if (cookie.getName().equals("loginidweaver")) {
idd = cookie.getValue();
bb.writeLog("获取idd=="+idd);
bb.writeLog("获取idd==" + idd);
}
}
}
//查询人员工号
RecordSet recordSet = new RecordSet();
String requestURI = request.getRequestURI();
bb.writeLog("请求路径="+requestURI);
bb.writeLog("请求路径=" + requestURI);
Map<String, Object> useridMap = ParamUtil.request2Map(request);
bb.writeLog("人员id="+useridMap.get("userid"));
bb.writeLog("人员id=" + useridMap.get("userid"));
recordSet.executeQuery("select WORKCODE from HRMRESOURCE where id=?", Util.null2String(useridMap.get("userid")));
String workcode = "";
if (recordSet.next()){
if (recordSet.next()) {
workcode = Util.null2String(recordSet.getString("WORKCODE"));
}
bb.writeLog("人员workcode="+useridMap.get("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地址
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 cockpitUrl = getsysSSOurl(sysid);
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)){
if (!isEmpty(certified_token) && !isDifferenceGreaterThan(certified_token_expires, 4)) {
bb.writeLog("TGT未失效");
String responseInfo = getST(certified_token, cockpitUrl, MachInfo);
bb.writeLog("进入responseInfo-->" + responseInfo);
if (isEmpty(responseInfo)) {
out.print("单点系统接口返回值为null");
return;
}else {
} else {
org.json.JSONObject stMsg = new org.json.JSONObject(responseInfo);
if(stMsg.has("ST")){
if (stMsg.has("ST")) {
ST = Util.null2String(stMsg.get("ST").toString());
}else{
} else {
out.print(Util.null2String(stMsg.getString("message")));
return;
}
@ -595,56 +721,92 @@
// 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;
if (isEm == true) {
loginUrl = remuseUrl + "ticket=" + ST;
}
//loginUrl = "https://www.baidu.com/";
bb.writeLog("loginUrl-->"+loginUrl);
out.print("跳转路径-->"+loginUrl);
out.print("进入驾驶舱成功");
bb.writeLog("loginUrl-->" + loginUrl);
out.print("跳转路径-->" + loginUrl);
//out.print(loginUrl);
response.sendRedirect(loginUrl);
// request.getRequestDispatcher("loginUrl").forward(request,response);
// return;
}
}else {
String TGT ="";
String passWord ="";
String retMsg ="";
} else {
bb.writeLog("TGT已失效");
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();
String publicKey = getPublicKey(MachInfo);
passWord = encrypt(user_password, publicKey);
params = new HashMap<>();//参数
params.put("username",loginId);
params.put("password",passWord);
bb.writeLog("==STparams=="+params);
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");
headers.put("API_KEY", API_KEY);
headers.put("MACH_ID", MachInfo.get("deviceId"));
headers.put("MACH_TYPE", MachInfo.get("clientType"));
headers.put("MACH_IP", MachInfo.get("param_ip"));
retMsg = httpPostForm(tgturl,params,headers,null);
bb.writeLog("===获取TGT返回值retMsg===="+retMsg);
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")){
bb.writeLog("===获取TGT返回值====" + resMsg);
if (resMsg.has("TGT")) {
TGT = Util.null2String(resMsg.get("TGT").toString());
}else{
//密码不正确,执行强制退出
if ("2002".equals(resMsg.get("errorCode")+"")){
out.print("<h3 style='font-size: 20px;'>您的单点系统密码已修改,请重新登录,将在3秒后退出</h3>");
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
JSONObject postBody = new JSONObject();
postBody.put("sysid","84df78883322432f90eb599899365c7b");
postBody.put("userids",user.getUID());
postBody.put("offline_type","1");
postBody.put("client_type","1,2,3");
String errmsg = EMExt(getEMToken(), postBody.toJSONString());
}
});
thread.start();
return;
}else{
out.print(resMsg.get("message"));
return;
}
}
String responseInfo = getST(TGT,cockpitUrl);
if (isEmpty(responseInfo)){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date now = new Date();
Date expiresDate = new Date(now.getTime() + (4 * 60 * 60 * 1000));
request.getSession(true).setAttribute("certified_token_expires", sdf.format(expiresDate));//记录toekn失效日期时间
request.getSession(true).setAttribute("certified_token", TGT);//记录toekn
String responseInfo = getST(TGT, cockpitUrl, MachInfo);
if (isEmpty(responseInfo)) {
out.print("单点系统接口返回值为null");
return;
}else {
} else {
org.json.JSONObject stMsg = new org.json.JSONObject(responseInfo);
if(stMsg.has("ST")){
if (stMsg.has("ST")) {
ST = Util.null2String(stMsg.get("ST").toString());
}else{
} else {
bb.writeLog(stMsg);
out.print(Util.null2String(stMsg.getString("message")));
return;
}
@ -654,22 +816,16 @@
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;
if (isEm == true) {
loginUrl = remuseUrl + "ticket=" + ST;
}
bb.writeLog("loginUrl-->"+loginUrl);
out.print("跳转路径-->"+loginUrl);
out.print("进入驾驶舱成功");
bb.writeLog("loginUrl-->" + loginUrl);
//out.print(loginUrl);
response.sendRedirect(loginUrl);
// request.getRequestDispatcher("loginUrl").forward(request,response);
}
// out.print("进入驾驶舱系统失败,请先获取标识");
//return;
}
}
%>
 <script type="text/javascript">

@ -0,0 +1,750 @@
<%--
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" %>
<%@ page import="org.json.JSONException" %>
<%!
//获取分页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(Map<String, String> MachInfo){
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");
headers.put("MACH_ID",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
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,Map<String, String> MachInfo){
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");
headers.put("MACH_ID",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
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;
}
public static String getsysSSOurl(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("hqdddz"));
}else {
return "-1";
}
new BaseBean().writeLog("hqdddz===="+url);
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-->");
try {
new BaseBean().writeLog("header====>" + JSONObject.toJSONString(request));
new BaseBean().writeLog("header====>" + request.getHeader("User-Agent"));
}catch (Exception e){
new BaseBean().writeLog("error===>"+e.getMessage());
}
Map<String, Object> paramsMap = ParamUtil.request2Map(request);
new BaseBean().writeLog("paramsMap===>"+JSONObject.toJSONString(paramsMap) );
String deviceId = Util.null2String(paramsMap.get("deviceId"));
String clientType = Util.null2String(paramsMap.get("clientType"));
if("2".equals(clientType)){
clientType = "0";
}else if("3".equals(clientType)){
clientType = "1";
}
String param_ip = Util.null2String(paramsMap.get("param_ip"));
new BaseBean().writeLog("paramsMap===>"+paramsMap );
new BaseBean().writeLog("deviceId===>"+deviceId );
new BaseBean().writeLog("clientType===>"+clientType );
HashMap<String, String> MachInfo = new HashMap<>();
MachInfo.put("deviceId",deviceId.isEmpty()?UUID.randomUUID().toString():deviceId);
MachInfo.put("clientType",clientType.isEmpty()?"1":clientType);
MachInfo.put("param_ip",param_ip.isEmpty()?"127.0.0.1":param_ip);
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);
String loginid = (String) paramsMap.get("loginid");
rs.executeQuery("select id,loginid,password,createtime from EmobileLoginDetail where loginid=?", loginid);
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 cockpitUrl = getsysSSOurl(sysid);
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(loginUrl);
// 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(MachInfo);
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",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
retMsg = httpPostForm(tgturl,params,headers,null);
bb.writeLog("===获取TGT返回值retMsg===="+retMsg);
org.json.JSONObject resMsg = new org.json.JSONObject(retMsg);
if(resMsg.has("TGT")){
// out.print(resMsg);
TGT = Util.null2String(resMsg.get("TGT").toString());
}else {
out.print(resMsg.get("message"));
return;
}
String responseInfo = getST(TGT,cockpitUrl,MachInfo);
// out.print("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{
bb.writeLog(stMsg);
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("进入驾驶舱成功");
out.print(loginUrl);
// 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

@ -1,5 +0,0 @@
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

@ -0,0 +1,177 @@
<%@ page import="weaver.hrm.User" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.icbc.api.internal.apache.http.impl.cookie.S" %>
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="java.time.LocalDateTime" %>
<%@ page import="java.time.format.DateTimeParseException" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
User user = HrmUserVarify.getUser(request, response);
if (user == null){
out.print("暂无权限");
}
Map<String, Object> param = ParamUtil.request2Map(request);
String type = (String)param.get("type");
String sqr = (String)param.get("sqr");
String startDate = (String)param.get("startDate");
String endDate = (String)param.get("endDate");
//请休假审批单-总行部门正职 formtable_main_213
//请休假审批单-总行部门副职 formtable_main_214
//差旅审批单-总行员工正式 formtable_main_217
//测试环境的
String ZZform = "formtable_main_213";
String FZform = "formtable_main_214";
String YGform = "formtable_main_217";
//生产环境的
// String ZZform = "formtable_main_214";
// String FZform = "formtable_main_215";
// String YGform = "formtable_main_292";
String sql = "select main.*,req.*,record.workflowcode from ";
if ("0".equals(type)){
sql += ZZform;
}else if("1".equals(type)){
sql += FZform;
}else if("2".equals(type)){
sql += YGform;
}
sql += " main left join workflow_requestBase req on main.REQUESTID = req.REQUESTID ";
sql += " left join workflow_codeseqrecord record on main.REQUESTID = record.REQUESTID ";
sql += "where sqr = ? AND ";
sql += "wcsj <= ? AND hgsj >= ? ";
//在审批状态
sql += "and req.currentnodetype != 0 ";
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql,sqr,endDate,startDate);
writeLog(sql,sqr,endDate,startDate);
ArrayList<Map<String, String>> records = new ArrayList<>();
ArrayList<Map<String, String>> specialobjs = new ArrayList<>();
ArrayList<String> requestid = new ArrayList<>();
ArrayList<String> requestname = new ArrayList<>();
ArrayList<String> clxcdh = new ArrayList<>();
int i = 0;
while (recordSet.next()){
HashMap<String, String> record = new HashMap<>();
record.put("requestid",recordSet.getString("requestid"));
record.put("requestname",recordSet.getString("requestname"));
record.put("clxcdh",recordSet.getString("clxcdh"));
requestid.add(recordSet.getString("requestid"));
requestname.add(recordSet.getString("requestname"));
clxcdh.add(recordSet.getString("clxcdh"));
records.add(record);
HashMap<String, String> specialobj = new HashMap<>();
specialobj.put("id",recordSet.getString("requestid"));
specialobj.put("name",recordSet.getString("workflowcode")) ;
specialobjs.add(specialobj);
i++;
}
// out.print(requestid.toString());
//查看变更单是否有对冲突时间流程的修改
String querybgdsql = "select * from formtable_main_282 where id = " +
"(select max(id) from formtable_main_282 where dcyslc = ? )";
ArrayList<String> requestidNew = new ArrayList<>();
for (String rid : requestid) {
recordSet.executeQuery(querybgdsql,rid);
if(recordSet.next()){
//获取修改变更单最新的一条
String start = recordSet.getString("wcsj");
String end = recordSet.getString("hgsj");
// out.print(start);
// out.print(end);
// out.print(startDate);
// out.print(endDate);
if (isOverlapping(start,end,startDate,endDate)){
requestidNew.add(rid);
}else{
// 如果变更后不冲突去掉这条数据
removeElement(records,"requestid",rid);
removeElement(specialobjs,"id",rid);
i--;
}
}else{
// 没有变更单的情况
requestidNew.add(rid);
}
}
requestid = requestidNew;
//再查询下变更表里有没有变更后冲突的数据
String queryBGBSql = "select main.*,req.*,record.workflowcode from formtable_main_282 main left join workflow_requestBase base " +
"on main.requestid = base.requestid " +
" left join workflow_codeseqrecord record on main.REQUESTID = record.REQUESTID " +
"where dcyslc not in ( " +String.join(",",requestid)+" ) " +
"AND wcsj <= ? AND hgsj >= ? " +
"AND sqr = ? ";
recordSet.executeQuery(queryBGBSql,endDate,startDate,sqr);
// out.print(queryBGBSql+"|"+endDate+"|"+startDate+"|"+sqr);
while (recordSet.next()){
HashMap<String, String> record = new HashMap<>();
record.put("requestid",recordSet.getString("requestid"));
record.put("requestname",recordSet.getString("requestname"));
// record.put("clxcdh",recordSet.getString("clxcdh"));
requestid.add(recordSet.getString("requestid"));
// requestname.add(recordSet.getString("requestname"));
// clxcdh.add(recordSet.getString("clxcdh"));
records.add(record);
HashMap<String, String> specialobj = new HashMap<>();
specialobj.put("id",recordSet.getString("requestid"));
specialobj.put("name",recordSet.getString("workflowcode"));
specialobjs.add(specialobj);
i++;
}
HashMap<String, Object> result = new HashMap<>();
result.put("code",0);
result.put("count",i);
result.put("requestid",String.join(",",requestid));
result.put("requestname",String.join(",",requestname));
result.put("clxcdh",String.join(",",clxcdh));
result.put("specialobjs",specialobjs);
result.put("result",records);
out.print(JSONObject.toJSONString(result));
%>
<%!
private void writeLog(Object... log){
new BaseBean().writeLog("queryDuplicatedataSL===>"+ Arrays.toString(log));;
}
public static boolean isOverlapping(String start1, String end1, String start2, String end2) {
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
try {
LocalDateTime dateTimeStart1 = LocalDateTime.parse(start1, formatter);
LocalDateTime dateTimeEnd1 = LocalDateTime.parse(end1, formatter);
LocalDateTime dateTimeStart2 = LocalDateTime.parse(start2, formatter);
LocalDateTime dateTimeEnd2 = LocalDateTime.parse(end2, formatter);
return !dateTimeStart1.isAfter(dateTimeEnd2) && !dateTimeEnd1.isBefore(dateTimeStart2);
} catch (DateTimeParseException e) {
e.printStackTrace();
return false;
}
}
public static void removeElement(List<Map<String, String>> list , String key, String value){
Iterator<Map<String, String>> iterator = list.iterator();
while (iterator.hasNext()) {
Map<String, String> map = iterator.next();
if (map.getOrDefault(key, "").equals(value)) {
iterator.remove();
}
}
}
%>

@ -0,0 +1,174 @@
<%@ page import="weaver.hrm.User" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="java.time.LocalDateTime" %>
<%@ page import="java.time.format.DateTimeParseException" %>
<%@ page import="weaver.conn.RecordSetTrans" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
User user = HrmUserVarify.getUser(request, response);
if (user == null){
out.print("暂无权限");
}
Map<String, Object> param = ParamUtil.request2Map(request);
String reqid = (String)param.get("requestid");
String sqr = (String)param.get("sqr");
String startDate = (String)param.get("startDate");
String endDate = (String)param.get("endDate");
//差旅行程变更审批单
String sql = "select main.*,req.*,record.workflowcode from ";
sql += getFormName(reqid);
sql += " main left join workflow_requestBase req on main.REQUESTID = req.REQUESTID ";
sql += " left join workflow_codeseqrecord record on main.REQUESTID = record.REQUESTID ";
sql += "where sqr = ? AND ";
sql += "wcsj <= ? AND hgsj >= ? ";
//在审批状态
sql += "and req.currentnodetype != 0 ";
sql += "and req.REQUESTID != ? ";
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql,sqr,endDate,startDate,reqid);
writeLog(sql,sqr,endDate,startDate,reqid);
ArrayList<Map<String, String>> records = new ArrayList<>();
ArrayList<Map<String, String>> specialobjs = new ArrayList<>();
ArrayList<String> requestid = new ArrayList<>();
ArrayList<String> requestname = new ArrayList<>();
ArrayList<String> clxcdh = new ArrayList<>();
int i = 0;
while (recordSet.next()){
HashMap<String, String> record = new HashMap<>();
record.put("requestid",recordSet.getString("requestid"));
record.put("requestname",recordSet.getString("requestname"));
record.put("clxcdh",recordSet.getString("clxcdh"));
requestid.add(recordSet.getString("requestid"));
// requestname.add(recordSet.getString("requestname"));
// clxcdh.add(recordSet.getString("clxcdh"));
records.add(record);
HashMap<String, String> specialobj = new HashMap<>();
specialobj.put("id",recordSet.getString("requestid"));
specialobj.put("name",recordSet.getString("workflowcode"));
specialobjs.add(specialobj);
i++;
}
//查看变更单是否有对冲突时间流程的修改
String querybgdsql = "select * from formtable_main_293 where id = " +
"(select max(id) from formtable_main_293 where dcyslc = ? )";
ArrayList<String> requestidNew = new ArrayList<>();
for (String rid : requestid) {
recordSet.executeQuery(querybgdsql,rid);
if(recordSet.next()){
//获取修改变更单最新的一条
String start = recordSet.getString("wcsj");
String end = recordSet.getString("hgsj");
if (isOverlapping(start,end,startDate,endDate)){
requestidNew.add(rid);
}else{
// 如果变更后不冲突去掉这条数据
removeElement(records,"requestid",rid);
removeElement(specialobjs,"id",rid);
i--;
}
}else{
// 没有变更单的情况
requestidNew.add(rid);
}
}
requestid = requestidNew;
//再查询下变更表里有没有变更后冲突的数据
String queryBGBSql = "select main.*,req.*,record.workflowcode from formtable_main_293 main left join workflow_requestBase base " +
" on main.requestid = base.requestid " +
" left join workflow_codeseqrecord record on main.REQUESTID = record.REQUESTID " +
"where dcyslc not in ( " +String.join(",",requestid)+" ) " +
"AND wcsj <= ? AND hgsj >= ? " +
"AND sqr = ? ";
recordSet.executeQuery(queryBGBSql,endDate,startDate,sqr);
while (recordSet.next()){
HashMap<String, String> record = new HashMap<>();
record.put("requestid",recordSet.getString("requestid"));
record.put("requestname",recordSet.getString("requestname"));
// record.put("clxcdh",recordSet.getString("clxcdh"));
requestid.add(recordSet.getString("requestid"));
// requestname.add(recordSet.getString("requestname"));
// clxcdh.add(recordSet.getString("clxcdh"));
records.add(record);
HashMap<String, String> specialobj = new HashMap<>();
specialobj.put("id",recordSet.getString("requestid"));
specialobj.put("name",recordSet.getString("workflowcode"));
specialobjs.add(specialobj);
i++;
}
HashMap<String, Object> result = new HashMap<>();
result.put("code",0);
result.put("count",i);
result.put("requestid",String.join(",",requestid));
result.put("requestname",String.join(",",requestname));
result.put("clxcdh",String.join(",",clxcdh));
result.put("specialobjs",specialobjs);
result.put("result",records);
out.print(JSONObject.toJSONString(result));
%>
<%!
private void writeLog(Object... log){
new BaseBean().writeLog("queryDuplicatedataSL===>"+ Arrays.toString(log));;
}
/**
* 根据request获取表单名称
* @param requestid
* @return
*/
private String getFormName(String requestid){
String QueryWfidsql = "select workflowid from workflow_requestbase where requestid = ?";
String QueryFormsql = "select base.ID , bill.TABLENAME from workflow_base base " +
"left join workflow_bill bill on base.FORMID = bill.ID where base.id = ?";
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(QueryWfidsql,requestid);
recordSet.next();
String workflowid = recordSet.getString("workflowid");
recordSet.executeQuery(QueryFormsql,workflowid);
recordSet.next();
return recordSet.getString("TABLENAME");
}
public static boolean isOverlapping(String start1, String end1, String start2, String end2) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
try {
LocalDateTime dateTimeStart1 = LocalDateTime.parse(start1, formatter);
LocalDateTime dateTimeEnd1 = LocalDateTime.parse(end1, formatter);
LocalDateTime dateTimeStart2 = LocalDateTime.parse(start2, formatter);
LocalDateTime dateTimeEnd2 = LocalDateTime.parse(end2, formatter);
return !dateTimeStart1.isAfter(dateTimeEnd2) && !dateTimeEnd1.isBefore(dateTimeStart2);
} catch (DateTimeParseException e) {
e.printStackTrace();
return false;
}
}
public static void removeElement(List <Map<String, String>> list ,String key,String value){
// 条件:删除所有 age 值为 "30" 的 Map
Iterator<Map<String, String>> iterator = list.iterator();
while (iterator.hasNext()) {
Map<String, String> map = iterator.next();
if (map.getOrDefault(key, "").equals(value)) {
iterator.remove();
}
}
}
%>

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

@ -0,0 +1,109 @@
<%@ page import="java.io.FileInputStream" %>
<%@ page import="java.net.URLEncoder" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="com.api.login.util.LoginUtil" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="com.icbc.api.internal.apache.http.impl.cookie.S" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="java.time.LocalDate" %>
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.general.StringUtil" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
Map<String, Object> apidatas = new HashMap<String, Object>();
try {
//获取当前用户
User user = HrmUserVarify.getUser(request, response);
RecordSet rs = new RecordSet();
RecordSet recordSet = new RecordSet();
JSONArray conArr = new JSONArray();
JSONObject dataObj = new JSONObject();
String userid = user.getUID() + "";
boolean isdialog = true;
LocalDate now = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String nowStr = now.format(formatter);
String id = "";
String title = "";
String backgroundAddress = "";
String sql = "select * from uf_MsgTopDialog where startDate <= ? and endDate >= ? order by id desc";
rs.executeQuery(sql, nowStr, nowStr);
while (rs.next()) {
String dataid = Util.null2String(rs.getString("id"));
String scope = Util.null2String(rs.getString("scope"));
String role = Util.null2String(rs.getString("role"));
boolean isLatest = getLatestData(dataid, user, recordSet, scope, role);
if (isLatest) {
id = Util.null2String(rs.getString("id"));
title = Util.null2String(rs.getString("title"));
backgroundAddress = Util.null2String(rs.getString("backgroundAddress"));
break;
}
}
if (!"".equals(id)) {
sql = "select count(1) as sl from uf_MsgTopDialog_dt2 where mainid = '" + id + "' and hrmid = '" + userid + "'";
rs.execute(sql);
while (rs.next()) {
if (Util.getIntValue(rs.getString("sl")) > 0) {
isdialog = false;
}
}
} else {
isdialog = false;
}
if (isdialog){
dataObj.put("id", id);
dataObj.put("tilte", title);
dataObj.put("backgroundAddress", backgroundAddress);
}
apidatas.put("data", dataObj);
apidatas.put("api_status", true);
} catch (Exception e) {
e.printStackTrace();
apidatas.put("api_status", false);
apidatas.put("api_errormsg", "getVersionInfo catch exception : " + e.getMessage());
}
out.print(JSONObject.toJSONString(apidatas));
%>
<%!
private boolean getLatestData(String id, User user, RecordSet recordSet, String scope, String role) {
HrmUserVarify hrmUserVarify = new HrmUserVarify();
if ("0".equals(scope)) {
//角色
if (!StringUtil.isEmpty(role)) {
String[] roleArr = role.split(",");
for (String roleid : roleArr) {
boolean b = hrmUserVarify.checkUserRole(roleid, user, user.getUserDepartment() + "");
if(b){
return true;
}
}
}
} else if ("1".equals(scope)) {
//多人力
String sql = "select count(main.id) cnt from uf_MsgTopDialog main left join uf_MsgTopDialog_dt1 dt on main.id = dt.mainid where main.id = ? and dt.hrmid = ?";
recordSet.executeQuery(sql,id,user.getUID());
if(recordSet.next()){
int cnt = recordSet.getInt("cnt");
if(cnt > 0 ){
return true;
}
}
}
return false;
}
%>

@ -0,0 +1,37 @@
<%@ page import="weaver.conn.RecordSetDataSource" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="com.engine.custom.corn.util.ReportUtil" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
%>
<%!
public void execute() {
RecordSetDataSource em7rs = new RecordSetDataSource("em7");
RecordSetDataSource emprs = new RecordSetDataSource("emp_msg");
RecordSet rs = new RecordSet();
RecordSet rs2 = new RecordSet();
RecordSet rs3 = new RecordSet();
String roleMember = ReportUtil.getRoleMember(rs);
updateRoleGjc(rs,roleMember);
updateGjcOfficialWf(rs);
}
private void updateRoleGjc(RecordSet rs, String roleMember) {
rs.executeUpdate(" update uf_personreport set gjc = '统筹全局' where ry in ( " + roleMember + ")" );
}
//更新公文办理数前10的人
private void updateGjcOfficialWf(RecordSet rs ,int rownum ){
rs.executeUpdate(" update uf_personreport set gjc = '人形公文处理机' where id in( " +
" select rk.id from ( " +
" select ROW_NUMBER() OVER (ORDER BY qnljclgw DESC) AS rank , * from uf_personreport where qnljclgw is not null and qnljclgw != 0 and gjc is null" +
" ) rk where rk.rank < " + rownum );
}
public static void main(String[] args) {
}
%>

@ -0,0 +1,749 @@
<%@ 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" %>
<%@ page import="org.json.JSONException" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Simple JSP Form</title>
</head>
<body>
<%!
//获取分页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(Map<String, String> MachInfo){
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");
headers.put("MACH_ID",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
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,Map<String, String> MachInfo){
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");
headers.put("MACH_ID",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
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;
}
public static String getsysSSOurl(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("hqdddz"));
}else {
return "-1";
}
new BaseBean().writeLog("hqdddz===="+url);
url = url.trim();
// if (!StringUtil.isBlank(url)){
// //判断是否带?号
// if (url.indexOf("?") == -1){
// url = url+"?";
// }else{
// url = url+"&";
// }
// };
return url;
}
%>
<%
// 检查是否有表单提交
String ST ="";//获取ST
String STurl ="";//获取ST
String loginid ="";//获取ST
if ("POST".equalsIgnoreCase(request.getMethod())) {
RecordSet rs = new RecordSet();
BaseBean bb=new BaseBean();
RSA rsa = new RSA();
out.print("123456");
if(1==1){
return;
}
Map<String,String> params = new HashMap<>();//参数
Map<String,String> headers = new HashMap<>();//headers
JSONArray array = new JSONArray();
List<String> decriptList = new ArrayList<>();
bb.writeLog("进入获取简历jsp-->");
STurl = request.getParameter("url");
loginid = request.getParameter("loginid");
Map<String, Object> paramsMap = ParamUtil.request2Map(request);
new BaseBean().writeLog("paramsMap===>"+JSONObject.toJSONString(paramsMap) );
String deviceId = Util.null2String(paramsMap.get("deviceId"));
String clientType = Util.null2String(paramsMap.get("clientType"));
if("2".equals(clientType)){
clientType = "0";
}else if("3".equals(clientType)){
clientType = "1";
}
String param_ip = Util.null2String(paramsMap.get("param_ip"));
new BaseBean().writeLog("paramsMap===>"+paramsMap );
new BaseBean().writeLog("deviceId===>"+deviceId );
new BaseBean().writeLog("clientType===>"+clientType );
HashMap<String, String> MachInfo = new HashMap<>();
MachInfo.put("deviceId",deviceId.isEmpty()?"123":deviceId);
MachInfo.put("clientType",clientType.isEmpty()?"1":clientType);
MachInfo.put("param_ip",param_ip.isEmpty()?"127.0.0.1":param_ip);
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 loginid=?", loginid);
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 cockpitUrl = STurl;
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(loginUrl);
// 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(MachInfo);
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",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
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,MachInfo);
if (isEmpty(responseInfo)){
out.print("单点系统接口返回值为null");
return;
}else {
org.json.JSONObject stMsg = new org.json.JSONObject(responseInfo);
out.print(stMsg);
if(stMsg.has("ST")){
ST = Util.null2String(stMsg.get("ST").toString());
}else{
bb.writeLog(stMsg);
out.print(Util.null2String(stMsg.getString("message")));
return;
}
String loginUrl = "";
// String remuseUrl = bb.getPropValue("tjbkremuse", "hbUrl");
String remuseUrl = "";
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("进入驾驶舱成功");
// out.print(loginUrl);
// response.sendRedirect(loginUrl);
// request.getRequestDispatcher("loginUrl").forward(request,response);
// }
// out.print("进入驾驶舱系统失败,请先获取标识");
//return;
}
}
%>
<h2>输入框与数据回显</h2>
<!-- 表单 -->
<form method="POST">
<label for="loginid">工号:</label>
<input type="text" name="loginid" id="loginid" />
<label for="STurl">地址:</label>
<input type="text" name="STurl" id="STurl" />
<button type="submit">提交</button>
</form>
<!-- 显示提交的数据 -->
<h3>提交的数据:</h3>
<p><%= loginid %></p>
<p><%= STurl %></p>
<p><%= ST %></p>
</body>
</html>

@ -0,0 +1,124 @@
<%@ page import="com.engine.custom.sl.entity.EsbRequestHeader" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%@ page import="com.engine.custom.sl.entity.TravelToEsbBean" %>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ page import="com.engine.util.SocketClientUtil" %>
<%@ page import="com.engine.util.XMLUtils" %>
<%@ page import="java.util.Map" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%@ page import="java.net.Socket" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.general.StringUtil" %>
<%@ page import="java.io.*" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
// Map<String, Object> param = ParamUtil.request2Map(request);
// String workCode = param.get("workCode").toString();
String workCode = HrmUserVarify.getUser(request, response).getLoginid();
String timeStr = generateTimestamp();
EsbRequestHeader esbRequestHeader = new EsbRequestHeader();
esbRequestHeader.setService_sn(timeStr+workCode);
esbRequestHeader.setSystem_id("0217");
esbRequestHeader.setRequester_id("0258");
esbRequestHeader.setBranch_id("KHCP0003");
esbRequestHeader.setChannel_id("24");
esbRequestHeader.setService_time(timeStr);
esbRequestHeader.setNeed_request("");
esbRequestHeader.setSvcCd("500130012");
esbRequestHeader.setSvcScn("24");
String bnkSrlNo = esbRequestHeader.getRequester_id() + timeStr + workCode;
esbRequestHeader.setBnkSrlNo(bnkSrlNo);
esbRequestHeader.setFileFlg("0");
String Service_Body = "<Service_Body><request><path>todo</path><method>getCount</method><args><entry><key>userNum</key><value>"+workCode+"</value></entry></args></request></Service_Body>" ;
String Service_Header = TravelToEsbBean.convertObjectToXml(esbRequestHeader,"Service_Header");
String serviceXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Service>";
// out.print("UTF_8_serviceXML==="+ serviceXML);
serviceXML = serviceXML + Service_Header + Service_Body;
serviceXML = serviceXML + "</Service>";
// out.print("UTF_8_serviceXML==="+ serviceXML);
String length = String.format("%08d", serviceXML.length());
serviceXML = length + serviceXML;
serviceXML = new String(serviceXML.getBytes(StandardCharsets.UTF_8));
String send = "";
try {
send = send(serviceXML);
// out.print("返回=="+send);
}catch (Exception e){
// out.print("异常=="+ e.getMessage());
}
// SocketClientUtil scketClient = new SocketClientUtil("14.1.76.116",10149);
// String substring = send.substring(0, 8);
// String substring1 = send.substring(8);
// out.print(substring);
Map<String, String> map = XMLUtils.parseXMLToMap(send);
JSONObject jsonObject = new JSONObject();
jsonObject.put("count", Util.getIntValue(map.get("count")));
out.print(jsonObject.toJSONString());
%>
<%!
public String send(String request) throws Exception {
// bs.writeLog("Client Start...");
BaseBean bs = new BaseBean();
Socket socket = null;
try {
//创建一个流套接字并将其连接到指定主机上的指定端口号
socket = new Socket("14.1.78.197",10149);
// String str = "00000612<?xml version=\"1.0\" encoding=\"UTF-8\"?><Service><Service_Header><service_sn>1010157060000081243</service_sn><system_id>0258</system_id><requester_id>0157</requester_id><branch_id>010231100</branch_id><channel_id>01</channel_id><service_time>20230905104426</service_time><need_request>true</need_request><SvcCd>500130004</SvcCd><SvcScn>13</SvcScn><BnkSrlNo>015720230905060000081243</BnkSrlNo><FileFlg>0</FileFlg></Service_Header><Service_Body><request><path>todo</path><method>getCount</method><args><entry><key>userNum</key><value>10913026任广鹏是个大刷币</value></entry></args></request></Service_Body></Service>";
// System.out.println(str);
//读取服务器端数据
BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream(), StandardCharsets.UTF_8));
//向服务器端发送数据
// PrintStream out = new PrintStream(new OutputStreamWriter(socket.getOutputStream(),StandardCharsets.UTF_8));
PrintWriter out = new PrintWriter(new OutputStreamWriter(socket.getOutputStream(),StandardCharsets.UTF_8),true);
out.println(request);
char[] datalen=new char[8];//报文前八位为报文体总长度
input.read(datalen,0,8);
String lendata=new String (datalen);
int length=Integer.parseInt(lendata);
new BaseBean().writeLog("报文长度"+length);
char[] data=new char[length];
int datalength = input.read(data,0,length);
String requestData = new String(data);
new BaseBean().writeLog("requestData",requestData);
// String ret = input.readLine();
System.out.println("服务器端返回过来的是: " + requestData);
bs.writeLog("服务器端返回过来的是: " + requestData);
// 如接收到 "OK" 则断开连接
if (!StringUtil.isEmpty(requestData)) {
bs.writeLog("客户端将关闭连接");
System.out.println("客户端将关闭连接: " + requestData);
Thread.sleep(500);
}
out.close();
input.close();
return requestData;
} catch (Exception e) {
bs.writeLog("客户端异常:" + e.getMessage());
throw e;
} finally {
if (socket != null) {
try {
socket.close();
} catch (IOException e) {
socket = null;
bs.writeLog("客户端 finally 异常:" + e.getMessage());
}
}
}
// return "-1";
}
public static String generateTimestamp() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
Date currentDate = new Date();
return dateFormat.format(currentDate);
}
%>

@ -0,0 +1,124 @@
<%@ page import="com.engine.custom.sl.entity.EsbRequestHeader" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%@ page import="com.engine.custom.sl.entity.TravelToEsbBean" %>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ page import="com.engine.util.SocketClientUtil" %>
<%@ page import="com.engine.util.XMLUtils" %>
<%@ page import="java.util.Map" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%@ page import="java.net.Socket" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.general.StringUtil" %>
<%@ page import="java.io.*" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
// Map<String, Object> param = ParamUtil.request2Map(request);
// String workCode = param.get("workCode").toString();
String workCode = HrmUserVarify.getUser(request, response).getLoginid();
String timeStr = generateTimestamp();
EsbRequestHeader esbRequestHeader = new EsbRequestHeader();
esbRequestHeader.setService_sn(timeStr+workCode);
esbRequestHeader.setSystem_id("0257");
esbRequestHeader.setRequester_id("0258");
esbRequestHeader.setBranch_id("FZKHCP001");
esbRequestHeader.setChannel_id("26");
esbRequestHeader.setService_time(timeStr);
esbRequestHeader.setNeed_request("");
esbRequestHeader.setSvcCd("500130012");
esbRequestHeader.setSvcScn("26");
String bnkSrlNo = esbRequestHeader.getRequester_id() + timeStr + workCode;
esbRequestHeader.setBnkSrlNo(bnkSrlNo);
esbRequestHeader.setFileFlg("0");
String Service_Body = "<Service_Body><request><path>todo</path><method>getCount</method><args><entry><key>userNum</key><value>"+workCode+"</value></entry></args></request></Service_Body>" ;
String Service_Header = TravelToEsbBean.convertObjectToXml(esbRequestHeader,"Service_Header");
String serviceXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Service>";
// out.print("UTF_8_serviceXML==="+ serviceXML);
serviceXML = serviceXML + Service_Header + Service_Body;
serviceXML = serviceXML + "</Service>";
// out.print("UTF_8_serviceXML==="+ serviceXML);
String length = String.format("%08d", serviceXML.length());
serviceXML = length + serviceXML;
serviceXML = new String(serviceXML.getBytes(StandardCharsets.UTF_8));
String send = "";
try {
send = send(serviceXML);
// out.print("返回=="+send);
}catch (Exception e){
out.print("异常=="+ e.getMessage());
}
// SocketClientUtil scketClient = new SocketClientUtil("14.1.76.116",10149);
// String substring = send.substring(0, 8);
// String substring1 = send.substring(8);
// out.print(substring);
Map<String, String> map = XMLUtils.parseXMLToMap(send);
JSONObject jsonObject = new JSONObject();
jsonObject.put("count", Util.getIntValue(map.get("count")));
out.print(jsonObject.toJSONString());
%>
<%!
public String send(String request) throws Exception {
// bs.writeLog("Client Start...");
BaseBean bs = new BaseBean();
Socket socket = null;
try {
//创建一个流套接字并将其连接到指定主机上的指定端口号
socket = new Socket("14.1.78.197",10149);
// String str = "00000612<?xml version=\"1.0\" encoding=\"UTF-8\"?><Service><Service_Header><service_sn>1010157060000081243</service_sn><system_id>0258</system_id><requester_id>0157</requester_id><branch_id>010231100</branch_id><channel_id>01</channel_id><service_time>20230905104426</service_time><need_request>true</need_request><SvcCd>500130004</SvcCd><SvcScn>13</SvcScn><BnkSrlNo>015720230905060000081243</BnkSrlNo><FileFlg>0</FileFlg></Service_Header><Service_Body><request><path>todo</path><method>getCount</method><args><entry><key>userNum</key><value>10913026任广鹏是个大刷币</value></entry></args></request></Service_Body></Service>";
// System.out.println(str);
//读取服务器端数据
BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream(), StandardCharsets.UTF_8));
//向服务器端发送数据
// PrintStream out = new PrintStream(new OutputStreamWriter(socket.getOutputStream(),StandardCharsets.UTF_8));
PrintWriter out = new PrintWriter(new OutputStreamWriter(socket.getOutputStream(),StandardCharsets.UTF_8),true);
out.println(request);
char[] datalen=new char[8];//报文前八位为报文体总长度
input.read(datalen,0,8);
String lendata=new String (datalen);
int length=Integer.parseInt(lendata);
new BaseBean().writeLog("报文长度"+length);
char[] data=new char[length];
int datalength = input.read(data,0,length);
String requestData = new String(data);
new BaseBean().writeLog("requestData",requestData);
// String ret = input.readLine();
System.out.println("服务器端返回过来的是: " + requestData);
bs.writeLog("服务器端返回过来的是: " + requestData);
// 如接收到 "OK" 则断开连接
if (!StringUtil.isEmpty(requestData)) {
bs.writeLog("客户端将关闭连接");
System.out.println("客户端将关闭连接: " + requestData);
Thread.sleep(500);
}
out.close();
input.close();
return requestData;
} catch (Exception e) {
bs.writeLog("客户端异常:" + e.getMessage());
throw e;
} finally {
if (socket != null) {
try {
socket.close();
} catch (IOException e) {
socket = null;
bs.writeLog("客户端 finally 异常:" + e.getMessage());
}
}
}
// return "-1";
}
public static String generateTimestamp() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
Date currentDate = new Date();
return dateFormat.format(currentDate);
}
%>

@ -7,6 +7,7 @@
<%@ page import="java.util.HashMap" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.icbc.api.internal.apache.http.impl.cookie.S" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
@ -15,6 +16,7 @@
// out.print(id);
ArrayList<Map<String, String>> sourceidsList = new ArrayList<Map<String, String>>();
RecordSet recordSet = new RecordSet();
BaseBean baseBean = new BaseBean();
recordSet.executeQuery("select lcbt from uf_CCSPDTZ where id = ?",id);
int lc = 0;
if (recordSet.next()){
@ -23,28 +25,39 @@
// out.print(lc+"\n");
String sqlWhere = " where JouneryID ";
String FlightsqlWhere = " where JourneyID ";
String HotelsqlWhere = " where HotelRelatedJourneyNo ";
// uf_CCBGJLB
recordSet.executeQuery("select mainid from uf_CCBGJLB_dt1 where ccbgjllc = ?",lc);
if(recordSet.getCounts() == 0){
// recordSet.executeQuery("select lc from uf_CCBGJLB ccqqlc = ?",lc);
// recordSet.next();
sqlWhere =sqlWhere + "LIKE '"+lc+"%'";
FlightsqlWhere =FlightsqlWhere + "LIKE '"+lc+"%'";
HotelsqlWhere =HotelsqlWhere + "LIKE '"+lc+"%'";
}else {
recordSet.next();
String mainid = recordSet.getString("mainid");
recordSet.executeQuery("select ccqqlc from uf_CCBGJLB where id = ?",mainid);
recordSet.next();
String ccqqlc = recordSet.getString("ccqqlc");
sqlWhere =sqlWhere + "LIKE '"+ccqqlc+"%'";
sqlWhere = sqlWhere + "LIKE '"+ccqqlc+"%'";
FlightsqlWhere = FlightsqlWhere + "LIKE '"+ccqqlc+"%'";
HotelsqlWhere = HotelsqlWhere + "LIKE '"+ccqqlc+"%'";
recordSet.executeQuery("select ccbgjllc from uf_CCBGJLB_dt1 where mainid = ?",mainid);
while (recordSet.next()){
String ccbgjllc = recordSet.getString("ccbgjllc");
sqlWhere =sqlWhere + "or JouneryID LIKE '"+ccbgjllc+"%'";
sqlWhere =sqlWhere + " or JouneryID LIKE '"+ccbgjllc+"%'";
FlightsqlWhere =FlightsqlWhere + " or JourneyID LIKE '"+ccbgjllc+"%'";
HotelsqlWhere =HotelsqlWhere + " or HotelRelatedJourneyNo LIKE '"+ccbgjllc+"%'";
}
}
// out.print(sqlWhere+"\n");
// sqlWhere = sqlWhere + "or JouneryID LIKE '"+332337+"%'";
baseBean.writeLog("sqlWhere===>"+sqlWhere);
recordSet.execute("select * from ctrip_SettlemenTrainOrdert" + sqlWhere);
while (recordSet.next()) {
HashMap<String, String> map = new HashMap<>();
map.put("JouneryID", Util.null2String(recordSet.getString("JouneryID")));
@ -59,7 +72,7 @@
map.put("ArrivalStationName", Util.null2String(recordSet.getString("ArrivalStationName")));
sourceidsList.add(map);
}
recordSet.execute("select * from ctrip_SettlemenFlightOrdert" + sqlWhere);
recordSet.execute("select * from ctrip_SettlemenFlightOrdert" + FlightsqlWhere);
while (recordSet.next()) {
HashMap<String, String> map = new HashMap<>();
map.put("JouneryID", Util.null2String(recordSet.getString("JourneyID")));
@ -74,7 +87,7 @@
map.put("ArrivalStationName", Util.null2String(recordSet.getString("APortName")));
sourceidsList.add(map);
}
recordSet.execute("select * from ctrip_SettlemenHotelOrdert" + sqlWhere);
recordSet.execute("select * from ctrip_SettlemenHotelOrdert" + HotelsqlWhere);
while (recordSet.next()) {
HashMap<String, String> map = new HashMap<>();
map.put("JouneryID", Util.null2String(recordSet.getString("HotelRelatedJourneyNo")));

@ -36,7 +36,7 @@
}
// out.print(lcArr);
if (lcArr.size() > 0){
recordSet.executeQuery("select requestid from formtable_main_206 where yccsj in ( " + String.join(",",lcArr) + ")");
recordSet.executeQuery("select requestid from formtable_main_294 where yccsj in ( " + String.join(",",lcArr) + ")");
}
ArrayList<String> requestArr = new ArrayList();
while (recordSet.next()){

@ -1,5 +1,3 @@
<%@ page import="weaver.file.Prop" %>
<%@ page import="com.engine.custom.sl.entity.EsbRequestHeader" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
@ -9,30 +7,33 @@
<%@ page import="com.engine.util.XMLUtils" %>
<%@ page import="java.util.Map" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="java.util.UUID" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%@ page import="java.net.Socket" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.general.StringUtil" %>
<%@ page import="java.io.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
// out.print(Prop.getPropValue("qwe","host"));
out.print("123456");
Map<String, Object> param = ParamUtil.request2Map(request);
String workCode = param.get("workCode").toString();
String timeStr = generateTimestamp();
EsbRequestHeader esbRequestHeader = new EsbRequestHeader();
esbRequestHeader.setService_sn(timeStr+workCode);
esbRequestHeader.setSystem_id("0170");
esbRequestHeader.setSystem_id("0217");
esbRequestHeader.setRequester_id("0258");
esbRequestHeader.setBranch_id("cwgl00002");
esbRequestHeader.setChannel_id("02");
esbRequestHeader.setBranch_id("KHCP0003");
esbRequestHeader.setChannel_id("24");
esbRequestHeader.setService_time(timeStr);
esbRequestHeader.setNeed_request("");
esbRequestHeader.setSvcCd("300130001");
esbRequestHeader.setSvcScn("39");
esbRequestHeader.setSvcCd("500130012");
esbRequestHeader.setSvcScn("24");
String bnkSrlNo = esbRequestHeader.getRequester_id() + timeStr + workCode;
esbRequestHeader.setBnkSrlNo(bnkSrlNo);
esbRequestHeader.setFileFlg("0");
String Service_Body = "<Service_Body><request><operatorNo>"+ workCode +"</operatorNo></request></Service_Body>" ;
String Service_Body = "<Service_Body><request><path>todo</path><method>getCount</method><args><entry><key>userNum</key><value>"+workCode+"</value></entry></args></request></Service_Body>" ;
String Service_Header = TravelToEsbBean.convertObjectToXml(esbRequestHeader,"Service_Header");
String serviceXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Service>";
// out.print("UTF_8_serviceXML==="+ serviceXML);
@ -42,19 +43,75 @@
String length = String.format("%08d", serviceXML.length());
serviceXML = length + serviceXML;
serviceXML = new String(serviceXML.getBytes(StandardCharsets.UTF_8));
// out.print("请求=="+ serviceXML);
out.print("\n");
out.print("\n");
out.print("\n");
SocketClientUtil scketClient = new SocketClientUtil("14.1.76.116",10149);
String send = scketClient.send(serviceXML);
String substring = send.substring(0, 8);
String substring1 = send.substring(8);
Map<String, String> map = XMLUtils.parseXMLToMap(substring1);
out.print("请求=="+ serviceXML);
try {
String send = send(serviceXML);
out.print("返回=="+send);
}catch (Exception e){
out.print("异常=="+ e.getMessage());
}
// SocketClientUtil scketClient = new SocketClientUtil("14.1.76.116",10149);
// String substring = send.substring(0, 8);
// String substring1 = send.substring(8);
// Map<String, String> map = XMLUtils.parseXMLToMap(substring1);
// out.print("返回=="+map);
out.print(JSONObject.toJSONString(map));
// out.print(JSONObject.toJSONString(map));
%>
<%!
public String send(String request) throws Exception {
// bs.writeLog("Client Start...");
BaseBean bs = new BaseBean();
Socket socket = null;
try {
//创建一个流套接字并将其连接到指定主机上的指定端口号
socket = new Socket("14.1.76.116",10149);
// String str = "00000612<?xml version=\"1.0\" encoding=\"UTF-8\"?><Service><Service_Header><service_sn>1010157060000081243</service_sn><system_id>0258</system_id><requester_id>0157</requester_id><branch_id>010231100</branch_id><channel_id>01</channel_id><service_time>20230905104426</service_time><need_request>true</need_request><SvcCd>500130004</SvcCd><SvcScn>13</SvcScn><BnkSrlNo>015720230905060000081243</BnkSrlNo><FileFlg>0</FileFlg></Service_Header><Service_Body><request><path>todo</path><method>getCount</method><args><entry><key>userNum</key><value>10913026任广鹏是个大刷币</value></entry></args></request></Service_Body></Service>";
// System.out.println(str);
//读取服务器端数据
BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream(), StandardCharsets.UTF_8));
//向服务器端发送数据
// PrintStream out = new PrintStream(new OutputStreamWriter(socket.getOutputStream(),StandardCharsets.UTF_8));
PrintWriter out = new PrintWriter(new OutputStreamWriter(socket.getOutputStream(),StandardCharsets.UTF_8),true);
out.println(request);
char[] datalen=new char[8];//报文前八位为报文体总长度
input.read(datalen,0,8);
String lendata=new String (datalen);
int length=Integer.parseInt(lendata);
new BaseBean().writeLog("报文长度"+length);
char[] data=new char[length];
int datalength = input.read(data,0,length);
String requestData = new String(data);
new BaseBean().writeLog("requestData",requestData);
// String ret = input.readLine();
System.out.println("服务器端返回过来的是: " + requestData);
bs.writeLog("服务器端返回过来的是: " + requestData);
// 如接收到 "OK" 则断开连接
if (!StringUtil.isEmpty(requestData)) {
bs.writeLog("客户端将关闭连接");
System.out.println("客户端将关闭连接: " + requestData);
Thread.sleep(500);
}
out.close();
input.close();
return requestData;
} catch (Exception e) {
bs.writeLog("客户端异常:" + e.getMessage());
throw e;
} finally {
if (socket != null) {
try {
socket.close();
} catch (IOException e) {
socket = null;
bs.writeLog("客户端 finally 异常:" + e.getMessage());
}
}
}
// return "-1";
}
public static String generateTimestamp() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
Date currentDate = new Date();

@ -0,0 +1,244 @@
<%@ page import="com.engine.custom.sl.entity.EsbRequestHeader" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%@ page import="com.engine.custom.sl.entity.TravelToEsbBean" %>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ page import="com.engine.util.SocketClientUtil" %>
<%@ page import="com.engine.util.XMLUtils" %>
<%@ page import="java.util.Map" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%@ page import="java.net.Socket" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.general.StringUtil" %>
<%@ page import="java.io.*" %>
<%@ page import="weaver.conn.RecordSetDataSource" %>
<%@ page import="java.time.LocalDateTime" %>
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="com.engine.custom.corn.util.ReportUtil" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
out.print(getMeetCountByUserid(new RecordSet(),"758"));
%>
<%!
/**
* 获取今年发送的消息总数
* @return
*/
public static int getMsgCount(){
String dateFormat = "yyyy-MM-dd HH:mm:ss.SSS";
String[] startEndOfYear = getStartEndOfYear(dateFormat);
System.out.println("Start of Year: " + startEndOfYear[0]);
System.out.println("End of Year: " + startEndOfYear[1]);
RecordSetDataSource rs = new RecordSetDataSource("emp_msg");
String getMsgCountSql = "select count(1) cnt from HISTORYMSG where DATETIME >= '"+ startEndOfYear[0] +"' and DATETIME <= '"+ startEndOfYear[1]+"'";
rs.execute(getMsgCountSql);
rs.next();
return rs.getInt("cnt");
}
/**
* 根据传入的格式化字符串获取当前年份的开始时间和结束时间
* @param dateFormat
* @return
*/
public static String[] getStartEndOfYear(String dateFormat) {
LocalDateTime startOfYear = LocalDateTime.of(LocalDateTime.now().getYear(), 1, 1, 0, 0, 0, 0);
LocalDateTime endOfYear = LocalDateTime.of(LocalDateTime.now().getYear(), 12, 31, 23, 59, 59, 999000000);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateFormat);
String start = startOfYear.format(formatter);
String end = endOfYear.format(formatter);
return new String[] {start, end};
}
/**
* 获取今年共享文档数量
* @return
*/
public static int getShareDOCCount(){
String dateFormat = "yyyy-MM-dd";
String[] startEndOfYear = getStartEndOfYear(dateFormat);
System.out.println("Start of Year: " + startEndOfYear[0]);
System.out.println("End of Year: " + startEndOfYear[1]);
RecordSet rs = new RecordSet();
String getMsgCountSql = "select count(1) cnt from DOCDETAIL where seccategory = 98 and doccreatedate >= '"+startEndOfYear[0]+"' and doccreatedate <= '"+startEndOfYear[1]+"'";
rs.execute(getMsgCountSql);
rs.next();
return rs.getInt("cnt");
}
/**
* 获取今年指定用户的共享文档数量
* @return
*/
public static int getShareDOCCountbyUserid(RecordSet rs , String userid){
String dateFormat = "yyyy-MM-dd";
String[] startEndOfYear = getStartEndOfYear(dateFormat);
System.out.println("Start of Year: " + startEndOfYear[0]);
System.out.println("End of Year: " + startEndOfYear[1]);
String getMsgCountSql = "select count(1) cnt from DOCDETAIL where seccategory = 98 and doccreatedate >= '"+startEndOfYear[0]+"' and doccreatedate <= '"+startEndOfYear[1]+"' and doccreaterid = "+userid ;
rs.execute(getMsgCountSql);
rs.next();
return rs.getInt("cnt");
}
/**
* 获取今年会议数量
* @return
*/
public static int getMeetCount(){
String dateFormat = "yyyy-MM-dd HH:mm";
String[] startEndOfYear = getStartEndOfYear(dateFormat);
System.out.println("Start of Year: " + startEndOfYear[0]);
System.out.println("End of Year: " + startEndOfYear[1]);
RecordSet rs = new RecordSet();
String getMsgCountSql = "select count(1) cnt from meeting_videolist where VIDEOMTBEGINDATE >= '"+startEndOfYear[0]+"' and VIDEOMTBEGINDATE <= '"+startEndOfYear[1]+"'";
rs.execute(getMsgCountSql);
rs.next();
return rs.getInt("cnt");
}
/**
* 获取今年会议数量
* @return
*/
public static int getMeetCountByUserid(RecordSet rs , String userid){
String dateFormat = "yyyy-MM-dd HH:mm";
String[] startEndOfYear = getStartEndOfYear(dateFormat);
System.out.println("Start of Year: " + startEndOfYear[0]);
System.out.println("End of Year: " + startEndOfYear[1]);
String getMsgCountSql = "select count(1) cnt from meeting_videolist where VIDEOMTBEGINDATE >= '"+startEndOfYear[0]+"' and VIDEOMTBEGINDATE <= '"+startEndOfYear[1]+"' and VIDEOMTCREATER = "+userid;
rs.execute(getMsgCountSql);
rs.next();
return rs.getInt("cnt");
}
/**
* 获取最早办理公文日期
* @param rs
* @param userid
* @return
*/
public static int getLastOfficialWfDate(RecordSet rs , String userid ,String OfficialWfid){
String getMsgCountSql = "select min(OPERATEDATE) from WORKFLOW_REQUESTLOG where OPERATOR = "+userid+" and workflowid in ( "+OfficialWfid+" )";
rs.execute(getMsgCountSql);
rs.next();
return rs.getInt("cnt");
}
/**
* 获取今年办理公文数
* @param rs
* @param userid
* @return
*/
public static int getYearOfficialWfCount(RecordSet rs , String userid ,String OfficialWfid ,String holidayStr){
String dateFormat = "yyyy-MM-dd";
String[] startEndOfYear = getStartEndOfYear(dateFormat);
System.out.println("Start of Year: " + startEndOfYear[0]);
System.out.println("End of Year: " + startEndOfYear[1]);
String getMsgCountSql = "select count(1) cnt from WORKFLOW_REQUESTLOG where OPERATOR = "+userid+" and workflowid in ( "+OfficialWfid+" ) " +
" and OPERATEDATE >= '"+startEndOfYear[0]+"' and OPERATEDATE <= '"+startEndOfYear[1]+"'";
rs.execute(getMsgCountSql);
rs.next();
return rs.getInt("cnt");
}
/**
* 获取节假日办理公文数
* @param rs
* @param userid
* @return
*/
public static int getHolidayOfficialWfCount(RecordSet rs , String userid ,String OfficialWfid ,String holidayStr){
String getMsgCountSql = "select count(1) cnt from WORKFLOW_REQUESTLOG where OPERATOR = "+userid+" and workflowid in ( "+OfficialWfid+" ) and OPERATEDATE in ( "+holidayStr+" )";
rs.execute(getMsgCountSql);
rs.next();
return rs.getInt("cnt");
}
/**
* 获取公文办理超越数
* @param rs
* @param userid
* @return
*/
public static int getOfficialWfCountPercentage(RecordSet rs , String userid ,String OfficialWfid ,String holidayStr,int total){
String dateFormat = "yyyy-MM-dd";
String[] startEndOfYear = getStartEndOfYear(dateFormat);
System.out.println("Start of Year: " + startEndOfYear[0]);
System.out.println("End of Year: " + startEndOfYear[1]);
String getMsgCountSql = "select rank from (select * , RANK() OVER (ORDER BY cnt DESC) AS rank from" +
" (select OPERATOR, count(1) cnt from WORKFLOW_REQUESTLOG" +
" where WORKFLOWID in ("+ OfficialWfid +") and OPERATEDATE >= '"+startEndOfYear[0]+"' and OPERATEDATE <= '"+startEndOfYear[1]+"' group by OPERATOR)) a where a.OPERATOR = "+ userid;
rs.execute(getMsgCountSql);
rs.next();
int rank = rs.getInt("rank");
return (int)(100.0 * (total - rank) / (total - 1));
}
/**
* 获取最晚公文办理时间的日期
* @param rs
* @param userid
* @return
*/
public static String getOfficialWflastTimeDate(RecordSet rs , String userid , String OfficialWfid ){
String dateFormat = "yyyy-MM-dd";
String[] startEndOfYear = getStartEndOfYear(dateFormat);
System.out.println("Start of Year: " + startEndOfYear[0]);
System.out.println("End of Year: " + startEndOfYear[1]);
String getMsgCountSql = "SELECT * FROM ( " +
" SELECT * FROM WORKFLOW_REQUESTLOG where OPERATETIME <= '05:00:00' and WORKFLOWID in ("+ OfficialWfid +") " +
" and OPERATEDATE >= '"+startEndOfYear[0]+"' and OPERATEDATE <= '"+startEndOfYear[1]+"'"+
" and OPERATOR = "+ userid +
" ORDER BY OPERATETIME DESC" +
" )WHERE ROWNUM = 1";
rs.execute(getMsgCountSql);
rs.next();
int counts = rs.getCounts();
if (counts != 0){
return rs.getString("OPERATEDATE")+" "+rs.getString("OPERATETIME");
}else {
getMsgCountSql = "SELECT * FROM ( " +
" SELECT * FROM WORKFLOW_REQUESTLOG where WORKFLOWID in ("+ OfficialWfid +") " +
" and OPERATEDATE >= '"+startEndOfYear[0]+"' and OPERATEDATE <= '"+startEndOfYear[1]+"'"+
" and OPERATOR = "+ userid +
" ORDER BY OPERATETIME DESC" +
" )WHERE ROWNUM = 1";
rs.execute(getMsgCountSql);
rs.next();
return rs.getString("OPERATEDATE")+" "+rs.getString("OPERATETIME");
}
}
//获取登录天数
public static int getLoginDayCount(RecordSet rs , String userid ){
String dateFormat = "yyyy-MM-dd";
String[] startEndOfYear = getStartEndOfYear(dateFormat);
System.out.println("Start of Year: " + startEndOfYear[0]);
System.out.println("End of Year: " + startEndOfYear[1]);
String getMsgCountSql = "select count(*) from ( " +
" select OPERATEDATE from hrmsysmaintenancelog where RELATEDID = " + userid + ""+
" and OPERATEDATE >= '"+startEndOfYear[0]+"' and OPERATEDATE <= '"+startEndOfYear[1]+"'"+
" group by OPERATEDATE)";
rs.execute(getMsgCountSql);
rs.next();
return rs.getInt("cnt");
}
%>

Binary file not shown.

@ -0,0 +1,226 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.Util,weaver.conn.RecordSet" %>
<%@ page import="weaver.integration.logging.Logger"%>
<%@ page import="weaver.integration.logging.LoggerFactory"%>
<%@ page import="org.apache.commons.lang3.StringUtils" %>
<%@ page import="weaver.interfaces.outter.CheckIpNetWorkForUpcoming" %>
<%@ page import="weaver.file.Prop" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="java.io.*" %>
<%@ page import="com.engine.common.biz.EncryptConfigBiz" %>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%
Logger log = LoggerFactory.getLogger();
RecordSet rs = new RecordSet();
String type = Util.null2String(request.getParameter("type")) ;
String workflowId = request.getParameter("workflowid");
String sysId = request.getParameter("sysid");
String forURL ;
if(StringUtils.isNotBlank(workflowId)){
//新建异构系统
log.error("workflowid="+workflowId);
rs.executeQuery("select * from ofs_workflow where workflowid = ?",workflowId);
rs.next();
if ("pc".equalsIgnoreCase(type)){
forURL = rs.getString("pccwurl");
}else{
forURL = rs.getString("APPCWURL");
}
if ("".equals(Util.null2String(sysId))){
sysId = rs.getString("SYSID");
}
}else{
//访问异构系统流程
String todoDataId = request.getParameter("tododataid");
log.error("todoDataId="+todoDataId);
String isRemark = request.getParameter("isremark");
log.error("isRemark="+isRemark);
if( "0".equals(isRemark) || "8".equals(isRemark)){
rs.executeQuery("select * from ofs_todo_data where id = ?",todoDataId);
rs.next();
if ("pc".equalsIgnoreCase(type)){
forURL = Util.null2String(rs.getString("pcurlsrc"));
}else{
forURL = Util.null2String(rs.getString("appurlsrc"));
}
if ("".equals(Util.null2String(sysId))){
sysId = rs.getString("SYSID");
}
}else{
rs.executeQuery("select * from ofs_done_data where id = ?",todoDataId);
rs.next();
if ("pc".equalsIgnoreCase(type)){
forURL = Util.null2String(rs.getString("pcurlsrc"));
}else{
forURL = Util.null2String(rs.getString("appurlsrc"));
}
if ("".equals(Util.null2String(sysId))){
sysId = rs.getString("SYSID");
}
}
}
rs.executeQuery("select * from ofs_sysinfo where sysid = ?" , sysId);
if(rs.next()){
String prefixURL ;
String sysCode = rs.getString("syscode") ;
if ("pc".equalsIgnoreCase(type)){
//自动内外网登录
String clientIp = Util.getIpAddr(request);
boolean notInOuter = this.notInOuter(sysCode , clientIp);
if (notInOuter){
prefixURL = Util.null2String(rs.getString("pcouterfixurl"));
}else{
prefixURL = Util.null2String(rs.getString("pcprefixurl"));
}
}else{
prefixURL = Util.null2String(rs.getString("Appprefixurl"));
}
String mobile = user.getMobile();
//将加密数据进行解密
mobile = EncryptConfigBiz.getDecryptData(mobile);
log.error("获取到的用户手机号码为: "+mobile);
String result = this.getToken(mobile , sysCode) ;
if ("".equals(Util.null2String(result))){
out.println("返回token为 null 无法跳转");
return;
}
JSONObject json = JSONObject.parseObject(result) ;
if (!"0".equals(Util.null2String(json.getString("errcode")))){
out.println("返回 报文异常:"+result);
log.error("返回 报文异常:"+result);
return;
}
String token = Util.null2String(json.getString("etLoginToken")) ;
if ("".equals(token)){
out.println("获取token为空 "+result);
log.error("获取token为空 "+result);
return;
}
String toURL = this.getURL(prefixURL , forURL , token) ;
String typeName ;
if ("pc".equalsIgnoreCase(type)){
typeName = "PC端" ;
}else{
typeName = "APP端" ;
}
log.error(typeName +"访问异构系统地址:"+toURL);
%>
<script type="text/javascript">
window.location.replace('<%=toURL%>');
</script>
<%
}else{
log.error("根据标识:"+sysId+"未查询到数据");
return;
}
%>
<%!
Logger log = LoggerFactory.getLogger();
//外网地址返回 true ,内网 false
private boolean notInOuter(String sysCode , String clientIp){
//0代表不开启则所有通过内网访问
//1代表开启并且有设置网段
//2代表开启但是没有设置网段
RecordSet rs = new RecordSet();
rs.executeQuery("SELECT * FROM autologin_status WHERE syscode= ? " , sysCode) ;
if (rs.next()){
String status = Util.null2String(rs.getString("status"),"0");
if ("0".equals(status)){
return false ;
}else if ("2".equals(status)){
return true ;
}
}
//检测IP
CheckIpNetWorkForUpcoming checkIpNetWorkForUpcoming = new CheckIpNetWorkForUpcoming();
return checkIpNetWorkForUpcoming.checkIpSeg(clientIp);//不在网段策略中 返回true
}
private String getURL(String prefixURL , String toURL , String token) {
StringBuilder url = new StringBuilder(prefixURL) ;
url.append("/papi/open/singleSignon?singleToken=")
.append(token).append("&oauthType=singlesign&redirect_uri=") ;
try{
url.append(java.net.URLEncoder.encode(toURL, "UTF-8")) ;
}catch (Exception e){
e.printStackTrace();
}
return url.toString() ;
}
private String getToken(String account , String sysCode){
//TODO 1 调用e9接口获取token
OutputStreamWriter oout = null;
BufferedReader iin = null;
String result = "";
try {
String prefixURL = Prop.getPropValue("ofsForEteams" , "url") ;
String appKey = Prop.getPropValue("ofsForEteams" , sysCode+"_appKey") ;
String security = Prop.getPropValue("ofsForEteams" , sysCode+"_security") ;
// 发送请求参数
URL realUrl = new URL(prefixURL + "?app_key="+appKey+"&app_security="+security+"&account="+account);
// 打开和URL之间的连接
URLConnection conn = realUrl.openConnection();
// 设置通用的请求属性
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("Content-Type", "application/json");
// 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
// 获取URLConnection对象对应的输出流
oout = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
oout.write("");
// flush输出流的缓冲
oout.flush();
// 定义BufferedReader输入流来读取URL的响应
iin = new BufferedReader(
new InputStreamReader(conn.getInputStream(), "UTF-8"));
String line;
while ((line = iin.readLine()) != null) {
result += line;
}
log.error("result" + result);
} catch (Exception e) {
log.error("发送 POST 请求出现异常!", e);
e.printStackTrace();
}
//使用finally块来关闭输出流、输入流
finally {
try {
if (oout != null) {
oout.close();
}
if (iin != null) {
iin.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return result ;
}
%>

@ -0,0 +1,152 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.Util,weaver.conn.RecordSet" %>
<%@ page import="weaver.integration.logging.Logger"%>
<%@ page import="weaver.integration.logging.LoggerFactory"%>
<%@ page import="org.apache.commons.lang3.StringUtils" %>
<%@ page import="weaver.interfaces.outter.CheckIpNetWorkForUpcoming" %>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%
Logger log = LoggerFactory.getLogger();
RecordSet rs = new RecordSet();
String type = Util.null2String(request.getParameter("type")) ;
if ("pc".equalsIgnoreCase(type)){
}else{
}
String workflowId = request.getParameter("workflowid");
String sysId = request.getParameter("sysid");
String forURL ;
if(StringUtils.isNotBlank(workflowId)){
//新建异构系统
log.error("workflowid="+workflowId);
rs.executeQuery("select * from ofs_workflow where workflowid = ?",workflowId);
rs.next();
if ("pc".equalsIgnoreCase(type)){
forURL = rs.getString("pccwurl");
}else{
forURL = rs.getString("APPCWURL");
}
if ("".equals(Util.null2String(sysId))){
sysId = rs.getString("SYSID");
}
}else{
//访问异构系统流程
String todoDataId = request.getParameter("tododataid");
log.error("todoDataId="+todoDataId);
String isRemark = request.getParameter("isremark");
log.error("isRemark="+isRemark);
if( "0".equals(isRemark) || "8".equals(isRemark)){
rs.executeQuery("select * from ofs_todo_data where id = ?",todoDataId);
rs.next();
if ("pc".equalsIgnoreCase(type)){
forURL = Util.null2String(rs.getString("pcurlsrc"));
}else{
forURL = Util.null2String(rs.getString("appurlsrc"));
}
if ("".equals(Util.null2String(sysId))){
sysId = rs.getString("SYSID");
}
}else{
rs.executeQuery("select * from ofs_done_data where id = ?",todoDataId);
rs.next();
if ("pc".equalsIgnoreCase(type)){
forURL = Util.null2String(rs.getString("pcurlsrc"));
}else{
forURL = Util.null2String(rs.getString("appurlsrc"));
}
if ("".equals(Util.null2String(sysId))){
sysId = rs.getString("SYSID");
}
}
}
rs.executeQuery("select * from ofs_sysinfo where sysid = ?" , sysId);
if(rs.next()){
String prefixURL ;
if ("pc".equalsIgnoreCase(type)){
//自动内外网登录
String clientIp = Util.getIpAddr(request);
boolean notInOuter = this.notInOuter(rs.getString("syscode") , clientIp);
if (notInOuter){
prefixURL = Util.null2String(rs.getString("pcouterfixurl"));
}else{
prefixURL = Util.null2String(rs.getString("pcprefixurl"));
}
}else{
prefixURL = Util.null2String(rs.getString("Appprefixurl"));
}
StringBuilder url = new StringBuilder() ;
if(forURL.startsWith("http://") || forURL.startsWith("https://")){
url.append(forURL);
}else{
url.append(prefixURL).append(forURL);
}
if(url.toString().contains("?")){
url.append("&");
}else{
url.append("?");
}
url.append("_random_ofs=").append(System.currentTimeMillis()) ;
String toURL = url.toString() ;
String typeName ;
if ("pc".equalsIgnoreCase(type)){
typeName = "PC端" ;
}else{
typeName = "APP端" ;
}
log.error(typeName +"访问异构系统地址:"+toURL);
%>
<script type="text/javascript">
window.location.replace('<%=toURL%>');
</script>
<%
}else{
log.error("根据标识:"+sysId+"未查询到数据");
return;
}
%>
<%!
Logger log = LoggerFactory.getLogger();
//外网地址返回 true ,内网 false
private boolean notInOuter(String sysCode , String clientIp){
//0代表不开启则所有通过内网访问
//1代表开启并且有设置网段
//2代表开启但是没有设置网段
RecordSet rs = new RecordSet();
rs.executeQuery("SELECT * FROM autologin_status WHERE syscode= ? " , sysCode) ;
if (rs.next()){
String status = Util.null2String(rs.getString("status"),"0");
if ("0".equals(status)){
return false ;
}else if ("2".equals(status)){
return true ;
}
}
//检测IP
CheckIpNetWorkForUpcoming checkIpNetWorkForUpcoming = new CheckIpNetWorkForUpcoming();
return checkIpNetWorkForUpcoming.checkIpSeg(clientIp);//不在网段策略中 返回true
}
%>

@ -0,0 +1,175 @@
<%@ page import="weaver.file.Prop" %>
<%@ page import="com.engine.custom.sl.entity.EsbRequestHeader" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="com.engine.custom.sl.entity.TravelToEsbBean" %>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ page import="com.engine.util.SocketClientUtil" %>
<%@ page import="com.engine.util.XMLUtils" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.soa.workflow.request.RequestInfo" %>
<%@ page import="weaver.hrm.company.DepartmentComInfo" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.interfaces.workflow.action.Action" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
// out.print(Prop.getPropValue("qwe","host"));
User user = HrmUserVarify.getUser(request, response);
if (user == null){
out.print("暂无权限");
}
if (!(1 == (user.getUID()))){
out.print("暂无权限");
return;
}
Map<String, Object> param = ParamUtil.request2Map(request);
String sql = "select main.*, base.REQUESTNAME from formtable_main_11 main " +
"left join uf_tohgLog log on log.REQUEST = main.REQUESTID " +
"left join WORKFLOW_REQUESTBASE base on base.REQUESTID = main.REQUESTID " +
" where log.ID is null and main.tohg = 1";
RecordSet recordSet = new RecordSet();
RecordSet rs = new RecordSet();
recordSet.executeQuery(sql);
StringBuilder execute = new StringBuilder();
int i = 0;
while (recordSet.next()){
String result = this.execute(recordSet, rs);
execute.append(result).append("\n");
i++;
}
out.print("共添加"+i+"条" +"\n");
out.print(execute.toString());
%>
<%!
public static String generateTimestamp() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
Date currentDate = new Date();
return dateFormat.format(currentDate);
}
public String execute(RecordSet recordSet, RecordSet rs) {
try {
String insertsql = "INSERT INTO uf_tohgLog(REQUEST, CONTENT, ZT, ML, DDSJ, TSSJ, FJML, ZWID, FJID) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ? )";
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
//公文标题
String requestname = recordSet.getString("REQUESTNAME");
String requestId = recordSet.getString("REQUESTID");
// 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 = recordSet.getString("id");
//公文编号
String fwwh = recordSet.getString("bh");
//发文部门名称
String ngbm = recordSet.getString("ngbm");
//成文时间
String cwrq = recordSet.getString("cwrq");
String ngr = recordSet.getString("ngr");
// String zw = rs.getString("zw"); //word格式
//生成的pdf
String zw = recordSet.getString("dwd");
String fj = recordSet.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);
return insertsql + "?"+ requestId + "|"+context + "|"+0 + "|"+null + "|"+time + "|"+null + "|"+null + "|"+zw + "|"+fj;
} catch (Exception e) {
// writeLog(e.getMessage()+ "||||||异常流程id==="+request.getRequestid());
e.printStackTrace();
//不管是否推送成功,都返回成功,不影响流程流转
return "error";
}
// 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;
};
%>

@ -0,0 +1,171 @@
<%@ page import="weaver.file.Prop" %>
<%@ page import="com.engine.custom.sl.entity.EsbRequestHeader" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="com.engine.custom.sl.entity.TravelToEsbBean" %>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ page import="com.engine.util.SocketClientUtil" %>
<%@ page import="com.engine.util.XMLUtils" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.soa.workflow.request.RequestInfo" %>
<%@ page import="weaver.hrm.company.DepartmentComInfo" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.interfaces.workflow.action.Action" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
// out.print(Prop.getPropValue("qwe","host"));
User user = HrmUserVarify.getUser(request, response);
if (user == null){
out.print("暂无权限");
}
// out.print(user.getUID());
if (!(1 == (user.getUID()))){
out.print("暂无权限");
return;
}
Map<String, Object> param = ParamUtil.request2Map(request);
String sql = "select main.*, base.REQUESTNAME from formtable_main_49 main " +
"left join uf_tohgLog log on log.REQUEST = main.REQUESTID " +
"left join WORKFLOW_REQUESTBASE base on base.REQUESTID = main.REQUESTID " +
" where log.ID is null and main.tohg = 1";
RecordSet recordSet = new RecordSet();
RecordSet rs = new RecordSet();
recordSet.executeQuery(sql);
StringBuilder execute = new StringBuilder();
int i = 0;
while (recordSet.next()){
String result = this.execute(recordSet, rs);
execute.append(result).append("\n");
i++;
}
out.print("共添加"+i+"条" +"\n");
out.print(execute.toString());
%>
<%!
public static String generateTimestamp() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
Date currentDate = new Date();
return dateFormat.format(currentDate);
}
public String execute(RecordSet recordSet, RecordSet rs) {
try {
String insertsql = "INSERT INTO uf_tohgLog(REQUEST, CONTENT, ZT, ML, DDSJ, TSSJ, FJML, ZWID, FJID) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ? )";
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
String requestname = recordSet.getString("REQUESTNAME");
String requestId = recordSet.getString("REQUESTID");
// 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);
return insertsql + "?"+ requestId + "|"+context + "|"+0 + "|"+null + "|"+time + "|"+null + "|"+null + "|"+zw + "|"+fj;
} catch (Exception e) {
// writeLog(e.getMessage()+ "||||||异常流程id==="+request.getRequestid());
e.printStackTrace();
return "error";
//不管是否推送成功,都返回成功,不影响流程流转
// 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;
};
%>

@ -32,7 +32,7 @@
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";

@ -0,0 +1,273 @@
<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: 23%;left: 50%;margin-left: -1.85rem;background: url('/weaver/weaver.file.FileDownload?fileid=a878999d62cd067432c14f1f4decd22e639fcdb58490e7941014470779c82640d4a20e07a1e7832d51509f687d1bbcbe66e8662b6d7f37c27&diyPicId=339') 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.56rem;font-weight: bold;color: #161616;}
</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">商密文件</span>
</div>
<div class="jys_n-h1">
<span class="btn_text">请通过内网PC端处理</span>
</div>
</div>
</div>
</body></html>

@ -0,0 +1,124 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.Util,weaver.conn.RecordSet" %>
<%@ page import="weaver.integration.logging.Logger"%>
<%@ page import="weaver.integration.logging.LoggerFactory"%>
<%@ page import="java.net.URL" %>
<%@ page import="java.net.URLConnection" %>
<%@ page import="org.apache.commons.lang3.StringUtils" %>
<%@ page import="weaver.interfaces.HrmTransferDao" %>
<%@ page import="java.io.*" %>
<%@ page import="weaver.sm.SM4Utils" %>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%
Logger log = LoggerFactory.getLogger();
RecordSet rs = new RecordSet();
String workflowId = request.getParameter("workflowid");
String sysId = request.getParameter("sysid");
int userId = user.getUID() ;
String appURL ;
if(StringUtils.isNotBlank(workflowId)){
//新建异构系统
log.error("workflowid="+workflowId);
rs.executeQuery("select * from ofs_workflow where workflowid = ?",workflowId);
rs.next();
appURL = rs.getString("APPCWURL");
if ("".equals(Util.null2String(sysId))){
sysId = rs.getString("SYSID");
}
}else{
//访问异构系统流程
String todoDataId = request.getParameter("tododataid");
log.error("todoDataId="+todoDataId);
String isRemark = request.getParameter("isremark");
log.error("isRemark="+isRemark);
if( "0".equals(isRemark) || "8".equals(isRemark)){
rs.executeQuery("select * from ofs_todo_data where id = ?",todoDataId);
rs.next();
appURL = Util.null2String(rs.getString("appurlsrc"));
if ("".equals(Util.null2String(sysId))){
sysId = rs.getString("SYSID");
}
}else{
rs.executeQuery("select * from ofs_done_data where id = ?",todoDataId);
rs.next();
appURL = Util.null2String(rs.getString("appurlsrc"));
if ("".equals(Util.null2String(sysId))){
sysId = rs.getString("SYSID");
}
}
}
rs.executeQuery("select * from ofs_sysinfo where sysid = ?" , sysId);
if(rs.next()){
String prefixURL = Util.null2String(rs.getString("Appprefixurl"));
String hrmTransRule = Util.null2String(rs.getString("HRMTRANSRULE"));//人员转换关系
HrmTransferDao hrmTransferDao = new HrmTransferDao();
String loginId = hrmTransferDao.getHrmResourceIdByHrmTransRule(hrmTransRule, Util.null2String(userId));
long stamp = System.currentTimeMillis();
String token = this.getToken(prefixURL, loginId, stamp);
String toURL = this.getURL(prefixURL, appURL, token, loginId, stamp);
log.info("==============APP端访问异构系统地址"+toURL);
%>
<script type="text/javascript">
location.replace('<%=toURL%>');
</script>
<%
}else{
log.error("根据标识:"+sysId+"未查询到数据");
return;
}
%>
<%!
Logger log = LoggerFactory.getLogger();
private String getURL(String prefixURL, String toURL, String token,String loginId, long stamp) throws UnsupportedEncodingException {
StringBuilder url = new StringBuilder() ;
if(toURL.startsWith("http://") || toURL.startsWith("https://")){
url.append(toURL);
}else{
url.append(prefixURL).append(toURL);
}
if(url.toString().contains("#")){
String[] split = toURL.split("#");
url.append(split[0]).append("&loginid="+loginId+"&stamp="+stamp+"&token=").append(URLEncoder.encode(token,"UTF-8")).append("#").append(split[1]) ;
}else{
if(toURL.contains("?")){
url.append("&");
}else{
url.append("?");
}
url.append("loginid="+loginId+"&stamp="+stamp+"&token=").append(URLEncoder.encode(token,"UTF-8")) ;
}
return url.toString() ;
}
private String getToken(String prefixURL, String loginId, long stamp){
//加密就是SM4 ECB模式NoPadding 不填充。加密key是bankoftianjincom
//String key = "bankoftianjincom";
SM4Utils sm4Utils = new SM4Utils();
String result = sm4Utils.encrypt(loginId + "" + stamp, "bankoftianjincom", "SM4");
log.info("=============apptransferforee9_token:"+result);
return result ;
}
%>

@ -0,0 +1,182 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.Util,weaver.conn.RecordSet" %>
<%@ page import="weaver.integration.logging.Logger"%>
<%@ page import="weaver.integration.logging.LoggerFactory"%>
<%@ page import="java.io.IOException" %>
<%@ page import="java.io.BufferedReader" %>
<%@ page import="java.io.OutputStreamWriter" %>
<%@ page import="java.net.URL" %>
<%@ page import="java.io.InputStreamReader" %>
<%@ page import="java.net.URLConnection" %>
<%@ page import="org.apache.commons.lang3.StringUtils" %>
<%@ page import="weaver.interfaces.HrmTransferDao" %>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%
Logger log = LoggerFactory.getLogger();
RecordSet rs = new RecordSet();
String workflowId = request.getParameter("workflowid");
String sysId = request.getParameter("sysid");
String isMsg = Util.null2String(request.getParameter("_weaverofsmsg"));
int userId = user.getUID() ;
String appURL ;
if(StringUtils.isNotBlank(workflowId)){
//新建异构系统
log.error("workflowid="+workflowId);
rs.executeQuery("select * from ofs_workflow where workflowid = ?",workflowId);
rs.next();
appURL = rs.getString("APPCWURL");
if ("".equals(Util.null2String(sysId))){
sysId = rs.getString("SYSID");
}
}else{
//访问异构系统流程
String todoDataId = request.getParameter("tododataid");
log.error("todoDataId="+todoDataId);
String isRemark = request.getParameter("isremark");
log.error("isRemark="+isRemark);
if( "0".equals(isRemark) || "8".equals(isRemark)){
rs.executeQuery("select * from ofs_todo_data where id = ?",todoDataId);
rs.next();
appURL = Util.null2String(rs.getString("appurlsrc"));
if ("".equals(Util.null2String(sysId))){
sysId = rs.getString("SYSID");
}
}else{
rs.executeQuery("select * from ofs_done_data where id = ?",todoDataId);
rs.next();
appURL = Util.null2String(rs.getString("appurlsrc"));
if ("".equals(Util.null2String(sysId))){
sysId = rs.getString("SYSID");
}
}
}
rs.executeQuery("select * from ofs_sysinfo where sysid = ?" , sysId);
if(rs.next()){
String prefixURL = Util.null2String(rs.getString("Appprefixurl"));
String hrmTransRule = Util.null2String(rs.getString("HRMTRANSRULE"));//人员转换关系
HrmTransferDao hrmTransferDao = new HrmTransferDao();
String loginId = hrmTransferDao.getHrmResourceIdByHrmTransRule(hrmTransRule, Util.null2String(userId));
String token = this.getToken(prefixURL , loginId) ;
if ("".equals(token)){
out.println("get Token is null ");
return ;
}
if (token.contains(":")){
out.println("get Token is err : " + token);
return ;
}
String toURL = this.getURL(prefixURL , appURL , token , isMsg) +"&ofsComeFrom=e9";
log.error("APP端访问异构系统地址"+toURL);
%>
<script type="text/javascript">
location.replace('<%=toURL%>');
</script>
<%
}else{
log.error("根据标识:"+sysId+"未查询到数据");
return;
}
%>
<%!
Logger log = LoggerFactory.getLogger();
private String getURL(String prefixURL , String toURL , String token, String isMsg){
StringBuilder url = new StringBuilder() ;
if(toURL.startsWith("http://") || toURL.startsWith("https://")){
url.append(toURL);
}else{
url.append(prefixURL).append(toURL);
}
if(url.toString().contains("#")){
StringBuilder ssoToken = new StringBuilder("&ssoToken=");
ssoToken.append(token) ;
if(!"".equals(isMsg)){
ssoToken.append("&_weaverofsmsg=1") ;
}
int i = url.toString().indexOf("#") ;
url.insert(i, ssoToken) ;
}else{
if(toURL.contains("?")){
url.append("&");
}else{
url.append("?");
}
url.append("ssoToken=").append(token) ;
if(!"".equals(isMsg)){
url.append("&_weaverofsmsg=1") ;
}
}
return url.toString() ;
}
private String getToken(String prefixURL ,String loginId){
//TODO 1 调用e9接口获取token
OutputStreamWriter oout = null;
BufferedReader iin = null;
String result = "";
try {
// 发送请求参数
URL realUrl = new URL(prefixURL + "/ssologin/getToken?appid=fore9&loginid=" + java.net.URLEncoder.encode(loginId, "UTF-8"));
// 打开和URL之间的连接
URLConnection conn = realUrl.openConnection();
// 设置通用的请求属性
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("Content-Type", "application/json");
// 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
// 获取URLConnection对象对应的输出流
oout = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
oout.write("");
// flush输出流的缓冲
oout.flush();
// 定义BufferedReader输入流来读取URL的响应
iin = new BufferedReader(
new InputStreamReader(conn.getInputStream(), "UTF-8"));
String line;
while ((line = iin.readLine()) != null) {
result += line;
}
log.error("result" + result);
} catch (Exception e) {
log.error("发送 POST 请求出现异常!", e);
e.printStackTrace();
}
//使用finally块来关闭输出流、输入流
finally {
try {
if (oout != null) {
oout.close();
}
if (iin != null) {
iin.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return result ;
}
%>

@ -0,0 +1,270 @@
<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('/weaver/weaver.file.FileDownload?fileid=a7d9c88d7fc1c1f7da8662c5bc8fe4c9aa53169d4782d0b61cc0d81753d2b94c0ff93209b79857c8551bb03bd589c1bec6e8662b6d7f37c27&diyPicId=337') 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">应用正在开发中</span>
<br/>
<span class="btn_text">敬请期待</span>
</div>
</div>
</div>
</body></html>

@ -0,0 +1,668 @@
<%--
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(String str,Map<String, String> MachInfo){
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",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
// 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,Map<String, String> MachInfo){
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",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
// 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);
Map<String, Object> paramsMap = ParamUtil.request2Map(request);
new BaseBean().writeLog("paramsMap===>"+JSONObject.toJSONString(paramsMap) );
String deviceId = Util.null2String(paramsMap.get("deviceId"));
String clientType = Util.null2String(paramsMap.get("clientType"));
if("2".equals(clientType)){
clientType = "0";
}else if("3".equals(clientType)){
clientType = "1";
}
String param_ip = Util.null2String(paramsMap.get("param_ip"));
new BaseBean().writeLog("paramsMap===>"+paramsMap );
new BaseBean().writeLog("deviceId===>"+deviceId );
new BaseBean().writeLog("clientType===>"+clientType );
HashMap<String, String> MachInfo = new HashMap<>();
MachInfo.put("deviceId",deviceId.isEmpty()?"123":deviceId);
MachInfo.put("clientType",clientType.isEmpty()?"1":clientType);
MachInfo.put("param_ip",param_ip.isEmpty()?"127.0.0.1":param_ip);
//获取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,MachInfo);
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",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
// 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,MachInfo);
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,639 @@
<%--
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://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="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/%E5%89%8D%E7%BD%AE%E9%A1%B5.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/%E5%89%8D%E7%BD%AE%E9%A1%B5.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,649 @@
<%--
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.alibaba.fastjson.JSONException" %>
<%!
//获取分页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{
try {
if (stMsg.has("errorCode")&&"2009".equals(stMsg.getString("errorCode"))){
response.sendRedirect("https://office.bankoftianjin.com/interface/transfer/mobile/noPermissons2.html");
}
} catch (JSONException e) {
bb.writeLog(e);
}
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>

@ -418,7 +418,7 @@
return Base64.encodeBase64String(cipher.doFinal(content.getBytes(StandardCharsets.UTF_8)));
}
public static String getPublicKey(){
public static String getPublicKey(Map<String, String> MachInfo){
BaseBean bb = new BaseBean();
String publicKey ="";
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));
@ -426,9 +426,12 @@
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");
headers.put("MACH_ID",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
// 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 {
@ -444,7 +447,7 @@
}
//获取TG
public static String getST(String tgt,String emobileUrl){
public static String getST(String tgt,String emobileUrl,Map<String, String> MachInfo){
BaseBean bb = new BaseBean();
String ST = "";
String retMsg = "";
@ -465,9 +468,12 @@
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");
headers.put("MACH_ID",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
// 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);
@ -509,6 +515,23 @@
}
bb.writeLog("login_id-->"+login_id);
bb.writeLog("user_password-->"+user_password);
Map<String, Object> paramsMap = ParamUtil.request2Map(request);
new BaseBean().writeLog("paramsMap===>"+JSONObject.toJSONString(paramsMap) );
String deviceId = Util.null2String(paramsMap.get("deviceId"));
String clientType = Util.null2String(paramsMap.get("clientType"));
if("2".equals(clientType)){
clientType = "0";
}else if("3".equals(clientType)){
clientType = "1";
}
String param_ip = Util.null2String(paramsMap.get("param_ip"));
new BaseBean().writeLog("paramsMap===>"+paramsMap );
new BaseBean().writeLog("deviceId===>"+deviceId );
new BaseBean().writeLog("clientType===>"+clientType );
HashMap<String, String> MachInfo = new HashMap<>();
MachInfo.put("deviceId",deviceId.isEmpty()?"123":deviceId);
MachInfo.put("clientType",clientType.isEmpty()?"1":clientType);
MachInfo.put("param_ip",param_ip.isEmpty()?"127.0.0.1":param_ip);
//获取session
session = request.getSession(true);
String certified_token = Util.null2String(session.getAttribute("certified_token"));
@ -544,37 +567,36 @@
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 {
// 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 ="";
@ -583,7 +605,7 @@
List<String> resultList = rsa.decryptList(request, decriptList);
String loginId = resultList.get(0);
String userPassword = resultList.get(1);
String publicKey = getPublicKey();
String publicKey = getPublicKey(MachInfo);
passWord = encrypt(user_password, publicKey);
params = new HashMap<>();//参数
params.put("username",loginId);
@ -592,9 +614,12 @@
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");
headers.put("MACH_ID",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
// 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);
@ -603,7 +628,7 @@
if(resMsg.has("TGT")){
TGT = Util.null2String(resMsg.get("TGT").toString());
}
String responseInfo = getST(TGT,cockpitUrl);
String responseInfo = getST(TGT,cockpitUrl,MachInfo);
if (isEmpty(responseInfo)){
out.print("单点系统接口返回值为null");
return;
@ -629,8 +654,7 @@
out.print("跳转路径-->"+loginUrl);
out.print("进入驾驶舱成功");
response.sendRedirect(loginUrl);
// request.getRequestDispatcher("loginUrl").forward(request,response);
}
// }
// out.print("进入驾驶舱系统失败,请先获取标识");
//return;

@ -0,0 +1,659 @@
<%--
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.alibaba.fastjson.JSONException" %>
<%!
//获取分页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{
try {
if (stMsg.has("errorCode")&&"2009".equals(stMsg.getString("errorCode"))){
response.sendRedirect("https://office.bankoftianjin.com/interface/transfer/mobile/noPermissons2.html");
}
} catch (JSONException e) {
bb.writeLog(e);
}
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,668 @@
<%--
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(String str,Map<String, String> MachInfo){
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",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
// 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,Map<String, String> MachInfo){
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",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
// 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);
Map<String, Object> paramsMap = ParamUtil.request2Map(request);
new BaseBean().writeLog("paramsMap===>"+JSONObject.toJSONString(paramsMap) );
String deviceId = Util.null2String(paramsMap.get("deviceId"));
String clientType = Util.null2String(paramsMap.get("clientType"));
if("2".equals(clientType)){
clientType = "0";
}else if("3".equals(clientType)){
clientType = "1";
}
String param_ip = Util.null2String(paramsMap.get("param_ip"));
new BaseBean().writeLog("paramsMap===>"+paramsMap );
new BaseBean().writeLog("deviceId===>"+deviceId );
new BaseBean().writeLog("clientType===>"+clientType );
HashMap<String, String> MachInfo = new HashMap<>();
MachInfo.put("deviceId",deviceId.isEmpty()?"123":deviceId);
MachInfo.put("clientType",clientType.isEmpty()?"1":clientType);
MachInfo.put("param_ip",param_ip.isEmpty()?"127.0.0.1":param_ip);
//获取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,MachInfo);
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",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
// 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,MachInfo);
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,649 @@
<%--
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.alibaba.fastjson.JSONException" %>
<%!
//获取分页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{
try {
if (stMsg.has("errorCode")&&"2009".equals(stMsg.getString("errorCode"))){
response.sendRedirect("https://office.bankoftianjin.com/interface/transfer/mobile/noPermissons2.html");
}
} catch (JSONException e) {
bb.writeLog(e);
}
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>

@ -418,7 +418,7 @@
return Base64.encodeBase64String(cipher.doFinal(content.getBytes(StandardCharsets.UTF_8)));
}
public static String getPublicKey(){
public static String getPublicKey(Map<String, String> MachInfo){
BaseBean bb = new BaseBean();
String publicKey ="";
String API_KEY = Util.null2String(bb.getPropValue("tjbankEMobileSSO","key"));
@ -426,9 +426,12 @@
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");
headers.put("MACH_ID",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
// 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 {
@ -444,7 +447,7 @@
}
//获取TG
public static String getST(String tgt,String emobileUrl){
public static String getST(String tgt,String emobileUrl,Map<String, String> MachInfo){
BaseBean bb = new BaseBean();
String ST = "";
String retMsg = "";
@ -465,9 +468,12 @@
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");
headers.put("MACH_ID",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
// 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);
@ -509,6 +515,23 @@
}
bb.writeLog("login_id-->"+login_id);
bb.writeLog("user_password-->"+user_password);
Map<String, Object> paramsMap = ParamUtil.request2Map(request);
new BaseBean().writeLog("paramsMap===>"+JSONObject.toJSONString(paramsMap) );
String deviceId = Util.null2String(paramsMap.get("deviceId"));
String clientType = Util.null2String(paramsMap.get("clientType"));
if("2".equals(clientType)){
clientType = "0";
}else if("3".equals(clientType)){
clientType = "1";
}
String param_ip = Util.null2String(paramsMap.get("param_ip"));
new BaseBean().writeLog("paramsMap===>"+paramsMap );
new BaseBean().writeLog("deviceId===>"+deviceId );
new BaseBean().writeLog("clientType===>"+clientType );
HashMap<String, String> MachInfo = new HashMap<>();
MachInfo.put("deviceId",deviceId.isEmpty()?"123":deviceId);
MachInfo.put("clientType",clientType.isEmpty()?"1":clientType);
MachInfo.put("param_ip",param_ip.isEmpty()?"127.0.0.1":param_ip);
//获取session
session = request.getSession(true);
String certified_token = Util.null2String(session.getAttribute("certified_token"));
@ -544,36 +567,36 @@
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 {
// 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 ="";
@ -582,7 +605,7 @@
List<String> resultList = rsa.decryptList(request, decriptList);
String loginId = resultList.get(0);
String userPassword = resultList.get(1);
String publicKey = getPublicKey();
String publicKey = getPublicKey(MachInfo);
passWord = encrypt(user_password, publicKey);
params = new HashMap<>();//参数
params.put("username",loginId);
@ -591,9 +614,12 @@
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");
headers.put("MACH_ID",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
// 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);
@ -602,7 +628,7 @@
if(resMsg.has("TGT")){
TGT = Util.null2String(resMsg.get("TGT").toString());
}
String responseInfo = getST(TGT,cockpitUrl);
String responseInfo = getST(TGT,cockpitUrl,MachInfo);
if (isEmpty(responseInfo)){
out.print("单点系统接口返回值为null");
return;
@ -628,7 +654,7 @@
out.print("跳转路径-->"+loginUrl);
out.print("进入驾驶舱成功");
response.sendRedirect(loginUrl);
}
// }
// out.print("进入驾驶舱系统失败,请先获取标识");
//return;

@ -0,0 +1,659 @@
<%--
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.alibaba.fastjson.JSONException" %>
<%!
//获取分页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{
try {
if (stMsg.has("errorCode")&&"2009".equals(stMsg.getString("errorCode"))){
response.sendRedirect("https://office.bankoftianjin.com/interface/transfer/mobile/noPermissons2.html");
}
} catch (JSONException e) {
bb.writeLog(e);
}
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,677 @@
<%--
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(Map<String, String> MachInfo){
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",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
// 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,Map<String, String> MachInfo){
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",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
// 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);
Map<String, Object> paramsMap = ParamUtil.request2Map(request);
new BaseBean().writeLog("paramsMap===>"+JSONObject.toJSONString(paramsMap) );
String deviceId = Util.null2String(paramsMap.get("deviceId"));
String clientType = Util.null2String(paramsMap.get("clientType"));
if("2".equals(clientType)){
clientType = "0";
}else if("3".equals(clientType)){
clientType = "1";
}
String param_ip = Util.null2String(paramsMap.get("param_ip"));
new BaseBean().writeLog("paramsMap===>"+paramsMap );
new BaseBean().writeLog("deviceId===>"+deviceId );
new BaseBean().writeLog("clientType===>"+clientType );
HashMap<String, String> MachInfo = new HashMap<>();
MachInfo.put("deviceId",deviceId.isEmpty()?"123":deviceId);
MachInfo.put("clientType",clientType.isEmpty()?"1":clientType);
MachInfo.put("param_ip",param_ip.isEmpty()?"127.0.0.1":param_ip);
//获取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( MachInfo);
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");
headers.put("MACH_ID",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
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,MachInfo);
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,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 = "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/%E5%91%98%E5%B7%A5%E4%BF%A1%E6%81%AF%E7%BB%99oa.db&yuangonggonghao=";
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 = "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/%E5%91%98%E5%B7%A5%E4%BF%A1%E6%81%AF%E7%BB%99oa.db&yuangonggonghao=";
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,843 @@
<%--
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" %>
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="java.time.LocalDateTime" %>
<%@ page import="java.time.temporal.ChronoUnit" %>
<%@ page import="okhttp3.*" %>
<%@ page import="javax.servlet.http.Cookie" %>
<%@ page import="weaver.file.Prop" %>
<%!
//获取分页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(Map<String, String> MachInfo){
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");
headers.put("MACH_ID",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
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,Map<String, String> MachInfo){
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",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
// 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;
}
public static String getsysSSOurl(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("hqdddz"));
}else {
return "-1";
}
new BaseBean().writeLog("hqdddz===="+url);
url = url.trim();
// if (!StringUtil.isBlank(url)){
// //判断是否带?号
// if (url.indexOf("?") == -1){
// url = url+"?";
// }else{
// url = url+"&";
// }
// };
return url;
}
public static boolean isDifferenceGreaterThan(String timeStr2, int hours) {
// 定义日期时间格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// 解析字符串为LocalDateTime对象
// LocalDateTime time1 = LocalDateTime.parse(timeStr1, formatter);
LocalDateTime now = LocalDateTime.now();
LocalDateTime time2 = LocalDateTime.parse(timeStr2, formatter);
// 计算两个时间的差值(以小时为单位)
// long hoursDifference = ChronoUnit.HOURS.between(time1, time2);
long hoursDifference = ChronoUnit.SECONDS.between(now, time2);
System.out.println(hoursDifference);
// 检查差值是否大于给定的小时数
return Math.abs(hoursDifference) > (long) hours * 60 * 60;
}
public String getEMToken() {
try {
String sysurl = Prop.getPropValue("emsysinfo", "sysurl");
String corpid = Prop.getPropValue("emsysinfo", "corpid");
String corpsecret = Prop.getPropValue("emsysinfo", "corpsecret");
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url(sysurl+"/emp/api/gettoken?corpid="+corpid+"&corpsecret="+corpsecret)
.get()
.build();
Response response = client.newCall(request).execute();
String responseStr = response.body().string();
JSONObject responseJson = JSONObject.parseObject(responseStr);
if ("0".equals(responseJson.get("errcode")+"")){
return responseJson.getString("access_token");
}else {
return responseJson.getString("errmsg");
}
} catch (Exception e) {
return e.getMessage();
}
}
public String EMExt(String access_token,String jsonStr) {
OkHttpClient client = new OkHttpClient();
String sysurl = Prop.getPropValue("emsysinfo", "sysurl");
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType,jsonStr);
Request request = new Request.Builder()
.url(sysurl+"/emp/api/integrate/func/offline?access_token="+access_token)
.post(body)
.addHeader("content-type", "application/json")
.build();
try {
Response response = client.newCall(request).execute();
String responseStr = response.body().string();
JSONObject responseJson = JSONObject.parseObject(responseStr);
if ("0".equals(responseJson.get("errcode"))){
return responseJson.getString("errmsg");
}else {
return responseJson.getString("errmsg");
}
} catch (Exception e) {
e.printStackTrace();
return e.getMessage();
}
}
%>
<%
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 deviceId = Util.null2String(paramsMap.get("deviceId"));
String clientType = Util.null2String(paramsMap.get("clientType"));
if("2".equals(clientType)){
clientType = "0";
}else if("3".equals(clientType)){
clientType = "1";
}
String param_ip = Util.null2String(paramsMap.get("param_ip"));
new BaseBean().writeLog("paramsMap===>"+paramsMap );
new BaseBean().writeLog("deviceId===>"+deviceId );
new BaseBean().writeLog("clientType===>"+clientType );
HashMap<String, String> MachInfo = new HashMap<>();
MachInfo.put("deviceId",deviceId.isEmpty()?"123":deviceId);
MachInfo.put("clientType",clientType.isEmpty()?"1":clientType);
MachInfo.put("param_ip",param_ip.isEmpty()?"127.0.0.1":param_ip);
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"));
String certified_token_expires = Util.null2String(session.getAttribute("certified_token_expires"));
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 cockpitUrl = getsysSSOurl(sysid);
String tgturl = Util.null2String(bb.getPropValue("tjbankEMobileSSO","tgtUrl"));//请求获取TGT地址
//获取ST带着下游系统
if (!isEmpty(certified_token) && !isDifferenceGreaterThan(certified_token_expires, 4)){
bb.writeLog("TGT未失效");
String responseInfo = getST(certified_token,cockpitUrl, MachInfo);
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(loginUrl);
response.sendRedirect(loginUrl);
// request.getRequestDispatcher("loginUrl").forward(request,response);
// return;
}
}else {
bb.writeLog("TGT已失效");
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(MachInfo);
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",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
// 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());
}else{
//密码不正确,执行强制退出
if ("2002".equals(resMsg.get("errorCode")+"")){
out.print("<h3 style='font-size: 20px;'>您的单点系统密码已修改,请重新登录,将在3秒后退出</h3>");
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
JSONObject postBody = new JSONObject();
String sysid = Prop.getPropValue("emsysinfo", "sysid");
postBody.put("sysid",sysid);
postBody.put("userids",user.getUID());
postBody.put("offline_type","1");
postBody.put("client_type","1,2,3");
String errmsg = EMExt(getEMToken(), postBody.toJSONString());
}
});
thread.start();
return;
}else{
out.print(resMsg.get("message"));
return;
}
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date now = new Date();
Date expiresDate = new Date(now.getTime() + (4 * 60 * 60 * 1000));
request.getSession(true).setAttribute("certified_token_expires", sdf.format(expiresDate));//记录toekn失效日期时间
request.getSession(true).setAttribute("certified_token", TGT);//记录toekn
String responseInfo = getST(TGT,cockpitUrl,MachInfo);
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("进入驾驶舱成功");
//out.print(loginUrl);
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,746 @@
<%--
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" %>
<%@ page import="com.alibaba.fastjson.JSONException" %>
<%!
//获取分页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(Map<String, String> MachInfo){
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",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
// 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,Map<String, String> MachInfo){
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",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
// 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;
}
public static String getsysSSOurl(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("hqdddz"));
}else {
return "-1";
}
new BaseBean().writeLog("hqdddz===="+url);
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 deviceId = Util.null2String(paramsMap.get("deviceId"));
String clientType = Util.null2String(paramsMap.get("clientType"));
if("2".equals(clientType)){
clientType = "0";
}else if("3".equals(clientType)){
clientType = "1";
}
String param_ip = Util.null2String(paramsMap.get("param_ip"));
new BaseBean().writeLog("paramsMap===>"+paramsMap );
new BaseBean().writeLog("deviceId===>"+deviceId );
new BaseBean().writeLog("clientType===>"+clientType );
HashMap<String, String> MachInfo = new HashMap<>();
MachInfo.put("deviceId",deviceId.isEmpty()?"123":deviceId);
MachInfo.put("clientType",clientType.isEmpty()?"1":clientType);
MachInfo.put("param_ip",param_ip.isEmpty()?"127.0.0.1":param_ip);
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 cockpitUrl = getsysSSOurl(sysid);
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(loginUrl);
// 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(MachInfo);
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",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
// 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,MachInfo);
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{
try {
if (stMsg.has("errorCode")&&"2009".equals(stMsg.getString("errorCode"))){
response.sendRedirect("https://office.bankoftianjin.com/interface/transfer/mobile/noPermissons2.html");
}
} catch (JSONException e) {
bb.writeLog(e);
}
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("进入驾驶舱成功");
//out.print(loginUrl);
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,743 @@
<%--
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" %>
<%@ page import="com.alibaba.fastjson.JSONException" %>
<%!
//获取分页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(Map<String, String> MachInfo){
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");
headers.put("MACH_ID",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
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,Map<String, String> MachInfo){
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");
headers.put("MACH_ID",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
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;
}
public static String getsysSSOurl(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("hqdddz"));
}else {
return "-1";
}
new BaseBean().writeLog("hqdddz===="+url);
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");
String deviceId = Util.null2String(paramsMap.get("deviceId"));
String clientType = Util.null2String(paramsMap.get("clientType"));
if("2".equals(clientType)){
clientType = "0";
}else if("3".equals(clientType)){
clientType = "1";
}
String param_ip = Util.null2String(paramsMap.get("param_ip"));
new BaseBean().writeLog("paramsMap===>"+paramsMap );
new BaseBean().writeLog("deviceId===>"+deviceId );
new BaseBean().writeLog("clientType===>"+clientType );
HashMap<String, String> MachInfo = new HashMap<>();
MachInfo.put("deviceId",deviceId.isEmpty()?"123":deviceId);
MachInfo.put("clientType",clientType.isEmpty()?"1":clientType);
MachInfo.put("param_ip",param_ip.isEmpty()?"127.0.0.1":param_ip);
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 cockpitUrl = getsysSSOurl(sysid);
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(loginUrl);
// 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(MachInfo);
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");
headers.put("MACH_ID",MachInfo.get("deviceId"));
headers.put("MACH_TYPE",MachInfo.get("clientType"));
headers.put("MACH_IP",MachInfo.get("param_ip"));
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,MachInfo);
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{
try {
if (stMsg.has("errorCode")&&"2009".equals(stMsg.getString("errorCode"))){
response.sendRedirect("https://office.bankoftianjin.com/interface/transfer/mobile/noPermissons2.html");
}
} catch (JSONException e) {
bb.writeLog(e);
}
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("进入驾驶舱成功");
out.print(loginUrl);
// 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,270 @@
<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('/weaver/weaver.file.FileDownload?fileid=a00b88571da680efc16426b25b0507550379ee36fab6223222325ef1877cdbbac0db20bf5876fc64b51bb03bd589c1bec6e8662b6d7f37c27&diyPicId=336') 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">需开通权限后</span>
<br/>
<span class="btn_text">方可使用</span>
</div>
</div>
</div>
</body></html>

@ -0,0 +1,270 @@
<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('http://14.1.215.14:9000/weaver/weaver.file.FileDownload?fileid=a2438419fbb558079823182e12dde46fefe2eb351259d245bc0587bef080a19d17e61e3df2c984e9151bb03bd589c1bec6e8662b6d7f37c27&diyPicId=335') 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">需开通权限后</span>
<br/>
<span class="btn_text">方可使用</span>
</div>
</div>
</div>
</body></html>

@ -0,0 +1,270 @@
<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('/weaver/weaver.file.FileDownload?fileid=ac7e440cf3c02b50da33b648ee01f66672f645d57d8e2bc12b75d412f24cb205aafc92b6247c8803351bb03bd589c1bec6e8662b6d7f37c27&diyPicId=334') 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">需开通权限后</span>
<br/>
<span class="btn_text">方可使用</span>
</div>
</div>
</div>
</body></html>

@ -0,0 +1,269 @@
<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(http://static.ktkt.com/jys_n-bj.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">敬请期待...</span>
</div>
</div>
</div>
</body></html>

@ -0,0 +1,160 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.Util,weaver.conn.RecordSet" %>
<%@ page import="weaver.integration.logging.Logger"%>
<%@ page import="weaver.integration.logging.LoggerFactory"%>
<%@ page import="weaver.ofs.bean.OfsSysInfo" %>
<%@ page import="weaver.ofs.service.OfsSysInfoService" %>
<%@ page import="weaver.ofs.manager.utils.OfsTodoDataUtils" %>
<%@ page import="java.util.Map" %>
<%@ page import="weaver.ofs.bean.OfsTodoData" %>
<%@ page import="weaver.ofs.dao.OfsRequestBaseDao" %>
<%@ page import="org.apache.commons.beanutils.BeanUtils" %>
<%@ page import="org.apache.commons.lang3.StringUtils" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="weaver.interfaces.sso.cas.CASLoginUtil" %>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%
Logger log = LoggerFactory.getLogger();
//补偿 认证 cas ,如果统一认证 开启 自动补偿刷新
CASLoginUtil.WxDingDingLoginSSO(request , response) ;
RecordSet rs = new RecordSet();
String type = request.getParameter("type") ;
String sysId = request.getParameter("sysId") ;
String workflowId = request.getParameter("workflowId") ;
String flowId = request.getParameter("flowId") ;
if ("".equals(sysId) || "".equals(type) || "".equals(workflowId) || "".equals(flowId)){
out.println(" parameter error ");
return;
}
int userId = user.getUID() ;
Map<String, String[]> paramMap =request.getParameterMap() ;
OfsSysInfoService ofsSysInfoService = new OfsSysInfoService() ;
OfsSysInfo ofsSysInfo = ofsSysInfoService.getOneBean(Util.getIntValue(sysId , 0)) ;
if (ofsSysInfo == null || "".equals(Util.null2String(ofsSysInfo.getSysid()))){
log.error("根据标识:"+sysId+"未查询到数据");
out.println("根据标识:"+sysId+"未查询到数据");
return;
}
OfsTodoDataUtils todoDataUtils = new OfsTodoDataUtils() ;
OfsRequestBaseDao ofsRequestBaseDao = new OfsRequestBaseDao() ;
OfsTodoData todoData = null;
String requestId = ofsRequestBaseDao.getRequestid(ofsSysInfo.getSyscode() , Util.getIntValue(workflowId , 0) , flowId , rs.getDBType()) ;
if(!"".equals(Util.null2String(requestId)))
todoData = todoDataUtils.getTodoData(requestId , Util.null2String(userId)) ;
if (todoData == null) {
todoData = this.getTodoData(flowId, workflowId, sysId, user);
if (todoData == null) {
log.error("根据标识:" + ofsSysInfo.getSyscode() + " workflowId:" + workflowId + " flowId: " + flowId + "未查询到数据");
out.println("根据标识:" + ofsSysInfo.getSyscode() + " workflowId:" + workflowId + " flowId: " + flowId + "未查询到数据");
return;
}
}
String toURL = todoDataUtils.getURL("app".equalsIgnoreCase(type)? "1":"0" , ofsSysInfo , todoData , request , paramMap) ;
log.warn("跳转URL:" + toURL);
rs.executeUpdate("update ofs_todo_data set viewtype=1 where requestid=? and userid=? and islasttimes=1" , requestId , userId);
rs.executeUpdate("update ofs_done_data set viewtype=1 where requestid=? and userid=? " , requestId , userId);
rs.executeUpdate("delete from SysPoppupRemindInfoNew where userid = ? and requestid = ?", userId, requestId);
%>
<script type="text/javascript">
location.replace('<%=toURL%>');
</script>
<%!
Logger log = LoggerFactory.getLogger();
/**
* 获取 异构系统流程数据
* @return
*/
private OfsTodoData getTodoData(String flowId ,String workflowId , String sysId ,User user ){
RecordSet rs = new RecordSet() ;
List<String> userList = new ArrayList<>();
userList.add(user.getUID() + "");
if (!"".equals(Util.null2String(user.getBelongtoids())))
userList.add(user.getBelongtoids());
//开启 主次账号 ,并且有多个用户
rs.executeQuery("select * from ofs_todo_data where flowid=? and workflowid=? and sysid=? and userid in ( "+String.join("," , userList)+" )",
flowId , workflowId , sysId);
OfsTodoData ofsTodoData = this.putValue2Bean(rs) ;
if (StringUtils.isBlank(ofsTodoData.getFlowid())){
rs.executeQuery("select * from ofs_done_data where flowid=? and workflowid=? and sysid=? and userid in ( "+String.join("," , userList)+" )",
flowId , workflowId , sysId);
OfsTodoData ofsDoneData = this.putValue2Bean(rs);
if (StringUtils.isBlank(ofsDoneData.getFlowid())){
log.error("flowId : "+ flowId +" workflowId : "+ workflowId +" sysId : "+ sysId +" userId:"+user.getUID() + " 没有对应数据");
return null ;
}
log.error("ofsTodoData : "+ JSONObject.toJSONString(ofsDoneData));
return ofsDoneData ;
}
log.error("ofsTodoData : "+ JSONObject.toJSONString(ofsTodoData));
return ofsTodoData ;
}
/**
* 将待办信息从数据库查询出来放入bean中
* @param rs
*/
private OfsTodoData putValue2Bean(RecordSet rs) {
rs.next();
OfsTodoData ofsTodoData = new OfsTodoData();
try{
BeanUtils.setProperty(ofsTodoData,"id", Util.getIntValue(rs.getString("id"), 0)+"");
BeanUtils.setProperty(ofsTodoData,"sysid", Util.getIntValue(rs.getString("sysid"), 0)+"");
BeanUtils.setProperty(ofsTodoData,"syscode", Util.null2String(rs.getString("syscode"), ""));
BeanUtils.setProperty(ofsTodoData,"requestid", Util.null2String(rs.getString("requestid")));
BeanUtils.setProperty(ofsTodoData,"flowid", Util.null2String(rs.getString("flowid")));
// BeanUtils.setProperty(ofsTodoData,"flowguid", Util.null2String(rs.getString("flowguid")));
BeanUtils.setProperty(ofsTodoData,"requestname", Util.null2String(rs.getString("requestname")));
BeanUtils.setProperty(ofsTodoData,"workflowname", Util.null2String(rs.getString("workflowname")));
BeanUtils.setProperty(ofsTodoData,"workflowid", Util.null2String(rs.getString("workflowid")));
BeanUtils.setProperty(ofsTodoData,"nodename", Util.null2String(rs.getString("nodename")));
BeanUtils.setProperty(ofsTodoData,"isremark", Util.null2String(rs.getString("isremark")));
BeanUtils.setProperty(ofsTodoData,"viewtype", Util.null2String(rs.getString("viewtype")));
BeanUtils.setProperty(ofsTodoData,"islasttimes", Util.null2String(rs.getString("islasttimes")));
BeanUtils.setProperty(ofsTodoData,"iscomplete", Util.null2String(rs.getString("iscomplete")));
BeanUtils.setProperty(ofsTodoData,"hrmtransrule", Util.null2String(rs.getString("hrmtransrule")));
BeanUtils.setProperty(ofsTodoData,"pcurl", Util.null2String(rs.getString("pcurl")));
BeanUtils.setProperty(ofsTodoData,"appurl", Util.null2String(rs.getString("appurl")));
BeanUtils.setProperty(ofsTodoData,"creator", Util.null2String(rs.getString("creator")));
BeanUtils.setProperty(ofsTodoData,"creatorid", Util.null2String(rs.getString("creatorid")));
BeanUtils.setProperty(ofsTodoData,"createdate", Util.null2String(rs.getString("createdate")));
BeanUtils.setProperty(ofsTodoData,"createtime", Util.null2String(rs.getString("createtime")));
BeanUtils.setProperty(ofsTodoData,"userid", Util.null2String(rs.getString("userid")));
BeanUtils.setProperty(ofsTodoData,"receiver", Util.null2String(rs.getString("receiver")));
BeanUtils.setProperty(ofsTodoData,"receivedate", Util.null2String(rs.getString("receivedate")));
BeanUtils.setProperty(ofsTodoData,"receivetime", Util.null2String(rs.getString("receivetime")));
BeanUtils.setProperty(ofsTodoData,"modifier", Util.null2String(rs.getString("modifier")));
BeanUtils.setProperty(ofsTodoData,"modifydate", Util.null2String(rs.getString("modifydate")));
BeanUtils.setProperty(ofsTodoData,"modifytime", Util.null2String(rs.getString("modifytime")));
BeanUtils.setProperty(ofsTodoData,"pcurlsrc", Util.null2String(rs.getString("pcurlsrc")));
BeanUtils.setProperty(ofsTodoData,"appurlsrc", Util.null2String(rs.getString("appurlsrc")));
BeanUtils.setProperty(ofsTodoData,"requestlevel", Util.null2String(rs.getString("requestlevel")));
BeanUtils.setProperty(ofsTodoData,"receivets", Util.null2String(rs.getString("receivets")));
BeanUtils.setProperty(ofsTodoData,"pcurlsrc", Util.null2String(rs.getString("pcurlsrc")));
BeanUtils.setProperty(ofsTodoData,"appurlsrc", Util.null2String(rs.getString("appurlsrc")));
return ofsTodoData;
}catch(Exception e){
log.error(e);
return null;
}
}
%>

@ -0,0 +1,203 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.Util,weaver.conn.RecordSet" %>
<%@ page import="weaver.integration.logging.Logger"%>
<%@ page import="weaver.integration.logging.LoggerFactory"%>
<%@ page import="java.io.IOException" %>
<%@ page import="java.io.BufferedReader" %>
<%@ page import="java.io.OutputStreamWriter" %>
<%@ page import="java.net.URL" %>
<%@ page import="java.io.InputStreamReader" %>
<%@ page import="java.net.URLConnection" %>
<%@ page import="org.apache.commons.lang3.StringUtils" %>
<%@ page import="weaver.interfaces.HrmTransferDao" %>
<%@ page import="weaver.interfaces.outter.CheckIpNetWorkForUpcoming" %>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%
Logger log = LoggerFactory.getLogger();
RecordSet rs = new RecordSet();
String workflowId = request.getParameter("workflowid");
String sysId = request.getParameter("sysid");
String isMsg = Util.null2String(request.getParameter("_weaverofsmsg"));
int userId = user.getUID() ;
String pcurl ;
if(StringUtils.isNotBlank(workflowId)){
//新建异构系统
log.error("workflowid="+workflowId);
rs.executeQuery("select * from ofs_workflow where workflowid = ?",workflowId);
rs.next();
pcurl = rs.getString("pccwurl");
if ("".equals(Util.null2String(sysId))){
sysId = rs.getString("SYSID");
}
}else{
//访问异构系统流程
String todoDataId = request.getParameter("tododataid");
log.error("todoDataId="+todoDataId);
String isRemark = request.getParameter("isremark");
log.error("isRemark="+isRemark);
if( "0".equals(isRemark) || "8".equals(isRemark)){
rs.executeQuery("select * from ofs_todo_data where id = ?",todoDataId);
rs.next();
pcurl = Util.null2String(rs.getString("pcurlsrc"));
if ("".equals(Util.null2String(sysId))){
sysId = rs.getString("SYSID");
}
}else{
rs.executeQuery("select * from ofs_done_data where id = ?",todoDataId);
rs.next();
pcurl = Util.null2String(rs.getString("pcurlsrc"));
if ("".equals(Util.null2String(sysId))){
sysId = rs.getString("SYSID");
}
}
}
rs.executeQuery("select * from ofs_sysinfo where sysid = ?" , sysId);
if(rs.next()){
//自动内外网登录
String clientIp = Util.getIpAddr(request);
boolean notInOuter = this.notInOuter(rs.getString("syscode") , clientIp);
String prefixURL ;
if (notInOuter){
prefixURL = Util.null2String(rs.getString("pcouterfixurl"));
}else{
prefixURL = Util.null2String(rs.getString("pcprefixurl"));
}
String hrmTransRule = Util.null2String(rs.getString("HRMTRANSRULE"));//人员转换关系
HrmTransferDao hrmTransferDao = new HrmTransferDao();
String loginId = hrmTransferDao.getHrmResourceIdByHrmTransRule(hrmTransRule, Util.null2String(userId));
String token = this.getToken(prefixURL , loginId) ;
String toURL = this.getURL(prefixURL , pcurl , token , isMsg) +"&ofsComeFrom=e9";
log.error("pc端访问异构系统地址"+toURL);
%>
<script type="text/javascript">
location.replace('<%=toURL%>');
</script>
<%
}else{
log.error("根据标识:"+sysId+"未查询到数据");
return;
}
%>
<%!
Logger log = LoggerFactory.getLogger();
//外网地址返回 true ,内网 false
private boolean notInOuter(String sysCode , String clientIp){
//0代表不开启则所有通过内网访问
//1代表开启并且有设置网段
//2代表开启但是没有设置网段
RecordSet rs = new RecordSet();
rs.executeQuery("SELECT * FROM autologin_status WHERE syscode= ? " , sysCode) ;
if (rs.next()){
String status = Util.null2String(rs.getString("status"),"0");
if ("0".equals(status)){
return false ;
}else if ("2".equals(status)){
return true ;
}
}
//检测IP
CheckIpNetWorkForUpcoming checkIpNetWorkForUpcoming = new CheckIpNetWorkForUpcoming();
return checkIpNetWorkForUpcoming.checkIpSeg(clientIp);//不在网段策略中 返回true
}
private String getURL(String prefixURL , String toURL , String token , String isMsg){
StringBuilder url = new StringBuilder() ;
if(toURL.startsWith("http://") || toURL.startsWith("https://")){
url.append(toURL);
}else{
url.append(prefixURL).append(toURL);
}
if(url.toString().contains("#")){
StringBuilder ssoToken = new StringBuilder("&ssoToken=");
ssoToken.append(token) ;
if(!"".equals(isMsg)){
ssoToken.append("&_weaverofsmsg=1") ;
}
int i = url.toString().indexOf("#") ;
url.insert(i, ssoToken) ;
}else{
if(toURL.contains("?")){
url.append("&");
}else{
url.append("?");
}
url.append("ssoToken=").append(token) ;
if(!"".equals(isMsg)){
url.append("&_weaverofsmsg=1") ;
}
}
return url.toString() ;
}
private String getToken(String prefixURL ,String loginId){
//TODO 1 调用e9接口获取token
OutputStreamWriter oout = null;
BufferedReader iin = null;
String result = "";
try {
// 发送请求参数
URL realUrl = new URL(prefixURL + "/ssologin/getToken?appid=fore9&loginid=" + java.net.URLEncoder.encode(loginId, "UTF-8"));
// 打开和URL之间的连接
URLConnection conn = realUrl.openConnection();
// 设置通用的请求属性
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("Content-Type", "application/json");
// 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
// 获取URLConnection对象对应的输出流
oout = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
oout.write("");
// flush输出流的缓冲
oout.flush();
// 定义BufferedReader输入流来读取URL的响应
iin = new BufferedReader(
new InputStreamReader(conn.getInputStream(), "UTF-8"));
String line;
while ((line = iin.readLine()) != null) {
result += line;
}
log.error("result" + result);
} catch (Exception e) {
log.error("发送 POST 请求出现异常!", e);
e.printStackTrace();
}
//使用finally块来关闭输出流、输入流
finally {
try {
if (oout != null) {
oout.close();
}
if (iin != null) {
iin.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return result ;
}
%>

@ -0,0 +1,214 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.Util,weaver.conn.RecordSet" %>
<%@ page import="weaver.integration.logging.Logger"%>
<%@ page import="weaver.integration.logging.LoggerFactory"%>
<%@ page import="java.io.IOException" %>
<%@ page import="java.io.BufferedReader" %>
<%@ page import="java.io.OutputStreamWriter" %>
<%@ page import="java.net.URL" %>
<%@ page import="java.io.InputStreamReader" %>
<%@ page import="java.net.URLConnection" %>
<%@ page import="org.apache.commons.lang3.StringUtils" %>
<%@ page import="weaver.interfaces.HrmTransferDao" %>
<%@ page import="weaver.interfaces.outter.CheckIpNetWorkForUpcoming" %>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%
Logger log = LoggerFactory.getLogger();
RecordSet rs = new RecordSet();
String workflowId = request.getParameter("workflowid");
String sysId = request.getParameter("sysid");
String isMsg = Util.null2String(request.getParameter("_weaverofsmsg"));
int userId = user.getUID() ;
String pcurl ;
if(StringUtils.isNotBlank(workflowId)){
//新建异构系统
log.error("workflowid="+workflowId);
rs.executeQuery("select * from ofs_workflow where workflowid = ?",workflowId);
rs.next();
pcurl = rs.getString("pccwurl");
if ("".equals(Util.null2String(sysId))){
sysId = rs.getString("SYSID");
}
}else{
//访问异构系统流程
String todoDataId = request.getParameter("tododataid");
log.error("todoDataId="+todoDataId);
String isRemark = request.getParameter("isremark");
log.error("isRemark="+isRemark);
if( "0".equals(isRemark) || "8".equals(isRemark)){
rs.executeQuery("select * from ofs_todo_data where id = ?",todoDataId);
rs.next();
pcurl = Util.null2String(rs.getString("pcurlsrc"));
if ("".equals(Util.null2String(sysId))){
sysId = rs.getString("SYSID");
}
}else{
rs.executeQuery("select * from ofs_done_data where id = ?",todoDataId);
rs.next();
pcurl = Util.null2String(rs.getString("pcurlsrc"));
if ("".equals(Util.null2String(sysId))){
sysId = rs.getString("SYSID");
}
}
}
rs.executeQuery("select * from ofs_sysinfo where sysid = ?" , sysId);
if(rs.next()){
//自动内外网登录
String clientIp = Util.getIpAddr(request);
boolean notInOuter = this.notInOuter(rs.getString("syscode") , clientIp);
String prefixURL ;
if (notInOuter){
prefixURL = Util.null2String(rs.getString("pcouterfixurl"));
}else{
prefixURL = Util.null2String(rs.getString("pcprefixurl"));
}
String hrmTransRule = Util.null2String(rs.getString("HRMTRANSRULE"));//人员转换关系
HrmTransferDao hrmTransferDao = new HrmTransferDao();
String loginId = hrmTransferDao.getHrmResourceIdByHrmTransRule(hrmTransRule, Util.null2String(userId));
String token = this.getToken(prefixURL , loginId) ;
if ("".equals(token)){
out.println("get Token is null ");
return ;
}
if (token.contains(":")){
out.println("get Token is err : " + token);
return ;
}
String toURL = this.getURL(prefixURL , pcurl , token , isMsg ) +"&ofsComeFrom=e9";
log.error("pc端访问异构系统地址"+toURL);
%>
<script type="text/javascript">
location.replace('<%=toURL%>');
</script>
<%
}else{
log.error("根据标识:"+sysId+"未查询到数据");
return;
}
%>
<%!
Logger log = LoggerFactory.getLogger();
//外网地址返回 true ,内网 false
private boolean notInOuter(String sysCode , String clientIp){
//0代表不开启则所有通过内网访问
//1代表开启并且有设置网段
//2代表开启但是没有设置网段
RecordSet rs = new RecordSet();
rs.executeQuery("SELECT * FROM autologin_status WHERE syscode= ? " , sysCode) ;
if (rs.next()){
String status = Util.null2String(rs.getString("status"),"0");
if ("0".equals(status)){
return false ;
}else if ("2".equals(status)){
return true ;
}
}
//检测IP
CheckIpNetWorkForUpcoming checkIpNetWorkForUpcoming = new CheckIpNetWorkForUpcoming();
return checkIpNetWorkForUpcoming.checkIpSeg(clientIp);//不在网段策略中 返回true
}
private String getURL(String prefixURL , String toURL , String token, String isMsg){
StringBuilder url = new StringBuilder() ;
if(toURL.startsWith("http://") || toURL.startsWith("https://")){
url.append(toURL);
}else{
url.append(prefixURL).append(toURL);
}
if(url.toString().contains("#")){
StringBuilder ssoToken = new StringBuilder("&ssoToken=");
ssoToken.append(token) ;
if(!"".equals(isMsg)){
ssoToken.append("&_weaverofsmsg=1") ;
}
int i = url.toString().indexOf("#") ;
url.insert(i, ssoToken) ;
}else{
if(toURL.contains("?")){
url.append("&");
}else{
url.append("?");
}
url.append("ssoToken=").append(token) ;
if(!"".equals(isMsg)){
url.append("&_weaverofsmsg=1") ;
}
}
return url.toString() ;
}
private String getToken(String prefixURL ,String loginId){
//TODO 1 调用e9接口获取token
OutputStreamWriter oout = null;
BufferedReader iin = null;
String result = "";
try {
// 发送请求参数
URL realUrl = new URL(prefixURL + "/ssologin/getToken?appid=fore9&loginid=" + java.net.URLEncoder.encode(loginId, "UTF-8"));
// 打开和URL之间的连接
URLConnection conn = realUrl.openConnection();
// 设置通用的请求属性
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("Content-Type", "application/json");
// 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
// 获取URLConnection对象对应的输出流
oout = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
oout.write("");
// flush输出流的缓冲
oout.flush();
// 定义BufferedReader输入流来读取URL的响应
iin = new BufferedReader(
new InputStreamReader(conn.getInputStream(), "UTF-8"));
String line;
while ((line = iin.readLine()) != null) {
result += line;
}
log.error("result" + result);
} catch (Exception e) {
log.error("发送 POST 请求出现异常!", e);
e.printStackTrace();
}
//使用finally块来关闭输出流、输入流
finally {
try {
if (oout != null) {
oout.close();
}
if (iin != null) {
iin.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return result ;
}
%>

@ -0,0 +1,162 @@
<%@ page import="weaver.hrm.User" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.icbc.api.internal.apache.http.impl.cookie.S" %>
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="java.time.LocalDateTime" %>
<%@ page import="java.time.format.DateTimeParseException" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
User user = HrmUserVarify.getUser(request, response);
if (user == null){
out.print("暂无权限");
}
Map<String, Object> param = ParamUtil.request2Map(request);
String type = (String)param.get("type");
String sqr = (String)param.get("sqr");
String startDate = (String)param.get("startDate");
String endDate = (String)param.get("endDate");
//请休假审批单-总行部门正职 formtable_main_214
//请休假审批单-总行部门副职 formtable_main_215
//差旅审批单-总行员工正式 formtable_main_217
String ZZform = "formtable_main_214";
String FZform = "formtable_main_215";
String YGform = "formtable_main_292";
String sql = "select * from ";
if ("0".equals(type)){
sql += ZZform;
}else if("1".equals(type)){
sql += FZform;
}else if("2".equals(type)){
sql += YGform;
}
sql += " main left join workflow_requestBase req on main.REQUESTID = req.REQUESTID ";
sql += "where sqr = ? AND ";
sql += "wcsj <= ? AND hgsj >= ? ";
//在审批状态
sql += "and req.currentnodetype != 0 ";
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql,sqr,endDate,startDate);
writeLog(sql,sqr,endDate,startDate);
ArrayList<Map<String, String>> records = new ArrayList<>();
ArrayList<Map<String, String>> specialobjs = new ArrayList<>();
ArrayList<String> requestid = new ArrayList<>();
ArrayList<String> requestname = new ArrayList<>();
ArrayList<String> clxcdh = new ArrayList<>();
int i = 0;
while (recordSet.next()){
HashMap<String, String> record = new HashMap<>();
record.put("requestid",recordSet.getString("requestid"));
record.put("requestname",recordSet.getString("requestname"));
record.put("clxcdh",recordSet.getString("clxcdh"));
requestid.add(recordSet.getString("requestid"));
requestname.add(recordSet.getString("requestname"));
clxcdh.add(recordSet.getString("clxcdh"));
records.add(record);
HashMap<String, String> specialobj = new HashMap<>();
specialobj.put("id",recordSet.getString("requestid"));
specialobj.put("name",recordSet.getString("qjbt"));
specialobjs.add(specialobj);
i++;
}
//查看变更单是否有对冲突时间流程的修改
String querybgdsql = "select * from formtable_main_293 where id = " +
"(select max(id) from formtable_main_293 where dcyslc = ? )";
ArrayList<String> requestidNew = new ArrayList<>();
for (String rid : requestid) {
recordSet.executeQuery(querybgdsql,rid);
if(recordSet.next()){
//获取修改变更单最新的一条
String start = recordSet.getString("wcsj");
String end = recordSet.getString("hgsj");
if (isOverlapping(start,end,startDate,endDate)){
requestidNew.add(rid);
}else{
// 如果变更后不冲突去掉这条数据
removeElement(records,"requestid",rid);
removeElement(specialobjs,"id",rid);
i--;
}
}else{
// 没有变更单的情况
requestidNew.add(rid);
}
}
requestid = requestidNew;
//再查询下变更表里有没有变更后冲突的数据
String queryBGBSql = "select * from formtable_main_293 main left join workflow_requestBase base " +
"on main.requestid = base.requestid " +
"where dcyslc not in ( " +String.join(",",requestid)+" ) " +
"AND wcsj <= ? AND hgsj >= ? " +
"AND sqr = ? ";
recordSet.executeQuery(queryBGBSql,endDate,startDate,sqr);
// out.print(queryBGBSql+"|"+endDate+"|"+startDate+"|"+sqr);
while (recordSet.next()){
HashMap<String, String> record = new HashMap<>();
record.put("requestid",recordSet.getString("requestid"));
record.put("requestname",recordSet.getString("requestname"));
// record.put("clxcdh",recordSet.getString("clxcdh"));
requestid.add(recordSet.getString("requestid"));
// requestname.add(recordSet.getString("requestname"));
// clxcdh.add(recordSet.getString("clxcdh"));
records.add(record);
HashMap<String, String> specialobj = new HashMap<>();
specialobj.put("id",recordSet.getString("requestid"));
specialobj.put("name",recordSet.getString("qjbt"));
specialobjs.add(specialobj);
i++;
}
HashMap<String, Object> result = new HashMap<>();
result.put("code",0);
result.put("count",i);
result.put("requestid",String.join(",",requestid));
result.put("requestname",String.join(",",requestname));
result.put("clxcdh",String.join(",",clxcdh));
result.put("specialobjs",specialobjs);
result.put("result",records);
out.print(JSONObject.toJSONString(result));
%>
<%!
private void writeLog(Object... log){
new BaseBean().writeLog("queryDuplicatedataSL===>"+ Arrays.toString(log));;
}
public static boolean isOverlapping(String start1, String end1, String start2, String end2) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
try {
LocalDateTime dateTimeStart1 = LocalDateTime.parse(start1, formatter);
LocalDateTime dateTimeEnd1 = LocalDateTime.parse(end1, formatter);
LocalDateTime dateTimeStart2 = LocalDateTime.parse(start2, formatter);
LocalDateTime dateTimeEnd2 = LocalDateTime.parse(end2, formatter);
return !dateTimeStart1.isAfter(dateTimeEnd2) && !dateTimeEnd1.isBefore(dateTimeStart2);
} catch (DateTimeParseException e) {
e.printStackTrace();
return false;
}
}
public static void removeElement(List<Map<String, String>> list , String key, String value){
Iterator<Map<String, String>> iterator = list.iterator();
while (iterator.hasNext()) {
Map<String, String> map = iterator.next();
if (map.getOrDefault(key, "").equals(value)) {
iterator.remove();
}
}
}
%>

@ -0,0 +1,172 @@
<%@ page import="weaver.hrm.User" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="com.engine.common.util.ParamUtil" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.BaseBean" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="java.time.LocalDateTime" %>
<%@ page import="java.time.format.DateTimeParseException" %>
<%@ page import="weaver.conn.RecordSetTrans" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
User user = HrmUserVarify.getUser(request, response);
if (user == null){
out.print("暂无权限");
}
Map<String, Object> param = ParamUtil.request2Map(request);
String reqid = (String)param.get("requestid");
String sqr = (String)param.get("sqr");
String startDate = (String)param.get("startDate");
String endDate = (String)param.get("endDate");
//差旅行程变更审批单
String sql = "select * from ";
sql += getFormName(reqid);
sql += " main left join workflow_requestBase req on main.REQUESTID = req.REQUESTID ";
sql += "where sqr = ? AND ";
sql += "wcsj <= ? AND hgsj >= ? ";
//在审批状态
sql += "and req.currentnodetype != 0 ";
sql += "and req.REQUESTID != ? ";
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(sql,sqr,endDate,startDate,reqid);
writeLog(sql,sqr,endDate,startDate,reqid);
ArrayList<Map<String, String>> records = new ArrayList<>();
ArrayList<Map<String, String>> specialobjs = new ArrayList<>();
ArrayList<String> requestid = new ArrayList<>();
ArrayList<String> requestname = new ArrayList<>();
ArrayList<String> clxcdh = new ArrayList<>();
int i = 0;
while (recordSet.next()){
HashMap<String, String> record = new HashMap<>();
record.put("requestid",recordSet.getString("requestid"));
record.put("requestname",recordSet.getString("requestname"));
record.put("clxcdh",recordSet.getString("clxcdh"));
requestid.add(recordSet.getString("requestid"));
// requestname.add(recordSet.getString("requestname"));
// clxcdh.add(recordSet.getString("clxcdh"));
records.add(record);
HashMap<String, String> specialobj = new HashMap<>();
specialobj.put("id",recordSet.getString("requestid"));
specialobj.put("name",recordSet.getString("qjbt"));
specialobjs.add(specialobj);
i++;
}
//查看变更单是否有对冲突时间流程的修改
String querybgdsql = "select * from formtable_main_293 where id = " +
"(select max(id) from formtable_main_293 where dcyslc = ? )";
ArrayList<String> requestidNew = new ArrayList<>();
for (String rid : requestid) {
recordSet.executeQuery(querybgdsql,rid);
if(recordSet.next()){
//获取修改变更单最新的一条
String start = recordSet.getString("wcsj");
String end = recordSet.getString("hgsj");
if (isOverlapping(start,end,startDate,endDate)){
requestidNew.add(rid);
}else{
// 如果变更后不冲突去掉这条数据
removeElement(records,"requestid",rid);
removeElement(specialobjs,"id",rid);
i--;
}
}else{
// 没有变更单的情况
requestidNew.add(rid);
}
}
requestid = requestidNew;
//再查询下变更表里有没有变更后冲突的数据
String queryBGBSql = "select * from formtable_main_293 main left join workflow_requestBase base " +
"on main.requestid = base.requestid " +
"where dcyslc not in ( " +String.join(",",requestid)+" ) " +
"AND wcsj <= ? AND hgsj >= ? " +
"AND sqr = ? ";
recordSet.executeQuery(queryBGBSql,endDate,startDate,sqr);
while (recordSet.next()){
HashMap<String, String> record = new HashMap<>();
record.put("requestid",recordSet.getString("requestid"));
record.put("requestname",recordSet.getString("requestname"));
// record.put("clxcdh",recordSet.getString("clxcdh"));
requestid.add(recordSet.getString("requestid"));
// requestname.add(recordSet.getString("requestname"));
// clxcdh.add(recordSet.getString("clxcdh"));
records.add(record);
HashMap<String, String> specialobj = new HashMap<>();
specialobj.put("id",recordSet.getString("requestid"));
specialobj.put("name",recordSet.getString("qjbt"));
specialobjs.add(specialobj);
i++;
}
HashMap<String, Object> result = new HashMap<>();
result.put("code",0);
result.put("count",i);
result.put("requestid",String.join(",",requestid));
result.put("requestname",String.join(",",requestname));
result.put("clxcdh",String.join(",",clxcdh));
result.put("specialobjs",specialobjs);
result.put("result",records);
out.print(JSONObject.toJSONString(result));
%>
<%!
private void writeLog(Object... log){
new BaseBean().writeLog("queryDuplicatedataSL===>"+ Arrays.toString(log));;
}
/**
* 根据request获取表单名称
* @param requestid
* @return
*/
private String getFormName(String requestid){
String QueryWfidsql = "select workflowid from workflow_requestbase where requestid = ?";
String QueryFormsql = "select base.ID , bill.TABLENAME from workflow_base base " +
"left join workflow_bill bill on base.FORMID = bill.ID where base.id = ?";
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(QueryWfidsql,requestid);
recordSet.next();
String workflowid = recordSet.getString("workflowid");
recordSet.executeQuery(QueryFormsql,workflowid);
recordSet.next();
return recordSet.getString("TABLENAME");
}
public static boolean isOverlapping(String start1, String end1, String start2, String end2) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
try {
LocalDateTime dateTimeStart1 = LocalDateTime.parse(start1, formatter);
LocalDateTime dateTimeEnd1 = LocalDateTime.parse(end1, formatter);
LocalDateTime dateTimeStart2 = LocalDateTime.parse(start2, formatter);
LocalDateTime dateTimeEnd2 = LocalDateTime.parse(end2, formatter);
return !dateTimeStart1.isAfter(dateTimeEnd2) && !dateTimeEnd1.isBefore(dateTimeStart2);
} catch (DateTimeParseException e) {
e.printStackTrace();
return false;
}
}
public static void removeElement(List <Map<String, String>> list ,String key,String value){
// 条件:删除所有 age 值为 "30" 的 Map
Iterator<Map<String, String>> iterator = list.iterator();
while (iterator.hasNext()) {
Map<String, String> map = iterator.next();
if (map.getOrDefault(key, "").equals(value)) {
iterator.remove();
}
}
}
%>

@ -0,0 +1,107 @@
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="com.icbc.api.internal.apache.http.impl.cookie.S" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
String id = request.getParameter("id");
// out.print(id);
ArrayList<Map<String, String>> sourceidsList = new ArrayList<Map<String, String>>();
RecordSet recordSet = new RecordSet();
recordSet.executeQuery("select lcbt from uf_CCSPDTZ where id = ?",id);
int lc = 0;
if (recordSet.next()){
lc = Util.getIntValue(recordSet.getString("lcbt"));
}
// out.print(lc+"\n");
String sqlWhere = " where JouneryID ";
// uf_CCBGJLB
recordSet.executeQuery("select mainid from uf_CCBGJLB_dt1 where ccbgjllc = ?",lc);
if(recordSet.getCounts() == 0){
// recordSet.executeQuery("select lc from uf_CCBGJLB ccqqlc = ?",lc);
// recordSet.next();
sqlWhere =sqlWhere + "LIKE '"+lc+"%'";
}else {
recordSet.next();
String mainid = recordSet.getString("mainid");
recordSet.executeQuery("select ccqqlc from uf_CCBGJLB where id = ?",mainid);
recordSet.next();
String ccqqlc = recordSet.getString("ccqqlc");
sqlWhere =sqlWhere + "LIKE '"+ccqqlc+"%'";
recordSet.executeQuery("select ccbgjllc from uf_CCBGJLB_dt1 where mainid = ?",mainid);
while (recordSet.next()){
String ccbgjllc = recordSet.getString("ccbgjllc");
sqlWhere =sqlWhere + "or JouneryID LIKE '"+ccbgjllc+"%'";
}
}
// out.print(sqlWhere+"\n");
// sqlWhere = sqlWhere + "or JouneryID LIKE '"+332337+"%'";
recordSet.execute("select * from ctrip_SettlemenTrainOrdert" + sqlWhere);
while (recordSet.next()) {
HashMap<String, String> map = new HashMap<>();
map.put("JouneryID", Util.null2String(recordSet.getString("JouneryID")));
map.put("OrderId", Util.null2String(recordSet.getString("OrderId")));
map.put("DetailType", getTypeName(Util.null2String(recordSet.getString("DetailType"))));
map.put("Type", "火车");
map.put("PassengerName", Util.null2String(recordSet.getString("PassengerName")));
map.put("DepartureCityName", Util.null2String(recordSet.getString("DepartureCityName")));
map.put("DepartureDateTime", Util.null2String(recordSet.getString("DepartureDateTime")));
map.put("ArrivalDateTime", Util.null2String(recordSet.getString("ArrivalDateTime")));
map.put("DepartureStationName", Util.null2String(recordSet.getString("DepartureStationName")));
map.put("ArrivalStationName", Util.null2String(recordSet.getString("ArrivalStationName")));
sourceidsList.add(map);
}
recordSet.execute("select * from ctrip_SettlemenFlightOrdert" + sqlWhere);
while (recordSet.next()) {
HashMap<String, String> map = new HashMap<>();
map.put("JouneryID", Util.null2String(recordSet.getString("JourneyID")));
map.put("OrderId", Util.null2String(recordSet.getString("OrderId")));
map.put("DetailType", getTypeName(Util.null2String(recordSet.getString("DetailType"))));
map.put("Type", "飞机");
map.put("PassengerName", Util.null2String(recordSet.getString("PassengerName")));
map.put("DepartureCityName", Util.null2String(recordSet.getString("DCityName")));
map.put("DepartureDateTime", Util.null2String(recordSet.getString("TakeOffTime2")));
map.put("ArrivalDateTime", Util.null2String(recordSet.getString("ArrivalTime2")));
map.put("DepartureStationName", Util.null2String(recordSet.getString("DPortName")));
map.put("ArrivalStationName", Util.null2String(recordSet.getString("APortName")));
sourceidsList.add(map);
}
recordSet.execute("select * from ctrip_SettlemenHotelOrdert" + sqlWhere);
while (recordSet.next()) {
HashMap<String, String> map = new HashMap<>();
map.put("JouneryID", Util.null2String(recordSet.getString("HotelRelatedJourneyNo")));
map.put("OrderId", Util.null2String(recordSet.getString("OrderId")));
map.put("DetailType", getTypeName(Util.null2String(recordSet.getString("DetailType"))));
map.put("Type", "酒店");
map.put("PassengerName", Util.null2String(recordSet.getString("CityName")));
map.put("DepartureCityName", Util.null2String(recordSet.getString("DepartureCityName")));
map.put("DepartureDateTime", Util.null2String(recordSet.getString("StartTime")));
map.put("ArrivalDateTime", Util.null2String(recordSet.getString("EndTime")));
map.put("DepartureStationName", Util.null2String(recordSet.getString("HotelName")));
map.put("ArrivalStationName", Util.null2String(recordSet.getString("HotelName")));
sourceidsList.add(map);
}
out.println(JSONObject.toJSONString(sourceidsList));
%>
<%!
private String getTypeName(String type) {
String s = "";
if ("O".equals(type)) {
s = "出票";
} else if ("A".equals(type)) {
s = "改签";
} else if ("R".equals(type)) {
s = "退票";
}
return s;
}
%>

@ -0,0 +1,81 @@
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.*" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
try {
String id = request.getParameter("id");
ArrayList<Map<String, String>> sourceidsList = new ArrayList<Map<String, String>>();
RecordSet recordSet = new RecordSet();
recordSet.executeQuery("select lcbt from uf_CCSPDTZ where id = ?",id);
int lc = 0;
if (recordSet.next()){
lc = Util.getIntValue(recordSet.getString("lcbt"));
}
ArrayList<String> lcArr = new ArrayList();
recordSet.executeQuery("select mainid from uf_CCBGJLB_dt1 where ccbgjllc = ?",lc);
if(recordSet.getCounts() == 0){
// recordSet.executeQuery("select lc from uf_CCBGJLB ccqqlc = ?",lc);
// recordSet.next();
lcArr.add(lc+"");
}else {
recordSet.next();
String mainid = recordSet.getString("mainid");
recordSet.executeQuery("select ccqqlc from uf_CCBGJLB where id = ?",mainid);
recordSet.next();
String ccqqlc = recordSet.getString("ccqqlc");
lcArr.add(ccqqlc);
recordSet.executeQuery("select ccbgjllc from uf_CCBGJLB_dt1 where mainid = ?",mainid);
while (recordSet.next()){
String ccbgjllc = recordSet.getString("ccbgjllc");
lcArr.add(ccbgjllc);
}
}
// out.print(lcArr);
if (lcArr.size() > 0){
recordSet.executeQuery("select requestid from formtable_main_206 where yccsj in ( " + String.join(",",lcArr) + ")");
}
ArrayList<String> requestArr = new ArrayList();
while (recordSet.next()){
String requestid = recordSet.getString("requestid");
requestArr.add(requestid);
}
// out.print(requestArr);
recordSet.executeQuery("select REQUESTID , currentnodetype ,REQUESTMARK from WORKFLOW_REQUESTBASE where REQUESTID in ( " + String.join(",",requestArr) + " )");
ArrayList<String> noArchivingReq = new ArrayList<>();
ArrayList<Map<String, String>> specialobj = new ArrayList<>();
while (recordSet.next()){
String currentnodetype = recordSet.getString("currentnodetype");
if(!"3".equals(currentnodetype)){
String requestid = recordSet.getString("requestid");
String requestname = recordSet.getString("REQUESTMARK");
noArchivingReq.add(requestid);
HashMap<String, String> map = new HashMap<>();
map.put("id",requestid);
map.put("name",requestname);
specialobj.add(map);
}
}
if (noArchivingReq.size() > 0){
HashMap<String, Object> changeFieldValue = new HashMap<>();
String value= String.join(",",noArchivingReq);
changeFieldValue.put("value" ,value );
changeFieldValue.put("specialobj",specialobj);
out.print(JSONObject.toJSONString(changeFieldValue));
// out.print("-2");
}else {
out.print("-1");
}
}catch (Exception e){
out.print(e);
out.print("");
out.print(e.getStackTrace());
}
%>
<%!
%>

@ -9,63 +9,37 @@ package weaver.file;
* @version 1.0,2004-6-25
*/
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.zip.ZipInputStream;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import DBstep.iMsgServer2000;
import com.api.doc.detail.service.DocDetailService;
import com.api.doc.detail.service.DocViewPermission;
import com.api.doc.detail.service.impl.DocWaterServiceImpl;
import com.api.doc.detail.util.DocCoopereateUtil;
import com.api.doc.detail.util.DocDownloadCheckUtil;
import com.api.doc.detail.util.ImageConvertUtil;
import com.api.doc.detail.util.PdfConvertUtil;
import com.api.doc.mobile.systemDoc.util.SystemDocUtil;
import com.engine.common.util.ServiceUtil;
import com.api.doc.upload.web.util.Json2MapUtil;
import com.api.doc.wps.service.impl.WebOfficeServiceImpl;
import com.api.workflow.service.RequestAuthenticationService;
import com.engine.doc.util.*;
import com.engine.ecme.biz.EcmeRightManager;
import com.engine.edc.biz.JoinCubeBiz;
import com.engine.odoc.util.DocUtil;
import org.apache.commons.io.FileUtils;
import com.weaver.formmodel.util.StringHelper;
import de.schlichtherle.util.zip.ZipEntry;
import de.schlichtherle.util.zip.ZipOutputStream;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.WorkPlan.WorkPlanService;
import weaver.alioss.AliOSSObjectManager;
import weaver.blog.BlogDao;
import weaver.common.DateUtil;
import weaver.common.StringUtil;
import weaver.conn.RecordSet;
import weaver.cowork.CoworkDAO;
import weaver.crm.CrmShareBase;
import weaver.docs.EncryptDecryptFileUtil;
import weaver.docs.category.SecCategoryComInfo;
import weaver.docs.docs.DocManager;
import weaver.docs.docs.AddWater.DocAddWaterForSecond;
import weaver.docs.docs.DocManager;
import weaver.email.service.MailFilePreviewService;
import weaver.file.util.FileDeleteUtil;
import weaver.file.util.FileManager;
@ -80,38 +54,34 @@ import weaver.hrm.User;
import weaver.hrm.resource.ResourceComInfo;
import weaver.meeting.MeetingUtil;
import weaver.mobile.plugin.ecology.service.AuthService;
import weaver.rdeploy.doc.PrivateSeccategoryManager;
import weaver.social.service.SocialIMService;
import weaver.splitepage.operate.SpopForDoc;
import weaver.system.SystemComInfo;
import weaver.systeminfo.SystemEnv;
import weaver.voting.VotingManager;
import weaver.voting.groupchartvote.ImageCompressUtil;
import DBstep.iMsgServer2000;
import com.api.doc.detail.service.DocDetailService;
import com.api.doc.detail.service.DocViewPermission;
import com.api.doc.detail.util.DocCoopereateUtil;
import com.api.doc.detail.util.DocDownloadCheckUtil;
import com.api.doc.detail.util.ImageConvertUtil;
import com.api.doc.upload.web.util.Json2MapUtil;
import com.api.doc.wps.service.impl.WebOfficeServiceImpl;
import com.api.workflow.service.RequestAuthenticationService;
import com.engine.edc.biz.JoinCubeBiz;
import com.weaver.formmodel.util.StringHelper;
import de.schlichtherle.util.zip.ZipEntry;
import de.schlichtherle.util.zip.ZipOutputStream;
import weaver.wps.CommonUtil;
import weaver.wps.doccenter.utils.Tools;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.zip.ZipInputStream;
public class FileDownload extends HttpServlet {
/**
*
*/
private boolean isCountDownloads = false;
private String downloadFlag = ""; // 2298348 wgs
private String agent = "";
private static final int BUFFER_SIZE = 1 *1024 * 1024;
private BaseBean baseBean = new BaseBean();
@ -140,15 +110,14 @@ public class FileDownload extends HttpServlet {
Boolean _ec_ismobile = Boolean.valueOf(req.getParameter("_ec_ismobile"));
String fromdocmobile = Util.null2String(req.getParameter("from_doc_mobile"));
Boolean from_doc_mobile = fromdocmobile.equals("1") ? true : false;
this.downloadFlag = Util.null2String(req.getParameter("download")); // 2298348 wgs
baseBean.writeLog(FileDownload.class.getName(),type);
baseBean.writeLog(FileDownload.class.getName(),_ec_ismobile);
baseBean.writeLog(FileDownload.class.getName(),fromdocmobile);
baseBean.writeLog(FileDownload.class.getName(),fromdocmobile);
baseBean.writeLog(FileDownload.class.getName(),this.downloadFlag);
baseBean.writeLog(FileDownload.class.getName(),"download:"+Util.null2String(req.getParameter("download")));
baseBean.writeLog("路径"+req.getRequestURI());
writeLogs("download start!");
writeLogs("downloadFlag=" + downloadFlag); // 2447956 wgs
writeLogs("downloadFlag=" + Util.null2String(req.getParameter("download"))); // 2447956 wgs
int nolog = Util.getIntValue(Util.null2String(req.getParameter("nolog")),0);
String res_content_disposition = Util.null2String(req.getParameter("response-content-disposition"));
boolean isMobileDown=false;
@ -321,13 +290,13 @@ public class FileDownload extends HttpServlet {
if(counts<=0){
if("1".equals(docSearchFlag)){
if(urlType.equals("10")){
res.sendRedirect(weaver.general.GCONST.getContextPath()+"/docs/search/DocCommonContent.jsp?urlType=10&displayUsage="+displayUsage);
res.sendRedirect(GCONST.getContextPath()+"/docs/search/DocCommonContent.jsp?urlType=10&displayUsage="+displayUsage);
}else{
res.sendRedirect(weaver.general.GCONST.getContextPath()+"/docs/search/DocCommonContent.jsp?urlType=6&fromUrlType=1&displayUsage="+displayUsage);
res.sendRedirect(GCONST.getContextPath()+"/docs/search/DocCommonContent.jsp?urlType=6&fromUrlType=1&displayUsage="+displayUsage);
}
return;
}else{
res.sendRedirect(weaver.general.GCONST.getContextPath()+"/login/BatchDownloadsEror.jsp");
res.sendRedirect(GCONST.getContextPath()+"/login/BatchDownloadsEror.jsp");
return;
}
}
@ -469,7 +438,7 @@ public class FileDownload extends HttpServlet {
imageFileManager.getImageFileInfoById(Util.getIntValue(imagefileid));
}
//writeLogs("452 downloadFlag=" + downloadFlag);
imageFileManager.setDownloadFlag(downloadFlag); // 2298348 wgs
imageFileManager.setDownloadFlag(Util.null2String(req.getParameter("download"))); // 2298348 wgs
imagefile=imageFileManager.getInputStream();
if(download.equals("1") && (isOfficeToDocument(extName))&&isMsgObjToDocument()) {
@ -596,7 +565,7 @@ public class FileDownload extends HttpServlet {
}
if(filerealpathList.size() == 0){
res.sendRedirect(weaver.general.GCONST.getContextPath()+"/notice/noright.jsp?v1");
res.sendRedirect(GCONST.getContextPath()+"/notice/noright.jsp?v1");
return;
}
@ -661,7 +630,7 @@ public class FileDownload extends HttpServlet {
String extName = filename.contains(".")? filename.substring(filename.lastIndexOf(".") + 1) : "";
// 2298348 wgs
//writeLogs("644 downloadFlag=" + downloadFlag);
if (!"1".equals(downloadFlag)) {
if (!"1".equals(Util.null2String(req.getParameter("download")))) {
is = EncryptDecryptFileUtil.fileDecrypt(Util.getIntValue(fileid), is, filename, "");
}
// 2298348 wgs
@ -765,7 +734,7 @@ public class FileDownload extends HttpServlet {
int maxDownFileCount = Util.getIntValue(rsprop.getPropValue("BatchDownFileControl","maxDownFileCount"),10);
int maxDownFileTotalSize = Util.getIntValue(rsprop.getPropValue("BatchDownFileControl","maxDownFileTotalSize"),200);
if(newfieldidsarray.length>maxDownFileCount){
res.sendRedirect(weaver.general.GCONST.getContextPath()+"/wui/common/page/sysRemindDocpreview.jsp?labelid="+SystemEnv.getHtmlLabelName(534454,loginuser.getLanguage())+maxDownFileCount);
res.sendRedirect(GCONST.getContextPath()+"/wui/common/page/sysRemindDocpreview.jsp?labelid="+SystemEnv.getHtmlLabelName(534454,loginuser.getLanguage())+maxDownFileCount);
return;
}else{
String dbType = rsprop.getDBType();
@ -777,7 +746,7 @@ public class FileDownload extends HttpServlet {
if(rsprop.next()){
double totalfilesize = Util.getDoubleValue(rsprop.getString("totalfilesize"),0);
if(totalfilesize>maxDownFileTotalSize*1024*1024){
res.sendRedirect(weaver.general.GCONST.getContextPath()+"/wui/common/page/sysRemindDocpreview.jsp?labelid="+SystemEnv.getHtmlLabelName(534453,loginuser.getLanguage())+maxDownFileTotalSize);
res.sendRedirect(GCONST.getContextPath()+"/wui/common/page/sysRemindDocpreview.jsp?labelid="+SystemEnv.getHtmlLabelName(534453,loginuser.getLanguage())+maxDownFileTotalSize);
return;
}
}
@ -880,7 +849,7 @@ public class FileDownload extends HttpServlet {
imageFileManager.getImageFileInfoById(Util.getIntValue(imagefileid));
}
//writeLogs("863 downloadFlag=" + downloadFlag);
imageFileManager.setDownloadFlag(downloadFlag); // 2298348 wgs
imageFileManager.setDownloadFlag(Util.null2String(req.getParameter("download"))); // 2298348 wgs
imagefile=imageFileManager.getInputStream();
if(download.equals("1") && (isOfficeToDocument(extName))&&isMsgObjToDocument()) {
@ -974,7 +943,7 @@ public class FileDownload extends HttpServlet {
imagefile = FileManager.download(req,imagefileid,filerealpath,aescode,iszip,isaesencrypt,imagefile);
Map<String,Object> secWmSetMap = WaterMarkUtilNew.getCategoryWmSet(imagefileid);
//writeLogs("957 imagefileid=" + imagefileid);
shouldAddFileDownLoadWm(secWmSetMap, imagefileid); // 2447956 wgs
shouldAddFileDownLoadWm(secWmSetMap, imagefileid,Util.null2String(req.getParameter("download"))); // 2447956 wgs
if(wmflag && "1".equals(secWmSetMap.get(WaterMarkUtilNew.SECCATEGORYDOWNLOAD))&& "1".equals(secWmSetMap.get(WaterMarkUtilNew.SECCATEGORYWMISOPEN)) && "0".equals(secWmSetMap.get(WaterMarkUtilNew.WATERCONTENTISNULL))){
imagefile = FileWaterManager.takewater(req,downloadpdfimagefileid,filename,extName,imagefile, WaterMarkUtil.MOULDDOC,Util.getIntValue(imagefileid));
@ -1004,7 +973,7 @@ public class FileDownload extends HttpServlet {
}
if(filerealpathList.size() == 0){
res.sendRedirect(weaver.general.GCONST.getContextPath()+"/notice/noright.jsp?v2");
res.sendRedirect(GCONST.getContextPath()+"/notice/noright.jsp?v2");
return;
}
toWriteLog("onlydownloadfj----5----批量下载--filerealpathList"+filerealpathList+"--filerealpathTempList:"
@ -1063,14 +1032,14 @@ public class FileDownload extends HttpServlet {
String extName = filename.contains(".")? filename.substring(filename.lastIndexOf(".") + 1) : "";
// 2298348 wgs
//writeLogs("1046 downloadFlag=" + downloadFlag);
if (!"1".equals(downloadFlag)) {
if (!"1".equals(Util.null2String(req.getParameter("download")))) {
is = EncryptDecryptFileUtil.fileDecrypt(fileids.get(j), is, filename, "");
}
// 2298348 wgs
if(!frompdfview.equals("1") && download.equals("1")){
Map<String,Object> secWmSetMap = WaterMarkUtil.getCategoryWmSet(imagefileid);
//writeLogs("1053 imagefileid=" + imagefileid);
shouldAddFileDownLoadWm(secWmSetMap, imagefileid); // 2447956 wgs
shouldAddFileDownLoadWm(secWmSetMap, imagefileid,Util.null2String(req.getParameter("download"))); // 2447956 wgs
if(wmflag && "1".equals(secWmSetMap.get(WaterMarkUtil.SECCATEGORYDOWNLOAD))&& "1".equals(secWmSetMap.get(WaterMarkUtil.SECCATEGORYWMISOPEN)) && "0".equals(secWmSetMap.get(WaterMarkUtil.WATERCONTENTISNULL))){
// is = WaterMarkUtil.takefileWater(is,loginuser,filename,fileids.get(j),extName,WaterMarkUtil.MOULDDOC);
is = FileWaterManager.takewater(req,fileids.get(j)+"",filename,extName,is, WaterMarkUtil.MOULDDOC,-1);
@ -1147,7 +1116,7 @@ public class FileDownload extends HttpServlet {
Map<String,Object> ddcodeMap = SystemDocUtil.deDdcode(userddcode,ddcode);
String isovertime = Util.null2String(ddcodeMap.get(SystemDocUtil.ISOVERTIME));
if("1".equals(isovertime)){
res.sendRedirect(weaver.general.GCONST.getContextPath()+"/notice/noright.jsp?ddcodeTimeout=1");
res.sendRedirect(GCONST.getContextPath()+"/notice/noright.jsp?ddcodeTimeout=1");
return;
}else{
userid = Util.getIntValue((String) ddcodeMap.get(SystemDocUtil.USERID));
@ -1171,7 +1140,7 @@ public class FileDownload extends HttpServlet {
if(fileid <= 0){//转化为int型防止SQL注入
res.sendRedirect(weaver.general.GCONST.getContextPath()+"/notice/noright.jsp?v3");
res.sendRedirect(GCONST.getContextPath()+"/notice/noright.jsp?v3");
return;
}
RecordSet rsprop = new RecordSet();
@ -1376,7 +1345,7 @@ public class FileDownload extends HttpServlet {
}
baseBean.writeLog("weaver-->1084-->fileid"+fileid+"--->user"+user+"=userid--");
if(user == null){
res.sendRedirect(weaver.general.GCONST.getContextPath()+"/notice/noright.jsp");
res.sendRedirect(GCONST.getContextPath()+"/notice/noright.jsp");
return;
}
int hrmid = user.getUID();
@ -1436,7 +1405,7 @@ public class FileDownload extends HttpServlet {
}
}
if(!hasRight){//
res.sendRedirect(weaver.general.GCONST.getContextPath()+"/notice/noright.jsp?v5");
res.sendRedirect(GCONST.getContextPath()+"/notice/noright.jsp?v5");
return;
@ -1803,7 +1772,7 @@ public class FileDownload extends HttpServlet {
if(!frompdfview.equals("1") && download.equals("1")){
Map<String,Object> secWmSetMap = WaterMarkUtilNew.getCategoryWmSet(fileid+"");
//writeLogs("1786 fileid=" + fileid);
shouldAddFileDownLoadWm(secWmSetMap, fileid+""); // 2447956 wgs
shouldAddFileDownLoadWm(secWmSetMap, fileid+"",Util.null2String(req.getParameter("download"))); // 2447956 wgs
if(wmflag && "1".equals(secWmSetMap.get(WaterMarkUtilNew.SECCATEGORYDOWNLOAD))&& "1".equals(secWmSetMap.get(WaterMarkUtilNew.SECCATEGORYWMISOPEN)) && "0".equals(secWmSetMap.get(WaterMarkUtilNew.WATERCONTENTISNULL))){
// imagefile = WaterMarkUtil.takefileWater(imagefile,user,filename,fileid,extName,WaterMarkUtil.MOULDDOC);
imagefile = FileWaterManager.takewater(req,downloadpdfimagefileid,filename,extName,imagefile, WaterMarkUtil.MOULDDOC,fileid);
@ -2030,7 +1999,7 @@ public class FileDownload extends HttpServlet {
if(!frompdfview.equals("1") && download.equals("1")){
Map<String,Object> secWmSetMap = WaterMarkUtil.getCategoryWmSet(fileid+"");
//writeLogs("2013 fileid=" + fileid);
shouldAddFileDownLoadWm(secWmSetMap, fileid+""); // 2447956 wgs
shouldAddFileDownLoadWm(secWmSetMap, fileid+"",Util.null2String(req.getParameter("download"))); // 2447956 wgs
if(wmflag && "1".equals(secWmSetMap.get(WaterMarkUtil.SECCATEGORYDOWNLOAD))&& "1".equals(secWmSetMap.get(WaterMarkUtil.SECCATEGORYWMISOPEN)) && "0".equals(secWmSetMap.get(WaterMarkUtil.WATERCONTENTISNULL))){
// imagefile = WaterMarkUtil.takefileWater(imagefile,user,filename,fileid,extName,WaterMarkUtil.MOULDDOC);
imagefile = FileWaterManager.takewater(req,downloadpdfimagefileid,filename,extName,imagefile, WaterMarkUtil.MOULDDOC,fileid);
@ -2038,7 +2007,7 @@ public class FileDownload extends HttpServlet {
}
// 2298348 wgs
//writeLogs("2021 downloadFlag=" + downloadFlag);
if (!"1".equals(downloadFlag)) {
if (!"1".equals(Util.null2String(req.getParameter("download")))) {
imagefile = EncryptDecryptFileUtil.fileDecrypt(Util.getIntValue(fileid), imagefile, filename, "");
}
// 2298348 wgs
@ -2370,7 +2339,7 @@ public class FileDownload extends HttpServlet {
res.setHeader("Content-Disposition", "attachment; filename="+ new String(imageFileManager.getImageFileName().replaceAll("<", "").replaceAll(">", "").replaceAll("&lt;", "").replaceAll("&gt;", "").getBytes("UTF-8"),"ISO-8859-1")+"");
res.setContentType("application/ofd");
//writeLogs("2353 downloadFlag=" + downloadFlag);
imageFileManager.setDownloadFlag(downloadFlag); // 2298348 wgs
imageFileManager.setDownloadFlag(Util.null2String(req.getParameter("download"))); // 2298348 wgs
is = imageFileManager.getInputStream();
bos = new BufferedOutputStream(res.getOutputStream());
byte[] buf = new byte[BUFFER_SIZE];
@ -2443,7 +2412,7 @@ public class FileDownload extends HttpServlet {
String fileid = Util.null2String(req.getParameter("fileid"));
if(user == null){
res.sendRedirect(weaver.general.GCONST.getContextPath()+"/notice/noright.jsp?line=4&user=null");
res.sendRedirect(GCONST.getContextPath()+"/notice/noright.jsp?line=4&user=null");
return;
}
@ -2460,7 +2429,7 @@ public class FileDownload extends HttpServlet {
boolean canRead = levelMap.get(DocViewPermission.READ);
boolean canCoope = dcu.jugeUserCoopeRight(docid,user,canRead);
if(!canCoope){
res.sendRedirect(weaver.general.GCONST.getContextPath()+"/notice/noright.jsp?line=3&fileid=" + fileid);
res.sendRedirect(GCONST.getContextPath()+"/notice/noright.jsp?line=3&fileid=" + fileid);
return;
}
@ -2514,11 +2483,11 @@ public class FileDownload extends HttpServlet {
}
}
}else{
res.sendRedirect(weaver.general.GCONST.getContextPath()+"/notice/noright.jsp?line=2&fileid=" + fileid);
res.sendRedirect(GCONST.getContextPath()+"/notice/noright.jsp?line=2&fileid=" + fileid);
return;
}
}else{
res.sendRedirect(weaver.general.GCONST.getContextPath()+"/notice/noright.jsp?line=1&fileid=" + fileid);
res.sendRedirect(GCONST.getContextPath()+"/notice/noright.jsp?line=1&fileid=" + fileid);
return;
}
@ -2531,12 +2500,12 @@ public class FileDownload extends HttpServlet {
String wpsFileid = Util.null2String(req.getParameter("wpsFileid"));
if(user == null){
res.sendRedirect(weaver.general.GCONST.getContextPath()+"/notice/noright.jsp?line=4&user=null");
res.sendRedirect(GCONST.getContextPath()+"/notice/noright.jsp?line=4&user=null");
return;
}
if(fromfileid == null || fromfileid.isEmpty()){
res.sendRedirect(weaver.general.GCONST.getContextPath()+"/notice/noright.jsp?fromid=null");
res.sendRedirect(GCONST.getContextPath()+"/notice/noright.jsp?fromid=null");
return;
}
@ -2562,7 +2531,7 @@ public class FileDownload extends HttpServlet {
sql = "select docid, imagefilename from docimagefile where imagefileid = ?";
rs.executeQuery(sql,fromecfileid);
if(!rs.next()) {
res.sendRedirect(weaver.general.GCONST.getContextPath()+"/notice/noright.jsp?line=1&wpsFileid=" + wpsFileid);
res.sendRedirect(GCONST.getContextPath()+"/notice/noright.jsp?line=1&wpsFileid=" + wpsFileid);
return;
}
docid = rs.getString("docid");
@ -2574,7 +2543,7 @@ public class FileDownload extends HttpServlet {
boolean canRead = levelMap.get(DocViewPermission.READ);
boolean canCoope = dcu.jugeUserCoopeRight(docid,user,canRead);
if(!canCoope){
res.sendRedirect(weaver.general.GCONST.getContextPath()+"/notice/noright.jsp?line=3&fileid=" + wpsFileid);
res.sendRedirect(GCONST.getContextPath()+"/notice/noright.jsp?line=3&fileid=" + wpsFileid);
return;
}
@ -2583,7 +2552,7 @@ public class FileDownload extends HttpServlet {
ServletOutputStream out = null;
if(null == in) {
res.sendRedirect(weaver.general.GCONST.getContextPath()+"/notice/noright.jsp?line=2&fileid=" + wpsFileid);
res.sendRedirect(GCONST.getContextPath()+"/notice/noright.jsp?line=2&fileid=" + wpsFileid);
return;
}
@ -2639,7 +2608,7 @@ public class FileDownload extends HttpServlet {
ImageFileManager ifm = new ImageFileManager();
ifm.getImageFileInfoById(fileid);
//writeLogs("2622 downloadFlag=" + downloadFlag);
ifm.setDownloadFlag(downloadFlag); // 2298348 wgs
ifm.setDownloadFlag(Util.null2String(req.getParameter("download"))); // 2298348 wgs
imagefile = ifm.getInputStream();
String filename = ifm.getImageFileName();
String contenttype = "";
@ -2791,7 +2760,7 @@ public class FileDownload extends HttpServlet {
requestid = Util.getIntValue(Util.null2String(jsonParams.get("requestid")));
}
if(fileid <= 0){//转化为int型防止SQL注入
res.sendRedirect(weaver.general.GCONST.getContextPath()+"/notice/noright.jsp?v6");
res.sendRedirect(GCONST.getContextPath()+"/notice/noright.jsp?v6");
return;
}
RecordSet statement = new RecordSet();
@ -2806,7 +2775,7 @@ public class FileDownload extends HttpServlet {
hasRight=false;
}
if(!hasRight){
res.sendRedirect(weaver.general.GCONST.getContextPath()+"/notice/noright.jsp?v7");
res.sendRedirect(GCONST.getContextPath()+"/notice/noright.jsp?v7");
return;
}
String contenttype = "application/octet-stream";
@ -3822,11 +3791,11 @@ public class FileDownload extends HttpServlet {
}
else{
response.sendRedirect(weaver.general.GCONST.getContextPath()+"/login/BatchDownloadsEror.jsp");
response.sendRedirect(GCONST.getContextPath()+"/login/BatchDownloadsEror.jsp");
}
}
else{
response.sendRedirect(weaver.general.GCONST.getContextPath()+"/login/BatchDownloadsEror.jsp");
response.sendRedirect(GCONST.getContextPath()+"/login/BatchDownloadsEror.jsp");
//注;这里面不要用到PrintWriter out=response.getWriter();这里调用了response对象后面下载调用时就会出错。这里要是想都用希望大家找到解决办法。
}
@ -4155,9 +4124,9 @@ public class FileDownload extends HttpServlet {
requParamStr.append("&").append(paramName).append("=").append(paramValue);
}
if(fromMobile){
secondAuthFileDownUrl=weaver.general.GCONST.getContextPath()+"/spa/custom/static4mobile/index.html#/cs/app/2e1b09c0329c4e839002365027216f64_baseTable?isSecondAuth=1"+requParamStr;
secondAuthFileDownUrl= GCONST.getContextPath()+"/spa/custom/static4mobile/index.html#/cs/app/2e1b09c0329c4e839002365027216f64_baseTable?isSecondAuth=1"+requParamStr;
}else{
secondAuthFileDownUrl=weaver.general.GCONST.getContextPath()+"/spa/custom/static/index.html#/main/cs/app/759eb4fa5ce742c2a0b96877972ceae0_baseTable?isSecondAuth=1"+requParamStr;
secondAuthFileDownUrl= GCONST.getContextPath()+"/spa/custom/static/index.html#/main/cs/app/759eb4fa5ce742c2a0b96877972ceae0_baseTable?isSecondAuth=1"+requParamStr;
}
toWriteLog("FileDownload-------------getSecondAuthFileDownUrl------docid------"+docid+";fromMobile="+fromMobile+";secondAuthFileDownUrl="+secondAuthFileDownUrl);
}
@ -4174,7 +4143,7 @@ public class FileDownload extends HttpServlet {
*
*
*/
public void shouldAddFileDownLoadWm(Map<String,Object> secWmSetMap, String imageFileId) {
public void shouldAddFileDownLoadWm(Map<String,Object> secWmSetMap, String imageFileId,String downloadFlag) {
RecordSet rs = new RecordSet();
try {
String wmfordownload = Util.null2String(secWmSetMap.get(WaterMarkUtil.SECCATEGORYDOWNLOAD));

@ -0,0 +1,127 @@
package weaver.filter;
import com.weaver.file.Prop;
import weaver.general.BaseBean;
import weaver.general.StringUtil;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class LoginEMFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws ServletException, IOException {
String isopen = Prop.getPropValue("emloginFilter", "isopen");
if ("1".equals(isopen)){
try {
HttpServletRequest request = (HttpServletRequest) servletRequest;
StringBuffer url = request.getRequestURL();
new BaseBean().writeLog("请求地址====>getRequestURL" + url);
//内网请求
if(url.indexOf("14.1.209.146:8080") == -1){
String currentDateTime = request.getHeader("currentDateTime");
String MdToken = request.getHeader("MdToken");
new BaseBean().writeLog("请求地址====>currentDateTime" + currentDateTime);
new BaseBean().writeLog("请求地址====>MdToken" + MdToken);
if (StringUtil.isEmpty(currentDateTime)||StringUtil.isEmpty(MdToken)){
// 如果条件满足发送HTTP 500错误
((HttpServletResponse) servletResponse).sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Internal Server Error");
return;
}
//大于十分钟返回报错
boolean b = DateExample(currentDateTime);
if (b){
new BaseBean().writeLog("请求地址====>时间异常" + b);
((HttpServletResponse) servletResponse).sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Internal Server Error");
return;
}
String password = "ecologytq33q#LzDw$98HwEA@"+currentDateTime;
new BaseBean().writeLog("请求地址====>toMD5(password)" + toMD5(password));
if (!(toMD5(password).toLowerCase().equals(MdToken))){
new BaseBean().writeLog("请求地址====>密码错误" +MdToken);
((HttpServletResponse) servletResponse).sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Internal Server Error");
return;
}else {
filterChain.doFilter(servletRequest, servletResponse);
}
}else {
filterChain.doFilter(servletRequest, servletResponse);
}
} catch (Exception e) {
new BaseBean().writeLog("请求地址====>error" + e.getMessage());
}
}else {
filterChain.doFilter(servletRequest, servletResponse);
}
}
@Override
public void destroy() {
}
public static String toMD5(String input) {
try {
// 创建MessageDigest实例指定MD5算法
MessageDigest md = MessageDigest.getInstance("MD5");
// 更新MessageDigest对象以包含要加密的字节
md.update(input.getBytes());
// 完成哈希计算
byte[] digest = md.digest();
// 将哈希值转换为十六进制字符串
StringBuilder hexString = new StringBuilder();
for (byte b : digest) {
String hex = Integer.toHexString(0xff & b);
if (hex.length() == 1) {hexString.append('0');}
hexString.append(hex);
}
return hexString.toString();
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
}
public static boolean DateExample (String dateTimeStr) {
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
Date parsedDate = sdf.parse(dateTimeStr);
Date currentDate = new Date();
long difference = currentDate.getTime() - parsedDate.getTime();
if (difference > 10 * 60 * 1000) { // 10分钟 = 10 * 60 * 1000 毫秒
return true;
} else {
return false;
}
} catch (Exception e) {
//报错也返回大于10分钟
e.printStackTrace();
return true;
}
}
public static void main(String[] args) {
String originalString = "tq33q#LzDw$98HwEA@";
String md5String = toMD5(originalString);
System.out.println("Original: " + originalString);
System.out.println("MD5 Hash: " + md5String);
}
}

@ -0,0 +1,54 @@
package weaver.filter;
import com.engine.common.util.ParamUtil;
import weaver.general.BaseBean;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Map;
public class RequestLoggingFilter implements Filter {
private BaseBean logger;
@Override
public void init(FilterConfig filterConfig) throws ServletException {
logger = new BaseBean();
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
try {
StringBuffer requestURI = ((HttpServletRequest) request).getRequestURL();
// 获取请求方式
String method = ((HttpServletRequest) request).getMethod();
// 获取请求参数
String queryString = ((HttpServletRequest) request).getQueryString();
String remoteHost = request.getRemoteHost();
Map parameterMap = request.getParameterMap();
logger.writeLog("Request URL:-----" + requestURI);
logger.writeLog("Request Method: " + method);
logger.writeLog("Request Parameters: " + queryString);
logger.writeLog("Request remoteHost: " + remoteHost);
logger.writeLog("Request parameterMap: " + parameterMap.toString());
chain.doFilter(request, response);
}catch (Exception e){
e.printStackTrace();
logger.writeLog("RequestLoggingFilter: " + e.getMessage());
}
}
@Override
public void destroy() {
}
}

@ -40,6 +40,11 @@ public class Action20231008042513 extends BaseBean implements Action{
if (isTohg == 0){
return Action.SUCCESS;
}
//是否子公司 0 - 是 1 - 否
int sfzgs = Util.getIntValue(rs.getString("sfzgs"), 1);
if (sfzgs == 0){
return Action.SUCCESS;
}
//id表单主键
String mainid = rs.getString("id");

@ -113,9 +113,18 @@ public class Action20231015024217 extends BaseBean implements Action {
String imageFileName = ifm.getImageFileName();
writeLog("imageFileName"+imageFileName);
String[] filename = imageFileName.split("\\.");
int lastIndex = imageFileName.lastIndexOf('.');
String part1 = "";
String part2 = "";
if (lastIndex != -1) {
part1 = imageFileName.substring(0, lastIndex);
part2 = imageFileName.substring(lastIndex + 1);
}else {
part1 = imageFileName;
}
String tempFilePath = "";
try {
File tempFile = File.createTempFile(filename[0],filename.length ==2 ?filename[1]:"");
File tempFile = File.createTempFile(part1,part2.length() == 0 ? "" :part2);
// 创建一个输出流,将数据写入临时文件
OutputStream outputStream = new FileOutputStream(tempFile);
@ -134,7 +143,7 @@ public class Action20231015024217 extends BaseBean implements Action {
}catch (Exception e){
e.printStackTrace();
writeLog( "创建本地文件异常"+e.getMessage());
throw new Exception("创建本地文件异常");
throw new Exception("创建"+imageFileName+"文件异常"+e.getMessage());
}
//推送ESB服务器
String ftpPath = "";
@ -167,7 +176,7 @@ public class Action20231015024217 extends BaseBean implements Action {
//OA差旅报销单单据编号
toEsbBean.setOaTrvlBnsExpnsAcctNo(rs.getString(Util.null2String("djbh")));
//经办人工号
toEsbBean.setOperatorNo(Util.null2String(rs.getString("jbrgh")));
toEsbBean.setOperatorNo(processString(Util.null2String(rs.getString("jbrgh"))));
//经办人姓名 id
toEsbBean.setOperatorName(Util.null2String(rs.getString("jbrxm")));
String lastname = new User(Util.getIntValue(toEsbBean.getOperatorName())).getLastname();
@ -330,16 +339,25 @@ public class Action20231015024217 extends BaseBean implements Action {
return "";
}
public static String processString(String input) {
// 检查字符串长度是否大于8
if (input.length() > 8) {
// 如果是,截取前八位
return input.substring(0, 8);
} else {
// 否则,返回原字符串
return input;
}
}
public static void main(String[] args) {
String htmlContent = "2023-10-05 07:00" ;
System.out.println(htmlContent.contains(" "));
if (htmlContent.indexOf(" ") == -1){
}
String imageFileName = "11.16天津-成都去程机票 (1).jpg";
int lastIndex = imageFileName.lastIndexOf('.');
String part1 = imageFileName.substring(0, lastIndex);
String part2 = imageFileName.substring(lastIndex + 1);
System.out.println(part1);
System.out.println(part2);
}

@ -34,18 +34,19 @@ public class Action20231027045935 extends BaseBean implements Action{
return Action.SUCCESS;
}
RecordSetTrans rs = request.getRequestManager() .getRsTrans();
// RecordSet rs = new RecordSet();
try {
rs.setAutoCommit(false);
// rs.setAutoCommit(false);
rs.executeUpdate(updateReqLevel,requestId);
int updateCount = rs.getUpdateCount();
writeLog("更新条数==>",updateCount);
if(updateCount > 1){
rs.rollback();
}else{
rs.commit();
}
writeLog("更新条数==>"+updateCount);
// if(updateCount > 1){
// // rs.rollback();
// }else{
// // rs.commit();
// }
} catch (Exception e) {
rs.rollback();
// rs.rollback();
e.printStackTrace();
}

@ -34,18 +34,19 @@ public class Action20231027060156 extends BaseBean implements Action{
return Action.SUCCESS;
}
RecordSetTrans rs = request.getRequestManager() .getRsTrans();
// RecordSet rs = new RecordSet();
try {
rs.setAutoCommit(false);
// rs.setAutoCommit(false);
rs.executeUpdate(updateReqLevel,requestId);
int updateCount = rs.getUpdateCount();
writeLog("更新条数==>",updateCount);
if(updateCount > 1){
rs.rollback();
}else{
rs.commit();
}
// if(updateCount > 1){
// // rs.rollback();
// }else{
// // rs.commit();
// }
} catch (Exception e) {
rs.rollback();
// rs.rollback();
e.printStackTrace();
}

@ -0,0 +1,93 @@
package weaver.interfaces.workflow.action.javacode;
import com.api.formmode.page.util.Util;
import weaver.conn.RecordSet;
import weaver.interfaces.workflow.action.Action;
import weaver.general.BaseBean;
import weaver.soa.workflow.request.RequestInfo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
/**
* Online custom action interface
*/
public class Action20231110054933 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) {
String requestId = request.getRequestid();
String tablename = request.getRequestManager().getBillTableName();
RecordSet rs = new RecordSet();
try {
rs.executeQuery("select MAINREQUESTID from workflow_requestbase where requestid = ?" , requestId);
//查询主流程
String mainrequestid = "";
if(rs.next()){
mainrequestid = Util.null2String(rs.getString("MAINREQUESTID"));
}
//查询平行流程request
ArrayList<String> siblingRequestIds = new ArrayList<>();
rs.executeQuery("select requestid from workflow_requestbase where MAINREQUESTID = ?" , mainrequestid);
while(rs.next()){
String siblingRequestId = Util.null2String(rs.getString("requestid"));
siblingRequestIds.add(siblingRequestId);
}
writeLog("平行流程"+siblingRequestIds);
//当前流程的协办部门
rs.execute("select * from " + tablename + " where requestid = " + requestId);
rs.next();
String xbbm = rs.getString("xbbm");
//
HashMap<String, String> xbbmMap = new HashMap<>();
rs.execute("select * from " + tablename + " where requestid in (" + String.join(",",siblingRequestIds)+" )");
while ( rs.next()){
String mainid = rs.getString("id");
String ycfxbbm = rs.getString("ycfxbbm");
String newycfxbbm = mergeWithoutDuplicates(xbbm, ycfxbbm);
xbbmMap.put(mainid,newycfxbbm);
}
writeLog("修改平行流程"+xbbmMap);
xbbmMap.forEach((key,value) ->{
rs.executeUpdate("update "+ tablename +" set ycfxbbm = ? where id = ?",value,key);
});
}catch (Exception e){
boolean error = true;
if (error) {
request.getRequestManager().setMessageid("90001");
request.getRequestManager().setMessagecontent("System Abnormal Termination Process Submission");
}
}
return Action.SUCCESS;
}
public static String mergeWithoutDuplicates(String a, String b) {
Set<String> setB = new HashSet<>();
StringBuilder result = new StringBuilder(b);
if (b != null && !b.isEmpty()) {
for (String id : b.split(",")) {
setB.add(id.trim());
}
}
for (String idA : a.split(",")) {
idA = idA.trim();
if (!setB.contains(idA)) {
if (result.length() > 0) {
result.append(",");
}
result.append(idA);
}
}
return result.toString();
}
}

@ -0,0 +1,82 @@
package weaver.interfaces.workflow.action.javacode;
import com.cloudstore.dev.api.bean.MessageBean;
import com.cloudstore.dev.api.bean.MessageType;
import com.cloudstore.dev.api.util.Util_Message;
import weaver.conn.RecordSet;
import weaver.interfaces.workflow.action.Action;
import weaver.general.BaseBean;
import weaver.soa.workflow.request.RequestInfo;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
/**
* Online custom action interface
*/
public class Action20231113045722 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) {
String requestId = request.getRequestid();
String tablename = request.getRequestManager().getBillTableName();
RecordSet rs = new RecordSet();
rs.execute("select * from " + tablename + " where requestid = " + requestId);
rs.next();
String mainid = rs.getString("id");
String fsr = rs.getString("fsr");
//标题
String title = rs.getString("fsnr");
//内容
String context = rs.getString("txxx");
//PC端链接 纯文本就传空字符串
String linkUrl = rs.getString("pclj");
//移动端链接 纯文本就传空字符串
String linkMobileUrl = rs.getString("applj");
//消息来源(见文档第四点补充)
MessageType messageType = MessageType.newInstance(1542);
//接收人id
Set<String> userIdList = convertToHashSet(fsr);
try {
MessageBean messageBean = Util_Message.createMessage(messageType, userIdList, title, context, linkUrl, linkMobileUrl);
messageBean.setCreater(1);//创建人id
//message.setBizState("0");需要修改消息状态时传入,表示消息最初状态为待处理
// messageBean.setTargetId("121|22"); //消息来源code +“|”+业务id 需要修改消息状态时传入,这个字段是自定义的,和修改消息状态的时候传入相同的值,可做更新。
Util_Message.store(messageBean);
} catch (IOException e) {
e.printStackTrace();
}
return Action.SUCCESS;
}
public static Set<String> convertToHashSet(String str) {
Set<String> resultSet = new HashSet<>();
if (str != null && !str.isEmpty()) {
String[] items = str.split(",");
for (String item : items) {
if (item != null && !item.trim().isEmpty()) {
resultSet.add(item.trim());
}
}
}
return resultSet;
}
}

@ -0,0 +1,419 @@
package weaver.interfaces.workflow.action.javacode;
import cn.wps.yun.StringUtil;
import com.google.common.base.Charsets;
import com.google.common.io.ByteSource;
import com.icbc.api.internal.apache.http.impl.cookie.S;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.file.ImageFileManager;
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.io.*;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import static java.nio.charset.StandardCharsets.UTF_8;
/**
* Online custom action interface
*/
public class Action20231123035106 implements Action{
private static final BaseBean bb = new BaseBean();
private static final String postSQl = "";
private static final String receiptSQL = "";
private static final String queryDocIdSql =
"select * from docimagefile docfile " +
"left join docdetail doc on docfile.DOCID = doc.ID " +
"left join imagefile file on docfile.IMAGEFILEID = file.IMAGEFILEID " +
// "left join uf_tssjb tssjb on docfile.DOCID = tssjb.wdid " +
"where (doc.docsubject like '%食品%' or doc.docsubject like '%专项%' ) ";
private static final String dataEqualSql = "and doc.DOCCREATEDATE = ? ";
private static final String dataRangeSql = "and doc.DOCCREATEDATE >= ? and doc.DOCCREATEDATE <= ? ";
public String url = "";
public String queryType = "";
public String queryDate = "";
public String startDate = "";
public String endDate = "";
public String deptIds = "";
// public String userNames = "";
public String dirPath = "/opt/weaver/scjgw";
public String postSeccategory = "";
public String receiptSeccategory = "";
@Override
public String execute(RequestInfo requestInfo) {
writeLog("执行定时任务开始","PushCorn");
writeLog("url",url);
writeLog("queryType",queryType);
writeLog("queryDate",queryDate);
writeLog("startDate",startDate);
writeLog("endDate",endDate);
writeLog("deptIds",deptIds);
// writeLog("userNames",userNames);
writeLog("dirPath",dirPath);
writeLog("postSeccategory",postSeccategory);
writeLog("receiptSeccategory",receiptSeccategory);
try {
System.setOut(new PrintStream(System.out, true, "UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
writeLog("new String(s.getBytes(UTF_8))",new String("通".getBytes(UTF_8)));
writeLog("new String(s.getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8)", new String("通".getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8));
writeLog("new String(s.getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8)", new String("通".getBytes(StandardCharsets.UTF_8), Charset.forName("GBK")));
// 假设 s 是 UTF-8 编码的字符串
String s1 = "通";
// 将 s 从 UTF-8 转换为字节数组
byte[] utf8Bytes = s1.getBytes(StandardCharsets.UTF_8);
// 将字节数组从 UTF-8 转换为 GBK
String gbkString = new String(utf8Bytes, Charset.forName("GBK"));
// 打印日志
writeLog("new String(s.getBytes(StandardCharsets.UTF_8), Charset.forName(\"GBK\"))", gbkString);
writeLog("new String(s.getBytes(UTF_8))",new String("通报".getBytes(UTF_8)));
writeLog("new String(s.getBytes(UTF_8))",new String("关于2023年天津市食品安全抽检监测任务完成情况的通报第三期.zip".getBytes(UTF_8)));
String x= "关于2023年天津市食品安全抽检监测任务完成情况的通报第三期.zip";
writeLog("utf8Str===>",convertGbkToUtf8(x));
String querySql = queryDocIdSql;
//生成人员map
final HashMap<String, String> useridNamemap = new HashMap<>();
RecordSet recordSet = new RecordSet();
// if (!StringUtil.isEmpty(deptIds)) {
// querySql = querySql + "and doc.docdepartmentid in (" + deptIds + " )";
// // String[] deptids = deptIds.split(",");
// // String[] usernames = deptIds.split(",");
// // for (int i = 0; i < userids.length; i++) {
// // useridNamemap.put(userids[i],usernames[i]);
// // }
// }else {
// return;
// }
// List<String> childNodeIds = getChildNodeIds(postSeccategory);
// childNodeIds.add(postSeccategory);
// List<String> childNodeIds1 = getChildNodeIds(receiptSeccategory);
// childNodeIds1.add(receiptSeccategory);
// childNodeIds.addAll(childNodeIds1);
//添加目录
// querySql = querySql + "and ( seccategory in ( "+ String.join(",",childNodeIds)+" ) )" ;
//查询指定天的
// if ("0".equals(queryType)) {
// writeLog("查询指定天的文档");
// querySql = querySql + dataEqualSql;
// recordSet.executeQuery(querySql, queryDate);
// } else if ("1".equals(queryType)) {
// writeLog("查询指定范围的文档",startDate,endDate);
// querySql = querySql + dataRangeSql;
// recordSet.executeQuery(querySql, startDate, endDate);
// } else if ("2".equals(queryType)) {
// writeLog("查询昨天的文档");
// querySql = querySql + dataEqualSql;
// recordSet.executeQuery(querySql, getYesterdayDateStr());
// }
recordSet.executeQuery(querySql);
writeLog("查询sql",querySql);
writeLog("查询sql",recordSet.getExceptionMsg());
writeLog("查询数量", recordSet.getCounts()+"");
//开始推送数据
//检查文件夹路径
checkAndCreateDir();
HashMap<String, String> docid_docNameMap = new HashMap<>();
HashMap<String, List<String>> docid_imagefilleIdMap = new HashMap<>();
HashMap<String,HashMap<String, String>> fileinfo = new HashMap<>();
while (recordSet.next()){
//文档id
String docid = weaver.general.Util.null2String(recordSet.getString("DOCID"));
//文档标题
String docsubject = weaver.general.Util.null2String(recordSet.getString("docsubject"));
//附件id
String imagefileid = weaver.general.Util.null2String(recordSet.getString("IMAGEFILEID"));
//文档时间
String DOCCREATEDATE = weaver.general.Util.null2String(recordSet.getString("DOCCREATEDATE"));
//目录 seccategory
String seccategory = weaver.general.Util.null2String(recordSet.getString("seccategory"));
String DOCCREATERID = weaver.general.Util.null2String(recordSet.getString("DOCCREATERID"));
HashMap<String, String> map = new HashMap<>();
map.put("DOCCREATEDATE",DOCCREATEDATE);
map.put("seccategory",postSeccategory.equals(seccategory) ? "2" : "1");
map.put("DOCCREATERID",new User(Util.getIntValue(DOCCREATERID)).getLastname() );
docid_docNameMap.put(docid,docsubject);
fileinfo.put(docid,map);
List<String> imagefilleIdList = docid_imagefilleIdMap.get(docid);
if (imagefilleIdList == null){
ArrayList<String> filleIdList = new ArrayList<>();
filleIdList.add(imagefileid);
docid_imagefilleIdMap.put(docid,filleIdList);
}else {
imagefilleIdList.add(imagefileid);
}
}
writeLog("需要推送的文档",docid_docNameMap.toString());
// 开始封装文件
String DateDirFile = "";
if(docid_docNameMap.keySet().size() > 0 ){
// 创建今天的文件夹
DateDirFile = checkAndCreateDir(getTodayDateStr());
}else {
return "";
}
String finalDateDirFile = DateDirFile;
writeLog("今天的文件目录",DateDirFile);
writeLog("docid_imagefilleIdMap",docid_imagefilleIdMap.toString());
docid_imagefilleIdMap.forEach((docid, filleIdList)->{
String FileDir = docid_docNameMap.get(docid);
String FileDir2 = new String(FileDir.getBytes(UTF_8));
writeLog("编码修改前 FileDir",FileDir);
writeLog("编码修改后 FileDir2",FileDir2);
String zipFileName = finalDateDirFile + File.separator + docid +".zip";
//修改下编码
String zipFileName2 = new String(zipFileName.getBytes(StandardCharsets.UTF_8));
String zipFileName3 = null;
try {
// zipFileName.getBytes(UTF_8)
zipFileName3 = new String(zipFileName.getBytes("GBK"), UTF_8);
} catch (Exception e) {
e.printStackTrace();
}
writeLog("编码修改前 zipFileName",zipFileName);
writeLog("编码修改后 zipFileName",zipFileName2);
writeLog("编码修改后 zipFileName3",zipFileName3);
File filezip = new File(new String(zipFileName.getBytes(UTF_8)));
byte[] folderBytes = new byte[0]; // 假设原始编码是GBK
try {
folderBytes = zipFileName.getBytes("GBK");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
String encodedFolderName = new String(folderBytes, Charset.defaultCharset());
writeLog("编码修改后 encodedFolderName",encodedFolderName);
ZipArchiveOutputStream zos =null;
writeLog("filezip",zipFileName);
try {
zos = new ZipArchiveOutputStream( new FileOutputStream(filezip));
zos.setEncoding("UTF-8");
for (String filleId : filleIdList) {
ImageFileManager ifm = new ImageFileManager();
ifm.getImageFileInfoById(Integer.parseInt(filleId));
InputStream imagefile = ifm.getInputStream();
// String s1 = ifm.getImageFileName().split(".")[0];
writeLog("压缩文件",ifm.getImageFileName());
addInputStreamToZip(imagefile,zos,FileDir+File.separator+ifm.getImageFileName());
}
} catch (FileNotFoundException e) {
writeLog("压缩文件异常",e.toString());
e.printStackTrace();
} catch (IOException e) {
writeLog("压缩文件异常",e.toString());
e.printStackTrace();
}catch (Exception e){
writeLog("压缩文件异常",e.toString());
e.printStackTrace();
}finally {
try {
zos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
writeLog("压缩完文件名",filezip.getName());
String s = "通.zip";
String convertedString ="";
try {
byte[] bytes = StringUtils.getBytes(s, "UTF-8");
// 使用Guava转换编码
ByteSource byteSource = ByteSource.wrap(s.getBytes(Charsets.UTF_8));
byte[] gbkBytes = byteSource.asCharSource(Charsets.UTF_8).asByteSource(Charsets.UTF_8).read();
// String gbkString = new String(gbkBytes, "GBK");
} catch (UnsupportedEncodingException e) {
} catch (IOException e) {
e.printStackTrace();
}
// filezip.renameTo(new File(convertedString));
// HashMap<String, String> map = fileinfo.get(docid);
//开始推送数据
// try {
// String s = ApiClient.callApi(url, docid, docid_docNameMap.get(docid), map.get("DOCCREATEDATE"),
// map.get("seccategory"), map.get("DOCCREATERID"), filezip);
// writeLog("返回数据",s);
// } catch (IOException e) {
// e.printStackTrace();
// writeLog(e.getMessage());
// writeLog(e.getMessage());
// }
});
return "";
}
private static String getTodayDateStr() {
// 获取当前日期
LocalDate today = LocalDate.now();
// 定义日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
// 将昨天的日期格式化为字符串
return today.format(formatter);
}
private static String getYesterdayDateStr() {
// 获取当前日期
LocalDate today = LocalDate.now();
// 减去一天得到前一天的日期
LocalDate yesterday = today.minusDays(1);
// 定义日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// 将昨天的日期格式化为字符串
return yesterday.format(formatter);
}
private static void writeLog(String... log) {
StringBuilder logStr = new StringBuilder();
for (String s : log) {
logStr.append("|").append(s);
}
bb.writeLog("PushCornTest.class"+"==>"+logStr);
}
private void checkAndCreateDir(){
// 创建File对象
File directory = new File(dirPath);
// 检查路径是否存在
if (!directory.exists()) {
// 不存在,尝试创建多级目录
boolean result = directory.mkdirs();
if (result) {
writeLog("多级目录已创建成功:" + dirPath);
} else {
writeLog("目录创建失败,请检查路径是否正确,或者程序是否有相应的权限。");
}
} else {
writeLog("目录已存在:" + dirPath);
}
}
private String checkAndCreateDir(String date){
// 创建File对象
File directory = new File(dirPath+File.separator+date);
// 检查路径是否存在
if (!directory.exists()) {
// 不存在,尝试创建多级目录
boolean result = directory.mkdirs();
if (result) {
writeLog("多级目录已创建成功:" + dirPath+File.separator+date);
} else {
writeLog(dirPath+File.separator+date,"目录创建失败,请检查路径是否正确,或者程序是否有相应的权限。");
return "-1";
}
} else {
writeLog("目录已存在:" + dirPath+File.separator+date);
}
return dirPath+File.separator+date;
}
public void addInputStreamToZip(InputStream inputStream, ZipArchiveOutputStream zos, String entryName) throws IOException {
writeLog("编码修改后 entryName",entryName);
ZipArchiveEntry zipEntry = new ZipArchiveEntry(entryName);
zos.putArchiveEntry(zipEntry);
byte[] buffer = new byte[1024];
int length;
while ((length = inputStream.read(buffer)) > 0) {
zos.write(buffer, 0, length);
}
inputStream.close();
zos.closeArchiveEntry();
}
public static List<String> getChildNodeIds(String parentId) {
String sql = "SELECT id FROM docseccategory WHERE parentid = ?";
List<String> childIds = new ArrayList<>();
RecordSet rs = new RecordSet();
rs.executeQuery(sql , parentId);
while (rs.next()) {
String id = rs.getString("id");
childIds.add(id);
childIds.addAll(getChildNodeIds(id)); // 递归调用以获取所有后代节点
}
return childIds;
}
public static String convertGbkToUtf8(String gbkStr) {
// 将GBK字符串转换为Unicode
String unicodeStr = new String(gbkStr.getBytes(Charset.forName("GBK")), Charset.forName("UTF-8"));
// 从Unicode转换为UTF-8
byte[] utf8Bytes = unicodeStr.getBytes(Charset.forName("UTF-8"));
return new String(utf8Bytes, Charset.forName("UTF-8"));
}
public static String toUnicodeString(String str) {
StringBuilder unicode = new StringBuilder();
for (int i = 0; i < str.length(); i++) {
unicode.append(String.format("\\u%04X", (int) str.charAt(i)));
}
return unicode.toString();
}
public static String unicodeToUtf8(String unicodeStr) {
String stringFromUnicode = unicodeStr.replace("\\u", "");
byte[] utf8Bytes = new byte[stringFromUnicode.length() / 2];
for (int i = 0; i < stringFromUnicode.length(); i += 2) {
int value = Integer.parseInt(stringFromUnicode.substring(i, i + 2), 16);
utf8Bytes[i / 2] = (byte) value;
}
return new String(utf8Bytes, StandardCharsets.UTF_8);
}
}

@ -23,12 +23,15 @@
int count=0;
String mainWorkflowid = "0";
String touchnodeid = "0";
String currentnodeid = "0";
if (!isEmpty(resquestid)){
String queryMainWorkflowidSql = "select workflowid from workflow_requestbase where requestid="+resquestid;
String queryMainWorkflowidSql = "select workflowid ,lastnodeid , currentnodeid from workflow_requestbase where requestid="+resquestid;
bb.writeLog("queryMainWorkflowidSql-->"+queryMainWorkflowidSql);
rs.execute(queryMainWorkflowidSql);
if(rs.next()){
mainWorkflowid = rs.getString(1);
touchnodeid = rs.getString(2);
currentnodeid = rs.getString(3);
}
ArrayList<String> touchnodeids = new ArrayList<>();
@ -36,12 +39,16 @@
bb.writeLog("queryTouchNodeidSql-->"+queryTouchNodeidSql);
rs.execute(queryTouchNodeidSql);
if(rs.next()){
touchnodeid = rs.getString(1);
touchnodeids.add(touchnodeid);
String nodeid = rs.getString(1);
if(nodeid.equals(currentnodeid)){
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 in ( "+String.join(",",touchnodeids)+"))))";
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()){

Loading…
Cancel
Save