sugangqiang 2 سال پیش
والد
کامیت
96f69e59a8

+ 4 - 0
app/admin/controller/EnterpriseVerifyMgr.php

@@ -39,6 +39,8 @@ class EnterpriseVerifyMgr extends AdminController {
             }
             }
             if (EnterpriseVerifyMgrApi::chkExist($params["enterpriseTag"]))
             if (EnterpriseVerifyMgrApi::chkExist($params["enterpriseTag"]))
                 return json(["msg" => "该标签已经存在审核配置,不需要重复配置"]);
                 return json(["msg" => "该标签已经存在审核配置,不需要重复配置"]);
+            if (EnterpriseVerifyMgrApi::chkUnicodeExist($params["uniCode"]) && $params["uniCode"])
+                return json(["msg" => "输入的例外企业统一信用代码中包含已经被其它单位设置过的企业,不能重复设置"]);
             if (EnterpriseVerifyMgrApi::edit($params))
             if (EnterpriseVerifyMgrApi::edit($params))
                 return json(["code" => 200, "msg" => "添加单位标签审核配置成功"]);
                 return json(["code" => 200, "msg" => "添加单位标签审核配置成功"]);
             return json(["msg" => "添加单位标签审核配置失败"]);
             return json(["msg" => "添加单位标签审核配置失败"]);
@@ -63,6 +65,8 @@ class EnterpriseVerifyMgr extends AdminController {
             }
             }
             if (EnterpriseVerifyMgrApi::chkExist($params["enterpriseTag"], $params["id"]))
             if (EnterpriseVerifyMgrApi::chkExist($params["enterpriseTag"], $params["id"]))
                 return json(["msg" => "该标签已经存在审核配置,不需要重复配置"]);
                 return json(["msg" => "该标签已经存在审核配置,不需要重复配置"]);
+            if (EnterpriseVerifyMgrApi::chkUnicodeExist($params["uniCode"], $params["id"]) && $params["uniCode"])
+                return json(["msg" => "输入的例外企业统一信用代码中包含已经被其它单位设置过的企业,不能重复设置"]);
             if (EnterpriseVerifyMgrApi::edit($params))
             if (EnterpriseVerifyMgrApi::edit($params))
                 return json(["code" => 200, "msg" => "编辑单位标签审核配置成功"]);
                 return json(["code" => 200, "msg" => "编辑单位标签审核配置成功"]);
             return json(["msg" => "编辑单位标签审核配置失败"]);
             return json(["msg" => "编辑单位标签审核配置失败"]);

+ 14 - 8
app/admin/view/enterprise_verify_mgr/add.html

@@ -7,27 +7,33 @@
                 <div class="row">
                 <div class="row">
                     <div class="col-sm-6">
                     <div class="col-sm-6">
                         <div class="form-group">
                         <div class="form-group">
-                            <label class="col-sm-3 control-label spacing">单位标签</label>
-                            <div class="col-sm-9 spacing">
-                                <select class="form-control" id="enterpriseTag" name="enterpriseTag">
+                            <label class="col-sm-3 control-label"><span style="color: red">*</span>审核单位</label>
+                            <div class="col-sm-9">
+                                <select class="form-control" id="companyId" name="companyId" data-placeholder="请选择审核单位">
                                 </select>
                                 </select>
                             </div>
                             </div>
                         </div>
                         </div>
                         <div class="form-group">
                         <div class="form-group">
-                            <label class="col-sm-3 control-label spacing">备注</label>
+                            <label class="col-sm-3 control-label spacing">例外设置</label>
                             <div class="col-sm-9 spacing">
                             <div class="col-sm-9 spacing">
-                                <input class="form-control" id="description" name="description">
+                                <input class="form-control" id="uniCode" name="uniCode" placeholder="填写统一信用代码,多个用,分隔">
                             </div>
                             </div>
                         </div>
                         </div>
                     </div>
                     </div>
                     <div class="col-sm-6">
                     <div class="col-sm-6">
                         <div class="form-group">
                         <div class="form-group">
-                            <label class="col-sm-3 control-label"><span style="color: red">*</span>审核单位</label>
-                            <div class="col-sm-9">
-                                <select class="form-control" id="companyId" name="companyId" data-placeholder="请选择审核单位">
+                            <label class="col-sm-3 control-label spacing">单位标签</label>
+                            <div class="col-sm-9 spacing">
+                                <select class="form-control" id="enterpriseTag" name="enterpriseTag">
                                 </select>
                                 </select>
                             </div>
                             </div>
                         </div>
                         </div>
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label spacing">备注</label>
+                            <div class="col-sm-9 spacing">
+                                <input class="form-control" id="description" name="description">
+                            </div>
+                        </div>
                     </div>
                     </div>
                 </div>
                 </div>
                 <div class="row btn-group-m-t">
                 <div class="row btn-group-m-t">

