Explorar o código

Merge branch 'master' of http://59.57.98.130:3000/jjhc/report

sandm %!s(int64=2) %!d(string=hai) anos
pai
achega
8df02b85a7

+ 16 - 3
app/admin/controller/Talent.php

@@ -376,8 +376,11 @@ class Talent extends AdminController {
         if ($log["new_state"] == TalentState::FST_VERIFY_PASS && $talent_info["pass_dept_check"] == 0) {
             $data["first_dept_check_time"] = date("Y-m-d H:i:s");
             $condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
-            $companyIds = array_filter(explode(",", $condition["companyIds"]));
-            TalentLogApi::writeDeptLogs($talent_info["id"], $companyIds, TalentState::FST_VERIFY_PASS);
+            $companyIds = array_filter(explode(",", $condition["companyIds"])); //该条件下需要审核的所有单位
+            //这边去除已经审核通过的单位,主要通过日志是否存在记录。
+            $pass_companyIds = TalentLogApi::getPassDepts($talent_info["id"]); //已经通过的单位
+            $unpass_companyIds = array_diff($companyIds, (array) $pass_companyIds); //排除已经通过的单位
+            TalentLogApi::writeDeptLogs($talent_info["id"], $unpass_companyIds, TalentState::FST_VERIFY_PASS);
         }
         $data["id"] = $talent_info["id"];
         $data["checkState"] = $log["new_state"];
@@ -395,6 +398,11 @@ class Talent extends AdminController {
     private function deptCheck(\think\Request $request, $talent_info, $companys) {
         if ($talent_info["pass_dept_check"] == 1)
             return json(["msg" => "不在审核范围。(初审部门已经选择跳过部门并审阶段)"]);
+        if (!in_array($this->user["companyId"], $companys))
+            return json(["msg" => "您的部门不在该申请的并审部门列表中。"]);
+        $pass_companyIds = TalentLogApi::getPassDepts($talent_info["id"]); //已经通过的单位
+        if (in_array($this->user["companyId"], $pass_companyIds))
+            return json(["msg" => "您的部门已经审核过了,无需重复审核。"]);
 
         $params = $request->param();
         if ($params["checkState"] == 3) {
@@ -430,10 +438,15 @@ class Talent extends AdminController {
     private function deptSubmitCheck($talent_info, $companys) {
         if ($talent_info["pass_dept_check"] == 1)
             return json(["msg" => "不在审核范围。(初审部门已经选择跳过部门并审阶段)"]);
+        if (!in_array($this->user["companyId"], $companys))
+            return json(["msg" => "您的部门不在该申请的并审部门列表中。"]);
+        $pass_companyIds = TalentLogApi::getPassDepts($talent_info["id"]); //已经通过的单位
+        if (in_array($this->user["companyId"], $pass_companyIds))
+            return json(["msg" => "您的部门已经审核过了,无需重复审核。"]);
 
         $dept_log = TalentLogApi::getLogByCompanyId($talent_info["id"], $this->user["companyId"], $talent_info["first_dept_check_time"]);
 
-        $over = 0; //完成度
+        $over = $pass_companyIds ? count($pass_companyIds) : 0; //完成度,如果重审之前已有通过审核的部门,不用再审,直接按通过算
         $error = 0; //失败数
         $nowProcess = 3;
         if (!$dept_log)

+ 9 - 0
app/common/api/TalentLogApi.php

@@ -21,6 +21,15 @@ class TalentLogApi {
         return $list = TalentLog::whereOr([$where, $whr])->order("createTime desc")->select()->toArray();
     }
 
+    public static function getPassDepts($mainId) {
+        $where[] = ["type", "=", 1];
+        $where[] = ["mainId", "=", $mainId];
+        $where[] = ["active", "=", 1];
+        $where[] = ["step", "=", 3];
+        $where[] = ["new_state", "=", 9];
+        return TalentLog::where($where)->column("compayId");
+    }
+
     public static function getLastLog($mainId, $type, $companyId = 0) {
         $where = [];
         $where[] = ["mainId", "=", $mainId];

+ 14 - 2
app/common/controller/Tool.php

@@ -35,16 +35,28 @@ class Tool extends BaseController {
         return json(Db::table("un_common_location")->where($where)->select()->toArray());
     }
 
+    /**
+     * 通过省份编码查找所有市区
+     * @return type
+     */
     public function findCityByProvinceSelect() {
         $code = $this->request->param("code");
         $province_prefix = substr($code, 0, 2);
-        return json(Db::table("un_common_location")->where("code", "like", $province_prefix . "%00")->select()->toArray());
+        $where[] = ["code", "like", $province_prefix . "%00"];
+        $where[] = ["code", "<>", $code];
+        return json(Db::table("un_common_location")->where($where)->select()->toArray());
     }
 
+    /**
+     * 通过市级编码查找所有区县
+     * @return type
+     */
     public function findCountyByCitySelect() {
         $code = $this->request->param("code");
         $city_prefix = substr($code, 0, 4);
-        return json(Db::table("un_common_location")->where("code", "like", $city_prefix . "%")->select()->toArray());
+        $where[] = ["code", "like", $city_prefix . "%"];
+        $where[] = ["code", "<>", $code];
+        return json(Db::table("un_common_location")->where($where)->select()->toArray());
     }
 
     /**

+ 22 - 22
app/enterprise/controller/Base.php

@@ -92,17 +92,17 @@ class Base extends EnterpriseController {
                     echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
                     exit;
                 }
-                $start = date_create($date1);
-                $end = date_create($date2);
-                $diff = date_diff($end, $start);
-                $m = $diff->m ?: 0;
-                $y = $diff->y ?: 0;
-                $months = $y * 12 + $m;
-                if ($months < 6) {
-                    $res = ["msg" => $filed_dict["tax_insurance_month"] . "应大于或等于6个月"];
-                    echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
-                    exit;
-                }
+                /* $start = date_create($date1);
+                  $end = date_create($date2);
+                  $diff = date_diff($end, $start);
+                  $m = $diff->m ?: 0;
+                  $y = $diff->y ?: 0;
+                  $months = $y * 12 + $m;
+                  if ($months < 6) {
+                  $res = ["msg" => $filed_dict["tax_insurance_month"] . "应大于或等于6个月"];
+                  echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
+                  exit;
+                  } */
                 $no_empty[] = "tax_insurance_month";
             }
             if ($param["talent_type"] == 3) {
@@ -112,17 +112,17 @@ class Base extends EnterpriseController {
                     echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
                     exit;
                 }
-                $start = date_create($date1);
-                $end = date_create($date2);
-                $diff = date_diff($end, $start);
-                $m = $diff->m ?: 0;
-                $y = $diff->y ?: 0;
-                $months = $y * 12 + $m;
-                if ($months < 6) {
-                    $res = ["msg" => $filed_dict["labor_contract_rangetime"] . "应大于或等于6个月"];
-                    echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
-                    exit;
-                }
+                /* $start = date_create($date1);
+                  $end = date_create($date2);
+                  $diff = date_diff($end, $start);
+                  $m = $diff->m ?: 0;
+                  $y = $diff->y ?: 0;
+                  $months = $y * 12 + $m;
+                  if ($months < 6) {
+                  $res = ["msg" => $filed_dict["labor_contract_rangetime"] . "应大于或等于6个月"];
+                  echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
+                  exit;
+                  } */
                 $no_empty[] = "labor_contract_rangetime";
             }
             $return = [];