瀏覽代碼

购房补贴++

sugangqiang 10 月之前
父節點
當前提交
2f30457417

+ 80 - 35
app/admin/controller/House.php

@@ -229,8 +229,8 @@ class House extends AdminController {
             "checkIsTradeRecord" => \StrUtil::getRequestDecodeParam($this->request, "checkIsTradeRecord"),
             "checkRecordTime" => \StrUtil::getRequestDecodeParam($this->request, "checkRecordTime"),
             "zjjCheckDetail" => \StrUtil::getRequestDecodeParam($this->request, "zjjCheckDetail"),
-            "otherList" => \StrUtil::getRequestDecodeParam($this->request, "otherList"),
-            "houseList" => \StrUtil::getRequestDecodeParam($this->request, "houseList")
+            "otherList" => $this->request["otherList"],
+            "houseList" => $this->request["houseList"]
         ];
         if (!$obj) {
             return new Response(Response::ERROR, "请填写信息后保存");
@@ -301,7 +301,7 @@ class House extends AdminController {
             'state' => 3,
             'step' => 2,
             'stateChange' => "保存未提交",
-            'description' => "录入核查数据",
+            'description' => $obj["zjjCheckDetail"] ? "录入核查数据:" . $obj["zjjCheckDetail"] : "录入核查数据:",
             'createTime' => date("Y-m-d H:i:s", time()),
             'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
         ]);
@@ -322,7 +322,7 @@ class House extends AdminController {
             "transferMethod" => \StrUtil::getRequestDecodeParam($this->request, "transferMethod"),
             "transferTime" => \StrUtil::getRequestDecodeParam($this->request, "transferTime"),
             "zrzzjCheckDetail" => \StrUtil::getRequestDecodeParam($this->request, "zrzzjCheckDetail"),
-            "houseList" => \StrUtil::getRequestDecodeParam($this->request, "houseList")
+            "houseList" => $this->request["houseList"]
         ];
         if (!$obj) {
             return new Response(Response::ERROR, "请填写信息后保存");
@@ -390,7 +390,7 @@ class House extends AdminController {
             'state' => 3,
             'step' => 2,
             'stateChange' => "保存未提交",
-            'description' => "录入核查数据",
+            'description' => $obj["zrzzjCheckDetail"] ? "录入核查数据:" . $obj["zrzzjCheckDetail"] : "录入核查数据",
             'createTime' => date("Y-m-d H:i:s", time()),
             'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
         ]);
@@ -406,7 +406,7 @@ class House extends AdminController {
             "id" => \StrUtil::getRequestDecodeParam($this->request, "id"),
             "companyId" => \StrUtil::getRequestDecodeParam($this->request, "companyId"),
             "mzjCheckDetail" => \StrUtil::getRequestDecodeParam($this->request, "mzjCheckDetail"),
-            "spouseList" => \StrUtil::getRequestDecodeParam($this->request, "spouseList")
+            "spouseList" => $this->request["spouseList"]
         ];
 
         if (!$obj) {
@@ -445,7 +445,7 @@ class House extends AdminController {
             'state' => 3,
             'step' => 2,
             'stateChange' => "保存未提交",
-            'description' => "录入核查数据",
+            'description' => $obj["mzjCheckDetail"] ? "录入核查数据:" . $obj["mzjCheckDetail"] : "录入核查数据:",
             'createTime' => date("Y-m-d H:i:s", time()),
             'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
         ]);
@@ -494,6 +494,35 @@ class House extends AdminController {
         return new Response(Response::SUCCESS, "审核成功");
     }
 
