|
@@ -9,6 +9,7 @@ use app\common\api\DictApi;
|
|
|
use app\common\state\AllowanceStateEnum;
|
|
|
use app\common\state\AllowanceProjectEnum;
|
|
|
use app\common\api\TalentAllowanceApi;
|
|
|
+use app\common\model\TalentChecklog;
|
|
|
|
|
|
/**
|
|
|
* Description of TalentAllowance
|
|
@@ -84,7 +85,7 @@ class TalentAllowance extends AdminController {
|
|
|
$this->translateToChinese($obj);
|
|
|
return view("info", ["row" => $obj, "process" => $process]);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 校验是否在审核范围内
|
|
|
*/
|
|
@@ -92,10 +93,10 @@ class TalentAllowance extends AdminController {
|
|
|
$id = $this->request["id"];
|
|
|
$type = $this->request["type"];
|
|
|
$process = $this->request["process"];
|
|
|
-
|
|
|
+
|
|
|
$response = new \stdClass();
|
|
|
$response->code = 500;
|
|
|
-
|
|
|
+
|
|
|
$info = null;
|
|
|
switch ($type) {
|
|
|
case 1: //编辑合同
|
|
@@ -115,74 +116,78 @@ class TalentAllowance extends AdminController {
|
|
|
return $response;
|
|
|
}
|
|
|
$where = [];
|
|
|
- $where[] = ["mainId","=",$info["id"]];
|
|
|
- $where[] = ["step","=",$process];
|
|
|
- $where[] = ["active","=",2];
|
|
|
- \app\common\model\TalentChecklog::where($where)->order("createTime desc")->find();
|
|
|
+ $where[] = ["mainId", "=", $info["id"]];
|
|
|
+ $where[] = ["step", "=", $process];
|
|
|
+ $where[] = ["active", "=", 2];
|
|
|
+
|
|
|
$log = null;
|
|
|
switch ($process) {
|
|
|
case 1:
|
|
|
- if (info.getCheckState() != AllowanceStateEnum.NEED_CHECK.getCode() && info.getCheckState() != AllowanceStateEnum.REJECT_TO_FIRST.getCode()) {
|
|
|
- return new ResponseObj(ResponseObj.FAILD, "不在审核范围内");
|
|
|
- } else {
|
|
|
- TalentDepcheckstate depcheckstate = this.talentDepcheckstateService.selectOne(new EntityWrapper<TalentDepcheckstate>().eq("mainId", info.getId()).eq("companyId", companyId).last("limit 1"));
|
|
|
- if (depcheckstate.getState() != BasicStateEnum.RCRD_BASIC_NEED.getCode() && depcheckstate.getState() != BasicStateEnum.RCRD_BASEIC_RESUBMIT.getCode()
|
|
|
- && depcheckstate.getState() != BasicStateEnum.RCRD_BASIC_UPREJECT.getCode()) {
|
|
|
- return new ResponseObj(ResponseObj.FAILD, "不在审核范围内");
|
|
|
- }
|
|
|
+ if ($info["checkState"] != AllowanceStateEnum::NEED_CHECK && $info["checkState"] != AllowanceStateEnum::REJECT_TO_FIRST) {
|
|
|
+ $response->msg = "不在审核范围内";
|
|
|
+ return $response;
|
|
|
}
|
|
|
- logWrapper.eq("companyId", companyId);
|
|
|
- log = this.talentChecklogService.selectOne(logWrapper);
|
|
|
+ //$where[] = ["companyId","=",$this->user["companyId"]];
|
|
|
+ $log = TalentChecklog::where($where)->order("createTime desc")->find();
|
|
|
break;
|
|
|
case 2:
|
|
|
- if (info.getCheckState() != AllowanceStateEnum.NEED_VISIT_CHECK.getCode() && info.getCheckState() != AllowanceStateEnum.REVIEW_REJECT.getCode()) {
|
|
|
- return new ResponseObj(ResponseObj.FAILD, "不在审核范围内");
|
|
|
+ if ($info["checkState"] != AllowanceStateEnum::NEED_VISIT_CHECK && $info["checkState"] != AllowanceStateEnum::REVIEW_REJECT) {
|
|
|
+ $response->msg = "不在审核范围内";
|
|
|
+ return $response;
|
|
|
}
|
|
|
break;
|
|
|
case 3:
|
|
|
- if (info.getCheckState() != AllowanceStateEnum.NEED_REVIEW.getCode() && info.getCheckState() != AllowanceStateEnum.PUBLIC_REJECT.getCode()) {
|
|
|
- return new ResponseObj(ResponseObj.FAILD, "不在审核范围内");
|
|
|
+ if ($info["checkState"] != AllowanceStateEnum::NEED_REVIEW && $info["checkState"] != AllowanceStateEnum::PUBLIC_REJECT) {
|
|
|
+ $response->msg = "不在审核范围内";
|
|
|
+ return $response;
|
|
|
}
|
|
|
- log = this.talentChecklogService.selectOne(logWrapper);
|
|
|
+ $log = TalentChecklog::where($where)->order("createTime desc")->find();
|
|
|
break;
|
|
|
}
|
|
|
- if (log != null) {
|
|
|
- info.setCheckState(log.getState());
|
|
|
- info.setCheckMsg(log.getDescription());
|
|
|
+ if ($log != null) {
|
|
|
+ $info["checkState"] = $log["state"];
|
|
|
+ $info["checkMsg"] = $log["description"];
|
|
|
} else {
|
|
|
- info.setCheckState(null);
|
|
|
- info.setCheckMsg("");
|
|
|
+ $info["checkState"] = null;
|
|
|
+ $info["checkMsg"] = "";
|
|
|
}
|
|
|
- Map<String, Object> res = new HashMap<>();
|
|
|
- res.put("info", info);
|
|
|
- if (type == 3) {
|
|
|
- Map<String, String> enterpriseMap = this.enterpriseService.selectListForMap(new EntityWrapper<Enterprise>());
|
|
|
- EntityWrapper<TalentAllowanceProject> projectEntityWrapper = new EntityWrapper<>();
|
|
|
- projectEntityWrapper.eq("mainId", id).eq("isLock", 1);
|
|
|
- if (ShiroKit.getUser().getType() == 1) {
|
|
|
- projectEntityWrapper.eq("project", AllowanceProjectEnum.PROJECT_TAX.getCode());
|
|
|
- }
|
|
|
- List<TalentAllowanceProject> projectList = this.talentAllowanceProjectService.selectList(projectEntityWrapper);
|
|
|
- List<TalentAllowancecontractDetail> detailList = this.talentAllowancecontractDetailService.selectList(new EntityWrapper<TalentAllowancecontractDetail>().eq("mainId", id));
|
|
|
- Map<String, TalentAllowancecontractDetail> detailMap = detailList.stream().collect(Collectors.toMap(TalentAllowancecontractDetail::getId, Function.identity()));
|
|
|
- for (TalentAllowancecontractDetail detail : detailList) {
|
|
|
- detail.setEnterpriseName(enterpriseMap.get(detail.getEnterpriseId()) + "(" + detail.getStartTime() + "至" + detail.getEndTime() + ")");
|
|
|
+ $res = [];
|
|
|
+ $res["info"] = $info;
|
|
|
+ if ($type == 3) {
|
|
|
+ $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
|
|
|
+ $where = [];
|
|
|
+ $where[] = ["mainId", "=", $id];
|
|
|
+ $where[] = ["isLock", "=", 1];
|
|
|
+ $projectList = \app\common\model\TalentAllowanceProject::where($where)->select()->toArray();
|
|
|
+ $detailList = \app\common\model\TalentAllowancecontractDetail::where("mainId", $id)->select()->toArray();
|
|
|
+ $detailMap = array_reduce($detailList, function ($result, $item) {
|
|
|
+ $key = $item["id"];
|
|
|
+ $result[$key] = $item;
|
|
|
+ return $result;
|
|
|
+ }, []);
|
|
|
+ foreach ($detailList as &$detail) {
|
|
|
+ $detail["enterpriseName"] = sprintf("%s(%s至%s)", $enterpriseMap[$detail["enterpriseId"]], $detail["startTime"], $detail["endTime"]);
|
|
|
+ }unset($detail);
|
|
|
+ foreach ($projectList as &$project) {
|
|
|
+ $detail = $detailMap[$project["baseId"]];
|
|
|
+ $project["projectName"] = sprintf("%s(%s(%s至%s))", AllowanceProjectEnum::getProjectName($project["project"]), $enterpriseMap[$project["enterpriseId"]], $detail["startTime"], $detail["endTime"]);
|
|
|
}
|
|
|
- for (TalentAllowanceProject project : projectList) {
|
|
|
- Enterprise enterprise = this.enterpriseService.selectById(project.getEnterpriseId());
|
|
|
- TalentAllowancecontractDetail detail = detailMap.get(project.getBaseId());
|
|
|
- project.setProjectName(AllowanceProjectEnum.valueOf(project.getProject()) + "(" + enterprise.getName() + "(" + detail.getStartTime() + "至" + detail.getEndTime() + "))");
|
|
|
- }
|
|
|
- EntityWrapper<UnCommonFiletype> filetypeEntityWrapper = new EntityWrapper<>();
|
|
|
- filetypeEntityWrapper.eq("project", ProjectEnum.JBT.getCode()).eq("active", 1).eq("type", info.getType());
|
|
|
- List<UnCommonFiletype> filetypeList = this.unCommonFiletypeService.selectList(filetypeEntityWrapper);
|
|
|
- res.put("files", filetypeList);
|
|
|
- res.put("projects", projectList);
|
|
|
- res.put("concats", detailList);
|
|
|
+ $where = [];
|
|
|
+ $where[] = ["type", "=", $info["type"]];
|
|
|
+ $where[] = ["project", "=", \app\common\state\ProjectState::JBT];
|
|
|
+ $where[] = ["active", "=", 1];
|
|
|
+ $where[] = ["delete", "=", 0];
|
|
|
+ $filetypes = Db::table("new_common_filetype")->where($where)->order("sn asc")->select()->toArray();
|
|
|
+ $res["files"] = $filetypes;
|
|
|
+ $res["projects"] = $projectList;
|
|
|
+ $res["concats"] = $detailList;
|
|
|
+ $response->obj = $res;
|
|
|
}
|
|
|
- return new ResponseObj(ResponseObj.SUCCESS, "", res);
|
|
|
+ $response->code = 200;
|
|
|
+ return $response;
|
|
|
+ return new ResponseObj(ResponseObj . SUCCESS, "", res);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 查询工作单位
|
|
|
*/
|