sugangqiang 1 سال پیش
والد
کامیت
ec772feb20
1فایلهای تغییر یافته به همراه311 افزوده شده و 44 حذف شده
  1. 311 44
      app/admin/controller/TalentAllowance.php

+ 311 - 44
app/admin/controller/TalentAllowance.php

@@ -227,7 +227,7 @@ class TalentAllowance extends AdminController {
                         $updCheck["checkState"] = AllowanceStateEnum::REVIEW_PASS;
                         $updCheck["reviewPassTime"] = date("Y-m-d H:i:s");
                         /*                         * * 在此处需要判断津补贴类型 */
-                        $arrangeList = $this->validateAllowanceType(&$updCheck);
+                        $arrangeList = $this->validateAllowanceType($updCheck);
                         TalentAllowanceArrange::update($arrangeList);
                         break;
                     case 2:
@@ -269,7 +269,7 @@ class TalentAllowance extends AdminController {
         return new Response(Response::SUCCESS, "提交审核成功");
     }
 
-    private function validateAllowanceType($info) {
+    private function validateAllowanceType(&$info) {
         $old = TalentAllowanceApi::getInfoById($info["id"]);
         $talentTypeMap = DictApi::selectByParentCode("enterprise_tag");
         $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
@@ -278,23 +278,11 @@ class TalentAllowance extends AdminController {
         $detaiPdList = [];                //用于判定类型
         $detailMonthList = [];            //用于计算月份
         $recommendAllowanceMsg = [];
-        
+
         foreach ($initDetailList as $detail) {
             $projectList = \app\common\model\TalentAllowanceProject::where("baseId", $detail["id"])->select()->toArray();
             $projectMap = [];
             foreach ($projectList as $project) {
-                switch ($project["project"]) {
-                    case AllowanceProjectEnum::PROJECT_TAX:
-                    case AllowanceProjectEnum::PROJECT_WAGES:
-                    case AllowanceProjectEnum::PROJECT_SB_PENSION:
-                    case AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT:
-                    case AllowanceProjectEnum::PROJECT_SB_MEDICA:
-                        break;
-                    case AllowanceProjectEnum::PROJECT_ATTENDANCE:
-                        break;
-                    case AllowanceProjectEnum::PROJECT_WORKDAY:
-                        break;
-                }
                 $projectMap[$project["project"]] = $project;
             }
             $detail["list"] = $projectList;
@@ -305,35 +293,314 @@ class TalentAllowance extends AdminController {
             $detaiPdList[] = $detail;
             $detailMonthList[] = $detail;
         }
-//        /**查询人才标签字典表*/
-//        Set<String> retainMonths = new TreeSet<>((o1, o2) -> {
-//            int o1Int = Integer.parseInt(o1);
-//            int o2Int = Integer.parseInt(o2);
-//            return o1Int - o2Int;
-//        });
-//        /**集成电路优秀人才*/
-//        if($this->user["type"] == 2) {
-//            /**获取各个项目的综合月份*/
-//            Map<Integer, Set<String>> monthMap = $this->mergeMonth($detailMonthList);
-//            Map<Integer, Map<String, Integer>> monthAndDayMap = $this->mergeMonthNeedDay($detailMonthList);
-//            info.setRecommendAllowanceType(1);
-//            info.setRecommendAllowanceMsg("");
-//            TalentInfo talentInfo = this.talentInfoService.selectById(info.getTalentId());
-//            List<TalentAllowanceProject> projectList = this.talentAllowanceProjectService.selectList(new EntityWrapper<TalentAllowanceProject>().eq("mainId", info.getId()));
-//            Set<String> set = AllowanceICDecideUtil.valideAllowanceType(info, talentInfo, projectList, monthMap, monthAndDayMap);
-//            info.setRecommendAllowanceMsg(info.getRecommendAllowanceMsg() + "\n综合以上所有判断得到最终补贴类型为:");
-//            if (info.getRecommendAllowanceType() == 1) {
-//                info.setRecommendAllowanceMsg(info.getRecommendAllowanceMsg() + "人才津贴;可享受月份为:" + set.stream().collect(Collectors.joining(",")) + "\n");
-//            }
-//            if (info.getRecommendAllowanceType() == 2)
-//                info.setRecommendAllowanceMsg(info.getRecommendAllowanceMsg() + "一次性交通补贴;");
-//            if (info.getRecommendAllowanceType() == 3)
-//                info.setRecommendAllowanceMsg(info.getRecommendAllowanceMsg() + "不予兑现;");
-//            retainMonths.addAll(set);
-//        }
-//        info.setRecommendMonths(StringUtils.join(retainMonths.toArray(), ","));
-//        List<TalentAllowanceArrange> arrangeList = calculateAllowance(info, retainMonths, detailMonthList);
-//        return arrangeList;
+        /*         * 集成电路优秀人才 */
+        if ($this->user["type"] == 2) {
+            /*             * 获取各个项目的综合月份 */
+            $monthMap = $this->mergeMonth($detailMonthList);
+            $monthAndDayMap = $this->mergeMonthNeedDay($detailMonthList);
+            $info["recommendAllowanceType"] = 1;
+            $info["recommendAllowanceMsg"] = "";
+            $projectList = \app\common\model\TalentAllowanceProject::where("mainId", $info["id"])->select()->toArray();
+            $set = $this->valideAllowanceType($info, $projectList, $monthMap, $monthAndDayMap);
+            $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n综合以上所有判断得到最终补贴类型为:";
+            if ($info["recommendAllowanceType"] == 1) {
+                $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "工作津贴;可享受月份为:" . implode(",", $set) . "\n";
+            }
+            if ($info["recommendAllowanceType"] == 2)
+                $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "一次性交通补贴;";
+            if ($info["recommendAllowanceType"] == 3)
+                $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "不予兑现;";
+            usort($set, function($a, $b) {
+                return (int) $a - (int) $b;
+            });
+        }
+        $info["recommendMonths"] = implode(",", $set);
+        $arrangeList = $this->calculateAllowance($info, $set, $detailMonthList);
+        return $arrangeList;
+    }
+
+    /**
+     * 集成电路津补贴总校验
+     * */
+    private function valideAllowanceType(&$info, $projectList, $monthMap, $monthAndDayMap) {
+        $set = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"];
+        /*         * 2.判定工作月份、五险和个税是否满足重叠6个月要求* */
+        $workdaySet = $this->chkMonths($monthMap[AllowanceProjectEnum::PROJECT_WORKDAY], $info, "上年度工作月份", "①");
+        $pensionSet = $this->chkMonths($monthMap[AllowanceProjectEnum::PROJECT_SB_PENSION], $info, "养老保险", "②");
+        $injurySet = $this->chkMonths($monthMap[AllowanceProjectEnum::PROJECT_SB_INJURY], $info, "工伤保险", "③");
+        $unemploymentSet = $this->chkMonths($monthMap[AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT], $info, "失业保险", "④");
+        $medicaSet = $this->chkMonths($monthMap[AllowanceProjectEnum::PROJECT_SB_MEDICA], $info, "医疗保险", "⑤");
+        $taxSet = $this->chkMonths($monthMap[AllowanceProjectEnum::PROJECT_TAX], $info, "个税", "⑥");
+        $set = array_intersect($set, $workdaySet);
+        $set = array_intersect($set, $pensionSet);
+        $set = array_intersect($set, $injurySet);
+        $set = array_intersect($set, $unemploymentSet);
+        $set = array_intersect($set, $medicaSet);
+        $set = array_intersect($set, $taxSet);
+        if ($info["recommendAllowanceType"] == 1 && count($set) < 6) {
+            //如果全部满足6个月,但是重叠时间不满足6个月,开始检测是否符合交通补贴要求
+            $info["recommendAllowanceType"] == 2;
+        }
+        if ($info["recommendAllowanceType"] == 2) {
+            //判断境内工作时间是否大于30天
+            $totalDays = 0;
+            $workmonths = $monthAndDayMap[AllowanceProjectEnum::PROJECT_WORKDAY];
+            foreach ($workmonths as $days) {
+                $totalDays += $days;
+            }
+            if ($totalDays < 30) {
+                $info["recommendAllowanceType"] == 3;
+                $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n全年在我市工作仅{$totalDays}天,未达到30天,无法享受一次性交通津贴(×)";
+            }
+        }
+        return $set;
+    }
+    
+    /**
+     * 计算津补贴
+     */
+    private function calculateAllowance(&$info, $retainMonths, $detailMonthList) {
+        /**查询人才层次变更记录*/
+        List<TalentAllowanceArrange> arrangeList = this.talentAllowanceArrangeService.selectListAndAmount(new EntityWrapper<TalentAllowanceArrange>().eq("mainId", info.getId()).orderBy("talentArrange"));
+        AmountStandard amountStandard = this.amountStandardService.selectOne(new EntityWrapper<AmountStandard>().eq("type", 1).eq("allowanceType", 1).eq("talentArrange", "4"));
+        /*** 容器*/
+        BigDecimal jobMoney = BigDecimal.ZERO;               //计算所得工作津贴
+        BigDecimal jtMoney = BigDecimal.ZERO;               //计算所得一次性交通补贴
+        Set<String> recommendMonths = new TreeSet<>(new Comparator<String>() {
+            @Override
+            public int compare(String o1, String o2) {
+                int o1Int = Integer.parseInt(o1);
+                int o2Int = Integer.parseInt(o2);
+                return o1Int - o2Int;
+            }
+        });               //推荐月份
+        String talentArrange = null;
+        /***********计算**************/
+        StringBuilder msgBulider = new StringBuilder();
+        switch (info.getRecommendAllowanceType()) {
+            case 1:
+                if (info.getType() == 1) {                //晋江市优秀人才
+                    /**判断判定最终月份和人才层次有效月份是否存在共同月份,不存在则为一次性交通补贴*/
+                    Set<String> totalArrangeMonth = new HashSet<>();
+                    for (TalentAllowanceArrange arrange : arrangeList) {
+                        List<String> levelList = new ArrayList<>(Arrays.asList(arrange.getPrepareMonths().split(",")));
+                        //对于2019年度的津补贴申报人才层次可享受月份均在07-12月
+                        if ("2019".equals(info.getYear())) {
+                            levelList.retainAll(new ArrayList<>(Arrays.asList("07", "08", "09", "10", "11", "12")));
+                        }
+                        totalArrangeMonth.addAll(levelList);
+                    }
+                    totalArrangeMonth.retainAll(retainMonths);
+                    /**对于人才标签中存在在站博士后的需要去除在站博士后计算,在站博士后不考虑人才层次(不予人才层次取交集),默认第四层次*/
+                    for (TalentAllowancecontractDetail detail : detailMonthList) {
+                        if (DictValueConst.TALENTTYPE_ZZBSH.equals(detail.getTalentType())) {
+                            String months = detail.getMonths();
+                            if (FengStringUtil.isNotEmpAndNull(months)) {
+                                List<String> monthsList = new ArrayList<>(Arrays.asList(months.split(",")));
+                                BigDecimal total = amountStandard.getMoney().multiply(new BigDecimal(monthsList.size())).setScale(2, BigDecimal.ROUND_HALF_UP);
+                                jobMoney = jobMoney.add(total);
+                                msgBulider.append(monthsList.size() + "(" + StringUtils.join(monthsList.toArray(), ",") + ")x" + amountStandard.getMoney() + "(第" + amountStandard.getTalentArrange() + "层次)+");
+                                recommendMonths.addAll(monthsList);
+                                retainMonths.removeAll(monthsList);             //去除在站博士后已计算月份
+                                /**当存在在站博士后时无需计算月份和人才层次的交集,此处在交集内加入月份 数据,防止下面if判断导致津贴类型变更*/
+                                totalArrangeMonth.addAll(monthsList);
+                            }
+                        }
+                    }
+                    if (totalArrangeMonth.size() == 0) {
+                        int tempArrange = Integer.parseInt(arrangeList.get(0).getTalentArrange());
+                        if (tempArrange < 6) {
+                            info.setRecommendAllowanceType(2);
+                            info.setRecommendAllowanceMsg(info.getRecommendAllowanceMsg() + "\n由于判定结果月份与人才层次有效月份无交集,因此津贴类型为:一次性交通补贴");
+                        } else {
+                            info.setRecommendAllowanceType(3);
+                            info.setRecommendAllowanceMsg(info.getRecommendAllowanceMsg() + "\n由于判定结果月份与人才层次有效月份无交集且为第" + tempArrange + "层次,因此津贴类型为:不予兑现");
+                        }
+                        return calculateAllowance(info, retainMonths, detailMonthList);
+                    }
+                    if (retainMonths.size() > 0) {
+                        for (TalentAllowanceArrange arrange : arrangeList) {
+                            if (FengStringUtil.isNotEmpAndNull(arrange.getPrepareMonths())) {
+                                List<String> levelList = new ArrayList<>(Arrays.asList(arrange.getPrepareMonths().split(",")));
+                                //对于2019年度的津补贴申报人才层次可享受月份均在07-12月
+                                if ("2019".equals(info.getYear())) {
+                                    levelList.retainAll(new ArrayList<>(Arrays.asList("07", "08", "09", "10", "11", "12")));
+                                }
+                                levelList.retainAll(retainMonths);
+                                BigDecimal total = arrange.getJobMoney().multiply(new BigDecimal(levelList.size())).setScale(2, BigDecimal.ROUND_HALF_UP);
+                                jobMoney = jobMoney.add(total);
+                                msgBulider.append(levelList.size() + "(" + StringUtils.join(levelList.toArray(), ",") + ")x" + arrange.getJobMoney() + "(第" + arrange.getTalentArrange() + "层次)+");
+                                recommendMonths.addAll(levelList);
+                                arrange.setMonths(StringUtils.join(levelList.toArray(), ","));
+                                arrange.setCount(levelList.size());
+                                arrange.setTotal(total);
+                            } else {
+                                msgBulider.append("0()x" + arrange.getJobMoney() + "(第" + arrange.getTalentArrange() + "层次)+");
+                                arrange.setCount(0);
+                                arrange.setTotal(new BigDecimal(0.00));
+                            }
+                        }
+                    }
+                    info.setRecommendMonths(StringUtils.join(recommendMonths.toArray(), ","));
+                    info.setRecommendAllowanceMsg(info.getRecommendAllowanceMsg() + "通过与人才证书有效期取交集得到最终可享受月份:" + StringUtils.join(recommendMonths.toArray(), ",") + "\n经过计算:人才津贴为" + jobMoney + ";");
+                    info.setRecommendMoney(jobMoney);
+                    info.setRecommendMoneyDesc(msgBulider.substring(0, msgBulider.length() - 1));
+                    info.setWorkAllowanceMoney(jobMoney.multiply(new BigDecimal(0.8)).setScale(2, BigDecimal.ROUND_HALF_UP));
+                    info.setDevelopAllowanceMoney(jobMoney.multiply(new BigDecimal(0.2)).setScale(2, BigDecimal.ROUND_HALF_UP));
+                    info.setRecommendAllowanceMsg(info.getRecommendAllowanceMsg() + "工作津贴为" + info.getWorkAllowanceMoney() + ";发展津贴为:" + info.getDevelopAllowanceMoney());
+                    this.talentAllowancecontractDetailService.updateBatchById(detailMonthList);
+                } else if (info.getType() == 2) {          //集成电路优秀人才
+                    for (TalentAllowanceArrange arrange : arrangeList) {
+                        if (FengStringUtil.isNotEmpAndNull(arrange.getPrepareMonths())) {
+                            List<String> levelList = new ArrayList<>(Arrays.asList(arrange.getPrepareMonths().split(",")));
+                            levelList.retainAll(retainMonths);
+                            BigDecimal total = arrange.getJobMoney().multiply(new BigDecimal(levelList.size())).setScale(2, BigDecimal.ROUND_HALF_UP);
+                            jobMoney = jobMoney.add(total);
+                            msgBulider.append(levelList.size() + "(" + StringUtils.join(levelList.toArray(), ",") + ")x" + arrange.getJobMoney() + "(第" + arrange.getTalentArrange() + "层次)+");
+                            recommendMonths.addAll(levelList);
+                            arrange.setMonths(StringUtils.join(levelList.toArray(), ","));
+                            arrange.setCount(levelList.size());
+                            arrange.setTotal(total);
+                        } else {
+                            msgBulider.append("0()x" + arrange.getJobMoney() + "(第" + arrange.getTalentArrange() + "层次)+");
+                            arrange.setCount(0);
+                            arrange.setTotal(new BigDecimal(0.00));
+                        }
+                    }
+                    info.setRecommendMonths(StringUtils.join(recommendMonths.toArray(), ","));
+                    info.setRecommendAllowanceMsg(info.getRecommendAllowanceMsg() + "通过与人才证书有效期取交集得到最终可享受月份:" + StringUtils.join(recommendMonths.toArray(), ",") + "\n经过计算:人才津贴为" + jobMoney + ";");
+                    info.setRecommendMoney(jobMoney);
+                    info.setRecommendMoneyDesc(msgBulider.substring(0, msgBulider.length() - 1));
+                }
+                break;
+            case 2:
+                for (TalentAllowanceArrange arrange : arrangeList) {
+                    Integer intArragnge = Integer.parseInt(arrange.getTalentArrange());
+                    if (FengStringUtil.isNotEmpAndNull(arrange.getPrepareMonths()) && intArragnge <=5) {
+                        if (jtMoney.compareTo(BigDecimal.ZERO) == 0 || arrange.getJtMoney().compareTo(jtMoney) == 1) {
+                            jtMoney = arrange.getJtMoney();
+                            talentArrange = arrange.getTalentArrange();
+                        }
+                    }
+                }
+                info.setRecommendMoney(jtMoney);
+                info.setRecommendMonths("");
+                info.setRecommendMoneyDesc("一次性交通补贴");
+                info.setWorkAllowanceMoney(new BigDecimal(0.00));
+                info.setDevelopAllowanceMoney(new BigDecimal(0.00));
+                info.setRecommendTalentArrange(talentArrange);
+                break;
+            case 3:
+                info.setRecommendMoney(new BigDecimal(0.00));
+                info.setRecommendMoneyDesc("不予兑现");
+                info.setRecommendMonths("");
+                info.setWorkAllowanceMoney(new BigDecimal(0.00));
+                info.setDevelopAllowanceMoney(new BigDecimal(0.00));
+                break;
+        }
+//        this.talentAllowanceArrangeService.updateBatchById(arrangeList);
+        return arrangeList;
+    }
+
+    /**
+     * 判定是否交足6个月(集成电路)
+     * @param set
+     * @param info
+     * @param name
+     */
+    private function chkMonths($set, &$info, $name, $sort) {
+        if ($info["recommendAllowanceType"] == 1 && (!$set || count($set) < 6)) {
+            $info["recommendAllowanceType"] = 2;
+            $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . $sort . $name . "不足6个月,无法享受工作津贴(×)";
+        }
+        return set;
+    }
+
+    //合并所有项目的月份
+    private function mergeMonth($detailList) {
+        $taxList = [];
+        $wagesList = [];
+        $pensionList = [];
+        $unemploymentList = [];
+        $medicaList = [];
+        $attendanceList = [];
+        $workdayList = [];
+        foreach ($detailList as $detail) {
+            $projectMap = $detail["projectMap"];
+            if ($projectMap[AllowanceProjectEnum::PROJECT_TAX] && \StrUtil::isNotEmpAndNull($projectMap[AllowanceProjectEnum::PROJECT_TAX]["months"])) {
+                $tmp = array_filter(explode(",", $projectMap[AllowanceProjectEnum::PROJECT_TAX]["months"]));
+                $taxList = array_merge($taxList, $tmp);
+            }
+            if ($projectMap[AllowanceProjectEnum::PROJECT_WAGES] && \StrUtil::isNotEmpAndNull($projectMap[AllowanceProjectEnum::PROJECT_WAGES]["months"])) {
+                $tmp = array_filter(explode(",", $projectMap[AllowanceProjectEnum::PROJECT_WAGES]["months"]));
+                $wagesList = array_merge($wagesList, $tmp);
+            }
+            if ($projectMap[AllowanceProjectEnum::PROJECT_SB_PENSION] && \StrUtil::isNotEmpAndNull($projectMap[AllowanceProjectEnum::PROJECT_SB_PENSION]["months"])) {
+                $tmp = array_filter(explode(",", $projectMap[AllowanceProjectEnum::PROJECT_SB_PENSION]["months"]));
+                $pensionList = array_merge($pensionList, $tmp);
+            }
+            if ($projectMap[AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT] && \StrUtil::isNotEmpAndNull($projectMap[AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT]["months"])) {
+                $tmp = array_filter(explode(",", $projectMap[AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT]["months"]));
+                $unemploymentList = array_merge($unemploymentList, $tmp);
+            }
+            if ($projectMap[AllowanceProjectEnum::PROJECT_SB_MEDICA] && \StrUtil::isNotEmpAndNull($projectMap[AllowanceProjectEnum::PROJECT_SB_MEDICA]["months"])) {
+                $tmp = array_filter(explode(",", $projectMap[AllowanceProjectEnum::PROJECT_SB_MEDICA]["months"]));
+                $medicaList = array_merge($medicaList, $tmp);
+            }
+            if ($projectMap[AllowanceProjectEnum::PROJECT_ATTENDANCE] && \StrUtil::isNotEmpAndNull($projectMap[AllowanceProjectEnum::PROJECT_ATTENDANCE]["months"])) {
+                $tmp = array_filter(explode(",", $projectMap[AllowanceProjectEnum::PROJECT_ATTENDANCE]["months"]));
+                $attendanceList = array_merge($attendanceList, $tmp);
+            }
+            if ($projectMap[AllowanceProjectEnum::PROJECT_WORKDAY] && \StrUtil::isNotEmpAndNull($projectMap[AllowanceProjectEnum::PROJECT_WORKDAY]["months"])) {
+                $tmp = array_filter(explode(",", $projectMap[AllowanceProjectEnum::PROJECT_WORKDAY]["months"]));
+                $workdayList = array_merge($workdayList, $tmp);
+            }
+        }
+        $map = [
+            AllowanceProjectEnum::PROJECT_TAX => $taxList,
+            AllowanceProjectEnum::PROJECT_WAGES => $wagesList,
+            AllowanceProjectEnum::PROJECT_SB_PENSION => $pensionList,
+            AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT => $unemploymentList,
+            AllowanceProjectEnum::PROJECT_SB_MEDICA => $medicaList,
+            AllowanceProjectEnum::PROJECT_ATTENDANCE => $attendanceList,
+            AllowanceProjectEnum::PROJECT_WORKDAY => $workdayList,
+        ];
+        return $map;
+    }
+
+    /**
+     * 合并多个单位带有天数的项目的月份如考勤1月30天,
+     * */
+    private function mergeMonthNeedDay($detailList) {
+        $attendMap = [];
+        $workDayMap = [];
+        foreach ($detailList as $detail) {
+            $attendMap = $this->getMergeMonthNeedDayMap($detail["projectMap"][AllowanceProjectEnum::PROJECT_ATTENDANCE], $attendMap);
+            $workDayMap = $this->getMergeMonthNeedDayMap($detail["projectMap"][AllowanceProjectEnum::PROJECT_WORKDAY], $workDayMap);
+        }
+        $res = [
+            AllowanceProjectEnum::PROJECT_ATTENDANCE => $attendMap,
+            AllowanceProjectEnum::PROJECT_WORKDAY => $workDayMap
+        ];
+        return $res;
+    }
+
+    private function getMergeMonthNeedDayMap($project, $map) {
+        if (\StrUtil::isNotEmpAndNull($project["months"])) {
+            $monthAndDayList = array_filter(explode(",", $project["months"]));
+            for ($i = 0; $i < count($monthAndDayList); $i++) {
+                $obj = explode("=", $monthAndDayList[$i]);
+                $month = $obj[0];
+                $day = $obj[1];
+                $count = $map[$month];
+                if ($count == 0) {
+                    $map[$month] = $day;
+                } else {
+                    $map[$month] = $day + $count;
+                }
+            }
+        }
+        return $map;
     }
 
     /**