+    /**
+     * @param id
+     * @param type
+     * @description 删除享受其他政策记录/历年享受记录
+     * */
+    public function deleteOtherOrHouse($id, $type) {
+        if (\StrUtil::isEmpOrNull($id)) {
+            return new Response(Response::ERROR, "系统错误");
+        }
+        if ($type == 1) {      //享受其他政策
+            \app\common\model\HousePurchaseEnjoyOther::where("id", $id)->delete();
+        } else if (type == 2) {    //其他房产信息
+            \app\common\model\HousePurchaseOtherHouse::where("id", $id)->delete();
+        }
+        return new Response(Response::SUCCESS, "删除成功");
+    }
+
+    /**
+     * @param id
+     * @description 删除配偶信息
+     * */
+    public function deleteSpouse($id) {
+        if (\StrUtil::isEmpOrNull($id)) {
+            return new Response(Response::ERROR, "系统错误");
+        }
+        \app\common\model\HousePurchaseSpouse::where("id", $id)->delete();
+        return new Response(Response::SUCCESS, "删除成功");
+    }
+
     /**
      * 提交审核
      * @return Response
@@ -1038,6 +1067,8 @@ class House extends AdminController {
             "id" => \StrUtil::getRequestDecodeParam($this->request, "id"),
             "checkIsTradeRecord" => \StrUtil::getRequestDecodeParam($this->request, "checkIsTradeRecord"),
             "checkRecordTime" => \StrUtil::getRequestDecodeParam($this->request, "checkRecordTime"),
+            "mzjCheckDetail" => \StrUtil::getRequestDecodeParam($this->request, "mzjCheckDetail"),
+            "mzjSpouseList" => $this->request["mzjSpouseList"],
             "zjjCheckDetail" => \StrUtil::getRequestDecodeParam($this->request, "zjjCheckDetail"),
             "isHasBdcCard" => \StrUtil::getRequestDecodeParam($this->request, "isHasBdcCard"),
             "bdcRegistTime" => \StrUtil::getRequestDecodeParam($this->request, "bdcRegistTime"),
@@ -1045,9 +1076,9 @@ class House extends AdminController {
             "transferMethod" => \StrUtil::getRequestDecodeParam($this->request, "transferMethod"),
             "transferTime" => \StrUtil::getRequestDecodeParam($this->request, "transferTime"),
             "zrzzjCheckDetail" => \StrUtil::getRequestDecodeParam($this->request, "zrzzjCheckDetail"),
-            "zjjHouseList" => \StrUtil::getRequestDecodeParam($this->request, "zjjHouseList"),
-            "zrzyjHouseList" => \StrUtil::getRequestDecodeParam($this->request, "zrzyjHouseList"),
-            "otherList" => \StrUtil::getRequestDecodeParam($this->request, "otherList")
+            "zjjHouseList" => $this->request["zjjHouseList"],
+            "zrzyjHouseList" => $this->request["zrzyjHouseList"],
+            "otherList" => $this->request["otherList"]
         ];
         if (!$obj) {
             return new Response(Response::ERROR, "系统错误,请联系管理员");
@@ -1081,6 +1112,21 @@ class House extends AdminController {
             $obj["checkIsTradeRecord"] = null;
             $obj["checkRecordTime"] = "";
         }
+        if ($obj["mzjSpouseList"] && count($obj["mzjSpouseList"]) > 0) {
+            foreach ($obj["mzjSpouseList"] as $spouse) {
+                if ($spouse["id"]) {
+                    $spouse["updateTime"] = date("Y-m-d H:i:s");
+                    $spouse["updateUser"] = $this->user["name"];
+                    \app\common\model\HousePurchaseSpouse::update($spouse);
+                } else {
+                    $spouse["id"] = getStringId();
+                    $spouse["pId"] = $obj["id"];
+                    $spouse["createTime"] = date("Y-m-d H:i:s");
+                    $spouse["createUser"] = $this->user["name"];
+                    \app\common\model\HousePurchaseSpouse::insert($spouse);
+                }
+            }
+        }
         if ($obj["zrzyjHouseList"] && count($obj["zrzyjHouseList"]) > 0) {
             foreach ($obj["zrzyjHouseList"] as $other) {
                 if ($other["id"]) {
@@ -2081,7 +2127,6 @@ class House extends AdminController {
      * @description 计算购房补贴金额
      * */
     private function calculate($old, &$housepurchase = [], &$descideDesc = [], $type = 1) {
-        $count = $old["type"] == 1 ? 5 : 3;            //最大申报数
         /*         * 1、查询申报人和配偶的房产信息 */
         $houseInfo = HouseApi::getHouseInfo($old["idCard"]);
         $spouseHouseInfo = HouseApi::getHouseInfo($old["spouseIdCard"]);
@@ -2101,9 +2146,6 @@ class House extends AdminController {
             ];
         }
         //判断是否超过五次申报
