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
3addac14
Commit
3addac14
authored
Jul 13, 2018
by
陈玉兰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交
parent
ff6ae920
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
219 additions
and
24 deletions
+219
-24
business-reptile.xml
WebContent/WEB-INF/conf/gaowj/bl/business-reptile.xml
+9
-0
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
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
No files found.
WebContent/WEB-INF/conf/gaowj/bl/business-reptile.xml
View file @
3addac14
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
<value>
classpath:com/gaowj/business/fileGrap/fileGrapDAO.xml
</value>
<value>
classpath:com/gaowj/business/fileGrap/fileGrapDAO.xml
</value>
<value>
classpath:com/gaowj/business/fileDataSort/fileDataSortDAO.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/allData/allDataDAO.xml
</value>
<value>
classpath:com/gaowj/business/textGrapUrl/textGrapUrlDAO.xml
</value>
</list>
</list>
</property>
</property>
</bean>
</bean>
...
@@ -55,4 +56,12 @@
...
@@ -55,4 +56,12 @@
</bean>
</bean>
</property>
</property>
</bean>
</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>
</beans>
WebContent/reptile/fileGrap/fileGrapTab.jsp
View file @
3addac14
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
<table id="list" style="width: 100%; height: 100%;"></table>
<table id="list" style="width: 100%; height: 100%;"></table>
<div id="tb">
<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-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>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear',plain:true" onclick="javascript:deleteBatchRow()">删除</a>
</div>
</div>
</div>
</div>
...
...
WebContent/reptile/textGrap/js/textGrapTab.js
View file @
3addac14
...
@@ -57,8 +57,8 @@ var ls_ywlx = 'YBYW';
...
@@ -57,8 +57,8 @@ var ls_ywlx = 'YBYW';
//定义grid列表
//定义grid列表
var
ls_title
=
"抓取数据列表"
;
var
ls_title
=
"抓取数据列表"
;
var
is_column
=
[
[
var
is_column
=
[
[
{
field
:
'
URL'
,
title
:
'路径'
,
width
:
3
00
,
align
:
'left'
},
{
field
:
'
TITLE'
,
title
:
'标题'
,
width
:
1
00
,
align
:
'left'
},
{
field
:
'
LABEL'
,
title
:
'标题
'
,
width
:
100
,
align
:
'left'
},
{
field
:
'
STATUS'
,
title
:
'爬取状态
'
,
width
:
100
,
align
:
'left'
},
{
field
:
'DATABASE_NAME'
,
title
:
'数据库'
,
width
:
100
,
align
:
'left'
},
{
field
:
'DATABASE_NAME'
,
title
:
'数据库'
,
width
:
100
,
align
:
'left'
},
{
field
:
'TABLE_NAME'
,
title
:
'表名'
,
width
:
100
,
align
:
'left'
},
{
field
:
'TABLE_NAME'
,
title
:
'表名'
,
width
:
100
,
align
:
'left'
},
{
field
:
'CREATE_TIME'
,
title
:
'创建时间'
,
width
:
100
,
align
:
'left'
},
{
field
:
'CREATE_TIME'
,
title
:
'创建时间'
,
width
:
100
,
align
:
'left'
},
...
@@ -100,7 +100,8 @@ function formatMenu(value, data,index) {
...
@@ -100,7 +100,8 @@ function formatMenu(value, data,index) {
function
getOptionMenu
(
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('"
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-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> | <span class=
\"
icon-clear
\"
style=
\"
padding-left:20px;*width:20px;
\"
></span><a href=
\"
javascript:void(0);
\"
onclick=
\"
deleteRow('"
+
index
+
"')
\"
>删除</a>"
;
+
index
+
"')
\"
>删除</a>"
;
return
returnData
;
return
returnData
;
...
@@ -108,7 +109,7 @@ function getOptionMenu(data,index){
...
@@ -108,7 +109,7 @@ function getOptionMenu(data,index){
//返回菜单集的菜单个数(需更改)
//返回菜单集的菜单个数(需更改)
function
getOptionMenuCount
(){
function
getOptionMenuCount
(){
var
is_menu_count
=
4
;
var
is_menu_count
=
5
;
return
is_menu_count
;
return
is_menu_count
;
}
}
...
@@ -132,11 +133,13 @@ function addRow(){
...
@@ -132,11 +133,13 @@ function addRow(){
//加载增加子页面成功后的回调
//加载增加子页面成功后的回调
function
addUrlOnloadCallback
(
is_row
){
function
addUrlOnloadCallback
(
is_row
){
//初始化combobox
//初始化combobox
init_combobox
();
init_combobox_for_datasort
();
init_combobox_for_url
();
}
}
function
init_combobox
(){
//初始化数据分类下拉框
function
init_combobox_for_datasort
(){
$
.
ajax
({
$
.
ajax
({
url
:
gaowj
.
WEB_APP_NAME
+
'/dataSortData_list'
,
url
:
gaowj
.
WEB_APP_NAME
+
'/dataSortData_list'
,
type
:
'post'
,
type
:
'post'
,
...
@@ -150,6 +153,26 @@ function init_combobox(){
...
@@ -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
){
function
insertData
(
is_entity
){
var
v_result
=
textGrapModule
.
textGrapActAction
.
insertTextGrap
(
is_entity
);
var
v_result
=
textGrapModule
.
textGrapActAction
.
insertTextGrap
(
is_entity
);
...
@@ -178,7 +201,8 @@ function editRow(index){
...
@@ -178,7 +201,8 @@ function editRow(index){
}
}
//加载修改子页面成功后的回调
//加载修改子页面成功后的回调
function
updateUrlOnloadCallback
(
is_row
){
function
updateUrlOnloadCallback
(
is_row
){
init_combobox
();
init_combobox_for_datasort
();
init_combobox_for_url
();
}
}
//保存(is_entity);
//保存(is_entity);
function
updateData
(
is_entity
){
function
updateData
(
is_entity
){
...
@@ -292,11 +316,13 @@ function grapRow(index){
...
@@ -292,11 +316,13 @@ function grapRow(index){
//alert("开发中");
//alert("开发中");
$
(
'#list'
).
datagrid
(
'selectRow'
,
index
);
$
(
'#list'
).
datagrid
(
'selectRow'
,
index
);
var
is_row
=
$
(
'#list'
).
datagrid
(
'getSelections'
);
var
is_row
=
$
(
'#list'
).
datagrid
(
'getSelections'
);
$
.
ajax
({
$
.
ajax
({
type
:
'post'
,
type
:
'post'
,
url
:
"textGrapAct_grap"
,
url
:
"textGrapAct_grap"
,
data
:{
data
:{
url
:
is_row
[
0
].
URL
,
uuid
:
is_row
[
0
].
UUID
,
url_id
:
is_row
[
0
].
URL_ID
,
dbName
:
is_row
[
0
].
DATABASE_NAME
,
dbName
:
is_row
[
0
].
DATABASE_NAME
,
tableName
:
is_row
[
0
].
TABLE_NAME
tableName
:
is_row
[
0
].
TABLE_NAME
},
},
...
@@ -313,4 +339,27 @@ function lookRow(index){
...
@@ -313,4 +339,27 @@ function lookRow(index){
var
is_row
=
$
(
'#list'
).
datagrid
(
'getSelections'
);
var
is_row
=
$
(
'#list'
).
datagrid
(
'getSelections'
);
$
(
'#list'
).
datagrid
(
'clearSelections'
);
$
(
'#list'
).
datagrid
(
'clearSelections'
);
window
.
location
=
'textGrapView_textGrapDataTab?tablename='
+
is_row
[
0
].
TABLE_NAME
;
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 @
3addac14
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
<span>URL:</span>
<span>URL:</span>
</td>
</td>
<td style="width: 100%">
<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>
</td>
</tr>
</tr>
<tr>
<tr>
...
@@ -22,22 +22,22 @@
...
@@ -22,22 +22,22 @@
<tr>
<tr>
<td style="width: 20%;" class="tableStyleLable">
<td style="width: 20%;" class="tableStyleLable">
<span>
<span>
label
:
标题
:
</span>
</span>
</td>
</td>
<td style="width: 100%">
<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>
</td>
</tr>
</tr>
<tr>
<tr>
<td style="width: 20%;" class="tableStyleLable">
<td style="width: 20%;" class="tableStyleLable">
<span>
<span>
xpath
:
存放路径
:
</span>
</span>
</td>
</td>
<td style="width: 100%">
<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>
</td>
</tr>
</tr>
<tr>
<tr>
...
...
src_reptile/com/gaowj/business/TextGrapUrlBusiness.java
0 → 100644
View file @
3addac14
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 @
3addac14
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 @
3addac14
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 @
3addac14
<?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 @
3addac14
...
@@ -6,8 +6,11 @@ import java.util.Map;
...
@@ -6,8 +6,11 @@ import java.util.Map;
import
net.sf.json.JSONObject
;
import
net.sf.json.JSONObject
;
import
com.gaowj.business.AllDataBusiness
;
import
com.gaowj.business.FileGrapBusiness
;
import
com.gaowj.business.SystemOpeBusiness
;
import
com.gaowj.business.SystemOpeBusiness
;
import
com.gaowj.business.TextGrapBusiness
;
import
com.gaowj.business.TextGrapBusiness
;
import
com.gaowj.business.TextGrapUrlBusiness
;
import
com.gaowj.business.action.BasicAction
;
import
com.gaowj.business.action.BasicAction
;
import
com.gaowj.business.comp.BusinessManager
;
import
com.gaowj.business.comp.BusinessManager
;
import
com.gaowj.business.exception.BusinessException
;
import
com.gaowj.business.exception.BusinessException
;
...
@@ -54,9 +57,6 @@ public class actAction extends BasicAction{
...
@@ -54,9 +57,6 @@ public class actAction extends BasicAction{
SystemOpeBusiness
sysbusiness
=
BusinessManager
.
getBusiness
(
SystemOpeBusiness
.
class
);
SystemOpeBusiness
sysbusiness
=
BusinessManager
.
getBusiness
(
SystemOpeBusiness
.
class
);
sysbusiness
.
insert_logBusiness
(
"insertTextGrap"
,
""
+
entity
,
sysbusiness
.
insert_logBusiness
(
"insertTextGrap"
,
""
+
entity
,
"增加爬虫文本爬取数据"
,
(
String
)
entity
.
get
(
"UUID"
),
(
String
)
entity
.
get
(
"NAME"
),
"reptile_textgrap"
);
"增加爬虫文本爬取数据"
,
(
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
(
"保存成功"
));
jsonObject
.
putAll
(
Status
.
getStatusSuccessMessage
(
"保存成功"
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
jsonObject
.
putAll
(
Status
.
getStatusErrorMessage
(
"保存失败"
));
jsonObject
.
putAll
(
Status
.
getStatusErrorMessage
(
"保存失败"
));
...
@@ -111,21 +111,59 @@ public class actAction extends BasicAction{
...
@@ -111,21 +111,59 @@ public class actAction extends BasicAction{
}
}
public
String
grap
()
throws
BusinessException
{
public
String
grap
()
throws
BusinessException
{
Map
<
String
,
Object
>
entity
=
RequestUtils
.
getUpdateFieldMap
(
request
,
RequestUtils
.
UPDATEDATAFIELDPREFIX
);
TextGrapBusiness
grapbusiness
=
BusinessManager
.
getBusiness
(
TextGrapBusiness
.
class
);
String
url
=
RequestUtils
.
getString
(
request
,
"url"
);
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
dbName
=
RequestUtils
.
getString
(
request
,
"dbName"
);
String
tableName
=
RequestUtils
.
getString
(
request
,
"tableName"
);
String
tableName
=
RequestUtils
.
getString
(
request
,
"tableName"
);
Map
<
String
,
Object
>
param
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
param_grapurl
=
new
HashMap
<
String
,
Object
>();
param
.
put
(
"dbname"
,
dbName
);
param_grapurl
.
put
(
"UUID"
,
url_id
);
param
.
put
(
"tablename"
,
tableName
);
List
<
Map
<
String
,
Object
>>
result
=
business
.
list_textgrap_url
(
param_grapurl
);
com
.
alibaba
.
fastjson
.
JSONObject
jsObject
=
new
com
.
alibaba
.
fastjson
.
JSONObject
(
param
);
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
();
String
json
=
jsObject
.
toJSONString
();
ResponseBack
responseBack
=
RestUtil
.
post
(
url
,
json
,
"utf-8"
);
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
.
putAll
(
Status
.
getStatusSuccessMessage
(
"开始抓取"
));
jsonObject
.
put
(
"statusCode"
,
responseBack
.
getStatusCode
());
jsonObject
.
put
(
"statusCode"
,
responseBack
.
getStatusCode
());
jsonObject
.
put
(
"responseBody"
,
responseBack
.
getResponseBody
());
jsonObject
.
put
(
"responseBody"
,
responseBack
.
getResponseBody
());
return
"json"
;
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 @
3addac14
...
@@ -3,6 +3,7 @@ package com.gaowj.textGrap;
...
@@ -3,6 +3,7 @@ package com.gaowj.textGrap;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
net.sf.json.JSONObject
;
import
net.sf.json.JSONObject
;
...
@@ -10,6 +11,7 @@ import net.sf.json.JSONObject;
...
@@ -10,6 +11,7 @@ import net.sf.json.JSONObject;
import
com.gaowj.business.AllDataBusiness
;
import
com.gaowj.business.AllDataBusiness
;
import
com.gaowj.business.DataSortBusiness
;
import
com.gaowj.business.DataSortBusiness
;
import
com.gaowj.business.TextGrapBusiness
;
import
com.gaowj.business.TextGrapBusiness
;
import
com.gaowj.business.TextGrapUrlBusiness
;
import
com.gaowj.business.action.BasicAction
;
import
com.gaowj.business.action.BasicAction
;
import
com.gaowj.business.comp.BusinessManager
;
import
com.gaowj.business.comp.BusinessManager
;
import
com.gaowj.business.exception.BusinessException
;
import
com.gaowj.business.exception.BusinessException
;
...
@@ -121,5 +123,17 @@ public class dataAction extends BasicAction {
...
@@ -121,5 +123,17 @@ public class dataAction extends BasicAction {
return
"json"
;
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"
;
}
}
}
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