Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jfV5pc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
管理员
jfV5pc
Commits
62d081e2
Commit
62d081e2
authored
Jul 16, 2018
by
周添尉
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into develop
parents
79fbacc1
474dfa3e
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
327 additions
and
90 deletions
+327
-90
business-reptile.xml
WebContent/WEB-INF/conf/gaowj/bl/business-reptile.xml
+9
-0
web.xml
WebContent/WEB-INF/web.xml
+19
-6
cas.jsp
WebContent/cas.jsp
+5
-60
fileGrapTab.jsp
WebContent/reptile/fileGrap/fileGrapTab.jsp
+1
-1
textGrapTab.js
WebContent/reptile/textGrap/js/textGrapTab.js
+58
-8
textGrapTabDetail.jsp
WebContent/reptile/textGrap/textGrapTabDetail.jsp
+5
-5
struts-ext.xml
src/struts-ext.xml
+5
-0
TextGrapUrlBusiness.java
src_reptile/com/gaowj/business/TextGrapUrlBusiness.java
+14
-0
TextGrapUrlBusinessImpl.java
...m/gaowj/business/textGrapUrl/TextGrapUrlBusinessImpl.java
+34
-0
textGrapUrlDAO.java
...eptile/com/gaowj/business/textGrapUrl/textGrapUrlDAO.java
+11
-0
textGrapUrlDAO.xml
...reptile/com/gaowj/business/textGrapUrl/textGrapUrlDAO.xml
+25
-0
actAction.java
src_reptile/com/gaowj/textGrap/actAction.java
+48
-10
dataAction.java
src_reptile/com/gaowj/textGrap/dataAction.java
+14
-0
CasAction.java
src_system/com/gaowj/system/login/CasAction.java
+79
-0
No files found.
WebContent/WEB-INF/conf/gaowj/bl/business-reptile.xml
View file @
62d081e2
...
...
@@ -11,6 +11,7 @@
<value>
classpath:com/gaowj/business/fileGrap/fileGrapDAO.xml
</value>
<value>
classpath:com/gaowj/business/fileDataSort/fileDataSortDAO.xml
</value>
<value>
classpath:com/gaowj/business/allData/allDataDAO.xml
</value>
<value>
classpath:com/gaowj/business/textGrapUrl/textGrapUrlDAO.xml
</value>
</list>
</property>
</bean>
...
...
@@ -55,4 +56,12 @@
</bean>
</property>
</bean>
<bean
id=
"TextGrapUrlBusiness"
class=
"com.gaowj.business.textGrapUrl.TextGrapUrlBusinessImpl"
>
<property
name=
"textGrapUrlDAO"
>
<bean
class=
"org.mybatis.spring.mapper.MapperFactoryBean"
>
<property
name=
"mapperInterface"
value=
"com.gaowj.business.textGrapUrl.textGrapUrlDAO"
/>
<property
name=
"sqlSessionFactory"
ref=
"sqlSessionFactory-reptile"
/>
</bean>
</property>
</bean>
</beans>
WebContent/WEB-INF/web.xml
View file @
62d081e2
...
...
@@ -69,17 +69,17 @@ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j
<filter-class>
org.jasig.cas.client.authentication.AuthenticationFilter
</filter-class>
<init-param>
<param-name>
casServerLoginUrl
</param-name>
<param-value>
http://
localhost:8080/cas-test01
/login
</param-value>
<!-- cas 服务器登录 地址 http://IP:PORT/CasWebProName/login -->
<param-value>
http://
cas.jfbrother.com:9003/cas-jfsso
/login
</param-value>
<!-- cas 服务器登录 地址 http://IP:PORT/CasWebProName/login -->
</init-param>
<init-param>
<!-- 这里的server是服务端的IP -->
<param-name>
serverName
</param-name>
<param-value>
http://
localhost:8082
</param-value>
<!-- 客户端服务器地址 http://IP:PORT -->
<param-value>
http://
pc.jfbrother.com:9003
</param-value>
<!-- 客户端服务器地址 http://IP:PORT -->
</init-param>
</filter>
<filter-mapping>
<filter-name>
CASFilter
</filter-name>
<url-pattern>
/
cas.jsp
</url-pattern>
<url-pattern>
/
jfcas
</url-pattern>
<!-- <url-pattern>/*</url-pattern> -->
</filter-mapping>
...
...
@@ -89,16 +89,16 @@ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j
<filter-class>
org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter
</filter-class>
<init-param>
<param-name>
casServerUrlPrefix
</param-name>
<param-value>
http://
localhost:8080/cas-test01
</param-value>
<!-- cas 服务器地址 http://IP:PORT/CasWebProName -->
<param-value>
http://
cas.jfbrother.com:9003/cas-jfsso
</param-value>
<!-- cas 服务器地址 http://IP:PORT/CasWebProName -->
</init-param>
<init-param>
<param-name>
serverName
</param-name>
<param-value>
http://
localhost:8082
</param-value>
<!-- 客户端服务器地址 http://IP:PORT -->
<param-value>
http://
pc.jfbrother.com:9003
</param-value>
<!-- 客户端服务器地址 http://IP:PORT -->
</init-param>
</filter>
<filter-mapping>
<filter-name>
CAS Validation Filter
</filter-name>
<url-pattern>
/
cas.jsp
</url-pattern>
<url-pattern>
/
jfcas
</url-pattern>
</filter-mapping>
<!-- 该过滤器负责实现HttpServletRequest请求的包裹,
...
...
@@ -112,6 +112,19 @@ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j
<url-pattern>
/*
</url-pattern>
</filter-mapping>
<!-- 单点注销监听器 -->
<listener>
<listener-class>
org.jasig.cas.client.session.SingleSignOutHttpSessionListener
</listener-class>
</listener>
<!-- 单点注销过滤器 -->
<filter>
<filter-name>
caslogoutFilter
</filter-name>
<filter-class>
org.jasig.cas.client.session.SingleSignOutFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>
caslogoutFilter
</filter-name>
<url-pattern>
/*
</url-pattern>
</filter-mapping>
<filter>
<filter-name>
struts2
</filter-name>
<filter-class>
com.gaowj.business.filter.myStrutsPrepareAndExecuteFilter
</filter-class>
...
...
WebContent/cas.jsp
View file @
62d081e2
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="org.jasig.cas.client.authentication.AttributePrincipal" %>
<%@ page import="org.jasig.cas.client.util.AssertionHolder"%>
<%@ page import="com.gaowj.business.comp.BusinessManager" %>
<%@ page import="com.gaowj.business.SystemOpeBusiness" %>
<%@ page import="com.gaowj.business.util.Java_tool" %>
<%@ page import="java.util.*" %>
<%@ page import="java.util.Map" %>
<%
//解决在IE的frame/iframe环境下,跨域单点登录后,无法重定向的问题
response.setHeader("P3P","CP=CAO PSA OUR");
%>
<%
AttributePrincipal principal = (AttributePrincipal)request.getUserPrincipal();
Map<String, Object> attributes = principal.getAttributes();
String userID = attributes.get("userid").toString();
String userName = attributes.get("USER_NAME").toString();
System.out.println("-----1"+userID);
System.out.println("-----2"+userName);
System.out.println("-----3"+attributes.get("UNIT_ID"));
if(userID!=null){
String username = userID;
Java_tool jt = new Java_tool();
SystemOpeBusiness systemOpeBusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
Map query = new HashMap();
query.put("EMID", username);
Map<String,Object> userInfoI = systemOpeBusiness.listLoginUserInfo(query).get(0);
Map<String,Object> sessionUser = new HashMap<String,Object>();
String u_all_m = systemOpeBusiness.getUserAllModule(userInfoI.get("CODE").toString());
sessionUser.put("CODE",userInfoI.get("CODE"));
sessionUser.put("EMID",userInfoI.get("EMID"));
sessionUser.put("EMSEX",userInfoI.get("EMSEX"));
sessionUser.put("EMDEPARTNAME",userInfoI.get("EMDEPARTNAME"));
sessionUser.put("EMDEPART",userInfoI.get("EMDEPART"));
sessionUser.put("EMNAME",userInfoI.get("EMNAME"));
sessionUser.put("BEFORETIME",userInfoI.get("BEFORETIME"));
sessionUser.put("SESSIONID", request.getSession().getId());
sessionUser.put("CURRENTTIME", jt.now_datetime());
sessionUser.put("LOGINIP", request.getRemoteAddr());
sessionUser.put("SERVERIP", request.getLocalAddr());
sessionUser.put("QUANXIAN",u_all_m);
request.getSession().setAttribute("userInfo", sessionUser);
//增加登陆日志
Map<String,Object> log = new HashMap<String,Object>();
log.put("CODE", sessionUser.get("CODE"));log.put("EMNAME", sessionUser.get("EMNAME"));log.put("EMIP", sessionUser.get("LOGINIP"));
log.put("OPENAME", "登陆");log.put("OPETIME", jt.String3date((String)sessionUser.get("CURRENTTIME")));log.put("TYPE", userInfoI.get("TYPE"));
log.put("OPETYPE", "B/S登陆");
systemOpeBusiness.insert_log(log);
}
String strRedirecturl = request.getParameter("redirectUrl");
if(strRedirecturl != null && strRedirecturl.length() > 0) {
response.sendRedirect(strRedirecturl);
}else{
response.sendRedirect("index.jsp");
}
response.getWriter().println("123");
%>
\ No newline at end of file
<script type="text/javascript">
var WebContextPath = '<%=request.getContextPath() %>';
window.location = WebContextPath + "/jfcas";
</script>
\ No newline at end of file
WebContent/reptile/fileGrap/fileGrapTab.jsp
View file @
62d081e2
...
...
@@ -14,7 +14,7 @@
<table id="list" style="width: 100%; height: 100%;"></table>
<div id="tb">
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="javascript:addRow()">新增</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="javascript:refreshRow()">
删除
</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="javascript:refreshRow()">
刷新
</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear',plain:true" onclick="javascript:deleteBatchRow()">删除</a>
</div>
</div>
...
...
WebContent/reptile/textGrap/js/textGrapTab.js
View file @
62d081e2
...
...
@@ -57,8 +57,8 @@ var ls_ywlx = 'YBYW';
//定义grid列表
var
ls_title
=
"抓取数据列表"
;
var
is_column
=
[
[
{
field
:
'
URL'
,
title
:
'路径'
,
width
:
3
00
,
align
:
'left'
},
{
field
:
'
LABEL'
,
title
:
'标题
'
,
width
:
100
,
align
:
'left'
},
{
field
:
'
TITLE'
,
title
:
'标题'
,
width
:
1
00
,
align
:
'left'
},
{
field
:
'
STATUS'
,
title
:
'爬取状态
'
,
width
:
100
,
align
:
'left'
},
{
field
:
'DATABASE_NAME'
,
title
:
'数据库'
,
width
:
100
,
align
:
'left'
},
{
field
:
'TABLE_NAME'
,
title
:
'表名'
,
width
:
100
,
align
:
'left'
},
{
field
:
'CREATE_TIME'
,
title
:
'创建时间'
,
width
:
100
,
align
:
'left'
},
...
...
@@ -100,7 +100,8 @@ function formatMenu(value, data,index) {
function
getOptionMenu
(
data
,
index
){
var
returnData
=
"<span class=
\"
icon-edit
\"
style=
\"
padding-left:20px;*width:20px;
\"
></span><a href=
\"
javascript:void(0);
\"
onclick=
\"
editRow('"
+
index
+
"')
\"
>编辑</a> | <span class=
\"
icon-ext-11_10
\"
style=
\"
padding-left:20px;*width:20px;
\"
></span><a href=
\"
javascript:void(0);
\"
onclick=
\"
grapRow('"
+
index
+
"')
\"
>爬取</a> | <span class=
\"
icon-search
\"
style=
\"
padding-left:20px;*width:20px;
\"
></span><a href=
\"
javascript:void(0);
\"
onclick=
\"
lookRow('"
+
index
+
"')
\"
>爬取</a> | <span class=
\"
icon-ext-13_12
\"
style=
\"
padding-left:20px;*width:20px;
\"
></span><a href=
\"
javascript:void(0);
\"
onclick=
\"
statusRow('"
+
index
+
"')
\"
>状态</a> | <span class=
\"
icon-search
\"
style=
\"
padding-left:20px;*width:20px;
\"
></span><a href=
\"
javascript:void(0);
\"
onclick=
\"
lookRow('"
+
index
+
"')
\"
>查看</a> | <span class=
\"
icon-clear
\"
style=
\"
padding-left:20px;*width:20px;
\"
></span><a href=
\"
javascript:void(0);
\"
onclick=
\"
deleteRow('"
+
index
+
"')
\"
>删除</a>"
;
return
returnData
;
...
...
@@ -108,7 +109,7 @@ function getOptionMenu(data,index){
//返回菜单集的菜单个数(需更改)
function
getOptionMenuCount
(){
var
is_menu_count
=
4
;
var
is_menu_count
=
5
;
return
is_menu_count
;
}
...
...
@@ -132,11 +133,13 @@ function addRow(){
//加载增加子页面成功后的回调
function
addUrlOnloadCallback
(
is_row
){
//初始化combobox
init_combobox
();
init_combobox_for_datasort
();
init_combobox_for_url
();
}
function
init_combobox
(){
//初始化数据分类下拉框
function
init_combobox_for_datasort
(){
$
.
ajax
({
url
:
gaowj
.
WEB_APP_NAME
+
'/dataSortData_list'
,
type
:
'post'
,
...
...
@@ -150,6 +153,26 @@ function init_combobox(){
})
}
//初始化爬取路径下拉框
function
init_combobox_for_url
(){
$
.
ajax
({
url
:
gaowj
.
WEB_APP_NAME
+
'/textGrapData_listUrl'
,
type
:
'post'
,
success
:
function
(
result
){
$
(
'#URL_ID'
).
combobox
({
valueField
:
'UUID'
,
textField
:
'NAME'
,
data
:
result
.
rowSet
,
onSelect
:
function
(
record
){
$
(
"#SAVE_PATH"
).
textbox
(
'setValue'
,
record
.
SAVE_PATH
);
$
(
"#DATABASE_NAME"
).
textbox
(
'setValue'
,
record
.
DATABASE_NAME
);
$
(
"#TABLE_NAME"
).
textbox
(
'setValue'
,
record
.
TABLE_NAME
);
console
.
log
(
record
);
}
})
}
})
}
//保存
function
insertData
(
is_entity
){
var
v_result
=
textGrapModule
.
textGrapActAction
.
insertTextGrap
(
is_entity
);
...
...
@@ -178,7 +201,8 @@ function editRow(index){
}
//加载修改子页面成功后的回调
function
updateUrlOnloadCallback
(
is_row
){
init_combobox
();
init_combobox_for_datasort
();
init_combobox_for_url
();
}
//保存(is_entity);
function
updateData
(
is_entity
){
...
...
@@ -292,11 +316,13 @@ function grapRow(index){
//alert("开发中");
$
(
'#list'
).
datagrid
(
'selectRow'
,
index
);
var
is_row
=
$
(
'#list'
).
datagrid
(
'getSelections'
);
$
.
ajax
({
type
:
'post'
,
url
:
"textGrapAct_grap"
,
data
:{
url
:
is_row
[
0
].
URL
,
uuid
:
is_row
[
0
].
UUID
,
url_id
:
is_row
[
0
].
URL_ID
,
dbName
:
is_row
[
0
].
DATABASE_NAME
,
tableName
:
is_row
[
0
].
TABLE_NAME
},
...
...
@@ -313,4 +339,27 @@ function lookRow(index){
var
is_row
=
$
(
'#list'
).
datagrid
(
'getSelections'
);
$
(
'#list'
).
datagrid
(
'clearSelections'
);
window
.
location
=
'textGrapView_textGrapDataTab?tablename='
+
is_row
[
0
].
TABLE_NAME
;
}
function
statusRow
(
index
){
$
(
'#list'
).
datagrid
(
'selectRow'
,
index
);
var
is_row
=
$
(
'#list'
).
datagrid
(
'getSelections'
);
var
map
=
{};
map
.
FIELD_UUID
=
is_row
[
0
].
UUID
;
/* map.FIELD_CREATE_ID=is_row[0].CREATE_ID
map.FIELD_CREATE_TIME=is_row[0].CREATE_TIME
map.FIELD_DATABASE_NAME=is_row[0].DATABASE_NAME
map.FIELD_DATA_SORT_ID=is_row[0].DATA_SORT_ID
map.FIELD_SAVE_PATH=is_row[0].SAVE_PATH
map.FIELD_TABLE_NAME=is_row[0].TABLE_NAME*/
map
.
FIELD_URL_ID
=
is_row
[
0
].
URL_ID
;
map
.
FIELD_TASK_ID
=
is_row
[
0
].
TASK_ID
;
$
.
ajax
({
type
:
'post'
,
url
:
"textGrapAct_status"
,
data
:
map
,
success
:
function
(
data
){
$
(
'#list'
).
datagrid
(
'reload'
);
}
});
}
\ No newline at end of file
WebContent/reptile/textGrap/textGrapTabDetail.jsp
View file @
62d081e2
...
...
@@ -8,7 +8,7 @@
<span>URL:</span>
</td>
<td style="width: 100%">
<input class="easyui-
textbox" id="URL" name="FIELD_URL" style="width:300px" value="${is_row.URL
}" required="required"/>
<input class="easyui-
combobox" id="URL_ID" name="FIELD_URL_ID" style="width:300px" value="${is_row.URL_ID
}" required="required"/>
</td>
</tr>
<tr>
...
...
@@ -22,22 +22,22 @@
<tr>
<td style="width: 20%;" class="tableStyleLable">
<span>
label
:
标题
:
</span>
</td>
<td style="width: 100%">
<input class="easyui-textbox" id="
LABEL" name="FIELD_LABEL" style="width:300px" value="${is_row.LABEL
}"/>
<input class="easyui-textbox" id="
TITLE" name="FIELD_TITLE" style="width:300px" value="${is_row.TITLE
}"/>
</td>
</tr>
<tr>
<td style="width: 20%;" class="tableStyleLable">
<span>
xpath
:
存放路径
:
</span>
</td>
<td style="width: 100%">
<input class="easyui-textbox" id="
XPATH" name="FIELD_XPATH" style="width:300px" value="${is_row.X
PATH}"/>
<input class="easyui-textbox" id="
SAVE_PATH" name="FIELD_SAVE_PATH" style="width:300px" value="${is_row.SAVE_
PATH}"/>
</td>
</tr>
<tr>
...
...
src/struts-ext.xml
View file @
62d081e2
...
...
@@ -64,4 +64,9 @@
</result>
</action>
</package>
<package
name=
"caslogin"
extends=
"struts-default,json-default"
>
<action
name=
"jfcas"
class=
"com.gaowj.system.login.CasAction"
>
</action>
</package>
</struts>
src_reptile/com/gaowj/business/TextGrapUrlBusiness.java
0 → 100644
View file @
62d081e2
package
com
.
gaowj
.
business
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.stereotype.Service
;
import
com.gaowj.business.exception.BusinessException
;
@Service
public
interface
TextGrapUrlBusiness
{
List
<
Map
<
String
,
Object
>>
list_textgrap_url
(
Map
<
String
,
Object
>
entity
)
throws
BusinessException
;
}
src_reptile/com/gaowj/business/textGrapUrl/TextGrapUrlBusinessImpl.java
0 → 100644
View file @
62d081e2
package
com
.
gaowj
.
business
.
textGrapUrl
;
import
java.util.List
;
import
java.util.Map
;
import
com.gaowj.business.TextGrapUrlBusiness
;
import
com.gaowj.business.exception.BusinessException
;
public
class
TextGrapUrlBusinessImpl
implements
TextGrapUrlBusiness
{
private
textGrapUrlDAO
textGrapUrlDAO
;
public
textGrapUrlDAO
getTextGrapUrlDAO
()
{
return
textGrapUrlDAO
;
}
public
void
setTextGrapUrlDAO
(
textGrapUrlDAO
textGrapUrlDAO
)
{
this
.
textGrapUrlDAO
=
textGrapUrlDAO
;
}
@Override
public
List
<
Map
<
String
,
Object
>>
list_textgrap_url
(
Map
<
String
,
Object
>
entity
)
throws
BusinessException
{
// TODO Auto-generated method stub
return
textGrapUrlDAO
.
list_textgrap_url
(
entity
);
}
}
src_reptile/com/gaowj/business/textGrapUrl/textGrapUrlDAO.java
0 → 100644
View file @
62d081e2
package
com
.
gaowj
.
business
.
textGrapUrl
;
import
java.util.List
;
import
java.util.Map
;
import
com.gaowj.business.exception.BusinessException
;
public
interface
textGrapUrlDAO
{
List
<
Map
<
String
,
Object
>>
list_textgrap_url
(
Map
<
String
,
Object
>
entity
)
throws
BusinessException
;
}
src_reptile/com/gaowj/business/textGrapUrl/textGrapUrlDAO.xml
0 → 100644
View file @
62d081e2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.gaowj.business.textGrapUrl.textGrapUrlDAO"
>
<select
id=
"list_textgrap_url"
parameterType=
"map"
resultType=
"upperCaseKeyMap"
>
<![CDATA[
select f.*
from C_T_REPTILE_TEXTGRAP_URL f where 1=1
]]>
<if
test=
"UUID != null and UUID != ''"
>
and f.UUID = #{UUID}
</if>
order by f.CREATE_TIME DESC
</select>
<select
id=
"listCount_textgrap_url"
parameterType=
"map"
resultType=
"int"
>
<![CDATA[
select count(*) c from C_T_REPTILE_TEXTGRAP_URL f where 1=1
]]>
<if
test=
"UUID != null and UUID != ''"
>
and f.UUID = #{UUID}
</if>
</select>
</mapper>
\ No newline at end of file
src_reptile/com/gaowj/textGrap/actAction.java
View file @
62d081e2
...
...
@@ -6,8 +6,11 @@ import java.util.Map;
import
net.sf.json.JSONObject
;
import
com.gaowj.business.AllDataBusiness
;
import
com.gaowj.business.FileGrapBusiness
;
import
com.gaowj.business.SystemOpeBusiness
;
import
com.gaowj.business.TextGrapBusiness
;
import
com.gaowj.business.TextGrapUrlBusiness
;
import
com.gaowj.business.action.BasicAction
;
import
com.gaowj.business.comp.BusinessManager
;
import
com.gaowj.business.exception.BusinessException
;
...
...
@@ -54,9 +57,6 @@ public class actAction extends BasicAction{
SystemOpeBusiness
sysbusiness
=
BusinessManager
.
getBusiness
(
SystemOpeBusiness
.
class
);
sysbusiness
.
insert_logBusiness
(
"insertTextGrap"
,
""
+
entity
,
"增加爬虫文本爬取数据"
,
(
String
)
entity
.
get
(
"UUID"
),
(
String
)
entity
.
get
(
"NAME"
),
"reptile_textgrap"
);
//
//更新缓存
//CacheKit.update("ehcache11", "com_gaowj_datasort_dataAction_list", business.list_textGrap(null);
jsonObject
.
putAll
(
Status
.
getStatusSuccessMessage
(
"保存成功"
));
}
catch
(
Exception
e
)
{
jsonObject
.
putAll
(
Status
.
getStatusErrorMessage
(
"保存失败"
));
...
...
@@ -111,21 +111,59 @@ public class actAction extends BasicAction{
}
public
String
grap
()
throws
BusinessException
{
Map
<
String
,
Object
>
entity
=
RequestUtils
.
getUpdateFieldMap
(
request
,
RequestUtils
.
UPDATEDATAFIELDPREFIX
);
String
url
=
RequestUtils
.
getString
(
request
,
"url"
);
TextGrapBusiness
grapbusiness
=
BusinessManager
.
getBusiness
(
TextGrapBusiness
.
class
);
TextGrapUrlBusiness
business
=
BusinessManager
.
getBusiness
(
TextGrapUrlBusiness
.
class
);
String
url_id
=
RequestUtils
.
getString
(
request
,
"url_id"
);
String
textgrap_id
=
RequestUtils
.
getString
(
request
,
"uuid"
);
String
dbName
=
RequestUtils
.
getString
(
request
,
"dbName"
);
String
tableName
=
RequestUtils
.
getString
(
request
,
"tableName"
);
Map
<
String
,
Object
>
param
=
new
HashMap
<
String
,
Object
>();
param
.
put
(
"dbname"
,
dbName
);
param
.
put
(
"tablename"
,
tableName
);
com
.
alibaba
.
fastjson
.
JSONObject
jsObject
=
new
com
.
alibaba
.
fastjson
.
JSONObject
(
param
);
Map
<
String
,
Object
>
param_grapurl
=
new
HashMap
<
String
,
Object
>();
param_grapurl
.
put
(
"UUID"
,
url_id
);
List
<
Map
<
String
,
Object
>>
result
=
business
.
list_textgrap_url
(
param_grapurl
);
Map
<
String
,
Object
>
map
=
result
.
get
(
0
);
String
url
=
null
;
if
(
map
.
get
(
"URL"
)!=
null
&&
""
!=
map
.
get
(
"URL"
)){
url
=
map
.
get
(
"URL"
).
toString
();
}
Map
<
String
,
Object
>
param_grap
=
new
HashMap
<
String
,
Object
>();
param_grap
.
put
(
"dbname"
,
dbName
);
param_grap
.
put
(
"tablename"
,
tableName
);
com
.
alibaba
.
fastjson
.
JSONObject
jsObject
=
new
com
.
alibaba
.
fastjson
.
JSONObject
(
param_grap
);
String
json
=
jsObject
.
toJSONString
();
ResponseBack
responseBack
=
RestUtil
.
post
(
url
,
json
,
"utf-8"
);
String
taskid
=
responseBack
.
getResponseBody
();
Map
<
String
,
Object
>
mapforup
=
new
HashMap
<
String
,
Object
>();
if
(
responseBack
.
getStatusCode
()==
200
){
String
taskid
=
responseBack
.
getResponseBody
();
mapforup
.
put
(
"UUID"
,
textgrap_id
);
mapforup
.
put
(
"TASK_ID"
,
taskid
);
grapbusiness
.
update_textGrap
(
mapforup
);
}
jsonObject
.
putAll
(
Status
.
getStatusSuccessMessage
(
"开始抓取"
));
jsonObject
.
put
(
"statusCode"
,
responseBack
.
getStatusCode
());
jsonObject
.
put
(
"responseBody"
,
responseBack
.
getResponseBody
());
return
"json"
;
}
public
String
status
()
throws
BusinessException
{
TextGrapBusiness
business
=
BusinessManager
.
getBusiness
(
TextGrapBusiness
.
class
);
TextGrapUrlBusiness
urlbusiness
=
BusinessManager
.
getBusiness
(
TextGrapUrlBusiness
.
class
);
Map
<
String
,
Object
>
entity
=
RequestUtils
.
getUpdateFieldMap
(
request
,
RequestUtils
.
UPDATEDATAFIELDPREFIX
);
Map
<
String
,
Object
>
param
=
new
HashMap
<
String
,
Object
>();
param
.
put
(
"UUID"
,
entity
.
get
(
"URL_ID"
));
List
<
Map
<
String
,
Object
>>
result
=
urlbusiness
.
list_textgrap_url
(
param
);
Map
<
String
,
Object
>
map
=
result
.
get
(
0
);
String
url
=
map
.
get
(
"GET_STATUS_URL"
).
toString
();
Map
<
String
,
Object
>
param_post
=
new
HashMap
<
String
,
Object
>();
param_post
.
put
(
"task_id"
,
entity
.
get
(
"TASK_ID"
));
com
.
alibaba
.
fastjson
.
JSONObject
jsObject
=
new
com
.
alibaba
.
fastjson
.
JSONObject
(
param_post
);
String
json
=
jsObject
.
toJSONString
();
ResponseBack
responseBack
=
RestUtil
.
post
(
url
,
json
,
"utf-8"
);
if
(
responseBack
.
getStatusCode
()==
200
){
entity
.
put
(
"STATUS"
,
responseBack
.
getResponseBody
());
business
.
update_textGrap
(
entity
);
}
return
"json"
;
}
}
src_reptile/com/gaowj/textGrap/dataAction.java
View file @
62d081e2
...
...
@@ -3,6 +3,7 @@ package com.gaowj.textGrap;
import
java.sql.SQLException
;
import
java.text.ParseException
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
net.sf.json.JSONObject
;
...
...
@@ -10,6 +11,7 @@ import net.sf.json.JSONObject;
import
com.gaowj.business.AllDataBusiness
;
import
com.gaowj.business.DataSortBusiness
;
import
com.gaowj.business.TextGrapBusiness
;
import
com.gaowj.business.TextGrapUrlBusiness
;
import
com.gaowj.business.action.BasicAction
;
import
com.gaowj.business.comp.BusinessManager
;
import
com.gaowj.business.exception.BusinessException
;
...
...
@@ -121,5 +123,17 @@ public class dataAction extends BasicAction {
return
"json"
;
}
public
String
listUrl
()
throws
BusinessException
{
TextGrapUrlBusiness
business
=
BusinessManager
.
getBusiness
(
TextGrapUrlBusiness
.
class
);
Map
<
String
,
Object
>
query
=
null
;
List
<
Map
<
String
,
Object
>>
pageRows
=
business
.
list_textgrap_url
(
query
);
Map
<
String
,
Object
>
data
=
new
HashMap
<
String
,
Object
>();
data
.
put
(
"rowSet"
,
pageRows
);
data
.
put
(
"rows"
,
data
.
get
(
"rowSet"
));
jsonObject
=
new
JSONObject
();
jsonObject
.
putAll
(
data
);
return
"json"
;
}
}
src_system/com/gaowj/system/login/CasAction.java
0 → 100644
View file @
62d081e2
package
com
.
gaowj
.
system
.
login
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.jasig.cas.client.authentication.AttributePrincipal
;
import
com.gaowj.business.SystemOpeBusiness
;
import
com.gaowj.business.action.BasicAction
;
import
com.gaowj.business.comp.BusinessManager
;
import
com.gaowj.business.exception.BusinessException
;
import
com.gaowj.business.util.Java_tool
;
public
class
CasAction
extends
BasicAction
{
/**
*
*/
private
static
final
long
serialVersionUID
=
4192673206777760091L
;
public
String
execute
()
throws
BusinessException
{
response
.
setHeader
(
"P3P"
,
"CP=CAO PSA OUR"
);
AttributePrincipal
principal
=
(
AttributePrincipal
)
request
.
getUserPrincipal
();
Map
<
String
,
Object
>
attributes
=
principal
.
getAttributes
();
String
userID
=
attributes
.
get
(
"userid"
).
toString
();
String
userName
=
attributes
.
get
(
"USER_NAME"
).
toString
();
System
.
out
.
println
(
"-----1"
+
userID
);
System
.
out
.
println
(
"-----2"
+
userName
);
System
.
out
.
println
(
"-----3"
+
attributes
.
get
(
"UNIT_ID"
));
if
(
userID
!=
null
){
String
username
=
userID
;
Java_tool
jt
=
new
Java_tool
();
SystemOpeBusiness
systemOpeBusiness
=
BusinessManager
.
getBusiness
(
SystemOpeBusiness
.
class
);
Map
<
String
,
Object
>
query
=
new
HashMap
<
String
,
Object
>();
query
.
put
(
"EMID"
,
username
);
Map
<
String
,
Object
>
userInfoI
=
systemOpeBusiness
.
listLoginUserInfo
(
query
).
get
(
0
);
Map
<
String
,
Object
>
sessionUser
=
new
HashMap
<
String
,
Object
>();
String
u_all_m
=
systemOpeBusiness
.
getUserAllModule
(
userInfoI
.
get
(
"CODE"
).
toString
());
sessionUser
.
put
(
"CODE"
,
userInfoI
.
get
(
"CODE"
));
sessionUser
.
put
(
"EMID"
,
userInfoI
.
get
(
"EMID"
));
sessionUser
.
put
(
"EMSEX"
,
userInfoI
.
get
(
"EMSEX"
));
sessionUser
.
put
(
"EMDEPARTNAME"
,
userInfoI
.
get
(
"EMDEPARTNAME"
));
sessionUser
.
put
(
"EMDEPART"
,
userInfoI
.
get
(
"EMDEPART"
));
sessionUser
.
put
(
"EMNAME"
,
userInfoI
.
get
(
"EMNAME"
));
sessionUser
.
put
(
"BEFORETIME"
,
userInfoI
.
get
(
"BEFORETIME"
));
sessionUser
.
put
(
"SESSIONID"
,
request
.
getSession
().
getId
());
sessionUser
.
put
(
"CURRENTTIME"
,
jt
.
now_datetime
());
sessionUser
.
put
(
"LOGINIP"
,
request
.
getRemoteAddr
());
sessionUser
.
put
(
"SERVERIP"
,
request
.
getLocalAddr
());
sessionUser
.
put
(
"QUANXIAN"
,
u_all_m
);
request
.
getSession
().
setAttribute
(
"userInfo"
,
sessionUser
);
//增加登陆日志
Map
<
String
,
Object
>
log
=
new
HashMap
<
String
,
Object
>();
log
.
put
(
"CODE"
,
sessionUser
.
get
(
"CODE"
));
log
.
put
(
"EMNAME"
,
sessionUser
.
get
(
"EMNAME"
));
log
.
put
(
"EMIP"
,
sessionUser
.
get
(
"LOGINIP"
));
log
.
put
(
"OPENAME"
,
"登陆"
);
log
.
put
(
"OPETIME"
,
jt
.
String3date
((
String
)
sessionUser
.
get
(
"CURRENTTIME"
)));
log
.
put
(
"TYPE"
,
userInfoI
.
get
(
"TYPE"
));
log
.
put
(
"OPETYPE"
,
"B/S登陆"
);
systemOpeBusiness
.
insert_log
(
log
);
}
String
strRedirecturl
=
request
.
getParameter
(
"redirectUrl"
);
String
toUrl
=
""
;
if
(
strRedirecturl
!=
null
&&
strRedirecturl
.
length
()
>
0
)
{
toUrl
=
strRedirecturl
;
}
else
{
toUrl
=
"index.jsp"
;
}
try
{
response
.
sendRedirect
(
toUrl
);
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
return
null
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment