| | |
| | | import com.aps.common.core.web.domain.AjaxResult; |
| | | import com.aps.core.domain.ApsPartPlan; |
| | | import com.aps.core.domain.ApsResourceDateStat; |
| | | import com.aps.core.domain.ApsResourceGroup; |
| | | import com.aps.core.mapper.ApsResourceGroupMapper; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | private ApsPartRouteStatMapper apsPartRouteStatMapper; |
| | | @Autowired |
| | | private ApsResourceGroupMapper resourceGroupMapper; |
| | | @Autowired |
| | | private ApsResourceGroupMapper apsResourceGroupMapper; |
| | | |
| | | /** |
| | | * 查询零件统计表 |
| | |
| | | /*查出所有统计的数据*/ |
| | | AjaxResult result = new AjaxResult(200, "生成成功"); |
| | | List<ApsResourceDateStat> list = apsPartRouteStatMapper.selectResourceDateStat(); |
| | | List<ApsResourceGroup> resourceGroupList = apsResourceGroupMapper.selectApsResourceGroupList(new ApsResourceGroup()); |
| | | if (!list.isEmpty()) { |
| | | /*求出计划的最大时间,没有 设置为当前时间+15天*/ |
| | | ApsResourceDateStat apsResourceDateStat = list.stream().max(Comparator.comparing(ApsResourceDateStat::getPlanDay)).orElse(null); |
| | |
| | | startDay = startDay.plus(1, ChronoUnit.DAYS); |
| | | } |
| | | /*组织出列头数据*/ |
| | | List<String> resourceNames =list.stream().map(ApsResourceDateStat::getResourceName).distinct().toList(); |
| | | |
| | | /*准备资源组信息*/ |
| | | List<Map<String, List<ApsResourceDateStat>>> targetList = new ArrayList<>(); |
| | | resourceNames.forEach(resourceName -> { |
| | | resourceGroupList.forEach(resourceGroup -> { |
| | | String resourceName=resourceGroup.getResourceGroupName(); |
| | | /*根据日期表头的顺序,组织出每个日期下的统计项目*/ |
| | | Map<String, List<ApsResourceDateStat>> maps = new HashMap<>(Map.of()); |
| | | List<ApsResourceDateStat> currentDaysResouces=new ArrayList<>(); |
| | |
| | | else { |
| | | ApsResourceDateStat empty = new ApsResourceDateStat(); |
| | | empty.setPlanDay(LocalDate.parse(planDay, formatter)); |
| | | empty.setDesignTimes(0); |
| | | empty.setDesignTimes(resourceGroup.getDevicesQuantity().intValue()*resourceGroup.getTheoryHours().intValue()); |
| | | empty.setRequireTimes(0); |
| | | empty.setResourceName(resourceName); |
| | | empty.setResourceGroupName(resourceName); |