123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694 |
- <?php
- namespace app\admin\controller;
- use app\admin\common\AdminController;
- use think\facade\Db;
- use app\common\api\Response;
- use app\common\api\DictApi;
- use app\common\api\TalentAllowanceApi;
- use app\common\api\TalentLogApi;
- use app\common\model\TalentAllowance as TaModel;
- use app\common\model\TalentChecklog;
- use app\common\model\TalentAllowanceArrange;
- use app\common\state\ProjectState;
- use app\common\state\AllowanceStateEnum;
- use app\common\state\AllowanceProjectEnum;
- /**
- * Description of TalentAllowance
- *
- * @author sgq
- */
- class TalentAllowance extends AdminController {
- public function index() {
- $process = $this->request["process"];
- $type = $this->user["type"];
- $assigns = ["process" => $process, "type" => $type];
- if ($process == 4) {
- if ($type == 1) {
- $msgBody["typeName"] = "晋江市优秀人才津补贴申报";
- $msgBody["address"] = "聚才网/人才晋江微信公众号";
- $msgBody["dep"] = "中共晋江市委人才办、晋江市纪委监委驻市人力资源和社会保障局纪检监察组或晋江市公共就业和人才服务中心";
- $msgBody["phone"] = "0595-85633128";
- $msgBody["email"] = "jjrc85661234@163.com";
- }
- if ($type == 2) {
- $msgBody["typeName"] = "晋江市集成电路产业优秀人才津补贴申报";
- $msgBody["address"] = "福建(晋江)集成电路产业园官方网站及微信公众号";
- $msgBody["dep"] = "集成电路产业园区";
- $msgBody["phone"] = "0595-82250007、0595-82250001";
- $msgBody["email"] = "jjjcdr@163.com";
- }
- $assigns["message"] = $msgBody;
- }
- return view("", $assigns);
- }
- /**
- * 获取优秀人才津补贴列表
- */
- public function list() {
- $param = $this->request->param();
- $offset = $param["offset"] ?: 0;
- $limit = $param["limit"] ?: 10;
- $process = $param["process"];
- $where = [];
- $where[] = ["type", "=", $this->user["type"]];
- $order = "newSubmitTime desc";
- $where = $this->setTalentAllowanceInfo($where, $param, $process);
- switch ($process) {
- case 1:
- $where[] = ["checkState", "in", [1, 5, 10, 13, 15, 20, 25, 30]];
- break;
- case 2:
- $where[] = ["firstPassTime", "EXP", Db::raw("is not null")];
- break;
- case 3:
- $where[] = ["visitPassTime", "EXP", Db::raw("is not null")];
- break;
- case 4:
- if ($param["publicState"]) {
- $where[] = ["publicState", "=", $param["publicState"]];
- }
- $where[] = ["checkState", "in", [-1, 30]];
- break;
- }
- $count = TaModel::where($where)->count();
- $list = TaModel::where($where)->limit($offset, $limit)->order($order)->select()->toArray();
- $list = $this->translateChinese($list);
- return json(["rows" => $list, "total" => $count]);
- }
- public function toCheckPage() {
- $id = $this->request["id"];
- $process = $this->request["process"];
- $obj = TalentAllowanceApi::getInfoById($id);
- $this->translateToChinese($obj);
- return view("info", ["row" => $obj, "process" => $process]);
- }
- /**
- * 审核
- */
- public function check() {
- $obj = $this->request->param();
- if (!$obj["checkState"]) {
- return new Response(Response::ERROR, "请选择审核状态");
- }
- $oldObj = TalentAllowanceApi::getInfoById($obj["id"]);
- if (!$oldObj) {
- return new Response(Response::ERROR, "审核对象不存在");
- }
- $newObj = [];
- $newObj["id"] = $obj["id"];
- $projectList = [];
- $fileList = [];
- if ($obj["process"] == 1) {
- if (\StrUtil::isNotEmpAndNull($obj["projects"])) {
- $projectList = array_filter(explode(",", $obj["projects"]));
- $newObj["projects"] = implode(",", $projectList);
- }
- if (\StrUtil::isNotEmpAndNull($obj["files"])) {
- $fileList = array_filter(explode(",", $obj["files"]));
- $newObj["files"] = implode(",", $fileList);
- }
- //if (Const.RSJ.equals(checkCompany.getCode())) {
- $newObj["concats"] = $obj["concats"];
- $newObj["fields"] = $obj["fields"];
- //}
- }
- if ($obj["process"] == 3) {
- $newObj["toProcess"] = $obj["toProcess"];
- $newObj["toDep"] = $obj["toDep"];
- }
- TaModel::update($newObj);
- //添加日志
- TalentChecklog::create([
- 'id' => getStringId(),
- 'mainId' => $obj['id'],
- 'type' => intval(ProjectState::JBT),
- 'typeFileId' => null,
- 'active' => 2,
- 'state' => $obj["checkState"],
- 'step' => $obj["process"],
- 'stateChange' => null,
- 'description' => $obj["checkMsg"],
- 'createTime' => date("Y-m-d H:i:s", time()),
- 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
- ]);
- return new Response(Response::SUCCESS, "审核成功");
- }
- public function submitCheck() {
- $id = $this->request["id"];
- $process = $this->request["process"];
- $old = TalentAllowanceApi::getInfoById($id);
- if (!$old) {
- return new Response(Response::ERROR, "审核对象不存在");
- }
- $updCheck = [];
- $updCheck["id"] = $id;
- /* * 查询审核日志 */
- $log = TalentLogApi::getLastLogByStep($id, ProjectState::JBT, $process);
- if (!$log) {
- return new Response(Response::ERROR, "请先审核后再提交");
- }
- $updCheck["checkMsg"] = $log["description"];
- /* * 判断到达的最高流程 */
- $updCheck["highProcess"] = !$old["highProcess"] || $old["highProcess"] < $process ? $process : $old["process"];
- switch ($process) {
- case 1:
- switch ($log["state"]) {
- case 3:
- $updCheck["firstPassTime"] = $old["firstPassTime"];
- if (!$old["firstPassTime"]) {
- $updCheck["firstPassTime"] = date("Y-m-d H:i:s");
- }
- $updCheck["submitTime"] = date("Y-m-d H:i:s");
- $updCheck["checkState"] = AllowanceStateEnum::NEED_REVIEW;
- break;
- case 2:
- $updCheck["checkState"] = AllowanceStateEnum::FIRST_REJECT;
- break;
- case -1:
- $updCheck["checkState"] = AllowanceStateEnum::NOTPASS;
- $updCheck["recommendAllowanceType"] = 3;
- $updCheck["recommendMoney"] = 0;
- $updCheck["recommendAllowanceMsg"] = "审核不通过,不予兑现";
- break;
- default:
- return new Response(Response::ERROR, "未知的审核状态");
- }
- //添加日志
- TalentChecklog::create([
- 'id' => getStringId(),
- 'mainId' => $id,
- 'type' => intval(ProjectState::JBT),
- 'typeFileId' => null,
- 'active' => 1,
- 'state' => $log["state"],
- 'step' => $process,
- 'stateChange' => AllowanceStateEnum::getStateName($old["checkState"]) . "->" . AllowanceStateEnum::getStateName($updCheck["checkState"]),
- 'description' => $log["checkMsg"],
- 'createTime' => date("Y-m-d H:i:s", time()),
- 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
- ]);
- break;
- case 2:
- if ($old["checkState"] != AllowanceStateEnum::NEED_VISIT_CHECK && $old["checkState"] != AllowanceStateEnum::REVIEW_REJECT) {
- return new Response(Response::ERROR, "不在审核范围内");
- }
- $updCheck["checkState"] = AllowanceStateEnum::NEED_REVIEW;
- $updCheck["visitPassTime"] = date("Y-m-d H:i:s");
- //添加日志
- TalentChecklog::create([
- 'id' => getStringId(),
- 'mainId' => $id,
- 'type' => intval(ProjectState::JBT),
- 'typeFileId' => null,
- 'active' => 1,
- 'state' => 3,
- 'step' => $process,
- 'stateChange' => AllowanceStateEnum::getStateName($old["checkState"]) . "->" . AllowanceStateEnum::getStateName($updCheck["checkState"]),
- 'description' => "走访核查提交审核",
- 'createTime' => date("Y-m-d H:i:s", time()),
- 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
- ]);
- break;
- case 3:
- switch ($log["state"]) {
- case 3:
- $updCheck["checkState"] = AllowanceStateEnum::REVIEW_PASS;
- $updCheck["reviewPassTime"] = date("Y-m-d H:i:s");
- /* * * 在此处需要判断津补贴类型 */
- $arrangeList = $this->validateAllowanceType(&$updCheck);
- TalentAllowanceArrange::update($arrangeList);
- break;
- case 2:
- if ($old["toProcess"] == 1) {
- $updCheck["checkState"] = AllowanceStateEnum::REJECT_TO_FIRST;
- } else if ($old["toProcess"] == 2) {
- $updCheck["checkState"] = AllowanceStateEnum::REVIEW_REJECT;
- }
- $updCheck["toProcess"] = null;
- $updCheck["toDep"] = "";
- break;
- case -1:
- $updCheck["checkState"] = AllowanceStateEnum::NOTPASS;
- $updCheck["recommendAllowanceType"] = 3;
- $updCheck["recommendMoney"] = 0;
- $updCheck["recommendAllowanceMsg"] = "审核不通过,不予兑现";
- break;
- default:
- return new Response(Response::ERROR, "未知的审核状态");
- }
- //添加日志
- TalentChecklog::create([
- 'id' => getStringId(),
- 'mainId' => $id,
- 'type' => intval(ProjectState::JBT),
- 'typeFileId' => null,
- 'active' => 1,
- 'state' => $log["state"],
- 'step' => $process,
- 'stateChange' => AllowanceStateEnum::getStateName($old["checkState"]) . "->" . AllowanceStateEnum::getStateName($updCheck["checkState"]),
- 'description' => $log["checkMsg"],
- 'createTime' => date("Y-m-d H:i:s", time()),
- 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
- ]);
- break;
- }
- TalentChecklog::delete($log["id"]);
- TaModel::update($updCheck);
- return new Response(Response::SUCCESS, "提交审核成功");
- }
- private function validateAllowanceType($info) {
- $old = TalentAllowanceApi::getInfoById($info["id"]);
- $talentTypeMap = DictApi::selectByParentCode("enterprise_tag");
- $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
- /* * 查询工作单位记录 */
- $initDetailList = \app\common\model\TalentAllowancecontractDetail::where("mainId", $info["id"])->select()->toArray();
- $detaiPdList = []; //用于判定类型
- $detailMonthList = []; //用于计算月份
- $recommendAllowanceMsg = [];
-
- foreach ($initDetailList as $detail) {
- $projectList = \app\common\model\TalentAllowanceProject::where("baseId", $detail["id"])->select()->toArray();
- $projectMap = [];
- foreach ($projectList as $project) {
- switch ($project["project"]) {
- case AllowanceProjectEnum::PROJECT_TAX:
- case AllowanceProjectEnum::PROJECT_WAGES:
- case AllowanceProjectEnum::PROJECT_SB_PENSION:
- case AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT:
- case AllowanceProjectEnum::PROJECT_SB_MEDICA:
- break;
- case AllowanceProjectEnum::PROJECT_ATTENDANCE:
- break;
- case AllowanceProjectEnum::PROJECT_WORKDAY:
- break;
- }
- $projectMap[$project["project"]] = $project;
- }
- $detail["list"] = $projectList;
- $detail["projectMap"] = $projectMap;
- $detail["enterpriseName"] = $enterpriseMap[$detail["enterpriseId"]];
- $detail["talentTypeName"] = $talentTypeMap[$detail["talentType"]];
- /* * 筛选符合条件的人才标签 */
- $detaiPdList[] = $detail;
- $detailMonthList[] = $detail;
- }
- // /**查询人才标签字典表*/
- // Set<String> retainMonths = new TreeSet<>((o1, o2) -> {
- // int o1Int = Integer.parseInt(o1);
- // int o2Int = Integer.parseInt(o2);
- // return o1Int - o2Int;
- // });
- // /**集成电路优秀人才*/
- // if($this->user["type"] == 2) {
- // /**获取各个项目的综合月份*/
- // Map<Integer, Set<String>> monthMap = $this->mergeMonth($detailMonthList);
- // Map<Integer, Map<String, Integer>> monthAndDayMap = $this->mergeMonthNeedDay($detailMonthList);
- // info.setRecommendAllowanceType(1);
- // info.setRecommendAllowanceMsg("");
- // TalentInfo talentInfo = this.talentInfoService.selectById(info.getTalentId());
- // List<TalentAllowanceProject> projectList = this.talentAllowanceProjectService.selectList(new EntityWrapper<TalentAllowanceProject>().eq("mainId", info.getId()));
- // Set<String> set = AllowanceICDecideUtil.valideAllowanceType(info, talentInfo, projectList, monthMap, monthAndDayMap);
- // info.setRecommendAllowanceMsg(info.getRecommendAllowanceMsg() + "\n综合以上所有判断得到最终补贴类型为:");
- // if (info.getRecommendAllowanceType() == 1) {
- // info.setRecommendAllowanceMsg(info.getRecommendAllowanceMsg() + "人才津贴;可享受月份为:" + set.stream().collect(Collectors.joining(",")) + "\n");
- // }
- // if (info.getRecommendAllowanceType() == 2)
- // info.setRecommendAllowanceMsg(info.getRecommendAllowanceMsg() + "一次性交通补贴;");
- // if (info.getRecommendAllowanceType() == 3)
- // info.setRecommendAllowanceMsg(info.getRecommendAllowanceMsg() + "不予兑现;");
- // retainMonths.addAll(set);
- // }
- // info.setRecommendMonths(StringUtils.join(retainMonths.toArray(), ","));
- // List<TalentAllowanceArrange> arrangeList = calculateAllowance(info, retainMonths, detailMonthList);
- // return arrangeList;
- }
- /**
- * 校验是否在审核范围内
- */
- public function validateIsCheck() {
- $id = $this->request["id"];
- $type = $this->request["type"];
- $process = $this->request["process"];
- $info = null;
- switch ($type) {
- case 1: //编辑合同
- $detail = \app\common\model\TalentAllowancecontractDetail::find($id);
- $info = TalentAllowanceApi::getInfoById($detail["mainId"]);
- break;
- case 2: //编辑项目
- $project = \app\common\model\TalentAllowanceProject::find($id);
- $info = TalentAllowanceApi::getInfoById($project["mainId"]);
- break;
- case 3:
- $info = TalentAllowanceApi::getInfoById($id);
- break;
- }
- if (!$info) {
- return new Response(Response::ERROR, "校验不通过,无法操作");
- }
- $where = [];
- $where[] = ["mainId", "=", $info["id"]];
- $where[] = ["step", "=", $process];
- $where[] = ["active", "=", 2];
- $log = null;
- switch ($process) {
- case 1:
- if ($info["checkState"] != AllowanceStateEnum::NEED_CHECK && $info["checkState"] != AllowanceStateEnum::REJECT_TO_FIRST) {
- return new Response(Response::ERROR, "不在审核范围内");
- }
- //$where[] = ["companyId","=",$this->user["companyId"]];
- $log = TalentChecklog::where($where)->order("createTime desc")->find();
- break;
- case 2:
- if ($info["checkState"] != AllowanceStateEnum::NEED_VISIT_CHECK && $info["checkState"] != AllowanceStateEnum::REVIEW_REJECT) {
- return new Response(Response::ERROR, "不在审核范围内");
- }
- break;
- case 3:
- if ($info["checkState"] != AllowanceStateEnum::NEED_REVIEW && $info["checkState"] != AllowanceStateEnum::PUBLIC_REJECT) {
- return new Response(Response::ERROR, "不在审核范围内");
- }
- $log = TalentChecklog::where($where)->order("createTime desc")->find();
- break;
- }
- if ($log != null) {
- $info["checkState"] = $log["state"];
- $info["checkMsg"] = $log["description"];
- } else {
- $info["checkState"] = null;
- $info["checkMsg"] = "";
- }
- $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"]);
- }
- $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;
- }
- return new Response(Response::SUCCESS, "不在审核范围内", $res);
- }
- /**
- * 查询工作单位
- */
- public function findAllowanceContractDetail() {
- $mainId = $this->request["mainId"];
- $offset = $this->request["offset"] ?: 0;
- $limit = $this->request["limit"] ?: 1000;
- $count = \app\common\model\TalentAllowancecontractDetail::where("mainId", $mainId)->count();
- $list = \app\common\model\TalentAllowancecontractDetail::where("mainId", $mainId)->limit($offset, $limit)->select()->toArray();
- $enterpriseMap = \app\common\model\Enterprise::column("name", "id");
- foreach ($list as &$row) {
- $row["enterpriseName"] = $enterpriseMap[$row["enterpriseId"]];
- }unset($row);
- return json(["rows" => $list, "total" => $count]);
- }
- /**
- * 查询核查项目情况
- */
- public function findAllowanceProject() {
- $mainId = $this->request["mainId"];
- $baseId = $this->request["baseId"];
- $offset = $this->request["offset"] ?: 0;
- $limit = $this->request["limit"] ?: 1000;
- $where = [];
- $where[] = ["mainId", "=", $mainId];
- $where[] = ["baseId", "=", $baseId];
- $count = \app\common\model\TalentAllowanceProject::where($where)->count();
- $list = \app\common\model\TalentAllowanceProject::where($where)->limit($offset, $limit)->select()->toArray();
- $info = TalentAllowanceApi::getInfoById($mainId);
- foreach ($list as &$project) {
- $project["projectName"] = AllowanceProjectEnum::getProjectName($project["project"]);
- if ($info["checkState"] == 1) {
- $project["isEdit"] = in_array($project["project"], [
- AllowanceProjectEnum::PROJECT_CONTRACT,
- AllowanceProjectEnum::PROJECT_TAX,
- AllowanceProjectEnum::PROJECT_WAGES,
- AllowanceProjectEnum::PROJECT_ATTENDANCE,
- AllowanceProjectEnum::PROJECT_SB_PENSION,
- AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT,
- AllowanceProjectEnum::PROJECT_SB_MEDICA,
- AllowanceProjectEnum::PROJECT_WORKDAY
- ]) ? 1 : 2;
- } else if ($info["checkState"] == 10) {
- $projects = explode(",", $info["projects"]);
- if (in_array($project["id"], $projects)) {
- $project["isEdit"] = 1;
- } else {
- $project["isEdit"] = 2;
- }
- } else {
- $project["isEdit"] = 2;
- }
- }unset($project);
- return json(["rows" => $list, "total" => $count]);
- }
- /**
- * 查询人才层次变更记录
- */
- public function findAllowanceArrange() {
- $mainId = $this->request["mainId"];
- $offset = $this->request["offset"] ?: 0;
- $limit = $this->request["limit"] ?: 1000;
- $where = [];
- $where[] = ["mainId", "=", $mainId];
- $count = \app\common\model\TalentAllowanceArrange::where($where)->count();
- $list = \app\common\model\TalentAllowanceArrange::where($where)->limit($offset, $limit)->select()->toArray();
- foreach ($list as &$arrange) {
- $condition = \app\common\api\TalentConditionApi::getOne($arrange["identifyCondition"]);
- $arrange["identifyConditionText"] = $condition["name"];
- $arrange["talentArrangeName"] = \app\common\state\CommonConst::getLayerNameByLayer($arrange["talentArrange"]);
- }unset($arrange);
- return json(["rows" => $list, "total" => $count]);
- }
- private function setTalentAllowanceInfo($where, $query, $process) {
- if (\StrUtil::isNotEmpAndNull($query["year"])) {
- $where[] = ["year", "=", $query["year"]];
- }
- if (\StrUtil::isNotEmpAndNull($query["enterpriseName"])) {
- $where[] = ["enterpriseName", "like", "%" . $query["enterpriseName"] . "%"];
- }
- if (\StrUtil::isNotEmpAndNull($query["name"])) {
- $where[] = ["name", "like", "%" . $query["name"] . "%"];
- }
- if (\StrUtil::isNotEmpAndNull($query["talentType"])) {
- $where[] = ["talentType", "=", $query["talentType"]];
- }
- if (\StrUtil::isNotEmpAndNull($query["talentArrange"])) {
- $where[] = ["talentArrange", "=", $query["talentArrange"]];
- }
- if (\StrUtil::isNotEmpAndNull($query["identifyCondition"])) {
- $where[] = ["identifyCondition", "=", $query["identifyCondition"]];
- }
- if (\StrUtil::isNotEmpAndNull($query["address"])) {
- $where[] = ["address", "=", $query["address"]];
- }
- if ($query["recommendAllowanceType"]) {
- $where[] = ["recommendAllowanceType", "=", $query["recommendAllowanceType"]];
- }
- if ($query["publicState"]) {
- $where[] = ["publicState", "=", $query["publicState"]];
- }
- if (\StrUtil::isNotEmpAndNull($query["introductionMode"])) {
- $where[] = ["introductionMode", "=", $query["introductionMode"]];
- }
- if (\StrUtil::isNotEmpAndNull($query["firstJJStartTime"])) {
- $where[] = ["firstInJJTime", ">=", $query["firstJJStartTime"]];
- }
- if (\StrUtil::isNotEmpAndNull($query["firstJJEndTime"])) {
- $where[] = ["firstInJJTime", "<=", $query["firstJJEndTime"]];
- }
- if ($process == 4) {
- if ($query["isSupple"]) {
- $where[] = ["isSupple", "=", $query["isSupple"]];
- }
- if ($query["isPublicCheck"]) {
- $where[] = ["isPublicCheck", "=", $query["isPublicCheck"]];
- }
- }
- if ($query["checkState"]) {
- if ($query["checkState"] == -1) {
- $where[] = ["checkState", "=", $query["checkState"]];
- } else {
- if ($process == 1) {
- switch ($query["checkState"]) {
- case 0: //保存未提交
- $where[] = ["checkState", "=", 1];
- break;
- case 1:
- $where[] = ["checkState", "=", 5];
- break;
- case 2: //驳回
- $where[] = ["checkState", "=", 10];
- break;
- case 3: //通过
- $where[] = ["checkState", "in", [15, 20, 30, 25]];
- break;
- case 4: //重新提交
- $where[] = ["checkState", "=", 5];
- $where[] = ["highProcess", ">=", $process];
- break;
- case 5: //上级驳回
- $where[] = ["checkState", "=", 13];
- break;
- }
- }
- if ($process == 2) {
- switch ($query["checkState"]) {
- case 1:
- $where[] = ["checkState", "=", 15];
- break;
- case 2: //驳回
- $where[] = ["checkState", "in", [1, 5, 10]];
- $where[] = ["highProcess", ">=", $process];
- break;
- case 3: //通过
- $where[] = ["checkState", "in", [20, 30]];
- break;
- case 9: //重新提交
- $where[] = ["checkState", "=", 15];
- $where[] = ["highProcess", ">=", $process];
- break;
- case 4: //上级驳回
- $where[] = ["checkState", "=", 25];
- break;
- case -1:
- $where[] = ["checkState", "=", -1];
- break;
- }
- }
- if ($process == 3) {
- switch ($query["checkState"]) {
- case -1:
- $where[] = ["checkState", "=", -1];
- break;
- case 1:
- $where[] = ["checkState", "=", 20];
- break;
- case 2: //驳回
- $where[] = ["checkState", "in", [1, 5, 10, 15, 25]];
- $where[] = ["highProcess", ">=", $process];
- break;
- case 3: //通过
- $where[] = ["checkState", "=", 30];
- break;
- case 9: //重新提交
- $where[] = ["checkState", "=", 20];
- $where[] = ["highProcess", ">=", $process];
- break;
- case 4: //上级驳回
- $where[] = ["checkState", "=", 35];
- break;
- }
- }
- if ($process == 4) {
- switch ($query["checkState"]) {
- case -1:
- $where[] = ["checkState", "=", -1];
- break;
- case 3: //通过
- $where[] = ["checkState", "=", 30];
- break;
- }
- }
- }
- }
- return $where;
- }
- private function translateToChinese(&$obj) {
- if (\StrUtil::isNotEmpAndNull($obj["address"])) {
- $obj["addressName"] = DictApi::findByParentCodeAndCode("street", $obj["address"])["name"];
- }
- if (\StrUtil::isNotEmpAndNull($obj["talentType"])) {
- $obj["talentTypeName"] = DictApi::findByParentCodeAndCode("enterprise_tag", $obj["talentType"])["name"];
- }
- if (\StrUtil::isNotEmpAndNull($obj["talentArrange"])) {
- $obj["talentArrangeName"] = DictApi::findByParentCodeAndCode("talent_arrange", $obj["talentArrange"])["name"];
- }
- if (\StrUtil::isNotEmpAndNull($obj["identifyCondition"])) {
- $obj["identifyConditionText"] = \app\common\api\TalentConditionApi::getOne($obj["identifyCondition"])["name"];
- }
- if (\StrUtil::isNotEmpAndNull($obj["introductionMode"])) {
- $obj["introductionModeName"] = DictApi::findByParentCodeAndCode("import_way", $obj["introductionMode"])["name"];
- }
- }
- private function translateChinese($list) {
- //获取字典表
- $levelMap = DictApi::selectByParentCode("talent_arrange");
- $talentTypeMap = DictApi::selectByParentCode("enterprise_tag");
- $streetMap = DictApi::selectByParentCode("street");
- $cardTypeMap = DictApi::selectByParentCode("card_type");
- $modeMap = DictApi::selectByParentCode("import_way");
- $where = [];
- $where[] = ["type", "=", $this->user["type"]];
- $where[] = ["id", "in", array_column($list, "identifyCondition")];
- $icmap = \app\common\model\TalentCondition::where($where)->column("name", "id");
- foreach ($list as &$info) {
- if (\StrUtil::isNotEmpAndNull($info["talentArrange"])) {
- $info["talentArrangeName"] = $levelMap[$info["talentArrange"]];
- }
- $info["talentTypeName"] = $talentTypeMap[$info["talentType"]];
- if (\StrUtil::isNotEmpAndNull($info["identifyCondition"])) {
- $info["identifyConditionText"] = $icmap[$info["identifyCondition"]];
- }
- $info["addressName"] = $streetMap[$info["address"]];
- $info["sexName"] = $info["sex"] == 1 ? "男" : "女";
- $info["checkStateName"] = AllowanceStateEnum::getStateName($info["checkState"]);
- $info["cardTypeName"] = $cardTypeMap[$info["cardType"]];
- $info["isSuppleName"] = $info["isSupple"] == 1 ? "是" : "否";
- $info["isPublicCheckName"] = $info["isPublicCheckName"] == 1 ? "是" : "否";
- $info["recomendAllowanceTypeName"] = \app\common\state\AllowanceTypeEnum::getTypeName($info["recomendAllowanceType"]);
- $info["allowanceTypeName"] = \app\common\state\AllowanceTypeEnum::getTypeName($info["allowanceType"]);
- $info["recommendTalentArrangeName"] = $levelMap[$info["recommendTalentArrange"]];
- $info["jtTalentArrangeName"] = $levelMap[$info["jtTalentArrange"]];
- $info["introductionModeName"] = $modeMap[$info["introductionMode"]];
- }unset($info);
- return $list;
- }
- }
|