|
@@ -35,20 +35,19 @@ class EnterpriseApi {
|
|
|
$ins = [];
|
|
|
$uniCodes = []; //查找单位对应例外
|
|
|
foreach ($list as $k => $v) {
|
|
|
- if(!empty($v['enterpriseTag'])){
|
|
|
+ if (!empty($v['enterpriseTag'])) {
|
|
|
array_push($talentType, $v['enterpriseTag']);
|
|
|
}
|
|
|
- if(!empty($v['organizationTag'])){
|
|
|
+ if (!empty($v['organizationTag'])) {
|
|
|
array_push($org, $v['organizationTag']);
|
|
|
}
|
|
|
- if(!empty($v['institutionTag'])){
|
|
|
+ if (!empty($v['institutionTag'])) {
|
|
|
array_push($ins, $v['institutionTag']);
|
|
|
}
|
|
|
- if(!empty($v["uniCode"])){
|
|
|
+ if (!empty($v["uniCode"])) {
|
|
|
$codes = explode(",", $v["uniCode"]);
|
|
|
$uniCodes = array_merge($uniCodes, (array) $codes);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
$_whr[] = ["uniCode", "<>", ""];
|
|
@@ -152,9 +151,9 @@ class EnterpriseApi {
|
|
|
}
|
|
|
foreach ($list as $k => &$v) {
|
|
|
unset($v['password']);
|
|
|
- $v['enterpriseTagName'] = array_key_exists($v['enterpriseTag'],$talentTypeList) ? $talentTypeList[$v['enterpriseTag']] : ''; //此处旧字段为talentType,新字段为enterpriseTag,为防止数据污染与丢失,因而这样写
|
|
|
- $v['organizationTagName'] = array_key_exists($v['organizationTag'],$orgList) ? $orgList[$v['organizationTag']] : '';
|
|
|
- $v['institutionTagName'] = array_key_exists($v['institutionTag'],$orgList) ? $orgList[$v['institutionTag']] : '';
|
|
|
+ $v['enterpriseTagName'] = array_key_exists($v['enterpriseTag'], $talentTypeList) ? $talentTypeList[$v['enterpriseTag']] : ''; //此处旧字段为talentType,新字段为enterpriseTag,为防止数据污染与丢失,因而这样写
|
|
|
+ $v['organizationTagName'] = array_key_exists($v['organizationTag'], $orgList) ? $orgList[$v['organizationTag']] : '';
|
|
|
+ $v['institutionTagName'] = array_key_exists($v['institutionTag'], $orgList) ? $orgList[$v['institutionTag']] : '';
|
|
|
$v['industryFieldNewName'] = $industryFieldNewList[$v['industryFieldNew']];
|
|
|
$v['streetName'] = $streetList[$v['street']];
|
|
|
}
|
|
@@ -180,20 +179,19 @@ class EnterpriseApi {
|
|
|
$ins = [];
|
|
|
$uniCodes = [];
|
|
|
foreach ($list as $k => $v) {
|
|
|
- if(!empty($v['enterpriseTag'])){
|
|
|
+ if (!empty($v['enterpriseTag'])) {
|
|
|
array_push($talentType, $v['enterpriseTag']);
|
|
|
}
|
|
|
- if(!empty($v['organizationTag'])){
|
|
|
+ if (!empty($v['organizationTag'])) {
|
|
|
array_push($org, $v['organizationTag']);
|
|
|
}
|
|
|
- if(!empty($v['institutionTag'])){
|
|
|
+ if (!empty($v['institutionTag'])) {
|
|
|
array_push($ins, $v['institutionTag']);
|
|
|
}
|
|
|
- if(!empty($v["uniCode"])){
|
|
|
+ if (!empty($v["uniCode"])) {
|
|
|
$codes = explode(",", $v["uniCode"]);
|
|
|
$uniCodes = array_merge($uniCodes, (array) $codes);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -310,6 +308,194 @@ class EnterpriseApi {
|
|
|
return ["total" => $count, "rows" => $list];
|
|
|
}
|
|
|
|
|
|
+ public static function getExportList($request) {
|
|
|
+ $companyId = session('user')['companyId'];
|
|
|
+ $company_info = CompanyApi::getOne($companyId);
|
|
|
+ $where = [];
|
|
|
+ $whereRaw = "";
|
|
|
+ if ($company_info['code'] != 'super') {
|
|
|
+ $where[] = ['type', '=', session('user')['type']];
|
|
|
+ if (session('user')['type'] == 1) {
|
|
|
+ $whr[] = ["companyId", "=", $companyId];
|
|
|
+ $whr[] = ["delete", "=", 0];
|
|
|
+ $list = \app\common\model\EnterpriseVerifyMgr::where($whr)->select()->toArray();
|
|
|
+ $talentType = []; //查找单位对应标签
|
|
|
+ $org = [];
|
|
|
+ $ins = [];
|
|
|
+ $uniCodes = [];
|
|
|
+ foreach ($list as $k => $v) {
|
|
|
+ if (!empty($v['enterpriseTag'])) {
|
|
|
+ array_push($talentType, $v['enterpriseTag']);
|
|
|
+ }
|
|
|
+ if (!empty($v['organizationTag'])) {
|
|
|
+ array_push($org, $v['organizationTag']);
|
|
|
+ }
|
|
|
+ if (!empty($v['institutionTag'])) {
|
|
|
+ array_push($ins, $v['institutionTag']);
|
|
|
+ }
|
|
|
+ if (!empty($v["uniCode"])) {
|
|
|
+ $codes = explode(",", $v["uniCode"]);
|
|
|
+ $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 || $org || $ins) && $uniCodes) {
|
|
|
+ if ($expUniCodes) {
|
|
|
+ $whereRaw = sprintf('(newEnterpriseTag in ("%s") or newOrganizationTag in ("%s") or newInstitutionTag in ("%s") and newIdCard not in ("%s")) or newIdCard in ("%s")', implode('","', $talentType), implode('","', $org), implode('","', $ins), implode('","', $expUniCodes), implode('","', $uniCodes));
|
|
|
+ } else {
|
|
|
+ $whereRaw = sprintf('newEnterpriseTag in ("%s") or newOrganizationTag in ("%s") or newInstitutionTag in ("%s") or newIdCard in ("%s")', implode('","', $talentType), implode('","', $org), implode('","', $ins), implode('","', $uniCodes));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (($talentType || $org || $ins) && !$uniCodes) {
|
|
|
+ if ($expUniCodes) {
|
|
|
+ $whereRaw = sprintf('newEnterpriseTag in ("%s") or newOrganizationTag in ("%s") or newInstitutionTag in ("%s") and newIdCard not in ("%s")', implode('","', $talentType), implode('","', $org), implode('","', $ins), implode('","', $expUniCodes));
|
|
|
+ } else {
|
|
|
+ $whereRaw = sprintf('newEnterpriseTag in ("%s") or newOrganizationTag in ("%s") or newInstitutionTag in ("%s") ', implode('","', $talentType), implode('","', $org), implode('","', $ins));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $offset = trim($request->param("offset")) ?: 0;
|
|
|
+ $limit = trim($request->param("limit")) ?: 10;
|
|
|
+
|
|
|
+ $oldName = trim($request->param("oldName"));
|
|
|
+ $oldIdCard = trim($request->param("oldIdCard"));
|
|
|
+ $oldLegal = trim($request->param("oldLegal"));
|
|
|
+ $oldStreet = trim($request->param("oldStreet"));
|
|
|
+ $oldEnterpriseTag = trim($request->param("oldEnterpriseTag"));
|
|
|
+ $oldIndustryFieldNew = trim($request->param("oldIndustryFieldNew"));
|
|
|
+ $newName = trim($request->param("newName"));
|
|
|
+ $newIdCard = trim($request->param("newIdCard"));
|
|
|
+ $newAgentName = trim($request->param("newAgentName"));
|
|
|
+ $newStreet = trim($request->param("newStreet"));
|
|
|
+ $newEnterpriseTag = trim($request->param("newEnterpriseTag"));
|
|
|
+ $newIndustryFieldNew = trim($request->param("newIndustryFieldNew"));
|
|
|
+ $checkState = trim($request->param("checkState"));
|
|
|
+
|
|
|
+ if ($oldName) {
|
|
|
+ $where[] = ["oldName", "like", "%{$oldName}%"];
|
|
|
+ }
|
|
|
+ if ($oldIdCard) {
|
|
|
+ $where[] = ["oldIdCard", "like", "%{$oldIdCard}%"];
|
|
|
+ }
|
|
|
+ if ($oldLegal) {
|
|
|
+ $where[] = ["oldLegal", "like", "%{$oldLegal}%"];
|
|
|
+ }
|
|
|
+ if ($oldStreet) {
|
|
|
+ $where[] = ["oldStreet", "=", "{$oldStreet}"];
|
|
|
+ }
|
|
|
+ if ($oldEnterpriseTag) {
|
|
|
+ $where[] = ["oldEnterpriseTag", "=", "{$oldEnterpriseTag}"];
|
|
|
+ }
|
|
|
+ if ($oldIndustryFieldNew) {
|
|
|
+ $where[] = ["oldIndustryFieldNew", "=", "{$oldIndustryFieldNew}"];
|
|
|
+ }
|
|
|
+ if ($newName) {
|
|
|
+ $where[] = ["newName", "like", "%{$newName}%"];
|
|
|
+ }
|
|
|
+ if ($newIdCard) {
|
|
|
+ $where[] = ["newIdCard", "like", "%{$newIdCard}%"];
|
|
|
+ }
|
|
|
+ if ($newAgentName) {
|
|
|
+ $where[] = ["newAgentName", "like", "%{$newAgentName}%"];
|
|
|
+ }
|
|
|
+ if ($checkState) {
|
|
|
+ $where[] = ["checkState", "=", "{$checkState}"];
|
|
|
+ } else {
|
|
|
+ $where[] = ['checkState', '>', 1];
|
|
|
+ }
|
|
|
+ if ($newStreet) {
|
|
|
+ $where[] = ["newStreet", "=", "{$newStreet}"];
|
|
|
+ }
|
|
|
+ if ($newEnterpriseTag) {
|
|
|
+ $where[] = ["newEnterpriseTag", "=", "{$newEnterpriseTag}"];
|
|
|
+ }
|
|
|
+ if ($newIndustryFieldNew) {
|
|
|
+ $where[] = ["newIndustryFieldNew", "=", "{$newIndustryFieldNew}"];
|
|
|
+ }
|
|
|
+ if ($whereRaw) {
|
|
|
+ $count = EnterpriseRecord::where($where)->whereRaw($whereRaw)->count();
|
|
|
+ } else {
|
|
|
+ $count = EnterpriseRecord::where($where)->count();
|
|
|
+ }
|
|
|
+ if ($count > 0) {
|
|
|
+ $organizationTagList = DictApi::selectByParentCode("organization_tag");
|
|
|
+ $institutionTag = DictApi::selectByParentCode("institution_tag");
|
|
|
+ $talentTypeList = DictApi::selectByParentCode("enterprise_tag");
|
|
|
+ $enterpriseTypeList = DictApi::selectByParentCode("enterprise_type");
|
|
|
+ $industryFieldNewList = DictApi::selectByParentCode("industry_field");
|
|
|
+ $streetList = DictApi::selectByParentCode("street");
|
|
|
+ $agencyTypeList = DictApi::selectByParentCode("agency_type");
|
|
|
+ if ($whereRaw) {
|
|
|
+ $list = EnterpriseRecord::where($where)->whereRaw($whereRaw)->order("createTime", 'desc')->select()->toArray();
|
|
|
+ } else {
|
|
|
+ $list = EnterpriseRecord::where($where)->order("createTime", 'desc')->select()->toArray();
|
|
|
+ }
|
|
|
+ foreach ($list as $k => &$v) {
|
|
|
+ if ($v["special"] == 1) {
|
|
|
+ $v["typeName"] = "事业单位";
|
|
|
+ $v["oldAgencyTagName"] = $institutionTag[$v["oldInstitutionTag"]];
|
|
|
+ $v["newAgencyTagName"] = $institutionTag[$v["newInstitutionTag"]];
|
|
|
+ } else if ($v["special"] == 2) {
|
|
|
+ $v["typeName"] = "民办非企业";
|
|
|
+ $v["oldAgencyTagName"] = $organizationTagList[$v["oldOrganizationTag"]];
|
|
|
+ $v["newAgencyTagName"] = $organizationTagList[$v["newOrganizationTag"]];
|
|
|
+ } else {
|
|
|
+ $v["typeName"] = "企业用户";
|
|
|
+ if ($v["type"] == 1) {
|
|
|
+ $v["typeName"] .= "(晋江市现代产业体系人才)";
|
|
|
+ } else if ($v["type"] == 2) {
|
|
|
+ $v["typeName"] .= "(集成电路优秀人才)";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $v['oldStreetName'] = $streetList[$v['oldStreet']];
|
|
|
+ $v['newStreetName'] = $streetList[$v['newStreet']];
|
|
|
+ $v['oldEnterpriseTagName'] = $talentTypeList[$v['oldEnterpriseTag']];
|
|
|
+ $v['newEnterpriseTagName'] = $talentTypeList[$v['newEnterpriseTag']]; //此处旧字段为talentType,新字段为enterpriseTag,为防止数据污染与丢失,因而这样写
|
|
|
+ $v['oldIndustryFieldNewName'] = $industryFieldNewList[$v['oldIndustryFieldNew']];
|
|
|
+ $v['newIndustryFieldNewName'] = $industryFieldNewList[$v['newIndustryFieldNew']];
|
|
|
+ $v["oldIndustryFieldOldName"] = DictApi::findDictByCode($v['oldIndustryFieldOld'])["name"];
|
|
|
+ $v["newIndustryFieldOldName"] = DictApi::findDictByCode($v['newIndustryFieldOld'])["name"];
|
|
|
+ $v["oldEnterpriseTypeName"] = $enterpriseTypeList[$v["oldEnterpriseType"]];
|
|
|
+ $v["newEnterpriseTypeName"] = $enterpriseTypeList[$v["newEnterpriseType"]];
|
|
|
+ $v["oldAgencyTypeName"] = $agencyTypeList[$v["oldAgencyType"]];
|
|
|
+ $v["newAgencyTypeName"] = $agencyTypeList[$v["newAgencyType"]];
|
|
|
+ switch ($v["checkState"]) {
|
|
|
+ case 1:
|
|
|
+ $v['checkStateName'] = '保存未提交审核';
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ $v['checkStateName'] = '待审核';
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ $v['checkStateName'] = '审核驳回';
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ $v['checkStateName'] = '审核通过';
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ $v['checkStateName'] = '重新提交';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $list = [];
|
|
|
+ }
|
|
|
+ return $list;
|
|
|
+ }
|
|
|
+
|
|
|
public static function updateById($data) {
|
|
|
return Enterprise::update($data);
|
|
|
}
|