|
@@ -2,8 +2,10 @@
|
|
|
|
|
|
namespace app\job;
|
|
namespace app\job;
|
|
|
|
|
|
|
|
+use app\common\api\BatchApi;
|
|
use app\common\api\TalentLogApi;
|
|
use app\common\api\TalentLogApi;
|
|
use app\common\model\TalentChecklog;
|
|
use app\common\model\TalentChecklog;
|
|
|
|
+use app\common\state\ProjectState;
|
|
use think\queue\Job;
|
|
use think\queue\Job;
|
|
use think\facade\Log;
|
|
use think\facade\Log;
|
|
use think\facade\Db;
|
|
use think\facade\Db;
|
|
@@ -188,7 +190,7 @@ class Import {
|
|
$datas = $sheet->toArray();
|
|
$datas = $sheet->toArray();
|
|
$datas = array_slice($datas, 1); //去标题
|
|
$datas = array_slice($datas, 1); //去标题
|
|
$country = Db::table("sys_dict")->where("pid", 35)->column("code", "name");
|
|
$country = Db::table("sys_dict")->where("pid", 35)->column("code", "name");
|
|
-
|
|
|
|
|
|
+ $batch = BatchApi::getValidBatch(ProjectState::TALENT, 1);
|
|
for ($index = 0; $index < count($datas); $index++) {
|
|
for ($index = 0; $index < count($datas); $index++) {
|
|
$row = $datas[$index];
|
|
$row = $datas[$index];
|
|
$msg = [];
|
|
$msg = [];
|
|
@@ -207,7 +209,7 @@ class Import {
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case 1:
|
|
case 1:
|
|
- $info = Db::table("un_enterprise")->where('idCard', $row[$i])->where('delete',0)->findOrEmpty();
|
|
|
|
|
|
+ $info = Db::table("un_enterprise")->where('idCard', $row[$i])->where('delete',0)->where('apply_year',$batch["batch"])->findOrEmpty();
|
|
if (!$info) {
|
|
if (!$info) {
|
|
array_push($msg, "机构代码不存在,请检查");
|
|
array_push($msg, "机构代码不存在,请检查");
|
|
} else {
|
|
} else {
|
|
@@ -308,6 +310,7 @@ class Import {
|
|
} else {
|
|
} else {
|
|
$item["highProcess"] = 5; //最高进度
|
|
$item["highProcess"] = 5; //最高进度
|
|
$item['createTime'] = date("Y-m-d H:i:s", time());
|
|
$item['createTime'] = date("Y-m-d H:i:s", time());
|
|
|
|
+ $item['apply_year'] = $batch["batch"];
|
|
Db::table("new_talent_info")->insert($item);
|
|
Db::table("new_talent_info")->insert($item);
|
|
$sheet->setCellValue('AL' . ($index + 2), '导入成功');
|
|
$sheet->setCellValue('AL' . ($index + 2), '导入成功');
|
|
|
|
|
|
@@ -342,10 +345,9 @@ class Import {
|
|
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($path ."/public/storage/" . $res['task_file']);
|
|
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($path ."/public/storage/" . $res['task_file']);
|
|
$sheet = $spreadsheet->getSheet(0);
|
|
$sheet = $spreadsheet->getSheet(0);
|
|
$datas = $sheet->toArray();
|
|
$datas = $sheet->toArray();
|
|
-
|
|
|
|
$datas = array_slice($datas, 1); //去标题
|
|
$datas = array_slice($datas, 1); //去标题
|
|
$country = Db::table("sys_dict")->where("pid", 35)->column("code", "name");
|
|
$country = Db::table("sys_dict")->where("pid", 35)->column("code", "name");
|
|
-
|
|
|
|
|
|
+ $batch = BatchApi::getValidBatch(ProjectState::TALENT, 1);
|
|
for ($index = 0; $index < count($datas); $index++) {
|
|
for ($index = 0; $index < count($datas); $index++) {
|
|
$row = $datas[$index];
|
|
$row = $datas[$index];
|
|
$msg = [];
|
|
$msg = [];
|
|
@@ -364,7 +366,8 @@ class Import {
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case 1:
|
|
case 1:
|
|
- $info = Db::table("un_enterprise")->where('idCard', $row[$i])->where('delete',0)->findOrEmpty();
|
|
|
|
|
|
+
|
|
|
|
+ $info = Db::table("un_enterprise")->where('idCard', $row[$i])->where('delete',0)->where('apply_year',$batch["batch"])->findOrEmpty();
|
|
if (!$info) {
|
|
if (!$info) {
|
|
array_push($msg, "机构代码不存在,请检查");
|
|
array_push($msg, "机构代码不存在,请检查");
|
|
} else {
|
|
} else {
|
|
@@ -471,6 +474,7 @@ class Import {
|
|
Db::table("new_talent_info")->where('id', $talent_info['id'])->update($item);
|
|
Db::table("new_talent_info")->where('id', $talent_info['id'])->update($item);
|
|
$sheet->setCellValue('AC' . ($index + 2), '更新成功');
|
|
$sheet->setCellValue('AC' . ($index + 2), '更新成功');
|
|
} else {
|
|
} else {
|
|
|
|
+ $item['apply_year'] = $batch["batch"];
|
|
$item['createTime'] = date("Y-m-d H:i:s", time());
|
|
$item['createTime'] = date("Y-m-d H:i:s", time());
|
|
Db::table("new_talent_info")->insert($item);
|
|
Db::table("new_talent_info")->insert($item);
|
|
$sheet->setCellValue('AC' . ($index + 2), '导入成功');
|
|
$sheet->setCellValue('AC' . ($index + 2), '导入成功');
|