+ 18 - 12
app/admin/view/enterprise_verify_mgr/edit.html

@@ -6,29 +6,35 @@
             <div class="form-horizontal">
             <div class="form-horizontal">
                 <div class="row">
                 <div class="row">
                     <div class="col-sm-6">
                     <div class="col-sm-6">
-                        <input type="hidden" name="id" id="id" value="{$info.id}">
+                        <input type="hidden" name="id" id="id" value="{$info.id}">     
                         <div class="form-group">
                         <div class="form-group">
-                            <label class="col-sm-3 control-label spacing">单位标签</label>
-                            <div class="col-sm-9 spacing">
-                                <select class="form-control" id="enterpriseTag" name="enterpriseTag" selectVal="{$info.enterpriseTag}">
+                            <label class="col-sm-3 control-label"><span style="color: red">*</span>审核单位</label>
+                            <div class="col-sm-9">
+                                <select class="form-control" id="companyId" name="companyId" selectVal="{$info.companyId}" data-placeholder="请选择审核单位">
                                 </select>
                                 </select>
                             </div>
                             </div>
-                        </div>                        
+                        </div>   
                         <div class="form-group">
                         <div class="form-group">
-                            <label class="col-sm-3 control-label spacing">备注</label>
+                            <label class="col-sm-3 control-label spacing">例外设置</label>
                             <div class="col-sm-9 spacing">
                             <div class="col-sm-9 spacing">
-                                <input class="form-control" id="description" name="description" value="{$info.description}">
+                                <input class="form-control" id="uniCode" name="uniCode" value="{$info.uniCode}" placeholder="填写统一信用代码,多个用,分隔">
                             </div>
                             </div>
-                        </div>
+                        </div>           
                     </div>
                     </div>
                     <div class="col-sm-6">
                     <div class="col-sm-6">
                         <div class="form-group">
                         <div class="form-group">
-                            <label class="col-sm-3 control-label"><span style="color: red">*</span>审核单位</label>
-                            <div class="col-sm-9">
-                                <select class="form-control" id="companyId" name="companyId" selectVal="{$info.companyId}" data-placeholder="请选择审核单位">
+                            <label class="col-sm-3 control-label spacing">单位标签</label>
+                            <div class="col-sm-9 spacing">
+                                <select class="form-control" id="enterpriseTag" name="enterpriseTag" selectVal="{$info.enterpriseTag}">
                                 </select>
                                 </select>
                             </div>
                             </div>
-                        </div>
+                        </div>   
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label spacing">备注</label>
+                            <div class="col-sm-9 spacing">
+                                <input class="form-control" id="description" name="description" value="{$info.description}">
+                            </div>
+                        </div> 
                     </div>
                     </div>
                 </div>
                 </div>
                 <div class="row btn-group-m-t">
                 <div class="row btn-group-m-t">

+ 52 - 10
app/common/api/EnterpriseApi.php

