Explorar el Código

计量支付
在线审批
重做接口更新到适合在线审批用的逻辑

NoNZero hace 9 años
padre
commit
cc9398b72b

+ 4 - 0
protected/class/attfile.php

@@ -63,6 +63,10 @@ class attFile {
 	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) {
+        return $this->__file->getOne(array('where' => 'pmid=? and numpname=? and isnew=2', 'desc' => 'times', 'param' => array($pmid, $numpname), '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));

+ 5 - 0
protected/class/measureauditact.php

@@ -88,6 +88,11 @@ class MeasureauditAct
         return $this->__measureaudit->find(array('where' => 'mpid=?', 'param' => array($mpid), 'asArray' => TRUE));
     }
 
+    public function getRowByMpid2($mpid)
+    {
+        return $this->__measureaudit->find(array('where' => 'mpid=? order by last desc,maid asc', 'param' => array($mpid), 'asArray' => TRUE));
+    }
+
 // for api
     public function getAlluserMeasureAudit($bid, $num)
     {

+ 1 - 1
protected/class/numofperact.php

@@ -194,7 +194,7 @@ class NumofperAct {
     }
 
     public function getChecknoRow($pmid, $numpname) {
-        return $this->__numofperact->getOne(array('where' => 'pmid=? and numpname=?', 'orderby' => 'times', 'desc' => 'times', 'param' => array($pmid, $numpname), 'asArray' => TRUE));
+        return $this->__numofperact->getOne(array('where' => 'pmid=? and numpname=?', 'desc' => 'times', 'param' => array($pmid, $numpname), 'asArray' => TRUE));
     }
 
 //    public function getMaxCurrStatus($pid, $pmid, $stid) {

+ 34 - 21
protected/controller/ClientController.php

@@ -126,8 +126,8 @@ class ClientController extends DooController
                 /**
                  * 增加上传压缩包md5检测机制
                  */
-                $localmd5HashString = hash_file("md5",Doo::conf()->SITE_PATH . $fp[0]['filepath']);
-                if($localmd5HashString!=trim($_POST['MD5_Zip'])){
+                $localmd5HashString = hash_file("md5", Doo::conf()->SITE_PATH . $fp[0]['filepath']);
+                if ($localmd5HashString != trim($_POST['MD5_Zip'])) {
                     $status = array('status' => 'FALSE', 'msg' => '期数数据上传失败,请重新上传');
                     echo json_encode($status, JSON_UNESCAPED_UNICODE);
                     die();
@@ -253,10 +253,10 @@ class ClientController extends DooController
                     if ($value['mastatus'] != 'uncheck') {
                         $isUnCheck = FALSE;
                     }
-                    if($value['audittime']>0){
-                        $value['audittime'] = date('Y-m-d',$value['audittime']);
+                    if ($value['audittime'] > 0) {
+                        $value['audittime'] = date('Y-m-d', $value['audittime']);
                     }
-                    $auditInfo[] = array('uid' => $userArray['userid'], 'name' => $userArray['name'], 'company' => $userArray['company'], 'jobs' => $userArray['jobs'], 'avatar' => $this->auth->getAvatar($value['auditoruid']), 'mastatus' => $this->statusArray[$value['mastatus']], 'CheckerMemo' => $value['auditcontent'],'onlineaudit' => $value['onlineaudit'],'audittime'=>$value['audittime']);
+                    $auditInfo[] = array('uid' => $userArray['userid'], 'name' => $userArray['name'], 'company' => $userArray['company'], 'jobs' => $userArray['jobs'], 'avatar' => $this->auth->getAvatar($value['auditoruid']), 'mastatus' => $this->statusArray[$value['mastatus']], 'CheckerMemo' => $value['auditcontent'], 'onlineaudit' => $value['onlineaudit'], 'audittime' => $value['audittime']);
                 }
             }
             if ($ownerStatusArray) {
@@ -340,9 +340,9 @@ class ClientController extends DooController
                     $uinfoArray[$key]['avatar'] = $this->auth->getAvatar($value['auditoruid']);
                     $uinfoArray[$key]['CheckerMemo'] = $value['auditcontent'];
                     $uinfoArray[$key]['onlineaudit'] = $value['onlineaudit'];
-                    if($value['audittime']>0){
-                        $uinfoArray[$key]['audittime'] = date('Y-m-d',$value['audittime']);
-                    }else{
+                    if ($value['audittime'] > 0) {
+                        $uinfoArray[$key]['audittime'] = date('Y-m-d', $value['audittime']);
+                    } else {
                         $uinfoArray[$key]['audittime'] = '0';
                     }
                 }
@@ -699,8 +699,8 @@ class ClientController extends DooController
             $auditUserArray = $this->measureauditact->getUserAuditLast($_POST['tenderid'], $_POST['phaseno']);
             $fp = $this->upfile('upfile');
             if (isset($fp[0]['filepath'])) {
-                $localmd5HashString = hash_file("md5",Doo::conf()->SITE_PATH . $fp[0]['filepath']);
-                if($localmd5HashString!=trim($_POST['MD5_Zip'])){
+                $localmd5HashString = hash_file("md5", Doo::conf()->SITE_PATH . $fp[0]['filepath']);
+                if ($localmd5HashString != trim($_POST['MD5_Zip'])) {
                     $status = array('status' => 'FALSE', 'msg' => '审核期数数据上传失败,请重新上传');
                     echo json_encode($status, JSON_UNESCAPED_UNICODE);
                     die();
@@ -906,8 +906,8 @@ class ClientController extends DooController
                 if (isset($fp[0]['filepath'])) {
                     // 解压缩文件等待以后直接使用
                     // TODO:根据校验码校验包的完整性
-                    $localmd5HashString = hash_file("md5",Doo::conf()->SITE_PATH . $fp[0]['filepath']);
-                    if($localmd5HashString!=trim($_POST['MD5_Zip'])){
+                    $localmd5HashString = hash_file("md5", Doo::conf()->SITE_PATH . $fp[0]['filepath']);
+                    if ($localmd5HashString != trim($_POST['MD5_Zip'])) {
                         $status = array('status' => 'FALSE', 'msg' => '未通过期数数据上传失败,请重新上传');
                         echo json_encode($status, JSON_UNESCAPED_UNICODE);
                         die();
@@ -956,14 +956,23 @@ class ClientController extends DooController
         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')) {
-                $auditUserArray = $this->measureauditact->getUserAudit($this->params['tenderid'], $this->params['phaseno'], $auditArray['times']);
-                if ($auditUserArray) {
+                $isCreate = false;
+                $auditUserArray = $this->measureauditact->getUserAuditLast($this->params['tenderid'], $this->params['phaseno']);
+                foreach ($auditUserArray as $key => $value) {
+                    if ($value['mastatus'] != 'uncheck') {
+                        $isCreate = true;
+                    }
+                }
+                if ($auditUserArray && $isCreate) {
                     foreach ($auditUserArray as $key => $value) {
-                        $auditUserArray = $this->measureauditact->insertMeasureAudit($value['pid'], $value['creatoruid'], $value['auditoruid'], $value['mpid'], $value['pmid'], $value['stid'], $value['numpname'], $status = 'uncheck', $value['last'], $auditArray['times'] + 1);
+                        $this->measureauditact->insertMeasureAudit($value['pid'], $value['creatoruid'], $value['auditoruid'], $value['mpid'], $value['pmid'], $value['stid'], $value['numpname'], $status = 'uncheck', $value['last'], $auditArray['times'] + 1);
                     }
+                } else {
+                    echo json_encode(array('status' => FALSE, 'msg' => '无效操作重复创建审批人'), JSON_UNESCAPED_UNICODE);
+                    die();
                 }
-                $timesArray = $this->numofperact->getMaxTimes($this->params['tenderid'], $this->params['phaseno']);
-                $urlinfoArray = $this->attfile->getLastNewProfileUnlock($this->params['tenderid'], $this->params['phaseno'], $timesArray['times']);
+//                $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']);
@@ -1114,11 +1123,13 @@ class ClientController extends DooController
         }
     }
 
-    function upfile($fildname, $param = 'doc, docx, xls, xlsx, png, zip') {
+    function upfile($fildname, $param = 'doc, docx, xls, xlsx, png, zip')
+    {
         return $this->att->uploadMut($fildname, $param);
     }
 
-    function upItemFile($fildname, $param = 'doc, docx, xls, xlsx, png, zip') {
+    function upItemFile($fildname, $param = 'doc, docx, xls, xlsx, png, zip')
+    {
         $this->att->setUploadDir();
         return $this->att->uploadMut($fildname, $param);
     }
@@ -1127,7 +1138,8 @@ class ClientController extends DooController
      *   根据标段ID获取标段是否已经被删除的提示
      *   标段ID
      */
-    public function getCountPmid() {
+    public function getCountPmid()
+    {
         if (isset($this->params['tenderid'])) {
             $isexist = $this->actmeasure->getCountPmid($this->params['tenderid']);
             if ($isexist > 0) {
@@ -1142,7 +1154,8 @@ class ClientController extends DooController
         }
     }
 
-    function getFileupErrorNo() {
+    function getFileupErrorNo()
+    {
         return $this->att->error();
     }
 

+ 3 - 2
protected/controller/RProjectController.php

@@ -305,10 +305,10 @@ class RProjectController extends DooController
         // 期数列表
         $tmpArray = $this->numofperact->getGroupByLastOne2($this->params['pmid']);
         foreach ($tmpArray as $k => $v) {
-            $this->data['currnum'] = $v['numpname'];
             if ($v['mpid'] == $this->params['mpid']) {
                 $this->data['mpid'] = $v['mpid'];
                 $this->data['MeasureArray2'][] = $v;
+                $this->data['currnum'] = $v['numpname'];
             } else {
                 $this->data['numArray'][] = $v;
             }
@@ -327,7 +327,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->getAllAudit($lastRowArray['pmid'], $lastRowArray['numpname'], $maxTimes['times']);
+        $auditUserArray = $this->measureauditact->getRowByMpid2($this->params['mpid']);
         $auditArray = $this->measureauditact->getLastNewRowInfo($lastRowArray['pmid'], $lastRowArray['numpname'], $this->auth->getUid());
         if (isset($_POST['act'])) {
             $auditStatusArray = array('checkno', 'checked');