|
@@ -30,18 +30,35 @@ class EnterpriseApi {
|
|
$whr[] = ["companyId", "=", $companyId];
|
|
$whr[] = ["companyId", "=", $companyId];
|
|
$whr[] = ["delete", "=", 0];
|
|
$whr[] = ["delete", "=", 0];
|
|
$list = \app\common\model\EnterpriseVerifyMgr::where($whr)->select()->toArray();
|
|
$list = \app\common\model\EnterpriseVerifyMgr::where($whr)->select()->toArray();
|
|
- $talentType = [];
|
|
|
|
- $uniCodes = [];
|
|
|
|
|
|
+ $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"]);
|
|
$codes = explode(",", $v["uniCode"]);
|
|
$uniCodes = array_merge($uniCodes, (array) $codes);
|
|
$uniCodes = array_merge($uniCodes, (array) $codes);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ $_whr[] = ["uniCode", "<>", ""];
|
|
|
|
+ $_whr[] = ["delete", "=", 0];
|
|
|
|
+ $_whr[] = ["companyId", "<>", $companyId];
|
|
|
|
+ $_list = \app\common\model\EnterpriseVerifyMgr::where($_whr)->select()->toArray();
|
|
|
|
+ $expUniCodes = []; //排除其它单位的例外
|
|
|
|
+ foreach ($_list as $_v) {
|
|
|
|
+ $codes = explode(",", $_v["uniCode"]);
|
|
|
|
+ $expUniCodes = array_merge($expUniCodes, (array) $codes);
|
|
|
|
+ }
|
|
if ($talentType && $uniCodes) {
|
|
if ($talentType && $uniCodes) {
|
|
- $whereRaw = sprintf('enterpriseTag in ("%s") or idCard in ("%s")', implode('","', $talentType), implode('","', $uniCodes));
|
|
|
|
|
|
+ if ($expUniCodes) {
|
|
|
|
+ $whereRaw = sprintf('(enterpriseTag in ("%s") and idCard not in ("%s")) or idCard in ("%s")', implode('","', $talentType), implode('","', $expUniCodes), implode('","', $uniCodes));
|
|
|
|
+ } else {
|
|
|
|
+ $whereRaw = sprintf('enterpriseTag in ("%s") or idCard in ("%s")', implode('","', $talentType), implode('","', $uniCodes));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if ($talentType && !$uniCodes) {
|
|
if ($talentType && !$uniCodes) {
|
|
$where[] = ["enterpriseTag", "in", $talentType];
|
|
$where[] = ["enterpriseTag", "in", $talentType];
|
|
|
|
+ if ($expUniCodes) {
|
|
|
|
+ $where[] = ["idCard", "not in", $expUniCodes];
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (!$talentType && $uniCodes) {
|
|
if (!$talentType && $uniCodes) {
|
|
$where[] = ["idCard", "in", $uniCodes];
|
|
$where[] = ["idCard", "in", $uniCodes];
|
|
@@ -142,11 +159,28 @@ class EnterpriseApi {
|
|
$codes = explode(",", $v["uniCode"]);
|
|
$codes = explode(",", $v["uniCode"]);
|
|
$uniCodes = array_merge($uniCodes, (array) $codes);
|
|
$uniCodes = array_merge($uniCodes, (array) $codes);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ $_whr[] = ["uniCode", "<>", ""];
|
|
|
|
+ $_whr[] = ["delete", "=", 0];
|
|
|
|
+ $_whr[] = ["companyId", "<>", $companyId];
|
|
|
|
+ $_list = \app\common\model\EnterpriseVerifyMgr::where($_whr)->select()->toArray();
|
|
|
|
+ $expUniCodes = []; //排除其它单位的例外
|
|
|
|
+ foreach ($_list as $_v) {
|
|
|
|
+ $codes = explode(",", $_v["uniCode"]);
|
|
|
|
+ $expUniCodes = array_merge($expUniCodes, (array) $codes);
|
|
|
|
+ }
|
|
if ($talentType && $uniCodes) {
|
|
if ($talentType && $uniCodes) {
|
|
- $whereRaw = sprintf('newEnterpriseTag in ("%s") or newIdCard in ("%s")', implode('","', $talentType), implode('","', $uniCodes));
|
|
|
|
|
|
+ if ($expUniCodes) {
|
|
|
|
+ $whereRaw = sprintf('(newEnterpriseTag in ("%s") and newIdCard not in ("%s")) or newIdCard in ("%s")', implode('","', $talentType), implode('","', $expUniCodes), implode('","', $uniCodes));
|
|
|
|
+ } else {
|
|
|
|
+ $whereRaw = sprintf('newEnterpriseTag in ("%s") or newIdCard in ("%s")', implode('","', $talentType), implode('","', $uniCodes));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if ($talentType && !$uniCodes) {
|
|
if ($talentType && !$uniCodes) {
|
|
$where[] = ["newEnterpriseTag", "in", $talentType];
|
|
$where[] = ["newEnterpriseTag", "in", $talentType];
|
|
|
|
+ if ($expUniCodes) {
|
|
|
|
+ $where[] = ["newIdCard", "not in", $expUniCodes];
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (!$talentType && $uniCodes) {
|
|
if (!$talentType && $uniCodes) {
|
|
$where[] = ["newIdCard", "in", $uniCodes];
|
|
$where[] = ["newIdCard", "in", $uniCodes];
|