Przeglądaj źródła

Merge remote-tracking branch 'origin/master'

zmw 10 miesięcy temu
rodzic
commit
84e0b7446a

+ 1700 - 0
app/admin/controller/House.php

@@ -0,0 +1,1700 @@
+<?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\state\CommonConst;
+use app\common\state\HouseStateEnum;
+use app\common\model\HousePurchase as houseModel;
+
+/**
+ * Description of House
+ *
+ * @author sgq
+ */
+class House 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($process) {
+        $param = $this->request->param();
+        $offset = $param["offset"] ?: 0;
+        $limit = $param["limit"] ?: 10;
+        $param["process"] = $process;
+        $param["type"] = $this->user["type"];
+        $where = [];
+        $where[] = ["type", "=", $this->user["type"]];
+        $where[] = ["delete", "=", 0];
+        $order = "createTime desc";
+        $this->setCondition($where, $param);
+        switch ($process) {
+            case 1:
+                break;
+            case 2:
+                break;
+            case 3:
+                $where[] = ["depPassTime", "EXP", Db::raw("is not null")];
+                break;
+            case 4:
+                $where[] = ["checkState", "in", [HouseStateEnum::NOTPASS, HouseStateEnum::REVIEW_PASS]];
+                $where[] = ["reviewPassTime", "EXP", Db::raw("is not null")];
+                break;
+        }
+        if (in_array($process, [1, 3, 4])) {
+            $count = houseModel::where($where)->count();
+            $list = houseModel::where($where)->limit($offset, $limit)->order($order)->select()->toArray();
+        } else {
+            /*SELECT
+            t1.companyId,
+            t1.state,
+            t3.`name` AS companyName,
+            t5.description AS checkMsg,
+            t2.id,
+            t2.talentId,
+            t2.enterpriseId,
+            t2.type,
+            t2.declareType,
+            t2.declareObject,
+            t2.`year`,
+            t2.`name`,
+            t2.cardType,
+            t2.idCard,
+            t2.provinceCode,
+            t2.provinceName,
+            t2.cityCode,
+            t2.cityName,
+            t2.countyCode,
+            t2.countyName,
+            t2.street,
+            t2.talentType,
+            t2.talentArrange,
+            t2.identifyCondition,
+            t2.idenfityConditionName,
+            t2.identifyGetTime,
+            t2.phone,
+            t2.marryStatus,
+            t2.spouseName,
+            t2.spouseCardType,
+            t2.spouseIdcard,
+            t2.childName,
+            t2.childCardType,
+            t2.childIdCard,
+            t2.number,
+            t2.houseAddress,
+            t2.houseArea,
+            t2.recordTime,
+            t2.houseMoney,
+            t2.realEstateNo,
+            t2.recordNo,
+            t2.isEnjoyOther,
+            t2.bank,
+            t2.bankNumber,
+            t2.bankNetwork,
+            t2.bankAccount,
+            t2.sbPayDetail,
+            t2.taxPayDetail,
+            t2.letterDetail,
+            t2.attendDetail,
+            t2.mzjCheckDetail,
+            t2.checkIsTradeRecord,
+            t2.checkRecordTime,
+            t2.zjjCheckDetail,
+            t2.isHasBdcCard,
+            t2.bdcRegistTime,
+            t2.isOwner,
+            t2.transferMethod,
+            t2.transferTime,
+            t2.zrzzjCheckDetail,
+            t2.shouldEnjoyMoney,
+            t2.realEnjoyMoney,
+            t2.talentArrangeMonths,
+            t2.monthCount,
+            t2.firstSubmitTime,
+            t2.newSubmitTime,
+            t2.firstPassTime,
+            t2.depPassTime,
+            t2.reviewPassTime,
+            t2.isConflict,
+            t2.checkState,
+            t2.checkMsg,
+            t2.publicState,
+            t2.cashType,
+            t2.cashIdCards,
+            t2.`fields`,
+            t2.files,
+            t2.highProcess
+        FROM
+            un_talent_depcheckstate t1
+        LEFT JOIN un_housepurchase t2 ON t2.id = t1.mainId
+        LEFT JOIN sys_company t3 ON t3.id = t1.companyId
+        LEFT JOIN (
+            SELECT
+                t4.mainId,
+                t4.createTime,
+                t4.companyId,
+                t4.description
+            FROM
+                (
+                    SELECT
+                        *
+                    FROM
+                        un_talent_checklog
+                    WHERE
+                        type = #{type}
+                    AND step = 2
+                    AND state != 8
+                    ORDER BY
+                        createTime DESC
+                    LIMIT 100000
+                ) t4
+            GROUP BY
+                t4.mainId,
+                t4.companyId
+            ORDER BY
+                t4.createTime DESC
+        ) t5 ON t1.mainId = t5.mainId
+        AND t1.companyId = t5.companyId
+        WHERE t1.type=#{type}
+        and  t2.type = #{obj.type}
+        <include refid="housePurchase_condition"></include>
+        ORDER BY t1.createTime DESC
+        LIMIT #{current},#{limit}*/
+            /*
+             * SELECT
+        count(0)
+        FROM
+        un_talent_depcheckstate t1
+        LEFT JOIN un_housepurchase t2 ON t2.id = t1.mainId
+        LEFT JOIN sys_company t3 ON t3.id = t1.companyId
+        WHERE t1.type=#{type}
+        and  t2.type = #{obj.type}
+        <include refid="housePurchase_condition"></include>
+             */
+        }
+        $list = $this->translateChinese($list, $process);
+        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 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;
+        $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["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 -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");
+                        /*                         * * 在此处需要判断津补贴类型 */
+                        $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);
+        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, "系统异常,请联系管理员");
+        }
+    }
+
+    /**
+     *  公示后审核
+     */
+    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", $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"];
+                    $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 = CommonConst::getTypeName($this->user["type"]) . $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 = CommonConst::getTypeName($this->user["type"]) . $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["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]]];
+        $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.allowanceType,ta.months,ta.money,ta.moneyDesc,ta.checkState,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"], AllowanceTypeEnum::getTypeName($item["allowanceType"]), $item["months"], $item["money"],
+                    $item["moneyDesc"], $this->getCheckStateName($item["checkState"], $item["publicState"], $item["allowanceType"])];
+            }
+            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);
+    }
+
+    /**
+     * 校验是否在审核范围内
+     */
+    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;
+        }
+        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, "修改成功");
+    }
+
+    private function setCondition(&$where, &$query) {
+        if (\StrUtil::isNotEmpAndNull($query["year"])) {
+            $where[] = ["year", "=", $query["year"]];
+        }
+        if (\StrUtil::isNotEmpAndNull($query["name"])) {
+            $where[] = ["name", "like", "%" . $query["name"] . "%"];
+        }
+        if (\StrUtil::isNotEmpAndNull($query["idCard"])) {
+            $where[] = ["idCard", "like", "%" . $query["idCard"] . "%"];
+        }
+        if (\StrUtil::isNotEmpAndNull($query["talentArrange"])) {
+            $where[] = ["talentArrange", "=", $query["talentArrange"]];
+        }
+        if (\StrUtil::isNotEmpAndNull($query["spouseName"])) {
+            $where[] = ["spouseName", "like", "%" . $query["spouseName"] . "%"];
+        }
+        if (\StrUtil::isNotEmpAndNull($query["spouseIdcard"])) {
+            $where[] = ["spouseIdcard", "like", "%" . $query["spouseIdcard"] . "%"];
+        }
+        if (\StrUtil::isNotEmpAndNull($query["childName"])) {
+            $where[] = ["childName", "like", "%" . $query["childName"] . "%"];
+        }
+        if (\StrUtil::isNotEmpAndNull($query["childIdCard"])) {
+            $where[] = ["childIdCard", "like", "%" . $query["childIdCard"] . "%"];
+        }
+        if (\StrUtil::isNotEmpAndNull($query["marryStatus"])) {
+            $where[] = ["marryStatus", "=", $query["marryStatus"]];
+        }
+        if ($query["isConflict"]) {
+            $where[] = ["isConflict", "=", $query["isConflict"]];
+        }
+        if ($query["isRecover"]) {
+            $where[] = ["isRecover", "=", $query["isRecover"]];
+        }
+        if ($query["checkState"]) {
+            switch ($query["checkState"]) {
+                case -1:
+                    $where[] = ["checkState", "=", HouseStateEnum::NOTPASS];
+                    break;
+                case 1:
+                    $where[] = ["checkState", "=", HouseStateEnum::SAVE];
+                    break;
+                case 2:
+                    switch ($query["process"]) {
+                        case 1:
+                            $where[] = ["checkState", "=", HouseStateEnum::NEED_CHECK];
+                            $where[] = ["highProcess", "<", $query["process"]];
+                            break;
+                        case 2:
+                            $query["state"] = 1;
+                            break;
+                        case 3:
+                            $where[] = ["checkState", "=", HouseStateEnum::NEED_REVIEW_CHECK];
+                            $where[] = ["highProcess", "<", $query["process"]];
+                            break;
+                    }
+                    break;
+                case 3:
+                    switch ($query["process"]) {
+                        case 1:
+                            $where[] = ["checkState", "=", HouseStateEnum::FIRST_REJECT];
+                            break;
+                        case 2:
+                            $query["state"] = 2;
+                            break;
+                        case 3:
+                            $where[] = ["checkState", "<=", HouseStateEnum::REJECT_TO_DEP];
+                            break;
+                    }
+                    break;
+                case 4:
+                    switch ($query["process"]) {
+                        case 1:
+                            $where[] = ["checkState", "in", [HouseStateEnum::NEED_DEP_CHECK, HouseStateEnum::REJECT_TO_DEP, HouseStateEnum::NEED_REVIEW_CHECK, HouseStateEnum::REVIEW_PASS]];
+                            break;
+                        case 2:
+                            $query["state"] = 3;
+                            break;
+                        case 3:
+                        case 4:
+                            $where[] = ["checkState", "=", HouseStateEnum::REVIEW_PASS];
+                            break;
+                    }
+                    break;
+                case 5:
+                    switch ($query["process"]) {
+                        case 1:
+                            $where[] = ["checkState", "in", [HouseStateEnum::REJECT_TO_FIRST, HouseStateEnum::DEP_REJECT]];
+                            break;
+                        case 2:
+                            $query["state"] = 4;
+                            break;
+                        case 3:
+                            $where[] = ["checkState", "=", HouseStateEnum::REJECT_TO_REVIEW];
+                            break;
+                    }
+                    break;
+                case 6:
+                    switch ($query["process"]) {
+                        case 1:
+                            $where[] = ["checkState", "=", HouseStateEnum::NEED_CHECK];
+                            $where[] = ["highProcess", ">=", $query["process"]];
+                            break;
+                        case 2:
+                            $query["state"] = 9;
+                            break;
+                        case 3:
+                            $where[] = ["checkState", "=", HouseStateEnum::NEED_REVIEW_CHECK];
+                            $where[] = ["highProcess", ">=", $query["process"]];
+                            break;
+                    }
+                    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, $process) {
+        //获取字典表
+        $marryMap = DictApi::selectByParentCode("marry_status");
+        $cardTypeMap = DictApi::selectByParentCode("card_type");
+        $streetMap = DictApi::selectByParentCode("street");
+        $levelMap = DictApi::selectByParentCode("talent_arrange");
+        $talentTypeMap = DictApi::selectByParentCode("enterprise_tag");
+        $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
+        $where = [];
+        $where[] = ["type", "=", $this->user["type"]];
+        $conditionMap = \app\common\model\TalentCondition::where($where)->column("name", "id");
+        $where = [];
+        $where[] = ["pId", "in", array_column($list, "id")];
+        $childrens = \app\common\model\HousePurchaseChildren::where($where)->select()->toArray();
+        $childMap = [];
+        foreach ($childrens as $child) {
+            $childMap[$child["pId"]][] = $child;
+        }
+        foreach ($list as &$info) {
+            $info["marryStatusName"] = $marryMap[$info["marryStatus"]];
+            $info["cardTypeName"] = $cardTypeMap[$info["cardType"]];
+            $info["spouseCardTypeName"] = $cardTypeMap[$info["spouseCardType"]];
+            $info["childCardTypeName"] = $cardTypeMap[$info["childCardType"]];
+            $info["streetName"] = $streetMap[$info["street"]];
+            $info["talentArrangeName"] = $levelMap[$info["talentArrange"]];
+            $info["identifyConditionCH"] = $conditionMap[$info["identifyCondition"]];
+            $info["talentTypeName"] = $talentTypeMap[$info["talentType"]];
+            $info["declareTypeName"] = $info["declareType"] == 1 ? "购房补贴" : "免租入住";
+            $info["enterpriseName"] = $enterpriseMap[$info["enterpriseId"]];
+            $info["isEnjoyOtherName"] = $info["isEnjoyOther"] == 1 ? "是" : "否";
+            $info["spouseIsLibraryName"] = $info["spouseIsLibrary"] == 1 ? "是" : "否";
+            $childs = $childMap[$info["id"]];
+            $childStr = "";
+            if ($childs) {
+                for ($i = 0; $i < count($childs); $i++) {
+                    $childStr .= $childs[$i]["name"] . "-" . $childs[$i]["idCard"] . ";";
+                }
+            }
+            $info["childs"] = $childStr;
+            switch ($process) {
+                case 1:
+                    if ($info["checkState"] == HouseStateEnum::NOTPASS) {
+                        $info["checkStateName"] = "审核不通过";
+                    }
+                    if ($info["checkState"] == HouseStateEnum::SAVE) {
+                        $info["checkStateName"] = "待提交";
+                    }
+                    if ($info["checkState"] == HouseStateEnum::NEED_CHECK) {
+                        $info["checkStateName"] = $info["highProcess"] != null && $info["highProcess"] >= $process ? "重新提交" : "待审核";
+                    }
+                    if ($info["checkState"] == HouseStateEnum::FIRST_REJECT) {
+                        $info["checkStateName"] = "已驳回";
+                    }
+                    if ($info["checkState"] == HouseStateEnum::REJECT_TO_FIRST || $info["checkState"] == HouseStateEnum::DEP_REJECT) {
+                        $info["checkStateName"] = "上级驳回";
+                    }
+                    if ($info["checkState"] == HouseStateEnum::NEED_DEP_CHECK || $info["checkState"] >= HouseStateEnum::REJECT_TO_DEP) {
+                        $info["checkStateName"] = "已通过";
+                    }
+                    break;
+                case 2:
+                    if ($info["state"] == 1) {
+                        $info["checkStateName"] = "待审核";
+                    }
+                    if ($info["state"] == 2) {
+                        $info["checkStateName"] = "已驳回";
+                    }
+                    if ($info["state"] == 3) {
+                        $info["checkStateName"] = "已通过";
+                    }
+                    if ($info["state"] == 4) {
+                        $info["checkStateName"] = "上级驳回";
+                    }
+                    if ($info["state"] == 9) {
+                        $info["checkStateName"] = "重新提交";
+                    }
+                    break;
+                case 3:
+                    if ($info["checkState"] <= HouseStateEnum::REJECT_TO_DEP) {
+                        $info["checkStateName"] = "已驳回";
+                    } else if ($info["checkState"] == HouseStateEnum::NEED_REVIEW_CHECK) {
+                        $info["checkStateName"] = $info["highProcess"] != null && $info["highProcess"] >= $process ? "重新提交" : "待审核";
+                    } else if ($info["checkState"] == HouseStateEnum::REVIEW_PASS) {
+                        $info["checkStateName"] = "已通过";
+                    }
+                    break;
+                case 4:
+                    if ($info["checkState"] == HouseStateEnum::NOTPASS) {
+                        $info["checkStateName"] = "审核不通过";
+                    } else if ($info["checkState"] == HouseStateEnum::REVIEW_PASS) {
+                        $info["checkStateName"] = "已通过";
+                    }
+                    break;
+            }
+        }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 "未知状态";
+        }
+    }
+
+}

