|
@@ -7,15 +7,18 @@ Doo::loadModel('measureaudit');
|
|
|
*
|
|
|
* @author zongheng
|
|
|
*/
|
|
|
-class MeasureauditAct {
|
|
|
+class MeasureauditAct
|
|
|
+{
|
|
|
|
|
|
private $__measureaudit;
|
|
|
|
|
|
- function __construct() {
|
|
|
+ function __construct()
|
|
|
+ {
|
|
|
$this->__measureaudit = new MeasureAudit();
|
|
|
}
|
|
|
|
|
|
- public function insertMeasureAudit($pid, $creatoruid, $auditoruid, $mpid, $pmid, $stid, $numpname, $status = 'uncheck', $last = 2, $times = 0) {
|
|
|
+ public function insertMeasureAudit($pid, $creatoruid, $auditoruid, $mpid, $pmid, $stid, $numpname, $status = 'uncheck', $last = 2, $times = 0)
|
|
|
+ {
|
|
|
if (!isset($pid))
|
|
|
return FALSE;
|
|
|
$this->__measureaudit->pid = filter_var($pid, FILTER_VALIDATE_INT);
|
|
@@ -33,106 +36,129 @@ class MeasureauditAct {
|
|
|
return $this->__measureaudit->insert();
|
|
|
}
|
|
|
|
|
|
- public function getUncheckRow($uid, $status) {
|
|
|
+ public function getUncheckRow($uid, $status)
|
|
|
+ {
|
|
|
return $this->__measureaudit->find(array('where' => 'auditoruid=? and mastatus=?', 'param' => array($uid, $status), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getAllRow($uid) {
|
|
|
+ public function getAllRow($uid)
|
|
|
+ {
|
|
|
return $this->__measureaudit->find(array('where' => 'auditoruid=?', 'param' => array($uid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getAuditProject($uid) {
|
|
|
+ public function getAuditProject($uid)
|
|
|
+ {
|
|
|
return $this->__measureaudit->find(array('where' => 'auditoruid=? and last=2', 'groupby' => 'pid', 'param' => array($uid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getProject($uid) {
|
|
|
+ public function getProject($uid)
|
|
|
+ {
|
|
|
return $this->__measureaudit->find(array('where' => 'auditoruid=?', 'groupby' => 'pmid,numpname', 'param' => array($uid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getUncheckMaxMpid($uid, $pid, $status) {
|
|
|
+ public function getUncheckMaxMpid($uid, $pid, $status)
|
|
|
+ {
|
|
|
return $this->__measureaudit->getOne(array('select' => 'max(mpid) as mpid', 'where' => 'auditoruid=? and pid=? and mastatus=?', 'param' => array($uid, $pid, $status), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function setStatusTrue($mpid) {
|
|
|
+ public function setStatusTrue($mpid)
|
|
|
+ {
|
|
|
$this->__measureaudit->mastatus = 'checked';
|
|
|
return $this->__measureaudit->update(array('where' => 'mpid=?', 'param' => array($mpid)));
|
|
|
}
|
|
|
|
|
|
- public function setStatusFalse($mpid) {
|
|
|
+ public function setStatusFalse($mpid)
|
|
|
+ {
|
|
|
$this->__measureaudit->mastatus = 'checkno';
|
|
|
return $this->__measureaudit->update(array('where' => 'mpid=?', 'param' => array($mpid)));
|
|
|
}
|
|
|
|
|
|
- public function getStatusByMpid($mpid) {
|
|
|
+ public function getStatusByMpid($mpid)
|
|
|
+ {
|
|
|
return $this->__measureaudit->getOne(array('select' => 'mastatus', 'where' => 'mpid=?', 'param' => array($mpid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getRowByMpid($mpid) {
|
|
|
+ public function getRowByMpid($mpid)
|
|
|
+ {
|
|
|
return $this->__measureaudit->find(array('where' => 'mpid=?', 'param' => array($mpid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
// for api
|
|
|
- public function getAlluserMeasureAudit($bid, $num) {
|
|
|
+ public function getAlluserMeasureAudit($bid, $num)
|
|
|
+ {
|
|
|
$maxtimesArray = $this->getMaxTimes($bid, $num);
|
|
|
return $this->__measureaudit->find(array('where' => 'pmid=? and numpname=? and times=? order by last desc,maid asc', 'param' => array($bid, $num, $maxtimesArray['maxtimes']), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
// for api
|
|
|
- public function getAllAudit($bid, $num, $times) {
|
|
|
+ public function getAllAudit($bid, $num, $times)
|
|
|
+ {
|
|
|
return $this->__measureaudit->find(array('where' => 'pmid=? and numpname=? and times=? order by last desc,maid asc', 'param' => array($bid, $num, $times), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getUserAudit($bid, $num, $times = 0) {
|
|
|
+ public function getUserAudit($bid, $num, $times = 0)
|
|
|
+ {
|
|
|
return $this->__measureaudit->find(array('where' => 'pmid=? and numpname=? and times=? order by maid asc', 'param' => array($bid, $num, $times), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getUserAuditLast($bid, $num) {
|
|
|
+ public function getUserAuditLast($bid, $num)
|
|
|
+ {
|
|
|
$maxtimesArray = $this->getMaxTimes($bid, $num);
|
|
|
return $this->__measureaudit->find(array('where' => 'pmid=? and numpname=? and times=? order by maid asc', 'param' => array($bid, $num, $maxtimesArray['maxtimes']), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getRowbyUID($audituid) {
|
|
|
+ public function getRowbyUID($audituid)
|
|
|
+ {
|
|
|
return $this->__measureaudit->find(array('where' => 'auditoruid=?', 'param' => array($audituid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getCheckedRowbyUID($audituid) {
|
|
|
+ public function getCheckedRowbyUID($audituid)
|
|
|
+ {
|
|
|
return $this->__measureaudit->find(array('where' => 'auditoruid=? and ((mastatus=\'uncheck\' or mastatus=\'checking\') or (mastatus=\'checked\' and DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= audittime))', 'param' => array($audituid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getCheckedRowbyUID2($audituid) {
|
|
|
+ public function getCheckedRowbyUID2($audituid)
|
|
|
+ {
|
|
|
return $this->__measureaudit->find(array('where' => '(mastatus=\'checking\') and auditoruid=?', 'groupby' => 'pmid,numpname', 'param' => array($audituid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getMyRecord($audituid) {
|
|
|
+ public function getMyRecord($audituid)
|
|
|
+ {
|
|
|
Doo::db()->connect();
|
|
|
$reArray = Doo::db()->fetchAll('select a.* from jl_measure_audit a inner join (select pmid ,numpname, max(times) times from jl_measure_audit group by pmid,numpname) b on a.pmid = b.pmid and a.numpname = b.numpname and a.times = b.times and (mastatus=\'uncheck\' or mastatus=\'checking\') and auditoruid=? order by a.pmid', array($audituid));
|
|
|
Doo::db()->disconnect();
|
|
|
return $reArray;
|
|
|
}
|
|
|
|
|
|
- public function getMyRecord2($audituid) {
|
|
|
+ public function getMyRecord2($audituid)
|
|
|
+ {
|
|
|
$resArray = Doo::db()->fetchAll('select a.* from jl_measure_audit a inner join (select pmid ,numpname, max(times) times from jl_measure_audit group by pmid,numpname) b on a.pmid = b.pmid and a.numpname = b.numpname and a.times = b.times and auditoruid=? order by a.pmid', array($audituid));
|
|
|
Doo::db()->disconnect();
|
|
|
return $resArray;
|
|
|
}
|
|
|
|
|
|
- public function getMyAllRecord($audituid) {
|
|
|
+ public function getMyAllRecord($audituid)
|
|
|
+ {
|
|
|
return Doo::db()->query('select a.* from jl_measure_audit a inner join (select pmid ,numpname, max(times) times from jl_measure_audit group by pmid,numpname) b on a.pmid = b.pmid and a.numpname = b.numpname and a.times = b.times and auditoruid=? order by a.pmid', array($audituid));
|
|
|
}
|
|
|
|
|
|
- public function getUpUIDStatus($pmid, $numpname, $creatoruid) {
|
|
|
+ public function getUpUIDStatus($pmid, $numpname, $creatoruid)
|
|
|
+ {
|
|
|
return $this->__measureaudit->getOne(array('where' => 'pmid=? AND numpname=? AND auditoruid=?', 'param' => array($pmid, $numpname, $creatoruid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getMyAuditStatus($pmid, $numpname, $times, $uid) {
|
|
|
- return $this->__measureaudit->getOne(array('where' => 'pmid=? AND numpname=? AND times=? AND auditoruid=?', 'param' => array($pmid, $numpname, $times,$uid), 'asArray' => TRUE));
|
|
|
+ public function getMyAuditStatus($pmid, $numpname, $times, $uid)
|
|
|
+ {
|
|
|
+ return $this->__measureaudit->getOne(array('where' => 'pmid=? AND numpname=? AND times=? AND auditoruid=?', 'param' => array($pmid, $numpname, $times, $uid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getFirstAuditor($pmid, $numpname, $times = 0) {
|
|
|
+ public function getFirstAuditor($pmid, $numpname, $times = 0)
|
|
|
+ {
|
|
|
return $this->__measureaudit->getOne(array('where' => 'maid =(select min(maid) from jl_measure_audit where `pmid`=? and `numpname` =? and times=? and last=2)', 'param' => array($pmid, $numpname, $times), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function updateMastatus($maid) {
|
|
|
+ public function updateMastatus($maid)
|
|
|
+ {
|
|
|
$this->__measureaudit->mastatus = 'checking';
|
|
|
$this->__measureaudit->auditcontent = '';
|
|
|
$this->__measureaudit->audittime = '';
|
|
@@ -140,12 +166,14 @@ class MeasureauditAct {
|
|
|
}
|
|
|
|
|
|
// for api
|
|
|
- public function updateAuditorMPID($mpid, $tenderid, $phaseno, $times = 0) {
|
|
|
+ public function updateAuditorMPID($mpid, $tenderid, $phaseno, $times = 0)
|
|
|
+ {
|
|
|
$this->__measureaudit->mpid = $mpid;
|
|
|
return $this->__measureaudit->update(array('where' => 'pmid=? and numpname=? and times=?', 'param' => array($tenderid, $phaseno, $times)));
|
|
|
}
|
|
|
|
|
|
- public function setCheckno($maid, $auditcontent = NULL,$isonline=0) {
|
|
|
+ public function setCheckno($maid, $auditcontent = NULL, $isonline = 0)
|
|
|
+ {
|
|
|
$this->__measureaudit->mastatus = 'checkno';
|
|
|
$this->__measureaudit->audittime = time();
|
|
|
$this->__measureaudit->onlineaudit = $isonline;
|
|
@@ -154,7 +182,8 @@ class MeasureauditAct {
|
|
|
return $this->__measureaudit->update(array('where' => 'maid=?', 'param' => array($maid)));
|
|
|
}
|
|
|
|
|
|
- public function setStatusTo($maid, $status = 3, $auditcontent = '',$isonline=0) {
|
|
|
+ public function setStatusTo($maid, $status = 3, $auditcontent = '', $isonline = 0)
|
|
|
+ {
|
|
|
if ($status == 3) {
|
|
|
$this->__measureaudit->mastatus = 'checked';
|
|
|
}
|
|
@@ -169,66 +198,80 @@ class MeasureauditAct {
|
|
|
return $this->__measureaudit->update(array('where' => 'maid=?', 'param' => array($maid)));
|
|
|
}
|
|
|
|
|
|
- public function getRowInfo($pmid, $numpname, $auditoruid) {
|
|
|
+ public function getRowInfo($pmid, $numpname, $auditoruid)
|
|
|
+ {
|
|
|
return $this->__measureaudit->getOne(array('where' => 'pmid=? and numpname=? and auditoruid=?', 'desc' => 'times', 'param' => array($pmid, $numpname, $auditoruid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
// for api
|
|
|
- public function getLastNewRowInfo($pmid, $numpname, $auditoruid) {
|
|
|
+ public function getLastNewRowInfo($pmid, $numpname, $auditoruid)
|
|
|
+ {
|
|
|
$maxtimesArray = $this->getMaxTimes($pmid, $numpname);
|
|
|
return $this->__measureaudit->getOne(array('where' => 'pmid=? and numpname=? and auditoruid=? and times=?', 'param' => array($pmid, $numpname, $auditoruid, $maxtimesArray['maxtimes']), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getStatusTender($pmid, $numpname) {
|
|
|
+ public function getStatusTender($pmid, $numpname)
|
|
|
+ {
|
|
|
return $this->__measureaudit->getOne(array('where' => 'pmid=? and numpname=? and last=1', 'param' => array($pmid, $numpname), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getStatusTen($pmid, $numpname) {
|
|
|
+ public function getStatusTen($pmid, $numpname)
|
|
|
+ {
|
|
|
return $this->__measureaudit->find(array('where' => 'pmid=? and numpname=?', 'param' => array($pmid, $numpname), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getAuditUser($bid, $num) {
|
|
|
+ public function getAuditUser($bid, $num)
|
|
|
+ {
|
|
|
return $this->__measureaudit->find(array('where' => 'pmid=? and numpname=? order by last desc,maid asc', 'param' => array($bid, $num), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
// 去重复
|
|
|
- public function getAuditUserRedo($bid, $num) {
|
|
|
+ public function getAuditUserRedo($bid, $num)
|
|
|
+ {
|
|
|
$maxtimesArray = $this->getMaxTimes($bid, $num);
|
|
|
return $this->__measureaudit->find(array('where' => 'pmid=? and numpname=? and times=? order by last desc,maid asc', 'param' => array($bid, $num, $maxtimesArray['maxtimes']), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
// 去重复
|
|
|
- public function getMaxTimes($bid, $num) {
|
|
|
+ public function getMaxTimes($bid, $num)
|
|
|
+ {
|
|
|
return $this->__measureaudit->getOne(array('select' => 'max(times) as maxtimes', 'where' => 'pmid=? and numpname=?', 'param' => array($bid, $num), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getMaxTimesInt($bid, $num) {
|
|
|
+ public function getMaxTimesInt($bid, $num)
|
|
|
+ {
|
|
|
return $this->__measureaudit->getOne(array('select' => 'max(times) as maxtimes', 'where' => 'pmid=? and numpname=?', 'param' => array($bid, $num), 'asArray' => TRUE))['maxtimes'];
|
|
|
}
|
|
|
|
|
|
- public function delAuditUser($tenderid, $phaseno, $uid) {
|
|
|
+ public function delAuditUser($tenderid, $phaseno, $uid)
|
|
|
+ {
|
|
|
return $this->__measureaudit->delete(array('where' => 'pmid=? and numpname=? and auditoruid=?', 'param' => array($tenderid, $phaseno, $uid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function delAuditUserTimes($tenderid, $phaseno, $uid, $times = 0) {
|
|
|
+ public function delAuditUserTimes($tenderid, $phaseno, $uid, $times = 0)
|
|
|
+ {
|
|
|
return $this->__measureaudit->delete(array('where' => 'pmid=? and numpname=? and auditoruid=? and times=?', 'param' => array($tenderid, $phaseno, $uid, $times), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getCurrUserAllProject($audituid) {
|
|
|
+ public function getCurrUserAllProject($audituid)
|
|
|
+ {
|
|
|
return $this->__measureaudit->find(array('where' => 'auditoruid=?', 'param' => array($audituid), 'desc' => 'numpname,times', 'groupby' => 'pmid', 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
// for API 获取用户参与PMID组
|
|
|
- public function getPmidGroup($audituid) {
|
|
|
+ public function getPmidGroup($audituid)
|
|
|
+ {
|
|
|
return $this->__measureaudit->find(array('where' => 'auditoruid=?', 'param' => array($audituid), 'groupby' => 'pmid', 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
// for API 根据pmid,审核人id 获取最新一期最新一次记录
|
|
|
- public function getLastNumTimes($pmid, $audituid) {
|
|
|
+ public function getLastNumTimes($pmid, $audituid)
|
|
|
+ {
|
|
|
return $this->__measureaudit->getOne(array('where' => 'auditoruid=? and pmid=?', 'desc' => 'maid', 'param' => array($audituid, $pmid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getUserPmid($audituid) {
|
|
|
+ public function getUserPmid($audituid)
|
|
|
+ {
|
|
|
return $this->__measureaudit->find(array('select' => 'pmid', 'where' => 'auditoruid=?', 'param' => array($audituid), 'groupby' => 'pmid', 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
@@ -239,9 +282,27 @@ class MeasureauditAct {
|
|
|
* @return type
|
|
|
* 最新一次的
|
|
|
*/
|
|
|
- public function getAuditOpinion($tenderid, $phaseno) {
|
|
|
+ public function getAuditOpinion($tenderid, $phaseno)
|
|
|
+ {
|
|
|
$maxtimesArray = $this->getMaxTimes($tenderid, $phaseno);
|
|
|
return $this->__measureaudit->find(array('select' => 'auditoruid,auditcontent', 'where' => 'pmid=? and numpname=? and times=?', 'param' => array($tenderid, $phaseno, $maxtimesArray['maxtimes']), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
+ public function getMyChecking($pid, $auditoruid, $all = false)
|
|
|
+ {
|
|
|
+ if ($all) {
|
|
|
+ return $this->__measureaudit->find(array('where' => 'pid=? and auditoruid=? and mastatus=\'checking\'', 'param' => array($pid, $auditoruid), 'asArray' => TRUE));
|
|
|
+ } else {
|
|
|
+ return $this->__measureaudit->getOne(array('where' => 'pid=? and auditoruid=? and mastatus=\'checking\'', 'param' => array($pid, $auditoruid), 'asArray' => TRUE));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getCountMyChecking($pid, $auditoruid)
|
|
|
+ {
|
|
|
+
|
|
|
+ return $this->__measureaudit->count(array('where' => 'pid=? and auditoruid=? and mastatus=\'checking\'', 'param' => array($pid, $auditoruid)));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|