| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628 | 
							- <?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\model\AmountStandard as AsModel;
 
- /**
 
-  * 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]);
 
-     }
 
-     /**
 
-      * 审核页面
 
-      * @return type
 
-      */
 
-     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]);
 
-     }
 
-     /**
 
-      * 查看详情
 
-      * @return type
 
-      */
 
-     public function toSelectPage() {
 
-         $id = $this->request["id"];
 
-         $process = $this->request["process"];
 
-         $obj = TalentAllowanceApi::getInfoById($id);
 
-         $this->translateToChinese($obj);
 
-         return view("select", ["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, "审核成功");
 
-     }
 
-     /**
 
-      * 提交审核
 
-      * @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;
 
-         /*         * 查询审核日志 */
 
-         $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");
 
-                         }
 
-                         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 -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");
 
-                         /*                         * * 在此处需要判断津补贴类型 */
 
-                         $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]];
 
-                 $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["description"]
 
-             ];
 
-             $rows[] = $row;
 
-         }
 
-         $filename = "津补贴待核查征信名单导出";
 
-         if ($rows) {
 
-             export($columns, $rows, $filename);
 
-             exit();
 
-         } else {
 
-             $response->msg = "没有选择导出的名单";
 
-             return \StrUtil::back($response, "TalentTypeChange.callBack");
 
-         }
 
-     }
 
-     /**
 
-      * 核查征信驳回
 
-      */
 
-     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);
 
-         return view("public_check", ["row" => $obj, "process" => $process]);
 
-     }
 
-     /**
 
-      * 公示再审核计算津补贴
 
-      * */
 
-     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($detal["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, "系统异常,请联系管理员");
 
-         }
 
-     }
 
-     /**
 
-      *  公示后审核
 
-      */
 
-     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 ($params["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 = $monthdsMap[$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" . $obj["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"];
 
-                     $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"];
 
-         $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"];
 
-                     $upd["moneyDesc"] = $obj["recommendMoneyDesc"];
 
-                 } else if ($upd["allowanceType"] == 2) {
 
-                     $upd["months"] = "";
 
-                     $upd["jtTalentArrange"] = $obj["recommendTalentArrange"];
 
-                     $upd["money"] = $obj["recommendMoney"];
 
-                     $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 = ($this->user["type"] == 1 ? "晋江市优秀人才" : "晋江市集成电路人才") . $allList[0]["year"] . "年度津补贴不予兑现对象名单";
 
-         $columns = ["序号", "姓名", "工作单位", "镇(街道)", "人才层次", "备注"];
 
-         if ($rows) {
 
-             export($columns, $rows, $filename);
 
-             exit();
 
-         } else {
 
-             $response->msg = "没有选择导出的名单";
 
-             return \StrUtil::back($response, "TalentTypeChange.callBack");
 
-         }
 
-     }
 
-     /**
 
-      * 导出公示名单(需要兑现)
 
-      */
 
-     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();
 
-         /*         * 查询相关的津补贴人才层次 */
 
-         $where = [];
 
-         $where[] = ["mainId", "in", explode(",", $this->request["ids"])];
 
-         $arrangeList = TalentAllowanceArrange::where($where)->select()->toArray();
 
-         foreach ($arrangeList as &$arrange) {
 
-             $arrange["talentArrangeName"] = $levelMap[$arrange["talentArrange"]];
 
-         }unset($arrange);
 
-         /* Map<String,List<TalentAllowanceArrange>> arrangeMap = arrangeList.stream().collect(Collectors.groupingBy(TalentAllowanceArrange::getMainId));
 
-           Integer sheetSize = 0;
 
-           for(TalentAllowanceInfo info:allList){
 
-           info.setEnterpriseName(enterpriseMap.get(info.getEnterpriseId()));
 
-           info.setAddressName(streetMap.get(info.getAddress()));
 
-           info.setTalentArrangeName(levelMap.get(info.getTalentArrange()));
 
-           if(info.getRecommendAllowanceType() == 1){
 
-           info.setArrangeList(arrangeMap.get(info.getId()));
 
-           sheetSize = sheetSize + info.getArrangeList().size();
 
-           }else if(info.getRecommendAllowanceType() == 1){
 
-           sheetSize++;
 
-           }
 
-           } */
 
-         $filename = ($this->user["type"] == 1 ? "晋江市优秀人才" : "晋江市集成电路人才") . $list[0]["year"] . "年度津补贴拟发放对象名单";
 
-         $columns = ["序号", "姓名", "工作单位", "镇(街道)", "人才层次", "津补贴享受月份数", "每月享受津贴标准(元)", $list[0]["year"] . "年度累计应享受津补贴金额(元)", "备注"];
 
-     }
 