-        if ($houseInfo["count"] >= $count) {
-            return new Response(Response::ERROR, "申报人已享受五次购房补贴,无法再次享受");
-        }
         if ($houseInfo["balanceMoney"] <= 0) {
             return new Response(Response::ERROR, "申报房产可享受余额不足,无法享受");
         }
@@ -2111,28 +2153,31 @@ class House extends AdminController {
         $amountStandard = \app\common\api\AmountStandardApi::getStandard($this->user["type"], 3, $old["talentArrange"]);
         if (!$amountStandard)
             return new Response(Response::ERROR, "系统暂未设置该人才层次的购房补贴享受金额,请设置后再提交");
-        if ($old["type"] == 1) {
-            $housepurchase["talentArrangeMoney"] = round(0.2 * $amountStandard["money"], 2);
-        } else {
-            $code = "housepurchase_percentage_";
-            switch ($old["type"]) {
-                case CommonConst::ENTERPRISE_JC:
-                    $code .= "ic";
-                    break;
-                case CommonConst::ENTERPRISE_WJ:
-                    $code .= "wj";
-                    break;
-                case CommonConst::ENTERPRISE_GJ:
-                    $code .= "gj";
-                    break;
-            }
-            $dic = DictApi::findByParentCodeAndCode($code, $houseInfo["count"] + 1);
-            if (!$dic)
-                return new Response(Response::ERROR, "系统字典中暂未设置购房补贴年度比例,请设置后再提交。字典代码以[集成电路:housepurchase_percentage_ic][卫健:housepurchase_percentage_wj][高教:housepurchase_percentage_gj]为准");
-            if (!is_numeric($dic["name"]) || $dic["name"] > 1 || $dic["name"] < 0)
-                return new Response(Response::ERROR, "系统字典中设置的购房补贴年度比例应该是介于0~1之间的数字");
-            $housepurchase["talentArrangeMoney"] = round($dic["name"] * $amountStandard["money"], 2);
+        $code = "housepurchase_percentage_";
+        switch ($old["type"]) {
+            case CommonConst::ENTERPRISE_NORMAL:
+                $code .= "normal";
+                break;
+            case CommonConst::ENTERPRISE_JC:
+                $code .= "ic";
+                break;
+            case CommonConst::ENTERPRISE_WJ:
+                $code .= "wj";
+                break;
+            case CommonConst::ENTERPRISE_GJ:
+                $code .= "gj";
+                break;
+        }
+        $dic = DictApi::findByParentCodeAndCode($code, $houseInfo["count"] + 1);
+        if (!$dic)
+            return new Response(Response::ERROR, "系统字典中暂未设置购房补贴年度比例,请设置后再提交。");
+        $count = count(DictApi::findChildDictByCode($code));
+        if ($houseInfo["count"] >= $count) {
+            return new Response(Response::ERROR, "申报人已享受五次购房补贴,无法再次享受");
         }
+        if (!is_numeric($dic["name"]) || $dic["name"] > 1 || $dic["name"] < 0)
+            return new Response(Response::ERROR, "系统字典中设置的购房补贴年度比例应该是介于0~1之间的数字");
+        $housepurchase["talentArrangeMoney"] = round($dic["name"] * $amountStandard["money"], 2);
         /*         * 3.计算当年度录入享受其他政策的金额 */
         $otherList = HouseApi::getEnjoyOtherList($old["id"]);
         $housepurchase["nowOtherMoney"] = 0;

+ 5 - 1
app/common/api/HouseApi.php

@@ -175,7 +175,11 @@ class HouseApi {
         $data["delete"] = 1;
         $data["deleteUser"] = session("user")["uid"];
         $data["deleteTime"] = date("Y-m-d H:i:s");
-        return houseModel::update($data);
+        if (houseModel::update($data)) {
+            enjoyOtherModel::where("pId", $id)->delete();
+            return true;
+        }
+        return false;
     }
 
     public static function deleteChildrenById($id) {

+ 7 - 0
app/enterprise/controller/House.php

@@ -389,6 +389,13 @@ class House extends EnterpriseController {
                 return new Response(Response::ERROR, "人才库中未查询到配偶相关信息");
             }
         }
+        if (\StrUtil::isNotEmpAndNull($info["spouseIdcard"])) {
+            //校验配偶是否存在申请记录,夫妻双方同时符合政策条件的,按照“就高不重复”原则,由一方选择一项申请。
+            $spouseHouseInfo = HouseApi::getHouseInfo($info["spouseIdcard"]);
+            if ($spouseHouseInfo && $info["declareType"] == 1 && $spouseHouseInfo["declareType"] == 1 && $spouseHouseInfo["delete"] == 0 && $spouseHouseInfo["checkState"] != HouseStateEnum::NOTPASS) {
+                return new Response(Response::ERROR, "该人才的配偶已经申请购房补贴,夫妻双方仅能由一方申请");
+            }
+        }
         $ti = \app\common\api\VerifyApi::getTalentInfoById($info["talentId"]);
         $info["provinceCode"] = $ti["province"];
         $info["provinceName"] = $ti["provinceName"];

+ 52 - 33
public/static/modular/house/housepurchase/housepurchase_info.js

@@ -863,39 +863,7 @@ HousepurchaseInfoDlg.saveDepCheckData = function () {
         case CONFIG.COM_MZJ:
             var spouseObj = new Array();
             var mzjCheckDetail = $("#mzjCheckDetail").val();
-            $("#mzjMarryData .panel-body").each(function (index) {
-                var id = $(this).find("input[name='id']").val();
-                var pId = $(this).find("input[name='pId']").val();
-                var type = $(this).find("select[name='type']").val();
-                var name = $(this).find("input[name='name']").val();
-                var registerTime = $(this).find("input[name='registerTime']").val();
-                var idCard = $(this).find("input[name='idCard']").val();
-                // var description = $(this).find("input[name='description']").val();
-                if (Feng.isNotEmptyStr(id) || Feng.isNotEmptyStr(pId) || Feng.isNotEmptyStr(type) || Feng.isNotEmptyStr(name) ||
-                        Feng.isNotEmptyStr(registerTime) || Feng.isNotEmptyStr(idCard)) {
-                    if (Feng.isEmptyStr(type)) {
-                        error = error + "婚姻状况" + (index + 1) + "登记类型为空;\n";
-                    }
-                    if (Feng.isEmptyStr(name)) {
-                        error = error + "婚姻状况" + (index + 1) + "配偶姓名为空;\n";
-                    }
-                    if (Feng.isEmptyStr(idCard)) {
-                        error = error + "婚姻状况" + (index + 1) + "配偶证件号码为空;\n";
-                    }
-                    if (Feng.isEmptyStr(registerTime)) {
-                        error = error + "婚姻状况" + (index + 1) + "登记时间为空;\n";
-                    } else if (!/^\d{4}-\d{2}-\d{2}$/.test(registerTime)) {
-                        error = error + "房产信息" + (index + 1) + "登记时间格式不正确;\n";
-                    }
-                    spouseObj.push({
-                        "id": id,
-                        "type": type,
-                        "name": name,
-                        "registerTime": registerTime,
-                        "idCard": idCard
-                    });
-                }
-            });
+            var error = HousepurchaseInfoDlg.getMzjData(spouseObj);
             if (Feng.isNotEmptyStr(error)) {
                 Feng.info(error);
                 return;
@@ -1042,6 +1010,46 @@ HousepurchaseInfoDlg.getZjjData = function (enjoyOtherObject, otherHouseObject)
     return null;
 }
 
+HousepurchaseInfoDlg.getMzjData = function (mzjSpouseList) {
+    var error = "";
+    $("#mzjMarryData .panel-body").each(function (index) {
+        var id = $(this).find("input[name='id']").val();
+        var pId = $(this).find("input[name='pId']").val();
+        var type = $(this).find("select[name='type']").val();
+        var registerTime = $(this).find("input[name='registerTime']").val();
+        var name = $(this).find("input[name='name']").val();
+        var idCard = $(this).find("input[name='idCard']").val();
+        if (Feng.isNotEmptyStr(id) || Feng.isNotEmptyStr(pId) || Feng.isNotEmptyStr(type) || Feng.isNotEmptyStr(name) || Feng.isNotEmptyStr(idCard) ||
+                Feng.isNotEmptyStr(registerTime)) {
+            if (Feng.isEmptyStr(type)) {
+                error = error + "婚姻状况" + (index + 1) + "没有选择登记类型;\n";
+            }
+            if (Feng.isEmptyStr(registerTime)) {
+                error = error + "婚姻状况" + (index + 1) + "登记时间为空;\n";
+            }
+            if (Feng.isEmptyStr(name)) {
+                error = error + "婚姻状况" + (index + 1) + "配偶姓名为空;\n";
+            }
+            if (Feng.isEmptyStr(idCard)) {
+                error = error + "婚姻状况" + (index + 1) + "配偶证件号码为空;\n";
+            } else if (!/^\d{4}-\d{2}-\d{2}$/.test(registerTime)) {
+                error = error + "婚姻状况" + (index + 1) + "登记时间格式不正确;\n";
+            }
+            mzjSpouseList.push({
+                "id": id,
+                "type": type,
+                "registerTime": registerTime,
+                "name": name,
+                "idCard": idCard
+            });
+        }
+    });
+    if (Feng.isNotEmptyStr(error)) {
+        return error;
+    }
+    return null;
+}
+
 HousepurchaseInfoDlg.getZrzyjData = function (otherHouseObject) {
     var error = "";
     $("#zrzyOtherHouse .panel-body").each(function (index) {
@@ -1102,11 +1110,19 @@ HousepurchaseInfoDlg.afterCheckEdit = function () {
     var mainId = $("#id").val();
     var declareType = $("#declareType").val();
     var enjoyOtherObject = new Array();
+    var mzjSpouseList = new Array();
     var zjjOtherHouseObject = new Array();
     var zrzyjOtherHouseObject = new Array();
     var checkIsTradeRecord = $("#zjjData").find("select[name='checkIsTradeRecord']").val();
     var checkRecordTime = $("#zjjData").find("input[name='checkRecordTime']").val();
     var zjjCheckDetail = $("#zjjData").find("input[name='zjjCheckDetail']").val();
+    var mzjCheckDetail = $("#mzjCheckDetail").val();
+
+    var error = HousepurchaseInfoDlg.getMzjData(mzjSpouseList);
+    if (Feng.isNotEmptyStr(error)) {
+        Feng.info(error);
+        return;
+    }
     if (declareType == 1) {
         if (Feng.isEmptyStr(checkIsTradeRecord)) {
             Feng.info("请选择是否交易备案");
@@ -1117,6 +1133,7 @@ HousepurchaseInfoDlg.afterCheckEdit = function () {
             return;
         }
     }
+
     var error = HousepurchaseInfoDlg.getZjjData(enjoyOtherObject, zjjOtherHouseObject);
     if (Feng.isNotEmptyStr(error)) {
         Feng.info(error);
@@ -1168,6 +1185,8 @@ HousepurchaseInfoDlg.afterCheckEdit = function () {
         "zrzzjCheckDetail": zrzzjCheckDetail,
         "zjjHouseList": zjjOtherHouseObject,
         "zrzyjHouseList": zrzyjOtherHouseObject,
+        "mzjCheckDetail": mzjCheckDetail,
+        "mzjSpouseList": mzjSpouseList,
         "otherList": enjoyOtherObject
     };
     var ajax = new $ax(Feng.ctxPath + "/admin/house/afterCheckEdit", function (data) {