|
@@ -73,12 +73,10 @@ class TalentTypeChange extends AdminController {
|
|
|
$this->setTalentTypeChange($where, $params);
|
|
|
$this->setTypeChangeCheckStateCondition($where, $params, $process);
|
|
|
//$whereRaw = "length(talentId) <> 19";
|
|
|
- if (in_array($this->user["type"], [1, 2, 5, 6])) {
|
|
|
- $where[] = ["type", "=", $this->user["type"]];
|
|
|
- }
|
|
|
$where[] = ["delete", "=", 0];
|
|
|
switch ($process) {
|
|
|
case -1:
|
|
|
+ $where[] = ["type", "=", $this->user["type"]];
|
|
|
$company = \app\common\api\CompanyApi::getOne($this->user["companyId"]);
|
|
|
$where[] = ["beforeCheckCompany", "EXP", Db::raw("is not null")];
|
|
|
if ($this->user["code"] != $company["code"]) {
|
|
@@ -86,27 +84,53 @@ class TalentTypeChange extends AdminController {
|
|
|
}
|
|
|
break;
|
|
|
case 1:
|
|
|
+ $where[] = ["type", "=", $this->user["type"]];
|
|
|
$where[] = ["checkState", "not in", [3, 5]];
|
|
|
break;
|
|
|
case 2:
|
|
|
- //Company company = (Company) super . getSession() . getAttribute("company");
|
|
|
- //page = this . talentDepcheckstateService . selectForTalentTypeChange(obj, page, company, Integer . parseInt(ProjectConst . LEVELCHANGE));
|
|
|
+ $where[] = ["ttc.type", "=", $this->user["type"]];
|
|
|
+ $companyId = $this->user["companyId"];
|
|
|
+ $where[] = ["td.companyId", "=", $companyId];
|
|
|
+ $where[] = ["td.type", "=", ProjectState::LEVELCHANGE];
|
|
|
+ switch ($params["checkState"]) {
|
|
|
+ case 1:
|
|
|
+ case 2:
|
|
|
+ case 3:
|
|
|
+ $where[] = ["td.state", "=", $params["checkState"]];
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ $where[] = ["ttc.highProcess", ">=", 2];
|
|
|
+ $where[] = ["td.state", "=", 1];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ $count = ttcModel::alias("ttc")->leftJoin("un_talent_depcheckstate td", "td.mainId=ttc.id")->where($where)->count();
|
|
|
+ $list = ttcModel::alias("ttc")->field("ttc.*,td.companyId,td.state as depState")->leftJoin("un_talent_depcheckstate td", "td.mainId=ttc.id")->where($where)->limit($offset, $limit)->order("ttc.createTime {$order}")->select()->toArray();
|
|
|
break;
|
|
|
case 3:
|
|
|
- //$where[] = ["firstDepPassTime", "EXP", Db::raw("is not null")];
|
|
|
+ $where[] = ["type", "=", $this->user["type"]];
|
|
|
+ $whereRaw = "firstDepPassTime is not null or (checkCompanyIds is null and highProcess >=1)";
|
|
|
break;
|
|
|
case 4:
|
|
|
+ $where[] = ["type", "=", $this->user["type"]];
|
|
|
$where[] = ["checkState", "in", [-1, 35]];
|
|
|
break;
|
|
|
case 5:
|
|
|
+ $where[] = ["type", "=", $this->user["type"]];
|
|
|
$where[] = ["checkState", "=", 35];
|
|
|
$where[] = ["isPublic", "=", 6];
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$levelMap = DictApi::selectByParentCode("talent_arrange");
|
|
|
- $count = ttcModel::where($where)->count();
|
|
|
- $list = ttcModel::where($where)->limit($offset, $limit)->order("createTime {$order}")->select()->toArray();
|
|
|
+ if ($process != 2) {
|
|
|
+ if ($whereRaw) {
|
|
|
+ $count = ttcModel::where($where)->whereRaw($whereRaw)->count();
|
|
|
+ $list = ttcModel::where($where)->whereRaw($whereRaw)->limit($offset, $limit)->order("createTime {$order}")->select()->toArray();
|
|
|
+ } else {
|
|
|
+ $count = ttcModel::where($where)->count();
|
|
|
+ $list = ttcModel::where($where)->limit($offset, $limit)->order("createTime {$order}")->select()->toArray();
|
|
|
+ }
|
|
|
+ }
|
|
|
foreach ($list as $key => $item) {
|
|
|
if ($item["beforeCheckCompany"]) {
|
|
|
$list[$key]["beforeCheckCompanyName"] = getCacheById("Company", $item["beforeCheckCompany"]);
|
|
@@ -173,6 +197,44 @@ class TalentTypeChange extends AdminController {
|
|
|
return view("", ["info" => $info]);
|
|
|
}
|
|
|
|
|
|
+ public function toDepCheck($id, $companyId) {
|
|
|
+ $info = ttcApi::getOne($id);
|
|
|
+ $arrangeMap = DictApi::selectByParentCode("talent_arrange");
|
|
|
+ $importMap = DictApi::selectByParentCode("import_way");
|
|
|
+ $info["oldTalentArrangeName"] = $arrangeMap[$info["oldTalentArrange"]];
|
|
|
+ $info["oldIntroductionModeName"] = $importMap[$info["oldIntroductionMode"]];
|
|
|
+ $info["newTalentArrangeName"] = $arrangeMap[$info["newTalentArrange"]];
|
|
|
+ $info["newIntroductionModeName"] = $importMap[$info["newIntroductionMode"]];
|
|
|
+ $info["process"] = 2;
|
|
|
+ if ($info["type"] == CommonConst::ENTERPRISE_NORMAL) {
|
|
|
+ $sourceMap = DictApi::selectByParentCode("source");
|
|
|
+ $info["oldSourceName"] = $sourceMap[$info["oldSource"]];
|
|
|
+ $info["newSourceName"] = $sourceMap[$info["newSource"]];
|
|
|
+ }
|
|
|
+ $talentCatMap = DictApi::selectByParentCode("talent_condition_cats");
|
|
|
+ if (strlen($info["oldIdentifyCondition"]) == 19) {
|
|
|
+ $oldCondition = Db::table("un_identify_condition")->find($info["oldIdentifyCondition"]);
|
|
|
+ $info["oldIdentifyConditionCH"] = $oldCondition["name"];
|
|
|
+ } else {
|
|
|
+ $oldCondition = TalentConditionApi::getOne($info["oldIdentifyCondition"]);
|
|
|
+ if ($oldCondition["talentLevelCat"]) {
|
|
|
+ $info["oldIdentifyConditionCategoryName"] = $talentCatMap[$oldCondition["talentLevelCat"]];
|
|
|
+ }
|
|
|
+ $info["oldIdentifyConditionCH"] = $oldCondition["name"];
|
|
|
+ }
|
|
|
+ if (strlen($info["newIdentifyCondition"]) == 19) {
|
|
|
+ $newCondition = Db::table("un_identify_condition")->find($info["newIdentifyCondition"]);
|
|
|
+ $info["newIdentifyConditionCH"] = $newCondition["name"];
|
|
|
+ } else {
|
|
|
+ $newCondition = TalentConditionApi::getOne($info["newIdentifyCondition"]);
|
|
|
+ if ($newCondition["talentLevelCat"]) {
|
|
|
+ $info["newIdentifyConditionCategoryName"] = $talentCatMap[$newCondition["talentLevelCat"]];
|
|
|
+ }
|
|
|
+ $info["newIdentifyConditionCH"] = $newCondition["name"];
|
|
|
+ }
|
|
|
+ return view("to_common_check", ["info" => $info, "companyId" => $companyId]);
|
|
|
+ }
|
|
|
+
|
|
|
public function findFieldsAndFiles() {
|
|
|
$response = new \stdClass();
|
|
|
$response->code = 500;
|
|
@@ -459,10 +521,54 @@ class TalentTypeChange extends AdminController {
|
|
|
if ($checkState == 3) {
|
|
|
$talent_condition = TalentConditionApi::getOne($old["newIdentifyCondition"]);
|
|
|
$companyIds = array_filter(explode(",", $talent_condition["companyIds"]));
|
|
|
+ $tdList = Db::table("un_talent_depcheckstate")->where("mainId", $id)->select()->toArray();
|
|
|
+ $ids = [];
|
|
|
+ $oldCompanyIds = [];
|
|
|
+ foreach ($tdList as $td) {
|
|
|
+ $ids[] = $td["id"];
|
|
|
+ $oldCompanyIds[] = $td["companyId"];
|
|
|
+ }
|
|
|
if ($companyIds) {
|
|
|
+ $addList = [];
|
|
|
+ $deleteDepList = [];
|
|
|
+ foreach ($companyIds as $_companyId) {
|
|
|
+ if (!in_array($_companyId, $oldCompanyIds)) {
|
|
|
+ $dep["id"] = getStringId();
|
|
|
+ $dep["type"] = ProjectState::LEVELCHANGE;
|
|
|
+ $dep["mainId"] = $id;
|
|
|
+ $dep["companyId"] = $_companyId;
|
|
|
+ $dep["state"] = 1;
|
|
|
+ $dep["createUser"] = $this->user["name"];
|
|
|
+ $dep["createTime"] = date("Y-m-d H:i:s");
|
|
|
+ $addList[] = $dep;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ foreach ($oldCompanyIds as $_ocompanyId) {
|
|
|
+ if (!in_array($_ocompanyId, $companyIds)) {
|
|
|
+ $deleteDepList[] = $_ocompanyId;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($addList) {
|
|
|
+ Db::table("un_talent_depcheckstate")->insertAll($addList);
|
|
|
+ }
|
|
|
+ if ($deleteDepList) {
|
|
|
+ $where = [];
|
|
|
+ $where[] = ["mainId", "=", $id];
|
|
|
+ $where[] = ["companyId", "in", $deleteDepList];
|
|
|
+ Db::table("un_talent_depcheckstate")->where($where)->delete();
|
|
|
+ }
|
|
|
+ $where = [];
|
|
|
+ $where[] = ["mainId", "=", $id];
|
|
|
+ $updTd["state"] = 1;
|
|
|
+ Db::table("un_talent_depcheckstate")->where($where)->update($updTd);
|
|
|
$data["checkCompanyIds"] = implode(",", $companyIds);
|
|
|
$data["checkState"] = MainState::NEED_DEP_CHECK;
|
|
|
} else {
|
|
|
+ if ($ids) {
|
|
|
+ $where = [];
|
|
|
+ $where[] = ["id", "in", $ids];
|
|
|
+ Db::table("un_talent_depcheckstate")->where($where)->delete();
|
|
|
+ }
|
|
|
$data["checkCompanyIds"] = null;
|
|
|
$data["checkState"] = MainState::NEED_THIRD;
|
|
|
}
|
|
@@ -477,38 +583,49 @@ class TalentTypeChange extends AdminController {
|
|
|
Db::table("un_talent_type_change")->update($data);
|
|
|
break;
|
|
|
case 2:
|
|
|
- /* EntityWrapper<TalentDepcheckstate> tdWrapper = new EntityWrapper<>();
|
|
|
- tdWrapper.eq("mainId", ti.getId()).eq("companyId", ti.getCompanyId());
|
|
|
- TalentDepcheckstate tds = this.talentDepcheckstateService.selectOne(tdWrapper);
|
|
|
- tds.setState(checkState);
|
|
|
- if (checkState == 3) {
|
|
|
- tds.setSubmitTime(DateUtil.getTime());
|
|
|
- }
|
|
|
- this.talentDepcheckstateService.updateById(tds);
|
|
|
- //判断所有部门是否全部通过
|
|
|
- EntityWrapper<TalentDepcheckstate> needWrapper = new EntityWrapper<>();
|
|
|
- needWrapper.eq("mainId", ti.getId()).eq("state", 1);
|
|
|
- int needCount = this.talentDepcheckstateService.selectCount(needWrapper);
|
|
|
- if (needCount == 0) {
|
|
|
- EntityWrapper<TalentDepcheckstate> rejectWrapper = new EntityWrapper<>();
|
|
|
- rejectWrapper.eq("mainId", ti.getId()).eq("state", 2);
|
|
|
- int rejectCount = this.talentDepcheckstateService.selectCount(rejectWrapper);
|
|
|
- if (rejectCount > 0) {
|
|
|
- talentTypeChange.setCheckState(StateConst.RCRD_DEP_REJECT);
|
|
|
- } else {
|
|
|
- if (FengStringUtil.isEmpOrNull(old.getFirstDepPassTime())) {
|
|
|
- talentTypeChange.setFirstDepPassTime(DateUtil.getTime());
|
|
|
- }
|
|
|
- talentTypeChange.setCheckState(StateConst.RCRD_NEED_THIRD);
|
|
|
- }
|
|
|
- this.talentTypeChangeService.updateById(talentTypeChange);
|
|
|
- }
|
|
|
- TalentChecklog newLog2 = new TalentChecklog(Integer.parseInt(ProjectConst.LEVELCHANGE), ti.getId(), null, StateConst.ACTIVE_YES, BasicStateEnum.RCRD_BASEIC_SUBMIT.getCode(),
|
|
|
- ti.getProcess(), MainStateEnum.valueOf(old.getCheckState()) + "->" + MainStateEnum.valueOf(talentTypeChange.getCheckState()), log.getDescription() + "(" + company.getName() + ")", DateUtil.getTime(),
|
|
|
- ShiroKit.getUser().getAccount() + "(" + company.getName() + ")");
|
|
|
- newLog2.setCompanyId(company.getId());
|
|
|
- this.talentChecklogService.delete(new EntityWrapper<TalentChecklog>().eq("mainId", ti.getId()).eq("active", StateConst.ACTIVE_NO).eq("companyId", ti.getCompanyId()));
|
|
|
- this.talentChecklogService.insert(newLog2); */
|
|
|
+ $where = [];
|
|
|
+ $where[] = ["mainId", "=", $id];
|
|
|
+ $where[] = ["companyId", "=", $companyId];
|
|
|
+ $td = Db::table("un_talent_depcheckstate")->where($where)->find();
|
|
|
+ $updTd = [];
|
|
|
+ $updTd["id"] = $td["id"];
|
|
|
+ $updTd["state"] = $checkState;
|
|
|
+ if ($checkState == 3) {
|
|
|
+ $updTd["submitTime"] = date("Y-m-d H:i:s");
|
|
|
+ }
|
|
|
+ Db::table("un_talent_depcheckstate")->update($updTd);
|
|
|
+ //判断所有部门是否全部通过
|
|
|
+ unset($where);
|
|
|
+ $where[] = ["mainId", "=", $id];
|
|
|
+ $tdList = Db::table("un_talent_depcheckstate")->where($where)->select()->toArray();
|
|
|
+ $needCount = 0;
|
|
|
+ $rejectCount = 0;
|
|
|
+ foreach ($tdList as $td) {
|
|
|
+ if ($td["state"] == 1) {
|
|
|
+ $needCount++;
|
|
|
+ }
|
|
|
+ if ($td["state"] == 2) {
|
|
|
+ $rejectCount++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($needCount == 0) {
|
|
|
+ if ($rejectCount > 0) {
|
|
|
+ $data["checkState"] = MainState::DEP_REJECT;
|
|
|
+ } else {
|
|
|
+ if (\StrUtil::isEmpOrNull($old["firstDepPassTime"])) {
|
|
|
+ $data["firstDepPassTime"] = date("Y-m-d H:i:s");
|
|
|
+ }
|
|
|
+ $data["checkState"] = MainState::NEED_THIRD;
|
|
|
+ }
|
|
|
+ Db::table("un_talent_type_change")->update($data);
|
|
|
+ }
|
|
|
+ $log["id"] = $lastLog["id"];
|
|
|
+ $log["active"] = 1;
|
|
|
+ $log["state"] = 8;
|
|
|
+ $log["stateChange"] = MainState::getStateDesc($old["checkState"]) . "->" . MainState::getStateDesc($data["checkState"]);
|
|
|
+ $log["updateUser"] = $user ? sprintf("%s(%s)", $user["account"], $user["companyName"] ?: $user["rolename"]) : "系统";
|
|
|
+ $log["updateTime"] = date("Y-m-d H:i:s");
|
|
|
+ Db::table("new_talent_checklog")->update($log);
|
|
|
break;
|
|
|
case 3:
|
|
|
if ($checkState == -1) {
|
|
@@ -1441,7 +1558,6 @@ class TalentTypeChange extends AdminController {
|
|
|
$response = new \stdClass();
|
|
|
$response->code = 500;
|
|
|
$where = [];
|
|
|
- $where[] = ["type", "=", $this->user["type"]];
|
|
|
//$whereRaw = "length(talentId) <> 19";
|
|
|
$request = $this->request;
|
|
|
$talentName = \StrUtil::getRequestDecodeParam($request, "talentName");
|
|
@@ -1493,24 +1609,56 @@ class TalentTypeChange extends AdminController {
|
|
|
$this->setTypeChangeCheckStateCondition($where, $filters, $process);
|
|
|
switch ($process) {
|
|
|
case -1:
|
|
|
+ $where[] = ["type", "=", $this->user["type"]];
|
|
|
+ $company = \app\common\api\CompanyApi::getOne($this->user["companyId"]);
|
|
|
+ $where[] = ["beforeCheckCompany", "EXP", Db::raw("is not null")];
|
|
|
+ if ($this->user["code"] != $company["code"]) {
|
|
|
+ $where[] = ["beforeCheckCompany", "=", $company["id"]];
|
|
|
+ }
|
|
|
break;
|
|
|
case 1:
|
|
|
+ $where[] = ["type", "=", $this->user["type"]];
|
|
|
$where[] = ["checkState", "not in", [3, 5]];
|
|
|
break;
|
|
|
case 2:
|
|
|
+ $where[] = ["ttc.type", "=", $this->user["type"]];
|
|
|
+ $companyId = $this->user["companyId"];
|
|
|
+ $where[] = ["td.companyId", "=", $companyId];
|
|
|
+ $where[] = ["td.type", "=", ProjectState::LEVELCHANGE];
|
|
|
+ switch ($checkState) {
|
|
|
+ case 1:
|
|
|
+ case 2:
|
|
|
+ case 3:
|
|
|
+ $where[] = ["td.state", "=", $checkState];
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ $where[] = ["ttc.highProcess", ">=", 2];
|
|
|
+ $where[] = ["td.state", "=", 1];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ $list = ttcModel::alias("ttc")->field("ttc.*,td.companyId,td.state as depState")->leftJoin("un_talent_depcheckstate td", "td.mainId=ttc.id")->where($where)->select()->toArray();
|
|
|
break;
|
|
|
case 3:
|
|
|
- $where[] = ["checkState", "in", [-1, 35]];
|
|
|
+ $where[] = ["type", "=", $this->user["type"]];
|
|
|
+ $whereRaw = "firstDepPassTime is not null or (checkCompanyIds is null and highProcess >=1)";
|
|
|
break;
|
|
|
case 4:
|
|
|
+ $where[] = ["type", "=", $this->user["type"]];
|
|
|
$where[] = ["checkState", "in", [-1, 35]];
|
|
|
break;
|
|
|
case 5:
|
|
|
+ $where[] = ["type", "=", $this->user["type"]];
|
|
|
$where[] = ["checkState", "=", 35];
|
|
|
$where[] = ["isPublic", "=", 6];
|
|
|
break;
|
|
|
}
|
|
|
- $list = ttcModel::where($where)->select()->toArray();
|
|
|
+ if ($process != 2) {
|
|
|
+ if ($whereRaw) {
|
|
|
+ $list = ttcModel::where($where)->whereRaw($whereRaw)->select()->toArray();
|
|
|
+ } else {
|
|
|
+ $list = ttcModel::where($where)->select()->toArray();
|
|
|
+ }
|
|
|
+ }
|
|
|
$list = $this->translateToChinese($list, $process);
|
|
|
$columns = [
|
|
|
"姓名", "证件号码", "工作单位", "所属街道", "原申报年度", "原申报来源", "原入选来源地级市", "原入选来源县市区", "原人才层次", "原认定条件", "原认定条件证书取得时间", "原认定条件过期时间", "原认定条件名称",
|