+ 0 - 0
app/admin/view/housepurchase/index.html → app/admin/view/house/index.html


+ 0 - 0
app/admin/view/housepurchase/info.html → app/admin/view/house/info.html


+ 0 - 0
app/admin/view/housepurchase/select.html → app/admin/view/house/select.html


+ 2 - 0
app/common/controller/Api.php

@@ -99,6 +99,7 @@ class Api extends BaseController {
             case 2:
             case 2:
             case 3:
             case 3:
             case 4:
             case 4:
+            case 5:
             case 6:
             case 6:
             case 7:
             case 7:
             case 8:
             case 8:
@@ -131,6 +132,7 @@ class Api extends BaseController {
                 case 2:
                 case 2:
                 case 3:
                 case 3:
                 case 4:
                 case 4:
+                case 5:
                 case 6:
                 case 6:
                 case 7:
                 case 7:
                 case 8:
                 case 8:

+ 59 - 0
app/common/state/HouseStateEnum.php

@@ -0,0 +1,59 @@
+<?php
+
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+namespace app\common\state;
+
+/**
+ * Description of HouseStateEnum
+ *
+ * @author sgq
+ */
+class HouseStateEnum {
+
+    const NOTPASS = -1;
+    const SAVE = 1;
+    const NEED_CHECK = 5;
+    const FIRST_REJECT = 10;
+    const REJECT_TO_FIRST = 15;
+    const NEED_DEP_CHECK = 20;
+    const DEP_REJECT = 25;
+    const REJECT_TO_DEP = 30;
+    const NEED_REVIEW_CHECK = 35;
+    const REJECT_TO_REVIEW = 38;
+    const REVIEW_PASS = 40;
+
+    static function getStateName($code) {
+        switch ($code) {
+            case self::NOTPASS:
+                return "审核不通过";
+            case self::SAVE:
+                return "待提交";
+            case self::NEED_CHECK:
+                return "待审核";
+            case self::FIRST_REJECT:
+                return "初审驳回";
+            case self::REJECT_TO_FIRST:
+                return "驳回(至初审)";
+            case self::NEED_DEP_CHECK:
+                return "待部门审核";
+            case self::DEP_REJECT:
+                return "部门驳回";
+            case self::REJECT_TO_DEP:
+                return "驳回(至部门)";
+            case self::NEED_REVIEW_CHECK:
+                return "待复核";
+            case self::REJECT_TO_REVIEW:
+                return "驳回(至复核)";
+            case self::REVIEW_PASS:
+                return "复核通过";
+            default:
+                return "";
+        }
+    }
+
+}

+ 16 - 14
app/enterprise/controller/House.php

@@ -15,6 +15,7 @@ use app\common\model\TalentLog;
 use app\common\api\DictApi;
 use app\common\api\DictApi;
 use app\common\state\CommonConst;
 use app\common\state\CommonConst;
 use app\common\state\MainState;
 use app\common\state\MainState;
+use app\common\state\HouseStateEnum;
 use app\common\api\Response;
 use app\common\api\Response;
 use app\common\model\HousePurchase as houseModel;
 use app\common\model\HousePurchase as houseModel;
 
 
@@ -133,6 +134,9 @@ class House extends EnterpriseController {
     public function submitToCheck() {
     public function submitToCheck() {
         try {
         try {
             $id = $this->request["id"];
             $id = $this->request["id"];
+            if (\StrUtil::isEmpOrNull($id)) {
+                throw new ValidateException("系统错误,提交审核失败");
+            }
             $info = HouseApi::getInfoById($id);
             $info = HouseApi::getInfoById($id);
             if (!$info) {
             if (!$info) {
                 throw new ValidateException("提交审核失败,请先填写基础信息");
                 throw new ValidateException("提交审核失败,请先填写基础信息");
@@ -175,7 +179,6 @@ class House extends EnterpriseController {
                 throw new ValidateException($msg);
                 throw new ValidateException($msg);
             }
             }
             $data["id"] = $id;
             $data["id"] = $id;
-            $data["checkState"] = LaState::LA_NEED_FIRST_CHECK;
             if (!$info["firstSubmitTime"]) {
             if (!$info["firstSubmitTime"]) {
                 $data["firstSubmitTime"] = date("Y-m-d H:i:s");
                 $data["firstSubmitTime"] = date("Y-m-d H:i:s");
             }
             }
@@ -183,7 +186,10 @@ class House extends EnterpriseController {
             $data["checkMsg"] = "";
             $data["checkMsg"] = "";
             $data["files"] = "";
             $data["files"] = "";
             $data["fields"] = "";
             $data["fields"] = "";
-            $res = LaModel::update($data);
+            $data["toDep"] = "";
+            $data["toProcess"] = null;
+            $data["checkState"] = HouseStateEnum::NEED_CHECK;
+            $res = houseModel::update($data);
 
 
             if ($res) {
             if ($res) {
                 $user = session("user");
                 $user = session("user");
@@ -191,23 +197,19 @@ class House extends EnterpriseController {
                 $log["active"] = 1;
                 $log["active"] = 1;
                 $log["state"] = 1;
                 $log["state"] = 1;
                 $log["step"] = 0;
                 $log["step"] = 0;
-                $log["stateChange"] = LaState::getStateDesc($info["checkState"]) . "->" . LaState::getStateDesc($data["checkState"]);
-                $log["type"] = ProjectState::LIVINGALLOWANCE;
+                $log["stateChange"] = HouseStateEnum::getStateName($info["checkState"]) . "->" . HouseStateEnum::getStateName($data["checkState"]);
+                $log["type"] = ProjectState::HOUSE;
                 $log["mainId"] = $id;
                 $log["mainId"] = $id;
                 $log["description"] = "确认提交审核";
                 $log["description"] = "确认提交审核";
-                $log["createUser"] = $user ? sprintf("%s(%s)", $user["account"], $user["companyName"] ?: $user["rolename"]) : "系统";
+                $log["createUser"] = "申报用户";
                 $log["createTime"] = date("Y-m-d H:i:s");
                 $log["createTime"] = date("Y-m-d H:i:s");
                 TalentLog::create($log);
                 TalentLog::create($log);
-                return json(["code" => 200, "msg" => "提交审核成功"]);
+                return json(new Response(Response::SUCCESS, "提交审核成功"));
             }
             }
             throw new ValidateException("提交审核失败");
             throw new ValidateException("提交审核失败");
         } catch (ValidateException $e) {
         } catch (ValidateException $e) {
-            $responseObj = new \stdClass();
-            $responseObj->code = 500;
-            $responseObj->msg = $e->getMessage();
-            return json($responseObj);
+            return json(new Response(Response::ERROR, $e->getMessage()));
         } catch (\think\Exception $e) {
         } catch (\think\Exception $e) {
-            $res = ["code" => 500, "msg" => "发生预料外错误,请联系管理员处理,错误代码:" . $e->getCode()];
             $logInfo = [
             $logInfo = [
                 "enterprise_id" => $this->user["uid"],
                 "enterprise_id" => $this->user["uid"],
                 "data" => $data,
                 "data" => $data,
@@ -217,7 +219,7 @@ class House extends EnterpriseController {
                 "errMsg" => $e->getMessage()
                 "errMsg" => $e->getMessage()
             ];
             ];
             Log::write($logInfo, "error");
             Log::write($logInfo, "error");
-            return json($res);
+            return json(new Response(Response::ERROR, "发生预料外错误,请联系管理员处理,错误代码:" . $e->getCode()));
         }
         }
     }
     }
 
 
@@ -255,7 +257,7 @@ class House extends EnterpriseController {
                 $data["updateTime"] = date("Y-m-d H:i:s");
                 $data["updateTime"] = date("Y-m-d H:i:s");
             } else {
             } else {
                 $data["id"] = getStringId();
                 $data["id"] = getStringId();
-                $data["checkState"] = MainState::SAVE;
+                $data["checkState"] = HouseStateEnum::SAVE;
                 $data["createUser"] = $this->user["uid"];
                 $data["createUser"] = $this->user["uid"];
                 $data["createTime"] = date("Y-m-d H:i:s");
                 $data["createTime"] = date("Y-m-d H:i:s");
                 $data["enterpriseId"] = $this->user["uid"];
                 $data["enterpriseId"] = $this->user["uid"];
@@ -422,7 +424,7 @@ class House extends EnterpriseController {
     }
     }
 
 
     private function validateIsEdit($checkState) {
     private function validateIsEdit($checkState) {
-        if ($checkState != MainState::SAVE && $checkState != MainState::FIRST_REJECT) {
+        if ($checkState != HouseStateEnum::SAVE && $checkState != HouseStateEnum::FIRST_REJECT) {
             return new Response(Response::ERROR, "正在审核中,无法修改");
             return new Response(Response::ERROR, "正在审核中,无法修改");
         }
         }
         return new Response(Response::SUCCESS, "");
         return new Response(Response::SUCCESS, "");

+ 61 - 57
public/static/modular/gate/house/housepurchase_select.js

@@ -3,7 +3,7 @@
  * 初始化购房补贴详情对话框
  * 初始化购房补贴详情对话框
  */
  */
 var HousepurchaseInfoDlg = {
 var HousepurchaseInfoDlg = {
-    housepurchaseInfoData : {},
+    housepurchaseInfoData: {},
     validateFields: {
     validateFields: {
         enterpriseId: {validators: {notEmpty: {message: '所属企业不能为空'}}},
         enterpriseId: {validators: {notEmpty: {message: '所属企业不能为空'}}},
         name: {validators: {notEmpty: {message: '姓名不能为空'}}},
         name: {validators: {notEmpty: {message: '姓名不能为空'}}},
@@ -89,7 +89,7 @@ var HousepurchaseInfoDlg = {
 /**
 /**
  * 清除数据
  * 清除数据
  */
  */
-HousepurchaseInfoDlg.clearData = function() {
+HousepurchaseInfoDlg.clearData = function () {
     this.housepurchaseInfoData = {};
     this.housepurchaseInfoData = {};
 }
 }
 
 
@@ -98,7 +98,7 @@ HousepurchaseInfoDlg.clearData = function() {
  * @param key 数据的名称
  * @param key 数据的名称
  * @param val 数据的具体值
  * @param val 数据的具体值
  */
  */
-HousepurchaseInfoDlg.set = function(key, val) {
+HousepurchaseInfoDlg.set = function (key, val) {
     this.housepurchaseInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
     this.housepurchaseInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
     return this;
     return this;
 }
 }
@@ -108,14 +108,14 @@ HousepurchaseInfoDlg.set = function(key, val) {
  * @param key 数据的名称
  * @param key 数据的名称
  * @param val 数据的具体值
  * @param val 数据的具体值
  */
  */
-HousepurchaseInfoDlg.get = function(key) {
+HousepurchaseInfoDlg.get = function (key) {
     return $("#" + key).val();
     return $("#" + key).val();
 }
 }
 
 
 /**
 /**
  * 关闭此对话框
  * 关闭此对话框
  */
  */
-HousepurchaseInfoDlg.close = function() {
+HousepurchaseInfoDlg.close = function () {
     parent.layer.close(window.parent.Housepurchase.layerIndex);
     parent.layer.close(window.parent.Housepurchase.layerIndex);
 }
 }
 
 
@@ -124,32 +124,32 @@ HousepurchaseInfoDlg.close = function() {
  * 初始化子女信息
  * 初始化子女信息
  * @param list
  * @param list
  */
  */
-HousepurchaseInfoDlg.initChildData = function(list){
+HousepurchaseInfoDlg.initChildData = function (list) {
     var options = $("#cardType").html();
     var options = $("#cardType").html();
     var html = "";
     var html = "";
-    for(var key in list) {
+    for (var key in list) {
         html = html +
         html = html +
-            '<div class="col-sm-12">\n' +
-            '<input type="hidden"  name="id" value="'+list[key].id+'"/>\n' +
-            '<input type="hidden" name="pId" value="'+list[key].pId+'"/>' +
-            '<div class="rowGroup col-sm-3">\n' +
-            '<input type="text" class="form-control" name="childName" value="'+list[key].name+'" placeholder="未成年子女姓名"/>\n' +
-            '</div>\n' +
-            '<div class="rowGroup col-sm-3">\n' +
-            '<select class="form-control" name="childCardType" value="'+list[key].cardType+'" placeholder="未成年子女证件类型">\n' +
-            options +
-            '</select>\n' +
-            '</div>\n' +
-            '<div class="rowGroup col-sm-3">\n' +
-            '<input type="text" class="form-control" name="childIdCard" value="'+list[key].idCard+'" placeholder="未成年子女证件号码"/>\n' +
-            '</div>\n' +
-            '</div>';
+                '<div class="col-sm-12">\n' +
+                '<input type="hidden"  name="id" value="' + list[key].id + '"/>\n' +
+                '<input type="hidden" name="pId" value="' + list[key].pId + '"/>' +
+                '<div class="rowGroup col-sm-3">\n' +
+                '<input type="text" class="form-control" name="childName" value="' + list[key].name + '" placeholder="未成年子女姓名"/>\n' +
+                '</div>\n' +
+                '<div class="rowGroup col-sm-3">\n' +
+                '<select class="form-control" name="childCardType" value="' + list[key].cardType + '" placeholder="未成年子女证件类型">\n' +
+                options +
+                '</select>\n' +
+                '</div>\n' +
+                '<div class="rowGroup col-sm-3">\n' +
+                '<input type="text" class="form-control" name="childIdCard" value="' + list[key].idCard + '" placeholder="未成年子女证件号码"/>\n' +
+                '</div>\n' +
+                '</div>';
     }
     }
     $("#childData").empty().append(html);
     $("#childData").empty().append(html);
     $("#childData select").each(function () {
     $("#childData select").each(function () {
         $(this).val($(this).attr("value"))
         $(this).val($(this).attr("value"))
     })
     })
-    if(list == null){
+    if (list == null) {
         HousepurchaseInfoDlg.addChild();
         HousepurchaseInfoDlg.addChild();
     }
     }
 }
 }
@@ -159,7 +159,7 @@ HousepurchaseInfoDlg.initChildData = function(list){
 /**
 /**
  * 申报对象级联
  * 申报对象级联
  */
  */
-HousepurchaseInfoDlg.declareObjChange = function(){
+HousepurchaseInfoDlg.declareObjChange = function () {
     var declareObj = $("#declareObject").val();
     var declareObj = $("#declareObject").val();
     switch (declareObj) {
     switch (declareObj) {
         case "":
         case "":
@@ -178,25 +178,25 @@ HousepurchaseInfoDlg.declareObjChange = function(){
 /**
 /**
  * 根据申报类型
  * 根据申报类型
  */
  */
-HousepurchaseInfoDlg.typeChange = function(){
+HousepurchaseInfoDlg.typeChange = function () {
     var type = $("#declareType").val();
     var type = $("#declareType").val();
-    if(type == null){
-        $("#realEstateNo,#recordNo,#houseAddress,#houseArea,#recordTime,#houseMoney,#number,#isEnjoyOther").val("").parent().css("display","none");
+    if (type == null) {
+        $("#realEstateNo,#recordNo,#houseAddress,#houseArea,#recordTime,#houseMoney,#number,#isEnjoyOther").val("").parent().css("display", "none");
     }
     }
-    if(type == 1){
-        $("#realEstateNo,#recordNo,#houseAddress,#houseArea,#recordTime,#houseMoney,#number,#isEnjoyOther").parent().css("display","block");
+    if (type == 1) {
+        $("#realEstateNo,#recordNo,#houseAddress,#houseArea,#recordTime,#houseMoney,#number,#isEnjoyOther").parent().css("display", "block");
     }
     }
-    if(type == 2){
-        $("#realEstateNo,#recordNo,#houseAddress,#houseArea,#recordTime,#houseMoney,#number,#isEnjoyOther").val("").parent().css("display","none");
+    if (type == 2) {
+        $("#realEstateNo,#recordNo,#houseAddress,#houseArea,#recordTime,#houseMoney,#number,#isEnjoyOther").val("").parent().css("display", "none");
     }
     }
 }
 }
 
 
 /**
 /**
  * 获取认定条件
  * 获取认定条件
  */
  */
-HousepurchaseInfoDlg.getIdentifyCondition = function(){
+HousepurchaseInfoDlg.getIdentifyCondition = function () {
     var level = $("#talentArrange").val();
     var level = $("#talentArrange").val();
-    if(level==null||level==''){
+    if (level == null || level == '') {
         $("#identifyCondition").empty();
         $("#identifyCondition").empty();
         return;
         return;
     }
     }
@@ -205,7 +205,7 @@ HousepurchaseInfoDlg.getIdentifyCondition = function(){
         "displayCode": "id",
         "displayCode": "id",
         "displayName": "name",
         "displayName": "name",
         "type": "GET",
         "type": "GET",
-        "url": Feng.ctxPath + "/common/api/findIdentifyConditionByLevel?level="+level
+        "url": Feng.ctxPath + "/common/api/findIdentifyConditionByLevel?level=" + level
     });
     });
 }
 }
 
 
@@ -216,38 +216,42 @@ HousepurchaseInfoDlg.getIdentifyCondition = function(){
  * @param row
  * @param row
  * @returns {string}
  * @returns {string}
  */
  */
-function validUploadButton(type,row,fileId){
+function validUploadButton(type, row, fileId) {
     var files = $("#files").val();
     var files = $("#files").val();
     var checkState = $("#checkState").val();
     var checkState = $("#checkState").val();
-    if(Feng.isEmptyStr(checkState)||checkState==1 || (checkState == 10 && files.indexOf(row.id)!=-1)){
-        return type == 1?
-            "<button type='button' onclick=\"checkFile(this,'"+row.id+"','"+null+"')\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
-            "<i class=\"fa fa-upload\"></i>上传" +
-            "</button>"
-            :
-            "<button type=\'button\' onclick=\"checkFile(this,'"+row.id+"','"+fileId+"')\" style=\'margin-right: 10px\' class=\"btn btn-xs btn-info\">" +
-            "<i class=\"fa fa-paste\"></i>修改" +
-            "</button>" +
-            "<button type='button' onclick=\"deleteFile('"+fileId+"','"+CONFIG.project_house+"')\" class=\"btn btn-xs btn-danger\">" +
-            "<i class=\"fa fa-times\"></i>删除" +
-            "</button>";
-    }else{
-        return type == 1?"":"" ;
+    if (Feng.isEmptyStr(checkState) || checkState == 1 || (checkState == 10 && files.indexOf(row.id) != -1)) {
+        return type == 1 ?
+                "<button type='button' onclick=\"checkFile(this,'" + row.id + "','" + null + "')\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
+                "<i class=\"fa fa-upload\"></i>上传" +
+                "</button>"
+                :
+                "<button type=\'button\' onclick=\"checkFile(this,'" + row.id + "','" + fileId + "')\" style=\'margin-right: 10px\' class=\"btn btn-xs btn-info\">" +
+                "<i class=\"fa fa-paste\"></i>修改" +
+                "</button>" +
+                "<button type='button' onclick=\"deleteFile('" + fileId + "','" + CONFIG.project_house + "')\" class=\"btn btn-xs btn-danger\">" +
+                "<i class=\"fa fa-times\"></i>删除" +
+                "</button>";
+    } else {
+        return type == 1 ? "" : "";
     }
     }
 }
 }
 
 
 
 
-$(function() {
+$(function () {
     //批量加载字典表数据
     //批量加载字典表数据
     var arr = [
     var arr = [
-        {"name":"cardType","code":"card_type"},
-        {"name":"spouseCardType","code":"card_type"},
-        {"name":"childCardType","code":"card_type"},
-        {"name":"marryStatus","code":"marry_status"},
-        {"name":"talentArrange","code":"talent_arrange"},
-        {"name":"street","code":"street"}];
+        {"name": "cardType", "code": "card_type"},
+        {"name": "spouseCardType", "code": "card_type"},
+        {"name": "childCardType", "code": "card_type"},
+        {"name": "marryStatus", "code": "marry_status"},
+        {"name": "talentArrange", "code": "talent_arrange"},
+        {"name": "street", "code": "street"}];
     Feng.findChildDictBatch(JSON.stringify(arr));
     Feng.findChildDictBatch(JSON.stringify(arr));
     $(".other_talentArrange").empty().append($("#talentArrange").html());
     $(".other_talentArrange").empty().append($("#talentArrange").html());
     loadProvince();
     loadProvince();
-    $("select").each(function () {$(this).val($(this).attr("value")).trigger("change");});
+    $("select").each(function () {
+        $(this).val($(this).attr("value")).trigger("change");
+    });
+    var id = $("#id").val();
+    Feng.getCheckLog("logTable", {"type": CONFIG.project_house, "mainId": id, "typeFileId": "", "active": 1})
 });
 });