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 setViewData()
 {
     $projectService = Factory::getInstance()->getProjectService();
     $projects = $projectService->getProjectsSumData();
     $this->setVariables(['projects' => $projects, 'perHourPerPerson' => Cost::getCostPerHourPerPerson()], true);
 }