#506, 实现问题数据的检查;优化数据恢复的SQL,提升相应速度
This commit is contained in:
parent
ae389ecc7c
commit
25a24e2e1b
|
@ -424,10 +424,11 @@ class Admin_SysController extends Zend_Controller_Action
|
||||||
if ($ac=='' || $ac=='online')
|
if ($ac=='' || $ac=='online')
|
||||||
{
|
{
|
||||||
$sql = "SELECT m.title,m.uuid,ds.host,ds.path,
|
$sql = "SELECT m.title,m.uuid,ds.host,ds.path,
|
||||||
(select floor(sum(filesize)/1024/1024*100)/100 from datafile where dsid=ds.id) as filesize,
|
floor(t.filesize/1024/1024*100)/100 as filesize,
|
||||||
(select count(id) from datafile where dsid=ds.id) as filecount from metadata m
|
t.filecount from metadata m
|
||||||
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
||||||
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
||||||
|
left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid
|
||||||
where s.status>4 and m.datatype=0 and ds.host='ftp1.westgis.ac.cn'
|
where s.status>4 and m.datatype=0 and ds.host='ftp1.westgis.ac.cn'
|
||||||
ORDER BY m.id DESC";
|
ORDER BY m.id DESC";
|
||||||
$sth = $this->db->prepare($sql);
|
$sth = $this->db->prepare($sql);
|
||||||
|
@ -443,10 +444,11 @@ class Admin_SysController extends Zend_Controller_Action
|
||||||
} else if ($ac=='heihe')
|
} else if ($ac=='heihe')
|
||||||
{
|
{
|
||||||
$sql = "SELECT m.title,m.uuid,ds.host,ds.path,
|
$sql = "SELECT m.title,m.uuid,ds.host,ds.path,
|
||||||
(select floor(sum(filesize)/1024/1024*100)/100 from datafile where dsid=ds.id) as filesize,
|
floor(t.filesize/1024/1024*100)/100 as filesize,
|
||||||
(select count(id) from datafile where dsid=ds.id) as filecount from metadata m
|
t.filecount from metadata m
|
||||||
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
||||||
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
||||||
|
left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid
|
||||||
left join datasource on datasource.uuid=m.uuid
|
left join datasource on datasource.uuid=m.uuid
|
||||||
left join source on datasource.sourceid=source.id
|
left join source on datasource.sourceid=source.id
|
||||||
where s.status>4 and m.datatype=1 and ds.host='ftp1.westgis.ac.cn' and source.code='heihe'
|
where s.status>4 and m.datatype=1 and ds.host='ftp1.westgis.ac.cn' and source.code='heihe'
|
||||||
|
@ -463,16 +465,15 @@ class Admin_SysController extends Zend_Controller_Action
|
||||||
$this->view->paginator=$paginator;
|
$this->view->paginator=$paginator;
|
||||||
} else if ($ac=='water')
|
} else if ($ac=='water')
|
||||||
{
|
{
|
||||||
$sql = "SELECT m.title,m.uuid,ds.host,ds.path,
|
$sql = "SELECT m.title,m.uuid,ds.host,ds.path,
|
||||||
floor(sum(datafile.filesize)/1024/1024*100)/100 as filesize,
|
floor(t.filesize/1024/1024*100)/100 as filesize,
|
||||||
count(datafile.id) as filecount from metadata m
|
t.filecount from metadata m
|
||||||
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
||||||
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
||||||
left join datafile on ds.id=datafile.dsid
|
left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid
|
||||||
left join datasource on datasource.uuid=m.uuid
|
left join datasource on datasource.uuid=m.uuid
|
||||||
left join source on datasource.sourceid=source.id
|
left join source on datasource.sourceid=source.id
|
||||||
where s.status>4 and m.datatype=1 and ds.host='ftp1.westgis.ac.cn' and source.code='water'
|
where s.status>4 and m.datatype=1 and ds.host='ftp1.westgis.ac.cn' and source.code='water'
|
||||||
group by m.title,m.uuid,ds.host,ds.path
|
|
||||||
ORDER BY m.title DESC";
|
ORDER BY m.title DESC";
|
||||||
$sth = $this->db->prepare($sql);
|
$sth = $this->db->prepare($sql);
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
|
@ -487,15 +488,14 @@ class Admin_SysController extends Zend_Controller_Action
|
||||||
} else if ($ac=='heihe1')
|
} else if ($ac=='heihe1')
|
||||||
{
|
{
|
||||||
$sql = "SELECT m.title,m.uuid,ds.host,ds.path,
|
$sql = "SELECT m.title,m.uuid,ds.host,ds.path,
|
||||||
floor(sum(datafile.filesize)/1024/1024*100)/100 as filesize,
|
floor(t.filesize/1024/1024*100)/100 as filesize,
|
||||||
count(datafile.id) as filecount from metadata m
|
t.filecount from metadata m
|
||||||
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
||||||
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
||||||
left join datasource on datasource.uuid=m.uuid
|
left join datasource on datasource.uuid=m.uuid
|
||||||
left join datafile on ds.id=datafile.dsid
|
left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid
|
||||||
left join source on datasource.sourceid=source.id
|
left join source on datasource.sourceid=source.id
|
||||||
where s.status in (2,3,4) and ds.host='ftp1.westgis.ac.cn' and source.code='heihe'
|
where s.status in (2,3,4) and ds.host='ftp1.westgis.ac.cn' and source.code='heihe'
|
||||||
group by m.title,m.uuid,ds.host,ds.path
|
|
||||||
ORDER BY m.title DESC";
|
ORDER BY m.title DESC";
|
||||||
$sth = $this->db->prepare($sql);
|
$sth = $this->db->prepare($sql);
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
|
@ -510,10 +510,11 @@ class Admin_SysController extends Zend_Controller_Action
|
||||||
} else if ($ac=='hiwater')
|
} else if ($ac=='hiwater')
|
||||||
{
|
{
|
||||||
$sql = "SELECT m.title,m.uuid,ds.host,ds.path,
|
$sql = "SELECT m.title,m.uuid,ds.host,ds.path,
|
||||||
(select floor(sum(filesize)/1024/1024*100)/100 from datafile where dsid=ds.id) as filesize,
|
floor(t.filesize/1024/1024*100)/100 as filesize,
|
||||||
(select count(id) from datafile where dsid=ds.id) as filecount from metadata m
|
t.filecount from metadata m
|
||||||
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
||||||
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
||||||
|
left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid
|
||||||
left join datasource on datasource.uuid=m.uuid
|
left join datasource on datasource.uuid=m.uuid
|
||||||
left join source on datasource.sourceid=source.id
|
left join source on datasource.sourceid=source.id
|
||||||
where ds.host='ftp1.westgis.ac.cn' and source.code='hiwater'
|
where ds.host='ftp1.westgis.ac.cn' and source.code='hiwater'
|
||||||
|
@ -531,10 +532,11 @@ class Admin_SysController extends Zend_Controller_Action
|
||||||
}else if ($ac=='westee')
|
}else if ($ac=='westee')
|
||||||
{
|
{
|
||||||
$sql = "SELECT m.title,m.uuid,ds.host,ds.path,
|
$sql = "SELECT m.title,m.uuid,ds.host,ds.path,
|
||||||
(select floor(sum(filesize)/1024/1024*100)/100 from datafile where dsid=ds.id) as filesize,
|
floor(t.filesize/1024/1024*100)/100 as filesize,
|
||||||
(select count(id) from datafile where dsid=ds.id) as filecount from metadata m
|
t.filecount from metadata m
|
||||||
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
||||||
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
||||||
|
left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid
|
||||||
where ds.host='ftp1.westgis.ac.cn' and m.uuid in (select uuid from westeemd)
|
where ds.host='ftp1.westgis.ac.cn' and m.uuid in (select uuid from westeemd)
|
||||||
ORDER BY m.title DESC";
|
ORDER BY m.title DESC";
|
||||||
$sth = $this->db->prepare($sql);
|
$sth = $this->db->prepare($sql);
|
||||||
|
@ -550,10 +552,11 @@ class Admin_SysController extends Zend_Controller_Action
|
||||||
}else if ($ac=='other')
|
}else if ($ac=='other')
|
||||||
{
|
{
|
||||||
$sql = "SELECT m.title,m.uuid,ds.host,ds.path,
|
$sql = "SELECT m.title,m.uuid,ds.host,ds.path,
|
||||||
(select floor(sum(filesize)/1024/1024*100)/100 from datafile where dsid=ds.id) as filesize,
|
floor(t.filesize/1024/1024*100)/100 as filesize,
|
||||||
(select count(id) from datafile where dsid=ds.id) as filecount from metadata m
|
t.filecount from metadata m
|
||||||
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
||||||
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
||||||
|
left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid
|
||||||
where ds.host='ftp1.westgis.ac.cn' and m.uuid not in (select uuid from datasource) and m.uuid not in (select uuid from westeemd)
|
where ds.host='ftp1.westgis.ac.cn' and m.uuid not in (select uuid from datasource) and m.uuid not in (select uuid from westeemd)
|
||||||
ORDER BY m.title DESC";
|
ORDER BY m.title DESC";
|
||||||
$sth = $this->db->prepare($sql);
|
$sth = $this->db->prepare($sql);
|
||||||
|
@ -569,6 +572,75 @@ class Admin_SysController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
$this->view->activeID="btn-".$ac;
|
$this->view->activeID="btn-".$ac;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function problemAction()
|
||||||
|
{
|
||||||
|
$pages=20;
|
||||||
|
$ac=$this->_request->getParam('ac');
|
||||||
|
if ($ac=='' || $ac=='ref')
|
||||||
|
{
|
||||||
|
$sql = "SELECT m.title,m.uuid,m.citation,g.id as gid from metadata m
|
||||||
|
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
||||||
|
left join geonetworkmetadata g on g.uuid=m.uuid
|
||||||
|
where s.status>4 and m.citation like '%??%'
|
||||||
|
ORDER BY m.id DESC";
|
||||||
|
$sth = $this->db->prepare($sql);
|
||||||
|
$sth->execute();
|
||||||
|
$rows = $sth->fetchAll();
|
||||||
|
|
||||||
|
$paginator = Zend_Paginator::factory($rows);
|
||||||
|
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
||||||
|
$paginator->setItemCountPerPage($pages);
|
||||||
|
$paginator->setView($this->view);
|
||||||
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
|
||||||
|
$this->view->paginator=$paginator;
|
||||||
|
$this->_helper->viewRenderer('problem-ref');
|
||||||
|
$ac='ref';
|
||||||
|
} else if ($ac=='file')
|
||||||
|
{
|
||||||
|
$sql = "SELECT m.title,m.uuid,m.filesize,ds.host,ds.path from metadata m
|
||||||
|
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
||||||
|
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
||||||
|
where s.status>4 and ds.id not in (select distinct dsid from datafile)
|
||||||
|
group by m.title,m.uuid,ds.host,ds.path,m.filesize
|
||||||
|
ORDER BY m.title DESC;";
|
||||||
|
$sth = $this->db->prepare($sql);
|
||||||
|
$sth->execute();
|
||||||
|
$rows = $sth->fetchAll();
|
||||||
|
|
||||||
|
$paginator = Zend_Paginator::factory($rows);
|
||||||
|
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
||||||
|
$paginator->setItemCountPerPage($pages);
|
||||||
|
$paginator->setView($this->view);
|
||||||
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
|
||||||
|
$this->view->paginator=$paginator;
|
||||||
|
} else if ($ac=='tiny')
|
||||||
|
{
|
||||||
|
$sql = "SELECT m.title,m.uuid,ds.host,ds.path,
|
||||||
|
floor(sum(datafile.filesize)/1024/1024*100)/100 as filesize,
|
||||||
|
count(datafile.id) as filecount
|
||||||
|
from metadata m
|
||||||
|
LEFT JOIN mdstatus s ON m.uuid=s.uuid
|
||||||
|
LEFT JOIN dataset ds ON m.uuid=ds.uuid
|
||||||
|
left join datasource on datasource.uuid=m.uuid
|
||||||
|
left join datafile on ds.id=datafile.dsid
|
||||||
|
left join source on datasource.sourceid=source.id
|
||||||
|
where s.status>4 and ds.id in (select t.dsid from (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t
|
||||||
|
where t.filesize<1024*5)
|
||||||
|
group by m.title,m.uuid,ds.host,ds.path
|
||||||
|
ORDER BY m.title DESC;";
|
||||||
|
$sth = $this->db->prepare($sql);
|
||||||
|
$sth->execute();
|
||||||
|
$rows = $sth->fetchAll();
|
||||||
|
|
||||||
|
$paginator = Zend_Paginator::factory($rows);
|
||||||
|
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
||||||
|
$paginator->setItemCountPerPage($pages);
|
||||||
|
$paginator->setView($this->view);
|
||||||
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
|
||||||
|
$this->view->paginator=$paginator;
|
||||||
|
}
|
||||||
|
$this->view->activeID="btn-".$ac;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
<!--<li><a href="/admin/sys/seekspace">文献平台同步</a></li>-->
|
<!--<li><a href="/admin/sys/seekspace">文献平台同步</a></li>-->
|
||||||
<li><a href="/admin/sys/message">管理消息</a></li>
|
<li><a href="/admin/sys/message">管理消息</a></li>
|
||||||
<li><a href="/admin/sys/ftptest">数据FTP测试</a></li>
|
<li><a href="/admin/sys/ftptest">数据FTP测试</a></li>
|
||||||
<li><a href="/admin/sys/recovery">数据恢复进展</a></li>
|
<li><a href="/admin/sys/recovery">数据恢复进展</a></li>
|
||||||
|
<li><a href="/admin/sys/problem">问题数据检查</a></li>
|
||||||
<li><a href="/admin/sys/regions">GN地点管理</a></li>
|
<li><a href="/admin/sys/regions">GN地点管理</a></li>
|
||||||
</ul>
|
</ul>
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
$this->headTitle($this->config->title->site);
|
||||||
|
$this->headTitle('后台管理');
|
||||||
|
$this->headTitle()->setSeparator(' - ');
|
||||||
|
$this->headLink()->appendStylesheet('/css/admin.css');
|
||||||
|
$this->theme->AppendPlus($this,'colorbox');
|
||||||
|
?>
|
||||||
|
<div id="leftPanel">
|
||||||
|
<?= $this->partial('sys/left.phtml'); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="rightPanel">
|
||||||
|
<a id="btn-ref" class="btn" href="/admin/sys/problem/ac/ref">数据引用方式错误</a>
|
||||||
|
<a id="btn-file" class="btn" href="/admin/sys/problem/ac/file">缺少文件列表</a>
|
||||||
|
<a id="btn-tiny" class="btn" href="/admin/sys/problem/ac/tiny">数据实体大小不匹配</a>
|
||||||
|
|
||||||
|
<table><thead><tr>
|
||||||
|
<th>数据标题</th>
|
||||||
|
<th>引用</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr></thead><tbody>
|
||||||
|
<?php
|
||||||
|
if (count($this->paginator)):
|
||||||
|
$autoindex=0;
|
||||||
|
foreach ($this->paginator as $item):
|
||||||
|
$autoindex++;?>
|
||||||
|
<tr class="<?php if($autoindex%2 == 0) echo 'even'; else echo 'odd'; ?>">
|
||||||
|
<td><a href="/data/<?php echo $item['uuid'];?>"><?php echo $item['title'];?></a></td>
|
||||||
|
<td><?php echo $item['citation'];?></td>
|
||||||
|
<td><a href="/service/geonetwork?url=metadata.edit?id=<?= $item['gid']; ?>" target="_blank">编辑</a></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; endif; ?>
|
||||||
|
</tbody></table>
|
||||||
|
<div class="pagenavi"><?= $this->paginator; ?></div>
|
||||||
|
</div>
|
||||||
|
<?php if(!empty($this->activeID)) : ?>
|
||||||
|
<script>$('#<?= $this->activeID?>').addClass("btn-primary");</script>
|
||||||
|
<?php endif; ?>
|
||||||
|
<script>
|
||||||
|
$(".iframe").colorbox({iframe:true, width:"50%", height:"50%"});
|
||||||
|
$(".inline").colorbox({inline:true, width:"50%"});
|
||||||
|
function Alert(html){
|
||||||
|
$.colorbox({'innerWidth':'50%','html':'<h4 style="font-size:16px;font-weight:bold;">'+html+'</h4>'});
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
$this->headTitle($this->config->title->site);
|
||||||
|
$this->headTitle('后台管理');
|
||||||
|
$this->headTitle()->setSeparator(' - ');
|
||||||
|
$this->headLink()->appendStylesheet('/css/admin.css');
|
||||||
|
$this->theme->AppendPlus($this,'colorbox');
|
||||||
|
?>
|
||||||
|
<div id="leftPanel">
|
||||||
|
<?= $this->partial('sys/left.phtml'); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="rightPanel">
|
||||||
|
<a id="btn-ref" class="btn" href="/admin/sys/problem/ac/ref">数据引用方式错误</a>
|
||||||
|
<a id="btn-file" class="btn" href="/admin/sys/problem/ac/file">缺少文件列表</a>
|
||||||
|
<a id="btn-tiny" class="btn" href="/admin/sys/problem/ac/tiny">数据实体过小</a>
|
||||||
|
<table><thead><tr>
|
||||||
|
<th>数据标题</th>
|
||||||
|
<th>UUID</th>
|
||||||
|
<th>FTP主机</th>
|
||||||
|
<th>路径</th>
|
||||||
|
<th>大小</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr></thead><tbody>
|
||||||
|
<?php
|
||||||
|
if (count($this->paginator)):
|
||||||
|
$autoindex=0;
|
||||||
|
foreach ($this->paginator as $item):
|
||||||
|
$autoindex++;?>
|
||||||
|
<tr class="<?php if($autoindex%2 == 0) echo 'even'; else echo 'odd'; ?>">
|
||||||
|
<td><a href="/data/<?php echo $item['uuid'];?>"><?php echo $item['title'];?></a></td>
|
||||||
|
<td><?php echo $item['uuid'];?></td>
|
||||||
|
<td><?php echo $item['host'];?></td>
|
||||||
|
<td><?php echo $item['path'];?></td>
|
||||||
|
<td><?php echo $item['filesize'];?></td>
|
||||||
|
<td><a href="/admin/data/dataset/ac/getdataset/uuid/<?php echo $item['uuid'];?>" class="iframe">数据路径</a></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; endif; ?>
|
||||||
|
</tbody></table>
|
||||||
|
<div class="pagenavi"><?= $this->paginator; ?></div>
|
||||||
|
</div>
|
||||||
|
<?php if(!empty($this->activeID)) : ?>
|
||||||
|
<script>$('#<?= $this->activeID?>').addClass("btn-primary");</script>
|
||||||
|
<?php endif; ?>
|
||||||
|
<script>
|
||||||
|
$(".iframe").colorbox({iframe:true, width:"50%", height:"50%"});
|
||||||
|
$(".inline").colorbox({inline:true, width:"50%"});
|
||||||
|
function Alert(html){
|
||||||
|
$.colorbox({'innerWidth':'50%','html':'<h4 style="font-size:16px;font-weight:bold;">'+html+'</h4>'});
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Reference in New Issue