Commit a24dc5fb by 陈玉兰

更新

parent beb91385
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<!-- 增加数据源dataSource-system --> <!-- 增加数据源dataSource-system -->
<bean id="dataSource-system" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close"> <bean id="dataSource-system" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
<!-- 基本属性 url、user、password --> <!-- 基本属性 url、user、password -->
<property name="url" value="jdbc:mysql://192.168.1.116:3306/pc_system?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;useSSL=false" /> <property name="url" value="jdbc:mysql://192.168.1.249:3306/pc_system?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;useSSL=false" />
<property name="username" value="pc_system" /> <property name="username" value="pc_system" />
<property name="password" value="pc_system" /> <property name="password" value="pc_system" />
<property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="driverClassName" value="com.mysql.jdbc.Driver" />
...@@ -57,9 +57,9 @@ ...@@ -57,9 +57,9 @@
<!-- 增加数据源dataSource-standard --> <!-- 增加数据源dataSource-standard -->
<bean id="dataSource-standard" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close"> <bean id="dataSource-standard" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
<!-- 基本属性 url、user、password --> <!-- 基本属性 url、user、password -->
<property name="url" value="jdbc:mysql://192.168.1.116:3306/jw_standard?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;useSSL=false" /> <property name="url" value="jdbc:mysql://192.168.1.249:3306/jf_standard?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;useSSL=false" />
<property name="username" value="jw_standard" /> <property name="username" value="jf_standard" />
<property name="password" value="jw_standard" /> <property name="password" value="jf_standard" />
<property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="driverClassName" value="com.mysql.jdbc.Driver" />
<!-- 配置初始化大小、最小、最大 --> <!-- 配置初始化大小、最小、最大 -->
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
<!-- 增加数据源dataSource-business --> <!-- 增加数据源dataSource-business -->
<bean id="dataSource-business" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close"> <bean id="dataSource-business" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
<!-- 基本属性 url、user、password --> <!-- 基本属性 url、user、password -->
<property name="url" value="jdbc:mysql://192.168.1.116:3306/pc_business?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;useSSL=false" /> <property name="url" value="jdbc:mysql://192.168.1.249:3306/pc_business?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;useSSL=false" />
<property name="username" value="pc_business" /> <property name="username" value="pc_business" />
<property name="password" value="pc_business" /> <property name="password" value="pc_business" />
<property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="driverClassName" value="com.mysql.jdbc.Driver" />
......
...@@ -312,4 +312,7 @@ ...@@ -312,4 +312,7 @@
} }
.icon-ext-10_36{ .icon-ext-10_36{
background:url('../../../../images/icons/(10,36).png') no-repeat left center; background:url('../../../../images/icons/(10,36).png') no-repeat left center;
}
.icon-ext-13_12{
background:url('../../../../images/icons/(13,12).png') no-repeat left center;
} }
\ No newline at end of file
...@@ -14,6 +14,7 @@ ...@@ -14,6 +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-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>
......
...@@ -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}"/> <input class="easyui-textbox" id="URL" name="FIELD_URL" style="width:300px" value="${is_row.URL}" required="required"/>
</td> </td>
</tr> </tr>
<tr> <tr>
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<span>存放地址:</span> <span>存放地址:</span>
</td> </td>
<td style="width: 100%"> <td style="width: 100%">
<input class="easyui-textbox" id="save_Path" name="FIELD_SAVE_PATH" style="width:300px" value="${is_row.SAVE_PATH}"/> <input class="easyui-textbox" id="save_Path" name="FIELD_SAVE_PATH" style="width:300px" value="${is_row.SAVE_PATH}" required="required"/>
</td> </td>
</tr> </tr>
<tr> <tr>
......
...@@ -69,11 +69,23 @@ var ls_ywlx = 'YBYW'; ...@@ -69,11 +69,23 @@ var ls_ywlx = 'YBYW';
var ls_title="抓取数据列表"; var ls_title="抓取数据列表";
var is_column = [ [ var is_column = [ [
{field : 'URL',title : '名称',width : 300,align : 'left'}, {field : 'URL',title : '名称',width : 300,align : 'left'},
{field : 'SAVE_PATH',title : '保存路径',width : 300,align : 'left'}, {field : 'SAVE_PATH',title : '保存路径',width : 200,align : 'left'},
{field : 'DATABASE_NAME',title : '指定数据库',width : 150,align : 'left'}, {field : 'DATABASE_NAME',title : '指定数据库',width : 100,align : 'left'},
{field : 'TABLE_NAME',title : '指定表名',width : 150,align : 'left'}, {field : 'TABLE_NAME',title : '指定表名',width : 100,align : 'left'},
{field : 'CREATE_TIME',title : '创建时间',width : 150,align : 'left'}, {field : 'STATUS',title : '爬取状态',width : 100,align : 'left',formatter:function(value,row,index){
{field : 'CREATE_ID',title : '创建人',width : 150,align : 'left'} if(value=='SUCCESS'){
return "爬取成功";
}
if(value=='PENDING'){
return "爬取中";
}
if(value=='FAILURE'){
return "爬取失败";
}
}},
{field : 'RESULT_COUNT',title : '当前数目',width : 50,align : 'left'},
{field : 'CREATE_TIME',title : '创建时间',width : 100,align : 'left'},
{field : 'CREATE_ID',title : '创建人',width : 100,align : 'left'}
] ]; ] ];
//列表加载完成回调 //列表加载完成回调
function dataOnLoadSuccess(){ function dataOnLoadSuccess(){
...@@ -99,7 +111,8 @@ function formatMenu(value, data,index) { ...@@ -99,7 +111,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;
...@@ -107,7 +120,7 @@ function getOptionMenu(data,index){ ...@@ -107,7 +120,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;
} }
...@@ -188,6 +201,10 @@ function updateData(is_entity){ ...@@ -188,6 +201,10 @@ function updateData(is_entity){
} }
/****/ /****/
function refreshRow(){
$('#list').datagrid('load',{});
}
/** /**
* 序号:7 * 序号:7
* 功能:单个删除 * 功能:单个删除
...@@ -269,17 +286,24 @@ function modifyNode(treeNode){ ...@@ -269,17 +286,24 @@ function modifyNode(treeNode){
function grapRow(index){ function grapRow(index){
$('#list').datagrid('selectRow',index); $('#list').datagrid('selectRow',index);
var is_row = $('#list').datagrid('getSelections'); 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=is_row[0].URL
$.messager.confirm('提示', '确定开始爬取?', function(r) { $.messager.confirm('提示', '确定开始爬取?', function(r) {
if (r) { if (r) {
$.ajax({ $.ajax({
type:'post', type:'post',
url:"fileGrapAct_grap", url:"fileGrapAct_grap",
data:{ data:map,
url:is_row[0].URL,
save_path:is_row[0].SAVE_PATH,
},
success:function(data){ success:function(data){
$.messager.alert('提示',"爬取中....."); $.messager.alert('提示',"爬取中.....");
$('#list').datagrid('reload');
} }
}); });
} }
...@@ -300,3 +324,27 @@ function lookRow(index){ ...@@ -300,3 +324,27 @@ function lookRow(index){
//openViewIframRow('listData',"fileGrapView_fileGrapDataTab?tableName="+is_row[0].TABLE_NAME,is_row[0],"爬取数据",true,0.65,0.95,170,0); //openViewIframRow('listData',"fileGrapView_fileGrapDataTab?tableName="+is_row[0].TABLE_NAME,is_row[0],"爬取数据",true,0.65,0.95,170,0);
} }
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=is_row[0].URL
map.FIELD_TASK_ID=is_row[0].TASK_ID
$.ajax({
type:'post',
url:"fileGrapAct_status",
data:map,
success:function(data){
$('#list').datagrid('reload');
}
});
}
\ No newline at end of file
...@@ -53,33 +53,7 @@ function resetQueryData(){ ...@@ -53,33 +53,7 @@ function resetQueryData(){
var ls_module_id='999'; var ls_module_id='999';
//定义当前模块业务类型(YBYW:一般业务,SPGL:审批业务) //定义当前模块业务类型(YBYW:一般业务,SPGL:审批业务)
var ls_ywlx = 'YBYW'; var ls_ywlx = 'YBYW';
/****/
/**
* 序号:2
* 功能:构建下拉框内容
* 参数:
* 说明:方便新增、修改页面里的下拉选项加载数据
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
//var v_standardquery = {};
//var v_standard_tree = standardModel.dataAction.listAllTables(v_reportquery);
/****/
/**
* 序号:3
* 功能:构建主页面列表
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
//定义grid列表 //定义grid列表
var ls_title="抓取数据列表"; var ls_title="抓取数据列表";
var is_column = [ [ var is_column = [ [
...@@ -297,7 +271,6 @@ function refreshRow(){ ...@@ -297,7 +271,6 @@ function refreshRow(){
function searchRow(){ function searchRow(){
var v_query = $("#textbGrapTab_searchForm").getFormVal(); var v_query = $("#textbGrapTab_searchForm").getFormVal();
console.log(v_query);
$('#list').datagrid('load',v_query); $('#list').datagrid('load',v_query);
} }
......
...@@ -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}"/> <input class="easyui-textbox" id="URL" name="FIELD_URL" style="width:300px" value="${is_row.URL}" required="required"/>
</td> </td>
</tr> </tr>
<tr> <tr>
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<span>数据库名称:</span> <span>数据库名称:</span>
</td> </td>
<td style="width: 100%"> <td style="width: 100%">
<input class="easyui-textbox" id="DATABASE_NAME" name="FIELD_DATABASE_NAME" style="width:300px" value="${is_row.DATABASE_NAME}"/> <input class="easyui-textbox" id="DATABASE_NAME" name="FIELD_DATABASE_NAME" style="width:300px" value="${is_row.DATABASE_NAME}" required="required"/>
</td> </td>
</tr> </tr>
<tr> <tr>
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
<span>表名:</span> <span>表名:</span>
</td> </td>
<td style="width: 100%"> <td style="width: 100%">
<input class="easyui-textbox" id="TABLE_NAME" name="FIELD_TABLE_NAME" style="width:300px" value="${is_row.TABLE_NAME}"/> <input class="easyui-textbox" id="TABLE_NAME" name="FIELD_TABLE_NAME" style="width:300px" value="${is_row.TABLE_NAME}" required="required"/>
</td> </td>
</tr> </tr>
</table> </table>
......
...@@ -6,6 +6,7 @@ import java.util.Map; ...@@ -6,6 +6,7 @@ import java.util.Map;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import com.gaowj.business.AllDataBusiness;
import com.gaowj.business.SystemOpeBusiness; import com.gaowj.business.SystemOpeBusiness;
import com.gaowj.business.FileGrapBusiness; import com.gaowj.business.FileGrapBusiness;
import com.gaowj.business.action.BasicAction; import com.gaowj.business.action.BasicAction;
...@@ -65,7 +66,6 @@ public class actAction extends BasicAction{ ...@@ -65,7 +66,6 @@ public class actAction extends BasicAction{
FileGrapBusiness business = BusinessManager.getBusiness(FileGrapBusiness.class); FileGrapBusiness business = BusinessManager.getBusiness(FileGrapBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX); Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try { try {
//去除不要更新的字段 //去除不要更新的字段
entity.remove("OPETYPE"); entity.remove("OPETYPE");
//修改 //修改
...@@ -106,18 +106,42 @@ public class actAction extends BasicAction{ ...@@ -106,18 +106,42 @@ public class actAction extends BasicAction{
} }
public String grap() throws BusinessException{ public String grap() throws BusinessException{
FileGrapBusiness business = BusinessManager.getBusiness(FileGrapBusiness.class);
String url=RequestUtils.getString(request, "url"); Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
String save_path=RequestUtils.getString(request, "save_path");
Map<String, Object> param=new HashMap<String, Object>(); Map<String, Object> param=new HashMap<String, Object>();
param.put("url", url); param.put("url", entity.get("URL"));
param.put("save_path", save_path); param.put("save_path", entity.get("SAVE_PATH"));
com.alibaba.fastjson.JSONObject jsonObject=new com.alibaba.fastjson.JSONObject(param); com.alibaba.fastjson.JSONObject jsObject=new com.alibaba.fastjson.JSONObject(param);
String json=jsonObject.toJSONString(); String json=jsObject.toJSONString();
ResponseBack responseBack=RestUtil.post("http://192.168.1.51:8188/downloadfile",json, "utf-8"); ResponseBack responseBack=RestUtil.post("http://192.168.1.51:8188/downloadfile",json, "utf-8");
String taskid=responseBack.getResponseBody();
entity.put("TASK_ID", taskid);
business.update_fileGrap(entity);
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{
FileGrapBusiness business = BusinessManager.getBusiness(FileGrapBusiness.class);
AllDataBusiness allBusiness=BusinessManager.getBusiness(AllDataBusiness.class);
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
Map<String, Object> param=new HashMap<String, Object>();
param.put("task_id", entity.get("TASK_ID"));
com.alibaba.fastjson.JSONObject jsObject=new com.alibaba.fastjson.JSONObject(param);
String json=jsObject.toJSONString();
ResponseBack responseBack=RestUtil.post("http://192.168.1.51:8188/getstatus",json, "utf-8");
entity.put("STATUS", responseBack.getResponseBody());
if(responseBack.getResponseBody().equals("PENDING")||responseBack.getResponseBody().equals("SUCCESS")){
Map<String, Object> map=new HashMap<String, Object>();
map.put("SAVE_PATH", entity.get("SAVE_PATH"));
int count=allBusiness.listCount_file_attribute(map);
entity.put("RESULT_COUNT", count);
}else{
entity.put("RESULT_COUNT", 0);
}
business.update_fileGrap(entity);
jsonObject.put("responseBody", responseBack.getResponseBody());
return "json";
}
} }
...@@ -111,4 +111,13 @@ public class dataAction extends BasicAction{ ...@@ -111,4 +111,13 @@ public class dataAction extends BasicAction{
} }
return "json"; return "json";
} }
public int listFileCount() throws BusinessException{
AllDataBusiness business=BusinessManager.getBusiness(AllDataBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
String savePath=RequestUtils.getString(request, "SAVE_PATH");
query.put("SAVE_PATH", savePath);
int count=business.listCount_file_attribute(query);
return count;
}
} }
...@@ -111,16 +111,17 @@ public class actAction extends BasicAction{ ...@@ -111,16 +111,17 @@ public class actAction extends BasicAction{
} }
public String grap() throws BusinessException{ public String grap() throws BusinessException{
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
String url=RequestUtils.getString(request, "url"); String url=RequestUtils.getString(request, "url");
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=new HashMap<String, Object>();
param.put("dbname", dbName); param.put("dbname", dbName);
param.put("tablename", tableName); param.put("tablename", tableName);
com.alibaba.fastjson.JSONObject jsonObject=new com.alibaba.fastjson.JSONObject(param); com.alibaba.fastjson.JSONObject jsObject=new com.alibaba.fastjson.JSONObject(param);
String json=jsonObject.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();
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());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment