浏览代码

津补贴修改计算方法,选了工作津贴就不再推荐交通补贴,选了交通补贴同理。
购房补贴++

sugangqiang 10 月之前
父节点
当前提交
c92cf69b6c

+ 4 - 4
app/admin/controller/TalentAllowance.php

@@ -1180,7 +1180,7 @@ class TalentAllowance extends AdminController {
         /*         * 获取各个项目的综合月份 */
         $monthMap = $this->mergeMonth($detailMonthList);
         $monthAndDayMap = $this->mergeMonthNeedDay($detailMonthList);
-        $info["recommendAllowanceType"] = 1;
+        $info["recommendAllowanceType"] = $old["allowanceType"];
         $info["recommendAllowanceMsg"] = "";
         $projectList = \app\common\model\TalentAllowanceProject::where("mainId", $info["id"])->select()->toArray();
         $set = $this->valideAllowanceType($info, $projectList, $monthMap, $monthAndDayMap);
@@ -1245,7 +1245,7 @@ class TalentAllowance extends AdminController {
         if ($info["recommendAllowanceType"] == 1) {
             if (count($checkSet) < 6) {
                 //如果全部满足6个月,但是重叠时间不满足6个月,开始检测是否符合交通补贴要求
-                $info["recommendAllowanceType"] = 2;
+                $info["recommendAllowanceType"] = 3;
                 $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n上年度{$str}交集月份不满足6个月(" . implode(",", $checkSet) . "),无法享受工作津贴(×)";
             } else {
                 //检查连续缴纳月份是否满足6个月
@@ -1264,7 +1264,7 @@ class TalentAllowance extends AdminController {
                     }
                 }
                 if ($count < 6) {
-                    $info["recommendAllowanceType"] = 2;
+                    $info["recommendAllowanceType"] = 3;
                     $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n上年度{$str}不满足连续缴纳6个月(" . implode(",", $checkSet) . "),无法享受工作津贴(×)";
                 }
             }
@@ -1404,7 +1404,7 @@ class TalentAllowance extends AdminController {
             $preCheckProjects = ["①", "②"];
         }
         if ($info["recommendAllowanceType"] == 1 && (!$set || count($set) < 6) && in_array($sort, $preCheckProjects)) {
-            $info["recommendAllowanceType"] = 2;
+            $info["recommendAllowanceType"] = 3;
             $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . $sort . $name . "不足6个月,无法享受工作津贴(×)";
         }
         return $set;

+ 16 - 0
app/common/api/HouseApi.php

@@ -34,4 +34,20 @@ class HouseApi {
         return houseChildModel::where($where)->select()->toArray();
     }
 
+    public static function getChildrenById($id) {
+        return houseChildModel::where($where)->find($id);
+    }
+
+    public static function deleteById($id) {
+        $data["id"] = $id;
+        $data["delete"] = 1;
+        $data["deleteUser"] = session("user")["uid"];
+        $data["deleteTime"] = date("Y-m-d H:i:s");
+        return houseModel::update($data);
+    }
+
+    public static function deleteChildrenById($id) {
+        return houseChildModel::where("id", $id)->delete();
+    }
+
 }

+ 4 - 4
app/common/api/TalentAllowanceApi.php

@@ -213,7 +213,7 @@ class TalentAllowanceApi {
         }
         $monthMap = self::mergeMonth($detailMonthList);
         $monthAndDayMap = self::mergeMonthNeedDay($detailMonthList);
-        $info["recommendAllowanceType"] = 1;
+        $info["recommendAllowanceType"] = $old["allowanceType"];
         $info["recommendAllowanceMsg"] = [];
         $projectList = \app\common\model\TalentAllowanceProject::where("mainId", $id)->select()->toArray();
         $set = self::valideAllowanceType($info, $projectList, $monthMap, $monthAndDayMap);
@@ -279,7 +279,7 @@ class TalentAllowanceApi {
         if ($info["recommendAllowanceType"] == 1) {
             if (count($checkSet) < 6) {
                 //如果全部满足6个月,但是重叠时间不满足6个月,开始检测是否符合交通补贴要求
-                $info["recommendAllowanceType"] = 2;
+                $info["recommendAllowanceType"] = 3;
                 $info["recommendAllowanceMsg"][] = "上年度{$str}交集月份不满足6个月(" . implode(",", $checkSet) . "),无法享受工作津贴(×)";
             } else {
                 //检查连续缴纳月份是否满足6个月
@@ -298,7 +298,7 @@ class TalentAllowanceApi {
                     }
                 }
                 if ($count < 6) {
-                    $info["recommendAllowanceType"] = 2;
+                    $info["recommendAllowanceType"] = 3;
                     $info["recommendAllowanceMsg"][] = "上年度{$str}交集月份不满足连续缴纳6个月(" . implode(",", $checkSet) . "),无法享受工作津贴(×)";
                 }
             }
@@ -446,7 +446,7 @@ class TalentAllowanceApi {
             $preCheckProjects = ["①", "②"];
         }
         if ($info["recommendAllowanceType"] == 1 && (!$set || count($set) < 6) && in_array($sort, $preCheckProjects)) {
-            $info["recommendAllowanceType"] = 2;
+            $info["recommendAllowanceType"] = 3;
             $info["recommendAllowanceMsg"][] = $sort . $name . "不足6个月,无法享受工作津贴(×)";
         }
         return $set;

+ 11 - 0
app/common/controller/Batch.php

@@ -5,6 +5,7 @@ namespace app\common\controller;
 use app\BaseController;
 use app\common\middleware\Auth;
 use app\common\api\BatchApi;
+use app\common\state\ProjectState;
 
 /**
  * Description of Batch
@@ -17,6 +18,16 @@ class Batch extends BaseController {
 
     public function checkBatchValid() {
         $user = session("user");
+        if ($this->request["id"] && $this->request["type"]) {
+            $params = [];
+            switch ($this->request["type"]) {
+                case ProjectState::HOUSE:
+                    $info = \app\common\api\HouseApi::getInfoById($this->request["id"]);
+                    $params = ["type" => $this->request["type"], "year" => $info["year"], "first_submit_time" => $info["firstSubmitTime"]];
+                    break;
+            }
+            return json(BatchApi::checkBatchValid($params, $user["type"]));
+        }
         return json(BatchApi::checkBatchValid($this->request->param(), $user["type"]));
     }
 

+ 101 - 91
app/enterprise/controller/House.php

@@ -37,6 +37,7 @@ class House extends EnterpriseController {
         $where = [];
         $where[] = ["type", "=", $this->user["type"]];
         $where[] = ["enterpriseId", "=", $this->user["uid"]];
+        $where[] = ["delete", "=", 0];
         if ($params["year"]) {
             $where[] = ["year", "=", $params["year"]];
         }
@@ -99,7 +100,7 @@ class House extends EnterpriseController {
             $info = HouseApi::getInfoById($id);
             $childrenList = HouseApi::getChildren($id);
             $houseInfo = HouseApi::getHouseInfo($info["idCard"]);
-            $dicts = DictApi::selectByParentCode("card_type");
+            $dicts = DictApi::findChildDictByCode("card_type");
             $vars["dicts"] = $dicts;
             $vars["row"] = $info;
             $vars["hand"] = $houseInfo ? 2 : 1;
@@ -115,9 +116,10 @@ class House extends EnterpriseController {
     }
 
     public function detail(\think\Request $request) {
+        $id = $this->request["id"];
         $info = HouseApi::getInfoById($id);
         $childrenList = HouseApi::getChildren($id);
-        $dicts = DictApi::selectByParentCode("card_type");
+        $dicts = DictApi::findChildDictByCode("card_type");
         $vars["dicts"] = $dicts;
         $vars["row"] = $info;
         $vars["childrenList"] = $childrenList;
@@ -125,67 +127,6 @@ class House extends EnterpriseController {
         return view("", $vars);
     }
 
-    private function other_validate(&$info, $type) {
-        //校验配偶是否在库
-        if ($info["spouseIsLibrary"] && $info["spouseIsLibrary"] == 1) {
-            if (\StrUtil::isEmpOrNull($info["spouseIdcard"])) {
-                return new Response(Response::ERROR, "请填写配偶证件号码");
-            }
-            if (\StrUtil::isEmpOrNull($info["spouseName"])) {
-                return new Response(Response::ERROR, "请填写配偶姓名");
-            }
-            $where = [];
-            $where[] = ["card_number", "=", $info["spouseIdcard"]];
-            $where[] = ["name", "=", $info["spouseName"]];
-            $where[] = ["checkState", "=", \app\common\api\TalentState::CERTIFICATED];
-            $where[] = ["isEffect", "<>", 4];
-            $where[] = ["delete", "=", 0];
-            $count = Db::table("new_talent_info")->where($where)->count();
-            if ($count == 0) {
-                return new Response(Response::ERROR, "人才库中未查询到配偶相关信息");
-            }
-        }
-        $ti = \app\common\api\VerifyApi::getTalentInfoById($info["talentId"]);
-        $info["provinceCode"] = $ti["province"];
-        $info["provinceName"] = $ti["provinceName"];
-        $info["cityCode"] = $ti["city"];
-        $info["cityName"] = $ti["cityName"];
-        $info["countyCode"] = $ti["county"];
-        $info["countyName"] = $ti["countyName"];
-        $info["street"] = $ti["street"];
-        $info["bank"] = $ti["bank"];
-        $info["bankAccount"] = $ti["bank_account"];
-        $info["bankNetwork"] = $ti["bank_branch_name"];
-        $info["bankNumber"] = $ti["bank_number"];
-        /*         * 校验上一年度人才层次 */
-        if ($type == 1) {
-            $responseObj = $this->getTalentArrange($ti, $info["year"]);
-            if ($responseObj->code == 500) {
-                return $responseObj;
-            }
-            $resInfo = $responseObj->obj;
-            $info["talentArrange"] = $resInfo["talentArrange"];
-            $info["identifyCondition"] = $resInfo["identifyCondition"];
-            $info["idenfityConditionName"] = $resInfo["identifyConditionName"];
-            $info["identifyGetTime"] = $resInfo["identifyGetTime"];
-
-            //设置上一年度人才层次有效月份
-            $info["monthCount"] = count($resInfo["monthList"]);
-            if ($info["monthCount"] < 9) {
-                return new Response(Response::ERROR, "申报年度人才证书有效期未满足九个月,无法申报购房补贴");
-            }
-            $info["talentArrangeMonths"] = implode(",", $resInfo["monthList"]);
-        }
-        return new Response(Response::SUCCESS, "");
-    }
-
-    private function validateIsEdit($checkState) {
-        if ($checkState != MainState::SAVE && $checkState != MainState::FIRST_REJECT) {
-            return new Response(Response::ERROR, "正在审核中,无法修改");
-        }
-        return new Response(Response::SUCCESS, "");
-    }
-
     /**
      * 提交表单
      */
@@ -281,6 +222,7 @@ class House extends EnterpriseController {
     }
 
     public function save($info, \think\Request $request) {
+        Db::startTrans();
         try {
             $batch = BatchApi::checkBatchValid(["type" => ProjectState::HOUSE, "year" => $info["year"], "first_submit_time" => $info["firstSubmitTime"]], $this->user["type"]);
 
@@ -309,6 +251,8 @@ class House extends EnterpriseController {
                     throw new ValidateException("没有对应的人才认定申报信息");
                 }
                 $data["checkState"] = $info["checkState"];
+                $data["updateUser"] = $this->user["uid"];
+                $data["updateTime"] = date("Y-m-d H:i:s");
             } else {
                 $data["id"] = getStringId();
                 $data["checkState"] = MainState::SAVE;
@@ -325,24 +269,23 @@ class House extends EnterpriseController {
             unset($data["jstime"]);
             unset($data["childList"]);
             if ($id) {
-                $res = houseModel::update($data);
+                $res = Db::table("un_housepurchase")->update($data);
             } else {
-                $res = houseModel::insertGetId($data);
+                $res = Db::table("un_housepurchase")->insert($data);
             }
             foreach ($childList as &$children) {
                 $children["pId"] = $data["id"];
                 if (\StrUtil::isEmpOrNull($children["id"])) {
                     $children["id"] = getStringId();
                     $children["createTime"] = date("Y-m-d H:i:s");
+                    Db::table("un_housepurchase_children")->insert($children);
                 } else {
                     $children["updateTime"] = date("Y-m-d H:i:s");
+                    $res = Db::table("un_housepurchase_children")->update($children);
                 }
-            }
-            if ($childList) {
-                \app\common\model\HousePurchaseChildren::insertAll($childList);
-            }
+            }unset($children);
             //添加日志
-            \app\common\model\TalentChecklog::create([
+            Db::table("new_talent_checklog")->insert([
                 'id' => getStringId(),
                 'mainId' => $data['id'],
                 'type' => intval(ProjectState::HOUSE),
@@ -355,10 +298,14 @@ class House extends EnterpriseController {
                 'createTime' => date("Y-m-d H:i:s", time()),
                 'createUser' => "申报用户"
             ]);
+            $data["childList"] = $childList;
+            Db::commit();
             return json(new Response(Response::SUCCESS, "添加成功", $data));
         } catch (ValidateException $e) {
+            Db::rollback();
             return json(new Response(Response::ERROR, $e->getMessage()));
         } catch (\think\Exception $e) {
+            Db::rollback();
             $logInfo = [
                 "enterprise_id" => $this->user["uid"],
                 "data" => $data,
@@ -372,31 +319,33 @@ class House extends EnterpriseController {
         }
     }
 
-    public function delete() {
-        $id = $this->request->param("id");
-        $info = CommonLaApi::getInfoById($id);
-        if (!$info || $info["enterpriseId"] != $this->user["uid"]) {
-            return json(["msg" => "操作失败"]);
+    public function deleteChildren($id) {
+        if (\StrUtil::isEmpOrNull($id)) {
+            return new Response(Response::ERROR, "删除失败,系统错误");
         }
-        $checkState = $info["checkState"];
-        if ($checkState != LaState::LA_SAVE) {
-            return json(["msg" => "该申报已提交审核,无法删除"]);
+        $obj = HouseApi::getChildrenById($id);
+        $housePurchase = HouseApi::getInfoById($obj["pId"]);
+        if ($housePurchase["checkState"] != 1 && $housePurchase["checkState"] != 10) {
+            return new Response(Response::ERROR, "正在审核中,无法删除");
         }
-        TalentModel::delete($id);
-
-        $where = [["mainId", "=", $id], ["type", "=", ProjectState::LIVINGALLOWANCE]];
-        $list = Db::table("new_talent_file")->where($where)->select()->toArray();
-        foreach ($list as $key => $file) {
-            if (!empty($file["url"])) {
-                $filepath = "storage/" . $file["url"];
-                if (file_exists($filepath)) {
-                    @unlink($filepath);
-                }
-            }
+        if (HouseApi::deleteChildrenById($id)) {
+            return new Response(Response::SUCCESS, "删除成功");
+        }
+        return new Response(Response::ERROR, "删除失败");
+    }
 
-            Db::table("new_talent_file")->delete($file["id"]);
+    public function delete($id) {
+        if (\StrUtil::isEmpOrNull($id)) {
+            return new Response(Response::ERROR, "删除失败,系统错误");
+        }
+        $obj = HouseApi::getInfoById($id);
+        if ($obj["checkState"] != 1) {
+            return new Response(Response::ERROR, "已提交审核,无法删除");
         }
-        return json(["msg" => "删除成功"]);
+        if (HouseApi::deleteById($id)) {
+            return new Response(Response::SUCCESS, "删除成功");
+        }
+        return new Response(Response::ERROR, "删除失败");
     }
 
     public function getTalentInfo($id, $year, $declareType) {
@@ -418,6 +367,67 @@ class House extends EnterpriseController {
         return new Response(Response::SUCCESS, "", ["talentInfo" => $ti, "houseInfo" => $houseInfo]);
     }
 
+    private function other_validate(&$info, $type) {
+        //校验配偶是否在库
+        if ($info["spouseIsLibrary"] && $info["spouseIsLibrary"] == 1) {
+            if (\StrUtil::isEmpOrNull($info["spouseIdcard"])) {
+                return new Response(Response::ERROR, "请填写配偶证件号码");
+            }
+            if (\StrUtil::isEmpOrNull($info["spouseName"])) {
+                return new Response(Response::ERROR, "请填写配偶姓名");
+            }
+            $where = [];
+            $where[] = ["card_number", "=", $info["spouseIdcard"]];
+            $where[] = ["name", "=", $info["spouseName"]];
+            $where[] = ["checkState", "=", \app\common\api\TalentState::CERTIFICATED];
+            $where[] = ["isEffect", "<>", 4];
+            $where[] = ["delete", "=", 0];
+            $count = Db::table("new_talent_info")->where($where)->count();
+            if ($count == 0) {
+                return new Response(Response::ERROR, "人才库中未查询到配偶相关信息");
+            }
+        }
+        $ti = \app\common\api\VerifyApi::getTalentInfoById($info["talentId"]);
+        $info["provinceCode"] = $ti["province"];
+        $info["provinceName"] = $ti["provinceName"];
+        $info["cityCode"] = $ti["city"];
+        $info["cityName"] = $ti["cityName"];
+        $info["countyCode"] = $ti["county"];
+        $info["countyName"] = $ti["countyName"];
+        $info["street"] = $ti["street"];
+        $info["bank"] = $ti["bank"];
+        $info["bankAccount"] = $ti["bank_account"];
+        $info["bankNetwork"] = $ti["bank_branch_name"];
+        $info["bankNumber"] = $ti["bank_number"];
+        /*         * 校验上一年度人才层次 */
+        if ($type == 1) {
+            $responseObj = $this->getTalentArrange($ti, $info["year"]);
+            if ($responseObj->code == 500) {
+                return $responseObj;
+            }
+            $resInfo = $responseObj->obj;
+            $info["talentArrange"] = $resInfo["talentArrange"];
+            $info["identifyCondition"] = $resInfo["identifyCondition"];
+            $info["idenfityConditionName"] = $resInfo["identifyConditionName"];
+            $info["identifyGetTime"] = $resInfo["identifyGetTime"];
+
+            //设置上一年度人才层次有效月份
+            $info["monthCount"] = count($resInfo["monthList"]);
+            if ($info["monthCount"] < 9) {
+                return new Response(Response::ERROR, "申报年度人才证书有效期未满足九个月,无法申报购房补贴");
+            }
+            $info["talentArrangeMonths"] = implode(",", $resInfo["monthList"]);
+        }
+        return new Response(Response::SUCCESS, "");
+    }
+
+    private function validateIsEdit($checkState) {
+        if ($checkState != MainState::SAVE && $checkState != MainState::FIRST_REJECT) {
+            return new Response(Response::ERROR, "正在审核中,无法修改");
+        }
+        return new Response(Response::SUCCESS, "");
+    }
+
     /**
      * @param talentInfo
      * @param year

+ 1 - 0
app/enterprise/controller/Talent.php

@@ -1706,6 +1706,7 @@ class Talent extends EnterpriseController {
         } else if ($type == 2) {    //购房补贴
             $where = [];
             $where[] = ["year", "=", $year];
+            $where[] = ["delete", "=", 0];
             $where[] = ["enterpriseId", "=", $this->user["uid"]];
             $housePurchases = \app\common\model\HousePurchase::where($where)->select()->toArray();
             $ids = array_unique(array_column($housePurchases, "talentId"));

+ 0 - 34
app/enterprise/validate/HouseValidator.php

@@ -92,38 +92,4 @@ class HouseValidator extends Validate {
         return true;
     }
 
-    protected function checkRangeDate($value, $rule, $data = []) {
-        $title = "";
-        $format = "[yyyy-MM-dd - yyyy-MM-dd]";
-        $str = "日期";
-        switch ($rule) {
-            case "tax_insurance_month":
-                $format = "[yyyy-MM - yyyy-MM]";
-                $str = "月份";
-                if ($data["talent_type"] == 1) {
-                    $title = "缴交社会保险或个人所得税月份";
-                }
-                if ($data["talent_type"] == 2) {
-                    $title = "首次在我市缴交社会保险或个人所得税月份";
-                }
-                break;
-            case "labor_contract_rangetime":
-                $title = "劳动合同起止时间";
-                break;
-            case "salary_pay_month":
-                $format = "[yyyy-MM - yyyy-MM]";
-                $str = "月份";
-                $title = "工资发放月份";
-                break;
-        }
-        $arr = explode(" - ", $value);
-        $chk1 = strtotime($arr[0]);
-        $chk2 = strtotime($arr[1]);
-        if (!$chk1 || !$chk2)
-            return "{$title}日期范围格式应为{$format}";
-        if ($chk1 > $chk2)
-            return "{$title}起始{$str}不能大于结束{$str}";
-        return true;
-    }
-
 }

+ 1 - 1
public/static/modular/gate/house/housepurchase.js

@@ -233,7 +233,7 @@ Housepurchase.delete = function () {
             }, function (data) {
                 Feng.error("删除失败!" + data.responseJSON.message + "!");
             });
-            ajax.set("housepurchaseId", Housepurchase.seItem.id);
+            ajax.set("id", Housepurchase.seItem.id);
             ajax.start();
         }
         Feng.confirm("删除后无法恢复,确认删除吗?", operation);

+ 3 - 3
public/static/modular/gate/house/housepurchase_info.js

@@ -285,7 +285,7 @@ HousepurchaseInfoDlg.reduceChild = function (context) {
         if (!validateIsEdit())
             return;
         var operation = function () {
-            var ajax = new $ax(Feng.ctxPath + "/api/housepurchase/deleteChildren", function (data) {
+            var ajax = new $ax(Feng.ctxPath + "/enterprise/house/deleteChildren", function (data) {
                 if (data.code == 200) {
                     $(context).parent().remove();
                     Feng.success(data.msg);
@@ -494,10 +494,10 @@ HousepurchaseInfoDlg.initChildData = function (list) {
 HousepurchaseInfoDlg.submitToCheck = function () {
     if (!validateIsEdit())
         return;
-    var ajax = new $ax(Feng.ctxPath + "/api/housepurchase/valiateIsSubmit", function (data) {
+    var ajax = new $ax("/common/batch/checkBatchValid", function (data) {
         if (data.code == 200) {
             var operation = function () {
-                var ajax = new $ax(Feng.ctxPath + "/api/housepurchase/submitToCheck", function (data) {
+                var ajax = new $ax(Feng.ctxPath + "/enterprise/house/submitToCheck", function (data) {
                     if (data.code == 200) {
                         Feng.success(data.msg);
                         window.parent.Housepurchase.table.refresh();

+ 7 - 14
public/static/modular/gate/house/housepurchase_select.js

@@ -205,7 +205,7 @@ HousepurchaseInfoDlg.getIdentifyCondition = function(){
         "displayCode": "id",
         "displayName": "name",
         "type": "GET",
-        "url": Feng.ctxPath + "/api/common/findIdentifyConditionByLevel?talentLevel="+level
+        "url": Feng.ctxPath + "/common/api/findIdentifyConditionByLevel?level="+level
     });
 }
 
@@ -238,21 +238,14 @@ function validUploadButton(type,row,fileId){
 
 
 $(function() {
-    Feng.addAjaxSelect({
-        "id": 'talentId',
-        "displayCode": "id",
-        "displayName": "name",
-        "type": "GET",
-        "url": Feng.ctxPath + "/api/talentInfo/findTalentByEnterpriseInLibrary?type=2&year="+$("#year").val()
-    });
     //批量加载字典表数据
     var arr = [
-        {"name":"cardType","code":"un_cardType"},
-        {"name":"spouseCardType","code":"un_cardType"},
-        {"name":"childCardType","code":"un_cardType"},
-        {"name":"marryStatus","code":"un_marryStatus"},
-        {"name":"talentArrange","code":"un_talentLevel"},
-        {"name":"street","code":"un_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));
     $(".other_talentArrange").empty().append($("#talentArrange").html());
     loadProvince();