Browse Source

购房补贴++

sugangqiang 10 months ago
parent
commit
aee070321b

+ 102 - 2
app/enterprise/controller/House.php

@@ -13,6 +13,9 @@ use app\common\api\BatchApi;
 use app\common\api\HouseApi;
 use app\common\model\TalentLog;
 use app\common\api\DictApi;
+use app\common\state\CommonConst;
+use app\common\state\MainState;
+use app\common\api\Response;
 
 /**
  * Description of House
@@ -412,8 +415,105 @@ class House extends EnterpriseController {
         return json(["msg" => "删除成功"]);
     }
 
-    public function getTalentInfo($id) {
-        
+    public function getTalentInfo($id, $year, $declareType) {
+        $ti = \app\common\api\VerifyApi::getTalentInfoById($id);
+        if ($ti["enterpriseType"] == CommonConst::ENTERPRISE_NORMAL) {
+            $response = $this->getTalentArrange($ti, $year);
+            if ($response->code == 500) {
+                return $response;
+            }
+        }
+        if (en . getType() == 1) {
+            /* List<String> totalMonth = DateUtil.getMonthBetweenDates(year + "-01-01", year + "-12-31");
+              TalentInfo resInfo = (TalentInfo) responseObj.getObj();
+              ti.setTalentArrange(resInfo.getTalentArrange());
+              ti.setIdentifyCondition(resInfo.getIdentifyCondition());
+              ti.setIdentifyConditionName(resInfo.getIdentifyConditionName());
+              ti.setIdentifyGetTime(resInfo.getIdentifyGetTime());
+              ti.setCertificateStartTime(resInfo.getCertificateStartTime());
+              ti.setQzgccrcActiveTime(resInfo.getQzgccrcActiveTime());
+              /**校验上一年度人才标签 */
+            /* responseObj = getTalentType(ti, declareType);
+              if (responseObj.getCode() == 500) {
+              return responseObj;
+              }
+              TalentQuit resQuit = (TalentQuit) responseObj.getObj();
+              ti.setTalentType(resQuit.getTalentType()); */
+        }
+        //查询房产库中是否存在房产信息
+        /* Housepurchase housepurchase = new Housepurchase();
+          housepurchase.setIdCard(ti.getIdCard());
+          HousepurchaseHouseInfo houseInfo = HousepurchaseUtil.getHouseInfo(housepurchase.getIdCard());
+          Map<String, Object> res = new HashMap<>();
+          res.put("talentInfo", ti);
+          res.put("houseInfo", houseInfo);
+          return new ResponseObj(ResponseObj.SUCCESS, "", res); */
+    }
+
+    /**
+     * @param talentInfo
+     * @param year
+     * @description 获取上一年度的人才层次,规则如下:上一年度存在多个人才层次则取占比大的人才层次,占比相同则取人才层次高者
+     * @returns com.stylefeng.guns.core.common.model.ResponseObj
+     * @author Liu
+     * @date 2020/5/6
+     * */
+    private function getTalentArrange($talentInfo, $year) {
+        /**
+         * 判定在申报年度内或之前是否认定,申报年度之后认定无效,根据公布入选月份判断(此处还要考虑人才层次变更)
+         */
+        $year = substr($year, 0, 4);
+        $identifyTimeField = "identifyMonth";
+        $oldStartTimeField = "oldIdentifyMonth";
+        $newStartTimeField = "newIdentifyMonth";
+        if ($talentInfo["enterpriseType"] == CommonConst::ENTERPRISE_JC) {
+            $identifyTimeField = "identifyGetTime";
+            $oldStartTimeField = "oldIdentifyGetTime";
+            $newStartTimeField = "newIdentifyGetTime";
+        }
+
+        $where = [];
+        $where[] = ["idCard", "=", $talentInfo["card_number"]];
+        $where[] = ["checkState", "=", MainState::PASS];
+        $where[] = ["isPublic", "=", 6];
+        $where[] = [$oldStartTimeField, "<=", $year . "-12-31"];
+        $typeChanges = TalentTypeChange::where($where)->field("oldTalentArrange,oldIdentifyCondition,oldIdentifyGetTime,oldIdentifyOutTime,oldIdentifyConditionName,oldIdentifyMonth,oldCertificateStartTime,oldCertificateOutTime,newIdentifyMonth,newIdentifyGetTime")->order("createTime desc")->select()->toArray();
+        $jjList = [];
+        $unionList = [];
+        $totalMonth = \DateUtil::getMonthBetweenDates($year . "-01-01", $year . "-12-31");
+        if (!$typeChanges && strtotime($year . "-12-31") > strtotime($talentInfo[$identifyTimeField])) {
+            return new Response(Response::ERROR, "在上一年度未认定优秀人才,无法申报");
+        } else {
+            $typeChanges[] = [
+                "oldTalentArrange" => $talentInfo["talent_arrange"],
+                "oldIdentifyCondition" => $talentInfo["talent_condition"],
+                "oldIdentifyGetTime" => $talentInfo["identifyGetTime"],
+                "oldIdentifyOutTime" => $talentInfo["identifyExpireTime"],
+                "oldIdentifyConditionName" => $talentInfo["identifyConditionName"],
+                "oldIdentifyMonth" => $talentInfo["identifyMonth"],
+                "oldCertificateStartTime" => $talentInfo["certificateGetTime"],
+                "oldCertificateOutTime" => $talentInfo["certificateExpireTime"] ?: date("Y-m-d", strtotime(sprintf("%s +6 years -1 days", $talentInfo["certificateGetTime"]))),
+                "newIdentifyMonth" => ($year + 1) . "-01-01",
+                "newIdentifyGetTime" => ($year + 1) . "-01-01"
+            ];
+            foreach ($typeChanges as $typeChange) {
+                $monthList = \DateUtil::getMonthBetweenDatesNotEnd($typeChange["oldCertificateStartTime"], $typeChange["oldCertificateOutTime"]);
+                $res = \DateUtil::getEveryMonthDayBetween($typeChange["oldCertificateStartTime"], $typeChange["oldCertificateOutTime"], $monthList);
+            }
+
+
+            for (TalentTypeChange typeChange : typeChanges) {
+                List<String> monthList = DateUtil . getMonthBetweenDatesNotEnd(typeChange . getOldCertificateStartTime(), typeChange . getOldCertificateOutTime());
+                Map<String, Integer> res = DateUtil . getEveryMonthDayBetween(typeChange . getOldCertificateStartTime(), typeChange . getOldCertificateOutTime(), monthList);
+                if (res . size() > 0) {
+                    unionList . removeAll(monthList);
+                    unionList . addAll(monthList);
+                    TalentInfo info = new TalentInfo(typeChange . getOldTalentArrange(), typeChange . getOldIdentifyCondition(), typeChange . getOldIdentifyGetTime(), typeChange . getOldIdentifyConditionName(), typeChange . getOldCertificateStartTime(), typeChange . getOldCertificateOutTime(), typeChange . getOldIdentifyMonth());
+                    info . setDayMap(res);
+                    jjList . add(info);
+                }
+            }
+        }
     }
 
 }

