This commit is contained in:
wangjinlei
2021-04-15 09:35:03 +08:00
parent 11da1a782b
commit 15de0ec6e6
4 changed files with 202 additions and 98 deletions

View File

@@ -43,12 +43,15 @@ class Super extends Controller{
}
public function main() {
$data = $this->request->post();
$start_time = strtotime($data['start']);
$end_time = strtotime($data['end'].' 23:59:59');
$list = $this->journal_obj->where('state',0)->select();
foreach ($list as $k => $v){
$list[$k]['LYL'] = $this->getLYL($v['journal_id']);
$list[$k]['CC'] = $this->getCC($v['journal_id']);
$list[$k]['WS'] = $this->getWS($v['journal_id']);
$list[$k]['SJ'] = $this->getSJ($v['journal_id']);
$list[$k]['LYL'] = $this->getLYL($v['journal_id'],$start_time,$end_time);
$list[$k]['CC'] = $this->getCC($v['journal_id'],$start_time,$end_time);
$list[$k]['WS'] = $this->getWS($v['journal_id'],$start_time,$end_time);
$list[$k]['SJ'] = $this->getSJ($v['journal_id'],$start_time,$end_time);
}
return jsonSuccess($list);
}
@@ -60,13 +63,48 @@ class Super extends Controller{
}
return jsonSuccess($list);
}
/**
* 获取查重文章
*/
public function getCCArticles(){
$data = $this->request->post();
// $data['issn'] = '2522-6371';
// $data['type'] = "low";
// $data['start'] = '2021-01-01';
// $data['end'] = '2021-04-08';
$journal_info = $this->journal_obj->where('issn',$data['issn'])->find();
$where['journal_id'] = $journal_info['journal_id'];
$where['ctime'] = [['>', strtotime($data['start'])],['<', strtotime($data['end'].' 23:59:59')]];
$where['state'] = 5;
if($data['type']=='low'){
$where['repetition'] = ['<=',20];
}elseif($data['type']=='low1'){
$where['repetition'] = [['>',20],['<=',30]];
}elseif($data['type']=='mid'){
$where['repetition'] = [['>',30],['<=',50]];
}else{
$where['repetition'] = ['>',50];
}
$list = $this->article_obj->where($where)->select();
// echo $this->article_obj->getLastSql();
$re['articles'] = $list;
return jsonSuccess($re);
}
/**
* 获取录用率
*/
private function getLYL($journalId){
$res = $this->article_obj->field('state,count(state) as num')->where('journal_id',$journalId)->where('state','in','3,5')->group('state')->select();
private function getLYL($journalId,$start_time,$end_time){
$res = $this->article_obj
->field('state,count(state) as num')
->where('journal_id',$journalId)
->where('ctime','>',$start_time)
->where('ctime','<',$end_time)
->where('state','in','3,5')
->group('state')
->select();
$js = 0;
$jj = 0;
foreach ( $res as $v){
@@ -76,24 +114,29 @@ class Super extends Controller{
$js = $v['num'];
}
}
return $js/($js+$jj);
return $js+$jj==0?0:$js/($js+$jj);
}
/**
* 获取查重异常
*/
private function getCC($journalId){
$res = $this->article_obj->where('journal_id',$journalId)->where('state',5)->select();
private function getCC($journalId,$start_time,$end_time){
$res = $this->article_obj
->where('journal_id',$journalId)
->where('ctime','>=',$start_time)
->where('ctime','<=',$end_time)
->where('state',5)
->select();
$low = 0;
$low1 = 0;
$mid = 0;
$high = 0;
foreach ($res as $v){
if($v['repetition']<20){
if($v['repetition']<=20){
$low++;
}elseif($v['repetition']>=20 && $v['repetition']<30){
}elseif($v['repetition']>20 && $v['repetition']<=30){
$low1++;
}elseif($v['repetition']>=30 && $v['repetition']<50){
}elseif($v['repetition']>30 && $v['repetition']<=50){
$mid++;
}else{
$high++;
@@ -110,8 +153,13 @@ class Super extends Controller{
/**
* 获取外审异常
*/
private function getWS($journalId){
$res = $this->article_obj->where('journal_id',$journalId)->where('state',5)->select();
private function getWS($journalId,$start_time,$end_time){
$res = $this->article_obj
->where('journal_id',$journalId)
->where('state',5)
->where('ctime','>',$start_time)
->where('ctime','<',$end_time)
->select();
$np =0;
foreach ( $res as $v){
$ca = $this->article_reviewer_obj->where('article_id',$v['article_id'])->count();
@@ -128,17 +176,40 @@ class Super extends Controller{
/**
* 获取时间异常
*/
private function getSJ($journalId){
private function getSJ($journalId,$start_time,$end_time){
//文章提交至接收超过48小时
$res['t48'] = $this->article_obj->where('journal_id',$journalId)->where('state',0)->count();
$res['t48'] = $this->article_obj
->where('ctime','>',$start_time)
->where('ctime','<',$end_time)
->where('journal_id',$journalId)
->where('state',0)
->count();
//文章接受时间小于15天
$res['j15'] = $this->article_obj->where('journal_id',$journalId)->where('state',5)->where('rtime','>',0)->where('(rtime-ctime)','<',3600*24*15)->count();
$res['j15'] = $this->article_obj
->where('journal_id',$journalId)
->where('ctime','>',$start_time)
->where('ctime','<',$end_time)
->where('state',5)
->where('rtime','>',0)
->where('(rtime-ctime)','<',3600*24*15)
->count();
//文章接收时间大于120天
$res['j120'] = $this->article_obj->where('journal_id',$journalId)->where('state',5)->where('rtime','>',0)->where('(rtime-ctime)','>',3600*24*120)->count();
$res['j120'] = $this->article_obj
->where('journal_id',$journalId)
->where('state',5)
->where('ctime','>',$start_time)
->where('ctime','<',$end_time)
->where('rtime','>',0)
->where('(rtime-ctime)','>',3600*24*120)
->count();
//with editor时间超过三天预留
//获取全部总数
$res['al'] = $this->article_obj->where('journal_id',$journalId)->count();
$res['al'] = $this->article_obj
->where('journal_id',$journalId)
->where('ctime','>',$start_time)
->where('ctime','<',$end_time)
->count();
return $res;
}