-     /**
 
-      * 导出基本信息
 
-      */
 
-     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["companyName"] = \StrUtil::getRequestDecodeParam($this->request, "companyName");
 
-         $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"];
 
-         $list = [];
 
-         switch ($obj["process"]) {
 
-             case 1:
 
-                 break;
 
-             case 2:
 
-                 break;
 
-             case 3:
 
-                 break;
 
-             case 4:
 
-                 break;
 
-         }
 
-     }
 
-     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["recommendAllowanceType"] = 1;
 
-             $info["recommendAllowanceMsg"] = "";
 
-             $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个月要求* */
 
-         $workdaySet = $this->chkMonths($monthMap[AllowanceProjectEnum::PROJECT_ATTENDANCE], $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, "个税", "⑤");
 
-         $set = array_intersect($set, $workdaySet);
 
-         $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 (count($set) < 6) {
 
-                 //如果全部满足6个月,但是重叠时间不满足6个月,开始检测是否符合交通补贴要求
 
-                 $info["recommendAllowanceType"] == 2;
 
-                 $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n社会保险、个税、上年度工作月份交集月份不满足6个月(" . implode(",", $set) . "),无法享受工作津贴(×)";
 
-             } else {
 
-                 //检查连续缴纳月份是否满足6个月
 
-                 $count = 1;
 
-                 foreach ($set as $s) {
 
-                     $currentVal = intval($s);
 
-                     $nextVal = $currentVal + 1;
 
-                     $nextKey = str_pad($nextVal, 2, "0", STR_PAD_LEFT);
 
-                     if (in_array($nextKey, $set)) {
 
-                         $count++;
 
-                         if ($count >= 6) {
 
-                             break;
 
-                         }
 
-                     } else {
 
-                         $count = 1;
 
-                     }
 
-                 }
 
-                 if ($count < 6) {
 
-                     $info["recommendAllowanceType"] == 2;
 
-                     $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n社会保险、个税、上年度工作月份交集月份不满足连续缴纳6个月(" . implode(",", $set) . "),无法享受工作津贴(×)";
 
-                 }
 
-             }
 
-         }
 
-         if ($info["recommendAllowanceType"] == 2) {
 
-             //判断境内工作时间是否大于30天
 
-             $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天,无法享受一次性交通津贴(×)";
 
-             }
 
-         }
 
-         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 = [];
 
-         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"] . "通过与人才证书有效期取交集得到最终可享受月份:" . implode(",", $recommendMonths) . "\n经过计算:人才津贴为" . $jobMoney . ";";
 
-                 $info["recommendMoney"] = $jobMoney;
 
-                 $info["recommendMoneyDesc"] = implode("+", $msgBulider);
 
-                 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;
 
-                 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 == "上年度工作月份") {
 
-             $tmp = [];
 
-             foreach ($set as $s) {
 
-                 $_s = explode("=", $s);
 
-                 $month = $_s[0];
 
-                 $days = $_s[1];
 
-                 if ($days > 0) {
 
-                     $tmp[] = $month;
 
-                 }
 
-             }
 
-             $set = $tmp;
 
-         }
 
-         if ($info["recommendAllowanceType"] == 1 && (!$set || count($set) < 6)) {
 
-             $info["recommendAllowanceType"] = 2;
 
-             $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . $sort . $name . "不足6个月,无法享受工作津贴(×)";
 
-         }
 
-         return $set;
 
-     }
 
-     //合并所有项目的月份
 
-     private function mergeMonth($detailList) {
 
-         $taxList = [];
 
-         $wagesList = [];
 
-         $pensionList = [];
 
-         $unemploymentList = [];
 
-         $medicaList = [];
 
-         $attendanceList = [];
 
-         $workdayList = [];
 
-         foreach ($detailList as $detail) {
 
-             $projectMap = $detail["projectMap"];
 
-             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_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 = $obj[1];
 
-                 $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[] = ["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;
 
-     }
 
- }
 
 
  |