+ 1 - 1
app/enterprise/controller/TalentAllowance.php

@@ -509,7 +509,7 @@ class TalentAllowance extends EnterpriseController {
         $where = [];
         $where[] = ["idCard", "=", $info["idCard"]];
         $where[] = ["checkState", "=", MainState::PASS];
-        $where[] = ["isPublic", ">=", 5];
+        $where[] = ["isPublic", "=", 6];
         $where[] = [$oldStartTimeField, "<=", $year . "-12-31"];
         $typeList = TalentTypeChange::where($where)->field("oldTalentArrange,oldIdentifyCondition,oldIdentifyGetTime,oldIdentifyOutTime,oldIdentifyMonth,oldCertificateStartTime,oldCertificateOutTime,newIdentifyMonth,newIdentifyGetTime")->order("createTime desc")->select()->toArray();
 

+ 1 - 1
app/job/TalentAllowance.php

@@ -200,7 +200,7 @@ class TalentAllowance {
         $where = [];
         $where[] = ["idCard", "=", $info["idCard"]];
         $where[] = ["checkState", "=", MainState::PASS];
-        $where[] = ["isPublic", ">=", 5];
+        $where[] = ["isPublic", "=", 6];
         $where[] = [$oldStartTimeField, "<=", $year . "-12-31"];
         $typeList = TalentTypeChange::where($where)->field("oldTalentArrange,oldIdentifyCondition,oldIdentifyGetTime,oldIdentifyOutTime,oldIdentifyMonth,oldCertificateStartTime,oldCertificateOutTime,newIdentifyMonth,newIdentifyGetTime")->order("createTime desc")->select()->toArray();
         $typeList[] = [

+ 28 - 0
extend/DateUtil.php

@@ -57,4 +57,32 @@ class DateUtil {
         return $months;
     }
 
+    public static function getEveryMonthDayBetween($startTime, $endTime, $monthList) {
+        $res = [];
+        $sdf = new DateTimeFormatter('yyyy-MM-dd');
+
+        $min = new DateTime($startTime);
+        $min->setTime(0, 0, 0);
+
+        $max = new DateTime($endTime);
+        $max->setTime(23, 59, 59);
+
+        $curr = clone $min;
+
+        while ($curr < $max) {
+            $month = $curr->format('Y-m');
+
+            if (in_array($month, $monthList)) {
+                if (!isset($res[$month])) {
+                    $res[$month] = 0;
+                }
+                $res[$month] ++;
+            }
+
+            $curr->modify('+1 day');
+        }
+
+        return $res;
+    }
+
 }

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

@@ -360,7 +360,7 @@ HousepurchaseInfoDlg.addSubmit = function () {
             $("#type").val(obj.type);
             $("#fileLi").removeAttr("style");
             $("#checkState").val(obj.checkState);
-            $("#talentId").prop("disabled", true).trigger("chosen:updated");
+            $("#name").prop("disabled", true).trigger("chosen:updated");
             HousepurchaseInfoDlg.initChildData(childList);
         } else {
             Feng.info(data.msg);
@@ -735,10 +735,10 @@ $(function () {
         Feng.getCheckLog("logTable", {"type": CONFIG.project_house, "mainId": id, "typeFileId": "", "active": 1})
     } else {
         $("#fileLi").attr("style", "pointer-events: none");
-        $("#talentId").on('chosen:ready', function (e, params) {
+        $("#name").on('chosen:ready', function (e, params) {
             $(".chosen-container-single .chosen-single").css("padding", "4px 0px 0px 4px");
         });
-        $("#talentId").chosen({
+        $("#name").chosen({
             search_contains: true,       //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
             disable_search: false,
             width: "100%",