@@ -23,15 +23,29 @@ class EnterpriseApi {
         $companyId = session('user')['companyId'];
         $companyId = session('user')['companyId'];
         $company_info = CompanyApi::getOne($companyId);
         $company_info = CompanyApi::getOne($companyId);
         $where = [];
         $where = [];
+        $whereRaw = "";
         if ($company_info['code'] != 'super') {
         if ($company_info['code'] != 'super') {
             $where[] = ['type', '=', session('user')['type']];
             $where[] = ['type', '=', session('user')['type']];
             if (session('user')['type'] == 1) {
             if (session('user')['type'] == 1) {
-                $list = \app\common\model\EnterpriseVerifyMgr::where('companyId', '=', $companyId)->select()->toArray();
+                $whr[] = ["companyId", "=", $companyId];
+                $whr[] = ["delete", "=", 0];
+                $list = \app\common\model\EnterpriseVerifyMgr::where($whr)->select()->toArray();
                 $talentType = [];
                 $talentType = [];
+                $uniCodes = [];
                 foreach ($list as $k => $v) {
                 foreach ($list as $k => $v) {
                     array_push($talentType, $v['enterpriseTag']);
                     array_push($talentType, $v['enterpriseTag']);
+                    $codes = explode(",", $v["uniCode"]);
+                    $uniCodes = array_merge($uniCodes, (array) $codes);
+                }
+                if ($talentType && $uniCodes) {
+                    $whereRaw = sprintf('enterpriseTag in (%s) or idCard in (%s)', explode(",", $talentType), explode(",", $uniCodes));
+                }
+                if ($talentType && !$uniCodes) {
+                    $where[] = ["enterpriseTag", "in", $talentType];
+                }
+                if (!$talentType && $uniCodes) {
+                    $where[] = ["idCard", "in", $uniCodes];
                 }
                 }
-                $where[] = ['enterpriseTag', 'in', $talentType];
             }
             }
         }
         }
 
 
@@ -83,14 +97,21 @@ class EnterpriseApi {
         if ($industryFieldNew) {
         if ($industryFieldNew) {
             $where[] = ["industryFieldNew", "=", "{$industryFieldNew}"];
             $where[] = ["industryFieldNew", "=", "{$industryFieldNew}"];
         }
         }
-
-        $count = Enterprise::where($where)->count();
+        if ($whereRaw) {
+            $count = Enterprise::where($where)->whereRaw($whereRaw)->count();
+        } else {
+            $count = Enterprise::where($where)->count();
+        }
         if ($count > 0) {
         if ($count > 0) {
             $talentTypeList = DictApi::selectByParentCode("enterprise_tag");
             $talentTypeList = DictApi::selectByParentCode("enterprise_tag");
             $industryFieldNewList = DictApi::selectByParentCode("industry_field");
             $industryFieldNewList = DictApi::selectByParentCode("industry_field");
             $streetList = DictApi::selectByParentCode("street");
             $streetList = DictApi::selectByParentCode("street");
             //dd($talentTypeList);
             //dd($talentTypeList);
-            $list = Enterprise::where($where)->limit($offset, $limit)->order("createTime", 'desc')->select()->toArray();
+            if ($whereRaw) {
+                $list = Enterprise::where($where)->whereRaw($whereRaw)->limit($offset, $limit)->order("createTime", 'desc')->select()->toArray();
+            } else {
+                $list = Enterprise::where($where)->limit($offset, $limit)->order("createTime", 'desc')->select()->toArray();
+            }
             foreach ($list as $k => &$v) {
             foreach ($list as $k => &$v) {
                 unset($v['password']);
                 unset($v['password']);
                 $v['enterpriseTagName'] = $talentTypeList[$v['enterpriseTag']]; //此处旧字段为talentType,新字段为enterpriseTag,为防止数据污染与丢失,因而这样写
                 $v['enterpriseTagName'] = $talentTypeList[$v['enterpriseTag']]; //此处旧字段为talentType,新字段为enterpriseTag,为防止数据污染与丢失,因而这样写
@@ -107,15 +128,29 @@ class EnterpriseApi {
         $companyId = session('user')['companyId'];
         $companyId = session('user')['companyId'];
         $company_info = CompanyApi::getOne($companyId);
         $company_info = CompanyApi::getOne($companyId);
         $where = [];
         $where = [];
+        $whereRaw = "";
         if ($company_info['code'] != 'super') {
         if ($company_info['code'] != 'super') {
             $where[] = ['type', '=', session('user')['type']];
             $where[] = ['type', '=', session('user')['type']];
             if (session('user')['type'] == 1) {
             if (session('user')['type'] == 1) {
-                $list = \app\common\model\EnterpriseVerifyMgr::where('companyId', '=', $companyId)->select()->toArray();
+                $whr[] = ["companyId", "=", $companyId];
+                $whr[] = ["delete", "=", 0];
+                $list = \app\common\model\EnterpriseVerifyMgr::where($whr)->select()->toArray();
                 $talentType = [];
                 $talentType = [];
+                $uniCodes = [];
                 foreach ($list as $k => $v) {
                 foreach ($list as $k => $v) {
                     array_push($talentType, $v['enterpriseTag']);
                     array_push($talentType, $v['enterpriseTag']);
+                    $codes = explode(",", $v["uniCode"]);
+                    $uniCodes = array_merge($uniCodes, (array) $codes);
+                }
+                if ($talentType && $uniCodes) {
+                    $whereRaw = sprintf('newEnterpriseTag in (%s) or newIdCard in (%s)', explode(",", $talentType), explode(",", $uniCodes));
+                }
+                if ($talentType && !$uniCodes) {
+                    $where[] = ["newEnterpriseTag", "in", $talentType];
+                }
+                if (!$talentType && $uniCodes) {
+                    $where[] = ["newIdCard", "in", $uniCodes];
                 }
                 }
-                $where[] = ['newEnterpriseTag', 'in', $talentType];
             }
             }
         }
         }
 
 
@@ -177,13 +212,20 @@ class EnterpriseApi {
         if ($newIndustryFieldNew) {
         if ($newIndustryFieldNew) {
             $where[] = ["newIndustryFieldNew", "=", "{$newIndustryFieldNew}"];
             $where[] = ["newIndustryFieldNew", "=", "{$newIndustryFieldNew}"];
         }
         }
-
-        $count = EnterpriseRecord::where($where)->count();
+        if ($whereRaw) {
+            $count = EnterpriseRecord::where($where)->whereRaw($whereRaw)->count();
+        } else {
+            $count = EnterpriseRecord::where($where)->count();
+        }
         if ($count > 0) {
         if ($count > 0) {
             $talentTypeList = DictApi::selectByParentCode("enterprise_tag");
             $talentTypeList = DictApi::selectByParentCode("enterprise_tag");
             $industryFieldNewList = DictApi::selectByParentCode("industry_field");
             $industryFieldNewList = DictApi::selectByParentCode("industry_field");
             $streetList = DictApi::selectByParentCode("street");
             $streetList = DictApi::selectByParentCode("street");
-            $list = EnterpriseRecord::where($where)->limit($offset, $limit)->order("createTime", 'desc')->select()->toArray();
+            if ($whereRaw) {
+                $list = EnterpriseRecord::where($where)->whereRaw($whereRaw)->limit($offset, $limit)->order("createTime", 'desc')->select()->toArray();
+            } else {
+                $list = EnterpriseRecord::where($where)->limit($offset, $limit)->order("createTime", 'desc')->select()->toArray();
+            }
             foreach ($list as $k => &$v) {
             foreach ($list as $k => &$v) {
                 $v['oldStreetName'] = $streetList[$v['oldStreet']];
                 $v['oldStreetName'] = $streetList[$v['oldStreet']];
                 $v['newStreetName'] = $streetList[$v['newStreet']];
                 $v['newStreetName'] = $streetList[$v['newStreet']];

+ 12 - 0
app/common/api/EnterpriseVerifyMgrApi.php

@@ -34,6 +34,7 @@ class EnterpriseVerifyMgrApi {
         $data["enterpriseTag"] = $params["enterpriseTag"];
         $data["enterpriseTag"] = $params["enterpriseTag"];
         $data["companyId"] = $params["companyId"];
         $data["companyId"] = $params["companyId"];
         $data["description"] = $params["description"];
         $data["description"] = $params["description"];
+        $data["uniCode"] = implode(",", array_unique(array_filter(explode(",", $params["uniCode"]))));
         if ($params["id"]) {
         if ($params["id"]) {
             $data["id"] = $params["id"];
             $data["id"] = $params["id"];
             $data["updateTime"] = date("Y-m-d H:i:s");
             $data["updateTime"] = date("Y-m-d H:i:s");
@@ -65,4 +66,15 @@ class EnterpriseVerifyMgrApi {
         return EnterpriseVerifyMgr::where($where)->find();
         return EnterpriseVerifyMgr::where($where)->find();
     }
     }
 
 
+    public static function chkUnicodeExist($codes, $id = 0) {
+        $where = [];
+        if ($id) {
+            $where[] = ["id", "<>", $id];
+        }
+        $codes = array_unique(array_filter(explode(",", $codes)));
+        $where[] = ["delete", "=", 0];
+        $whereRaw = sprintf("concat(',',uniCode,',') regexp(',%s,')", implode(",|,", $codes));
+        return EnterpriseVerifyMgr::where($where)->whereRaw($whereRaw)->find();
+    }
+
 }
 }

+ 2 - 1
public/static/modular/system/enterprisetypeProperties/enterprisetypeProperties.js

@@ -14,8 +14,9 @@ var EnterprisetypeProperties = {
 EnterprisetypeProperties.initColumn = function () {
 EnterprisetypeProperties.initColumn = function () {
     return [
     return [
         {field: 'selectItem', radio: true},
         {field: 'selectItem', radio: true},
-        {title: '单位标签', field: 'enterpriseTagName', visible: true, align: 'center', valign: 'middle'},
         {title: '审核单位', field: 'companyName', visible: true, align: 'center', valign: 'middle'},
         {title: '审核单位', field: 'companyName', visible: true, align: 'center', valign: 'middle'},
+        {title: '单位标签', field: 'enterpriseTagName', visible: true, align: 'center', valign: 'middle'},
+        {title: '例外设置', field: 'uniCode', visible: true, align: 'center', valign: 'middle'},
         {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle'},
         {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle'},
     ];
     ];
 };
 };

+ 1 - 0
public/static/modular/system/enterprisetypeProperties/enterprisetypeProperties_info.js

@@ -63,6 +63,7 @@ EnterprisetypePropertiesInfoDlg.collectData = function () {
     this
     this
             .set('id')
             .set('id')
             .set('enterpriseTag')
             .set('enterpriseTag')
+            .set('uniCode')
             .set('description');
             .set('description');
     var companys = $("#companyId").val();
     var companys = $("#companyId").val();
     /*var ids = "";
     /*var ids = "";