private function removeCache()
 {
     $cache = Cache::getAdapter();
     $cache->removeItem(ProjectService::CACHE_KEY_WEEK);
     $cache->removeItem(ProjectService::CACHE_KEY_SUM);
     $cache->removeItem(UserService::CACHE_KEY_WEEK);
     $cache->removeItem(UserService::CACHE_KEY_MONTH);
     $memberIds = Factory::getInstance()->getUserRepository()->getUserIds();
     foreach ($memberIds as $id) {
         $cache->removeItem(UserService::CACHE_KEY_WEEK_USER . '-' . $id);
         $cache->removeItem(UserService::CACHE_KEY_MONTH_USER . '-' . $id);
     }
 }
 public function getProjectsSumData()
 {
     $cache = Cache::getAdapter();
     $result = $cache->getItem(self::CACHE_KEY_SUM, $success);
     if ($success) {
         return unserialize($result);
     } else {
         $projectRows = Factory::getInstance()->getProjectRepository()->getAll();
         $projects = Ginq::from($projectRows)->orderBy(function ($projectRow) {
             return $projectRow['archived'] == true ? 1 : 0;
         })->thenBy(function ($projectRow) {
             return $projectRow['id'];
         })->renum()->toArray();
         $result = Ginq::from($projects)->select(function ($project) {
             $issues = Factory::getInstance()->getIssueRepository()->getIssueByProjectId($project['id']);
             $estimatedHours = Ginq::from($issues)->sum(function ($issue) {
                 return $issue['estimatedHours'];
             });
             $actualHours = Ginq::from($issues)->sum(function ($issue) {
                 return $issue['actualHours'];
             });
             $backlogUrl = 'https://' . AbstractRepository::$spaceName . '.backlog.jp/gantt/' . $project['projectKey'];
             $projectSumInfo = new ProjectSumInfo();
             $projectSumInfo->setProjectName($project['name']);
             $archived = $project['archived'] === true ? '◯' : '';
             $projectSumInfo->setArchived($archived);
             $orderAmount = OrderAmount::getOrderAmountByProjectKey($project['projectKey']);
             $totalManHour = OrderAmount::getTotalManHourByProjectKey($project['projectKey']);
             $projectSumInfo->setTotalManHour($totalManHour);
             $outsourcingCost = OrderAmount::getOutsourcingByProjectKey($project['projectKey']);
             $projectSumInfo->setOutsourcingCost($outsourcingCost);
             $projectSumInfo->setOrderAmount($orderAmount);
             $projectSumInfo->setSumEstimatedHours($estimatedHours);
             $projectSumInfo->setSumActualHours($actualHours);
             $estimatedCost = (int) $estimatedHours * Cost::getCostPerHourPerPerson();
             $projectSumInfo->setSumEstimatedCost($estimatedCost);
             $actualCost = $actualHours * Cost::getCostPerHourPerPerson();
             $projectSumInfo->setSumActualCost($actualCost);
             $projectSumInfo->setBackLogUrl($backlogUrl);
             $projectSumInfo->setCostCompare($orderAmount - $actualCost - $outsourcingCost);
             return $projectSumInfo;
         })->toArray();
         $cache->setItem(self::CACHE_KEY_SUM, serialize($result));
     }
     return $result;
 }
 public function getMemberMonthDetailData($userId)
 {
     $cache = Cache::getAdapter();
     $result = $cache->getItem(self::CACHE_KEY_MONTH_USER . '-' . $userId, $success);
     if ($success) {
         return unserialize($result);
     } else {
         $issues = Factory::getInstance()->getIssueRepository()->getIssueByProjectIdAndStartMonthDate($userId);
         $result = Ginq::from($issues)->select(function ($issue) {
             $project = Factory::getInstance()->getProjectRepository()->getProjectByPk($issue['projectId']);
             $userDetail = new UserDetail();
             $userDetail->setProjectName($project['name']);
             $userDetail->setThisWeekEstimatedHours($issue['estimatedHours']);
             $userDetail->setThisWeekActualHours($issue['actualHours']);
             $userDetail->setSummary($issue['summary']);
             $userDetail->setPriority($issue['priority']['name']);
             $userDetail->setStatus($issue['status']['name']);
             return $userDetail;
         })->toArray();
         $cache->setItem(self::CACHE_KEY_MONTH_USER . '-' . $userId, serialize($result));
     }
     return $result;
 }