123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280 |
- <?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;
- use app\common\state\AllowanceTypeEnum;
- use app\common\model\AmountStandard as AsModel;
- use app\common\state\CommonConst;
- /**
- * 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 == CommonConst::ENTERPRISE_NORMAL) {
- $msgBody["typeName"] = "晋江市现代产业体系人才津补贴申报";
- $msgBody["address"] = "聚才网/人才晋江微信公众号";
- $msgBody["dep"] = "中共晋江市委人才办、晋江市纪委监委驻市人力资源和社会保障局纪检监察组或晋江市公共就业和人才服务中心";
- $msgBody["phone"] = "0595-85633128";
- $msgBody["email"] = "jjrc85661234@163.com";
- }
- if ($type == CommonConst::ENTERPRISE_JC) {
- $msgBody["typeName"] = "晋江市集成电路产业优秀人才津补贴申报";
- $msgBody["address"] = "福建(晋江)集成电路产业园官方网站及微信公众号";
- $msgBody["dep"] = "集成电路产业园区";
- $msgBody["phone"] = "0595-82250007、0595-82250001";
- $msgBody["email"] = "jjjcdr@163.com";
- }
- if ($type == CommonConst::ENTERPRISE_WJ) {
- $msgBody["typeName"] = "晋江市医疗卫生人才津补贴申报";
- $msgBody["address"] = "“健康晋江”微信公众号";
- $msgBody["dep"] = "晋江市卫生健康局";
- $msgBody["phone"] = "0595-85636159";
- $msgBody["email"] = "jjswjjrsk@163.com";
- }
- if ($type == CommonConst::ENTERPRISE_GJ) {
- $msgBody["typeName"] = "晋江市高等教育人才津补贴申报";
- $msgBody["address"] = "“泉州市高教发展中心”微信公众号";
- $msgBody["dep"] = "泉州市高教发展中心";
- $msgBody["phone"] = "0595-85002588";
- $msgBody["email"] = "jjsgjrc@126.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"]];
- $where[] = ["delete", "=", 0];
- $order = "newSubmitTime desc";
- $where = $this->setTalentAllowanceInfo($where, $param, $process);
- switch ($process) {
- case 1:
- $where[] = ["checkState", "in", [-1, 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]);
- }
- /**
- * 审核页面
- * @return type
- */
- public function toCheckPage() {
- $id = $this->request["id"];
- $process = $this->request["process"];
- $obj = TalentAllowanceApi::getInfoById($id);
- $this->translateToChinese($obj);
- if ($this->user["type"] == CommonConst::ENTERPRISE_GJ) {
- $need_choose_post_type = getJsonConfig("../sys_config.json", "talent_allowance_need_choose_post_type");
- $need_choose_institution = getJsonConfig("../sys_config.json", "talent_allowance_need_choose_institution");
- if ($need_choose_post_type[$obj["enterpriseId"]]) {
- $postTypes = DictApi::findChildDictByCode("PostType");
- foreach ($postTypes as $key => $pt) {
- if (!in_array($pt["code"], $need_choose_post_type[$obj["enterpriseId"]])) {
- unset($postTypes[$key]);
- }
- }
- }
- if (in_array($obj["enterpriseId"], $need_choose_institution)) {
- $institutions = DictApi::findChildDictByCode("Institution");
- }
- }
- return view("info", ["row" => $obj, "process" => $process, "postTypes" => $postTypes, "institutions" => $institutions]);
- }
- /**
- * 查看详情
- * @return type
- */
- public function toSelectPage() {
- $id = $this->request["id"];
- $process = $this->request["process"];
- $obj = TalentAllowanceApi::getInfoById($id);
- $this->translateToChinese($obj);
- if ($this->user["type"] == CommonConst::ENTERPRISE_GJ) {
- $need_choose_post_type = getJsonConfig("../sys_config.json", "talent_allowance_need_choose_post_type");
- $need_choose_institution = getJsonConfig("../sys_config.json", "talent_allowance_need_choose_institution");
- if ($need_choose_post_type[$obj["enterpriseId"]]) {
- $postTypes = DictApi::findChildDictByCode("PostType");
- foreach ($postTypes as $key => $pt) {
- if (!in_array($pt["code"], $need_choose_post_type[$obj["enterpriseId"]])) {
- unset($postTypes[$key]);
- }
- }
- }
- if (in_array($obj["enterpriseId"], $need_choose_institution)) {
- $institutions = DictApi::findChildDictByCode("Institution");
- }
- }
- return view("select", ["row" => $obj, "process" => $process, "postTypes" => $postTypes, "institutions" => $institutions]);
- }
- public function save() {
- $id = $this->request["id"];
- $allowanceType = $this->request["allowanceType"];
- $old = TalentAllowanceApi::getInfoById($id);
- if ($old["checkState"] != AllowanceStateEnum::NEED_CHECK && $old["checkState"] != AllowanceStateEnum::REJECT_TO_FIRST) {
- return new Response(Response::ERROR, "不在审核范围内");
- }
- if ($allowanceType == $old["allowanceType"]) {
- return new Response(Response::ERROR, "没有更改不需要保存");
- }
- $upd["id"] = $id;
- $upd["allowanceType"] = $allowanceType;
- TaModel::update($upd);
- return new Response(Response::SUCCESS, "保存成功");
- }
- /**
- * 审核保存
- */
- 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"];
- if ($oldObj["type"] == CommonConst::ENTERPRISE_GJ && $obj["checkState"] == 3) {
- $typeName = "";
- $old["recommendAllowanceMsg"] = "";
- if ($obj["source"] == 1) { //遵循系统结果
- $typeName = "系统判定:津补贴类型(" . (\app\common\state\AllowanceTypeEnum::getTypeName($old["allowanceType"])) . ");享受月份:" . $old["recommendMonths"] . ";\n";
- $newObj["recommendAllowanceMsg"] = $typeName . "判定说明:\n" . $newObj["recommendAllowanceMsg"] . ";";
- } else if ($obj["source"] == 2) {
- $detailIds = array_column($obj["details"], "id");
- $where = [];
- $where[] = ["id", "in", $detailIds];
- $detailList = \app\common\model\TalentAllowancecontractDetail::where($where)->select()->toArray();
- $newObj['allowanceType'] = $obj["resAllowanceType"];
- $newObj["recommendAllowanceType"] = $obj["resAllowanceType"];
- $set = [];
- if ($obj["resAllowanceType"] == 1) {
- $monthsMap = [];
- for ($i = 0; $i < count($obj["details"]); $i++) {
- $monthsMap[$obj["details"][$i]["id"]] = $obj["details"][$i]["months"];
- }
- foreach ($detailList as &$detail) {
- $months = $monthsMap[$detail["id"]];
- if (\StrUtil::isNotEmpAndNull($months)) {
- $detail["months"] = $months;
- $set = array_merge($set, explode(",", $months));
- }
- }unset($detail);
- $set = array_filter($set);
- usort($set, function ($a, $b) {
- return (int) $a - (int) $b;
- });
- $newObj["recommendMonths"] = implode(",", $set);
- $typeName = "人工判定:津补贴类型(" . (\app\common\state\AllowanceTypeEnum::getTypeName($newObj["recommendAllowanceType"])) . ");享受月份:" . $newObj["recommendMonths"] . ";\n";
- }else{
- $typeName = "人工判定:津补贴类型(" . (\app\common\state\AllowanceTypeEnum::getTypeName($newObj["recommendAllowanceType"])) . ");\n";
- }
- $newObj["recommendAllowanceMsg"] = $typeName . "判定说明:\n" . $obj["resAllowanceMsg"] . ";";
- $arrangeList = $this->calculateAllowance($newObj, $set, $detailList);
- $taaModel = new TalentAllowanceArrange();
- $taaModel->saveAll($arrangeList);
- }
- $newObj["otherEnjoyedMoney"] = $obj["otherEnjoyedMoney"];
- $newObj["otherEnjoyedDescription"] = $obj["otherEnjoyedDescription"];
- } else {
- //$newObj["otherEnjoyedMoney"] = 0.00;
- //$newObj["otherEnjoyedDescription"] = null;
- }
- }
- 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, "审核成功");
- }
- /**
- * 提交审核
- * @return Response
- */
- 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;
- $updCheck["type"] = $old["type"];
- /* * 查询审核日志 */
- $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["highProcess"];
- 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");
- }
- if (!$old["visitPassTime"]) {
- $updCheck["visitPassTime"] = 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 -2:
- $updCheck["checkState"] = AllowanceStateEnum::FIRST_REJECT_BRANCH;
- 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["description"],
- '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");
- $old = TalentAllowanceApi::getInfoById($id);//20240915增加判定是否人工认定,如果人工认定不再走系统计算
- if(strpos($old['recommendAllowanceMsg'],"人工判定") === false){
- /* * * 在此处需要判断津补贴类型 */
- $arrangeList = $this->validateAllowanceType($updCheck);
- $taaModel = new TalentAllowanceArrange();
- $taaModel->saveAll($arrangeList);
- }
- break;
- case 2:
- $updCheck["checkState"] = AllowanceStateEnum::REJECT_TO_FIRST;
- $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["description"],
- 'createTime' => date("Y-m-d H:i:s", time()),
- 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
- ]);
- break;
- }
- TalentChecklog::where("id", $log["id"])->delete();
- TaModel::update($updCheck);
- return new Response(Response::SUCCESS, "提交审核成功");
- }
- /**
- * 初审撤销
- * @return Response
- */
- public function cancleFirstCheck() {
- $obj = $this->request->param();
- $id = $obj["id"];
- $checkMsg = $obj["checkMsg"];
- if (!$id) {
- return new Response(Response::ERROR, "请选择需要撤销的对象");
- }
- $old = TalentAllowanceApi::getInfoById($id);
- if ($old["checkState"] != AllowanceStateEnum::NEED_REVIEW && $old["checkState"] != AllowanceStateEnum::NOTPASS) {
- return new Response(Response::ERROR, "当前对象的审核无法撤销");
- }
- $data["id"] = $id;
- $data["checkMsg"] = $checkMsg;
- $data["checkState"] = AllowanceStateEnum::NEED_CHECK;
- //添加日志
- TalentChecklog::create([
- 'id' => getStringId(),
- 'mainId' => $id,
- 'type' => intval(ProjectState::JBT),
- 'typeFileId' => null,
- 'active' => 1,
- 'state' => 11, //撤销审核
- 'step' => 1,
- 'stateChange' => AllowanceStateEnum::getStateName($old["checkState"]) . "->" . AllowanceStateEnum::getStateName($data["checkState"]),
- 'description' => "撤销原因:" . $checkMsg,
- 'createTime' => date("Y-m-d H:i:s", time()),
- 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
- ]);
- TaModel::update($data);
- return new Response(Response::SUCCESS, "撤销成功");
- }
- /**
- * 复核撤销
- * @return Response|\app\admin\controller\ResponseObj
- */
- public function reviewCancleCheck() {
- $obj = $this->request->param();
- $id = $obj["id"];
- $checkMsg = $obj["checkMsg"];
- if (!$id) {
- return new Response(Response::ERROR, "请选择需要撤销的对象");
- }
- $old = TalentAllowanceApi::getInfoById($id);
- if ($old["checkState"] != AllowanceStateEnum::REVIEW_PASS || $old["publicState"] != 1) {
- return new Response(Response::ERROR, "当前对象的审核无法撤销");
- }
- $data["id"] = $id;
- $data["checkMsg"] = $checkMsg;
- $data["checkState"] = AllowanceStateEnum::NEED_REVIEW;
- //添加日志
- TalentChecklog::create([
- 'id' => getStringId(),
- 'mainId' => $id,
- 'type' => intval(ProjectState::JBT),
- 'typeFileId' => null,
- 'active' => 1,
- 'state' => 11, //撤销审核
- 'step' => 3,
- 'stateChange' => AllowanceStateEnum::getStateName($old["checkState"]) . "->" . AllowanceStateEnum::getStateName($data["checkState"]),
- 'description' => "撤销原因:" . $checkMsg,
- 'createTime' => date("Y-m-d H:i:s", time()),
- 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
- ]);
- TaModel::update($data);
- return new Response(Response::SUCCESS, "撤销成功");
- }
- /**
- * 查询需要导出的数据
- *
- */
- public function findTalentAllowanceByPage() {
- $param = $this->request->param();
- $where = [];
- $where[] = ["type", "=", $this->user["type"]];
- if ($param != null) {
- if (\StrUtil::isNotEmpAndNull($param["name"])) {
- $where[] = ["name", "like", "%" . $param["name"] . "%"];
- }
- if (\StrUtil::isNotEmpAndNull($param["idCard"])) {
- $where[] = ["idCard", "like", "%" . $param["idCard"] . "%"];
- }
- }
- $error = null;
- switch ($param["type"]) {
- case 1:
- case 2:
- $where[] = ["publicState", "=", 1];
- $where[] = ["checkState", "in", [-1, 30]];
- $where[] = ['recommendAllowanceType',"in", [1, 2]];
- $error = "暂无可核查征信的数据";
- break;
- case 3:
- case 7:
- $where[] = ["publicState", "=", 2];
- $where[] = ["checkState", "in", [-1, 30]];
- $where[] = ["recommendAllowanceType", "=", 3];
- $error = "暂无可公示(不予兑现)的数据";
- break;
- case 4: //需要兑现
- case 8:
- $where[] = ["publicState", "=", 2];
- $where[] = ["checkState", "in", [30]];
- $where[] = ["recommendAllowanceType", "in", [1, 2]];
- $error = "暂无需要公示(兑现)的数据";
- break;
- case 5:
- $where[] = ["publicState", "=", 3];
- $where[] = ["checkState", "in", [-1, 30]];
- $error = "暂无可公示通过的数据";
- break;
- case 6:
- $where[] = ["publicState", "=", 4];
- $where[] = ["checkState", "in", [30]];
- $where[] = ["allowanceType", "in", [1, 2]];
- $error = "暂无可兑现的数据";
- break;
- }
- $list = TaModel::where($where)->select()->toArray();
- //查询企业信息
- $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
- foreach ($list as $key => $item) {
- $list[$key]["enterpriseName"] = $enterpriseMap[$item["enterpriseId"]];
- }
- $res = [
- "rows" => $list,
- "total" => count($list)
- ];
- return new Response(Response::SUCCESS, "", $res);
- }
- public function exportHczx() {
- $response = new \stdClass();
- $response->code = 500;
- $ids = $this->request->param("ids");
- $ids_arr = array_filter(explode(",", $ids));
- if (!$ids_arr) {
- $response->msg = "没有选择导出的名单";
- return \StrUtil::back($response, "TalentAllowanceInfo.hczxCallBack");
- }
- $where = [];
- $where[] = ["id", "in", $ids_arr];
- $list = TaModel::field("id,cardType,idCard,name,enterpriseId,year")->where($where)->select()->toArray();
- if (!$list) {
- $response->msg = "暂无可核查征信的数据";
- return \StrUtil::back($response, "TalentAllowanceInfo.hczxCallBack");
- }
- $columns = ["序号", "姓名", "证件类型", "证件号码", "工作单位", "年度"];
- $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
- $cardTypeName = DictApi::selectByParentCode("card_type");
- $rows = [];
- for ($i = 0; $i < count($list); $i++) {
- $item = $list[$i];
- $row = [
- $i + 1, $item["name"], $cardTypeName[$item["cardType"]], $item["idCard"], $enterpriseMap[$item["enterpriseId"]], $item["year"]
- ];
- $rows[] = $row;
- }
- $filename = "津补贴待核查征信名单导出";
- if ($rows) {
- export($columns, $rows, $filename);
- exit();
- } else {
- $response->msg = "没有选择导出的名单";
- return \StrUtil::back($response, "TalentAllowanceInfo.hczxCallBack");
- }
- }
- /**
- * 核查征信驳回
- */
- public function hczxReject() {
- $param = $this->request->param();
- if (!$param) {
- return new Response(Response::ERROR, "系统错误,请联系管理员");
- }
- $old = TalentAllowanceApi::getInfoById($param["id"]);
- if ($old["publicState"] != 1) {
- return new Response(Response::ERROR, "当前记录不是待核查征信状态,无法核查");
- }
- $data["id"] = $param["id"];
- $data["publicState"] = 2;
- $data["checkState"] = AllowanceStateEnum::NOTPASS;
- $data["recommendAllowanceType"] = 3;
- $data["recommendAllowanceMsg"] = "征信失信,不予兑现,失信原因:" . $param["outMsg"];
- $data["recommendMonths"] = "";
- $data["recommendMoney"] = 0.00;
- $data["workAllowanceMoney"] = null;
- $data["developAllowanceMoney"] = null;
- //添加日志
- TalentChecklog::create([
- 'id' => getStringId(),
- 'mainId' => $param["id"],
- 'type' => intval(ProjectState::JBT),
- 'typeFileId' => null,
- 'active' => 1,
- 'state' => 2,
- 'step' => 4,
- 'stateChange' => AllowanceStateEnum::getStateName($old["checkState"]) . "-><span class='label label-primary'>审核不通过</span>" . "公示状态:<span class='label label-success'>待核查</span>-><span class='label label-primary'>待公示</span>",
- 'description' => $param["outMsg"],
- 'createTime' => date("Y-m-d H:i:s", time()),
- 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
- ]);
- TaModel::update($data);
- return new Response(Response::SUCCESS, "核查征信成功");
- }
- /**
- * 核查征信批量通过
- */
- public function hczxPass() {
- $ids = $this->request["ids"];
- if (\StrUtil::isEmpOrNull($ids)) {
- return new Response(Response::ERROR, "请选择核查征信通过的数据");
- }
- $where = [];
- $where[] = ["id", "in", $ids];
- $list = TaModel::where($where)->select()->toArray();
- $logList = [];
- $upds = [];
- foreach ($list as $obj) {
- $upds[] = [
- "id" => $obj["id"],
- "publicState" => 2,
- ];
- $logList[] = [
- "id" => getStringId(),
- "type" => ProjectState::JBT,
- "mainId" => $obj["id"],
- "active" => 1,
- "state" => 3,
- "step" => 4,
- "stateChange" => "<span class='label label-success'>待核查</span>-><span class='label label-primary'>待公示</span>",
- "description" => "核查征信通过",
- "createTime" => date("Y-m-d H:i:s"),
- 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
- ];
- }
- $taModel = new TaModel();
- $taModel->saveAll($upds);
- Db::table("new_talent_checklog")->insertAll($logList);
- return new Response(Response::SUCCESS, "核查征信通过成功");
- }
- /**
- * 公示
- * */
- public function publicBatch() {
- $params = $this->request->param();
- $ids = $params["ids"];
- $ids = array_filter(explode(",", $ids));
- if (!$ids) {
- return new Response(Response::ERROR, "请至少选择一行数据");
- }
- $isMessage = $params["isMessage"] == 1 ? true : false;
- if ($isMessage && (!$params["typeName"] || !$params["address"] || !$params["publicStartTime"] || !$params["publicEndTime"] || !$params["dep"] || !$params["phone"] || !$params["email"])) {
- return new Response(Response::ERROR, "短信参数不能为空");
- }
- $where = [];
- $where[] = ["id", "in", $ids];
- $list = TaModel::where($where)->select()->toArray();
- Db::startTrans();
- try {
- $logList = [];
- $phones = [];
- foreach ($list as $info) {
- $data["id"] = $info["id"];
- $data["publicState"] = 3;
- Db::table("un_talent_allowance_info")->update($data);
- /* * 添加日志 */
- $logList[] = [
- "id" => getStringId(),
- "type" => ProjectState::JBT,
- "mainId" => $info["id"],
- "active" => 1,
- "state" => 3,
- "step" => 5,
- "stateChange" => "<span class='label label-success'>待公示</span>-><span class='label label-primary'>公示中</span>",
- "description" => "批量公示",
- "createTime" => date("Y-m-d H:i:s"),
- 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
- ];
- $phones[] = $info["phone"];
- }
- $effect = Db::table("new_talent_checklog")->insertAll($logList);
- Db::commit();
- if ($phones && $isMessage && $effect) {
- $tpl_content = sprintf("【晋江市人才服务平台】您好!您提交申请的%s已完成初步审核,现通过%s将审核结果予以公示,公示时间%s至%s。公示期间如有异议,请及时向%s反映。电话%s,电子邮箱%s。",
- $params["typeName"], $params["address"], $params["publicStartTime"], $params["publicEndTime"], $params["dep"], $params["phone"], $params["email"]);
- $phones = array_filter($phones);
- foreach ($phones as $phone) {
- queue("app\job\Messenger", ["type" => 6, "userId" => 0, "phone" => $phone, "template" => $tpl_content, "processName" => "津补贴-批量公示", "userType" => 3]);
- }
- }
- return new Response(Response::SUCCESS, "公示成功");
- } catch (\think\db\exception\DbException $e) {
- Db::rollback();
- return new Response(Response::SUCCESS, "公示失败:" . $e->getMessage());
- }
- }
- /**
- * 跳转到公示再审核页面
- * */
- public function toSupplePage() {
- $id = $this->request["id"];
- $process = $this->request["process"];
- $obj = TalentAllowanceApi::getInfoById($id);
- $this->translateToChinese($obj);
- if ($this->user["type"] == CommonConst::ENTERPRISE_GJ) {
- $need_choose_post_type = getJsonConfig("../sys_config.json", "talent_allowance_need_choose_post_type");
- $need_choose_institution = getJsonConfig("../sys_config.json", "talent_allowance_need_choose_institution");
- if ($need_choose_post_type[$obj["enterpriseId"]]) {
- $postTypes = DictApi::findChildDictByCode("PostType");
- foreach ($postTypes as $key => $pt) {
- if (!in_array($pt["code"], $need_choose_post_type[$obj["enterpriseId"]])) {
- unset($postTypes[$key]);
- }
- }
- }
- if (in_array($obj["enterpriseId"], $need_choose_institution)) {
- $institutions = DictApi::findChildDictByCode("Institution");
- }
- }
- return view("public_check", ["row" => $obj, "process" => $process, "postTypes" => $postTypes, "institutions" => $institutions]);
- }
- /**
- * 公示再审核计算津补贴
- * */
- public function suppleCheckCalculate() {
- $id = $this->request["id"];
- try {
- $info = TalentAllowanceApi::getInfoById($id);
- $arrangeList = $this->validateAllowanceType($info);
- $detailList = \app\common\model\TalentAllowancecontractDetail::where("mainId", $id)->select()->toArray();
- $talentTypeMap = DictApi::selectByParentCode("enterprise_tag");
- $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
- foreach ($detailList as &$detail) {
- $detail["enterpriseName"] = $enterpriseMap[$detail["enterpriseId"]];
- if (\StrUtil::isNotEmpAndNull($detail["talentType"])) {
- $detail["talentTypeName"] = $talentTypeMap[$detail["talentType"]];
- }
- }
- $res = [
- "info" => $info,
- "detailList" => $detailList
- ];
- return new Response(Response::SUCCESS, "计算成功", $res);
- } catch (\think\Exception $e) {
- return new Response(Response::ERROR, "系统异常,请联系管理员:" . $e->getMessage());
- }
- }
- /**
- * 公示后审核
- */
- public function afterCheck() {
- $param = $this->request->param();
- if (!$param["id"]) {
- return new Response(Response::ERROR, "系统错误,请联系管理员");
- }
- $old = TalentAllowanceApi::getInfoById($param["id"]);
- if ($old["publicState"] != 3) {
- return new Response(Response::ERROR, "当前记录不是公示中状态,无法审核");
- }
- try {
- $arrangeList = null;
- $desc = "审核意见:" . $param["checkMsg"] . ";\n";
- $desc .= "征信:" . ($param["zxState"] == 1 ? "征信通过" : $param["zxMsg"] . ";\n");
- $data["id"] = $param["id"];
- if ($param["checkState"] == -1) {
- $data["checkState"] = -1;
- $data["checkMsg"] = $param["checkMsg"];
- $data["allowanceType"] = 3;
- $data["allowanceMsg"] = "审核不通过,原因:" . $param["checkMsg"];
- $data["outMsg"] = $param["zxState"] == 1 ? "" : $param["zxMsg"];
- } else if ($param["checkState"] == 3) {
- if ($param["zxState"] == 1) {
- $typeName = "";
- $old["recommendAllowanceMsg"] = "";
- if ($param["source"] == 1) { //遵循系统结果
- $arrangeList = $this->validateAllowanceType($old);
- $typeName = "系统判定:津补贴类型(" . (\app\common\state\AllowanceTypeEnum::getTypeName($old["allowanceType"])) . ");享受月份:" . $old["recommendMonths"] . ";\n";
- $old["recommendAllowanceMsg"] = $typeName . "判定说明:\n" . $old["recommendAllowanceMsg"] . ";";
- } else if ($param["source"] == 2) {
- $detailIds = array_column($param["details"], "id");
- $where = [];
- $where[] = ["id", "in", $detailIds];
- $detailList = \app\common\model\TalentAllowancecontractDetail::where($where)->select()->toArray();
- $set = [];
- if ($param["resAllowanceType"] == 1) {
- $monthsMap = [];
- for ($i = 0; $i < count($param["details"]); $i++) {
- $monthsMap[$param["details"][$i]["id"]] = $param["details"][$i]["months"];
- }
- foreach ($detailList as &$detail) {
- $months = $monthsMap[$detail["id"]];
- if (\StrUtil::isNotEmpAndNull($months)) {
- $detail["months"] = $months;
- $set = array_merge($set, explode(",", $months));
- }
- }unset($detail);
- }
- $set = array_filter($set);
- usort($set, function ($a, $b) {
- return (int) $a - (int) $b;
- });
- $old["recommendAllowanceType"] = $param["resAllowanceType"];
- $old["recommendMonths"] = implode(",", $set);
- $typeName = "人工判定:津补贴类型(" . (\app\common\state\AllowanceTypeEnum::getTypeName($old["recommendAllowanceType"])) . ");享受月份:" . $old["recommendMonths"] . ";\n";
- $old["recommendAllowanceMsg"] = $typeName . "判定说明:\n" . $param["resAllowanceMsg"] . ";";
- $arrangeList = $this->calculateAllowance($old, $set, $detailList);
- }
- $desc .= "判定结果:" . $typeName;
- $data["checkState"] = 30;
- $data["outMsg"] = "";
- $data["allowanceType"] = $old["recommendAllowanceType"];
- $data["allowanceMsg"] = $old["recommendAllowanceMsg"];
- $data["months"] = $old["recommendMonths"];
- $data["money"] = $old["recommendMoney"] - $old["otherEnjoyedMoney"];
- $data["moneyDesc"] = $old["recommendMoneyDesc"];
- $data["jtTalentArrange"] = $old["recommendTalentArrange"];
- $data["workAllowanceMoney"] = $old["workAllowanceMoney"];
- $data["developAllowanceMoney"] = $old["developAllowanceMoney"];
- } else {
- $data["checkState"] = -1;
- $data["outMsg"] = $param["zxMsg"];
- $data["allowanceType"] = 3;
- $data["allowanceMsg"] = "征信失信(不予兑现),原因:" . $param["zxMsg"];
- }
- }
- if ($param["allowanceType"] == 3) {
- $data["months"] = "";
- $data["money"] = 0;
- $data["moneyDesc"] = "";
- $data["jtTalentArrange"] = "";
- $data["workAllowanceMoney"] = null;
- $data["developAllowanceMoney"] = null;
- }
- $data["isPublicCheck"] = 1;
- $data["publicState"] = 4;
- //添加日志
- TalentChecklog::create([
- 'id' => getStringId(),
- 'mainId' => $old['id'],
- 'type' => intval(ProjectState::JBT),
- 'typeFileId' => null,
- 'active' => 1,
- 'state' => $param["checkState"] == AllowanceStateEnum::REVIEW_PASS ? 3 : $param["checkState"],
- 'step' => 6,
- 'stateChange' => "<span class='label label-success'>公示中</span>-><span class='label label-primary'>待兑现</span>",
- 'description' => $desc,
- 'createTime' => date("Y-m-d H:i:s", time()),
- 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
- ]);
- TaModel::update($data);
- if ($arrangeList != null) {
- $taaModel = new TalentAllowanceArrange();
- $taaModel->saveAll($arrangeList);
- }
- return new Response(Response::SUCCESS, "审核成功");
- } catch (\think\Exception $e) {
- return new Response(Response::ERROR, "系统异常,请联系管理员");
- }
- }
- /**
- * 批量公示通过
- */
- public function publicPass() {
- $ids = $this->request["ids"];
- $ids = explode(",", $ids);
- if (!$ids) {
- return new Response(Response::ERROR, "请至少选择一行数据");
- }
- $where = [];
- $where[] = ["id", "in", $ids];
- $list = TaModel::where($where)->select()->toArray();
- $logList = [];
- try {
- Db::startTrans();
- for ($i = 0; $i < count($list); $i++) {
- $obj = $list[$i];
- $upd["id"] = $obj["id"];
- $upd["publicState"] = 4;
- $upd["allowanceType"] = $obj["recommendAllowanceType"];
- $upd["allowanceMsg"] = $obj["recommendAllowanceMsg"];
- if ($upd["allowanceType"] == 1) {
- $upd["months"] = $obj["recommendMonths"];
- $upd["money"] = $obj["recommendMoney"] - $obj["otherEnjoyedMoney"];
- $upd["moneyDesc"] = $obj["recommendMoneyDesc"];
- } else if ($upd["allowanceType"] == 2) {
- $upd["months"] = "";
- $upd["jtTalentArrange"] = $obj["recommendTalentArrange"];
- $upd["money"] = $obj["recommendMoney"] - $obj["otherEnjoyedMoney"];
- $upd["moneyDesc"] = $obj["recommendMoneyDesc"];
- $upd["workAllowanceMoney"] = null;
- $upd["developAllowanceMoney"] = null;
- } else {
- $upd["months"] = "";
- $upd["money"] = 0.00;
- $upd["workAllowanceMoney"] = null;
- $upd["developAllowanceMoney"] = null;
- }
- Db::table("un_talent_allowance_info")->update($upd);
- //添加日志
- $stateChange = null;
- $desc = null;
- if ($obj["checkState"] == AllowanceStateEnum::NOTPASS) {
- $stateChange = "<span class='label label-success'>公示中</span>-><span class='label label-danger'>审核不通过</span>";
- $desc = "审核不通过";
- } else {
- $stateChange = "<span class='label label-success'>公示中</span>-><span class='label label-primary'>待兑现</span>";
- $desc = "批量公示";
- }
- $logList[] = [
- "id" => getStringId(),
- "type" => ProjectState::JBT,
- "mainId" => $obj["id"],
- "active" => 1,
- "state" => 3,
- "step" => 6,
- "stateChange" => $stateChange,
- "description" => $desc,
- "createTime" => date("Y-m-d H:i:s"),
- 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
- ];
- }
- Db::table("new_talent_checklog")->insertAll($logList);
- Db::commit();
- return new Response(Response::SUCCESS, "批量公示通过成功");
- } catch (\think\db\exception\DbException $e) {
- Db::rollback();
- return new Response(Response::ERROR, "批量公示失败:" . $e->getCode());
- }
- }
- /**
- * 兑现
- */
- public function cash() {
- $ids = $this->request["ids"];
- $ids = array_filter(explode(",", $ids));
- if (!$ids) {
- return new Response(Response::ERROR, "请至少选择一行数据");
- }
- $where = [];
- $where[] = ["id", "in", $ids];
- $list = TaModel::where($where)->select()->toArray();
- //添加日志
- $logList = [];
- try {
- Db::startTrans();
- for ($i = 0; $i < count($list); $i++) {
- $obj = $list[$i];
- $upd["id"] = $obj["id"];
- $upd["publicState"] = 5;
- Db::table("un_talent_allowance_info")->update($upd);
- $logList[] = [
- "id" => getStringId(),
- "type" => ProjectState::JBT,
- "mainId" => $obj["id"],
- "active" => 1,
- "state" => 3,
- "step" => 50,
- "stateChange" => "<span class='label label-success'>待兑现</span>-><span class='label label-primary'>已兑现</span>;",
- "description" => "批量兑现",
- "createTime" => date("Y-m-d H:i:s"),
- 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
- ];
- }
- Db::table("new_talent_checklog")->insertAll($logList);
- Db::commit();
- return new Response(Response::SUCCESS, "批量兑现成功");
- } catch (\think\db\exception\DbException $e) {
- Db::rollback();
- return new Response(Response::ERROR, "批量兑现失败:" . $e->getCode());
- }
- }
- /**
- * 公示预览(不予兑现)
- */
- public function exportPublicNotCash() {
- $response = new \stdClass();
- $response->code = 500;
- //获取字典表人才层次+
- $levelMap = DictApi::selectByParentCode("talent_arrange");
- $streetMap = DictApi::selectByParentCode("street");
- //查询企业信息
- $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
- //查询所有
- $where = [];
- $where[] = ["id", "in", explode(",", $this->request["ids"])];
- $list = TaModel::where($where)->select()->toArray();
- $rows = [];
- for ($i = 0; $i < count($list); $i++) {
- $item = $list[$i];
- $rows[] = [
- $i + 1, $item["name"], $enterpriseMap[$item["enterpriseId"]], $streetMap[$item["address"]], $levelMap[$item["talentArrange"]], $item["description"]
- ];
- }
- $filename = CommonConst::getTypeName($this->user["type"]) . $allList[0]["year"] . "年度津补贴不予兑现对象名单";
- $columns = ["序号", "姓名", "工作单位", "镇(街道)", "人才层次", "备注"];
- if ($rows) {
- export($columns, $rows, $filename);
- exit();
- } else {
- $response->msg = "没有选择导出的名单";
- return \StrUtil::back($response, "TalentAllowanceInfo.hczxCallBack");
- }
- }
- /**
- * 导出公示名单(需要兑现)
- */
- public function exportPublic() {
- //获取字典表人才层次+
- $levelMap = DictApi::selectByParentCode("talent_arrange");
- $streetMap = DictApi::selectByParentCode("street");
- //查询企业信息
- $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
- /* * 查询需要公示的数据 */
- $where = [];
- $where[] = ["id", "in", explode(",", $this->request["ids"])];
- $list = TaModel::where($where)->select()->toArray();
- $rows = [];
- for ($i = 0; $i < count($list); $i++) {
- $item = $list[$i];
- $rows[] = [
- $i + 1, $item["name"], $enterpriseMap[$item["enterpriseId"]], $streetMap[$item["address"]], $levelMap[$item["talentArrange"]], $item["description"]
- ];
- }
- $filename = CommonConst::getTypeName($this->user["type"]) . $allList[0]["year"] . "年度津补贴拟发放对象名单";
- $columns = ["序号", "姓名", "工作单位", "镇(街道)", "人才层次", "备注"];
- if ($rows) {
- export($columns, $rows, $filename);
- exit();
- } else {
- $response->msg = "没有选择导出的名单";
- return \StrUtil::back($response, "TalentAllowanceInfo.hczxCallBack");
- }
- }
- /**
- * 导出基本信息
- */
- public function exportBasicInfo() {
- $obj["year"] = \StrUtil::getRequestDecodeParam($this->request, "year");
- $obj["enterpriseName"] = \StrUtil::getRequestDecodeParam($this->request, "enterpriseName");
- $obj["name"] = \StrUtil::getRequestDecodeParam($this->request, "name");
- $obj["idCard"] = \StrUtil::getRequestDecodeParam($this->request, "idCard");
- $obj["talentType"] = \StrUtil::getRequestDecodeParam($this->request, "talentType");
- $obj["talentArrange"] = \StrUtil::getRequestDecodeParam($this->request, "talentArrange");
- $obj["address"] = \StrUtil::getRequestDecodeParam($this->request, "address");
- $obj["identifyCondition"] = \StrUtil::getRequestDecodeParam($this->request, "identifyCondition");
- $obj["isSupple"] = \StrUtil::getRequestDecodeParam($this->request, "isSupple");
- $obj["checkState"] = \StrUtil::getRequestDecodeParam($this->request, "checkState");
- $obj["publicState"] = \StrUtil::getRequestDecodeParam($this->request, "publicState");
- $obj["companyName"] = \StrUtil::getRequestDecodeParam($this->request, "companyName");
- $obj["allowanceType"] = \StrUtil::getRequestDecodeParam($this->request, "allowanceType");
- $obj["recommendAllowanceType"] = \StrUtil::getRequestDecodeParam($this->request, "recommendAllowanceType");
- $obj["introductionMode"] = \StrUtil::getRequestDecodeParam($this->request, "introductionMode");
- $obj["firstJJStartTime"] = \StrUtil::getRequestDecodeParam($this->request, "firstJJStartTime");
- $obj["firstJJEndTime"] = \StrUtil::getRequestDecodeParam($this->request, "firstJJEndTime");
- $obj["process"] = intval(\StrUtil::getRequestDecodeParam($this->request, "process"));
- $obj["type"] = $this->user["type"];
- $where = [];
- $where[] = ["ta.delete", "=", 0];
- $where[] = ["ta.type", "=", $this->user["type"]];
- $this->setTalentAllowanceInfoForExport($where, $obj, $obj["process"]);
- switch ($obj["process"]) {
- case 1:
- $where[] = ["ta.checkState", "in", [1, 5, 10, 13, 15, 20, 25, 30]];
- break;
- case 2:
- $where[] = ["ta.firstPassTime", "EXP", Db::raw("is not null")];
- break;
- case 3:
- $where[] = ["ta.visitPassTime", "EXP", Db::raw("is not null")];
- break;
- case 4:
- if ($obj["publicState"]) {
- $where[] = ["publicState", "=", $param["publicState"]];
- }
- $where[] = ["ta.checkState", "in", [-1, 30]];
- break;
- }
- $projects = [
- AllowanceProjectEnum::PROJECT_TAX,
- AllowanceProjectEnum::PROJECT_WAGES,
- AllowanceProjectEnum::PROJECT_ATTENDANCE,
- AllowanceProjectEnum::PROJECT_SB_PENSION,
- AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT,
- AllowanceProjectEnum::PROJECT_SB_MEDICA,
- ];
- $months = [];
- for ($m = 1; $m <= 12; $m++) {
- $months[] = $m . "月";
- }
- $columns = [["年度", [1, 2]], ["所属镇街", [1, 2]], ["姓名", [1, 2]], ["性别", [1, 2]], ["证件号码", [1, 2]], ["人才层次", [1, 2]], ["认定条件", [1, 2]], ["认定条件取得时间", [1, 2]], ["认定条件名称", [1, 2]], ["公布入选月份", [1, 2]], ["拟认定津补贴类型", [1, 2]], ["拟兑现月份", [1, 2]], ["拟兑现金额", [1, 2]], ["拟兑现金额说明", [1, 2]], ["其它补贴金额", [1, 2]], ["其它补贴说明", [1, 2]], ["津补贴类型", [1, 2]], ["兑现月份", [1, 2]], ["兑现金额", [1, 2]], ["金额说明", [1, 2]], ["审核状态", [1, 2]], ["审核意见", [1, 2]], ["缴纳单位", [1, 2]]];
- $infoCols = count($columns);
- for ($i = 0; $i < count($projects); $i++) {
- $columns[] = [AllowanceProjectEnum::getProjectName($projects[$i]), $months];
- }
- $list = \app\common\model\TalentAllowanceProject::alias("pro")
- ->field("ta.id,ta.year,ta.enterpriseId as curEnterpriseId,ta.address,ta.name,ta.sex,ta.idCard,ta.talentArrange,ta.identifyCondition,ta.identifyGetTime,ta.identifyConditionName,ta.identifyMonth,ta.recommendAllowanceType,ta.recommendMonths,ta.recommendMoney,ta.recommendMoneyDesc,ta.otherEnjoyedMoney,ta.otherEnjoyedDescription,ta.allowanceType,ta.months,ta.money,ta.moneyDesc,ta.checkState,ta.checkMsg,ta.publicState,pro.project,pro.months as pre_months,con.enterpriseId,con.startTime,con.endTime,con.entryTime,con.quitTime,con.isQuit")
- ->leftJoin("un_talent_allowance_info ta", "ta.id=pro.mainId")
- ->leftJoin("un_talent_allowancecontract_detail con", "pro.baseId=con.id")
- ->where($where)
- ->order("ta.year desc,ta.createTime desc,pro.project asc")
- ->select()->toArray();
- $tmpList = [];
- $levelMap = DictApi::selectByParentCode("talent_arrange");
- $streetMap = DictApi::selectByParentCode("street");
- $where = [];
- $where[] = ["id", "in", array_column($list, "identifyCondition")];
- $icmap = \app\common\model\TalentCondition::where($where)->column("name", "id");
- $where = [];
- $where[] = ["id", "in", array_column($list, "enterpriseId")];
- $enterpriseMap = \app\common\model\Enterprise::where($where)->column("name", "id");
- foreach ($list as $item) {
- //组装数据
- if (!$tmpList[$item["id"]]) {
- $tmpList[$item["id"]]["curEnterpriseId"] = $item["curEnterpriseId"];
- $tmpList[$item["id"]]["info"] = [$item["year"], $streetMap[$item["address"]], $item["name"], $item["sex"] == 1 ? "男" : "女", $item["idCard"], $levelMap[$item["talentArrange"]],
- $icmap[$item["identifyCondition"]], $item["identifyGetTime"], $item["identifyConditionName"], $item["identifyMonth"], AllowanceTypeEnum::getTypeName($item["recommendAllowanceType"]), $item["recommendMonths"], $item["recommendMoney"],
- $item["recommendMoneyDesc"], $item["otherEnjoyedMoney"], $item["otherEnjoyedDescription"] ?: "", AllowanceTypeEnum::getTypeName($item["allowanceType"]), $item["months"], $item["money"],
- $item["moneyDesc"], $this->getCheckStateName($item["checkState"], $item["publicState"], $item["allowanceType"]), $item["checkMsg"]];
- }
- if (!$tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]]) {
- $tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]] = [
- "startTime" => $item["startTime"],
- "endTime" => $item["endTime"],
- "entryTime" => $item["entryTime"],
- "isQuit" => $item["isQuit"]
- ];
- }
- $tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]]["projects"][$item["project"]] = $item["pre_months"];
- }
- $rows = [];
- $colorset = [];
- foreach ($tmpList as $id => $item) {
- foreach ($item["enterprise"] as $enterpriseId => $enterprise) {
- $row = $item["info"];
- $row[] = $this->user["uid"] == $enterpriseId ? "本单位" : $enterpriseMap[$enterpriseId];
- for ($i = 0; $i < count($projects); $i++) {
- if (strpos($enterprise["projects"][$projects[$i]], "=") === false) {
- $months = array_filter(explode(",", $enterprise["projects"][$projects[$i]]));
- for ($m = 1; $m <= 12; $m++) {
- $_month = str_pad($m, 2, "0", STR_PAD_LEFT);
- if (in_array($_month, $months)) {
- $row[] = "✔";
- $colorset[] = [sprintf("%s%d", getExcelColumnByIndex($infoCols + $i * 12 + $m - 1), count($rows) + 3), "29dd23"];
- } else {
- $row[] = "";
- }
- }
- } else {
- $months = array_filter(explode(",", $enterprise["projects"][$projects[$i]]));
- $_months = [];
- foreach ($months as $month) {
- $kv = explode("=", $month);
- $_months[$kv[0]] = $kv[1];
- }
- for ($m = 1; $m <= 12; $m++) {
- $_month = str_pad($m, 2, "0", STR_PAD_LEFT);
- $days = $_months[$_month];
- if ($days && $days > 0) {
- $row[] = $days . "天";
- $colorset[] = [sprintf("%s%d", getExcelColumnByIndex($infoCols + $i * 12 + $m - 1), count($rows) + 3), "29dd23"];
- } else {
- $row[] = "";
- }
- }
- }
- }
- $rows[] = $row;
- }
- }
- $cols = $infoCols + count($projects) * 12 - 1;
- $settings = [
- "width" => [["A", 8], ["C", 12], ["D", 6], ["E", 20], ["F", 12], ["G", 70], ["H", 12], ["I", 15], ["J", 12], ["K", 12], ["P", 30]],
- "height" => [18],
- "freeze" => "D3",
- "color" => $colorset
- ];
- for ($i = 0; $i < count($projects) * 12; $i++) {
- $settings["width"][] = [getExcelColumnByIndex($infoCols + $i), 6]; //批设置项目的宽度
- }
- $settings["background-color"][] = [sprintf("%s2:%s2", getExcelColumnByIndex($infoCols), getExcelColumnByIndex($cols)), "E1F1DE"];
- export($columns, $rows, "津补贴申报名单", $settings);
- }
- 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) {
- $projectMap[$project["project"]] = $project;
- }
- $detail["list"] = $projectList;
- $detail["projectMap"] = $projectMap;
- $detail["enterpriseName"] = $enterpriseMap[$detail["enterpriseId"]];
- $detail["talentTypeName"] = $talentTypeMap[$detail["talentType"]];
- /* * 筛选符合条件的人才标签 */
- $detaiPdList[] = $detail;
- $detailMonthList[] = $detail;
- }
- /* * 集成电路优秀人才 */
- //if ($this->user["type"] == 2) {
- /* * 获取各个项目的综合月份 */
- $monthMap = $this->mergeMonth($detailMonthList);
- $monthAndDayMap = $this->mergeMonthNeedDay($detailMonthList);
- $info["backWork"] = $old["backWork"];
- $info["recommendAllowanceType"] = $old["allowanceType"];
- $info["recommendAllowanceMsg"] = "";
- $info["otherEnjoyedMoney"] = $old["otherEnjoyedMoney"];
- $info["otherEnjoyedDescription"] = $old["otherEnjoyedDescription"];
- $projectList = \app\common\model\TalentAllowanceProject::where("mainId", $info["id"])->select()->toArray();
- $set = $this->valideAllowanceType($info, $projectList, $monthMap, $monthAndDayMap);
- $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n综合以上所有判断得到最终补贴类型为:";
- if ($info["recommendAllowanceType"] == 1) {
- $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "工作津贴;可享受月份为:" . implode(",", $set) . "\n";
- }
- if ($info["recommendAllowanceType"] == 2)
- $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "一次性交通补贴;";
- if ($info["recommendAllowanceType"] == 3)
- $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "不予兑现;";
- usort($set, function ($a, $b) {
- return (int) $a - (int) $b;
- });
- //}
- $info["recommendMonths"] = implode(",", $set);
- $arrangeList = $this->calculateAllowance($info, $set, $detailMonthList);
- return $arrangeList;
- }
- /**
- * 集成电路津补贴总校验
- * */
- private function valideAllowanceType(&$info, $projectList, $monthMap, $monthAndDayMap) {
- $set = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"];
- /* * 2.判定工作月份、五险和个税是否满足重叠6个月要求* */
- $contractSet = $this->chkMonths($monthMap[AllowanceProjectEnum::PROJECT_CONTRACT], $info, "上年度合同月份", "①");
- $workdaySet = $this->chkMonths($monthMap[AllowanceProjectEnum::PROJECT_ATTENDANCE], $info, "上年度工作月份", "②");
- $wageSet = self::chkMonths($monthMap[AllowanceProjectEnum::PROJECT_WAGES], $info, "上年度工资发放月份", "③");
- $pensionSet = $this->chkMonths($monthMap[AllowanceProjectEnum::PROJECT_SB_PENSION], $info, "养老保险", "④");
- $unemploymentSet = $this->chkMonths($monthMap[AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT], $info, "失业保险", "⑤");
- $medicaSet = $this->chkMonths($monthMap[AllowanceProjectEnum::PROJECT_SB_MEDICA], $info, "医疗保险", "⑥");
- $taxSet = $this->chkMonths($monthMap[AllowanceProjectEnum::PROJECT_TAX], $info, "个税", "⑦");
- $str = "工作合同月份、考勤月份、工资发放月份";
- if ($info["type"] == CommonConst::ENTERPRISE_WJ) {
- $str = "工作合同月份、考勤月份";
- $set = array_intersect($set, $contractSet);
- $set = array_intersect($set, $workdaySet);
- $checkSet = $set;
- //$set = array_intersect($set, $pensionSet);
- //$set = array_intersect($set, $taxSet);
- } else if ($info["type"] == CommonConst::ENTERPRISE_GJ) {
- if ($info["backWork"] == 1) {
- //$set = array_intersect($set, $workdaySet);
- $set = array_intersect($set, $wageSet);
- } else {
- //$set = array_intersect($set, $workdaySet);
- $set = array_intersect($set, $wageSet);
- }
- } else {
- $set = array_intersect($set, $contractSet);
- $set = array_intersect($set, $workdaySet);
- $set = array_intersect($set, $wageSet);
- $checkSet = $set;
- $set = array_intersect($set, $pensionSet);
- $set = array_intersect($set, $unemploymentSet);
- $set = array_intersect($set, $medicaSet);
- $set = array_intersect($set, $taxSet);
- }
- usort($set, function ($a, $b) {
- return (int) $a - (int) $b;
- });
- if ($info["recommendAllowanceType"] == 1) {
- if ($info["type"] == CommonConst::ENTERPRISE_GJ) {
- //高教另外判断
- $taxCount = 1;
- foreach ($taxSet as $s) {
- $currentVal = intval($s);
- $nextVal = $currentVal + 1;
- $nextKey = str_pad($nextVal, 2, "0", STR_PAD_LEFT);
- if (in_array($nextKey, $taxSet)) {
- $taxCount++;
- if ($taxCount >= 2) {
- break;
- }
- } else {
- $taxCount = 1;
- }
- }
- if ($info["backWork"] == 1) {
- //需要判断缴税有没有连续两个月以上
- if ($taxCount < 2) {
- $info["recommendAllowanceType"] = 3;
- $info["recommendAllowanceMsg"][] = "上年度个税缴纳月份不满足连续缴纳2个月(" . implode(",", $taxSet) . "),无法享受工作津贴(×)";
- }
- } else {
- //需要判断缴税或者养老有没有连续两个月以上
- $pensionCount = 1;
- foreach ($pensionSet as $s) {
- $currentVal = intval($s);
- $nextVal = $currentVal + 1;
- $nextKey = str_pad($nextVal, 2, "0", STR_PAD_LEFT);
- if (in_array($nextKey, $pensionSet)) {
- $pensionCount++;
- if ($pensionCount >= 2) {
- break;
- }
- } else {
- $pensionCount = 1;
- }
- }
- if ($taxCount < 2 && $pensionCount < 2) {
- $info["recommendAllowanceType"] = 3;
- $info["recommendAllowanceMsg"][] = "上年度个税缴纳月份(" . implode(",", $taxSet) . ")与养老保险缴纳月份(" . implode(",", $pensionSet) . ")均不满足连续缴纳2个月,无法享受工作津贴(×)";
- }
- }
- } else {
- if (count($checkSet) < 6) {
- //如果全部满足6个月,但是重叠时间不满足6个月,开始检测是否符合交通补贴要求
- $info["recommendAllowanceType"] = 3;
- $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n上年度{$str}交集月份不满足6个月(" . implode(",", $checkSet) . "),无法享受工作津贴(×)";
- } else {
- //检查连续缴纳月份是否满足6个月
- $count = 1;
- foreach ($checkSet as $s) {
- $currentVal = intval($s);
- $nextVal = $currentVal + 1;
- $nextKey = str_pad($nextVal, 2, "0", STR_PAD_LEFT);
- if (in_array($nextKey, $checkSet)) {
- $count++;
- if ($count >= 6) {
- break;
- }
- } else {
- $count = 1;
- }
- }
- if ($count < 6) {
- $info["recommendAllowanceType"] = 3;
- $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n上年度{$str}不满足连续缴纳6个月(" . implode(",", $checkSet) . "),无法享受工作津贴(×)";
- }
- }
- }
- }
- if ($info["recommendAllowanceType"] == 2) {
- //判断境内工作时间是否大于30天
- if ($info["allowanceType"] == 2) {
- $totalDays = 0;
- $workmonths = $monthAndDayMap[AllowanceProjectEnum::PROJECT_ATTENDANCE];
- foreach ($workmonths as $days) {
- $totalDays += $days;
- }
- if ($totalDays < 30) {
- $info["recommendAllowanceType"] = 3;
- $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n全年在我市工作仅{$totalDays}天,未达到30天,无法享受一次性交通津贴(×)";
- }
- } else {
- if (count($workdaySet) == 0) {
- $info["recommendAllowanceType"] = 3;
- $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n全年在我市工作未达到30天,无法享受一次性交通津贴(×)";
- } else {
- $info["recommendAllowanceType"] = 2;
- $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n*首选为工作津贴,未录入实际工作天数,需要进一步核实提交的相关附件是否满足全年在我市工作30天";
- }
- }
- }
- return $set;
- }
- /**
- * 计算津补贴
- */
- private function calculateAllowance(&$info, $retainMonths, $detailMonthList) {
- /* * 查询人才层次变更记录 */
- $arrangeList = TalentAllowanceArrange::where("mainId", $info["id"])->order("talentArrange")->select()->toArray();
- foreach ($arrangeList as &$arrange) {
- $where = [];
- $where[] = ["type", "=", $this->user["type"]];
- $where[] = ["allowanceType", "in", [1, 2]];
- $where[] = ["talentArrange", "=", $arrange["talentArrange"]];
- $list = AsModel::where($where)->field("money,allowanceType")->select()->toArray();
- foreach ($list as $amount) {
- if ($amount["allowanceType"] == 1) {
- $arrange["jobMoney"] = $amount["money"];
- }
- if ($amount["allowanceType"] == 2) {
- $arrange["jtMoney"] = $amount["money"];
- }
- }
- }unset($arrange);
- /* * * 容器 */
- $jobMoney = 0.00; //计算所得工作津贴
- $jtMoney = 0.00; //计算所得一次性交通补贴
- $recommendMonths = []; //推荐月份
- $talentArrange = null;
- /* * *********计算************* */
- $msgBulider = [];
- $identifyExpiredName = "人才证书有效期";
- if ($info["type"] == CommonConst::ENTERPRISE_JC) {
- $identifyExpiredName = "认定条件有效期";
- }
- switch ($info["recommendAllowanceType"]) {
- case 1:
- foreach ($arrangeList as &$arrange) {
- if (\StrUtil::isNotEmpAndNull($arrange["prepareMonths"])) {
- $levelList = array_filter(explode(",", $arrange["prepareMonths"]));
- $levelList = array_intersect($levelList, $retainMonths);
- $total = round($arrange["jobMoney"] * count($levelList), 2);
- $jobMoney += $total;
- $msgBulider[] = sprintf("%d(%s)x%s(第%d层次)", count($levelList), $levelList ? implode(",", $levelList) : "", $arrange["jobMoney"], $arrange["talentArrange"]);
- $recommendMonths = array_merge($recommendMonths, $levelList);
- usort($recommendMonths, function ($a, $b) {
- return (int) $a - (int) $b;
- });
- $arrange["months"] = implode(",", $levelList);
- $arrange["count"] = count($levelList);
- $arrange["total"] = $total;
- } else {
- $msgBulider[] = sprintf("0()x%s(第%d层次)", $arrange["jobMoney"], $arrange["talentArrange"]);
- $arrange["count"] = 0;
- $arrange["total"] = 0.00;
- }
- }unset($arrange);
- $info["recommendMonths"] = implode(",", $recommendMonths);
- $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "通过与{$identifyExpiredName}取交集得到最终可享受月份:" . implode(",", $recommendMonths) . "\n经过计算:人才津贴为" . $jobMoney . ";";
- if ($info["otherEnjoyedMoney"] != 0) {
- $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n" . "扣除其它补贴金额" . $info["otherEnjoyedMoney"] . "元,最终可享受人才津贴为" . number_format($jobMoney - $info["otherEnjoyedMoney"], 2) . "元";
- }
- $info["recommendMoney"] = $jobMoney;
- $info["recommendMoneyDesc"] = implode("+", $msgBulider) . ($info["otherEnjoyedMoney"] != 0 ? sprintf("-%s(其它补贴金额)", number_format($info["otherEnjoyedMoney"], 2)) : "");
- break;
- case 2:
- foreach ($arrangeList as $arrange) {
- $jtMoney = $arrange["jtMoney"];
- $talentArrange = $arrange["talentArrange"];
- }
- $info["recommendMoney"] = $jtMoney;
- $info["recommendMonths"] = "";
- $info["recommendMoneyDesc"] = "一次性交通补贴";
- $info["workAllowanceMoney"] = 0.00;
- $info["developAllowanceMoney"] = 0.00;
- $info["recommendTalentArrange"] = $talentArrange;
- if ($info["otherEnjoyedMoney"] != 0) {
- $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n" . "扣除其它补贴金额" . $info["otherEnjoyedMoney"] . "元,最终可享受人才津贴为" . number_format($jtMoney - $info["otherEnjoyedMoney"], 2) . "元";
- }
- $info["recommendMoneyDesc"] = $info["otherEnjoyedMoney"] != 0 ? sprintf("-%s(其它补贴金额)", number_format($info["otherEnjoyedMoney"], 2)) : "";
- break;
- case 3:
- $info["recommendMoney"] = 0.00;
- $info["recommendMonths"] = "";
- $info["recommendMoneyDesc"] = "不予兑现";
- $info["workAllowanceMoney"] = 0.00;
- $info["developAllowanceMoney"] = 0.00;
- break;
- }
- return $arrangeList;
- }
- /**
- * 判定是否交足6个月(集成电路)
- * @param set
- * @param info
- * @param name
- */
- private function chkMonths($set, &$info, $name, $sort) {
- if ($name == "上年度工作月份") {
- if ($info["allowanceType"] == 2) {
- $tmp = [];
- foreach ($set as $s) {
- $_s = explode("=", $s);
- $month = $_s[0];
- $days = $_s[1];
- if ($days > 0) {
- $tmp[] = $month;
- }
- }
- $set = $tmp;
- }
- }
- $preCheckProjects = ["①", "②", "③"];
- if ($info["type"] == CommonConst::ENTERPRISE_WJ) {
- $preCheckProjects = ["①", "②"];
- }
- if ($info["type"] == CommonConst::ENTERPRISE_GJ) {
- if ($info["backWork"] == 1) {
- $preCheckProjects = ["②", "③"];
- } else {
- $preCheckProjects = ["②", "③"];
- }
- }
- if ($info["recommendAllowanceType"] == 1 && (!$set || count($set) < 6) && in_array($sort, $preCheckProjects)) {
- $info["recommendAllowanceType"] = 3;
- $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . $sort . $name . "不足6个月,无法享受工作津贴(×)";
- }
- return $set;
- }
- //合并所有项目的月份
- private function mergeMonth($detailList) {
- $contractList = [];
- $taxList = [];
- $wagesList = [];
- $pensionList = [];
- $unemploymentList = [];
- $medicaList = [];
- $attendanceList = [];
- $workdayList = [];
- foreach ($detailList as $detail) {
- $projectMap = $detail["projectMap"];
- if ($detail["months"]) {
- $tmp = array_filter(explode(",", $detail["months"]));
- $contractList = array_merge($contractList, $tmp);
- }
- if ($projectMap[AllowanceProjectEnum::PROJECT_TAX] && \StrUtil::isNotEmpAndNull($projectMap[AllowanceProjectEnum::PROJECT_TAX]["months"])) {
- $tmp = array_filter(explode(",", $projectMap[AllowanceProjectEnum::PROJECT_TAX]["months"]));
- $taxList = array_merge($taxList, $tmp);
- }
- if ($projectMap[AllowanceProjectEnum::PROJECT_WAGES] && \StrUtil::isNotEmpAndNull($projectMap[AllowanceProjectEnum::PROJECT_WAGES]["months"])) {
- $tmp = array_filter(explode(",", $projectMap[AllowanceProjectEnum::PROJECT_WAGES]["months"]));
- $wagesList = array_merge($wagesList, $tmp);
- }
- if ($projectMap[AllowanceProjectEnum::PROJECT_SB_PENSION] && \StrUtil::isNotEmpAndNull($projectMap[AllowanceProjectEnum::PROJECT_SB_PENSION]["months"])) {
- $tmp = array_filter(explode(",", $projectMap[AllowanceProjectEnum::PROJECT_SB_PENSION]["months"]));
- $pensionList = array_merge($pensionList, $tmp);
- }
- if ($projectMap[AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT] && \StrUtil::isNotEmpAndNull($projectMap[AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT]["months"])) {
- $tmp = array_filter(explode(",", $projectMap[AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT]["months"]));
- $unemploymentList = array_merge($unemploymentList, $tmp);
- }
- if ($projectMap[AllowanceProjectEnum::PROJECT_SB_MEDICA] && \StrUtil::isNotEmpAndNull($projectMap[AllowanceProjectEnum::PROJECT_SB_MEDICA]["months"])) {
- $tmp = array_filter(explode(",", $projectMap[AllowanceProjectEnum::PROJECT_SB_MEDICA]["months"]));
- $medicaList = array_merge($medicaList, $tmp);
- }
- if ($projectMap[AllowanceProjectEnum::PROJECT_ATTENDANCE] && \StrUtil::isNotEmpAndNull($projectMap[AllowanceProjectEnum::PROJECT_ATTENDANCE]["months"])) {
- $tmp = array_filter(explode(",", $projectMap[AllowanceProjectEnum::PROJECT_ATTENDANCE]["months"]));
- $attendanceList = array_merge($attendanceList, $tmp);
- }
- if ($projectMap[AllowanceProjectEnum::PROJECT_WORKDAY] && \StrUtil::isNotEmpAndNull($projectMap[AllowanceProjectEnum::PROJECT_WORKDAY]["months"])) {
- $tmp = array_filter(explode(",", $projectMap[AllowanceProjectEnum::PROJECT_WORKDAY]["months"]));
- $workdayList = array_merge($workdayList, $tmp);
- }
- }
- $map = [
- AllowanceProjectEnum::PROJECT_CONTRACT => $contractList,
- AllowanceProjectEnum::PROJECT_TAX => $taxList,
- AllowanceProjectEnum::PROJECT_WAGES => $wagesList,
- AllowanceProjectEnum::PROJECT_SB_PENSION => $pensionList,
- AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT => $unemploymentList,
- AllowanceProjectEnum::PROJECT_SB_MEDICA => $medicaList,
- AllowanceProjectEnum::PROJECT_ATTENDANCE => $attendanceList,
- AllowanceProjectEnum::PROJECT_WORKDAY => $workdayList,
- ];
- return $map;
- }
- /**
- * 合并多个单位带有天数的项目的月份如考勤1月30天,
- * */
- private function mergeMonthNeedDay($detailList) {
- $attendMap = [];
- $workDayMap = [];
- foreach ($detailList as $detail) {
- $attendMap = $this->getMergeMonthNeedDayMap($detail["projectMap"][AllowanceProjectEnum::PROJECT_ATTENDANCE], $attendMap);
- $workDayMap = $this->getMergeMonthNeedDayMap($detail["projectMap"][AllowanceProjectEnum::PROJECT_WORKDAY], $workDayMap);
- }
- $res = [
- AllowanceProjectEnum::PROJECT_ATTENDANCE => $attendMap,
- AllowanceProjectEnum::PROJECT_WORKDAY => $workDayMap
- ];
- return $res;
- }
- private function getMergeMonthNeedDayMap($project, $map) {
- if (\StrUtil::isNotEmpAndNull($project["months"])) {
- $monthAndDayList = array_filter(explode(",", $project["months"]));
- for ($i = 0; $i < count($monthAndDayList); $i++) {
- $obj = explode("=", $monthAndDayList[$i]);
- $month = $obj[0];
- $day = is_numeric($obj[1]) ? $obj[1] : 0;
- $count = $map[$month];
- if ($count == 0) {
- $map[$month] = $day;
- } else {
- $map[$month] = $day + $count;
- }
- }
- }
- return $map;
- }
- /**
- * 校验是否在审核范围内
- */
- 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[] = ["isConditionFile", "=", $info["allowanceType"]];
- $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;
- $res["calResult"] = TalentAllowanceApi::validateAllowanceType($id);
- }
- $detailList = \app\common\model\TalentAllowancecontractDetail::where("mainId", $id)->select()->toArray();
- $talentTypeMap = DictApi::selectByParentCode("enterprise_tag");
- $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
- foreach ($detailList as &$detail) {
- $detail["enterpriseName"] = $enterpriseMap[$detail["enterpriseId"]];
- if (\StrUtil::isNotEmpAndNull($detail["talentType"])) {
- $detail["talentTypeName"] = $talentTypeMap[$detail["talentType"]];
- }
- }
- $res["detailList"] = $detailList;
- return new Response(Response::SUCCESS, "不在审核范围内", $res);
- }
- /**
- * 初始化可修改的项目/附件/合同
- * */
- public function findFieldsAndFiles() {
- $id = $this->request["id"];
- if (\StrUtil::isEmpOrNull($id)) {
- return new Response(Response::ERROR, "请选择需要修改的对象");
- }
- $info = TalentAllowanceApi::getInfoById($id);
- if (!$info) {
- return new Response(Response::ERROR, "系统错误,请联系管理员");
- }
- if ($info["checkState"] != AllowanceStateEnum::FIRST_REJECT) {
- return new Response(Response::ERROR, "只能修改初审驳回的数据");
- }
- $res = [];
- $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();
- foreach ($detailList as &$detail) {
- $detail["enterpriseName"] = $enterpriseMap[$detail["enterpriseId"]];
- }unset($detail);
- foreach ($projectList as &$project) {
- $detail = $detailMap[$project["baseId"]];
- $project["projectName"] = sprintf("%s(%s)", AllowanceProjectEnum::getProjectName($project["project"]), $enterpriseMap[$project["enterpriseId"]]);
- }unset($project);
- $where = [];
- $where[] = ["type", "=", $info["type"]];
- $where[] = ["project", "=", \app\common\state\ProjectState::JBT];
- $where[] = ["active", "=", 1];
- $where[] = ["isConditionFile", "=", $info["allowanceType"]];
- $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;
- $res["info"] = $info;
- return new Response(Response::SUCCESS, "", $res);
- }
- /**
- * 修改驳回项目/附件/合同
- * */
- public function updateFieldsAndFiles() {
- $data = $this->request->param();
- if (!$data["id"]) {
- return new Response(Response::ERROR, "系统错误,请联系管理员");
- }
- TaModel::update($data);
- return new Response(Response::SUCCESS, "修改成功");
- }
- /**
- * 修改项目
- */
- public function editProject() {
- $param = $this->request->param();
- if (!$param["id"]) {
- return new Response(Response::ERROR, "系统错误,请联系管理员");
- }
- $detail = \app\common\model\TalentAllowanceProject::find($param["id"]);
- $info = TalentAllowanceApi::getInfoById($detail["mainId"]);
- \app\common\model\TalentAllowanceProject::update($param);
- //添加日志
- TalentChecklog::create([
- 'id' => getStringId(),
- 'mainId' => $info['id'],
- 'type' => intval(ProjectState::JBT),
- 'typeFileId' => $param["id"],
- 'active' => 1,
- 'state' => null,
- 'step' => $param["process"],
- 'stateChange' => null,
- 'description' => "修改项目名:" . AllowanceProjectEnum::getProjectName($detail["project"]) . "的值为:" . $param["months"] . ";备注为:" . $param["description"],
- '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 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_TEACHING,
- AllowanceProjectEnum::PROJECT_LESSON,
- AllowanceProjectEnum::PROJECT_TRAINING_PROGRAM,
- //AllowanceProjectEnum::PROJECT_WORKDAY
- ]) ? 1 : 2;
- } else if ($info["checkState"] == 10 || $info["checkState"] == 8) {
- $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"] = CommonConst::getLayerNameByLayer($arrange["talentArrange"]);
- }unset($arrange);
- return json(["rows" => $list, "total" => $count]);
- }
- /**
- * 试算
- * @param type $id
- * @return type
- */
- public function calculator($id) {
- $cal = TalentAllowanceApi::validateAllowanceType($id);
- return json($cal);
- }
- private function setTalentAllowanceInfo($where, $query, $process) {
- if (\StrUtil::isNotEmpAndNull($query["year"])) {
- $where[] = ["year", "like", $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["allowanceType"]) {
- $where[] = ["allowanceType", "=", $query["allowanceType"]];
- }
- 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 -2: //保存未提交
- $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 9: //重新提交
- $where[] = ["checkState", "=", 5];
- $where[] = ["highProcess", ">=", $process];
- break;
- case 4: //上级驳回
- $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 setTalentAllowanceInfoForExport(&$where, $query, $process) {
- if (\StrUtil::isNotEmpAndNull($query["year"])) {
- $where[] = ["ta.year", "like", $query["year"] . "%"];
- }
- if (\StrUtil::isNotEmpAndNull($query["enterpriseName"])) {
- $where[] = ["ta.enterpriseName", "like", "%" . $query["enterpriseName"] . "%"];
- }
- if (\StrUtil::isNotEmpAndNull($query["name"])) {
- $where[] = ["ta.name", "like", "%" . $query["name"] . "%"];
- }
- if (\StrUtil::isNotEmpAndNull($query["talentType"])) {
- $where[] = ["ta.talentType", "=", $query["talentType"]];
- }
- if (\StrUtil::isNotEmpAndNull($query["talentArrange"])) {
- $where[] = ["ta.talentArrange", "=", $query["talentArrange"]];
- }
- if (\StrUtil::isNotEmpAndNull($query["identifyCondition"])) {
- $where[] = ["ta.identifyCondition", "=", $query["identifyCondition"]];
- }
- if (\StrUtil::isNotEmpAndNull($query["address"])) {
- $where[] = ["ta.address", "=", $query["address"]];
- }
- if (\StrUtil::isNotEmpAndNull($query["allowanceType"])) {
- $where[] = ["ta.allowanceType", "=", $query["allowanceType"]];
- }
- if (\StrUtil::isNotEmpAndNull($query["recommendAllowanceType"])) {
- $where[] = ["ta.recommendAllowanceType", "=", $query["recommendAllowanceType"]];
- }
- if (\StrUtil::isNotEmpAndNull($query["publicState"])) {
- $where[] = ["ta.publicState", "=", $query["publicState"]];
- }
- if (\StrUtil::isNotEmpAndNull($query["introductionMode"])) {
- $where[] = ["ta.introductionMode", "=", $query["introductionMode"]];
- }
- if (\StrUtil::isNotEmpAndNull($query["firstJJStartTime"])) {
- $where[] = ["ta.firstInJJTime", ">=", $query["firstJJStartTime"]];
- }
- if (\StrUtil::isNotEmpAndNull($query["firstJJEndTime"])) {
- $where[] = ["ta.firstInJJTime", "<=", $query["firstJJEndTime"]];
- }
- if ($process == 4) {
- if ($query["isSupple"]) {
- $where[] = ["ta.isSupple", "=", $query["isSupple"]];
- }
- if ($query["isPublicCheck"]) {
- $where[] = ["ta.isPublicCheck", "=", $query["isPublicCheck"]];
- }
- }
- if ($query["checkState"]) {
- if ($query["checkState"] == -1) {
- $where[] = ["ta.checkState", "=", $query["checkState"]];
- } else {
- if ($process == 1) {
- switch ($query["checkState"]) {
- case 0: //保存未提交
- $where[] = ["ta.checkState", "=", 1];
- break;
- case 1:
- $where[] = ["ta.checkState", "=", 5];
- break;
- case 2: //驳回
- $where[] = ["ta.checkState", "=", 10];
- break;
- case 3: //通过
- $where[] = ["ta.checkState", "in", [15, 20, 30, 25]];
- break;
- case 4: //重新提交
- $where[] = ["ta.checkState", "=", 5];
- $where[] = ["ta.highProcess", ">=", $process];
- break;
- case 5: //上级驳回
- $where[] = ["ta.checkState", "=", 13];
- break;
- }
- }
- if ($process == 2) {
- switch ($query["checkState"]) {
- case 1:
- $where[] = ["ta.checkState", "=", 15];
- break;
- case 2: //驳回
- $where[] = ["ta.checkState", "in", [1, 5, 10]];
- $where[] = ["ta.highProcess", ">=", $process];
- break;
- case 3: //通过
- $where[] = ["ta.checkState", "in", [20, 30]];
- break;
- case 9: //重新提交
- $where[] = ["ta.checkState", "=", 15];
- $where[] = ["ta.highProcess", ">=", $process];
- break;
- case 4: //上级驳回
- $where[] = ["ta.checkState", "=", 25];
- break;
- case -1:
- $where[] = ["ta.checkState", "=", -1];
- break;
- }
- }
- if ($process == 3) {
- switch ($query["checkState"]) {
- case -1:
- $where[] = ["ta.checkState", "=", -1];
- break;
- case 1:
- $where[] = ["ta.checkState", "=", 20];
- break;
- case 2: //驳回
- $where[] = ["ta.checkState", "in", [1, 5, 10, 15, 25]];
- $where[] = ["ta.highProcess", ">=", $process];
- break;
- case 3: //通过
- $where[] = ["ta.checkState", "=", 30];
- break;
- case 9: //重新提交
- $where[] = ["ta.checkState", "=", 20];
- $where[] = ["ta.highProcess", ">=", $process];
- break;
- case 4: //上级驳回
- $where[] = ["ta.checkState", "=", 35];
- break;
- }
- }
- if ($process == 4) {
- switch ($query["checkState"]) {
- case -1:
- $where[] = ["ta.checkState", "=", -1];
- break;
- case 3: //通过
- $where[] = ["ta.checkState", "=", 30];
- break;
- }
- }
- }
- }
- }
- 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["recommendAllowanceType"]);
- $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;
- }
- private function getCheckStateName($checkState, $publicState, $allowanceType) {
- switch ($checkState) {
- case 1:
- return "待提交";
- case 5:
- case 13:
- case 15:
- case 20:
- case 25:
- case 35:
- return "审核中";
- case 10:
- return "已驳回";
- case - 1:
- if ($publicState >= 3) {
- return "审核不通过";
- } else {
- return "审核中";
- }
- break;
- case 30:
- if ($publicState == 1) {
- return "待核查征信";
- } else if ($publicState == 2) {
- return "待公示";
- } else if ($publicState == 3) {
- return "公示中";
- } else if ($publicState == 4) {
- return $allowanceType != 3 ? "待兑现" : "不予兑现";
- } else if ($publicState == 5) {
- return "已兑现";
- }
- default:
- return "未知状态";
- }
- }
- }
|