|
@@ -11,6 +11,7 @@ use app\common\api\DictApi;
|
|
|
use app\common\state\CommonConst;
|
|
|
use app\common\state\ProjectState;
|
|
|
use app\common\api\TalentLogApi;
|
|
|
+use app\common\model\TalentChecklog;
|
|
|
|
|
|
class TalentTypeChange extends AdminController {
|
|
|
|
|
@@ -113,7 +114,7 @@ class TalentTypeChange extends AdminController {
|
|
|
return json(["rows" => $list, "total" => $count]);
|
|
|
}
|
|
|
|
|
|
- public function toCommonCheck($id) {
|
|
|
+ public function toCommonCheck($id, $process) {
|
|
|
$info = ttcModel::find($id);
|
|
|
$arrangeMap = DictApi::selectByParentCode("talent_arrange");
|
|
|
$importMap = DictApi::selectByParentCode("import_way");
|
|
@@ -121,6 +122,7 @@ class TalentTypeChange extends AdminController {
|
|
|
$info["oldIntroductionModeName"] = $importMap[$info["oldIntroductionMode"]];
|
|
|
$info["newTalentArrangeName"] = $arrangeMap[$info["newTalentArrange"]];
|
|
|
$info["newIntroductionModeName"] = $importMap[$info["newIntroductionMode"]];
|
|
|
+ $info["process"] = $process;
|
|
|
if ($info["type"] == CommonConst::ENTERPRISE_NORMAL) {
|
|
|
$sourceMap = DictApi::selectByParentCode("source");
|
|
|
$info["oldSourceName"] = $sourceMap[$info["oldSource"]];
|
|
@@ -152,7 +154,6 @@ class TalentTypeChange extends AdminController {
|
|
|
$id = $this->request->param("id");
|
|
|
$companyId = $this->request->param("companyId");
|
|
|
$process = $this->request->param("process");
|
|
|
- var_dump($process);exit();
|
|
|
$response = new \stdClass();
|
|
|
$response->code = 500;
|
|
|
$whr = [];
|
|
@@ -174,6 +175,7 @@ class TalentTypeChange extends AdminController {
|
|
|
$response->msg = "该申报不在审核范围内,无法审核";
|
|
|
} else {
|
|
|
$lastLog = TalentLogApi::getLastLogEx($id, ProjectState::LEVELCHANGE, 0, $where);
|
|
|
+ $response->code = 200;
|
|
|
}
|
|
|
break;
|
|
|
case 1:
|
|
@@ -181,6 +183,7 @@ class TalentTypeChange extends AdminController {
|
|
|
$response->msg = "该申报不在审核范围内,无法审核";
|
|
|
} else {
|
|
|
$lastLog = TalentLogApi::getLastLogEx($id, ProjectState::LEVELCHANGE, 0, $where);
|
|
|
+ $response->code = 200;
|
|
|
}
|
|
|
break;
|
|
|
case 2:
|
|
@@ -189,6 +192,7 @@ class TalentTypeChange extends AdminController {
|
|
|
} else {
|
|
|
$where[] = ["companyId", "=", $companyId];
|
|
|
$lastLog = TalentLogApi::getLastLogEx($id, ProjectState::LEVELCHANGE, 0, $where);
|
|
|
+ $response->code = 200;
|
|
|
}
|
|
|
break;
|
|
|
case 3:
|
|
@@ -196,6 +200,7 @@ class TalentTypeChange extends AdminController {
|
|
|
$response->msg = "该申报不在审核范围内,无法审核";
|
|
|
} else {
|
|
|
$lastLog = TalentLogApi::getLastLogEx($id, ProjectState::LEVELCHANGE, 0, $where);
|
|
|
+ $response->code = 200;
|
|
|
}
|
|
|
break;
|
|
|
case 4:
|
|
@@ -210,17 +215,229 @@ class TalentTypeChange extends AdminController {
|
|
|
$info["checkMsg"] = "";
|
|
|
}
|
|
|
$response->data = $info;
|
|
|
- $response->code = 200;
|
|
|
|
|
|
$whrFile = [];
|
|
|
- $whrFile = ["type", "=", $info["type"]];
|
|
|
- $whrFile = ["project", "=", ProjectState::LEVELCHANGE];
|
|
|
- $whrFile = ["active", "=", 1];
|
|
|
+ $whrFile[] = ["type", "=", $info["type"]];
|
|
|
+ $whrFile[] = ["project", "=", ProjectState::LEVELCHANGE];
|
|
|
+ $whrFile[] = ["active", "=", 1];
|
|
|
$response->fileList = \app\common\model\FileType::where($whrFile)->order("sn asc")->select()->toArray();
|
|
|
+
|
|
|
+ $fieldList = DictApi::getTalentTypeChangeFields($info["type"]);
|
|
|
+ $field_tmp = [];
|
|
|
+ foreach ($fieldList as $key => $field) {
|
|
|
+ $field_tmp[] = ["key" => $key, "value" => $field];
|
|
|
+ }
|
|
|
+ $response->fieldList = $field_tmp;
|
|
|
+ }
|
|
|
+ return $response;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function check() {
|
|
|
+ $response = new \stdClass();
|
|
|
+ $response->code = 500;
|
|
|
+ $talentTypeChange = $this->request->param();
|
|
|
+ $id = $talentTypeChange["id"];
|
|
|
+ $process = $talentTypeChange["process"];
|
|
|
+ $checkState = $talentTypeChange["checkState"];
|
|
|
+ $checkMsg = $talentTypeChange["checkMsg"];
|
|
|
+ $fields = $talentTypeChange["fields"];
|
|
|
+ $files = $talentTypeChange["files"];
|
|
|
+ if (!$checkState) {
|
|
|
+ $response->msg = "请选择审核状态";
|
|
|
+ return $response;
|
|
|
}
|
|
|
+ if ($process == 1 || $process == 3) {
|
|
|
+ $upd["id"] = $id;
|
|
|
+ $upd["fields"] = $fields;
|
|
|
+ $upd["files"] = $files;
|
|
|
+ ttcModel::update($upd);
|
|
|
+ }
|
|
|
+ $user = $this->user;
|
|
|
+ $log["id"] = getStringId();
|
|
|
+ $log["active"] = 0;
|
|
|
+ $log["state"] = $checkState;
|
|
|
+ $log["step"] = $process;
|
|
|
+ $log["companyId"] = $user["companyId"];
|
|
|
+ $log["stateChange"] = "保存未提交";
|
|
|
+ $log["type"] = ProjectState::LEVELCHANGE;
|
|
|
+ $log["mainId"] = $id;
|
|
|
+ $log["description"] = $checkMsg;
|
|
|
+ $log["createUser"] = $user ? sprintf("%s(%s)", $user["account"], $user["companyName"] ?: $user["rolename"]) : "系统";
|
|
|
+ $log["createTime"] = date("Y-m-d H:i:s");
|
|
|
+ $response->msg = "审核成功";
|
|
|
+ $response->code = 200;
|
|
|
return $response;
|
|
|
}
|
|
|
|
|
|
+ public function submitCheck(TalentTypeChange ti) {
|
|
|
+ Company company = (Company) this.getSession().getAttribute("company");
|
|
|
+ EntityWrapper<TalentChecklog> logWrapper = new EntityWrapper<>();
|
|
|
+ if (ti.getProcess() == 2) {
|
|
|
+ logWrapper.eq("companyId", ti.getCompanyId());
|
|
|
+ }
|
|
|
+ logWrapper.eq("mainId", ti.getId()).eq("active", StateConst.ACTIVE_NO)
|
|
|
+ .eq("step", ti.getProcess()).orderBy("createTime", false).last("limit 1");
|
|
|
+ TalentChecklog log = this.talentChecklogService.selectOne(logWrapper);
|
|
|
+ if (log == null) {
|
|
|
+ return new ResponseObj(ResponseObj.FAILD, "请先审核后再提交");
|
|
|
+ }
|
|
|
+ Integer checkState = log.getState();
|
|
|
+ TalentTypeChange talentTypeChange = new TalentTypeChange();
|
|
|
+ talentTypeChange.setId(ti.getId());
|
|
|
+ talentTypeChange.setCheckMsg(log.getDescription());
|
|
|
+ TalentTypeChange old = this.talentTypeChangeService.selectById(ti.getId());
|
|
|
+ Enterprise enterprise = this.enterpriseService.selectById(old.getEnterpriseId());
|
|
|
+ //判断到达的最高流程
|
|
|
+ talentTypeChange.setHighProcess(old.getHighProcess() == null ? ti.getProcess() : old.getHighProcess() < ti.getProcess() ? ti.getProcess() : old.getHighProcess());
|
|
|
+ switch (ti.getProcess()) {
|
|
|
+ case -1:
|
|
|
+ if (checkState == -1) {
|
|
|
+ talentTypeChange.setCheckState(StateConst.RCRD_NOTPASS);
|
|
|
+ }
|
|
|
+ if (checkState == 2) {
|
|
|
+ talentTypeChange.setCheckState(StateConst.RCRD_BEFORE_REJECT);
|
|
|
+ }
|
|
|
+ if (checkState == 3) {
|
|
|
+ talentTypeChange.setCheckState(StateConst.RCRD_NEED_FIRST_CHECK);
|
|
|
+ talentTypeChange.setFirstBeforeSubmitTime(DateUtil.getTime());
|
|
|
+ }
|
|
|
+ TalentChecklog newLog = 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(), DateUtil.getTime(),
|
|
|
+ ShiroKit.getUser().getAccount() + "(" + company.getName() + ")");
|
|
|
+ this.talentChecklogService.delete(new EntityWrapper<TalentChecklog>().eq("mainId", ti.getId()).eq("active", StateConst.ACTIVE_NO));
|
|
|
+ this.talentChecklogService.insert(newLog);
|
|
|
+ this.talentTypeChangeService.updateById(talentTypeChange);
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ if (checkState == -1) {
|
|
|
+ talentTypeChange.setCheckState(StateConst.RCRD_NOTPASS);
|
|
|
+ }
|
|
|
+ if (checkState == 2) {
|
|
|
+ talentTypeChange.setCheckState(StateConst.RCRD_FIRST_REJECT);
|
|
|
+ }
|
|
|
+ //审核通过
|
|
|
+ if (checkState == 3) {
|
|
|
+ EntityWrapper<TalentDepcheckstate> wrapper = new EntityWrapper<>();
|
|
|
+ wrapper.eq("mainId", talentTypeChange.getId());
|
|
|
+ List<TalentDepcheckstate> tdList = this.talentDepcheckstateService.selectList(wrapper);
|
|
|
+ List<String> ids = new ArrayList<>();
|
|
|
+ List<String> oldCompanyIds = new ArrayList<>();
|
|
|
+ for (TalentDepcheckstate td : tdList) {
|
|
|
+ ids.add(td.getId());
|
|
|
+ oldCompanyIds.add(td.getCompanyId());
|
|
|
+ }
|
|
|
+ //根据申报来源决定审核流程 集成电路默认为1
|
|
|
+ //第一种来源无需部门审核
|
|
|
+ if (FengStringUtil.isNotEmpAndNull(old.getNewCertificateOutTime()) || old.getType() == 2) {
|
|
|
+ //如果存在部门记录,则删除部门数据
|
|
|
+ if (tdList != null && tdList.size() != 0) {
|
|
|
+ this.talentDepcheckstateService.deleteBatchIds(ids);
|
|
|
+ }
|
|
|
+ talentTypeChange.setCheckState(StateConst.RCRD_NEED_THIRD);
|
|
|
+ talentTypeChange.setFirstDepPassTime(DateUtil.getTime());
|
|
|
+ } else {
|
|
|
+ //审核通过时需要根据认定条件确定审核部门
|
|
|
+ IdentifyCondition ic = this.identifyConditionService.selectById(old.getNewIdentifyCondition());
|
|
|
+ if (FengStringUtil.isEmpOrNull(ic.getCompanyIds())) {
|
|
|
+ return new ResponseObj(ResponseObj.FAILD, "该认定条件还未设置审核单位,请设置审核单位后再试!");
|
|
|
+ }
|
|
|
+ String[] companyArr = ic.getCompanyIds().split(",");
|
|
|
+ List<TalentDepcheckstate> addList = new ArrayList<>();
|
|
|
+ List<String> deleteDepList = new ArrayList<>();
|
|
|
+ for (String companyId : companyArr) {
|
|
|
+ if (!oldCompanyIds.contains(companyId)) {
|
|
|
+ TalentDepcheckstate dep = new TalentDepcheckstate();
|
|
|
+ dep.setType(Integer.parseInt(ProjectConst.LEVELCHANGE));
|
|
|
+ dep.setMainId(old.getId());
|
|
|
+ dep.setCompanyId(companyId);
|
|
|
+ dep.setState(1);
|
|
|
+ dep.setCreateUser(ShiroKit.getUser().getName());
|
|
|
+ dep.setCreateTime(DateUtil.getTime());
|
|
|
+ addList.add(dep);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (String companyId : oldCompanyIds) {
|
|
|
+ List<String> sList = new ArrayList<>(Arrays.asList(companyArr));
|
|
|
+ if (!sList.contains(companyId)) {
|
|
|
+ deleteDepList.add(companyId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (deleteDepList.size() != 0) this.talentDepcheckstateService.deleteBatchIds(deleteDepList);
|
|
|
+ if (addList.size() != 0) this.talentDepcheckstateService.insertBatch(addList);
|
|
|
+ EntityWrapper<TalentDepcheckstate> depUpWrapper = new EntityWrapper<>();
|
|
|
+ depUpWrapper.eq("mainId", talentTypeChange.getId()).eq("state", StateConst.BASIC_REJECT);
|
|
|
+ this.talentDepcheckstateService.updateForSet("state=" + StateConst.BASIC_NEED, depUpWrapper);
|
|
|
+ talentTypeChange.setCheckState(StateConst.RCRD_NEED_DEP_CHECK);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ TalentChecklog newLog1 = 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(), DateUtil.getTime(),
|
|
|
+ ShiroKit.getUser().getAccount() + "(" + company.getName() + ")");
|
|
|
+ this.talentChecklogService.delete(new EntityWrapper<TalentChecklog>().eq("mainId", ti.getId()).eq("active", StateConst.ACTIVE_NO));
|
|
|
+ this.talentChecklogService.insert(newLog1);
|
|
|
+ this.talentTypeChangeService.updateById(talentTypeChange);
|
|
|
+ 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);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ if (checkState == -1) {
|
|
|
+ talentTypeChange.setCheckState(StateConst.RCRD_NOTPASS);
|
|
|
+ }
|
|
|
+ if (checkState == 2) {
|
|
|
+ talentTypeChange.setCheckState(StateConst.RCRD_DEP_REJECT);
|
|
|
+ //复核驳回时修改部门审核状态为驳回
|
|
|
+ EntityWrapper<TalentDepcheckstate> wrapper = new EntityWrapper<>();
|
|
|
+ wrapper.eq("mainId", talentTypeChange.getId());
|
|
|
+ this.talentDepcheckstateService.updateForSet("state=2", wrapper);
|
|
|
+ }
|
|
|
+ if (checkState == 3) {
|
|
|
+ talentTypeChange.setCheckState(StateConst.RCRD_PASS);
|
|
|
+ }
|
|
|
+ TalentChecklog newLog3 = 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(), DateUtil.getTime(),
|
|
|
+ ShiroKit.getUser().getAccount() + "(" + company.getName() + ")");
|
|
|
+ this.talentChecklogService.delete(new EntityWrapper<TalentChecklog>().eq("mainId", ti.getId()).eq("active", StateConst.ACTIVE_NO).eq("companyId", ti.getCompanyId()));
|
|
|
+ this.talentChecklogService.insert(newLog3);
|
|
|
+ this.talentTypeChangeService.updateById(talentTypeChange);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return new ResponseObj(ResponseObj.SUCCESS, "提交审核成功");
|
|
|
+ }
|
|
|
+
|
|
|
private function setTalentTypeChange(&$where, $data) {
|
|
|
if (\StrUtil::isNotEmpAndNull($data["talentName"])) {
|
|
|
$where[] = ["talentName", "like", "%{$data["talentName"]}%"];
|