Browse Source

计量支付
在线审批
禅道1004

NoNZero 9 năm trước cách đây
mục cha
commit
dd376a1093

+ 77 - 44
protected/class/attfile.php

@@ -2,102 +2,135 @@
 
 Doo::loadModel('fileup');
 
-class attFile {
+class attFile
+{
 
     private $__file;
 
-    function __construct() {
-	$this->__file = new fileup();
+    function __construct()
+    {
+        $this->__file = new fileup();
     }
 
-    public function insertFile($pid, $stid, $mpid, $pmid, $numpname, $auditoruid, $filepath, $ziphashcode = 0, $filehashcode = 0, $times = 0) {
-	return $this->__file->createFile($pid, $stid, $mpid, $pmid, $numpname, $auditoruid, $filepath, $ziphashcode = 0, $filehashcode, 2, $times);
+    public function insertFile($pid, $stid, $mpid, $pmid, $numpname, $auditoruid, $filepath, $ziphashcode = 0, $filehashcode = 0, $times = 0)
+    {
+        return $this->__file->createFile($pid, $stid, $mpid, $pmid, $numpname, $auditoruid, $filepath, $ziphashcode = 0, $filehashcode, 2, $times);
     }
 
-    public function getMaxRow() {
-	return $this->__file->getOne(array('where' => 'aid = (select max(aid)) order by aid desc', 'asArray' => TRUE));
+    public function getMaxRow()
+    {
+        return $this->__file->getOne(array('where' => 'aid = (select max(aid)) order by aid desc', 'asArray' => TRUE));
     }
 
-    public function getDownUrl($mpid) {
-	return $this->__file->getOne(array('where' => 'mpid=?', 'param' => array($mpid), 'asArray' => TRUE));
+    public function getDownUrl($mpid)
+    {
+        return $this->__file->getOne(array('where' => 'mpid=?', 'param' => array($mpid), 'asArray' => TRUE));
     }
 
-    public function getNewLast($pmid, $numpname, $times = 0) {
-	return $this->__file->getOne(array('where' => 'pmid=? and numpname=? and times=?  and isnew=2', 'param' => array($pmid, $numpname, $times), 'asArray' => TRUE));
+    public function getNewLast($pmid, $numpname, $times = 0)
+    {
+        return $this->__file->getOne(array('where' => 'pmid=? and numpname=? and times=?  and isnew=2', 'param' => array($pmid, $numpname, $times), 'asArray' => TRUE));
     }
 
-    public function getNewLast3($pmid, $numpname, $times = 0) {
-	return $this->__file->getOne(array('where' => 'pmid=? and numpname=? and times=?  and isnew=2', 'param' => array($pmid, $numpname, $times), 'asArray' => TRUE));
+    public function getNewLast3($pmid, $numpname, $times = 0)
+    {
+        return $this->__file->getOne(array('where' => 'pmid=? and numpname=? and times=?  and isnew=2', 'param' => array($pmid, $numpname, $times), 'asArray' => TRUE));
     }
 
-    public function getMeasureLastNew($pmid, $numpname) {
-	return $this->__file->getOne(array('where' => 'pmid=? and numpname=? and isnew=2', 'param' => array($pmid, $numpname), 'desc' => 'times', 'asArray' => TRUE));
+    public function getMeasureLastNew($pmid, $numpname)
+    {
+        return $this->__file->getOne(array('where' => 'pmid=? and numpname=? and isnew=2', 'param' => array($pmid, $numpname), 'desc' => 'times', 'asArray' => TRUE));
     }
 
-    public function getNewLast2($pmid, $numpname) {
-	return $this->__file->getOne(array('where' => 'stid=? and isnew=2', 'param' => array($pmid, $numpname), 'groupby' => 'numpname', 'asArray' => TRUE));
+    public function getNewLast2($pmid, $numpname)
+    {
+        return $this->__file->getOne(array('where' => 'stid=? and isnew=2', 'param' => array($pmid, $numpname), 'groupby' => 'numpname', 'asArray' => TRUE));
     }
 
-    public function getFirstFile($pmid, $numpname, $times = 0) {
-	return $this->__file->getOne(array('where' => 'pmid=? and numpname=? and times=?  and isnew=1', 'orderby' => 'aid', 'param' => array($pmid, $numpname, $times), 'asArray' => TRUE));
+    public function getFirstFile($pmid, $numpname, $times = 0)
+    {
+        return $this->__file->getOne(array('where' => 'pmid=? and numpname=? and times=?  and isnew=1', 'orderby' => 'aid', 'param' => array($pmid, $numpname, $times), 'asArray' => TRUE));
     }
 
-    public function getLastData($stid) {
-	return $this->__file->find(array('where' => 'stid=? and isnew=2', 'param' => array($stid), 'groupby' => 'pmid', 'asArray' => TRUE));
+    public function getLastData($stid)
+    {
+        return $this->__file->find(array('where' => 'stid=? and isnew=2', 'param' => array($stid), 'groupby' => 'pmid', 'asArray' => TRUE));
     }
 
-    public function getFileUpdate($pmid) {
-	return $this->__file->getOne(array('where' => 'aid=(SELECT max(aid) FROM jl_attachment where pmid=? and isnew=2)', 'desc' => 'aid', 'param' => array($pmid), 'asArray' => TRUE));
+    public function getFileUpdate($pmid)
+    {
+        return $this->__file->getOne(array('where' => 'aid=(SELECT max(aid) FROM jl_attachment where pmid=? and isnew=2)', 'desc' => 'aid', 'param' => array($pmid), 'asArray' => TRUE));
 //	return $this->__file->getOne(array('where' => 'numpname=(SELECT max(numpname) FROM jl_attachment pmid=?) and isnew=2', 'param' => array($pmid), 'asArray' => TRUE));
     }
 
-    public function getLastNewProfile($pmid) {
-	return $this->__file->getOne(array('where' => 'pmid=? and isnew=2', 'groupby' => 'numpname', 'desc' => 'numpname', 'param' => array($pmid), 'asArray' => TRUE));
+    public function getLastNewProfile($pmid)
+    {
+        return $this->__file->getOne(array('where' => 'pmid=? and isnew=2', 'groupby' => 'numpname', 'desc' => 'numpname', 'param' => array($pmid), 'asArray' => TRUE));
     }
 
-    public function getLastNewProfile2($pmid) {
-	return $this->__file->getOne(array('where' => 'pmid=? and isnew=2', 'groupby' => 'pmid,numpname,times', 'desc' => 'aid', 'param' => array($pmid), 'asArray' => TRUE));
+    public function getLastNewProfile2($pmid)
+    {
+        return $this->__file->getOne(array('where' => 'pmid=? and isnew=2', 'groupby' => 'pmid,numpname,times', 'desc' => 'aid', 'param' => array($pmid), 'asArray' => TRUE));
     }
 
-    public function getLastNewProfileUnlock($pmid, $numpname, $times) {
-	return $this->__file->getOne(array('where' => 'pmid=? and numpname=? and times=? and isnew=1', 'groupby' => 'numpname', 'desc' => 'times', 'param' => array($pmid, $numpname, $times), 'asArray' => TRUE));
+    public function getLastNewProfileUnlock($pmid, $numpname, $times)
+    {
+        return $this->__file->getOne(array('where' => 'pmid=? and numpname=? and times=? and isnew=1', 'groupby' => 'numpname', 'desc' => 'times', 'param' => array($pmid, $numpname, $times), 'asArray' => TRUE));
     }
 
-    public function getLastNewProfileUnlock2($pmid, $numpname) {
+    public function getLastNewProfileUnlock2($pmid, $numpname)
+    {
         return $this->__file->getOne(array('where' => 'pmid=? and numpname=? and isnew=2', 'desc' => 'times', 'param' => array($pmid, $numpname), 'asArray' => TRUE));
     }
 
+    public function getLastNewProfileUnlock3($pmid, $numpname, $times)
+    {
+        return $this->__file->getOne(array('where' => 'pmid=? and numpname=? and times=? and isnew=1', 'desc' => 'times', 'param' => array($pmid, $numpname, $times), 'asArray' => TRUE));
+    }
+
+    public function getReportFile($pmid, $numpname, $times)
+    {
+        return $this->__file->getOne(array('where' => 'pmid=? and numpname=? and times=?', 'asc' => 'aid', 'param' => array($pmid, $numpname, $times), 'asArray' => TRUE));
+    }
+
 // for api
-    public function getAllRowPid($pid) {
-	return $this->__file->find(array('where' => 'pid=? and isnew=2', 'groupby' => 'pmid,numpname', 'desc' => 'times', 'param' => array($pid), 'asArray' => TRUE));
+    public function getAllRowPid($pid)
+    {
+        return $this->__file->find(array('where' => 'pid=? and isnew=2', 'groupby' => 'pmid,numpname', 'desc' => 'times', 'param' => array($pid), 'asArray' => TRUE));
     }
 
     //  for API 根据PID分组pmid
-    public function getPmidGroup($pid) {
-	return $this->__file->find(array('where' => 'pid=? and isnew=2', 'groupby' => 'pmid', 'param' => array($pid), 'asArray' => TRUE));
+    public function getPmidGroup($pid)
+    {
+        return $this->__file->find(array('where' => 'pid=? and isnew=2', 'groupby' => 'pmid', 'param' => array($pid), 'asArray' => TRUE));
     }
 
     // for API 根据pmid,审核人id 获取最新一期最新一次记录
-    public function getLastNumTimes($pmid) {
-	return $this->__file->getOne(array('where' => 'pmid=? and isnew=2', 'desc' => 'aid', 'param' => array($pmid), 'asArray' => TRUE));
+    public function getLastNumTimes($pmid)
+    {
+        return $this->__file->getOne(array('where' => 'pmid=? and isnew=2', 'desc' => 'aid', 'param' => array($pmid), 'asArray' => TRUE));
     }
 
     // 去重复
-    public function getMaxTimes($bid, $num) {
-	return $this->__file->getOne(array('select' => 'max(times) as maxtimes', 'where' => 'pmid=? and numpname=?', 'param' => array($bid, $num), 'asArray' => TRUE));
+    public function getMaxTimes($bid, $num)
+    {
+        return $this->__file->getOne(array('select' => 'max(times) as maxtimes', 'where' => 'pmid=? and numpname=?', 'param' => array($bid, $num), 'asArray' => TRUE));
     }
 
     // 去重复
-    public function getMaxTimes2($bid, $num) {
-	return $this->__file->getOne(array('select' => 'max(times) as maxtimes', 'where' => 'pmid=? and numpname=?', 'groupby' => 'pmid,numpname', 'param' => array($bid, $num), 'asArray' => TRUE));
+    public function getMaxTimes2($bid, $num)
+    {
+        return $this->__file->getOne(array('select' => 'max(times) as maxtimes', 'where' => 'pmid=? and numpname=?', 'groupby' => 'pmid,numpname', 'param' => array($bid, $num), 'asArray' => TRUE));
     }
 
-    public function setOldfileFlag($pmid, $numpname, $times = 0) {
-	$this->__file->isnew = 1;
-	return $this->__file->update(array('where' => 'pmid=? and numpname=? and times=?', 'param' => array($pmid, $numpname, $times)));
+    public function setOldfileFlag($pmid, $numpname, $times = 0)
+    {
+        $this->__file->isnew = 1;
+        return $this->__file->update(array('where' => 'pmid=? and numpname=? and times=?', 'param' => array($pmid, $numpname, $times)));
     }
 
-    public function updateHash($pmid, $numpname, $times = 0) {
+    public function updateHash($pmid, $numpname, $times = 0)
+    {
         $this->__file->filehashcode = md5(mt_rand());
         return $this->__file->update(array('where' => 'pmid=? and numpname=? and times=? and isnew=2', 'param' => array($pmid, $numpname, $times)));
     }

+ 11 - 1
protected/class/measureauditact.php

@@ -93,6 +93,16 @@ class MeasureauditAct
         return $this->__measureaudit->find(array('where' => 'mpid=? order by last desc,maid asc', 'param' => array($mpid), 'asArray' => TRUE));
     }
 
+    public function getRowByMpidTimes($mpid,$times)
+    {
+        return $this->__measureaudit->find(array('where' => 'mpid=? and times=? order by last desc,maid asc', 'param' => array($mpid,$times), 'asArray' => TRUE));
+    }
+
+    public function getRowGroupByTimes($mpid)
+    {
+        return $this->__measureaudit->getOne(array('where' => 'mpid=?', 'groupby' => 'times', 'desc' => 'maid', 'param' => array($mpid), 'asArray' => TRUE));
+    }
+
 // for api
     public function getAlluserMeasureAudit($bid, $num)
     {
@@ -164,7 +174,7 @@ class MeasureauditAct
 
     public function getMyAuditStatus2($pmid, $numpname, $times, $uid)
     {
-        return $this->__measureaudit->getOne(array('where' => 'pmid=? AND numpname=? AND times=? AND auditoruid=?', 'param' => array($pmid, $numpname, $times, $uid),'asc'=>'maid', 'asArray' => TRUE));
+        return $this->__measureaudit->getOne(array('where' => 'pmid=? AND numpname=? AND times=? AND auditoruid=?', 'param' => array($pmid, $numpname, $times, $uid), 'asc' => 'maid', 'asArray' => TRUE));
     }
 
 

+ 4 - 0
protected/config/routes.conf.php

@@ -104,6 +104,10 @@ $route['*']['/api/client/user/set/:userid/:tenderid/:phaseno/checkno'] = array('
  */
 $route['*']['/api/client/user/create/:tenderid/:phaseno/new/audit'] = array('ClientController', 'createNewAudit');
 /**
+ * 重做新一期获取原报上报文件
+ */
+$route['*']['/api/client/user/get/:tenderid/:phaseno/report/file'] = array('ClientController', 'getReportFile');
+/**
  * 从桌面软件端变更标段名称接口
  */
 $route['*']['/api/client/tender/:BidID/:BidNewName/update'] = array('ClientController', 'updateTenderName');

+ 47 - 6
protected/controller/ClientController.php

@@ -693,7 +693,7 @@ class ClientController extends DooController
             $auditcontent = iconv('GBK', 'UTF-8', $_POST['CheckerMemo']);
             $auditArray = $this->measureauditact->getLastNewRowInfo($_POST['tenderid'], $_POST['phaseno'], $_POST['userid']);
             if (isset($auditArray ['mastatus']) && ($auditArray ['mastatus'] == 'checked') || ($auditArray ['mastatus'] == 'checkno')) {
-                echo json_encode(array('status' => FALSE, 'msg' => '已审核完毕,请勿重复提交'), JSON_UNESCAPED_UNICODE);
+                echo json_encode(array('status' => FALSE, 'msg' => '该标段已审批完毕。'), JSON_UNESCAPED_UNICODE);
                 die();
             }
             $auditUserArray = $this->measureauditact->getUserAuditLast($_POST['tenderid'], $_POST['phaseno']);
@@ -894,6 +894,11 @@ class ClientController extends DooController
     {
         if (isset($this->params['userid']) && isset($this->params['tenderid']) && isset($this->params['phaseno']) && isset($_POST['MD5_JL']) && isset($_POST['MD5_Zip'])) {
             $auditcontent = iconv('GBK', 'UTF-8', $_POST['CheckerMemo']);
+            $auditArrayStatus = $this->measureauditact->getLastNewRowInfo($this->params['tenderid'], $this->params['phaseno'], $this->params['userid']);
+            if (isset($auditArrayStatus ['mastatus']) && (($auditArrayStatus ['mastatus'] == 'checkno'))) {
+                echo json_encode(array('status' => FALSE, 'msg' => '该标段已审批完毕。'), JSON_UNESCAPED_UNICODE);
+                die();
+            }
             $auditArray = $this->measureauditact->getRowInfo($this->params['tenderid'], $this->params['phaseno'], $this->params['userid']);
             if (isset($auditArray['maid'])) {
                 $intMaxTimes = $this->numofperact->getMaxTimes($this->params['tenderid'], $this->params['phaseno']);
@@ -971,17 +976,53 @@ class ClientController extends DooController
                     echo json_encode(array('status' => FALSE, 'msg' => '无效操作重复创建审批人'), JSON_UNESCAPED_UNICODE);
                     die();
                 }
-//                $timesArray = $this->numofperact->getMaxTimes($this->params['tenderid'], $this->params['phaseno']);
-                $urlinfoArray = $this->attfile->getLastNewProfileUnlock2($this->params['tenderid'], $this->params['phaseno']);
+////                $timesArray = $this->numofperact->getMaxTimes($this->params['tenderid'], $this->params['phaseno']);
+//                $urlinfoArray = $this->attfile->getLastNewProfileUnlock2($this->params['tenderid'], $this->params['phaseno']);
+//                $proArray = $this->project->getRowByPid($urlinfoArray['pid']);
+//                $stArray = $this->contractact->getRowByStid($urlinfoArray['stid']);
+//                $MeasureArray = $this->actmeasure->getRowByPmid($this->params['tenderid']);
+//                $downArray = NULL;
+//                $pathinfo = pathinfo($urlinfoArray['filepath']);
+//                if (isset($pathinfo['dirname']))
+//                    $downArray[] = array('downurl' => Doo::conf()->APP_URL . $pathinfo['dirname'] . '/' . $pathinfo['filename'] . '/ProjectFile.rmf', 'MD5_Jl' => $urlinfoArray['filehashcode'], 'proName' => $proArray['pname'], 'stName' => $stArray['stname'], 'pnameid' => $proArray['pid'], 'ptypeid' => $stArray['stid'], 'BidName' => $MeasureArray['pmname']);
+//                echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $downArray), JSON_UNESCAPED_UNICODE);
+                echo json_encode(array('status' => 'TRUE', 'msg' => ''), JSON_UNESCAPED_UNICODE);
+                die();
+            } else {
+                echo json_encode(array('status' => FALSE, 'msg' => '审核状态无效'), JSON_UNESCAPED_UNICODE);
+                die();
+            }
+        } else {
+            echo json_encode(array('status' => FALSE, 'msg' => '创建未通过的新一期参数错误'), JSON_UNESCAPED_UNICODE);
+            die();
+        }
+    }
+
+    /**
+     * 重做新一期获取原报上报文件
+     *
+     */
+    function getReportFile()
+    {
+        if (isset($this->params['tenderid']) && isset($this->params['phaseno'])) {
+            $auditArray = $this->numofperact->getChecknoRow($this->params['tenderid'], $this->params['phaseno']);
+            if (isset($auditArray['currstatus']) && ($auditArray['currstatus'] == 'checkno')) {
+                $timesArray = $this->numofperact->getMaxTimes($this->params['tenderid'], $this->params['phaseno']);
+                $urlinfoArray = $this->attfile->getReportFile($this->params['tenderid'], $this->params['phaseno'], $timesArray['times']);
                 $proArray = $this->project->getRowByPid($urlinfoArray['pid']);
                 $stArray = $this->contractact->getRowByStid($urlinfoArray['stid']);
                 $MeasureArray = $this->actmeasure->getRowByPmid($this->params['tenderid']);
                 $downArray = NULL;
                 $pathinfo = pathinfo($urlinfoArray['filepath']);
-                if (isset($pathinfo['dirname']))
+                if (isset($pathinfo['dirname'])) {
                     $downArray[] = array('downurl' => Doo::conf()->APP_URL . $pathinfo['dirname'] . '/' . $pathinfo['filename'] . '/ProjectFile.rmf', 'MD5_Jl' => $urlinfoArray['filehashcode'], 'proName' => $proArray['pname'], 'stName' => $stArray['stname'], 'pnameid' => $proArray['pid'], 'ptypeid' => $stArray['stid'], 'BidName' => $MeasureArray['pmname']);
-                echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $downArray), JSON_UNESCAPED_UNICODE);
-                die();
+                    echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $downArray), JSON_UNESCAPED_UNICODE);
+                    die();
+                } else {
+                    echo json_encode(array('status' => FALSE, 'msg' => '上报文件不存在'), JSON_UNESCAPED_UNICODE);
+                    die();
+                }
+
             } else {
                 echo json_encode(array('status' => FALSE, 'msg' => '审核状态无效'), JSON_UNESCAPED_UNICODE);
                 die();

+ 2 - 1
protected/controller/RProjectController.php

@@ -328,7 +328,8 @@ class RProjectController extends DooController
         $lastRowArray = $this->numofperact->getLastNew2($this->params['pmid']);
         $maxTimes = $this->numofperact->getMaxTimes($lastRowArray['pmid'], $lastRowArray['numpname']);
 //        $auditUserArray = $this->measureauditact->getAllAudit($lastRowArray['pmid'], $lastRowArray['numpname'], $maxTimes['times']);
-        $auditUserArray = $this->measureauditact->getRowByMpid2($this->params['mpid']);
+        $maxtimez = $this->measureauditact->getRowGroupByTimes($this->params['mpid']);
+        $auditUserArray = $this->measureauditact->getRowByMpidTimes($this->params['mpid'],$maxtimez['times']);
         $auditArray = $this->measureauditact->getLastNewRowInfo($lastRowArray['pmid'], $lastRowArray['numpname'], $this->auth->getUid());
         if (isset($_POST['act'])) {
             $auditStatusArray = array('checkno', 'checked');